From acae8909b32c00ac2dad656bf54b3bffb56e01e0 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Mon, 21 Oct 2019 16:09:30 +0200 Subject: [PATCH 01/20] Add missing domains --- ps_emailsmanager.php | 98 ++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 54bd564..1f82039 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -32,10 +32,10 @@ public function __construct() parent::__construct(); - $this->displayName = $this->l('Email Templates Manager'); - $this->description = $this->l('This module allows you to manage your email templates'); - $this->confirmUninstall = $this->l( - 'Are you sure you want to uninstall this module? It will restore default email templates' + $this->displayName = $this->trans('Email Templates Manager', array(), 'Modules.Emailsmanager.Admin'); + $this->description = $this->trans('Adapt your emails’ design to your site’s visual identity, to your business, or to the time of the year!', array(), 'Modules.Emailsmanager.Admin'); + $this->confirmUninstall = $this->trans( + 'Are you sure you want to uninstall this module? It will restore default email templates', array(), 'Modules.Emailsmanager.Admin' ); $this->importsPath = dirname(__FILE__).DIRECTORY_SEPARATOR.'imports'.DIRECTORY_SEPARATOR; @@ -122,21 +122,21 @@ public function backupDefaultPack() // Create "mails" directory inside the theme if it doesn't exist if (!file_exists($themeMailsPath) && !mkdir($themeMailsPath)) { - $this->_errors[] = $this->l('Can\'t create folder: ').$themeMailsPath; + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$themeMailsPath; return false; } // Create iso folder if it doesn't exist if (!file_exists($themeMailsPath.DIRECTORY_SEPARATOR.$isoCode) && !mkdir($themeMailsPath.DIRECTORY_SEPARATOR.$isoCode)) { - $this->_errors[] = $this->l('Can\'t create folder: ').$themeMailsPath.DIRECTORY_SEPARATOR.$isoCode; + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$themeMailsPath.DIRECTORY_SEPARATOR.$isoCode; return false; } // Copy email if it doesn't exist if (!file_exists($themeMailsPath.$toCheck) && !copy($file->getPathname(), $themeMailsPath.$toCheck)) { - $this->_errors[] = $this->l('Can\'t copy file: ').$themeMailsPath.$toCheck; + $this->_errors[] = $this->trans('Cannot copy file:', array(), 'Modules.Emailsmanager.Admin').$themeMailsPath.$toCheck; return false; } } @@ -151,7 +151,7 @@ public function backupDefaultPack() // Creates the "classic" template directory if not exists if (!file_exists($backupPath) && !mkdir($backupPath)) { - $this->_errors[] = $this->l('Can\'t create folder: ').$backupPath; + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$backupPath; return false; } @@ -189,12 +189,12 @@ private function recursiveCopy($src, $dest) if (!file_exists($dest.DIRECTORY_SEPARATOR.$isoCode) && !mkdir($dest.DIRECTORY_SEPARATOR.$isoCode)) { - $this->_errors[] = $this->l('Can\'t create folder: ').$dest.DIRECTORY_SEPARATOR.$isoCode; + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$dest.DIRECTORY_SEPARATOR.$isoCode; return false; } if (!copy($copySrc, $copyDest)) { - $this->_errors[] = $this->l('Can\'t copy file: ').$copyDest; + $this->_errors[] = $this->trans('Cannot copy file:', array(), 'Modules.Emailsmanager.Admin').$copyDest; return false; } } @@ -271,7 +271,7 @@ public function saveTemplateConf() { $tplName = basename(Tools::getValue('select_template')); if (!$tplName || $tplName == '') { - $this->_errors[] = $this->l('Invalid template\'s name'); + $this->_errors[] = $this->trans('Invalid template\'s name', array(), 'Modules.Emailsmanager.Admin'); return false; } @@ -283,7 +283,7 @@ public function saveTemplateConf() $settings = $this->getTemplateSettings($tplName); if (!isset($settings['inputs']) || !is_array($settings['inputs'])) { - $this->_errors[] = $this->l('Invalid template'); + $this->_errors[] = $this->trans('Invalid template', array(), 'Modules.Emailsmanager.Admin'); return false; } @@ -334,7 +334,7 @@ public function saveTemplateConf() } if (!$translations) { - $this->_errors[] = $this->l('Addons API error'); + $this->_errors[] = $this->trans('Addons API error', array(), 'Admin.Notifications.Error'); return false; } @@ -348,7 +348,7 @@ public function saveTemplateConf() // Create folder for compiled files if (!mkdir($compilePath, 0777, true)) { - $this->_errors[] = $this->l('Can\'t create folder: '.$compilePath); + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin'.$compilePath); return false; } @@ -366,7 +366,7 @@ public function saveTemplateConf() $dest = $compilePath.$f->getBasename('.tpl').'.html'; if (file_put_contents($dest, $templateContent) === false) { - $this->_errors[] = $this->l('Can\'t write file:').' '.$dest; + $this->_errors[] = $this->trans('Cannot write file:', array(), 'Admin.Notifications.Error').' '.$dest; } } else { continue; @@ -379,7 +379,7 @@ public function saveTemplateConf() $dest = $compilePath.$f->getFilename(); if (copy($f->getRealPath(), $dest) === false) { - $this->_errors[] = $this->l('Can\'t write file:').' '.$dest; + $this->_errors[] = $this->trans('Cannot write file:', array(), 'Modules.Emailsmanager.Admin').' '.$dest; } } else { continue; @@ -395,7 +395,7 @@ public function saveTemplateConf() $themeMailsPath = _PS_ALL_THEMES_DIR_.$this->getCurrentThemeDirectory().DIRECTORY_SEPARATOR; $themeMailsPath .= 'mails'.DIRECTORY_SEPARATOR.$language['iso_code'].DIRECTORY_SEPARATOR; if (!file_exists($themeMailsPath) && !mkdir($themeMailsPath)) { - $this->_errors[] = $this->l('Can\'t create directory:').' '.$themeMailsPath; + $this->_errors[] = $this->trans('Cannot create directory:', array(), 'Modules.Emailsmanager.Admin').' '.$themeMailsPath; return false; } @@ -420,7 +420,7 @@ private function saveTemplateImgs() $dest = _PS_IMG_DIR_.'emails'; if (!file_exists($dest) && !mkdir($dest)) { - $this->_errors[] = $this->l('Can\'t create directory:').' '._PS_IMG_DIR_.'emails'; + $this->_errors[] = $this->trans('Cannot create directory:', array(), 'Admin.Emailsmanager.Admin').' '._PS_IMG_DIR_.'emails'; return false; } @@ -434,7 +434,7 @@ private function saveTemplateImgs() ); if ($state === false) { - $this->_errors[] = $this->l('Can\'t copy file:').' '.$file->getRealPath(); + $this->_errors[] = $this->trans('Cannot copy file:', array(), 'Modules.Emailsmanager.Admin').' '.$file->getRealPath(); return false; } } @@ -506,7 +506,7 @@ public function getContent() if (Tools::isSubmit('submitconf_'.$this->name)) { if ($this->saveTemplateImgs()) { if ($this->saveTemplateConf()) { - $this->_confirmations[] = $this->l('Template changed with success!'); + $this->_confirmations[] = $this->trans('Template changed successfully!', array(), 'Modules.Emailsmanager.Admin'); } } } elseif (Tools::getValue('select_template') === self::DEFAULT_THEME_NAME) { @@ -522,13 +522,13 @@ public function getContent() // Delete the template and restore classic $currentTemplate = $this->getCurrentTemplate(); if (!$currentTemplate) { - $this->_errors[] = $this->l('Invalid template'); + $this->_errors[] = $this->trans('Invalid template', array(), 'Modules.Emailsmanager.Admin'); } else { if ($currentTemplate['name'] == Tools::getValue('delete_template')) { $this->restoreClassicTemplate(); } Tools::deleteDirectory($this->importsPath.Tools::getValue('delete_template')); - $this->_confirmations[] = $this->l('Deleted with success'); + $this->_confirmations[] = $this->trans('Deleted with success', array(), 'Modules.Emailsmanager.Admin'); } } @@ -656,7 +656,7 @@ public function restoreClassicTemplate($all = false) } if (!mkdir($backupFolder, 0777)) { - $this->_errors[] = $this->l('Cannot create backup\'s folder. Please check permissions.'); + $this->_errors[] = $this->trans('Cannot create backup\'s folder. Please check permissions.', array(), 'Modules.Emailsmanager.Admin'); return false; } @@ -694,7 +694,7 @@ public function getTemplateSettings($name) $settings = Tools::jsonDecode(Tools::file_get_contents($path.DIRECTORY_SEPARATOR.'settings.json'), true); if (is_null($settings)) { - $this->_errors[] = $this->l('Invalid settings.json'); + $this->_errors[] = $this->trans('Invalid settings.json', array(), 'Modules.Emailsmanager.Admin'); return false; } @@ -715,17 +715,17 @@ public function displayForm($tplName) // init fields form $fieldsForm[0]['form'] = array( 'legend' => array( - 'title' => $this->l('Configure ').$settings['name'], + 'title' => $this->trans('Configure', array(), 'Admin.Actions').$settings['name'], 'name' => $settings['name'], ), 'input' => array(), 'submit' => array( - 'title' => $this->l('Save'), + 'title' => $this->trans('Save', array(), 'Admin.Actions'), 'class' => 'btn btn-default pull-right', ), 'buttons' => array( 'preview' => array( - 'title' => $this->l('Preview'), + 'title' => $this->trans('Preview', array(), 'Admin.Actions'), 'icon' => 'process-icon-preview', 'class' => 'pull-right', 'id' => 'preview-template', @@ -733,7 +733,7 @@ public function displayForm($tplName) ), 'cancel' => array( 'href' => $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name, - 'title' => $this->l('Cancel'), + 'title' => $this->trans('Cancel', array(), 'Admin.Actions'), 'icon' => 'process-icon-cancel' ) ) @@ -762,7 +762,7 @@ public function displayForm($tplName) $fieldsForm[0]['form']['buttons'] = array( array( 'href' => $this->context->link->getAdminLink('AdminModules').'&configure='.$this->name, - 'title' => $this->l('Cancel'), + 'title' => $this->trans('Cancel', array(), 'Admin.Actions'), 'icon' => 'process-icon-cancel' ), ); @@ -879,19 +879,19 @@ public function generateImportPanel() $fieldsForm[0]['form'] = array( 'legend' => array( - 'title' => $this->l('Import a pack of template'), + 'title' => $this->trans('Import a pack of template', array(), 'Modules.Emailsmanager.Admin'), ), 'input' => array( array( 'type' => 'file', - 'label' => $this->l('Zip'), - 'desc' => $this->l('Select your template\'s zip'), + 'label' => $this->trans('ZIP file', array(), 'Admin.Global'), + 'desc' => $this->trans('Select the template you want to import', array(), 'Modules.Emailsmanager.Admin'), 'required' => true, 'name' => 'uploadedfile', ), ), 'submit' => array( - 'title' => $this->l('Save'), + 'title' => $this->trans('Save', array(), 'Admin.Actions'), 'class' => 'btn btn-default pull-right' ), ); @@ -939,7 +939,7 @@ public function postProcess() $this->manageUploadError(); } elseif (!isset($_FILES['uploadedfile']) || !self::hasValidMimeType($_FILES['uploadedfile']['tmp_name'], 'application/zip')) { - $this->_errors[] = $this->l('Invalid .zip file'); + $this->_errors[] = $this->trans('Invalid .zip file', array(), 'Modules.Emailsmanager.Admin'); } else { $targetPath .= uniqid().DIRECTORY_SEPARATOR; @@ -948,12 +948,12 @@ public function postProcess() } if (!mkdir($targetPath, 0777, true)) { - $this->_errors[] = $this->l('Can\'t create folder: '.$targetPath); + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin'.$targetPath); return false; } if (!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $targetPath.$_FILES['uploadedfile']['name'])) { - $this->_errors[] = $this->l('Can\'t copy file to:').' '.$targetPath; + $this->_errors[] = $this->trans('Cannot copy file to:', array(), 'Admin.Emailsmanager.Admin').' '.$targetPath; } else { return $this->unpackTemplates($targetPath, $_FILES['uploadedfile']['name']); } @@ -980,7 +980,7 @@ public function unpackTemplates($zipPath, $filename) $fullPath = $destPath.DIRECTORY_SEPARATOR.$file; if (!is_dir($fullPath)) { if (!self::hasValidMimeType($fullPath, $allowedTypes)) { - $this->_errors[] = $this->l('Invalid file(s) in your zip'); + $this->_errors[] = $this->trans('Invalid file(s) in your .zip', array(), 'Modules.Emailsmanager.Admin'); Tools::deleteDirectory($destPath); $zip->close(); return false; @@ -992,9 +992,9 @@ public function unpackTemplates($zipPath, $filename) $settings = Tools::file_get_contents($settingsPath); $settings = Tools::jsonDecode($settings, true); if (!$settings || is_null($settings)) { - $this->_errors[] = $this->l('Settings file is missing'); + $this->_errors[] = $this->trans('Settings file is missing', array(), 'Modules.Emailsmanager.Admin'); } elseif (!isset($settings['name']) || empty($settings['name'])) { - $this->_errors[] = $this->l('Name is missing in settings file'); + $this->_errors[] = $this->trans('Name is missing in settings file', array(), 'Modules.Emailsmanager.Admin'); } else { if (file_exists($this->importsPath.$settings['name'])) { Tools::deleteDirectory($this->importsPath.$settings['name']); @@ -1006,7 +1006,7 @@ public function unpackTemplates($zipPath, $filename) } $zip->close(); } else { - $this->_errors[] = $this->l('Can\'t open:'.$zipPath); + $this->_errors[] = $this->trans('Cannot open:', array(), 'Modules.Emailsmanager.Admin'.$zipPath); } Tools::deleteDirectory($zipPath); @@ -1020,30 +1020,30 @@ public function manageUploadError() { switch ($_FILES['uploadedfile']['error']) { case UPLOAD_ERR_INI_SIZE: - $this->_errors[] = $this->l('The uploaded file exceeds the upload_max_filesize directive in php.ini'); + $this->_errors[] = $this->trans('The uploaded file exceeds the upload_max_filesize directive in php.ini', array(), 'Admin.Notifications.Error'); break; case UPLOAD_ERR_FORM_SIZE: - $this->_errors[] = $this->l( - 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form' + $this->_errors[] = $this->trans( + 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', array(), 'Admin.Notifications.Error' ); break; case UPLOAD_ERR_PARTIAL: - $this->_errors[] = $this->l('The uploaded file was only partially uploaded'); + $this->_errors[] = $this->trans('The uploaded file was only partially uploaded', array(), 'Admin.Notifications.Error'); break; case UPLOAD_ERR_NO_FILE: - $this->_errors[] = $this->l('No file was uploaded'); + $this->_errors[] = $this->trans('No file was uploaded', array(), 'Admin.Notifications.Error'); break; case UPLOAD_ERR_NO_TMP_DIR: - $this->_errors[] = $this->l('Missing a temporary folder'); + $this->_errors[] = $this->trans('Missing a temporary folder', array(), 'Admin.Notifications.Error'); break; case UPLOAD_ERR_CANT_WRITE: - $this->_errors[] = $this->l('Failed to write file to disk.'); + $this->_errors[] = $this->trans('Failed to write file to disk.', array(), 'Admin.Notifications.Error'); break; case UPLOAD_ERR_EXTENSION: - $this->_errors[] = $this->l('A PHP extension stopped the file upload.'); + $this->_errors[] = $this->trans('A PHP extension stopped the file upload.', array(), 'Admin.Notifications.Error'); break; default: - $this->_errors[] = sprintf($this->l('Internal error #%s'), $_FILES['newfile']['error']); + $this->_errors[] = sprintf($this->trans('Internal error #%s', array(), 'Admin.Notifications.Error'), $_FILES['newfile']['error']); break; } } From ea1bf2456387317597a5071e853fdafa1eaf88d3 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 10:11:01 +0100 Subject: [PATCH 02/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 1f82039..400e0f8 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -366,7 +366,7 @@ public function saveTemplateConf() $dest = $compilePath.$f->getBasename('.tpl').'.html'; if (file_put_contents($dest, $templateContent) === false) { - $this->_errors[] = $this->trans('Cannot write file:', array(), 'Admin.Notifications.Error').' '.$dest; + $this->_errors[] = $this->trans('Cannot write file:', array(), 'Modules.Emailsmanager.Admin').' '.$dest; } } else { continue; From bd320664bb05e953791000160bfe0ae4cbafe99e Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 10:11:07 +0100 Subject: [PATCH 03/20] Update ps_emailsmanager.php Co-Authored-By: GoT --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 400e0f8..4f48272 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -1006,7 +1006,7 @@ public function unpackTemplates($zipPath, $filename) } $zip->close(); } else { - $this->_errors[] = $this->trans('Cannot open:', array(), 'Modules.Emailsmanager.Admin'.$zipPath); + $this->_errors[] = $this->trans('Cannot open:', array(), 'Modules.Emailsmanager.Admin') . ' ' . $zipPath; } Tools::deleteDirectory($zipPath); From 7d0fc2adb401d7b37f6303c10ebf7ea38feb2759 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 10:11:29 +0100 Subject: [PATCH 04/20] Update ps_emailsmanager.php Co-Authored-By: GoT --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 4f48272..f08f0cc 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -948,7 +948,7 @@ public function postProcess() } if (!mkdir($targetPath, 0777, true)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin'.$targetPath); + $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin') . ' ' . $targetPath; return false; } From 9785dcdb64ca9de45520b5d0dc9afc15872c792d Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:34:59 +0100 Subject: [PATCH 05/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index f08f0cc..37aead0 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -122,7 +122,7 @@ public function backupDefaultPack() // Create "mails" directory inside the theme if it doesn't exist if (!file_exists($themeMailsPath) && !mkdir($themeMailsPath)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$themeMailsPath; + $this->_errors[] = $this->trans('Cannot create folder: %s', array($themeMailsPath), 'Modules.Emailsmanager.Admin'); return false; } From 40ba0dc5019ca50cc45ba93e186a7b8e74749b0e Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:35:08 +0100 Subject: [PATCH 06/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 37aead0..6fbbddf 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -129,7 +129,7 @@ public function backupDefaultPack() // Create iso folder if it doesn't exist if (!file_exists($themeMailsPath.DIRECTORY_SEPARATOR.$isoCode) && !mkdir($themeMailsPath.DIRECTORY_SEPARATOR.$isoCode)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$themeMailsPath.DIRECTORY_SEPARATOR.$isoCode; + $this->_errors[] = $this->trans('Cannot create folder: %s', array($themeMailsPath . DIRECTORY_SEPARATOR . $isoCode), 'Modules.Emailsmanager.Admin'); return false; } From cbaf8d789427d51eda74c14f09c179851ff4c2a7 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:35:41 +0100 Subject: [PATCH 07/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 6fbbddf..753129b 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -151,7 +151,7 @@ public function backupDefaultPack() // Creates the "classic" template directory if not exists if (!file_exists($backupPath) && !mkdir($backupPath)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$backupPath; + $this->_errors[] = $this->trans('Cannot create folder: %s', array($backupPath), 'Modules.Emailsmanager.Admin'); return false; } From f1da669caee2f2adefd868913168de4040787870 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:36:07 +0100 Subject: [PATCH 08/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 753129b..3a9cfa5 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -189,7 +189,7 @@ private function recursiveCopy($src, $dest) if (!file_exists($dest.DIRECTORY_SEPARATOR.$isoCode) && !mkdir($dest.DIRECTORY_SEPARATOR.$isoCode)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin').$dest.DIRECTORY_SEPARATOR.$isoCode; + $this->_errors[] = $this->trans('Cannot create folder: %s', array($dest . DIRECTORY_SEPARATOR . $isoCode), 'Modules.Emailsmanager.Admin'); return false; } From d73ad7a4c12e5a1aba07f10fd5b056089d21d342 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:36:52 +0100 Subject: [PATCH 09/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 3a9cfa5..e65cc97 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -348,7 +348,7 @@ public function saveTemplateConf() // Create folder for compiled files if (!mkdir($compilePath, 0777, true)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin'.$compilePath); + $this->_errors[] = $this->trans('Cannot create folder: %s', array($compilePath), 'Modules.Emailsmanager.Admin'); return false; } From abaa6c4a294c8d9cd6eec75d6157dd096b4ed00d Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:37:02 +0100 Subject: [PATCH 10/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index e65cc97..de0c19e 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -948,7 +948,7 @@ public function postProcess() } if (!mkdir($targetPath, 0777, true)) { - $this->_errors[] = $this->trans('Cannot create folder:', array(), 'Modules.Emailsmanager.Admin') . ' ' . $targetPath; + $this->_errors[] = $this->trans('Cannot create folder: %s', array($targetPath), 'Modules.Emailsmanager.Admin'); return false; } From 91eaf4354df2b136b142160e7a2bab04f9812c2f Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:37:16 +0100 Subject: [PATCH 11/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index de0c19e..b29eb27 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -136,7 +136,7 @@ public function backupDefaultPack() // Copy email if it doesn't exist if (!file_exists($themeMailsPath.$toCheck) && !copy($file->getPathname(), $themeMailsPath.$toCheck)) { - $this->_errors[] = $this->trans('Cannot copy file:', array(), 'Modules.Emailsmanager.Admin').$themeMailsPath.$toCheck; + $this->_errors[] = $this->trans('Cannot copy file: %s', array($themeMailsPath . $toCheck), 'Modules.Emailsmanager.Admin'); return false; } } From 0419c7ab08ebb006ad35e73cb98b15c324d19662 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:37:33 +0100 Subject: [PATCH 12/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index b29eb27..c013462 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -194,7 +194,7 @@ private function recursiveCopy($src, $dest) } if (!copy($copySrc, $copyDest)) { - $this->_errors[] = $this->trans('Cannot copy file:', array(), 'Modules.Emailsmanager.Admin').$copyDest; + $this->_errors[] = $this->trans('Cannot copy file: %s', array($copyDest), 'Modules.Emailsmanager.Admin'); return false; } } From 1ed6475670e9d33938b32f3376c698470582caaa Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:37:48 +0100 Subject: [PATCH 13/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index c013462..b04e295 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -366,7 +366,7 @@ public function saveTemplateConf() $dest = $compilePath.$f->getBasename('.tpl').'.html'; if (file_put_contents($dest, $templateContent) === false) { - $this->_errors[] = $this->trans('Cannot write file:', array(), 'Modules.Emailsmanager.Admin').' '.$dest; + $this->_errors[] = $this->trans('Cannot write file: %s', array($dest), 'Modules.Emailsmanager.Admin'); } } else { continue; From 0be800ee88f18ae3103d1aa7ec580746524d92b0 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:38:02 +0100 Subject: [PATCH 14/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index b04e295..53686be 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -379,7 +379,7 @@ public function saveTemplateConf() $dest = $compilePath.$f->getFilename(); if (copy($f->getRealPath(), $dest) === false) { - $this->_errors[] = $this->trans('Cannot write file:', array(), 'Modules.Emailsmanager.Admin').' '.$dest; + $this->_errors[] = $this->trans('Cannot write file: %s', array($dest), 'Modules.Emailsmanager.Admin'); } } else { continue; From 5ca32a0536435bb9bedf8b7ffa20597cda591386 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:38:13 +0100 Subject: [PATCH 15/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 53686be..5a91283 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -395,7 +395,7 @@ public function saveTemplateConf() $themeMailsPath = _PS_ALL_THEMES_DIR_.$this->getCurrentThemeDirectory().DIRECTORY_SEPARATOR; $themeMailsPath .= 'mails'.DIRECTORY_SEPARATOR.$language['iso_code'].DIRECTORY_SEPARATOR; if (!file_exists($themeMailsPath) && !mkdir($themeMailsPath)) { - $this->_errors[] = $this->trans('Cannot create directory:', array(), 'Modules.Emailsmanager.Admin').' '.$themeMailsPath; + $this->_errors[] = $this->trans('Cannot create directory: %s', array($themeMailsPath), 'Modules.Emailsmanager.Admin'); return false; } From 7361a0cc49c4dd9356c2b2b6a20b5c771b6c01d7 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:38:29 +0100 Subject: [PATCH 16/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 5a91283..f077336 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -420,7 +420,7 @@ private function saveTemplateImgs() $dest = _PS_IMG_DIR_.'emails'; if (!file_exists($dest) && !mkdir($dest)) { - $this->_errors[] = $this->trans('Cannot create directory:', array(), 'Admin.Emailsmanager.Admin').' '._PS_IMG_DIR_.'emails'; + $this->_errors[] = $this->trans('Cannot create directory: %s', array(_PS_IMG_DIR_ . 'emails'), 'Admin.Emailsmanager.Admin'); return false; } From 2844a78c7adc9bf700e158b39b34d018a68ac212 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:38:40 +0100 Subject: [PATCH 17/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index f077336..53cfcc1 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -434,7 +434,7 @@ private function saveTemplateImgs() ); if ($state === false) { - $this->_errors[] = $this->trans('Cannot copy file:', array(), 'Modules.Emailsmanager.Admin').' '.$file->getRealPath(); + $this->_errors[] = $this->trans('Cannot copy file: %s', array($file->getRealPath()), 'Modules.Emailsmanager.Admin'); return false; } } From 5bfeb11cc349fb573611e75534980794a8495f02 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:39:04 +0100 Subject: [PATCH 18/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 53cfcc1..11c730f 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -953,7 +953,7 @@ public function postProcess() } if (!move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $targetPath.$_FILES['uploadedfile']['name'])) { - $this->_errors[] = $this->trans('Cannot copy file to:', array(), 'Admin.Emailsmanager.Admin').' '.$targetPath; + $this->_errors[] = $this->trans('Cannot copy file to: %s', array($targetPath), 'Admin.Emailsmanager.Admin'); } else { return $this->unpackTemplates($targetPath, $_FILES['uploadedfile']['name']); } From 96d9c5f3d0b5df9118aaad929bb2ea83610c9e06 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 11:39:14 +0100 Subject: [PATCH 19/20] Update ps_emailsmanager.php --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index 11c730f..bdf0856 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -1006,7 +1006,7 @@ public function unpackTemplates($zipPath, $filename) } $zip->close(); } else { - $this->_errors[] = $this->trans('Cannot open:', array(), 'Modules.Emailsmanager.Admin') . ' ' . $zipPath; + $this->_errors[] = $this->trans('Cannot open: %s', array($zipPath), 'Modules.Emailsmanager.Admin'); } Tools::deleteDirectory($zipPath); From e3bc430b0dce9fca3d485ebb8f2032be2a5f2291 Mon Sep 17 00:00:00 2001 From: LouiseBonnard <32565890+LouiseBonnard@users.noreply.github.com> Date: Fri, 15 Nov 2019 16:32:12 +0100 Subject: [PATCH 20/20] Update ps_emailsmanager.php Co-Authored-By: GoT --- ps_emailsmanager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ps_emailsmanager.php b/ps_emailsmanager.php index bdf0856..40aeeee 100644 --- a/ps_emailsmanager.php +++ b/ps_emailsmanager.php @@ -1043,7 +1043,7 @@ public function manageUploadError() $this->_errors[] = $this->trans('A PHP extension stopped the file upload.', array(), 'Admin.Notifications.Error'); break; default: - $this->_errors[] = sprintf($this->trans('Internal error #%s', array(), 'Admin.Notifications.Error'), $_FILES['newfile']['error']); + $this->_errors[] = $this->trans('Internal error #%s', array($_FILES['newfile']['error']), 'Admin.Notifications.Error'); break; } }