Changeset 93651 in spip-zone
- Timestamp:
- Dec 13, 2015, 2:51:19 PM (5 years ago)
- Location:
- _core_/plugins/revisions
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
_core_/plugins/revisions/afficher_diff/champ.php
r93622 r93651 41 41 42 42 $out = afficher_diff($diff->comparer($n, $o)); 43 if ($format == 'diff' OR$format == 'apercu') {43 if ($format == 'diff' or $format == 'apercu') { 44 44 $out = afficher_para_modifies($out, ($format == 'apercu')); 45 45 } … … 67 67 $texte_ret = ""; 68 68 $paras = explode("\n", $texte); 69 for ($i = 0; $i < count($paras) ANDstrlen($texte_ret) < $max; $i++) {69 for ($i = 0; $i < count($paras) and strlen($texte_ret) < $max; $i++) { 70 70 if (strpos($paras[$i], '"diff-')) { 71 71 $texte_ret .= $paras[$i] . "\n\n"; -
_core_/plugins/revisions/afficher_diff/id_rubrique.php
r93622 r93651 36 36 $out = _T('revisions:version_deplace_rubrique', 37 37 array( 38 'from' => generer_info_entite($old, 'rubrique', 'titre') 39 , 38 'from' => generer_info_entite($old, 'rubrique', 'titre'), 40 39 'to' => generer_info_entite($new, 'rubrique', 'titre') 41 40 ) -
_core_/plugins/revisions/base/revisions.php
r93622 r93651 111 111 return $tables_auxiliaires; 112 112 } 113 114 ?> -
_core_/plugins/revisions/formulaires/configurer_revisions_objets.php
r93622 r93651 37 37 function test_objet_versionable($desc) { 38 38 if (!$desc['editable'] 39 OR!isset($desc['champs_versionnes'])40 OR!count($desc['champs_versionnes'])39 or !isset($desc['champs_versionnes']) 40 or !count($desc['champs_versionnes']) 41 41 ) { 42 42 return ''; … … 53 53 return ''; 54 54 } 55 56 ?> -
_core_/plugins/revisions/formulaires/reviser.php
r93622 r93651 54 54 55 55 // minorer id_diff en fonction de id_version 56 $id_diff = min($id_diff, $id_version -1);56 $id_diff = min($id_diff, $id_version - 1); 57 57 // verifier id_diff 58 58 $id_diff = trouver_version_inf($objet, $id_objet, "id_version<=" . intval($id_diff)); … … 64 64 // echec, on renvoi ce qu'on peut 65 65 if (!$id_diff) { 66 $id_diff = $id_version -1;66 $id_diff = $id_version - 1; 67 67 } 68 68 -
_core_/plugins/revisions/genie/optimiser_revisions.php
r93622 r93651 94 94 } 95 95 } 96 97 ?> -
_core_/plugins/revisions/inc/diff.php
r93622 r93651 53 53 for ($len = $max_len; $len > 0; $len--) { 54 54 if ($paths_ymin[$len] < $y) { 55 $paths_ymin[$len +1] = $y;56 $paths[$len +1] = $paths[$len];57 $paths[$len +1][$y] = $c;55 $paths_ymin[$len + 1] = $y; 56 $paths[$len + 1] = $paths[$len]; 57 $paths[$len + 1][$y] = $c; 58 58 break; 59 59 } … … 63 63 $paths[1] = array($y => $c); 64 64 } 65 if ($len +1 > $max_len) {66 $max_len = $len +1;65 if ($len + 1 > $max_len) { 66 $max_len = $len + 1; 67 67 } 68 68 } … … 106 106 for ($len = $max_len; $len > 0; $len--) { 107 107 if ($paths_ymin[$len] < $y) { 108 $paths_ymin[$len +1] = $y;108 $paths_ymin[$len + 1] = $y; 109 109 // On construit le resultat sous forme de chaine d'abord, 110 110 // car les tableaux de PHP sont dispendieux en taille memoire 111 $paths[$len +1] = $paths[$len] . " $x,$y";111 $paths[$len + 1] = $paths[$len] . " $x,$y"; 112 112 break; 113 113 } 114 114 } 115 if ($len +1 > $max_len) {116 $max_len = $len +1;115 if ($len + 1 > $max_len) { 116 $max_len = $len + 1; 117 117 } 118 118 if ($len == 0) { … … 122 122 } 123 123 } 124 if (isset($paths[$max_len]) AND$paths[$max_len]) {124 if (isset($paths[$max_len]) and $paths[$max_len]) { 125 125 $path = explode(" ", $paths[$max_len]); 126 126 $u = $v = array(); … … 148 148 * @var Object Objet Diff* (DiffTexte, DiffPara, DiffPhrase) 149 149 */ 150 var$diff;151 var$fuzzy;150 public $diff; 151 public $fuzzy; 152 152 153 153 /** … … 156 156 * @param Object $diff Objet Diff* d'un texte ou morceau de texte 157 157 **/ 158 function __construct($diff) {158 public function __construct($diff) { 159 159 $this->diff = $diff; 160 160 $this->fuzzy = true; … … 162 162 163 163 // http://code.spip.net/@comparer 164 function comparer($new, $old) {164 public function comparer($new, $old) { 165 165 $paras = $this->diff->segmenter($new); 166 166 $paras_old = $this->diff->segmenter($old); … … 248 248 **/ 249 249 class DiffTexte { 250 var$r;250 public $r; 251 251 252 252 /** 253 253 * Constructeur 254 254 **/ 255 function __construct() {255 public function __construct() { 256 256 $this->r = ""; 257 257 } 258 258 259 259 // http://code.spip.net/@_diff 260 function _diff($p, $p_old) {260 public function _diff($p, $p_old) { 261 261 $diff = new Diff(new DiffPara); 262 262 … … 265 265 266 266 // http://code.spip.net/@fuzzy 267 function fuzzy() {267 public function fuzzy() { 268 268 return true; 269 269 } … … 275 275 * @return string[] Tableau de fragments (paragraphes) 276 276 **/ 277 function segmenter($texte) {277 public function segmenter($texte) { 278 278 return separer_paras($texte); 279 279 } … … 281 281 // NB : rem=\"diff-\" est un signal pour la fonction "afficher_para_modifies" 282 282 // http://code.spip.net/@ajouter 283 function ajouter($p) {283 public function ajouter($p) { 284 284 $p = trim($p); 285 285 $this->r .= "\n\n\n<span class=\"diff-para-ajoute\" title=\"" . _T('revisions:diff_para_ajoute') . "\">" . $p . "</span rem=\"diff-\">"; … … 287 287 288 288 // http://code.spip.net/@supprimer 289 function supprimer($p_old) {289 public function supprimer($p_old) { 290 290 $p_old = trim($p_old); 291 291 $this->r .= "\n\n\n<span class=\"diff-para-supprime\" title=\"" . _T('revisions:diff_para_supprime') . "\">" . $p_old . "</span rem=\"diff-\">"; … … 293 293 294 294 // http://code.spip.net/@deplacer 295 function deplacer($p, $p_old) {295 public function deplacer($p, $p_old) { 296 296 $this->r .= "\n\n\n<span class=\"diff-para-deplace\" title=\"" . _T('revisions:diff_para_deplace') . "\">"; 297 297 $this->r .= trim($this->_diff($p, $p_old)); … … 300 300 301 301 // http://code.spip.net/@comparer 302 function comparer($p, $p_old) {302 public function comparer($p, $p_old) { 303 303 $this->r .= "\n\n\n" . $this->_diff($p, $p_old); 304 304 } 305 305 306 306 // http://code.spip.net/@resultat 307 function resultat() {307 public function resultat() { 308 308 return $this->r; 309 309 } … … 316 316 **/ 317 317 class DiffPara { 318 var$r;318 public $r; 319 319 320 320 /** Constructeur */ 321 function __construct() {321 public function __construct() { 322 322 $this->r = ""; 323 323 } 324 324 325 325 // http://code.spip.net/@_diff 326 function _diff($p, $p_old) {326 public function _diff($p, $p_old) { 327 327 $diff = new Diff(new DiffPhrase); 328 328 … … 331 331 332 332 // http://code.spip.net/@fuzzy 333 function fuzzy() {333 public function fuzzy() { 334 334 return true; 335 335 } 336 336 337 337 // http://code.spip.net/@segmenter 338 function segmenter($texte) {338 public function segmenter($texte) { 339 339 $paras = array(); 340 340 $texte = trim($texte); 341 341 while (preg_match('/[\.!\?\]]+\s*/u', $texte, $regs)) { 342 $p = strpos($texte, $regs[0]) +strlen($regs[0]);342 $p = strpos($texte, $regs[0]) + strlen($regs[0]); 343 343 $paras[] = substr($texte, 0, $p); 344 344 $texte = substr($texte, $p); … … 352 352 353 353 // http://code.spip.net/@ajouter 354 function ajouter($p) {354 public function ajouter($p) { 355 355 $this->r .= "<span class=\"diff-ajoute\" title=\"" . _T('revisions:diff_texte_ajoute') . "\">" . $p . "</span rem=\"diff-\">"; 356 356 } 357 357 358 358 // http://code.spip.net/@supprimer 359 function supprimer($p_old) {359 public function supprimer($p_old) { 360 360 $this->r .= "<span class=\"diff-supprime\" title=\"" . _T('revisions:diff_texte_supprime') . "\">" . $p_old . "</span rem=\"diff-\">"; 361 361 } 362 362 363 363 // http://code.spip.net/@deplacer 364 function deplacer($p, $p_old) {364 public function deplacer($p, $p_old) { 365 365 $this->r .= "<span class=\"diff-deplace\" title=\"" . _T('revisions:diff_texte_deplace') . "\">" . $this->_diff($p, 366 366 $p_old) . "</span rem=\"diff-\">"; … … 368 368 369 369 // http://code.spip.net/@comparer 370 function comparer($p, $p_old) {370 public function comparer($p, $p_old) { 371 371 $this->r .= $this->_diff($p, $p_old); 372 372 } 373 373 374 374 // http://code.spip.net/@resultat 375 function resultat() {375 public function resultat() { 376 376 return $this->r; 377 377 } … … 384 384 **/ 385 385 class DiffPhrase { 386 var$r;386 public $r; 387 387 388 388 /** Constructeur */ 389 function __construct() {389 public function __construct() { 390 390 $this->r = ""; 391 391 } 392 392 393 393 // http://code.spip.net/@fuzzy 394 function fuzzy() {394 public function fuzzy() { 395 395 return false; 396 396 } 397 397 398 398 // http://code.spip.net/@segmenter 399 function segmenter($texte) {399 public function segmenter($texte) { 400 400 $paras = array(); 401 401 if (test_pcre_unicode()) { … … 417 417 if ($punct == '[[') { 418 418 $avant = substr($texte, 0, $p) . $regs[5] . $punct; 419 $texte = $regs[4] . substr($texte, $p +$l);419 $texte = $regs[4] . substr($texte, $p + $l); 420 420 } else { 421 421 if ($punct == ']]') { 422 422 $avant = substr($texte, 0, $p) . $regs[5] . $punct; 423 $texte = substr($texte, $p +$l);423 $texte = substr($texte, $p + $l); 424 424 } // Attacher les raccourcis fermants au mot precedent 425 425 else { 426 426 if (preg_match(',^[\]}]+$,', $punct)) { 427 427 $avant = substr($texte, 0, $p) . (isset($regs[5]) ? $regs[5] : '') . $punct; 428 $texte = $regs[4] . substr($texte, $p +$l);428 $texte = $regs[4] . substr($texte, $p + $l); 429 429 } // Attacher les raccourcis ouvrants au mot suivant 430 430 else { 431 431 if (isset($regs[5]) && $regs[5] && preg_match(',^[\[{]+$,', $punct)) { 432 432 $avant = substr($texte, 0, $p) . $regs[5]; 433 $texte = $punct . substr($texte, $p +$l);433 $texte = $punct . substr($texte, $p + $l); 434 434 } // Les autres signes de ponctuation sont des mots a part entiere 435 435 else { 436 436 $avant = substr($texte, 0, $p); 437 437 $milieu = $regs[0]; 438 $texte = substr($texte, $p +$l);438 $texte = substr($texte, $p + $l); 439 439 } 440 440 } … … 442 442 } 443 443 } else { 444 $avant = substr($texte, 0, $p +$l);445 $texte = substr($texte, $p +$l);444 $avant = substr($texte, 0, $p + $l); 445 $texte = substr($texte, $p + $l); 446 446 } 447 447 if ($avant) { … … 460 460 461 461 // http://code.spip.net/@ajouter 462 function ajouter($p) {462 public function ajouter($p) { 463 463 $this->r .= "<span class=\"diff-ajoute\" title=\"" . _T('revisions:diff_texte_ajoute') . "\">" . $p . "</span rem=\"diff-\"> "; 464 464 } 465 465 466 466 // http://code.spip.net/@supprimer 467 function supprimer($p_old) {467 public function supprimer($p_old) { 468 468 $this->r .= "<span class=\"diff-supprime\" title=\"" . _T('revisions:diff_texte_supprime') . "\">" . $p_old . "</span rem=\"diff-\"> "; 469 469 } 470 470 471 471 // http://code.spip.net/@comparer 472 function comparer($p, $p_old) {472 public function comparer($p, $p_old) { 473 473 $this->r .= $p; 474 474 } 475 475 476 476 // http://code.spip.net/@resultat 477 function resultat() {477 public function resultat() { 478 478 return $this->r; 479 479 } … … 502 502 return charset2unicode($texte, 'utf-8'); 503 503 } 504 505 506 ?> -
_core_/plugins/revisions/inc/revisions.php
r93622 r93651 37 37 } 38 38 while (preg_match("/(\r\n?){2,}|\n{2,}/", $texte, $regs)) { 39 $p = strpos($texte, $regs[0]) +strlen($regs[0]);39 $p = strpos($texte, $regs[0]) + strlen($regs[0]); 40 40 $paras[] = substr($texte, 0, $p); 41 41 $texte = substr($texte, $p); … … 135 135 // Ne pas dupliquer les fragments non modifies 136 136 $modif = true; 137 for ($i = $id_version -1; $i >= $version_min; $i--) {137 for ($i = $id_version - 1; $i >= $version_min; $i--) { 138 138 if (isset($fragment[$i])) { 139 139 $modif = ($fragment[$i] != $texte); … … 182 182 if (isset($fragment[$i])) { 183 183 // Recopier le dernier fragment si implicite 184 if (!isset($fragment[$version_fin +1])) {185 $fragment[$version_fin +1] = $fragment[$i];184 if (!isset($fragment[$version_fin + 1])) { 185 $fragment[$version_fin + 1] = $fragment[$i]; 186 186 } 187 187 unset($fragment[$i]); … … 217 217 // Ajuster l'intervalle des versions 218 218 $deb_version_min[$id_fragment] = $version_min; 219 $deb_version_max[$id_fragment] = $version_debut -1;219 $deb_version_max[$id_fragment] = $version_debut - 1; 220 220 } 221 221 … … 236 236 if (isset($fragment[$i])) { 237 237 // Recopier le dernier fragment si implicite 238 if (!isset($fragment[$version_fin +1])) {239 $fragment[$version_fin +1] = $fragment[$i];238 if (!isset($fragment[$version_fin + 1])) { 239 $fragment[$version_fin + 1] = $fragment[$i]; 240 240 } 241 241 unset($fragment[$i]); … … 248 248 $agreger = false; 249 249 if (isset($deb_fragment[$id_fragment])) { 250 $agreger = (count($deb_fragment[$id_fragment]) +count($fragment) <= $agregation_versions);250 $agreger = (count($deb_fragment[$id_fragment]) + count($fragment) <= $agregation_versions); 251 251 if ($agreger) { 252 $fragment = $deb_fragment[$id_fragment] +$fragment;252 $fragment = $deb_fragment[$id_fragment] + $fragment; 253 253 $version_min = $deb_version_min[$id_fragment]; 254 254 } else { … … 261 261 if (!$agreger) { 262 262 // Ajuster l'intervalle des versions 263 $version_min = $version_fin +1;263 $version_min = $version_fin + 1; 264 264 } 265 265 $replaces[] = replace_fragment($id_objet, $objet, $version_min, $version_max, $id_fragment, $fragment); … … 330 330 ## la situation n'est pas meilleure ni pire qu'avant) 331 331 if ($GLOBALS['meta']['charset'] == 'utf-8' 332 ANDinclude_spip('inc/charsets')333 AND!is_utf8($fragment[$i])332 and include_spip('inc/charsets') 333 and !is_utf8($fragment[$i]) 334 334 ) { 335 335 $fragment[$i] = importer_charset($fragment[$i], 'iso-8859-1'); … … 381 381 if (isset($md2[$h])) { 382 382 $key2 = reset($md2[$h]); 383 if (isset($t1[$key1]) AND isset($t2[$key2]) AND$t1[$key1] == $t2[$key2]) {383 if (isset($t1[$key1]) and isset($t2[$key2]) and $t1[$key1] == $t2[$key2]) { 384 384 $src_dest[$key1] = $key2; 385 385 $dest_src[$key2] = $key1; … … 402 402 foreach ($t2 as $key2 => $s2) { 403 403 $r = strlen(gzcompress($s1 . $s2)); 404 $taux = 1.0 *$r/($l1[$key1]+$l2[$key2]);404 $taux = 1.0 * $r / ($l1[$key1] + $l2[$key2]); 405 405 if (!isset($gz_min1[$key1]) || !$gz_min1[$key1] || $gz_min1[$key1] > $taux) { 406 406 $gz_min1[$key1] = $taux; … … 441 441 $champs = sql_getfetsel("champs", "spip_versions", 442 442 "id_objet=" . intval($id_objet) . " AND objet=" . sql_quote($objet) . " AND id_version=" . intval($id_version)); 443 if (!$champs OR!is_array($champs = unserialize($champs))) {443 if (!$champs or !is_array($champs = unserialize($champs))) { 444 444 return array(); 445 445 } else { … … 531 531 list($ms, $sec) = explode(' ', microtime()); 532 532 $date = $sec . substr($ms, 1, 533 4) -20; // SQL ne ramene que 4 chiffres significatifs apres la virgule pour 0.0+titre_version534 $datediff = ($sec -mktime(0, 0, 0, 9, 1, 2007))*1000000+substr($ms, 2, strlen($ms)-4);533 4) - 20; // SQL ne ramene que 4 chiffres significatifs apres la virgule pour 0.0+titre_version 534 $datediff = ($sec - mktime(0, 0, 0, 9, 1, 2007)) * 1000000 + substr($ms, 2, strlen($ms) - 4); 535 535 536 536 $valeurs = array( 537 537 'id_objet' => $id_objet, 538 538 'objet' => $objet, 539 'id_version' => (0 -$datediff),539 'id_version' => (0 - $datediff), 540 540 'date' => date('Y-m-d H:i:s'), 541 541 'id_auteur' => $str_auteur, // varchar ici! … … 555 555 // 4. enregistrer une autre modif dans les 15 secondes 556 556 # sleep(15); 557 $delai = $sec -10;557 $delai = $sec - 10; 558 558 while (sql_countsel('spip_versions', 559 559 "id_objet=" . intval($id_objet) . " AND objet=" . sql_quote($objet) . " AND id_version < 0 AND 0.0+titre_version < $date AND titre_version<>" . sql_quote($date, … … 580 580 $champs_old = $row['champs']; 581 581 if ($row['id_auteur'] != $str_auteur 582 OR$row['permanent'] != 'non'583 OR strtotime($row['date']) < (time()-_INTERVALLE_REVISIONS)582 or $row['permanent'] != 'non' 583 or strtotime($row['date']) < (time() - _INTERVALLE_REVISIONS) 584 584 ) { 585 585 spip_log(strtotime($row['date']), 'revisions'); … … 598 598 } 599 599 600 $next = !$next ? 1 : ($next['id_fragment'] +1);600 $next = !$next ? 1 : ($next['id_fragment'] + 1); 601 601 602 602 // Generer les nouveaux fragments … … 618 618 // eviter une notice PHP au tout debut de la boucle 619 619 // on ajoute ''=>0 en debut de tableau. 620 $paras_champ = array($nom => 0) +$paras_champ;620 $paras_champ = array($nom => 0) + $paras_champ; 621 621 622 622 for ($i = 0; $i < $n; $i++) { 623 623 while ($i >= $paras_champ[$nom]) { 624 list($nom, ) = each($champs);624 list($nom, ) = each($champs); 625 625 } 626 626 // Lier au fragment existant si possible, sinon creer un nouveau fragment … … 727 727 // quand le dernier tag est ouvrant le refermer ... 728 728 $reg = end($regs); 729 if (!$reg[1] AND$reg[2]) {729 if (!$reg[1] and $reg[2]) { 730 730 $texte .= "</$reg[2]>"; 731 731 } … … 755 755 include_spip('base/objets'); 756 756 if ($infos = lister_tables_objets_sql($table) 757 ANDisset($infos['champs_versionnes'])757 and isset($infos['champs_versionnes']) 758 758 ) { 759 759 return $infos['champs_versionnes']; … … 833 833 $champs_originaux[$v] = recuperer_valeur_champ_jointure($objet, $id_objet, substr($v, 9)); 834 834 } 835 if (isset($champs_originaux[$v]) AND isset($originaux[$v]) ANDstrlen($originaux[$v])) {835 if (isset($champs_originaux[$v]) and isset($originaux[$v]) and strlen($originaux[$v])) { 836 836 $premiere = true; 837 837 } … … 848 848 $date_modif = ""; 849 849 foreach (array('date_modif', 'maj') as $d) { 850 if (!$date_modif AND isset($originaux[$d]) AND$t = strtotime($d)) {851 $date_modif = date("Y-m-d H:i:s", $t -20);850 if (!$date_modif and isset($originaux[$d]) and $t = strtotime($d)) { 851 $date_modif = date("Y-m-d H:i:s", $t - 20); 852 852 } 853 853 } 854 854 if (!$date_modif 855 ANDisset($desc['date'])856 ANDisset($originaux[$desc['date']])855 and isset($desc['date']) 856 and isset($originaux[$desc['date']]) 857 857 ) { 858 858 $date_modif = $originaux[$desc['date']]; 859 859 } elseif (!$date_modif) { 860 $date_modif = date("Y-m-d H:i:s", time() -20);860 $date_modif = date("Y-m-d H:i:s", time() - 20); 861 861 } 862 862 … … 872 872 return $id_version; 873 873 } 874 875 ?> -
_core_/plugins/revisions/inc/revisions_autoriser.php
r93622 r93651 78 78 // ET pas de version... pas de bouton, c'est inutile... 79 79 include_spip('inc/config'); 80 if (!lire_config('objets_versions/') AND!sql_countsel('spip_versions')) {80 if (!lire_config('objets_versions/') and !sql_countsel('spip_versions')) { 81 81 return false; 82 82 } … … 84 84 return true; 85 85 } 86 87 ?> -
_core_/plugins/revisions/inc/revisions_pipeline.php
r93622 r93651 31 31 $type = $flux['args']['type']; 32 32 if ($id = intval($flux['args']['id']) 33 AND$tables = unserialize($GLOBALS['meta']['objets_versions'])34 ANDin_array(table_objet_sql($type), $tables)35 ANDautoriser('voirrevisions', $type, $id)33 and $tables = unserialize($GLOBALS['meta']['objets_versions']) 34 and in_array(table_objet_sql($type), $tables) 35 and autoriser('voirrevisions', $type, $id) 36 36 // regarder le numero de revision le plus eleve, et afficher le bouton 37 37 // si c'est interessant (id_version>1) 38 ANDsql_countsel('spip_versions', 'id_objet=' . intval($id) . ' AND objet = ' . sql_quote($type)) > 138 and sql_countsel('spip_versions', 'id_objet=' . intval($id) . ' AND objet = ' . sql_quote($type)) > 1 39 39 ) { 40 40 include_spip('inc/presentation'); … … 95 95 function revisions_formulaire_charger($flux) { 96 96 if (strncmp($flux['args']['form'], 'editer_', 7) == 0 97 AND$id_version = _request('id_version')98 AND$objet = substr($flux['args']['form'], 7)99 AND$id_table_objet = id_table_objet($objet)100 ANDisset($flux['data'][$id_table_objet])101 AND$id = intval($flux['data'][$id_table_objet])102 AND!$flux['args']['je_suis_poste']97 and $id_version = _request('id_version') 98 and $objet = substr($flux['args']['form'], 7) 99 and $id_table_objet = id_table_objet($objet) 100 and isset($flux['data'][$id_table_objet]) 101 and $id = intval($flux['data'][$id_table_objet]) 102 and !$flux['args']['je_suis_poste'] 103 103 ) { 104 104 // ajouter un message convival pour indiquer qu'on a restaure la version … … 151 151 // ne rien faire quand on passe ici en controle md5 152 152 if (!isset($x['args']['action']) 153 OR$x['args']['action'] !== 'controler'153 or $x['args']['action'] !== 'controler' 154 154 ) { 155 155 $table = $x['args']['table']; … … 177 177 function revisions_pre_edition_lien($x) { 178 178 if (intval($x['args']['id_objet_source']) > 0 179 ANDintval($x['args']['id_objet']) > 0179 and intval($x['args']['id_objet']) > 0 180 180 ) { 181 181 $table = table_objet_sql($x['args']['objet']); … … 186 186 } // ex : si le champ jointure_mots est versionnable sur les articles 187 187 elseif ($versionnes = liste_champs_versionnes($table) 188 ANDin_array($j = 'jointure_' . table_objet($x['args']['objet_source']), $versionnes)188 and in_array($j = 'jointure_' . table_objet($x['args']['objet_source']), $versionnes) 189 189 ) { 190 190 verifier_premiere_revision($table, $x['args']['objet'], $id_objet, $versionnes, -1); … … 197 197 } // ex : si le champ jointure_articles est versionnable sur les mots 198 198 elseif ($versionnes = liste_champs_versionnes($table) 199 ANDin_array($j = 'jointure_' . table_objet($x['args']['objet']), $versionnes)199 and in_array($j = 'jointure_' . table_objet($x['args']['objet']), $versionnes) 200 200 ) { 201 201 verifier_premiere_revision($table, $x['args']['objet_source'], $id_objet, $versionnes, -1); … … 265 265 */ 266 266 if (intval($x['args']['id_objet_source']) > 0 267 ANDintval($x['args']['id_objet']) > 0267 and intval($x['args']['id_objet']) > 0 268 268 ) { 269 269 … … 275 275 } // ex : si le champ jointure_mots est versionnable sur les articles 276 276 elseif ($versionnes = liste_champs_versionnes($table) 277 ANDin_array($j = 'jointure_' . table_objet($x['args']['objet_source']), $versionnes)277 and in_array($j = 'jointure_' . table_objet($x['args']['objet_source']), $versionnes) 278 278 ) { 279 279 $champs = array( … … 289 289 } // ex : si le champ jointure_articles est versionnable sur les mots 290 290 elseif ($versionnes = liste_champs_versionnes($table) 291 ANDin_array($j = 'jointure_' . table_objet($x['args']['objet']), $versionnes)291 and in_array($j = 'jointure_' . table_objet($x['args']['objet']), $versionnes) 292 292 ) { 293 293 $champs = array( … … 316 316 return $taches_generales; 317 317 } 318 319 ?> -
_core_/plugins/revisions/inc/suivi_versions.php
r93622 r93651 82 82 // Remonter dans le temps pour trouver le champ en question 83 83 // pour la version demandee 84 $id_ref = $id_version -1;84 $id_ref = $id_version - 1; 85 85 $prev = array(); 86 while (!isset($prev[$champ]) AND$id_ref > 0) {86 while (!isset($prev[$champ]) and $id_ref > 0) { 87 87 $prev = recuperer_version($id_objet, $objet, $id_ref--); 88 88 } … … 180 180 181 181 // si on a les deux, le diff nous interesse, plus ou moins court 182 if (isset($new[$champ]) ANDisset($old[$champ])) {182 if (isset($new[$champ]) and isset($old[$champ])) { 183 183 if (!$afficher_diff = charger_fonction($objet . "_" . $champ, 'afficher_diff', true) 184 AND!$afficher_diff = charger_fonction($champ, 'afficher_diff', true)184 and !$afficher_diff = charger_fonction($champ, 'afficher_diff', true) 185 185 ) { 186 186 $afficher_diff = (strncmp($champ, 'jointure_', 9) == 0 ? $afficher_diff_jointure : $afficher_diff_champ); … … 199 199 return $textes; 200 200 } 201 202 ?> -
_core_/plugins/revisions/prive/objets/contenu/revision_fonctions.php
r93622 r93651 49 49 return $label ? _T($label) : ""; 50 50 } 51 52 ?> -
_core_/plugins/revisions/prive/objets/liste/versions_fonctions.php
r93622 r93651 7 7 include_spip('inc/puce_statut'); 8 8 include_spip('inc/suivi_versions'); 9 10 ?> -
_core_/plugins/revisions/prive/rss/revisions_fonctions.php
r93622 r93651 16 16 17 17 include_spip('inc/suivi_versions'); 18 19 ?> -
_core_/plugins/revisions/revisions_administrations.php
r93622 r93651 35 35 $trouver_table = charger_fonction('trouver_table', 'base'); 36 36 if ($desc = $trouver_table('spip_versions') 37 AND isset($desc['exist']) AND$desc['exist']38 ANDisset($desc['field']['id_article'])37 and isset($desc['exist']) and $desc['exist'] 38 and isset($desc['field']['id_article']) 39 39 ) { 40 40 ecrire_meta($nom_meta_base_version, '1.0.0'); … … 102 102 // si la decompression echoue, on met en base le flag 'corrompu-gz' 103 103 // et au dump le framgment compresse dans un fichier 104 if (strlen($row['fragment']) AND$fragment === false) {104 if (strlen($row['fragment']) and $fragment === false) { 105 105 $dir_tmp = sous_repertoire(_DIR_TMP, "versions_fragments_corrompus"); 106 106 $f = $row['id_fragment'] . "-" . $row['objet'] . "-" . $row['id_objet']; … … 138 138 139 139 // verifier que le fragment est bien serializable 140 if (unserialize($fragment) === false ANDstrncmp($fragment, "corrompu", 8) !== 0) {140 if (unserialize($fragment) === false and strncmp($fragment, "corrompu", 8) !== 0) { 141 141 $dir_tmp = sous_repertoire(_DIR_TMP, "versions_fragments_corrompus"); 142 142 $set['fragment'] = revisions_repair_serialise($fragment); … … 180 180 } 181 181 if (strlen($s) < $l) { 182 $s .= str_pad("", $l -strlen($s), " ");182 $s .= str_pad("", $l - strlen($s), " "); 183 183 } 184 184 if (strlen($s) == $l) { … … 245 245 ecrire_meta('objets_versions', serialize($versions)); 246 246 } 247 248 249 ?> -
_core_/plugins/revisions/revisions_ieconfig.php
r93622 r93651 24 24 return $table; 25 25 } 26 27 ?>
Note: See TracChangeset
for help on using the changeset viewer.