Page effacée si balise lien incompléte dans une page
Micman Membre non connecté
-
Booster Mortier
- Voir le profil du membre Micman
- Inscrit le : 01/11/2009
- Site internet
- Groupes :
-
Equipe Rédaction
Je n'ai pas trouvé de post sur le sujet alors je crée celui-ci au cas.
Je viens de faire la désagréable expérience avec une page dans laquelle j'ai plusieurs lien avec les balises "url" et "/url" qui, si la balise "/url" est oubliée , cela a l'effet d'effacer entiérement la page !
De plus, comme je n'arrivais plus à la faire afficher - et avant de comprendre ce qui se passait - je l'ai supprimée. Mal m'en a pris, parce que j'avais oublié qu'elle était aussi une catégorie ... ce qui a eu l'effet de supprimer toutes les pages qui lui étaient rattachées !
Bref la cata. Surtout lorsque vous n'avez pas fait de sauvegarde de la base depuis un petit moment ...
Je voulais surtout alerter les développeurs sur ce problème et pour que ce souci soit pris en compte dans la prochaine version du module.
PS: j'ai intensionnellement mis des " à la place des [ dans le texte.
Si toutefois vous avez une solution sur ce problème, je suis preneur.
Merci
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
Je viens de tester et je n'ai aucun soucis ?
Tu as quel version de PBT ?
Micman Membre non connecté
-
Booster Mortier
- Voir le profil du membre Micman
- Inscrit le : 01/11/2009
- Site internet
- Groupes :
-
Equipe Rédaction
Je suis en 3.0.8.
Je préciserais que le lien fait appel à une autre page. Cela peut avoir son importance.
Voilà la ligne sur laquelle j'ai soumis le manque de balise :
Code BBCODE :
> [url=/pages/pages.php?title=brouillon-mises-a-jour-et-nouveaux-logiciels-2011]Brouillon Mises à jour et Nouveaux logiciels 2011[/url]
Si j'enlève la balise [/url] la page dans laquelle j'ai ce lien devient vide.
Ensuite j'ai aussi eu le souci de la suppression de toutes pages liées à la "page catégorie" qui ne m'a pas alerté quelles allaient être supprimée.
Il faudrait peut-être un message d'alerte plus précis sur ce point.
benflovideo Membre non connecté
-
Modérateur
- Voir le profil du membre benflovideo
- Inscrit le : 13/03/2010
- Groupes :
-
Equipe Modération
-
Equipe Communication
Micman :
Ensuite j'ai aussi eu le souci de la suppression de toutes pages liées à la "page catégorie" qui ne m'a pas alerté quelles allaient être supprimée.
Il faudrait peut-être un message d'alerte plus précis sur ce point.
Ensuite j'ai aussi eu le souci de la suppression de toutes pages liées à la "page catégorie" qui ne m'a pas alerté quelles allaient être supprimée.
Il faudrait peut-être un message d'alerte plus précis sur ce point.
Hello,
Je suis d'accord là dessus, je me suis fais avoir la première fois.. heureusement que la sauvegarde de la bdd était récente !
Benji
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
Micman Membre non connecté
-
Booster Mortier
- Voir le profil du membre Micman
- Inscrit le : 01/11/2009
- Site internet
- Groupes :
-
Equipe Rédaction
Pour la suppression de la "page catégorie" c'est avec le menu flottant "Outils" en sélectionnant "Supprimer cette page". J'ai refais un essai avec des pages de tests, en fait, il n'y a pas de message d'alerte. La page est supprimée directement ainsi que les pages liées.
Shadow Membre non connecté
Booster Fusée
-
Booster Fusée
- Voir le profil du membre Shadow
- Inscrit le : 30/12/2007
- Site internet
Pour la suppression d'une catégorie sans alerte, je suis d'accord qu'il faudrait corriger cela.
Concernant la suppression d'une page lorsqu'une balise est fermante est oubliée, tu sembles être le seul à rencontrer ce problème (je n'ai pas non plus réussi à le reproduire, que ce soit en ligne ou en local). Est-ce que tu rencontres ce problèmes de façon systématique ?
Shadow
"Quand tu ranges chez toi, ça fout le bordel chez ton voisin". - Règle d'entropie générale adaptée aux usages domestiques.
"Quand tu ranges chez toi, ça fout le bordel chez ton voisin". - Règle d'entropie générale adaptée aux usages domestiques.
Micman Membre non connecté
-
Booster Mortier
- Voir le profil du membre Micman
- Inscrit le : 01/11/2009
- Site internet
- Groupes :
-
Equipe Rédaction
En ce qui concerne le problème avec la balise manquante, je n'ai pas dis que la page était supprimée mais que cela l'effaçait. Je viens de refaire l'expérience et c'est la même chose.
Cependant, il faut réunir les conditions suivantes :
> Avoir créé une "page catégorie"
> Avoir une/des pages liée(s) à cette "page catégorie"
> Créer un lien à une de ces pages
> Utiliser les balises [url] et [/url] pour ce lien
> Utiliser un chemin direct /pages/pages?title=nom-page-liée
Il suffit d'enlever la balise [/url] et de valider, et cela vide (efface) entièrement le contenu de la "page catégorie".
Édité par Micman Le 01/03/2011 à 00h40
FameLady93 Membre non connecté
Booster Fuzil
-
Booster Fuzil
- Voir le profil du membre FameLady93
- Inscrit le : 07/02/2011
Sa ne viens pas du fait de créer un lien vers une autre page de l'outils pages
Si tu fais ceci
Code TEXT :
[url]http://ADRESSE/PATH/pages/TITRE-DE-LA-PAGE
Quand tu vas valider, le contenu de la page sera toujours là.
Par contre avec ce format
Code TEXT :
[url]http://ADRESSE/PATH/pages/pages?title=TITRE_DE_LA_PAGE
Là oui en effet sa supprime le contenu de la page.
J'ai remarquée que sa se manifestait surtout après le
title=
Si ce qui se trouve après le = à un nombre de caractères supérieur à 8, alors tu perd le contenu de ta page.
Sinon et bien tu voie les balises et rien ne disparaît.
Il y a bien un problème de ce côté là
Micman Membre non connecté
-
Booster Mortier
- Voir le profil du membre Micman
- Inscrit le : 01/11/2009
- Site internet
- Groupes :
-
Equipe Rédaction
Oui, après de nouveaux tests, je confirme bien que l'effacement de la page se produit lorsque les 3 conditions suivantes sont réunies :
> Avoir un nom de page comportant plus de 8 caractères.
> Utiliser les balises de lien pour créer un lien sur cette page.
> Avoir oublié/supprimé la balise de fin [/url]
Je pense que créer une page avec un nom dépassant 8 caractères est courant. De ce fait, ce souci est potentiellement dangereux et susceptible d'arriver à n'importe qui utilisant aujourd'hui PHPBoost non ?
Est-ce un souci intrinsèque à PHP ? Au BBcode ? Je ne saurais le dire. Mais je pense qu'une personne du développement devrait se pencher dessus non ?
Édité par Micman Le 02/03/2011 à 22h09
ben.popeye Membre non connecté
-
Modérateur
- Voir le profil du membre ben.popeye
- Inscrit le : 04/08/2005
- Site internet
- Groupes :
-
Equipe Historique
J'ai fait quelques petits tests et à priori c'est dans l'interprétation du BBCode qu'il y a ce problème, il ne doit donc pas être spécifique aux pages mais à l'ensemble de PHPBoost.
Je n'ai pas le temps de le corriger maintenant, j'essaie de faire ça dans les jours à venir. Faites moi un up si vous n'avez pas de nouvelles.
Un problème, une question ? Cherchez dans la FAQ ou la documentation. Si vous ne trouvez pas la réponse, demandez du support sur le forum.
Bjarne Stroustrup, inventeur du C++ :"There are two ways to write error-free programs; only the third works."
ReidLos Membre non connecté
-
Modérateur
- Voir le profil du membre ReidLos
- Inscrit le : 27/02/2009
- Site internet
- Groupes :
-
Equipe Développement
ben.popeye Membre non connecté
-
Modérateur
- Voir le profil du membre ben.popeye
- Inscrit le : 04/08/2005
- Site internet
- Groupes :
-
Equipe Historique
J'ai passé un petit quart d'heure à regarder ce problème et je n'arrive pas à comprendre ce qu'il se passe. Je pense qu'il vient des expressions régulières, mais je ne sais pas d'où exactement, j'observe un comportement hasardeux, ce qui n'est pas normal. Je n'arrive pas à identifier des cas qui font que ça plante systématiquement.
Par contre, je tiens à remercier FameLady93 et Micman qui ont été très précis sur leur rapport de bug et sur les conditions nécessaires pour reproduire ce bug.
Je déplace le sujet parce que j'ai réussi à le reproduire ailleurs que dans le module pages, il s'agit d'un bug global.
Un problème, une question ? Cherchez dans la FAQ ou la documentation. Si vous ne trouvez pas la réponse, demandez du support sur le forum.
Bjarne Stroustrup, inventeur du C++ :"There are two ways to write error-free programs; only the third works."
FameLady93 Membre non connecté
Booster Fuzil
-
Booster Fuzil
- Voir le profil du membre FameLady93
- Inscrit le : 07/02/2011

Perso j'ai mon phpBoost a été mis à jour au fur et à mesure qu'une nouvelle version soit sortie.
Pour ce faire je Téléchargeais le Pack de Mise à jour.
Donc juste à remplacer des fichiers.
Et le problème ce situe ici.
J'ai vérifier dans les Packs
http://dl.phpboost.com/fr/phpboost/3.0/diff/diff-phpboost-3.0.5-to-phpboost-3.0.6.zip
http://dl.phpboost.com/fr/phpboost/3.0/diff/diff-phpboost-3.0.6-to-phpboost-3.0.7.zip
http://dl.phpboost.com/fr/phpboost/3.0/diff/diff-phpboost-3.0.7-to-phpboost-3.0.8.zip
Et aucun ne contient le fichier en cause qui est
Code TEXT :
kernel/framework/util/url.class.php
En effet ce fichier n'est pas donné dans les Pack de Mise à jour.
Peu être un oublie.
J'ai sur mon PC un fichier url.class.php qui ne correspond en rien à celui des archives complète ou autre de la distribution.
Pourtant sur mon PC j'ai un phpBoost qui a lui aussi un fichier différent

Pour faire simple
Fichier url.class.php que j'ai actuellement
Code PHP :
<?php /*################################################## * url.class.php * ------------------- * begin : January 14, 2009 * copyright : (C) 2009 Loïc Rouchon * email : horn@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ define('URL__CLASS','url'); define('SERVER_URL', $_SERVER['PHP_SELF']); /** * @author Loïc Rouchon <horn@phpboost.com> * @desc This class offers a simple way to transform an absolute or relative link * to a relative one to the website root. * It can also deals with absolute url and will convert only those from this * site into relatives ones. * Usage : * <ul> * <li>In content, get the url with the absolute() method. It will allow content include at multiple level</li> * <li>In forms, get the url with the relative() method. It's a faster way to display url</li> * </ul> * @package util */ class Url { /** * @desc Build a Url object. By default, builds an Url object representing the current path. * If the url is empty, no computation is done and an empty string will be returned * when asking for both relative and absolute form of the url. * @param string $url the url string relative to the current path, * to the website root if beginning with a "/" or an absolute url * @param string $path_to_root url context. default is PATH_TO_ROOT */ function Url($url = '.', $path_to_root = null, $server_url = null) { if (!empty($url)) { if ($path_to_root !== null) { $this->path_to_root = $path_to_root; } else { $this->path_to_root = Url::path_to_root(); } if ($server_url !== null) { $this->server_url = $server_url; } else { $this->server_url = Url::server_url(); } $anchor = ''; if (($pos = strpos($url, '#')) !== false) { // Backup url arguments in order to restore them after compression if ($pos == 0) { // anchor to the current page $this->url = $url; $this->is_relative = false; // forbids all url transformations return; } else { $anchor = substr($url, $pos); $url = substr($url, 0, $pos); } } if (preg_match('`^[a-z0-9]+:(?!//).+`iU', $url) > 0) { // This is a special protocol link and we don't try to convert it. $this->url = $url; return; } else if (strpos($url, 'www.') === 0) { // If the url begins with 'www.', it's an absolute one $url = 'http://' . $url; } $url = str_replace(Url::get_absolute_root() . '/', '/', Url::compress($url)); if (!strpos($url, '://')) { $this->is_relative = true; if (substr($url, 0, 1) == '/') { // Relative url from the website root (good form) $this->url = $url; } else { // The url is relative to the current foler $this->url = $this->root_to_local() . $url; } } else { $this->is_relative = false; $this->url = $url; } $this->url = Url::compress($this->url) . $anchor; } } /** * @return bool true if the url is a relative one */ function is_relative() { return $this->is_relative; } /** * @desc Returns the relative url if defined, else the absolute one * @return string the relative url if defined, else the absolute one */ function relative() { if ($this->is_relative()) { return $this->url; } else { return $this->absolute(); } } /** * @desc Returns the absolute url * @return string the absolute url */ function absolute() { if ($this->is_relative()) { return Url::compress($this->get_absolute_root() . $this->url); } else { return $this->url; } } /** * @static * @desc Compress a url by removing all "folder/.." occurrences * @param string $url the url to compress * @return string the compressed url */ /* static */ function compress($url) { $args = ''; if (($pos = strpos($url, '?')) !== false) { // Backup url arguments inn order to restore them after compression $args = substr($url, $pos); $url = substr($url, 0, $pos); } $url = preg_replace(array('`([^:]|^)/+`', '`(?<!.)./`'), array('$1/', ''), $url); do { $url = preg_replace('`/?[^/]+/..`', '', $url); } while (preg_match('`/?[^/]+/..`', $url) > 0); return preg_replace('`^//`', '/', $url) . $args; } /** * @desc Returns the relative path from the website root to the current path if working on a relative url * @return string the relative path from the website root to the current path if working on a relative url */ function root_to_local() { global $CONFIG; $local_path = $this->server_url; $local_path = substr(trim($local_path, '/'), strlen(trim($CONFIG['server_path'], '/'))); $file_begun = strrpos($local_path, '/'); if ($file_begun >= 0) { $local_path = substr($local_path, 0, $file_begun) . '/'; } return '/' . ltrim($local_path, '/'); } /** * @static * @desc Returns the absolute website root Url * @return string the absolute website root Url */ /* static */ function get_absolute_root() { global $CONFIG; return trim(trim($CONFIG['server_name'], '/') . '/' . trim($CONFIG['server_path'], '/'), '/'); } /** * @static * @desc Returns the HTML text with only absolutes urls * @param string $html_text The HTML text in which we gonna search for * root relatives urls (only those beginning by '/') to convert into absolutes ones. * @param string $path_to_root Path to root of the page to which you want to fit the URL. * @param string $server_url Path from the site root of the page to which you want to fit the URL. * @return string The HTML text with only absolutes urls */ /* static */ function html_convert_root_relative2absolute($html_text, $path_to_root = PATH_TO_ROOT, $server_url = SERVER_URL) { $path_to_root_bak = Url::path_to_root(); $server_url_bak = Url::server_url(); Url::path_to_root($path_to_root); Url::server_url($server_url); $result = preg_replace_callback(Url::_build_html_match_regex(true), array('Url', '_convert_url_to_absolute'), $html_text); Url::path_to_root($path_to_root_bak); Url::server_url($server_url_bak); return $result; } /** * @static * @desc Returns the HTML text with only relatives urls * @param string $html_text The HTML text in which we gonna search for absolutes urls to convert into relatives ones. * @param string $path_to_root Path to root of the page to which you want to fit the URL. * @param string $server_url Path from the site root of the page to which you want to fit the URL. * @return string The HTML text with only absolutes urls */ /* static */ function html_convert_absolute2root_relative($html_text, $path_to_root = PATH_TO_ROOT, $server_url = SERVER_URL) { $path_to_root_bak = Url::path_to_root(); $server_url_bak = Url::server_url(); Url::path_to_root($path_to_root); Url::server_url($server_url); $result = preg_replace_callback(Url::_build_html_match_regex(), array('Url', '_convert_url_to_root_relative'), $html_text); Url::path_to_root($path_to_root_bak); Url::server_url($server_url_bak); return $result; } /** * @static * @desc Transforms the relative URL whose base is the site root (for instance /images/mypic.png) to the real relative path fited to the current page. * @param string $html_text The HTML text in which you want to replace the paths * @param string $path_to_root Path to root of the page to which you want to fit the URL. * @param string $server_url Path from the site root of the page to which you want to fit the URL. * @return string The transformed string */ /* static */ function html_convert_root_relative2relative($html_text, $path_to_root = PATH_TO_ROOT, $server_url = SERVER_URL) { $path_to_root_bak = Url::path_to_root(); $server_url_bak = Url::server_url(); Url::path_to_root($path_to_root); Url::server_url($server_url); $result = preg_replace_callback(Url::_build_html_match_regex(true), array('Url', '_convert_url_to_relative'), $html_text); Url::path_to_root($path_to_root_bak); Url::server_url($server_url_bak); return $result; } /** * @static * @desc replace a relative url by the corresponding absolute one * @param string[] $url_params Array containing the attributes containing the url and the url * @return string the replaced url */ /* static */ function _convert_url_to_absolute($url_params) { $url = new Url($url_params[2]); $url_params[2] = $url->absolute(); return $url_params[1] . $url_params[2] . $url_params[3]; } /** * @static * @desc replace an absolute url by the corresponding root relative one if possible * @param string[] $url_params Array containing the attributes containing the url and the url * @return string the replaced url */ /* static */ function _convert_url_to_root_relative($url_params) { $url = new Url($url_params[2]); $url_params[2] = $url->relative(); return $url_params[1] . $url_params[2] . $url_params[3]; } /** * @static * @desc replace an absolute url by the corresponding relative one if possible * @param string[] $url_params Array containing the attributes containing the url and the url * @return string the replaced url */ /* static */ function _convert_url_to_relative($url_params) { $url = new Url($url_params[2]); if ($url->is_relative()) { $url_params[2] = Url::compress(Url::path_to_root() . $url->relative()); } return $url_params[1] . $url_params[2] . $url_params[3]; } /* static */ function _build_html_match_regex($only_match_relative = false) { static $regex_match_all = null; static $regex_only_match_relative = null; // regex cache is empty, builds it if ((!$only_match_relative && $regex_match_all === null) || ($only_match_relative && $regex_only_match_relative === null)) { $regex = array(); $nodes = array('a', 'img', 'form', 'object', 'param name="movie"'); $attributes = array('href', 'src', 'action', 'data', 'value'); $nodes_length = count($nodes); for ($i = 0; $i < $nodes_length; $i++) { $a_regex = '`(<' . $nodes[$i] . ' [^>]*(?<= )' . $attributes[$i] . '=")('; if ($only_match_relative) { $a_regex .= '/'; } $a_regex .= '[^"]+)(")`isU'; $regex[] = $a_regex; } //'`(<script type="text/javascript">.*insert(?:Sound|Movie|Swf)Player(")(/[^"]+)(".*</script>)`sU'; $a_regex = '`(<script type="text/javascript"><!--s*insert(?:Sound|Movie|Swf)Player\(")('; if ($only_match_relative) { $a_regex .= '/'; } $a_regex .= '[^"]+)("\)s*--></script>)`isU'; $regex[] = $a_regex; // Update regex cache if ($only_match_relative) { $regex_only_match_relative = $regex; } else { $regex_match_all = $regex; } } if ($only_match_relative) { return $regex_only_match_relative; } else { return $regex_match_all; } } /** * @static * @param string $url the url to "relativize" * @param string $path_to_root Path to root of the page to which you want to fit the URL * @param string $server_url Path from the site root of the page to which you want to fit the URL. * @return string the relative url of the $url parameter */ /* static */ function get_relative($url, $path_to_root = null, $server_url = null) { $o_url = new Url($url, $path_to_root, $server_url); return $o_url->relative(); } /** * @static * @desc Overrides the used PATH_TO_ROOT. if the argument is null, the value is only returned. * Please note this is a PHP4 hack to allow a Class variable. * @param string $path the new PATH_TO_ROOT to use * @return string the used PATH_TO_ROOT */ function path_to_root($path = null) { static $path_to_root = PATH_TO_ROOT; if ($path != null) { $path_to_root = $path; } return $path_to_root; } /** * @static * @desc Overrides the used SERVER URL. if the argument is null, the value is only returned. * Please note this is a PHP4 hack to allow a Class variable. * @param string $path the new SERVER URL to use * @return string the used SERVER URL */ function server_url($url = null) { static $server_url = SERVER_URL; if ($url !== null) { $server_url = $url; } return $server_url; } /** * @desc Returns the regex matching the requested url form * @static * @param int $protocol REGEX_MULTIPLICITY_OPTION for the protocol sub-regex * @param int $user REGEX_MULTIPLICITY_OPTION for the user:password@ sub-regex * @param int $domain REGEX_MULTIPLICITY_OPTION for the domain sub-regex * @param int $folders REGEX_MULTIPLICITY_OPTION for the folders sub-regex * @param int $file REGEX_MULTIPLICITY_OPTION for the file sub-regex * @param int $args REGEX_MULTIPLICITY_OPTION for the arguments sub-regex * @param int $anchor REGEX_MULTIPLICITY_OPTION for the anchor sub-regex * @param bool $forbid_js true if you want to forbid javascript uses in urls * @return the regex matching the requested url form * @see REGEX_MULTIPLICITY_OPTIONNAL * @see REGEX_MULTIPLICITY_NEEDED * @see REGEX_MULTIPLICITY_AT_LEAST_ONE * @see REGEX_MULTIPLICITY_ALL * @see REGEX_MULTIPLICITY_NOT_USED */ /* static */ function get_wellformness_regex($protocol = REGEX_MULTIPLICITY_OPTIONNAL, $user = REGEX_MULTIPLICITY_OPTIONNAL, $domain = REGEX_MULTIPLICITY_OPTIONNAL, $folders = REGEX_MULTIPLICITY_OPTIONNAL, $file = REGEX_MULTIPLICITY_OPTIONNAL, $args = REGEX_MULTIPLICITY_OPTIONNAL, $anchor = REGEX_MULTIPLICITY_OPTIONNAL, $forbid_js = true) { static $forbid_js_regex = '(?!javascript:)'; static $protocol_regex = '[a-z0-9-_]+(?::[a-z0-9-_]+)*://'; static $user_regex = '[a-z0-9-_]+(?::[a-z0-9-_]+)?@'; static $domain_regex = '(?:[a-z0-9-_~]+.)*[a-z0-9-_~]+(?::[0-9]{1,5})?/'; static $folders_regex = '/*(?:[a-z0-9~_.-]+/+)*'; static $file_regex = '[a-z0-9-+_,~:.%]+'; static $args_regex = '(?:?(?!&)(?:(?:&|&)?[a-z0-9-+=,_~:;/.?'%]+(?:=[a-z0-9-+=_~:;/.?'%]+)?)*)?'; static $anchor_regex = '#[a-z0-9-_/]*'; if ($forbid_js) { $protocol_regex_secured = $forbid_js_regex . $protocol_regex; } else { $protocol_regex_secured = $protocol_regex; } $regex = set_subregex_multiplicity($protocol_regex_secured, $protocol) . set_subregex_multiplicity($user_regex, $user) . set_subregex_multiplicity($domain_regex, $domain) . set_subregex_multiplicity($folders_regex, $folders) . set_subregex_multiplicity($file_regex, $file); if ($anchor == REGEX_MULTIPLICITY_OPTIONNAL) { $regex .= set_subregex_multiplicity($anchor_regex, REGEX_MULTIPLICITY_OPTIONNAL); } $regex .= set_subregex_multiplicity($args_regex, $args) . set_subregex_multiplicity($anchor_regex, $anchor); return $regex; } /** * @desc Returns true if the url match the requested url form * @static * @param int $protocol REGEX_MULTIPLICITY_OPTION for the protocol sub-regex * @param int $user REGEX_MULTIPLICITY_OPTION for the user:password@ sub-regex * @param int $domain REGEX_MULTIPLICITY_OPTION for the domain sub-regex * @param int $folders REGEX_MULTIPLICITY_OPTION for the folders sub-regex * @param int $file REGEX_MULTIPLICITY_OPTION for the file sub-regex * @param int $args REGEX_MULTIPLICITY_OPTION for the arguments sub-regex * @param int $anchor REGEX_MULTIPLICITY_OPTION for the anchor sub-regex * @param bool $forbid_js true if you want to forbid javascript uses in urls * @return true if the url match the requested url form * @see REGEX_MULTIPLICITY_OPTIONNAL * @see REGEX_MULTIPLICITY_NEEDED * @see REGEX_MULTIPLICITY_AT_LEAST_ONE * @see REGEX_MULTIPLICITY_ALL * @see REGEX_MULTIPLICITY_NOT_USED */ /* static */ function check_wellformness($url, $protocol = REGEX_MULTIPLICITY_OPTIONNAL, $user = REGEX_MULTIPLICITY_OPTIONNAL, $domain = REGEX_MULTIPLICITY_OPTIONNAL, $folders = REGEX_MULTIPLICITY_OPTIONNAL, $file = REGEX_MULTIPLICITY_OPTIONNAL, $args = REGEX_MULTIPLICITY_OPTIONNAL, $anchor = REGEX_MULTIPLICITY_OPTIONNAL, $forbid_js = true) { return preg_match('`^' . Url::get_wellformness_regex($protocol, $user, $domain, $folders, $file, $args, $anchor, $forbid_js) . '$`i', $url); } var $url = ''; var $is_relative = false; var $path_to_root = ''; var $server_url = ''; } ?>
Fichier url.class.php que j'ai sur mon PC qui est différent du précédent qui datait de la dernière V2, celui qui suit est celui du passage à la première V3 il me semble
Code PHP :
<?php define('URL__CLASS','url'); define('SERVER_URL',$_SERVER['PHP_SELF']); class Url { function Url($url='.',$path_to_root=null,$server_url=null) { if(!empty($url)) { if($path_to_root!==null) { $this->path_to_root=$path_to_root; } else { $this->path_to_root=Url::path_to_root(); } if($server_url!==null) { $this->server_url=$server_url; } else { $this->server_url=Url::server_url(); } $anchor=''; if(($pos=strpos($url,'#'))!==false) { if($pos==0) { $this->url=$url; $this->is_relative=false; return; } else { $anchor=substr($url,$pos); $url=substr($url,0,$pos); } } if(preg_match('`^[a-z0-9]+:(?!//).+`iU',$url)>0) { $this->url=$url; return; } else if(strpos($url,'www.')===0) { $url='http://'.$url; } $url=str_replace(Url::get_absolute_root().'/','/',Url::compress($url)); if(!strpos($url,'://')) { $this->is_relative=true; if(substr($url,0,1)=='/') { $this->url=$url; } else { $this->url=$this->root_to_local().$url; } } else { $this->is_relative=false; $this->url=$url; } $this->url=Url::compress($this->url).$anchor; } } function is_relative() { return $this->is_relative; } function relative() { if($this->is_relative()) { return $this->url; } else { return $this->absolute(); } } function absolute() { if($this->is_relative()) { return Url::compress($this->get_absolute_root().$this->url); } else { return $this->url; } } function compress($url) { $args=''; if(($pos=strpos($url,'?'))!==false) { $args=substr($url,$pos); $url=substr($url,0,$pos); } $url=preg_replace(array('`([^:]|^)/+`','`(?<!.)./`'),array('$1/',''),$url); do { $url=preg_replace('`/?[^/]+/..`','',$url); } while(preg_match('`/?[^/]+/..`',$url)>0); return preg_replace('`^//`','/',$url).$args; } function root_to_local() { global $CONFIG; $local_path=$this->server_url; $local_path=substr(trim($local_path,'/'),strlen(trim($CONFIG['server_path'],'/'))); $file_begun=strrpos($local_path,'/'); if($file_begun>=0) { $local_path=substr($local_path,0,$file_begun).'/'; } return '/'.ltrim($local_path,'/'); } function get_absolute_root() { global $CONFIG; return trim(trim($CONFIG['server_name'],'/').'/'.trim($CONFIG['server_path'],'/'),'/'); } function html_convert_root_relative2absolute($html_text,$path_to_root=PATH_TO_ROOT,$server_url=SERVER_URL) { $path_to_root_bak=Url::path_to_root(); $server_url_bak=Url::server_url(); Url::path_to_root($path_to_root); Url::server_url($server_url); $result=preg_replace_callback(Url::_build_html_match_regex(true), array('Url','_convert_url_to_absolute'),$html_text); Url::path_to_root($path_to_root_bak); Url::server_url($server_url_bak); return $result; } function html_convert_absolute2root_relative($html_text,$path_to_root=PATH_TO_ROOT,$server_url=SERVER_URL) { $path_to_root_bak=Url::path_to_root(); $server_url_bak=Url::server_url(); Url::path_to_root($path_to_root); Url::server_url($server_url); $result=preg_replace_callback(Url::_build_html_match_regex(), array('Url','_convert_url_to_root_relative'),$html_text); Url::path_to_root($path_to_root_bak); Url::server_url($server_url_bak); return $result; } function html_convert_root_relative2relative($html_text,$path_to_root=PATH_TO_ROOT,$server_url=SERVER_URL) { $path_to_root_bak=Url::path_to_root(); $server_url_bak=Url::server_url(); Url::path_to_root($path_to_root); Url::server_url($server_url); $result=preg_replace_callback(Url::_build_html_match_regex(true), array('Url','_convert_url_to_relative'),$html_text); Url::path_to_root($path_to_root_bak); Url::server_url($server_url_bak); return $result; } function _convert_url_to_absolute($url_params) { $url=new Url($url_params[2]); $url_params[2]=$url->absolute(); return $url_params[1].$url_params[2].$url_params[3]; } function _convert_url_to_root_relative($url_params) { $url=new Url($url_params[2]); $url_params[2]=$url->relative(); return $url_params[1].$url_params[2].$url_params[3]; } function _convert_url_to_relative($url_params) { $url=new Url($url_params[2]); if($url->is_relative()) { $url_params[2]=Url::compress(Url::path_to_root().$url->relative()); } return $url_params[1].$url_params[2].$url_params[3]; } function _build_html_match_regex($only_match_relative=false) { static $regex_match_all=null; static $regex_only_match_relative=null; if((!$only_match_relative&&$regex_match_all===null)||($only_match_relative&&$regex_only_match_relative===null)) { $regex=array(); $nodes=array('a','img','form','object','param name="movie"'); $attributes=array('href','src','action','data','value'); $nodes_length=count($nodes); for($i=0;$i<$nodes_length;$i++) { $a_regex='`(<'.$nodes[$i].' [^>]*(?<= )'.$attributes[$i].'=")('; if($only_match_relative) { $a_regex.='/'; } $a_regex.='[^"]+)(")`isU'; $regex[]=$a_regex; } $a_regex='`(<script type="text/javascript"><!--s*insert(?:Sound|Movie|Swf)Player\(")('; if($only_match_relative) { $a_regex.='/'; } $a_regex.='[^"]+)("\)s*--></script>)`isU'; $regex[]=$a_regex; if($only_match_relative) { $regex_only_match_relative=$regex; } else { $regex_match_all=$regex; } } if($only_match_relative) { return $regex_only_match_relative; } else { return $regex_match_all; } } function get_relative($url,$path_to_root=null,$server_url=null) { $o_url=new Url($url,$path_to_root,$server_url); return $o_url->relative(); } function path_to_root($path=null) { static $path_to_root=PATH_TO_ROOT; if($path!=null) { $path_to_root=$path; } return $path_to_root; } function server_url($url=null) { static $server_url=SERVER_URL; if($url!==null) { $server_url=$url; } return $server_url; } function get_wellformness_regex($protocol=REGEX_MULTIPLICITY_OPTIONNAL, $user=REGEX_MULTIPLICITY_OPTIONNAL,$domain=REGEX_MULTIPLICITY_OPTIONNAL, $folders=REGEX_MULTIPLICITY_OPTIONNAL,$file=REGEX_MULTIPLICITY_OPTIONNAL, $args=REGEX_MULTIPLICITY_OPTIONNAL,$anchor=REGEX_MULTIPLICITY_OPTIONNAL,$forbid_js=true) { static $forbid_js_regex='(?!javascript:)'; static $protocol_regex='[a-z0-9-_]+(?::[a-z0-9-_]+)*://'; static $user_regex='[a-z0-9-_]+(?::[a-z0-9-_]+)?@'; static $domain_regex='(?:[a-z0-9-_~]+.)*[a-z0-9-_~]+(?::[0-9]{1,5})?/'; static $folders_regex='/*(?:[a-z0-9~_.-]+/+)*'; static $file_regex='[a-z0-9-+_~:.%]+'; static $args_regex='(?:?(?!&)(?:(?:&|&)?[a-z0-9-+=_~:;/.?'%]+=[a-z0-9-+=_~:;/.?'%]+)*)?'; static $anchor_regex='#[a-z0-9-_/]*'; if($forbid_js) { $protocol_regex_secured=$forbid_js_regex.$protocol_regex; } else { $protocol_regex_secured=$protocol_regex; } return set_subregex_multiplicity($protocol_regex_secured,$protocol). set_subregex_multiplicity($user_regex,$user). set_subregex_multiplicity($domain_regex,$domain). set_subregex_multiplicity($folders_regex,$folders). set_subregex_multiplicity($file_regex,$file). set_subregex_multiplicity($anchor_regex,REGEX_MULTIPLICITY_OPTIONNAL). set_subregex_multiplicity($args_regex,$args). set_subregex_multiplicity($anchor_regex,$anchor); } function check_wellformness($url,$protocol=REGEX_MULTIPLICITY_OPTIONNAL, $user=REGEX_MULTIPLICITY_OPTIONNAL,$domain=REGEX_MULTIPLICITY_OPTIONNAL, $folders=REGEX_MULTIPLICITY_OPTIONNAL,$file=REGEX_MULTIPLICITY_OPTIONNAL, $args=REGEX_MULTIPLICITY_OPTIONNAL,$anchor=REGEX_MULTIPLICITY_OPTIONNAL,$forbid_js=true) { return preg_match('`^'.Url::get_wellformness_regex($protocol,$user,$domain, $folders,$file,$args,$anchor,$forbid_js).'$`i',$url); } var $url=''; var $is_relative=false; var $path_to_root=''; var $server_url=''; } ?>
Je ne donne pas celui des Packs complet et autre car vous les avez sous la main

Perso voici les modifications que j'ai faite sur mon fichier qui est celui donné en tout premier
Code TEXT :
***** [TROUVER] *****
$regex = set_subregex_multiplicity($protocol_regex_secured, $protocol) .
***** [REMPLACER, PAR] *****
return set_subregex_multiplicity($protocol_regex_secured,$protocol).
***** [TROUVER] *****
set_subregex_multiplicity($file_regex, $file);
if ($anchor == REGEX_MULTIPLICITY_OPTIONNAL)
{
$regex .= set_subregex_multiplicity($anchor_regex, REGEX_MULTIPLICITY_OPTIONNAL);
}
$regex .= set_subregex_multiplicity($args_regex, $args) .
set_subregex_multiplicity($anchor_regex, $anchor);
return $regex;
***** [REMPLACER, PAR] *****
set_subregex_multiplicity($file_regex,$file).
set_subregex_multiplicity($anchor_regex,REGEX_MULTIPLICITY_OPTIONNAL).
set_subregex_multiplicity($args_regex,$args).
set_subregex_multiplicity($anchor_regex,$anchor);
***** [TROUVER] *****
static $file_regex = '[a-z0-9-+_,~:.%]+';
***** [REMPLACER, PAR] *****
static $file_regex = '[a-z0-9-+_~:.%]+';
***** [TROUVER] *****
static $args_regex = '(?:?(?!&)(?:(?:&|&)?[a-z0-9-+=,_~:;/.?'%]+(?:=[a-z0-9-+=_~:;/.?'%]+)?)*)?';
***** [REMPLACER, PAR] *****
static $args_regex='(?:?(?!&)(?:(?:&|&)?[a-z0-9-+=_~:;/.?'%]+=[a-z0-9-+=_~:;/.?'%]+)*)?';Après je ne sais pas trop quoi faire, prendre le fichier de la distribution complète ?
Le problème c'est que si d'autres fichiers sont dans ce cas, sa va poser pas mal de problème, enfin sa risque.
Je pense que beaucoup de personnes qui ont mis à jour avec les Packs de MAJ doivent rencontrer ce problème.
A moins que ce ne soit moi qui est sauté une MAJ.
Mais dans ce cas que faire ?
Recommencer les MAJ avec les Packs depuis le premier de la MAJ 3.0 ?
En tout cas actuellement le problème est réglé sur mon Site test en Local grâce au code que j'ai donné au dessus.
Je ne sais pas si Micman est dans le même cas que moi ou non

PS : De rien ben.popeye

Je suis désolée du gros code mis en balise code
Édité par FameLady93 Le 30/03/2011 à 18h10
ben.popeye Membre non connecté
-
Modérateur
- Voir le profil du membre ben.popeye
- Inscrit le : 04/08/2005
- Site internet
- Groupes :
-
Equipe Historique
Ce fichier n'existait pas en version 2.0, il n'existe que depuis la 3.0.
Le patch de mise à jour (les zip dont tu parles) ne contiennent que les fichiers qui ont été modifiés entre deux versions, c'est la raison pour laquelle ce fichier n'y est pas présent, il n'a tout simplement pas été modifié
Un problème, une question ? Cherchez dans la FAQ ou la documentation. Si vous ne trouvez pas la réponse, demandez du support sur le forum.
Bjarne Stroustrup, inventeur du C++ :"There are two ways to write error-free programs; only the third works."
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie