diff --git a/404.php b/404.php index 856c99e72..d90d7df7a 100644 --- a/404.php +++ b/404.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e6ace3913..322ab0155 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,53 +1,58 @@ -CONTRIBUTORS -============ + - (d)oekia + - Caleydon Media + - Damien Metzger + - DamienMetzger + - Damon Skelhorn + - David Gasperoni + - François Gaillard + - Gabriel Schwardy + - Ha!*!*y + - Jonathan Danse + - Krystian Podemski + - Milow + - PrestaEdit + - Rémi Gaillard + - Sarah Lorenzini + - Vincent Augagneur + - Xavier POITAU + - aFolletete + - aKorczak + - aNiassy + - adonis karavokyros + - bLeveque + - bMancone + - bumbu + - cmouleyre + - dMetzger + - dSevere + - fBrignoli + - fSerny + - gBrunier + - gCharmes + - gPoulain + - hAitmansour + - ivancasasempere + - jBreux + - jObregon + - jessylenne + - jmCollin + - lBrieu + - lCherifi + - lLefevre + - mBertholino + - mDeflotte + - mMarinetti + - montes + - nPellicari + - oleacorner + - rGaillard + - rMalie + - rMontagne + - sLorenzini + - sThiebaut + - tDidierjean + - vAugagneur + - vChabot + - vKham + - vSchoener -- Caleydon Media -- DamienMetzger -- Damon Skelhorn -- doekia -- François Gaillard -- Gabriel Schwardy -- Jonathan Danse -- Krystian Podemski -- PrestaEdit -- Rémi Gaillard -- Sarah Lorenzini -- Vincent Augagneur -- Xavier POITAU -- aFolletete -- aKorczak -- aNiassy -- adonis karavokyros -- bLeveque -- bMancone -- bumbu -- cmouleyre -- dMetzger -- dSevere -- fBrignoli -- fSerny -- gBrunier -- gCharmes -- gPoulain -- hAitmansour -- jBreux -- jObregon -- jessylenne -- jmCollin -- lBrieu -- lCherifi -- lLefevre -- mBertholino -- mDeflotte -- mMarinetti -- nPellicari -- oleacorner -- rGaillard -- rMalie -- rMontagne -- sLorenzini -- sThiebaut -- tDidierjean -- vChabot -- vKham -- vSchoener \ No newline at end of file diff --git a/address.php b/address.php index 8d2a7ee75..fcfac54af 100644 --- a/address.php +++ b/address.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/addresses.php b/addresses.php index 71a0007c2..75e3a1dfe 100644 --- a/addresses.php +++ b/addresses.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajax-tab.php b/admin-dev/ajax-tab.php index d3b865930..684278d34 100755 --- a/admin-dev/ajax-tab.php +++ b/admin-dev/ajax-tab.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 01c35c7db..5ec0197ac 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -171,110 +171,6 @@ if (Tools::isSubmit('updateElementEmployee') && Tools::getValue('updateElementEm die($notification->updateEmployeeLastElement(Tools::getValue('updateElementEmployeeType'))); } -if (Tools::isSubmit('syncImapMail')) -{ - if (!($url = Configuration::get('PS_SAV_IMAP_URL')) - || !($port = Configuration::get('PS_SAV_IMAP_PORT')) - || !($user = Configuration::get('PS_SAV_IMAP_USER')) - || !($password = Configuration::get('PS_SAV_IMAP_PWD'))) - die('{"hasError" : true, "errors" : ["Configuration is not correct"]}'); - - $conf = Configuration::getMultiple(array( - 'PS_SAV_IMAP_OPT_NORSH', 'PS_SAV_IMAP_OPT_SSL', - 'PS_SAV_IMAP_OPT_VALIDATE-CERT', 'PS_SAV_IMAP_OPT_NOVALIDATE-CERT', - 'PS_SAV_IMAP_OPT_TLS', 'PS_SAV_IMAP_OPT_NOTLS')); - - $conf_str = ''; - if ($conf['PS_SAV_IMAP_OPT_NORSH']) - $conf_str .= '/norsh'; - if ($conf['PS_SAV_IMAP_OPT_SSL']) - $conf_str .= '/ssl'; - if ($conf['PS_SAV_IMAP_OPT_VALIDATE-CERT']) - $conf_str .= '/validate-cert'; - if ($conf['PS_SAV_IMAP_OPT_NOVALIDATE-CERT']) - $conf_str .= '/novalidate-cert'; - if ($conf['PS_SAV_IMAP_OPT_TLS']) - $conf_str .= '/tls'; - if ($conf['PS_SAV_IMAP_OPT_NOTLS']) - $conf_str .= '/notls'; - - if (!function_exists('imap_open')) - die('{"hasError" : true, "errors" : ["imap is not installed on this server"]}'); - - $mbox = @imap_open('{'.$url.':'.$port.$conf_str.'}', $user, $password); - - //checks if there is no error when connecting imap server - $errors = imap_errors(); - $str_errors = ''; - $str_error_delete = ''; - if (sizeof($errors) && is_array($errors)) - { - var_dump($errors); - $str_errors = ''; - foreach($errors as $error) - $str_errors .= '"'.$error.'",'; - $str_errors = rtrim($str_errors, ',').''; - } - //checks if imap connexion is active - if (!$mbox) - die('{"hasError" : true, "errors" : ["Cannot connect to the mailbox"]}'); - - //Returns information about the current mailbox. Returns FALSE on failure. - $check = imap_check($mbox); - if (!$check) - die('{"hasError" : true, "errors" : ["Fail to get information about the current mailbox"]}'); - - if ($check->Nmsgs == 0) - die('{"hasError" : true, "errors" : ["NO message to sync"]}'); - - $result = imap_fetch_overview($mbox,"1:{$check->Nmsgs}",0); - foreach ($result as $overview) - { - //check if message exist in database - if (isset($overview->subject)) - $subject = $overview->subject; - else - $subject = ''; - - //Creating an md5 to check if message has been allready processed - $md5 = md5($overview->date.$overview->from.$subject.$overview->msgno); - $exist = Db::getInstance()->getValue( - 'SELECT `md5_header` - FROM `'._DB_PREFIX_.'customer_message_sync_imap` - WHERE `md5_header` = \''.pSQL($md5).'\''); - if ($exist) - { - if (Configuration::get('PS_SAV_IMAP_DELETE_MSG')) - if (!imap_delete($mbox, $overview->msgno)) - $str_error_delete = ', "Fail to delete message"'; - } - else - { - //check if subject has id_order - preg_match('/\#ct([0-9]*)/', $subject, $matches1); - preg_match('/\#tc([0-9-a-z-A-Z]*)/', $subject, $matches2); - - if (isset($matches1[1]) && isset($matches2[1])) - { - //check if order exist in database - $ct = new CustomerThread((int)$matches1[1]); - - if (Validate::isLoadedObject($ct) && $ct->token == $matches2[1]) - { - $cm = new CustomerMessage(); - $cm->id_customer_thread = $ct->id; - $cm->message = imap_fetchbody($mbox, $overview->msgno, 1); - $cm->add(); - } - } - Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'customer_message_sync_imap` (`md5_header`) VALUES (\''.pSQL($md5).'\')'); - } - } - imap_expunge($mbox); - imap_close($mbox); - die('{"hasError" : false, "errors" : ["'.$str_errors.$str_error_delete.'"]}'); -} - if (Tools::isSubmit('searchCategory')) { $q = Tools::getValue('q'); diff --git a/admin-dev/ajax_products_list.php b/admin-dev/ajax_products_list.php index f3c747e18..64ee54211 100644 --- a/admin-dev/ajax_products_list.php +++ b/admin-dev/ajax_products_list.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -51,13 +51,16 @@ else // Excluding downloadable products from packs because download from pack is not supported $excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false); +$exclude_packs = (bool)Tools::getValue('exclude_packs', false); $sql = 'SELECT p.`id_product`, `reference`, pl.name FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').') WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'. (!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' '). - ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''); + ($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : ''). + ($exclude_packs ? 'AND (p.cache_is_pack IS NULL OR p.cache_is_pack = 0)' : ''); + $items = Db::getInstance()->executeS($sql); if ($items) diff --git a/admin-dev/ajaxfilemanager/inc/index.php b/admin-dev/ajaxfilemanager/inc/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/inc/index.php +++ b/admin-dev/ajaxfilemanager/inc/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/index.php b/admin-dev/ajaxfilemanager/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/index.php +++ b/admin-dev/ajaxfilemanager/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/images/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/langs/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php b/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/edit_area/reg_syntax/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/jscripts/index.php b/admin-dev/ajaxfilemanager/jscripts/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/jscripts/index.php +++ b/admin-dev/ajaxfilemanager/jscripts/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/langs/index.php b/admin-dev/ajaxfilemanager/langs/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/langs/index.php +++ b/admin-dev/ajaxfilemanager/langs/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/session/index.php b/admin-dev/ajaxfilemanager/session/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/session/index.php +++ b/admin-dev/ajaxfilemanager/session/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/css/index.php b/admin-dev/ajaxfilemanager/theme/default/css/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/css/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/css/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/action/index.php b/admin-dev/ajaxfilemanager/theme/default/images/action/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/action/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/action/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php b/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/big_icon/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php b/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/file_type/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/index.php b/admin-dev/ajaxfilemanager/theme/default/images/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php b/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/pagination/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php b/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php index ec45b2dfe..f42f03e4d 100644 --- a/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/images/standard/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/default/index.php b/admin-dev/ajaxfilemanager/theme/default/index.php index 7a626751d..319128b59 100644 --- a/admin-dev/ajaxfilemanager/theme/default/index.php +++ b/admin-dev/ajaxfilemanager/theme/default/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/ajaxfilemanager/theme/index.php b/admin-dev/ajaxfilemanager/theme/index.php index 7a626751d..319128b59 100644 --- a/admin-dev/ajaxfilemanager/theme/index.php +++ b/admin-dev/ajaxfilemanager/theme/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/autoupgrade/index.php b/admin-dev/autoupgrade/index.php index 4c1db9e4c..5ca842ada 100644 --- a/admin-dev/autoupgrade/index.php +++ b/admin-dev/autoupgrade/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/backup.php b/admin-dev/backup.php index bf13d08ad..e4b451f43 100644 --- a/admin-dev/backup.php +++ b/admin-dev/backup.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ define('_PS_ADMIN_DIR_', getcwd()); - include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); if (!Context::getContext()->employee->isLoggedBack()) @@ -39,7 +38,7 @@ if ($tabAccess['view'] !== '1') $backupdir = realpath(_PS_ADMIN_DIR_ . '/backups/'); if ($backupdir === false) - die (Tools::displayError('Backups directory does not exist.')); + die (Tools::displayError('"Backup" directory does not exist.')); if (!$backupfile = Tools::getValue('filename')) die (Tools::displayError('No file specified')); diff --git a/admin-dev/backups/index.php b/admin-dev/backups/index.php index 88e934d59..195fab225 100644 --- a/admin-dev/backups/index.php +++ b/admin-dev/backups/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/cron_currency_rates.php b/admin-dev/cron_currency_rates.php index 36015d7e5..2bf94de21 100644 --- a/admin-dev/cron_currency_rates.php +++ b/admin-dev/cron_currency_rates.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/displayImage.php b/admin-dev/displayImage.php index 17ac32918..e48f4f290 100644 --- a/admin-dev/displayImage.php +++ b/admin-dev/displayImage.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ +define('_PS_ADMIN_DIR_', getcwd()); require_once(dirname(__FILE__).'/../config/config.inc.php'); require_once(dirname(__FILE__).'/init.php'); diff --git a/admin-dev/drawer.php b/admin-dev/drawer.php index 6d6c78384..d155d25c5 100644 --- a/admin-dev/drawer.php +++ b/admin-dev/drawer.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/export/index.php b/admin-dev/export/index.php index 88e934d59..195fab225 100644 --- a/admin-dev/export/index.php +++ b/admin-dev/export/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/footer.inc.php b/admin-dev/footer.inc.php index e41c93db3..5f91c44fa 100644 --- a/admin-dev/footer.inc.php +++ b/admin-dev/footer.inc.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/functions.php b/admin-dev/functions.php index a79749b62..888f9bb24 100644 --- a/admin-dev/functions.php +++ b/admin-dev/functions.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ -require_once(dirname(__FILE__).'/../images.inc.php'); - function bindDatepicker($id, $time) { if ($time) @@ -265,7 +263,7 @@ function checkingTab($tab) $adminObj = new $tab; if (!$adminObj->viewAccess() AND ($adminObj->table != 'employee' OR Context::getContext()->employee->id != Tools::getValue('id_employee') OR !Tools::isSubmit('updateemployee'))) { - $adminObj->_errors = array(Tools::displayError('Access denied')); + $adminObj->_errors = array(Tools::displayError('Access denied.')); echo $adminObj->displayErrors(); return false; } @@ -431,7 +429,7 @@ function runAdminTab($tab, $ajaxMode = false) $bread = ''; foreach ($tabs AS $key => $item) { - $bread .= ' >'; + $bread .= ' >'; if (count($tabs) - 1 > $key) $bread .= ''; diff --git a/admin-dev/get-file-admin.php b/admin-dev/get-file-admin.php index bc9e28e82..1a6c855db 100644 --- a/admin-dev/get-file-admin.php +++ b/admin-dev/get-file-admin.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/grider.php b/admin-dev/grider.php index 4fffad24a..0ba54a8a6 100644 --- a/admin-dev/grider.php +++ b/admin-dev/grider.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/header.inc.php b/admin-dev/header.inc.php index 0f92567d4..077fde82f 100644 --- a/admin-dev/header.inc.php +++ b/admin-dev/header.inc.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -36,9 +36,9 @@ echo ' - + - + PrestaShop™ - '.translate('Administration panel').' @@ -231,28 +231,37 @@ echo ' var html = ""; '; } - echo ' - '.translate('My preferences').' - - - '.Tools::substr(Context::getContext()->employee->firstname, 0, 1).'. '.htmlentities(Context::getContext()->employee->lastname, ENT_COMPAT, 'UTF-8').' - '.translate('logout').''; - if (Context::getContext()->shop->getBaseURL()) - echo ''.translate('View my shop').''; - echo ' + echo ' + +
+
+
'.translate('Welcome,').' '.Context::getContext()->employee->firstname.' '.Context::getContext()->employee->lastname.'
+
+ '; + if (defined(_PS_BASE_URL_)) + echo ''.translate('View my shop').''; + echo '
+
+ + +
+
{l s='Vouchers'} ({count($discounts)}) + {if count($discounts)} + + + + + + + + + {foreach $discounts AS $key => $discount} + + + + + + + + {/foreach} +
{l s='ID'}{l s='Code'}{l s='Name'}{l s='Status'}{l s='Actions'}
{$discount['id_cart_rule']}{$discount['code']}{$discount['name']}{l s='Status'} + + +
+ {else} + {l s='%1$s %2$s has no discount vouchers' sprintf=[$customer->firstname, $customer->lastname]}. + {/if} +
+
{* display hook specified to this page : AdminCustomers *}
{hook h="displayAdminCustomers" id_customer=$customer->id}
 
-

- {l s='Groups'} ({count($groups)}) - - - -

- {if $groups AND count($groups)} - - - - - - - - - - - - {foreach $groups AS $key => $group} - - - - - - {/foreach} -
{l s='ID'}{l s='Name'}{l s='Actions'}
{$group['id_group']}{$group['name']}
- {/if} -
 
- - +

{l s='Orders'} ({count($orders)})

{if $orders AND count($orders)} {assign var=count_ok value=count($orders_ok)} {if $count_ok}
-

+

{l s='Valid orders:'} {$count_ok} {l s='for'} {$total_ok}

@@ -202,18 +206,18 @@ - + - - + + {foreach $orders_ok AS $key => $order} - - - - + + + + @@ -225,7 +229,6 @@ {assign var=count_ko value=count($orders_ko)} {if $count_ko}
-

{l s='Invalid orders:'} {$count_ko}

{l s='ID'} {l s='Date'}{l s='Payment'}{l s='Payment: '} {l s='State'}{l s='Products'}{l s='Total spent'}{l s='Products'}{l s='Total spent'} {l s='Actions'}
{$order['id_order']}{$order['date_add']}{$order['payment']}{$order['order_state']}{$order['id_order']}{$order['date_add']}{$order['payment']}{$order['order_state']} {$order['nb_products']} {$order['total_paid_real']}
@@ -237,36 +240,73 @@ - - - - - - + + + + + + {foreach $orders_ko AS $key => $order} - - - - - + + + + + {/foreach}
{l s='ID'}{l s='Date'}{l s='Payment'}{l s='State'}{l s='Products'}{l s='Total spent'}{l s='ID'}{l s='Date'}{l s='Payment: '}{l s='State'}{l s='Products'}{l s='Total spent'} {l s='Actions'}
{$order['id_order']}{$order['date_add']}{$order['payment']}{$order['order_state']}{$order['nb_products']}{$order['id_order']}{$order['date_add']}{$order['payment']}{$order['order_state']}{$order['nb_products']} {$order['total_paid_real']}
+

{l s='Invalid orders:'} {$count_ko}

-
 
{/if} {else} {l s='%1$s %2$s has not placed any orders yet' sprintf=[$customer->firstname, $customer->lastname]} {/if} +
+
+
+

{l s='Carts'} ({count($carts)})

+ {if $carts AND count($carts)} + + + + + + + + + + + + + + + + {foreach $carts AS $key => $cart} + + + + + + + + {/foreach} +
{l s='ID'}{l s='Date'}{l s='Carrier'}{l s='Total'}{l s='Actions'}
{$cart['id_cart']}{$cart['date_add']}{$cart['name']}{$cart['total_price']}
+ {else} + {l s='No cart is available'}. + {/if} +
+
+ +
 
{if $products AND count($products)}
 
-

{l s='Products'} ({count($products)})

+

{l s='Products:'} ({count($products)})

@@ -291,116 +331,90 @@
{/if}
 
- -

{l s='Addresses'} ({count($addresses)})

- {if count($addresses)} - - - - - - - - - - - - - - - - - - {foreach $addresses AS $key => $address} - - - - - - - - - {/foreach} -
{l s='Company'}{l s='Name'}{l s='Address'}{l s='Country'}{l s='Phone number(s)'}{l s='Actions'}
{if $address['company']}{$address['company']}{else}--{/if}{$address['firstname']} {$address['lastname']}{$address['address1']} {if $address['address2']}{$address['address2']}{/if} {$address['postcode']} {$address['city']}{$address['country']} - {if $address['phone']} - {$address['phone']} - {if $address['phone_mobile']}
{$address['phone_mobile']}{/if} - {else} - {if $address['phone_mobile']}
{$address['phone_mobile']}{else}--{/if} - {/if} -
- - -
- {else} - {l s='%1$s %2$s has not registered any addresses yet' sprintf=[$customer->firstname, $customer->lastname]} - {/if} - -
 
-

{l s='Vouchers'} ({count($discounts)})

- {if count($discounts)} - - - - - - - - - {foreach $discounts AS $key => $discount} - - - - - - - - {/foreach} -
{l s='ID'}{l s='Code'}{l s='Name'}{l s='Status'}{l s='Actions'}
{$discount['id_cart_rule']}{$discount['code']}{$discount['name']}{l s='Status'} - - -
- {else} - {l s='%1$s %2$s has no discount vouchers' sprintf=[$customer->firstname, $customer->lastname]}. - {/if} -
 
- -
-

{l s='Carts'} ({count($carts)})

- {if $carts AND count($carts)} - - - - - - - - + +
+

{l s='Addresses'} ({count($addresses)})

+ {if count($addresses)} +
+ + + + + + + + - - - - + + + + + - {foreach $carts AS $key => $cart} - - - - - - + {foreach $addresses AS $key => $address} + + + + + + + {/foreach}
{l s='ID'}{l s='Date'}{l s='Carrier'}{l s='Total'}{l s='Company'}{l s='Name'}{l s='Address'}{l s='Country'}{l s='Phone number(s)'} {l s='Actions'}
{$cart['id_cart']}{$cart['date_add']}{$cart['name']}{$cart['total_price']}
{if $address['company']}{$address['company']}{else}--{/if}{$address['firstname']} {$address['lastname']}{$address['address1']} {if $address['address2']}{$address['address2']}{/if} {$address['postcode']} {$address['city']}{$address['country']} + {if $address['phone']} + {$address['phone']} + {if $address['phone_mobile']}
{$address['phone_mobile']}{/if} + {else} + {if $address['phone_mobile']}
{$address['phone_mobile']}{else}--{/if} + {/if} +
+ + +
{else} - {l s='No cart available'}. + {l s='%1$s %2$s has not registered any addresses yet' sprintf=[$customer->firstname, $customer->lastname]} {/if}
- + +
+
+

+ {l s='Groups'} ({count($groups)}) + + + +

+ {if $groups AND count($groups)} + + + + + + + + + + + + {foreach $groups AS $key => $group} + + + + + + {/foreach} +
{l s='ID'}{l s='Name'}{l s='Actions'}
{$group['id_group']}{$group['name']}
+ {/if} +
+
+ +
 
+ {if count($interested)}
-

{l s='Products'} ({count($interested)})

+

{l s='Products:'} ({count($interested)})

@@ -417,9 +431,9 @@
{/if} - +
 
- +
{* Last connections *} {if count($connections)}

{l s='Last connections'}

@@ -432,42 +446,46 @@ - {l s='Date'} - {l s='Pages viewed'} - {l s='Total time'} - {l s='Origin'} - {l s='IP Address'} + {l s='Date'} + {l s='Pages viewed'} + {l s='Total time'} + {l s='Origin'} + {l s='IP Address'} {foreach $connections as $connection} - {$connection['date_add']} - {$connection['pages']} - {$connection['time']} - {$connection['http_referer']} - {$connection['ipaddress']} + {$connection['date_add']} + {$connection['pages']} + {$connection['time']} + {$connection['http_referer']} + {$connection['ipaddress']} {/foreach}
 
{/if} - - {if count($referrers)} -

{l s='Referrers'}

- - - - - {if $shop_is_feature_active}{/if} - - {foreach $referrers as $referrer} - - - - {if $shop_is_feature_active}{/if} - - {/foreach} -
{l s='Date'}{l s='Name'}{l s='Shop'}
{$referrer['date_add']}{$referrer['name']}{$referrer['shop_name']}
- {/if} +
+
+
+ {if count($referrers)} +

{l s='Referrers'}

+ + + + + {if $shop_is_feature_active}{/if} + + {foreach $referrers as $referrer} + + + + {if $shop_is_feature_active}{/if} + + {/foreach} +
{l s='Date'}{l s='Name'}{l s='Shop'}
{$referrer['date_add']}{$referrer['name']}{$referrer['shop_name']}
+ {/if} +
+
{/block} -
 
+
 
\ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/customers/index.php b/admin-dev/themes/default/template/controllers/customers/index.php index 3d0287ee8..fcb7f5c2b 100644 --- a/admin-dev/themes/default/template/controllers/customers/index.php +++ b/admin-dev/themes/default/template/controllers/customers/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/themes/default/template/controllers/emails/content.tpl b/admin-dev/themes/default/template/controllers/emails/content.tpl index 9e8ae6652..7ae001ff5 100644 --- a/admin-dev/themes/default/template/controllers/emails/content.tpl +++ b/admin-dev/themes/default/template/controllers/emails/content.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,18 +18,18 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} + +
+ + {if count($tab_modules_list.installed)} + {foreach from=$tab_modules_list.installed item=module} + {include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}} + {/foreach} + {else} + + {/if} +
{l s='No modules available in this section.'}
+ + {if count($tab_modules_list.not_installed)} + {foreach from=$tab_modules_list.not_installed item=module} + {include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}} + {/foreach} + {else} + + {/if} + +
+{/if} +

