Completed
Push — master ( 410b54...85a1b0 )
by cam
01:12
created
ecrire/inc/iconifier.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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');
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  *     - ou tableau d'information sur le squelette.
37 37
  */
38 38
 function inc_iconifier_dist($objet, $id, $script, $visible = false, $flag_modif = true) {
39
-	// compat avec anciens appels
40
-	$objet = objet_type($objet);
39
+    // compat avec anciens appels
40
+    $objet = objet_type($objet);
41 41
 
42
-	return recuperer_fond('prive/objets/editer/logo',
43
-		array('objet' => $objet, 'id_objet' => $id, 'editable' => $flag_modif));
42
+    return recuperer_fond('prive/objets/editer/logo',
43
+        array('objet' => $objet, 'id_objet' => $id, 'editable' => $flag_modif));
44 44
 }
Please login to merge, or discard this patch.
ecrire/inc/lien_court.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 /*
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
  * http://zoumzamzouilam/truc/chose/machin..."
23 23
  */
24 24
 function inc_lien_court($url) {
25
-	$long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40;
26
-	$coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35;
25
+    $long_url = defined('_MAX_LONG_URL') ? _MAX_LONG_URL : 40;
26
+    $coupe_url = defined('_MAX_COUPE_URL') ? _MAX_COUPE_URL : 35;
27 27
 
28
-	if (strlen($url) > $long_url) {
29
-		$url = substr($url, 0, $coupe_url) . '...';
30
-	}
28
+    if (strlen($url) > $long_url) {
29
+        $url = substr($url, 0, $coupe_url) . '...';
30
+    }
31 31
 
32
-	return $url;
32
+    return $url;
33 33
 }
Please login to merge, or discard this patch.
ecrire/inc/log.php 1 patch
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -11,103 +11,103 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 function inc_log_dist($message, $logname = null, $logdir = null, $logsuf = null) {
18
-	static $test_repertoire = array();
19
-	static $compteur = array();
20
-	static $debugverb = ''; // pour ne pas le recalculer au reappel
21
-
22
-	if (is_null($logname) or !is_string($logname)) {
23
-		$logname = defined('_FILE_LOG') ? _FILE_LOG : 'spip';
24
-	}
25
-	if (!isset($compteur[$logname])) {
26
-		$compteur[$logname] = 0;
27
-	}
28
-	if ($logname != 'maj'
29
-		and defined('_MAX_LOG')
30
-		and (
31
-			$compteur[$logname]++ > _MAX_LOG
32
-			or !$GLOBALS['nombre_de_logs']
33
-			or !$GLOBALS['taille_des_logs']
34
-		)
35
-	) {
36
-		return;
37
-	}
38
-
39
-	$logfile = ($logdir === null ? _DIR_LOG : $logdir)
40
-		. ($logname)
41
-		. ($logsuf === null ? _FILE_LOG_SUFFIX : $logsuf);
42
-
43
-	if (!isset($test_repertoire[$d = dirname($logfile)])) {
44
-		$test_repertoire[$d] = false; // eviter une recursivite en cas d'erreur de sous_repertoire
45
-		$test_repertoire[$d] = (@is_dir($d) ? true : (function_exists('sous_repertoire') ? sous_repertoire(
46
-			$d,
47
-			'',
48
-			false,
49
-			true
50
-		) : false));
51
-	}
52
-
53
-	// si spip_log() dans mes_options, ou repertoire log/ non present, poser dans tmp/
54
-	if (!defined('_DIR_LOG') or !$test_repertoire[$d]) {
55
-		$logfile = _DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES . $logname . '.log';
56
-	}
57
-
58
-	$rotate = 0;
59
-	$pid = '(pid ' . @getmypid() . ')';
60
-
61
-	// accepter spip_log( Array )
62
-	if (!is_string($message)) {
63
-		$message = var_export($message, true);
64
-	}
65
-
66
-	if (!$debugverb and defined('_LOG_FILELINE') and _LOG_FILELINE) {
67
-		$debug = debug_backtrace();
68
-		$l = $debug[1]['line'];
69
-		$fi = $debug[1]['file'];
70
-		if (strncmp($fi, _ROOT_RACINE, strlen(_ROOT_RACINE)) == 0) {
71
-			$fi = substr($fi, strlen(_ROOT_RACINE));
72
-		}
73
-		$fu = isset($debug[2]['function']) ? $debug[2]['function'] : '';
74
-		$debugverb = "$fi:L$l:$fu" . '():';
75
-	}
76
-
77
-	$m = date('Y-m-d H:i:s') . ' ' . (isset($GLOBALS['ip']) ? $GLOBALS['ip'] : '') . ' ' . $pid . ' '
78
-		//distinguer les logs prives et publics dans les grep
79
-		. $debugverb
80
-		. (test_espace_prive() ? ':Pri:' : ':Pub:')
81
-		. preg_replace("/\n*$/", "\n", $message);
82
-
83
-
84
-	if (@is_readable($logfile)
85
-		and (!$s = @filesize($logfile) or $s > $GLOBALS['taille_des_logs'] * 1024)
86
-	) {
87
-		$rotate = $GLOBALS['nombre_de_logs'];
88
-		$m .= "[-- rotate --]\n";
89
-	}
90
-
91
-	$f = @fopen($logfile, 'ab');
92
-	if ($f) {
93
-		fputs($f, (defined('_LOG_BRUT') and _LOG_BRUT) ? $m : str_replace('<', '&lt;', $m));
94
-		fclose($f);
95
-	}
96
-
97
-	if ($rotate-- > 0
98
-		and function_exists('spip_unlink')
99
-	) {
100
-		spip_unlink($logfile . '.' . $rotate);
101
-		while ($rotate--) {
102
-			@rename($logfile . ($rotate ? '.' . $rotate : ''), $logfile . '.' . ($rotate + 1));
103
-		}
104
-	}
105
-
106
-	// Dupliquer les erreurs specifiques dans le log general
107
-	if ($logname !== _FILE_LOG
108
-		and defined('_FILE_LOG')
109
-	) {
110
-		inc_log_dist($logname == 'maj' ? 'cf maj.log' : $message);
111
-	}
112
-	$debugverb = '';
18
+    static $test_repertoire = array();
19
+    static $compteur = array();
20
+    static $debugverb = ''; // pour ne pas le recalculer au reappel
21
+
22
+    if (is_null($logname) or !is_string($logname)) {
23
+        $logname = defined('_FILE_LOG') ? _FILE_LOG : 'spip';
24
+    }
25
+    if (!isset($compteur[$logname])) {
26
+        $compteur[$logname] = 0;
27
+    }
28
+    if ($logname != 'maj'
29
+        and defined('_MAX_LOG')
30
+        and (
31
+            $compteur[$logname]++ > _MAX_LOG
32
+            or !$GLOBALS['nombre_de_logs']
33
+            or !$GLOBALS['taille_des_logs']
34
+        )
35
+    ) {
36
+        return;
37
+    }
38
+
39
+    $logfile = ($logdir === null ? _DIR_LOG : $logdir)
40
+        . ($logname)
41
+        . ($logsuf === null ? _FILE_LOG_SUFFIX : $logsuf);
42
+
43
+    if (!isset($test_repertoire[$d = dirname($logfile)])) {
44
+        $test_repertoire[$d] = false; // eviter une recursivite en cas d'erreur de sous_repertoire
45
+        $test_repertoire[$d] = (@is_dir($d) ? true : (function_exists('sous_repertoire') ? sous_repertoire(
46
+            $d,
47
+            '',
48
+            false,
49
+            true
50
+        ) : false));
51
+    }
52
+
53
+    // si spip_log() dans mes_options, ou repertoire log/ non present, poser dans tmp/
54
+    if (!defined('_DIR_LOG') or !$test_repertoire[$d]) {
55
+        $logfile = _DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES . $logname . '.log';
56
+    }
57
+
58
+    $rotate = 0;
59
+    $pid = '(pid ' . @getmypid() . ')';
60
+
61
+    // accepter spip_log( Array )
62
+    if (!is_string($message)) {
63
+        $message = var_export($message, true);
64
+    }
65
+
66
+    if (!$debugverb and defined('_LOG_FILELINE') and _LOG_FILELINE) {
67
+        $debug = debug_backtrace();
68
+        $l = $debug[1]['line'];
69
+        $fi = $debug[1]['file'];
70
+        if (strncmp($fi, _ROOT_RACINE, strlen(_ROOT_RACINE)) == 0) {
71
+            $fi = substr($fi, strlen(_ROOT_RACINE));
72
+        }
73
+        $fu = isset($debug[2]['function']) ? $debug[2]['function'] : '';
74
+        $debugverb = "$fi:L$l:$fu" . '():';
75
+    }
76
+
77
+    $m = date('Y-m-d H:i:s') . ' ' . (isset($GLOBALS['ip']) ? $GLOBALS['ip'] : '') . ' ' . $pid . ' '
78
+        //distinguer les logs prives et publics dans les grep
79
+        . $debugverb
80
+        . (test_espace_prive() ? ':Pri:' : ':Pub:')
81
+        . preg_replace("/\n*$/", "\n", $message);
82
+
83
+
84
+    if (@is_readable($logfile)
85
+        and (!$s = @filesize($logfile) or $s > $GLOBALS['taille_des_logs'] * 1024)
86
+    ) {
87
+        $rotate = $GLOBALS['nombre_de_logs'];
88
+        $m .= "[-- rotate --]\n";
89
+    }
90
+
91
+    $f = @fopen($logfile, 'ab');
92
+    if ($f) {
93
+        fputs($f, (defined('_LOG_BRUT') and _LOG_BRUT) ? $m : str_replace('<', '&lt;', $m));
94
+        fclose($f);
95
+    }
96
+
97
+    if ($rotate-- > 0
98
+        and function_exists('spip_unlink')
99
+    ) {
100
+        spip_unlink($logfile . '.' . $rotate);
101
+        while ($rotate--) {
102
+            @rename($logfile . ($rotate ? '.' . $rotate : ''), $logfile . '.' . ($rotate + 1));
103
+        }
104
+    }
105
+
106
+    // Dupliquer les erreurs specifiques dans le log general
107
+    if ($logname !== _FILE_LOG
108
+        and defined('_FILE_LOG')
109
+    ) {
110
+        inc_log_dist($logname == 'maj' ? 'cf maj.log' : $message);
111
+    }
112
+    $debugverb = '';
113 113
 }
