header("Last-Modified: ".gmdate("r",time())."\r\n"); header("Expires: ".gmdate("r",time()+1)."\r\n"); header("Cache-Control: max-age=1, must-revalidate"); include("../libs/common.php"); include_once(SITE_PATH."libs/forumforms.php"); include_once(SITE_PATH."forum/classes/forum.php"); define('TABLE_PREFIX', 'che_'); ////////////////// SETUP $site->REG_NONE= 0; //не требуется $site->REG_ADD= 1; //требуется на добавление $site->REG_VIEW= 2; //требуется на просмотр $site->reg_level= $site->REG_NONE; //уровень требования регистрации $site->CODE_REG= 0x1; //при регистрации $site->CODE_ADD_IF_NOTREG= 0x2;//при добавлении если не зарегитсрирован $site->CODE_ADD= 0x4; //при добавлении в любом случае $site->need_code= $site->CODE_ADD; ////////////////// EOf(SETUP) $core = new Smarty(); $GLOBALS['core'] = $core; $core->assign("site_url",SITE_URL); // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // работа с версияси /* $_VER = array(); $Rver = sql_field("SELECT id FROM che_ver WHERE id='1'"); $_VER['ver'] = $Rver; $r = sql_query("SELECT * FROM che_ver WHERE enabled='1'"); while($d=sql_row($r)){ $_VER['all'][$d['id']] = $d; $_VER['nick'][$d['nick']] = $d; } $_VER['row'] = sql_row(sql_query("SELECT * FROM che_ver WHERE id='".$_VER['ver']."' AND enabled='1'")); $_VER['where'] = " AND ver='".$_VER['ver']."' "; $_VER['where_all'] = " WHERE ver='".$_VER['ver']."' "; $_VER['link'] = "&ver=".$_VER['ver'].""; $lang = $lang_ver[$_VER['row']['nick']];*/ // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $data_options=sql_row(sql_query("SELECT * FROM che_options #".$_VER['where_all'])); $data_options["lang"]=$_VER['row']['nick']; $nid=@sql_result(sql_query("SELECT a.id AS num FROM che_pages AS a INNER JOIN che_modules AS b ON b.id=a.module_id WHERE b.nick='forum'"),"num"); $data_page = sql_row(sql_query("SELECT * FROM che_pages WHERE id='$nid'")); $core->assign("contacts",stripslashes($data_options["contacts"])); $core->assign("title",$data_options["title"]." ".$data_page["title"]); $core->assign("header",$data_page["title"]); $core->assign("email",$data_options["email"]); $core->assign("keywords",quote($data_page["keywords"])); $core->assign("description",quote($data_page["description"])); $core->assign("cid",intval(@sql_result(sql_query("SELECT a.id AS num FROM che_pages AS a INNER JOIN che_modules AS b ON b.id=a.module_id WHERE b.nick='contacts'"),"num"))); // Номер страницы поиска $search_id = intval(@sql_result(sql_query("SELECT a.id AS num FROM che_pages AS a INNER JOIN che_modules AS b ON b.id=a.module_id WHERE b.nick='search'"),"num")); $core->assign("search_id",$search_id); // картинка в шапке if(@$data["image"]) $pageimage=SITE_URL."pics/pages/".$data["image"]; else $pageimage=SITE_URL."pic/museum.jpg"; $core->assign("pageimage",$pageimage); // формируем меню /* $menu=array(); $rr=sql_query("SELECT * FROM che_pages WHERE parent='0' AND mainmenu='1' ORDER BY ord ASC"); while($dd=sql_row($rr)){ $menu[$dd["id"]]=array( "name" => $dd["name"], "link" => SITE_URL."index.php?page=".$dd["id"], "module"=> $dd["module_id"], "sub" => NULL ); } $s=""; $s.=""; $core->assign("menu",$s); */ /* $sid= session_id(); $uid= check_access($sid); $url_register= SITE_URL . "forum/?action=register"; */ $site->is_check_code= false; switch(@$_REQUEST['action']) { // начать новую тему case "newtop": // написать сообщение case "newmes": // добавляем сообщение case "addnewmes": // добавляем тему case "addnewtop": if(($site->need_code | $site->CODE_ADD) || ($site->need_code | $site->CODE_ADD_IF_NOTREG && !$uid)) $site->is_check_code= true; $core->assign("is_check_code", $site->is_check_code); } //dump($site->is_check_code, '$site->is_check_code'); $core->assign("random_num", getRand()); //$core->assign("message", ""); switch(@$_REQUEST['action']) { /// регистрация case "register": $core->assign("step", "register"); //$core->assign("catpath",ForumPath(intval($_GET['id']))); $core->display("forum/templates/index.tpl"); break; // начать новую тему case "newtop": //print('case "newtop":'); //dump($site->reg_level, '$site->reg_level'); //die(); if(($site->reg_level >= $site->REG_ADD) && !$uid) GotoURL($url_register); //print("after"); $core->assign("forumid",intval($_GET['id'])); $core->assign("step",4); $core->assign("catpath",ForumPath(intval($_GET['id']))); $core->assign("message", AddNewTopic()); //в функции есть проверка... $core->assign("author", htmlspecialchars(@$_POST['author'])); $core->assign("email", htmlspecialchars(@$_POST['email'])); $core->assign("name", htmlspecialchars(@$_POST['name'])); $core->assign("text", htmlspecialchars(@$_POST['text'])); $core->display("forum/templates/index.tpl"); break; // написать сообщение case "newmes": //print('case "newmes":'); //die(); if($site->reg_level >= $site->REG_ADD && !$uid) GotoURL($url_register); $quotetext= FQuote(intval(@$_GET['quote'])); $quotetitle= QuoteTitle(intval(@$_GET['quote'])); $core->assign("forumid",intval($_GET['fid'])); $core->assign("topicid",intval($_GET['id'])); $core->assign("step",5); $core->assign("catpath",TopicPath(intval($_GET['fid']),intval($_GET['id']))); $core->assign("message", AddNewMessage()); $core->assign("author", htmlspecialchars(@$_POST['author'])); $core->assign("email", htmlspecialchars(@$_POST['email'])); $name= htmlspecialchars(@$_POST['name']); $text= htmlspecialchars(@$_POST['text']); if(!$name) $name= $quotetitle; if(!$text) $text= $quotetext; $core->assign("name", $name); $core->assign("text", $text); $core->display("forum/templates/index.tpl"); break; // добавляем сообщение /*case "addnewmes": if($site->reg_level >= $site->REG_ADD && !$uid) GotoURL($url_register); $core->assign("message", AddNewMessage()); */ // показываем сообщения case "messages": $core->assign("messages",ViewMessages(intval($_GET['fid']),intval($_GET['id']))); $core->assign("catpath",TopicPath(intval($_GET['fid']),intval($_GET['id']))); $core->assign("step",3); $core->display("forum/templates/index.tpl"); break; // добавляем тему /*case "addnewtop": if($site->reg_level >= $site->REG_ADD && !$uid) GotoURL($url_register); */ // показываем темы case "topics": $core->assign("topics",ViewTopics(intval($_GET['id']))); $core->assign("catpath",ForumPath(intval($_GET['id']))); $core->assign("step",2); $core->display("forum/templates/index.tpl"); break; // показываем форумы default: case "view": $core->assign("groups",ViewForums()); $core->assign("catpath",ForumPath(0)); $core->assign("step",1); $core->display("forum/templates/index.tpl"); break; } ?>