コード例 #1
0
 public static function listing_view()
 {
     global $conn, $lang, $config;
     $display = '';
     if (isset($_GET['listingID']) && $_GET['listingID'] != "" && is_numeric($_GET['listingID'])) {
         $sql = 'SELECT listingsdb_id FROM ' . $config['table_prefix'] . 'listingsdb WHERE listingsdb_id=' . $_GET['listingID'];
         $recordSet = $conn->Execute($sql);
         if ($recordSet === false) {
             $misc->log_error($sql);
         }
         $num = $recordSet->RecordCount();
         if ($num != 0) {
             // first, check to see whether the listing is currently active
             $show_listing = listing_pages::checkActive($_GET['listingID']);
             if ($show_listing == "yes") {
                 require_once $config['basepath'] . '/include/class/template/core.inc.php';
                 $page = new page_user();
                 //Lookup Class
                 $sql2 = "SELECT class_id FROM " . $config['table_prefix_no_lang'] . "classlistingsdb WHERE listingsdb_id = {$_GET['listingID']}";
                 $recordSet2 = $conn->SelectLimit($sql2, 1, 0);
                 $num = $recordSet2->RecordCount();
                 if ($recordSet2 === false) {
                     $misc->log_error($sql2);
                 }
                 $class = $recordSet2->fields['class_id'];
                 if (file_exists($config['template_path'] . '/listing_detail_pclass' . $class . '.html')) {
                     $page->load_page($config['template_path'] . '/listing_detail_pclass' . $class . '.html');
                 } else {
                     $page->load_page($config['template_path'] . '/' . $config['listing_template']);
                 }
                 $sections = explode(',', $config['template_listing_sections']);
                 foreach ($sections as $section) {
                     $replace = listing_pages::renderTemplateArea($section, $_GET['listingID']);
                     $page->replace_tag($section, $replace);
                 }
                 $page->replace_listing_field_tags($_GET['listingID']);
                 // Check to see if listing owner is an admin only.
                 $is_admin = listing_pages::getListingAgentAdminStatus($_GET['listingID']);
                 if ($is_admin == true && $config["show_listedby_admin"] == 0) {
                     $page->page = $page->remove_template_block('show_listed_by_admin', $page->page);
                     $page->page = $page->cleanup_template_block('!show_listed_by_admin', $page->page);
                 } else {
                     $page->page = $page->cleanup_template_block('show_listed_by_admin', $page->page);
                     $page->page = $page->remove_template_block('!show_listed_by_admin', $page->page);
                 }
                 if ($config['show_next_prev_listing_page'] == 1) {
                     $next_prev = listing_pages::listing_next_prev();
                     $page->page = str_replace('{next_prev}', $next_prev, $page->page);
                 } else {
                     $page->page = str_replace('{next_prev}', '', $page->page);
                 }
                 require_once $config['basepath'] . '/include/vtour.inc.php';
                 $goodvtour = vtours::goodvtour($_GET['listingID']);
                 if ($goodvtour == true) {
                     $page->page = $page->cleanup_template_block('vtour_tab', $page->page);
                 } else {
                     $page->page = $page->remove_template_block('vtour_tab', $page->page);
                 }
                 $display .= $page->return_page();
             } else {
                 $display .= $lang['this_listing_is_not_active'];
             }
         } else {
             $display .= "<a href=\"index.php\">{$lang['perhaps_you_were_looking_something_else']}</a>";
         }
     } else {
         $display .= "<a href=\"index.php\">{$lang['perhaps_you_were_looking_something_else']}</a>";
     }
     return $display;
 }