@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | include_spip('maj/legacy/v30'); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Installation |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | include_spip('inc/acces'); |
@@ -33,18 +33,18 @@ discard block |
||
| 33 | 33 | * @return bool |
| 34 | 34 | */ |
| 35 | 35 | function base_determine_autoinc($table, $desc = []) { |
| 36 | - if ($t = lister_tables_principales() and isset($t[$table])) { |
|
| 37 | - $autoinc = true; |
|
| 38 | - } elseif ($t = lister_tables_auxiliaires() and isset($t[$table])) { |
|
| 39 | - $autoinc = false; |
|
| 40 | - } else { |
|
| 41 | - // essayer de faire au mieux ! |
|
| 42 | - $autoinc = (isset($desc['key']['PRIMARY KEY']) |
|
| 43 | - and strpos($desc['key']['PRIMARY KEY'], ',') === false |
|
| 44 | - and strpos($desc['field'][$desc['key']['PRIMARY KEY']], 'default') === false); |
|
| 45 | - } |
|
| 36 | + if ($t = lister_tables_principales() and isset($t[$table])) { |
|
| 37 | + $autoinc = true; |
|
| 38 | + } elseif ($t = lister_tables_auxiliaires() and isset($t[$table])) { |
|
| 39 | + $autoinc = false; |
|
| 40 | + } else { |
|
| 41 | + // essayer de faire au mieux ! |
|
| 42 | + $autoinc = (isset($desc['key']['PRIMARY KEY']) |
|
| 43 | + and strpos($desc['key']['PRIMARY KEY'], ',') === false |
|
| 44 | + and strpos($desc['field'][$desc['key']['PRIMARY KEY']], 'default') === false); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $autoinc; |
|
| 47 | + return $autoinc; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /** |
@@ -61,58 +61,58 @@ discard block |
||
| 61 | 61 | * @return void |
| 62 | 62 | */ |
| 63 | 63 | function creer_ou_upgrader_table($table, $desc, $autoinc, $upgrade = false, $serveur = '') { |
| 64 | - #spip_log("creer_ou_upgrader_table table=$table autoinc=$autoinc upgrade=$upgrade","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 65 | - $sql_desc = $upgrade ? sql_showtable($table, true, $serveur) : false; |
|
| 66 | - #if (!$sql_desc) $sql_desc = false; |
|
| 67 | - #spip_log("table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 68 | - if (!$sql_desc) { |
|
| 69 | - if ($autoinc === 'auto') { |
|
| 70 | - $autoinc = base_determine_autoinc($table, $desc); |
|
| 71 | - } |
|
| 72 | - #spip_log("sql_create $table autoinc=$autoinc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 73 | - if (isset($desc['field']) and isset($desc['key'])) { |
|
| 74 | - sql_create($table, $desc['field'], $desc['key'], $autoinc, false, $serveur); |
|
| 75 | - } |
|
| 76 | - // verifier la bonne installation de la table (php-fpm es-tu la ?) |
|
| 77 | - $sql_desc = sql_showtable($table, true, $serveur); |
|
| 78 | - #if (!$sql_desc) $sql_desc = false; |
|
| 79 | - #spip_log("Resultat table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 80 | - if (!$sql_desc) { |
|
| 81 | - // on retente avec un sleep ? |
|
| 82 | - sleep(1); |
|
| 83 | - sql_create($table, $desc['field'], $desc['key'], $autoinc, false, $serveur); |
|
| 84 | - $sql_desc = sql_showtable($table, true, $serveur); |
|
| 85 | - #if (!$sql_desc) $sql_desc = false; |
|
| 86 | - #spip_log("Resultat table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 87 | - if (!$sql_desc) { |
|
| 88 | - spip_log("Echec creation table $table", 'maj' . _LOG_CRITIQUE); |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - } else { |
|
| 92 | - #spip_log("sql_alter $table ... (on s'en fiche)","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 93 | - // ajouter les champs manquants |
|
| 94 | - // on ne supprime jamais les champs, car c'est dangereux |
|
| 95 | - // c'est toujours a faire manuellement |
|
| 96 | - $last = ''; |
|
| 97 | - if (isset($desc['field'])) { |
|
| 98 | - foreach ($desc['field'] as $field => $type) { |
|
| 99 | - if (!isset($sql_desc['field'][$field])) { |
|
| 100 | - sql_alter("TABLE $table ADD $field $type" . ($last ? " AFTER $last" : ''), $serveur); |
|
| 101 | - } |
|
| 102 | - $last = $field; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - if (isset($desc['key'])) { |
|
| 106 | - foreach ($desc['key'] as $key => $type) { |
|
| 107 | - // Ne pas oublier les cas des cles non nommees dans la declaration et qui sont retournees |
|
| 108 | - // par le showtable sous la forme d'un index de tableau "KEY $type" et non "KEY" |
|
| 109 | - if (!isset($sql_desc['key'][$key]) and !isset($sql_desc['key']["$key $type"])) { |
|
| 110 | - sql_alter("TABLE $table ADD $key ($type)", $serveur); |
|
| 111 | - } |
|
| 112 | - $last = $field; |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - } |
|
| 64 | + #spip_log("creer_ou_upgrader_table table=$table autoinc=$autoinc upgrade=$upgrade","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 65 | + $sql_desc = $upgrade ? sql_showtable($table, true, $serveur) : false; |
|
| 66 | + #if (!$sql_desc) $sql_desc = false; |
|
| 67 | + #spip_log("table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 68 | + if (!$sql_desc) { |
|
| 69 | + if ($autoinc === 'auto') { |
|
| 70 | + $autoinc = base_determine_autoinc($table, $desc); |
|
| 71 | + } |
|
| 72 | + #spip_log("sql_create $table autoinc=$autoinc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 73 | + if (isset($desc['field']) and isset($desc['key'])) { |
|
| 74 | + sql_create($table, $desc['field'], $desc['key'], $autoinc, false, $serveur); |
|
| 75 | + } |
|
| 76 | + // verifier la bonne installation de la table (php-fpm es-tu la ?) |
|
| 77 | + $sql_desc = sql_showtable($table, true, $serveur); |
|
| 78 | + #if (!$sql_desc) $sql_desc = false; |
|
| 79 | + #spip_log("Resultat table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 80 | + if (!$sql_desc) { |
|
| 81 | + // on retente avec un sleep ? |
|
| 82 | + sleep(1); |
|
| 83 | + sql_create($table, $desc['field'], $desc['key'], $autoinc, false, $serveur); |
|
| 84 | + $sql_desc = sql_showtable($table, true, $serveur); |
|
| 85 | + #if (!$sql_desc) $sql_desc = false; |
|
| 86 | + #spip_log("Resultat table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 87 | + if (!$sql_desc) { |
|
| 88 | + spip_log("Echec creation table $table", 'maj' . _LOG_CRITIQUE); |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + } else { |
|
| 92 | + #spip_log("sql_alter $table ... (on s'en fiche)","dbinstall"._LOG_INFO_IMPORTANTE); |
|
| 93 | + // ajouter les champs manquants |
|
| 94 | + // on ne supprime jamais les champs, car c'est dangereux |
|
| 95 | + // c'est toujours a faire manuellement |
|
| 96 | + $last = ''; |
|
| 97 | + if (isset($desc['field'])) { |
|
| 98 | + foreach ($desc['field'] as $field => $type) { |
|
| 99 | + if (!isset($sql_desc['field'][$field])) { |
|
| 100 | + sql_alter("TABLE $table ADD $field $type" . ($last ? " AFTER $last" : ''), $serveur); |
|
| 101 | + } |
|
| 102 | + $last = $field; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + if (isset($desc['key'])) { |
|
| 106 | + foreach ($desc['key'] as $key => $type) { |
|
| 107 | + // Ne pas oublier les cas des cles non nommees dans la declaration et qui sont retournees |
|
| 108 | + // par le showtable sous la forme d'un index de tableau "KEY $type" et non "KEY" |
|
| 109 | + if (!isset($sql_desc['key'][$key]) and !isset($sql_desc['key']["$key $type"])) { |
|
| 110 | + sql_alter("TABLE $table ADD $key ($type)", $serveur); |
|
| 111 | + } |
|
| 112 | + $last = $field; |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -134,26 +134,26 @@ discard block |
||
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | 136 | function alterer_base($tables_inc, $tables_noinc, $up = false, $serveur = '') { |
| 137 | - if ($up === false) { |
|
| 138 | - $old = false; |
|
| 139 | - $up = []; |
|
| 140 | - } else { |
|
| 141 | - $old = true; |
|
| 142 | - if (!is_array($up)) { |
|
| 143 | - $up = [$up]; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - foreach ($tables_inc as $k => $v) { |
|
| 147 | - if (!$old or in_array($k, $up)) { |
|
| 148 | - creer_ou_upgrader_table($k, $v, true, $old, $serveur); |
|
| 149 | - } |
|
| 150 | - } |
|
| 137 | + if ($up === false) { |
|
| 138 | + $old = false; |
|
| 139 | + $up = []; |
|
| 140 | + } else { |
|
| 141 | + $old = true; |
|
| 142 | + if (!is_array($up)) { |
|
| 143 | + $up = [$up]; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + foreach ($tables_inc as $k => $v) { |
|
| 147 | + if (!$old or in_array($k, $up)) { |
|
| 148 | + creer_ou_upgrader_table($k, $v, true, $old, $serveur); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - foreach ($tables_noinc as $k => $v) { |
|
| 153 | - if (!$old or in_array($k, $up)) { |
|
| 154 | - creer_ou_upgrader_table($k, $v, false, $old, $serveur); |
|
| 155 | - } |
|
| 156 | - } |
|
| 152 | + foreach ($tables_noinc as $k => $v) { |
|
| 153 | + if (!$old or in_array($k, $up)) { |
|
| 154 | + creer_ou_upgrader_table($k, $v, false, $old, $serveur); |
|
| 155 | + } |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -173,16 +173,16 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function creer_base($serveur = '') { |
| 175 | 175 | |
| 176 | - // Note: les mises a jour reexecutent ce code pour s'assurer |
|
| 177 | - // de la conformite de la base |
|
| 178 | - // pas de panique sur "already exists" et "duplicate entry" donc. |
|
| 176 | + // Note: les mises a jour reexecutent ce code pour s'assurer |
|
| 177 | + // de la conformite de la base |
|
| 178 | + // pas de panique sur "already exists" et "duplicate entry" donc. |
|
| 179 | 179 | |
| 180 | - alterer_base( |
|
| 181 | - lister_tables_principales(), |
|
| 182 | - lister_tables_auxiliaires(), |
|
| 183 | - false, |
|
| 184 | - $serveur |
|
| 185 | - ); |
|
| 180 | + alterer_base( |
|
| 181 | + lister_tables_principales(), |
|
| 182 | + lister_tables_auxiliaires(), |
|
| 183 | + false, |
|
| 184 | + $serveur |
|
| 185 | + ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | * @return void |
| 203 | 203 | */ |
| 204 | 204 | function maj_tables($upgrade_tables = [], $serveur = '') { |
| 205 | - alterer_base( |
|
| 206 | - lister_tables_principales(), |
|
| 207 | - lister_tables_auxiliaires(), |
|
| 208 | - $upgrade_tables, |
|
| 209 | - $serveur |
|
| 210 | - ); |
|
| 205 | + alterer_base( |
|
| 206 | + lister_tables_principales(), |
|
| 207 | + lister_tables_auxiliaires(), |
|
| 208 | + $upgrade_tables, |
|
| 209 | + $serveur |
|
| 210 | + ); |
|
| 211 | 211 | } |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | define( |
| 18 | - '_REGEXP_DOCTYPE', |
|
| 19 | - '/^((?:<\001?[?][^>]*>\s*)*(?:<!--.*?-->\s*)*)*<!DOCTYPE\s+(\w+)\s+(\w+)\s*([^>]*)>\s*/s' |
|
| 18 | + '_REGEXP_DOCTYPE', |
|
| 19 | + '/^((?:<\001?[?][^>]*>\s*)*(?:<!--.*?-->\s*)*)*<!DOCTYPE\s+(\w+)\s+(\w+)\s*([^>]*)>\s*/s' |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | 22 | define('_REGEXP_XML', '/^(\s*(?:<[?][^x>][^>]*>\s*)?(?:<[?]xml[^>]*>)?\s*(?:<!--.*?-->\s*)*)<(\w+)/s'); |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | define('_REGEXP_ENTITY_DEF', '/^%(' . _SUB_REGEXP_SYMBOL . '+);/'); |
| 36 | 36 | define('_REGEXP_TYPE_XML', 'PUBLIC|SYSTEM|INCLUDE|IGNORE|CDATA'); |
| 37 | 37 | define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*(' . |
| 38 | - _SUB_REGEXP_SYMBOL . |
|
| 39 | - '+;?)\s+(' . |
|
| 40 | - _REGEXP_TYPE_XML . |
|
| 41 | - ')?\s*(' . |
|
| 42 | - "('([^']*)')" . |
|
| 43 | - '|("([^"]*)")' . |
|
| 44 | - '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' . |
|
| 45 | - ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s'); |
|
| 38 | + _SUB_REGEXP_SYMBOL . |
|
| 39 | + '+;?)\s+(' . |
|
| 40 | + _REGEXP_TYPE_XML . |
|
| 41 | + ')?\s*(' . |
|
| 42 | + "('([^']*)')" . |
|
| 43 | + '|("([^"]*)")' . |
|
| 44 | + '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' . |
|
| 45 | + ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s'); |
|
| 46 | 46 | |
| 47 | 47 | define('_REGEXP_INCLUDE_USE', '/^<!\[\s*%\s*([^;]*);\s*\[\s*(.*)$/s'); |
| 48 | 48 | |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | * Document Type Compilation |
| 53 | 53 | **/ |
| 54 | 54 | class DTC { |
| 55 | - public $macros = []; |
|
| 56 | - public $elements = []; |
|
| 57 | - public $peres = []; |
|
| 58 | - public $attributs = []; |
|
| 59 | - public $entites = []; |
|
| 60 | - public $regles = []; |
|
| 61 | - public $pcdata = []; |
|
| 55 | + public $macros = []; |
|
| 56 | + public $elements = []; |
|
| 57 | + public $peres = []; |
|
| 58 | + public $attributs = []; |
|
| 59 | + public $entites = []; |
|
| 60 | + public $regles = []; |
|
| 61 | + public $pcdata = []; |
|
| 62 | 62 | } |
@@ -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 | |
@@ -36,22 +36,22 @@ discard block |
||
| 36 | 36 | * Description de la boucle complétée des champs |
| 37 | 37 | */ |
| 38 | 38 | function iterateur_php_dist($b, $iteratorName) { |
| 39 | - $b->iterateur = $iteratorName; # designe la classe d'iterateur |
|
| 40 | - $b->show = [ |
|
| 41 | - 'field' => [ |
|
| 42 | - 'cle' => 'STRING', |
|
| 43 | - 'valeur' => 'STRING', |
|
| 44 | - ] |
|
| 45 | - ]; |
|
| 46 | - foreach (get_class_methods($iteratorName) as $method) { |
|
| 47 | - $b->show['field'][strtolower($method)] = 'METHOD'; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /* |
|
| 39 | + $b->iterateur = $iteratorName; # designe la classe d'iterateur |
|
| 40 | + $b->show = [ |
|
| 41 | + 'field' => [ |
|
| 42 | + 'cle' => 'STRING', |
|
| 43 | + 'valeur' => 'STRING', |
|
| 44 | + ] |
|
| 45 | + ]; |
|
| 46 | + foreach (get_class_methods($iteratorName) as $method) { |
|
| 47 | + $b->show['field'][strtolower($method)] = 'METHOD'; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /* |
|
| 51 | 51 | foreach (get_class_vars($iteratorName) as $property) { |
| 52 | 52 | $b->show['field'][ strtolower($property) ] = 'PROPERTY'; |
| 53 | 53 | } |
| 54 | 54 | */ |
| 55 | 55 | |
| 56 | - return $b; |
|
| 56 | + return $b; |
|
| 57 | 57 | } |
@@ -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('iterateur/data'); |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | * Description de la boucle complétée des champs |
| 40 | 40 | */ |
| 41 | 41 | function iterateur_POUR_dist($b) { |
| 42 | - $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 43 | - $b->show = [ |
|
| 44 | - 'field' => [ |
|
| 45 | - 'cle' => 'STRING', |
|
| 46 | - 'valeur' => 'STRING', |
|
| 47 | - ] |
|
| 48 | - ]; |
|
| 42 | + $b->iterateur = 'DATA'; # designe la classe d'iterateur |
|
| 43 | + $b->show = [ |
|
| 44 | + 'field' => [ |
|
| 45 | + 'cle' => 'STRING', |
|
| 46 | + 'valeur' => 'STRING', |
|
| 47 | + ] |
|
| 48 | + ]; |
|
| 49 | 49 | |
| 50 | - return $b; |
|
| 50 | + return $b; |
|
| 51 | 51 | } |
@@ -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('iterateur/data'); |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | * Description de la boucle complétée des champs |
| 36 | 36 | */ |
| 37 | 37 | function iterateur_CONDITION_dist($b) { |
| 38 | - $b->iterateur = 'CONDITION'; # designe la classe d'iterateur |
|
| 39 | - $b->show = [ |
|
| 40 | - 'field' => [] |
|
| 41 | - ]; |
|
| 38 | + $b->iterateur = 'CONDITION'; # designe la classe d'iterateur |
|
| 39 | + $b->show = [ |
|
| 40 | + 'field' => [] |
|
| 41 | + ]; |
|
| 42 | 42 | |
| 43 | - return $b; |
|
| 43 | + return $b; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /** |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | * La boucle condition n'a toujours qu'un seul élément. |
| 50 | 50 | */ |
| 51 | 51 | class IterateurCONDITION extends IterateurData { |
| 52 | - /** |
|
| 53 | - * Obtenir les données de la boucle CONDITION |
|
| 54 | - * |
|
| 55 | - * @param array $command |
|
| 56 | - **/ |
|
| 57 | - protected function select($command) { |
|
| 58 | - $this->tableau = [0 => 1]; |
|
| 59 | - } |
|
| 52 | + /** |
|
| 53 | + * Obtenir les données de la boucle CONDITION |
|
| 54 | + * |
|
| 55 | + * @param array $command |
|
| 56 | + **/ |
|
| 57 | + protected function select($command) { |
|
| 58 | + $this->tableau = [0 => 1]; |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -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 = [ |
|
| 23 | + $liste = [ |
|
| 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 | } |
@@ -11,71 +11,71 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/boutons'); |
| 18 | 18 | include_spip('base/objets'); |
| 19 | 19 | |
| 20 | 20 | function inc_icone_renommer_dist($fond, $fonction) { |
| 21 | - $size = 24; |
|
| 22 | - if ( |
|
| 23 | - preg_match('/(?:-([0-9]{1,3}))?([.](gif|png|svg))?$/i', $fond, $match) |
|
| 24 | - and ((isset($match[0]) and $match[0]) or (isset($match[1]) and $match[1])) |
|
| 25 | - ) { |
|
| 26 | - if (isset($match[1]) and $match[1]) { |
|
| 27 | - $size = $match[1]; |
|
| 28 | - } |
|
| 29 | - $type = substr($fond, 0, -strlen($match[0])); |
|
| 30 | - if (!isset($match[2]) or !$match[2]) { |
|
| 31 | - $fond .= '.png'; |
|
| 32 | - } |
|
| 33 | - } else { |
|
| 34 | - $type = $fond; |
|
| 35 | - $fond .= '.png'; |
|
| 36 | - } |
|
| 21 | + $size = 24; |
|
| 22 | + if ( |
|
| 23 | + preg_match('/(?:-([0-9]{1,3}))?([.](gif|png|svg))?$/i', $fond, $match) |
|
| 24 | + and ((isset($match[0]) and $match[0]) or (isset($match[1]) and $match[1])) |
|
| 25 | + ) { |
|
| 26 | + if (isset($match[1]) and $match[1]) { |
|
| 27 | + $size = $match[1]; |
|
| 28 | + } |
|
| 29 | + $type = substr($fond, 0, -strlen($match[0])); |
|
| 30 | + if (!isset($match[2]) or !$match[2]) { |
|
| 31 | + $fond .= '.png'; |
|
| 32 | + } |
|
| 33 | + } else { |
|
| 34 | + $type = $fond; |
|
| 35 | + $fond .= '.png'; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - $rtl = false; |
|
| 39 | - if (preg_match(',[-_]rtl$,i', $type, $match)) { |
|
| 40 | - $rtl = true; |
|
| 41 | - $type = substr($type, 0, -strlen($match[0])); |
|
| 42 | - } |
|
| 38 | + $rtl = false; |
|
| 39 | + if (preg_match(',[-_]rtl$,i', $type, $match)) { |
|
| 40 | + $rtl = true; |
|
| 41 | + $type = substr($type, 0, -strlen($match[0])); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - // objet_type garde invariant tout ce qui ne commence par par id_, spip_ |
|
| 45 | - // et ne finit pas par un s, sauf si c'est une exception declaree |
|
| 46 | - $type = objet_type($type, false); |
|
| 44 | + // objet_type garde invariant tout ce qui ne commence par par id_, spip_ |
|
| 45 | + // et ne finit pas par un s, sauf si c'est une exception declaree |
|
| 46 | + $type = objet_type($type, false); |
|
| 47 | 47 | |
| 48 | - $dir = 'images/'; |
|
| 49 | - $f = "$type-$size.png"; |
|
| 50 | - if ($icone = find_in_theme($dir . $f)) { |
|
| 51 | - $dir = dirname($icone); |
|
| 52 | - $fond = $icone; |
|
| 48 | + $dir = 'images/'; |
|
| 49 | + $f = "$type-$size.png"; |
|
| 50 | + if ($icone = find_in_theme($dir . $f)) { |
|
| 51 | + $dir = dirname($icone); |
|
| 52 | + $fond = $icone; |
|
| 53 | 53 | |
| 54 | - if ( |
|
| 55 | - $rtl |
|
| 56 | - and $fr = $dir . '/' . str_replace("$type-", "$type-rtl-", basename($icone)) |
|
| 57 | - and file_exists($fr) |
|
| 58 | - ) { |
|
| 59 | - $fond = $fr; |
|
| 60 | - } |
|
| 54 | + if ( |
|
| 55 | + $rtl |
|
| 56 | + and $fr = $dir . '/' . str_replace("$type-", "$type-rtl-", basename($icone)) |
|
| 57 | + and file_exists($fr) |
|
| 58 | + ) { |
|
| 59 | + $fond = $fr; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $action = $fonction; |
|
| 63 | - if ($action == 'supprimer.gif') { |
|
| 64 | - $action = 'del'; |
|
| 65 | - } elseif ($action == 'creer.gif') { |
|
| 66 | - $action = 'new'; |
|
| 67 | - } elseif ($action == 'edit.gif') { |
|
| 68 | - $action = 'edit'; |
|
| 69 | - } |
|
| 62 | + $action = $fonction; |
|
| 63 | + if ($action == 'supprimer.gif') { |
|
| 64 | + $action = 'del'; |
|
| 65 | + } elseif ($action == 'creer.gif') { |
|
| 66 | + $action = 'new'; |
|
| 67 | + } elseif ($action == 'edit.gif') { |
|
| 68 | + $action = 'edit'; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - $fonction = ''; |
|
| 72 | - if (in_array($action, ['add','del', 'new', 'edit', 'config'])) { |
|
| 73 | - $fonction = $action; |
|
| 74 | - } |
|
| 71 | + $fonction = ''; |
|
| 72 | + if (in_array($action, ['add','del', 'new', 'edit', 'config'])) { |
|
| 73 | + $fonction = $action; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - // c'est bon ! |
|
| 77 | - return [$fond, $fonction]; |
|
| 78 | - } |
|
| 76 | + // c'est bon ! |
|
| 77 | + return [$fond, $fonction]; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - return [$fond, $fonction]; |
|
| 80 | + return [$fond, $fonction]; |
|
| 81 | 81 | } |
@@ -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 | |
@@ -40,29 +40,29 @@ discard block |
||
| 40 | 40 | * Code HTML de la liste |
| 41 | 41 | */ |
| 42 | 42 | function inc_lister_objets_dist($vue, $contexte = [], $force = false) { |
| 43 | - $res = ''; // debug |
|
| 44 | - if (!is_array($contexte)) { |
|
| 45 | - return _L('$contexte doit etre un tableau dans inc/lister_objets'); |
|
| 46 | - } |
|
| 43 | + $res = ''; // debug |
|
| 44 | + if (!is_array($contexte)) { |
|
| 45 | + return _L('$contexte doit etre un tableau dans inc/lister_objets'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - $fond = "prive/objets/liste/$vue"; |
|
| 49 | - if (!find_in_path($fond . '.' . _EXTENSION_SQUELETTES)) { |
|
| 50 | - // traiter les cas particuliers |
|
| 51 | - include_spip('base/connect_sql'); |
|
| 52 | - $vue = table_objet($vue); |
|
| 53 | - $fond = "prive/objets/liste/$vue"; |
|
| 54 | - if (!find_in_path($fond . '.' . _EXTENSION_SQUELETTES)) { |
|
| 55 | - return _L("vue $vue introuvable pour lister les objets"); |
|
| 56 | - } |
|
| 57 | - } |
|
| 48 | + $fond = "prive/objets/liste/$vue"; |
|
| 49 | + if (!find_in_path($fond . '.' . _EXTENSION_SQUELETTES)) { |
|
| 50 | + // traiter les cas particuliers |
|
| 51 | + include_spip('base/connect_sql'); |
|
| 52 | + $vue = table_objet($vue); |
|
| 53 | + $fond = "prive/objets/liste/$vue"; |
|
| 54 | + if (!find_in_path($fond . '.' . _EXTENSION_SQUELETTES)) { |
|
| 55 | + return _L("vue $vue introuvable pour lister les objets"); |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | - $contexte['sinon'] = ($force ? $contexte['titre'] : ''); |
|
| 60 | + $contexte['sinon'] = ($force ? $contexte['titre'] : ''); |
|
| 61 | 61 | |
| 62 | - $res = recuperer_fond($fond, $contexte, ['ajax' => true]); |
|
| 63 | - if (_request('var_liste')) { |
|
| 64 | - echo var_export($contexte, true); |
|
| 65 | - } |
|
| 62 | + $res = recuperer_fond($fond, $contexte, ['ajax' => true]); |
|
| 63 | + if (_request('var_liste')) { |
|
| 64 | + echo var_export($contexte, true); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - return $res; |
|
| 67 | + return $res; |
|
| 68 | 68 | } |