From a7da6cf001ec195f1a5b1b4cf564abeeaffe7dbe Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Sun, 25 Oct 2015 22:50:40 +0100 Subject: [PATCH 1/6] function rel2abs() dans class.plx.utils.php --- core/lib/class.plx.utils.php | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/core/lib/class.plx.utils.php b/core/lib/class.plx.utils.php index d8f652d34..5ae4b5a2b 100644 --- a/core/lib/class.plx.utils.php +++ b/core/lib/class.plx.utils.php @@ -669,28 +669,26 @@ public static function httpEncoding() { * @param base url du site qui sera rajoutée devant les liens relatifs * @param html chaine de caractères à convertir * @return string chaine de caractères modifiée - * @author Stephane F., Amaury Graillat + * @author Stephane F., Amaury Graillat, J.P. Pourrez **/ public static function rel2abs($base, $html) { - // on protège les liens de type (href|src)="//" en doublant le caractère = - $html = preg_replace('@(href|src)=(["\']\/\/)@i', '\1==\2', $html); - // url des plugins - $html = preg_replace('@\<([^>]*) (href|src)=(["\'])[\.]/plugins@i', '<$1 $2=$3'.$base.'plugins', $html); - // generate server-only replacement for root-relative URLs - $server = preg_replace('@^([^:]+)://([^/]+)(/|$).*@', '\1://\2/', $base); - // on repare les liens ne commençant que part # - $get = plxUtils::getGets(); - $html = preg_replace('@\<([^>]*) (href|src)=(["\'])#@i', '<\1 \2=\3'.$get.'#', $html); - // replace root-relative URLs - $html = preg_replace('@\<([^>]*) (href|src)=(["\']).?/@i', '<\1 \2=\3'.$server, $html); - // replace base-relative URLs - $html = preg_replace('@\<([^>]*) (href|src)=(["\'])([^:"]*|[^:"]*:[^/"][^"]*)(["\'])@i', '<\1 \2=\3'.$base.'\4\5', $html); - // unreplace fully qualified URLs with proto: that were wrongly added $base - $html = preg_replace('@\<([^>]*) (href|src)=(["\'])'.$base.'([a-zA-Z0-9]*):@i', '<\1 \2=\3\4:', $html); - // on rétablit les liens de type (href|src)="//" en remplaçant les caractères == par = - $html = preg_replace('@(href|src)==@i', '\1=', $html); - return $html; + if (substr($base, -1) != '/') + $base .= '/'; + // on protège tous les liens externes au site, + // et on transforme tous les liens relatifs en absolus. + // on ajoute le hostname si nécessaire + $mask = '=<<>>='; + $patterns = array('/(href|src)=("|\')([a-z0-9]+):\/\//i', '/(href|src)=("|\')([^\/])/i'); + $replaces = array('\1'.$mask.'\2\3://', '\1=\2'.$base.'\3'); + if (preg_match('/^[a-z]+:\/\//i', $base)) { + $patterns[] = '/(href|src)=("|\')\/([^\/])/i'; + $replaces[] = '\1=\2'.$base.'\3'; + } + $result = preg_replace($patterns, $replaces, $html); + // on retire la protection des liens externes. Expressions régulières lentes et inutiles !! + $result = str_replace($mask, '=', $result); + return $result; } From 6c5ab44740d7343af59da8cbe251138d38cd0e84 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Wed, 28 Oct 2015 10:13:15 +0100 Subject: [PATCH 2/6] Refonte de la fonction tagList dans core/lib/class.plx.show.php --- core/lib/class.plx.show.php | 70 +++++++++++++++++++++---------------- themes/defaut/css/theme.css | 3 +- themes/defaut/sidebar.php | 2 +- 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/core/lib/class.plx.show.php b/core/lib/class.plx.show.php index 79218e46d..f0f2fda9a 100644 --- a/core/lib/class.plx.show.php +++ b/core/lib/class.plx.show.php @@ -1537,14 +1537,14 @@ public function tagFeed($type='rss', $tag='') { * @param order tri des tags (random, alpha, '') * @return stdout * @scope global - * @author Stephane F + * @author Stephane F, Jean-Pierre Pourrez **/ - public function tagList($format='
  • #tag_name
  • ', $max='', $order='') { + public function tagList($format='
  • #tag_name
  • ', $max='', $order='') { # Hook Plugins if(eval($this->plxMotor->plxPlugins->callHook('plxShowTagList'))) return; $datetime = date('YmdHi'); - $array=array(); + $buf = array(); // tableau associatif $alphasort=array(); # On verifie qu'il y a des tags if($this->plxMotor->aTags) { @@ -1553,48 +1553,58 @@ public function tagList($format='
  • - tagList('
  • #tag_name
  • '); ?> + tagList('
  • #tag_name
  • ', 20); ?>

    From 4c2c4dc07c53f99afc8f0b2c3e986f28e6c452bb Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Wed, 28 Oct 2015 22:49:59 +0100 Subject: [PATCH 3/6] Correction des mime-type et de la valeur de href dans le noeud des flux RSS. --- core/lib/class.plx.feed.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/lib/class.plx.feed.php b/core/lib/class.plx.feed.php index 06c7b7826..756ec63dd 100644 --- a/core/lib/class.plx.feed.php +++ b/core/lib/class.plx.feed.php @@ -265,7 +265,7 @@ public function getRssArticles() { } # On affiche le flux - header('Content-Type: text/xml; charset='.PLX_CHARSET); + header('Content-Type: application/rss+xml; charset='.PLX_CHARSET); echo ''."\n"; echo ''."\n"; echo ''."\n"; @@ -273,7 +273,7 @@ public function getRssArticles() { echo "\t".''.$link.''."\n"; echo "\t".'' . $this->aConf['default_lang'] . ''."\n"; echo "\t".''.plxUtils::strCheck($this->aConf['description']).''."\n"; - echo ''."\n"; + echo ''."\n"; $last_updated = plxDate::dateIso2rfc822($last_updated); echo "\t".''.$last_updated.''."\n"; echo "\t".'PluXml'."\n"; @@ -340,7 +340,7 @@ public function getRssComments() { } # On affiche le flux - header('Content-Type: text/xml; charset='.PLX_CHARSET); + header('Content-Type: application/rss+xml; charset='.PLX_CHARSET); echo ''."\n"; echo ''."\n"; echo ''."\n"; @@ -405,7 +405,7 @@ public function getAdminComments() { } # On affiche le flux - header('Content-Type: text/xml; charset='.PLX_CHARSET); + header('Content-Type: application/rss+xml; charset='.PLX_CHARSET); echo ''."\n"; echo ''."\n"; echo ''."\n"; From a7661efc5667b1ad4c548efb672f08ed5acc76b4 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Mon, 2 Nov 2015 13:49:49 +0100 Subject: [PATCH 4/6] Revert "Correction des mime-type et de la valeur de href dans le noeud des flux RSS." This reverts commit 4c2c4dc07c53f99afc8f0b2c3e986f28e6c452bb. --- core/lib/class.plx.feed.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/lib/class.plx.feed.php b/core/lib/class.plx.feed.php index 756ec63dd..06c7b7826 100644 --- a/core/lib/class.plx.feed.php +++ b/core/lib/class.plx.feed.php @@ -265,7 +265,7 @@ public function getRssArticles() { } # On affiche le flux - header('Content-Type: application/rss+xml; charset='.PLX_CHARSET); + header('Content-Type: text/xml; charset='.PLX_CHARSET); echo ''."\n"; echo ''."\n"; echo ''."\n"; @@ -273,7 +273,7 @@ public function getRssArticles() { echo "\t".''.$link.''."\n"; echo "\t".'' . $this->aConf['default_lang'] . ''."\n"; echo "\t".''.plxUtils::strCheck($this->aConf['description']).''."\n"; - echo ''."\n"; + echo ''."\n"; $last_updated = plxDate::dateIso2rfc822($last_updated); echo "\t".''.$last_updated.''."\n"; echo "\t".'PluXml'."\n"; @@ -340,7 +340,7 @@ public function getRssComments() { } # On affiche le flux - header('Content-Type: application/rss+xml; charset='.PLX_CHARSET); + header('Content-Type: text/xml; charset='.PLX_CHARSET); echo ''."\n"; echo ''."\n"; echo ''."\n"; @@ -405,7 +405,7 @@ public function getAdminComments() { } # On affiche le flux - header('Content-Type: application/rss+xml; charset='.PLX_CHARSET); + header('Content-Type: text/xml; charset='.PLX_CHARSET); echo ''."\n"; echo ''."\n"; echo ''."\n"; From 9f0ea4fd9bcab8d9351c13f103449cabe69955b4 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Mon, 2 Nov 2015 13:50:54 +0100 Subject: [PATCH 5/6] Revert "Refonte de la fonction tagList dans core/lib/class.plx.show.php" This reverts commit 6c5ab44740d7343af59da8cbe251138d38cd0e84. --- core/lib/class.plx.show.php | 70 ++++++++++++++++--------------------- themes/defaut/css/theme.css | 3 +- themes/defaut/sidebar.php | 2 +- 3 files changed, 32 insertions(+), 43 deletions(-) diff --git a/core/lib/class.plx.show.php b/core/lib/class.plx.show.php index f0f2fda9a..79218e46d 100644 --- a/core/lib/class.plx.show.php +++ b/core/lib/class.plx.show.php @@ -1537,14 +1537,14 @@ public function tagFeed($type='rss', $tag='') { * @param order tri des tags (random, alpha, '') * @return stdout * @scope global - * @author Stephane F, Jean-Pierre Pourrez + * @author Stephane F **/ - public function tagList($format='
  • #tag_name
  • ', $max='', $order='') { + public function tagList($format='
  • #tag_name
  • ', $max='', $order='') { # Hook Plugins if(eval($this->plxMotor->plxPlugins->callHook('plxShowTagList'))) return; $datetime = date('YmdHi'); - $buf = array(); // tableau associatif + $array=array(); $alphasort=array(); # On verifie qu'il y a des tags if($this->plxMotor->aTags) { @@ -1553,58 +1553,48 @@ public function tagList($format='
  • - tagList('
  • #tag_name
  • ', 20); ?> + tagList('
  • #tag_name
  • '); ?>

    From 23cdb23ea50d8b3beaa44a7b633203cab4efc215 Mon Sep 17 00:00:00 2001 From: bazooka07 Date: Thu, 5 Nov 2015 09:18:30 +0100 Subject: [PATCH 6/6] =?UTF-8?q?correction=20de=20la=20valeur=20de=20href?= =?UTF-8?q?=20dans=20le=20link=20inclus=20dans=20l'entete=20de=20la=20page?= =?UTF-8?q?=20html,=20pour=20la=20categorie=20ou=20le=20tag=20affich=C3=A9?= =?UTF-8?q?=20dans=20la=20page.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/defaut/header.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/themes/defaut/header.php b/themes/defaut/header.php index f46465223..da7081fb2 100644 --- a/themes/defaut/header.php +++ b/themes/defaut/header.php @@ -13,7 +13,21 @@ templateCss() ?> pluginsCss() ?> +plxMotor->mode == 'categorie') { + $categorie = $plxShow->catId(); + $id = str_pad($categorie, 3, '0', STR_PAD_LEFT); ?> + +plxMotor->mode == 'tags') { + $tag = plxUtils::strCheck($plxShow->plxMotor->cible); ?> + + +