[+] MO : CloudCache module

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14929 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
jObregon
2012-04-26 16:39:43 +00:00
parent e9d8e968b8
commit fac1566a5f
31 changed files with 6776 additions and 0 deletions

View File

@@ -0,0 +1,221 @@
<?php
/*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
*
* International Registered Trademark & Property of PrestaShop SA
*/
// Retro 1.3, 'class_exists' cause problem with autoload...
if (version_compare(_PS_VERSION_, '1.4', '<'))
{
// Not exist for 1.3
class Shop extends ObjectModel
{
public $id = 1;
public $id_group_shop = 1;
public function __construct()
{
}
public static function getShops()
{
return array(
array('id_shop' => 1, 'name' => 'Default shop')
);
}
public static function getCurrentShop()
{
return 1;
}
}
class Logger
{
public static function AddLog($message, $severity = 2)
{
$fp = fopen(dirname(__FILE__).'/../logs.txt', 'a+');
fwrite($fp, '['.(int)$severity.'] '.Tools::safeOutput($message));
fclose($fp);
}
}
}
// Not exist for 1.3 and 1.4
class Context
{
/**
* @var Context
*/
protected static $instance;
/**
* @var Cart
*/
public $cart;
/**
* @var Customer
*/
public $customer;
/**
* @var Cookie
*/
public $cookie;
/**
* @var Link
*/
public $link;
/**
* @var Country
*/
public $country;
/**
* @var Employee
*/
public $employee;
/**
* @var Controller
*/
public $controller;
/**
* @var Language
*/
public $language;
/**
* @var Currency
*/
public $currency;
/**
* @var AdminTab
*/
public $tab;
/**
* @var Shop
*/
public $shop;
/**
* @var Smarty
*/
public $smarty;
public function __construct()
{
global $cookie, $cart, $smarty, $link;
$this->tab = null;
if ($cookie)
$this->cookie = $cookie;
$this->cart = $cart;
$this->smarty = $smarty;
$this->link = $link;
$this->controller = new ControllerBackwardModule();
if ($cookie)
{
$this->currency = new Currency((int)$cookie->id_currency);
$this->language = new Language((int)$cookie->id_lang);
$this->country = new Country((int)$cookie->id_country);
$this->customer = new Customer((int)$cookie->id_customer);
$this->employee = new Employee((int)$cookie->id_employee);
}
$this->shop = new ShopBackwardModule();
}
/**
* Get a singleton context
*
* @return Context
*/
public static function getContext()
{
if (!isset(self::$instance))
self::$instance = new Context();
return self::$instance;
}
/**
* Clone current context
*
* @return Context
*/
public function cloneContext()
{
return clone($this);
}
/**
* @return int Shop context type (Shop::CONTEXT_ALL, etc.)
*/
public static function shop()
{
if (!self::$instance->shop->getContextType())
return ShopBackwardModule::CONTEXT_ALL;
return self::$instance->shop->getContextType();
}
}
/**
* Class Shop for Backward compatibility
*/
class ShopBackwardModule extends Shop
{
const CONTEXT_ALL = 1;
public $id = 1;
public $id_group_shop = 1;
public function getContextType()
{
return ShopBackwardModule::CONTEXT_ALL;
}
// Simulate shop for 1.3 / 1.4
public function getID()
{
return 1;
}
}
/**
* Class Controller for a Backward compatibility
* Allow to use method declared in 1.5
*/
class ControllerBackwardModule
{
/**
* @param $js_uri
* @return void
*/
public function addJS($js_uri)
{
Tools::addJS($js_uri);
}
/**
* @param $css_uri
* @param string $css_media_type
* @return void
*/
public function addCSS($css_uri, $css_media_type = 'all')
{
Tools::addCSS($css_uri, $css_media_type);
}
}

View File

@@ -0,0 +1,24 @@
<?php
/*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
*
* International Registered Trademark & Property of PrestaShop SA
*/
/**
* Backward function compatibility
* Need to be called for each module in 1.4
*/
// Get out if the context is already defined
if (!in_array('Context', get_declared_classes()))
require_once(dirname(__FILE__).'/Context.php');
if (!isset($this) || isset($this->context))
return;
$this->context = Context::getContext();
$this->smarty = $this->context->smarty;

View File

