sql_query($sql); if ( $row = $DB->sql_fetchrow($q_id) ) { // Check if item is on if( $row['i_status'] == false && empty($_SESSION['u_id'])) $FV->error("Item '" . $_GET['i_id'] ."' is off and cannot be viewed",$C); // Check if item Category is On if( $row['ic_status'] === 0 && empty($_SESSION['u_id']) && empty($_SESSION['wu_id']) ) $FV->error("Item '" . $_GET['i_id'] ."' category is off and cannot be viewed",$C); // Check if article is secure if( $row['ic_secure'] == true && empty($_SESSION['u_id']) && empty($_SESSION['wu_id']) ) $FV->error("Item '" . $_GET['i_id'] ."' is secure and cannot be viewed, please login to view the item",$C); if ( $S->val['cache'] == false || !empty($_SESSION['wu_id']) || ( $S->val['cache'] >= $row['i_cache_date']) ) { $tpl = new TemplatePower($T->get_item_set($i_id,"global"),T_BYVAR); $tpl->assignInclude("BODY",$T->get_item_set($i_id,"item_view"),T_BYVAR); $tpl->assignInclude("MENU",$T->get_item_set($i_id,"menu"),T_BYVAR); $tpl->assignInclude("ARTICLES_PREVIEW",$T->get_item_set($i_id,"articles_preview"),T_BYVAR); $tpl->assignInclude("ITEMS_PREVIEW",$T->get_item_set($i_id,"items_preview"),T_BYVAR); $tpl->assignInclude("ARTICLE_RANDOM",$T->get_item_set($i_id,"article_random"),T_BYVAR); $tpl->assignInclude("ITEM_RANDOM",$T->get_item_set($i_id,"item_random"),T_BYVAR); $tpl->prepare(); $tpl->assign("Stylesheet",$T->get_item_set($i_id,"stylesheet")); $tpl->assign("Site_Name",$S->val['site_name']); $tpl->assign("Page_Title",$row['i_title']); $tpl->assign("Keywords",$row['i_keywords']); $tpl->assign("Description",$row['i_description']); $tpl->assign("Date",date($S->val['date_format'])); if( !empty($row['ic_template_set']) ) $HTML->make_menu_site($row['ic_template_set'],$tpl,$S,$C,$T); else $HTML->make_menu_site("",$tpl,$S,$C,$T); $HTML->make_preview_articles($tpl,$S,$C); $HTML->make_preview_items($tpl,$S,$C); //$HTML->make_random_article($tpl,$S,$C); //$HTML->make_random_item($tpl,$S,$C); // Show Page $tpl->newBlock("item"); $tpl->assign("i_id",$row['i_id']); $tpl->assign("i_title",$row['i_title']); $tpl->assign("i_field1",$row['i_field1']); $tpl->assign("i_field2",$row['i_field2']); $tpl->assign("i_field3",$row['i_field3']); $tpl->assign("i_field4",$row['i_field4']); $tpl->assign("i_field5",$row['i_field5']); $tpl->assign("i_u_date",date($S->val['date_format'],$row['i_u_date'])); $tpl->assign("i_description",$row['i_description']); $tpl->assign("i_content",$row['i_content']); $thumb_image_wrapper = ''; $tpl->assign("i_thumb",$thumb_image_wrapper); ## breadcrum: if($row['i_category'] > 0) { $B->add($S->val['item_alias'], "item_list.php", 1); $B->add($row['ic_title'], "", 0); $B->output(); $tpl->assign("breadcrum", $B->html); } // Assign rss href: $tpl->assign("rss_item_href", $C->url . "/rss_feed_item.php"); if ( !empty($row['i_thumb']) ) { $tpl->newBlock("il_thumb"); $tpl->assign("i_id", $row['i_id']); $tpl->assign("i_thumb",$C->url_items_thumbs."/".$row['i_thumb']); $tpl->assign("i_field1",$row['i_field1']); $tpl->assign("i_field2",$row['i_field2']); $tpl->assign("i_field3",$row['i_field3']); $tpl->assign("i_field4",$row['i_field4']); $tpl->assign("i_field5",$row['i_field5']); } $sql_query = "SELECT * FROM `ps_item_attach`, `ps_items` WHERE `ia_i_id` = `i_id` AND `ia_i_id` = ".$i_id; $query_id = $DB->sql_query($sql_query); if($DB->sql_numrows($query_id) <> 0) { $tpl->newBlock("attachments"); while ( $attach = $DB->sql_fetchrow($query_id) ) { $tpl->newBlock("attach_row"); $real_file_name = substr($attach['ia_file_name'], strpos($attach['ia_file_name'],"_")+1); $tpl->assign("filename", $real_file_name); $kilobytes = round(($attach['ia_size'] / 1000), 1); $tpl->assign("size", $kilobytes."KB"); $tpl->assign("post", date($S->val['date_format'], $attach['ia_date'])); $tpl->assign("downloads", $attach['ia_count']); //$tpl->assign("aa_type", $attach['aa_type']); $tpl->assign("ia_id", $attach['ia_id']); $sql_query = "SELECT `ft_id` FROM `ps_file_types`, `ps_item_attach` WHERE `ft_name` = '".$attach['ia_type']."'"; $query_id2 = $DB->sql_query($sql_query); if ( $row3 = $DB->sql_fetchrow($query_id2)) $tpl->assign("ia_type",$attach['ia_type']); else $tpl->assign("ia_type","def"); } } $tpl->assignGlobal("i_field_1_alias",$S->val['i_field_1_alias']); $tpl->assignGlobal("i_field_2_alias",$S->val['i_field_2_alias']); $tpl->assignGlobal("i_field_3_alias",$S->val['i_field_3_alias']); $tpl->assignGlobal("i_field_4_alias",$S->val['i_field_4_alias']); $tpl->assignGlobal("i_field_5_alias",$S->val['i_field_5_alias']); if( ($S->val['cache'] != '0') && ($S->val['cache'] >= $row['i_cache_date']) ) { $cache = $tpl->getOutputContent(); $clean = addslashes($cache); $cond1['i_id'] = $i_id; $val1[i_cache] = $clean; $val1['i_cache_date'] = mktime(); $DB->db_update("ps_items",$val1,$cond1); } $end = benchit(); $tpl->assignGlobal("C_Time", round( $end - $start, 3 )); $tpl->assignGlobal("S_Time", date("H:i:s")); $tpl->assignGlobal("Q_Count",$DB->num_queries['total']); $tpl->printToScreen(); } else { echo $row['i_cache']; } } else $FV->error("Item '" . $_GET['a_id'] ."' is invalid and cannot be found",$C); ?>