$page->load_page($config['template_path'] . '/main.html'); } } } else { //echo 'RSS'; $page->page = '{content}'; } // Allow Addons/Functions to pass back custom jscript. global $jscript, $jscript_last; $jscript = ''; $jscript_last = ''; //Load Content $page->replace_tags(array('content')); //Replace Permission tags first $page->replace_permission_tags(); $page->replace_urls(); $page->replace_meta_template_tags(); $page->auto_replace_tags(); // Load js last to make sure all custom js was added $page->replace_tags(array('load_js', 'load_js_last')); //Replace Languages $page->replace_lang_template_tags(); $page->replace_css_template_tags(); $page->output_page(); $conn->Close(); // Close Buffer $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; // Display TIme $end_time = $misc->getmicrotime();
function renderNotifyListings($listingIDArray, $search_title, $user_name, $email) { global $conn, $lang, $config, $db_type, $current_ID; //Load the Core Template class and the Misc Class require_once $config['basepath'] . '/include/class/template/core.inc.php'; $page = new page_user(); require_once $config['basepath'] . '/include/misc.inc.php'; $misc = new misc(); require_once $config['basepath'] . '/include/listing.inc.php'; $listingclass = new listing_pages(); //Declare an empty display variable to hold all output from function. $display = ''; //If We have a $current_ID save it $old_current_ID = ''; if ($current_ID != '') { $old_current_ID = $current_ID; } //Load the Notify Listing Template specified in the Site Config $page->load_page($config['template_path'] . '/' . $config['notify_listings_template']); // Determine if the template uses rows. // First item in array is the row conent second item is the number of block per block row $notify_template_row = $page->get_template_section_row('notify_listing_block_row'); if (is_array($notify_template_row)) { $row = $notify_template_row[0]; $col_count = $notify_template_row[1]; $user_rows = true; $x = 1; //Create an empty array to hold the row conents $new_row_data = array(); } else { $user_rows = false; } $notify_template_section = ''; foreach ($listingIDArray as $current_ID) { if ($user_rows == true && $x > $col_count) { //We are at then end of a row. Save the template section as a new row. $new_row_data[] = $page->replace_template_section('notify_listing_block', $notify_template_section, $row); //$new_row_data[] = $notify_template_section; $notify_template_section = $page->get_template_section('notify_listing_block'); $x = 1; } else { $notify_template_section .= $page->get_template_section('notify_listing_block'); } $listing_title = $listingclass->get_title($current_ID); if ($config['url_style'] == '1') { $notify_url = $config['baseurl'] . '/index.php?action=listingview&listingID=' . $current_ID; // ##### } else { $url_title = str_replace("/", "", $listing_title); $url_title = strtolower(str_replace(" ", $config['seo_url_seperator'], $url_title)); $notify_url = $config['baseurl'] . '/listing-' . misc::urlencode_to_sef($url_title) . '-' . $current_ID . '.html'; // ##### } $notify_template_section = $page->replace_listing_field_tags($current_ID, $notify_template_section); $notify_template_section = $page->replace_listing_field_tags($current_ID, $notify_template_section); $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_url', $notify_url); $notify_template_section = $page->parse_template_section($notify_template_section, 'listingid', $current_ID); // Setup Image Tags $sql2 = "SELECT listingsimages_thumb_file_name,listingsimages_file_name\n\t\t\t\t\tFROM " . $config['table_prefix'] . "listingsimages\n\t\t\t\t\tWHERE (listingsdb_id = {$current_ID})\n\t\t\t\t\tORDER BY listingsimages_rank"; $recordSet2 = $conn->SelectLimit($sql2, 1, 0); if ($recordSet2 === false) { $misc->log_error($sql2); } if ($recordSet2->RecordCount() > 0) { $thumb_file_name = $misc->make_db_unsafe($recordSet2->fields['listingsimages_thumb_file_name']); $file_name = $misc->make_db_unsafe($recordSet2->fields['listingsimages_file_name']); if ($thumb_file_name != "" && file_exists("{$config['listings_upload_path']}/{$thumb_file_name}")) { // gotta grab the thumbnail image size $imagedata = GetImageSize("{$config['listings_upload_path']}/{$thumb_file_name}"); $imagewidth = $imagedata[0]; $imageheight = $imagedata[1]; $shrinkage = $config['thumbnail_width'] / $imagewidth; $notify_thumb_width = $imagewidth * $shrinkage; $notify_thumb_height = $imageheight * $shrinkage; $notify_thumb_src = $config['listings_view_images_path'] . '/' . $thumb_file_name; // gotta grab the thumbnail image size $imagedata = GetImageSize("{$config['listings_upload_path']}/{$file_name}"); $imagewidth = $imagedata[0]; $imageheight = $imagedata[1]; $notify_width = $imagewidth; $notify_height = $imageheight; $notify_src = $config['listings_view_images_path'] . '/' . $file_name; } } else { if ($config['show_no_photo'] == 1) { $imagedata = GetImageSize($config['basepath'] . "/images/nophoto.gif"); $imagewidth = $imagedata[0]; $imageheight = $imagedata[1]; $shrinkage = $config['thumbnail_width'] / $imagewidth; $notify_thumb_width = $imagewidth * $shrinkage; $notify_thumb_height = $imageheight * $shrinkage; $notify_thumb_src = $config['baseurl'] . '/images/nophoto.gif'; $notify_width = $notify_thumb_width; $notify_height = $notify_thumb_height; $notify_src = $config['baseurl'] . '/images/nophoto.gif'; } else { $notify_thumb_width = ''; $notify_thumb_height = ''; $notify_thumb_src = ''; $notify_width = ''; $notify_height = ''; $notify_src = ''; } } if (!empty($notify_thumb_src)) { $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_thumb_src', $notify_thumb_src); $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_thumb_height', $notify_thumb_height); $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_thumb_width', $notify_thumb_width); $notify_template_section = $page->cleanup_template_block('notify_img', $notify_template_section); } else { $notify_template_section = $page->remove_template_block('notify_img', $notify_template_section); } if (!empty($notify_src)) { $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_large_src', $notify_src); $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_large_height', $notify_height); $notify_template_section = $page->parse_template_section($notify_template_section, 'notify_large_width', $notify_width); $notify_template_section = $page->cleanup_template_block('notify_img_large', $notify_template_section); } else { $notify_template_section = $page->remove_template_block('notify_img_large', $notify_template_section); } if ($user_rows == true) { $x++; } } if ($user_rows == true) { $notify_template_section = $page->cleanup_template_block('notify_listing', $notify_template_section); $new_row_data[] = $page->replace_template_section('notify_listing_block', $notify_template_section, $row); $replace_row = ''; foreach ($new_row_data as $rows) { $replace_row .= $rows; } $page->replace_template_section_row('notify_listing_block_row', $replace_row); } else { $page->replace_template_section('notify_listing_block', $notify_template_section); } $page->replace_permission_tags(); $page->replace_urls(); $page->auto_replace_tags(); $page->replace_lang_template_tags(); $display .= $page->return_page(); $current_ID = ''; if ($old_current_ID != '') { $current_ID = $old_current_ID; } return $display; }