From ae25d7275c32ac136bd3d78f8d6b709da7720dfb Mon Sep 17 00:00:00 2001 From: P3ter Date: Sun, 5 Jan 2020 21:59:48 +0100 Subject: [PATCH 1/7] phpmailer include removed --- core/admin/prepend.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/admin/prepend.php b/core/admin/prepend.php index 44c742bc9..fd811d190 100644 --- a/core/admin/prepend.php +++ b/core/admin/prepend.php @@ -41,9 +41,6 @@ include_once PLX_CORE.'lib/class.plx.plugins.php'; include_once PLX_CORE.'lib/class.plx.token.php'; include_once PLX_CORE.'lib/class.plx.template.php'; -include_once PLX_CORE.'lib/class.phpmailer.php'; -include_once PLX_CORE.'lib/class.phpmailer.smtp.php'; -include_once PLX_CORE.'lib/class.phpmailer.exception.php'; # Echappement des caractères if($_SERVER['REQUEST_METHOD'] == 'POST') $_POST = plxUtils::unSlash($_POST); From 5c8b5a3914338b46e6382f30649228909bb365eb Mon Sep 17 00:00:00 2001 From: P3ter Date: Tue, 7 Jan 2020 00:46:01 +0100 Subject: [PATCH 2/7] FIX #360 #361 #362 #363 --- README.md | 6 ++-- core/admin/auth.php | 6 ++-- core/admin/prepend.php | 3 -- core/lang/en/core.php | 2 +- core/lib/class.plx.admin.php | 2 +- core/lib/class.plx.motor.php | 30 ++++++++++++++------ core/lib/class.plx.show.php | 4 +-- core/lib/class.plx.template.php | 19 +++++++++---- core/lib/class.plx.token.php | 2 +- core/lib/config.php | 5 ++-- install.php | 3 +- update/update_5.8.1.php | 32 +++++++++++++++++++++ update/versions.php | 49 +++++++++++++++++---------------- 13 files changed, 107 insertions(+), 56 deletions(-) create mode 100755 update/update_5.8.1.php diff --git a/README.md b/README.md index 40250c461..396da3fcb 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,10 @@ PluXml ====== Créez un site web performant en toute simplicité et sans base de données. -[**Télécharger PluXml 5.7**](https://www.pluxml.org/download/pluxml-latest.zip) (zip) +[**Télécharger PluXml 5.8**](https://www.pluxml.org/download/pluxml-latest.zip) (zip) -* Version stable (5.7) : [master](https://github.com/pluxml/PluXml/tree/master) -* Version en développement (5.8) : [develop](https://github.com/pluxml/PluXml/tree/develop) +* Version stable (5.8) : [master](https://github.com/pluxml/PluXml/tree/master) +* Version en développement (5.8.1) : [develop](https://github.com/pluxml/PluXml/tree/develop) Principales caractéristiques ---------------------------- diff --git a/core/admin/auth.php b/core/admin/auth.php index 32a3edc2f..97dbaf204 100644 --- a/core/admin/auth.php +++ b/core/admin/auth.php @@ -130,11 +130,11 @@ $plxAdmin->editPassword($_POST); - if (!empty($msg = $_SESSION['error'])) { + if (!empty($msg = isset($_SESSION['error']) ? $_SESSION['error'] : '')) { $css = 'alert red'; } else { - if (!empty($msg = $_SESSION['info'])) { + if (!empty($msg = isset($_SESSION['info']) ? $_SESSION['info'] : '')) { $css = 'alert green'; } } @@ -173,7 +173,7 @@ plxPlugins->callHook('AdminAuthBegin')); - switch ($_GET['action']){ + switch (isset($_GET['action']) ? $_GET['action'] : false){ case 'lostpassword': # Affichage du formulaire d'envoi du mail de changement de mot de passe # Hook plugins eval($plxAdmin->plxPlugins->callHook('AdminAuthTopLostPassword')); diff --git a/core/admin/prepend.php b/core/admin/prepend.php index fd811d190..78697e910 100644 --- a/core/admin/prepend.php +++ b/core/admin/prepend.php @@ -1,8 +1,6 @@ '%s has write access', -'L_WRITE_NOT_ACCESS' => '%s does not have write access or does not exist', +'L_WRITE_NOT_ACCESS' => '%s has no writing access or is missing', 'L_MODREWRITE_AVAILABLE' => 'Apache URL Rewriting module mod_rewrite available', 'L_MODREWRITE_NOT_AVAILABLE' => 'Apache URL Rewriting module mod_rewrite unavailable', 'L_LIBGD_INSTALLED' => 'GD library installed', diff --git a/core/lib/class.plx.admin.php b/core/lib/class.plx.admin.php index b42791069..cb4f28892 100644 --- a/core/lib/class.plx.admin.php +++ b/core/lib/class.plx.admin.php @@ -370,7 +370,7 @@ public function verifyLostPasswordToken($token) { $valid = false; foreach($this->aUsers as $user_id => $user) { - if ($user['password_token'] == $token AND $user['password_token_expiry'] >= date(YmdHi)) { + if ($user['password_token'] == $token AND $user['password_token_expiry'] >= date('YmdHi')) { $valid = true; } } diff --git a/core/lib/class.plx.motor.php b/core/lib/class.plx.motor.php index 1c5c5f106..912e2ab08 100644 --- a/core/lib/class.plx.motor.php +++ b/core/lib/class.plx.motor.php @@ -7,6 +7,8 @@ * @author Anthony GUÉRIN, Florent MONTHEL, Stéphane F, Pedro "P3ter" CADETE **/ +include_once PLX_CORE.'lib/class.plx.template.php'; + class plxMotor { public $get = false; # Donnees variable GET @@ -41,6 +43,9 @@ class plxMotor { public $plxErreur = null; # Objet plxErreur public $plxPlugins = null; # Objet plxPlugins + private static $plxTemplates = PLX_CORE.'templates/'; + private static $plxTemplatesData = PLX_ROOT.'data/templates/'; + private static $instance; /** @@ -110,8 +115,8 @@ protected function __construct($filename) { # Hook plugins eval($this->plxPlugins->callHook('plxMotorConstruct')); # Get templates from core/templates and data/templates - $this->getTemplates(PLX_TEMPLATES); - $this->getTemplates(PLX_TEMPLATES_DATA); + $this->getTemplates(self::$plxTemplates); + $this->getTemplates(self::$plxTemplatesData); } /** @@ -443,9 +448,12 @@ public function getCategories($filename) { # Recuperation du fichier template $this->aCats[$number]['template']=isset($attributes['template'])?$attributes['template']:'categorie.php'; # Récupération des informations de l'image représentant la catégorie - $this->aCats[$number]['thumbnail']=plxUtils::getValue($values[$iTags['thumbnail'][$i]]['value']); - $this->aCats[$number]['thumbnail_title']=plxUtils::getValue($values[$iTags['thumbnail_title'][$i]]['value']); - $this->aCats[$number]['thumbnail_alt']=plxUtils::getValue($values[$iTags['thumbnail_alt'][$i]]['value']); + $thumbnail = plxUtils::getValue($iTags['thumbnail'][$i]); + $this->aCats[$number]['thumbnail']=plxUtils::getValue($values[$thumbnail]['value']); + $thumbnail_title = plxUtils::getValue($iTags['thumbnail_title'][$i]); + $this->aCats[$number]['thumbnail_title']=plxUtils::getValue($values[$thumbnail_title]['value']); + $thumbnail_alt = plxUtils::getValue($iTags['thumbnail_alt'][$i]); + $this->aCats[$number]['thumbnail_alt']=plxUtils::getValue($values[$thumbnail_alt]['value']); # Récuperation état affichage de la catégorie dans le menu $this->aCats[$number]['menu']=isset($attributes['menu'])?$attributes['menu']:'oui'; # Récuperation état activation de la catégorie dans le menu @@ -569,8 +577,10 @@ public function getUsers($filename) { $this->aUsers[$number]['email']=plxUtils::getValue($values[$email]['value']); $lang = isset($iTags['lang'][$i]) ? $values[$iTags['lang'][$i]]['value']:''; $this->aUsers[$number]['lang'] = $lang!='' ? $lang : $this->aConf['default_lang']; - $this->aUsers[$number]['password_token']=plxUtils::getValue($values[$iTags['password_token'][$i]]['value']); - $this->aUsers[$number]['password_token_expiry']=plxUtils::getValue($values[$iTags['password_token_expiry'][$i]]['value']); + $password_token = plxUtils::getValue($iTags['password_token'][$i]); + $this->aUsers[$number]['password_token']=plxUtils::getValue($values[$password_token]['value']); + $password_token_expiry = plxUtils::getValue($iTags['password_token_expiry'][$i]); + $this->aUsers[$number]['password_token_expiry']=plxUtils::getValue($values[$password_token_expiry]['value']); # Hook plugins eval($this->plxPlugins->callHook('plxMotorGetUsers')); } @@ -1002,8 +1012,10 @@ public function getTags($filename) { **/ public function getTemplates($templateFolder) { $files = array_diff(scandir($templateFolder), array('..', '.')); - foreach ($files as $file) { - $this->aTemplates[$file] = new PlxTemplate($templateFolder, $file); + if (!empty($files)) { + foreach ($files as $file) { + $this->aTemplates[$file] = new PlxTemplate($templateFolder, $file); + } } } diff --git a/core/lib/class.plx.show.php b/core/lib/class.plx.show.php index 287858120..507a67fac 100644 --- a/core/lib/class.plx.show.php +++ b/core/lib/class.plx.show.php @@ -487,8 +487,8 @@ public function catThumbnail($format=''."\n"; $xml .= ''."\n"; if($content['data']>0) - $xml .= "\t".''."\n"; + $xml .= "\t".''."\n"; $xml .= ''; plxUtils::write($xml,path('XMLFILE_CATEGORIES')); diff --git a/update/update_5.8.1.php b/update/update_5.8.1.php new file mode 100755 index 000000000..ab2ec5b09 --- /dev/null +++ b/update/update_5.8.1.php @@ -0,0 +1,32 @@ +"; + $data = file_get_contents(path('XMLFILE_CATEGORIES')); + $tag = 'categorie'; + if(preg_match_all('{<'.$tag.'[^>]*>(.*?)}', $data, $matches, PREG_PATTERN_ORDER)) { + foreach($matches[0] as $match) { + if(!preg_match('//', $match)) { + $str = str_replace('', '', $match); + $data = str_replace($match, $str, $data); + } + } + if(!plxUtils::write($data, path('XMLFILE_CATEGORIES'))) { + echo '