Please login to merge, or discard this patch.
ecrire/inc/nfslock.php 1 patch
Indentation   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  **/
8 8
 
9 9
 if (!defined('_ECRIRE_INC_VERSION')) {
10
-	return;
10
+    return;
11 11
 }
12 12
 
13 13
 include_spip('inc/acces');
@@ -101,93 +101,93 @@  discard block
 block discarded – undo
101 101
  * @return int|bool Timestamp du verrou, false si erreur
102 102
  */
103 103
 function spip_nfslock($fichier, $max_age = 0) {
104
-	$tries = 0;
104
+    $tries = 0;
105 105
 
106
-	if (!$max_age) {
107
-		$max_age = _DEFAULT_LOCKTIME;
108
-	}
109
-	$lock_file = _DIR_TMP . _NAME_LOCK . '-' . substr(md5($fichier), 0, 8);
106
+    if (!$max_age) {
107
+        $max_age = _DEFAULT_LOCKTIME;
108
+    }
109
+    $lock_file = _DIR_TMP . _NAME_LOCK . '-' . substr(md5($fichier), 0, 8);
110 110
 
111 111
 
112
-	/*
112
+    /*
113 113
 	 * 1. create a tmp file with a psuedo random file name. we also make
114 114
 	 *    tpath which is a buffer to store the full pathname of the tmp file.
115 115
 	 */
116 116
 
117
-	$id = creer_uniqid();
118
-	$tpath = _DIR_TMP . "slock.$id";
119
-	$tmpfd = @fopen($tpath, 'w'); // hum, le 'x' necessite php4,3,2 ...
120
-	if (!$tmpfd) {  /* open failed */
121
-		@fclose($tmpfd);
122
-		spip_unlink($tpath);
117
+    $id = creer_uniqid();
118
+    $tpath = _DIR_TMP . "slock.$id";
119
+    $tmpfd = @fopen($tpath, 'w'); // hum, le 'x' necessite php4,3,2 ...
120
+    if (!$tmpfd) {  /* open failed */
121
+        @fclose($tmpfd);
122
+        spip_unlink($tpath);
123 123
 
124
-		return false; //NFSL_SYSF
125
-	}
124
+        return false; //NFSL_SYSF
125
+    }
126 126
 
127
-	/*
127
+    /*
128 128
 	 * 2. make fullpath, a buffer for the full pathname of the lock file.
129 129
 	 *    then start looping trying to lock it
130 130
 	 */
131 131
 
132
-	while ($tries < 10) {
133
-		/*
132
+    while ($tries < 10) {
133
+        /*
134 134
 		 * 3. link tmp file to lock file.  if it goes, we win and we clean
135 135
 		 *    up and return the st_ctime of the lock file.
136 136
 		 */
137 137
 
138
-		if (link($tpath, $lock_file) == 1) {
139
-			spip_unlink($tpath); /* got it! */
140
-			@fclose($tmpfd);
141
-			if (($our_tmp = lstat($lock_file)) == false) {  /* stat failed... shouldn't happen */
142
-				spip_unlink($lock_file);
138
+        if (link($tpath, $lock_file) == 1) {
139
+            spip_unlink($tpath); /* got it! */
140
+            @fclose($tmpfd);
141
+            if (($our_tmp = lstat($lock_file)) == false) {  /* stat failed... shouldn't happen */
142
+                spip_unlink($lock_file);
143 143
 
144
-				return false; // (NFSL_SYSF);
145
-			}
144
+                return false; // (NFSL_SYSF);
145
+            }
146 146
 
147
-			return ($our_tmp['ctime']);
148
-		}
147
+            return ($our_tmp['ctime']);
148
+        }
149 149
 
150
-		/*
150
+        /*
151 151
 		 * 4. the lock failed.  check for a stale lock file, being mindful
152 152
 		 *    of NFS and the fact the time is set from the NFS server.  we
153 153
 		 *    do a write on the tmp file to update its time to the server's
154 154
 		 *    idea of "now."
155 155
 		 */
156 156
 
157
-		$old_stat = lstat($lock_file);
158
-		if (@fputs($tmpfd, 'zz', 2) != 2 || !$our_tmp = fstat($tmpfd)) {
159
-			break;
160
-		} /* something bogus is going on */
157
+        $old_stat = lstat($lock_file);
158
+        if (@fputs($tmpfd, 'zz', 2) != 2 || !$our_tmp = fstat($tmpfd)) {
159
+            break;
160
+        } /* something bogus is going on */
161 161
 
162 162
 
163
-		if ($old_stat != false && (($old_stat['ctime'] + $max_age) < $our_tmp['ctime'])) {
164
-			spip_unlink($lock_file); /* break the stale lock */
165
-			$tries++;
166
-			/* It is CRITICAL that we sleep after breaking
163
+        if ($old_stat != false && (($old_stat['ctime'] + $max_age) < $our_tmp['ctime'])) {
164
+            spip_unlink($lock_file); /* break the stale lock */
165
+            $tries++;
166
+            /* It is CRITICAL that we sleep after breaking
167 167
 			 * the lock. Otherwise, we could race with
168 168
 			 * another process and unlink it's newly-
169 169
 			 * created file.
170 170
 			 */
171
-			sleep(1 + rand(0, 4));
172
-			continue;
173
-		}
171
+            sleep(1 + rand(0, 4));
172
+            continue;
173
+        }
174 174
 
175
-		/*
175
+        /*
176 176
 		 * 5. try again
177 177
 		 */
178 178
 
179
-		$tries++;
180
-		sleep(1 + rand(0, 4));
181
-	}
179
+        $tries++;
180
+        sleep(1 + rand(0, 4));
181
+    }
182 182
 