{l s='More options'}

\ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/modules_positions/form.tpl b/admin-dev/themes/default/template/controllers/modules_positions/form.tpl index d5b356883..ebd8d9dbc 100644 --- a/admin-dev/themes/default/template/controllers/modules_positions/form.tpl +++ b/admin-dev/themes/default/template/controllers/modules_positions/form.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -44,7 +44,7 @@
*
@@ -88,8 +88,8 @@ {$value} {/foreach} {/if} - {l s='Please specify the files for which you do not want the module to be displayed'}.
- {l s='Please type each filename separated by a comma'}. + {l s='Please specify the files for which you do not want the module to be displayed.'}.
+ {l s='Please input each filename, separated by a comma.'}.

diff --git a/admin-dev/themes/default/template/controllers/modules_positions/index.php b/admin-dev/themes/default/template/controllers/modules_positions/index.php index 3d0287ee8..fcb7f5c2b 100644 --- a/admin-dev/themes/default/template/controllers/modules_positions/index.php +++ b/admin-dev/themes/default/template/controllers/modules_positions/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl b/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl index a23a751a8..0a4626f66 100644 --- a/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl +++ b/admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -65,7 +65,7 @@ {if !$can_move} -
{l s='If you want to order/move the following data, please select a shop from the shop list'}
+
{l s='If you want to order/move the following data, please select a shop from the shop list.'}
{/if} {foreach $hooks as $hook} @@ -121,7 +121,7 @@ {/if} {/foreach} {else} - {l s='No module for this hook'} + {l s='No module was found for this hook.'} {/if} {/foreach} diff --git a/admin-dev/themes/default/template/controllers/not_found/content.tpl b/admin-dev/themes/default/template/controllers/not_found/content.tpl index f2df6da4c..67933528c 100644 --- a/admin-dev/themes/default/template/controllers/not_found/content.tpl +++ b/admin-dev/themes/default/template/controllers/not_found/content.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,12 +18,12 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *}

{l s='The controller %s is missing or invalid.' sprintf=$controller}

diff --git a/admin-dev/themes/default/template/controllers/not_found/index.php b/admin-dev/themes/default/template/controllers/not_found/index.php index 3d0287ee8..fcb7f5c2b 100644 --- a/admin-dev/themes/default/template/controllers/not_found/index.php +++ b/admin-dev/themes/default/template/controllers/not_found/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/themes/default/template/controllers/order_preferences/helpers/index.php b/admin-dev/themes/default/template/controllers/order_preferences/helpers/index.php index b4a66917e..063209789 100644 --- a/admin-dev/themes/default/template/controllers/order_preferences/helpers/index.php +++ b/admin-dev/themes/default/template/controllers/order_preferences/helpers/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/index.php b/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/index.php index 8e4de11e4..30839633c 100644 --- a/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/index.php +++ b/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/options.tpl b/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/options.tpl index 04b7f7c69..e990347fb 100644 --- a/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/options.tpl +++ b/admin-dev/themes/default/template/controllers/order_preferences/helpers/options/options.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} diff --git a/admin-dev/themes/default/template/controllers/order_preferences/index.php b/admin-dev/themes/default/template/controllers/order_preferences/index.php index 3d0287ee8..fcb7f5c2b 100644 --- a/admin-dev/themes/default/template/controllers/order_preferences/index.php +++ b/admin-dev/themes/default/template/controllers/order_preferences/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl index a7bd55c58..05b150228 100755 --- a/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_customized_data.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -28,7 +28,7 @@ {if isset($product.image) && $product.image->id}{$product.image_tag}{else}--{/if} - {$product['product_name']} - {l s='customized'}
+ {$product['product_name']} - {l s='Customized'}
{if ($product['product_reference'])}{l s='Ref:'} {$product['product_reference']}
{/if} {if ($product['product_supplier_reference'])}{l s='Ref Supplier:'} {$product['product_supplier_reference']}{/if}
diff --git a/admin-dev/themes/default/template/controllers/orders/_discount_form.tpl b/admin-dev/themes/default/template/controllers/orders/_discount_form.tpl index b68240298..dc71b2c44 100644 --- a/admin-dev/themes/default/template/controllers/orders/_discount_form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_discount_form.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -49,7 +49,7 @@ {/if} % @@ -64,7 +64,7 @@

- {l s='If you select to create this discount for all invoices, one discount will be created per order invoice.'} + {l s='If you chooses to create this discount for all invoices, only one discount will be created per order invoice.'}

{/if} diff --git a/admin-dev/themes/default/template/controllers/orders/_documents.tpl b/admin-dev/themes/default/template/controllers/orders/_documents.tpl index cff383826..8a14112c5 100644 --- a/admin-dev/themes/default/template/controllers/orders/_documents.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_documents.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} diff --git a/admin-dev/themes/default/template/controllers/orders/_new_product.tpl b/admin-dev/themes/default/template/controllers/orders/_new_product.tpl index 7da1b4d27..a51d92871 100644 --- a/admin-dev/themes/default/template/controllers/orders/_new_product.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_new_product.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -71,7 +71,7 @@
-

{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied'}

+

{l s='If you don\'t select "Free shipping," the normal shipping cost will be applied.'}

diff --git a/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl b/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl index 42a7c6a60..f88070aa3 100644 --- a/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} diff --git a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl index a5fd8cac3..6519dadaf 100755 --- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -135,7 +135,7 @@ {if sizeof($invoices_collection)} {else} diff --git a/admin-dev/themes/default/template/controllers/orders/_shipping.tpl b/admin-dev/themes/default/template/controllers/orders/_shipping.tpl index e777df913..53138482a 100644 --- a/admin-dev/themes/default/template/controllers/orders/_shipping.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_shipping.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index 2f0b1af18..e6179ea30 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -33,7 +33,7 @@ var currencies = new Array(); var id_currency = ''; var id_lang = ''; - var txt_show_carts = '{l s='Show carts and orders for this customer'}'; + var txt_show_carts = '{l s='Show carts and orders for this customer.'}'; var txt_hide_carts = '{l s='Hide carts and orders for this customer'}'; var defaults_order_state = new Array(); var customization_errors = false; @@ -42,6 +42,7 @@ defaults_order_state['{$module}'] = '{$id_order_state}'; {/foreach} $(document).ready(function() { + $('#customer').typeWatch({ captureLength: 1, highlight: true, @@ -111,7 +112,7 @@ }, parse: function(data) { if (!data.found) - $('#vouchers_err').html('{l s='No voucher found'}').show(); + $('#vouchers_err').html('{l s='No voucher was found'}').show(); else $('#vouchers_err').hide(); var mytab = new Array(); @@ -299,7 +300,7 @@ id_product: id_product, id_product_attribute: id_product_attribute, id_customer: id_customer, - price: new_price + price: new Number(new_price.replace(",",".")).toFixed(4).toString() }, success : function(res) { @@ -597,7 +598,11 @@ }); products_found += ''; $('#products_found #product_list').html(products_found); - $('#products_found #attributes_list').html(attributes_html); + $('#products_found #attributes_list').html(attributes_html); + $('link[rel="stylesheet"]').each(function (i, element) { + sheet = $(element).clone(); + $('#products_found #customization_list').contents().find('head').append(sheet); + }); $('#products_found #customization_list').contents().find('body').html(customization_html); display_product_attributes(); display_product_customizations(); @@ -680,7 +685,7 @@ $.each(gifts, function() { cart_content += ''+this.name+'
'+this.attributes_small+''+this.reference+''; - cart_content += '{l s='Gift !'}'+this.cart_quantity+'{l s='Gift !'}'; + cart_content += '{l s='Gift'}'+this.cart_quantity+'{l s='Gift'}'; }); $('#customer_cart tbody').html(cart_content); } @@ -981,7 +986,7 @@
-

{l s='Search a customer by tapping the first letters of his name'}

+

{l s='Search a customer by tapping the first letters of his/her name'}

{l s='Add new customer'} @@ -996,7 +1001,7 @@
-

{l s='Search a product by tapping the first letters of his name'}

+

{l s='Search a product by tapping the first letters of his/her name.'}

@@ -1111,9 +1116,9 @@ {l s='ID'} {l s='Date'} - {l s='Products'} + {l s='Products:'} {l s='Total paid'} - {l s='Payment'} + {l s='Payment: '} {l s='Status'} {l s='Action'} @@ -1129,7 +1134,7 @@
-{l s='Add new address'} +{l s='Add a new address'}

specificPrice OR $product->specificPrice.reduction_type != 'percentage'} style="display:none;"{/if}>{if $product->specificPrice AND $product->specificPrice.reduction_type == 'percentage'}-{$product->specificPrice.reduction*100}%{/if}

-

specificPrice OR $product->specificPrice.reduction_type != 'amount' && $product->specificPrice.reduction|intval ==0} style="display:none"{/if}>{if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' && $product->specificPrice.reduction|intval !=0}-{convertPrice price=$product->specificPrice.reduction|floatval}{/if}

+

specificPrice OR $product->specificPrice.reduction_type != 'amount' && $product->specificPrice.reduction|intval ==0} style="display:none"{/if}> + + {if $product->specificPrice AND $product->specificPrice.reduction_type == 'amount' AND $product->specificPrice.reduction|intval !=0} + -{convertPrice price=$productPriceWithoutReduction-$productPrice|floatval} + {/if} + +

{if $product->specificPrice AND $product->specificPrice.reduction}

{if $priceDisplay >= 0 && $priceDisplay <= 2} @@ -412,11 +423,11 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus

{/if} {if $packItems|@count && $productPrice < $product->getNoPackPrice()} -

{l s='instead of'} {convertPrice price=$product->getNoPackPrice()}

+

{l s='Instead of'} {convertPrice price=$product->getNoPackPrice()}


{/if} {if $product->ecotax != 0} -

{l s='include'} {if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if} {l s='for green tax'} +

{l s='Include'} {if $priceDisplay == 2}{$ecotax_tax_exc|convertAndFormatPrice}{else}{$ecotax_tax_inc|convertAndFormatPrice}{/if} {l s='For green tax'} {if $product->specificPrice AND $product->specificPrice.reduction}
{l s='(not impacted by the discount)'} {/if} @@ -452,15 +463,15 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus {if (isset($quantity_discounts) && count($quantity_discounts) > 0)}

- - - + + + @@ -585,7 +596,7 @@ var fieldRequired = '{l s='Please fill in all required fields, then save the cus {/if}
- +
diff --git a/themes/default/products-comparison.tpl b/themes/default/products-comparison.tpl index a9c38e2b8..c85bb5c88 100644 --- a/themes/default/products-comparison.tpl +++ b/themes/default/products-comparison.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -76,7 +76,7 @@ {if $allow_oosp} {$product->available_later|escape:'htmlall':'UTF-8'} {else} - {l s='This product is no longer in stock'} + {l s='This product is no longer in stock.'} {/if} {else} {$product->available_now|escape:'htmlall':'UTF-8'} @@ -101,7 +101,7 @@ {section loop=$products|count step=1 start=0 name=td} @@ -139,6 +139,6 @@
{l s='product'}{l s='from (qty)'}{l s='discount'}{l s='Product'}{l s='From (qty)'}{l s='Discount'}
- {l s='Features'} + {l s='Features:'}
{else} -

{l s='There are no products selected for comparison'}

+

{l s='There are no products selected for comparison.'}

{/if} diff --git a/themes/default/restricted-country.tpl b/themes/default/restricted-country.tpl index ecc2c05d5..3c34f9458 100644 --- a/themes/default/restricted-country.tpl +++ b/themes/default/restricted-country.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -42,7 +42,7 @@

logo

- {l s='You cannot access our store from your country. We apologize for the inconvenience.'} + {l s='You cannot access this store from your country. We apologize for the inconvenience.'}

 
diff --git a/themes/default/scenes.tpl b/themes/default/scenes.tpl index 2721db97f..e8b86fefe 100644 --- a/themes/default/scenes.tpl +++ b/themes/default/scenes.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} diff --git a/themes/default/search.tpl b/themes/default/search.tpl index 2236e2537..512d4c0c3 100644 --- a/themes/default/search.tpl +++ b/themes/default/search.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,28 +18,28 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} -{capture name=path}{l s='Search'}{/capture} +{capture name=path}{l s='Search:'}{/capture} {include file="$tpl_dir./breadcrumb.tpl"}

-{l s='Search'} {if $nbProducts > 0}"{if isset($search_query) && $search_query}{$search_query|escape:'htmlall':'UTF-8'}{elseif $search_tag}{$search_tag|escape:'htmlall':'UTF-8'}{elseif $ref}{$ref|escape:'htmlall':'UTF-8'}{/if}"{/if} -{if isset($instantSearch) && $instantSearch}{l s='Return to previous page'}{/if} +{l s='Search:'} {if $nbProducts > 0}"{if isset($search_query) && $search_query}{$search_query|escape:'htmlall':'UTF-8'}{elseif $search_tag}{$search_tag|escape:'htmlall':'UTF-8'}{elseif $ref}{$ref|escape:'htmlall':'UTF-8'}{/if}"{/if} +{if isset($instantSearch) && $instantSearch}{l s='Return to the previous page'}{/if}

{include file="$tpl_dir./errors.tpl"} {if !$nbProducts}

{if isset($search_query) && $search_query} - {l s='No results found for your search'} "{if isset($search_query)}{$search_query|escape:'htmlall':'UTF-8'}{/if}" + {l s='No results were found for your search'} "{if isset($search_query)}{$search_query|escape:'htmlall':'UTF-8'}{/if}" {elseif isset($search_tag) && $search_tag} - {l s='No results found for your search'} "{$search_tag|escape:'htmlall':'UTF-8'}" + {l s='No results were found for your search'} "{$search_tag|escape:'htmlall':'UTF-8'}" {else} - {l s='Please type a search keyword'} + {l s='Please enter a search keyword'} {/if}

{else} diff --git a/themes/default/shopping-cart-product-line.tpl b/themes/default/shopping-cart-product-line.tpl index 4f58210a9..fb11ef178 100644 --- a/themes/default/shopping-cart-product-line.tpl +++ b/themes/default/shopping-cart-product-line.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -62,9 +62,9 @@ {/if} {if !isset($customizedDatas.$productId.$productAttributeId) OR $quantityDisplayed > 0}
- {l s='Add'}
+ {l s='Add'}
{if $product.minimal_quantity < ($product.cart_quantity-$quantityDisplayed) OR $product.minimal_quantity <= 1} - + {l s='Subtract'} {else} diff --git a/themes/default/shopping-cart.tpl b/themes/default/shopping-cart.tpl index cfcd20405..e8ab9d46c 100644 --- a/themes/default/shopping-cart.tpl +++ b/themes/default/shopping-cart.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -100,29 +100,12 @@ {displayPrice price=$total_products} {/if} - - - {if $use_taxes && $display_tax_label} - {l s='Total vouchers (tax excl.):'} - {else} - {l s='Total vouchers:'} - {/if} - - - {if $use_taxes && !$priceDisplay} - {assign var='total_discounts_negative' value=$total_discounts * -1} - {else} - {assign var='total_discounts_negative' value=$total_discounts_tax_exc * -1} - {/if} - {displayPrice price=$total_discounts_negative} - - {if $use_taxes} - {if $display_tax_label}{l s='Total gift-wrapping (tax incl.):'}{else}{l s='Total gift-wrapping:'}{/if} + {if $display_tax_label}{l s='Total gift wrapping (tax incl.):'}{else}{l s='Total gift-wrapping cost:'}{/if} {else} - {l s='Total gift-wrapping:'} + {l s='Total gift-wrapping cost:'} {/if} @@ -138,7 +121,7 @@ {if $total_shipping_tax_exc <= 0 && !isset($virtualCart)} - + {l s='Shipping:'} {l s='Free Shipping!'} @@ -162,6 +145,27 @@ {/if} {/if} + + + {if $display_tax_label} + {if $use_taxes && $priceDisplay == 0} + {l s='Total vouchers (tax incl.):'} + {else} + {l s='Total vouchers (tax excl.):'} + {/if} + {else} + {l s='Total vouchers:'} + {/if} + + + {if $use_taxes && $priceDisplay == 0} + {assign var='total_discounts_negative' value=$total_discounts * -1} + {else} + {assign var='total_discounts_negative' value=$total_discounts_tax_exc * -1} + {/if} + {displayPrice price=$total_discounts_negative} + + {if $use_taxes} {l s='Total (tax excl.):'} @@ -185,14 +189,14 @@

-

+

{if $displayVouchers} -

{l s='Take advantage of our offers:'}

+

{l s='Take advantage of our exclusive offers:'}

{foreach $displayVouchers as $voucher} {if $voucher.code != ''}{$voucher.code} - {/if}{$voucher.name}
@@ -261,9 +265,9 @@ {if $quantityDisplayed == 0 AND isset($customizedDatas.$productId.$productAttributeId)}{$customizedDatas.$productId.$productAttributeId|@count}{else}{$product.cart_quantity-$quantityDisplayed}{/if} {else}
- {l s='Add'}
+ {l s='Add'}
{if $product.minimal_quantity < ($customization.quantity -$quantityDisplayed) OR $product.minimal_quantity <= 1} - + {l s='Subtract'} {else} @@ -280,7 +284,7 @@ {if isset($cannotModify) AND $cannotModify == 1} {else} {/if} @@ -328,14 +332,14 @@ {if $show_option_allow_separate_package}

allow_seperated_package}checked="checked"{/if} /> - +

{/if} {if !$opc} {if Configuration::get('PS_ALLOW_MULTISHIPPING')}

- +

{/if} {/if} @@ -360,10 +364,10 @@ {if ((!empty($delivery_option) AND !isset($virtualCart)) OR $delivery->id OR $invoice->id) AND !$opc}
- {if !isset($formattedAddresses)} + {if !isset($formattedAddresses) || (count($formattedAddresses.invoice) == 0 && count($formattedAddresses.delivery) == 0) || (count($formattedAddresses.invoice.formated) == 0 && count($formattedAddresses.delivery.formated) == 0)} {if $delivery->id}
    -
  • {l s='Delivery address'}
  • +
  • {l s='Delivery address'} ({$delivery->alias})
  • {if $delivery->company}
  • {$delivery->company|escape:'htmlall':'UTF-8'}
  • {/if}
  • {$delivery->firstname|escape:'htmlall':'UTF-8'} {$delivery->lastname|escape:'htmlall':'UTF-8'}
  • {$delivery->address1|escape:'htmlall':'UTF-8'}
  • @@ -374,7 +378,7 @@ {/if} {if $invoice->id}
      -
    • {l s='Invoice address'}
    • +
    • {l s='Invoice address'} ({$invoice->alias})
    • {if $invoice->company}
    • {$invoice->company|escape:'htmlall':'UTF-8'}
    • {/if}
    • {$invoice->firstname|escape:'htmlall':'UTF-8'} {$invoice->lastname|escape:'htmlall':'UTF-8'}
    • {$invoice->address1|escape:'htmlall':'UTF-8'}
    • @@ -384,9 +388,9 @@
    {/if} {else} - {foreach $formattedAddresses as $address} + {foreach from=$formattedAddresses key=k item=address}
      -
    • {$address.object.alias}
    • +
    • {if $k eq 'invoice'}{l s='Invoice address'}{elseif $k eq 'delivery'}{l s='Delivery address'}{/if} ({$address.object.alias})
    • {foreach $address.ordered as $pattern} {assign var=addressKey value=" "|explode:$pattern}
    • diff --git a/themes/default/sitemap.tpl b/themes/default/sitemap.tpl index 9fe213569..e316dfa64 100644 --- a/themes/default/sitemap.tpl +++ b/themes/default/sitemap.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -33,11 +33,11 @@
@@ -62,7 +62,7 @@
-

{l s='Categories'}

+

