@@ -16,11 +16,11 @@ |
||
| 16 | 16 | * Purger la liste des travaux en attente |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | -function action_purger_queue_dist(){ |
|
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 19 | +function action_purger_queue_dist() { |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | 21 | $securiser_action(); |
| 22 | 22 | |
| 23 | - if (autoriser('purger','queue')){ |
|
| 23 | + if (autoriser('purger', 'queue')) { |
|
| 24 | 24 | include_spip('inc/queue'); |
| 25 | 25 | queue_purger(); |
| 26 | 26 | } |
@@ -19,14 +19,14 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @param string|null $arg |
| 21 | 21 | */ |
| 22 | -function action_calculer_taille_cache_dist($arg=null){ |
|
| 23 | - if (is_null($arg)){ |
|
| 22 | +function action_calculer_taille_cache_dist($arg = null) { |
|
| 23 | + if (is_null($arg)) { |
|
| 24 | 24 | $securiser_action = charger_fonction('securiser_action', 'inc'); |
| 25 | 25 | $arg = $securiser_action(); |
| 26 | 26 | } |
| 27 | 27 | include_spip('inc/filtres'); |
| 28 | 28 | |
| 29 | - if ($arg=='images'){ |
|
| 29 | + if ($arg == 'images') { |
|
| 30 | 30 | $taille = calculer_taille_dossier(_DIR_VAR); |
| 31 | 31 | $res = _T('ecrire:taille_cache_image', |
| 32 | 32 | array( |
@@ -44,14 +44,14 @@ discard block |
||
| 44 | 44 | +calculer_taille_dossier(_DIR_CACHE.'contextes/') |
| 45 | 45 | ; |
| 46 | 46 | $taille += intval(taille_du_cache()); |
| 47 | - if ($taille<=150000){ |
|
| 47 | + if ($taille <= 150000) { |
|
| 48 | 48 | $res = _T('taille_cache_vide'); |
| 49 | 49 | } |
| 50 | - elseif ($taille<=1024*1024){ |
|
| 51 | - $res = _T('taille_cache_moins_de',array('octets'=>taille_en_octets(1024*1024))); |
|
| 50 | + elseif ($taille <= 1024 * 1024) { |
|
| 51 | + $res = _T('taille_cache_moins_de', array('octets'=>taille_en_octets(1024 * 1024))); |
|
| 52 | 52 | } |
| 53 | 53 | else { |
| 54 | - $res = _T('taille_cache_octets',array('octets'=>taille_en_octets($taille))); |
|
| 54 | + $res = _T('taille_cache_octets', array('octets'=>taille_en_octets($taille))); |
|
| 55 | 55 | } |
| 56 | 56 | $res = "<b>$res</b>"; |
| 57 | 57 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @param $dir |
| 70 | 70 | * @return int |
| 71 | 71 | */ |
| 72 | -function calculer_taille_dossier ($dir) { |
|
| 72 | +function calculer_taille_dossier($dir) { |
|
| 73 | 73 | $handle = @opendir($dir); |
| 74 | 74 | if (!$handle) return 0; |
| 75 | 75 | $taille = 0; |
@@ -16,13 +16,13 @@ |
||
| 16 | 16 | * Annuler un travail |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | -function action_annuler_job_dist(){ |
|
| 20 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 19 | +function action_annuler_job_dist() { |
|
| 20 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 21 | 21 | $id_job = $securiser_action(); |
| 22 | 22 | |
| 23 | 23 | if ($id_job = intval($id_job) |
| 24 | - AND autoriser('annuler','job',$id_job) |
|
| 25 | - ){ |
|
| 24 | + AND autoriser('annuler', 'job', $id_job) |
|
| 25 | + ) { |
|
| 26 | 26 | job_queue_remove($id_job); |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -14,26 +14,26 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // mise a jour des donnees si envoi via formulaire |
| 16 | 16 | // http://doc.spip.org/@enregistre_modif_plugin |
| 17 | -function enregistre_modif_plugin(){ |
|
| 17 | +function enregistre_modif_plugin() { |
|
| 18 | 18 | include_spip('inc/plugin'); |
| 19 | 19 | // recuperer les plugins dans l'ordre des $_POST |
| 20 | 20 | $test = array(); |
| 21 | - foreach(liste_plugin_files() as $file){ |
|
| 22 | - $test['s'.substr(md5(_DIR_PLUGINS.$file),0,16)] = $file; |
|
| 21 | + foreach (liste_plugin_files() as $file) { |
|
| 22 | + $test['s'.substr(md5(_DIR_PLUGINS.$file), 0, 16)] = $file; |
|
| 23 | 23 | } |
| 24 | 24 | if (defined('_DIR_PLUGINS_SUPPL')) |
| 25 | - foreach(liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file){ |
|
| 26 | - $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file),0,16)] = $file; |
|
| 25 | + foreach (liste_plugin_files(_DIR_PLUGINS_SUPPL) as $file) { |
|
| 26 | + $test['s'.substr(md5(_DIR_PLUGINS_SUPPL.$file), 0, 16)] = $file; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $plugin=array(); |
|
| 29 | + $plugin = array(); |
|
| 30 | 30 | |
| 31 | - foreach($_POST as $choix=>$val){ |
|
| 32 | - if (isset($test[$choix])&&$val=='O') |
|
| 33 | - $plugin[]=$test[$choix]; |
|
| 31 | + foreach ($_POST as $choix=>$val) { |
|
| 32 | + if (isset($test[$choix]) && $val == 'O') |
|
| 33 | + $plugin[] = $test[$choix]; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - spip_log("Changement des plugins actifs par l'auteur " . $GLOBALS['visiteur_session']['id_auteur'] . ": " . join(',', $plugin)); |
|
| 36 | + spip_log("Changement des plugins actifs par l'auteur ".$GLOBALS['visiteur_session']['id_auteur'].": ".join(',', $plugin)); |
|
| 37 | 37 | ecrire_plugin_actifs($plugin); |
| 38 | 38 | |
| 39 | 39 | // Chaque fois que l'on valide des plugins, on memorise la liste de ces plugins comme etant "interessants", avec un score initial, qui sera decremente a chaque tour : ainsi un plugin active pourra reter visible a l'ecran, jusqu'a ce qu'il tombe dans l'oubli. |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $plugins_interessants2 = array(); |
| 45 | 45 | |
| 46 | - foreach($plugins_interessants as $plug => $score) |
|
| 46 | + foreach ($plugins_interessants as $plug => $score) |
|
| 47 | 47 | if ($score > 1) |
| 48 | - $plugins_interessants2[$plug] = $score-1; |
|
| 48 | + $plugins_interessants2[$plug] = $score - 1; |
|
| 49 | 49 | foreach ($plugin as $plug) |
| 50 | 50 | $plugins_interessants2[$plug] = 10; // score initial |
| 51 | 51 | ecrire_meta('plugins_interessants', serialize($plugins_interessants2)); |
@@ -12,14 +12,14 @@ |
||
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
| 14 | 14 | |
| 15 | -function action_ajouter_lien_dist($arg=null){ |
|
| 16 | - if (is_null($arg)){ |
|
| 17 | - $securiser_action = charger_fonction('securiser_action','inc'); |
|
| 15 | +function action_ajouter_lien_dist($arg = null) { |
|
| 16 | + if (is_null($arg)) { |
|
| 17 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 18 | 18 | $arg = $securiser_action(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - $arg = explode("-",$arg); |
|
| 22 | - list($objet_source,$ids,$objet_lie,$idl) = $arg; |
|
| 21 | + $arg = explode("-", $arg); |
|
| 22 | + list($objet_source, $ids, $objet_lie, $idl) = $arg; |
|
| 23 | 23 | |
| 24 | 24 | include_spip('action/editer_liens'); |
| 25 | 25 | objet_associer(array($objet_source=>$ids), array($objet_lie=>$idl)); |
@@ -16,48 +16,48 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | ####### modifications possibles dans ecrire/mes_options |
| 18 | 18 | # on peut indiquer '.html' pour faire joli |
| 19 | -define ('_terminaison_urls_page', ''); |
|
| 19 | +define('_terminaison_urls_page', ''); |
|
| 20 | 20 | # ci-dessous, ce qu'on veut ou presque (de preference pas de '/') |
| 21 | 21 | # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite |
| 22 | -define ('_separateur_urls_page', ''); |
|
| 22 | +define('_separateur_urls_page', ''); |
|
| 23 | 23 | # on peut indiquer '' si on a installe le .htaccess |
| 24 | -define ('_debut_urls_page', get_spip_script('./').'?'); |
|
| 24 | +define('_debut_urls_page', get_spip_script('./').'?'); |
|
| 25 | 25 | ####### |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | // http://doc.spip.org/@_generer_url_page |
| 29 | -function _generer_url_page($type,$id, $args='', $ancre='') { |
|
| 29 | +function _generer_url_page($type, $id, $args = '', $ancre = '') { |
|
| 30 | 30 | |
| 31 | - if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
|
| 31 | + if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) { |
|
| 32 | 32 | $url = $generer_url_externe($id, $args, $ancre); |
| 33 | 33 | if (NULL != $url) return $url; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 37 | - . $id . _terminaison_urls_page; |
|
| 36 | + $url = _debut_urls_page.$type._separateur_urls_page |
|
| 37 | + . $id._terminaison_urls_page; |
|
| 38 | 38 | |
| 39 | - if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 40 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 39 | + if ($args) $args = strpos($url, '?') ? "&$args" : "?$args"; |
|
| 40 | + return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : ''); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | // retrouve le fond et les parametres d'une URL abregee |
| 44 | 44 | // le contexte deja existant est fourni dans args sous forme de tableau ou query string |
| 45 | 45 | // http://doc.spip.org/@urls_page_dist |
| 46 | -function urls_page_dist($i, &$entite, $args='', $ancre='') |
|
| 46 | +function urls_page_dist($i, &$entite, $args = '', $ancre = '') |
|
| 47 | 47 | { |
| 48 | 48 | if (is_numeric($i)) |
| 49 | 49 | return _generer_url_page($entite, $i, $args, $ancre); |
| 50 | 50 | |
| 51 | 51 | // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
| 52 | - if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
|
| 53 | - return array(array(),'404'); |
|
| 52 | + if ($GLOBALS['profondeur_url'] > 0 AND $entite == 'sommaire') { |
|
| 53 | + return array(array(), '404'); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
| 57 | 57 | if (is_array($args)) |
| 58 | 58 | $contexte = $args; |
| 59 | 59 | else |
| 60 | - parse_str($args,$contexte); |
|
| 60 | + parse_str($args, $contexte); |
|
| 61 | 61 | include_spip('inc/urls'); |
| 62 | 62 | $r = nettoyer_url_page($i, $contexte); |
| 63 | 63 | if ($r) { |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | : '' |
| 84 | 84 | )); |
| 85 | 85 | if ($url_propre) { |
| 86 | - if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | - $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 86 | + if ($GLOBALS['profondeur_url'] <= 0) |
|
| 87 | + $urls_anciennes = charger_fonction('propres', 'urls', true); |
|
| 88 | 88 | else |
| 89 | - $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 90 | - return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
|
| 89 | + $urls_anciennes = charger_fonction('arbo', 'urls', true); |
|
| 90 | + return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : ''; |
|
| 91 | 91 | } |
| 92 | 92 | /* Fin du bloc compatibilite url-propres */ |
| 93 | 93 | } |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | * array command: les commandes d'initialisation |
| 67 | 67 | * array info: les infos sur le squelette |
| 68 | 68 | */ |
| 69 | - public function __construct($command, $info=array()) { |
|
| 70 | - $this->type='SQL'; |
|
| 69 | + public function __construct($command, $info = array()) { |
|
| 70 | + $this->type = 'SQL'; |
|
| 71 | 71 | $this->command = $command; |
| 72 | 72 | $this->info = $info; |
| 73 | 73 | $this->select(); |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * @param null|string $continue |
| 114 | 114 | * @return bool |
| 115 | 115 | */ |
| 116 | - public function seek($n=0, $continue=null) { |
|
| 116 | + public function seek($n = 0, $continue = null) { |
|
| 117 | 117 | if (!sql_seek($this->sqlresult, $n, $this->command['connect'], $continue)) { |
| 118 | 118 | // SQLite ne sait pas seek(), il faut relancer la query |
| 119 | 119 | // si la position courante est apres la position visee |
| 120 | 120 | // il faut relancer la requete |
| 121 | - if ($this->pos>$n){ |
|
| 121 | + if ($this->pos > $n) { |
|
| 122 | 122 | $this->free(); |
| 123 | 123 | $this->select(); |
| 124 | 124 | $this->valid(); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | $this->row = sql_fetch($this->sqlresult, $this->command['connect']); |
| 131 | - $this->pos = min($n,$this->count()); |
|
| 131 | + $this->pos = min($n, $this->count()); |
|
| 132 | 132 | return true; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | * Avancer d'un cran |
| 137 | 137 | * @return void |
| 138 | 138 | */ |
| 139 | - public function next(){ |
|
| 139 | + public function next() { |
|
| 140 | 140 | $this->row = sql_fetch($this->sqlresult, $this->command['connect']); |
| 141 | - $this->pos ++; |
|
| 141 | + $this->pos++; |
|
| 142 | 142 | $this->firstseek |= true; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * Avancer et retourner les donnees pour le nouvel element |
| 147 | 147 | * @return array|bool|null |
| 148 | 148 | */ |
| 149 | - public function fetch(){ |
|
| 149 | + public function fetch() { |
|
| 150 | 150 | if ($this->valid()) { |
| 151 | 151 | $r = $this->current(); |
| 152 | 152 | $this->next(); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * liberer les ressources |
| 160 | 160 | * @return bool |
| 161 | 161 | */ |
| 162 | - public function free(){ |
|
| 162 | + public function free() { |
|
| 163 | 163 | if (!$this->sqlresult) return true; |
| 164 | 164 | $a = sql_free($this->sqlresult, $this->command['connect']); |
| 165 | 165 | $this->sqlresult = null; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | ) |
| 27 | 27 | ); |
| 28 | 28 | foreach (get_class_methods($iteratorName) as $method) { |
| 29 | - $b->show['field'][ strtolower($method) ] = 'METHOD'; |
|
| 29 | + $b->show['field'][strtolower($method)] = 'METHOD'; |
|
| 30 | 30 | } |
| 31 | 31 | /* |
| 32 | 32 | foreach (get_class_vars($iteratorName) as $property) { |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | // Diverses taches de maintenance |
| 16 | 16 | // http://doc.spip.org/@genie_maintenance_dist |
| 17 | -function genie_maintenance_dist ($t) { |
|
| 17 | +function genie_maintenance_dist($t) { |
|
| 18 | 18 | |
| 19 | 19 | // (re)mettre .htaccess avec deny from all |
| 20 | 20 | // dans les deux repertoires dits inaccessibles par http |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $crash = array(); |
| 39 | 39 | foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
| 40 | 40 | foreach ($GLOBALS[$com] as $table => $desc) { |
| 41 | - if (!sql_select('*', $table,'','','', 1) |
|
| 41 | + if (!sql_select('*', $table, '', '', '', 1) |
|
| 42 | 42 | AND !defined('spip_interdire_cache')) # cas "LOST CONNECTION" |
| 43 | 43 | $crash[] = $table; |
| 44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | function message_crash_tables() { |
| 63 | 63 | if ($crash = verifier_crash_tables()) { |
| 64 | 64 | return |
| 65 | - '<strong>' . _T('texte_recuperer_base') . '</strong><br />' |
|
| 65 | + '<strong>'._T('texte_recuperer_base').'</strong><br />' |
|
| 66 | 66 | . ' <tt>'.join(', ', $crash).'</tt><br />' |
| 67 | 67 | . generer_form_ecrire('base_repair', |
| 68 | 68 | _T('texte_crash_base'), '', |