183
-	/*
183
+    /*
184 184
 	 * 6. give up, failure.
185 185
 	 */
186 186
 
187
-	spip_unlink($tpath);
188
-	@fclose($tmpfd);
187
+    spip_unlink($tpath);
188
+    @fclose($tmpfd);
189 189
 
190
-	return false; //(NFSL_LOCKED);
190
+    return false; //(NFSL_LOCKED);
191 191
 }
192 192
 
193 193
 /**
@@ -231,73 +231,73 @@  discard block
 block discarded – undo
231 231
  * return bool true si déverrouillé, false sinon
232 232
  */
233 233
 function spip_nfsunlock($fichier, $birth, $max_age = 0, $test = false) {
234
-	$id = creer_uniqid();
235
-	if (!$max_age) {
236
-		$max_age = _DEFAULT_LOCKTIME;
237
-	}
234
+    $id = creer_uniqid();
235
+    if (!$max_age) {
236
+        $max_age = _DEFAULT_LOCKTIME;
237
+    }
238 238
 
239
-	/*
239
+    /*
240 240
 	 * 1. Build a temp file and stat that to get an idea of what the server
241 241
 	 *    thinks the current time is (our_tmp.st_ctime)..
242 242
 	 */
243 243
 
244
-	$tpath = _DIR_TMP . "stime.$id";
245
-	$tmpfd = @fopen($tpath, 'w');
246
-	if ((!$tmpfd)
247
-		or (@fputs($tmpfd, 'zz', 2) != 2)
248
-		or !($our_tmp = fstat($tmpfd))
249
-	) {
250
-		/* The open failed, or we can't write the file, or we can't stat it */
251
-		@fclose($tmpfd);
252
-		spip_unlink($tpath);
244
+    $tpath = _DIR_TMP . "stime.$id";
245
+    $tmpfd = @fopen($tpath, 'w');
246
+    if ((!$tmpfd)
247
+        or (@fputs($tmpfd, 'zz', 2) != 2)
248
+        or !($our_tmp = fstat($tmpfd))
249
+    ) {
250
+        /* The open failed, or we can't write the file, or we can't stat it */
251
+        @fclose($tmpfd);
252
+        spip_unlink($tpath);
253 253
 
254
-		return false; //(NFSL_SYSF);
255
-	}
254
+        return false; //(NFSL_SYSF);
255
+    }
256 256
 
257
-	@fclose($tmpfd);    /* We don't need this once we have our_tmp.st_ctime. */
258
-	spip_unlink($tpath);
257
+    @fclose($tmpfd);    /* We don't need this once we have our_tmp.st_ctime. */
258
+    spip_unlink($tpath);
259 259
 
260
-	/*
260
+    /*
261 261
 	 * 2. make fullpath, a buffer for the full pathname of the lock file
262 262
 	 */
263 263
 
264
-	$lock_file = _DIR_TMP . _NAME_LOCK . '-' . substr(md5($fichier), 0, 8);
264
+    $lock_file = _DIR_TMP . _NAME_LOCK . '-' . substr(md5($fichier), 0, 8);
265 265
 
266
-	/*
266
+    /*
267 267
 	 * 3. If the ctime hasn't been modified, unlink the file and return. If the
268 268
 	 *    lock has expired, sleep the usual random interval before returning.
269 269
 	 *    If we didn't sleep, there could be a race if the caller immediately
270 270
 	 *    tries to relock the file.
271 271
 	 */
272 272
 
273
-	if (($old_stat = @lstat($lock_file))  /* stat succeeds so file is there */
274
-		&& ($old_stat['ctime'] == $birth)
275
-	) {  /* hasn't been modified since birth */
276
-		if (!$test) {
277
-			spip_unlink($lock_file);
278
-		}      /* so the lock is ours to remove */
279
-		if ($our_tmp['ctime'] >= $birth + $max_age) {  /* the lock has expired */
280
-			if (!$test) {
281
-				return false;
282
-			} //(NFSL_LOST);
283
-			sleep(1 + (random(0, 4)));    /* so sleep a bit */
284
-		}
285
-
286
-		return true;//(NFSL_OK);			/* success */
287
-	}
288
-
289
-	/*
273
+    if (($old_stat = @lstat($lock_file))  /* stat succeeds so file is there */
274
+        && ($old_stat['ctime'] == $birth)
275
+    ) {  /* hasn't been modified since birth */
276
+        if (!$test) {
277
+            spip_unlink($lock_file);
278
+        }      /* so the lock is ours to remove */
279
+        if ($our_tmp['ctime'] >= $birth + $max_age) {  /* the lock has expired */
280
+            if (!$test) {
281
+                return false;
282
+            } //(NFSL_LOST);
283
+            sleep(1 + (random(0, 4)));    /* so sleep a bit */
284
+        }
285
+
286
+        return true;//(NFSL_OK);			/* success */
287
+    }
288
+
289
+    /*
290 290
 	 * 4. Either ctime has been modified, or the entire lock file is missing.
291 291
 	 *    If the lock should still be ours, based on the ctime of the temp
292 292
 	 *    file, return with NFSL_STOLEN. If not, then our lock is expired and
293 293
 	 *    someone else has grabbed the file, so return NFSL_LOST.
294 294
 	 */
