예제 #1
0
 function replace_tags($tags = array())
 {
     global $config, $lang;
     require_once $config['basepath'] . '/include/login.inc.php';
     $login = new login();
     require_once $config['basepath'] . '/include/misc.inc.php';
     $misc = new misc();
     // Remove tags not found in teh template
     $new_tags = $tags;
     $tags = array();
     foreach ($new_tags as $tag) {
         if (strpos($this->page, '{' . $tag . '}') !== false) {
             $tags[] = $tag;
         }
     }
     unset($new_tags);
     if (sizeof($tags) > 0) {
         foreach ($tags as $tag) {
             $data = '';
             switch ($tag) {
                 case 'content':
                     $data = $this->replace_user_action();
                     break;
                 case 'templated_search_form':
                     require_once $config['basepath'] . '/include/search.inc.php';
                     $search = new search_page();
                     $data = $search->create_searchpage('no', true);
                     break;
                 case 'baseurl':
                     $data = $config['baseurl'];
                     break;
                 case 'template_url':
                     $data = $config['template_url'];
                     break;
                 case 'addthis_button':
                     global $jscript_last;
                     $jscript_last .= "\r\n" . '<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>';
                     $data = '<a href="http://www.addthis.com/bookmark.php?v=250" class="addthis_button"><img src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" width="125" height="16" border="0" alt="Share" /></a>';
                     break;
                 case 'load_js':
                     $data = $this->load_js();
                     break;
                 case 'load_js_last':
                     global $jscript_last;
                     $data = $jscript_last;
                     break;
                 case 'tabbed_js':
                     global $jscript;
                     $jscript .= '<script type="text/javascript" src="' . $config['baseurl'] . '/tabpane.js"></script>' . "\r\n";
                     $data = '';
                     break;
                 case 'license_tag':
                     $data = "<!--Open-Realty is distributed by Transparent Technologies and is Licensed under the Open-Realty License. See http://www.open-realty.org/license_info.html for more information.-->";
                     break;
                 case 'main_listing_data':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->getMainListingData($_GET['listingID']);
                     break;
                 case 'featured_listings_vertical':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsVertical();
                     break;
                 case 'featured_listings_horizontal':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsHorizontal();
                     break;
                 case 'featured_listings_horizontal_latest':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderLatestFeaturedListingsHorizontal();
                     break;
                 case 'random_listings_vertical':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsVertical(0, true);
                     break;
                 case 'random_listings_horizontal':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     //$data = $listing->renderFeaturedListingsHorizontal(0, true);
                     $data = $listing->renderRandomListingsHorizontal();
                     break;
                 case 'latest_listings_vertical':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsVertical(0, false, '', true);
                     break;
                 case 'latest_listings_horizontal':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsHorizontal(0, false, '', true);
                     break;
                 case preg_match("/^featured_listings_horizontal_class_([0-9]*)/", $tag, $feat_class) ? $tag : !$tag:
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsHorizontal(0, FALSE, $feat_class[1]);
                     break;
                 case preg_match("/^featured_listings_vertical_class_([0-9]*)/", $tag, $feat_class) ? $tag : !$tag:
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsVertical(0, FALSE, $feat_class[1]);
                     break;
                 case preg_match("/^random_listings_horizontal_class_([0-9]*)/", $tag, $feat_class) ? $tag : !$tag:
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsHorizontal(0, TRUE, $feat_class[1]);
                     break;
                 case preg_match("/^random_listings_vertical_class_([0-9]*)/", $tag, $feat_class) ? $tag : !$tag:
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsVertical(0, TRUE, $feat_class[1]);
                     break;
                 case preg_match("/^latest_listings_horizontal_class_([0-9]*)/", $tag, $feat_class) ? $tag : !$tag:
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsHorizontal(0, false, $feat_class[1], true);
                     break;
                 case preg_match("/^latest_listings_vertical_class_([0-9]*)/", $tag, $feat_class) ? $tag : !$tag:
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderFeaturedListingsVertical(0, false, $feat_class[1], true);
                     break;
                 case 'headline':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderTemplateAreaNoCaption('headline', $_GET['listingID']);
                     break;
                 case 'full_description':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderTemplateAreaNoCaption('center', $_GET['listingID']);
                     break;
                 case 'listing_images':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImages($_GET['listingID'], 'yes');
                     break;
                 case 'listing_images_nocaption':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImages($_GET['listingID'], 'no');
                     break;
                 case 'listing_files_select':
                     require_once $config['basepath'] . '/include/files.inc.php';
                     $files = new file_handler();
                     $data = $files->render_files_select($_GET['listingID'], 'listing');
                     break;
                 case 'files_listing_vertical':
                     require_once $config['basepath'] . '/include/files.inc.php';
                     $files = new file_handler();
                     $data = $files->render_templated_files($_GET['listingID'], 'listing', 'vertical');
                     break;
                 case 'files_listing_horizontal':
                     require_once $config['basepath'] . '/include/files.inc.php';
                     $files = new file_handler();
                     $data = $files->render_templated_files($_GET['listingID'], 'listing', 'horizontal');
                     break;
                 case 'slideshow_images':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsMainImageSlideShow($_GET['listingID']);
                     break;
                 case 'link_calc':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_calc_link();
                     break;
                 case 'link_calc_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_calc_link($url_only = 'yes');
                     break;
                 case 'link_add_favorites':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_add_favorite_link();
                     break;
                 case 'link_add_favorites_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_add_favorite_link($url_only = 'yes');
                     break;
                 case 'link_printer_friendly':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_printer_friendly_link();
                     break;
                 case 'link_email_friend':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_email_friend_link();
                     break;
                 case 'link_map':
                     require_once $config['basepath'] . '/include/maps.inc.php';
                     $maps = new maps();
                     $data = $maps->create_map_link();
                     break;
                 case 'link_yahoo_school':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_yahoo_school_link();
                     break;
                 case 'link_yahoo_neighborhood':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_yahoo_neighborhood_link();
                     break;
                 case 'link_printer_friendly_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_printer_friendly_link($url_only = 'yes');
                     break;
                 case 'link_email_friend_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_email_friend_link($url_only = 'yes');
                     break;
                 case 'link_map_url':
                     require_once $config['basepath'] . '/include/maps.inc.php';
                     $maps = new maps();
                     $data = $maps->create_map_link($url_only = 'yes');
                     break;
                 case 'link_yahoo_school_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_yahoo_school_link($url_only = 'yes');
                     break;
                 case 'link_yahoo_neighborhood_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->create_yahoo_neighborhood_link($url_only = 'yes');
                     break;
                 case 'contact_agent_link_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->contact_agent_link($url_only = 'yes');
                     break;
                 case 'agent_info':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->renderUserInfoOnListingsPage($_GET['listingID']);
                     break;
                 case 'listing_email':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->getListingEmail($_GET['listingID']);
                     break;
                 case 'hitcount':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->hitcount($_GET['listingID']);
                     break;
                 case 'main_image':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsMainImage($_GET['listingID'], 'yes', 'no');
                     break;
                 case 'main_image_nodesc':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsMainImage($_GET['listingID'], 'no', 'no');
                     break;
                 case 'main_image_java':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsMainImage($_GET['listingID'], 'yes', 'yes');
                     break;
                 case 'main_image_java_nodesc':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsMainImage($_GET['listingID'], 'no', 'yes');
                     break;
                 case 'listing_images_java':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImagesJava($_GET['listingID'], 'no');
                     break;
                 case 'listing_images_java_caption':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImagesJava($_GET['listingID'], 'yes');
                     break;
                 case 'listing_images_java_rows':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImagesJavaRows($_GET['listingID']);
                     break;
                 case 'listing_images_mouseover_java':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImagesJava($_GET['listingID'], 'no', 'yes');
                     break;
                 case 'listing_images_mouseover_java_caption':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImagesJava($_GET['listingID'], 'yes', 'yes');
                     break;
                 case 'listing_images_mouseover_java_rows':
                     require_once $config['basepath'] . '/include/images.inc.php';
                     $images = new image_handler();
                     $data = $images->renderListingsImagesJavaRows($_GET['listingID'], 'yes');
                     break;
                 case 'vtour_button':
                     require_once $config['basepath'] . '/include/vtour.inc.php';
                     $vtour = new vtours();
                     $data = $vtour->rendervtourlink($_GET['listingID']);
                     break;
                 case 'listingid':
                     $data = $_GET['listingID'];
                     break;
                 case 'get_creation_date':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->get_creation_date($_GET['listingID']);
                     break;
                 case 'get_featured_raw':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->get_featured($_GET['listingID'], 'yes');
                     break;
                 case 'get_featured':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->get_featured($_GET['listingID'], 'no');
                     break;
                 case 'get_modified_date':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->get_modified_date($_GET['listingID']);
                     break;
                 case 'contact_agent_link':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->contact_agent_link();
                     break;
                 case 'select_language':
                     // require_once($config['basepath'] . '/include/multilingual.inc.php');
                     // $multilingual = new multilingual();
                     // $data = $multilingual->multilingual_select();
                     break;
                 case 'company_name':
                     $data = $config['company_name'];
                     break;
                 case 'company_location':
                     $data = $config['company_location'];
                     break;
                 case 'company_logo':
                     $data = $config['company_logo'];
                     break;
                 case 'show_vtour':
                     if (isset($_GET['listingID'])) {
                         require_once $config['basepath'] . '/include/vtour.inc.php';
                         $vtour = new vtours();
                         $data = $vtour->show_vtour($_GET['listingID'], false);
                     } else {
                         $data = 'No Listing ID';
                     }
                     break;
                 case 'charset':
                     $data = $config['charset'];
                     break;
                 case 'link_edit_listing':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->edit_listing_link();
                     break;
                 case 'link_edit_listing_url':
                     require_once $config['basepath'] . '/include/listing.inc.php';
                     $listing = new listing_pages();
                     $data = $listing->edit_listing_link('yes');
                     break;
                 case 'template_select':
                     $data = $this->template_selector();
                     break;
                 case 'money_sign':
                     $data = $config['money_sign'];
                     break;
                 case 'horizontal_header_banner':
                     if (@(include getenv('DOCUMENT_ROOT') . '/advertising/phpadsnew.inc.php')) {
                         if (!isset($phpAds_context)) {
                             $phpAds_context = array();
                         }
                         $phpAds_raw = view_raw('zone:1', 0, '_self', '', '0', $phpAds_context);
                         $data = $phpAds_raw['html'];
                     } else {
                         $data = '<img src="/images/bannerd.png">';
                     }
                     break;
                 default:
                     if (preg_match("/^addon_(.*?)_.*/", $tag, $addon_name)) {
                         $file = $config['basepath'] . '/addons/' . $addon_name[1] . '/addon.inc.php';
                         if (file_exists($file)) {
                             include_once $file;
                             $function_name = $addon_name[1] . '_run_template_user_fields';
                             $data = $function_name($tag);
                         } else {
                             $data = '';
                         }
                     } else {
                         $data = '';
                     }
                     break;
             }
             $this->page = str_replace('{' . $tag . '}', $data, $this->page);
         }
     }
     unset($tags);
     unset($tag);
 }