email = $email; $this->messages(); $this->createdatabases(); if ($_POST){ $this->processposts($level,$userid); } if (!isset($_GET["forum_threads"])){ echo "

WELCOME TO OUR FORUM

"; $this->list_threads($logat,$level,$userid); } else { echo "

FORUM SECTION : ".getfieldvalue("forum_threads_".$_SESSION["lang"], "forum_threads_name","forum_threads_id",$_GET["forum_threads"])."

"; $this->list_posts($_GET["forum_threads"],$logat,$level,$userid); } if ($logat){ echo "
"; echo "
"; if (!isset($_GET["forum_threads"])){ echo "

Add a new thread:
"; echo "

"; echo "

"; } else { echo "

"; echo "Post name :
"; echo "
"; echo "
"; echo "Text to insert:
"; echo "
"; echo " "; echo "

"; } echo "
"; } else { echo "
"; echo "Please register to be able to post into this forum..."; echo "
"; } $this->forumrules(); } /******************************************************************* * addthread - add a active or inactive thread according to userlevel *******************************************************************/ Function addthread($text,$level,$userid){\ if($level==9){ $query = ' INSERT INTO forum_threads_'.$_SESSION["lang"].' ( forum_threads_id , forum_threads_name , forum_threads_user , forum_threads_active ) VALUES ( "0", "'.quote_smart($text).'", "'.quote_smart($userid).'", "1" )'; } else { $query = ' INSERT INTO forum_threads_'.$_SESSION["lang"].' ( forum_threads_id , forum_threads_name , forum_threads_user , forum_threads_active ) VALUES ( "0", "'.quote_smart($text).'", "'.quote_smart($userid).'", "0" )'; sendMail($this->email,"New thread on your site","\n\nNew thread on your site\n".$text); } $result = mysql_query($query); } /******************************************************************* * list_threads - list threads of the current forum *******************************************************************/ Function list_threads($logat,$level,$userid){ $query = "select * from forum_threads_".$_SESSION["lang"]." where forum_threads_active = 1 ORDER by forum_threads_name"; $result = mysql_query($query) or die (mysql_error()); echo ""; if ($logat){ echo " "; if ($level==9){ echo " "; } echo ""; } if ($logat){ echo "


(W) = waiting for approval

"; } } /******************************************************************* * processposts - is processing the POST situation *******************************************************************/ Function processposts($level,$userid){ if ($_POST){ $submit_array = array_keys($_POST['submit']); $action = $submit_array[0]; //echo $action; switch ($action) { case 'addthread': echo "

Thread added...

"; $text = $_POST["text"]; $this->addthread($text,$level,$userid); echo "

The new threads are moderated ! Please allow 1-24 hrs for aproval.

"; break; } } } } if ($session->username!=="Guest"){ $email = $session->userinfo["email"]; } else { $email = "EMAIL UNKNOWNED"; } $forum = new forum($session->logged_in, $session->userlevel, $session->username, $email); ?>