295 295
 
296
-	if ($our_tmp['ctime'] < $birth + $max_age) { /* lock was stolen */
297
-		return false;
298
-	} //(NFSL_STOLEN);
296
+    if ($our_tmp['ctime'] < $birth + $max_age) { /* lock was stolen */
297
+        return false;
298
+    } //(NFSL_STOLEN);
299 299
 
300
-	return false; //(NFSL_LOST);	/* The lock must have expired first. */
300
+    return false; //(NFSL_LOST);	/* The lock must have expired first. */
301 301
 }
302 302
 
303 303
 
@@ -321,5 +321,5 @@  discard block
 block discarded – undo
321 321
  * return bool true si déverrouillé, false sinon
322 322
  */
323 323
 function spip_nfslock_test($fichier, $birth, $max_age = 0) {
324
-	return spip_nfsunlock($fichier, $birth, $max_age, true);
324
+    return spip_nfsunlock($fichier, $birth, $max_age, true);
325 325
 }
Please login to merge, or discard this patch.
ecrire/inc/roles.php 1 patch
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  */
29 29
 
30 30
 if (!defined('_ECRIRE_INC_VERSION')) {
31
-	return;
31
+    return;
32 32
 }
33 33
 
34 34
 
@@ -48,55 +48,55 @@  discard block
 block discarded – undo
48 48
  *     array : description des roles applicables dans 3 index : colonne, titres, roles
49 49
  **/
50 50
 function roles_presents($objet, $objet_destination = '') {
51
-	$desc = lister_tables_objets_sql(table_objet_sql($objet));
52
-
53
-	// pas de liste de roles, on sort
54
-	if (!isset($desc['roles_titres']) or !($titres = $desc['roles_titres'])) {
55
-		return false;
56
-	}
57
-
58
-	// on vérifie que la table de liaison existe
59
-	include_spip('action/editer_liens');
60
-	if (!$lien = objet_associable($objet)) {
61
-		return false;
62
-	}
63
-
64
-	// on cherche ensuite si la colonne existe bien dans la table de liaison (par défaut 'role')
65
-	$colonne = isset($desc['roles_colonne']) ? $desc['roles_colonne'] : 'role';
66
-	$trouver_table = charger_fonction('trouver_table', 'base');
67
-	list(, $table_lien) = $lien;
68
-	$desc_lien = $trouver_table($table_lien);
69
-	if (!isset($desc_lien['field'][$colonne])) {
70
-		return false;
71
-	}
72
-
73
-	// sur quoi peuvent s'appliquer nos rôles
74
-	if (!$application = $desc['roles_objets']) {
75
-		return false;
76
-	}
77
-
78
-	// destination presente, on restreint si possible
79
-	if ($objet_destination) {
80
-		$objet_destination = table_objet($objet_destination);
81
-
82
-		// pour l'objet
83
-		if (isset($application[$objet_destination])) {
84
-			$application = $application[$objet_destination];
85
-			// sinon pour tous les objets
86
-		} elseif (isset($application['*'])) {
87
-			$application = $application['*'];
88
-		} // sinon tant pis
89
-		else {
90
-			return false;
91
-		}
92
-	}
93
-
94
-	// tout est ok
95
-	return array(
96
-		'titres' => $titres,
97
-		'roles' => $application,
98
-		'colonne' => $colonne
99
-	);
51
+    $desc = lister_tables_objets_sql(table_objet_sql($objet));
52
+
53
+    // pas de liste de roles, on sort
54
+    if (!isset($desc['roles_titres']) or !($titres = $desc['roles_titres'])) {
55
+        return false;
56
+    }
57
+
58
+    // on vérifie que la table de liaison existe
59
+    include_spip('action/editer_liens');
60
+    if (!$lien = objet_associable($objet)) {
61
+        return false;
62
+    }
63
+
64
+    // on cherche ensuite si la colonne existe bien dans la table de liaison (par défaut 'role')
65
+    $colonne = isset($desc['roles_colonne']) ? $desc['roles_colonne'] : 'role';
66
+    $trouver_table = charger_fonction('trouver_table', 'base');
67
+    list(, $table_lien) = $lien;
68
+    $desc_lien = $trouver_table($table_lien);
69
+    if (!isset($desc_lien['field'][$colonne])) {
70
+        return false;
71
+    }
72
+
73
+    // sur quoi peuvent s'appliquer nos rôles
74
+    if (!$application = $desc['roles_objets']) {
75
+        return false;
76
+    }
77
+
78
+    // destination presente, on restreint si possible
79
+    if ($objet_destination) {
80
+        $objet_destination = table_objet($objet_destination);
81
+
82
+        // pour l'objet
83
+        if (isset($application[$objet_destination])) {
84
+            $application = $application[$objet_destination];
85
+            // sinon pour tous les objets
86
+        } elseif (isset($application['*'])) {
87
+            $application = $application['*'];
88
+        } // sinon tant pis
89
+        else {
90
+            return false;
91
+        }
92
+    }
93
+
94
+    // tout est ok
95
+    return array(
96
+        'titres' => $titres,
97
+        'roles' => $application,
98
+        'colonne' => $colonne
99
+    );
100 100
 }
