PluginPlace("hook_php_detail_DefaultField_begin"); /* default field*/ $query_fields = "select * from idx_default_field where visible='1'"; $result_fields = $dbConn->Execute($query_fields); while (!$result_fields->EOF) { $new_var_visible = $result_fields->Fields('field_name').'_is_visible'; global $$new_var_visible; $$new_var_visible = 1; $tpl->assign($new_var_visible,$$new_var_visible); $result_fields->MoveNext(); } $plug->PluginPlace("hook_php_detail_DefaultField_end"); } /*=================================================== ShowDetailPage() ===================================================*/ function ShowDetailPage() { // vars global configuration global $tpl, $dbConn, $theme_name, $theme_path, $rev_max_rows, $category_separator; // vars url & form global $id; // vars messages global $msg, $plug; // vars template global $link_detail, $pagination, $review_rows, $ofc_review, $page_title, $link_id, $link_title, $link_description, $link_keywords, $category_id, $category_name, $category_path, $category_path_with_link, $num_review, $avg_review, $avg_review_image, $links_obj, $dbConn; global $links_obj; $plug->PluginPlace("hook_php_detail_ShowDetailPage_begin"); $plug->setHook("hook_php_link_class_display_begin","DefaultField"); $links_obj = new clsLink; $links_obj->query = "select * from idx_link where link_id = '$id'"; $links_obj->table_name = "idx_link"; $links_obj->category_table_name = "idx_category"; $links_obj->review_table_name = "idx_review"; $links_obj->category_separator = $category_separator; $links_obj->max_rows = 1; $links_obj->rating_image_path = $site_url . "themes/" . $theme_name . "/images/rating/"; $links_obj->rev_rating_image_path = $site_url . "themes/" . $theme_name . "/images/review/"; $links_obj->date_format = $msg["10161"]; $links_obj->template_file = $theme_path . "detail_link.html"; $link_detail = $links_obj->Display(); // link data $query = "select * from idx_link where link_id = '$id'"; $row = $dbConn->FetchOne($query); $link_id = $id; $link_title = $row["title"]; $link_description = strip_tags($row["description"]); $link_keywords = strip_tags($row["keywords"]); $page_title = $link_title; // official review $ofc_review = $row["official_review"]; $category_id = $row["category_id"]; if (!empty($ofc_review)) { $ofc_review_html = $msg["10163"]; if (empty($ofc_review_html)) { $ofc_review_html = '<%$ofc_review%>'; } } $tpl->assign('ofc_review', $ofc_review); $ofc_review = $tpl->fetch('var:' . $ofc_review_html); // review $links_obj->pg_size = $rev_max_rows; $links_obj->href = "detail.php"; $links_obj->more_param = "&linkid=$id"; $links_obj->template_file = $theme_path . "review_rows.html"; if ($links_obj->GetNumberOfReview($id) > 0) { $avg_review = $row["avg_review"]; $num_review = $row["reviews"]; if ($avg_review != floor($avg_review)) { $avg_review_image = "\"$avg_review\""; } else { $avg_review_image = "\"$avg_review\""; } $tpl->assign('avg_review', $avg_review); $tpl->assign('num_review', $num_review); $tpl->assign('avg_review_image', $avg_review_image); $review_header = $tpl->fetch('var:' . $msg["10162"]); $links_obj->header = $review_header; $review_rows = $links_obj->header; $review_rows .= $links_obj->DisplayReview($id); } $pagination = $links_obj->pagination; $query = "select name, path, path_with_url from idx_category a left join idx_category_path b on (a.category_id = b.category_id) where a.category_id = '$category_id'"; $row = $dbConn->FetchOne($query); $category_name = $row['name']; $category_path = $row['path']; $category_path_with_link = $row['path_with_url']; $plug->PluginPlace("hook_php_detail_ShowDetailPage_end"); DisplayTemplate($theme_path . "detail.html", "\$page_title,\$link_id,\$link_title,\$link_description,". "\$link_keywords,\$link_detail,\$avg_review,\$num_review,". "\$avg_review_image,\$review_rows,\$ofc_review,\$pagination,". "\$category_id,\$category_name,\$category_path,". "\$category_path_with_link"); } /*=================================================== main ===================================================*/ include "application.php"; AddFilter("page_cache"); RunPreFilter(__FILE__); $plug->PluginPlace("hook_php_detail_begin"); $page_identifier = "detail.php"; if (!defined('CACHED_PAGE')) { if (empty($id)) { $id = $linkid; } $query = "select link_id, suspended, category_id, cat1, cat2 from idx_link where link_id = '$id'"; $row = $dbConn->FetchOne($query); // check if exist if (!$row['link_id']) { RemoveFilter('page_cache'); header("HTTP/1.0 404 Not Found"); $requested_url = $_SERVER["REQUEST_URI"]; DisplayTemplate($theme_path . "404.html", "\$requested_url"); RunPostFilter(__FILE__); } // check if suspended if ($row['suspended']) { RemoveFilter('page_cache'); $pg_generic_title = PT_SUSPENDED_LINK; $pg_generic_message = $lang['link_suspended']; DisplayTemplate($theme_path . "generic.html", "\$pg_generic_title,\$pg_generic_message"); RunPostFilter(__FILE__); } // check categories permission $category_id = $row["category_id"]; $cat1 = $row["cat1"]; $cat2 = $row["cat2"]; $category_obj = new clsCategory; $category_obj->table_name = "idx_category"; if ($category_obj->GetAccessPermission($category_id) == 1 || $category_obj->GetAccessPermission($cat1) == 1 || $category_obj->GetAccessPermission($cat2) == 1) { RemoveFilter("page_cache"); ExecuteFilter("validate_user"); } ShowDetailPage(); } $plug->PluginPlace("hook_php_detail_end"); RunPostFilter(__FILE__); ?>