Location: PHPKode > projects > L-Forum > l-forum/lib/init.inc
<?

if(defined("_INIT_")) return;
define("_INIT_", 1);

error_reporting(E_ALL ^ E_NOTICE);

$pre = "";
if(ereg("admin", $PHP_SELF)) $pre = "../";
include $pre."lib/sql.inc";
include $pre."lib/lib.inc";

include $pre."lang/".$lang_d.".inc";

if(empty($lng)&&empty($cookie_lang))
   $lng = $lang_d;
else if(empty($lng)&&!empty($cookie_lang)&&isset($langlist[$cookie_lang]))
   $lng = $cookie_lang;

if(!empty($lng)&&$lng!=$cookie_lang)
   if(isset($langlist[$lng]))
      setcookie("cookie_lang", $lng, time()+999999999);
   else
      $lng = $lang_d;

include $pre."lang/".$lng.".inc";

if(ereg("/list.php|/read.php|/new.php|/search.php|/read_thr.php", $PHP_SELF)){
   if(!isset($f))
      error_f($lang['nofid']);
   if(is_array($forum_array[$f]))
      $theme=$forum_array[$f]["theme"];
   else
      error_f($lang['nofid']);
}

include $pre."themes/".$theme."/design.inc";

if(empty($s)&&empty($ns)){
   $ns='d';
}

if(isset($ns)){
   setcookie("s", $ns, time()+999999999);
   $s=$ns;
}

if(isset($HTTP_REFERER)){
   if(!ereg("list.php|read.php|new.php|search.php|(^$)", $HTTP_REFERER)||
         (empty($o)&&empty($no))){
      $no=0;
   }
}

if(isset($no)){
   $o=$no;
}

if(!empty($nt)){
   setcookie("t", $nt, time()+999999999);
   $t=$nt;
}

if(isset($nosql))
   return;

$sys_basename=$db_name;

switch($db_type){
   case 'postgres':
      $sys_database=new Database();
      $true = 't';
      $false = 'f';
      break;
   case 'mysql':
      $sys_database=new MySQLDatabase();
      $true = 1;
      $false = 0;
      break;
}

if(ereg("/list.php", $PHP_SELF)){
   $q=new Query("select id from articles where level=0 and forum = $f");
   if(empty($open_thr[$f])){
      $open_thr[$f]=Array();
      for($x=0; $x<$q->nr(); $x++)
	 $open_thr[$f][$q->get($x, 'id')] = ( $coll_thr ? 0 : 1 );
   }
   else{
      $open_thr[$f]=unserialize($open_thr[$f]);
      for($x=0; $x<$q->nr(); $x++){
	 $id = $q->get($x, 'id');
	 if(@$open_thr[$f][$id]!=1) $open_thr[$f][$id] = 0;
      }
   }

   if(!empty($uc)||!empty($c)){
      if(!empty($uc))
	 $open_thr[$f][$uc]=1;
      else if(!empty($c))
	 $open_thr[$f][$c]=0;
   }

   if(isset($cmd)){
      if($cmd==1 && count($open_thr[$f])>0){
         while(list($k, $v) = each($open_thr[$f]))
            $open_thr_n[$f][$k] = 1;
         $open_thr[$f] = $open_thr_n[$f];
      }
   }
   setcookie("open_thr[$f]", serialize($open_thr[$f]), time()+999999999);
}
?>
Return current item: L-Forum