101 101
 
102 102
 /**
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
  *     Nom de la colonne, sinon vide
111 111
  **/
112 112
 function roles_colonne($objet, $objet_destination) {
113
-	if ($roles = roles_presents($objet, $objet_destination)) {
114
-		return $roles['colonne'];
115
-	}
113
+    if ($roles = roles_presents($objet, $objet_destination)) {
114
+        return $roles['colonne'];
115
+    }
116 116
 
117
-	return '';
117
+    return '';
118 118
 }
119 119
 
120 120
 
@@ -136,23 +136,23 @@  discard block
 block discarded – undo
136 136
  *     Liste ('', '', array()) sinon.
137 137
  **/
138 138
 function roles_trouver_dans_qualif($objet, $objet_destination, $qualif = array()) {
139
-	// si des rôles sont possibles, on les utilise
140
-	$role = $colonne_role = ''; # role défini
141
-	// condition du where par defaut
142
-	$cond = array();
143
-	if ($roles = roles_presents($objet, $objet_destination)) {
144
-		$colonne_role = $roles['colonne'];
145
-		// qu'il n'est pas défini
146
-		if (!isset($qualif[$colonne_role])
147
-			or !($role = $qualif[$colonne_role])
148
-		) {
149
-			$role = $roles['roles']['defaut'];
150
-		}
151
-		// where
152
-		$cond = array("$colonne_role=" . sql_quote($role));
153
-	}
154
-
155
-	return array($role, $colonne_role, $cond);
139
+    // si des rôles sont possibles, on les utilise
140
+    $role = $colonne_role = ''; # role défini
141
+    // condition du where par defaut
142
+    $cond = array();
143
+    if ($roles = roles_presents($objet, $objet_destination)) {
144
+        $colonne_role = $roles['colonne'];
145
+        // qu'il n'est pas défini
146
+        if (!isset($qualif[$colonne_role])
147
+            or !($role = $qualif[$colonne_role])
148
+        ) {
149
+            $role = $roles['roles']['defaut'];
150
+        }
151
+        // where
152
+        $cond = array("$colonne_role=" . sql_quote($role));
153
+    }
154
+
155
+    return array($role, $colonne_role, $cond);
156 156
 }
157 157
 
158 158
 /**
@@ -174,21 +174,21 @@  discard block
 block discarded – undo
174 174
  *     Liste (Tableau de conditions where complété du role, Colonne du role, role utilisé)
175 175
  **/
176 176
 function roles_creer_condition_role($objet_source, $objet, $cond, $tous_si_absent = false) {
177
-	// role par défaut, colonne
178
-	list($role_defaut, $colonne_role) = roles_trouver_dans_qualif($objet_source, $objet);
177
+    // role par défaut, colonne
178
+    list($role_defaut, $colonne_role) = roles_trouver_dans_qualif($objet_source, $objet);
179 179
 
180
-	// chercher d'eventuels rôles transmis
181
-	$role = (isset($cond['role']) ? $cond['role'] : ($tous_si_absent ? '*' : $role_defaut));
182
-	unset($cond['role']); // cette condition est particuliere...
180
+    // chercher d'eventuels rôles transmis
181
+    $role = (isset($cond['role']) ? $cond['role'] : ($tous_si_absent ? '*' : $role_defaut));
182
+    unset($cond['role']); // cette condition est particuliere...
183 183
 
184
-	if ($colonne_role) {
185
-		// on ajoute la condition du role aux autres conditions.
186
-		if ($role != '*') {
187
-			$cond[] = "$colonne_role=" . sql_quote($role);
188
-		}
189
-	}
184
+    if ($colonne_role) {
185
+        // on ajoute la condition du role aux autres conditions.
186
+        if ($role != '*') {
187
+            $cond[] = "$colonne_role=" . sql_quote($role);
188
+        }
189
+    }
190 190
 
191
-	return array($cond, $colonne_role, $role);
191
+    return array($cond, $colonne_role, $role);
192 192
 }
193 193
 
194 194
 /**
@@ -210,28 +210,28 @@  discard block
 block discarded – undo
210 210
  */
