@@ -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 | // Cette action permet de confirmer un changement d'email |
@@ -27,8 +29,9 @@ discard block |
||
| 27 | 29 | } |
| 28 | 30 | // verifier avant de rediriger pour invalider le message de confirmation |
| 29 | 31 | // si ca n'a pas marche |
| 30 | - if ($redirect = _request('redirect') AND !$arg == sql_getfetsel('email', 'spip_auteurs', 'id_auteur='.intval($GLOBALS['visiteur_session']))) |
|
| 31 | - $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif',''); |
|
| 32 | + if ($redirect = _request('redirect') AND !$arg == sql_getfetsel('email', 'spip_auteurs', 'id_auteur='.intval($GLOBALS['visiteur_session']))) { |
|
| 33 | + $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif',''); |
|
| 34 | + } |
|
| 32 | 35 | |
| 33 | 36 | } |
| 34 | 37 | |
@@ -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 | /** |
| 16 | 18 | * Url pour lancer le cron de manière asynchrone si le serveur |
@@ -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 | * Retour d'authentification pour les SSO |
@@ -22,8 +24,7 @@ discard block |
||
| 22 | 24 | |
| 23 | 25 | if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
| 24 | 26 | spip_log("action_auth_dist $arg pas compris"); |
| 25 | - } |
|
| 26 | - else { |
|
| 27 | + } else { |
|
| 27 | 28 | $auth_methode = $r[1]; |
| 28 | 29 | $login = $r[2]; |
| 29 | 30 | include_spip('inc/auth'); |
@@ -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 | // http://doc.spip.org/@action_purger_dist |
| 16 | 18 | function action_purger_dist($arg=null) |
@@ -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 | * L'entree par l'action ne sert plus qu'a une retro compat eventuelle |
@@ -25,11 +27,13 @@ discard block |
||
| 25 | 27 | |
| 26 | 28 | $arg = rawurldecode($arg); |
| 27 | 29 | |
| 28 | - if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) |
|
| 29 | - spip_log("action iconifier: $arg pas compris"); |
|
| 30 | - elseif ($r[1] == '+') |
|
| 31 | - action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
|
| 32 | - else action_spip_image_effacer_dist($r[2]); |
|
| 30 | + if (!preg_match(',^-?\d*(\D)(.*)$,',$arg, $r)) { |
|
| 31 | + spip_log("action iconifier: $arg pas compris"); |
|
| 32 | + } elseif ($r[1] == '+') { |
|
| 33 | + action_spip_image_ajouter_dist($r[2], _request('sousaction2'), _request('source')); |
|
| 34 | + } else { |
|
| 35 | + action_spip_image_effacer_dist($r[2]); |
|
| 36 | + } |
|
| 33 | 37 | |
| 34 | 38 | if(_request("iframe") == 'iframe') { |
| 35 | 39 | $redirect = urldecode($iframe_redirect)."&iframe=iframe"; |
@@ -40,9 +44,10 @@ discard block |
||
| 40 | 44 | // http://doc.spip.org/@action_spip_image_effacer_dist |
| 41 | 45 | function action_spip_image_effacer_dist($arg) { |
| 42 | 46 | |
| 43 | - if (!strstr($arg, "..")) |
|
| 44 | - spip_unlink(_DIR_LOGOS . $arg); |
|
| 45 | -} |
|
| 47 | + if (!strstr($arg, "..")) { |
|
| 48 | + spip_unlink(_DIR_LOGOS . $arg); |
|
| 49 | + } |
|
| 50 | + } |
|
| 46 | 51 | |
| 47 | 52 | // |
| 48 | 53 | // Ajouter un logo |
@@ -56,30 +61,34 @@ discard block |
||
| 56 | 61 | |
| 57 | 62 | include_spip('inc/documents'); |
| 58 | 63 | if (!$sousaction2) { |
| 59 | - if (!$_FILES) $_FILES = $GLOBALS['HTTP_POST_FILES']; |
|
| 64 | + if (!$_FILES) { |
|
| 65 | + $_FILES = $GLOBALS['HTTP_POST_FILES']; |
|
| 66 | + } |
|
| 60 | 67 | $source = (is_array($_FILES) ? array_pop($_FILES) : ""); |
| 61 | 68 | } |
| 62 | 69 | $erreur = ""; |
| 63 | - if (!$source) |
|
| 64 | - spip_log("spip_image_ajouter : source inconnue"); |
|
| 65 | - else { |
|
| 70 | + if (!$source) { |
|
| 71 | + spip_log("spip_image_ajouter : source inconnue"); |
|
| 72 | + } else { |
|
| 66 | 73 | $f =_DIR_LOGOS . $arg . '.tmp'; |
| 67 | 74 | |
| 68 | - if (!is_array($source)) |
|
| 69 | - // fichier dans upload/ |
|
| 75 | + if (!is_array($source)) { |
|
| 76 | + // fichier dans upload/ |
|
| 70 | 77 | $source = @copy(determine_upload() . $source, $f); |
| 71 | - else { |
|
| 78 | + } else { |
|
| 72 | 79 | // Intercepter une erreur a l'envoi |
| 73 | - if ($erreur = check_upload_error($source['error'],"",$return)) |
|
| 74 | - $source =""; |
|
| 75 | - else |
|
| 76 | - // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 80 | + if ($erreur = check_upload_error($source['error'],"",$return)) { |
|
| 81 | + $source =""; |
|
| 82 | + } else { |
|
| 83 | + // analyse le type de l'image (on ne fait pas confiance au nom de |
|
| 77 | 84 | // fichier envoye par le browser : pour les Macs c'est plus sur) |
| 78 | 85 | |
| 79 | 86 | $source = deplacer_fichier_upload($source['tmp_name'], $f); |
| 87 | + } |
|
| 88 | + } |
|
| 89 | + if (!$source) { |
|
| 90 | + spip_log("pb de copie pour $f"); |
|
| 80 | 91 | } |
| 81 | - if (!$source) |
|
| 82 | - spip_log("pb de copie pour $f"); |
|
| 83 | 92 | } |
| 84 | 93 | if ($source AND $f) { |
| 85 | 94 | $size = @getimagesize($f); |
@@ -93,9 +102,7 @@ discard block |
||
| 93 | 102 | $erreur = _T('info_logo_max_poids', |
| 94 | 103 | array('maxi' => taille_en_octets(_LOGO_MAX_SIZE*1024), |
| 95 | 104 | 'actuel' => taille_en_octets($poids))); |
| 96 | - } |
|
| 97 | - |
|
| 98 | - elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
|
| 105 | + } elseif (_LOGO_MAX_WIDTH * _LOGO_MAX_HEIGHT |
|
| 99 | 106 | AND ($size[0] > _LOGO_MAX_WIDTH |
| 100 | 107 | OR $size[1] > _LOGO_MAX_HEIGHT)) { |
| 101 | 108 | spip_unlink ($f); |
@@ -110,11 +117,10 @@ discard block |
||
| 110 | 117 | array('largeur_vignette' => $size[0], |
| 111 | 118 | 'hauteur_vignette' => $size[1])) |
| 112 | 119 | )); |
| 120 | + } else { |
|
| 121 | + @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 113 | 122 | } |
| 114 | - else |
|
| 115 | - @rename ($f, _DIR_LOGOS . $arg . ".$type"); |
|
| 116 | - } |
|
| 117 | - else { |
|
| 123 | + } else { |
|
| 118 | 124 | spip_unlink ($f); |
| 119 | 125 | $erreur = _T('info_logo_format_interdit', |
| 120 | 126 | array('formats' => join(', ', $formats_logos))); |
@@ -122,10 +128,11 @@ discard block |
||
| 122 | 128 | |
| 123 | 129 | } |
| 124 | 130 | if ($erreur){ |
| 125 | - if ($return) |
|
| 126 | - return $erreur; |
|
| 127 | - else |
|
| 128 | - check_upload_error(6,$erreur); |
|
| 131 | + if ($return) { |
|
| 132 | + return $erreur; |
|
| 133 | + } else { |
|
| 134 | + check_upload_error(6,$erreur); |
|
| 135 | + } |
|
| 129 | 136 | } |
| 130 | 137 | } |
| 131 | 138 | ?> |
@@ -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 | /** |
| 16 | 18 | * Purger la liste des travaux en attente |
@@ -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 | |
@@ -34,8 +36,7 @@ discard block |
||
| 34 | 36 | 'taille' => "<b>".(taille_en_octets($taille) > 0 ? taille_en_octets($taille) : "0 octet")."</b>" |
| 35 | 37 | ) |
| 36 | 38 | ); |
| 37 | - } |
|
| 38 | - else { |
|
| 39 | + } else { |
|
| 39 | 40 | include_spip('inc/invalideur'); |
| 40 | 41 | $taille = |
| 41 | 42 | calculer_taille_dossier(_DIR_CACHE_XML) |
@@ -46,11 +47,9 @@ discard block |
||
| 46 | 47 | $taille += intval(taille_du_cache()); |
| 47 | 48 | if ($taille<=150000){ |
| 48 | 49 | $res = _T('taille_cache_vide'); |
| 49 | - } |
|
| 50 | - elseif ($taille<=1024*1024){ |
|
| 50 | + } elseif ($taille<=1024*1024){ |
|
| 51 | 51 | $res = _T('taille_cache_moins_de',array('octets'=>taille_en_octets(1024*1024))); |
| 52 | - } |
|
| 53 | - else { |
|
| 52 | + } else { |
|
| 54 | 53 | $res = _T('taille_cache_octets',array('octets'=>taille_en_octets($taille))); |
| 55 | 54 | } |
| 56 | 55 | $res = "<b>$res</b>"; |
@@ -71,16 +70,20 @@ discard block |
||
| 71 | 70 | */ |
| 72 | 71 | function calculer_taille_dossier ($dir) { |
| 73 | 72 | $handle = @opendir($dir); |
| 74 | - if (!$handle) return 0; |
|
| 73 | + if (!$handle) { |
|
| 74 | + return 0; |
|
| 75 | + } |
|
| 75 | 76 | $taille = 0; |
| 76 | 77 | while (($fichier = @readdir($handle)) !== false) { |
| 77 | 78 | // Eviter ".", "..", ".htaccess", etc. |
| 78 | - if ($fichier[0] == '.') continue; |
|
| 79 | + if ($fichier[0] == '.') { |
|
| 80 | + continue; |
|
| 81 | + } |
|
| 79 | 82 | if (is_file($d = "$dir/$fichier")) { |
| 80 | 83 | $taille += filesize($d); |
| 84 | + } else if (is_dir($d)) { |
|
| 85 | + $taille += calculer_taille_dossier($d); |
|
| 81 | 86 | } |
| 82 | - else if (is_dir($d)) |
|
| 83 | - $taille += calculer_taille_dossier($d); |
|
| 84 | 87 | } |
| 85 | 88 | closedir($handle); |
| 86 | 89 | return $taille; |
@@ -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 | /** |
| 16 | 18 | * Annuler un travail |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | * @package SPIP\Liens\API |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | -if (!defined('_ECRIRE_INC_VERSION')) return; |
|
| 19 | +if (!defined('_ECRIRE_INC_VERSION')) { |
|
| 20 | + return; |
|
| 21 | +} |
|
| 20 | 22 | |
| 21 | 23 | |
| 22 | 24 | |
@@ -39,8 +41,9 @@ discard block |
||
| 39 | 41 | if ($primary = id_table_objet($objet) |
| 40 | 42 | AND $trouver_table($l = $table_sql."_liens") |
| 41 | 43 | AND !preg_match(',[^\w],',$primary) |
| 42 | - AND !preg_match(',[^\w],',$l)) |
|
| 43 | - return array($primary,$l); |
|
| 44 | + AND !preg_match(',[^\w],',$l)) { |
|
| 45 | + return array($primary,$l); |
|
| 46 | + } |
|
| 44 | 47 | |
| 45 | 48 | spip_log("Objet $objet non associable : ne dispose pas d'une cle primaire $primary OU d'une table liens $l"); |
| 46 | 49 | return false; |
@@ -71,8 +74,9 @@ discard block |
||
| 71 | 74 | function objet_associer($objets_source, $objets_lies, $qualif = null){ |
| 72 | 75 | $modifs = objet_traiter_liaisons('lien_insert', $objets_source, $objets_lies); |
| 73 | 76 | |
| 74 | - if ($qualif) |
|
| 75 | - objet_qualifier_liens($objets_source, $objets_lies, $qualif); |
|
| 77 | + if ($qualif) { |
|
| 78 | + objet_qualifier_liens($objets_source, $objets_lies, $qualif); |
|
| 79 | + } |
|
| 76 | 80 | |
| 77 | 81 | return $modifs; // pas d'erreur |
| 78 | 82 | } |
@@ -218,8 +222,7 @@ discard block |
||
| 218 | 222 | $n++; |
| 219 | 223 | if ($infos['type']==$objet){ |
| 220 | 224 | objet_associer(array($objet=>$id_cible),array($lien['objet']=>$lien[$lien['objet']]),$lien); |
| 221 | - } |
|
| 222 | - else { |
|
| 225 | + } else { |
|
| 223 | 226 | objet_associer(array($infos['type']=>$lien[$infos['type']]),array($objet=>$id_cible),$lien); |
| 224 | 227 | } |
| 225 | 228 | } |
@@ -259,15 +262,17 @@ discard block |
||
| 259 | 262 | */ |
| 260 | 263 | function objet_traiter_liaisons($operation,$objets_source,$objets_lies, $set = null){ |
| 261 | 264 | // accepter une syntaxe minimale pour supprimer tous les liens |
| 262 | - if ($objets_lies=='*') $objets_lies = array('*'=>'*'); |
|
| 265 | + if ($objets_lies=='*') { |
|
| 266 | + $objets_lies = array('*'=>'*'); |
|
| 267 | + } |
|
| 263 | 268 | $modifs = 0; // compter le nombre de modifications |
| 264 | 269 | $echec = null; |
| 265 | 270 | foreach($objets_source as $objet=>$ids){ |
| 266 | 271 | if ($a = objet_associable($objet)) { |
| 267 | 272 | list($primary,$l) = $a; |
| 268 | - if (!is_array($ids)) |
|
| 269 | - $ids = array($ids); |
|
| 270 | - elseif(reset($ids)=="NOT"){ |
|
| 273 | + if (!is_array($ids)) { |
|
| 274 | + $ids = array($ids); |
|
| 275 | + } elseif(reset($ids)=="NOT"){ |
|
| 271 | 276 | // si on demande un array('NOT',...) => recuperer la liste d'ids correspondants |
| 272 | 277 | $where = lien_where($primary,$ids,'*','*'); |
| 273 | 278 | $ids = sql_allfetsel($primary,$l,$where); |
@@ -278,13 +283,13 @@ discard block |
||
| 278 | 283 | if ($res===false) { |
| 279 | 284 | spip_log("objet_traiter_liaisons [Echec] : $operation sur $objet/$primary/$l/$id",_LOG_ERREUR); |
| 280 | 285 | $echec = true; |
| 286 | + } else { |
|
| 287 | + $modifs=($modifs?(is_array($res)?array_merge($modifs,$res):$modifs+$res):$res); |
|
| 281 | 288 | } |
| 282 | - else |
|
| 283 | - $modifs=($modifs?(is_array($res)?array_merge($modifs,$res):$modifs+$res):$res); |
|
| 284 | 289 | } |
| 290 | + } else { |
|
| 291 | + $echec = true; |
|
| 285 | 292 | } |
| 286 | - else |
|
| 287 | - $echec = true; |
|
| 288 | 293 | } |
| 289 | 294 | |
| 290 | 295 | return ($echec?false:$modifs); // pas d'erreur |
@@ -313,7 +318,9 @@ discard block |
||
| 313 | 318 | $ins = 0; |
| 314 | 319 | $echec = null; |
| 315 | 320 | foreach($objets as $objet => $id_objets){ |
| 316 | - if (!is_array($id_objets)) $id_objets = array($id_objets); |
|
| 321 | + if (!is_array($id_objets)) { |
|
| 322 | + $id_objets = array($id_objets); |
|
| 323 | + } |
|
| 317 | 324 | foreach($id_objets as $id_objet) { |
| 318 | 325 | $objet = ($objet=='*')?$objet:objet_type($objet); # securite |
| 319 | 326 | // Envoyer aux plugins |
@@ -356,9 +363,9 @@ discard block |
||
| 356 | 363 | 'data' => $id_objet |
| 357 | 364 | ) |
| 358 | 365 | ); |
| 366 | + } else { |
|
| 367 | + $echec = true; |
|
| 359 | 368 | } |
| 360 | - else |
|
| 361 | - $echec = true; |
|
| 362 | 369 | } |
| 363 | 370 | } |
| 364 | 371 | } |
@@ -378,8 +385,10 @@ discard block |
||
| 378 | 385 | function lien_where($primary, $id_source, $objet, $id_objet){ |
| 379 | 386 | if ((!is_array($id_source) AND !strlen($id_source)) |
| 380 | 387 | OR !strlen($objet) |
| 381 | - OR (!is_array($id_objet) AND !strlen($id_objet))) |
|
| 382 | - return array("0=1"); // securite |
|
| 388 | + OR (!is_array($id_objet) AND !strlen($id_objet))) { |
|
| 389 | + return array("0=1"); |
|
| 390 | + } |
|
| 391 | + // securite |
|
| 383 | 392 | |
| 384 | 393 | $not=""; |
| 385 | 394 | if (is_array($id_source) AND reset($id_source)=="NOT"){ |
@@ -387,10 +396,12 @@ discard block |
||
| 387 | 396 | $id_source = reset($id_source); |
| 388 | 397 | } |
| 389 | 398 | $where = array(); |
| 390 | - if ($id_source!=='*') |
|
| 391 | - $where[] = (is_array($id_source)?sql_in(addslashes($primary),array_map('intval',$id_source),$not):addslashes($primary) . ($not?"<>":"=") . intval($id_source)); |
|
| 392 | - elseif ($not) |
|
| 393 | - $where[] = "0=1"; // idiot mais quand meme |
|
| 399 | + if ($id_source!=='*') { |
|
| 400 | + $where[] = (is_array($id_source)?sql_in(addslashes($primary),array_map('intval',$id_source),$not):addslashes($primary) . ($not?"<>":"=") . intval($id_source)); |
|
| 401 | + } elseif ($not) { |
|
| 402 | + $where[] = "0=1"; |
|
| 403 | + } |
|
| 404 | + // idiot mais quand meme |
|
| 394 | 405 | |
| 395 | 406 | $not=""; |
| 396 | 407 | if (is_array($id_objet) AND reset($id_objet)=="NOT"){ |
@@ -398,12 +409,15 @@ discard block |
||
| 398 | 409 | $id_objet = reset($id_objet); |
| 399 | 410 | } |
| 400 | 411 | |
| 401 | - if ($objet!=='*') |
|
| 402 | - $where[] = "objet=".sql_quote($objet); |
|
| 403 | - if ($id_objet!=='*') |
|
| 404 | - $where[] = (is_array($id_objet)?sql_in('id_objet',array_map('intval',$id_objet),$not):"id_objet" . ($not?"<>":"=") . intval($id_objet)); |
|
| 405 | - elseif ($not) |
|
| 406 | - $where[] = "0=1"; // idiot mais quand meme |
|
| 412 | + if ($objet!=='*') { |
|
| 413 | + $where[] = "objet=".sql_quote($objet); |
|
| 414 | + } |
|
| 415 | + if ($id_objet!=='*') { |
|
| 416 | + $where[] = (is_array($id_objet)?sql_in('id_objet',array_map('intval',$id_objet),$not):"id_objet" . ($not?"<>":"=") . intval($id_objet)); |
|
| 417 | + } elseif ($not) { |
|
| 418 | + $where[] = "0=1"; |
|
| 419 | + } |
|
| 420 | + // idiot mais quand meme |
|
| 407 | 421 | |
| 408 | 422 | return $where; |
| 409 | 423 | } |
@@ -431,7 +445,9 @@ discard block |
||
| 431 | 445 | $echec = false; |
| 432 | 446 | foreach($objets as $objet => $id_objets){ |
| 433 | 447 | $objet = ($objet=='*')?$objet:objet_type($objet); # securite |
| 434 | - if (!is_array($id_objets) OR reset($id_objets)=="NOT") $id_objets = array($id_objets); |
|
| 448 | + if (!is_array($id_objets) OR reset($id_objets)=="NOT") { |
|
| 449 | + $id_objets = array($id_objets); |
|
| 450 | + } |
|
| 435 | 451 | foreach($id_objets as $id_objet) { |
| 436 | 452 | // id_objet peut valoir '*' |
| 437 | 453 | $where = lien_where($primary, $id, $objet, $id_objet); |
@@ -460,9 +476,9 @@ discard block |
||
| 460 | 476 | $dels+=$e; |
| 461 | 477 | lien_propage_date_modif($l['objet'],$id_o); |
| 462 | 478 | lien_propage_date_modif($objet_source,$l[$primary]); |
| 479 | + } else { |
|
| 480 | + $echec = true; |
|
| 463 | 481 | } |
| 464 | - else |
|
| 465 | - $echec = true; |
|
| 466 | 482 | $retire[] = array('source'=>array($objet_source=>$l[$primary]),'lien'=>array($l['objet']=>$id_o),'type'=>$l['objet'],'id'=>$id_o); |
| 467 | 483 | // Envoyer aux plugins |
| 468 | 484 | pipeline('post_edition_lien', |
@@ -512,7 +528,9 @@ discard block |
||
| 512 | 528 | $dels = 0; |
| 513 | 529 | foreach($objets as $objet => $id_objets){ |
| 514 | 530 | $objet = ($objet=='*')?$objet:objet_type($objet); # securite |
| 515 | - if (!is_array($id_objets) OR reset($id_objets)=="NOT") $id_objets = array($id_objets); |
|
| 531 | + if (!is_array($id_objets) OR reset($id_objets)=="NOT") { |
|
| 532 | + $id_objets = array($id_objets); |
|
| 533 | + } |
|
| 516 | 534 | foreach($id_objets as $id_objet) { |
| 517 | 535 | $where = lien_where($primary, $id, $objet, $id_objet); |
| 518 | 536 | # les liens vers un objet inexistant |
@@ -579,8 +597,9 @@ discard block |
||
| 579 | 597 | function lien_set($objet_source,$primary,$table_lien,$id,$objets,$qualif){ |
| 580 | 598 | $echec = null; |
| 581 | 599 | $ok = 0; |
| 582 | - if (!$qualif) |
|
| 583 | - return false; |
|
| 600 | + if (!$qualif) { |
|
| 601 | + return false; |
|
| 602 | + } |
|
| 584 | 603 | // nettoyer qualif qui peut venir directement d'un objet_trouver_lien : |
| 585 | 604 | unset($qualif[$primary]); |
| 586 | 605 | unset($qualif[$objet_source]); |
@@ -591,14 +610,17 @@ discard block |
||
| 591 | 610 | unset($qualif['id_objet']); |
| 592 | 611 | foreach($objets as $objet => $id_objets){ |
| 593 | 612 | $objet = ($objet=='*')?$objet:objet_type($objet); # securite |
| 594 | - if (!is_array($id_objets) OR reset($id_objets)=="NOT") $id_objets = array($id_objets); |
|
| 613 | + if (!is_array($id_objets) OR reset($id_objets)=="NOT") { |
|
| 614 | + $id_objets = array($id_objets); |
|
| 615 | + } |
|
| 595 | 616 | foreach($id_objets as $id_objet) { |
| 596 | 617 | $where = lien_where($primary, $id, $objet, $id_objet); |
| 597 | 618 | $e = sql_updateq($table_lien,$qualif,$where); |
| 598 | - if ($e===false) |
|
| 599 | - $echec = true; |
|
| 600 | - else |
|
| 601 | - $ok++; |
|
| 619 | + if ($e===false) { |
|
| 620 | + $echec = true; |
|
| 621 | + } else { |
|
| 622 | + $ok++; |
|
| 623 | + } |
|
| 602 | 624 | } |
| 603 | 625 | } |
| 604 | 626 | return ($echec?false:$ok); |