[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> news.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/news.php,v $
  14  |     $Revision: 1.116 $
  15  |     $Date: 2007/02/07 01:19:44 $
  16  |     $Author: e107coders $
  17  +----------------------------------------------------------------------------+
  18  */
  19  require_once ("class2.php");
  20  require_once(e_HANDLER."news_class.php");
  21  require_once(e_HANDLER."comment_class.php");
  22  $cobj = new comment;
  23  
  24  if (isset($NEWSHEADER)) {
  25      require_once(HEADERF);
  26      require_once(FOOTERF);
  27      exit;
  28  }
  29  $cacheString = 'news.php_'.e_QUERY;
  30  $action = '';
  31  if (!defined("ITEMVIEW")){
  32      if ($pref['newsposts']==""){
  33          define("ITEMVIEW", 15);
  34      } else {
  35          define("ITEMVIEW", $pref['newsposts']);
  36      }
  37  }
  38  
  39  if (e_QUERY) {
  40      $tmp = explode(".", e_QUERY);
  41      $action = $tmp[0];
  42      $sub_action = $tmp[1];
  43      $id = $tmp[2];
  44  }
  45  
  46  $from = (!is_numeric($action) || !e_QUERY ? 0 : ($action ? $action : e_QUERY));
  47  if (isset($tmp[1]) && $tmp[1] == 'list') {
  48      $action = 'list';
  49      $from = intval($tmp[0]);
  50      $sub_action = intval($tmp[2]);
  51  }
  52  if ($action == 'all' || $action == 'cat') {
  53      $from = intval($tmp[2]);
  54      $sub_action = intval($tmp[1]);
  55  }
  56  
  57  $ix = new news;
  58  $nobody_regexp = "'(^|,)(".str_replace(",", "|", e_UC_NOBODY).")(,|$)'";
  59  if ($action == 'cat' || $action == 'all'){
  60  
  61      // --> Cache
  62      if($tmp = checkCache($cacheString)){
  63          require_once(HEADERF);
  64          renderCache($tmp, TRUE);
  65      }
  66      // <-- Cache
  67  
  68      $qs = explode(".", e_QUERY);
  69  
  70      $category = intval($qs[1]);
  71      if ($action == 'cat' && $category != 0)    {
  72          $gen = new convert;
  73          $sql->db_Select("news_category", "*", "category_id='$category'");
  74          $row = $sql->db_Fetch();
  75          extract($row);  // still required for the table-render.  :(
  76      }
  77      if ($action == 'all'){
  78          if(!defined("NEWSALL_LIMIT")){ define("NEWSALL_LIMIT",10); }
  79          // show archive of all news items using list-style template.
  80          $news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
  81          $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
  82          LEFT JOIN #user AS u ON n.news_author = u.user_id
  83          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
  84          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
  85          AND (n.news_end=0 || n.news_end>".time().")  ORDER BY n.news_sticky DESC,n.news_datestamp DESC LIMIT ".intval($from).",".NEWSALL_LIMIT;
  86          $category_name = "All";
  87      }
  88      elseif ($action == 'cat'){
  89          // show archive of all news items in a particular category using list-style template.
  90          $news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_category=".intval($sub_action));
  91          if(!defined("NEWSLIST_LIMIT")){ define("NEWSLIST_LIMIT",10); }
  92          $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
  93          LEFT JOIN #user AS u ON n.news_author = u.user_id
  94          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
  95          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_category=".intval($sub_action)." ORDER BY n.news_datestamp DESC LIMIT ".intval($from).",".NEWSLIST_LIMIT;
  96      }
  97  
  98      if($category_name){
  99          define("e_PAGETITLE", $tp->toHTML($category_name,FALSE,"defs"));
 100      }
 101  
 102      require_once(HEADERF);
 103  
 104      if(!$NEWSLISTSTYLE){
 105          $NEWSLISTSTYLE = "
 106          <div style='padding:3px;width:100%'>
 107          <table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
 108          <tr>
 109          <td style='vertical-align:top;padding:3px;width:20px'>
 110          {NEWSCATICON}
 111          </td><td style='text-align:left;padding:3px'>
 112          {NEWSTITLELINK}
 113          <br />
 114          {NEWSSUMMARY}
 115          <span class='smalltext'>
 116          {NEWSDATE}
 117          {NEWSCOMMENTS}
 118          </span>
 119          </td><td style='width:55px'>
 120          {NEWSTHUMBNAIL}
 121          </td></tr></table>
 122          </div>\n";
 123  
 124      }
 125      $param['itemlink'] = (defined("NEWSLIST_ITEMLINK")) ? NEWSLIST_ITEMLINK : "";
 126      $param['thumbnail'] =(defined("NEWSLIST_THUMB")) ? NEWSLIST_THUMB : "border:0px";
 127      $param['catlink']  = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
 128      $param['caticon'] =  (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : ICONSTYLE;
 129      $sql->db_Select_gen($query);
 130      $newsList = $sql->db_getList();
 131      foreach($newsList as $row)
 132      {
 133          $text .= $ix->render_newsitem($row, 'return', '', $NEWSLISTSTYLE, $param);
 134      }
 135  
 136      $amount = ($action == "all") ? NEWSALL_LIMIT : NEWSLIST_LIMIT;
 137  
 138      $icon = ($row['category_icon']) ? "<img src='".e_IMAGE."icons/".$row['category_icon']."' alt='' />" : "";
 139      $parms = $news_total.",".$amount.",".$from.",".e_SELF.'?'.$action.".".$sub_action.".[FROM]";
 140      $text .= "<div class='nextprev'>".$tp->parseTemplate("{NEXTPREV={$parms}}")."</div>";
 141  
 142      if(!$NEWSLISTTITLE){
 143          $NEWSLISTTITLE = LAN_NEWS_82." '".$tp->toHTML($category_name,FALSE,"defs")."'";
 144      }
 145  
 146      ob_start();
 147      $ns->tablerender($NEWSLISTTITLE, $text);
 148      $cache_data = ob_get_flush();
 149      setNewsCache($cacheString, $cache_data);
 150      require_once(FOOTERF);
 151      exit;
 152  }
 153  
 154  if ($action == "extend") {
 155  
 156      // --> Cache
 157      if($tmp = checkCache($cacheString)){
 158          require_once(HEADERF);
 159          renderCache($tmp, TRUE);
 160      }
 161      // <-- Cache
 162  
 163      $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 164          LEFT JOIN #user AS u ON n.news_author = u.user_id
 165          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 166          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id=".intval($sub_action);
 167      $sql->db_Select_gen($query);
 168      $news = $sql->db_Fetch();
 169  
 170      if($news['news_title']){
 171          if($pref['meta_news_summary'] && $news['news_title']){
 172              define("META_DESCRIPTION",SITENAME.": ".$news['news_title']." - ".$news['news_summary']);
 173          }
 174          define("e_PAGETITLE",$news['news_title']);
 175      }
 176  
 177      require_once(HEADERF);
 178      ob_start();
 179      $ix->render_newsitem($news, "extend");
 180      $cache_data = ob_get_contents();
 181      ob_end_flush();
 182      setNewsCache($cacheString, $cache_data);
 183      require_once(FOOTERF);
 184      exit;
 185  }
 186  
 187  if (empty($order)){
 188      $order = "news_datestamp";
 189  }
 190  $order = $tp -> toDB($order, true);
 191  
 192  $interval = 10;
 193  if ($action == "list"){
 194      $sub_action = intval($sub_action);
 195      $news_total = $sql->db_Count("news", "(*)", "WHERE news_category=$sub_action AND news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().")");
 196      $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 197          LEFT JOIN #user AS u ON n.news_author = u.user_id
 198          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 199          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()."
 200          AND (n.news_end=0 || n.news_end>".time().") AND n.news_category={$sub_action} ORDER BY n.news_sticky DESC,".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
 201  
 202  }
 203  elseif($action == "item")
 204  {
 205      $sub_action = intval($sub_action);
 206      $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 207          LEFT JOIN #user AS u ON n.news_author = u.user_id
 208          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 209          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_id={$sub_action}";
 210  }
 211  elseif(strstr(e_QUERY, "month"))
 212  {
 213      $tmp = explode(".", e_QUERY);
 214      $item = $tp -> toDB($tmp[1]);
 215      $year = substr($item, 0, 4);
 216      $month = substr($item, 4);
 217      $startdate = mktime(0, 0, 0, $month, 1, $year);
 218      $lastday = date("t", $startdate);
 219      $enddate = mktime(23, 59, 59, $month, $lastday, $year);
 220      $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 221          LEFT JOIN #user AS u ON n.news_author = u.user_id
 222          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 223          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2 AND n.news_datestamp > $startdate AND n.news_datestamp < $enddate ORDER BY ".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
 224  }
 225  elseif(strstr(e_QUERY, "day"))
 226  {
 227      $tmp = explode(".", e_QUERY);
 228      $item = $tp -> toDB($tmp[1]);
 229      $year = substr($item, 0, 4);
 230      $month = substr($item, 4, 2);
 231      $day = substr($item, 6, 2);
 232      $startdate = mktime(0, 0, 0, $month, $day, $year);
 233      $lastday = date("t", $startdate);
 234      $enddate = mktime(23, 59, 59, $month, $day, $year);
 235      $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 236          LEFT JOIN #user AS u ON n.news_author = u.user_id
 237          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 238          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") AND n.news_render_type<2 AND n.news_datestamp > $startdate AND n.news_datestamp < $enddate ORDER BY ".$order." DESC LIMIT ".intval($from).",".ITEMVIEW;
 239  }
 240  else
 241  {
 242      $news_total = $sql->db_Count("news", "(*)", "WHERE news_class REGEXP '".e_CLASS_REGEXP."' AND NOT (news_class REGEXP ".$nobody_regexp.") AND news_start < ".time()." AND (news_end=0 || news_end>".time().") AND news_render_type<2" );
 243  
 244      if(!isset($pref['newsposts_archive']))
 245      {
 246          $pref['newsposts_archive'] = 0;
 247      }
 248      $interval = $pref['newsposts']-$pref['newsposts_archive'];
 249  
 250      // Get number of news item to show
 251      if(isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) {
 252          $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon, COUNT(*) AS tbcount FROM #news AS n
 253          LEFT JOIN #user AS u ON n.news_author = u.user_id
 254          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 255          LEFT JOIN #trackback AS tb ON tb.trackback_pid  = n.news_id
 256          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
 257          AND NOT (n.news_class REGEXP ".$nobody_regexp.")
 258          AND n.news_start < ".time()."
 259          AND (n.news_end=0 || n.news_end>".time().")
 260          AND n.news_render_type<2
 261          GROUP by n.news_id
 262          ORDER BY news_sticky DESC, ".$order." DESC LIMIT ".intval($from).",".$pref['newsposts'];
 263      }
 264      else
 265      {
 266          $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
 267          LEFT JOIN #user AS u ON n.news_author = u.user_id
 268          LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
 269          WHERE n.news_class REGEXP '".e_CLASS_REGEXP."'
 270          AND NOT (n.news_class REGEXP ".$nobody_regexp.")
 271          AND n.news_start < ".time()."
 272          AND (n.news_end=0 || n.news_end>".time().")
 273          AND n.news_render_type<2
 274          ORDER BY n.news_sticky DESC, ".$order." DESC LIMIT ".intval($from).",".$pref['newsposts'];
 275      }
 276      // #### END ---------------------------------------------------------------------------------------------------
 277  }
 278  
 279  if($tmp_cache = checkCache($cacheString)) // normal news front-page - with cache.
 280  {
 281      require_once(HEADERF);
 282  
 283      if(!$action)
 284      {
 285          if (isset($pref['fb_active']))
 286          {
 287              require_once(e_PLUGIN."featurebox/featurebox.php");
 288          }
 289          if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1)
 290          {
 291              require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
 292          }
 293  
 294      }
 295  
 296      //news archive
 297      if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
 298          if ($sql->db_Select_gen($query)) {
 299              $newsAr = $sql -> db_getList();
 300              if($newsarchive = checkCache('newsarchive')){
 301                  $tmp_cache = $tmp_cache.$newsarchive;
 302              }else{
 303                  newsarchive($newsAr);
 304              }
 305          }
 306      }
 307      renderCache($tmp_cache, TRUE);
 308  }
 309  
 310  
 311  if (!$sql->db_Select_gen($query)) {
 312      require_once(HEADERF);
 313      echo "<br /><br /><div style='text-align:center'><b>".(strstr(e_QUERY, "month") ? LAN_NEWS_462 : LAN_NEWS_83)."</b></div><br /><br />";
 314      require_once(FOOTERF);
 315      exit;
 316  } else {
 317      $newsAr = $sql -> db_getList();
 318  }
 319  
 320  
 321  $p_title = ($action == "item") ? $newsAr[1]['news_title'] : $tp->toHTML($newsAr[1]['category_name'],FALSE,"defs");
 322  
 323  if($action != "" && !is_numeric($action))
 324  {
 325      if($action == "item" && $pref['meta_news_summary'] && $newsAr[1]['news_title']){
 326          define("META_DESCRIPTION",SITENAME.": ".$newsAr[1]['news_title']." - ".$newsAr[1]['news_summary']);
 327      }
 328      define("e_PAGETITLE", $p_title);
 329  }
 330  
 331  require_once(HEADERF);
 332  if(!$action)
 333  {
 334      if (isset($pref['fb_active'])){   // --->feature box
 335          require_once(e_PLUGIN."featurebox/featurebox.php");
 336      }
 337  
 338      if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){
 339          require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
 340      }
 341  }
 342  
 343  
 344  /*
 345  changes by jalist 03/02/2005:
 346  news page templating
 347  
 348  */
 349  if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php")) {
 350      // theme specific template required ...
 351      require_once(THEME."news_template.php");
 352  
 353      if($ALTERNATECLASS1){
 354          return TRUE;
 355      }
 356  
 357      $newscolumns = (isset($NEWSCOLUMNS) ? $NEWSCOLUMNS : 1);
 358      $newspercolumn = (isset($NEWSITEMSPERCOLUMN) ? $NEWSITEMSPERCOLUMN : 10);
 359      $newsdata = array();
 360      $loop = 1;
 361      foreach($newsAr as $news) {
 362  
 363          if(is_array($ALTERNATECLASSES)) {
 364              $newsdata[$loop] .= "<div class='{$ALTERNATECLASSES[0]}'>".$ix->render_newsitem($news, "return")."</div>";
 365              $ALTERNATECLASSES = array_reverse($ALTERNATECLASSES);
 366          } else {
 367              $newsdata[$loop] .= $ix->render_newsitem($news, "return");
 368          }
 369          $loop ++;
 370          if($loop > $newscolumns) {
 371              $loop = 1;
 372          }
 373      }
 374      $loop = 1;
 375      foreach($newsdata as $data) {
 376          $var = "ITEMS{$loop}";
 377          $$var = $data;
 378          $loop ++;
 379      }
 380      $text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT);
 381  
 382      require_once(HEADERF);
 383      echo $text;
 384      setNewsCache($cacheString, $text);
 385  
 386  } else {
 387      /*
 388      changes by jalist 22/01/2005:
 389      added ability to add a new date header to news posts, turn on and off from news->prefs
 390      */
 391  
 392      ob_start();
 393  
 394      $newpostday = 0;
 395      $thispostday = 0;
 396      $pref['newsHeaderDate'] = 1;
 397      $gen = new convert();
 398  
 399      if (!defined("DATEHEADERCLASS")) {
 400          define("DATEHEADERCLASS", "nextprev");
 401          // if not defined in the theme, default class nextprev will be used for new date header
 402      }
 403  
 404      // #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
 405  
 406      $i= 1;
 407      while(isset($newsAr[$i]) && $i <= $interval) {
 408          $news = $newsAr[$i];
 409          //        render new date header if pref selected ...
 410          $thispostday = strftime("%j", $news['news_datestamp']);
 411          if ($newpostday != $thispostday && (isset($pref['news_newdateheader']) && $pref['news_newdateheader'])) {
 412              echo "<div class='".DATEHEADERCLASS."'>".strftime("%A %d %B %Y", $news['news_datestamp'])."</div>";
 413          }
 414          $newpostday = $thispostday;
 415          $news['category_id'] = $news['news_category'];
 416          if ($action == "item") {
 417              unset($news['news_render_type']);
 418          }
 419  
 420          $ix->render_newsitem($news);
 421          $i++;
 422      }
 423      $parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
 424      $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
 425       echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
 426  
 427      $cache_data = ob_get_clean();
 428      require_once(HEADERF);
 429      echo $cache_data;
 430      setNewsCache($cacheString, $cache_data);
 431  }
 432  
 433  // ##### --------------------------------------------------------------------------------------------------------------
 434  
 435  function newsarchive($newsAr){
 436      global $ns, $gen, $interval, $pref, $tp, $news_archive_shortcodes, $NEWSARCHIVE, $news2;
 437  
 438      // do not show the news archive on the news.php?item.X page (but only on the news mainpage)
 439      require_once(e_FILE.'shortcode/batch/news_archives.php');
 440  
 441      ob_start();
 442  
 443      $i = $interval + 1;
 444      while(isset($newsAr[$i]))
 445      {
 446          $news2 = $newsAr[$i];
 447          // Code from Lisa
 448          // copied from the rss creation, but added here to make sure the url for the newsitem is to the news.php?item.X
 449          // instead of the actual hyperlink that may have been added to a newstitle on creation
 450          $search = array();
 451          $replace = array();
 452          $search[0] = "/\<a href=\"(.*?)\">(.*?)<\/a>/si";
 453          $replace[0] = '\\2';
 454          $search[1] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
 455          $replace[1] = '\\2';
 456          $search[2] = "/\<a href='(.*?)'>(.*?)<\/a>/si";
 457          $replace[2] = '\\2';
 458          $search[3] = "/\<a href=&quot;(.*?)&quot;>(.*?)<\/a>/si";
 459          $replace[3] = '\\2';
 460          $search[4] = "/\<a href=&#39;(.*?)&#39;>(.*?)<\/a>/si";
 461          $replace[4] = '\\2';
 462          $news2['news_title'] = preg_replace($search, $replace, $news2['news_title']);
 463          // End of code from Lisa
 464  
 465          $gen = new convert;
 466          $news2['news_datestamp'] = $gen->convert_date($news2['news_datestamp'], "short");
 467  
 468  
 469          if(!$NEWSARCHIVE){
 470              $NEWSARCHIVE ="<div>
 471                      <table style='width:98%;'>
 472                      <tr>
 473                      <td>
 474                      <div>{ARCHIVE_BULLET} <b>{ARCHIVE_LINK}</b> <span class='smalltext'><i>{ARCHIVE_AUTHOR} @ ({ARCHIVE_DATESTAMP}) ({ARCHIVE_CATEGORY})</i></span></div>
 475                      </td>
 476                      </tr>
 477                      </table>
 478                      </div>";
 479  
 480          }
 481          $textnewsarchive .= $tp->parseTemplate($NEWSARCHIVE, FALSE, $news_archive_shortcodes);
 482          $i++;
 483      }
 484      $ns->tablerender($pref['newsposts_archive_title'], $textnewsarchive, 'news_archive');
 485      $newsarchive = ob_get_contents();
 486      ob_end_flush(); // dump collected data
 487      setNewsCache('newsarchive', $newsarchive);
 488  }
 489  
 490  // #### new: news archive ---------------------------------------------------------------------------------------------
 491  if ($action != "item" && $action != 'list' && $pref['newsposts_archive']) {
 492      newsarchive($newsAr);
 493  }
 494  // #### END -----------------------------------------------------------------------------------------------------------
 495  
 496  if ($action != "item") {
 497      if (is_numeric($action)){
 498          $action = "";
 499      }
 500   //    $parms = $news_total.",".ITEMVIEW.",".$from.",".e_SELF.'?'."[FROM].".$action.(isset($sub_action) ? ".".$sub_action : "");
 501   //    $nextprev = $tp->parseTemplate("{NEXTPREV={$parms}}");
 502   //    echo ($nextprev ? "<div class='nextprev'>".$nextprev."</div>" : "");
 503  }
 504  
 505  if(is_dir("remotefile")) {
 506      require_once(e_HANDLER."file_class.php");
 507      $file = new e_file;
 508      $reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*', 'Readme.txt');
 509      $crem = $file -> get_files(e_BASE."remotefile", "", $reject);
 510      if(count($crem)) {
 511          foreach($crem as $loadrem) {
 512              if(strstr($loadrem['fname'], "load_")) {
 513                  require_once(e_BASE."remotefile/".$loadrem['fname']);
 514              }
 515          }
 516      }
 517  }
 518  
 519  if (isset($pref['nfp_display']) && $pref['nfp_display'] == 2) {
 520      require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
 521  }
 522  
 523  render_newscats();
 524  
 525  require_once(FOOTERF);
 526  
 527  
 528  // =========================================================================
 529  function setNewsCache($cache_tag, $cache_data) {
 530      global $e107cache;
 531      $e107cache->set($cache_tag, $cache_data);
 532      $e107cache->set($cache_tag."_title", defined("e_PAGETITLE") ? e_PAGETITLE : '');
 533      $e107cache->set($cache_tag."_diz", defined("META_DESCRIPTION") ? META_DESCRIPTION : '');
 534  }
 535  
 536  function checkCache($cacheString){
 537      global $pref,$e107cache;
 538      $cache_data = $e107cache->retrieve($cacheString);
 539      $cache_title = $e107cache->retrieve($cacheString."_title");
 540      $cache_diz = $e107cache->retrieve($cacheString."_diz");
 541      $etitle = ($cache_title != "e_PAGETITLE") ? $cache_title : "";
 542      $ediz = ($cache_diz != "META_DESCRIPTION") ? $cache_diz : "";
 543      if($etitle){
 544          define(e_PAGETITLE,$etitle);
 545      }
 546      if($ediz){
 547          define("META_DESCRIPTION",$ediz);
 548      }
 549      if ($cache_data) {
 550          return $cache_data;
 551      } else {
 552          return false;
 553      }
 554  }
 555  
 556  function renderCache($cache, $nfp = FALSE){
 557      global $pref,$tp,$sql,$CUSTOMFOOTER, $FOOTER,$cust_footer,$ph;
 558      global $db_debug,$ns,$eTraffic,$eTimingStart, $error_handler, $db_time, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb,$e107;
 559      echo $cache;
 560      if (isset($nfp) && isset($pref['nfp_display']) && $pref['nfp_display'] == 2) {
 561          require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
 562      }
 563      render_newscats();
 564      require_once(FOOTERF);
 565      exit;
 566  }
 567  
 568  function render_newscats(){  // --  CNN Style Categories. ----
 569      global $pref,$ns,$tp;
 570      if (isset($pref['news_cats']) && $pref['news_cats'] == '1') {
 571          $text3 = $tp->toHTML("{NEWS_CATEGORIES}", TRUE, 'parse_sc,nobreak,emotes_off,no_make_clickable');
 572          $ns->tablerender(LAN_NEWS_23, $text3, 'news_cat');
 573      }
 574  }
 575  
 576  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7