211 211
 function roles_complets($objet_source, $objet, $id_objet, $objet_lien) {
212 212
 
213
-	$presents = roles_presents_liaisons($objet_source, $objet, $id_objet, $objet_lien);
214
-	// pas de roles sur ces objets => la liste par defaut, comme sans role
215
-	if ($presents === false) {
216
-		return lister_objets_lies($objet_source, $objet, $id_objet, $objet_lien);
217
-	}
218
-
219
-	// types de roles possibles
220
-	$roles_possibles = $presents['roles']['roles']['choix'];
221
-	// couples id / roles
222
-	$ids = $presents['ids'];
223
-
224
-	// pour chaque groupe, on fait le diff entre tous les roles possibles
225
-	// et les roles attribués à l'élément : s'il en reste, c'est que l'élément
226
-	// n'est pas complet
227
-	$complets = array();
228
-	foreach ($ids as $id => $roles_presents) {
229
-		if (!array_diff($roles_possibles, $roles_presents)) {
230
-			$complets[] = $id;
231
-		}
232
-	}
233
-
234
-	return $complets;
213
+    $presents = roles_presents_liaisons($objet_source, $objet, $id_objet, $objet_lien);
214
+    // pas de roles sur ces objets => la liste par defaut, comme sans role
215
+    if ($presents === false) {
216
+        return lister_objets_lies($objet_source, $objet, $id_objet, $objet_lien);
217
+    }
218
+
219
+    // types de roles possibles
220
+    $roles_possibles = $presents['roles']['roles']['choix'];
221
+    // couples id / roles
222
+    $ids = $presents['ids'];
223
+
224
+    // pour chaque groupe, on fait le diff entre tous les roles possibles
225
+    // et les roles attribués à l'élément : s'il en reste, c'est que l'élément
226
+    // n'est pas complet
227
+    $complets = array();
228
+    foreach ($ids as $id => $roles_presents) {
229
+        if (!array_diff($roles_possibles, $roles_presents)) {
230
+            $complets[] = $id;
231
+        }
232
+    }
233
+
234
+    return $complets;
235 235
 }
236 236
 
237 237
 
@@ -248,17 +248,17 @@  discard block
 block discarded – undo
248 248
  */
249 249
 function roles_presents_sur_id($id_objet_source, $objet_source, $objet, $id_objet, $objet_lien) {
250 250
 
251
-	$presents = roles_presents_liaisons($objet_source, $objet, $id_objet, $objet_lien);
252
-	// pas de roles sur ces objets => la liste par defaut, comme sans role
253
-	if ($presents === false) {
254
-		return array();
255
-	}
251
+    $presents = roles_presents_liaisons($objet_source, $objet, $id_objet, $objet_lien);
252
+    // pas de roles sur ces objets => la liste par defaut, comme sans role
253
+    if ($presents === false) {
254
+        return array();
255
+    }
256 256
 
257
-	if (!isset($presents['ids'][$id_objet_source])) {
258
-		return array();
259
-	}
257
+    if (!isset($presents['ids'][$id_objet_source])) {
258
+        return array();
259
+    }
260 260
 
261
-	return $presents['ids'][$id_objet_source];
261
+    return $presents['ids'][$id_objet_source];
262 262
 }
263 263
 
264 264
 
@@ -286,47 +286,47 @@  discard block
 block discarded – undo
286 286
  *     - False si pas de role déclarés
287 287
  */
288 288
 function roles_presents_liaisons($objet_source, $objet, $id_objet, $objet_lien) {
289
-	static $done = array();
290
-
291
-	// stocker le résultat
292
-	$hash = "$objet_source-$objet-$id_objet-$objet_lien";
293
-	if (isset($done[$hash])) {
294
-		return $done[$hash];
295
-	}
296
-
297
-	// pas de roles sur ces objets, on sort
298
-	$roles = roles_presents($objet_lien, ($objet_lien == $objet) ? $objet_source : $objet);
299
-	if (!$roles) {
300
-		return $done[$hash] = false;
301
-	}
302
-
303
-	// inspiré de lister_objets_lies()
304
-	if ($objet_lien == $objet) {
305
-		$res = objet_trouver_liens(array($objet => $id_objet), array($objet_source => '*'));
306
-	} else {
307
-		$res = objet_trouver_liens(array($objet_source => '*'), array($objet => $id_objet));
308
-	}
309
-
310
-	// types de roles possibles
311
-	$roles_possibles = $roles['roles']['choix'];
312
-	// colonne du role
313
-	$colonne = $roles['colonne'];
314
-
315
-	// on recupere par id, et role existant
316
-	$ids = array();
317
-	while ($row = array_shift($res)) {
318
-		$id = $row[$objet_source];
319
-		if (!isset($ids[$id])) {
320
-			$ids[$id] = array();
321
-		}
322
-		// tableau des roles présents
323
-		$ids[$id][] = $row[$colonne];
324
-	}
325
-
326
-	return $done[$hash] = array(
327
-		'roles' => $roles,
328
-		'ids' => $ids
329
-	);
289
+    static $done = array();
290
+
291
+    // stocker le résultat
292
+    $hash = "$objet_source-$objet-$id_objet-$objet_lien";
293
+    if (isset($done[$hash])) {
294
+        return $done[$hash];
295
+    }
296
+
297
+    // pas de roles sur ces objets, on sort
298
+    $roles = roles_presents($objet_lien, ($objet_lien == $objet) ? $objet_source : $objet);
299
+    if (!$roles) {
300
+        return $done[$hash] = false;
301
+    }
302
+
303
+    // inspiré de lister_objets_lies()
304
+    if ($objet_lien == $objet) {
305
+        $res = objet_trouver_liens(array($objet => $id_objet), array($objet_source => '*'));
306
+    } else {
307
+        $res = objet_trouver_liens(array($objet_source => '*'), array($objet => $id_objet));
308
+    }
309
+
310
+    // types de roles possibles
311
+    $roles_possibles = $roles['roles']['choix'];
312
+    // colonne du role
313
+    $colonne = $roles['colonne'];
314
+
315
+    // on recupere par id, et role existant
316
+    $ids = array();
317
+    while ($row = array_shift($res)) {
318
+        $id = $row[$objet_source];
319
+        if (!isset($ids[$id])) {
320
+            $ids[$id] = array();
321
+        }
322
+        // tableau des roles présents
323
+        $ids[$id][] = $row[$colonne];
324
+    }
325
+
326
+    return $done[$hash] = array(
327
+        'roles' => $roles,
328
+        'ids' => $ids
329
+    );
330 330
 }
331 331
 
332 332
 
@@ -344,33 +344,33 @@  discard block
 block discarded – undo
344 344
  *     - false si pas de role déclarés
345 345
  */
