Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/hikashopgeolocation.tar
Назад
hikashopgeolocation.php 0000644 00000020274 15117110215 0011306 0 ustar 00 <?php /** * @package HikaShop for Joomla! * @version 4.4.1 * @author hikashop.com * @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><?php class plgSystemHikashopgeolocation extends JPlugin { function __construct(&$subject, $config){ parent::__construct($subject, $config); if(!isset($this->params)){ $plugin = JPluginHelper::getPlugin('system', 'hikashopgeolocation'); $this->params = new JRegistry($plugin->params); } } function onAfterOrderCreate(&$order,&$send_email){ $app = JFactory::getApplication(); if (hikashop_isClient('administrator') || !hikashop_level(2)) return true; if(!empty($order->order_id) && !empty($order->order_ip)){ $order_geoloc = $this->params->get('order',1); if($order_geoloc){ $geo = new stdClass(); $geo->geolocation_ref_id = $order->order_id; $geo->geolocation_type = 'order'; $geo->geolocation_ip = $order->order_ip; $class = hikashop_get('class.geolocation'); $class->params =& $this->params; $class->save($geo); } } return true; } public function afterInitialise() { return $this->onAfterInitialise(); } public function afterRoute() { return $this->onAfterRoute(); } public function onAfterInitialise() { $app = JFactory::getApplication(); $admin = false; if(version_compare(JVERSION,'4.0','>=') && $app->isClient('administrator')) $admin = true; if(version_compare(JVERSION,'4.0','<') && $app->isAdmin()) $admin = true; if($admin) return; if(!$this->params->get('after_init', 1)) return; $this->process(); } public function onAfterRoute() { $app = JFactory::getApplication(); $admin = false; if(version_compare(JVERSION,'4.0','>=') && $app->isClient('administrator')) $admin = true; if(version_compare(JVERSION,'4.0','<') && $app->isAdmin()) $admin = true; if($admin) return; if($this->params->get('after_init', 1)) return; $this->process(); } function process(){ $app = JFactory::getApplication(); $admin = false; if(version_compare(JVERSION,'4.0','>=') && $app->isClient('administrator')) $admin = true; if(version_compare(JVERSION,'4.0','<') && $app->isAdmin()) $admin = true; if ($admin) return true; $zone = 0; $components = $this->params->get('components','all'); if($components=='all' || in_array($_REQUEST['option'],explode(',',$components))){ $blocked_zones = $this->params->get('blocked_zones',''); $authorized_zones = $this->params->get('authorized_zones',''); if(!empty($blocked_zones) || !empty($authorized_zones)){ if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; if(!hikashop_level(2)) return true; $zone = $this->getZone(); if(!empty($zone)){ $zoneClass = hikashop_get('class.zone'); $parents = $zoneClass->getZoneParents($zone); $db = JFactory::getDBO(); $zones = array(); foreach($parents as $parent){ $zones[] = $db->Quote($parent); } $db->setQuery('SELECT zone_id FROM '.hikashop_table('zone').' WHERE zone_namekey IN ('.implode(',',$zones).')'); $zones = $db->loadColumn(); $ok = false; if(!empty($authorized_zones)){ $authorized_zones = explode(',',$authorized_zones); $valid_zones = array_intersect($zones,$authorized_zones); if(!empty($valid_zones)){ $ok=true; } }elseif(!empty($blocked_zones)){ $ok=true; $blocked_zones = explode(',',$blocked_zones); $invalid_zones = array_intersect($zones,$blocked_zones); if(!empty($invalid_zones)){ $ok=false; } } if(!$ok){ $name = 'hikashopgeolocation_restricted.php'; $path = JPATH_THEMES.DS.$app->getTemplate().DS.'system'.DS.$name; if(!file_exists($path)){ $path = JPATH_PLUGINS .DS.'system'.DS.'hikashopgeolocation'.DS.$name; if(!file_exists($path)){ exit; } } require($path); } } } } $set_default_currency = $this->params->get('set_default_currency', 0); if(!empty($set_default_currency)) { $currency = $app->getUserState('com_hikashop.currency_id', 0); if(empty($currency)){ if(empty($zone)){ if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; if(!hikashop_level(2)) return true; $zone = $this->getZone(); } $config =& hikashop_config(); $toSetCurrency = (int)$config->get('main_currency',1); if(!empty($zone)){ $zoneClass = hikashop_get('class.zone'); $zone_currency_id = $zoneClass->getZoneCurrency($zone); $currencyClass = hikashop_get('class.currency'); if(empty($zone_currency_id) && !empty($this->geolocation->currencyCode)){ $zone_currency_id = $this->geolocation->currencyCode; } if(!empty($zone_currency_id)){ $currencyData = $currencyClass->get($zone_currency_id); if(!empty($currencyData) && ($currencyData->currency_published || $currencyData->currency_displayed)){ $toSetCurrency = $currencyData->currency_id; } } } $app->setUserState( HIKASHOP_COMPONENT.'.currency_id',$toSetCurrency); } } $zone_id = (int)$app->getUserState('com_hikashop.zone_id',0); if(empty($zone_id) && empty($zone)) { if(!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if(!include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')) return true; if(!hikashop_level(2)) return true; $zone = $this->getZone(); } $geo_zone_id = (int)$app->getUserState('com_hikashop.geoloc_zone_id',0); if(empty($geo_zone_id) && !empty($zone)) $app->setUserState('com_hikashop.geoloc_zone_id', (int)$zone); return true; } function getZone(){ $app = JFactory::getApplication(); $zone = (int)$app->getUserState(HIKASHOP_COMPONENT.'.zone_id',0); if(!empty($zone)) return $zone; $geoClass = hikashop_get('class.geolocation'); $this->geolocation = $geoClass->getIPLocation(hikashop_getIP()); if(empty($this->geolocation)) return $zone; $geolocation_country_code = $this->geolocation->countryCode; $db = JFactory::getDBO(); $db->setQuery('SELECT * FROM '.hikashop_table('zone').' WHERE zone_code_2 ='.$db->Quote($geolocation_country_code).' AND zone_type=\'country\' AND zone_published=1'); $zones = $db->loadObjectList(); if(empty($zones)) { $states = array(); $countries = array(); foreach($zones as $zone){ if($zone->zone_type=='state'){ $states[]=$zone; }else{ $countries[]=$zone; } } if(!empty($states)){ if(empty($countries)){ $zone = $states[0]->zone_id; }else{ $child_namekeys=array(); foreach($states as $state){ $child_namekeys[]=$db->Quote($state->zone_namekey); } $parent_namekeys=array(); foreach($countries as $country){ $parent_namekeys[]=$db->Quote($country->zone_namekey); } $db->setQuery('SELECT zone_child_namekey FROM '.hikashop_table('zone_link').' WHERE zone_parent_namekey IN ('.implode(',',$parent_namekeys).') AND zone_child_namekey IN ('.implode(',',$child_namekeys).')'); $link = $db->loadResult(); if(empty($link)){ $zone = $countries[0]->zone_id; }else{ foreach($states as $state){ if($state->zone_namekey==$link){ $zone = $state->zone_id; } } } } }else{ $zone = $countries[0]->zone_id; } } if(empty($zone)){ $db->setQuery('SELECT zone_id FROM '.hikashop_table('zone').' WHERE zone_code_2='.$db->Quote($geolocation_country_code).' AND zone_published=1'); $zone = $db->loadResult(); } if(!empty($zone)){ $app->setUserState( HIKASHOP_COMPONENT.'.zone_id', (int)$zone); $app->setUserState( HIKASHOP_COMPONENT.'.geoloc_zone_id', (int)$zone); } return (int)$zone; } } hikashopgeolocation.xml 0000644 00000011072 15117110215 0011313 0 ustar 00 <?xml version="1.0" encoding="utf-8"?> <extension type="plugin" version="2.5" method="upgrade" group="system"> <name>Hikashop Geolocation Plugin</name> <creationDate>12 février 2021</creationDate> <version>4.4.1</version> <author>Hikashop</author> <authorEmail>dev@hikashop.com</authorEmail> <authorUrl>http://www.hikashop.com</authorUrl> <copyright>(C) 2010-2021 HIKARI SOFTWARE. All rights reserved.</copyright> <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license> <description>This plugin enables you to handle geolocation</description> <files> <filename plugin="hikashopgeolocation">hikashopgeolocation.php</filename> </files> <params addpath="/components/com_hikashop/params"> <param name="geoloc_timeout" type="text" size="10" default="10" label="TIMEOUT" description="GEOLOCATION_TIMEOUT" /> <param name="geoloc_service" type="radio" default="both" label="HIKA_GEOLOCATION_SERVICE" description="GEOLOCATION_SERVICE"> <option value="geoplugin">GEOLOCATION_GEOPLUGIN</option> <option value="ipinfodb">GEOLOCATION_IPINFODB</option> <option value="both">GEOLOCATION_BOTH</option> </param> <param name="geoloc_api_key" type="textarea" cols="30" default="" label="API_KEY" description="GEOLOCATION_API_KEY" /> <param name="order" type="radio" default="1" label="HIKA_ORDERS_GEOLOCATION" description="ORDERS_GEOLOCATION"> <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </param> <param name="user" type="radio" default="1" label="HIKA_CUSTOMERS_GEOLOCATION" description="CUSTOMERS_GEOLOCATION"> <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </param> <param name="set_default_currency" type="radio" default="0" label="SET_CURRENCY" description="GEOLOCATION_CURRENCY"> <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </param> <param name="blocked_zones" type="text" size="52" default="" label="ZONES_BLOCKED" description="GEOLOCATION_ZONES_BLOCKED" /> <param name="authorized_zones" type="text" size="52" default="" label="ZONES_AUTHORIZED" description="GEOLOCATION_ZONES_AUTHORIZED" /> <param name="components" type="text" size="52" default="all" label="COMPONENTS_CHECKED" description="GEOLOCATION_COMPONENTS_CHECKED" /> <param name="after_init" type="radio" label="AFTER_INITIALISATION" default="1" description="AFFILIATE_AFTER_INITIALISATION" > <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </param> </params> <config> <fields name="params" addfieldpath="/components/com_hikashop/fields"> <fieldset name="basic"> <field name="geoloc_timeout" type="text" label="TIMEOUT" size="10" default="10" description="GEOLOCATION_TIMEOUT" /> <field name="geoloc_service" type="radio" default="both" label="HIKA_GEOLOCATION_SERVICE" description="GEOLOCATION_SERVICE"> <option value="geoplugin">GEOLOCATION_GEOPLUGIN</option> <option value="ipinfodb">GEOLOCATION_IPINFODB</option> <option value="both">GEOLOCATION_BOTH</option> </field> <field name="geoloc_api_key" type="textarea" cols="30" default="" label="API_KEY" description="GEOLOCATION_API_KEY" /> <field name="order" type="radio" label="HIKA_ORDERS_GEOLOCATION" default="1" description="ORDERS_GEOLOCATION"> <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </field> <field name="user" type="radio" label="HIKA_CUSTOMERS_GEOLOCATION" default="1" description="CUSTOMERS_GEOLOCATION"> <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </field> <field name="set_default_currency" type="radio" default="0" label="SET_CURRENCY" description="GEOLOCATION_CURRENCY" class="btn-group btn-group-yesno"> <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </field> <field name="blocked_zones" type="text" size="52" default="" label="ZONES_BLOCKED" description="GEOLOCATION_ZONES_BLOCKED" /> <field name="authorized_zones" type="text" size="52" default="" label="ZONES_AUTHORIZED" description="GEOLOCATION_ZONES_AUTHORIZED" /> <field name="components" type="text" size="52" default="all" label="COMPONENTS_CHECKED" description="GEOLOCATION_COMPONENTS_CHECKED" /> <field name="after_init" type="radio" label="AFTER_INITIALISATION" default="1" description="AFFILIATE_AFTER_INITIALISATION" > <option value="0">HIKASHOP_NO</option> <option value="1">HIKASHOP_YES</option> </field> </fieldset> </fields> </config> </extension> hikashopgeolocation_restricted.php 0000644 00000001107 15117110215 0013530 0 ustar 00 <?php /** * @package HikaShop for Joomla! * @version 4.4.1 * @author hikashop.com * @copyright (C) 2010-2021 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><html> <head> <?php $doc = JFactory::getDocument(); $head = $doc->loadRenderer('head'); if(HIKASHOP_J30) echo $head->render(''); else echo $head->render(); ?> </head> <body> <?php echo hikashop_display(JText::_('RESSOURCE_NOT_ALLOWED'),'error'); ?> </body> </html> <?php exit; index.html 0000644 00000000054 15117110215 0006532 0 ustar 00 <html><body bgcolor="#FFFFFF"></body></html>