Exemplo n.º 1
0
 function replace_listing_field_tags($listing_id, $tempate_section = '', $utf8HTML = false)
 {
     global $lang;
     if (is_numeric($listing_id)) {
         global $config, $conn, $or_replace_listing_id, $or_replace_listing_owner;
         $or_replace_listing_id = $listing_id;
         require_once $config['basepath'] . '/include/listing.inc.php';
         require_once $config['basepath'] . '/include/vtour.inc.php';
         require_once $config['basepath'] . '/include/misc.inc.php';
         $misc = new misc();
         if ($tempate_section != '') {
             $tsection = true;
         } else {
             $tempate_section = $this->page;
             $tsection = false;
         }
         if ($utf8HTML) {
             //Deal with listing field blocks
             $lf_blocks = array();
             preg_match_all('/{listing_field_([^{}]*?)_block}/', $tempate_section, $lf_blocks);
             require_once $config['basepath'] . '/include/user.inc.php';
             global $or_replace_listing_owner;
             if (count($lf_blocks) > 1) {
                 foreach ($lf_blocks[1] as $block) {
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $value = listing_pages::renderSingleListingItem($or_replace_listing_id, $block, 'rawvalue');
                     if ($value == '') {
                         $tempate_section = preg_replace('/{listing_field_' . $block . '_block}(.*?){\\/listing_field_' . $block . '_block}/is', '', $tempate_section);
                     } else {
                         $tempate_section = str_replace('{listing_field_' . $block . '_block}', '', $tempate_section);
                         $tempate_section = str_replace('{/listing_field_' . $block . '_block}', '', $tempate_section);
                     }
                 }
             }
             // Handle Caption Only
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)_caption}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return htmlentities(utf8_encode(listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1],\'caption\')), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             // Hanle Value Only
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)_value}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return htmlentities(utf8_encode(listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1],\'value\')), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             // Handle Raw Value
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)_rawvalue}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return htmlentities(utf8_encode(listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1],\'rawvalue\')), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             // Handle Both Caption and Value
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return htmlentities(utf8_encode(listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1])), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::get_title($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_title}', $value, $tempate_section);
             $value = listing_pages::get_title($listing_id);
             if ($config["controlpanel_mbstring_enabled"] == 1) {
                 if (mb_detect_encoding($value) != 'UTF-8') {
                     $value = utf8_encode($value);
                 }
             }
             $tempate_section = str_replace('{rss_listing_title}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::getListingAgent($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_agent_name}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::getListingAgentFirstName($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_agent_first_name}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::getListingAgentLastName($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_agent_last_name}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::getListingAgentLink($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_agent_link}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::get_pclass($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_pclass}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::getAgentListingsLink($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_agent_listings}', $value, $tempate_section);
             $value = htmlentities(utf8_encode(listing_pages::getListingAgentID($listing_id)), ENT_QUOTES, 'UTF-8');
             $tempate_section = str_replace('{listing_agent_id}', $value, $tempate_section);
             // Get listing owner
             $owner_sql = 'SELECT userdb_id FROM ' . $config['table_prefix'] . 'listingsdb WHERE (listingsdb_id = ' . $or_replace_listing_id . ')';
             $recordSet = $conn->execute($owner_sql);
             $or_replace_listing_owner = $recordSet->fields['userdb_id'];
             //New listing_agent_field_****_block tag handler for 2.4.1
             $laf_blocks = array();
             preg_match_all('/{listing_agent_field_([^{}]*?)_block}/', $tempate_section, $laf_blocks);
             require_once $config['basepath'] . '/include/user.inc.php';
             global $or_replace_listing_owner;
             if (count($laf_blocks) > 1) {
                 foreach ($laf_blocks[1] as $block) {
                     $value = user::renderSingleListingItem($or_replace_listing_owner, $block, 'rawvalue');
                     if ($value == '') {
                         $tempate_section = preg_replace('/{listing_agent_field_' . $block . '_block}(.*?){\\/listing_agent_field_' . $block . '_block}/is', '', $tempate_section);
                     } else {
                         $tempate_section = str_replace('{listing_agent_field_' . $block . '_block}', '', $tempate_section);
                         $tempate_section = str_replace('{/listing_agent_field_' . $block . '_block}', '', $tempate_section);
                     }
                 }
             }
             // Replace listing_agent tags
             // Handle Caption Only
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)_caption}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return htmlentities(utf8_encode(user::renderSingleListingItem($or_replace_listing_owner, $matches[1],\'caption\')), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             // Hanle Value Only
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)_value}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return htmlentities(utf8_encode(user::renderSingleListingItem($or_replace_listing_owner, $matches[1],\'value\')), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             // Handle Raw Value
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)_rawvalue}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return htmlentities(utf8_encode(user::renderSingleListingItem($or_replace_listing_owner, $matches[1],\'rawvalue\')), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
             // Handle Both Caption and Value
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return htmlentities(utf8_encode(user::renderSingleListingItem($or_replace_listing_owner, $matches[1])), ENT_QUOTES, \'UTF-8\');'), $tempate_section);
         } else {
             //Deal with listing field blocks
             $lf_blocks = array();
             preg_match_all('/{listing_field_([^{}]*?)_block}/', $tempate_section, $lf_blocks);
             require_once $config['basepath'] . '/include/user.inc.php';
             global $or_replace_listing_owner;
             if (count($lf_blocks) > 1) {
                 foreach ($lf_blocks[1] as $block) {
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $value = listing_pages::renderSingleListingItem($or_replace_listing_id, $block, 'rawvalue');
                     if ($value == '') {
                         $tempate_section = preg_replace('/{listing_field_' . $block . '_block}(.*?){\\/listing_field_' . $block . '_block}/is', '', $tempate_section);
                     } else {
                         $tempate_section = str_replace('{listing_field_' . $block . '_block}', '', $tempate_section);
                         $tempate_section = str_replace('{/listing_field_' . $block . '_block}', '', $tempate_section);
                     }
                 }
             }
             // Handle Caption Only
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)_caption}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1],\'caption\');'), $tempate_section);
             // Hanle Value Only
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)_value}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1],\'value\');'), $tempate_section);
             // Handle Raw Value
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)_rawvalue}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1],\'rawvalue\');'), $tempate_section);
             // Handle Both Caption and Value
             $tempate_section = preg_replace_callback('/{listing_field_([^{}]*?)}/', create_function('$matches', 'global $config,$or_replace_listing_id,$lang;require_once($config[\'basepath\'].\'/include/listing.inc.php\'); return listing_pages::renderSingleListingItem($or_replace_listing_id, $matches[1]);'), $tempate_section);
             $value = listing_pages::get_title($listing_id);
             $tempate_section = str_replace('{listing_title}', $value, $tempate_section);
             $value = listing_pages::getListingAgent($listing_id);
             $tempate_section = str_replace('{listing_agent_name}', $value, $tempate_section);
             $value = listing_pages::getListingAgentFirstName($listing_id);
             $tempate_section = str_replace('{listing_agent_first_name}', $value, $tempate_section);
             $value = listing_pages::getListingAgentLastName($listing_id);
             $tempate_section = str_replace('{listing_agent_last_name}', $value, $tempate_section);
             $value = listing_pages::getListingAgentLink($listing_id);
             $tempate_section = str_replace('{listing_agent_link}', $value, $tempate_section);
             $value = listing_pages::get_pclass($listing_id);
             $tempate_section = str_replace('{listing_pclass}', $value, $tempate_section);
             $value = listing_pages::getAgentListingsLink($listing_id);
             $tempate_section = str_replace('{listing_agent_listings}', $value, $tempate_section);
             $value = listing_pages::getListingAgentID($listing_id);
             $tempate_section = str_replace('{listing_agent_id}', $value, $tempate_section);
             // Get listing owner
             $owner_sql = 'SELECT userdb_id FROM ' . $config['table_prefix'] . 'listingsdb WHERE (listingsdb_id = ' . $or_replace_listing_id . ')';
             $recordSet = $conn->execute($owner_sql);
             $or_replace_listing_owner = $recordSet->fields['userdb_id'];
             $laf_blocks = array();
             preg_match_all('/{listing_agent_field_([^{}]*?)_block}/', $tempate_section, $laf_blocks);
             require_once $config['basepath'] . '/include/user.inc.php';
             global $or_replace_listing_owner;
             if (count($laf_blocks) > 1) {
                 foreach ($laf_blocks[1] as $block) {
                     $value = user::renderSingleListingItem($or_replace_listing_owner, $block, 'rawvalue');
                     if ($value == '') {
                         $tempate_section = preg_replace('/{listing_agent_field_' . $block . '_block}(.*?){\\/listing_agent_field_' . $block . '_block}/is', '', $tempate_section);
                     } else {
                         $tempate_section = str_replace('{listing_agent_field_' . $block . '_block}', '', $tempate_section);
                         $tempate_section = str_replace('{/listing_agent_field_' . $block . '_block}', '', $tempate_section);
                     }
                 }
             }
             // Replace listing_agent tags
             // Handle Caption Only
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)_caption}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($or_replace_listing_owner, $matches[1],\'caption\');'), $tempate_section);
             // Hanle Value Only
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)_value}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($or_replace_listing_owner, $matches[1],\'value\');'), $tempate_section);
             // Handle Raw Value
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)_rawvalue}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($or_replace_listing_owner, $matches[1],\'rawvalue\');'), $tempate_section);
             // Handle Both Caption and Value
             $tempate_section = preg_replace_callback('/{listing_agent_field_([^{}]*?)}/', create_function('$matches', 'global $config,$or_replace_listing_owner,$lang;require_once($config[\'basepath\'].\'/include/user.inc.php\'); return user::renderSingleListingItem($or_replace_listing_owner, $matches[1]);'), $tempate_section);
         }
         // Listing Images
         $sql2 = "SELECT listingsdb_title FROM " . $config['table_prefix'] . "listingsdb WHERE listingsdb_id = {$listing_id}";
         $recordSet2 = $conn->Execute($sql2);
         if (!$recordSet2) {
             $misc->log_error($sql2);
         }
         $Title = $misc->make_db_unsafe($recordSet2->fields['listingsdb_title']);
         if ($config['url_style'] == '1') {
             $url = '<a href="index.php?action=listingview&amp;listingID=' . $listing_id . '">';
             $fullurl = '<a href="' . $config["baseurl"] . '/index.php?action=listingview&amp;listingID=' . $listing_id . '">';
             // Listing Link
             $tempate_section = str_replace('{link_to_listing}', 'index.php?action=listingview&amp;listingID=' . $listing_id, $tempate_section);
             $tempate_section = str_replace('{fulllink_to_listing}', $config['baseurl'] . '/index.php?action=listingview&amp;listingID=' . $listing_id, $tempate_section);
         } else {
             $url_title = str_replace("/", "", $Title);
             $url_title = strtolower(str_replace(" ", $config['seo_url_seperator'], $url_title));
             $url = '<a href="listing-' . misc::urlencode_to_sef($url_title) . '-' . $listing_id . '.html">';
             $fullurl = '<a href="' . $config["baseurl"] . '/listing-' . misc::urlencode_to_sef($url_title) . '-' . $listing_id . '.html">';
             // Listing Link
             $tempate_section = str_replace('{link_to_listing}', 'listing-' . misc::urlencode_to_sef($url_title) . '-' . $listing_id . '.html', $tempate_section);
             $tempate_section = str_replace('{fulllink_to_listing}', '' . $config["baseurl"] . '/listing-' . misc::urlencode_to_sef($url_title) . '-' . $listing_id . '.html', $tempate_section);
         }
         // grab the listing's image
         $sql2 = "SELECT listingsimages_id, listingsimages_caption, listingsimages_thumb_file_name, listingsimages_file_name FROM " . $config['table_prefix'] . "listingsimages WHERE listingsdb_id = {$listing_id} ORDER BY listingsimages_rank";
         $recordSet2 = $conn->Execute($sql2);
         if (!$recordSet2) {
             $misc->log_error($sql2);
         }
         $num_images = $recordSet2->RecordCount();
         if ($num_images == 0) {
             if ($config['show_no_photo'] == 1) {
                 $listing_image = $url . '<img src="' . $config["baseurl"] . '/images/nophoto.gif" alt="' . $lang['no_photo'] . '" /></a>';
                 $listing_image_full = $fullurl . '<img src="' . $config["baseurl"] . '/images/nophoto.gif" alt="' . $lang['no_photo'] . '" /></a>';
                 if ($_GET['action'] == 'listingview') {
                     $listing_image = '<img src="' . $config["baseurl"] . '/images/nophoto.gif" alt="' . $lang['no_photo'] . '" />';
                     $listing_image_full = '<img src="' . $config["baseurl"] . '/images/nophoto.gif" alt="' . $lang['no_photo'] . '" />';
                 }
                 $tempate_section = str_replace('{raw_image_thumb_1}', $config['baseurl'] . '/images/nophoto.gif', $tempate_section);
             } else {
                 $listing_image = '';
                 $tempate_section = str_replace('{raw_image_thumb_1}', '', $tempate_section);
             }
             $tempate_section = str_replace('{image_thumb_1}', $listing_image, $tempate_section);
             $tempate_section = str_replace('{image_thumb_fullurl_1}', $listing_image, $tempate_section);
         }
         $x = 1;
         while (!$recordSet2->EOF) {
             //if we're already on the listing then make the urls goto the view image
             $listingsimages_id = $misc->make_db_unsafe($recordSet2->fields['listingsimages_id']);
             $image_caption = $misc->make_db_unsafe($recordSet2->fields['listingsimages_caption']);
             $thumb_file_name = $misc->make_db_unsafe($recordSet2->fields['listingsimages_thumb_file_name']);
             $full_file_name = $misc->make_db_unsafe($recordSet2->fields['listingsimages_file_name']);
             if ($_GET['action'] == 'listingview') {
                 if ($config['url_style'] == '1') {
                     $url = '<a href="index.php?action=view_listing_image&amp;image_id=' . $listingsimages_id . '">';
                     $fullurl = '<a href="' . $config["baseurl"] . '/index.php?action=view_listing_image&amp;image_id=' . $listingsimages_id . '">';
                 } else {
                     $url = '<a href="listing_image_' . $listingsimages_id . '.html">';
                     $fullurl = '<a href="' . $config["baseurl"] . '/listing_image_' . $listingsimages_id . '.html">';
                 }
             }
             if ($thumb_file_name != "" && file_exists("{$config['listings_upload_path']}/{$thumb_file_name}")) {
                 // Full Image Sizes
                 $imagedata = GetImageSize("{$config['listings_upload_path']}/{$full_file_name}");
                 $imagewidth = $imagedata[0];
                 $imageheight = $imagedata[1];
                 $max_width = $config['main_image_width'];
                 $max_height = $config['main_image_height'];
                 $resize_by = $config['resize_by'];
                 $shrinkage = 1;
                 if ($max_width == $imagewidth || $max_height == $imageheight) {
                     $display_width = $imagewidth;
                     $display_height = $imageheight;
                 } else {
                     if ($resize_by == 'width') {
                         $shrinkage = $imagewidth / $max_width;
                         $display_width = $max_width;
                         $display_height = round($imageheight / $shrinkage);
                     } elseif ($resize_by == 'height') {
                         $shrinkage = $imageheight / $max_height;
                         $display_height = $max_height;
                         $display_width = round($imagewidth / $shrinkage);
                     } elseif ($resize_by == 'both') {
                         $display_width = $max_width;
                         $display_height = $max_height;
                     } elseif ($resize_by == 'bestfit') {
                         $shrinkage_width = $imagewidth / $max_width;
                         $shrinkage_height = $imageheight / $max_height;
                         $shrinkage = max($shrinkage_width, $shrinkage_height);
                         $display_height = round($imageheight / $shrinkage);
                         $display_width = round($imagewidth / $shrinkage);
                     }
                 }
                 // Thumbnail Image Sizes
                 $thumb_imagedata = GetImageSize("{$config['listings_upload_path']}/{$thumb_file_name}");
                 $thumb_imagewidth = $thumb_imagedata[0];
                 $thumb_imageheight = $thumb_imagedata[1];
                 $thumb_max_width = $config['thumbnail_width'];
                 $thumb_max_height = $config['thumbnail_height'];
                 $resize_thumb_by = $config['resize_thumb_by'];
                 $shrinkage = 1;
                 if ($thumb_max_width == $thumb_imagewidth || $thumb_max_height == $thumb_imageheight) {
                     $thumb_displaywidth = $thumb_imagewidth;
                     $thumb_displayheight = $thumb_imageheight;
                 } else {
                     if ($resize_thumb_by == 'width') {
                         $shrinkage = $thumb_imagewidth / $thumb_max_width;
                         $thumb_displaywidth = $thumb_max_width;
                         $thumb_displayheight = round($thumb_imageheight / $shrinkage);
                     } elseif ($resize_thumb_by == 'height') {
                         $shrinkage = $thumb_imageheight / $thumb_max_height;
                         $thumb_displayheight = $thumb_max_height;
                         $thumb_displaywidth = round($thumb_imagewidth / $shrinkage);
                     } elseif ($resize_thumb_by == 'both') {
                         $thumb_displayheight = $thumb_max_height;
                         $thumb_displaywidth = $thumb_max_width;
                     }
                 }
                 $listing_image = $url . '<img src="' . $config['listings_view_images_path'] . '/' . $thumb_file_name . '" height="' . $thumb_displayheight . '" width="' . $thumb_displaywidth . '" alt="' . $image_caption . '" /></a>';
                 $listing_image_full = $url . '<img src="' . $config['listings_view_images_path'] . '/' . $full_file_name . '" height="' . $display_height . '" width="' . $display_width . '" alt="' . $image_caption . '" /></a>';
                 $listing_image_fullurl = $fullurl . '<img src="' . $config['listings_view_images_path'] . '/' . $thumb_file_name . '" height="' . $thumb_displayheight . '" width="' . $thumb_displaywidth . '" alt="' . $image_caption . '" /></a>';
                 $listing_image_full_fullurl = $fullurl . '<img src="' . $config['listings_view_images_path'] . '/' . $full_file_name . '" height="' . $display_height . '" width="' . $display_width . '" alt="' . $image_caption . '" /></a>';
                 $tempate_section = str_replace('{image_thumb_' . $x . '}', $listing_image, $tempate_section);
                 $tempate_section = str_replace('{raw_image_thumb_' . $x . '}', $config['listings_view_images_path'] . '/' . $thumb_file_name, $tempate_section);
                 $tempate_section = str_replace('{image_thumb_fullurl_' . $x . '}', $listing_image_fullurl, $tempate_section);
                 //Full Image tags
                 $tempate_section = str_replace('{image_full_' . $x . '}', $listing_image_full, $tempate_section);
                 $tempate_section = str_replace('{raw_image_full_' . $x . '}', $config['listings_view_images_path'] . '/' . $full_file_name, $tempate_section);
                 $tempate_section = str_replace('{image_full_fullurl_' . $x . '}', $listing_image_full_fullurl, $tempate_section);
             } else {
                 if ($config['show_no_photo'] == 1) {
                     $listing_image = $url . '<img src="' . $config["baseurl"] . '/images/nophoto.gif" alt="' . $lang['no_photo'] . '" /></a>';
                     $listing_image_fullurl = $fullurl . '<img src="' . $config["baseurl"] . '/images/nophoto.gif" alt="' . $lang['no_photo'] . '" /></a>';
                     $tempate_section = str_replace('{raw_image_thumb_' . $x . '}', $config['baseurl'] . '/images/nophoto.gif', $tempate_section);
                 } else {
                     $listing_image = '';
                     $tempate_section = str_replace('{raw_image_thumb_' . $x . '}', '', $tempate_section);
                 }
                 $tempate_section = str_replace('{image_thumb_' . $x . '}', $listing_image, $tempate_section);
                 $tempate_section = str_replace('{image_thumb_fullurl_' . $x . '}', $listing_image_fullurl, $tempate_section);
                 $tempate_section = str_replace('{image_full_' . $x . '}', '', $tempate_section);
                 $tempate_section = str_replace('{raw_image_full_' . $x . '}', '', $tempate_section);
                 $tempate_section = str_replace('{image_full_fullurl_' . $x . '}', '', $tempate_section);
             }
             // We have the image so insert it into the section.
             $x++;
             $recordSet2->MoveNext();
         }
         // end while
         // End Listing Images
         $value = array();
         $value = listing_pages::getListingAgentThumbnail($listing_id);
         $x = 0;
         foreach ($value as $y) {
             $tempate_section = str_replace('{listing_agent_thumbnail_' . $x . '}', $y, $tempate_section);
             $x++;
         }
         $tempate_section = preg_replace('/{listing_agent_thumbnail_([^{}]*?)}/', '', $tempate_section);
         // End of Listing Tag Replacement
         if ($tsection === true) {
             return $tempate_section;
         } else {
             $this->page = $tempate_section;
         }
     }
 }