@@ -0,0 +1,18 @@
<?php
/*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
*
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,860 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
// Security
if (!defined('_PS_VERSION_'))
exit;
if (file_exists(dirname(__FILE__).'/lib/CloudCacheApi.php'))
require(dirname(__FILE__).'/lib/CloudCacheApi.php');
elseif (file_exists(dirname(__FILE__).'/../modules/cloudcache/lib/CloudCacheApi.php'))
require(dirname(__FILE__).'/../modules/cloudcache/lib/CloudCacheApi.php');
define('CLOUDCACHE_API_PORT', 80);
define('CLOUDCACHE_API_HTTP_METHOD', 'http11');
define('CLOUDCACHE_API_URI', '/xmlrpc/');
define('CLOUDCACHE_API_URL', 'api.netdna.com');
define('CLOUDCACHE_API_ZONE_URL', 'netdna-cdn.com');
define('CLOUDCACHE_API_HASH_TYPE', 'sha256');
define('CLOUDCACHE_API_PULL_ZONE_TYPE', 1);
class CloudCache extends Module
{
/** @var _cipherTool Helper Object to encrypt API KEY */
private $_cipherTool;
/** @var _api Cloudcache Api Object */
private $_api;
/******************************************************************/
/** Construct Method **********************************************/
/******************************************************************/
public function __construct()
{
$this->name = 'cloudcache';
$this->tab = 'administration';
$this->version = '1.2';
$this->author = 'PrestaShop';
parent::__construct();
$this->displayName = $this->l('CloudCache');
$this->description = $this->l('Supercharge your Shop with the CloudCache.com Content Delivery Network (CDN).');
/* Backward compatibility */
require(_PS_MODULE_DIR_.$this->name.'/backward_compatibility/backward.php');
$this->context->smarty->assign('base_dir', __PS_BASE_URI__);
if (Configuration::get('PS_CIPHER_ALGORITHM'))
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
else
$this->_cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
$this->_api = new CloudcacheApi();
}
/**
* @brief Install/Uninstall Configuration variables
*
* @param install True for installation, false for uninstall
*
* @return Success or failure
*/
private function _setupConfigVariables($install = true)
{
$configVars = array(
'CLOUDCACHE_API_USER' => '',
'CLOUDCACHE_API_KEY' => '',
'CLOUDCACHE_API_COMPANY_ID' => '',
'CLOUDCACHE_API_ACTIVE' => 0,
);
$error = 0;
foreach ($configVars as $varName => $value)
if ($install)
$error += Configuration::updateValue($varName, $value) ? 0 : 1;
else
$error += Configuration::deleteByName($varName) ? 0 : 1;
return $error > 0 ? false : true;
}
private function _installOverride()
{
// Hash of the empty file in 1.5 => file name
$files = array('810f3fa83a88b5019be31d7b80db460d' => 'classes/Tools.php');
if (_PS_VERSION_ > '1.5')
$files['5b917f57038acb75714cf144c9043bb4'] = 'classes/controller/FrontController.php';
// Make sure the environment is OK
if (!is_dir(dirname(__FILE__).'/../../override/classes/'))
mkdir(dirname(__FILE__).'/../../override/classes/', 0777, true);
if (_PS_VERSION_ > '1.5' && !is_dir(dirname(__FILE__).'/../../override/classes/controller/'))
mkdir(dirname(__FILE__).'/../../override/classes/controller/', 0777);
$errors = array();
foreach ($files as $hash => $path)
{
if (file_exists(dirname(__FILE__).'/../../override/'.$path))
{
if (md5_file(dirname(__FILE__).'/../../override/'.$path) == $hash)
rename(dirname(__FILE__).'/../../override/'.$path, dirname(__FILE__).'/../../override/'.$path.'.origin.php');
elseif (md5_file(dirname(__FILE__).'/../../override/'.$path) == md5_file(dirname(__FILE__).'/override/'.$path))
continue ;
else
{
$errors[] = '/override/'.$path;
continue ;
}
}
copy(dirname(__FILE__).'/override/'.$path, dirname(__FILE__).'/../../override/'.$path);
}
if (count($errors))
die('<div class="conf warn">
<img src="../img/admin/warn2.png" alt="" title="" />'.
$this->l('The module was successfully installed (').
'<a href="?tab=AdminModules&configure=cloudcache&token='.Tools::getAdminTokenLite('AdminModules').'&tab_module=administration&module_name=cloudcache" style="color: blue;">'.$this->l('configure').'</a>'.
$this->l(') but the following file already exist. Please, merge the file manually.').'<br />'.
implode('<br />', $errors).
'</div>');
return true;
}
/******************************************************************/
/** Install / Uninstall Methods ***********************************/
/******************************************************************/
public function install()
{
// Setup config variable with 'install' flag on
if (!$this->_setupConfigVariables(true))
return false;
if (!parent::install() || !$this->registerHook('backOfficeTop'))
return false;
// Perform the sql install
include(dirname(__FILE__).'/sql/sql-install.php');
foreach ($sql as $s)
if (!Db::getInstance()->execute($s))
return false;
return $this->_installOverride();;
}
/**
* @brief Uninstall function
*
* @return Success or failure
*/
public function uninstall()
{
// Uninstall parent and unregister Configuration
if (!parent::uninstall())
return false;
// Unregister hook
if (!$this->unregisterHook('backOfficeTop'))
return false;
// Remove configuration variable with 'install' flag off
if (!$this->_setupConfigVariables(false))
return false;
// Uninstall SQL
include(dirname(__FILE__).'/sql/sql-uninstall.php');
foreach ($sql as $s)
if (!Db::getInstance()->execute($s))
return false;
return true;
}
/**
* @brief Check that everything is alright for Cloudcache usage.
*
* @return Array empty on success, filled with error messages on failure.
*/
private function _compatibilityCheck()
{
// Compatibility check
$messages = array();
if (Configuration::get('PS_CSS_THEME_CACHE') ||
Configuration::get('PS_JS_THEME_CACHE') ||
Configuration::get('PS_HTML_THEME_COMPRESSION') ||
Configuration::get('PS_JS_HTML_THEME_COMPRESSION') ||
Configuration::get('PS_HIGH_HTML_THEME_COMPRESSION'))
$messages[] = $this->l('In order to succesfully use Cloudcache, please fix the following:');
if (Configuration::get('PS_CSS_THEME_CACHE'))
$messages[] = $this->l('Make sure you check "Keep CSS as original"');
if (Configuration::get('PS_JS_THEME_CACHE'))
$messages[] = $this->l('Make sure you check "Keep JavaScript as original"');
if (Configuration::get('PS_HTML_THEME_COMPRESSION'))
$messages[] = $this->l('Make sure you check "Keep HTML as original"');
if (Configuration::get('PS_JS_HTML_THEME_COMPRESSION'))
$messages[] = $this->l('Make sure you check "Keep inline JavaScript in HTML as original"');
if (Configuration::get('PS_HIGH_HTML_THEME_COMPRESSION'))
$messages[] = $this->l('Make sure you check "Keep W3C validation"');
if (!extension_loaded('curl'))
$messages[] = $this->l('You should ask your hosting provider to enable CURL extension in PHP (php.ini) for Cloudcache module to work.');
// If there is any compatibility issue, just deactivate everything
if (count($messages))
Configuration::updateValue('CLOUDCACHE_API_ACTIVE', 0);
return $messages;
}
/**
* @brief hookBackOfficeTop Implementation.
*
* Hook that allow to add script anywhere in the backoffice.
*
* @return Render to display
*/
public function hookBackOfficeTop()
{
$this->context->smarty->assign('isModuleActive', $this->active);
$this->context->smarty->assign('adminToken', Tools::getAdminTokenLite('AdminModules'));
$messages = $this->_compatibilityCheck();
if (count($messages))
$this->context->smarty->assign('compatibilityIssues', $messages);
return $this->display(__FILE__, 'views/backOfficeTop.tpl');
}
/**
* @brief Empty all tables of the module.
*/
private function _clearTables()
{
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'cloudcache_zone` WHERE `id_shop` = '.(int)$this->context->shop->id);
}
private function _getCouponUrl()
{
$curLang = $this->context->cookie->id_lang;
// $prestaBaseUrl = 'http://www.prestashop.com/modules/cloudcache.png?source='.urlencode($_SERVER['HTTP_HOST']);
$prestaBaseUrl = __PS_BASE_URI__.'modules/cloudcache/coupon.php?lang='.$curLang.'&source='.urlencode($_SERVER['HTTP_HOST']);
if (Configuration::get('CLOUDCACHE_API_ACTIVE'))
return $prestaBaseUrl.'&userId='.((int)Configuration::get('CLOUDCACHE_API_USER')).
'&companyId='.urlencode(Configuration::get('CLOUDCACHE_API_COMPANY_ID'));
return $prestaBaseUrl;
}
/**
* @brief Main Form Method
*
* @return Rendered form
*/
public function getContent()
{
if (Tools::isSubmit('SubmitCloudcacheSettings'))
{
// If we change the credentials, we deactivate the module
Configuration::updateValue('CLOUDCACHE_API_ACTIVE', 0);
// And clear the local cache for the zones
$this->_clearTables();
Configuration::updateValue('CLOUDCACHE_API_USER',
Tools::getValue('cloudcache_api_user'));
Configuration::updateValue('CLOUDCACHE_API_COMPANY_ID',
Tools::getValue('cloudcache_api_company_id'));
Configuration::updateValue('CLOUDCACHE_API_KEY',
$this->_cipherTool->encrypt(Tools::getValue('cloudcache_api_key')));
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation());
}
elseif (Tools::isSubmit('SubmitCloudcacheTestConnection'))
$connectionTestResult = $this->_testConnection();
elseif (Tools::isSubmit('SubmitCloudcacheAdd_zone'))
{
// Check http[s]
if (substr(Tools::getValue('origin'), 0, 7) != 'http://' &&
substr(Tools::getValue('origin'), 0, 8) != 'https://')
$origin = 'http://'.Tools::getValue('origin');
else
$origin = Tools::getValue('origin');
if (substr(Tools::getValue('vanity_domain'), 0, 7) == 'http://' ||
substr(Tools::getValue('vanity_domain'), 0, 8) == 'https://')
$vanity = substr(Tools::getValue('vanity_domain'), strpos(':') + 3);
else
$vanity = Tools::getValue('vanity_domain');
$zone_info = array(
'name' => Tools::getValue('name'),
'origin' => $origin,
'vanity_domain' => $vanity,
'label' => Tools::getValue('label'),
'compress' => Tools::getValue('compress'),
);
$action = $this->createZone(Tools::getValue('type'), $zone_info);
if (is_array($action))
{
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cloudcache_zone` SET
`name` = \''.pSQL($_POST['name']).'\',
`origin` = \''.pSQL($_POST['origin']).'\',
`compress` = \''.(isset($_POST['compress']) ? 1: 0).'\',
`label` = \''.pSQL($_POST['label']).'\',
`file_type` = \''.pSQL(CLOUDCACHE_FILE_TYPE_ALL).'\',
`cdn_url` = \''.($_POST['vanity_domain'] ? pSQL($_POST['vanity_domain']) : pSQL($_POST['name'].'.'.Configuration::get('CLOUDCACHE_API_COMPANY_ID').'.'.CLOUDCACHE_API_ZONE_URL)).'\'
WHERE `id_zone` = '.(int)$action['id']);
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Zone added.')));
}
else
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Error adding the zone: ').' '.pSQL($action), 'error'));
}
elseif (Tools::isSubmit('SubmitCloudcacheSync'))
{
$action = $this->_syncZonesWithServer('all');
if (is_array($action))
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('All zones were synced.')));
else
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Error syncing zones: ').' '.pSQL($action), 'error'));
}
elseif (Tools::isSubmit('SubmitCloudcacheClearAllCache'))
{
$error = false;
foreach (Db::getInstance()->ExecuteS('SELECT `id_zone`, `zone_type`, `name` FROM `'._DB_PREFIX_.'cloudcache_zone` WHERE `id_shop` = '.(int)$this->context->shop->id.' AND `id_shop` = '.(int)$this->context->shop->id) as $zone)
if (!$this->_api->cachePurgeAll('cache', $zone['id_zone']))
{
$error = true;
break;
}
if (!$error)
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('The cache was purged for all zones.')));
else
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Error purging cache for all zones.'), 'error'));
}
elseif (Tools::isSubmit('SubmitCloudcacheClearZoneCache'))
{
$zoneName = Db::getInstance()->ExecuteS('SELECT `name` FROM '._DB_PREFIX_.'cloudcache_zone
WHERE `id_zone` = '.(int)Tools::getValue('id_zone').' AND `id_shop` = '.(int)$this->context->shop->id);
if ($this->_api->cachePurgeAll('cache', Tools::getValue('id_zone')))
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('The cache was purged for zone:').' '.Tools::safeOutput($zoneName[0]['name'])));
else
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Error purging cache for zone:').' '.Tools::safeOutput($zoneName[0]['name']), 'error'));
}
elseif (Tools::isSubmit('SubmitCloudcacheEditZoneAction')) // display the form to edit the zone
{
// Get info for current zone
$zone_info = Db::getInstance()->getRow('SELECT `id_zone`, `name`, `origin`, `compress`, `label`,
`cdn_url`, `bw_yesterday`, `bw_last_week`, `bw_last_month`,
`file_type`, `zone_type`
FROM `'._DB_PREFIX_.'cloudcache_zone`
WHERE `id_zone` = '.(int)Tools::getValue('id_zone').' AND `id_shop` = '.(int)$this->context->shop->id);
// Clean $zone_info before sending to smarty
$zone_info_clean = array();
foreach ($zone_info as $key => $z)
$zone_info_clean[$key] = pSQL($z);
$this->context->smarty->assign('edit_zone_info', $zone_info_clean);
}
elseif (Tools::isSubmit('SubmitCloudcacheEdit_zone')) // save the changes on the edited zone
{
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cloudcache_zone` SET
`name` = \''.pSQL($_POST['name']).'\',
`origin` = \''.pSQL($_POST['origin']).'\',
`compress` = \''.(isset($_POST['compress']) ? 1: 0).'\',
`label` = \''.pSQL($_POST['label']).'\',
`cdn_url` = \''.pSQL($_POST['vanity_domain']).'\',
`file_type` = \''.pSQL($_POST['file_type']).'\'
WHERE `id_zone` = '.(int)Tools::getValue('id_zone'));
$zone_info = array('id_zone' => (int)Tools::getValue('id_zone'),
'name' => Tools::getValue('name'),
'origin' => Tools::getValue('origin'),
'vanity_domain' => Tools::getValue('vanity_domain'),
'label' => Tools::getValue('label'),
'compress' => (bool)Tools::getValue('compress'),
'file_type' => Tools::getValue('file_type'));
if (!$this->updateZone(Tools::getValue('type'), $zone_info)) // 0 : good | 1 : bad
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('The following zone was updated:').' '.pSQL(Tools::getValue('name'))));
else
$this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Error updating zone:').' '.pSQL(Tools::getValue('name')), 'error'));
}
$confValues = Configuration::getMultiple(array(
'CLOUDCACHE_API_USER',
'CLOUDCACHE_API_KEY',
'CLOUDCACHE_API_COMPANY_ID'));
// Set the smarty env
$this->context->smarty->assign('serverRequestUri',
Tools::safeOutput($_SERVER['REQUEST_URI']));
$this->context->smarty->assign('displayName',
Tools::safeOutput($this->displayName));
if (isset($connectionTestResult))
$this->context->smarty->assign('connectionTestResult',
$connectionTestResult);
if (isset($confValues['CLOUDCACHE_API_COMPANY_ID']))
$this->context->smarty->assign('companyId',
Tools::safeOutput($confValues['CLOUDCACHE_API_COMPANY_ID']));
if (isset($confValues['CLOUDCACHE_API_USER']))
$this->context->smarty->assign('apiUser',
Tools::safeOutput($confValues['CLOUDCACHE_API_USER']));
$this->context->smarty->assign('apiKey',
Tools::safeOutput($this->_cipherTool->decrypt($confValues['CLOUDCACHE_API_KEY'])));
$messages = $this->_compatibilityCheck();
if (count($messages))
$this->context->smarty->assign('compatibilityIssues', $messages);
$this->context->smarty->assign('allAvailableZones', $this->_api->getAvailableNamespaces(true));
$this->context->smarty->assign('prepaidBandwith', $this->getPrepaidBandwidth());
// Get the zones
//$zones = array('zone2' => array('name' => '','type' => 'css'));
$zones = array();
if (Configuration::get('CLOUDCACHE_API_USER'))
$zones = $this->getZones('pullzone');
// display the form
$this->context->smarty->assign('apiActive', Configuration::get('CLOUDCACHE_API_ACTIVE'));
$this->context->smarty->assign('zones', $zones);
$this->context->smarty->assign('couponUrl', $this->_getCouponUrl());
$this->context->smarty->assign('defaultOriginServerURL', (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').Configuration::get('PS_SHOP_DOMAIN'));
if (isset($_GET['id_tab']))
$this->context->smarty->assign('cloudcache_id_tab', (int)$_GET['id_tab']);
$this->context->smarty->assign('cloudcache_tracking', 'http://www.prestashop.com/modules/'.$this->name.'.png?url_site='.Tools::safeOutput($_SERVER['SERVER_NAME']).'&id_lang='.$this->context->cookie->id_lang);
return $this->display(__FILE__, 'views/content2.tpl');
}
/**
* @brief Test the conenction to Cloudcache and the credentials.
*
* In order to test that, we just try to get the pullzones amd we check if
* the server reply the errorCode 0. If can't connect or other errorCode, then
* there is something wrong.
*
* @return True if the connection is OK, false otherwise
*/
private function _testConnection()
{
set_time_limit(0);
if (count($this->_compatibilityCheck()))
return array('<img src="../img/admin/forbbiden.gif" alt="" /><b style="color: #CC0000;">'.
$this->l('You have compatibility issues, please fix them before using the module.').'</b>',
'#FFD8D8');
$zones = $this->_api->listZones('pullzone');
if ($this->_api->getLastFaultCode())
{
$ret = array('<img src="../img/admin/forbbiden.gif" alt="" />
<b style="color: #CC0000;">'.$this->l('Connection Test Failed.').'</b>',
'#FFD8D8', false);
Configuration::updateValue('CLOUDCACHE_API_ACTIVE', 0);
return $ret;
}
$defaultName = pSQL($this->l('prestashop'));
// Check if default zone exists
for ($i = 0; $i < count($zones); $i++)
if ($zones[$i]['name'] == $defaultName)
{
$defaultName .= rand(1, 999);
$i = 0;
}
$newZone = false;
// If there is no zones, then create the default one
if (!count($zones) || !Configuration::get('CLOUDCACHE_API_COMPANY_ID'))
{
$origin = pSQL((Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').Configuration::get('PS_SHOP_DOMAIN'));
$r = $this->createZone('pullzone', array(
'name' => $defaultName,
'origin' => $origin,
'compress' => 1,
));
if (is_array($r))
{
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cloudcache_zone` SET `name` = \''.pSQL($defaultName).'\', `origin` = \''.$origin.'\', `compress` = \'1\', `file_type` = \''.pSQL(CLOUDCACHE_FILE_TYPE_ALL).'\', `cdn_url` = \''.pSQL($r['cdn_url']).'\' WHERE `id_zone` = '.(int)$r['id']);
$tmp = substr($r['cdn_url'], strlen($defaultName) + 1);
$companyId = substr($tmp, 0, strlen('netdna-cdn.com') * -1 - 1);
Configuration::updateValue('CLOUDCACHE_API_COMPANY_ID', pSQL($companyId));
}
else // If failure, the zonename have probably been taken
{
$defaultName .= rand(1, 999);
$r = $this->createZone('pullzone', array(
'name' => $defaultName,
'origin' => $origin,
'compress' => 1,
));
if (is_array($r))
{
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'cloudcache_zone` SET `name` = \''.pSQL($defaultName).'\', `origin` = \''.$origin.'\', `compress` = \'1\', `file_type` = \''.pSQL(CLOUDCACHE_FILE_TYPE_ALL).'\', `cdn_url` = \''.pSQL($r['cdn_url']).'\' WHERE `id_zone` = '.(int)$r['id']);
$tmp = substr($r['cdn_url'], strlen($defaultName) + 1);
$companyId = substr($tmp, 0, strlen('netdna-cdn.com') * -1 - 1);
Configuration::updateValue('CLOUDCACHE_API_COMPANY_ID', pSQL($companyId));
}
else
return array('<img src="../img/admin/error.png" /><b style="color: red;">'.$this->l('An error occured, impossible to create a default zone.').'</b>', '#FFD8D8', true);
}
$newZone = $tmp;
}
Configuration::updateValue('CLOUDCACHE_API_ACTIVE', 1);
$ret = array('<img src="../img/admin/ok.gif" alt="" />
<b style="color: green;">'.$this->l('Register').' '.
Configuration::get('PS_SHOP_DOMAIN').' '.
$this->l('on Cloudcache').'<br /></b>
<img src="http://www.prestashop.com/modules/'.$this->name.'.png?api_user='.urlencode(Configuration::get('CLOUDCACHE_API_COMPANY_ID')).
'" style="display: none;" />
', '#D6F5D6', true);
if ($newZone)
$ret['newZone'] = $origin;
return $ret;
}
/*
** Display a custom message for settings update
** $text string Text to be displayed in the message
** $type string (confirm|warn|error) Decides what color will the
** message have (green|yellow)
*/
private function _displayConfirmation($text = '', $type = 'confirm')
{
switch ($type)
{
case 'confirm':
$img = 'ok.gif';
break ;
case 'warn':
$img = 'warn2.png';
break ;
case 'error':
$img = 'disabled.gif';
break ;
default:
die('Invalid type.');
}
return array(
'class' => Tools::safeOutput($type),
'img' => Tools::safeOutput($img),
'text' => (empty($text) ? $this->l('Settings updated') : $text)
);
}
/******************************************************************/
/** Tools methods *************************************************/
/******************************************************************/
function getCurrentURL($htmlEntities = false)
{
$url = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
return (!empty($_SERVER['HTTPS']) ? 'https' : 'http').
'://'.($htmlEntities ? preg_replace('/&/', '&amp;', $url): $url);
}
/**
* @brief Retrieve the bandwith from the selected zone and date range.
*
* @param zoneId Zone Id from which we want to retrieve data
* @param range Range to retrieve (daily, weekly, monthly)
*
* @return Bandwith spent by the selecte zone between the wanted date range.
*/
private function _getZoneTransfer($zoneId, $range)
{
// Associate a range with real date
$allowedRange = array(
'daily' => date('Y-m-d',
mktime(0, 0, 0, date('n'), date('j') - 1, date('Y'))),
'weekly' => date('Y-m-d',
mktime(0, 0, 0, date('n'), date('j') - 7, date('Y'))),
'monthly' => date('Y-m-d',
mktime(0, 0, 0, date('n') - 1, date('j'), date('Y'))),
);
// Retrieve today's date
$today = date('Y-m-d');
// We check the range is correct
if (!array_key_exists($range, $allowedRange))
return -1;
$companyId = Configuration::get('CLOUDCACHE_API_COMPANY_ID');
// Retrieve the data from the server
$r = $this->_api->getTotalTransferStats('report', $companyId, $zoneId,
$allowedRange[$range], $today);
// Check if the transaction went well
if ($this->_api->getLastFaultCode())
return -1;
return 0;
}
/**
* @brief Retrieves Zones from Cloudcache Server and sync with local data
*
* @param type Namespace of the zones to retrieve (pullzone, pushzone, etc)
*
* @return Array describing the zones.
*/
private function _syncZonesWithServer($type)
{
// Send the request to the API server
$cdnZones = array();
if ($type == 'all')
foreach ($this->_api->getAvailableNamespaces() as $namespace)
$cdnZones[$namespace] = $this->_api->listZones($namespace);
else
$cdnZones[$type] = $this->_api->listZones($type);
$zones = array();
// Check if the transaction went well
if (!$this->_api->getLastFaultCode())
{
// Build our custom array from the retieved data
foreach ($cdnZones as $namespace => $cdnZone)
{
foreach ($cdnZone as $zone)
{
$exists = false;
$row = Db::getInstance()->getRow('SELECT `id_zone`, `id_shop`, `origin`, `cdn_url`, `file_type` FROM `'._DB_PREFIX_.'cloudcache_zone` WHERE `id_zone` = '.(int)$zone['id']);
if ($row['id_zone'])
$exists = true;
if ($exists && $row['id_shop'] != $this->context->shop->id)
continue ;
$zones[(int)$zone['id']] = array(
'id_zone' => (int)$zone['id'],
'name' => pSQL($zone['name']),
'origin' => ($exists ? pSQL($row['origin']) : $this->l('no data')),
'cdn_url' => ($exists ? pSQL($row['cdn_url']) : $this->l('no data')),
'bw_yesterday' => (int)$this->_getZoneTransfer($zone['id'], 'daily'),
'bw_last_week' => (int)$this->_getZoneTransfer($zone['id'], 'weekly'),
'bw_last_month' => (int)$this->_getZoneTransfer($zone['id'], 'monthly'),
'file_type' => ($exists ? pSQL($row['file_type']) : 'none'),
'zone_type' => pSQL($namespace),
'id_shop' => $this->context->shop->id,
'id_group_shop' => $this->context->shop->id_group_shop,
);
}
}
// For each zone, update or insert the new data in the database
foreach ($zones as $id_zone => $zone_data)
if ($zone_data['zone_type'] != 'all')
Db::getInstance()->Execute('REPLACE INTO `'._DB_PREFIX_.'cloudcache_zone`
(`'.implode('`,`', array_keys($zone_data)).'`)
VALUES (\''.implode('\', \'', $zone_data).'\')');
return $zones;
}
return false;
}
/**
* @brief Get Zones from the selected zone type.
*
* If the sync flag is setted to true, then retrieve data from Cloudcache servers.
*
* @note Function call thru ajax
*
* @param type Type of zone (Cloudcache namespace)
* @param sync Flag to know if we should ask the Cloudcache servers.
*
* @return Array describing the zones
*/
public function getZones($type, $sync = false)
{
// Check that the $type is correct an harmless for the database
if (!in_array($type, $this->_api->getAvailableNamespaces()))
return $this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Invalid zone type.'), 'error'));
// Check on the database if $sync is false (cache)
$zones = array();
if (!$sync)
{
$d = Db::getInstance()->ExecuteS('
SELECT `id_zone`, `id_shop`, `name`, `origin`, `compress`, `label`, `cdn_url`,
`bw_yesterday`, `bw_last_week`, `bw_last_month`, `file_type`, `zone_type`
FROM `'._DB_PREFIX_.'cloudcache_zone`
WHERE `zone_type` = \''.pSQL($type).'\' AND `id_shop` = '.(int)$this->context->shop->id);
foreach ($d as $line)
$zones[$line['id_zone']] = $line;
}
// if no result or if $sync, load data from API server
if (($sync || !count($zones)) && Configuration::get('CLOUDCACHE_API_ACTIVE'))
$zones = $this->_syncZonesWithServer($type);
// Return the data array
return $zones;
}
/**
* @brief Create a Zone on the Cloudcache Server.
*
* First create the zone thru the API then call the sync function in order to
* update the local data.
*
* @param type Type of the zone (pullzone, pushzone, etc)
* @param values Array describing the zone.
*
* @return True if everything went well, False otherwise
*/
public function createZone($type, $values)
{
// Check that the $type is correct an harmless for the database
if (!in_array($type, $this->_api->getAvailableNamespaces()))
return $this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Invalid zone type.'), 'error'));
// Create the basic zone data
$zone = array(
'name' => pSQL($values['name']),
'origin' => pSQL($values['origin']),
);
// If an optional field is set, add it to the zone
$optionalFields = array('vanity_domain', 'vhost',
'ip', 'compress', 'label');
foreach ($optionalFields as $field)
if (isset($values[$field]) && !empty($values[$field]))
$zone[$field] = pSQL($values[$field]);
// Then send the request to the server
// The server return an array with the new id, vanity_ip and cdn_url
$r = $this->_api->createZone($type, $zone);
// Check if the transaction went well and return result
if ($this->_api->getLastFaultCode())
return $this->_api->getLastFaultString();
/* // Insert the new zone in database */
/* if ($this->_updateZoneSql($r, 'CRE)) */
/* return $this->context->smarty->assign('confirmMessage', */
/* $this->_displayConfirmation($this->l('Unknown internal error.'), 'error')); */
// Sync
$this->_syncZonesWithServer($type);
return $r;
}
/**
* @brief Update the selected zone.
*
* @param type Type of the zone (namespace)
* @param values Values of the updated zone
*
* @return True if OK, false otherwise.
*/
public function updateZone($type, $values)
{
// Check that the $type is correct an harmless for the database
if (!in_array($type, $this->_api->getAvailableNamespaces()))
return $this->context->smarty->assign('confirmMessage',
$this->_displayConfirmation($this->l('Invalid zone type.'), 'error'));
// Create the basic zone data
$zone = array(
'id' => (int)$values['id_zone'],
);
$optionalFields = array('name', 'origin', 'vhost', 'ip', 'compress', 'label');
foreach ($optionalFields as $field)
if (isset($values[$field]) && !empty($values[$field]))
$zone[$field] = pSQL($values[$field]);
// The updateZone return a bool success/error
$r = $this->_api->updateZone($type, (int)$values['id_zone'], $zone);
// Check if the transaction went well
if ($this->_api->getLastFaultCode())
return ; //die('KO '.pSQL($this->_api->getLastFaultString())); // pSQL for XSS
return $r;
}
/**
* @brief Retrieve the paid Bandwith left
*
* @return The bandwith left.
*/
public function getPrepaidBandwidth()
{
// The namespace need to retrieve the bandwith is 'account'
// The server reply the amount of bandwith left
$r = $this->_api->getBandwidth('account');
// Check if the transaction went well
if ($this->_api->getLastFaultCode())
return $this->l('N/A');
// $r /= (1024 * 1024 * 1024 * 1024);
$r /= (1000 * 1000 * 1000 * 1000);
return round($r, 2);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>cloudcache</name>
<displayName><![CDATA[CloudCache]]></displayName>
<version><![CDATA[1.2]]></version>
<description><![CDATA[Supercharge your Shop with the CloudCache.com Content Delivery Network (CDN).]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[administration]]></tab>
<is_configurable>1</is_configurable>
<need_instance>1</need_instance>
<limited_countries></limited_countries>
</module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

108
modules/cloudcache/es.php Normal file
View File

@@ -0,0 +1,108 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{cloudcache}prestashop>cloudcache_f86d8910fee395bdb3d9e0165763235d'] = 'CloudCache';
$_MODULE['<{cloudcache}prestashop>cloudcache_04a5752fc2ed63bac60e8e819fb37a8a'] = 'Acelera tu tienda con la red de distribución de contenido de CloudCache.com';
$_MODULE['<{cloudcache}prestashop>cloudcache_3d31c37e7b674b0882fd6eb636b9f883'] = 'El módulo se ha instalado correctamente (';
$_MODULE['<{cloudcache}prestashop>cloudcache_e2d5a00791bce9a01f99bc6fd613a39d'] = 'configurar';
$_MODULE['<{cloudcache}prestashop>cloudcache_7171d1fc720355ddfb40537f566d8775'] = ') pero el siguiente archivo ya existe. Por favor, combine los archivos manualmente.';
$_MODULE['<{cloudcache}prestashop>cloudcache_21d079ded53ed9bc6e6fef18a7deff87'] = 'Para poder usar Cloudcache correctamente, por favor corrija los siguientes errores:';
$_MODULE['<{cloudcache}prestashop>cloudcache_c3c06280e8f7a758b5b3ba55bc31aa54'] = 'Asegúrese de marcar \"Mantener CSS como el original\"';
$_MODULE['<{cloudcache}prestashop>cloudcache_610c04b1a22a45228804fbe850e5035c'] = 'Asegúrese de marcar \"Mantener JavaScript como el original\"';
$_MODULE['<{cloudcache}prestashop>cloudcache_adf0bfd77f102fb4b793f62efdb52ad8'] = 'Asegúrese de marcar \"Mantener HTML como el original\"';
$_MODULE['<{cloudcache}prestashop>cloudcache_936aea1c0611cae3cd3c8b6299d22c28'] = 'Asegúrese de marcar \"Mantener JavaScript en HTML como el original\"';
$_MODULE['<{cloudcache}prestashop>cloudcache_3da4c8edd49a7c69fcd74b31955ec538'] = 'Asegúrese de marcar \"Mantener validación W3C como el original\"';
$_MODULE['<{cloudcache}prestashop>cloudcache_f0c746da3e0a8585f9431752a47f4471'] = 'Usted debe pedir a su proveedor de hosting que active la extensión CURL de PHP (php.ini) para que el módulo Cloudcache pueda funcionar correctamente.';
$_MODULE['<{cloudcache}prestashop>cloudcache_108118f45620e45322c3d5862591c418'] = 'Zona añadida.';
$_MODULE['<{cloudcache}prestashop>cloudcache_a63636b538337a40fcdd3363c6707f15'] = 'Error añadiendo zona.';
$_MODULE['<{cloudcache}prestashop>cloudcache_58f9c3960361509cf1d68bf643941ca1'] = 'Todas las zonas fueron sincronizadas.';
$_MODULE['<{cloudcache}prestashop>cloudcache_c72fd9c59ceba8b6724e2fd47823a371'] = 'Error sincronizando las zonas.';
$_MODULE['<{cloudcache}prestashop>cloudcache_3d015f6519d6a4266d58735cbb0646aa'] = 'Se limpió el cache para todas las zonas.';
$_MODULE['<{cloudcache}prestashop>cloudcache_927a80bfb795058dd0d56b910ce75182'] = 'Error limpiando el cache para todas las zonas.';
$_MODULE['<{cloudcache}prestashop>cloudcache_0784546200bf0e0b692ce92fca030051'] = 'Se limpió el cache de la zona: ';
$_MODULE['<{cloudcache}prestashop>cloudcache_677b9ce0ce1753890cfeb9d88b8b6a2d'] = 'Error limpiando el cache de la zona: ';
$_MODULE['<{cloudcache}prestashop>cloudcache_5ea453e070eec6c0d81206b66e7b47bb'] = 'La siguiente zona fue actualizada:';
$_MODULE['<{cloudcache}prestashop>cloudcache_7e185a7cd33a7ec22abaff3f1faa8d28'] = 'Error actualizando la zona: ';
$_MODULE['<{cloudcache}prestashop>cloudcache_d5a735d3395d8928332af64d25479273'] = 'Se han encontrado problemas de compatibilidad, por favor corrija los errores antes de usar el modulo.';
$_MODULE['<{cloudcache}prestashop>cloudcache_63a77eaf9f310dc5def6709c2887dcc4'] = 'Conexión de prueba fallida.';
$_MODULE['<{cloudcache}prestashop>cloudcache_4dee17e319890f92a2595a308752a1c3'] = 'prestashop';
$_MODULE['<{cloudcache}prestashop>cloudcache_2631b272000ffdc568ad04d7982d1f7c'] = 'Ha ocurrido un error. Imposible crear una zona predeterminada.';
$_MODULE['<{cloudcache}prestashop>cloudcache_0ba7583639a274c434bbe6ef797115a4'] = 'Incribirse';
$_MODULE['<{cloudcache}prestashop>cloudcache_43bff7159a5c1a845ce6bd00f90b692f'] = 'en Cloudcache';
$_MODULE['<{cloudcache}prestashop>cloudcache_c888438d14855d7d96a2724ee9c306bd'] = 'Opciones actualizadas';
$_MODULE['<{cloudcache}prestashop>cloudcache_42c4d8746ae597c8db2724998063b0f5'] = 'no hay datos';
$_MODULE['<{cloudcache}prestashop>cloudcache_fd7695c3fa7df2aeb0957554d5007378'] = 'Tipo de zona inválida.';
$_MODULE['<{cloudcache}prestashop>cloudcache_fb27ef14699bf81370e0c7384aa9e118'] = 'Error interno desconocido';
$_MODULE['<{cloudcache}prestashop>cloudcache_382b0f5185773fa0f67a8ed8056c7759'] = 'N/A';
$_MODULE['<{cloudcache}prestashop>backofficetop_3f3391f413c692b76b90034e19074ea4'] = 'Actualmente usted está teniendo mejor rendimiento';
$_MODULE['<{cloudcache}prestashop>backofficetop_baccc7910ea31b5cf2fedc346eee0fe6'] = 'usando el módulo CloudCache';
$_MODULE['<{cloudcache}prestashop>backofficetop_bdb079cd385ce7a5227f1d56d91200c0'] = 'el mejor servicio CDN recomendado por usuarios de PrestaShop!';
$_MODULE['<{cloudcache}prestashop>backofficetop_69595fc8764ca77da1ca3cab85ba38b1'] = 'Tenga aun mejor rendimiento';
$_MODULE['<{cloudcache}prestashop>backofficetop_938d6948b598780c6d713b7cd350e963'] = 'al activar el módulo CloudCache';
$_MODULE['<{cloudcache}prestashop>backofficetop_fa65e0f3acb9c0b1d8243c3edeebe058'] = 'Todo luce bien para CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_41902f7e9bb357cbada1d47b0c252f23'] = 'Abra su cuenta en CloudCache.com';
$_MODULE['<{cloudcache}prestashop>content2_d500acbdf6da11b99ba163036743bd67'] = 'CloudCache provee a los usuarios de PrestaShop un descuento exclusivo del 25% al mes en cada paquete disponible. Por favor, haga click en logo abajo para subscribirse:';
$_MODULE['<{cloudcache}prestashop>content2_38d9b91c515b7d3a97f2bf6e72cd24ec'] = 'Este módulo le permite acelerar su tienda PrestaShop a través de la red de distribución de contenido de CloudCache.';
$_MODULE['<{cloudcache}prestashop>content2_03894b6f1d0447b352ae5093b25beb3d'] = 'Una red de distribución de contenido (CDN) es para cada dueño de tiendas en línea que demanda de un alto rendimiento, y un servicio exclusivo al visitante.';
$_MODULE['<{cloudcache}prestashop>content2_0bcf4cd42f3d29472055668091d3ebc6'] = 'Chequeo de compatibilidad de CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_d83cbcd4f991b9b43098437b58a7d1f3'] = 'Por qué CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_6a26f548831e6a8c26bfbbd9f6ec61e0'] = 'Ayuda';
$_MODULE['<{cloudcache}prestashop>content2_f4f70727dc34561dfde1a3c529b6205c'] = 'Opciones';
$_MODULE['<{cloudcache}prestashop>content2_dad1f8d794ee0dd7753fe75e73b78f31'] = 'Zonas';
$_MODULE['<{cloudcache}prestashop>content2_52b730e469f179c52956110ff7d1920f'] = 'CloudCache está enfocado en entregar el contenido de la web con una eficiencia a la velocidad de la luz. Nosotros mantenemos una copia de los elementos \"pesados\" de su tienda PrestaShop, como imágenes, CSS y JavaScript en nuestros centros de datos alrededor del mundo y entregamos el contenido a sus visitantes desde la localización mas cercana. Estos son algunos de los numerosos beneficios de tener un sitio que carga mas rápido:';
$_MODULE['<{cloudcache}prestashop>content2_3ce64c688b949bec0dcec57bbdf2e48f'] = 'Crezca durante los picos de tráfico';
$_MODULE['<{cloudcache}prestashop>content2_be2501ec16464402d9069fabeae68cd0'] = 'En caso de que llegará a ser famoso durante la noche (es decir, su tienda se menciona en la televisión), sus ventas se dispararían, pero su servidor puede bloquearse debido a la sobrecarga, nosotros te ayudamos a equilibrar la sobrecarga de tráfico.';
$_MODULE['<{cloudcache}prestashop>content2_867681a0d2b527c81f35f397e26d96dc'] = 'Certificados SSL fáciles';
$_MODULE['<{cloudcache}prestashop>content2_aeebd43d3152b36de94e03808ad25957'] = 'Nuestra aceleración SSL disminuye la sobrecarga de energía de la CPU del servidor hasta un 70%. Además, hemos hecho que sea muy fácil y asequible para ejecutar SSL en la nube. Solo cobramos $ 24.95 por certificados SSL por Zona, por mes, incluyendo el certificado SSL.';
$_MODULE['<{cloudcache}prestashop>content2_2ea70b7571baf4de04631283af3a3a4b'] = 'Mayor puntuación SEO';
$_MODULE['<{cloudcache}prestashop>content2_6ad31549b6404d19697b28d718e2aa77'] = 'Google utiliza la velocidad de la página como un factor clave en su algoritmo de clasificación. Páginas que cargan rapido ganan posiciones más altas en los resultados de búsqueda, lo que significa más tráfico y más dinero para usted.';
$_MODULE['<{cloudcache}prestashop>content2_5b40a55b46342c709ef61fe48a11572f'] = 'Aumentar sus conversiones';
$_MODULE['<{cloudcache}prestashop>content2_8a8d5433fef3fe8b8940e32698d97e9d'] = 'Amazon halló que si su sitio se carga 100 milésimas de segundo más lento, pierden un 1% mas de sus ingresos. Creemos que esta sola razón es suficiente para preocuparse por el tiempo de carga de página.';
$_MODULE['<{cloudcache}prestashop>content2_412504f79aaab3a708c24f2b5f6af4b6'] = 'Cómo configurar CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_2cb43a908b4bc11d16e651063a9c4027'] = 'Suscríbete a CloudCache haciendo clic en el logo a la derecha';
$_MODULE['<{cloudcache}prestashop>content2_f85e413f1f55286db4da358df3053062'] = 'Crear un usuario de la API y obtenga el ID de usuario y la clave de la API';
$_MODULE['<{cloudcache}prestashop>content2_13ad6491d90c3d8b08f072c13c34a797'] = 'ver vídeo tutorial';
$_MODULE['<{cloudcache}prestashop>content2_44641e218ebb6c07d0cb756a79673069'] = 'Cómo configurar el módulo:';
$_MODULE['<{cloudcache}prestashop>content2_784f83c332ae60b4d453cb63dc8c49b1'] = 'Llene el ID de usuario CloudCache y el campos de la clave de la API con los proporcionados por CloudCache.';
$_MODULE['<{cloudcache}prestashop>content2_2a5075cb5b1148436ee37a1ef46e51a6'] = 'Haga clic en \"Guardar configuración\" y luego \"Probar su conexión\".';
$_MODULE['<{cloudcache}prestashop>content2_59c8906c9f68c992003be17308173bd9'] = 'Si usted no tiene las zonas ya existentes, una zona predeterminada se creará.';
$_MODULE['<{cloudcache}prestashop>content2_fbd942973e8b17f065e587a2512a8f7f'] = 'Con el fin de aumentar el rendimiento, se puede ir a su cuenta CloudCache haciendo clic en el enlace de la derecha, vaya a la lista Pullzones, elija su zona, editar, ir a las Opciones avanzadas y desactive la opción de \"Query String\". Con el fin de guardar los cambios, haga clic en \"Actualizar\".';
$_MODULE['<{cloudcache}prestashop>content2_727283f37d3e70d3faceb71761d0fb51'] = 'Propósito del modulo:';
$_MODULE['<{cloudcache}prestashop>content2_0bae64ec079443c47750df1bdbf35871'] = 'Un Content Delivery Network (CDN) es para cada propietario de un sitio que exige un alto rendimiento, y proveer una experiencia excelente al visitante. ¿Por qué? Debido a que nuestro CDN acelera al máximo tus archivos descargables - imágenes, vídeo, scripts, css-con tiempos de carga super-rápido.';
$_MODULE['<{cloudcache}prestashop>content2_343618e9fcce53224cc7a47c2145c5e5'] = '¿Qué modificaciones hace el módulo de hacer en mi tienda?';
$_MODULE['<{cloudcache}prestashop>content2_082be8b13b40bfbf9c9cc70316bc1fec'] = 'Tools.php se sobrescribirá.';
$_MODULE['<{cloudcache}prestashop>content2_21ce50e4e30845efcb5005cdaa912bfd'] = '[Ficha Preferencias -> Rendimiento -> Servidores de Medios de Comunicación] mostrará un enlace a las configuraciones de módulos CloudCache y una notificación cuando el módulo está activo.';
$_MODULE['<{cloudcache}prestashop>content2_b480863a2096d2a5fca0cb3460b79c1e'] = 'Ha ocurrido un error mientras se prueba la conexión.';
$_MODULE['<{cloudcache}prestashop>content2_e72dafd095a9ec228dfd9c054f0530b0'] = 'Éxito! Eso es todo lo que tienes que hacer!';
$_MODULE['<{cloudcache}prestashop>content2_633d7bd9ecfcb1b67fa03b8a281aa8dd'] = 'ahora es acelerado por cloudcache.com';
$_MODULE['<{cloudcache}prestashop>content2_7e1678acc78078f22f6196a9737e3431'] = 'Éxito! La conexión se ha establecido!';
$_MODULE['<{cloudcache}prestashop>content2_bd93cd0fb528a1a2cb9cee3ecea69906'] = 'Haga clic aquí para acceder a su cuenta CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_c949d7fe576e586e47a39b41752bd12c'] = 'El ancho de banda disponible es:';
$_MODULE['<{cloudcache}prestashop>content2_c6bce2a0c02ed4dc352779f8ecfdb3f5'] = 'ID de la compañia';
$_MODULE['<{cloudcache}prestashop>content2_e9db460a0154b96521063e4054997cdc'] = 'Usuario API';
$_MODULE['<{cloudcache}prestashop>content2_d876ff8da67c3731ae25d8335a4168b4'] = 'Clave API';
$_MODULE['<{cloudcache}prestashop>content2_9daf1fb753b42c3cdc8f1d01669cd6d8'] = 'Guardar configuración';
$_MODULE['<{cloudcache}prestashop>content2_79ddd6cfbf01f63986f7b114ecc2ca95'] = 'Haga clic aquí para Conexión de prueba';
$_MODULE['<{cloudcache}prestashop>content2_16bfbf9c462762cf1cba4134ec53c504'] = 'Cargando';
$_MODULE['<{cloudcache}prestashop>content2_382b0f5185773fa0f67a8ed8056c7759'] = 'N/A';
$_MODULE['<{cloudcache}prestashop>content2_7469a286259799e5b37e5db9296f00b3'] = 'SI';
$_MODULE['<{cloudcache}prestashop>content2_c2f3f489a00553e7a01d369c103c7251'] = 'NO';
$_MODULE['<{cloudcache}prestashop>content2_2e1911a1922b9c56488e7e3d37bf9cb5'] = 'Purgar caché';
$_MODULE['<{cloudcache}prestashop>content2_50100a6fa3a40543749d43b69210d473'] = 'Sincronizar las zonas!';
$_MODULE['<{cloudcache}prestashop>content2_1cd6038e51e247649e3046c3d963658d'] = 'Añadir zonas';
$_MODULE['<{cloudcache}prestashop>content2_3114114e2cdf0892739ee4ca557e8da5'] = 'Borrar todo el caché';
$_MODULE['<{cloudcache}prestashop>content2_93604834836f885a26ad3c780a490841'] = 'ID de la zona';
$_MODULE['<{cloudcache}prestashop>content2_fa018acf009f5435d50578357f449ed3'] = 'Nombre del Pull Zone';
$_MODULE['<{cloudcache}prestashop>content2_5e50936ee3316f28363a8de993cb07e8'] = 'URL del servidor de origen';
$_MODULE['<{cloudcache}prestashop>content2_ae9980aee84bd689e09532a927049f2c'] = 'Dominio CDN personalizado ';
$_MODULE['<{cloudcache}prestashop>content2_b021df6aac4654c454f46c77646e745f'] = 'Etiqueta';
$_MODULE['<{cloudcache}prestashop>content2_82af841589057aa8922b1ac3bb4a28a4'] = 'Compresión';
$_MODULE['<{cloudcache}prestashop>content2_e539fd665e202f536325140d87d7bf72'] = 'Tipo de Archivo';
$_MODULE['<{cloudcache}prestashop>content2_b1c94ca2fbc3e78fc30069c8d0f01680'] = 'Todo';
$_MODULE['<{cloudcache}prestashop>content2_9b001c69726efc0b7ef4876759a01874'] = 'Tipo de Zona';
$_MODULE['<{cloudcache}prestashop>content2_ea4788705e6873b424c65e91c2846b19'] = 'Cancelar';
$_MODULE['<{cloudcache}prestashop>content2_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar';
$_MODULE['<{cloudcache}prestashop>content2_962a4c03ca790e4682304039c71e79d4'] = 'Crear Zona';
$_MODULE['<{cloudcache}prestashop>content2_96f583efefa0ce369ffeb5c3a7b3bd2a'] = 'Cloudcache y PrestaShop';
$_MODULE['<{cloudcache}prestashop>content2_fb66c688ec4cf810d1d60a11a67458c4'] = 'Aprenda mas acerca de Cloudcache en PrestaShop.com';

108
modules/cloudcache/fr.php Normal file
View File

@@ -0,0 +1,108 @@
<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{cloudcache}prestashop>cloudcache_f86d8910fee395bdb3d9e0165763235d'] = 'CloudCache';
$_MODULE['<{cloudcache}prestashop>cloudcache_04a5752fc2ed63bac60e8e819fb37a8a'] = 'Accélérez votre boutique avec le Content Delivery Network (CDN) de CloudCache.com';
$_MODULE['<{cloudcache}prestashop>cloudcache_3d31c37e7b674b0882fd6eb636b9f883'] = 'Le module a été correctement intallé (';
$_MODULE['<{cloudcache}prestashop>cloudcache_e2d5a00791bce9a01f99bc6fd613a39d'] = 'configurer';
$_MODULE['<{cloudcache}prestashop>cloudcache_7171d1fc720355ddfb40537f566d8775'] = ') mais le fichier suivant existe. Fusionnez le manuellement.';
$_MODULE['<{cloudcache}prestashop>cloudcache_21d079ded53ed9bc6e6fef18a7deff87'] = 'Pour utiliser correctement CloudCache, réglez les problèmes suivant:';
$_MODULE['<{cloudcache}prestashop>cloudcache_c3c06280e8f7a758b5b3ba55bc31aa54'] = 'Assurez vous que \'Gardez les CSS originaux\'';
$_MODULE['<{cloudcache}prestashop>cloudcache_610c04b1a22a45228804fbe850e5035c'] = 'Assurez vous que \'Gardez les JavaScript originaux\'';
$_MODULE['<{cloudcache}prestashop>cloudcache_adf0bfd77f102fb4b793f62efdb52ad8'] = 'Assurez vous que \'Gardez les HTML originaux\'';
$_MODULE['<{cloudcache}prestashop>cloudcache_936aea1c0611cae3cd3c8b6299d22c28'] = 'Assurez vous que \"Gardez les Javascript dans les HTML originaux\"';
$_MODULE['<{cloudcache}prestashop>cloudcache_3da4c8edd49a7c69fcd74b31955ec538'] = 'Assurez vous que \'Garder la validation W3C\' soit séléctionné';
$_MODULE['<{cloudcache}prestashop>cloudcache_f0c746da3e0a8585f9431752a47f4471'] = 'Vous devez demander à votre hébergeur d\'activer l\'extension PHP CURL (dans php.ini) afin de pouvoir faire fonctionner le module CloudCache.';
$_MODULE['<{cloudcache}prestashop>cloudcache_108118f45620e45322c3d5862591c418'] = 'Zone ajouté.';
$_MODULE['<{cloudcache}prestashop>cloudcache_a63636b538337a40fcdd3363c6707f15'] = 'Erreur pendant l\'ajout de la zone:';
$_MODULE['<{cloudcache}prestashop>cloudcache_58f9c3960361509cf1d68bf643941ca1'] = 'Toutes les zones ont été synchronisé';
$_MODULE['<{cloudcache}prestashop>cloudcache_c72fd9c59ceba8b6724e2fd47823a371'] = 'Erreur pendant la synchronisation des zones:';
$_MODULE['<{cloudcache}prestashop>cloudcache_3d015f6519d6a4266d58735cbb0646aa'] = 'Le cache a été purgé pour toutes les zones.';
$_MODULE['<{cloudcache}prestashop>cloudcache_927a80bfb795058dd0d56b910ce75182'] = 'Erreur pendant la purge du cache pour toutes els zones.';
$_MODULE['<{cloudcache}prestashop>cloudcache_0784546200bf0e0b692ce92fca030051'] = 'Le cache a été purgé pour la zone:';
$_MODULE['<{cloudcache}prestashop>cloudcache_677b9ce0ce1753890cfeb9d88b8b6a2d'] = 'Erreur pendant la purge du cache pour la zone:';
$_MODULE['<{cloudcache}prestashop>cloudcache_5ea453e070eec6c0d81206b66e7b47bb'] = 'Les zones suivantes ont été mise à jour:';
$_MODULE['<{cloudcache}prestashop>cloudcache_7e185a7cd33a7ec22abaff3f1faa8d28'] = 'Erreur pendant la mise à jour de la zone:';
$_MODULE['<{cloudcache}prestashop>cloudcache_d5a735d3395d8928332af64d25479273'] = 'Vous avez des erreurs de compatibilité, résolvez les avant d\'utiliser le module.';
$_MODULE['<{cloudcache}prestashop>cloudcache_63a77eaf9f310dc5def6709c2887dcc4'] = 'Le test de connexion a échoué.';
$_MODULE['<{cloudcache}prestashop>cloudcache_4dee17e319890f92a2595a308752a1c3'] = 'PrestaShop';
$_MODULE['<{cloudcache}prestashop>cloudcache_2631b272000ffdc568ad04d7982d1f7c'] = 'Une erreur est survenue, impossible de créer la zone par défault.';
$_MODULE['<{cloudcache}prestashop>cloudcache_0ba7583639a274c434bbe6ef797115a4'] = 'S\'inscrire';
$_MODULE['<{cloudcache}prestashop>cloudcache_43bff7159a5c1a845ce6bd00f90b692f'] = 'sur CloudCache';
$_MODULE['<{cloudcache}prestashop>cloudcache_c888438d14855d7d96a2724ee9c306bd'] = 'Paramètres mis à jour';
$_MODULE['<{cloudcache}prestashop>cloudcache_42c4d8746ae597c8db2724998063b0f5'] = 'Aucune données';
$_MODULE['<{cloudcache}prestashop>cloudcache_fd7695c3fa7df2aeb0957554d5007378'] = 'Type de zone invalide.';
$_MODULE['<{cloudcache}prestashop>cloudcache_fb27ef14699bf81370e0c7384aa9e118'] = 'Erreur interne.';
$_MODULE['<{cloudcache}prestashop>cloudcache_382b0f5185773fa0f67a8ed8056c7759'] = 'N/A';
$_MODULE['<{cloudcache}prestashop>backofficetop_3f3391f413c692b76b90034e19074ea4'] = 'Vous économisez encore plus de performances en';
$_MODULE['<{cloudcache}prestashop>backofficetop_baccc7910ea31b5cf2fedc346eee0fe6'] = 'utilisant le module CloudCache';
$_MODULE['<{cloudcache}prestashop>backofficetop_bdb079cd385ce7a5227f1d56d91200c0'] = 'le meilleur server CDN recommandé par les utilisateurs de PrestaShop!';
$_MODULE['<{cloudcache}prestashop>backofficetop_69595fc8764ca77da1ca3cab85ba38b1'] = 'Économisez encore plus de performances en';
$_MODULE['<{cloudcache}prestashop>backofficetop_938d6948b598780c6d713b7cd350e963'] = 'activant le module CloudCache';
$_MODULE['<{cloudcache}prestashop>backofficetop_fa65e0f3acb9c0b1d8243c3edeebe058'] = 'Tout les paramètres sont corrects pour CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_41902f7e9bb357cbada1d47b0c252f23'] = 'Ouvrir un compte chez CloudCache.com';
$_MODULE['<{cloudcache}prestashop>content2_d500acbdf6da11b99ba163036743bd67'] = 'CloudCache fournis aux utilsiateurs de PrestaShop une réduction exclusive de 25% par mois sur tous les pack disponible. Cliquez sur le logo ci-dessous pour s\'inscrire:';
$_MODULE['<{cloudcache}prestashop>content2_38d9b91c515b7d3a97f2bf6e72cd24ec'] = 'Ce module permet d\'accélérer votre PrestaShop grâce au Content Delivery Network de CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_03894b6f1d0447b352ae5093b25beb3d'] = 'Un Content Delivery Network (CDN) est pour un webmaster qui cherche de hautes performances et qui préviligie l\'expérience utilisateur.';
$_MODULE['<{cloudcache}prestashop>content2_0bcf4cd42f3d29472055668091d3ebc6'] = 'Vérification de compatiblité pour CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_d83cbcd4f991b9b43098437b58a7d1f3'] = 'Pourquoi CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_6a26f548831e6a8c26bfbbd9f6ec61e0'] = 'Aide';
$_MODULE['<{cloudcache}prestashop>content2_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres';
$_MODULE['<{cloudcache}prestashop>content2_dad1f8d794ee0dd7753fe75e73b78f31'] = 'Zones';
$_MODULE['<{cloudcache}prestashop>content2_52b730e469f179c52956110ff7d1920f'] = 'CloudCache est centré sur l\'envoie de votre contenu à très haute vitesse. Nous convervons une copie de des éléments \'lourd\' de PrestaShop comme les images, CSS et les JavaScript dans nos datacenters répartie partout dans le monde et nous envoyons ces fichier à vos visiteurs depuis l\'endroit le plus proche de chez eux. Ci-dessous vous trouvez quelques avantage d\'avoir un site qui charge plus rapidement';
$_MODULE['<{cloudcache}prestashop>content2_3ce64c688b949bec0dcec57bbdf2e48f'] = 'Fonctionne très bien lors des période de fort traffic';
$_MODULE['<{cloudcache}prestashop>content2_be2501ec16464402d9069fabeae68cd0'] = 'Si vous devenez célébre dans la nuit (e.g. votre boutique aparrait à la télé), vos ventes vont augmenter mais votre server risque de tomber; nous vous aidons à gérer la balance de votre traffic.';
$_MODULE['<{cloudcache}prestashop>content2_867681a0d2b527c81f35f397e26d96dc'] = 'SSL personnel facilité';
$_MODULE['<{cloudcache}prestashop>content2_aeebd43d3152b36de94e03808ad25957'] = 'Notre accélération SSL alège la charge CPU de votre server de 70%. En plus, on a rendu très simple et bon marché la mise en place du SSL sur la \'cloud\'. Le coût est de 24.95$ par Zone personnalisée par mois incluant le certificat SSL.';
$_MODULE['<{cloudcache}prestashop>content2_2ea70b7571baf4de04631283af3a3a4b'] = 'Meilleur classement SEO';
$_MODULE['<{cloudcache}prestashop>content2_6ad31549b6404d19697b28d718e2aa77'] = 'Google utilise la vitesse de chargement des page comme facteur clef dans leur algorithme de classement. Les pages les plus rapide ont le meilleurs classement, ce qui signifie plus de traffic et donc plus de revenu pour vous.';
$_MODULE['<{cloudcache}prestashop>content2_5b40a55b46342c709ef61fe48a11572f'] = 'Augement le taux de conversions';
$_MODULE['<{cloudcache}prestashop>content2_8a8d5433fef3fe8b8940e32698d97e9d'] = 'Amazon a trouvé que si votre site charge 100 millisecondes plus lentement, vous perdez 1% de vos revenue. Nous penseons que pour cette simple raison, il est important de s\'inquiéter du temps de chargement des pages.';
$_MODULE['<{cloudcache}prestashop>content2_412504f79aaab3a708c24f2b5f6af4b6'] = 'Comment configurer CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_2cb43a908b4bc11d16e651063a9c4027'] = 'S\'inscrire sur CloudCache en cliquant sur le logo à droite';
$_MODULE['<{cloudcache}prestashop>content2_f85e413f1f55286db4da358df3053062'] = 'Créer des identifiants récupérer le \'User Id\' et le \'API key\'';
$_MODULE['<{cloudcache}prestashop>content2_13ad6491d90c3d8b08f072c13c34a797'] = 'jouer la video tutoriel (en anglais)';
$_MODULE['<{cloudcache}prestashop>content2_44641e218ebb6c07d0cb756a79673069'] = 'Comment configurer le module:';
$_MODULE['<{cloudcache}prestashop>content2_784f83c332ae60b4d453cb63dc8c49b1'] = 'Remplir les champs \'User Id\' et \'Api keu\' avec les informations founis par CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_2a5075cb5b1148436ee37a1ef46e51a6'] = 'Cliquer sur le bouton \'Sauvegarder les paramètres\' puis sur \'Tester la connexion\'';
$_MODULE['<{cloudcache}prestashop>content2_59c8906c9f68c992003be17308173bd9'] = 'Si vous n\'avez pas de zones, une zone par défaut sera créée';
$_MODULE['<{cloudcache}prestashop>content2_fbd942973e8b17f065e587a2512a8f7f'] = 'Pour améliorer les performances, vous pouvez aller sur votre compte CloudCache en cliquant sur le lien à droite, allez sur la liste des \'Pullzones\', choisissez votre zone, éditez la, allez à \'Advanced Settings\' et décochez l\'option \'Query String\'. Pour sauvegar, cliquez sur \'Update\'.';
$_MODULE['<{cloudcache}prestashop>content2_727283f37d3e70d3faceb71761d0fb51'] = 'But du module:';
$_MODULE['<{cloudcache}prestashop>content2_0bae64ec079443c47750df1bdbf35871'] = 'Un Content Delivery Network (CDN) est pour tout webmaster qui veut des hautes performances. Pourquoi? Parce que notre CDN hébérge vos fichiers téléchargeables (images, vidéos, scripts, css) avec des temps de chargement extrêmement rapide.';
$_MODULE['<{cloudcache}prestashop>content2_343618e9fcce53224cc7a47c2145c5e5'] = 'Quelles modifications le module apporte à mon magasin?';
$_MODULE['<{cloudcache}prestashop>content2_082be8b13b40bfbf9c9cc70316bc1fec'] = 'Le fichier Tools.php va être surchargé.';
$_MODULE['<{cloudcache}prestashop>content2_21ce50e4e30845efcb5005cdaa912bfd'] = '[Onglet Préférences -> Performance -> Servers de média] va afficher un lien vers la page de configuration du module CloudCache que celui ci est actif.';
$_MODULE['<{cloudcache}prestashop>content2_b480863a2096d2a5fca0cb3460b79c1e'] = 'Un erreur est survenue pendant le test de la connexion.';
$_MODULE['<{cloudcache}prestashop>content2_e72dafd095a9ec228dfd9c054f0530b0'] = 'Succès! C\'est out ce que vous aviez à faire!';
$_MODULE['<{cloudcache}prestashop>content2_633d7bd9ecfcb1b67fa03b8a281aa8dd'] = 'est maintenant accéléré par CloudCache.com';
$_MODULE['<{cloudcache}prestashop>content2_7e1678acc78078f22f6196a9737e3431'] = 'Succès! La connexion a été correctement établie!';
$_MODULE['<{cloudcache}prestashop>content2_bd93cd0fb528a1a2cb9cee3ecea69906'] = 'Cliquez ici pour accéder à votre compte CloudCache';
$_MODULE['<{cloudcache}prestashop>content2_c949d7fe576e586e47a39b41752bd12c'] = 'Votre bande passante disponnible est:';
$_MODULE['<{cloudcache}prestashop>content2_c6bce2a0c02ed4dc352779f8ecfdb3f5'] = 'Company ID';
$_MODULE['<{cloudcache}prestashop>content2_e9db460a0154b96521063e4054997cdc'] = 'API User';
$_MODULE['<{cloudcache}prestashop>content2_d876ff8da67c3731ae25d8335a4168b4'] = 'API Key';
$_MODULE['<{cloudcache}prestashop>content2_9daf1fb753b42c3cdc8f1d01669cd6d8'] = 'Sauvegarder les paramètres';
$_MODULE['<{cloudcache}prestashop>content2_79ddd6cfbf01f63986f7b114ecc2ca95'] = 'Cliquer ici pour tester la connexion';
$_MODULE['<{cloudcache}prestashop>content2_16bfbf9c462762cf1cba4134ec53c504'] = 'Chargement';
$_MODULE['<{cloudcache}prestashop>content2_382b0f5185773fa0f67a8ed8056c7759'] = 'N/A';
$_MODULE['<{cloudcache}prestashop>content2_7469a286259799e5b37e5db9296f00b3'] = 'OUI';
$_MODULE['<{cloudcache}prestashop>content2_c2f3f489a00553e7a01d369c103c7251'] = 'NON';
$_MODULE['<{cloudcache}prestashop>content2_2e1911a1922b9c56488e7e3d37bf9cb5'] = 'Purger le cache';
$_MODULE['<{cloudcache}prestashop>content2_50100a6fa3a40543749d43b69210d473'] = 'Synchroniser les Zones!';
$_MODULE['<{cloudcache}prestashop>content2_1cd6038e51e247649e3046c3d963658d'] = 'Ajouter des zones';
$_MODULE['<{cloudcache}prestashop>content2_3114114e2cdf0892739ee4ca557e8da5'] = 'Effacer tout le cache';
$_MODULE['<{cloudcache}prestashop>content2_93604834836f885a26ad3c780a490841'] = 'Zone ID';
$_MODULE['<{cloudcache}prestashop>content2_fa018acf009f5435d50578357f449ed3'] = 'Nom de la Pull Zone';
$_MODULE['<{cloudcache}prestashop>content2_5e50936ee3316f28363a8de993cb07e8'] = 'URL du server d\'origine';
$_MODULE['<{cloudcache}prestashop>content2_ae9980aee84bd689e09532a927049f2c'] = 'Domaine CDN personalisé';
$_MODULE['<{cloudcache}prestashop>content2_b021df6aac4654c454f46c77646e745f'] = 'Label';
$_MODULE['<{cloudcache}prestashop>content2_82af841589057aa8922b1ac3bb4a28a4'] = 'Compression';
$_MODULE['<{cloudcache}prestashop>content2_e539fd665e202f536325140d87d7bf72'] = 'Type de fichier';
$_MODULE['<{cloudcache}prestashop>content2_b1c94ca2fbc3e78fc30069c8d0f01680'] = 'Tous';
$_MODULE['<{cloudcache}prestashop>content2_9b001c69726efc0b7ef4876759a01874'] = 'Type de Zone';
$_MODULE['<{cloudcache}prestashop>content2_ea4788705e6873b424c65e91c2846b19'] = 'Annuler';
$_MODULE['<{cloudcache}prestashop>content2_c9cc8cce247e49bae79f15173ce97354'] = 'Sauvegarder';
$_MODULE['<{cloudcache}prestashop>content2_962a4c03ca790e4682304039c71e79d4'] = 'Créer la zone';
$_MODULE['<{cloudcache}prestashop>content2_96f583efefa0ce369ffeb5c3a7b3bd2a'] = 'CloudCache et PrestaShop';
$_MODULE['<{cloudcache}prestashop>content2_fb66c688ec4cf810d1d60a11a67458c4'] = 'En savoir plus sur CloudCache sur PrestaShop.com';

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,155 @@
/**
* jQuery Easy Confirm Dialog plugin 1.2
*
* Copyright (c) 2010 Emil Janitzek (http://projectshadowlight.org)
* Based on Confirm 1.3 by Nadia Alramli (http://nadiana.com/)
*
* Samples and instructions at:
* http://projectshadowlight.org/jquery-easy-confirm-dialog/
*
* This script is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*/
(function($) {
$.easyconfirm = {};
$.easyconfirm.locales = {};
$.easyconfirm.locales.enUS = {
title: 'Are you sure?',
text: 'Are you sure that you want to perform this action?',
button: ['Cancel', 'Confirm'],
closeText: 'close'
};
$.easyconfirm.locales.svSE = {
title: 'Är du säker?',
text: 'Är du säker på att du vill genomföra denna åtgärden?',
button: ['Avbryt', 'Bekräfta'],
closeText: 'stäng'
};
$.fn.easyconfirm = function(options) {
var _attr = $.fn.attr;
$.fn.attr = function(attr, value) {
// Let the original attr() do its work.
var returned = _attr.apply(this, arguments);
// Fix for jQuery 1.6+
if (attr == 'title' && returned === undefined)
returned = '';
return returned;
};
var options = jQuery.extend({
eventType: 'click',
icon: 'help'
}, options);
var locale = jQuery.extend({}, $.easyconfirm.locales.enUS, options.locale);
// Shortcut to eventType.
var type = options.eventType;
return this.each(function() {
var target = this;
var $target = jQuery(target);
// If no events present then and if there is a valid url, then trigger url change
var urlClick = function() {
if (target.href) {
var length = String(target.href).length;
if (target.href.substring(length - 1, length) != '#')
document.location = target.href;
}
};
// If any handlers where bind before triggering, lets save them and add them later
var saveHandlers = function() {
var events = jQuery.data(target, 'events');
if (events) {
target._handlers = new Array();
for (var i in events[type]) {
target._handlers.push(events[type][i]);
}
$target.unbind(type);
}
};
// Re-bind old events
var rebindHandlers = function() {
if (target._handlers !== undefined) {
jQuery.each(target._handlers, function() {
$target.bind(type, this);
});
}
};
if ($target.attr('title') !== null && $target.attr('title').length > 0)
locale.text = $target.attr('title');
var dialog = (options.dialog === undefined || typeof(options.dialog) != 'object') ?
$('<div class="dialog confirm">' + locale.text + '</div>') :
options.dialog;
var buttons = {};
buttons[locale.button[1]] = function() {
// Unbind overriding handler and let default actions pass through
$target.unbind(type, handler);
// Close dialog
$(dialog).dialog("close");
// Check if there is any events on the target
if (jQuery.data(target, 'events')) {
// Trigger click event.
$target.click();
}
else {
// No event trigger new url
urlClick();
}
init();
};
buttons[locale.button[0]] = function() {
$(dialog).dialog("close");
};
$(dialog).dialog({
autoOpen: false,
resizable: false,
draggable: false,
closeOnEscape: true,
width: 'auto',
minHeight: 220,
maxHeight: 200,
buttons: buttons,
title: locale.title,
closeText: locale.closeText,
modal: true
});
// Handler that will override all other actions
var handler = function(event) {
$(dialog).dialog('open');
event.stopImmediatePropagation();
event.preventDefault();
return false;
};
var init = function() {
saveHandlers();
$target.bind(type, handler);
rebindHandlers();
};
init();
});
};
})(jQuery);

