/** * main action */ public function mainAction() { require_once 'models/common/common_node.php'; $Node = new common_node(); require_once 'models/common/common_uri_mapping.php'; $Mapping = new common_uri_mapping(); $uri_list = $Mapping->getDetailList(); //print_r($uri_list); foreach ($uri_list as $item) { if ($item['type'] == '301') { $item['title'] = ''; $item['teaser'] = ''; $item['description'] = ''; $item['keywords'] = ''; } if ($item['page_title'] == '') { $item['page_title'] = $item['title']; } $this->tpl->assign('ITEM', $item); //temporarily disable 301 management - don't display 301 in the list //and don't display 404 page //and not symbolic node_controller if ($item['type'] != '301' && $item['id'] != 14 && $item['node_controller'] != 'symbolic') { $this->tpl->parse('content.item'); } } return true; }
/** * main action */ public function mainAction() { $taxonomy_id = $this->GET['taxonomy_id']; $store_to_select = $this->GET['store_id']; if (is_numeric($this->GET['zoom'])) { $this->tpl->assign('ZOOM', $this->GET['zoom']); } else { $this->tpl->assign('ZOOM', 13); } $Mapping = new common_uri_mapping(); $this->Store = new ecommerce_store(); $store_pages = $this->getStorePages(); $stores = $this->getAllStores($taxonomy_id); // display pins foreach ($stores as $store) { if ($store['latitude'] != 0 && $store['longitude'] != 0) { // pre-select this item? if ($store['id'] == $store_to_select) { $selected_store = $store; } // find page and url $page = $store_pages[$store['id']]; $store['url'] = $Mapping->stringToSeoUrl("/page/{$page['id']}"); $store['node_id'] = $page['id']; $store['icon'] = $store['id'] == $selected_store['id'] ? 'false' : 'true'; $store['open'] = $store['id'] == $selected_store['id'] ? 'true' : 'false'; // parse item $this->tpl->assign("STORE", $store); $this->tpl->parse("content.map.store_marker"); } } // center map to a selected store if ($selected_store) { $map['latitude'] = $selected_store['latitude']; $map['longitude'] = $selected_store['longitude']; } else { $map['latitude'] = $this->Store->conf['latitude']; $map['longitude'] = $this->Store->conf['longitude']; $this->fitMapToBounds($stores); } $this->tpl->assign("MAP", $map); $this->tpl->parse("content.map"); return true; }
/** * outputFilterGlobal */ public function outputFilterGlobal($content) { require_once 'models/common/common_uri_mapping.php'; $Mapper = new common_uri_mapping(); // translate /page/{ID} to URLs $content = $Mapper->system_uri2public_uri($content); // CDN rewrites for URLs if (ONXSHOP_CDN && (ONXSHOP_CDN_USE_WHEN_SSL || !isset($_SERVER['HTTPS']))) { require_once 'lib/onxshop.cdn.php'; $CDN = new Onxshop_Cdn(); $content = $CDN->processOutputHtml($content); } // remove multiple white spaces beetween tags if (ONXSHOP_COMPRESS_OUTPUT == 1) { $content = preg_replace("/>[\\s]+</", "> <", $content); } return $content; }
/** * global function to translate URLs using common_uri_mapping * * @param unknown_type $request * @return unknown */ function translateURL($request) { require_once 'models/common/common_uri_mapping.php'; $Mapping = new common_uri_mapping(); if ($Mapping->conf['seo']) { $seo = $Mapping->stringToSeoUrl("/{$request}"); return $seo; } else { return "/{$request}"; } }
/** * Update a single record in mapping table */ function updateSingleURI($node_data) { require_once 'models/common/common_uri_mapping.php'; $Mapper = new common_uri_mapping(); if ($Mapper->updateSingle($node_data)) { return true; } else { return false; } }
/** * outputFilterGlobal */ public function outputFilterGlobal($content) { require_once 'models/common/common_uri_mapping.php'; $Mapper = new common_uri_mapping(); // translate /page/{ID} to URLs $content = $Mapper->system_uri2public_uri($content); // CDN rewrites for URLs if (ONXSHOP_CDN && (ONXSHOP_CDN_USE_WHEN_SSL || !isset($_SERVER['HTTPS']))) { require_once 'lib/onxshop.cdn.php'; $CDN = new Onxshop_Cdn(); $content = $CDN->processOutputHtml($content); } return $content; }
/** * main action */ public function mainAction() { // init URI mapping object and store object $Mapping = new common_uri_mapping(); $this->Store = new ecommerce_store(); // get selected store for detail $node_id = (int) $this->GET['node_id']; // load stores, store pages and related categories $store_pages = $this->getStorePages(); $stores = $this->getAllStores(); $categories = $this->getAllStoreTaxonomyIds(); $selected_store = $this->getStoreAssociatedToNode($node_id); $page_categories = $this->getPageTaxonomyIds($node_id); // process request to save store as my own store if ($this->GET['set_home_store'] == 'true' && $selected_store['id'] > 0) { if ($this->updateCustomersHomeStore($selected_store['id'])) { msg("Your store has been updated."); } else { msg("Please login into your account to save your store."); } return true; } // init map bounds $bounds['latitude']['max'] = -9999; $bounds['latitude']['min'] = 9999; $bounds['longitude']['max'] = -9999; $bounds['longitude']['min'] = 9999; // display pins foreach ($stores as $store) { if ($store['latitude'] != 0 && $store['longitude'] != 0) { // find page and url $page = $store_pages[$store['id']]; $store['url'] = $Mapping->stringToSeoUrl("/page/{$page['id']}"); $store['node_id'] = $page['id']; $store['icon'] = $store['id'] == $selected_store['id'] ? 'false' : 'true'; $store['open'] = $store['id'] == $selected_store['id'] ? 'true' : 'false'; if ($store['id'] == $_SESSION['client']['customer']['store_id']) { $store['icon'] = 'false'; } // adjust bounds (by province/county) if (array_intersect($page_categories, $categories[$store['id']])) { if ($store['latitude'] > $bounds['latitude']['max']) { $bounds['latitude']['max'] = $store['latitude']; } if ($store['latitude'] < $bounds['latitude']['min']) { $bounds['latitude']['min'] = $store['latitude']; } if ($store['longitude'] > $bounds['longitude']['max']) { $bounds['longitude']['max'] = $store['longitude']; } if ($store['longitude'] < $bounds['longitude']['min']) { $bounds['longitude']['min'] = $store['longitude']; } } $store['street_view_options'] = unserialize($store['street_view_options']); switch ($store['street_view_options']['image']) { case 1: $lat = $store['street_view_options']['latitude']; $lng = $store['street_view_options']['longitude']; if (empty($lat)) { $lat = $store['latitude']; } if (empty($lng)) { $lng = $store['longitude']; } $store['image'] = 'http://maps.googleapis.com/maps/api/streetview?size=130x130' . '&location=' . $lat . "," . $lng . '&fov=' . (int) $store['street_view_options']['fov'] . '&heading=' . (int) $store['street_view_options']['heading'] . '&pitch=' . (int) $store['street_view_options']['pitch'] . '&sensor=false' . '&key=' . ONXSHOP_GOOGLE_API_KEY; break; case 2: $store['image'] = "/thumbnail/130x130/" . $this->getStoreImage($store['id']) . '?fill=1'; break; case 0: default: $store['image'] = '/image/var/files/generic_store.jpg'; } // parse item $this->tpl->assign("STORE", $store); $this->tpl->parse("content.map.store_marker"); } } // center map to ... if ($selected_store) { // ... to a selected store $map['latitude'] = $selected_store['latitude'] + 0.004; $map['longitude'] = $selected_store['longitude']; } else { // ... to bounds of a selected region (province/county) if ($bounds['latitude']['min'] != 9999) { $this->tpl->assign("BOUNDS", $bounds); $this->tpl->parse("content.map.fit_to_bounds"); } $map['latitude'] = $this->Store->conf['latitude']; $map['longitude'] = $this->Store->conf['longitude']; } $this->tpl->assign("MAP", $map); $this->tpl->parse("content.map"); return true; }
/** * main action */ public function mainAction() { set_time_limit(0); require_once 'models/common/common_file.php'; $File = new common_file(); $tool = $this->GET['tool']; switch ($tool) { case 'uri': require_once 'models/common/common_uri_mapping.php'; $CommonURIMapping = new common_uri_mapping(); $CommonURIMapping->generateAndSaveURITable(); msg("Nice URLs has been completely generated"); break; case 'flush_thumb': if ($File->rm(ONXSHOP_PROJECT_DIR . "var/thumbnails/*")) { msg("All image thumbnails have been deleted"); } else { "Flushing thumbnails failed"; } break; case 'flush_tmp': if ($File->rm(ONXSHOP_PROJECT_DIR . "var/tmp/*")) { msg("Temp directory has been cleaned"); } else { "Flushing temp dir failed"; } break; case 'flush_cache': if (onxshop_flush_cache()) { msg("Cache has been refreshed"); } else { msg("Flushing cache failed"); } break; case 'flush_api_cache': if (is_numeric($GLOBALS['onxshop_conf']['common_configuration']['api_data_version'])) { $current_api_data_version = $GLOBALS['onxshop_conf']['common_configuration']['api_data_version']; } else { $current_api_data_version = 1; } $api_data_version = $current_api_data_version + 1; $Configuration = new common_configuration(); if ($Configuration->saveConfig('common_configuration', 'api_data_version', $api_data_version)) { msg("Data version of API has increased to {$api_data_version}"); if (onxshop_flush_cache()) { msg("Cache has been refreshed"); } else { msg("Flushing cache failed"); } } break; case 'find_hard_links': require_once 'models/common/common_node.php'; $Node = new common_node(); $hard_links = $Node->findHardLinks(); foreach ($hard_links as $hard_link) { $this->tpl->assign('ITEM', $hard_link); $this->tpl->parse('content.hard_links.item'); } $this->tpl->parse('content.hard_links'); break; case 'delete_orphaned_baskets': require_once 'models/ecommerce/ecommerce_basket.php'; $Basket = new ecommerce_basket(); if ($Basket->deleteOrphanedAnonymouseBaskets()) { msg('Deleted orphaned baskets older than two weeks'); } break; case 'backup': $_Onxshop = new Onxshop_Request("bo/component/backup"); $this->tpl->assign('SUB_CONTENT', $_Onxshop->getContent()); break; default: $this->tpl->parse('content.menu'); break; } return true; }