[ PHPXref.com ] [ Generated: Sun Jul 20 17:08:59 2008 ] [ CuteNews 1.4.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> show_news.php (source)

   1  <?PHP
   2  
   3  error_reporting (E_ALL ^ E_NOTICE);
   4  
   5  $cutepath =  __FILE__;
   6  $cutepath = preg_replace( "'\\\show_news\.php'", "", $cutepath);
   7  $cutepath = preg_replace( "'/show_news\.php'", "", $cutepath);
   8  
   9  require_once("$cutepath/inc/functions.inc.php");
  10  require_once("$cutepath/data/config.php");
  11  
  12  // If we are showing RSS, include some need variables.

  13  if($template == 'rss'){
  14     include("$cutepath/data/rss_config.php");
  15  }
  16  
  17  //----------------------------------

  18  // Check if we are included by PATH

  19  //----------------------------------

  20  if($HTTP_SERVER_VARS["HTTP_ACCEPT"] or $HTTP_SERVER_VARS["HTTP_ACCEPT_CHARSET"] or $HTTP_SERVER_VARS["HTTP_ACCEPT_ENCODING"] or $HTTP_SERVER_VARS["HTTP_CONNECTION"]){ /* do nothing */ }
  21  elseif(eregi("show_news.php", $PHP_SELF)){
  22  die("<h4>CuteNews has detected that you are including show_news.php using the URL to this file.<br>
  23  This is incorrect and you must include it using the PATH to show_news.php</h4><br>Example:<br>
  24  this is <font color=red>WRONG</font> :&nbsp;&nbsp; &lt;?PHP include(\"http://yoursite.com/cutenews/show_news.php\"); ?&gt;<br>
  25  this is <font color=green>CORRECT</font>:&nbsp;&nbsp; &lt;?PHP include(\"cutenews/show_news.php\"); ?&gt;<br>
  26  <br><BR>// <font size=2>if you think this message shouldn't be shown, open show_news.php and delete it from there</font>");
  27  }
  28  //----------------------------------

  29  // End of the check

  30  //----------------------------------

  31  
  32  if(!isset($subaction) or $subaction == ""){ $subaction = $POST["subaction"]; }
  33  
  34  if(!isset($template) or $template == "" or strtolower($template) == "default"){ require_once("$cutepath/data/Default.tpl"); }
  35  else{
  36          if(file_exists("$cutepath/data/$template}.tpl")){ require("$cutepath/data/$template}.tpl"); }
  37      else{ die("Error!<br>the template <b>".htmlspecialchars($template)."</b> does not exists, note that templates are case sensetive and you must write the name exactly as it is"); }
  38  }
  39  
  40  // Prepare requested categories

  41  if(eregi("[a-z]", $category)){
  42          die("<b>Error</b>!<br>CuteNews has detected that you use \$category = \"$category\"; but you can call the categories only with their <b>ID</b> numbers and not with names<br>
  43      example:<br><blockquote>&lt;?PHP<br>\$category = \"1\";<br>include(\"path/to/show_news.php\");<br>?&gt;</blockquote>");
  44  }
  45  $category = preg_replace("/ /", "", $category);
  46  $tmp_cats_arr = explode(",", $category);
  47  foreach($tmp_cats_arr as $key=>$value){
  48      if($value != ""){ $requested_cats[$value] = TRUE; }
  49  }
  50  
  51  if($archive == ""){
  52          $news_file = "$cutepath/data/news.txt";
  53          $comm_file = "$cutepath/data/comments.txt";
  54  }else{
  55          $news_file = "$cutepath/data/archives/$archive.news.arch";
  56          $comm_file = "$cutepath/data/archives/$archive.comments.arch";
  57  }
  58  
  59  $allow_add_comment                        = FALSE;
  60  $allow_full_story                        = FALSE;
  61  $allow_active_news                         = FALSE;
  62  $allow_comments                         = FALSE;
  63  
  64  
  65  
  66  //<<<------------ Detarime what user want to do

  67  if( $CN_HALT != TRUE and $static != TRUE and ($subaction == "showcomments" or $subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "") or ($requested_cats[$ucat] == TRUE )  ) ){
  68      if($subaction == "addcomment"){  $allow_add_comment        = TRUE; $allow_comments = TRUE; }
  69      if($subaction == "showcomments"){ $allow_comments = TRUE; }
  70      if(($subaction == "showcomments" or $allow_comments == TRUE) and $config_show_full_with_comments == "yes"){$allow_full_story = TRUE; }
  71      if($subaction == "showfull") $allow_full_story = TRUE;
  72      if($subaction == "showfull" and $config_show_comments_with_full == "yes") $allow_comments = TRUE;
  73  
  74  }
  75  else{
  76      if($config_reverse_active == "yes"){ $reverse = TRUE; }
  77          $allow_active_news = TRUE;
  78  }
  79  //----------->>> Detarime what user want to do

  80  
  81  require("$cutepath/inc/shows.inc.php");
  82      if($_GET['archive'] and $_GET['archive'] != ''){ $archive = $_GET['archive']; } // stupid fix ?

  83  unset($static, $template, $requested_cats, $category, $catid, $cat,$reverse, $in_use, $archives_arr, $number, $no_prev, $no_next, $i, $showed, $prev, $used_archives);
  84  ?>
  85  <!-- News Powered by CuteNews: http://cutephp.com/ -->


[ Powered by PHPXref - Served by Debian GNU/Linux ]