View File

@@ -0,0 +1,388 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
// Load the XML-RPC abstraction
require(dirname(__FILE__).'/xmlrpc.inc.php');
// Defines for the report.gettotaltransfert Method rangeType values
if (!defined('CLOUDCACHE_RANGE_TYPE_TODAY'))
{
define('CLOUDCACHE_RANGE_TYPE_TODAY', '1');
define('CLOUDCACHE_RANGE_TYPE_HOUR', '2');
define('CLOUDCACHE_RANGE_TYPE_DATE', '3');
define('CLOUDCACHE_FILE_TYPE_UNASSOCIATED', 'none');
define('CLOUDCACHE_FILE_TYPE_ALL', 'all');
define('CLOUDCACHE_FILE_TYPE_IMG', 'img');
define('CLOUDCACHE_FILE_TYPE_JS', 'js');
define('CLOUDCACHE_FILE_TYPE_CSS', 'css');
define('CLOUDCACHE_FILE_TYPE_OTHER', 'other');
}
class CloudcacheApi
{
private $apiKey;
private $apiUserId;
private $companyId;
private $curDate;
private $hashType;
private $pullzoneType;
private $availableNamespaces = array('pullzone' => 'Pull Zone');
private $lastRpcRequest;
private $lastRpcResponse;
/** @var port Port of the cloudcache XML-RPC Api server */
private $port;
/** @var httpMethod Http method to be used when using the XML-RPC API */
private $httpMethod;
public function __construct()
{
// Declare which method is avaible for which namespace
$tab = array(
'user' => array('listUsers', 'update'),
'account' => array('getBandwidth'),
'report' => array(
'getTotalTransfer',
'getTotalHits',
'getTotalTransferStats',
'getCacheHitStats',
'getPopularFiles',
'getUsagePerDay',
'getNodeHits',
'getConnectionStats',
'getHourlyConnectionStats',
),
'cache' => array('purge', 'purgeAllCache'),
'pullzone' => array('listZones', 'create', 'update'),
'pushzone' => array('listZones', 'create', 'update'),
'vodzone' => array('listZones', 'create', 'update'),
// 'livezone' => array('listZones', 'create', 'update', 'delete'), // Not yet implemented
);
// Connection settings
$this->port = CLOUDCACHE_API_PORT;
$this->httpMethod = CLOUDCACHE_API_HTTP_METHOD;
$this->apiURI = CLOUDCACHE_API_URI;
$this->apiURL = CLOUDCACHE_API_URL;
// Api credentials
if (Configuration::get('PS_CIPHER_ALGORITHM'))
$this->_cipherTool = new Rijndael(_RIJNDAEL_KEY_, _RIJNDAEL_IV_);
else
$this->_cipherTool = new Blowfish(_COOKIE_KEY_, _COOKIE_IV_);
$this->apiKey = $this->_cipherTool->decrypt(Configuration::get('CLOUDCACHE_API_KEY'));
$this->apiUserId = Configuration::get('CLOUDCACHE_API_USER');
$this->companyId = Configuration::get('CLOUDCACHE_API_COMPANY_ID');
// Random stuff needed by the API
// Save the current timezone
$currentTimezone = date_default_timezone_get();
// Set the timezone to the Cloudcache one
date_default_timezone_set('America/Los_Angeles');
// Retreive the RFC 8601 With Cloudcache timezone
$this->curDate = date('c');
// Put back user timezone
date_default_timezone_set($currentTimezone);
$this->hashType = CLOUDCACHE_API_HASH_TYPE;
$this->pullzoneType = CLOUDCACHE_API_PULL_ZONE_TYPE;
}
/**
* @brief Create a new empty XML-RPC message ready for cloudcache API.
*
* @param namespace Namespace of the request
* @param method Method used
*
* @return The new xmlrpcmsg Object instance.
*/
private function _getEmptyRpcMessage($namespace, $method)
{
// reset last command
$this->lastRpcRequest = $this->lastRpcResponse = null;
return new xmlrpcmsg($namespace.'.'.$method, array(
php_xmlrpc_encode($this->apiUserId),
php_xmlrpc_encode(hash($this->hashType,
$this->curDate.':'.$this->apiKey.':'.$method)),
php_xmlrpc_encode($this->curDate),
));
}
/**
* @brief List zones.
*
* @param namespace Namespace wanted (pullzone, pushzone, vodzone)
*
* @return List of the zones (replied by the cloudcache server)
*/
public function listZones($namespace)
{
$method = 'listZones';
// Initialize the XML-RPC message
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
switch ($namespace)
{
case 'pullzone':
// For the pullzone, we add a parameter type
$rpcMsg->addParam(php_xmlrpc_encode($this->pullzoneType));
break;
case 'pushzone':
case 'vodzone':
case 'livezone':
default:
break;
}
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Create a zone.
*
* @param namespace Namespace wanted (pullzone, pushzone, vodzone)
* @param values Array describing the zone to create.
*
* @return The anwser from the server.
*/
public function createZone($namespace, $values)
{
$method = 'create';
// $values['name'] = 'zonename';
// $values['origin'] = 'zone origin url';
// $values['vanity_domain'] = 'domain to use for the zone';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
$rpcMsg->addParam(php_xmlrpc_encode($values));
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Update a zone
*
* @param namespace Namespace wanted (pullzone, pushzone, vodzone)
* @param zoneId Id of the zone to update
* @param values Array describing the new infos of the zone.
*
* @return Reply from the server.
*/
public function updateZone($namespace, $zoneId, $values)
{
$method = 'update';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
$rpcMsg->addParam(php_xmlrpc_encode($zoneId));
$rpcMsg->addParam(php_xmlrpc_encode($values));
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Retrieve the Bandwith of the wanted time area
*
* @param namespace Namespace wanted (should be 'account')
* @param from From when to check
* @param to Until when to check
*
* @return Bandwith used (Replied from the server)
*/
public function getBandwidth($namespace, $from = null, $to = null)
{
$method = 'getBandwidth';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
if ($from)
$rpcMsg->addParam(php_xmlrpc_encode($from));
if ($to)
$rpcMsg->addParam(php_xmlrpc_encode($to));
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Purge the cache of the given URL.
*
* @param namespace Namespace wanted (should be 'cache')
* @param url Url to purge
*
* @return Reply from the server.
*/
public function cachePurge($namespace, $url)
{
$method = 'purge';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
$rpcMsg->addParam(php_xmlrpc_encode($url));
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Purge all cache of the specified zone.
*
* @param namespace Namespace wanted (should be 'cache')
* @param zoneId Zone to purge.
*
* @return Reply from the server.
*/
public function cachePurgeAll($namespace, $zoneId)
{
$method = 'purgeAllCache';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
$rpcMsg->addParam(php_xmlrpc_encode($zoneId));
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Retrieve the data transfert from the given zone and dates
*
* @param namespace Namespace wanted (should be 'report')
* @param zoneId Zone to check
* @param rangeType Type of date range wanted (1: today, 2:cur day,
* 3: date range)
* @param from Date from where to retrieve the data (format Y-m-d)
* @param to Date from where to retrieve the data (format Y-m-d)
*
* @return Reply from the server.
*/
public function getTotalTransfer($namespace, $zoneId, $rangeType,
$from = null, $to = null)
{
$method = 'getTotalTransferStats';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
$rpcMsg->addParam(php_xmlrpc_encode(Configuration::get('CLOUDCACHE_API_COMPANY_ID')));
$rpcMsg->addParam(php_xmlrpc_encode($zoneId));
//$rpcMsg->addParam(php_xmlrpc_encode($rangeType));
if ($rangeType == CLOUDCACHE_RANGE_TYPE_DATE)
{
if ($from)
$rpcMsg->addParam(php_xmlrpc_encode($from));
if ($to)
$rpcMsg->addParam(php_xmlrpc_encode($to));
}
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Retrieve the data transfert from the given zone and dates
*
* @param namespace Namespace wanted (should be 'report')
* @param companyId Company to check
* @param zoneId Zone to check
* @param from Date from where to retrieve the data (format Y-m-d)
* @param to Date from where to retrieve the data (format Y-m-d)
*
* @return Reply from the server.
*/
public function getTotalTransferStats($namespace, $companyId, $zoneId,
$from, $to)
{
$method = 'getTotalTransferStats';
$rpcMsg = $this->_getEmptyRpcMessage($namespace, $method);
$rpcMsg->addParam(php_xmlrpc_encode($companyId));
$rpcMsg->addParam(php_xmlrpc_encode($from));
$rpcMsg->addParam(php_xmlrpc_encode($to));
$rpcMsg->addParam(php_xmlrpc_encode($zoneId));
return $this->_sendRequest($namespace, $rpcMsg);
}
/**
* @brief Actually send the request to the cloudcache API server.
*
* @param namespace Namespace of the request
* @param rpcMsg XML-RPC message Object containing the actual request
*
* @return Reply from the server
*/
private function _sendRequest($namespace, $rpcMsg)
{
$this->lastRpcRequest = $rpcMsg;
// Initialize the XML-RPL client
$rpcClient = new xmlrpc_client($this->apiURI.$namespace,
$this->apiURL, $this->port, $this->httpMethod);
if (file_exists(dirname(__FILE__).'/proxy.inc.php'))
{
include(dirname(__FILE__).'/proxy.inc.php');
$rpcClient->setProxy($proxy->host, $proxy->port,
$proxy->username, $proxy->password);
}
// Send the message
$this->lastRpcResponse = $rpcClient->send($rpcMsg);
return !$this->getLastFaultCode() ? php_xmlrpc_decode($this->lastRpcResponse->value()) : false;
}
public function getLastFaultCode()
{
if ($this->lastRpcResponse)
return $this->lastRpcResponse->faultCode();
return false;
}
public function getLastFaultString()
{
if ($this->lastRpcResponse)
return $this->lastRpcResponse->faultString();
return false;
}
public function getLastRpcResponse()
{
return $this->lastRpcResponse;
}
public function getLastRpcRequest()
{
return $this->lastRpcRequest;
}
public function getAvailableNamespaces($name = false)
{
return !$name ? array_keys($this->availableNamespaces) : $this->availableNamespaces;
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
modules/cloudcache/logo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

View File

@@ -0,0 +1,180 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 12823 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
if (!class_exists('CloudCache') && file_exists(dirname(__FILE__).'/../../modules/cloudcache/cloudcache.php'))
require(dirname(__FILE__).'/../../modules/cloudcache/cloudcache.php');
class Tools extends ToolsCore
{
/** @var _totalServerCount Total count of all servers */
private static $_totalServerCount = 0;
/** @var _servers Array containing all the media servers by type */
private static $_servers = null;
/** @var _serversCount Array countaining the count of servers by type */
private static $_serversCount = null;
/** @var _fileTypes Available file types */
private static $_fileTypes = null;
/** @var _activatedModule Flag weither or not the module is active */
private static $_activatedModule = false;
public static $id_group_shop = 1;
public static $id_shop = 1;
/**
* @brief Init the statics needed by getMediaServer
*/
private static function _initServers()
{
require_once(dirname(__FILE__).'/../../modules/cloudcache/backward_compatibility/backward.php');
$context = Context::getContext();
self::$id_shop = $context->shop->id;
self::$id_group_shop = $context->shop->id_group_shop;
// Init the statics
self::$_servers = array();
self::$_serversCount = array();
self::$_fileTypes = array(CLOUDCACHE_FILE_TYPE_IMG, CLOUDCACHE_FILE_TYPE_JS,
CLOUDCACHE_FILE_TYPE_CSS, CLOUDCACHE_FILE_TYPE_OTHER,
CLOUDCACHE_FILE_TYPE_ALL);
// check if the module is active
self::$_activatedModule = Configuration::get('CLOUDCACHE_API_ACTIVE');
foreach (self::$_fileTypes as $type)
{
self::$_servers[$type] = array();
self::$_serversCount[$type] = 0;
}
$d = Db::getInstance()->executeS('SELECT `cdn_url`, `file_type`
FROM `'._DB_PREFIX_.'cloudcache_zone`
WHERE `file_type` != \''.CLOUDCACHE_FILE_TYPE_UNASSOCIATED.'\' AND `id_shop` = '.(int)self::$id_shop);
$allOnly = false;
foreach ($d as $line)
if ($line['file_type'] == CLOUDCACHE_FILE_TYPE_ALL)
{
self::$_servers[CLOUDCACHE_FILE_TYPE_ALL][] = pSQL($line['cdn_url']);
self::$_serversCount[CLOUDCACHE_FILE_TYPE_ALL]++;
self::$_totalServerCount++;
$allOnly = true;
}
foreach ($d as $line)
if ($line['file_type'] && !$allOnly)
{
self::$_servers[$line['file_type']][] = $line['cdn_url'];
self::$_serversCount[$line['file_type']]++;
self::$_totalServerCount++;
}
}
public static function addJS($js_uri)
{
parent::addJS($js_uri);
global $js_files;
foreach ($js_files as &$file)
if (!preg_match('/^http(s?):\/\//i', $file))
$file = 'http://'.self::getMediaServer($file).$file;
}
public static function addCSS($css_uri, $css_media_type = 'all')
{
parent::addCSS($css_uri, $css_media_type);
global $css_files;
$new = array();
foreach ($css_files as $key => $file)
{
if (!preg_match('/^http(s?):\/\//i', $key))
$key = 'http://'.self::getMediaServer($key).$key;
$new[$key] = $file;
}
$css_files = $new;
}
/**
* @brief Retrieve the media server to use
*
* @param filename Name of the file to serve (acually, part of the path)
*
* @todo Check performences
*
* @return URL of the server to use.
*/
public static function getMediaServer($filename)
{
// Override default behavior only if module is active
if (!class_exists('CloudCache'))
include(dirname(__FILE__).'/../../modules/cloudcache/cloudcache.php');
$module = new CloudCache();
if (!$module->active)
return parent::getMediaServer($filename);
// Init the server list if needed
if (!self::$_servers)
self::_initServers();
if (!self::$_activatedModule)
return parent::getMediaServer($filename);
// If there is a least one ALL server, then use one of them
if (self::$_serversCount[CLOUDCACHE_FILE_TYPE_ALL])
// Return one of those server
return (self::$_servers[CLOUDCACHE_FILE_TYPE_ALL][(abs(crc32($filename)) %
self::$_serversCount[CLOUDCACHE_FILE_TYPE_ALL])]);
// If there is servers, then use them
if (self::$_totalServerCount)
{
// Loop on the file types to find the current one
foreach (self::$_fileTypes as $type)
// If we find the type in the filename, then it is our
if (strstr($filename, $type) && self::$_serversCount[$type])
{
// Return one of those server
return (self::$_servers[$type][(abs(crc32($filename)) %
self::$_serversCount[$type])]);
}
// If no file type found, then it is 'other'
// If there is server setted for the 'other' type, use it
if (self::$_serversCount[CLOUDCACHE_FILE_TYPE_OTHER])
// Return one of the server setted up
return (self::$_servers[$type][(abs(crc32($filename)) %
self::$_serversCount[$type])]);
}
// If there is no server setted up, then use the parent method
return parent::getMediaServer($filename);
}
}

View File

@@ -0,0 +1,55 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 1.4 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
class FrontController extends FrontControllerCore
{
public function addCSS($css_uri, $css_media_type = 'all')
{
if (!is_array($css_uri))
$css_uri = array($css_uri);
$new_uri = array();
foreach ($css_uri as $uri)
if ($uri && !preg_match('/^http(s?):\/\//', $uri) && preg_match('#.css$#', $uri))
$new_uri[] = 'http://'.Tools::getMediaServer($uri).$uri;
else
$new_uri[] = $uri;
return parent::addCSS($new_uri, $css_media_type);
}
public function addJS($js_uri)
{
if (!is_array($js_uri))
$js_uri = array($js_uri);
foreach ($js_uri as &$uri)
if ($uri && !preg_match('/^http(s?):\/\//', $uri))
$uri = 'http://'.Tools::getMediaServer($uri).$uri;
return parent::addJS($js_uri);
}
}

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,94 @@
$(function(){
$('.tabbed-form.content li').not('#tab1_content').hide();
$('.tabbed-form.menu li').click(function(){
$('.tabbed-form.menu li').removeClass('active');
$(this).addClass('active');
$('.tabbed-form.content li').hide();
$('.tabbed-form.content li:eq(' + $(this).index() + ')').show();
});
$('.tabbed-form.menu li:eq(0)').addClass('active');
$('.tabbed-form.content li:eq(0)').show();
/* Make table first column bolded (on table with 2 cols) */
$('.bold-first-column td:even').addClass('bold');
/* Make sure all .tree.closed have (+) inside, and the content is not shown */
$('span.tree-button').live('click', function(){
$(this).parent().find('.details').toggle("fast");
$(this).toggleClass('opened');
if ($(this).hasClass('opened'))
$(this).html('&ndash;');
else
$(this).html('+');
});
/* jExcerpt v1.1.1 */
length = 20;
jExcerptClass = '.jexcerpt-short';
$(jExcerptClass).each(function(){
if ($(this).text().length > length)
{
// Create the .jexcerpt-long
$('<div class="jexcerpt-long">' + $(this).text() + '</div>').appendTo($(this).parent());
excerpt = $(this).text().substring(0, length);
$(this).text(excerpt + '...');
}
});
$(jExcerptClass).mouseover(function(){
$('.jexcerpt-long').hide();
$(this).parent().attr('width', $(this).parent().width());
$(this).parent().find('.jexcerpt-long')
.css('left', $(this).parent().offset().left + 4 + 'px')
.css('top', $(this).parent().offset().top + 9 + 'px')
.show();
});
$('.jexcerpt-long').live('mouseout', function(){
$(this).parent().find(jExcerptClass).show();
$(this).hide();
});
/* Add span.tree for those .tree who have .details */
$('<span class="tree-button">+</span>').prependTo($('.tree').has('.details'));
if ($('#cloudcache_edit_zone_form').size())
window.scroll(0, $('#cloudcache_edit_zone_form').offset().top-100);
/* CRUD Zones*/
$('#cloudcache_add_zone_form').hide();
$('#cloudcache_add_zone').live('click', function(event){
if ($('.tabbed-form.menu li.active').size())
{
indexActiveTab = $('.tabbed-form.menu li.active').index();
$('#cloudcache_add_zone_form:eq(' + indexActiveTab + ') #type').attr('value', 'pullzone');
$('#cloudcache_add_zone_form:eq(' + indexActiveTab + ')').toggle('fast');
} else {
$('#cloudcache_add_zone_form').toggle();
}
event.preventDefault();
});
$('.SubmitCloudcacheEditZone').click(function(event){
$('.CloudcacheZone_action').val('edit');
$(this).parent().submit();
});
$('.SubmitCloudcacheClearZoneCache').click(function(event){
$('.CloudcacheZone_action').val('clear_zone_cache');
$(this).parent().submit();
});
/* Validate the required fields */
$('#SubmitCloudcacheAdd_zone').click(function(){
if ($('#name').val().length < 1 || $('#origin').val().length < 1)
{
alert($('#requiredFieldsTranslation').text());
return false;
}
else
$(this).parent('form').submit();
});
});

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,21 @@
<?php
$sql = array();
$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'cloudcache_zone` (
`id_zone` int(10) unsigned NOT NULL,
`id_shop` int(10) unsigned NOT NULL,
`id_group_shop` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`origin` varchar(255) NULL,
`compress` tinyint NULL,
`label` varchar(255) NULL,
`cdn_url` varchar(255) NOT NULL,
`bw_yesterday` int(10) NOT NULL,
`bw_last_week` int(10) NOT NULL,
`bw_last_month` int(10) NOT NULL,
`file_type` varchar(16) NOT NULL,
`zone_type` varchar(16) NOT NULL,
PRIMARY KEY (`id_zone`, `id_shop`),
UNIQUE (`id_zone`, `name`, `cdn_url`))
ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';

View File

@@ -0,0 +1,5 @@
<?php
$sql = array();
$sql[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'cloudcache_zone`;';

View File

@@ -0,0 +1,128 @@
fieldset.cloudcache_fieldset td.cloudcache_column { padding: 0 18px; text-align: right; vertical-align: top;}
fieldset.cloudcache_fieldset input[type=text] { width: 250px; }
fieldset.cloudcache_fieldset input.cloudcache_button { margin-top: 10px; }
fieldset.cloudcache_fieldset div#test_connection { margin-left: 18px; border: 1px solid #DFD5C3; padding: 5px; font-size: 11px; margin-bottom: 10px; width: 90%; }
fieldset.cloudcache_fieldset a { color: #0000CC; font-weight: bold; text-decoration: underline; }
.clear {clear: both; margin: 0 auto;}
.current-page {border: 1px solid #000; padding: 3px;}
.description {font-size: 11px; color: #777; font-style: italic; margin-top: 3px;}
.small { font-size: 10px; display: inline-block; }
.tabbed-form { margin: 0px; padding: 0px; }
.tabbed-form.menu li { list-style: none; float: left; border: 1px solid #CCC; padding: 3px 6px; border-bottom: none;}
.tabbed-form.menu li.active { background: #FFF; height: 22px; margin-top: -7px; border: 1px solid #AAA; border-bottom: none; position: relative; top: 2px;}
.tabbed-form.menu li:hover { background: #FFF; cursor: pointer; }
.tabbed-form.content { border: 1px solid #AAA; padding-left: 10px; background: #FFF;}
.tabbed-form.content li { list-style: none; width: 100%; padding: 10px; }
span.tree-button { border: 1px solid #000000; font-size: 10px; height: 0; margin: 4px; padding: 0 2px; }
span.tree-button:hover { background: #DDD; cursor: pointer; }
.tree .details { display: none; margin: 5px 20px;}
.tree table { vertical-align: middle; }
.tree table td { padding: 0px 5px; min-width: 50px;}
.spaced-table { border-collapse: collapse }
.spaced-table td {padding: 0px 5px; min-width: 50px; font-weight: bold; border-bottom: 1px dashed #E8E8E8;}
.spaced-table2 th{ min-width: 65px; }
.spaced-table2 td{ max-width: 100px; }
.cloudcache-dialogbox { border: 1px solid #D8D8D8; padding: 10px; width: 90%; margin: 10px 0px;}
.cloudcache-dialogbox input { margin: 5px 0px;}
.cloudcache-dialogbox label{ padding: 0.2em 1.5em 0 0; width: 150px; }
.prepaid-bandwidth {
background: none repeat scroll 0 0 #DDE9F7;
border: 1px solid #50B0EC;
font-size: 11px;
left: 566px;
padding: 10px;
position: relative;
text-shadow: 0 1px 0 #FFFFFF;
top: 26px;
width: 155px;
}
.prepaid-bandwidth.coupon {
left: 565px;
width: 340px;
}
.bandwidth-value { font-size: 30px; text-align: center; margin-top: 10px;}
.bold-td { font-weight: bold; }
.hint { padding: 8px 6px 8px 42px; }
/* Aliases */
.MB0 {margin-bottom: 0;}
.MB10 {margin-bottom: 10px;}
.MB20 {margin-bottom: 20px;}
.MB30 {margin-bottom: 30px;}
.MT0 {margin-top: 0;}
.MT10 {margin-top: 10px;}
.MT20 {margin-top: 20px;}
.MT30 {margin-top: 30px;}
.ML0 {margin-left: 0px;}
.ML10 {margin-left: 10px;}
.ML20 {margin-left: 20px;}
.ML30 {margin-left: 30px;}
.MR0 {margin-right: 0px;}
.MR10 {margin-right: 10px;}
.MR20 {margin-right: 20px;}
.MR30 {margin-right: 30px;}
.resetM {margin: 0;}
.C { clear: both; margin: 0 auto; }
.I {font-style: italic;}
.L {float: left;}
.R {float: right;}
/* jExcerpt */
.jexcerpt-long {
float: left;
display: none;
position: absolute;
background: #FFF;
border: 1px solid #444;
padding: 3px;
margin: -3px;
cursor: default;
}
.jexcerpt-short {
float: left;
}
#requiredFieldsTranslation { display: none; }
/* Tabs */
#menuTab {
float: left;
padding: 0;
margin: 0;
text-align: left;
}
#menuTab li {
text-align: left;
float: left;
display: inline;
padding: 5px;
padding-right: 10px;
background: #EFEFEF;
font-weight: bold;
cursor: pointer;
border-left: 1px solid #CCCCCC;
border-right: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
}
#menuTab li.menuTabButton.selected {
background: #FFFFF0;
border-left: 1px solid #CCCCCC;
border-right: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
height: 20px;
margin-bottom: -8px;
margin-top: -4px;
}
#tabList { clear: left; }
.tabItem { display: none; }
.tabItem.selected { display: block; background: #FFFFF0; border: 1px solid #CCCCCC; padding: 10px; padding-top: 20px; }

View File

@@ -0,0 +1,35 @@
{literal}
<script type="text/javascript">
$(function(){
{/literal}
mediaServerForm = $('input[name="submitMediaServers"]').parent().parent();
ccc = $('input[name="submitCCC"]').parent().parent();
{if $isModuleActive}
legend = $(mediaServerForm).find('legend').html();
$(mediaServerForm).empty();
$('<legend>' + legend + '</legend>' +
'<div class="conf"><img alt="" src="../img/admin/ok2.png">' +
'{l s='You are currently saving even more performance by' mod='cloudcache'}' +
' <a href="?tab=AdminModules&configure=cloudcache&token={$adminToken}&tab_module=administration&module_name=cloudcache" style="color: blue; font-weight: bold">' +
'{l s='using CloudCache module' mod='cloudcache'}</a>, ' +
'{l s='the Best CDN service recommended by PrestaShop users!' mod='cloudcache'} ' +
'</div>').prependTo(mediaServerForm);
{else}
$('<div class="warn"><img src="../img/admin/warn2.png">' + '{l s='Save even more performance by' mod='cloudcache'}' + '<a href="?tab=AdminModules&configure=cloudcache&token={$adminToken}&tab_module=administration&module_name=cloudcache" style="color: blue; font-weight: bold">{l s='activating CloudCache module' mod='cloudcache'}</a>, {l s='the Best CDN service recommended by PrestaShop users!' mod='cloudcache'}</div>').prependTo(mediaServerForm);
{/if}
{if $isModuleActive}
{if isset($compatibilityIssues)}
$('<div class="warn"><img src="../img/admin/warn2.png"> ' +
{foreach from=$compatibilityIssues key=i item=message}
'{if $i > 0}{$i} - {/if}{$message}' +
{/foreach}
'</div>').prependTo(ccc);
{else}
$('<div class="conf"><img src="../img/admin/ok2.png">{l s='Everything looks good for CloudCache' mod='cloudcache'}</div>').prependTo(ccc);
{/if}
{/if}
{literal}
});</script>
{/literal}

View File

@@ -0,0 +1,360 @@
<script type="text/javascript" src="{$base_dir}modules/cloudcache/script.js"></script>
<link rel="stylesheet" type="text/css" href="{$base_dir}modules/cloudcache/style.css" />
<script type="text/javascript">
var apikey = '{$apiKey|escape}';
{literal}
$(document).ready(function()
{
$('#loading').hide();
$("#SubmitCloudcacheSettings").click(function()
{
if ($("#cloudcache_api_user").val() != '' && $("#cloudcache_api_key").val() != '')
{
if (apikey == '')
return true;
if (confirm("Are you sure ?"))
return true;
}
return false;
});
});
{/literal}
</script>
<div style="float:right;width:400px;margin-bottom:10px">
<fieldset>
<h3>{l s='Opening your CloudCache.com Account' mod='cloudcache'}</h3>
<p>{l s='CloudCache provides Prestashop users an exclusive discount of 25% per month on every available package. Please click the logo below to sign up: ' mod='cloudcache'}</p><br/>
<a href="http://www.cloudcache.com/prestashop"><img style="width: 370px;" src="{$base_dir}modules/cloudcache/cloudcache_ps_logo.png" alt="cloudcache"/></a>
</fieldset>
</div>
<div style="width:450px">
<div style="float: left; width: 150px">
<img style="width:150px; float:left; margin:25px 20px 0px 0px;" src="../modules/cloudcache/cloudcache_logo.png" alt="cloudcache"/>
</div>
<div style="float: left; width: 250px; margin: 25px;">
<b>{l s='This module allows you to acclerate your PrestaShop via the CloudCache Content Delivery Network.' mod='cloudcache'}</b><br /><br />
{l s='A content Delivery Network (CDN) is for every site owner who demands a high performance, primo visitor experience.' mod='cloudcache'}
</div>
</div>
<br/>
<br/>
{if isset($confirmMessage)}
<div style="clear:both" class="conf {$confirmMessage['class']}">
<img src="../img/admin/{$confirmMessage['img']}" alt="" title="" />
{$confirmMessage['text']}
</div>
{/if}
{if isset($compatibilityIssues)}
<fieldset style="clear:both" class="width6 cloudcache_fieldset">
<legend>
<img src="../img/admin/statsettings.gif" alt="" />
{l s='CloudCache Compatibilty Check' mod='cloudcache'}
</legend>
<p>
<div class="warn">
<img src="../img/admin/warn2.png" />
{foreach from=$compatibilityIssues key=i item=message}
{if $i > 0}{$i|strip_tags} - {/if}{$message|strip_tags}<br />
{/foreach}
</div>
</p>
</fieldset><br />
{else}
<ul id="menuTab" style="clear:both">
<li id="menuTab1" class="menuTabButton selected">{l s='Why CloudCache' mod='cloudcache'}</li>
<li id="menuTab2" class="menuTabButton">{l s='Help' mod='cloudcache'}</li>
<li id="menuTab3" class="menuTabButton">{l s='Settings' mod='cloudcache'}</li>
{if isset($couponUrl) && isset($apiActive) && $apiActive == 1}
<li id="menuTab4" class="menuTabButton">{l s='Zones' mod='cloudcache'}</li>
{/if}
</ul>
<div id="tabList">
<div id="menuTab1Sheet" class="tabItem selected">
<p>{l s='CloudCache is focused on delivering your web content at light speed efficiency. We keep a copy of the “heavy” objects from your PrestaShop, like images, CSS and JavaScript on our datacenters around the world and deliver these to your visitors from the closest location to them. Here are numerous benefits of having a faster loading site: ' mod='cloudcache'}</p>
{*
<ul>
<li><b>{l s='Thrive During Traffic Spikes!' mod='cloudcache'}</b><p style="display: block;">{l s='In case you become famous overnight (i.e your shop is mentioned on TV), your sales would skyrocket, but your server might crash from the load; we help you to load balance your traffic.' mod='cloudcache'}</p><br /></li>
<li><p><b style="display: block;">{l s='Custom SSL made Easy' mod='cloudcache'}</b><br /></p>{l s='Our SSL acceleration offloads up to 70% of your server CPU power. Plus we made it super easy and affordable to run SSL on the cloud. We only charge $24.95 per Custom SSL Zone, per month including the SSL certificate.' mod='cloudcache'}</li>
<li><p><b>{l s='Higher SEO Rankings' mod='cloudcache'}</b><br /></p><p>{l s='Google uses page speed as a key factor in their ranking algorithm. Faster loading pages earn higher rankings in search results, which means more traffic and more money for you.' mod='cloudcache'}</p></li>
<li><p><b>{l s='Increase your Conversions' mod='cloudcache'}</b></p><p>{l s='Amazon found that if your site loads 100 milliseconds slower they lose 1% of their revenue. We think that this reason alone is enough to worry about page load time.' mod='cloudcache'}</p></li>
</ul> *}
<ul style="float: right; width: 45%;">
<li style="margin-bottom: 10px;"><b>Thrive During Traffic Spikes!</b><br />In case you become famous overnight (i.e your shop is mentioned on TV), your sales would skyrocket, but your server might crash from the load; we help you to load balance your traffic.</li>
<li><b>Custom SSL made Easy</b><br />Our SSL acceleration offloads up to 70% of your server CPU power. Plus we made it super easy and affordable to run SSL on the cloud. We only charge $24.95 per Custom SSL Zone, per month including the SSL certificate.</li>
</ul>
<ul style="float: right; width: 45%">
<li style="margin-bottom: 10px;"><b>Higher SEO Rankings</b><br />Google uses page speed as a key factor in their ranking algorithm. Faster loading pages earn higher rankings in search results, which means more traffic and more money for you.<br /></li>
<li><b>Increase your Conversions</b><br />Amazon found that if your site loads 100 milliseconds slower they lose 1% of their revenue. We think that this reason alone is enough to worry about page load time.<br /></li>
</ul>
<div style="clear:both;"></div>
</div>
<div id="menuTab2Sheet" class="tabItem">
<h3>{l s='How to configure CloudCache' mod='cloudcache'}</h3>
- {l s='Subscribe to CloudCache by clicking on the logo on the right' mod='cloudcache'}<br />
- {l s='Create an API user and retrieve the User ID and the API key' mod='cloudcache'} (<a style="color:blue;text-decoration:underline" href="http://www.youtube.com/watch?v=YfKFkq-J2CU">{l s='see how-to video' mod='cloudcache'}</a>)<br /><br />
<h3>{l s='How to configure the Module:' mod='cloudcache'}</h3>
- {l s='Fill the CloudCache User ID and API key fields with those provided by CloudCache.' mod='cloudcache'}<br />
- {l s='Click on the "Save Settings" button and then Test your connection.' mod='cloudcache'}<br />
- {l s='If you do not have existing zones, a default zone will be created.' mod='cloudcache'}<br />
- {l s='In order to increase the performance, you can go to your CloudCache account by clicking on the link at the right, go to the Pullzones list, choose your zone, edit it, go to the Advanced Settings and uncheck the "Query String" option. In order to save the change, click on the "Update".' mod='cloudcache'}<br /><br />
{* <h3>{l s='Module purpose:' mod='cloudcache'}</h3>
{l s='A Content Delivery Network (CDN) is for every site owner who demands a high performance, primo visitor experience. Why? Because our CDN delivers your downloadables images, video, scripts, css with super-fast load times. ' mod='cloudcache'}<br /><br /> *}
<h3>{l s='What modifications does the module do on my store?' mod='cloudcache'}</h3>
- {l s='Tools.php will be overwritten.' mod='cloudcache'}<br />
- {l s='[Preferences Tab -> Performance -> Media Servers] will display a link to the CloudCache module configurations and a notification when the module is active.' mod='cloudcache'}<br />
</div>
<div id="menuTab3Sheet" class="tabItem">
<form action="{$serverRequestUri|strip_tags}&id_tab=3" method="post">
{if isset($connectionTestResult)}
<div id="test_connection" style="background: {$connectionTestResult[1]};" >
{$connectionTestResult[0]}<br />
{if $connectionTestResult[1] == '#FFD8D8'}
<b style="color: red">{l s='An error occured while testing the connection.' mod='cloudcache'}</b>
{elseif isset($connectionTestResult['newZone'])}
<b style="color: green;">{l s='Success! That is all you have to do!' mod='cloudcache'} {$connectionTestResult['newZone']|escape} {l s='is now accelerated by cloudcache.com' mod='cloudcache'}</b>
{else}
<b style="color: green;">{l s='Success! The connection have been established!' mod='cloudcache'}</b>
{/if}<br />
</div>
{/if}
<div style="height: 0px;">
<div style="display: block; float: right; margin-top: 14px;">
{if !empty($companyId)}
<fieldset>
<legend>CloudCache</legend>
<a href="http://login.cloudcache.com">
{l s='Click Here to access your CloudCache account' mod='cloudcache'}
</a>
</fieldset>
{/if}
</div>
<div style="clear: both;"></div>
{*if isset($couponUrl) && isset($apiActive) && $apiActive == 1}
<div class="prepaid-bandwidth MT20" style="display: block;">
<b>{l s='Your available bandwidth is:' mod='cloudcache'}</b><br />
<div class="bandwidth-value">{$prepaidBandwith|escape} Tb left</div>
</div>
{/if*}
</div>
<table border="0" cellspacing="5">
{if 0 && !empty($companyId)}<tr>
<td class="cloudcache_column">{l s='Company ID' mod='cloudcache'}</td>
<td><input type="text" name="cloudcache_api_company_id" value="{if isset($companyId)}{$companyId|escape}{/if}" /></td>
</tr> {/if}
<tr>
<td class="cloudcache_column">{l s='API User' mod='cloudcache'}</td>
<td><input type="text" name="cloudcache_api_user" id="cloudcache_api_user" value="{if isset($apiUser)}{$apiUser|escape}{/if}" /></td>
</tr>
<tr>
<td class="cloudcache_column">{l s='API Key' mod='cloudcache'}</td>
<td><input type="{if isset($apiKey) && !empty($apiKey)}password{else}text{/if}" id="cloudcache_api_key" name="cloudcache_api_key" value="{if isset($apiKey)}{$apiKey|escape}{/if}"/></td>
</tr>
</table>
<center><input type="submit" id="SubmitCloudcacheSettings" class="button cloudcache_button" name="SubmitCloudcacheSettings" value="{l s='Save Settings' mod='cloudcache'}" /></center>
<hr size="1" style="margin: 14px auto;" noshade />
<center><img src="../img/admin/exchangesrate.gif" alt="" /> <input type="submit" onClick="$('#loading').show();" id="cloudcache_test_connection" class="button cloudcache_button" name="SubmitCloudcacheTestConnection" value="{l s='Click here to Test Connection' mod='cloudcache'}" style="margin-top: 0;" /><div id="loading" >{l s='Loading' mod='cloudcache'} <img src="{$base_dir|escape}modules/cloudcache/loading.gif" style="height: 25px;" /></div></center>
</form>
</div>
{if isset($couponUrl) && isset($apiActive) && $apiActive == 1}
<div id="menuTab4Sheet" class="tabItem">
<!-- Menu -->
{if !empty($zones)}
<ul class="tabbed-form menu">
{foreach from=$allAvailableZones key=type item=name}
<li>{$name|escape}</li>
{/foreach}
</ul>
<ul class="tabbed-form content" style="margin-top: 23px">
<li id="tab1_content">
<table style="display: inline-block;" class="spaced-table2">
<tr>
<th>Name</th>
<th>File Type</th>
<th>Origin</th>
<th>Vanity URL</th>
{* <th>Label</th> *}
<th>Compress</th>
<th>BW Last Month</th>
<th>BW Last Week</th>
<th>BW Yesterday</th>
<th style="min-width: 150px;"></th>
</tr>
{foreach from=$zones key=id_zone item=zone}
<tr align="left" valign="top">
<td>{$zone['name']|escape}</td>
<td>{if $zone['file_type'] eq null or $zone['file_type'] eq 'none' or $zone['file_type'] eq '0'}{l s='N/A' mod='cloudcache'}{else}{$zone['file_type']|upper|escape}{/if}</td>
<td><div class="jexcerpt-short">{$zone['origin']|substr:0:10|escape}{if $zone['origin']|strlen > 10}...{/if}</div>{if $zone['origin']|strlen > 10}<div class="jexcerpt-long">{$zone['origin']}</div>{/if}</td>
<td><span class="jexcerpt-short">{$zone['cdn_url']|substr:0:10|escape}{if $zone['cdn_url']|strlen > 10}...{/if}</span>{if $zone['cdn_url']|strlen > 10}<span class="jexcerpt-long">{$zone['cdn_url']|escape}</span>{/if}</td>
{* <td>{if isset($zone.label)}{$zone['label']|escape}{/if}</td> *}
<td>{if isset($zone['compress']) && $zone['compress'] == 1}{l s='YES' mod='cloudcache'}{else}{l s='NO' mod='cloudcache'}{/if}</td>
<td>{if $zone.bw_last_month != -1}{$zone['bw_last_month']|escape}{else}{l s='N/A' mod='cloudcache'}{/if}</td>
<td>{if $zone.bw_last_week != -1}{$zone['bw_last_week']|escape}{else}{l s='N/A' mod='cloudcache'}{/if}</td>
<td>{if $zone.bw_yesterday != -1}{$zone['bw_yesterday']|escape}{else}{l s='N/A' mod='cloudcache'}{/if}</td>
<td>
<form method="post" action="{$serverRequestUri|strip_tags}&id_tab=4">
<input type="hidden" value="{$id_zone|escape}" name="id_zone"/>
<input type="hidden" value="" name="CloudcacheZone_action" class="CloudcacheZone_action"/>
<input type="submit" name="SubmitCloudcacheEditZoneAction" value="Edit" class="button"/>
<input type="submit" name="SubmitCloudcacheClearZoneCache" value="{l s='Purge Cache' mod='cloudcache'}" class="button"/>
</form>
</td>
</tr>
{/foreach}
</table>
</li>
</ul>
{/if}
<form method="post" action="{$serverRequestUri|strip_tags}&id_tab=4" class="MT20">
<div class="R">
<input type="submit" class="button MB10" id="SubmitCloudcacheSync" name="SubmitCloudcacheSync" value="{l s='Sync Zones!' mod='cloudcache'}" />
{if !isset($edit_zone_info)}
<input type="submit" class="button MB10" id="cloudcache_add_zone" name="cloudcache_add_zone" value="{l s='Add zones' mod='cloudcache'}" />
{/if}
<input type="submit" class="button MB10" id="SubmitCloudcacheClearAllCache" name="SubmitCloudcacheClearAllCache" value="{l s='Clear All Cache' mod='cloudcache'}" />
</div>
</form>
<div style="margin-bottom: 60px;"></div>
{if isset($edit_zone_info)}
<div id="cloudcache_edit_zone_form" class="cloudcache-dialogbox">
<form method="post" action="{$serverRequestUri|strip_tags}&id_tab=4">
<input type="hidden" name="id_zone" id="id_zone" value="{$edit_zone_info['id_zone']|escape}"/>
<table border="0" cellspacing="5" class="bold-td">
<tr>
<td>{l s='ID Zone' mod='cloudcache'}</td>
<td>{$edit_zone_info['id_zone']|escape}</td>
</tr>
<tr>
<td>{l s='Pull Zone Name' mod='cloudcache'}</td>
<td><input type="hidden" name="name" id="name" size="20" maxlength="30" value="{$edit_zone_info['name']|escape}"/>{$edit_zone_info['name']|escape}</td>
</tr>
<tr>
<td>{l s='Origin Server Url' mod='cloudcache'}</td>
<td><input type="hidden" name="origin" id="origin" size="20" maxlength="30" value="{$edit_zone_info['origin']|escape}"/>{$edit_zone_info['origin']|escape}</td>
</tr>
<tr>
<td>{l s='Custom CDN Domain' mod='cloudcache'}</td>
<td><input type="text" name="vanity_domain" id="vanity_domain" size="20" maxlength="30" value="{$edit_zone_info['cdn_url']|escape}"/></td>
</tr>
<tr>
<td>{l s='Label' mod='cloudcache'}</td>
<td><input type="text" name="label" id="label" size="20" maxlength="30" value="{$edit_zone_info['label']|escape}"/></td>
</tr>
<tr>
<td>{l s='Compression' mod='cloudcache'}</td>
<td>
<input type="checkbox" name="compress" id="compress" size="20" maxlength="30" {if $edit_zone_info['compress'] == 1}checked="checked"{/if}/>
</td>
</tr>
<tr>
<td>{l s='File Type' mod='cloudcache'}</td>
<td>
<select name="file_type" id="file_type">
<option value="all" {if $edit_zone_info['file_type'] == 'all'}selected="selected"{/if}>{l s='All' mod='cloudcache'}</option>
<option value="0" {if !$edit_zone_info['file_type']}selected="selected"{/if}>--not assigned--</option>
<option value="css" {if $edit_zone_info['file_type'] == 'css'}selected="selected"{/if}>CSS</option>
<option value="js" {if $edit_zone_info['file_type'] == 'js'}selected="selected"{/if}>JS</option>
<option value="img" {if $edit_zone_info['file_type'] == 'img'}selected="selected"{/if}>Images</option>
<option value="other" {if $edit_zone_info['file_type'] == 'other'}selected="selected"{/if}>Others</option>
</select>
<input type="hidden" style="display: none;" name="type" value="pullzone" />
</td>
</tr>
{* <tr>
<td>{l s='Zone Type' mod='cloudcache'}</td>
<td><select name="type" id="type">
{foreach from=$allAvailableZones key=type item=name}
<option value="{$type|escape}" {if $edit_zone_info['type'] == $type}selected="selected"{/if}>{$name|escape}</option>
{/foreach}
</select>
</td>
</tr>
*}
<tr>
<td></td>
<td>
<input type="submit" class="button R" style="margin: 0px 10px;" id="cloudcache_close_edit" name="cloudcache_close_edit" value="{l s='Cancel' mod='cloudcache'}" />
<input type="submit" name="SubmitCloudcacheEdit_zone" id="SubmitCloudcacheEdit_zone" value="{l s='Save' mod='cloudcache'}" class="button R ML20" style="margin: 0px 10px;" />
</td>
</tr>
</table>
<div class="C"></div>
</form>
</div>
{else}
<div id="cloudcache_add_zone_form" class="cloudcache-dialogbox">
<form method="post" action="{$serverRequestUri|strip_tags}&id_tab=4">
<table border="0" cellspacing="5" class="bold-td">
<tr>
<td>{l s='Pull Zone Name' mod='cloudcache'}<sup> *</sup></td>
<td><input type="text" name="name" id="name" size="20" maxlength="30" /></td>
</tr>
<tr>
<td>{l s='Origin Server Url' mod='cloudcache'}<sup> *</sup></td>
<td><input type="text" name="origin" id="origin" size="20" maxlength="30" value="{$defaultOriginServerURL|strip_tags}"/></td>
</tr>
<tr>
<td>{l s='Custom CDN Domain' mod='cloudcache'}</td>
<td><input type="text" name="vanity_domain" id="vanity_domain" size="20" maxlength="30" /></td>
</tr>
<tr>
<td>{l s='Label' mod='cloudcache'}</td>
<td><input type="text" name="label" id="label" size="20" maxlength="30" /></td>
</tr>
<tr>
<td>{l s='Compression' mod='cloudcache'}</td>
<td><input type="checkbox" name="compress" id="compress" size="20" maxlength="30" /></td>
</tr>
<tr>
<td>{l s='Zone Type' mod='cloudcache'}</td>
<td><select name="type" id="type">
{foreach from=$allAvailableZones key=type item=name}
<option value="{$type|escape}">{$name|escape}</option>
{/foreach}
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="SubmitCloudcacheAdd_zone" id="SubmitCloudcacheAdd_zone" value="{l s='Create Zone' mod='cloudcache'}" class="button R MR20" /></td>
</tr>
</table>
<div class="C"></div>
</form>
</div>
{/if}
</div>
{/if}
</div>
{/if}
<br clear="left" />
<fieldset class="width2 cloudcache_fieldset">
<legend><img src="../img/admin/statsettings.gif" alt="" />{l s='Cloudcache and PrestaShop' mod='cloudcache'}</legend>
<p><a href="http://www.prestashop.com/en/industry-partners/management/cloudcache" target="_blank">{l s='Learn more about Cloudcache at PrestaShop.com' mod='cloudcache'}</a></p>
</fieldset><br />
<br />
<script type="text/javascript">
{literal}
$(".menuTabButton").click(function () {
$(".menuTabButton.selected").removeClass("selected");
$(this).addClass("selected");
$(".tabItem.selected").removeClass("selected");
$("#" + this.id + "Sheet").addClass("selected");
});
{/literal}
{if (isset($cloudcache_id_tab))}
var id_tab = '{$cloudcache_id_tab}';
{literal}
$(".menuTabButton.selected").removeClass("selected");
$("#menuTab"+id_tab).addClass("selected");
$(".tabItem.selected").removeClass("selected");
$("#menuTab"+id_tab+"Sheet").addClass("selected");
{/literal}
{/if}
</script>

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2012 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2012 PrestaShop SA
* @version Release: $Revision: 14011 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;