@@ -10,7 +10,9 @@ |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | function action_ajouter_lien_dist($arg=null){ |
| 16 | 18 | if (is_null($arg)){ |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | define('URLS_PAGE_EXEMPLE', 'spip.php?article12'); |
| 16 | 18 | |
@@ -30,13 +32,17 @@ discard block |
||
| 30 | 32 | |
| 31 | 33 | if ($generer_url_externe = charger_fonction("generer_url_$type",'urls',true)) { |
| 32 | 34 | $url = $generer_url_externe($id, $args, $ancre); |
| 33 | - if (NULL != $url) return $url; |
|
| 35 | + if (NULL != $url) { |
|
| 36 | + return $url; |
|
| 37 | + } |
|
| 34 | 38 | } |
| 35 | 39 | |
| 36 | 40 | $url = _debut_urls_page . $type . _separateur_urls_page |
| 37 | 41 | . $id . _terminaison_urls_page; |
| 38 | 42 | |
| 39 | - if ($args) $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 43 | + if ($args) { |
|
| 44 | + $args = strpos($url,'?') ? "&$args" : "?$args"; |
|
| 45 | + } |
|
| 40 | 46 | return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
| 41 | 47 | } |
| 42 | 48 | |
@@ -45,8 +51,9 @@ discard block |
||
| 45 | 51 | // http://doc.spip.org/@urls_page_dist |
| 46 | 52 | function urls_page_dist($i, &$entite, $args='', $ancre='') |
| 47 | 53 | { |
| 48 | - if (is_numeric($i)) |
|
| 49 | - return _generer_url_page($entite, $i, $args, $ancre); |
|
| 54 | + if (is_numeric($i)) { |
|
| 55 | + return _generer_url_page($entite, $i, $args, $ancre); |
|
| 56 | + } |
|
| 50 | 57 | |
| 51 | 58 | // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
| 52 | 59 | if ($GLOBALS['profondeur_url']>0 AND $entite=='sommaire'){ |
@@ -54,10 +61,11 @@ discard block |
||
| 54 | 61 | } |
| 55 | 62 | |
| 56 | 63 | // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
| 57 | - if (is_array($args)) |
|
| 58 | - $contexte = $args; |
|
| 59 | - else |
|
| 60 | - parse_str($args,$contexte); |
|
| 64 | + if (is_array($args)) { |
|
| 65 | + $contexte = $args; |
|
| 66 | + } else { |
|
| 67 | + parse_str($args,$contexte); |
|
| 68 | + } |
|
| 61 | 69 | include_spip('inc/urls'); |
| 62 | 70 | $r = nettoyer_url_page($i, $contexte); |
| 63 | 71 | if ($r) { |
@@ -83,10 +91,11 @@ discard block |
||
| 83 | 91 | : '' |
| 84 | 92 | )); |
| 85 | 93 | if ($url_propre) { |
| 86 | - if ($GLOBALS['profondeur_url']<=0) |
|
| 87 | - $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 88 | - else |
|
| 89 | - $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 94 | + if ($GLOBALS['profondeur_url']<=0) { |
|
| 95 | + $urls_anciennes = charger_fonction('propres','urls',true); |
|
| 96 | + } else { |
|
| 97 | + $urls_anciennes = charger_fonction('arbo','urls',true); |
|
| 98 | + } |
|
| 90 | 99 | return $urls_anciennes?$urls_anciennes($url_propre, $entite, $contexte):''; |
| 91 | 100 | } |
| 92 | 101 | /* Fin du bloc compatibilite url-propres */ |
@@ -10,9 +10,13 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | -if (!defined('_DATA_SOURCE_MAX_SIZE')) define('_DATA_SOURCE_MAX_SIZE',2*1048576); |
|
| 17 | +if (!defined('_DATA_SOURCE_MAX_SIZE')) { |
|
| 18 | + define('_DATA_SOURCE_MAX_SIZE',2*1048576); |
|
| 19 | +} |
|
| 16 | 20 | |
| 17 | 21 | |
| 18 | 22 | /** |
@@ -117,10 +121,14 @@ discard block |
||
| 117 | 121 | * @return |
| 118 | 122 | */ |
| 119 | 123 | protected function cache_get($cle) { |
| 120 | - if (!$cle) return; |
|
| 124 | + if (!$cle) { |
|
| 125 | + return; |
|
| 126 | + } |
|
| 121 | 127 | # utiliser memoization si dispo |
| 122 | 128 | include_spip('inc/memoization'); |
| 123 | - if (!function_exists('cache_get')) return; |
|
| 129 | + if (!function_exists('cache_get')) { |
|
| 130 | + return; |
|
| 131 | + } |
|
| 124 | 132 | return cache_get($cle); |
| 125 | 133 | } |
| 126 | 134 | |
@@ -131,13 +139,17 @@ discard block |
||
| 131 | 139 | * @return |
| 132 | 140 | */ |
| 133 | 141 | protected function cache_set($cle, $ttl, $valeur = null) { |
| 134 | - if (!$cle) return; |
|
| 142 | + if (!$cle) { |
|
| 143 | + return; |
|
| 144 | + } |
|
| 135 | 145 | if (is_null($valeur)) { |
| 136 | 146 | $valeur = $this->tableau; |
| 137 | 147 | } |
| 138 | 148 | # utiliser memoization si dispo |
| 139 | 149 | include_spip('inc/memoization'); |
| 140 | - if (!function_exists('cache_set')) return; |
|
| 150 | + if (!function_exists('cache_set')) { |
|
| 151 | + return; |
|
| 152 | + } |
|
| 141 | 153 | return cache_set($cle, |
| 142 | 154 | array( |
| 143 | 155 | 'data' => $valeur, |
@@ -226,20 +238,23 @@ discard block |
||
| 226 | 238 | # l'objet en cache ; cf plugins/icalendar |
| 227 | 239 | # perf : pas de fonction table_to_array ! (table est deja un array) |
| 228 | 240 | if (isset($this->command['sourcemode']) |
| 229 | - AND !in_array($this->command['sourcemode'],array('table', 'array', 'tableau'))) |
|
| 230 | - charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true); |
|
| 241 | + AND !in_array($this->command['sourcemode'],array('table', 'array', 'tableau'))) { |
|
| 242 | + charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true); |
|
| 243 | + } |
|
| 231 | 244 | |
| 232 | 245 | # le premier argument peut etre un array, une URL etc. |
| 233 | 246 | $src = $this->command['source'][0]; |
| 234 | 247 | |
| 235 | 248 | # avons-nous un cache dispo ? |
| 236 | 249 | $cle = null; |
| 237 | - if (is_string($src)) |
|
| 238 | - $cle = 'datasource_'.md5($this->command['sourcemode'].':'.var_export($this->command['source'],true)); |
|
| 250 | + if (is_string($src)) { |
|
| 251 | + $cle = 'datasource_'.md5($this->command['sourcemode'].':'.var_export($this->command['source'],true)); |
|
| 252 | + } |
|
| 239 | 253 | |
| 240 | 254 | $cache = $this->cache_get($cle); |
| 241 | - if (isset($this->command['datacache'])) |
|
| 242 | - $ttl = intval($this->command['datacache']); |
|
| 255 | + if (isset($this->command['datacache'])) { |
|
| 256 | + $ttl = intval($this->command['datacache']); |
|
| 257 | + } |
|
| 243 | 258 | if ($cache |
| 244 | 259 | AND ($cache['time'] + (isset($ttl) ? $ttl : $cache['ttl']) |
| 245 | 260 | > time()) |
@@ -248,11 +263,12 @@ discard block |
||
| 248 | 263 | AND autoriser('recalcul') |
| 249 | 264 | )) { |
| 250 | 265 | $this->tableau = $cache['data']; |
| 251 | - } |
|
| 252 | - else try { |
|
| 266 | + } else { |
|
| 267 | + try { |
|
| 253 | 268 | # dommage que ca ne soit pas une option de yql_to_array... |
| 254 | 269 | if ($this->command['sourcemode'] == 'yql') |
| 255 | 270 | if (!isset($ttl)) $ttl = 3600; |
| 271 | + } |
|
| 256 | 272 | |
| 257 | 273 | if (isset($this->command['sourcemode']) |
| 258 | 274 | AND in_array($this->command['sourcemode'], |
@@ -262,25 +278,34 @@ discard block |
||
| 262 | 278 | OR (is_string($a) |
| 263 | 279 | AND $a = str_replace('"', '"', $a) # fragile! |
| 264 | 280 | AND is_array($a = @unserialize($a))) |
| 265 | - ) |
|
| 266 | - $this->tableau = $a; |
|
| 267 | - } |
|
| 268 | - else { |
|
| 281 | + ) { |
|
| 282 | + $this->tableau = $a; |
|
| 283 | + } |
|
| 284 | + } else { |
|
| 269 | 285 | if (preg_match(',^https?://,', $src)) { |
| 270 | 286 | include_spip('inc/distant'); |
| 271 | 287 | $u = recuperer_page($src, false, false, _DATA_SOURCE_MAX_SIZE); |
| 272 | - if (!$u) |
|
| 273 | - throw new Exception("404"); |
|
| 274 | - if (!isset($ttl)) $ttl = 24*3600; |
|
| 288 | + if (!$u) { |
|
| 289 | + throw new Exception("404"); |
|
| 290 | + } |
|
| 291 | + if (!isset($ttl)) { |
|
| 292 | + $ttl = 24*3600; |
|
| 293 | + } |
|
| 275 | 294 | } else if (@is_dir($src)) { |
| 276 | 295 | $u = $src; |
| 277 | - if (!isset($ttl)) $ttl = 10; |
|
| 296 | + if (!isset($ttl)) { |
|
| 297 | + $ttl = 10; |
|
| 298 | + } |
|
| 278 | 299 | } else if (@is_readable($src) && @is_file($src)) { |
| 279 | 300 | $u = spip_file_get_contents($src); |
| 280 | - if (!isset($ttl)) $ttl = 10; |
|
| 301 | + if (!isset($ttl)) { |
|
| 302 | + $ttl = 10; |
|
| 303 | + } |
|
| 281 | 304 | } else { |
| 282 | 305 | $u = $src; |
| 283 | - if (!isset($ttl)) $ttl = 10; |
|
| 306 | + if (!isset($ttl)) { |
|
| 307 | + $ttl = 10; |
|
| 308 | + } |
|
| 284 | 309 | } |
| 285 | 310 | if (!$this->err |
| 286 | 311 | AND $g = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true)) { |
@@ -292,14 +317,15 @@ discard block |
||
| 292 | 317 | } |
| 293 | 318 | } |
| 294 | 319 | |
| 295 | - if (!is_array($this->tableau)) |
|
| 296 | - $this->err = true; |
|
| 320 | + if (!is_array($this->tableau)) { |
|
| 321 | + $this->err = true; |
|
| 322 | + } |
|
| 297 | 323 | |
| 298 | - if (!$this->err AND isset($ttl) and $ttl>0) |
|
| 299 | - $this->cache_set($cle, $ttl); |
|
| 324 | + if (!$this->err AND isset($ttl) and $ttl>0) { |
|
| 325 | + $this->cache_set($cle, $ttl); |
|
| 326 | + } |
|
| 300 | 327 | |
| 301 | - } |
|
| 302 | - catch (Exception $e) { |
|
| 328 | + } catch (Exception $e) { |
|
| 303 | 329 | $e = $e->getMessage(); |
| 304 | 330 | $err = sprintf("[%s, %s] $e", |
| 305 | 331 | $src, |
@@ -348,10 +374,11 @@ discard block |
||
| 348 | 374 | $this->command['enum'] = $this->command['enum'][0]; |
| 349 | 375 | } |
| 350 | 376 | } |
| 351 | - if (count($this->command['enum'])>=3) |
|
| 352 | - $enum = range(array_shift($this->command['enum']),array_shift($this->command['enum']),array_shift($this->command['enum'])); |
|
| 353 | - else |
|
| 354 | - $enum = range(array_shift($this->command['enum']),array_shift($this->command['enum'])); |
|
| 377 | + if (count($this->command['enum'])>=3) { |
|
| 378 | + $enum = range(array_shift($this->command['enum']),array_shift($this->command['enum']),array_shift($this->command['enum'])); |
|
| 379 | + } else { |
|
| 380 | + $enum = range(array_shift($this->command['enum']),array_shift($this->command['enum'])); |
|
| 381 | + } |
|
| 355 | 382 | $this->tableau = $enum; |
| 356 | 383 | } |
| 357 | 384 | |
@@ -386,27 +413,30 @@ discard block |
||
| 386 | 413 | if (preg_match(',^\.?([/\w]+)( DESC)?$,iS', ltrim($tri, '/'), $r)) { |
| 387 | 414 | // tri par cle |
| 388 | 415 | if ($r[1] == 'cle'){ |
| 389 | - if (isset($r[2]) and $r[2]) |
|
| 390 | - krsort($this->tableau); |
|
| 391 | - else |
|
| 392 | - ksort($this->tableau); |
|
| 416 | + if (isset($r[2]) and $r[2]) { |
|
| 417 | + krsort($this->tableau); |
|
| 418 | + } else { |
|
| 419 | + ksort($this->tableau); |
|
| 420 | + } |
|
| 393 | 421 | } |
| 394 | 422 | # {par hasard} |
| 395 | 423 | else if ($r[1] == 'alea') { |
| 396 | 424 | $k = array_keys($this->tableau); |
| 397 | 425 | shuffle($k); |
| 398 | 426 | $v = array(); |
| 399 | - foreach($k as $cle) |
|
| 400 | - $v[$cle] = $this->tableau[$cle]; |
|
| 427 | + foreach($k as $cle) { |
|
| 428 | + $v[$cle] = $this->tableau[$cle]; |
|
| 429 | + } |
|
| 401 | 430 | $this->tableau = $v; |
| 402 | - } |
|
| 403 | - else { |
|
| 431 | + } else { |
|
| 404 | 432 | # {par valeur} |
| 405 | - if ($r[1] == 'valeur') |
|
| 406 | - $tv = '%s'; |
|
| 433 | + if ($r[1] == 'valeur') { |
|
| 434 | + $tv = '%s'; |
|
| 435 | + } |
|
| 407 | 436 | # {par valeur/xx/yy} ?? |
| 408 | - else |
|
| 409 | - $tv = 'table_valeur(%s, '.var_export($r[1],true).')'; |
|
| 437 | + else { |
|
| 438 | + $tv = 'table_valeur(%s, '.var_export($r[1],true).')'; |
|
| 439 | + } |
|
| 410 | 440 | $sortfunc .= ' |
| 411 | 441 | $a = '.sprintf($tv,'$aa').'; |
| 412 | 442 | $b = '.sprintf($tv,'$bb').'; |
@@ -436,10 +466,11 @@ discard block |
||
| 436 | 466 | $vu = array(); |
| 437 | 467 | foreach($this->tableau as $k => $v) { |
| 438 | 468 | $val = table_valeur($v, $fusion); |
| 439 | - if (isset($vu[$val])) |
|
| 440 | - unset($this->tableau[$k]); |
|
| 441 | - else |
|
| 442 | - $vu[$val] = true; |
|
| 469 | + if (isset($vu[$val])) { |
|
| 470 | + unset($this->tableau[$k]); |
|
| 471 | + } else { |
|
| 472 | + $vu[$val] = true; |
|
| 473 | + } |
|
| 443 | 474 | } |
| 444 | 475 | } |
| 445 | 476 | } |
@@ -474,8 +505,9 @@ discard block |
||
| 474 | 505 | * @return void |
| 475 | 506 | */ |
| 476 | 507 | public function next(){ |
| 477 | - if ($this->valid()) |
|
| 478 | - list($this->cle, $this->valeur) = each($this->tableau); |
|
| 508 | + if ($this->valid()) { |
|
| 509 | + list($this->cle, $this->valeur) = each($this->tableau); |
|
| 510 | + } |
|
| 479 | 511 | } |
| 480 | 512 | |
| 481 | 513 | /** |
@@ -483,8 +515,9 @@ discard block |
||
| 483 | 515 | * @return int |
| 484 | 516 | */ |
| 485 | 517 | public function count() { |
| 486 | - if (is_null($this->total)) |
|
| 487 | - $this->total = count($this->tableau); |
|
| 518 | + if (is_null($this->total)) { |
|
| 519 | + $this->total = count($this->tableau); |
|
| 520 | + } |
|
| 488 | 521 | return $this->total; |
| 489 | 522 | } |
| 490 | 523 | } |
@@ -568,8 +601,9 @@ discard block |
||
| 568 | 601 | $req = trim($v[2]); |
| 569 | 602 | if ($s = sql_query($req, $serveur)) { |
| 570 | 603 | $r = array(); |
| 571 | - while ($t = sql_fetch($s)) |
|
| 572 | - $r[] = $t; |
|
| 604 | + while ($t = sql_fetch($s)) { |
|
| 605 | + $r[] = $t; |
|
| 606 | + } |
|
| 573 | 607 | return $r; |
| 574 | 608 | } |
| 575 | 609 | return false; |
@@ -582,9 +616,10 @@ discard block |
||
| 582 | 616 | */ |
| 583 | 617 | function inc_json_to_array_dist($u) { |
| 584 | 618 | if (is_array($json = json_decode($u)) |
| 585 | - OR is_object($json)) |
|
| 586 | - return (array) $json; |
|
| 587 | -} |
|
| 619 | + OR is_object($json)) { |
|
| 620 | + return (array) $json; |
|
| 621 | + } |
|
| 622 | + } |
|
| 588 | 623 | |
| 589 | 624 | /** |
| 590 | 625 | * csv -> tableau |
@@ -599,8 +634,9 @@ discard block |
||
| 599 | 634 | include_spip('inc/charsets'); |
| 600 | 635 | foreach ($entete as $k => $v) { |
| 601 | 636 | $v = strtolower(preg_replace(',\W+,', '_', translitteration($v))); |
| 602 | - foreach ($csv as &$item) |
|
| 603 | - $item[$v] = &$item[$k]; |
|
| 637 | + foreach ($csv as &$item) { |
|
| 638 | + $item[$v] = &$item[$k]; |
|
| 639 | + } |
|
| 604 | 640 | } |
| 605 | 641 | return $csv; |
| 606 | 642 | } |
@@ -612,8 +648,9 @@ discard block |
||
| 612 | 648 | */ |
| 613 | 649 | function inc_rss_to_array_dist($u) { |
| 614 | 650 | include_spip('inc/syndic'); |
| 615 | - if (is_array($rss = analyser_backend($u))) |
|
| 616 | - $tableau = $rss; |
|
| 651 | + if (is_array($rss = analyser_backend($u))) { |
|
| 652 | + $tableau = $rss; |
|
| 653 | + } |
|
| 617 | 654 | return $tableau; |
| 618 | 655 | } |
| 619 | 656 | |
@@ -681,8 +718,9 @@ discard block |
||
| 681 | 718 | $a = $glob($u); |
| 682 | 719 | foreach ($a as &$v) { |
| 683 | 720 | $b = (array) @stat($v); |
| 684 | - foreach ($b as $k => $ignore) |
|
| 685 | - if (is_numeric($k)) unset($b[$k]); |
|
| 721 | + foreach ($b as $k => $ignore) { |
|
| 722 | + if (is_numeric($k)) unset($b[$k]); |
|
| 723 | + } |
|
| 686 | 724 | $b['file'] = basename($v); |
| 687 | 725 | $v = array_merge( |
| 688 | 726 | pathinfo($v), |
@@ -704,14 +742,14 @@ discard block |
||
| 704 | 742 | $key .= '-'.uniqid(); |
| 705 | 743 | } |
| 706 | 744 | $vars = get_object_vars($object->current()); |
| 707 | - if (isset($vars['@attributes'])) |
|
| 708 | - foreach($vars['@attributes'] as $k => $v) |
|
| 745 | + if (isset($vars['@attributes'])) { |
|
| 746 | + foreach($vars['@attributes'] as $k => $v) |
|
| 709 | 747 | $xml_array[$key][$k] = $v; |
| 748 | + } |
|
| 710 | 749 | if($object->hasChildren()){ |
| 711 | 750 | $xml_array[$key][] = XMLObjectToArray( |
| 712 | 751 | $object->current()); |
| 713 | - } |
|
| 714 | - else{ |
|
| 752 | + } else{ |
|
| 715 | 753 | $xml_array[$key][] = strval($object->current()); |
| 716 | 754 | } |
| 717 | 755 | } |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | |
| 16 | 18 | /** |
@@ -88,10 +90,12 @@ discard block |
||
| 88 | 90 | * @return bool |
| 89 | 91 | */ |
| 90 | 92 | public function valid() { |
| 91 | - if ($this->err) |
|
| 92 | - return false; |
|
| 93 | - if (!$this->firstseek) |
|
| 94 | - $this->next(); |
|
| 93 | + if ($this->err) { |
|
| 94 | + return false; |
|
| 95 | + } |
|
| 96 | + if (!$this->firstseek) { |
|
| 97 | + $this->next(); |
|
| 98 | + } |
|
| 95 | 99 | return is_array($this->row); |
| 96 | 100 | } |
| 97 | 101 | |
@@ -150,8 +154,9 @@ discard block |
||
| 150 | 154 | if ($this->valid()) { |
| 151 | 155 | $r = $this->current(); |
| 152 | 156 | $this->next(); |
| 153 | - } else |
|
| 154 | - $r = false; |
|
| 157 | + } else { |
|
| 158 | + $r = false; |
|
| 159 | + } |
|
| 155 | 160 | return $r; |
| 156 | 161 | } |
| 157 | 162 | |
@@ -160,7 +165,9 @@ discard block |
||
| 160 | 165 | * @return bool |
| 161 | 166 | */ |
| 162 | 167 | public function free(){ |
| 163 | - if (!$this->sqlresult) return true; |
|
| 168 | + if (!$this->sqlresult) { |
|
| 169 | + return true; |
|
| 170 | + } |
|
| 164 | 171 | $a = sql_free($this->sqlresult, $this->command['connect']); |
| 165 | 172 | $this->sqlresult = null; |
| 166 | 173 | return $a; |
@@ -180,8 +187,9 @@ discard block |
||
| 180 | 187 | $this->valid(); |
| 181 | 188 | $s = $this->current(); |
| 182 | 189 | $this->total = $s['count(*)']; |
| 183 | - } else |
|
| 184 | - $this->total = sql_count($this->sqlresult, $this->command['connect']); |
|
| 190 | + } else { |
|
| 191 | + $this->total = sql_count($this->sqlresult, $this->command['connect']); |
|
| 192 | + } |
|
| 185 | 193 | } |
| 186 | 194 | } |
| 187 | 195 | return $this->total; |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 12 | 12 | \***************************************************************************/ |
| 13 | 13 | |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | // |
| 17 | 19 | // creer une boucle sur un iterateur |
@@ -11,7 +11,9 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | |
| 14 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 14 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 15 | + return; |
|
| 16 | +} |
|
| 15 | 17 | |
| 16 | 18 | include_spip('iterateur/data'); |
| 17 | 19 | |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | // Diverses taches de maintenance |
| 16 | 18 | // http://doc.spip.org/@genie_maintenance_dist |
@@ -23,8 +25,9 @@ discard block |
||
| 23 | 25 | verifier_htaccess(_DIR_TMP); |
| 24 | 26 | |
| 25 | 27 | // Verifier qu'aucune table n'est crashee |
| 26 | - if (!_request('reinstall')) |
|
| 27 | - verifier_crash_tables(); |
|
| 28 | + if (!_request('reinstall')) { |
|
| 29 | + verifier_crash_tables(); |
|
| 30 | + } |
|
| 28 | 31 | |
| 29 | 32 | return 1; |
| 30 | 33 | } |
@@ -39,8 +42,10 @@ discard block |
||
| 39 | 42 | foreach (array('tables_principales', 'tables_auxiliaires') as $com) { |
| 40 | 43 | foreach ($GLOBALS[$com] as $table => $desc) { |
| 41 | 44 | if (!sql_select('*', $table,'','','', 1) |
| 42 | - AND !defined('spip_interdire_cache')) # cas "LOST CONNECTION" |
|
| 45 | + AND !defined('spip_interdire_cache')) { |
|
| 46 | + # cas "LOST CONNECTION" |
|
| 43 | 47 | $crash[] = $table; |
| 48 | + } |
|
| 44 | 49 | } |
| 45 | 50 | } |
| 46 | 51 | #$crash[] = 'test'; |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Verifier si une mise a jour est disponible |
@@ -53,11 +55,14 @@ discard block |
||
| 53 | 55 | list(, $maj2, $min2,, $rev2) = $v; |
| 54 | 56 | $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
| 55 | 57 | if ((spip_version_compare($version, $version_maj, '<')) |
| 56 | - AND (spip_version_compare($page, $version_maj, '<'))) |
|
| 57 | - $page = $version_maj; |
|
| 58 | + AND (spip_version_compare($page, $version_maj, '<'))) { |
|
| 59 | + $page = $version_maj; |
|
| 60 | + } |
|
| 58 | 61 | } |
| 59 | 62 | |
| 60 | - if (!$page) return ""; |
|
| 63 | + if (!$page) { |
|
| 64 | + return ""; |
|
| 65 | + } |
|
| 61 | 66 | return "<a class='info_maj_spip' href='"._VERSIONS_SERVEUR."$dir' title='$page'>" . |
| 62 | 67 | _T('nouvelle_version_spip',array('version'=>$page)) . |
| 63 | 68 | '</a>'; |
@@ -71,14 +76,18 @@ discard block |
||
| 71 | 76 | function info_maj_cache($nom, $dir, $page='') |
| 72 | 77 | { |
| 73 | 78 | $re = '<archives id="a' . $GLOBALS['meta']["alea_ephemere"] . '">'; |
| 74 | - if (preg_match("/$re/", $page)) return $page; |
|
| 79 | + if (preg_match("/$re/", $page)) { |
|
| 80 | + return $page; |
|
| 81 | + } |
|
| 75 | 82 | |
| 76 | 83 | $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
| 77 | 84 | $a = file_exists($nom) ? filemtime($nom) : ''; |
| 78 | 85 | include_spip('inc/distant'); |
| 79 | 86 | $res = recuperer_lapage($url, false, 'GET', _COPIE_LOCALE_MAX_SIZE, '',false, $a); |
| 80 | 87 | // Si rien de neuf (ou inaccessible), garder l'ancienne |
| 81 | - if ($res) list(, $page) = $res; |
|
| 88 | + if ($res) { |
|
| 89 | + list(, $page) = $res; |
|
| 90 | + } |
|
| 82 | 91 | // Placer l'indicateur de fraicheur |
| 83 | 92 | $page = preg_replace('/^<archives.*?>/', $re, $page); |
| 84 | 93 | sous_repertoire(_DIR_CACHE_XML); |
@@ -10,7 +10,9 @@ discard block |
||
| 10 | 10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * |
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 13 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 14 | + return; |
|
| 15 | +} |
|
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * Envoi du Mail des nouveautes |
@@ -29,8 +31,9 @@ discard block |
||
| 29 | 31 | $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
| 30 | 32 | |
| 31 | 33 | $now = time(); |
| 32 | - if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) |
|
| 33 | - ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now - (3600 * 24 * $jours_neuf))); |
|
| 34 | + if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 35 | + ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now - (3600 * 24 * $jours_neuf))); |
|
| 36 | + } |
|
| 34 | 37 | |
| 35 | 38 | $page = recuperer_fond('nouveautes',array('date'=>$GLOBALS['meta']['dernier_envoi_neuf'],'jours_neuf'=>$jours_neuf),array('raw'=>true)); |
| 36 | 39 | |
@@ -38,16 +41,17 @@ discard block |
||
| 38 | 41 | // recuperer les entetes envoyes par #HTTP_HEADER |
| 39 | 42 | $headers = ""; |
| 40 | 43 | if (isset($page['entetes']) AND count($page['entetes'])){ |
| 41 | - foreach ($page['entetes'] as $k => $v) |
|
| 42 | - $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 44 | + foreach ($page['entetes'] as $k => $v) { |
|
| 45 | + $headers .= (strlen($v)?"$k: $v":$k)."\n"; |
|
| 46 | + } |
|
| 43 | 47 | } |
| 44 | 48 | |
| 45 | 49 | include_spip("inc/notifications"); |
| 46 | 50 | notifications_envoyer_mails($adresse_neuf,$page['texte'],"","",$headers); |
| 47 | 51 | ecrire_meta('dernier_envoi_neuf',date('Y-m-d H:i:s',$now)); |
| 52 | + } else { |
|
| 53 | + spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 48 | 54 | } |
| 49 | - else |
|
| 50 | - spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 51 | 55 | |
| 52 | 56 | return 1; |
| 53 | 57 | } |