diff --git a/core/bootstrap.php b/core/bootstrap.php index 468df2eac..0cc61ceaa 100755 --- a/core/bootstrap.php +++ b/core/bootstrap.php @@ -11,12 +11,10 @@ define('THELIA_CONF_DIR' , THELIA_LOCAL_DIR . 'config/'); define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules/'); define('THELIA_WEB_DIR' , THELIA_ROOT . 'web/'); define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . 'templates/'); -define('DS', DIRECTORY_SEPARATOR); +define('DS' , DIRECTORY_SEPARATOR); $loader = require __DIR__ . "/vendor/autoload.php"; - - if (!file_exists(THELIA_ROOT . '/local/config/database.yml') && !defined('THELIA_INSTALL_MODE')) { $request = \Thelia\Core\HttpFoundation\Request::createFromGlobals(); header('location: '.$request->getSchemeAndHttpHost() . '/install'); diff --git a/core/lib/Thelia/Action/HttpException.php b/core/lib/Thelia/Action/HttpException.php index 50ee92d5e..10e0dad37 100755 --- a/core/lib/Thelia/Action/HttpException.php +++ b/core/lib/Thelia/Action/HttpException.php @@ -24,7 +24,7 @@ namespace Thelia\Action; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/core/lib/Thelia/Config/Resources/config.xml b/core/lib/Thelia/Config/Resources/config.xml index e75ab8ebb..198f9f999 100755 --- a/core/lib/Thelia/Config/Resources/config.xml +++ b/core/lib/Thelia/Config/Resources/config.xml @@ -55,8 +55,6 @@ %kernel.debug% - - diff --git a/core/lib/Thelia/Config/Resources/form.xml b/core/lib/Thelia/Config/Resources/form.xml index 8577bf145..dda9be749 100644 --- a/core/lib/Thelia/Config/Resources/form.xml +++ b/core/lib/Thelia/Config/Resources/form.xml @@ -120,6 +120,8 @@
+ + diff --git a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php index 46760eba9..689ac9b1b 100644 --- a/core/lib/Thelia/Controller/Admin/AbstractCrudController.php +++ b/core/lib/Thelia/Controller/Admin/AbstractCrudController.php @@ -253,7 +253,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Render the object list, ensuring the sort order is set. * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ protected function renderList() { @@ -263,7 +263,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * The default action is displaying the list. * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ public function defaultAction() { @@ -274,7 +274,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Create a new object * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ public function createAction() { @@ -335,7 +335,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Load a object for modification, and display the edit template. * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ public function updateAction() { @@ -361,7 +361,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Save changes on a modified object, and either go back to the object list, or stay on the edition page. * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ public function processUpdateAction() { @@ -516,7 +516,7 @@ abstract class AbstractCrudController extends BaseAdminController /** * Delete an object * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ public function deleteAction() { diff --git a/core/lib/Thelia/Controller/Admin/BaseAdminController.php b/core/lib/Thelia/Controller/Admin/BaseAdminController.php index 5fc11c814..d34f2ce82 100755 --- a/core/lib/Thelia/Controller/Admin/BaseAdminController.php +++ b/core/lib/Thelia/Controller/Admin/BaseAdminController.php @@ -26,7 +26,7 @@ use Symfony\Component\Routing\Exception\InvalidParameterException; use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; use Symfony\Component\Routing\Exception\RouteNotFoundException; use Thelia\Controller\BaseController; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Security\Exception\AuthorizationException; use Thelia\Model\ConfigQuery; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -85,7 +85,7 @@ class BaseAdminController extends BaseController /** * Return a 404 error * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ protected function pageNotFound() { @@ -97,7 +97,7 @@ class BaseAdminController extends BaseController * * @param mixed $message a message string, or an exception instance * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ protected function errorPage($message, $status = 500) { @@ -373,7 +373,7 @@ class BaseAdminController extends BaseController * @param $templateName the complete template name, with extension * @param array $args the template arguments * @param int $status http code status - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ protected function render($templateName, $args = array(), $status = 200) { @@ -387,7 +387,7 @@ class BaseAdminController extends BaseController * @param array $args the template arguments * @param null $templateDir * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ protected function renderRaw($templateName, $args = array(), $templateDir = null) { diff --git a/core/lib/Thelia/Controller/Admin/CategoryController.php b/core/lib/Thelia/Controller/Admin/CategoryController.php index 86e4bb00c..018aa3586 100755 --- a/core/lib/Thelia/Controller/Admin/CategoryController.php +++ b/core/lib/Thelia/Controller/Admin/CategoryController.php @@ -23,7 +23,7 @@ namespace Thelia\Controller\Admin; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Category\CategoryDeleteEvent; use Thelia\Core\Event\TheliaEvents; @@ -320,7 +320,7 @@ class CategoryController extends AbstractCrudController /** * Add category pictures * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function addRelatedPictureAction() { diff --git a/core/lib/Thelia/Controller/Admin/ConfigController.php b/core/lib/Thelia/Controller/Admin/ConfigController.php index f8eafe820..67aec848a 100644 --- a/core/lib/Thelia/Controller/Admin/ConfigController.php +++ b/core/lib/Thelia/Controller/Admin/ConfigController.php @@ -181,7 +181,7 @@ class ConfigController extends AbstractCrudController /** * Change values modified directly from the variable list * - * @return Symfony\Component\HttpFoundation\Response the response + * @return Thelia\Core\HttpFoundation\Response the response */ public function changeValuesAction() { diff --git a/core/lib/Thelia/Controller/Admin/ContentController.php b/core/lib/Thelia/Controller/Admin/ContentController.php index adf3cc697..0b850734c 100644 --- a/core/lib/Thelia/Controller/Admin/ContentController.php +++ b/core/lib/Thelia/Controller/Admin/ContentController.php @@ -64,7 +64,7 @@ class ContentController extends AbstractCrudController /** * controller adding content to additional folder * - * @return mixed|\Symfony\Component\HttpFoundation\Response + * @return mixed|\Thelia\Core\HttpFoundation\Response */ public function addAdditionalFolderAction() { @@ -92,7 +92,7 @@ class ContentController extends AbstractCrudController /** * controller removing additional folder to a content * - * @return mixed|\Symfony\Component\HttpFoundation\Response + * @return mixed|\Thelia\Core\HttpFoundation\Response */ public function removeAdditionalFolderAction() { diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index 5cc71ac00..0169a16b9 100755 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -58,7 +58,7 @@ class CouponController extends BaseAdminController /** * Manage Coupons list display * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function browseAction() { @@ -90,7 +90,7 @@ class CouponController extends BaseAdminController * * @param int $couponId Coupon Id * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function readAction($couponId) { @@ -117,7 +117,7 @@ class CouponController extends BaseAdminController /** * Manage Coupons creation display * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function createAction() { @@ -165,7 +165,7 @@ class CouponController extends BaseAdminController * * @param int $couponId Coupon id * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function updateAction($couponId) { @@ -270,7 +270,7 @@ class CouponController extends BaseAdminController * * @param string $conditionId Condition service id * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function getConditionInputAction($conditionId) { @@ -300,7 +300,7 @@ class CouponController extends BaseAdminController * * @param int $couponId Coupon id * - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ public function updateConditionsAction($couponId) { diff --git a/core/lib/Thelia/Controller/Admin/CustomerController.php b/core/lib/Thelia/Controller/Admin/CustomerController.php index 93a007426..9719748fc 100644 --- a/core/lib/Thelia/Controller/Admin/CustomerController.php +++ b/core/lib/Thelia/Controller/Admin/CustomerController.php @@ -61,7 +61,7 @@ class CustomerController extends BaseAdminController * update customer action * * @param $customer_id - * @return mixed|\Symfony\Component\HttpFoundation\Response + * @return mixed|\Thelia\Core\HttpFoundation\Response */ public function updateAction($customer_id) { diff --git a/core/lib/Thelia/Controller/Admin/FileController.php b/core/lib/Thelia/Controller/Admin/FileController.php index ced780181..5c712898a 100755 --- a/core/lib/Thelia/Controller/Admin/FileController.php +++ b/core/lib/Thelia/Controller/Admin/FileController.php @@ -25,7 +25,7 @@ namespace Thelia\Controller\Admin; use Propel\Runtime\Exception\PropelException; use Symfony\Component\HttpFoundation\File\UploadedFile; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Document\DocumentCreateOrUpdateEvent; use Thelia\Core\Event\Document\DocumentDeleteEvent; diff --git a/core/lib/Thelia/Controller/Admin/LangController.php b/core/lib/Thelia/Controller/Admin/LangController.php index 7c9eefad5..ccf980c81 100644 --- a/core/lib/Thelia/Controller/Admin/LangController.php +++ b/core/lib/Thelia/Controller/Admin/LangController.php @@ -117,7 +117,7 @@ class LangController extends BaseAdminController $changedObject = $event->getLang(); $this->adminLogAppend(AdminResources::LANGUAGE, AccessManager::UPDATE, sprintf("%s %s (ID %s) modified", 'Lang', $changedObject->getTitle(), $changedObject->getId())); - $this->redirectToRoute('/admin/configuration/languages'); + $this->redirectToRoute('admin.configuration.languages'); } catch (\Exception $e) { $error_msg = $e->getMessage(); } diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php index 429d9837e..ff075b0e4 100644 --- a/core/lib/Thelia/Controller/Admin/OrderController.php +++ b/core/lib/Thelia/Controller/Admin/OrderController.php @@ -23,7 +23,7 @@ namespace Thelia\Controller\Admin; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Security\Resource\AdminResources; use Thelia\Core\Event\Order\OrderAddressEvent; use Thelia\Core\Event\Order\OrderEvent; diff --git a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php index 2bd6363cc..8e8f38eec 100644 --- a/core/lib/Thelia/Controller/Admin/ShippingZoneController.php +++ b/core/lib/Thelia/Controller/Admin/ShippingZoneController.php @@ -55,7 +55,7 @@ class ShippingZoneController extends BaseAdminController } /** - * @return mixed|\Symfony\Component\HttpFoundation\Response + * @return mixed|\Thelia\Core\HttpFoundation\Response */ public function addArea() { diff --git a/core/lib/Thelia/Controller/Admin/SystemLogController.php b/core/lib/Thelia/Controller/Admin/SystemLogController.php new file mode 100644 index 000000000..96621717c --- /dev/null +++ b/core/lib/Thelia/Controller/Admin/SystemLogController.php @@ -0,0 +1,182 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Controller\Admin; + + +use Thelia\Core\Security\Resource\AdminResources; +use Thelia\Core\Security\AccessManager; +use Thelia\Form\SystemLogConfigurationForm; +use Thelia\Log\Tlog; +use Thelia\Model\ConfigQuery; +/** + * Class LangController + * @package Thelia\Controller\Admin + * @author Manuel Raynaud + */ +class SystemLogController extends BaseAdminController +{ + + protected function renderTemplate() + { + $destinations = array(); + + $destination_directories = Tlog::getInstance()->getDestinationsDirectories(); + + foreach($destination_directories as $dir) { + $this->loadDefinedDestinations($dir, $destinations); + } + + $active_destinations = explode(";", ConfigQuery::read(Tlog::VAR_DESTINATIONS, Tlog::DEFAUT_DESTINATIONS)); + + return $this->render('system-logs', + array( + 'ip_address' => $this->getRequest()->getClientIp(), + 'destinations' => $destinations, + 'active_destinations' => $active_destinations + ) + ); + } + + protected function loadDefinedDestinations($directory, &$destinations) { + + try { + foreach (new \DirectoryIterator($directory) as $fileInfo) { + + if ($fileInfo->isDot()) continue; + + $matches = array(); + + if (preg_match("/([^\.]+)\.php/", $fileInfo->getFilename(), $matches)) { + + $classname = $matches[1]; + + if (! isset($destinations[$classname])) { + + $full_class_name = "Thelia\\Log\\Destination\\".$classname; + + $destinations[$classname] = new $full_class_name(); + } + } + } + } catch (\UnexpectedValueException $ex) { + // Directory does no exists -> Nothing to do + } + } + + public function defaultAction() + { + if (null !== $response = $this->checkAuth(AdminResources::SYSTEM_LOG, AccessManager::VIEW)) return $response; + + /* + const VAR_LEVEL = "tlog_level"; + const VAR_DESTINATIONS = "tlog_destinations"; + const VAR_PREFIXE = "tlog_prefix"; + const VAR_FILES = "tlog_files"; + const VAR_IP = "tlog_ip"; + const VAR_SHOW_REDIRECT = "tlog_show_redirect"; + + const DEFAULT_LEVEL = self::DEBUG; + const DEFAUT_DESTINATIONS = "Thelia\Log\Destination\TlogDestinationFile"; + const DEFAUT_PREFIXE = "#NUM: #NIVEAU [#FICHIER:#FONCTION()] {#LIGNE} #DATE #HEURE: "; + const DEFAUT_FILES = "*"; + const DEFAUT_IP = ""; + const DEFAUT_SHOW_REDIRECT = 0; + + */ + + // Hydrate the general configuration form + $systemLogForm = new SystemLogConfigurationForm($this->getRequest(), 'form', array( + 'level' => ConfigQuery::read(Tlog::VAR_LEVEL, Tlog::DEFAULT_LEVEL), + 'format' => ConfigQuery::read(Tlog::VAR_PREFIXE, Tlog::DEFAUT_PREFIXE), + 'show_redirections' => ConfigQuery::read(Tlog::VAR_SHOW_REDIRECT, Tlog::DEFAUT_SHOW_REDIRECT), + 'files' => ConfigQuery::read(Tlog::VAR_FILES, Tlog::DEFAUT_FILES), + 'ip_addresses' => ConfigQuery::read(Tlog::VAR_IP, Tlog::DEFAUT_IP), + )); + + $this->getParserContext()->addForm($systemLogForm); + + return $this->renderTemplate(); + } + + public function saveAction() + { + if (null !== $response = $this->checkAuth(AdminResources::LANGUAGE, AccessManager::UPDATE)) return $response; + + $error_msg = false; + + $systemLogForm = new SystemLogConfigurationForm($this->getRequest()); + + try { + $form = $this->validateForm($systemLogForm); + + $data = $form->getData(); + + ConfigQuery::write(Tlog::VAR_LEVEL , $data['level']); + ConfigQuery::write(Tlog::VAR_PREFIXE , $data['format']); + ConfigQuery::write(Tlog::VAR_SHOW_REDIRECT , $data['show_redirections']); + ConfigQuery::write(Tlog::VAR_FILES , $data['files']); + ConfigQuery::write(Tlog::VAR_IP , $data['ip_addresses']); + + // Save destination configuration + $destinations = $this->getRequest()->get('destinations'); + $configs = $this->getRequest()->get('config'); + + $active_destinations = array(); + + foreach($destinations as $classname => $destination) { + + if (isset($destination['active'])) { + $active_destinations[] = $destination['classname']; + } + + if (isset($configs[$classname])) { + + // Update destinations configuration + foreach($configs[$classname] as $var => $value) { + ConfigQuery::write($var, $value, true, true); + } + } + } + + // Update active destinations list + ConfigQuery::write(Tlog::VAR_DESTINATIONS, implode(';', $active_destinations)); + + $this->adminLogAppend(AdminResources::SYSTEM_LOG, AccessManager::UPDATE, "System log configuration changed"); + + $this->redirectToRoute('admin.configuration.system-logs.default'); + + } catch (\Exception $ex) { + $error_msg = $ex->getMessage(); + } + + $this->setupFormErrorContext( + $this->getTranslator()->trans("System log configuration failed."), + $error_msg, + $systemLogForm, + $ex + ); + + return $this->renderTemplate(); + } +} diff --git a/core/lib/Thelia/Controller/BaseController.php b/core/lib/Thelia/Controller/BaseController.php index 4bfc3c65f..d5868b8d2 100755 --- a/core/lib/Thelia/Controller/BaseController.php +++ b/core/lib/Thelia/Controller/BaseController.php @@ -22,7 +22,7 @@ /*************************************************************************************/ namespace Thelia\Controller; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -58,7 +58,7 @@ class BaseController extends ContainerAware /** * Return an empty response (after an ajax request, for example) * @param int $status - * @return \Symfony\Component\HttpFoundation\Response + * @return \Thelia\Core\HttpFoundation\Response */ protected function nullResponse($status = 200) { diff --git a/core/lib/Thelia/Core/Bundle/TheliaBundle.php b/core/lib/Thelia/Core/Bundle/TheliaBundle.php index 9a536f88d..3df5e4345 100755 --- a/core/lib/Thelia/Core/Bundle/TheliaBundle.php +++ b/core/lib/Thelia/Core/Bundle/TheliaBundle.php @@ -60,13 +60,12 @@ class TheliaBundle extends Bundle $container->addScope(new Scope('request')); $container + ->addCompilerPass(new TranslatorPass()) ->addCompilerPass(new RegisterListenersPass()) ->addCompilerPass(new RegisterParserPluginPass()) ->addCompilerPass(new RegisterRouterPass()) ->addCompilerPass(new RegisterCouponPass()) ->addCompilerPass(new RegisterCouponConditionPass()) - ->addCompilerPass(new TranslatorPass()) - ; } } diff --git a/core/lib/Thelia/Core/Controller/ControllerResolver.php b/core/lib/Thelia/Core/Controller/ControllerResolver.php index ebf0eff86..a9cd30feb 100755 --- a/core/lib/Thelia/Core/Controller/ControllerResolver.php +++ b/core/lib/Thelia/Core/Controller/ControllerResolver.php @@ -26,6 +26,7 @@ namespace Thelia\Core\Controller; use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Psr\Log\LoggerInterface; /** * ControllerResolver that supports "a:b:c", "service:method" and class::method" notations in routes definition diff --git a/core/lib/Thelia/Core/EventListener/ViewListener.php b/core/lib/Thelia/Core/EventListener/ViewListener.php index db036f111..667a3d42c 100755 --- a/core/lib/Thelia/Core/EventListener/ViewListener.php +++ b/core/lib/Thelia/Core/EventListener/ViewListener.php @@ -27,7 +27,7 @@ use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Symfony\Component\Routing\Router; use Thelia\Core\Template\Exception\ResourceNotFoundException; use Thelia\Core\Template\ParserInterface; diff --git a/core/lib/Thelia/Core/HttpFoundation/Response.php b/core/lib/Thelia/Core/HttpFoundation/Response.php new file mode 100644 index 000000000..277c16cc2 --- /dev/null +++ b/core/lib/Thelia/Core/HttpFoundation/Response.php @@ -0,0 +1,48 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Core\HttpFoundation; + +use Symfony\Component\HttpFoundation\Response as BaseResponse; +use Thelia\Log\Tlog; + +/** + * extends Thelia\Core\HttpFoundation\Response for adding some helpers + * + * Class Response + * @package Thelia\Core\HttpFoundation + * @author Franck Allimant + */ +class Response extends BaseResponse +{ + /** + * Allow Tlog to write log stuff in the fina content. + * + * @see \Thelia\Core\HttpFoundation\Response::sendContent() + */ + public function sendContent() { + + Tlog::getInstance()->write($this->content); + + parent::sendContent(); + } +} diff --git a/core/lib/Thelia/Core/Security/Resource/AdminResources.php b/core/lib/Thelia/Core/Security/Resource/AdminResources.php index 6efcf89c2..295de1fe8 100644 --- a/core/lib/Thelia/Core/Security/Resource/AdminResources.php +++ b/core/lib/Thelia/Core/Security/Resource/AdminResources.php @@ -97,4 +97,6 @@ final class AdminResources const TAX = "admin.configuration.tax"; const TEMPLATE = "admin.configuration.template"; + + const SYSTEM_LOG = "admin.configuration.system-log"; } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php index a401755a4..ba6f1d1f9 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/DataAccessFunctions.php @@ -238,13 +238,13 @@ class DataAccessFunctions extends AbstractSmartyPlugin public function ConfigDataAccess($params, $smarty) { - if (false === array_key_exists("key", $params)) { - return null; - } + $key = $this->getParam($params, 'key', false); - $key = $params['key']; + if ($key === false) return null; - return ConfigQuery::read($key); + $default = $this->getParam($params, 'default', ''); + + return ConfigQuery::read($key, $default); } /** diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php index 61a68fdc7..e89898af6 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/FlashMessage.php @@ -74,13 +74,18 @@ class FlashMessage extends AbstractSmartyPlugin public function getFlashMessage($params, $content, \Smarty_Internal_Template $template, &$repeat) { if ($repeat) { - $key = $params['key']; - $flashBag = $this->request->getSession()->get('flashMessage'); - $template->assign('value', $flashBag[$key]); - // Reset flash message (can be read once) - unset($flashBag[$key]); - $this->request->getSession()->set('flashMessage', $flashBag); + if (false !== $key = $this->getParam($params, 'key', false)) { + + $flashBag = $this->request->getSession()->get('flashMessage'); + + $template->assign('value', $flashBag[$key]); + + // Reset flash message (can be read once) + unset($flashBag[$key]); + + $this->request->getSession()->set('flashMessage', $flashBag); + } } else { return $content; } diff --git a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php index beb9a6b25..2dfbb08fc 100755 --- a/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php +++ b/core/lib/Thelia/Core/Template/Smarty/Plugins/Module.php @@ -41,14 +41,16 @@ class Module extends AbstractSmartyPlugin public function theliaModule($params, \Smarty_Internal_Template $template) { $content = null; - if (array_key_exists('location', $params)) { - $location = $params['location']; + + if (false !== $location = $this->getParam($params, 'location', false)) { + $modules = ModuleQuery::getActivated(); foreach ($modules as $module) { - $file = THELIA_MODULE_DIR . "/". ucfirst($module->getCode()) . "/AdminIncludes/".$location.".html"; - if(file_exists($file)) { + $file = sprintf("%s/%s/AdminIncludes/%s.html", THELIA_MODULE_DIR, ucfirst($module->getCode()), $location); + + if (file_exists($file)) { $content .= file_get_contents($file); } } diff --git a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php index 92c1377ce..272f6787c 100755 --- a/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php +++ b/core/lib/Thelia/Core/Template/Smarty/SmartyParser.php @@ -7,7 +7,7 @@ use \Symfony\Component\EventDispatcher\EventDispatcherInterface; use \Smarty; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\Template\ParserInterface; use Thelia\Core\Template\Smarty\AbstractSmartyPlugin; @@ -155,7 +155,7 @@ class SmartyParser extends Smarty implements ParserInterface * * set $content with the body of the response or the Response object directly * - * @param string|Symfony\Component\HttpFoundation\Response $content + * @param string|Thelia\Core\HttpFoundation\Response $content */ public function setContent($content) { diff --git a/core/lib/Thelia/Core/Thelia.php b/core/lib/Thelia/Core/Thelia.php index 3d476ad30..cc9f4bae4 100755 --- a/core/lib/Thelia/Core/Thelia.php +++ b/core/lib/Thelia/Core/Thelia.php @@ -69,7 +69,7 @@ class Thelia extends Kernel protected function initPropel() { - if (file_exists(THELIA_ROOT . '/local/config/database.yml') === false) { + if (file_exists(THELIA_CONF_DIR . 'database.yml') === false) { return ; } @@ -96,7 +96,7 @@ class Thelia extends Kernel { parent::boot(); - if (file_exists(THELIA_ROOT . '/local/config/database.yml') === true) { + if (file_exists(THELIA_CONF_DIR . 'database.yml') === true) { $this->getContainer()->get("event_dispatcher")->dispatch(TheliaEvents::BOOT); } diff --git a/core/lib/Thelia/Exception/CouponExpiredException.php b/core/lib/Thelia/Exception/CouponExpiredException.php index c1ccace0a..271927cb4 100644 --- a/core/lib/Thelia/Exception/CouponExpiredException.php +++ b/core/lib/Thelia/Exception/CouponExpiredException.php @@ -46,7 +46,7 @@ class CouponExpiredException extends \Exception public function __construct($couponCode) { $message = 'Expired Coupon ' . $couponCode . 'attempt'; - Tlog::getInstance()->addInfo($message); + Tlog::getInstance()->addWarning($message); parent::__construct($message); } diff --git a/core/lib/Thelia/Form/AdministratorCreationForm.php b/core/lib/Thelia/Form/AdministratorCreationForm.php index 4b5afe34c..f0a479dd2 100644 --- a/core/lib/Thelia/Form/AdministratorCreationForm.php +++ b/core/lib/Thelia/Form/AdministratorCreationForm.php @@ -81,7 +81,7 @@ class AdministratorCreationForm extends BaseForm array($this, "verifyPasswordField") ))) ), - "label" => "Password confirmation", + "label" => Translator::getInstance()->trans('Password confirmation'), "label_attr" => array( "for" => "password_confirmation" ), @@ -94,7 +94,7 @@ class AdministratorCreationForm extends BaseForm "constraints" => array( new Constraints\NotBlank(), ), - "label" => "Profile", + "label" => Translator::getInstance()->trans('Profile'), "label_attr" => array( "for" => "profile" ), diff --git a/core/lib/Thelia/Form/ConfigCreationForm.php b/core/lib/Thelia/Form/ConfigCreationForm.php index e52f44c29..56df63f8a 100644 --- a/core/lib/Thelia/Form/ConfigCreationForm.php +++ b/core/lib/Thelia/Form/ConfigCreationForm.php @@ -25,6 +25,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Thelia\Model\ConfigQuery; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; class ConfigCreationForm extends BaseForm { @@ -41,7 +42,7 @@ class ConfigCreationForm extends BaseForm $this->formBuilder ->add("name", "text", array( "constraints" => $name_constraints, - "label" => "Name *", + "label" => Translator::getInstance()->trans('Name *'), "label_attr" => array( "for" => "name" ) @@ -50,7 +51,7 @@ class ConfigCreationForm extends BaseForm "constraints" => array( new Constraints\NotBlank() ), - "label" => "Purpose *", + "label" => Translator::getInstance()->trans('Purpose *'), "label_attr" => array( "for" => "purpose" ) @@ -61,14 +62,14 @@ class ConfigCreationForm extends BaseForm ) )) ->add("value", "text", array( - "label" => "Value *", + "label" => Translator::getInstance()->trans('Value *'), "label_attr" => array( "for" => "value" ) )) ->add("hidden", "hidden", array()) ->add("secured", "hidden", array( - "label" => "Prevent variable modification or deletion, except for super-admin" + "label" => Translator::getInstance()->trans('Prevent variable modification or deletion, except for super-admin') )) ; } @@ -83,7 +84,7 @@ class ConfigCreationForm extends BaseForm $config = ConfigQuery::create()->findOneByName($value); if ($config) { - $context->addViolation(sprintf("A variable with name \"%s\" already exists.", $value)); + $context->addViolation(Translator::getInstance()->trans('A variable with name "%name" already exists.', array('%name' => $value))); } } diff --git a/core/lib/Thelia/Form/ConfigModificationForm.php b/core/lib/Thelia/Form/ConfigModificationForm.php index 257af38c5..318da7185 100644 --- a/core/lib/Thelia/Form/ConfigModificationForm.php +++ b/core/lib/Thelia/Form/ConfigModificationForm.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\GreaterThan; +use Thelia\Core\Translation\Translator; class ConfigModificationForm extends BaseForm { @@ -43,20 +44,20 @@ class ConfigModificationForm extends BaseForm "constraints" => array( new NotBlank() ), - "label" => "Name", + "label" => Translator::getInstance()->trans('Name'), "label_attr" => array( "for" => "name" ) )) ->add("value", "text", array( - "label" => "Value", + "label" => Translator::getInstance()->trans('Value'), "label_attr" => array( "for" => "value" ) )) ->add("hidden", "hidden", array()) ->add("secured", "hidden", array( - "label" => "Prevent variable modification or deletion, except for super-admin" + "label" => Translator::getInstance()->trans('Prevent variable modification or deletion, except for super-admin') )) ; diff --git a/core/lib/Thelia/Form/ContentCreationForm.php b/core/lib/Thelia/Form/ContentCreationForm.php index df8838f59..663ed4c1b 100644 --- a/core/lib/Thelia/Form/ContentCreationForm.php +++ b/core/lib/Thelia/Form/ContentCreationForm.php @@ -34,7 +34,7 @@ class ContentCreationForm extends BaseForm "constraints" => array( new NotBlank() ), - "label" => "Content title *", + "label" => Translator::getInstance()->trans('Content title *'), "label_attr" => array( "for" => "title" ) diff --git a/core/lib/Thelia/Form/CurrencyCreationForm.php b/core/lib/Thelia/Form/CurrencyCreationForm.php index 3328cd342..9872d100c 100644 --- a/core/lib/Thelia/Form/CurrencyCreationForm.php +++ b/core/lib/Thelia/Form/CurrencyCreationForm.php @@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints; use Thelia\Model\CurrencyQuery; use Symfony\Component\Validator\ExecutionContextInterface; use Symfony\Component\Validator\Constraints\NotBlank; +use Thelia\Core\Translation\Translator; class CurrencyCreationForm extends BaseForm { @@ -44,7 +45,7 @@ class CurrencyCreationForm extends BaseForm "constraints" => array( new NotBlank() ), - "label" => "Name *", + "label" => Translator::getInstance()->trans('Name *'), "label_attr" => array( "for" => "name" )) @@ -58,7 +59,7 @@ class CurrencyCreationForm extends BaseForm "constraints" => array( new NotBlank() ), - "label" => "Symbol *", + "label" => Translator::getInstance()->trans('Symbol *'), "label_attr" => array( "for" => "symbol" )) @@ -67,7 +68,7 @@ class CurrencyCreationForm extends BaseForm "constraints" => array( new NotBlank() ), - "label" => "Rate from € *", + "label" => Translator::getInstance()->trans('Rate from € *'), "label_attr" => array( "for" => "rate" )) @@ -76,7 +77,7 @@ class CurrencyCreationForm extends BaseForm "constraints" => array( new NotBlank() ), - "label" => "ISO 4217 code *", + "label" => Translator::getInstance()->trans('ISO 4217 code *'), "label_attr" => array( "for" => "iso_4217_code" )) @@ -94,7 +95,7 @@ class CurrencyCreationForm extends BaseForm $currency = CurrencyQuery::create()->findOneByCode($value); if ($currency) { - $context->addViolation(sprintf("A currency with code \"%s\" already exists.", $value)); + $context->addViolation(Translator::getInstance()->trans('A currency with code "%name" already exists.', array('%name' => $value))); } } diff --git a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php index afea21f70..0a29aeda7 100755 --- a/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerPasswordUpdateForm.php @@ -70,7 +70,7 @@ class CustomerPasswordUpdateForm extends BaseForm array($this, "verifyPasswordField") ))) ), - "label" => "Password confirmation", + "label" => Translator::getInstance()->trans('Password confirmation'), "label_attr" => array( "for" => "password_confirmation" ) diff --git a/core/lib/Thelia/Form/CustomerProfilUpdateForm.php b/core/lib/Thelia/Form/CustomerProfilUpdateForm.php index d1e928d0c..471c12432 100755 --- a/core/lib/Thelia/Form/CustomerProfilUpdateForm.php +++ b/core/lib/Thelia/Form/CustomerProfilUpdateForm.php @@ -58,7 +58,7 @@ class CustomerProfilUpdateForm extends CustomerCreateForm // Add Newsletter ->add("newsletter", "checkbox", array( - "label" => "I would like to receive the newsletter our the latest news.", + "label" => Translator::getInstance()->trans('I would like to receive the newsletter or the latest news.'), "label_attr" => array( "for" => "newsletter" ), diff --git a/core/lib/Thelia/Form/MessageCreationForm.php b/core/lib/Thelia/Form/MessageCreationForm.php index 6ce84cb06..288de1d36 100644 --- a/core/lib/Thelia/Form/MessageCreationForm.php +++ b/core/lib/Thelia/Form/MessageCreationForm.php @@ -25,6 +25,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints; use Thelia\Model\MessageQuery; use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Core\Translation\Translator; class MessageCreationForm extends BaseForm { @@ -41,7 +42,7 @@ class MessageCreationForm extends BaseForm $this->formBuilder ->add("name", "text", array( "constraints" => $name_constraints, - "label" => "Name *", + "label" => Translator::getInstance()->trans('Name *'), "label_attr" => array( "for" => "name" ) @@ -50,7 +51,7 @@ class MessageCreationForm extends BaseForm "constraints" => array( new Constraints\NotBlank() ), - "label" => "Purpose *", + "label" => Translator::getInstance()->trans('Purpose *'), "label_attr" => array( "for" => "purpose" ) @@ -74,7 +75,7 @@ class MessageCreationForm extends BaseForm $message = MessageQuery::create()->findOneByName($value); if ($message) { - $context->addViolation(sprintf("A message with name \"%s\" already exists.", $value)); + $context->addViolation(Translator::getInstance()->trans('A message with name "%name" already exists.', array('%name' => $value))); } } diff --git a/core/lib/Thelia/Form/MessageModificationForm.php b/core/lib/Thelia/Form/MessageModificationForm.php index c8f20448d..c22d67bbf 100644 --- a/core/lib/Thelia/Form/MessageModificationForm.php +++ b/core/lib/Thelia/Form/MessageModificationForm.php @@ -24,6 +24,7 @@ namespace Thelia\Form; use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\Constraints\GreaterThan; +use Thelia\Core\Translation\Translator; class MessageModificationForm extends BaseForm { @@ -33,37 +34,37 @@ class MessageModificationForm extends BaseForm ->add("id" , "hidden", array("constraints" => array(new GreaterThan(array('value' => 0))))) ->add("name" , "text" , array( "constraints" => array(new NotBlank()), - "label" => "Name *", + "label" => Translator::getInstance()->trans('Name *'), "label_attr" => array( "for" => "name" ) )) ->add("secured" , "text" , array( - "label" => "Prevent mailing template modification or deletion, except for super-admin" + "label" => Translator::getInstance()->trans('Prevent mailing template modification or deletion, except for super-admin') )) ->add("locale" , "text" , array()) ->add("title" , "text" , array( "constraints" => array(new NotBlank()), - "label" => "Title *", + "label" => Translator::getInstance()->trans('Title *'), "label_attr" => array( "for" => "title" ) )) ->add("subject" , "text" , array( "constraints" => array(new NotBlank()), - "label" => "Message subject *", + "label" => Translator::getInstance()->trans('Message subject *'), "label_attr" => array( "for" => "subject" ) )) ->add("html_message" , "text" , array( - "label" => "HTML Message", + "label" => Translator::getInstance()->trans('HTML Message'), "label_attr" => array( "for" => "html_message" ) )) ->add("text_message" , "text" , array( - "label" => "Text Message", + "label" => Translator::getInstance()->trans('Text Message'), "label_attr" => array( "for" => "text_message" ) diff --git a/core/lib/Thelia/Form/ProductCreationForm.php b/core/lib/Thelia/Form/ProductCreationForm.php index c1b8bd6b4..de683e27a 100644 --- a/core/lib/Thelia/Form/ProductCreationForm.php +++ b/core/lib/Thelia/Form/ProductCreationForm.php @@ -43,12 +43,12 @@ class ProductCreationForm extends BaseForm $this->formBuilder ->add("ref", "text", array( "constraints" => $ref_constraints, - "label" => "Product reference *", + "label" => Translator::getInstance()->trans('Product reference *'), "label_attr" => array("for" => "ref") )) ->add("title", "text", array( "constraints" => array(new NotBlank()), - "label" => "Product title *", + "label" => Translator::getInstance()->trans('Product title *'), "label_attr" => array("for" => "title") )) ->add("default_category", "integer", array( diff --git a/core/lib/Thelia/Form/SystemLogConfigurationForm.php b/core/lib/Thelia/Form/SystemLogConfigurationForm.php new file mode 100644 index 000000000..9ba9e6cf2 --- /dev/null +++ b/core/lib/Thelia/Form/SystemLogConfigurationForm.php @@ -0,0 +1,86 @@ +. */ +/* */ +/*************************************************************************************/ +namespace Thelia\Form; + +use Symfony\Component\Validator\Constraints; +use Thelia\Model\ConfigQuery; +use Symfony\Component\Validator\ExecutionContextInterface; +use Thelia\Log\Tlog; +use Thelia\Core\Translation\Translator; + +class SystemLogConfigurationForm extends BaseForm +{ + protected function buildForm() + { + $this->formBuilder + ->add("level", "choice", array( + 'choices' => array( + Tlog::MUET => Translator::getInstance()->trans("Disabled"), + Tlog::DEBUG => Translator::getInstance()->trans("Debug"), + Tlog::INFO => Translator::getInstance()->trans("Information"), + Tlog::NOTICE => Translator::getInstance()->trans("Notices"), + Tlog::WARNING => Translator::getInstance()->trans("Warnings"), + Tlog::ERROR => Translator::getInstance()->trans("Errors"), + Tlog::CRITICAL => Translator::getInstance()->trans("Critical"), + Tlog::ALERT => Translator::getInstance()->trans("Alerts"), + Tlog::EMERGENCY => Translator::getInstance()->trans("Emergency"), + ), + + "label" => Translator::getInstance()->trans('Log level *'), + "label_attr" => array( + "for" => "level_field" + ) + )) + ->add("format", "text", array( + "label" => Translator::getInstance()->trans('Log format *'), + "label_attr" => array( + "for" => "format_field" + ) + )) + ->add("show_redirections", "integer", array( + "constraints" => array(new Constraints\NotBlank()), + "label" => Translator::getInstance()->trans('Show redirections *'), + "label_attr" => array( + "for" => "show_redirections_field" + ) + )) + ->add("files", "text", array( + "label" => Translator::getInstance()->trans('Activate logs only for these files'), + "label_attr" => array( + "for" => "files_field" + ) + )) + ->add("ip_addresses", "text", array( + "label" => Translator::getInstance()->trans('Activate logs only for these IP Addresses'), + "label_attr" => array( + "for" => "files_field" + ) + )) + ; + } + + public function getName() + { + return "thelia_system_log_configuration"; + } +} diff --git a/core/lib/Thelia/Log/AbstractTlogDestination.php b/core/lib/Thelia/Log/AbstractTlogDestination.php index 582f57934..0d3cde9e1 100755 --- a/core/lib/Thelia/Log/AbstractTlogDestination.php +++ b/core/lib/Thelia/Log/AbstractTlogDestination.php @@ -31,9 +31,6 @@ abstract class AbstractTlogDestination //Tableau des lignes de logs stockés avant utilisation par ecrire() protected $_logs; - // Vaudra true si on est dans le back office. - protected $flag_back_office = false; - public function __construct() { $this->_configs = array(); @@ -50,8 +47,8 @@ abstract class AbstractTlogDestination public function setConfig($name, $value) { foreach ($this->_configs as $config) { - if ($config->name == $name) { - $config->value = $value; + if ($config->getName() == $name) { + $config->setValue($value); // Appliquer les changements $this->configure(); @@ -66,8 +63,8 @@ abstract class AbstractTlogDestination public function getConfig($name) { foreach ($this->_configs as $config) { - if ($config->name == $name) { - return $config->value; + if ($config->getName() == $name) { + return $config->getValue(); } } @@ -79,26 +76,19 @@ abstract class AbstractTlogDestination return $this->_configs; } - public function SetBackOfficeMode($bool) - { - $this->flag_back_office = $bool; - } - //Ajoute une ligne de logs à la destination public function add($string) { $this->_logs[] = $string; } - protected function InsertAfterBody(&$res, $logdata) + protected function insertAfterBody(&$res, $logdata) { - $match = array(); + $match = array(); - if (preg_match("/(]*>)/i", $res, $match)) { - $res = str_replace($match[0], $match[0] . "\n" . $logdata, $res); - } else { - $res = $logdata . $res; - } + if (preg_match("/(]*>)/i", $res, $match)) { + $res = str_replace($match[0], $match[0] . "\n" . $logdata, $res); + } } // Demande à la destination de se configurer pour être prête @@ -106,7 +96,7 @@ abstract class AbstractTlogDestination // que seul le paramètre de configuration indiqué a été modifié. protected function configure() { - // Cette methode doit etre surchargée si nécessaire. + // Cette methode doit etre surchargée si nécessaire. } //Lance l'écriture de tous les logs par la destination diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php index 6d2da2b52..a045196fe 100755 --- a/core/lib/Thelia/Log/Destination/TlogDestinationFile.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationFile.php @@ -25,6 +25,7 @@ namespace Thelia\Log\Destination; use Thelia\Log\AbstractTlogDestination; use Thelia\Log\TlogDestinationConfig; +use Thelia\Core\Translation\Translator; class TlogDestinationFile extends AbstractTlogDestination { @@ -41,7 +42,7 @@ class TlogDestinationFile extends AbstractTlogDestination public function __construct() { - $this->path_defaut = THELIA_ROOT . "log/" . self::TLOG_DEFAULT_NAME; + $this->path_defaut = THELIA_ROOT . "log" . DS . self::TLOG_DEFAULT_NAME; parent::__construct(); } @@ -69,12 +70,12 @@ class TlogDestinationFile extends AbstractTlogDestination public function getTitle() { - return "Text File"; + return Translator::getInstance()->trans('Text File'); } public function getDescription() { - return "Store logs into text file"; + return Translator::getInstance()->trans('Store logs into text file'); } public function getConfigs() @@ -82,15 +83,15 @@ class TlogDestinationFile extends AbstractTlogDestination return array( new TlogDestinationConfig( self::VAR_PATH_FILE, - "Chemin du fichier", - "Attention, vous devez indiquer un chemin absolu.
Le répertoire de base de votre Thelia est ".dirname(getcwd()), + 'Absolute file path', + 'You should enter an abolute file path. The base directory of your Thelia installation is '.THELIA_ROOT, $this->path_defaut, TlogDestinationConfig::TYPE_TEXTFIELD ), new TlogDestinationConfig( self::VAR_MODE, - "Mode d'ouverture (A ou E)", - "Indiquez E pour ré-initialiser le fichier à chaque requête, A pour ne jamais réinitialiser le fichier. Pensez à le vider de temps en temps !", + 'File opening mode (A or E)', + 'Enter E to empty this file for each request, or A to always append logs. Consider resetting the file from time to time', self::VALEUR_MODE_DEFAULT, TlogDestinationConfig::TYPE_TEXTFIELD ) diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php b/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php index a510e18ef..7d0be3fa8 100755 --- a/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationHtml.php @@ -24,6 +24,7 @@ namespace Thelia\Log\Destination; use Thelia\Log\AbstractTlogDestination; +use Thelia\Log\TlogDestinationConfig; class TlogDestinationHtml extends AbstractTlogDestination { @@ -46,12 +47,12 @@ class TlogDestinationHtml extends AbstractTlogDestination public function getTitle() { - return "Affichage direct dans la page, en HTML"; + return "Direct HTML display"; } public function getDescription() { - return "Permet d'afficher les logs directement dans la page resultat, avec une mise en forme HTML."; + return "Display logs in HTML format, on top of generated pages."; } public function getConfigs() @@ -59,8 +60,8 @@ class TlogDestinationHtml extends AbstractTlogDestination return array( new TlogDestinationConfig( self::VAR_STYLE, - "Style d'affichage direct dans la page", - "Vous pouvez aussi laisser ce champ vide, et créer un style \"tlog-trace\" dans votre feuille de style.", + "CSS of each log line", + "You may also leave this field empty, and define a \"tlog-trace\" style in your CSS.", self::VALEUR_STYLE_DEFAUT, TlogDestinationConfig::TYPE_TEXTAREA ) @@ -71,6 +72,6 @@ class TlogDestinationHtml extends AbstractTlogDestination { $block = sprintf('
%s
', $this->style, htmlspecialchars(implode("\n", $this->_logs))); - $this->InsertAfterBody($res, $block); + $this->insertAfterBody($res, $block); } } diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php b/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php new file mode 100644 index 000000000..546ab488c --- /dev/null +++ b/core/lib/Thelia/Log/Destination/TlogDestinationJavascriptConsole.php @@ -0,0 +1,51 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Log\Destination; + +use Thelia\Log\AbstractTlogDestination; + +class TlogDestinationJavascriptConsole extends AbstractTlogDestination { + + public function getTitle() { + return "Browser's Javascript console"; + } + + public function getDescription() { + return "The Thelia logs are displayed in your browser's Javascript console."; + } + + public function write(&$res) { + + $content = ''."\n"; + + if (preg_match("||i", $res)) + $res = preg_replace("||i", "$content", $res); + } +} \ No newline at end of file diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationNull.php b/core/lib/Thelia/Log/Destination/TlogDestinationNull.php index 1fa8eaf3a..b78d24258 100755 --- a/core/lib/Thelia/Log/Destination/TlogDestinationNull.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationNull.php @@ -29,12 +29,12 @@ class TlogDestinationNull extends AbstractTlogDestination { public function getTitle() { - return "Trou noir"; + return "Black hole"; } public function getDescription() { - return "Cette destination ne provoque aucune sortie"; + return "This destinations consumes the logs but don't display them"; } public function add($string) diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php new file mode 100644 index 000000000..1734e2f43 --- /dev/null +++ b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.php @@ -0,0 +1,111 @@ +. */ +/* */ +/*************************************************************************************/ + +namespace Thelia\Log\Destination; + +use Thelia\Log\AbstractTlogDestination; +use Thelia\Log\TlogDestinationConfig; + +class TlogDestinationPopup extends AbstractTlogDestination { + + // Nom des variables de configuration + // ---------------------------------- + const VAR_POPUP_WIDTH = "tlog_destinationpopup_width"; + const VALEUR_POPUP_WIDTH_DEFAUT = "600"; + + const VAR_POPUP_HEIGHT = "tlog_destinationpopup_height"; + const VALEUR_POPUP_HEIGHT_DEFAUT = "600"; + + const VAR_POPUP_TPL = "tlog_destinationpopup_template"; + // Ce fichier doit se trouver dans le même répertoire que TlogDestinationPopup.class.php + const VALEUR_POPUP_TPL_DEFAUT = "TlogDestinationPopup.tpl"; + + public function getTitle() { + return "Javascript popup window"; + } + + public function getDescription() { + return "Display logs in a popup window, separate from the main window ."; + } + + public function getConfigs() { + return array( + new TlogDestinationConfig( + self::VAR_POPUP_TPL, + "Popup windows template", + "Put #LOGTEXT in the template text where you want to display logs..", + file_get_contents(__DIR__.DS. self::VALEUR_POPUP_TPL_DEFAUT), + TlogDestinationConfig::TYPE_TEXTAREA + ), + new TlogDestinationConfig( + self::VAR_POPUP_HEIGHT, + "Height of the popup window", + "In pixels", + self::VALEUR_POPUP_HEIGHT_DEFAUT, + TlogDestinationConfig::TYPE_TEXTFIELD + ), + new TlogDestinationConfig( + self::VAR_POPUP_WIDTH, + "Width of the popup window", + "In pixels", + self::VALEUR_POPUP_WIDTH_DEFAUT, + TlogDestinationConfig::TYPE_TEXTFIELD + ) + ); + } + + public function write(&$res) { + + $content = ""; $count = 1; + + foreach($this->_logs as $line) { + $content .= "
".htmlspecialchars($line)."
"; + } + + $tpl = $this->getConfig(self::VAR_POPUP_TPL); + + $tpl = str_replace('#LOGTEXT', $content, $tpl); + $tpl = str_replace(array("\r\n", "\r", "\n"), '\\n', $tpl); + + $wop = sprintf(' + ', + $this->getConfig(self::VAR_POPUP_WIDTH), + $this->getConfig(self::VAR_POPUP_HEIGHT), + str_replace('"', '\\"', $tpl) + ); + + if (preg_match("||i", $res)) + $res = preg_replace("||i", "$wop\n", $res); + else + $res .= $wop; + } +} diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationPopup.tpl b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.tpl new file mode 100644 index 000000000..7c67e1649 --- /dev/null +++ b/core/lib/Thelia/Log/Destination/TlogDestinationPopup.tpl @@ -0,0 +1,52 @@ + + + + + Thelia logs + + + + + +

Thelia Debug

+
#LOGTEXT
+ + diff --git a/core/lib/Thelia/Log/Destination/TlogDestinationText.php b/core/lib/Thelia/Log/Destination/TlogDestinationText.php index b03f03f65..00dca3ddd 100755 --- a/core/lib/Thelia/Log/Destination/TlogDestinationText.php +++ b/core/lib/Thelia/Log/Destination/TlogDestinationText.php @@ -34,12 +34,12 @@ class TlogDestinationText extends AbstractTlogDestination public function getTitle() { - return "Affichage direct dans la page, en texte brut"; + return "Direct text display"; } public function getDescription() { - return "Permet d'afficher les logs directement dans la page resultat, au format texte brut."; + return "Display logs in raw text format, on top of generated pages."; } public function add($texte) diff --git a/core/lib/Thelia/Log/Tlog.php b/core/lib/Thelia/Log/Tlog.php index a2396d31b..86bd8bb29 100755 --- a/core/lib/Thelia/Log/Tlog.php +++ b/core/lib/Thelia/Log/Tlog.php @@ -24,6 +24,7 @@ namespace Thelia\Log; use Thelia\Model\ConfigQuery; use Psr\Log\LoggerInterface; +use Thelia\Core\Translation\Translator; /** * @@ -69,7 +70,7 @@ class Tlog Implements LoggerInterface // default values const DEFAULT_LEVEL = self::DEBUG; const DEFAUT_DESTINATIONS = "Thelia\Log\Destination\TlogDestinationFile"; - const DEFAUT_PREFIXE = "#NUM: #NIVEAU [#FICHIER:#FONCTION()] {#LIGNE} #DATE #HEURE: "; + const DEFAUT_PREFIXE = "#INDEX: #LEVEL [#FILE:#FUNCTION()] {#LINE} #DATE #HOUR: "; const DEFAUT_FILES = "*"; const DEFAUT_IP = ""; const DEFAUT_SHOW_REDIRECT = 0; @@ -95,7 +96,7 @@ class Tlog Implements LoggerInterface private $linecount = 0; - protected static $done = false; + protected $done = false; // directories where are the Destinations Files public $dir_destinations = array(); @@ -132,8 +133,8 @@ class Tlog Implements LoggerInterface $this->setLevel(ConfigQuery::read(self::VAR_LEVEL, self::DEFAULT_LEVEL)); $this->dir_destinations = array( - __DIR__.'/Destination' - //, __DIR__.'/../client/tlog/destinations' + __DIR__.DS.'Destination', + THELIA_LOCAL_DIR.'tlog'.DS.'destinations' ); $this->setPrefix(ConfigQuery::read(self::VAR_PREFIXE, self::DEFAUT_PREFIXE)); @@ -160,10 +161,20 @@ class Tlog Implements LoggerInterface $this->destinations = array(); $classes_destinations = explode(';', $destinations); + $this->loadDestinations($this->destinations, $classes_destinations); } } + /** + * Return the directories where destinations classes should be searched. + * + * @return array of directories + */ + public function getDestinationsDirectories() { + return $this->dir_destinations; + } + /** * * change the debug level. Use Tlog constant : \Thelia\Log\Tlog::DEBUG set level to Debug @@ -489,16 +500,6 @@ class Tlog Implements LoggerInterface $this->out($this->levels[$level], $message, $context); } - - - // Mode back office - public static function SetBackOfficeMode($booleen) - { - foreach (Tlog::getInstance()->destinations as $dest) { - $dest->SetBackOfficeMode($booleen); - } - } - /** * * final end method. Write log for each destination handler @@ -508,7 +509,7 @@ class Tlog Implements LoggerInterface */ public function write(&$res) { - self::$done = true; + $this->done = true; // Muet ? On ne fait rien if ($this->level == self::MUET) return; @@ -524,7 +525,7 @@ class Tlog Implements LoggerInterface public function writeOnExit() { // Si les infos de debug n'ont pas été ecrites, le faire maintenant - if (self::$done === false) { + if ($this->done === false) { $res = ""; @@ -539,12 +540,12 @@ class Tlog Implements LoggerInterface if ($this->level != self::MUET && $this->show_redirect) { echo " -Redirection... +".Translator::getInstance()->trans('Redirecting ...')." -Redirection vers $url +".Translator::getInstance()->trans('Redirecting to %url', array('%url' => $url))." - "; +"; return true; } else { @@ -670,7 +671,7 @@ class Tlog Implements LoggerInterface $line = $origine['line']; $prefixe = str_replace( - array("#NUM", "#NIVEAU", "#FICHIER", "#FONCTION", "#LIGNE", "#DATE", "#HEURE"), + array("#INDEX", "#LEVEL", "#FILE", "#FUNCTION", "#LINE", "#DATE", "#HOUR"), array(1+$this->linecount, $level, $file, $function, $line, date("Y-m-d"), date("G:i:s")), $this->prefixe ); diff --git a/core/lib/Thelia/Log/TlogDestinationConfig.php b/core/lib/Thelia/Log/TlogDestinationConfig.php index 1bcbd9960..01c8fbe4f 100755 --- a/core/lib/Thelia/Log/TlogDestinationConfig.php +++ b/core/lib/Thelia/Log/TlogDestinationConfig.php @@ -22,7 +22,6 @@ /*************************************************************************************/ namespace Thelia\Log; - use Thelia\Model\Config; use Thelia\Model\ConfigQuery; @@ -32,12 +31,12 @@ class TlogDestinationConfig const TYPE_TEXTAREA = 1; const TYPE_TEXTFIELD = 2; - public $name; - public $title; - public $label; - public $default; - public $type; - public $value; + protected $name; + protected $title; + protected $label; + protected $default; + protected $type; + protected $value; public function __construct($name, $title, $label, $default, $type) { @@ -45,22 +44,67 @@ class TlogDestinationConfig $this->title = $title; $this->label = $label; $this->default = $default; - $this->type = $type; - - $this->load(); + $this->type= $type; + $this->value = ConfigQuery::read($this->name, $this->default); } - public function load() + public function getName() { - if (null === $config = ConfigQuery::create()->findOneByName($this->name)) { - $config = new Config(); - $config->setName($this->name); - $config->setValue($this->default); - $config->setHidden(1); - $config->setSecured(1); - $config->save(); - } + return $this->name; + } - $this->value = $config->getValue(); + public function setName($name) + { + $this->name = $name; + } + + public function getTitle() + { + return $this->title; + } + + public function setTitle($title) + { + $this->title = $title; + } + + public function getLabel() + { + return $this->label; + } + + public function setLabel($label) + { + $this->label = $label; + } + + public function getDefault() + { + return $this->default; + } + + public function setDefault($default) + { + $this->default = $default; + } + + public function getType() + { + return $this->type; + } + + public function setType($type) + { + $this->type = $type; + } + + public function getValue() + { + return $this->value; + } + + public function setValue($value) + { + $this->value = $value; } } diff --git a/core/lib/Thelia/Model/ConfigQuery.php b/core/lib/Thelia/Model/ConfigQuery.php index 11bbc51d6..71ff253ea 100755 --- a/core/lib/Thelia/Model/ConfigQuery.php +++ b/core/lib/Thelia/Model/ConfigQuery.php @@ -32,7 +32,7 @@ class ConfigQuery extends BaseConfigQuery { return self::$cache[$search]; } - public static function write($configName, $value, $secured, $hidden) + public static function write($configName, $value, $secured = null, $hidden = null) { $config = self::create()->findOneByName($configName); @@ -41,8 +41,9 @@ class ConfigQuery extends BaseConfigQuery { $config->setName($configName); } - $config->setSecured($secured ? 1 : 0); - $config->setHidden($hidden ? 1 : 0); + if ($secured !== null) $config->setSecured($secured ? 1 : 0); + if ($hidden !== null) $config->setHidden($hidden ? 1 : 0); + $config->setValue($value); $config->save(); diff --git a/core/lib/Thelia/Tools/Redirect.php b/core/lib/Thelia/Tools/Redirect.php index ed7932080..23fd9258b 100755 --- a/core/lib/Thelia/Tools/Redirect.php +++ b/core/lib/Thelia/Tools/Redirect.php @@ -24,14 +24,17 @@ namespace Thelia\Tools; use Symfony\Component\HttpFoundation\RedirectResponse; +use Thelia\Log\Tlog; class Redirect { public static function exec($url, $status = 302) { - $response = new RedirectResponse($url, $status); + if (false == Tlog::getInstance()->showRedirect($url)) { + $response = new RedirectResponse($url, $status); - $response->send(); + $response->send(); + } exit; } diff --git a/core/lib/Thelia/Tools/Rest/ResponseRest.php b/core/lib/Thelia/Tools/Rest/ResponseRest.php index 0c9186436..9df26e0d8 100644 --- a/core/lib/Thelia/Tools/Rest/ResponseRest.php +++ b/core/lib/Thelia/Tools/Rest/ResponseRest.php @@ -2,7 +2,7 @@ namespace Thelia\Tools\Rest; -use Symfony\Component\HttpFoundation\Response; +use Thelia\Core\HttpFoundation\Response; use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Encoder\XmlEncoder; diff --git a/local/config/schema.xml b/local/config/schema.xml index cc9c4c396..70df6710e 100755 --- a/local/config/schema.xml +++ b/local/config/schema.xml @@ -1,1264 +1,1264 @@ - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - -
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - -
- - - - - - - - - - -
-
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
diff --git a/templates/admin/default/configuration.html b/templates/admin/default/configuration.html index d0e3c880c..9f0cc4160 100644 --- a/templates/admin/default/configuration.html +++ b/templates/admin/default/configuration.html @@ -167,8 +167,8 @@ {loop type="auth" name="pcc8" role="ADMIN" resource="admin.configuration.system-logs" access="VIEW"} - {intl l='System logs'} - + {intl l='System logs'} + {/loop} diff --git a/templates/admin/default/includes/inner-form-toolbar.html b/templates/admin/default/includes/inner-form-toolbar.html index 96e0e65ab..1b2be1ff7 100755 --- a/templates/admin/default/includes/inner-form-toolbar.html +++ b/templates/admin/default/includes/inner-form-toolbar.html @@ -3,6 +3,7 @@ A toolbar displayed in forms, to display language change flags, submit and close Parameters: + - hide_flags: true / false. If true, the flags will not be visible - hide_submit_buttons: true / false. If true, only the close button will be deplayed. - show_currencies: true/false. If true, show the currency selection bar - page_url: the current page URL. Dafault id $current_url. Used to switchedition anguage. @@ -11,6 +12,7 @@ Parameters:
+ {if $hide_flags != true} + {/if}
diff --git a/templates/admin/default/includes/module-block.html b/templates/admin/default/includes/module-block.html index dd3e1ddb8..527e9bf6a 100644 --- a/templates/admin/default/includes/module-block.html +++ b/templates/admin/default/includes/module-block.html @@ -36,7 +36,7 @@ {module_include location='modules_table_row'} - +
{* {loop type="auth" name="can_change" role="ADMIN" resource="admin.modules" access="VIEW"} diff --git a/templates/admin/default/system-logs.html b/templates/admin/default/system-logs.html new file mode 100644 index 000000000..92e59c730 --- /dev/null +++ b/templates/admin/default/system-logs.html @@ -0,0 +1,213 @@ +{extends file="admin-layout.tpl"} + +{block name="page-title"}{intl l='System Logs'}{/block} + +{block name="check-resource"}admin.configuration.variable{/block} +{block name="check-access"}update{/block} + +{block name="main-content"} +
+ +
+ + + +
+
+
+ +
+ {intl l="System Logs configuration"} +
+
+ +
+
+
+ {form name='thelia.system-logs.configuration'} + + + {form_hidden_fields form=$form} + + {include + file = "includes/inner-form-toolbar.html" + hide_flags = true + + page_url = "{url path='/admin/configuration/system-logs'}" + close_url = "{url path='/admin/configuration'}" + } + +
+
+

{intl l='General configuration'}

+ + {if $form_error} +
{$form_error_message}
+ {/if} + +
+ + {form_field form=$form field="level"} +
+ + + + + + + {intl l='Messages which have a level greater or equal to the selected level will be added to the log destinations. '} + +
+ {/form_field} + + {form_field form=$form field='format'} +
+ + +
+ +
+ + + {intl l='Log lines header format. You may use the following variables: '} +
    +
  • #INDEX : {intl l='Sequential number of log line'}
  • +
  • #LEVEL : {intl l='Message level'}
  • +
  • #FILE : {intl l='Originating file name'}
  • +
  • #FUNCTION : {intl l='Originating function name '}
  • +
  • #LINE : {intl l='Originating file line number '}
  • +
  • #DATE : {intl l='date in yyyy-mm-dd format'}
  • +
  • #HOUR : {intl l='hour in hh:mm:ss format'}
  • +
+
+
+ {/form_field} + + {form_field form=$form field='show_redirections'} +
+ + +
+ + +
+ + {intl l='If yes, redirections through Redirect::exec() will be displayed as links'} +
+ {/form_field} + + {form_field form=$form field='files'} +
+ + +
+ +
+ + {intl l='Enter one or more file names without path separated by ";". Use "!" before a file name to exclude it. Use "*" to activate logs for all files.'} +
+ {/form_field} + + {form_field form=$form field='ip_addresses'} +
+ + +
+ +
+ + {intl l='Enter one or more IP V4 addresses separated by ";". Leave empty to display logs for all IP addresses'} + {intl l='Your current IP address is %ip' ip=$ip_address} +
+ {/form_field} + +
+ +
+ +
+

{intl l='Destinations'}

+ +
+ {intl l='The destinations processes logs to display, store or send them. You can select and configure zero, one or more destinations below.'} +
+ +
+ {foreach $destinations as $classname => $destination} + {$active = in_array(get_class($destination), $active_destinations)} +
+ + +

{$destination->getTitle()}

+

{$destination->getDescription()}

+ +
+
+ +
+
+ + {if count($destination->getConfigs()) > 0} +
+ {foreach $destination->getConfigs() as $config} +
+ + {if $config->getType() == 2} + + {else if $config->getType() == 1} + + {/if} + {$config->getLabel()} +
+ {/foreach} +
+ {/if} + +
+ {/foreach} +
+ +
+
+ + {/form} +
+
+
+
+
+
+
+{/block} + +{block name="javascript-initialization"} + +{/block} \ No newline at end of file diff --git a/web/index_dev.php b/web/index_dev.php index 3a88088fc..6b06585cd 100755 --- a/web/index_dev.php +++ b/web/index_dev.php @@ -21,9 +21,8 @@ /* */ /**********************************************************************************/ - -use Symfony\Component\HttpFoundation\Response; use Thelia\Core\Thelia; +use Thelia\Core\HttpFoundation\Response; use Thelia\Core\HttpFoundation\Request; //use Symfony\Component\DependencyInjection;