@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/actions'); |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | * @uses ajax_retour() |
| 30 | 30 | **/ |
| 31 | 31 | function exec_informer_dist() { |
| 32 | - $id = intval(_request('id')); |
|
| 33 | - $col = intval(_request('col')); |
|
| 34 | - $exclus = intval(_request('exclus')); |
|
| 35 | - $do = _request('do'); |
|
| 32 | + $id = intval(_request('id')); |
|
| 33 | + $col = intval(_request('col')); |
|
| 34 | + $exclus = intval(_request('exclus')); |
|
| 35 | + $do = _request('do'); |
|
| 36 | 36 | |
| 37 | - if (preg_match('/^\w*$/', $do)) { |
|
| 38 | - if (!$do) { |
|
| 39 | - $do = 'aff'; |
|
| 40 | - } |
|
| 37 | + if (preg_match('/^\w*$/', $do)) { |
|
| 38 | + if (!$do) { |
|
| 39 | + $do = 'aff'; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $informer = charger_fonction('informer', 'inc'); |
|
| 43 | - $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 44 | - } else { |
|
| 45 | - $res = ''; |
|
| 46 | - } |
|
| 47 | - ajax_retour($res); |
|
| 42 | + $informer = charger_fonction('informer', 'inc'); |
|
| 43 | + $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 44 | + } else { |
|
| 45 | + $res = ''; |
|
| 46 | + } |
|
| 47 | + ajax_retour($res); |
|
| 48 | 48 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/actions'); |
@@ -30,63 +30,63 @@ discard block |
||
| 30 | 30 | **/ |
| 31 | 31 | function exec_upgrade_dist() { |
| 32 | 32 | |
| 33 | - if (!_FILE_CONNECT) { |
|
| 34 | - redirige_url_ecrire("install"); |
|
| 35 | - } |
|
| 33 | + if (!_FILE_CONNECT) { |
|
| 34 | + redirige_url_ecrire("install"); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - // Si reinstallation necessaire, message ad hoc |
|
| 38 | - if (_request('reinstall') == 'oui') { |
|
| 39 | - include_spip('inc/minipres'); |
|
| 40 | - $r = minipres(_T('titre_page_upgrade'), |
|
| 41 | - "<p><b>" |
|
| 42 | - . _T('texte_nouvelle_version_spip_1') |
|
| 43 | - . "</b><p> " |
|
| 44 | - . _T('texte_nouvelle_version_spip_2', |
|
| 45 | - array('connect' => '<tt>' . _FILE_CONNECT . '</tt>')) |
|
| 46 | - . generer_form_ecrire('upgrade', "<input type='hidden' name='reinstall' value='non' />", '', |
|
| 47 | - _T('bouton_relancer_installation'))); |
|
| 48 | - echo $r; |
|
| 49 | - } elseif (_request('fin')) { |
|
| 50 | - include_spip('inc/plugin'); |
|
| 51 | - actualise_plugins_actifs(); |
|
| 52 | - include_spip('inc/headers'); |
|
| 53 | - $res = generer_url_ecrire('admin_plugin', 'var_mode=recalcul'); |
|
| 54 | - echo redirige_formulaire($res); |
|
| 55 | - } else { |
|
| 37 | + // Si reinstallation necessaire, message ad hoc |
|
| 38 | + if (_request('reinstall') == 'oui') { |
|
| 39 | + include_spip('inc/minipres'); |
|
| 40 | + $r = minipres(_T('titre_page_upgrade'), |
|
| 41 | + "<p><b>" |
|
| 42 | + . _T('texte_nouvelle_version_spip_1') |
|
| 43 | + . "</b><p> " |
|
| 44 | + . _T('texte_nouvelle_version_spip_2', |
|
| 45 | + array('connect' => '<tt>' . _FILE_CONNECT . '</tt>')) |
|
| 46 | + . generer_form_ecrire('upgrade', "<input type='hidden' name='reinstall' value='non' />", '', |
|
| 47 | + _T('bouton_relancer_installation'))); |
|
| 48 | + echo $r; |
|
| 49 | + } elseif (_request('fin')) { |
|
| 50 | + include_spip('inc/plugin'); |
|
| 51 | + actualise_plugins_actifs(); |
|
| 52 | + include_spip('inc/headers'); |
|
| 53 | + $res = generer_url_ecrire('admin_plugin', 'var_mode=recalcul'); |
|
| 54 | + echo redirige_formulaire($res); |
|
| 55 | + } else { |
|
| 56 | 56 | |
| 57 | - if (!isset($GLOBALS['meta']['version_installee'])) { |
|
| 58 | - $GLOBALS['meta']['version_installee'] = 0.0; |
|
| 59 | - } else { |
|
| 60 | - $GLOBALS['meta']['version_installee'] = |
|
| 61 | - (double)str_replace(',', '.', $GLOBALS['meta']['version_installee']); |
|
| 62 | - } |
|
| 63 | - # NB: str_replace car, sur club-internet, il semble que version_installe soit |
|
| 64 | - # enregistree au format '1,812' et non '1.812' |
|
| 57 | + if (!isset($GLOBALS['meta']['version_installee'])) { |
|
| 58 | + $GLOBALS['meta']['version_installee'] = 0.0; |
|
| 59 | + } else { |
|
| 60 | + $GLOBALS['meta']['version_installee'] = |
|
| 61 | + (double)str_replace(',', '.', $GLOBALS['meta']['version_installee']); |
|
| 62 | + } |
|
| 63 | + # NB: str_replace car, sur club-internet, il semble que version_installe soit |
|
| 64 | + # enregistree au format '1,812' et non '1.812' |
|
| 65 | 65 | |
| 66 | - // Erreur downgrade |
|
| 67 | - // (cas de double installation de fichiers SPIP sur une meme base) |
|
| 68 | - if ($GLOBALS['spip_version_base'] < $GLOBALS['meta']['version_installee']) { |
|
| 69 | - $commentaire = _T('info_mise_a_niveau_base_2'); |
|
| 70 | - } // Commentaire standard upgrade |
|
| 71 | - else { |
|
| 72 | - $commentaire = _T('texte_mise_a_niveau_base_1'); |
|
| 73 | - } |
|
| 66 | + // Erreur downgrade |
|
| 67 | + // (cas de double installation de fichiers SPIP sur une meme base) |
|
| 68 | + if ($GLOBALS['spip_version_base'] < $GLOBALS['meta']['version_installee']) { |
|
| 69 | + $commentaire = _T('info_mise_a_niveau_base_2'); |
|
| 70 | + } // Commentaire standard upgrade |
|
| 71 | + else { |
|
| 72 | + $commentaire = _T('texte_mise_a_niveau_base_1'); |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $commentaire .= "<br />[" . $GLOBALS['meta']['version_installee'] . "/" . $GLOBALS['spip_version_base'] . "]"; |
|
| 75 | + $commentaire .= "<br />[" . $GLOBALS['meta']['version_installee'] . "/" . $GLOBALS['spip_version_base'] . "]"; |
|
| 76 | 76 | |
| 77 | - $_POST['reinstall'] = 'non'; // pour copy_request dans admin |
|
| 78 | - include_spip('inc/headers'); |
|
| 79 | - $admin = charger_fonction('admin', 'inc'); |
|
| 80 | - $res = $admin('upgrade', _T('info_mise_a_niveau_base'), $commentaire); |
|
| 81 | - if ($res) { |
|
| 82 | - echo $res; |
|
| 83 | - } else { |
|
| 84 | - // effacer les alea pour forcer leur relecture |
|
| 85 | - // si jamais ils ont change pendant l'upgrade |
|
| 86 | - unset($GLOBALS['meta']['alea_ephemere']); |
|
| 87 | - unset($GLOBALS['meta']['alea_ephemere_ancien']); |
|
| 88 | - $res = redirige_action_auteur('purger', 'cache', 'upgrade', 'fin=oui', true); |
|
| 89 | - echo redirige_formulaire($res); |
|
| 90 | - } |
|
| 91 | - } |
|
| 77 | + $_POST['reinstall'] = 'non'; // pour copy_request dans admin |
|
| 78 | + include_spip('inc/headers'); |
|
| 79 | + $admin = charger_fonction('admin', 'inc'); |
|
| 80 | + $res = $admin('upgrade', _T('info_mise_a_niveau_base'), $commentaire); |
|
| 81 | + if ($res) { |
|
| 82 | + echo $res; |
|
| 83 | + } else { |
|
| 84 | + // effacer les alea pour forcer leur relecture |
|
| 85 | + // si jamais ils ont change pendant l'upgrade |
|
| 86 | + unset($GLOBALS['meta']['alea_ephemere']); |
|
| 87 | + unset($GLOBALS['meta']['alea_ephemere_ancien']); |
|
| 88 | + $res = redirige_action_auteur('purger', 'cache', 'upgrade', 'fin=oui', true); |
|
| 89 | + echo redirige_formulaire($res); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 24 | - return; |
|
| 24 | + return; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -29,29 +29,29 @@ discard block |
||
| 29 | 29 | * Demander à mettre à jour la base de données |
| 30 | 30 | */ |
| 31 | 31 | function exec_demande_mise_a_jour_dist() { |
| 32 | - // on fait la verif du path avant tout, |
|
| 33 | - // et l'installation des qu'on est dans la colonne principale |
|
| 34 | - // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 35 | - // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 36 | - include_spip('inc/plugin'); |
|
| 37 | - if (actualise_plugins_actifs()) { |
|
| 38 | - include_spip('inc/headers'); |
|
| 39 | - redirige_par_entete(self()); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - include_spip('inc/presentation'); |
|
| 43 | - include_spip('inc/filtres_boites'); |
|
| 44 | - $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 45 | - echo $commencer_page('', '', '', '', true, false, false); |
|
| 46 | - |
|
| 47 | - echo debut_grand_cadre(true); |
|
| 48 | - echo boite_ouvrir(_T('info_message_technique'), 'notice'); |
|
| 49 | - echo "<p>" . _T('info_procedure_maj_version') . "</p>", |
|
| 50 | - "<p>" . _T('info_administrateur_site_01') . "</p>"; |
|
| 51 | - echo bouton_action(_T('bouton_mettre_a_jour_base'), generer_url_ecrire("upgrade", "reinstall=non")); |
|
| 52 | - echo boite_fermer(); |
|
| 53 | - // masquer les erreurs sql sur cette page car proviennent de la base pas a jour ! |
|
| 54 | - echo '<style type="text/css">#debug-nav {display: none;}</style>'; |
|
| 55 | - echo fin_grand_cadre(true); |
|
| 56 | - echo fin_page(); |
|
| 32 | + // on fait la verif du path avant tout, |
|
| 33 | + // et l'installation des qu'on est dans la colonne principale |
|
| 34 | + // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 35 | + // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 36 | + include_spip('inc/plugin'); |
|
| 37 | + if (actualise_plugins_actifs()) { |
|
| 38 | + include_spip('inc/headers'); |
|
| 39 | + redirige_par_entete(self()); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + include_spip('inc/presentation'); |
|
| 43 | + include_spip('inc/filtres_boites'); |
|
| 44 | + $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 45 | + echo $commencer_page('', '', '', '', true, false, false); |
|
| 46 | + |
|
| 47 | + echo debut_grand_cadre(true); |
|
| 48 | + echo boite_ouvrir(_T('info_message_technique'), 'notice'); |
|
| 49 | + echo "<p>" . _T('info_procedure_maj_version') . "</p>", |
|
| 50 | + "<p>" . _T('info_administrateur_site_01') . "</p>"; |
|
| 51 | + echo bouton_action(_T('bouton_mettre_a_jour_base'), generer_url_ecrire("upgrade", "reinstall=non")); |
|
| 52 | + echo boite_fermer(); |
|
| 53 | + // masquer les erreurs sql sur cette page car proviennent de la base pas a jour ! |
|
| 54 | + echo '<style type="text/css">#debug-nav {display: none;}</style>'; |
|
| 55 | + echo fin_grand_cadre(true); |
|
| 56 | + echo fin_page(); |
|
| 57 | 57 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | include_spip('inc/actions'); |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | * @uses ajax_retour() |
| 32 | 32 | **/ |
| 33 | 33 | function exec_rechercher_dist() { |
| 34 | - $id = intval(_request('id')); |
|
| 35 | - $exclus = intval(_request('exclus')); |
|
| 36 | - $rac = spip_htmlentities(_request('rac')); |
|
| 37 | - $type = _request('type'); |
|
| 38 | - $do = _request('do'); |
|
| 39 | - if (preg_match('/^\w*$/', $do)) { |
|
| 40 | - $r = exec_rechercher_args($id, $type, $exclus, $rac, $do); |
|
| 41 | - } else { |
|
| 42 | - $r = ''; |
|
| 43 | - } |
|
| 44 | - ajax_retour($r); |
|
| 34 | + $id = intval(_request('id')); |
|
| 35 | + $exclus = intval(_request('exclus')); |
|
| 36 | + $rac = spip_htmlentities(_request('rac')); |
|
| 37 | + $type = _request('type'); |
|
| 38 | + $do = _request('do'); |
|
| 39 | + if (preg_match('/^\w*$/', $do)) { |
|
| 40 | + $r = exec_rechercher_args($id, $type, $exclus, $rac, $do); |
|
| 41 | + } else { |
|
| 42 | + $r = ''; |
|
| 43 | + } |
|
| 44 | + ajax_retour($r); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -58,59 +58,59 @@ discard block |
||
| 58 | 58 | * @return string |
| 59 | 59 | **/ |
| 60 | 60 | function exec_rechercher_args($id, $type, $exclus, $rac, $do) { |
| 61 | - if (!$do) { |
|
| 62 | - $do = 'aff'; |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - $points = $rub = array(); |
|
| 66 | - |
|
| 67 | - $where = preg_split(",\s+,", $type); |
|
| 68 | - if ($where) { |
|
| 69 | - foreach ($where as $k => $v) { |
|
| 70 | - $where[$k] = "'%" . substr(str_replace("%", "\%", sql_quote($v, '', 'string')), 1, -1) . "%'"; |
|
| 71 | - } |
|
| 72 | - $where_titre = ("(titre LIKE " . join(" AND titre LIKE ", $where) . ")"); |
|
| 73 | - $where_desc = ("(descriptif LIKE " . join(" AND descriptif LIKE ", $where) . ")"); |
|
| 74 | - $where_id = ("(id_rubrique = " . intval($type) . ")"); |
|
| 75 | - |
|
| 76 | - if ($exclus) { |
|
| 77 | - include_spip('inc/rubriques'); |
|
| 78 | - $where_exclus = " AND " . sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 79 | - } else { |
|
| 80 | - $where_exclus = ''; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - foreach (array( |
|
| 84 | - 3 => $where_titre, |
|
| 85 | - 2 => $where_desc, |
|
| 86 | - 1 => $where_id, |
|
| 87 | - ) as $point => $recherche) { |
|
| 88 | - $res = sql_select("id_rubrique, id_parent, titre", "spip_rubriques", "$recherche$where_exclus"); |
|
| 89 | - while ($row = sql_fetch($res)) { |
|
| 90 | - $id_rubrique = $row["id_rubrique"]; |
|
| 91 | - if (!isset($rub[$id_rubrique])) { |
|
| 92 | - $rub[$id_rubrique] = array(); |
|
| 93 | - } |
|
| 94 | - $rub[$id_rubrique]["titre"] = typo($row["titre"]); |
|
| 95 | - $rub[$id_rubrique]["id_parent"] = $row["id_parent"]; |
|
| 96 | - if (!isset($points[$id_rubrique])) { |
|
| 97 | - $points[$id_rubrique] = 0; |
|
| 98 | - } |
|
| 99 | - $points[$id_rubrique] = $points[$id_rubrique] + $point; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - if ($points) { |
|
| 105 | - arsort($points); |
|
| 106 | - $style = " style='background-image: url(" . chemin_image('secteur-12.png') . ")'"; |
|
| 107 | - foreach ($rub as $k => $v) { |
|
| 108 | - $rub[$k]['atts'] = ($v["id_parent"] ? $style : '') |
|
| 109 | - . " class='petite-rubrique'"; |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - return (proposer_item($points, $rub, $rac, $type, $do)); |
|
| 61 | + if (!$do) { |
|
| 62 | + $do = 'aff'; |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + $points = $rub = array(); |
|
| 66 | + |
|
| 67 | + $where = preg_split(",\s+,", $type); |
|
| 68 | + if ($where) { |
|
| 69 | + foreach ($where as $k => $v) { |
|
| 70 | + $where[$k] = "'%" . substr(str_replace("%", "\%", sql_quote($v, '', 'string')), 1, -1) . "%'"; |
|
| 71 | + } |
|
| 72 | + $where_titre = ("(titre LIKE " . join(" AND titre LIKE ", $where) . ")"); |
|
| 73 | + $where_desc = ("(descriptif LIKE " . join(" AND descriptif LIKE ", $where) . ")"); |
|
| 74 | + $where_id = ("(id_rubrique = " . intval($type) . ")"); |
|
| 75 | + |
|
| 76 | + if ($exclus) { |
|
| 77 | + include_spip('inc/rubriques'); |
|
| 78 | + $where_exclus = " AND " . sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 79 | + } else { |
|
| 80 | + $where_exclus = ''; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + foreach (array( |
|
| 84 | + 3 => $where_titre, |
|
| 85 | + 2 => $where_desc, |
|
| 86 | + 1 => $where_id, |
|
| 87 | + ) as $point => $recherche) { |
|
| 88 | + $res = sql_select("id_rubrique, id_parent, titre", "spip_rubriques", "$recherche$where_exclus"); |
|
| 89 | + while ($row = sql_fetch($res)) { |
|
| 90 | + $id_rubrique = $row["id_rubrique"]; |
|
| 91 | + if (!isset($rub[$id_rubrique])) { |
|
| 92 | + $rub[$id_rubrique] = array(); |
|
| 93 | + } |
|
| 94 | + $rub[$id_rubrique]["titre"] = typo($row["titre"]); |
|
| 95 | + $rub[$id_rubrique]["id_parent"] = $row["id_parent"]; |
|
| 96 | + if (!isset($points[$id_rubrique])) { |
|
| 97 | + $points[$id_rubrique] = 0; |
|
| 98 | + } |
|
| 99 | + $points[$id_rubrique] = $points[$id_rubrique] + $point; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + if ($points) { |
|
| 105 | + arsort($points); |
|
| 106 | + $style = " style='background-image: url(" . chemin_image('secteur-12.png') . ")'"; |
|
| 107 | + foreach ($rub as $k => $v) { |
|
| 108 | + $rub[$k]['atts'] = ($v["id_parent"] ? $style : '') |
|
| 109 | + . " class='petite-rubrique'"; |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + return (proposer_item($points, $rub, $rac, $type, $do)); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -133,35 +133,35 @@ discard block |
||
| 133 | 133 | **/ |
| 134 | 134 | function proposer_item($ids, $titles, $rac, $type, $do) { |
| 135 | 135 | |
| 136 | - if (!$ids) { |
|
| 137 | - return "<br /><br /><div style='padding: 5px; color: red;'><b>" |
|
| 138 | - . spip_htmlentities($type) |
|
| 139 | - . "</b> : " . _T('avis_aucun_resultat') . "</div>"; |
|
| 140 | - } |
|
| 136 | + if (!$ids) { |
|
| 137 | + return "<br /><br /><div style='padding: 5px; color: red;'><b>" |
|
| 138 | + . spip_htmlentities($type) |
|
| 139 | + . "</b> : " . _T('avis_aucun_resultat') . "</div>"; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - $ret = ''; |
|
| 143 | - $info = generer_url_ecrire('informer', "type=rubrique&rac=$rac&id="); |
|
| 142 | + $ret = ''; |
|
| 143 | + $info = generer_url_ecrire('informer', "type=rubrique&rac=$rac&id="); |
|
| 144 | 144 | |
| 145 | - $onClick = "aff_selection(this.firstChild.title,'$rac" . "_selection','$info', event)"; |
|
| 145 | + $onClick = "aff_selection(this.firstChild.title,'$rac" . "_selection','$info', event)"; |
|
| 146 | 146 | |
| 147 | - $ondbClick = "$do(this.firstChild.firstChild.nodeValue,this.firstChild.title,'selection_rubrique', 'id_parent');"; |
|
| 147 | + $ondbClick = "$do(this.firstChild.firstChild.nodeValue,this.firstChild.title,'selection_rubrique', 'id_parent');"; |
|
| 148 | 148 | |
| 149 | - foreach ($ids as $id => $bof) { |
|
| 149 | + foreach ($ids as $id => $bof) { |
|
| 150 | 150 | |
| 151 | - $titre = strtr(str_replace("'", "’", str_replace('"', """, textebrut($titles[$id]["titre"]))), "\n\r", |
|
| 152 | - " "); |
|
| 151 | + $titre = strtr(str_replace("'", "’", str_replace('"', """, textebrut($titles[$id]["titre"]))), "\n\r", |
|
| 152 | + " "); |
|
| 153 | 153 | |
| 154 | - $ret .= "<div class='highlight off'\nonclick=\"changerhighlight(this); " |
|
| 155 | - . $onClick |
|
| 156 | - . "\"\nondblclick=\"" |
|
| 157 | - . $ondbClick |
|
| 158 | - . $onClick |
|
| 159 | - . " \"><div" |
|
| 160 | - . $titles[$id]["atts"] |
|
| 161 | - . " title='$id'> " |
|
| 162 | - . $titre |
|
| 163 | - . "</div></div>"; |
|
| 164 | - } |
|
| 154 | + $ret .= "<div class='highlight off'\nonclick=\"changerhighlight(this); " |
|
| 155 | + . $onClick |
|
| 156 | + . "\"\nondblclick=\"" |
|
| 157 | + . $ondbClick |
|
| 158 | + . $onClick |
|
| 159 | + . " \"><div" |
|
| 160 | + . $titles[$id]["atts"] |
|
| 161 | + . " title='$id'> " |
|
| 162 | + . $titre |
|
| 163 | + . "</div></div>"; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - return $ret; |
|
| 166 | + return $ret; |
|
| 167 | 167 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | 25 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 26 | - return; |
|
| 26 | + return; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
@@ -31,24 +31,24 @@ discard block |
||
| 31 | 31 | * Réparer la base de données |
| 32 | 32 | */ |
| 33 | 33 | function exec_base_repair_dist() { |
| 34 | - $ok = false; |
|
| 35 | - if (!spip_connect()) { |
|
| 36 | - $message = _T('titre_probleme_technique'); |
|
| 37 | - } else { |
|
| 38 | - $version_sql = sql_version(); |
|
| 39 | - if (!$version_sql) { |
|
| 40 | - $message = _T('avis_erreur_connexion_mysql'); |
|
| 41 | - } else { |
|
| 42 | - $message = _T('texte_requetes_echouent'); |
|
| 43 | - $ok = true; |
|
| 44 | - } |
|
| 45 | - $action = _T('texte_tenter_reparation'); |
|
| 46 | - } |
|
| 47 | - if ($ok) { |
|
| 48 | - $admin = charger_fonction('admin', 'inc'); |
|
| 49 | - echo $admin('repair', $action, $message, true); |
|
| 50 | - } else { |
|
| 51 | - include_spip('inc/minipres'); |
|
| 52 | - echo minipres(_T('titre_reparation'), "<p>$message</p>"); |
|
| 53 | - } |
|
| 34 | + $ok = false; |
|
| 35 | + if (!spip_connect()) { |
|
| 36 | + $message = _T('titre_probleme_technique'); |
|
| 37 | + } else { |
|
| 38 | + $version_sql = sql_version(); |
|
| 39 | + if (!$version_sql) { |
|
| 40 | + $message = _T('avis_erreur_connexion_mysql'); |
|
| 41 | + } else { |
|
| 42 | + $message = _T('texte_requetes_echouent'); |
|
| 43 | + $ok = true; |
|
| 44 | + } |
|
| 45 | + $action = _T('texte_tenter_reparation'); |
|
| 46 | + } |
|
| 47 | + if ($ok) { |
|
| 48 | + $admin = charger_fonction('admin', 'inc'); |
|
| 49 | + echo $admin('repair', $action, $message, true); |
|
| 50 | + } else { |
|
| 51 | + include_spip('inc/minipres'); |
|
| 52 | + echo minipres(_T('titre_reparation'), "<p>$message</p>"); |
|
| 53 | + } |
|
| 54 | 54 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | |
| 23 | 23 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 24 | - return; |
|
| 24 | + return; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -29,15 +29,15 @@ discard block |
||
| 29 | 29 | $GLOBALS['delais'] = 0;// pas de cache ! |
| 30 | 30 | // Securite |
| 31 | 31 | if (strstr($fond, '/')) { |
| 32 | - if (!include_spip('inc/autoriser') |
|
| 33 | - or !autoriser('webmestre') |
|
| 34 | - ) { |
|
| 35 | - include_spip('inc/minipres'); |
|
| 36 | - echo minipres(); |
|
| 37 | - exit; |
|
| 38 | - } |
|
| 32 | + if (!include_spip('inc/autoriser') |
|
| 33 | + or !autoriser('webmestre') |
|
| 34 | + ) { |
|
| 35 | + include_spip('inc/minipres'); |
|
| 36 | + echo minipres(); |
|
| 37 | + exit; |
|
| 38 | + } |
|
| 39 | 39 | } else { |
| 40 | - $fond = "prive/squelettes/$fond"; |
|
| 40 | + $fond = "prive/squelettes/$fond"; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // quelques inclusions et ini prealables |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | * @todo supprimer cette fonction vide ? |
| 50 | 50 | **/ |
| 51 | 51 | function shutdown_error() { |
| 52 | - // si on arrive ici avec un tampon non ferme : erreur fatale |
|
| 53 | - /* if (ob_get_level()){ |
|
| 52 | + // si on arrive ici avec un tampon non ferme : erreur fatale |
|
| 53 | + /* if (ob_get_level()){ |
|
| 54 | 54 | // envoyer tous les tampons |
| 55 | 55 | while (ob_get_level()) |
| 56 | 56 | ob_end_flush(); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | |
@@ -24,11 +24,11 @@ discard block |
||
| 24 | 24 | * @param array $opt |
| 25 | 25 | */ |
| 26 | 26 | function inc_journal_dist($phrase, $opt = array()) { |
| 27 | - if (!strlen($phrase)) { |
|
| 28 | - return; |
|
| 29 | - } |
|
| 30 | - if ($opt) { |
|
| 31 | - $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | - } |
|
| 33 | - spip_log($phrase, 'journal'); |
|
| 27 | + if (!strlen($phrase)) { |
|
| 28 | + return; |
|
| 29 | + } |
|
| 30 | + if ($opt) { |
|
| 31 | + $phrase .= ' :: ' . str_replace("\n", ' ', join(', ', $opt)); |
|
| 32 | + } |
|
| 33 | + spip_log($phrase, 'journal'); |
|
| 34 | 34 | } |
@@ -20,21 +20,21 @@ |
||
| 20 | 20 | * Retourne la liste des menus favoris par défaut ainsi que leur rang |
| 21 | 21 | */ |
| 22 | 22 | function inc_definir_menus_favoris_dist() { |
| 23 | - $liste = array( |
|
| 23 | + $liste = array( |
|
| 24 | 24 | |
| 25 | - // Menu Édition, |
|
| 26 | - 'auteurs' => 1, |
|
| 27 | - 'rubriques' => 2, |
|
| 28 | - 'articles' => 3, |
|
| 25 | + // Menu Édition, |
|
| 26 | + 'auteurs' => 1, |
|
| 27 | + 'rubriques' => 2, |
|
| 28 | + 'articles' => 3, |
|
| 29 | 29 | |
| 30 | - // Menu Maintenance |
|
| 31 | - 'admin_vider' => 1, |
|
| 30 | + // Menu Maintenance |
|
| 31 | + 'admin_vider' => 1, |
|
| 32 | 32 | |
| 33 | - // Menu Configurations |
|
| 34 | - 'configurer_identite' => 1, |
|
| 35 | - 'admin_plugin' => 2, |
|
| 33 | + // Menu Configurations |
|
| 34 | + 'configurer_identite' => 1, |
|
| 35 | + 'admin_plugin' => 2, |
|
| 36 | 36 | |
| 37 | - ); |
|
| 37 | + ); |
|
| 38 | 38 | |
| 39 | - return $liste; |
|
| 39 | + return $liste; |
|
| 40 | 40 | } |
| 41 | 41 | \ No newline at end of file |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | include_spip('base/objets'); |
| 24 | 24 | |
@@ -58,114 +58,114 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | */ |
| 60 | 60 | function urls_decoder_url($url, $fond = '', $contexte = array(), $assembler = false) { |
| 61 | - static $current_base = null; |
|
| 61 | + static $current_base = null; |
|
| 62 | 62 | |
| 63 | - // les anciennes fonctions modifient directement les globales |
|
| 64 | - // on les sauve avant l'appel, et on les retablit apres ! |
|
| 65 | - $save = array( |
|
| 66 | - isset($GLOBALS['fond']) ? $GLOBALS['fond'] : null, |
|
| 67 | - isset($GLOBALS['contexte']) ? $GLOBALS['contexte'] : null, |
|
| 68 | - isset($_SERVER['REDIRECT_url_propre']) ? $_SERVER['REDIRECT_url_propre'] : null, |
|
| 69 | - isset($_ENV['url_propre']) ? $_ENV['url_propre'] : null, |
|
| 70 | - $GLOBALS['profondeur_url'] |
|
| 71 | - ); |
|
| 63 | + // les anciennes fonctions modifient directement les globales |
|
| 64 | + // on les sauve avant l'appel, et on les retablit apres ! |
|
| 65 | + $save = array( |
|
| 66 | + isset($GLOBALS['fond']) ? $GLOBALS['fond'] : null, |
|
| 67 | + isset($GLOBALS['contexte']) ? $GLOBALS['contexte'] : null, |
|
| 68 | + isset($_SERVER['REDIRECT_url_propre']) ? $_SERVER['REDIRECT_url_propre'] : null, |
|
| 69 | + isset($_ENV['url_propre']) ? $_ENV['url_propre'] : null, |
|
| 70 | + $GLOBALS['profondeur_url'] |
|
| 71 | + ); |
|
| 72 | 72 | |
| 73 | - if (is_null($current_base)) { |
|
| 74 | - include_spip('inc/filtres_mini'); |
|
| 75 | - // le decodage des urls se fait toujours par rapport au site public |
|
| 76 | - $current_base = url_absolue(_DIR_RACINE ? _DIR_RACINE : './'); |
|
| 77 | - } |
|
| 78 | - if (strncmp($url, $current_base, strlen($current_base)) == 0) { |
|
| 79 | - $url = substr($url, strlen($current_base)); |
|
| 80 | - } |
|
| 73 | + if (is_null($current_base)) { |
|
| 74 | + include_spip('inc/filtres_mini'); |
|
| 75 | + // le decodage des urls se fait toujours par rapport au site public |
|
| 76 | + $current_base = url_absolue(_DIR_RACINE ? _DIR_RACINE : './'); |
|
| 77 | + } |
|
| 78 | + if (strncmp($url, $current_base, strlen($current_base)) == 0) { |
|
| 79 | + $url = substr($url, strlen($current_base)); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - // si on est en train d'assembler la page principale, |
|
| 83 | - // recuperer l'url depuis les globales url propres si fournies |
|
| 84 | - // sinon extraire la bonne portion d'url |
|
| 85 | - if ($assembler) { |
|
| 86 | - if (isset($_SERVER['REDIRECT_url_propre'])) { |
|
| 87 | - $url = $_SERVER['REDIRECT_url_propre']; |
|
| 88 | - } elseif (isset($_ENV['url_propre'])) { |
|
| 89 | - $url = $_ENV['url_propre']; |
|
| 90 | - } else { |
|
| 91 | - $qs = explode("?", $url); |
|
| 92 | - // ne prendre que le segment d'url qui correspond, en fonction de la profondeur calculee |
|
| 93 | - $url = ltrim($qs[0], '/'); |
|
| 94 | - $url = explode('/', $url); |
|
| 95 | - while (count($url) > $GLOBALS['profondeur_url'] + 1) { |
|
| 96 | - array_shift($url); |
|
| 97 | - } |
|
| 98 | - $qs[0] = implode('/', $url); |
|
| 99 | - $url = implode("?", $qs); |
|
| 100 | - } |
|
| 101 | - } |
|
| 82 | + // si on est en train d'assembler la page principale, |
|
| 83 | + // recuperer l'url depuis les globales url propres si fournies |
|
| 84 | + // sinon extraire la bonne portion d'url |
|
| 85 | + if ($assembler) { |
|
| 86 | + if (isset($_SERVER['REDIRECT_url_propre'])) { |
|
| 87 | + $url = $_SERVER['REDIRECT_url_propre']; |
|
| 88 | + } elseif (isset($_ENV['url_propre'])) { |
|
| 89 | + $url = $_ENV['url_propre']; |
|
| 90 | + } else { |
|
| 91 | + $qs = explode("?", $url); |
|
| 92 | + // ne prendre que le segment d'url qui correspond, en fonction de la profondeur calculee |
|
| 93 | + $url = ltrim($qs[0], '/'); |
|
| 94 | + $url = explode('/', $url); |
|
| 95 | + while (count($url) > $GLOBALS['profondeur_url'] + 1) { |
|
| 96 | + array_shift($url); |
|
| 97 | + } |
|
| 98 | + $qs[0] = implode('/', $url); |
|
| 99 | + $url = implode("?", $qs); |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - unset($_SERVER['REDIRECT_url_propre']); |
|
| 104 | - unset($_ENV['url_propre']); |
|
| 105 | - include_spip('inc/filtres_mini'); |
|
| 106 | - if (strpos($url, "://") === false) { |
|
| 107 | - $GLOBALS['profondeur_url'] = substr_count(ltrim(resolve_path("/$url"), '/'), '/'); |
|
| 108 | - } else { |
|
| 109 | - $GLOBALS['profondeur_url'] = max(0, substr_count($url, "/") - substr_count($current_base, "/")); |
|
| 110 | - } |
|
| 103 | + unset($_SERVER['REDIRECT_url_propre']); |
|
| 104 | + unset($_ENV['url_propre']); |
|
| 105 | + include_spip('inc/filtres_mini'); |
|
| 106 | + if (strpos($url, "://") === false) { |
|
| 107 | + $GLOBALS['profondeur_url'] = substr_count(ltrim(resolve_path("/$url"), '/'), '/'); |
|
| 108 | + } else { |
|
| 109 | + $GLOBALS['profondeur_url'] = max(0, substr_count($url, "/") - substr_count($current_base, "/")); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - $url_redirect = ""; |
|
| 113 | - $renommer = generer_url_entite('', '', '', '', true); |
|
| 114 | - if (!$renommer and !function_exists('recuperer_parametres_url')) { |
|
| 115 | - $renommer = charger_fonction('page', 'urls'); |
|
| 116 | - } // fallback pour decoder l'url |
|
| 117 | - if ($renommer) { |
|
| 118 | - $a = $renommer($url, $fond, $contexte); |
|
| 119 | - if (is_array($a)) { |
|
| 120 | - list($ncontexte, $type, $url_redirect, $nfond) = array_pad($a, 4, null); |
|
| 121 | - if ($url_redirect == $url) { |
|
| 122 | - $url_redirect = ""; |
|
| 123 | - } // securite pour eviter une redirection infinie |
|
| 124 | - if ($assembler and strlen($url_redirect)) { |
|
| 125 | - spip_log("Redirige $url vers $url_redirect"); |
|
| 126 | - include_spip('inc/headers'); |
|
| 127 | - redirige_par_entete($url_redirect, '', 301); |
|
| 128 | - } |
|
| 129 | - if (isset($nfond)) { |
|
| 130 | - $fond = $nfond; |
|
| 131 | - } else { |
|
| 132 | - if ($fond == '' |
|
| 133 | - or $fond == 'type_urls' /* compat avec htaccess 2.0.0 */ |
|
| 134 | - ) { |
|
| 135 | - $fond = $type; |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - if (isset($ncontexte)) { |
|
| 139 | - $contexte = $ncontexte; |
|
| 140 | - } |
|
| 141 | - if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) { |
|
| 142 | - $contexte['type'] = $type; |
|
| 143 | - } |
|
| 144 | - if (defined('_DEFINIR_CONTEXTE_TYPE_PAGE') and _DEFINIR_CONTEXTE_TYPE_PAGE) { |
|
| 145 | - $contexte['type-page'] = $type; |
|
| 146 | - } |
|
| 147 | - } |
|
| 148 | - } // compatibilite <= 1.9.2 |
|
| 149 | - elseif (function_exists('recuperer_parametres_url')) { |
|
| 150 | - $GLOBALS['fond'] = $fond; |
|
| 151 | - $GLOBALS['contexte'] = $contexte; |
|
| 152 | - recuperer_parametres_url($fond, nettoyer_uri()); |
|
| 153 | - // fond est en principe modifiee directement |
|
| 154 | - $contexte = $GLOBALS['contexte']; |
|
| 155 | - } |
|
| 112 | + $url_redirect = ""; |
|
| 113 | + $renommer = generer_url_entite('', '', '', '', true); |
|
| 114 | + if (!$renommer and !function_exists('recuperer_parametres_url')) { |
|
| 115 | + $renommer = charger_fonction('page', 'urls'); |
|
| 116 | + } // fallback pour decoder l'url |
|
| 117 | + if ($renommer) { |
|
| 118 | + $a = $renommer($url, $fond, $contexte); |
|
| 119 | + if (is_array($a)) { |
|
| 120 | + list($ncontexte, $type, $url_redirect, $nfond) = array_pad($a, 4, null); |
|
| 121 | + if ($url_redirect == $url) { |
|
| 122 | + $url_redirect = ""; |
|
| 123 | + } // securite pour eviter une redirection infinie |
|
| 124 | + if ($assembler and strlen($url_redirect)) { |
|
| 125 | + spip_log("Redirige $url vers $url_redirect"); |
|
| 126 | + include_spip('inc/headers'); |
|
| 127 | + redirige_par_entete($url_redirect, '', 301); |
|
| 128 | + } |
|
| 129 | + if (isset($nfond)) { |
|
| 130 | + $fond = $nfond; |
|
| 131 | + } else { |
|
| 132 | + if ($fond == '' |
|
| 133 | + or $fond == 'type_urls' /* compat avec htaccess 2.0.0 */ |
|
| 134 | + ) { |
|
| 135 | + $fond = $type; |
|
| 136 | + } |
|
| 137 | + } |
|
| 138 | + if (isset($ncontexte)) { |
|
| 139 | + $contexte = $ncontexte; |
|
| 140 | + } |
|
| 141 | + if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) { |
|
| 142 | + $contexte['type'] = $type; |
|
| 143 | + } |
|
| 144 | + if (defined('_DEFINIR_CONTEXTE_TYPE_PAGE') and _DEFINIR_CONTEXTE_TYPE_PAGE) { |
|
| 145 | + $contexte['type-page'] = $type; |
|
| 146 | + } |
|
| 147 | + } |
|
| 148 | + } // compatibilite <= 1.9.2 |
|
| 149 | + elseif (function_exists('recuperer_parametres_url')) { |
|
| 150 | + $GLOBALS['fond'] = $fond; |
|
| 151 | + $GLOBALS['contexte'] = $contexte; |
|
| 152 | + recuperer_parametres_url($fond, nettoyer_uri()); |
|
| 153 | + // fond est en principe modifiee directement |
|
| 154 | + $contexte = $GLOBALS['contexte']; |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - // retablir les globales |
|
| 158 | - list($GLOBALS['fond'], $GLOBALS['contexte'], $_SERVER['REDIRECT_url_propre'], $_ENV['url_propre'], $GLOBALS['profondeur_url']) = $save; |
|
| 157 | + // retablir les globales |
|
| 158 | + list($GLOBALS['fond'], $GLOBALS['contexte'], $_SERVER['REDIRECT_url_propre'], $_ENV['url_propre'], $GLOBALS['profondeur_url']) = $save; |
|
| 159 | 159 | |
| 160 | - // vider les globales url propres qui ne doivent plus etre utilisees en cas |
|
| 161 | - // d'inversion url => objet |
|
| 162 | - // maintenir pour compat ? |
|
| 163 | - #if ($assembler) { |
|
| 164 | - # unset($_SERVER['REDIRECT_url_propre']); |
|
| 165 | - # unset($_ENV['url_propre']); |
|
| 166 | - #} |
|
| 160 | + // vider les globales url propres qui ne doivent plus etre utilisees en cas |
|
| 161 | + // d'inversion url => objet |
|
| 162 | + // maintenir pour compat ? |
|
| 163 | + #if ($assembler) { |
|
| 164 | + # unset($_SERVER['REDIRECT_url_propre']); |
|
| 165 | + # unset($_ENV['url_propre']); |
|
| 166 | + #} |
|
| 167 | 167 | |
| 168 | - return array($fond, $contexte, $url_redirect); |
|
| 168 | + return array($fond, $contexte, $url_redirect); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
@@ -179,24 +179,24 @@ discard block |
||
| 179 | 179 | * @return string|array |
| 180 | 180 | */ |
| 181 | 181 | function urls_liste_objets($preg = true) { |
| 182 | - static $url_objets = null; |
|
| 183 | - if (is_null($url_objets)) { |
|
| 184 | - $url_objets = array(); |
|
| 185 | - // recuperer les tables_objets_sql declarees |
|
| 186 | - $tables_objets = lister_tables_objets_sql(); |
|
| 187 | - foreach ($tables_objets as $t => $infos) { |
|
| 188 | - if ($infos['page']) { |
|
| 189 | - $url_objets[] = $infos['type']; |
|
| 190 | - $url_objets = array_merge($url_objets, $infos['type_surnoms']); |
|
| 191 | - } |
|
| 192 | - } |
|
| 193 | - $url_objets = pipeline('declarer_url_objets', $url_objets); |
|
| 194 | - } |
|
| 195 | - if (!$preg) { |
|
| 196 | - return $url_objets; |
|
| 197 | - } |
|
| 182 | + static $url_objets = null; |
|
| 183 | + if (is_null($url_objets)) { |
|
| 184 | + $url_objets = array(); |
|
| 185 | + // recuperer les tables_objets_sql declarees |
|
| 186 | + $tables_objets = lister_tables_objets_sql(); |
|
| 187 | + foreach ($tables_objets as $t => $infos) { |
|
| 188 | + if ($infos['page']) { |
|
| 189 | + $url_objets[] = $infos['type']; |
|
| 190 | + $url_objets = array_merge($url_objets, $infos['type_surnoms']); |
|
| 191 | + } |
|
| 192 | + } |
|
| 193 | + $url_objets = pipeline('declarer_url_objets', $url_objets); |
|
| 194 | + } |
|
| 195 | + if (!$preg) { |
|
| 196 | + return $url_objets; |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - return implode('|', array_map('preg_quote', $url_objets)); |
|
| 199 | + return implode('|', array_map('preg_quote', $url_objets)); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
@@ -210,25 +210,25 @@ discard block |
||
| 210 | 210 | * @return array |
| 211 | 211 | */ |
| 212 | 212 | function nettoyer_url_page($url, $contexte = array()) { |
| 213 | - $url_objets = urls_liste_objets(); |
|
| 214 | - $raccourci_url_page_html = ',^(?:[^?]*/)?(' . $url_objets . ')([0-9]+)(?:\.html)?([?&].*)?$,'; |
|
| 215 | - $raccourci_url_page_id = ',^(?:[^?]*/)?(' . $url_objets . ')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,'; |
|
| 216 | - $raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?](' . $url_objets . ')([0-9]+)=?(&.*)?$,'; |
|
| 213 | + $url_objets = urls_liste_objets(); |
|
| 214 | + $raccourci_url_page_html = ',^(?:[^?]*/)?(' . $url_objets . ')([0-9]+)(?:\.html)?([?&].*)?$,'; |
|
| 215 | + $raccourci_url_page_id = ',^(?:[^?]*/)?(' . $url_objets . ')\.php3?[?]id_\1=([0-9]+)([?&].*)?$,'; |
|
| 216 | + $raccourci_url_page_spip = ',^(?:[^?]*/)?(?:spip[.]php)?[?](' . $url_objets . ')([0-9]+)=?(&.*)?$,'; |
|
| 217 | 217 | |
| 218 | - if (preg_match($raccourci_url_page_html, $url, $regs) |
|
| 219 | - or preg_match($raccourci_url_page_id, $url, $regs) |
|
| 220 | - or preg_match($raccourci_url_page_spip, $url, $regs) |
|
| 221 | - ) { |
|
| 222 | - $regs = array_pad($regs, 4, null); |
|
| 223 | - $type = objet_type($regs[1]); |
|
| 224 | - $_id = id_table_objet($type); |
|
| 225 | - $contexte[$_id] = $regs[2]; |
|
| 226 | - $suite = $regs[3]; |
|
| 218 | + if (preg_match($raccourci_url_page_html, $url, $regs) |
|
| 219 | + or preg_match($raccourci_url_page_id, $url, $regs) |
|
| 220 | + or preg_match($raccourci_url_page_spip, $url, $regs) |
|
| 221 | + ) { |
|
| 222 | + $regs = array_pad($regs, 4, null); |
|
| 223 | + $type = objet_type($regs[1]); |
|
| 224 | + $_id = id_table_objet($type); |
|
| 225 | + $contexte[$_id] = $regs[2]; |
|
| 226 | + $suite = $regs[3]; |
|
| 227 | 227 | |
| 228 | - return array($contexte, $type, null, $type, $suite); |
|
| 229 | - } |
|
| 228 | + return array($contexte, $type, null, $type, $suite); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - return array(); |
|
| 231 | + return array(); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -247,32 +247,32 @@ discard block |
||
| 247 | 247 | * |
| 248 | 248 | */ |
| 249 | 249 | function generer_url_ecrire_objet($objet, $id, $args = '', $ancre = '', $public = null, $connect = '') { |
| 250 | - static $furls = array(); |
|
| 251 | - if (!isset($furls[$objet])) { |
|
| 252 | - if (function_exists($f = 'generer_url_ecrire_' . $objet) |
|
| 253 | - // ou definie par un plugin |
|
| 254 | - or $f = charger_fonction($f, 'urls', true) |
|
| 255 | - ) { |
|
| 256 | - $furls[$objet] = $f; |
|
| 257 | - } else { |
|
| 258 | - $furls[$objet] = ''; |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - if ($furls[$objet]) { |
|
| 262 | - return $furls[$objet]($id, $args, $ancre, $public, $connect); |
|
| 263 | - } |
|
| 264 | - // si pas de flag public fourni |
|
| 265 | - // le calculer en fonction de la declaration de statut |
|
| 266 | - if (is_null($public) and !$connect) { |
|
| 267 | - $public = objet_test_si_publie($objet, $id, $connect); |
|
| 268 | - } |
|
| 269 | - if ($public or $connect) { |
|
| 270 | - return generer_url_entite_absolue($id, $objet, $args, $ancre, $connect); |
|
| 271 | - } |
|
| 272 | - $a = id_table_objet($objet) . "=" . intval($id); |
|
| 273 | - if (!function_exists('objet_info')) { |
|
| 274 | - include_spip('inc/filtres'); |
|
| 275 | - } |
|
| 250 | + static $furls = array(); |
|
| 251 | + if (!isset($furls[$objet])) { |
|
| 252 | + if (function_exists($f = 'generer_url_ecrire_' . $objet) |
|
| 253 | + // ou definie par un plugin |
|
| 254 | + or $f = charger_fonction($f, 'urls', true) |
|
| 255 | + ) { |
|
| 256 | + $furls[$objet] = $f; |
|
| 257 | + } else { |
|
| 258 | + $furls[$objet] = ''; |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + if ($furls[$objet]) { |
|
| 262 | + return $furls[$objet]($id, $args, $ancre, $public, $connect); |
|
| 263 | + } |
|
| 264 | + // si pas de flag public fourni |
|
| 265 | + // le calculer en fonction de la declaration de statut |
|
| 266 | + if (is_null($public) and !$connect) { |
|
| 267 | + $public = objet_test_si_publie($objet, $id, $connect); |
|
| 268 | + } |
|
| 269 | + if ($public or $connect) { |
|
| 270 | + return generer_url_entite_absolue($id, $objet, $args, $ancre, $connect); |
|
| 271 | + } |
|
| 272 | + $a = id_table_objet($objet) . "=" . intval($id); |
|
| 273 | + if (!function_exists('objet_info')) { |
|
| 274 | + include_spip('inc/filtres'); |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - return generer_url_ecrire(objet_info($objet, 'url_voir'), $a . ($args ? "&$args" : '')) . ($ancre ? "#$ancre" : ''); |
|
| 277 | + return generer_url_ecrire(objet_info($objet, 'url_voir'), $a . ($args ? "&$args" : '')) . ($ancre ? "#$ancre" : ''); |
|
| 278 | 278 | } |