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);
 }
Example #2
0
* 
*/
include "config/config.php";
class maps
{
    private $db_connection = null;
    public function _construct()
    {
        if (isset($_POST['type'])) {
            if ($_POST['type'] == "traffic") {
                $this->marktraffic($_POST['lat'], $_POST['long']);
            }
        }
    }
    private function db_connection()
    {
        try {
            $this->db_connection = new PDO('mysql:host=' . DATABASE_HOST . ';dbname=mapfik;charset=utf8', DATABASE_USERNAME, DATABASE_PASSWORD);
            return true;
        } catch (PDOExcption $e) {
            $this->error('ERR_DB_NOT_CONNECTED');
            return false;
        }
    }
    private function marktraffic($lat, $long)
    {
        header("Location:traffic.php?lat=" . $lat . "&long=" . $long);
    }
}
$new = new maps();
$new->_construct();
<?php

/*    
	This file is part of STFC.
	Copyright 2006-2007 by Michael Krauss (info@stfc2.de) and Tobias Gafner
		
	STFC is based on STGC,
	Copyright 2003-2007 by Florian Brede (florian_brede@hotmail.com) and Philipp Schmidt
	
    STFC is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.

    STFC is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
$game->init_player();
check_auth(STGC_DEVELOPER);
include_once 'include/libs/maps.php';
$maps = new maps();
$maps->create_galaxy_map();
$maps->create_quadrant_map(1);
$maps->create_quadrant_map(2);
$maps->create_quadrant_map(3);
$maps->create_quadrant_map(4);
Example #4
0
                break;
        }
        SystemMessage($user['user_id'], $title, $message);
        $sql = 'UPDATE user SET num_sitting=-1 WHERE user_id=' . $user['user_id'];
        if (!$db->query($sql)) {
            $sdl->log('<b>Error:</b> cannot lock sitting for user ID ' . $user['user_id'] . '!');
        }
        $sdl->log('User sitting locked: ID ' . $user['user_id'] . ' Name: ' . $user['user_name'] . ' Abuse: ' . $val);
    }
}
$sdl->finish_job('Sitting abuse check');
// #######################################################################################
// #######################################################################################
// Create or update galaxy map image
$sdl->start_job('Create galaxy map');
$maps = new maps();
$maps->create_galaxy_detail_map();
if (($destimg = ImageCreateTrueColor(150, 150)) === false) {
    $sdl->log('<b>Error:</b> problem creating image');
} else {
    if (($srcimg = ImageCreateFromPNG($game_path . 'maps/images/galaxy_detail.png')) === false) {
        $sdl->log('<b>Error:</b> problem opening source image');
    } else {
        if (!ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, 150, 159, ImageSX($srcimg), ImageSY($srcimg))) {
            $sdl->log('<b>Error:</b> problem resizing image');
        } else {
            imagepng($destimg, $game_path . 'maps/images/galaxy_detail_small.png');
        }
        imagedestroy($srcimg);
    }
    imagedestroy($destimg);
      </table>
    </td>
  </tr>
</table>
            ');
        }
    }
    display_cartography_jump();
    if ($game->planet['planet_id'] != $planet_id) {
        if ($planet_is_known && $own_planet) {
            display_ferengi_transfer($planet['planet_id'], $planet['system_id'], $planet['system_global_x'], $planet['system_global_y'], $planet['building_11']);
        }
    }
} elseif (!empty($_GET['system_id']) || !empty($_GET['sector_id']) || !empty($_GET['quadrant_id']) || isset($_GET['galaxy'])) {
    include_once 'include/libs/maps.php';
    $maps = new maps();
    $nav_html = $img_html = $legend_html = '';
    $numbers = $letters = array('&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;');
    if (!empty($_GET['system_id'])) {
        if (is_numeric($_GET['system_id'])) {
            die(constant($game->sprache("TEXT59")));
        } else {
            $system_id = (int) decode_system_id($_GET['system_id']);
        }
        $sql = 'SELECT system_name, sector_id
                FROM starsystems
                WHERE system_id = ' . $system_id;
        if (($system = $db->queryrow($sql)) === false) {
            message(DATABASE_ERROR, 'Could not query starsystem data');
        }
        if (empty($system['sector_id'])) {
Example #6
0
 /**
  * maps::create_map_link()
  * This is the function to call to show a map link. It should be called from the listing detail page, or any page where $_GET['listingID'] is set.
  * This function then calls the appropriate make_mapname function as specified in the configuration.
  *
  * @see maps::make_mapquest()
  * @see maps::make_yahoo_us()
  * @return string Return the URL for the map as long as the required fields are filled out, if not it returns a empty string.
  */
 function create_map_link($url_only = 'no')
 {
     global $conn, $config;
     require_once $config['basepath'] . '/include/misc.inc.php';
     $misc = new misc();
     // Map Type
     // Get Address, City, State, Zip
     // Create Blank Variables
     $display = '';
     $address = '';
     $city = '';
     $state = '';
     $zip = '';
     // Get Listing ID
     $sql_listingID = $misc->make_db_safe($_GET['listingID']);
     $listing_title = urlencode(listing_pages::get_title($_GET['listingID']));
     // get address
     $sql_address_field = $misc->make_db_safe($config['map_address']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_address_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $address = urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     // Add address fields 2 & 3
     $sql_address_field = $misc->make_db_safe($config['map_address2']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_address_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $address .= ' ' . urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     $sql_address_field = $misc->make_db_safe($config['map_address3']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_address_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $address .= ' ' . urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     $sql_address_field = $misc->make_db_safe($config['map_address4']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_address_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $address .= ' ' . urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     // get city
     $sql_city_field = $misc->make_db_safe($config['map_city']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_city_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $city = urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     // get state
     $sql_state_field = $misc->make_db_safe($config['map_state']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_state_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $state = urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     // get zip
     $sql_zip_field = $misc->make_db_safe($config['map_zip']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_zip_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $zip = urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     // get zip
     $sql_country_field = $misc->make_db_safe($config['map_country']);
     $sql = "SELECT listingsdbelements_field_value, listingsformelements_field_type, listingsformelements_field_caption FROM " . $config['table_prefix'] . "listingsdbelements, " . $config['table_prefix'] . "listingsformelements WHERE ((" . $config['table_prefix'] . "listingsdbelements.listingsdb_id = {$sql_listingID}) AND (listingsformelements_field_name = listingsdbelements_field_name) AND (listingsdbelements_field_name = {$sql_country_field}))";
     $recordSet = $conn->Execute($sql);
     if ($recordSet === false) {
         $misc->log_error($sql);
     }
     while (!$recordSet->EOF) {
         $country = urlencode($misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']));
         $recordSet->MoveNext();
     }
     // end while
     if ($address != '' || $city != '' || $state != '' || $zip != '') {
         $map_type = 'make_' . $config['map_type'];
         $pos = strpos($map_type, 'mapquest');
         $pos2 = strpos($map_type, 'multimap');
         $pos3 = strpos($map_type, 'global_');
         if ($pos3 !== false) {
             if ($pos !== false) {
                 $display = maps::make_mapquest($country, $address, $city, $state, $zip, $listing_title, $url_only);
             } elseif ($pos2 !== false) {
                 $display = maps::make_multimap($country, $address, $city, $state, $zip, $listing_title, $url_only);
             }
         } elseif ($pos !== false) {
             $country = substr($map_type, -2);
             $display = maps::make_mapquest($country, $address, $city, $state, $zip, $listing_title, $url_only);
         } elseif ($pos2 !== false) {
             $country = substr($map_type, -2);
             $display = maps::make_multimap($country, $address, $city, $state, $zip, $listing_title, $url_only);
         } else {
             $display = maps::$map_type($address, $city, $state, $zip, $listing_title, $url_only);
         }
     }
     return $display;
 }
Example #7
0
/**
 * googlemap_display_addon_link()
 * This function generates the link to the Google Map.  If either of the latitude or
 * longitude fields for the current listing are not set, it returns a link to the old
 * (default Open-Realty) map.
 *
 * @return string Returns a hyperlink that will load the map when clicked.
 */
function googlemap_display_addon_link()
{
    // Need access to common path information, and current connection
    global $config, $lang, $conn;
    // Get access to database functions
    require_once $config['basepath'] . '/include/misc.inc.php';
    $misc = new misc();
    $listingID = $misc->make_db_safe($_GET['listingID']);
    // grab latitude and longitude of current listing
    $sql = "SELECT listingsdbelements_field_value FROM " . $config['table_prefix'] . "listingsdbelements WHERE (listingsdb_id = {$listingID} AND (listingsdbelements_field_name = 'latitude' OR listingsdbelements_field_name = 'longitude'))";
    $recordSet = $conn->Execute($sql);
    if ($recordSet === false) {
        $misc->log_error($sql);
    }
    $val1 = $misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']);
    $recordSet->MoveNext();
    $val2 = $misc->make_db_unsafe($recordSet->fields['listingsdbelements_field_value']);
    // if (latitude and longitude) are set for the current listing
    if (!($val1 == '') && !($val2 == '')) {
        $sql = "SELECT * FROM " . $config['table_prefix_no_lang'] . "addon_googlemap";
        $recordSet = $conn->Execute($sql);
        if ($recordSet === false) {
            $misc->log_error($sql);
        }
        $popup = $misc->make_db_unsafe($recordSet->fields['popup']);
        // Open map in a pop up window?
        if ($popup == 1) {
            $map_height = $misc->make_db_unsafe($recordSet->fields['map_height']);
            $map_width = $misc->make_db_unsafe($recordSet->fields['map_width']);
            $display = '<a href="index.php?action=addon_googlemap_showmap&listingID=' . $_GET['listingID'] . "&popup=1\" onclick=\"window.open(this.href,'_map','location=0,status=0,scrollbars=1,toolbar=0,menubar=0,width={$map_width},height={$map_height}');return false\">";
            $display .= '<img src="template/dd2col/images/viewmap.jpg" alt="click to view google map"/></a>';
        } else {
            $display = '<a href="index.php?action=addon_googlemap_showmap&listingID=' . $_GET['listingID'] . '">' . $lang[map_link] . '</a>';
        }
        return $display;
    }
    // Fail gracefully if latitude or longitude not set.
    require_once $config['basepath'] . '/include/maps.inc.php';
    $map = new maps();
    return $map->create_map_link();
}
Example #8
0
<?php

require_once 'maps.php';
$mapsServer = new maps();
if (isset($_GET['content'])) {
    $content = $_GET['content'];
} else {
    die('error: unknown request');
}
if (isset($_GET['contentType'])) {
    $contentType = $_GET['contentType'];
} else {
    die('error: must set contentType');
}
if ($contentType == 'json') {
    header('Content-Type: application/json');
}
switch ($content) {
    case 'getPoints':
        if (isset($_POST['NELat'])) {
            $NELat = $_POST['NELat'];
        } else {
            die('error: parameter NELat not set');
        }
        if (isset($_POST['NELng'])) {
            $NELng = $_POST['NELng'];
        } else {
            die('error: parameter NELng not set');
        }
        if (isset($_POST['SWLat'])) {
            $SWLat = $_POST['SWLat'];