sNews Forum

sNews 1.7 (current stable version) => Patches/fixes => Topic started by: Rui Mendes on January 08, 2009, 01:56:58 am

Title: Fix 404 errors
Post by: Rui Mendes on January 08, 2009, 01:56:58 am
Please fix your sNews 1.7 version:

Joost fix, add blue text in startup
Quote
if (!empty($_GET['category'])) {
   $url = explode('/', clean($_GET['category']));
   $categorySEF = $url[0];

....some lines down

Find in startup this code and add red text
Quote
if (!empty($MainQuery)){
      $Mainresult = mysql_query($MainQuery);
      if (mysql_num_rows($Mainresult) === 1 ){
         $R = mysql_fetch_assoc($Mainresult);
      } else if(!in_array($_GET['action'],explode(',',l('cat_listSEF')))){
         $categorySEF = '404';
         header('HTTP/1.1 404 Not Found');
         unset($subcatSEF,$articleSEF);}
      update_articles();

And in center function add red text
Quote
global $categorySEF, $subcatSEF, $articleSEF;
      switch(true) {
         case isset($_GET['category']):
            $action = $categorySEF;
            break;
         case isset($_GET['action']):
            $action = $categorySEF == '404' ? $categorySEF :  clean(cleanXSS($_GET['action']));
            break;
      }