{l s='Categories:'}

    {if isset($categoriesTree.children)} diff --git a/themes/default/store_infos.tpl b/themes/default/store_infos.tpl index 3e09027c4..9e5242b4d 100644 --- a/themes/default/store_infos.tpl +++ b/themes/default/store_infos.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -34,7 +34,7 @@ *}

    -{l s='Hours:'} +{l s='working hours'} {foreach from=$days_datas item=one_day} diff --git a/themes/default/stores.tpl b/themes/default/stores.tpl index e015f41a2..19598fdb4 100644 --- a/themes/default/stores.tpl +++ b/themes/default/stores.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -30,7 +30,7 @@ {if $simplifiedStoresDiplay} {if $stores|@count} -

    {l s='Here are our store locations, please feel free to contact us:'}

    +

    {l s='Here you can find our store locations. Please feel free to contact us:'}

    {foreach $stores as $store}
    {if $store.has_picture}

    {/if} @@ -57,7 +57,7 @@ var defaultLat = '{$defaultLat}'; var defaultLong = '{$defaultLong}'; - var translation_1 = '{l s='No stores found, try selecting a wider radius' js=1}'; + var translation_1 = '{l s='No stores were found. Please try selecting a wider radius.' js=1}'; var translation_2 = '{l s='store found - see details:' js=1}'; var translation_3 = '{l s='stores found - see all results:' js=1}'; var translation_4 = '{l s='Phone:' js=1}'; @@ -76,7 +76,7 @@

    {l s='Enter a location (e.g. zip/postal code, address, city or country) in order to find the nearest stores.'}

    - +

    @@ -89,7 +89,7 @@

    - +

    diff --git a/themes/default/supplier-list.tpl b/themes/default/supplier-list.tpl index f06e8ab3d..b418cc416 100644 --- a/themes/default/supplier-list.tpl +++ b/themes/default/supplier-list.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,15 +18,15 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} -{capture name=path}{l s='Suppliers'}{/capture} +{capture name=path}{l s='Suppliers:'}{/capture} {include file="$tpl_dir./breadcrumb.tpl"} -

    {l s='Suppliers'}

    +

    {l s='Suppliers:'}

    {if isset($errors) AND $errors} {include file="$tpl_dir./errors.tpl"} diff --git a/themes/default/supplier.tpl b/themes/default/supplier.tpl index c85c5c952..9c40ab2d4 100644 --- a/themes/default/supplier.tpl +++ b/themes/default/supplier.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} @@ -56,6 +56,6 @@ {include file="./pagination.tpl"}
    {else} -

    {l s='No products for this manufacturer.'}

    +

    {l s='No products for this supplier.'}

    {/if} {/if} diff --git a/themes/index.php b/themes/index.php index af0ec9eab..52b4e5c37 100644 --- a/themes/index.php +++ b/themes/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/themes/live_edit.tpl b/themes/live_edit.tpl index 77b385e84..6f764f6a5 100644 --- a/themes/live_edit.tpl +++ b/themes/live_edit.tpl @@ -1,5 +1,5 @@ {* -* 2007-2012 PrestaShop +* 2007-2013 PrestaShop * * NOTICE OF LICENSE * @@ -18,7 +18,7 @@ * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} diff --git a/tools/FirePHP/index.php b/tools/FirePHP/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/FirePHP/index.php +++ b/tools/FirePHP/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/fpdf/font/index.php b/tools/fpdf/font/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/fpdf/font/index.php +++ b/tools/fpdf/font/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/fpdf/font/makefont/index.php b/tools/fpdf/font/makefont/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/fpdf/font/makefont/index.php +++ b/tools/fpdf/font/makefont/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/fpdf/index.php b/tools/fpdf/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/fpdf/index.php +++ b/tools/fpdf/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/geoip/geoip.inc b/tools/geoip/geoip.inc index f04686374..d2aea2e09 100755 --- a/tools/geoip/geoip.inc +++ b/tools/geoip/geoip.inc @@ -19,85 +19,107 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/* PrestaShop - Test if functions and defines are already defined - END -*/ -if (!defined('GEOIP_COUNTRY_BEGIN')) + /* + * Hack PrestaShop because some users may use mod_geoip with this lib and it will cause a crash + */ + +if (!defined("GEOIP_COUNTRY_BEGIN")) define("GEOIP_COUNTRY_BEGIN", 16776960); -if (!defined('GEOIP_STATE_BEGIN_REV0')) +if (!defined("GEOIP_STATE_BEGIN_REV0")) define("GEOIP_STATE_BEGIN_REV0", 16700000); -if (!defined('GEOIP_STATE_BEGIN_REV1')) +if (!defined("GEOIP_STATE_BEGIN_REV1")) define("GEOIP_STATE_BEGIN_REV1", 16000000); -if (!defined('GEOIP_STANDARD')) +if (!defined("GEOIP_STANDARD")) define("GEOIP_STANDARD", 0); -if (!defined('GEOIP_MEMORY_CACHE')) +if (!defined("GEOIP_MEMORY_CACHE")) define("GEOIP_MEMORY_CACHE", 1); -if (!defined('GEOIP_SHARED_MEMORY')) +if (!defined("GEOIP_SHARED_MEMORY")) define("GEOIP_SHARED_MEMORY", 2); -if (!defined('STRUCTURE_INFO_MAX_SIZE')) +if (!defined("STRUCTURE_INFO_MAX_SIZE")) define("STRUCTURE_INFO_MAX_SIZE", 20); -if (!defined('DATABASE_INFO_MAX_SIZE')) +if (!defined("DATABASE_INFO_MAX_SIZE")) define("DATABASE_INFO_MAX_SIZE", 100); -if (!defined('GEOIP_COUNTRY_EDITION')) +if (!defined("GEOIP_COUNTRY_EDITION")) define("GEOIP_COUNTRY_EDITION", 106); -if (!defined('GEOIP_PROXY_EDITION')) +if (!defined("GEOIP_PROXY_EDITION")) define("GEOIP_PROXY_EDITION", 8); -if (!defined('GEOIP_ASNUM_EDITION')) +if (!defined("GEOIP_ASNUM_EDITION")) define("GEOIP_ASNUM_EDITION", 9); -if (!defined('GEOIP_NETSPEED_EDITION')) +if (!defined("GEOIP_NETSPEED_EDITION")) define("GEOIP_NETSPEED_EDITION", 10); -if (!defined('GEOIP_REGION_EDITION_REV0')) +if (!defined("GEOIP_REGION_EDITION_REV0")) define("GEOIP_REGION_EDITION_REV0", 112); -if (!defined('GEOIP_REGION_EDITION_REV1')) +if (!defined("GEOIP_REGION_EDITION_REV1")) define("GEOIP_REGION_EDITION_REV1", 3); -if (!defined('GEOIP_CITY_EDITION_REV0')) +if (!defined("GEOIP_CITY_EDITION_REV0")) define("GEOIP_CITY_EDITION_REV0", 111); -if (!defined('GEOIP_CITY_EDITION_REV1')) +if (!defined("GEOIP_CITY_EDITION_REV1")) define("GEOIP_CITY_EDITION_REV1", 2); -if (!defined('GEOIP_ORG_EDITION')) +if (!defined("GEOIP_ORG_EDITION")) define("GEOIP_ORG_EDITION", 110); -if (!defined('GEOIP_ISP_EDITION')) +if (!defined("GEOIP_ISP_EDITION")) define("GEOIP_ISP_EDITION", 4); -if (!defined('SEGMENT_RECORD_LENGTH')) +if (!defined("SEGMENT_RECORD_LENGTH")) define("SEGMENT_RECORD_LENGTH", 3); -if (!defined('STANDARD_RECORD_LENGTH')) +if (!defined("STANDARD_RECORD_LENGTH")) define("STANDARD_RECORD_LENGTH", 3); -if (!defined('ORG_RECORD_LENGTH')) +if (!defined("ORG_RECORD_LENGTH")) define("ORG_RECORD_LENGTH", 4); -if (!defined('MAX_RECORD_LENGTH')) +if (!defined("MAX_RECORD_LENGTH")) define("MAX_RECORD_LENGTH", 4); -if (!defined('MAX_ORG_RECORD_LENGTH')) +if (!defined("MAX_ORG_RECORD_LENGTH")) define("MAX_ORG_RECORD_LENGTH", 300); -if (!defined('GEOIP_SHM_KEY')) +if (!defined("GEOIP_SHM_KEY")) define("GEOIP_SHM_KEY", 0x4f415401); -if (!defined('US_OFFSET')) +if (!defined("US_OFFSET")) define("US_OFFSET", 1); -if (!defined('CANADA_OFFSET')) +if (!defined("CANADA_OFFSET")) define("CANADA_OFFSET", 677); -if (!defined('WORLD_OFFSET')) +if (!defined("WORLD_OFFSET")) define("WORLD_OFFSET", 1353); -if (!defined('FIPS_RANGE')) +if (!defined("FIPS_RANGE")) define("FIPS_RANGE", 360); -if (!defined('GEOIP_UNKNOWN_SPEED')) +if (!defined("GEOIP_UNKNOWN_SPEED")) define("GEOIP_UNKNOWN_SPEED", 0); -if (!defined('GEOIP_DIALUP_SPEED')) +if (!defined("GEOIP_DIALUP_SPEED")) define("GEOIP_DIALUP_SPEED", 1); -if (!defined('GEOIP_CABLEDSL_SPEED')) +if (!defined("GEOIP_CABLEDSL_SPEED")) define("GEOIP_CABLEDSL_SPEED", 2); -if (!defined('GEOIP_CORPORATE_SPEED')) +if (!defined("GEOIP_CORPORATE_SPEED")) define("GEOIP_CORPORATE_SPEED", 3); -if (!defined('GEOIP_DOMAIN_EDITION')) +if (!defined("GEOIP_DOMAIN_EDITION")) define("GEOIP_DOMAIN_EDITION", 11); -if (!defined('GEOIP_LOCATIONA_EDITION')) +if (!defined("GEOIP_COUNTRY_EDITION_V6")) + define("GEOIP_COUNTRY_EDITION_V6", 12); +if (!defined("GEOIP_LOCATIONA_EDITION")) define("GEOIP_LOCATIONA_EDITION", 13); -if (!defined('GEOIP_ACCURACYRADIUS_EDITION')) +if (!defined("GEOIP_ACCURACYRADIUS_EDITION")) define("GEOIP_ACCURACYRADIUS_EDITION", 14); -if (!defined('GEOIP_CITYCOMBINED_EDITION')) +if (!defined("GEOIP_CITYCOMBINED_EDITION")) define("GEOIP_CITYCOMBINED_EDITION", 15); -if (!defined('CITYCOMBINED_FIXED_RECORD')) +if (!defined("GEOIP_CITY_EDITION_REV1_V6")) + define("GEOIP_CITY_EDITION_REV1_V6", 30); +if (!defined("GEOIP_CITY_EDITION_REV0_V6")) + define("GEOIP_CITY_EDITION_REV0_V6",31); +if (!defined("GEOIP_NETSPEED_EDITION_REV1")) + define("GEOIP_NETSPEED_EDITION_REV1",32); +if (!defined("GEOIP_NETSPEED_EDITION_REV1_V6")) + define("GEOIP_NETSPEED_EDITION_REV1_V6",33); +if (!defined("GEOIP_USERTYPE_EDITION")) + define("GEOIP_USERTYPE_EDITION",28); +if (!defined("GEOIP_USERTYPE_EDITION_V6")) + define("GEOIP_USERTYPE_EDITION_V6",29); +if (!defined("GEOIP_ASNUM_EDITION_V6")) + define("GEOIP_ASNUM_EDITION_V6",21); +if (!defined("GEOIP_ISP_EDITION_V6")) + define("GEOIP_ISP_EDITION_V6",22); +if (!defined("GEOIP_ORG_EDITION_V6")) + define("GEOIP_ORG_EDITION_V6",23); +if (!defined("GEOIP_DOMAIN_EDITION_V6")) + define("GEOIP_DOMAIN_EDITION_V6",24); + +if (!defined("CITYCOMBINED_FIXED_RECORD")) define("CITYCOMBINED_FIXED_RECORD", 7 ); class GeoIP { @@ -109,529 +131,690 @@ class GeoIP { var $record_length; var $shmid; var $GEOIP_COUNTRY_CODE_TO_NUMBER = array( -"" => 0, "AP" => 1, "EU" => 2, "AD" => 3, "AE" => 4, "AF" => 5, -"AG" => 6, "AI" => 7, "AL" => 8, "AM" => 9, "AN" => 10, "AO" => 11, -"AQ" => 12, "AR" => 13, "AS" => 14, "AT" => 15, "AU" => 16, "AW" => 17, -"AZ" => 18, "BA" => 19, "BB" => 20, "BD" => 21, "BE" => 22, "BF" => 23, -"BG" => 24, "BH" => 25, "BI" => 26, "BJ" => 27, "BM" => 28, "BN" => 29, -"BO" => 30, "BR" => 31, "BS" => 32, "BT" => 33, "BV" => 34, "BW" => 35, -"BY" => 36, "BZ" => 37, "CA" => 38, "CC" => 39, "CD" => 40, "CF" => 41, -"CG" => 42, "CH" => 43, "CI" => 44, "CK" => 45, "CL" => 46, "CM" => 47, -"CN" => 48, "CO" => 49, "CR" => 50, "CU" => 51, "CV" => 52, "CX" => 53, -"CY" => 54, "CZ" => 55, "DE" => 56, "DJ" => 57, "DK" => 58, "DM" => 59, -"DO" => 60, "DZ" => 61, "EC" => 62, "EE" => 63, "EG" => 64, "EH" => 65, -"ER" => 66, "ES" => 67, "ET" => 68, "FI" => 69, "FJ" => 70, "FK" => 71, -"FM" => 72, "FO" => 73, "FR" => 74, "FX" => 75, "GA" => 76, "GB" => 77, -"GD" => 78, "GE" => 79, "GF" => 80, "GH" => 81, "GI" => 82, "GL" => 83, -"GM" => 84, "GN" => 85, "GP" => 86, "GQ" => 87, "GR" => 88, "GS" => 89, -"GT" => 90, "GU" => 91, "GW" => 92, "GY" => 93, "HK" => 94, "HM" => 95, -"HN" => 96, "HR" => 97, "HT" => 98, "HU" => 99, "ID" => 100, "IE" => 101, -"IL" => 102, "IN" => 103, "IO" => 104, "IQ" => 105, "IR" => 106, "IS" => 107, -"IT" => 108, "JM" => 109, "JO" => 110, "JP" => 111, "KE" => 112, "KG" => 113, -"KH" => 114, "KI" => 115, "KM" => 116, "KN" => 117, "KP" => 118, "KR" => 119, -"KW" => 120, "KY" => 121, "KZ" => 122, "LA" => 123, "LB" => 124, "LC" => 125, -"LI" => 126, "LK" => 127, "LR" => 128, "LS" => 129, "LT" => 130, "LU" => 131, -"LV" => 132, "LY" => 133, "MA" => 134, "MC" => 135, "MD" => 136, "MG" => 137, -"MH" => 138, "MK" => 139, "ML" => 140, "MM" => 141, "MN" => 142, "MO" => 143, -"MP" => 144, "MQ" => 145, "MR" => 146, "MS" => 147, "MT" => 148, "MU" => 149, +"" => 0, "AP" => 1, "EU" => 2, "AD" => 3, "AE" => 4, "AF" => 5, +"AG" => 6, "AI" => 7, "AL" => 8, "AM" => 9, "CW" => 10, "AO" => 11, +"AQ" => 12, "AR" => 13, "AS" => 14, "AT" => 15, "AU" => 16, "AW" => 17, +"AZ" => 18, "BA" => 19, "BB" => 20, "BD" => 21, "BE" => 22, "BF" => 23, +"BG" => 24, "BH" => 25, "BI" => 26, "BJ" => 27, "BM" => 28, "BN" => 29, +"BO" => 30, "BR" => 31, "BS" => 32, "BT" => 33, "BV" => 34, "BW" => 35, +"BY" => 36, "BZ" => 37, "CA" => 38, "CC" => 39, "CD" => 40, "CF" => 41, +"CG" => 42, "CH" => 43, "CI" => 44, "CK" => 45, "CL" => 46, "CM" => 47, +"CN" => 48, "CO" => 49, "CR" => 50, "CU" => 51, "CV" => 52, "CX" => 53, +"CY" => 54, "CZ" => 55, "DE" => 56, "DJ" => 57, "DK" => 58, "DM" => 59, +"DO" => 60, "DZ" => 61, "EC" => 62, "EE" => 63, "EG" => 64, "EH" => 65, +"ER" => 66, "ES" => 67, "ET" => 68, "FI" => 69, "FJ" => 70, "FK" => 71, +"FM" => 72, "FO" => 73, "FR" => 74, "SX" => 75, "GA" => 76, "GB" => 77, +"GD" => 78, "GE" => 79, "GF" => 80, "GH" => 81, "GI" => 82, "GL" => 83, +"GM" => 84, "GN" => 85, "GP" => 86, "GQ" => 87, "GR" => 88, "GS" => 89, +"GT" => 90, "GU" => 91, "GW" => 92, "GY" => 93, "HK" => 94, "HM" => 95, +"HN" => 96, "HR" => 97, "HT" => 98, "HU" => 99, "ID" => 100, "IE" => 101, +"IL" => 102, "IN" => 103, "IO" => 104, "IQ" => 105, "IR" => 106, "IS" => 107, +"IT" => 108, "JM" => 109, "JO" => 110, "JP" => 111, "KE" => 112, "KG" => 113, +"KH" => 114, "KI" => 115, "KM" => 116, "KN" => 117, "KP" => 118, "KR" => 119, +"KW" => 120, "KY" => 121, "KZ" => 122, "LA" => 123, "LB" => 124, "LC" => 125, +"LI" => 126, "LK" => 127, "LR" => 128, "LS" => 129, "LT" => 130, "LU" => 131, +"LV" => 132, "LY" => 133, "MA" => 134, "MC" => 135, "MD" => 136, "MG" => 137, +"MH" => 138, "MK" => 139, "ML" => 140, "MM" => 141, "MN" => 142, "MO" => 143, +"MP" => 144, "MQ" => 145, "MR" => 146, "MS" => 147, "MT" => 148, "MU" => 149, "MV" => 150, "MW" => 151, "MX" => 152, "MY" => 153, "MZ" => 154, "NA" => 155, -"NC" => 156, "NE" => 157, "NF" => 158, "NG" => 159, "NI" => 160, "NL" => 161, -"NO" => 162, "NP" => 163, "NR" => 164, "NU" => 165, "NZ" => 166, "OM" => 167, -"PA" => 168, "PE" => 169, "PF" => 170, "PG" => 171, "PH" => 172, "PK" => 173, -"PL" => 174, "PM" => 175, "PN" => 176, "PR" => 177, "PS" => 178, "PT" => 179, -"PW" => 180, "PY" => 181, "QA" => 182, "RE" => 183, "RO" => 184, "RU" => 185, -"RW" => 186, "SA" => 187, "SB" => 188, "SC" => 189, "SD" => 190, "SE" => 191, -"SG" => 192, "SH" => 193, "SI" => 194, "SJ" => 195, "SK" => 196, "SL" => 197, -"SM" => 198, "SN" => 199, "SO" => 200, "SR" => 201, "ST" => 202, "SV" => 203, -"SY" => 204, "SZ" => 205, "TC" => 206, "TD" => 207, "TF" => 208, "TG" => 209, -"TH" => 210, "TJ" => 211, "TK" => 212, "TM" => 213, "TN" => 214, "TO" => 215, -"TL" => 216, "TR" => 217, "TT" => 218, "TV" => 219, "TW" => 220, "TZ" => 221, -"UA" => 222, "UG" => 223, "UM" => 224, "US" => 225, "UY" => 226, "UZ" => 227, +"NC" => 156, "NE" => 157, "NF" => 158, "NG" => 159, "NI" => 160, "NL" => 161, +"NO" => 162, "NP" => 163, "NR" => 164, "NU" => 165, "NZ" => 166, "OM" => 167, +"PA" => 168, "PE" => 169, "PF" => 170, "PG" => 171, "PH" => 172, "PK" => 173, +"PL" => 174, "PM" => 175, "PN" => 176, "PR" => 177, "PS" => 178, "PT" => 179, +"PW" => 180, "PY" => 181, "QA" => 182, "RE" => 183, "RO" => 184, "RU" => 185, +"RW" => 186, "SA" => 187, "SB" => 188, "SC" => 189, "SD" => 190, "SE" => 191, +"SG" => 192, "SH" => 193, "SI" => 194, "SJ" => 195, "SK" => 196, "SL" => 197, +"SM" => 198, "SN" => 199, "SO" => 200, "SR" => 201, "ST" => 202, "SV" => 203, +"SY" => 204, "SZ" => 205, "TC" => 206, "TD" => 207, "TF" => 208, "TG" => 209, +"TH" => 210, "TJ" => 211, "TK" => 212, "TM" => 213, "TN" => 214, "TO" => 215, +"TL" => 216, "TR" => 217, "TT" => 218, "TV" => 219, "TW" => 220, "TZ" => 221, +"UA" => 222, "UG" => 223, "UM" => 224, "US" => 225, "UY" => 226, "UZ" => 227, "VA" => 228, "VC" => 229, "VE" => 230, "VG" => 231, "VI" => 232, "VN" => 233, -"VU" => 234, "WF" => 235, "WS" => 236, "YE" => 237, "YT" => 238, "RS" => 239, -"ZA" => 240, "ZM" => 241, "ME" => 242, "ZW" => 243, "A1" => 244, "A2" => 245, +"VU" => 234, "WF" => 235, "WS" => 236, "YE" => 237, "YT" => 238, "RS" => 239, +"ZA" => 240, "ZM" => 241, "ME" => 242, "ZW" => 243, "A1" => 244, "A2" => 245, "O1" => 246, "AX" => 247, "GG" => 248, "IM" => 249, "JE" => 250, "BL" => 251, -"MF" => 252 +"MF" => 252, "BQ" => 253, ); var $GEOIP_COUNTRY_CODES = array( -"", "AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", -"AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", -"BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", -"CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", -"CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", -"EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "FX", "GA", "GB", -"GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", -"GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", -"IO", "IQ", "IR", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", -"KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", -"LT", "LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN", -"MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", -"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", -"PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", -"QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", -"SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", -"TF", "TG", "TH", "TJ", "TK", "TM", "TN", "TO", "TL", "TR", "TT", "TV", "TW", -"TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", -"VU", "WF", "WS", "YE", "YT", "RS", "ZA", "ZM", "ME", "ZW", "A1", "A2", "O1", -"AX", "GG", "IM", "JE", "BL", "MF" -); + "","AP","EU","AD","AE","AF","AG","AI","AL","AM","CW", + "AO","AQ","AR","AS","AT","AU","AW","AZ","BA","BB", + "BD","BE","BF","BG","BH","BI","BJ","BM","BN","BO", + "BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD", + "CF","CG","CH","CI","CK","CL","CM","CN","CO","CR", + "CU","CV","CX","CY","CZ","DE","DJ","DK","DM","DO", + "DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ", + "FK","FM","FO","FR","SX","GA","GB","GD","GE","GF", + "GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT", + "GU","GW","GY","HK","HM","HN","HR","HT","HU","ID", + "IE","IL","IN","IO","IQ","IR","IS","IT","JM","JO", + "JP","KE","KG","KH","KI","KM","KN","KP","KR","KW", + "KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT", + "LU","LV","LY","MA","MC","MD","MG","MH","MK","ML", + "MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV", + "MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI", + "NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF", + "PG","PH","PK","PL","PM","PN","PR","PS","PT","PW", + "PY","QA","RE","RO","RU","RW","SA","SB","SC","SD", + "SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO", + "SR","ST","SV","SY","SZ","TC","TD","TF","TG","TH", + "TJ","TK","TM","TN","TO","TL","TR","TT","TV","TW", + "TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE", + "VG","VI","VN","VU","WF","WS","YE","YT","RS","ZA", + "ZM","ME","ZW","A1","A2","O1","AX","GG","IM","JE", + "BL","MF", "BQ"); var $GEOIP_COUNTRY_CODES3 = array( -"","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","ANT","AGO","ATA","ARG", -"ASM","AUT","AUS","ABW","AZE","BIH","BRB","BGD","BEL","BFA","BGR","BHR","BDI", -"BEN","BMU","BRN","BOL","BRA","BHS","BTN","BVT","BWA","BLR","BLZ","CAN","CCK", -"COD","CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI","CUB","CPV", -"CXR","CYP","CZE","DEU","DJI","DNK","DMA","DOM","DZA","ECU","EST","EGY","ESH", -"ERI","ESP","ETH","FIN","FJI","FLK","FSM","FRO","FRA","FX","GAB","GBR","GRD", -"GEO","GUF","GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","SGS","GTM","GUM", -"GNB","GUY","HKG","HMD","HND","HRV","HTI","HUN","IDN","IRL","ISR","IND","IOT", -"IRQ","IRN","ISL","ITA","JAM","JOR","JPN","KEN","KGZ","KHM","KIR","COM","KNA", -"PRK","KOR","KWT","CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", -"LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI","MMR","MNG","MAC", -"MNP","MTQ","MRT","MSR","MLT","MUS","MDV","MWI","MEX","MYS","MOZ","NAM","NCL", -"NER","NFK","NGA","NIC","NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER", -"PYF","PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW","PRY","QAT", -"REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN","SWE","SGP","SHN","SVN","SJM", -"SVK","SLE","SMR","SEN","SOM","SUR","STP","SLV","SYR","SWZ","TCA","TCD","ATF", -"TGO","THA","TJK","TKL","TLS","TKM","TUN","TON","TUR","TTO","TUV","TWN","TZA", -"UKR","UGA","UMI","USA","URY","UZB","VAT","VCT","VEN","VGB","VIR","VNM","VUT", -"WLF","WSM","YEM","MYT","SRB","ZAF","ZMB","MNE","ZWE","A1","A2","O1", -"ALA","GGY","IMN","JEY","BLM","MAF" - ); + "","AP","EU","AND","ARE","AFG","ATG","AIA","ALB","ARM","CUW", + "AGO","ATA","ARG","ASM","AUT","AUS","ABW","AZE","BIH","BRB", + "BGD","BEL","BFA","BGR","BHR","BDI","BEN","BMU","BRN","BOL", + "BRA","BHS","BTN","BVT","BWA","BLR","BLZ","CAN","CCK","COD", + "CAF","COG","CHE","CIV","COK","CHL","CMR","CHN","COL","CRI", + "CUB","CPV","CXR","CYP","CZE","DEU","DJI","DNK","DMA","DOM", + "DZA","ECU","EST","EGY","ESH","ERI","ESP","ETH","FIN","FJI", + "FLK","FSM","FRO","FRA","SXM","GAB","GBR","GRD","GEO","GUF", + "GHA","GIB","GRL","GMB","GIN","GLP","GNQ","GRC","SGS","GTM", + "GUM","GNB","GUY","HKG","HMD","HND","HRV","HTI","HUN","IDN", + "IRL","ISR","IND","IOT","IRQ","IRN","ISL","ITA","JAM","JOR", + "JPN","KEN","KGZ","KHM","KIR","COM","KNA","PRK","KOR","KWT", + "CYM","KAZ","LAO","LBN","LCA","LIE","LKA","LBR","LSO","LTU", + "LUX","LVA","LBY","MAR","MCO","MDA","MDG","MHL","MKD","MLI", + "MMR","MNG","MAC","MNP","MTQ","MRT","MSR","MLT","MUS","MDV", + "MWI","MEX","MYS","MOZ","NAM","NCL","NER","NFK","NGA","NIC", + "NLD","NOR","NPL","NRU","NIU","NZL","OMN","PAN","PER","PYF", + "PNG","PHL","PAK","POL","SPM","PCN","PRI","PSE","PRT","PLW", + "PRY","QAT","REU","ROU","RUS","RWA","SAU","SLB","SYC","SDN", + "SWE","SGP","SHN","SVN","SJM","SVK","SLE","SMR","SEN","SOM", + "SUR","STP","SLV","SYR","SWZ","TCA","TCD","ATF","TGO","THA", + "TJK","TKL","TKM","TUN","TON","TLS","TUR","TTO","TUV","TWN", + "TZA","UKR","UGA","UMI","USA","URY","UZB","VAT","VCT","VEN", + "VGB","VIR","VNM","VUT","WLF","WSM","YEM","MYT","SRB","ZAF", + "ZMB","MNE","ZWE","A1","A2","O1","ALA","GGY","IMN","JEY", + "BLM","MAF", "BES" + ); var $GEOIP_COUNTRY_NAMES = array( -"", "Asia/Pacific Region", "Europe", "Andorra", "United Arab Emirates", -"Afghanistan", "Antigua and Barbuda", "Anguilla", "Albania", "Armenia", -"Netherlands Antilles", "Angola", "Antarctica", "Argentina", "American Samoa", -"Austria", "Australia", "Aruba", "Azerbaijan", "Bosnia and Herzegovina", -"Barbados", "Bangladesh", "Belgium", "Burkina Faso", "Bulgaria", "Bahrain", -"Burundi", "Benin", "Bermuda", "Brunei Darussalam", "Bolivia", "Brazil", -"Bahamas", "Bhutan", "Bouvet Island", "Botswana", "Belarus", "Belize", -"Canada", "Cocos (Keeling) Islands", "Congo, The Democratic Republic of the", -"Central African Republic", "Congo", "Switzerland", "Cote D'Ivoire", "Cook Islands", -"Chile", "Cameroon", "China", "Colombia", "Costa Rica", "Cuba", "Cape Verde", -"Christmas Island", "Cyprus", "Czech Republic", "Germany", "Djibouti", -"Denmark", "Dominica", "Dominican Republic", "Algeria", "Ecuador", "Estonia", -"Egypt", "Western Sahara", "Eritrea", "Spain", "Ethiopia", "Finland", "Fiji", -"Falkland Islands (Malvinas)", "Micronesia, Federated States of", "Faroe Islands", -"France", "France, Metropolitan", "Gabon", "United Kingdom", -"Grenada", "Georgia", "French Guiana", "Ghana", "Gibraltar", "Greenland", -"Gambia", "Guinea", "Guadeloupe", "Equatorial Guinea", "Greece", "South Georgia and the South Sandwich Islands", -"Guatemala", "Guam", "Guinea-Bissau", -"Guyana", "Hong Kong", "Heard Island and McDonald Islands", "Honduras", -"Croatia", "Haiti", "Hungary", "Indonesia", "Ireland", "Israel", "India", -"British Indian Ocean Territory", "Iraq", "Iran, Islamic Republic of", -"Iceland", "Italy", "Jamaica", "Jordan", "Japan", "Kenya", "Kyrgyzstan", -"Cambodia", "Kiribati", "Comoros", "Saint Kitts and Nevis", "Korea, Democratic People's Republic of", -"Korea, Republic of", "Kuwait", "Cayman Islands", -"Kazakhstan", "Lao People's Democratic Republic", "Lebanon", "Saint Lucia", -"Liechtenstein", "Sri Lanka", "Liberia", "Lesotho", "Lithuania", "Luxembourg", -"Latvia", "Libyan Arab Jamahiriya", "Morocco", "Monaco", "Moldova, Republic of", -"Madagascar", "Marshall Islands", "Macedonia", -"Mali", "Myanmar", "Mongolia", "Macau", "Northern Mariana Islands", -"Martinique", "Mauritania", "Montserrat", "Malta", "Mauritius", "Maldives", -"Malawi", "Mexico", "Malaysia", "Mozambique", "Namibia", "New Caledonia", -"Niger", "Norfolk Island", "Nigeria", "Nicaragua", "Netherlands", "Norway", -"Nepal", "Nauru", "Niue", "New Zealand", "Oman", "Panama", "Peru", "French Polynesia", -"Papua New Guinea", "Philippines", "Pakistan", "Poland", "Saint Pierre and Miquelon", -"Pitcairn Islands", "Puerto Rico", "Palestinian Territory", -"Portugal", "Palau", "Paraguay", "Qatar", "Reunion", "Romania", -"Russian Federation", "Rwanda", "Saudi Arabia", "Solomon Islands", -"Seychelles", "Sudan", "Sweden", "Singapore", "Saint Helena", "Slovenia", -"Svalbard and Jan Mayen", "Slovakia", "Sierra Leone", "San Marino", "Senegal", -"Somalia", "Suriname", "Sao Tome and Principe", "El Salvador", "Syrian Arab Republic", -"Swaziland", "Turks and Caicos Islands", "Chad", "French Southern Territories", -"Togo", "Thailand", "Tajikistan", "Tokelau", "Turkmenistan", -"Tunisia", "Tonga", "Timor-Leste", "Turkey", "Trinidad and Tobago", "Tuvalu", -"Taiwan", "Tanzania, United Republic of", "Ukraine", -"Uganda", "United States Minor Outlying Islands", "United States", "Uruguay", -"Uzbekistan", "Holy See (Vatican City State)", "Saint Vincent and the Grenadines", -"Venezuela", "Virgin Islands, British", "Virgin Islands, U.S.", -"Vietnam", "Vanuatu", "Wallis and Futuna", "Samoa", "Yemen", "Mayotte", -"Serbia", "South Africa", "Zambia", "Montenegro", "Zimbabwe", -"Anonymous Proxy","Satellite Provider","Other", -"Aland Islands","Guernsey","Isle of Man","Jersey","Saint Barthelemy","Saint Martin" + "","Asia/Pacific Region","Europe","Andorra","United Arab Emirates","Afghanistan","Antigua and Barbuda","Anguilla","Albania","Armenia","Curacao", + "Angola","Antarctica","Argentina","American Samoa","Austria","Australia","Aruba","Azerbaijan","Bosnia and Herzegovina","Barbados", + "Bangladesh","Belgium","Burkina Faso","Bulgaria","Bahrain","Burundi","Benin","Bermuda","Brunei Darussalam","Bolivia", + "Brazil","Bahamas","Bhutan","Bouvet Island","Botswana","Belarus","Belize","Canada","Cocos (Keeling) Islands","Congo, The Democratic Republic of the", + "Central African Republic","Congo","Switzerland","Cote D'Ivoire","Cook Islands","Chile","Cameroon","China","Colombia","Costa Rica", + "Cuba","Cape Verde","Christmas Island","Cyprus","Czech Republic","Germany","Djibouti","Denmark","Dominica","Dominican Republic", + "Algeria","Ecuador","Estonia","Egypt","Western Sahara","Eritrea","Spain","Ethiopia","Finland","Fiji", + "Falkland Islands (Malvinas)","Micronesia, Federated States of","Faroe Islands","France","Sint Maarten (Dutch part)","Gabon","United Kingdom","Grenada","Georgia","French Guiana", + "Ghana","Gibraltar","Greenland","Gambia","Guinea","Guadeloupe","Equatorial Guinea","Greece","South Georgia and the South Sandwich Islands","Guatemala", + "Guam","Guinea-Bissau","Guyana","Hong Kong","Heard Island and McDonald Islands","Honduras","Croatia","Haiti","Hungary","Indonesia", + "Ireland","Israel","India","British Indian Ocean Territory","Iraq","Iran, Islamic Republic of","Iceland","Italy","Jamaica","Jordan", + "Japan","Kenya","Kyrgyzstan","Cambodia","Kiribati","Comoros","Saint Kitts and Nevis","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait", + "Cayman Islands","Kazakhstan","Lao People's Democratic Republic","Lebanon","Saint Lucia","Liechtenstein","Sri Lanka","Liberia","Lesotho","Lithuania", + "Luxembourg","Latvia","Libya","Morocco","Monaco","Moldova, Republic of","Madagascar","Marshall Islands","Macedonia","Mali", + "Myanmar","Mongolia","Macau","Northern Mariana Islands","Martinique","Mauritania","Montserrat","Malta","Mauritius","Maldives", + "Malawi","Mexico","Malaysia","Mozambique","Namibia","New Caledonia","Niger","Norfolk Island","Nigeria","Nicaragua", + "Netherlands","Norway","Nepal","Nauru","Niue","New Zealand","Oman","Panama","Peru","French Polynesia", + "Papua New Guinea","Philippines","Pakistan","Poland","Saint Pierre and Miquelon","Pitcairn Islands","Puerto Rico","Palestinian Territory","Portugal","Palau", + "Paraguay","Qatar","Reunion","Romania","Russian Federation","Rwanda","Saudi Arabia","Solomon Islands","Seychelles","Sudan", + "Sweden","Singapore","Saint Helena","Slovenia","Svalbard and Jan Mayen","Slovakia","Sierra Leone","San Marino","Senegal","Somalia","Suriname", + "Sao Tome and Principe","El Salvador","Syrian Arab Republic","Swaziland","Turks and Caicos Islands","Chad","French Southern Territories","Togo","Thailand", + "Tajikistan","Tokelau","Turkmenistan","Tunisia","Tonga","Timor-Leste","Turkey","Trinidad and Tobago","Tuvalu","Taiwan", + "Tanzania, United Republic of","Ukraine","Uganda","United States Minor Outlying Islands","United States","Uruguay","Uzbekistan","Holy See (Vatican City State)","Saint Vincent and the Grenadines","Venezuela", + "Virgin Islands, British","Virgin Islands, U.S.","Vietnam","Vanuatu","Wallis and Futuna","Samoa","Yemen","Mayotte","Serbia","South Africa", + "Zambia","Montenegro","Zimbabwe","Anonymous Proxy","Satellite Provider","Other","Aland Islands","Guernsey","Isle of Man","Jersey", + "Saint Barthelemy","Saint Martin", "Bonaire, Saint Eustatius and Saba" ); var $GEOIP_CONTINENT_CODES = array( - "--", "AS", "EU", "EU", "AS", "AS", "NA", "NA", "EU", "AS", - "NA", "AF", "AN", "SA", "OC", "EU", "OC", "NA", "AS", "EU", - "NA", "AS", "EU", "AF", "EU", "AS", "AF", "AF", "NA", "AS", - "SA", "SA", "NA", "AS", "AN", "AF", "EU", "NA", "NA", "AS", - "AF", "AF", "AF", "EU", "AF", "OC", "SA", "AF", "AS", "SA", - "NA", "NA", "AF", "AS", "AS", "EU", "EU", "AF", "EU", "NA", - "NA", "AF", "SA", "EU", "AF", "AF", "AF", "EU", "AF", "EU", - "OC", "SA", "OC", "EU", "EU", "EU", "AF", "EU", "NA", "AS", - "SA", "AF", "EU", "NA", "AF", "AF", "NA", "AF", "EU", "AN", - "NA", "OC", "AF", "SA", "AS", "AN", "NA", "EU", "NA", "EU", - "AS", "EU", "AS", "AS", "AS", "AS", "AS", "EU", "EU", "NA", - "AS", "AS", "AF", "AS", "AS", "OC", "AF", "NA", "AS", "AS", - "AS", "NA", "AS", "AS", "AS", "NA", "EU", "AS", "AF", "AF", - "EU", "EU", "EU", "AF", "AF", "EU", "EU", "AF", "OC", "EU", - "AF", "AS", "AS", "AS", "OC", "NA", "AF", "NA", "EU", "AF", - "AS", "AF", "NA", "AS", "AF", "AF", "OC", "AF", "OC", "AF", - "NA", "EU", "EU", "AS", "OC", "OC", "OC", "AS", "NA", "SA", - "OC", "OC", "AS", "AS", "EU", "NA", "OC", "NA", "AS", "EU", - "OC", "SA", "AS", "AF", "EU", "EU", "AF", "AS", "OC", "AF", - "AF", "EU", "AS", "AF", "EU", "EU", "EU", "AF", "EU", "AF", - "AF", "SA", "AF", "NA", "AS", "AF", "NA", "AF", "AN", "AF", - "AS", "AS", "OC", "AS", "AF", "OC", "AS", "EU", "NA", "OC", - "AS", "AF", "EU", "AF", "OC", "NA", "SA", "AS", "EU", "NA", - "SA", "NA", "NA", "AS", "OC", "OC", "OC", "AS", "AF", "EU", - "AF", "AF", "EU", "AF", "--", "--", "--", "EU", "EU", "EU", - "EU", "NA", "NA" + "--", "AS","EU","EU","AS","AS","NA","NA","EU","AS","NA", + "AF","AN","SA","OC","EU","OC","NA","AS","EU","NA", + "AS","EU","AF","EU","AS","AF","AF","NA","AS","SA", + "SA","NA","AS","AN","AF","EU","NA","NA","AS","AF", + "AF","AF","EU","AF","OC","SA","AF","AS","SA","NA", + "NA","AF","AS","AS","EU","EU","AF","EU","NA","NA", + "AF","SA","EU","AF","AF","AF","EU","AF","EU","OC", + "SA","OC","EU","EU","NA","AF","EU","NA","AS","SA", + "AF","EU","NA","AF","AF","NA","AF","EU","AN","NA", + "OC","AF","SA","AS","AN","NA","EU","NA","EU","AS", + "EU","AS","AS","AS","AS","AS","EU","EU","NA","AS", + "AS","AF","AS","AS","OC","AF","NA","AS","AS","AS", + "NA","AS","AS","AS","NA","EU","AS","AF","AF","EU", + "EU","EU","AF","AF","EU","EU","AF","OC","EU","AF", + "AS","AS","AS","OC","NA","AF","NA","EU","AF","AS", + "AF","NA","AS","AF","AF","OC","AF","OC","AF","NA", + "EU","EU","AS","OC","OC","OC","AS","NA","SA","OC", + "OC","AS","AS","EU","NA","OC","NA","AS","EU","OC", + "SA","AS","AF","EU","EU","AF","AS","OC","AF","AF", + "EU","AS","AF","EU","EU","EU","AF","EU","AF","AF", + "SA","AF","NA","AS","AF","NA","AF","AN","AF","AS", + "AS","OC","AS","AF","OC","AS","EU","NA","OC","AS", + "AF","EU","AF","OC","NA","SA","AS","EU","NA","SA", + "NA","NA","AS","OC","OC","OC","AS","AF","EU","AF", + "AF","EU","AF","--","--","--","EU","EU","EU","EU", + "NA","NA","NA" ); } -if (!function_exists('geoip_load_shared_mem')) -{ - function geoip_load_shared_mem ($file) { - $fp = fopen($file, "rb"); - if (!$fp) { - print "error opening $file: $php_errormsg\n"; - exit; - } - $s_array = fstat($fp); - $size = $s_array['size']; - if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { - shmop_delete ($shmid); - shmop_close ($shmid); - } - $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); - shmop_write ($shmid, fread($fp, $size), 0); - shmop_close ($shmid); - } +if (!function_exists('geoip_load_shared_mem ')){ +function geoip_load_shared_mem ($file) { + + $fp = fopen($file, "rb"); + if (!$fp) { + print "error opening $file: $php_errormsg\n"; + exit; + } + $s_array = fstat($fp); + $size = $s_array['size']; + if ($shmid = @shmop_open (GEOIP_SHM_KEY, "w", 0, 0)) { + shmop_delete ($shmid); + shmop_close ($shmid); + } + $shmid = shmop_open (GEOIP_SHM_KEY, "c", 0644, $size); + shmop_write ($shmid, fread($fp, $size), 0); + shmop_close ($shmid); } -if (!function_exists('_setup_segments')) -{ - function _setup_segments($gi){ - $gi->databaseType = GEOIP_COUNTRY_EDITION; - $gi->record_length = STANDARD_RECORD_LENGTH; - if ($gi->flags & GEOIP_SHARED_MEMORY) { - $offset = @shmop_size ($gi->shmid) - 3; - for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { - $delim = @shmop_read ($gi->shmid, $offset, 3); - $offset += 3; - if ($delim == (chr(255).chr(255).chr(255))) { - $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); - $offset++; - - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ - $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ - $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| - ($gi->databaseType == GEOIP_CITY_EDITION_REV1) - || ($gi->databaseType == GEOIP_ORG_EDITION) - || ($gi->databaseType == GEOIP_DOMAIN_EDITION) - || ($gi->databaseType == GEOIP_ISP_EDITION) - || ($gi->databaseType == GEOIP_LOCATIONA_EDITION) - || ($gi->databaseType == GEOIP_ACCURACYRADIUS_EDITION) - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ - $gi->databaseSegments = 0; - $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ - $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); - } - if (($gi->databaseType == GEOIP_ORG_EDITION) - || ($gi->databaseType == GEOIP_DOMAIN_EDITION) - || ($gi->databaseType == GEOIP_ISP_EDITION)) { - $gi->record_length = ORG_RECORD_LENGTH; - } - } - break; - } else { - $offset -= 4; - } - } - if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| - ($gi->databaseType == GEOIP_PROXY_EDITION)|| - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ - $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; - } - } else { - $filepos = ftell($gi->filehandle); - fseek($gi->filehandle, -3, SEEK_END); - for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { - $delim = fread($gi->filehandle,3); - if ($delim == (chr(255).chr(255).chr(255))){ - $gi->databaseType = ord(fread($gi->filehandle,1)); - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ - $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; - } - else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ - $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) - || ($gi->databaseType == GEOIP_CITY_EDITION_REV1) - || ($gi->databaseType == GEOIP_ORG_EDITION) - || ($gi->databaseType == GEOIP_DOMAIN_EDITION) - || ($gi->databaseType == GEOIP_ISP_EDITION) - || ($gi->databaseType == GEOIP_LOCATIONA_EDITION) - || ($gi->databaseType == GEOIP_ACCURACYRADIUS_EDITION) - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ - $gi->databaseSegments = 0; - $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ - $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); - } - if ( ( $gi->databaseType == GEOIP_ORG_EDITION ) - || ( $gi->databaseType == GEOIP_DOMAIN_EDITION ) - || ( $gi->databaseType == GEOIP_ISP_EDITION ) ) { - $gi->record_length = ORG_RECORD_LENGTH; - } - } - break; - } else { - fseek($gi->filehandle, -4, SEEK_CUR); - } - } - if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| - ($gi->databaseType == GEOIP_PROXY_EDITION)|| - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ - $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; - } - fseek($gi->filehandle,$filepos,SEEK_SET); - } - return $gi; - } } -if (!function_exists('geoip_open')) -{ - function geoip_open($filename, $flags) { - $gi = new GeoIP; - $gi->flags = $flags; - if ($gi->flags & GEOIP_SHARED_MEMORY) { - $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); - } else { - $gi->filehandle = fopen($filename,"rb") or die( "Can not open $filename\n" ); - if ($gi->flags & GEOIP_MEMORY_CACHE) { - $s_array = fstat($gi->filehandle); - $gi->memory_buffer = fread($gi->filehandle, $s_array['size']); - } - } +if (!function_exists('_setup_segments')){ +function _setup_segments($gi){ + $gi->databaseType = GEOIP_COUNTRY_EDITION; + $gi->record_length = STANDARD_RECORD_LENGTH; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $offset = @shmop_size ($gi->shmid) - 3; + for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { + $delim = @shmop_read ($gi->shmid, $offset, 3); + $offset += 3; + if ($delim == (chr(255).chr(255).chr(255))) { + $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); + $offset++; - $gi = _setup_segments($gi); - return $gi; - } + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| + ($gi->databaseType == GEOIP_CITY_EDITION_REV1) + || ($gi->databaseType == GEOIP_ORG_EDITION) + || ($gi->databaseType == GEOIP_ORG_EDITION_V6) + || ($gi->databaseType == GEOIP_DOMAIN_EDITION) + || ($gi->databaseType == GEOIP_DOMAIN_EDITION_V6) + || ($gi->databaseType == GEOIP_ISP_EDITION) + || ($gi->databaseType == GEOIP_ISP_EDITION_V6) + || ($gi->databaseType == GEOIP_USERTYPE_EDITION) + || ($gi->databaseType == GEOIP_USERTYPE_EDITION_V6) + || ($gi->databaseType == GEOIP_LOCATIONA_EDITION) + || ($gi->databaseType == GEOIP_ACCURACYRADIUS_EDITION) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV0_V6) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV1_V6) + || ($gi->databaseType == GEOIP_NETSPEED_EDITION_REV1) + || ($gi->databaseType == GEOIP_NETSPEED_EDITION_REV1_V6) + || ($gi->databaseType == GEOIP_ASNUM_EDITION) + || ($gi->databaseType == GEOIP_ASNUM_EDITION_V6)){ + $gi->databaseSegments = 0; + $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ + $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); + } + if (($gi->databaseType == GEOIP_ORG_EDITION) + || ($gi->databaseType == GEOIP_ORG_EDITION_V6) + || ($gi->databaseType == GEOIP_DOMAIN_EDITION) + || ($gi->databaseType == GEOIP_DOMAIN_EDITION_V6) + || ($gi->databaseType == GEOIP_ISP_EDITION) + || ($gi->databaseType == GEOIP_ISP_EDITION_V6)) { + $gi->record_length = ORG_RECORD_LENGTH; + } + } + break; + } else { + $offset -= 4; + } + } + if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| + ($gi->databaseType == GEOIP_COUNTRY_EDITION_V6)|| + ($gi->databaseType == GEOIP_PROXY_EDITION)|| + ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; + } + } else { + $filepos = ftell($gi->filehandle); + fseek($gi->filehandle, -3, SEEK_END); + for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { + $delim = fread($gi->filehandle,3); + if ($delim == (chr(255).chr(255).chr(255))){ + $gi->databaseType = ord(fread($gi->filehandle,1)); + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; + } + else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ + $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV1) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV0_V6) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV1_V6) + || ($gi->databaseType == GEOIP_ORG_EDITION) + || ($gi->databaseType == GEOIP_DOMAIN_EDITION) + || ($gi->databaseType == GEOIP_ISP_EDITION) + || ($gi->databaseType == GEOIP_ORG_EDITION_V6) + || ($gi->databaseType == GEOIP_DOMAIN_EDITION_V6) + || ($gi->databaseType == GEOIP_ISP_EDITION_V6) + || ($gi->databaseType == GEOIP_LOCATIONA_EDITION) + || ($gi->databaseType == GEOIP_ACCURACYRADIUS_EDITION) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV0_V6) + || ($gi->databaseType == GEOIP_CITY_EDITION_REV1_V6) + || ($gi->databaseType == GEOIP_NETSPEED_EDITION_REV1) + || ($gi->databaseType == GEOIP_NETSPEED_EDITION_REV1_V6) + || ($gi->databaseType == GEOIP_USERTYPE_EDITION) + || ($gi->databaseType == GEOIP_USERTYPE_EDITION_V6) + || ($gi->databaseType == GEOIP_ASNUM_EDITION) + || ($gi->databaseType == GEOIP_ASNUM_EDITION_V6)){ + $gi->databaseSegments = 0; + $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ + $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); + } + if ( ( $gi->databaseType == GEOIP_ORG_EDITION ) + || ( $gi->databaseType == GEOIP_DOMAIN_EDITION ) + || ( $gi->databaseType == GEOIP_ISP_EDITION ) + || ( $gi->databaseType == GEOIP_ORG_EDITION_V6 ) + || ( $gi->databaseType == GEOIP_DOMAIN_EDITION_V6 ) + || ( $gi->databaseType == GEOIP_ISP_EDITION_V6 )) { + $gi->record_length = ORG_RECORD_LENGTH; + } + } + break; + } else { + fseek($gi->filehandle, -4, SEEK_CUR); + } + } + if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| + ($gi->databaseType == GEOIP_COUNTRY_EDITION_V6)|| + ($gi->databaseType == GEOIP_PROXY_EDITION)|| + ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ + $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; + } + fseek($gi->filehandle,$filepos,SEEK_SET); + } + return $gi; } -if (!function_exists('geoip_close')) -{ - function geoip_close($gi) { - if ($gi->flags & GEOIP_SHARED_MEMORY) { - return true; - } - - return fclose($gi->filehandle); - } -} -if (!function_exists('geoip_country_id_by_name')) -{ - function geoip_country_id_by_name($gi, $name) { - $addr = gethostbyname($name); - if (!$addr || $addr == $name) { - return false; - } - return geoip_country_id_by_addr($gi, $addr); - } -} -if (!function_exists('geoip_country_code_by_name')) -{ - function geoip_country_code_by_name($gi, $name) { - $country_id = geoip_country_id_by_name($gi,$name); - if ($country_id !== false) { - return $gi->GEOIP_COUNTRY_CODES[$country_id]; - } - return false; - } } -if (!function_exists('geoip_country_name_by_name')) -{ - function geoip_country_name_by_name($gi, $name) { - $country_id = geoip_country_id_by_name($gi,$name); - if ($country_id !== false) { - return $gi->GEOIP_COUNTRY_NAMES[$country_id]; - } - return false; - } +if (!function_exists('geoip_open')){ +function geoip_open($filename, $flags) { + $gi = new GeoIP; + $gi->flags = $flags; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0); + } else { + $gi->filehandle = fopen($filename,"rb") or die( "Can not open $filename\n" ); + if ($gi->flags & GEOIP_MEMORY_CACHE) { + $s_array = fstat($gi->filehandle); + $gi->memory_buffer = fread($gi->filehandle, $s_array['size']); + } + } + + $gi = _setup_segments($gi); + return $gi; } -if (!function_exists('geoip_country_id_by_addr')) -{ - function geoip_country_id_by_addr($gi, $addr) { - $ipnum = ip2long($addr); - return _geoip_seek_country($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; - } } -if (!function_exists('geoip_country_code_by_addr')) -{ - function geoip_country_code_by_addr($gi, $addr) { - if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { - $record = geoip_record_by_addr($gi,$addr); - if ( $record !== false ) { - return $record->country_code; - } - } else { - $country_id = geoip_country_id_by_addr($gi,$addr); - if ($country_id !== false) { - return $gi->GEOIP_COUNTRY_CODES[$country_id]; - } - } - return false; - } -} -if (!function_exists('geoip_country_name_by_addr')) -{ - function geoip_country_name_by_addr($gi, $addr) { - if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { - $record = geoip_record_by_addr($gi,$addr); - return $record->country_name; - } else { - $country_id = geoip_country_id_by_addr($gi,$addr); - if ($country_id !== false) { - return $gi->GEOIP_COUNTRY_NAMES[$country_id]; - } - } - return false; - } -} -if (!function_exists('_geoip_seek_country')) -{ - function _geoip_seek_country($gi, $ipnum) { - $offset = 0; - for ($depth = 31; $depth >= 0; --$depth) { - if ($gi->flags & GEOIP_MEMORY_CACHE) { - // workaround php's broken substr, strpos, etc handling with - // mbstring.func_overload and mbstring.internal_encoding - $enc = mb_internal_encoding(); - mb_internal_encoding('ISO-8859-1'); +if (!function_exists('geoip_close')){ +function geoip_close($gi) { + if ($gi->flags & GEOIP_SHARED_MEMORY) { + return true; + } - $buf = substr($gi->memory_buffer, - 2 * $gi->record_length * $offset, - 2 * $gi->record_length); - - mb_internal_encoding($enc); - } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { - $buf = @shmop_read ($gi->shmid, - 2 * $gi->record_length * $offset, - 2 * $gi->record_length ); - } else { - fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 - or die("fseek failed"); - $buf = fread($gi->filehandle, 2 * $gi->record_length); - } - $x = array(0,0); - for ($i = 0; $i < 2; ++$i) { - for ($j = 0; $j < $gi->record_length; ++$j) { - $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); - } - } - if ($ipnum & (1 << $depth)) { - if ($x[1] >= $gi->databaseSegments) { - return $x[1]; - } - $offset = $x[1]; - } else { - if ($x[0] >= $gi->databaseSegments) { - return $x[0]; - } - $offset = $x[0]; - } - } - trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); - return false; - } + return fclose($gi->filehandle); } -if (!function_exists('_get_org')) -{ - function _get_org($gi,$ipnum){ - $seek_org = _geoip_seek_country($gi,$ipnum); - if ($seek_org == $gi->databaseSegments) { - return NULL; - } - $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; - if ($gi->flags & GEOIP_SHARED_MEMORY) { - $org_buf = @shmop_read ($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); - } else { - fseek($gi->filehandle, $record_pointer, SEEK_SET); - $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); - } - // workaround php's broken substr, strpos, etc handling with - // mbstring.func_overload and mbstring.internal_encoding - $enc = mb_internal_encoding(); - mb_internal_encoding('ISO-8859-1'); - $org_buf = substr($org_buf, 0, strpos($org_buf, "\0")); - mb_internal_encoding($enc); - return $org_buf; - } } -if (!function_exists('geoip_org_by_addr')) -{ - function geoip_org_by_addr ($gi,$addr) { - if ($addr == NULL) { - return 0; - } - $ipnum = ip2long($addr); - return _get_org($gi, $ipnum); - } +if (!function_exists('geoip_country_id_by_name_v6')){ +function geoip_country_id_by_name_v6($gi, $name) { + $rec = dns_get_record($name, DNS_AAAA); + if ( !$rec ) { + return false; + } + $addr = $rec[0]["ipv6"]; + if (!$addr || $addr == $name) { + return false; + } + return geoip_country_id_by_addr_v6($gi, $addr); +} } -if (!function_exists('_get_region')) -{ - function _get_region($gi,$ipnum){ - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ - $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; - if ($seek_region >= 1000){ - $country_code = "US"; - $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); - } else { - $country_code = $gi->GEOIP_COUNTRY_CODES[$seek_region]; - $region = ""; - } - return array ($country_code,$region); - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { - $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; - //print $seek_region; - if ($seek_region < US_OFFSET){ - $country_code = ""; - $region = ""; - } else if ($seek_region < CANADA_OFFSET) { - $country_code = "US"; - $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); - } else if ($seek_region < WORLD_OFFSET) { - $country_code = "CA"; - $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); - } else { - $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; - $region = ""; - } - return array ($country_code,$region); - } - } +if (!function_exists('geoip_country_id_by_name')){ +function geoip_country_id_by_name($gi, $name) { + $addr = gethostbyname($name); + if (!$addr || $addr == $name) { + return false; + } + return geoip_country_id_by_addr($gi, $addr); +} } -if (!function_exists('geoip_region_by_addr')) -{ - function geoip_region_by_addr ($gi,$addr) { - if ($addr == NULL) { - return 0; - } - $ipnum = ip2long($addr); - return _get_region($gi, $ipnum); - } +if (!function_exists('geoip_country_code_by_name_v6')){ +function geoip_country_code_by_name_v6($gi, $name) { + $country_id = geoip_country_id_by_name_v6($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + return false; +} } -if (!function_exists('getdnsattributes')) -{ - function getdnsattributes ($l,$ip){ - $r = new Net_DNS_Resolver(); - $r->nameservers = array("ws1.maxmind.com"); - $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); - $str = is_object($p->answer[0])?$p->answer[0]->string():''; - ereg("\"(.*)\"",$str,$regs); - $str = $regs[1]; - return $str; - } +if (!function_exists('geoip_country_code_by_name')){ +function geoip_country_code_by_name($gi, $name) { + $country_id = geoip_country_id_by_name($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + return false; } +} + +if (!function_exists('geoip_country_name_by_name_v6')){ +function geoip_country_name_by_name_v6($gi, $name) { + $country_id = geoip_country_id_by_name_v6($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + return false; +} +} + +if (!function_exists('geoip_country_name_by_name')){ +function geoip_country_name_by_name($gi, $name) { + $country_id = geoip_country_id_by_name($gi,$name); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + return false; +} +} + +if (!function_exists('geoip_country_id_by_addr_v6')){ +function geoip_country_id_by_addr_v6($gi, $addr) { + $ipnum = inet_pton($addr); + return _geoip_seek_country_v6($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; +} +} + +if (!function_exists('geoip_country_id_by_addr')){ +function geoip_country_id_by_addr($gi, $addr) { + $ipnum = ip2long($addr); + return _geoip_seek_country($gi, $ipnum) - GEOIP_COUNTRY_BEGIN; +} +} + +if (!function_exists('geoip_country_code_by_addr_v6')){ +function geoip_country_code_by_addr_v6($gi, $addr) { + $country_id = geoip_country_id_by_addr_v6($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + return false; +} +} + +if (!function_exists('geoip_country_code_by_addr')){ +function geoip_country_code_by_addr($gi, $addr) { + if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { + $record = geoip_record_by_addr($gi,$addr); + if ( $record !== false ) { + return $record->country_code; + } + } else { + $country_id = geoip_country_id_by_addr($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_CODES[$country_id]; + } + } + return false; +} +} + +if (!function_exists('geoip_country_name_by_addr_v6')){ +function geoip_country_name_by_addr_v6($gi, $addr) { + $country_id = geoip_country_id_by_addr_v6($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + return false; +} +} + +if (!function_exists('geoip_country_name_by_addr')){ +function geoip_country_name_by_addr($gi, $addr) { + if ($gi->databaseType == GEOIP_CITY_EDITION_REV1) { + $record = geoip_record_by_addr($gi,$addr); + return $record->country_name; + } else { + $country_id = geoip_country_id_by_addr($gi,$addr); + if ($country_id !== false) { + return $gi->GEOIP_COUNTRY_NAMES[$country_id]; + } + } + return false; +} +} + +if (!function_exists('_geoip_seek_country_v6')){ +function _geoip_seek_country_v6($gi, $ipnum) { + + # arrays from unpack start with offset 1 + # yet another php mystery. array_merge work around + # this broken behaviour + $v6vec = array_merge(unpack( "C16", $ipnum)); + + $offset = 0; + for ($depth = 127; $depth >= 0; --$depth) { + if ($gi->flags & GEOIP_MEMORY_CACHE) { + // workaround php's broken substr, strpos, etc handling with + // mbstring.func_overload and mbstring.internal_encoding + $enc = mb_internal_encoding(); + mb_internal_encoding('ISO-8859-1'); + + $buf = substr($gi->memory_buffer, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length); + + mb_internal_encoding($enc); + } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { + $buf = @shmop_read ($gi->shmid, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length ); + } else { + fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 + or die("fseek failed"); + $buf = fread($gi->filehandle, 2 * $gi->record_length); + } + $x = array(0,0); + for ($i = 0; $i < 2; ++$i) { + for ($j = 0; $j < $gi->record_length; ++$j) { + $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); + } + } + + $bnum = 127 - $depth; + $idx = $bnum >> 3; + $b_mask = 1 << ( $bnum & 7 ^ 7 ); + if (($v6vec[$idx] & $b_mask) > 0) { + if ($x[1] >= $gi->databaseSegments) { + return $x[1]; + } + $offset = $x[1]; + } else { + if ($x[0] >= $gi->databaseSegments) { + return $x[0]; + } + $offset = $x[0]; + } + } + trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); + return false; +} +} + +if (!function_exists('_geoip_seek_country')){ +function _geoip_seek_country($gi, $ipnum) { + $offset = 0; + for ($depth = 31; $depth >= 0; --$depth) { + if ($gi->flags & GEOIP_MEMORY_CACHE) { + // workaround php's broken substr, strpos, etc handling with + // mbstring.func_overload and mbstring.internal_encoding + $enc = mb_internal_encoding(); + mb_internal_encoding('ISO-8859-1'); + + $buf = substr($gi->memory_buffer, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length); + + mb_internal_encoding($enc); + } elseif ($gi->flags & GEOIP_SHARED_MEMORY) { + $buf = @shmop_read ($gi->shmid, + 2 * $gi->record_length * $offset, + 2 * $gi->record_length ); + } else { + fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0 + or die("fseek failed"); + $buf = fread($gi->filehandle, 2 * $gi->record_length); + } + $x = array(0,0); + for ($i = 0; $i < 2; ++$i) { + for ($j = 0; $j < $gi->record_length; ++$j) { + $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8); + } + } + if ($ipnum & (1 << $depth)) { + if ($x[1] >= $gi->databaseSegments) { + return $x[1]; + } + $offset = $x[1]; + } else { + if ($x[0] >= $gi->databaseSegments) { + return $x[0]; + } + $offset = $x[0]; + } + } + trigger_error("error traversing database - perhaps it is corrupt?", E_USER_ERROR); + return false; +} +} + +if (!function_exists('_common_get_org')){ +function _common_get_org($gi, $seek_org){ + $record_pointer = $seek_org + (2 * $gi->record_length - 1) * $gi->databaseSegments; + if ($gi->flags & GEOIP_SHARED_MEMORY) { + $org_buf = @shmop_read ($gi->shmid, $record_pointer, MAX_ORG_RECORD_LENGTH); + } else { + fseek($gi->filehandle, $record_pointer, SEEK_SET); + $org_buf = fread($gi->filehandle,MAX_ORG_RECORD_LENGTH); + } + // workaround php's broken substr, strpos, etc handling with + // mbstring.func_overload and mbstring.internal_encoding + $enc = mb_internal_encoding(); + mb_internal_encoding('ISO-8859-1'); + $org_buf = substr($org_buf, 0, strpos($org_buf, "\0")); + mb_internal_encoding($enc); + return $org_buf; +} +} + +if (!function_exists('_get_org_v6')){ +function _get_org_v6($gi,$ipnum){ + $seek_org = _geoip_seek_country_v6($gi,$ipnum); + if ($seek_org == $gi->databaseSegments) { + return NULL; + } + return _common_get_org($gi, $seek_org); +} +} + +if (!function_exists('_get_org')){ +function _get_org($gi,$ipnum){ + $seek_org = _geoip_seek_country($gi,$ipnum); + if ($seek_org == $gi->databaseSegments) { + return NULL; + } + return _common_get_org($gi, $seek_org); +} +} + + + +if (!function_exists('geoip_name_by_addr_v6 ')){ +function geoip_name_by_addr_v6 ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = inet_pton($addr); + return _get_org_v6($gi, $ipnum); +} +} + +if (!function_exists('geoip_name_by_addr ')){ +function geoip_name_by_addr ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = ip2long($addr); + return _get_org($gi, $ipnum); +} +} + +if (!function_exists('geoip_org_by_addr ')){ +function geoip_org_by_addr ($gi,$addr) { + return geoip_name_by_addr($gi, $addr); +} +} + +if (!function_exists('_get_region')){ +function _get_region($gi,$ipnum){ + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ + $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; + if ($seek_region >= 1000){ + $country_code = "US"; + $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); + } else { + $country_code = $gi->GEOIP_COUNTRY_CODES[$seek_region]; + $region = ""; + } + return array ($country_code,$region); + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { + $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; + //print $seek_region; + if ($seek_region < US_OFFSET){ + $country_code = ""; + $region = ""; + } else if ($seek_region < CANADA_OFFSET) { + $country_code = "US"; + $region = chr(($seek_region - US_OFFSET)/26 + 65) . chr(($seek_region - US_OFFSET)%26 + 65); + } else if ($seek_region < WORLD_OFFSET) { + $country_code = "CA"; + $region = chr(($seek_region - CANADA_OFFSET)/26 + 65) . chr(($seek_region - CANADA_OFFSET)%26 + 65); + } else { + $country_code = $gi->GEOIP_COUNTRY_CODES[($seek_region - WORLD_OFFSET) / FIPS_RANGE]; + $region = ""; + } + return array ($country_code,$region); + } +} +} + +if (!function_exists('geoip_region_by_addr ')){ +function geoip_region_by_addr ($gi,$addr) { + if ($addr == NULL) { + return 0; + } + $ipnum = ip2long($addr); + return _get_region($gi, $ipnum); +} +} + +if (!function_exists('getdnsattributes ')){ +function getdnsattributes ($l,$ip){ + $r = new Net_DNS_Resolver(); + $r->nameservers = array("ws1.maxmind.com"); + $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); + $str = is_object($p->answer[0])?$p->answer[0]->string():''; + $str = substr( $str, 1, -1 ); + return $str; +} +} + ?> diff --git a/tools/geoip/geoipcity.inc b/tools/geoip/geoipcity.inc index 08efe52d9..a93c3d35d 100755 --- a/tools/geoip/geoipcity.inc +++ b/tools/geoip/geoipcity.inc @@ -67,9 +67,9 @@ class geoipdnsrecord { function getrecordwithdnsservice($str){ $record = new geoipdnsrecord; - $keyvalue = split(";",$str); + $keyvalue = explode(";",$str); foreach ($keyvalue as $keyvalue2){ - list($key,$value) = split("=",$keyvalue2); + list($key,$value) = explode("=",$keyvalue2); if ($key == "co"){ $record->country_code = $value; } @@ -115,12 +115,16 @@ function getrecordwithdnsservice($str){ return $record; } -function _get_record($gi,$ipnum){ - $seek_country = _geoip_seek_country($gi,$ipnum); + +function _get_record_v6($gi,$ipnum){ + $seek_country = _geoip_seek_country_v6($gi,$ipnum); if ($seek_country == $gi->databaseSegments) { return NULL; } - + return _common_get_record($gi, $seek_country); +} + +function _common_get_record($gi, $seek_country){ // workaround php's broken substr, strpos, etc handling with // mbstring.func_overload and mbstring.internal_encoding $enc = mb_internal_encoding(); @@ -206,6 +210,22 @@ function _get_record($gi,$ipnum){ return $record; } +function GeoIP_record_by_addr_v6 ($gi,$addr){ + if ($addr == NULL){ + return 0; + } + $ipnum = inet_pton($addr); + return _get_record_v6($gi, $ipnum); +} + +function _get_record($gi,$ipnum){ + $seek_country = _geoip_seek_country($gi,$ipnum); + if ($seek_country == $gi->databaseSegments) { + return NULL; + } + return _common_get_record($gi, $seek_country); +} + function GeoIP_record_by_addr ($gi,$addr){ if ($addr == NULL){ return 0; diff --git a/tools/geoip/geoipregionvars.php b/tools/geoip/geoipregionvars.php index 4f34d2fd1..c18a4aff8 100755 --- a/tools/geoip/geoipregionvars.php +++ b/tools/geoip/geoipregionvars.php @@ -1,5 +1,5 @@ array( "02" => "Canillo", @@ -254,7 +254,9 @@ $GEOIP_REGION_NAME = array( "09" => "West-Vlaanderen", "10" => "Brabant Wallon", "11" => "Brussels Hoofdstedelijk Gewest", - "12" => "Vlaams-Brabant"), + "12" => "Vlaams-Brabant", + "13" => "Flanders", + "14" => "Wallonia"), "BF" => array( "15" => "Bam", "19" => "Boulkiemde", @@ -675,9 +677,6 @@ $GEOIP_REGION_NAME = array( "02" => "Antioquia", "03" => "Arauca", "04" => "Atlantico", - "05" => "Bolivar Department", - "06" => "Boyaca Department", - "07" => "Caldas Department", "08" => "Caqueta", "09" => "Cauca", "10" => "Cesar", @@ -687,7 +686,6 @@ $GEOIP_REGION_NAME = array( "15" => "Guainia", "16" => "Huila", "17" => "La Guajira", - "18" => "Magdalena Department", "19" => "Meta", "20" => "Narino", "21" => "Norte de Santander", @@ -1621,26 +1619,19 @@ $GEOIP_REGION_NAME = array( "03" => "Bengkulu", "04" => "Jakarta Raya", "05" => "Jambi", - "06" => "Jawa Barat", "07" => "Jawa Tengah", "08" => "Jawa Timur", - "09" => "Papua", "10" => "Yogyakarta", "11" => "Kalimantan Barat", "12" => "Kalimantan Selatan", "13" => "Kalimantan Tengah", "14" => "Kalimantan Timur", "15" => "Lampung", - "16" => "Maluku", "17" => "Nusa Tenggara Barat", "18" => "Nusa Tenggara Timur", - "19" => "Riau", - "20" => "Sulawesi Selatan", "21" => "Sulawesi Tengah", "22" => "Sulawesi Tenggara", - "23" => "Sulawesi Utara", "24" => "Sumatera Barat", - "25" => "Sumatera Selatan", "26" => "Sumatera Utara", "28" => "Maluku", "29" => "Maluku Utara", @@ -1850,14 +1841,17 @@ $GEOIP_REGION_NAME = array( "17" => "Kingston"), "JO" => array( "02" => "Al Balqa'", - "07" => "Ma", "09" => "Al Karak", - "10" => "Al Mafraq", - "11" => "Amman Governorate", "12" => "At Tafilah", - "13" => "Az Zarqa", - "14" => "Irbid", - "16" => "Amman"), + "15" => "Al Mafraq", + "16" => "Amman", + "17" => "Az Zaraqa", + "18" => "Irbid", + "19" => "Ma'an", + "20" => "Ajlun", + "21" => "Al Aqabah", + "22" => "Jarash", + "23" => "Madaba"), "JP" => array( "01" => "Aichi", "02" => "Akita", @@ -2272,6 +2266,7 @@ $GEOIP_REGION_NAME = array( "79" => "Leova", "80" => "Nisporeni", "81" => "Ocnita", + "82" => "Orhei", "83" => "Rezina", "84" => "Riscani", "85" => "Singerei", @@ -2721,7 +2716,6 @@ $GEOIP_REGION_NAME = array( "05" => "Limburg", "06" => "Noord-Brabant", "07" => "Noord-Holland", - "08" => "Overijssel", "09" => "Utrecht", "10" => "Zeeland", "11" => "Zuid-Holland", @@ -3217,7 +3211,8 @@ $GEOIP_REGION_NAME = array( "89" => "Yevrey", "90" => "Permskiy Kray", "91" => "Krasnoyarskiy Kray", - "CI" => "Chechnya Republic"), + "92" => "Kamchatskiy Kray", + "93" => "Zabaykal'skiy Kray"), "RW" => array( "01" => "Butare", "06" => "Gitarama", @@ -3230,12 +3225,11 @@ $GEOIP_REGION_NAME = array( "15" => "Sud"), "SA" => array( "02" => "Al Bahah", - "03" => "Al Jawf", "05" => "Al Madinah", "06" => "Ash Sharqiyah", "08" => "Al Qasim", - "09" => "Al Qurayyat", "10" => "Ar Riyad", + "11" => "Asir Province", "13" => "Ha'il", "14" => "Makkah", "15" => "Al Hudud ash Shamaliyah", @@ -4142,19 +4136,26 @@ $GEOIP_REGION_NAME = array( "03" => "Al Mahrah", "04" => "Hadramawt", "05" => "Shabwah", - "06" => "Al Ghaydah", + "06" => "Lahij", + "07" => "Al Bayda'", "08" => "Al Hudaydah", + "09" => "Al Jawf", "10" => "Al Mahwit", "11" => "Dhamar", + "12" => "Hajjah", + "13" => "Ibb", "14" => "Ma'rib", - "15" => "Sa", - "16" => "San", + "15" => "Sa'dah", + "16" => "San'a'", + "17" => "Taizz", + "18" => "Ad Dali", + "19" => "Amran", "20" => "Al Bayda'", "21" => "Al Jawf", "22" => "Hajjah", "23" => "Ibb", "24" => "Lahij", - "25" => "Ta"), + "25" => "Taizz"), "ZA" => array( "01" => "North-Western Province", "02" => "KwaZulu-Natal", diff --git a/tools/geoip/index.php b/tools/geoip/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/geoip/index.php +++ b/tools/geoip/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/index.php b/tools/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/index.php +++ b/tools/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/js_minify/index.php b/tools/js_minify/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/js_minify/index.php +++ b/tools/js_minify/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/json/index.php b/tools/json/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/json/index.php +++ b/tools/json/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/minify_html/index.php b/tools/minify_html/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/minify_html/index.php +++ b/tools/minify_html/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/minify_html/minify_html.class.php b/tools/minify_html/minify_html.class.php index e7b06c972..2905e37bc 100755 --- a/tools/minify_html/minify_html.class.php +++ b/tools/minify_html/minify_html.class.php @@ -43,6 +43,10 @@ class Minify_HTML { * * @return string */ + + /* PrestaShop + added a limit for all preg_replace_callback + */ public static function minify($html, $options = array()) { if (isset($options['cssMinifier'])) { @@ -67,47 +71,53 @@ class Minify_HTML { $html = preg_replace_callback( '/\\s*(]*?>)([\\s\\S]*?)<\\/script>\\s*/i' ,array(self::$className, '_removeScriptCB') - ,$html); + ,$html, + Media::getBackTrackLimit()); // replace STYLEs (and minify) with placeholders $html = preg_replace_callback( '/\\s*(]*?>)([\\s\\S]*?)<\\/style>\\s*/i' ,array(self::$className, '_removeStyleCB') - ,$html); - + ,$html, + Media::getBackTrackLimit()); + // remove HTML comments (not containing IE conditional comments). $html = preg_replace_callback( '//' ,array(self::$className, '_commentCB') - ,$html); + ,$html, + Media::getBackTrackLimit()); // replace PREs with placeholders $html = preg_replace_callback('/\\s*(]*?>[\\s\\S]*?<\\/pre>)\\s*/i' ,array(self::$className, '_removePreCB') - , $html); + , $html, + Media::getBackTrackLimit()); // replace TEXTAREAs with placeholders $html = preg_replace_callback( '/\\s*(]*?>[\\s\\S]*?<\\/textarea>)\\s*/i' ,array(self::$className, '_removeTaCB') - , $html); + , $html, + Media::getBackTrackLimit()); // trim each line. // @todo take into account attribute values that span multiple lines. - $html = preg_replace('/^\\s+|\\s+$/m', '', $html); + $html = preg_replace('/^\\s+|\\s+$/m', '', $html, Media::getBackTrackLimit()); // remove ws around block/undisplayed elements $html = preg_replace('/\\s+(<\\/?(?:area|base(?:font)?|blockquote|body' .'|caption|center|cite|col(?:group)?|dd|dir|div|dl|dt|fieldset|form' .'|frame(?:set)?|h[1-6]|head|hr|html|legend|li|link|map|menu|meta' .'|ol|opt(?:group|ion)|p|param|t(?:able|body|head|d|h||r|foot|itle)' - .'|ul)\\b[^>]*>)/i', '$1', $html); + .'|ul)\\b[^>]*>)/i', '$1', $html, Media::getBackTrackLimit()); // remove ws outside of all elements $html = preg_replace_callback( '/>([^<]+)]+>)/i', "$1\n$2", $html); @@ -146,7 +156,7 @@ class Minify_HTML { protected static function _outsideTagCB($m) { - return '>' . preg_replace('/^\\s+|\\s+$/', ' ', $m[1]) . '<'; + return '>' . preg_replace('/^\\s+|\\s+$/', ' ', $m[1], Media::getBackTrackLimit()) . '<'; } protected static function _removePreCB($m) @@ -164,7 +174,7 @@ class Minify_HTML { $openStyle = $m[1]; $css = $m[2]; // remove HTML comments - $css = preg_replace('/(?:^\\s*\\s*$)/', '', $css); + $css = preg_replace('/(?:^\\s*\\s*$)/', '', $css, Media::getBackTrackLimit()); // remove CDATA section markers $css = self::_removeCdata($css); @@ -187,7 +197,7 @@ class Minify_HTML { $js = $m[2]; // remove HTML comments (and ending "//" if present) - $js = preg_replace('/(?:^\\s*\\s*$)/', '', $js); + $js = preg_replace('/(?:^\\s*\\s*$)/', '', $js, Media::getBackTrackLimit()); // remove CDATA section markers $js = self::_removeCdata($js); diff --git a/tools/mobile_Detect/Mobile_Detect.php b/tools/mobile_Detect/Mobile_Detect.php index 54ca81460..e82fbdd1c 100644 --- a/tools/mobile_Detect/Mobile_Detect.php +++ b/tools/mobile_Detect/Mobile_Detect.php @@ -1,129 +1,270 @@ -* @copyright 2007-2012 PrestaShop SA -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - /** - * Mobile Detect - * $Id: Mobile_Detect.php 51 2012-08-03 02:16:06Z serbanghita@gmail.com $ + * MIT License + * =========== * - * @author Mobile_Detect v.1.0 Victor Stanciu - * Mobile_Detect v.2.x Serban Ghita - * - * @usage require_once 'Mobile_Detect.php'; - * $detect = new Mobile_Detect(); - * $detect->isMobile() or $detect->isTablet() - * - * For more specific usage see the documentation navigate to: - * http://code.google.com/p/php-mobile-detect/wiki/Mobile_Detect - * - * @license http://www.opensource.org/licenses/mit-license.php The MIT License + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * + * @author Serban Ghita + * Victor Stanciu (until v.1.0) + * @license MIT License https://github.com/serbanghita/Mobile-Detect/blob/master/LICENSE.txt + * @link Official page: http://mobiledetect.net + * GitHub Repository: https://github.com/serbanghita/Mobile-Detect + * Google Code Old Page: http://code.google.com/p/php-mobile-detect/ */ class Mobile_Detect { + protected $scriptVersion = '2.5.5'; + // External info. protected $userAgent = null; protected $httpHeaders; - // Array holding all detection rules. - protected $mobileDetectionRules; + // Arrays holding all detection rules. + protected $mobileDetectionRules = null; + protected $mobileDetectionRulesExtended = null; + // Type of detection to use. + protected $detectionType = 'mobile'; // mobile, extended @todo: refactor this. // List of mobile devices (phones) - protected $phoneDevices = array( - 'iPhone' => '(iPhone.*Mobile|iPod|iTunes)', - 'BlackBerry' => 'BlackBerry|rim[0-9]+', - 'HTC' => 'HTC|HTC.*(6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT', - 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus', - 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35', - 'Motorola' => '\bDroid\b.*Build|DROIDX|HRI39|MOT\-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT909|XT910|XT912|XT928', - 'Samsung' => 'Samsung|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9300 |GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-P6810|GT-P7100|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100', - 'Sony' => 'E10i|SonyEricsson|SonyEricssonLT15iv', - 'Asus' => 'Asus.*Galaxy', - 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex. - 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;) - 'GenericPhone' => '(mmp|pocket|psp|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|wap|nokia|Series40|Series60|S60|SonyEricsson|N900|PPC;|MAUI.*WAP.*Browser|LG-P500)' + protected $phoneDevices = array( + 'iPhone' => '\biPhone.*Mobile|\biPod|\biTunes', + 'BlackBerry' => 'BlackBerry|rim[0-9]+', + 'HTC' => 'HTC|HTC.*(Sensation|Evo|Vision|Explorer|6800|8100|8900|A7272|S510e|C110e|Legend|Desire|T8282)|APX515CKT|Qtek9090|APA9292KT|HD_mini|Sensation.*Z710e|PG86100|Z715e|Desire.*(A8181|HD)|ADR6200|ADR6425|001HT|Inspire 4G', + 'Nexus' => 'Nexus One|Nexus S|Galaxy.*Nexus|Android.*Nexus.*Mobile', + // @todo: Is 'Dell Streak' a tablet or a phone? ;) + 'Dell' => 'Dell.*Streak|Dell.*Aero|Dell.*Venue|DELL.*Venue Pro|Dell Flash|Dell Smoke|Dell Mini 3iX|XCD28|XCD35|\b001DL\b|\b101DL\b|\bGS01\b', + 'Motorola' => 'Motorola|\bDroid\b.*Build|DROIDX|Android.*Xoom|HRI39|MOT-|A1260|A1680|A555|A853|A855|A953|A955|A956|Motorola.*ELECTRIFY|Motorola.*i1|i867|i940|MB200|MB300|MB501|MB502|MB508|MB511|MB520|MB525|MB526|MB611|MB612|MB632|MB810|MB855|MB860|MB861|MB865|MB870|ME501|ME502|ME511|ME525|ME600|ME632|ME722|ME811|ME860|ME863|ME865|MT620|MT710|MT716|MT720|MT810|MT870|MT917|Motorola.*TITANIUM|WX435|WX445|XT300|XT301|XT311|XT316|XT317|XT319|XT320|XT390|XT502|XT530|XT531|XT532|XT535|XT603|XT610|XT611|XT615|XT681|XT701|XT702|XT711|XT720|XT800|XT806|XT860|XT862|XT875|XT882|XT883|XT894|XT909|XT910|XT912|XT928', + 'Samsung' => 'Samsung|BGT-S5230|GT-B2100|GT-B2700|GT-B2710|GT-B3210|GT-B3310|GT-B3410|GT-B3730|GT-B3740|GT-B5510|GT-B5512|GT-B5722|GT-B6520|GT-B7300|GT-B7320|GT-B7330|GT-B7350|GT-B7510|GT-B7722|GT-B7800|GT-C3010|GT-C3011|GT-C3060|GT-C3200|GT-C3212|GT-C3212I|GT-C3222|GT-C3300|GT-C3300K|GT-C3303|GT-C3303K|GT-C3310|GT-C3322|GT-C3330|GT-C3350|GT-C3500|GT-C3510|GT-C3530|GT-C3630|GT-C3780|GT-C5010|GT-C5212|GT-C6620|GT-C6625|GT-C6712|GT-E1050|GT-E1070|GT-E1075|GT-E1080|GT-E1081|GT-E1085|GT-E1087|GT-E1100|GT-E1107|GT-E1110|GT-E1120|GT-E1125|GT-E1130|GT-E1160|GT-E1170|GT-E1175|GT-E1180|GT-E1182|GT-E1200|GT-E1210|GT-E1225|GT-E1230|GT-E1390|GT-E2100|GT-E2120|GT-E2121|GT-E2152|GT-E2220|GT-E2222|GT-E2230|GT-E2232|GT-E2250|GT-E2370|GT-E2550|GT-E2652|GT-E3210|GT-E3213|GT-I5500|GT-I5503|GT-I5700|GT-I5800|GT-I5801|GT-I6410|GT-I6420|GT-I7110|GT-I7410|GT-I7500|GT-I8000|GT-I8150|GT-I8160|GT-I8320|GT-I8330|GT-I8350|GT-I8530|GT-I8700|GT-I8703|GT-I8910|GT-I9000|GT-I9001|GT-I9003|GT-I9010|GT-I9020|GT-I9023|GT-I9070|GT-I9100|GT-I9103|GT-I9220|GT-I9250|GT-I9300|GT-I9300 |GT-M3510|GT-M5650|GT-M7500|GT-M7600|GT-M7603|GT-M8800|GT-M8910|GT-N7000|GT-P6810|GT-P7100|GT-S3110|GT-S3310|GT-S3350|GT-S3353|GT-S3370|GT-S3650|GT-S3653|GT-S3770|GT-S3850|GT-S5210|GT-S5220|GT-S5229|GT-S5230|GT-S5233|GT-S5250|GT-S5253|GT-S5260|GT-S5263|GT-S5270|GT-S5300|GT-S5330|GT-S5350|GT-S5360|GT-S5363|GT-S5369|GT-S5380|GT-S5380D|GT-S5560|GT-S5570|GT-S5600|GT-S5603|GT-S5610|GT-S5620|GT-S5660|GT-S5670|GT-S5690|GT-S5750|GT-S5780|GT-S5830|GT-S5839|GT-S6102|GT-S6500|GT-S7070|GT-S7200|GT-S7220|GT-S7230|GT-S7233|GT-S7250|GT-S7500|GT-S7530|GT-S7550|GT-S8000|GT-S8003|GT-S8500|GT-S8530|GT-S8600|SCH-A310|SCH-A530|SCH-A570|SCH-A610|SCH-A630|SCH-A650|SCH-A790|SCH-A795|SCH-A850|SCH-A870|SCH-A890|SCH-A930|SCH-A950|SCH-A970|SCH-A990|SCH-I100|SCH-I110|SCH-I400|SCH-I405|SCH-I500|SCH-I510|SCH-I515|SCH-I600|SCH-I730|SCH-I760|SCH-I770|SCH-I830|SCH-I910|SCH-I920|SCH-LC11|SCH-N150|SCH-N300|SCH-R100|SCH-R300|SCH-R351|SCH-R400|SCH-R410|SCH-T300|SCH-U310|SCH-U320|SCH-U350|SCH-U360|SCH-U365|SCH-U370|SCH-U380|SCH-U410|SCH-U430|SCH-U450|SCH-U460|SCH-U470|SCH-U490|SCH-U540|SCH-U550|SCH-U620|SCH-U640|SCH-U650|SCH-U660|SCH-U700|SCH-U740|SCH-U750|SCH-U810|SCH-U820|SCH-U900|SCH-U940|SCH-U960|SCS-26UC|SGH-A107|SGH-A117|SGH-A127|SGH-A137|SGH-A157|SGH-A167|SGH-A177|SGH-A187|SGH-A197|SGH-A227|SGH-A237|SGH-A257|SGH-A437|SGH-A517|SGH-A597|SGH-A637|SGH-A657|SGH-A667|SGH-A687|SGH-A697|SGH-A707|SGH-A717|SGH-A727|SGH-A737|SGH-A747|SGH-A767|SGH-A777|SGH-A797|SGH-A817|SGH-A827|SGH-A837|SGH-A847|SGH-A867|SGH-A877|SGH-A887|SGH-A897|SGH-A927|SGH-B100|SGH-B130|SGH-B200|SGH-B220|SGH-C100|SGH-C110|SGH-C120|SGH-C130|SGH-C140|SGH-C160|SGH-C170|SGH-C180|SGH-C200|SGH-C207|SGH-C210|SGH-C225|SGH-C230|SGH-C417|SGH-C450|SGH-D307|SGH-D347|SGH-D357|SGH-D407|SGH-D415|SGH-D780|SGH-D807|SGH-D980|SGH-E105|SGH-E200|SGH-E315|SGH-E316|SGH-E317|SGH-E335|SGH-E590|SGH-E635|SGH-E715|SGH-E890|SGH-F300|SGH-F480|SGH-I200|SGH-I300|SGH-I320|SGH-I550|SGH-I577|SGH-I600|SGH-I607|SGH-I617|SGH-I627|SGH-I637|SGH-I677|SGH-I700|SGH-I717|SGH-I727|SGH-I777|SGH-I780|SGH-I827|SGH-I847|SGH-I857|SGH-I896|SGH-I897|SGH-I900|SGH-I907|SGH-I917|SGH-I927|SGH-I937|SGH-I997|SGH-J150|SGH-J200|SGH-L170|SGH-L700|SGH-M110|SGH-M150|SGH-M200|SGH-N105|SGH-N500|SGH-N600|SGH-N620|SGH-N625|SGH-N700|SGH-N710|SGH-P107|SGH-P207|SGH-P300|SGH-P310|SGH-P520|SGH-P735|SGH-P777|SGH-Q105|SGH-R210|SGH-R220|SGH-R225|SGH-S105|SGH-S307|SGH-T109|SGH-T119|SGH-T139|SGH-T209|SGH-T219|SGH-T229|SGH-T239|SGH-T249|SGH-T259|SGH-T309|SGH-T319|SGH-T329|SGH-T339|SGH-T349|SGH-T359|SGH-T369|SGH-T379|SGH-T409|SGH-T429|SGH-T439|SGH-T459|SGH-T469|SGH-T479|SGH-T499|SGH-T509|SGH-T519|SGH-T539|SGH-T559|SGH-T589|SGH-T609|SGH-T619|SGH-T629|SGH-T639|SGH-T659|SGH-T669|SGH-T679|SGH-T709|SGH-T719|SGH-T729|SGH-T739|SGH-T746|SGH-T749|SGH-T759|SGH-T769|SGH-T809|SGH-T819|SGH-T839|SGH-T919|SGH-T929|SGH-T939|SGH-T959|SGH-T989|SGH-U100|SGH-U200|SGH-U800|SGH-V205|SGH-V206|SGH-X100|SGH-X105|SGH-X120|SGH-X140|SGH-X426|SGH-X427|SGH-X475|SGH-X495|SGH-X497|SGH-X507|SGH-X600|SGH-X610|SGH-X620|SGH-X630|SGH-X700|SGH-X820|SGH-X890|SGH-Z130|SGH-Z150|SGH-Z170|SGH-ZX10|SGH-ZX20|SHW-M110|SPH-A120|SPH-A400|SPH-A420|SPH-A460|SPH-A500|SPH-A560|SPH-A600|SPH-A620|SPH-A660|SPH-A700|SPH-A740|SPH-A760|SPH-A790|SPH-A800|SPH-A820|SPH-A840|SPH-A880|SPH-A900|SPH-A940|SPH-A960|SPH-D600|SPH-D700|SPH-D710|SPH-D720|SPH-I300|SPH-I325|SPH-I330|SPH-I350|SPH-I500|SPH-I600|SPH-I700|SPH-L700|SPH-M100|SPH-M220|SPH-M240|SPH-M300|SPH-M305|SPH-M320|SPH-M330|SPH-M350|SPH-M360|SPH-M370|SPH-M380|SPH-M510|SPH-M540|SPH-M550|SPH-M560|SPH-M570|SPH-M580|SPH-M610|SPH-M620|SPH-M630|SPH-M800|SPH-M810|SPH-M850|SPH-M900|SPH-M910|SPH-M920|SPH-M930|SPH-N100|SPH-N200|SPH-N240|SPH-N300|SPH-N400|SPH-Z400|SWC-E100|SCH-i909|GT-N7100|GT-N8010', + 'Sony' => 'sony|SonyEricsson|SonyEricssonLT15iv|LT18i|E10i', + 'Asus' => 'Asus.*Galaxy', + 'Palm' => 'PalmSource|Palm', // avantgo|blazer|elaine|hiptop|plucker|xiino ; @todo - complete the regex. + 'Vertu' => 'Vertu|Vertu.*Ltd|Vertu.*Ascent|Vertu.*Ayxta|Vertu.*Constellation(F|Quest)?|Vertu.*Monika|Vertu.*Signature', // Just for fun ;) + // @ref: http://www.pantech.co.kr/en/prod/prodList.do?gbrand=VEGA (PANTECH) + // Most of the VEGA devices are legacy. PANTECH seem to be newer devices based on Android. + 'Pantech' => 'PANTECH|IM-A850S|IM-A840S|IM-A830L|IM-A830K|IM-A830S|IM-A820L|IM-A810K|IM-A810S|IM-A800S|IM-T100K|IM-A725L|IM-A780L|IM-A775C|IM-A770K|IM-A760S|IM-A750K|IM-A740S|IM-A730S|IM-A720L|IM-A710K|IM-A690L|IM-A690S|IM-A650S|IM-A630K|IM-A600S|VEGA PTL21|PT003|P8010|ADR910L|P6030|P6020|P9070|P4100|P9060|P5000|CDM8992|TXT8045|ADR8995|IS11PT|P2030|P6010|P8000|PT002|IS06|CDM8999|P9050|PT001|TXT8040|P2020|P9020|P2000|P7040|P7000|C790', + // @ref: http://www.fly-phone.com/devices/smartphones/ ; Included only smartphones. + 'Fly' => 'IQ230|IQ444|IQ450|IQ440|IQ442|IQ441|IQ245|IQ256|IQ236|IQ255|IQ235|IQ245|IQ275|IQ240|IQ285|IQ280|IQ270|IQ260|IQ250', + // @Tapatalk is a mobile app; @ref: http://support.tapatalk.com/threads/smf-2-0-2-os-and-browser-detection-plugin-and-tapatalk.15565/#post-79039 + 'GenericPhone' => 'Tapatalk|PDA;|PPC;|SAGEM|mmp|pocket|psp|symbian|Smartphone|smartfon|treo|up.browser|up.link|vodafone|wap|nokia|Series40|Series60|S60|SonyEricsson|N900|MAUI.*WAP.*Browser|LG-P500' ); // List of tablet devices. protected $tabletDevices = array( - 'BlackBerryTablet' => 'PlayBook|RIM Tablet', 'iPad' => 'iPad|iPad.*Mobile', // @todo: check for mobile friendly emails topic. + 'NexusTablet' => '^.*Android.*Nexus(((?:(?!Mobile))|(?:(\s(7|10).+))).)*$', + 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|SC-01C|GT-P1000|GT-P1010|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P3100|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7320|GT-P7511|GT-N8000|GT-P8510|SGH-I497|SPH-P500|SGH-T779|SCH-I705|SCH-I915|GT-N8013|GT-P3113|GT-P5113|GT-P8110|GT-N8010|GT-N8005|GT-N8020|GT-P1013|GT-P6201|GT-P6810|GT-P7501', + // @reference: http://www.labnol.org/software/kindle-user-agent-string/20378/ 'Kindle' => 'Kindle|Silk.*Accelerated', - 'SamsungTablet' => 'SAMSUNG.*Tablet|Galaxy.*Tab|GT-P1000|GT-P1010|GT-P6210|GT-P6800|GT-P6810|GT-P7100|GT-P7300|GT-P7310|GT-P7500|GT-P7510|SCH-I800|SCH-I815|SCH-I905|SGH-I957|SGH-I987|SGH-T849|SGH-T859|SGH-T869|SPH-P100|GT-P1000|GT-P3100|GT-P3110|GT-P5100|GT-P5110|GT-P6200|GT-P7300|GT-P7320|GT-P7500|GT-P7510|GT-P7511', - 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200', - 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617', 'AsusTablet' => 'Transformer|TF101', - 'NookTablet' => 'NookColor|nook browser|BNTV250A|LogicPD Zoom2', - 'AcerTablet' => 'Android.*\b(A100|A101|A200|A500|A501|A510|W500|W500P|W501|W501P)\b', - 'YarvikTablet' => 'Android.*(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468)', + 'BlackBerryTablet' => 'PlayBook|RIM Tablet', + 'HTCtablet' => 'HTC Flyer|HTC Jetstream|HTC-P715a|HTC EVO View 4G|PG41200', + 'MotorolaTablet' => 'xoom|sholest|MZ615|MZ605|MZ505|MZ601|MZ602|MZ603|MZ604|MZ606|MZ607|MZ608|MZ609|MZ615|MZ616|MZ617', + 'NookTablet' => 'Android.*Nook|NookColor|nook browser|BNTV250A|LogicPD Zoom2', + // @ref: http://www.acer.ro/ac/ro/RO/content/drivers + // @ref: http://www.packardbell.co.uk/pb/en/GB/content/download (Packard Bell is part of Acer) + 'AcerTablet' => 'Android.*\b(A100|A101|A200|A500|A501|A510|A700|A701|W500|W500P|W501|W501P|G100|G100W)\b', + // @ref: http://eu.computers.toshiba-europe.com/innovation/family/Tablets/1098744/banner_id/tablet_footerlink/ + // @ref: http://us.toshiba.com/tablets/tablet-finder + // @ref: http://www.toshiba.co.jp/regza/tablet/ + 'ToshibaTablet' => 'Android.*(AT100|AT105|AT200|AT205|AT270|AT275|AT300|AT305|AT1S5|AT500|AT570|AT700|AT830)', + // @ref: http://www.nttdocomo.co.jp/english/service/developer/smart_phone/technical_info/spec/index.html + 'LGTablet' => '\bL-06C|LG-V900|LG-V909', + 'YarvikTablet' => 'Android.*(TAB210|TAB211|TAB224|TAB250|TAB260|TAB264|TAB310|TAB360|TAB364|TAB410|TAB411|TAB420|TAB424|TAB450|TAB460|TAB461|TAB464|TAB465|TAB467|TAB468)', 'MedionTablet' => 'Android.*\bOYO\b|LIFE.*(P9212|P9514|P9516|S9512)|LIFETAB', 'ArnovaTablet' => 'AN10G2|AN7bG3|AN7fG3|AN8G3|AN8cG3|AN7G3|AN9G3|AN7dG3|AN7dG3ST|AN7dG3ChildPad|AN10bG3|AN10bG3DT', - 'GenericTablet' => 'Tablet(?!.*PC)|ViewPad7|LG-V909|MID7015|BNTV250A|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b', + // @reference: http://wiki.archosfans.com/index.php?title=Main_Page + 'ArchosTablet' => 'Android.*ARCHOS|101G9|80G9', + // @reference: http://en.wikipedia.org/wiki/NOVO7 + 'AinolTablet' => 'NOVO7|Novo7Aurora|Novo7Basic|NOVO7PALADIN', + // @todo: inspect http://esupport.sony.com/US/p/select-system.pl?DIRECTOR=DRIVER + // @ref: Readers http://www.atsuhiro-me.net/ebook/sony-reader/sony-reader-web-browser + 'SonyTablet' => 'Sony Tablet|Sony Tablet S|EBRD1101|EBRD1102|EBRD1201', + // @ref: db + http://www.cube-tablet.com/buy-products.html + 'CubeTablet' => 'Android.*(K8GT|U9GT|U10GT|U16GT|U17GT|U18GT|U19GT|U20GT|U23GT|U30GT)', + // @ref: http://www.cobyusa.com/?p=pcat&pcat_id=3001 + 'CobyTablet' => 'MID1042|MID1045|MID1125|MID1126|MID7012|MID7014|MID7034|MID7035|MID7036|MID7042|MID7048|MID7127|MID8042|MID8048|MID8127|MID9042|MID9740|MID9742|MID7022|MID7010', + // @ref: http://pdadb.net/index.php?m=pdalist&list=SMiT (NoName Chinese Tablets) + // @ref: http://www.imp3.net/14/show.php?itemid=20454 + 'SMiTTablet' => 'Android.*(\bMID\b|MID-560|MTV-T1200|MTV-PND531|MTV-P1101|MTV-PND530)', + // @ref: http://www.rock-chips.com/index.php?do=prod&pid=2 + 'RockChipTablet' => 'Android.*(RK2818|RK2808A|RK2918|RK3066)|RK2738|RK2808A', + // @ref: http://www.telstra.com.au/home-phone/thub-2/ + 'TelstraTablet' => 'T-Hub2', + // @ref: http://www.fly-phone.com/devices/tablets/ ; http://www.fly-phone.com/service/ + 'FlyTablet' => 'IQ310|Fly Vision', + // @ref: http://www.bqreaders.com/gb/tablets-prices-sale.html + 'bqTablet' => 'bq.*(Elcano|Curie|Edison|Maxwell|Kepler|Pascal|Tesla|Hypatia|Platon|Newton|Livingstone|Cervantes|Avant)', + // @ref: http://www.huaweidevice.com/worldwide/productFamily.do?method=index&directoryId=5011&treeId=3290 + // @ref: http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index&directoryId=3372&treeId=0&tb=1&type=software (including legacy tablets) + 'HuaweiTablet' => 'MediaPad|IDEOS S7|S7-201c|S7-202u|S7-101|S7-103|S7-104|S7-105|S7-106|S7-201|S7-Slim', + // Nec or Medias Tab + 'NecTablet' => '\bN-06D|\bN-08D', + // @ref: https://www.nabitablet.com/ + 'NabiTablet' => 'Android.*\bNabi', + // @note: Avoid detecting 'PLAYSTATION 3' as mobile. + 'PlaystationTablet' => 'Playstation.*(Portable|Vita)', + 'GenericTablet' => 'Android.*\b97D\b|Tablet(?!.*PC)|ViewPad7|MID7015|BNTV250A|LogicPD Zoom2|\bA7EB\b|CatNova8|A1_07|CT704|CT1002|\bM721\b|hp-tablet', ); // List of mobile Operating Systems. protected $operatingSystems = array( - 'AndroidOS' => '(android.*mobile|android(?!.*mobile))', - 'BlackBerryOS' => '(blackberry|rim tablet os)', - 'PalmOS' => '(avantgo|blazer|elaine|hiptop|palm|plucker|xiino)', - 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|\bS60\b', - 'WindowsMobileOS' => 'IEMobile|Windows Phone|Windows CE.*(PPC|Smartphone)|MSIEMobile|Window Mobile|XBLWP7', - 'iOS' => '(iphone|ipod|ipad)', - 'FlashLiteOS' => '', - 'JavaOS' => '', - 'NokiaOS' => '', - 'webOS' => '', + 'AndroidOS' => 'Android', + 'BlackBerryOS' => 'blackberry|rim tablet os', + 'PalmOS' => 'PalmOS|avantgo|blazer|elaine|hiptop|palm|plucker|xiino', + 'SymbianOS' => 'Symbian|SymbOS|Series60|Series40|SYB-[0-9]+|\bS60\b', + // @reference: http://en.wikipedia.org/wiki/Windows_Mobile + 'WindowsMobileOS' => 'Windows CE.*(PPC|Smartphone|Mobile|[0-9]{3}x[0-9]{3})|Window Mobile|Windows Phone [0-9.]+|WCE;', + // @reference: http://en.wikipedia.org/wiki/Windows_Phone + // http://wifeng.cn/?r=blog&a=view&id=106 + // http://nicksnettravels.builttoroam.com/post/2011/01/10/Bogus-Windows-Phone-7-User-Agent-String.aspx + 'WindowsPhoneOS' => 'Windows Phone OS|XBLWP7|ZuneWP7', + 'iOS' => '\biPhone.*Mobile|\biPod|\biPad', + // http://en.wikipedia.org/wiki/MeeGo + // @todo: research MeeGo in UAs + 'MeeGoOS' => 'MeeGo', + // http://en.wikipedia.org/wiki/Maemo + // @todo: research Maemo in UAs + 'MaemoOS' => 'Maemo', + 'JavaOS' => 'J2ME/MIDP|Java/', + 'webOS' => 'webOS|hpwOS', 'badaOS' => '\bBada\b', - 'BREWOS' => '', + 'BREWOS' => 'BREW', ); // List of mobile User Agents. protected $userAgents = array( - 'Chrome' => '\bCrMo\b|Chrome\/[.0-9]* Mobile', - 'Dolfin' => '\bDolfin\b', - 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera', - 'Skyfire' => 'skyfire', - 'IE' => 'IEMobile|MSIEMobile', - 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile', - 'Bolt' => 'bolt', - 'TeaShark' => 'teashark', - 'Blazer' => 'Blazer', - 'Safari' => 'Mobile.*Safari|Safari.*Mobile', - 'Midori' => 'midori', - 'GenericBrowser' => 'NokiaBrowser|OviBrowser|SEMC.*Browser' + // @reference: https://developers.google.com/chrome/mobile/docs/user-agent + 'Chrome' => '\bCrMo\b|CriOS|Android.*Chrome/[.0-9]* (Mobile)?', + 'Dolfin' => '\bDolfin\b', + 'Opera' => 'Opera.*Mini|Opera.*Mobi|Android.*Opera', + 'Skyfire' => 'Skyfire', + 'IE' => 'IEMobile|MSIEMobile', + 'Firefox' => 'fennec|firefox.*maemo|(Mobile|Tablet).*Firefox|Firefox.*Mobile', + 'Bolt' => 'bolt', + 'TeaShark' => 'teashark', + 'Blazer' => 'Blazer', + // @reference: http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3 + 'Safari' => 'Version.*Mobile.*Safari|Safari.*Mobile', + // @ref: http://en.wikipedia.org/wiki/Midori_(web_browser) + //'Midori' => 'midori', + 'Tizen' => 'Tizen', + 'UCBrowser' => 'UC.*Browser|UCWEB', + // @ref: https://github.com/serbanghita/Mobile-Detect/issues/7 + 'DiigoBrowser' => 'DiigoBrowser', + // http://www.puffinbrowser.com/index.php + 'Puffin' => 'Puffin', + // @reference: http://en.wikipedia.org/wiki/Minimo + // http://en.wikipedia.org/wiki/Vision_Mobile_Browser + 'GenericBrowser' => 'NokiaBrowser|OviBrowser|SEMC.*Browser|FlyFlow|Minimo|NetFront|Novarra-Vision' ); // Utilities. protected $utilities = array( - 'WebKit' => '(webkit)[ \/]([\w.]+)', - 'Bot' => 'Googlebot|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|facebookexternalhit', - 'MobileBot' => 'Googlebot-Mobile|YahooSeeker\/M1A1-R2D2', + 'TV' => 'SonyDTV115', + 'WebKit' => '(webkit)[ /]([\w.]+)', + 'Bot' => 'Googlebot|DoCoMo|YandexBot|bingbot|ia_archiver|AhrefsBot|Ezooms|GSLFbot|WBSearchBot|Twitterbot|TweetmemeBot|Twikle|PaperLiBot|Wotbox|UnwindFetchor|facebookexternalhit', + 'MobileBot' => 'Googlebot-Mobile|DoCoMo|YahooSeeker/M1A1-R2D2', ); - + // Properties list. + // @reference: http://user-agent-string.info/list-of-ua#Mobile Browser + const VER = '([\w._]+)'; + protected $properties = array( + + // Build + 'Mobile' => 'Mobile/[VER]', + 'Build' => 'Build/[VER]', + 'Version' => 'Version/[VER]', + 'VendorID' => 'VendorID/[VER]', + + // Devices + 'iPad' => 'iPad.*CPU[a-z ]+[VER]', + 'iPhone' => 'iPhone.*CPU[a-z ]+[VER]', + 'iPod' => 'iPod.*CPU[a-z ]+[VER]', + //'BlackBerry' => array('BlackBerry[VER]', 'BlackBerry [VER];'), + 'Kindle' => 'Kindle/[VER]', + + // Browser + 'Chrome' => 'Chrome/[VER]', + 'CriOS' => 'CriOS/[VER]', + 'Dolfin' => 'Dolfin/[VER]', + // @reference: https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference + 'Firefox' => 'Firefox/[VER]', + 'Fennec' => 'Fennec/[VER]', + // @reference: http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx + 'IEMobile' => array('IEMobile/[VER];', 'IEMobile [VER]'), + 'MSIE' => 'MSIE [VER];', + // http://en.wikipedia.org/wiki/NetFront + 'NetFront' => 'NetFront/[VER]', + 'NokiaBrowser' => 'NokiaBrowser/[VER]', + 'NokiaBrowser' => 'NokiaBrowser/[VER]', + 'Opera' => 'Version/[VER]', + 'Opera Mini' => 'Opera Mini/[VER]', + 'Opera Mobi' => 'Version/[VER]', + 'UC Browser' => 'UC Browser[VER]', + 'Safari' => 'Version/[VER]', + 'Skyfire' => 'Skyfire/[VER]', + 'Tizen' => 'Tizen/[VER]', + 'Webkit' => 'webkit[ /][VER]', + + // Engine + 'Gecko' => 'Gecko/[VER]', + 'Trident' => 'Trident/[VER]', + 'Presto' => 'Presto/[VER]', + + // OS + 'Android' => 'Android [VER]', + 'BlackBerry' => array('BlackBerry[\w]+/[VER]', 'BlackBerry.*Version/[VER]'), + 'BREW' => 'BREW [VER]', + 'Java' => 'Java/[VER]', + // @reference: http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/08/29/introducing-the-ie9-on-windows-phone-mango-user-agent-string.aspx + // @reference: http://en.wikipedia.org/wiki/Windows_NT#Releases + 'Windows Phone OS' => 'Windows Phone OS [VER]', + 'Windows Phone' => 'Windows Phone [VER]', + 'Windows CE' => 'Windows CE/[VER]', + // http://social.msdn.microsoft.com/Forums/en-US/windowsdeveloperpreviewgeneral/thread/6be392da-4d2f-41b4-8354-8dcee20c85cd + 'Windows NT' => 'Windows NT [VER]', + 'Symbian' => array('SymbianOS/[VER]', 'Symbian/[VER]'), + 'webOS' => array('webOS/[VER]', 'hpwOS/[VER];'), + + + ); + function __construct(){ $this->setHttpHeaders(); $this->setUserAgent(); $this->setMobileDetectionRules(); + $this->setMobileDetectionRulesExtended(); + + } + + + /** + * Get the current script version. + * This is useful for the demo.php file, + * so people can check on what version they are testing + * for mobile devices. + */ + public function getScriptVersion(){ + + return $this->scriptVersion; } @@ -141,6 +282,12 @@ class Mobile_Detect { } + public function getHttpHeaders(){ + + return $this->httpHeaders; + + } + public function setUserAgent($userAgent = null){ if(!empty($userAgent)){ @@ -151,10 +298,38 @@ class Mobile_Detect { if(empty($this->userAgent)){ $this->userAgent = isset($this->httpHeaders['HTTP_X_DEVICE_USER_AGENT']) ? $this->httpHeaders['HTTP_X_DEVICE_USER_AGENT'] : null; } + // Header can occur on devices using Opera Mini (can expose the real device type). Let's concatenate it (we need this extra info in the regexes). + if(!empty($this->httpHeaders['HTTP_X_OPERAMINI_PHONE_UA'])){ + $this->userAgent .= ' '.$this->httpHeaders['HTTP_X_OPERAMINI_PHONE_UA']; + } } } + public function getUserAgent(){ + + return $this->userAgent; + + } + + function setDetectionType($type = null){ + + $this->detectionType = (!empty($type) ? $type : 'mobile'); + + } + + public function getPhoneDevices(){ + + return $this->phoneDevices; + + } + + public function getTabletDevices(){ + + return $this->tabletDevices; + + } + /** * Method sets the mobile detection rules. * @@ -182,9 +357,8 @@ class Mobile_Detect { */ public function setMobileDetectionRulesExtended(){ - // Merge all rules together. - $this->mobileDetectionRules = array_merge( + $this->mobileDetectionRulesExtended = array_merge( $this->phoneDevices, $this->tabletDevices, $this->operatingSystems, @@ -194,10 +368,35 @@ class Mobile_Detect { } + /** + * @return array + */ + public function getRules() + { + + if($this->detectionType=='extended'){ + return $this->mobileDetectionRulesExtended; + } else { + return $this->mobileDetectionRules; + } + + } + +/** +* Check the HTTP headers for signs of mobile. +* This is the fastest mobile check possible; it's used +* inside isMobile() method. +* @return boolean +*/ public function checkHttpHeadersForMobile(){ if( - isset($this->httpHeaders['HTTP_X_WAP_PROFILE']) || + isset($this->httpHeaders['HTTP_ACCEPT']) && + (strpos($this->httpHeaders['HTTP_ACCEPT'], 'application/x-obml2d') !== false || // Opera Mini; @reference: http://dev.opera.com/articles/view/opera-binary-markup-language/ + strpos($this->httpHeaders['HTTP_ACCEPT'], 'application/vnd.rim.html') !== false || // BlackBerry devices. + strpos($this->httpHeaders['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false || + strpos($this->httpHeaders['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false) || + isset($this->httpHeaders['HTTP_X_WAP_PROFILE']) || // @todo: validate isset($this->httpHeaders['HTTP_X_WAP_CLIENTID']) || isset($this->httpHeaders['HTTP_WAP_CONNECTION']) || isset($this->httpHeaders['HTTP_PROFILE']) || @@ -209,12 +408,11 @@ class Mobile_Detect { isset($this->httpHeaders['HTTP_X_HUAWEI_USERID']) || isset($this->httpHeaders['HTTP_UA_OS']) || // Reported by Windows Smartphones. isset($this->httpHeaders['HTTP_X_MOBILE_GATEWAY']) || // Reported by Verizon, Vodafone proxy system. + isset($this->httpHeaders['HTTP_X_ATT_DEVICEID']) || // Seend this on HTC Sensation. @ref: SensationXE_Beats_Z715e + //HTTP_X_NETWORK_TYPE = WIFI ( isset($this->httpHeaders['HTTP_UA_CPU']) && - $this->httpHeaders['HTTP_UA_CPU'] == 'ARM' - ) || // Seen this on a HTC. - isset($this->httpHeaders['HTTP_ACCEPT']) && - (strpos($this->httpHeaders['HTTP_ACCEPT'], 'text/vnd.wap.wml') !== false || - strpos($this->httpHeaders['HTTP_ACCEPT'], 'application/vnd.wap.xhtml+xml') !== false) + $this->httpHeaders['HTTP_UA_CPU'] == 'ARM' // Seen this on a HTC. + ) ){ return true; @@ -225,36 +423,37 @@ class Mobile_Detect { } - /** - * @return array - */ - public function getRules() - { - return $this->mobileDetectionRules; - } - /** * Magic overloading method. - * + * * @method boolean is[...]() * @param string $name * @param array $arguments - * @return mixed + * @return mixed */ public function __call($name, $arguments) { - + + $this->setDetectionType('mobile'); + $key = substr($name, 2); return $this->matchUAAgainstKey($key); } + /** + * Find a detection rule that matches the current User-agent. + * + * @param null $userAgent deprecated + * @return boolean + */ private function matchDetectionRulesAgainstUA($userAgent = null){ // Begin general search. foreach($this->getRules() as $_regex){ if(empty($_regex)){ continue; } - if( preg_match('/'.$_regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent)) ){ + if( $this->match($_regex, $userAgent) ){ + //var_dump( $_regex ); return true; } } @@ -263,7 +462,15 @@ class Mobile_Detect { } - // Search for a certain key. + /** + * Search for a certain key in the rules array. + * If the key is found the try to match the corresponding + * regex agains the User-agent. + * + * @param string $key + * @param null $userAgent deprecated + * @return mixed + */ private function matchUAAgainstKey($key, $userAgent = null){ // Make the keys lowercase so we can match: isIphone(), isiPhone(), isiphone(), etc. @@ -272,16 +479,18 @@ class Mobile_Detect { if(array_key_exists($key, $_rules)){ if(empty($_rules[$key])){ return null; } - return (bool)preg_match('/'.$_rules[$key].'/is', (!empty($userAgent) ? $userAgent : $this->userAgent)); + return $this->match($_rules[$key], $userAgent); } return false; } - + /** * Check if the device is mobile. * Returns true if any type of mobile device detected, including special ones + * @param null $userAgent deprecated + * @param null $httpHeaders deprecated * @return bool */ public function isMobile($userAgent = null, $httpHeaders = null) { @@ -289,7 +498,7 @@ class Mobile_Detect { if($httpHeaders){ $this->setHttpHeaders($httpHeaders); } if($userAgent){ $this->setUserAgent($userAgent); } - $this->setMobileDetectionRules(); + $this->setDetectionType('mobile'); if ($this->checkHttpHeadersForMobile()) { return true; @@ -297,17 +506,22 @@ class Mobile_Detect { return $this->matchDetectionRulesAgainstUA(); } - } - + } + /** * Check if the device is a tablet. * Return true if any type of tablet device is detected. - * @return boolean + * + * @param null $userAgent deprecated + * @param null $httpHeaders deprecated + * @return bool */ public function isTablet($userAgent = null, $httpHeaders = null) { + $this->setDetectionType('mobile'); + foreach($this->tabletDevices as $_regex){ - if(preg_match('/'.$_regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent))){ + if($this->match($_regex, $userAgent)){ return true; } } @@ -322,20 +536,238 @@ class Mobile_Detect { * @todo: The httpHeaders part is not yet used. * * @param $key - * @param string $userAgent - * @param string $httpHeaders + * @param string $userAgent deprecated + * @param string $httpHeaders deprecated * @return bool|int|null */ public function is($key, $userAgent = null, $httpHeaders = null){ - $this->setHttpHeaders($httpHeaders); - $this->setUserAgent($userAgent); - $this->setMobileDetectionRulesExtended(); + // Set the UA and HTTP headers only if needed (eg. batch mode). + if($httpHeaders) $this->setHttpHeaders($httpHeaders); + if($userAgent) $this->setUserAgent($userAgent); + + $this->setDetectionType('extended'); return $this->matchUAAgainstKey($key); } - - -} \ No newline at end of file + + public function getOperatingSystems(){ + + return $this->operatingSystems; + + } + + /** + * Some detection rules are relative (not standard), + * because of the diversity of devices, vendors and + * their conventions in representing the User-Agent or + * the HTTP headers. + * + * This method will be used to check custom regexes against + * the User-Agent string. + * + * @param $regex + * @param string $userAgent + * @return bool + * + * @todo: search in the HTTP headers too. + */ + function match($regex, $userAgent=null){ + + // Escape the special character which is the delimiter. + $regex = str_replace('/', '\/', $regex); + + return (bool)preg_match('/'.$regex.'/is', (!empty($userAgent) ? $userAgent : $this->userAgent)); + + } + + /** + * Get the properties array. + * @return array + */ + function getProperties(){ + + return $this->properties; + + } + + /** + * Prepare the version number. + * + * @param $ver + * @return int + */ + function prepareVersionNo($ver){ + + $ver = str_replace(array('_', ' ', '/'), array('.', '.', '.'), $ver); + $arrVer = explode('.', $ver, 2); + $arrVer[1] = @str_replace('.', '', $arrVer[1]); // @todo: treat strings versions. + $ver = (float)implode('.', $arrVer); + + return $ver; + + } + + /** + * Check the version of the given property in the User-Agent. + * Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31) + * + * @param string $propertyName + * @return mixed $version + */ + function version($propertyName){ + + $properties = $this->getProperties(); + + // If the property is found in the User-Agent then move to the next step. + if(stripos($this->userAgent, $propertyName)!==false){ + + // Prepare the pattern to be matched. + // Make sure we always deal with an array (string is converted). + $properties[$propertyName] = (array)$properties[$propertyName]; + + foreach($properties[$propertyName] as $propertyMatchString){ + + $propertyPattern = str_replace('[VER]', self::VER, $propertyMatchString); + + // Escape the special character which is the delimiter. + $propertyPattern = str_replace('/', '\/', $propertyPattern); + + // Identify and extract the version. + preg_match('/'.$propertyPattern.'/is', $this->userAgent, $match); + + if(!empty($match[1])){ + $version = $this->prepareVersionNo($match[1]); + return $version; + } + + } + + return 0; + + } + + return false; + + } + + function mobileGrade(){ + + $isMobile = $this->isMobile(); + + if( + // Apple iOS 3.2-5.1 - Tested on the original iPad (4.3 / 5.0), iPad 2 (4.3), iPad 3 (5.1), original iPhone (3.1), iPhone 3 (3.2), 3GS (4.3), 4 (4.3 / 5.0), and 4S (5.1) + $this->version('iPad')>=4.3 || + $this->version('iPhone')>=3.1 || + $this->version('iPod')>=3.1 || + + // Android 2.1-2.3 - Tested on the HTC Incredible (2.2), original Droid (2.2), HTC Aria (2.1), Google Nexus S (2.3). Functional on 1.5 & 1.6 but performance may be sluggish, tested on Google G1 (1.5) + // Android 3.1 (Honeycomb) - Tested on the Samsung Galaxy Tab 10.1 and Motorola XOOM + // Android 4.0 (ICS) - Tested on a Galaxy Nexus. Note: transition performance can be poor on upgraded devices + // Android 4.1 (Jelly Bean) - Tested on a Galaxy Nexus and Galaxy 7 + ( $this->version('Android')>2.1 && $this->is('Webkit') ) || + + // Windows Phone 7-7.5 - Tested on the HTC Surround (7.0) HTC Trophy (7.5), LG-E900 (7.5), Nokia Lumia 800 + $this->version('Windows Phone OS')>=7.0 || + + // Blackberry 7 - Tested on BlackBerry® Torch 9810 + // Blackberry 6.0 - Tested on the Torch 9800 and Style 9670 + $this->version('BlackBerry')>=6.0 || + // Blackberry Playbook (1.0-2.0) - Tested on PlayBook + $this->match('Playbook.*Tablet') || + + // Palm WebOS (1.4-2.0) - Tested on the Palm Pixi (1.4), Pre (1.4), Pre 2 (2.0) + ( $this->version('webOS')>=1.4 && $this->match('Palm|Pre|Pixi') ) || + // Palm WebOS 3.0 - Tested on HP TouchPad + $this->match('hp.*TouchPad') || + + // Firefox Mobile (12 Beta) - Tested on Android 2.3 device + ( $this->is('Firefox') && $this->version('Firefox')>=12 ) || + + // Chrome for Android - Tested on Android 4.0, 4.1 device + ( $this->is('Chrome') && $this->is('AndroidOS') && $this->version('Android')>=4.0 ) || + + // Skyfire 4.1 - Tested on Android 2.3 device + ( $this->is('Skyfire') && $this->version('Skyfire')>=4.1 && $this->is('AndroidOS') && $this->version('Android')>=2.3 ) || + + // Opera Mobile 11.5-12: Tested on Android 2.3 + ( $this->is('Opera') && $this->version('Opera Mobi')>11 && $this->is('AndroidOS') ) || + + // Meego 1.2 - Tested on Nokia 950 and N9 + $this->is('MeeGoOS') || + + // Tizen (pre-release) - Tested on early hardware + $this->is('Tizen') || + + // Samsung Bada 2.0 - Tested on a Samsung Wave 3, Dolphin browser + // @todo: more tests here! + $this->is('Dolfin') && $this->version('Bada')>=2.0 || + + // UC Browser - Tested on Android 2.3 device + ( ($this->is('UC Browser') || $this->is('Dolfin')) && $this->version('Android')>=2.3 ) || + + // Kindle 3 and Fire - Tested on the built-in WebKit browser for each + ( $this->match('Kindle Fire') || + $this->is('Kindle') && $this->version('Kindle')>=3.0 ) || + + // Nook Color 1.4.1 - Tested on original Nook Color, not Nook Tablet + $this->is('AndroidOS') && $this->is('NookTablet') || + + // Chrome Desktop 11-21 - Tested on OS X 10.7 and Windows 7 + $this->version('Chrome')>=11 && !$isMobile || + + // Safari Desktop 4-5 - Tested on OS X 10.7 and Windows 7 + $this->version('Safari')>=5.0 && !$isMobile || + + // Firefox Desktop 4-13 - Tested on OS X 10.7 and Windows 7 + $this->version('Firefox')>=4.0 && !$isMobile || + + // Internet Explorer 7-9 - Tested on Windows XP, Vista and 7 + $this->version('MSIE')>=7.0 && !$isMobile || + + // Opera Desktop 10-12 - Tested on OS X 10.7 and Windows 7 + // @reference: http://my.opera.com/community/openweb/idopera/ + $this->version('Opera')>=10 && !$isMobile + + + ){ + return 'A'; + } + + if( + // Blackberry 5.0: Tested on the Storm 2 9550, Bold 9770 + $this->version('BlackBerry')>=5 && $this->version('BlackBerry')<6 || + + //Opera Mini (5.0-6.5) - Tested on iOS 3.2/4.3 and Android 2.3 + ( $this->version('Opera Mini')>=5.0 && $this->version('Opera Mini')<=6.5 && + ($this->version('Android')>=2.3 || $this->is('iOS')) ) || + + // Nokia Symbian^3 - Tested on Nokia N8 (Symbian^3), C7 (Symbian^3), also works on N97 (Symbian^1) + $this->match('NokiaN8|NokiaC7|N97.*Series60|Symbian/3') || + + // @todo: report this (tested on Nokia N71) + $this->version('Opera Mobi')>=11 && $this->is('SymbianOS') + + ){ + return 'B'; + } + + if( + // Blackberry 4.x - Tested on the Curve 8330 + $this->version('BlackBerry')<5.0 || + // Windows Mobile - Tested on the HTC Leo (WinMo 5.2) + $this->match('MSIEMobile|Windows CE.*Mobile') || $this->version('Windows Mobile')<=5.2 + + + ){ + + return 'C'; + + } + + // All older smartphone platforms and featurephones - Any device that doesn't support media queries will receive the basic, C grade experience + return 'C'; + } +} diff --git a/tools/mobile_Detect/index.php b/tools/mobile_Detect/index.php index 4c1db9e4c..5ca842ada 100644 --- a/tools/mobile_Detect/index.php +++ b/tools/mobile_Detect/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/parser_sql/index.php b/tools/parser_sql/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/parser_sql/index.php +++ b/tools/parser_sql/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/pclzip/index.php b/tools/pclzip/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/pclzip/index.php +++ b/tools/pclzip/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/pear/index.php b/tools/pear/index.php index ec45b2dfe..f42f03e4d 100644 --- a/tools/pear/index.php +++ b/tools/pear/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/pear_xml_parser/Parser/index.php b/tools/pear_xml_parser/Parser/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/pear_xml_parser/Parser/index.php +++ b/tools/pear_xml_parser/Parser/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/pear_xml_parser/index.php b/tools/pear_xml_parser/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/pear_xml_parser/index.php +++ b/tools/pear_xml_parser/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/profiling/Controller.php b/tools/profiling/Controller.php index ec2d42cbf..1b55dd0dd 100644 --- a/tools/profiling/Controller.php +++ b/tools/profiling/Controller.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -387,7 +387,7 @@ abstract class Controller extends ControllerCore uasort($queries, 'prestashop_querytime_sort'); foreach ($queries as $data) { - echo $hr.'getTimeColor($data['time'] * 1000).'>'.round($data['time'] * 1000, 3).' ms '.$data['query'].'
    in '.$data['file'].':'.$data['line'].'
    '; + echo $hr.'getTimeColor($data['time'] * 1000).'>'.round($data['time'] * 1000, 3).' ms '.htmlspecialchars($data['query'], ENT_NOQUOTES, 'utf-8', false).'
    in '.$data['file'].':'.$data['line'].'
    '; if (preg_match('/^\s*select\s+/i', $data['query'])) { $explain = Db::getInstance()->executeS('explain '.$data['query']); diff --git a/tools/profiling/Db.php b/tools/profiling/Db.php index 273555816..77f8b0973 100644 --- a/tools/profiling/Db.php +++ b/tools/profiling/Db.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/profiling/Hook.php b/tools/profiling/Hook.php index 9572e0fbe..b5da985db 100644 --- a/tools/profiling/Hook.php +++ b/tools/profiling/Hook.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -43,11 +43,11 @@ class Hook extends HookCore return self::$hookMemoryUsage; } - public static function exec($hook_name, $hookArgs = array(), $id_module = null) + public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true) { $memoryUsage = memory_get_usage(); $t0 = microtime(true); - $result = parent::exec($hook_name, $hookArgs, $id_module); + $result = parent::exec($hook_name, $hook_args, $id_module, $array_return, $check_exceptions); self::$hookTime[$hook_name] = microtime(true) - $t0; self::$hookMemoryUsage[$hook_name] = memory_get_usage() - $memoryUsage; return $result; diff --git a/tools/profiling/ObjectModel.php b/tools/profiling/ObjectModel.php index af31ef0f9..fe80322c4 100644 --- a/tools/profiling/ObjectModel.php +++ b/tools/profiling/ObjectModel.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/override/classes/_Tools.php b/tools/profiling/Tools.php old mode 100755 new mode 100644 similarity index 98% rename from override/classes/_Tools.php rename to tools/profiling/Tools.php index 3d124d735..065b3eb23 --- a/override/classes/_Tools.php +++ b/tools/profiling/Tools.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ @@ -77,7 +77,7 @@ class Tools extends ToolsCore /** - * Redirect url wich allready PS_BASE_URI after 5 sec + * Redirect URLs already containing PS_BASE_URI after 5s * * @param string $url Desired URL */ diff --git a/tools/profiling/index.php b/tools/profiling/index.php index af0ec9eab..52b4e5c37 100644 --- a/tools/profiling/index.php +++ b/tools/profiling/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/smarty/Smarty.class.php b/tools/smarty/Smarty.class.php index b8a10c5d0..40532fc2a 100644 --- a/tools/smarty/Smarty.class.php +++ b/tools/smarty/Smarty.class.php @@ -2,7 +2,7 @@ /** * Project: Smarty: the PHP compiling template engine * File: Smarty.class.php - * SVN: $Id: Smarty.class.php 4551 2012-02-06 20:45:10Z rodneyrehm $ + * SVN: $Id: Smarty.class.php 4694 2013-01-13 21:13:14Z uwe.tews@googlemail.com $ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,7 +28,7 @@ * @author Uwe Tews * @author Rodney Rehm * @package Smarty - * @version 3.1.8 + * @version 3.1.13 */ /** @@ -57,7 +57,7 @@ if (!defined('SMARTY_PLUGINS_DIR')) { define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS); } if (!defined('SMARTY_MBSTRING')) { - define('SMARTY_MBSTRING', function_exists('mb_strlen')); + define('SMARTY_MBSTRING', function_exists('mb_split')); } if (!defined('SMARTY_RESOURCE_CHAR_SET')) { // UTF-8 can only be done properly when mbstring is available! @@ -113,7 +113,7 @@ class Smarty extends Smarty_Internal_TemplateBase { /** * smarty version */ - const SMARTY_VERSION = 'Smarty-3.1.8'; + const SMARTY_VERSION = 'Smarty-3.1.13'; /** * define variable scopes @@ -189,8 +189,12 @@ class Smarty extends Smarty_Internal_TemplateBase { * Flag denoting if PCRE should run in UTF-8 mode */ public static $_UTF8_MODIFIER = 'u'; - - + + /** + * Flag denoting if operating system is windows + */ + public static $_IS_WINDOWS = false; + /**#@+ * variables */ @@ -1277,7 +1281,7 @@ class Smarty extends Smarty_Internal_TemplateBase { } // plugin filename is expected to be: [type].[name].php $_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php"; - + $_stream_resolve_include_path = function_exists('stream_resolve_include_path'); // loop through plugin dirs and find the plugin @@ -1298,7 +1302,7 @@ class Smarty extends Smarty_Internal_TemplateBase { } else { $file = Smarty_Internal_Get_Include_Path::getIncludePath($file); } - + if ($file !== false) { require_once($file); return $file; @@ -1388,10 +1392,12 @@ class Smarty extends Smarty_Internal_TemplateBase { // add the SMARTY_DIR to the list of muted directories if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) { $smarty_dir = realpath(SMARTY_DIR); - Smarty::$_muted_directories[SMARTY_DIR] = array( - 'file' => $smarty_dir, - 'length' => strlen($smarty_dir), - ); + if ($smarty_dir !== false) { + Smarty::$_muted_directories[SMARTY_DIR] = array( + 'file' => $smarty_dir, + 'length' => strlen($smarty_dir), + ); + } } // walk the muted directories and test against $errfile @@ -1399,6 +1405,11 @@ class Smarty extends Smarty_Internal_TemplateBase { if (!$dir) { // resolve directory and length for speedy comparisons $file = realpath($key); + if ($file === false) { + // this directory does not exist, remove and skip it + unset(Smarty::$_muted_directories[$key]); + continue; + } $dir = array( 'file' => $file, 'length' => strlen($file), @@ -1464,6 +1475,9 @@ class Smarty extends Smarty_Internal_TemplateBase { } } +// Check if we're running on windows +Smarty::$_IS_WINDOWS = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; + // let PCRE (preg_*) treat strings as ISO-8859-1 if we're not dealing with UTF-8 if (Smarty::$_CHARSET !== 'UTF-8') { Smarty::$_UTF8_MODIFIER = ''; @@ -1474,6 +1488,10 @@ if (Smarty::$_CHARSET !== 'UTF-8') { * @package Smarty */ class SmartyException extends Exception { + public static $escape = true; + public function __construct($message) { + $this->message = self::$escape ? htmlentities($message) : $message; + } } /** @@ -1502,8 +1520,8 @@ function smartyAutoload($class) 'smarty_resource_recompiled' => true, ); - if (preg_match('/^[0-9a-z_-]+$/i', $_class) && !strncmp($_class, 'smarty_internal_', 16) || isset($_classes[$_class])) { - include SMARTY_SYSPLUGINS_DIR . $_class . '.php'; + if (!strncmp($_class, 'smarty_internal_', 16) || isset($_classes[$_class])) { + include SMARTY_SYSPLUGINS_DIR . $_class . '.php'; } } diff --git a/tools/smarty/index.php b/tools/smarty/index.php index 4c1db9e4c..5ca842ada 100644 --- a/tools/smarty/index.php +++ b/tools/smarty/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/smarty/plugins/function.html_checkboxes.php b/tools/smarty/plugins/function.html_checkboxes.php index fb9584bbd..1866bc2f3 100644 --- a/tools/smarty/plugins/function.html_checkboxes.php +++ b/tools/smarty/plugins/function.html_checkboxes.php @@ -116,6 +116,23 @@ function smarty_function_html_checkboxes($params, $template) case 'assign': break; + case 'strict': break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + default: if(!is_array($_val)) { $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"'; diff --git a/tools/smarty/plugins/function.html_options.php b/tools/smarty/plugins/function.html_options.php index 86266e269..68fa0524a 100644 --- a/tools/smarty/plugins/function.html_options.php +++ b/tools/smarty/plugins/function.html_options.php @@ -90,7 +90,24 @@ function smarty_function_html_options($params, $template) $selected = smarty_function_escape_special_chars((string) $_val); } break; - + + case 'strict': break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; @@ -150,6 +167,8 @@ function smarty_function_html_options_optoutput($key, $value, $selected, $id, $c trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE); return ''; } + } else { + $value = smarty_function_escape_special_chars((string) $value); } $_html_result .= $_html_class . $_html_id . '>' . $value . '' . "\n"; $idx++; diff --git a/tools/smarty/plugins/function.html_radios.php b/tools/smarty/plugins/function.html_radios.php index 7c830724a..a2741f68f 100644 --- a/tools/smarty/plugins/function.html_radios.php +++ b/tools/smarty/plugins/function.html_radios.php @@ -102,6 +102,23 @@ function smarty_function_html_radios($params, $template) case 'assign': break; + case 'strict': break; + + case 'disabled': + case 'readonly': + if (!empty($params['strict'])) { + if (!is_scalar($_val)) { + trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE); + } + + if ($_val === true || $_val === $_key) { + $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"'; + } + + break; + } + // omit break; to fall through! + default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; diff --git a/tools/smarty/plugins/index.php b/tools/smarty/plugins/index.php index 04675e9e1..5e4749107 100644 --- a/tools/smarty/plugins/index.php +++ b/tools/smarty/plugins/index.php @@ -1,6 +1,6 @@ -* @copyright 2007-2012 PrestaShop SA +* @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */ diff --git a/tools/smarty/plugins/modifier.date_format.php b/tools/smarty/plugins/modifier.date_format.php index 3cca7d395..f3eaba057 100644 --- a/tools/smarty/plugins/modifier.date_format.php +++ b/tools/smarty/plugins/modifier.date_format.php @@ -35,7 +35,7 @@ function smarty_modifier_date_format($string, $format=null, $default_date='', $f * Include the {@link shared.make_timestamp.php} plugin */ require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php'); - if ($string != '') { + if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') { $timestamp = smarty_make_timestamp($string); } elseif ($default_date != '') { $timestamp = smarty_make_timestamp($default_date); diff --git a/tools/smarty/plugins/modifier.escape.php b/tools/smarty/plugins/modifier.escape.php index 680bcfe3f..70876293d 100644 --- a/tools/smarty/plugins/modifier.escape.php +++ b/tools/smarty/plugins/modifier.escape.php @@ -21,38 +21,76 @@ * @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities() * @return string escaped input string */ -function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true) +/* PrestaShop +change double_encode to false by default +function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true) +*/ +function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = false) +/* END */ { + static $_double_encode = null; + if ($_double_encode === null) { + $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); + } + if (!$char_set) { $char_set = Smarty::$_CHARSET; } switch ($esc_type) { case 'html': -/* PrestaShop - return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); - */ - return htmlspecialchars($string, ENT_QUOTES, $char_set); - /* END */ + if ($_double_encode) { + // php >=5.3.2 - go native + return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); + } else { + if ($double_encode) { + // php <5.2.3 - only handle double encoding + return htmlspecialchars($string, ENT_QUOTES, $char_set); + } else { + // php <5.2.3 - prevent double encoding + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlspecialchars($string, ENT_QUOTES, $char_set); + $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); + return $string; + } + } case 'htmlall': if (Smarty::$_MBSTRING) { // mb_convert_encoding ignores htmlspecialchars() - /* PrestaShop - return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); - */ - return htmlspecialchars($string, ENT_QUOTES, $char_set); - /* END */ + if ($_double_encode) { + // php >=5.3.2 - go native + $string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode); + } else { + if ($double_encode) { + // php <5.2.3 - only handle double encoding + $string = htmlspecialchars($string, ENT_QUOTES, $char_set); + } else { + // php <5.2.3 - prevent double encoding + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlspecialchars($string, ENT_QUOTES, $char_set); + $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); + return $string; + } + } + // htmlentities() won't convert everything, so use mb_convert_encoding return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set); } // no MBString fallback - /* PrestaShop - return htmlentities($string, ENT_QUOTES, $char_set, $double_encode); - */ - return htmlentities($string, ENT_QUOTES, $char_set); - /* END */ + if ($_double_encode) { + return htmlentities($string, ENT_QUOTES, $char_set, $double_encode); + } else { + if ($double_encode) { + return htmlentities($string, ENT_QUOTES, $char_set); + } else { + $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string); + $string = htmlentities($string, ENT_QUOTES, $char_set); + $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string); + return $string; + } + } case 'url': return rawurlencode($string); @@ -152,4 +190,4 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $ } } -?> \ No newline at end of file +?> diff --git a/tools/smarty/plugins/modifiercompiler.escape.php b/tools/smarty/plugins/modifiercompiler.escape.php index b4f1f6638..f50028bd9 100644 --- a/tools/smarty/plugins/modifiercompiler.escape.php +++ b/tools/smarty/plugins/modifiercompiler.escape.php @@ -25,6 +25,11 @@ require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' ); */ function smarty_modifiercompiler_escape($params, $compiler) { + static $_double_encode = null; + if ($_double_encode === null) { + $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>='); + } + try { $esc_type = smarty_literal_compiler_param($params, 1, 'html'); $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET); @@ -36,48 +41,56 @@ function smarty_modifiercompiler_escape($params, $compiler) switch ($esc_type) { case 'html': - /* PrestaShop - return 'htmlspecialchars(' - . $params[0] .', ENT_QUOTES, ' - . var_export($char_set, true) . ', ' - . var_export($double_encode, true) . ')'; - */ - return 'htmlspecialchars(' - . $params[0] .', ENT_QUOTES, ' - . var_export($char_set, true) . ')'; - /* END */ - - case 'htmlall': - /* PrestaShop - if (Smarty::$_MBSTRING) { - return 'mb_convert_encoding(htmlspecialchars(' + if ($_double_encode) { + return 'htmlspecialchars(' . $params[0] .', ENT_QUOTES, ' . var_export($char_set, true) . ', ' - . var_export($double_encode, true) - . '), "HTML-ENTITIES", ' - . var_export($char_set, true) . ')'; - } - */ - if (Smarty::$_MBSTRING) { - return 'mb_convert_encoding(htmlspecialchars(' + . var_export($double_encode, true) . ')'; + } else if ($double_encode) { + return 'htmlspecialchars(' . $params[0] .', ENT_QUOTES, ' - . var_export($char_set, true) - . '), "HTML-ENTITIES", ' . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } + + case 'htmlall': + if (Smarty::$_MBSTRING) { + if ($_double_encode) { + // php >=5.2.3 - go native + return 'mb_convert_encoding(htmlspecialchars(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ', ' + . var_export($double_encode, true) + . '), "HTML-ENTITIES", ' + . var_export($char_set, true) . ')'; + } else if ($double_encode) { + // php <5.2.3 - only handle double encoding + return 'mb_convert_encoding(htmlspecialchars(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) + . '), "HTML-ENTITIES", ' + . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } } - /* END */ // no MBString fallback - /* PrestaShop - return 'htmlentities(' - . $params[0] .', ENT_QUOTES, ' - . var_export($char_set, true) . ', ' - . var_export($double_encode, true) . ')'; - */ - return 'htmlentities(' - . $params[0] .', ENT_QUOTES, ' - . var_export($char_set, true) . ')'; - /* END */ + if ($_double_encode) { + // php >=5.2.3 - go native + return 'htmlentities(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ', ' + . var_export($double_encode, true) . ')'; + } else if ($double_encode) { + // php <5.2.3 - only handle double encoding + return 'htmlentities(' + . $params[0] .', ENT_QUOTES, ' + . var_export($char_set, true) . ')'; + } else { + // fall back to modifier.escape.php + } case 'url': return 'rawurlencode(' . $params[0] . ')'; diff --git a/tools/smarty/plugins/outputfilter.trimwhitespace.php b/tools/smarty/plugins/outputfilter.trimwhitespace.php index 31a75557c..87cf8c781 100644 --- a/tools/smarty/plugins/outputfilter.trimwhitespace.php +++ b/tools/smarty/plugins/outputfilter.trimwhitespace.php @@ -40,6 +40,7 @@ function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $s } // Strip all HTML-Comments + // yes, even the ones in