",$stringtodecode) ; } } return html_entity_decode($stringtodecode); //return $stringtodecode; } } header("Cache-Control: no-store, no-cache"); include("includes/util.class.php"); include("includes/commons.php"); include("login.php"); //make a database connection // get the details of the article whos id is passed on to this page $database = new ArticlesDatabase(); $articleid = $_GET['aid']; // this is the id of the article we are looking for into the database $database->field_name = array("articleid"); $database->field_value =array($_GET['aid']); $database->table_name = "Articles"; $result = $database->filtering_record(); $articlebody =""; if($result){ $row = mysql_fetch_object($result); $articlehead = $row->articlename; $database->field_name = array("articleid"); $database->field_value =array($_GET['aid']); //get the details from the articles details table $database->table_name = "Articles_Details"; $resultdetails = $database->filtering_record(); // prepare the article body while ($rowdetails = mysql_fetch_array($resultdetails)) { $database->table_name = "Article_Headings"; $database->field_name =array("headid"); $database->field_value= array($rowdetails['headid']); $resultinner = $database->filtering_record(); $rowinner = mysql_fetch_array($resultinner); $title = $rowinner['title']; $articlebody .= " <".$rowinner['style'].">" .$title."" ." "; $articlebody .= "
".htmlentities($rowdetails['body'])."
"; } $copyright = $row->copyright; $signature = $row->signature; $keywords = $row->keywordstitle; $dateadded = strftime("%B %d, %G",strtotime($row->dateadded)); $database->field_name = array("userid"); $database->field_value =array($row->userid); $database->table_name = "Users"; $userid = $row->userid; unset($result); unset($resultinner); unset($row); unset($rowinner); $result = $database->filtering_record(); $row = mysql_fetch_object($result); $username = $row->username; $avatar = $row->avatar; $articles = array() ; $database->field_name = array("userid"); //select the articles by the user $database->field_value = array($userid); $database->table_name = "Articles"; $result = $database->filtering_record(); if($result){ $tpl->assign("ARTICLES","yes"); while($row = mysql_fetch_array($result)) array_push($articles,$row); $tpl->assign ( "ITERATEARTICLES" , $articles ) ; } } else{ $errors[]="Article is either not active or deleted from the system. This artile no longer exist in the system"; $tpl->assign("dontshow","dontshow"); } // url that will be used for the links $url_for_current_page = urlencode("articles.php?aid=".$articleid); // make the arrray of the post message so that they can be assigned to the template file //making of array ends here /******************************************************************************************************* RENDER THE PAGE *******************************************************************************************************/ if($_GET['xcode'] == "gfc") { $tpl->assign("STYLESHEET","../styles/default.css"); $tpl->assign("extraimagepath","../"); $tpl->assign("addedjavascriptpath","../"); $tpl->assign("murl","../"); $murl = "../"; } $tpl->assign("TITLE",html_entity_decode($articlehead) ." ".$keywords); $tpl->assign("ARTICLE_HEADING",html_entity_decode($articlehead)); $tpl->assign("PAGE_NAVIGATION","Home > Articles > $articlehead"); $tpl->assign("AUTHOR_DATE","By $username, $dateadded"); $tpl->assign("AUTHORIMAGE",$upload_dir.$avatar); $tpl->assign("ARTICLE_CONTENT",html_entity_decode(html_entity_decode($articlebody))); $tpl->assign("ARTICLE_SIGNATURE",$signature); $tpl->assign("ARTICLE_COPYRIGHT",$copyright); $tpl->assign("ARTICLEID",$_GET['aid']); $tpl->assign("NEW_MESSAGE_URL","newthread.php?url=$url_for_current_page&aid=$articleid"); $tpl->assign("REFRESH_URL",$url_for_current_page); $tpl->assign("START_URL",""); $tpl->assign("END_URL",""); $tpl->assign("FROM_TO_REPLACE",""); $tpl->assign("TO_TO_REPLACE",""); $tpl->assign("TOTAL_TO_REPLACE",""); $tpl->assign("errors",$errors); $treedatabase = new treedatabase(); $sql = 'SET NAMES utf8'; $treedatabase->Execute($sql); require_once('includes/dbtree.class.php'); // Create new object $dbtree = new dbtree('Sections', 'section', $treedatabase); // the conversation tree to be displayed $dbtree->Full($articleid,false,$nospam,$noabuse); // Check class errors if (!empty($dbtree->ERRORS_MES)) { $errors[] = 'Message board can not be displayed for come reason.'; } $counter = 0; $traversalarray =array(); while ($item = $dbtree->NextRow()) { $traversalarray[$counter] = $item; $counter++; } $tpl->assign("tree",$traversalarray); /******************************************************************************************************* ENDS HERE *******************************************************************************************************/ // THIS LINE BELOW MUST BE AFTER THE ABOVE ELSE THE LOGIC WILL NOT WORK // NO NEED TO CHANGE THE VARIABLE NAMES UNLESS UNTIL YOU ARE SURE WHAT YOU DOING*/ if ($_SESSION['MRAGENISLOGGEDON'] ==2){ $tpl->assign('message_logon',"Invalid Login.."); } elseif($_SESSION['MRAGENISLOGGEDON'] ==3 || $_SESSION['MRANDERSONISLOGGEDON'] == 3){ $tpl->assign("TOPBARUSER",$_SESSION['name']); } if ($_SESSION['MAXTRIESEXCEED']){ $tpl->assign('message_logon',"Maximum Login tries Exceded. Click here to retrive new password"); } $myobj = new Htmldecode; // registering the object (will be by reference) $tpl->assign_by_ref("myobj", $myobj); // we are making this assignment from here as we can not use php functions from smarty template directly $tpl->assign('wherepage',"index");//where is the user $tpl->display("discuss_article.tpl"); ?>