sebbe |
01-09-2007 05:35 PM |
Yes that file. Try to replace it with the following code
NOTE: On line 273 change the XX in "thread.forumid NOT IN (XX)" to the forumid of the forum you want to exclude. In your case your admin/mod forum.
PHP Code:
<?
if(file_exists("{$CONFIG['dir_config']}/forums_vb.inc.php")) {
include("{$CONFIG['dir_config']}/forums_vb.inc.php");
}
//////////////////////////////////////////////////////////////////////////////////////
// VARIABLE MAP //
//////////////////////////////////////////////////////////////////////////////////////
$MAP_DB=array();
$MAP_DB['comment_id'] = 'nnet_rid';
$MAP_DB['article_id'] = 'nnet_aid';
$MAP_DB['category_id'] = 'nnet_cid';
$MAP_DB['comment_uid'] = 'nnet_uid';
$MAP_DB['comment_uname'] = 'nnet_poster';
$MAP_DB['comment_title'] = 'nnet_title';
$MAP_DB['comment_rate'] = 'nnet_rate';
$MAP_DB['comment_msg'] = 'nnet_msg';
$MAP_DB['comment_date'] = 'nnet_date';
//////////////////////////////////////////////////////////////////////////////////////
// REQUIRED FUNCTIONS //
//////////////////////////////////////////////////////////////////////////////////////
if(PHP_ACCESS!='1'){
print "This file doesn't support direct access.";
exit;
}
function forums_comment_insert($input){
global $CONFIG,$MAP_DB;
mysql_query("INSERT INTO `{$CONFIG['sql_db']}`.`nnet_reviews` SET `{$MAP_DB['article_id']}`='{$input['article_id']}',`{$MAP_DB['category_id']}`='{$input['category_id']}',`{$MAP_DB['comment_uid']}`='{$input['comment_uid']}',`{$MAP_DB['comment_uname']}`='{$input['comment_uname']}',`{$MAP_DB['comment_title']}`='{$input['comment_title']}',`{$MAP_DB['comment_rate']}`='{$input['comment_rate']}',`{$MAP_DB['comment_msg']}`='{$input['comment_msg']}',`{$MAP_DB['comment_date']}`='{$input['comment_date']}'")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
return true;
}
function forums_comment_remove($in_id,$type){
global $CONFIG,$MAP_DB;
switch($type){
case 0: $type='nnet_rid';break;
case 1: $type='nnet_aid';break;
case 2: $type='nnet_cid';break;
default: $type='nnet_rid';break;
};
mysql_query("DELETE FROM `{$CONFIG['sql_db']}`.`nnet_reviews` WHERE `$type`='$in_id'")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
}
function forums_auto_insert($input){
global $CONFIG,$MAP_DB,$INT_CONF;
/* Available Input Variables
$input['comment_id'] =addslashes(
$input['comment_desc'] =addslashes(
$input['category_id'] =addslashes(
$input['comment_uid'] =addslashes(
$input['comment_uname'] =addslashes(
$input['comment_title'] =addslashes(
$input['comment_rate'] =addslashes(
$input['comment_msg'] =addslashes(
$input['comment_date'] =addslashes( */
if($INT_CONF["auto_insert_type"]==2){
// LOOK FOR APPROPRIATE FORUM
foreach($INT_CONF as $key => $value){
if(preg_match("/^it_/",$key) && $value==$input['category_id']){
list($null,$TRUE_FID)=explode("_",$key);
}
}
if($TRUE_FID!=''){
$INT_CONF["auto_insertID"]=$TRUE_FID;
} else {
$INT_CONF["auto_insertID"]=$INT_CONF["auto_insert_default"];
}
}
if($INT_CONF["auto_insertID"]>0){
if(strlen($input['comment_title'])>1){
forum_sql_connect(1);
$input['comment_desc'].=" [}?m=show&id={$input['comment_id']}]details]";
$result=mysql_query("INSERT INTO `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}thread` SET `title`='{$input['comment_title']}',`lastpost`='{$input['comment_date']}',`nnet_aid`='{$input['comment_id']}',`forumid`='{$INT_CONF["auto_insertID"]}',`open`='1',`postusername`='{$input['comment_uname']}',`postuserid`='{$input['comment_uid']}',`lastposter`='{$input['comment_uname']}',`dateline`='{$input['comment_date']}',`visible`='1'")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
$data=mysql_fetch_row(mysql_query("SELECT LAST_INSERT_ID() FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}thread`"));
mysql_free_result($result);
mysql_query("INSERT INTO `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}post` SET `threadid`='{$data[0]}',`username`='{$input['comment_uname']}',`userid`='{$input['comment_uid']}',`title`='{$input['comment_title']}',`nnet_aid`='{$input['comment_id']}',`pagetext`='{$input['comment_desc']}',`ipaddress`='".getenv("HTTP_REFERER")."',`allowsmilie`='1',`iconid`='1',`visible`='1',`dateline`='{$input['comment_date']}'")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
mysql_query("UPDATE `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}forum` SET `threadcount`=`threadcount`+1 WHERE `forumid`='{$INT_CONF["auto_insertID"]}' LIMIT 1")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
forum_sql_connect(2);
}
} // ends forum id check
}
function forums_thread_id($input){
global $CONFIG,$MAP_DB,$INT_CONF;
forum_sql_connect(1);
extract(v45_sql_stripper(mysql_fetch_array(mysql_query("SELECT `threadid` FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}thread` WHERE `nnet_aid`='$input' LIMIT 1"),MYSQL_ASSOC)));
forum_sql_connect(2);
return $threadid;
}
function forums_comment_retrieve($input,$type,$start,$end){
global $CONFIG,$MAP_DB,$INT_CONF;$tmp_array=array();
forum_sql_connect(1);
$type=($type==1)?'nnet_cid':'nnet_aid';
if($INT_CONF["auto_insert"]==1){
forum_sql_connect(1);
$id_thread=forums_thread_id($input);
$result=mysql_query("SELECT `postid` AS `comment_id`,`userid` AS `comment_uid`,`title` AS `comment_title`,`username` AS `comment_uname`,`pagetext` AS `comment_msg`,`dateline` AS `comment_date` FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}post` WHERE `threadid`='$id_thread' AND `nnet_aid`='' ORDER BY `postid` DESC LIMIT $start,$end;")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){
$data=v45_sql_stripper($data);
$data['article_id']=$input;
$tmp_array[]=$data;
}
mysql_free_result($result);
forum_sql_connect(2);
} else {
$int_counter=0;
$result=mysql_query("SELECT `nnet_rid` AS `comment_id`,
`nnet_aid` AS `article_id`,
`nnet_cid` AS `category_id`,
`nnet_uid` AS `comment_uid`,
`nnet_title` AS `comment_title`,
`nnet_poster` AS `comment_uname`,
`nnet_rate` AS `comment_rate`,
`nnet_msg` AS `comment_msg`,
`nnet_date` AS `comment_date`
FROM `{$CONFIG['sql_db']}`.`nnet_reviews`
WHERE `$type`='$input' ORDER BY `nnet_rid` DESC LIMIT $start,$end;")
or die("sMYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){
$data=v45_sql_stripper($data);
$tmp_array[$int_counter]=$data;
$int_counter++;
}
mysql_free_result($result);
}
return $tmp_array;
}
function forums_comment_search($input,$field,$keywords,$start,$end){
global $CONFIG,$MAP_DB;$tmp_array=array();
$int_counter=0;$keywords=addslashes(stripslashes($keywords));
$result=mysql_query("SELECT `nnet_rid` AS `comment_id`,`nnet_aid` AS `article_id`,`nnet_cid` AS `category_id`,`nnet_uid` AS `comment_uid`,`nnet_title` AS `comment_title`,`nnet_poster` AS `comment_uname`,`nnet_rate` AS `comment_rate`,`nnet_msg` AS `comment_msg`,`nnet_date` AS `comment_date` FROM `{$CONFIG['sql_db']}`.`nnet_reviews` WHERE `{$MAP_DB[$field]}` REGEXP '$keywords' ORDER BY `nnet_rid` DESC LIMIT $start,$end;")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){
$data=v45_sql_stripper($data);
$tmp_array[$int_counter]=$data;
$int_counter++;
}
mysql_free_result($result);
return $tmp_array;
}
function forums_comment_total($input,$type){
global $CONFIG,$MAP_DB;
$type=($type==1)? 'nnet_cid' : 'nnet_aid';
extract(v45_sql_stripper(mysql_fetch_array(mysql_query("SELECT COUNT(`nnet_rid`) AS `totalsize` FROM `{$CONFIG['sql_db']}`.`nnet_reviews` WHERE `$type`='$input'"),MYSQL_ASSOC)));
return $totalsize;
}
function forums_comment_edit($input,$action){
global $CONFIG,$MAP_DB;
if($action=='r'){
return (v45_sql_stripper(mysql_fetch_array(mysql_query("SELECT `nnet_rid` AS `comment_id`,`nnet_aid` AS `article_id`,`nnet_cid` AS `category_id`,`nnet_uid` AS `comment_uid`,`nnet_title` AS `comment_title`,`nnet_poster` AS `comment_uname`,`nnet_rate` AS `comment_rate`,`nnet_msg` AS `comment_msg`,`nnet_date` AS `comment_date` FROM `{$CONFIG['sql_db']}`.`nnet_reviews` WHERE `nnet_rid`='{$input}' LIMIT 1"),MYSQL_ASSOC)));
} else {
mysql_query("UPDATE `{$CONFIG['sql_db']}`.`nnet_reviews` SET `nnet_aid`='{$input['article_id']}',`nnet_cid`='{$input['category_id']}',`nnet_uid`='{$input['comment_uid']}',`net_title`='{$input['comment_title']}',`nnet_poster`='{$input['comment_uname']}',`nnet_rate`='{$input['comment_rate']}',`nnet_msg`='{$input['comment_msg']}',`nnet_date`='{NEPHP_CTIME}' WHERE `nnet_rid`='{$input['comment_id']}' LIMIT 1")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
}
}
function forums_login($input){
global $gbl_env,$CONFIG,$INT_CONF,$access_hash,$_SERVER;
forum_sql_connect(1);
extract(v45_sql_stripper(mysql_fetch_array(mysql_query("SELECT `userid` AS `user_uid`,`styleid`,`lastactivity` FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}user` WHERE `username`='{$gbl_env['user_usr']}' AND `password`='".md5($gbl_env['user_pwd'])."' LIMIT 1"),MYSQL_ASSOC)));
if($user_uid<1){
printr("javascript:history.go(-1);","Invalid access combination. Please go back and try again....","{$CONFIG['dir_main']}/templates/common_redirect.html");
}
mysql_query("INSERT INTO `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}session` SET `sessionhash`='$access_hash',`userid`='$user_uid',`host`='".getenv("HTTP_REFERER")."',`useragent`='".addslashes(stripslashes($_SERVER["HTTP_USER_AGENT"]))."',`lastactivity`='$lastactivity',`styleid`='$styleid'")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
forum_sql_connect(2);
$int_long= time() + 30240000;
setcookie('sessionhash',"$access_hash","$int_long",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
setcookie('bbuserid',"$user_uid","$int_long",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
setcookie('bbpassword',md5($gbl_env['user_pwd']),"$int_long",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
}
function forums_logout($input){
global $HTTP_COOKIE_VARS,$INT_CONF;
forum_sql_connect(1);
mysql_query("DELETE FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}session` WHERE `sessionhash`='{$HTTP_COOKIE_VARS['sessionhash']}' LIMIT 1")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
$int_del = time()-31536001 ;
///////////////////////////////////////////////////////////////////////////////////////////////
// DELETE COOKIES HERE //
///////////////////////////////////////////////////////////////////////////////////////////////
setcookie('sessionhash',"","$int_del",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
setcookie('bbuserid',"","$int_del",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
setcookie('bbpassword',"","$int_del",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
setcookie('nephp4x',"","$int_del",HTTP_COOKIE_PATH,HTTP_COOKIE_DOMAIN,HTTP_COOKIE_SECURE);
forum_sql_connect(2);
}
function forums_get_groups($db_info){
global $HTTP_COOKIE_VARS,$INT_CONF;
forum_sql_connect(1);
$result=mysql_query("SELECT `usergroupid` AS `forum_group_id`,`title` AS `forum_group_title` FROM `$db_info`.`usergroup`")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
$tmp_array=array();
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){
$data=v45_sql_stripper($data);
$tmp_array[]=$data;
}
mysql_free_result($result);
forum_sql_connect(2);
return $tmp_array;
}
function forums_forums_fetch(){
global $HTTP_COOKIE_VARS,$INT_CONF;
forum_sql_connect(1);
$result=mysql_query("SELECT `forumid`,`title` FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}forum` WHERE `allowposting`='1'")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
$tmp_hash=array();
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){
$data=v45_sql_stripper($data);
$tmp_hash[]=$data;
}
mysql_free_result($result);
forum_sql_connect(2);
return $tmp_hash;
}
function forum_db_setup($input=''){
/////////////////////////////////////////////////////////////////////////////
// ADD MORE FIELDS IF NECCESSARY //
/////////////////////////////////////////////////////////////////////////////
global $CONFIG,$HTTP_COOKIE_VARS,$INT_CONF,$gbl_env,$NEPHP_IMG,$m_connect;
forum_sql_connect(1);
$result=mysql_query("ALTER TABLE `$input`.`user` ADD `user_favs` TEXT NOT NULL;");
mysql_free_result($result);
$result=mysql_query("ALTER TABLE `$input`.`user` ADD `user_cats` TEXT NOT NULL;");
mysql_free_result($result);
$result=mysql_query("ALTER TABLE `$input`.`post` ADD `nnet_aid` TEXT NOT NULL;");
mysql_free_result($result);
$result=mysql_query("ALTER TABLE `$input`.`thread` ADD `nnet_aid` TEXT NOT NULL;");
mysql_free_result($result);
forum_sql_connect(2);
}
function forum_review_simulator(){
global $CONFIG,$HTTP_COOKIE_VARS,$INT_CONF,$gbl_env,$NEPHP_IMG;
$id_thread=forums_thread_id($gbl_env['nnet_aid']);
Header("Location: {$INT_CONF["forum_url"]}/newreply.php?action=newreply&threadid=$id_thread&preview=Preview%20Reply&title=".htmlspecialchars($gbl_env['comment_title'])."&message=".htmlspecialchars($gbl_env['comment_text']));
}
function forum_favs_update($input,$user_uid){
global $CONFIG,$HTTP_COOKIE_VARS,$INT_CONF,$gbl_env,$NEPHP_IMG;
forum_sql_connect(1);
mysql_query("UPDATE `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}user` SET `user_favs`='$input' WHERE `userid`='$user_uid'LIMIT 1")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
forum_sql_connect(2);
}
function forum_sql_connect($stage){
global $CONFIG,$HTTP_COOKIE_VARS,$INT_CONF,$gbl_env,$NEPHP_IMG,$m_connect,$db;
if($INT_CONF['db_user']!='' && $INT_CONF['db_user']!=$CONFIG['sql_username']){
if($stage==1 && $CONNECTION_SWITCH != 1){ // establish connection
$db->sql_disconnect();
$db = new nephp();
$db->sql_connect($CONFIG['sql_server'],$INT_CONF['db_user'],$INT_CONF['db_pass'],$CONFIG['sql_persistant'],'ERROR');
$db->set_db($INT_CONF["db"]);
$CONNECTION_SWITCH = 1;
}
if($stage==2){ // establish connection
$db->sql_disconnect();
$db = new nephp();
$db->sql_connect($CONFIG['sql_server'],$CONFIG['sql_username'],$CONFIG['sql_password'],$CONFIG['sql_persistant'],'ERROR');
$db->set_db($CONFIG['sql_db']);
$CONNECTION_SWITCH = 0;
}
}
}
function forums_comment_latest($start,$end){
global $CONFIG,$MAP_DB,$INT_CONF;$tmp_array=array();
forum_sql_connect(1);
$id_thread=forums_thread_id($input);
$result=mysql_query("SELECT `postid` AS `comment_id`,`userid` AS `comment_uid`,`title` AS `comment_title`,`username` AS `comment_uname`,`pagetext` AS `comment_msg`,`dateline` AS `comment_date` FROM `{$INT_CONF['db']}`.`{$INT_CONF['prefix']}post`,`{$INT_CONF['db']}`.`{$INT_CONF['prefix']}thread` WHERE post.threadid = thread.threadid AND thread.forumid NOT IN (XX) ORDER BY `postid` DESC LIMIT $start,$end;")
or die("MYSQL_QUERY ERROR NUMBER ".mysql_errno().": ".mysql_error());
while($data=mysql_fetch_array($result,MYSQL_ASSOC)){
$data=v45_sql_stripper($data);
$data['article_id']=$input;
$tmp_array[]=$data;
}
mysql_free_result($result);
forum_sql_connect(2);
return $tmp_array;
}
$var_test_pass=1;
$var_int_pass =1;
|