346 346
 function roles_connus_en_base($objet_source, $objet, $objet_lien) {
347
-	static $done = array();
348
-
349
-	// stocker le résultat
350
-	$hash = "$objet_source-$objet-$objet_lien";
351
-	if (isset($done[$hash])) {
352
-		return $done[$hash];
353
-	}
354
-
355
-	if (!$lien = objet_associable($objet_lien)) {
356
-		return $done[$hash] = false;
357
-	}
358
-
359
-	// pas de roles sur ces objets, on sort
360
-	$roles = roles_presents($objet_lien, ($objet_lien == $objet) ? $objet_source : $objet);
361
-	if (!$roles) {
362
-		return $done[$hash] = false;
363
-	}
364
-
365
-	list($primary, $l) = $lien;
366
-	$colone_role = $roles['colonne'];
367
-
368
-	$all = sql_allfetsel(
369
-		"DISTINCT $colone_role",
370
-		$l,
371
-		'objet=' . sql_quote(($objet_source == $objet_lien) ? $objet : $objet_source)
372
-	);
373
-	$done[$hash] = array_map('reset', $all);
374
-
375
-	return $done[$hash];
347
+    static $done = array();
348
+
349
+    // stocker le résultat
350
+    $hash = "$objet_source-$objet-$objet_lien";
351
+    if (isset($done[$hash])) {
352
+        return $done[$hash];
353
+    }
354
+
355
+    if (!$lien = objet_associable($objet_lien)) {
356
+        return $done[$hash] = false;
357
+    }
358
+
359
+    // pas de roles sur ces objets, on sort
360
+    $roles = roles_presents($objet_lien, ($objet_lien == $objet) ? $objet_source : $objet);
361
+    if (!$roles) {
362
+        return $done[$hash] = false;
363
+    }
364
+
365
+    list($primary, $l) = $lien;
366
+    $colone_role = $roles['colonne'];
367
+
368
+    $all = sql_allfetsel(
369
+        "DISTINCT $colone_role",
370
+        $l,
371
+        'objet=' . sql_quote(($objet_source == $objet_lien) ? $objet : $objet_source)
372
+    );
373
+    $done[$hash] = array_map('reset', $all);
374
+
375
+    return $done[$hash];
376 376
 }
Please login to merge, or discard this patch.
ecrire/inc/simplexml_to_array.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  * @return array
24 24
  */
25 25
 function inc_simplexml_to_array_dist($u, $utiliser_namespace = false) {
26
-	// decoder la chaine en SimpleXML si pas deja fait
27
-	if (is_string($u)) {
28
-		$u = simplexml_load_string($u);
29
-	}
26
+    // decoder la chaine en SimpleXML si pas deja fait
27
+    if (is_string($u)) {
28
+        $u = simplexml_load_string($u);
29
+    }
30 30
 
31
-	return array('root' => @xmlObjToArr($u, $utiliser_namespace));
31
+    return array('root' => @xmlObjToArr($u, $utiliser_namespace));
32 32
 }
33 33
 
34 34
 
@@ -43,66 +43,66 @@  discard block
 block discarded – undo
43 43
  **/
44 44
 function xmlObjToArr($obj, $utiliser_namespace = false) {
45 45
 
46
-	$tableau = array();
46
+    $tableau = array();
47 47
 
48
-	// Cette fonction getDocNamespaces() est longue sur de gros xml. On permet donc
49
-	// de l'activer ou pas suivant le contenu supposé du XML
50
-	if (is_object($obj)) {
51
-		if (is_array($utiliser_namespace)) {
52
-			$namespace = $utiliser_namespace;
53
-		} else {
54
-			if ($utiliser_namespace) {
55
-				$namespace = $obj->getDocNamespaces(true);
56
-			}
57
-			$namespace[null] = null;
58
-		}
48
+    // Cette fonction getDocNamespaces() est longue sur de gros xml. On permet donc
49
+    // de l'activer ou pas suivant le contenu supposé du XML
50
+    if (is_object($obj)) {
51
+        if (is_array($utiliser_namespace)) {
52
+            $namespace = $utiliser_namespace;
53
+        } else {
54
+            if ($utiliser_namespace) {
55
+                $namespace = $obj->getDocNamespaces(true);
56
+            }
57
+            $namespace[null] = null;
58
+        }
59 59
 
60
-		$name = strtolower((string)$obj->getName());
61
-		$text = trim((string)$obj);
62
-		if (strlen($text) <= 0) {
63
-			$text = null;
64
-		}
60
+        $name = strtolower((string)$obj->getName());
61
+        $text = trim((string)$obj);
62
+        if (strlen($text) <= 0) {
63
+            $text = null;
64
+        }
65 65
 
66
-		$children = array();
67
-		$attributes = array();
66
+        $children = array();
67
+        $attributes = array();
68 68
 
69
-		// get info for all namespaces
70
-		foreach ($namespace as $ns => $nsUrl) {
71
-			// attributes
72
-			$objAttributes = $obj->attributes($ns, true);
73
-			foreach ($objAttributes as $attributeName => $attributeValue) {
74
-				$attribName = strtolower(trim((string)$attributeName));
75
-				$attribVal = trim((string)$attributeValue);
76
-				if (!empty($ns)) {
77
-					$attribName = $ns . ':' . $attribName;
78
-				}
79
-				$attributes[$attribName] = $attribVal;
80
-			}
69
+        // get info for all namespaces
70
+        foreach ($namespace as $ns => $nsUrl) {
71
+            // attributes
72
+            $objAttributes = $obj->attributes($ns, true);
73
+            foreach ($objAttributes as $attributeName => $attributeValue) {
74
+                $attribName = strtolower(trim((string)$attributeName));
75
+                $attribVal = trim((string)$attributeValue);
76
+                if (!empty($ns)) {
77
+                    $attribName = $ns . ':' . $attribName;
78
+                }
79
+                $attributes[$attribName] = $attribVal;
80
+            }
81 81
 
82
-			// children
83
-			$objChildren = $obj->children($ns, true);
84
-			foreach ($objChildren as $childName => $child) {
85
-				$childName = strtolower((string)$childName);
86
-				if (!empty($ns)) {
87
-					$childName = $ns . ':' . $childName;
88
-				}
89
-				$children[$childName][] = xmlObjToArr($child, $namespace);
90
-			}
91
-		}
82
+            // children
83
+            $objChildren = $obj->children($ns, true);
84
+            foreach ($objChildren as $childName => $child) {
85
+                $childName = strtolower((string)$childName);
86
+                if (!empty($ns)) {
87
+                    $childName = $ns . ':' . $childName;
88
+                }
89
+                $children[$childName][] = xmlObjToArr($child, $namespace);
90
+            }
91
+        }
92 92
 
93
-		$tableau = array(
94
-			'name' => $name,
95
-		);
96
-		if ($text) {
97
-			$tableau['text'] = $text;
98
-		}
99
-		if ($attributes) {
100
-			$tableau['attributes'] = $attributes;
101
-		}
102
-		if ($children) {
103
-			$tableau['children'] = $children;
104
-		}
105
-	}
93
+        $tableau = array(
94
+            'name' => $name,
95
+        );
96
+        if ($text) {
97
+            $tableau['text'] = $text;
98
+        }
99
+        if ($attributes) {
100
+            $tableau['attributes'] = $attributes;
101
+        }
102
+        if ($children) {
103
+            $tableau['children'] = $children;
104
+        }
105
+    }
106 106
 
107
-	return $tableau;
107
+    return $tableau;
108 108
 }
