Completed
Push — spip-3.0 ( fca166...29aaca )
by cam
07:01
created
ecrire/action/calculer_taille_cache.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
ecrire/action/annuler_job.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
ecrire/action/activer_plugins.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,26 +14,26 @@  discard block
 block discarded – undo
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
 block discarded – undo
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));
Please login to merge, or discard this patch.
ecrire/action/ajouter_lien.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@
 block discarded – undo
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));
Please login to merge, or discard this patch.
ecrire/urls/page.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -16,48 +16,48 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
ecrire/iterateur/sql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
ecrire/iterateur/php.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
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) {
Please login to merge, or discard this patch.
ecrire/genie/maintenance.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'), '',
Please login to merge, or discard this patch.
ecrire/genie/mise_a_jour.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -20,10 +20,10 @@  discard block
 block discarded – undo
20 20
  */
21 21
 function genie_mise_a_jour_dist($t) {
22 22
 	include_spip('inc/meta');
23
-	$maj = info_maj ('spip', 'SPIP', $GLOBALS['spip_version_branche']);
24
-	ecrire_meta('info_maj_spip',$maj?($GLOBALS['spip_version_branche']."|$maj"):"",'non');
23
+	$maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']);
24
+	ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : "", 'non');
25 25
 
26
-	spip_log("Verification version SPIP : ".($maj?$maj:"version a jour"),"verifie_maj");
26
+	spip_log("Verification version SPIP : ".($maj ? $maj : "version a jour"), "verifie_maj");
27 27
 	return 1;
28 28
 }
29 29
 
@@ -34,32 +34,32 @@  discard block
 block discarded – undo
34 34
 define('_VERSIONS_SERVEUR', 'http://files.spip.org/');
35 35
 define('_VERSIONS_LISTE', 'archives.xml');
36 36
 
37
-function info_maj ($dir, $file, $version){
37
+function info_maj($dir, $file, $version) {
38 38
 	include_spip('inc/plugin');
39 39
 	
40
-	list($maj,$min,$rev) = preg_split('/\D+/', $version);
40
+	list($maj, $min, $rev) = preg_split('/\D+/', $version);
41 41
 
42
-	$nom = _DIR_CACHE_XML . _VERSIONS_LISTE;
42
+	$nom = _DIR_CACHE_XML._VERSIONS_LISTE;
43 43
 	$page = !file_exists($nom) ? '' : file_get_contents($nom);
44 44
 	$page = info_maj_cache($nom, $dir, $page);
45 45
 
46 46
 	// reperer toutes les versions de numero majeur superieur ou egal
47 47
 	// (a revoir quand on arrivera a SPIP V10 ...)
48 48
 	$p = substr("0123456789", intval($maj));
49
-	$p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i';
50
-	preg_match_all($p, $page, $m,  PREG_SET_ORDER);
49
+	$p = ',/'.$file.'\D+(['.$p.']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i';
50
+	preg_match_all($p, $page, $m, PREG_SET_ORDER);
51 51
 	$page = '';
52 52
 	foreach ($m as $v) {
53 53
 		list(, $maj2, $min2,, $rev2) = $v;
54
-		$version_maj = $maj2 . '.' . $min2 . '.' . $rev2;
54
+		$version_maj = $maj2.'.'.$min2.'.'.$rev2;
55 55
 		if ((spip_version_compare($version, $version_maj, '<'))
56 56
 		AND (spip_version_compare($page, $version_maj, '<')))
57 57
 			$page = $version_maj;
58 58
 	}
59 59
 
60 60
 	if (!$page) return "";
61
-	return "<a class='info_maj_spip' href='"._VERSIONS_SERVEUR."$dir' title='$page'>" .
62
-		_T('nouvelle_version_spip',array('version'=>$page)) .
61
+	return "<a class='info_maj_spip' href='"._VERSIONS_SERVEUR."$dir' title='$page'>".
62
+		_T('nouvelle_version_spip', array('version'=>$page)).
63 63
 	    '</a>';
64 64
 }
65 65
 
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 // on teste la nouveaute par If-Modified-Since,
69 69
 // et seulement quand celui-ci a change' pour limiter les acces HTTP
70 70
 
71
-function info_maj_cache($nom, $dir, $page='')
71
+function info_maj_cache($nom, $dir, $page = '')
72 72
 {
73
-	$re = '<archives id="a' . $GLOBALS['meta']["alea_ephemere"] . '">';
73
+	$re = '<archives id="a'.$GLOBALS['meta']["alea_ephemere"].'">';
74 74
 	if (preg_match("/$re/", $page)) return $page;
75 75
 
76
-	$url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE;
76
+	$url = _VERSIONS_SERVEUR.$dir.'/'._VERSIONS_LISTE;
77 77
 	$a = file_exists($nom) ? filemtime($nom) : '';
78 78
 	include_spip('inc/distant');
79
-	$res = recuperer_lapage($url, false, 'GET', _COPIE_LOCALE_MAX_SIZE, '',false, $a);
79
+	$res = recuperer_lapage($url, false, 'GET', _COPIE_LOCALE_MAX_SIZE, '', false, $a);
80 80
 	// Si rien de neuf (ou inaccessible), garder l'ancienne
81 81
 	if ($res) list(, $page) = $res;
82 82
 	// Placer l'indicateur de fraicheur
Please login to merge, or discard this patch.