'.L_UPDATE_ERR_FILE.'

'; + return false; + } + } + return true; + } +} \ No newline at end of file diff --git a/update/versions.php b/update/versions.php index 599a1ca3d..c0a19178f 100644 --- a/update/versions.php +++ b/update/versions.php @@ -6,29 +6,30 @@ * @author Stephane F **/ -$versions = array( - '4.2' => 'update_4.2.php', - '4.3' => '', - '4.3.1' => '', - '4.3.2' => '', - '5.0' => 'update_5.0.php', - '5.0.1' => '', - '5.0.2' => '', - '5.1' => 'update_5.1.php', - '5.1.1' => 'update_5.1.1.php', - '5.1.2' => '', - '5.1.3' => 'update_5.1.3.php', - '5.1.4' => 'update_5.1.4.php', - '5.1.5' => '', - '5.1.6' => 'update_5.1.6.php', - '5.1.7' => 'update_5.1.7.php', - '5.2' => 'update_5.2.php', - '5.3' => '', - '5.3.1' => '', - '5.4' => 'update_5.4.php', - '5.5' => 'update_5.5.php', - '5.6' => '', - '5.7' => '', - '5.8' => 'update_5.8.php', +$versions = array ( + '4.2' => 'update_4.2.php', + '4.3' => '', + '4.3.1' => '', + '4.3.2' => '', + '5.0' => 'update_5.0.php', + '5.0.1' => '', + '5.0.2' => '', + '5.1' => 'update_5.1.php', + '5.1.1' => 'update_5.1.1.php', + '5.1.2' => '', + '5.1.3' => 'update_5.1.3.php', + '5.1.4' => 'update_5.1.4.php', + '5.1.5' => '', + '5.1.6' => 'update_5.1.6.php', + '5.1.7' => 'update_5.1.7.php', + '5.2' => 'update_5.2.php', + '5.3' => '', + '5.3.1' => '', + '5.4' => 'update_5.4.php', + '5.5' => 'update_5.5.php', + '5.6' => '', + '5.7' => '', + '5.8' => 'update_5.8.php', + '5.8.1' => 'update_5.8.1.php' ); ?> From 1d6c9529e19bf8d0ef90309c80ff8fe7de34c006 Mon Sep 17 00:00:00 2001 From: P3ter Date: Tue, 7 Jan 2020 01:01:43 +0100 Subject: [PATCH 3/7] FIX #360 --- core/lib/class.plx.admin.php | 4 ++-- update/update_5.8.1.php | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/lib/class.plx.admin.php b/core/lib/class.plx.admin.php index cb4f28892..51747a416 100644 --- a/core/lib/class.plx.admin.php +++ b/core/lib/class.plx.admin.php @@ -439,8 +439,8 @@ public function editUsers($content, $action=false) { $this->aUsers[$user_id]['lang'] = (isset($this->aUsers[$user_id]['lang'])?$this->aUsers[$user_id]['lang']:$this->aConf['default_lang']); $this->aUsers[$user_id]['infos'] = (isset($this->aUsers[$user_id]['infos'])?$this->aUsers[$user_id]['infos']:''); - $this->aUsers[$user_id]['password_token'] = trim($content[$user_id.'_password_token']); - $this->aUsers[$user_id]['password_token_expiry'] = trim($content[$user_id.'_password_token_expiry']); + $this->aUsers[$user_id]['password_token'] = (isset($this->aUsers[$user_id]['_password_token'])?$this->aUsers[$user_id]['_password_token']:''); + $this->aUsers[$user_id]['password_token_expiry'] = (isset($this->aUsers[$user_id]['_password_token_expiry'])?$this->aUsers[$user_id]['_password_token_expiry']:''); # Hook plugins eval($this->plxPlugins->callHook('plxAdminEditUsersUpdate')); $action = true; diff --git a/update/update_5.8.1.php b/update/update_5.8.1.php index ab2ec5b09..d5cce1ff7 100755 --- a/update/update_5.8.1.php +++ b/update/update_5.8.1.php @@ -29,4 +29,27 @@ public function step1() { } return true; } + + /** + * Update users file with new fields password_token, password_token_expiry + * @return boolean + */ + public function step2() { + echo L_UPDATE_FILE." (".path('XMLFILE_USERS').")
"; + $data = file_get_contents(path('XMLFILE_USERS')); + $tag = 'user'; + if(preg_match_all('{<'.$tag.'[^>]*>(.*?)}', $data, $matches, PREG_PATTERN_ORDER)) { + foreach($matches[0] as $match) { + if(!preg_match('//', $match)) { + $str = str_replace('', '', $match); + $data = str_replace($match, $str, $data); + } + } + if(!plxUtils::write($data, path('XMLFILE_CATEGORIES'))) { + echo '

'.L_UPDATE_ERR_FILE.'

'; + return false; + } + } + return true; + } } \ No newline at end of file From 02280b5a334561dd6b7d4725129aab3ec95f8181 Mon Sep 17 00:00:00 2001 From: Pedro CADETE Date: Tue, 7 Jan 2020 18:31:11 +0100 Subject: [PATCH 4/7] FIX warning messages --- core/admin/top.php | 4 ++-- core/lib/class.plx.motor.php | 10 ++++++---- install.php | 5 +++++ readme/CHANGELOG | 6 ++++++ update/update_5.8.1.php | 13 ++++++++++++- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/core/admin/top.php b/core/admin/top.php index fed4cc05d..cfaed96a4 100644 --- a/core/admin/top.php +++ b/core/admin/top.php @@ -68,7 +68,7 @@ else echo L_PROFIL_WRITER; ?> -
  • PluXml aConf['version'] ?>
  • +
  • PluXml aConf['version'] ?>