Please login to merge, or discard this patch.
ecrire/inc/precharger_article.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 include_spip('inc/precharger_objet');
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
  *     Couples clés / valeurs des champs du formulaire à charger.
40 40
  **/
41 41
 function inc_precharger_article_dist($id_article, $id_rubrique = 0, $lier_trad = 0) {
42
-	return precharger_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre');
42
+    return precharger_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre');
43 43
 }
44 44
 
45 45
 
@@ -60,5 +60,5 @@  discard block
 block discarded – undo
60 60
  *     Couples clés / valeurs des champs du formulaire à charger
61 61
  **/
62 62
 function inc_precharger_traduction_article_dist($id_article, $id_rubrique = 0, $lier_trad = 0) {
63
-	return precharger_traduction_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre');
63
+    return precharger_traduction_objet('article', $id_article, $id_rubrique, $lier_trad, 'titre');
64 64
 }
Please login to merge, or discard this patch.
ecrire/inc/lister_objets.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
  *     Code HTML de la liste
40 40
  */
41 41
 function inc_lister_objets_dist($vue, $contexte = array(), $force = false) {
42
-	$res = ""; // debug
43
-	if (!is_array($contexte)) {
44
-		return _L('$contexte doit etre un tableau dans inc/lister_objets');
45
-	}
42
+    $res = ""; // debug
43
+    if (!is_array($contexte)) {
44
+        return _L('$contexte doit etre un tableau dans inc/lister_objets');
45
+    }
46 46
 
47
-	$fond = "prive/objets/liste/$vue";
48
-	if (!find_in_path($fond . "." . _EXTENSION_SQUELETTES)) {
49
-		// traiter les cas particuliers
50
-		include_spip('base/connect_sql');
51
-		$vue = table_objet($vue);
52
-		$fond = "prive/objets/liste/$vue";
53
-		if (!find_in_path($fond . "." . _EXTENSION_SQUELETTES)) {
54
-			return _L("vue $vue introuvable pour lister les objets");
55
-		}
56
-	}
47
+    $fond = "prive/objets/liste/$vue";
48
+    if (!find_in_path($fond . "." . _EXTENSION_SQUELETTES)) {
49
+        // traiter les cas particuliers
50
+        include_spip('base/connect_sql');
51
+        $vue = table_objet($vue);
52
+        $fond = "prive/objets/liste/$vue";
53
+        if (!find_in_path($fond . "." . _EXTENSION_SQUELETTES)) {
54
+            return _L("vue $vue introuvable pour lister les objets");
55
+        }
56
+    }
57 57
 
58 58
 
59
-	$contexte['sinon'] = ($force ? $contexte['titre'] : '');
59
+    $contexte['sinon'] = ($force ? $contexte['titre'] : '');
60 60
 
61
-	$res = recuperer_fond($fond, $contexte, array('ajax' => true));
62
-	if (_request('var_liste')) {
63
-		echo var_export($contexte, true);
64
-	}
61
+    $res = recuperer_fond($fond, $contexte, array('ajax' => true));
62
+    if (_request('var_liste')) {
63
+        echo var_export($contexte, true);
64
+    }
65 65
 
66
-	return $res;
66
+    return $res;
67 67
 }
Please login to merge, or discard this patch.
ecrire/base/delete_all.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -29,27 +29,27 @@  discard block
 block discarded – undo
29 29
  * @param string $titre Inutilisé
30 30
  **/
31 31
 function base_delete_all_dist($titre) {
32
-	$delete = _request('delete');
33
-	$res = array();
34
-	if (is_array($delete)) {
35
-		foreach ($delete as $table) {
36
-			if (sql_drop_table($table)) {
37
-				$res[] = $table;
38
-			} else {
39
-				spip_log("SPIP n'a pas pu detruire $table.", _LOG_ERREUR);
40
-			}
41
-		}
32
+    $delete = _request('delete');
33
+    $res = array();
34
+    if (is_array($delete)) {
35
+        foreach ($delete as $table) {
36
+            if (sql_drop_table($table)) {
37
+                $res[] = $table;
38
+            } else {
39
+                spip_log("SPIP n'a pas pu detruire $table.", _LOG_ERREUR);
40
+            }
41
+        }
42 42
 
43
-		// un pipeline pour detruire les tables installees par les plugins
44
-		pipeline('delete_tables', '');
43
+        // un pipeline pour detruire les tables installees par les plugins
44
+        pipeline('delete_tables', '');
45 45
 
46
-		spip_unlink(_FILE_CONNECT);
47
-		spip_unlink(_FILE_CHMOD);
48
-		spip_unlink(_FILE_META);
49
-		spip_unlink(_ACCESS_FILE_NAME);
50
-		spip_unlink(_CACHE_RUBRIQUES);
51
-	}
52
-	$d = count($delete);
53
-	$r = count($res);
54
-	spip_log("Tables detruites: $r sur $d: " . join(', ', $res), _LOG_INFO_IMPORTANTE);
46
+        spip_unlink(_FILE_CONNECT);
47
+        spip_unlink(_FILE_CHMOD);
48
+        spip_unlink(_FILE_META);
49
+        spip_unlink(_ACCESS_FILE_NAME);
50
+        spip_unlink(_CACHE_RUBRIQUES);
51
+    }
52
+    $d = count($delete);
53
+    $r = count($res);
54
+    spip_log("Tables detruites: $r sur $d: " . join(', ', $res), _LOG_INFO_IMPORTANTE);
55 55
 }
Please login to merge, or discard this patch.