- modules/fotolab updated imagej to current version & some cod fixes to make it work
[care2x.git] / Care2007 / include / inc_news_get.php
blob4cc3fe234a73a02b33cc592d4fc30d93c6c71fa3
1 <?php
2 /*------begin------ This protection code was suggested by Luki R. luki@karet.org ---- */
3 if (eregi("inc_news_get.php",$PHP_SELF))
4 die('<meta http-equiv="refresh" content="0; url=../">');
5 /*------end------*/
7 $dbtable='care_news_article';
8 $today=date('Y-m-d');
10 /* Establish db connection */
11 if(!isset($db) || !$db) include_once($root_path.'include/inc_db_makelink.php');
13 if($dblink_ok)
16 $str_sql="SELECT nr,title,preface,body,pic_mime FROM ".$dbtable."
17 WHERE dept_nr=".$dept_nr;
19 $stat_pending=" AND status<>'pending'";
20 $order_by_desc=" ORDER BY create_time DESC";
22 for($i=1;$i<=$news_num_stop;$i++)
24 $sql=$str_sql." AND art_num='".$i."'";
25 $publish_when=" AND publish_date='".$today."'";
26 if(defined('MODERATE_NEWS') && (MODERATE_NEWS==1))
28 $sql.=$publish_when.$stat_pending;
30 else
32 $sql.=$publish_when;
35 $sql.=$order_by_desc;
37 if($ergebnis=$db->Execute($sql))
39 if($rows=$ergebnis->RecordCount())
41 $art[$i]=$ergebnis->FetchRow();
43 else // if no file found get the last entry
46 $sql=$str_sql." AND art_num='".$i."'";
47 $publish_when=" AND publish_date<'".$today."'";
49 if(defined('MODERATE_NEWS') && (MODERATE_NEWS==1))
51 $sql.=$publish_when.$stat_pending;
53 else
55 $sql.=$publish_when;
58 $sql.=$order_by_desc;
60 if($ergebnis=$db->Execute($sql))
62 if($rows=$ergebnis->RecordCount())
64 $art[$i]=$ergebnis->FetchRow();
70 } else { echo "$LDDbNoLink $sql<br>"; }