@@ -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 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * Pile complétée du code compilé |
| 43 | 43 | **/ |
| 44 | 44 | function balise_FORMULAIRE_ADMIN($p) { |
| 45 | - return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', array()); |
|
| 45 | + return calculer_balise_dynamique($p, 'FORMULAIRE_ADMIN', array()); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * - chaîne vide sinon. |
| 60 | 60 | */ |
| 61 | 61 | function balise_FORMULAIRE_ADMIN_stat($args, $context_compil) { |
| 62 | - return $args; |
|
| 62 | + return $args; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -84,66 +84,66 @@ discard block |
||
| 84 | 84 | **/ |
| 85 | 85 | function balise_FORMULAIRE_ADMIN_dyn($float = '', $debug = '') { |
| 86 | 86 | |
| 87 | - static $dejafait = false; |
|
| 87 | + static $dejafait = false; |
|
| 88 | 88 | |
| 89 | - if (empty($_COOKIE['spip_admin'])) { |
|
| 90 | - return ''; |
|
| 91 | - } |
|
| 89 | + if (empty($_COOKIE['spip_admin'])) { |
|
| 90 | + return ''; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - if (!is_array($debug)) { |
|
| 94 | - if ($dejafait) { |
|
| 95 | - return ''; |
|
| 96 | - } |
|
| 97 | - } else { |
|
| 98 | - if ($dejafait) { |
|
| 99 | - if (empty($debug['sourcefile'])) { |
|
| 100 | - return ''; |
|
| 101 | - } |
|
| 102 | - foreach ($debug['sourcefile'] as $k => $v) { |
|
| 103 | - if (strpos($v, 'administration.') !== false) { |
|
| 104 | - if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | - return $debug['resultat'][$k . 'tout']; |
|
| 106 | - } |
|
| 107 | - } |
|
| 108 | - } |
|
| 93 | + if (!is_array($debug)) { |
|
| 94 | + if ($dejafait) { |
|
| 95 | + return ''; |
|
| 96 | + } |
|
| 97 | + } else { |
|
| 98 | + if ($dejafait) { |
|
| 99 | + if (empty($debug['sourcefile'])) { |
|
| 100 | + return ''; |
|
| 101 | + } |
|
| 102 | + foreach ($debug['sourcefile'] as $k => $v) { |
|
| 103 | + if (strpos($v, 'administration.') !== false) { |
|
| 104 | + if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | + return $debug['resultat'][$k . 'tout']; |
|
| 106 | + } |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - return ''; |
|
| 111 | - } |
|
| 112 | - } |
|
| 110 | + return ''; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - include_spip('inc/autoriser'); |
|
| 115 | - include_spip('base/abstract_sql'); |
|
| 114 | + include_spip('inc/autoriser'); |
|
| 115 | + include_spip('base/abstract_sql'); |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | - $dejafait = true; |
|
| 118 | + $dejafait = true; |
|
| 119 | 119 | |
| 120 | - // Preparer le #ENV des boutons |
|
| 120 | + // Preparer le #ENV des boutons |
|
| 121 | 121 | |
| 122 | - $env = admin_objet(); |
|
| 122 | + $env = admin_objet(); |
|
| 123 | 123 | |
| 124 | - // Pas de "modifier ce..." ? -> donner "acces a l'espace prive" |
|
| 125 | - if (!$env) { |
|
| 126 | - $env['ecrire'] = _DIR_RESTREINT_ABS; |
|
| 127 | - } |
|
| 124 | + // Pas de "modifier ce..." ? -> donner "acces a l'espace prive" |
|
| 125 | + if (!$env) { |
|
| 126 | + $env['ecrire'] = _DIR_RESTREINT_ABS; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - $env['divclass'] = $float; |
|
| 130 | - $env['lang'] = admin_lang(); |
|
| 131 | - $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul'); |
|
| 132 | - $env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? "" : admin_debug()); |
|
| 133 | - $env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider(); |
|
| 134 | - $env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : ''); |
|
| 129 | + $env['divclass'] = $float; |
|
| 130 | + $env['lang'] = admin_lang(); |
|
| 131 | + $env['calcul'] = (_request('var_mode') ? 'recalcul' : 'calcul'); |
|
| 132 | + $env['debug'] = ((defined('_VAR_PREVIEW') and _VAR_PREVIEW) ? "" : admin_debug()); |
|
| 133 | + $env['analyser'] = (!$env['debug'] and !$GLOBALS['xhtml']) ? '' : admin_valider(); |
|
| 134 | + $env['inclure'] = ((defined('_VAR_INCLURE') and _VAR_INCLURE) ? 'inclure' : ''); |
|
| 135 | 135 | |
| 136 | - if (empty($GLOBALS['use_cache'])) { |
|
| 137 | - $env['use_cache'] = ' *'; |
|
| 138 | - } |
|
| 136 | + if (empty($GLOBALS['use_cache'])) { |
|
| 137 | + $env['use_cache'] = ' *'; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - if (isset($debug['validation'])) { |
|
| 141 | - $env['xhtml_error'] = $debug['validation']; |
|
| 142 | - } |
|
| 140 | + if (isset($debug['validation'])) { |
|
| 141 | + $env['xhtml_error'] = $debug['validation']; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - $env['_pipelines']['formulaire_admin'] = array(); |
|
| 144 | + $env['_pipelines']['formulaire_admin'] = array(); |
|
| 145 | 145 | |
| 146 | - return array('formulaires/administration', 0, $env); |
|
| 146 | + return array('formulaires/administration', 0, $env); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -161,45 +161,45 @@ discard block |
||
| 161 | 161 | * Tableau de l'environnement calculé |
| 162 | 162 | **/ |
| 163 | 163 | function admin_objet() { |
| 164 | - include_spip('inc/urls'); |
|
| 165 | - $env = array(); |
|
| 166 | - |
|
| 167 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 168 | - $objets = urls_liste_objets(false); |
|
| 169 | - $objets = array_diff($objets, array('rubrique')); |
|
| 170 | - $objets = array_reverse($objets); |
|
| 171 | - array_unshift($objets, 'rubrique'); |
|
| 172 | - foreach ($objets as $obj) { |
|
| 173 | - $type = $obj; |
|
| 174 | - if ($type == objet_type($type, false) |
|
| 175 | - and $_id_type = id_table_objet($type) |
|
| 176 | - and isset($GLOBALS['contexte'][$_id_type]) |
|
| 177 | - and $id = $GLOBALS['contexte'][$_id_type] |
|
| 178 | - and !is_array($id) |
|
| 179 | - and $id = intval($id) |
|
| 180 | - and $desc = $trouver_table(table_objet_sql($type)) |
|
| 181 | - ) { |
|
| 182 | - $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 183 | - if ($id) { |
|
| 184 | - $env[$_id_type] = $id; |
|
| 185 | - $env['objet'] = $type; |
|
| 186 | - $env['id_objet'] = $id; |
|
| 187 | - $env['voir_' . $obj] = |
|
| 188 | - str_replace('&', '&', generer_url_entite($id, $obj, '', '', false)); |
|
| 189 | - if (isset($desc['field']['id_rubrique']) |
|
| 190 | - and $type != 'rubrique' |
|
| 191 | - ) { |
|
| 192 | - unset($env['id_rubrique']); |
|
| 193 | - unset($env['voir_rubrique']); |
|
| 194 | - if (admin_preview($type, $id, $desc)) { |
|
| 195 | - $env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&'); |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - return $env; |
|
| 164 | + include_spip('inc/urls'); |
|
| 165 | + $env = array(); |
|
| 166 | + |
|
| 167 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 168 | + $objets = urls_liste_objets(false); |
|
| 169 | + $objets = array_diff($objets, array('rubrique')); |
|
| 170 | + $objets = array_reverse($objets); |
|
| 171 | + array_unshift($objets, 'rubrique'); |
|
| 172 | + foreach ($objets as $obj) { |
|
| 173 | + $type = $obj; |
|
| 174 | + if ($type == objet_type($type, false) |
|
| 175 | + and $_id_type = id_table_objet($type) |
|
| 176 | + and isset($GLOBALS['contexte'][$_id_type]) |
|
| 177 | + and $id = $GLOBALS['contexte'][$_id_type] |
|
| 178 | + and !is_array($id) |
|
| 179 | + and $id = intval($id) |
|
| 180 | + and $desc = $trouver_table(table_objet_sql($type)) |
|
| 181 | + ) { |
|
| 182 | + $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 183 | + if ($id) { |
|
| 184 | + $env[$_id_type] = $id; |
|
| 185 | + $env['objet'] = $type; |
|
| 186 | + $env['id_objet'] = $id; |
|
| 187 | + $env['voir_' . $obj] = |
|
| 188 | + str_replace('&', '&', generer_url_entite($id, $obj, '', '', false)); |
|
| 189 | + if (isset($desc['field']['id_rubrique']) |
|
| 190 | + and $type != 'rubrique' |
|
| 191 | + ) { |
|
| 192 | + unset($env['id_rubrique']); |
|
| 193 | + unset($env['voir_rubrique']); |
|
| 194 | + if (admin_preview($type, $id, $desc)) { |
|
| 195 | + $env['preview'] = parametre_url(self(), 'var_mode', 'preview', '&'); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + return $env; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
@@ -217,30 +217,30 @@ discard block |
||
| 217 | 217 | * - Tableau d'un élément sinon. |
| 218 | 218 | **/ |
| 219 | 219 | function admin_preview($type, $id, $desc = null) { |
| 220 | - if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) { |
|
| 221 | - return ''; |
|
| 222 | - } |
|
| 223 | - |
|
| 224 | - if (!$desc) { |
|
| 225 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 226 | - $desc = $trouver_table(table_objet_sql($type)); |
|
| 227 | - } |
|
| 228 | - if (!$desc or !isset($desc['field']['statut'])) { |
|
| 229 | - return ''; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - include_spip('inc/autoriser'); |
|
| 233 | - if (!autoriser('previsualiser')) { |
|
| 234 | - return ''; |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - $notpub = sql_in("statut", array('prop', 'prive')); |
|
| 238 | - |
|
| 239 | - if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
|
| 240 | - $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ")"; |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . "=" . $id . " AND ($notpub)"); |
|
| 220 | + if (defined('_VAR_PREVIEW') and _VAR_PREVIEW) { |
|
| 221 | + return ''; |
|
| 222 | + } |
|
| 223 | + |
|
| 224 | + if (!$desc) { |
|
| 225 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 226 | + $desc = $trouver_table(table_objet_sql($type)); |
|
| 227 | + } |
|
| 228 | + if (!$desc or !isset($desc['field']['statut'])) { |
|
| 229 | + return ''; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + include_spip('inc/autoriser'); |
|
| 233 | + if (!autoriser('previsualiser')) { |
|
| 234 | + return ''; |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + $notpub = sql_in("statut", array('prop', 'prive')); |
|
| 238 | + |
|
| 239 | + if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
|
| 240 | + $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ")"; |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . "=" . $id . " AND ($notpub)"); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -251,25 +251,25 @@ discard block |
||
| 251 | 251 | * Code de langue |
| 252 | 252 | **/ |
| 253 | 253 | function admin_lang() { |
| 254 | - $alang = ''; |
|
| 255 | - if (!empty($_COOKIE['spip_admin'])) { |
|
| 256 | - $email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']); |
|
| 257 | - $alang = sql_getfetsel('lang', 'spip_auteurs', "email=" . sql_quote($email_or_login)); |
|
| 258 | - if (!$alang) { |
|
| 259 | - $alang = sql_getfetsel('lang', 'spip_auteurs', "login=" . sql_quote($email_or_login)); |
|
| 260 | - } |
|
| 261 | - } |
|
| 262 | - if (!$alang) { |
|
| 263 | - return ''; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - $l = lang_select($alang); |
|
| 267 | - $alang = $GLOBALS['spip_lang']; |
|
| 268 | - if ($l) { |
|
| 269 | - lang_select(); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - return $alang; |
|
| 254 | + $alang = ''; |
|
| 255 | + if (!empty($_COOKIE['spip_admin'])) { |
|
| 256 | + $email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']); |
|
| 257 | + $alang = sql_getfetsel('lang', 'spip_auteurs', "email=" . sql_quote($email_or_login)); |
|
| 258 | + if (!$alang) { |
|
| 259 | + $alang = sql_getfetsel('lang', 'spip_auteurs', "login=" . sql_quote($email_or_login)); |
|
| 260 | + } |
|
| 261 | + } |
|
| 262 | + if (!$alang) { |
|
| 263 | + return ''; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + $l = lang_select($alang); |
|
| 267 | + $alang = $GLOBALS['spip_lang']; |
|
| 268 | + if ($l) { |
|
| 269 | + lang_select(); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + return $alang; |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | **/ |
| 280 | 280 | function admin_valider() { |
| 281 | 281 | |
| 282 | - return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
|
| 283 | - (parametre_url(self(), 'var_mode', 'debug', '&') |
|
| 284 | - . '&var_mode_affiche=validation') : |
|
| 285 | - ('http://validator.w3.org/check?uri=' |
|
| 286 | - . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 282 | + return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
|
| 283 | + (parametre_url(self(), 'var_mode', 'debug', '&') |
|
| 284 | + . '&var_mode_affiche=validation') : |
|
| 285 | + ('http://validator.w3.org/check?uri=' |
|
| 286 | + . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -292,14 +292,14 @@ discard block |
||
| 292 | 292 | * @return string |
| 293 | 293 | **/ |
| 294 | 294 | function admin_debug() { |
| 295 | - return (( |
|
| 296 | - (isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug']) |
|
| 297 | - or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug']) |
|
| 298 | - or ( |
|
| 299 | - defined('_VAR_MODE') and _VAR_MODE == 'debug' |
|
| 300 | - and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug'] |
|
| 301 | - ) |
|
| 302 | - ) and autoriser('debug') |
|
| 303 | - ) |
|
| 304 | - ? parametre_url(self(), 'var_mode', 'debug', '&') : ''; |
|
| 295 | + return (( |
|
| 296 | + (isset($GLOBALS['forcer_debug']) and $GLOBALS['forcer_debug']) |
|
| 297 | + or (isset($GLOBALS['bouton_admin_debug']) and $GLOBALS['bouton_admin_debug']) |
|
| 298 | + or ( |
|
| 299 | + defined('_VAR_MODE') and _VAR_MODE == 'debug' |
|
| 300 | + and isset($_COOKIE['spip_debug']) and $_COOKIE['spip_debug'] |
|
| 301 | + ) |
|
| 302 | + ) and autoriser('debug') |
|
| 303 | + ) |
|
| 304 | + ? parametre_url(self(), 'var_mode', 'debug', '&') : ''; |
|
| 305 | 305 | } |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | foreach ($debug['sourcefile'] as $k => $v) { |
| 103 | 103 | if (strpos($v, 'administration.') !== false) { |
| 104 | - if (isset($debug['resultat'][$k . 'tout'])) { |
|
| 105 | - return $debug['resultat'][$k . 'tout']; |
|
| 104 | + if (isset($debug['resultat'][$k.'tout'])) { |
|
| 105 | + return $debug['resultat'][$k.'tout']; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | and $id = intval($id) |
| 180 | 180 | and $desc = $trouver_table(table_objet_sql($type)) |
| 181 | 181 | ) { |
| 182 | - $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=" . intval($id)); |
|
| 182 | + $id = sql_getfetsel($_id_type, table_objet_sql($type), "$_id_type=".intval($id)); |
|
| 183 | 183 | if ($id) { |
| 184 | 184 | $env[$_id_type] = $id; |
| 185 | 185 | $env['objet'] = $type; |
| 186 | 186 | $env['id_objet'] = $id; |
| 187 | - $env['voir_' . $obj] = |
|
| 187 | + $env['voir_'.$obj] = |
|
| 188 | 188 | str_replace('&', '&', generer_url_entite($id, $obj, '', '', false)); |
| 189 | 189 | if (isset($desc['field']['id_rubrique']) |
| 190 | 190 | and $type != 'rubrique' |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | $notpub = sql_in("statut", array('prop', 'prive')); |
| 238 | 238 | |
| 239 | 239 | if ($type == 'article' and $GLOBALS['meta']['post_dates'] != 'oui') { |
| 240 | - $notpub .= " OR (statut='publie' AND date>" . sql_quote(date('Y-m-d H:i:s')) . ")"; |
|
| 240 | + $notpub .= " OR (statut='publie' AND date>".sql_quote(date('Y-m-d H:i:s')).")"; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | - return sql_fetsel('1', table_objet_sql($type), id_table_objet($type) . "=" . $id . " AND ($notpub)"); |
|
| 243 | + return sql_fetsel('1', table_objet_sql($type), id_table_objet($type)."=".$id." AND ($notpub)"); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | $alang = ''; |
| 255 | 255 | if (!empty($_COOKIE['spip_admin'])) { |
| 256 | 256 | $email_or_login = preg_replace(',^@,', '', $_COOKIE['spip_admin']); |
| 257 | - $alang = sql_getfetsel('lang', 'spip_auteurs', "email=" . sql_quote($email_or_login)); |
|
| 257 | + $alang = sql_getfetsel('lang', 'spip_auteurs', "email=".sql_quote($email_or_login)); |
|
| 258 | 258 | if (!$alang) { |
| 259 | - $alang = sql_getfetsel('lang', 'spip_auteurs', "login=" . sql_quote($email_or_login)); |
|
| 259 | + $alang = sql_getfetsel('lang', 'spip_auteurs', "login=".sql_quote($email_or_login)); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | if (!$alang) { |
@@ -281,9 +281,8 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | return ((!isset($GLOBALS['xhtml']) or $GLOBALS['xhtml'] !== 'true') ? |
| 283 | 283 | (parametre_url(self(), 'var_mode', 'debug', '&') |
| 284 | - . '&var_mode_affiche=validation') : |
|
| 285 | - ('http://validator.w3.org/check?uri=' |
|
| 286 | - . rawurlencode("http://" . $_SERVER['HTTP_HOST'] . nettoyer_uri()))); |
|
| 284 | + . '&var_mode_affiche=validation') : ('http://validator.w3.org/check?uri=' |
|
| 285 | + . rawurlencode("http://".$_SERVER['HTTP_HOST'].nettoyer_uri()))); |
|
| 287 | 286 | } |
| 288 | 287 | |
| 289 | 288 | /** |