Changeset 93641 in spip-zone for _core_/plugins/grenier/inc/afficher_objets.php
- Timestamp:
- Dec 13, 2015, 2:41:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_core_/plugins/grenier/inc/afficher_objets.php
r89285 r93641 13 13 if (!defined('_ECRIRE_INC_VERSION')) return; 14 14 15 $GLOBALS['my_sites'] =array();15 $GLOBALS['my_sites'] = array(); 16 16 17 17 // http://code.spip.net/@icone_table 18 function icone_table($type) {19 $derog = array('document' => 'doc-24.png','syndic_article'=>'site-24.png', 'groupes_mot'=>'groupes-mot-24.png');18 function icone_table($type) { 19 $derog = array('document' => 'doc-24.png','syndic_article' => 'site-24.png', 'groupes_mot' => 'groupes-mot-24.png'); 20 20 if (isset($derog[$type])) 21 21 return $derog[$type]; … … 24 24 25 25 // http://code.spip.net/@lien_editer_objet 26 function lien_editer_objet($type, $key,$id){27 return $type == 'document' ? '' : generer_url_ecrire($type . "s_edit", "$key=$id");26 function lien_editer_objet($type, $key, $id) { 27 return $type == 'document' ? '' : generer_url_ecrire($type . "s_edit", "$key=$id"); 28 28 } 29 29 30 30 // http://code.spip.net/@lien_voir_objet 31 function lien_voir_objet($type, $key,$id){32 return generer_url_entite($id, $type);31 function lien_voir_objet($type, $key, $id) { 32 return generer_url_entite($id, $type); 33 33 } 34 34 35 35 // http://code.spip.net/@afficher_numero_edit 36 function afficher_numero_edit($id, $key, $type, $row=NULL) {36 function afficher_numero_edit($id, $key, $type, $row = null) { 37 37 global $spip_lang_right, $spip_lang_left,$my_sites; 38 static $numero , $style ='' ;39 if ($type =='syndic_article') {38 static $numero , $style = '' ; 39 if ($type == 'syndic_article') { 40 40 $redirect = _request('id_syndic') ? 'id_syndic='._request('id_syndic') : ''; 41 if (autoriser('modifier', $type,$id)) {41 if (autoriser('modifier', $type, $id)) { 42 42 if ($row['statut'] == "publie"){ 43 $s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-refuse", _request('exec'), $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]";43 $s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-refuse", _request('exec'), $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]"; 44 44 45 45 } 46 else 47 $s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-publie", _request('exec'), $redirect) . "'>"._T('info_retablir_lien')."</a>]";46 elseif ($row['statut'] == "refuse"){ 47 $s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-publie", _request('exec'), $redirect) . "'>"._T('info_retablir_lien')."</a>]"; 48 48 } 49 else 50 AND isset($my_sites[$id]['miroir']) AND$my_sites[$id]['miroir'] == 'oui') {49 elseif ($row['statut'] == "off" 50 and isset($my_sites[$id]['miroir']) and $my_sites[$id]['miroir'] == 'oui') { 51 51 $s = '('._T('syndic_lien_obsolete').')'; 52 52 } 53 53 else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */ 54 54 { 55 $s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-publie", _request('exec'), $redirect) . "'>"._T('info_valider_lien')."</a>]";55 $s = "[<a href='". redirige_action_auteur('instituer_syndic', "$id-publie", _request('exec'), $redirect) . "'>"._T('info_valider_lien')."</a>]"; 56 56 } 57 57 return $s; … … 65 65 } 66 66 67 if (!autoriser('modifier', $type,$id) OR68 !$href = lien_editer_objet($type, $key,$id)) {69 $bal = 'span';67 if (!autoriser('modifier', $type, $id) or 68 !$href = lien_editer_objet($type, $key, $id)) { 69 $bal = 'span'; 70 70 } else { 71 71 $bal = 'a'; … … 86 86 // puis la partie hors lien 87 87 // http://code.spip.net/@afficher_titre_objet 88 function afficher_titre_objet($type, $row){88 function afficher_titre_objet($type, $row) { 89 89 if (function_exists($f = "afficher_titre_$type")) 90 90 return $f($row); … … 94 94 (isset($row['nom_email'])?sinon($row['nom_email'], "("._T('info_sans_titre_2').")"): 95 95 "")); 96 return array(typo(supprime_img($titre, '')),'');96 return array(typo(supprime_img($titre, '')),''); 97 97 } 98 98 // http://code.spip.net/@afficher_titre_site 99 function afficher_titre_site($row) {99 function afficher_titre_site($row) { 100 100 $nom = $row['nom_site']; 101 101 102 $nom = $nom?(strlen($nom) >1?typo($nom):_T('info_sans_titre_2')):("("._T('info_sans_titre_2').")");102 $nom = $nom?(strlen($nom) > 1?typo($nom):_T('info_sans_titre_2')):("("._T('info_sans_titre_2').")"); 103 103 104 104 $s2 = " <span class='spip_xx-small'>[<a href='" … … 108 108 } 109 109 // http://code.spip.net/@afficher_titre_auteur 110 function afficher_titre_auteur($row) {110 function afficher_titre_auteur($row) { 111 111 return array($row['nom'], 112 ((isset($row['restreint']) AND$row['restreint'])112 ((isset($row['restreint']) and $row['restreint']) 113 113 ? (" <small>"._T('statut_admin_restreint')."</small>") 114 114 : '')); … … 116 116 117 117 // http://code.spip.net/@afficher_titre_syndic_article 118 function afficher_titre_syndic_article($row) {118 function afficher_titre_syndic_article($row) { 119 119 return array('', recuperer_fond( 120 120 'prive/objets/contenu/syndic_article', … … 124 124 125 125 // http://code.spip.net/@afficher_complement_objet 126 function afficher_complement_objet($type, $row){126 function afficher_complement_objet($type, $row) { 127 127 if (function_exists($f = "afficher_complement_$type")) 128 128 return $f($row); … … 131 131 132 132 // http://code.spip.net/@afficher_complement_site 133 function afficher_complement_site($row) {133 function afficher_complement_site($row) { 134 134 $syndication = $row['syndication']; 135 135 $s = ""; 136 if ($syndication == 'off' OR$syndication == 'sus') {136 if ($syndication == 'off' or $syndication == 'sus') { 137 137 $s .= "<div style='color: red;'>" 138 . http_img_pack('puce-orange-anim.gif', $syndication, "class='puce'", _T('info_panne_site_syndique'))138 . http_img_pack('puce-orange-anim.gif', $syndication, "class='puce'", _T('info_panne_site_syndique')) 139 139 . " "._T('info_probleme_grave')." </div>"; 140 140 } 141 if ($syndication == "oui" or $syndication == "off" OR$syndication == 'sus'){141 if ($syndication == "oui" or $syndication == "off" or $syndication == 'sus'){ 142 142 $s .= "<div style='color: red;'>"._T('info_syndication')."</div>"; 143 143 } 144 if ($syndication == "oui" OR $syndication == "off" OR$syndication == "sus") {144 if ($syndication == "oui" or $syndication == "off" or $syndication == "sus") { 145 145 $id_syndic = $row['id_syndic']; 146 146 $total_art = sql_countsel("spip_syndic_articles", "id_syndic=$id_syndic"); … … 152 152 } 153 153 // http://code.spip.net/@afficher_complement_syndic_article 154 function afficher_complement_syndic_article($row) {154 function afficher_complement_syndic_article($row) { 155 155 global $my_sites; 156 156 if ($GLOBALS['exec'] != 'sites') { … … 164 164 $aff = "<i>$aff</i>"; 165 165 166 $s = "<a href='" . generer_url_ecrire("sites", "id_syndic=$id_syndic") . "'>$aff</a>";166 $s = "<a href='" . generer_url_ecrire("sites", "id_syndic=$id_syndic") . "'>$aff</a>"; 167 167 168 168 return $s; … … 174 174 // Cas generique, utilise pour tout sauf article 175 175 // http://code.spip.net/@inc_afficher_objets_dist 176 function inc_afficher_objets_dist($type, $titre, $requete,$formater='', $force=false){177 if ($afficher = charger_fonction("afficher_{$type}s", 'inc',true)){178 return $afficher($titre, $requete,$formater);176 function inc_afficher_objets_dist($type, $titre, $requete, $formater = '', $force = false) { 177 if ($afficher = charger_fonction("afficher_{$type}s", 'inc', true)){ 178 return $afficher($titre, $requete, $formater); 179 179 } 180 180 181 181 if (($GLOBALS['meta']['multi_rubriques'] == 'oui' 182 AND(!isset($GLOBALS['id_rubrique'])))183 OR$GLOBALS['meta']['multi_articles'] == 'oui') {182 and (!isset($GLOBALS['id_rubrique']))) 183 or $GLOBALS['meta']['multi_articles'] == 'oui') { 184 184 $afficher_langue = true; 185 185 … … 206 206 global $spip_display; 207 207 208 if ($spip_display == 1 OR $spip_display == 4 OR!isset($GLOBALS['meta']['image_process']))208 if ($spip_display == 1 or $spip_display == 4 or !isset($GLOBALS['meta']['image_process'])) 209 209 return false; 210 210 if ($GLOBALS['meta']['image_process'] == "non") return false; … … 218 218 static $chercher_logo = true; 219 219 220 list($afficher_langue, $affrub, $langue_defaut, $formater, $type,$primary) = $own;220 list($afficher_langue, $affrub, $langue_defaut, $formater, $type, $primary) = $own; 221 221 $vals = array(); 222 222 $id_objet = $row[$primary]; 223 if (autoriser('voir', $type,$id_objet)){223 if (autoriser('voir', $type, $id_objet)){ 224 224 225 225 $date_heure = isset($row['date'])?$row['date']:(isset($row['date_heure'])?$row['date_heure']:""); … … 235 235 $vals[] = $puce_statut($id_objet, $statut, $id_rubrique, $type); 236 236 237 list($titre, $suite) = afficher_titre_objet($type,$row);237 list($titre, $suite) = afficher_titre_objet($type, $row); 238 238 $flogo = ''; 239 239 if ($chercher_logo) { 240 240 if ($chercher_logo !== true 241 OR$chercher_logo = charger_fonction_logo_if())241 or $chercher_logo = charger_fonction_logo_if()) 242 242 if ($logo = $chercher_logo($id_objet, $primary, 'on')) { 243 243 list($fid, $dir, $nom, $format) = $logo; … … 250 250 if ($titre) { 251 251 $titre = "<a href='" 252 . lien_voir_objet($type, $primary,$id_objet)252 . lien_voir_objet($type, $primary, $id_objet) 253 253 . "'>" 254 254 . $titre … … 275 275 $vals[] = $s; 276 276 277 $vals[] = afficher_complement_objet($type, $row);277 $vals[] = afficher_complement_objet($type, $row); 278 278 279 279 $s = ""; … … 281 281 $rub = sql_fetsel("id_rubrique, titre", "spip_rubriques", "id_rubrique=$id_rubrique"); 282 282 $id_rubrique = $rub['id_rubrique']; 283 $s .= "<a href='" . generer_url_entite($id_rubrique,'rubrique') . "' style=\"display:block;\">".typo($rub['titre'])."</a>"; 284 } else 285 if ($statut){ 283 $s .= "<a href='" . generer_url_entite($id_rubrique, 'rubrique') . "' style=\"display:block;\">".typo($rub['titre'])."</a>"; 284 } elseif ($statut){ 286 285 if ($statut != "prop") 287 286 $s = affdate_jourcourt($date_heure); … … 302 301 // 303 302 // http://code.spip.net/@inc_afficher_articles_dist 304 function inc_afficher_articles_dist($titre, $requete, $formater ='') {303 function inc_afficher_articles_dist($titre, $requete, $formater = '') { 305 304 306 305 if (!isset($requete['FROM'])) $requete['FROM'] = 'spip_articles AS A'; … … 351 350 // supprime les fonctions trop vieilles 352 351 foreach ($ajax_fonctions as $h => $fonc) 353 if (time() - $fonc[0] > 48 *3600)352 if (time() - $fonc[0] > 48 * 3600) 354 353 unset($ajax_fonctions[$h]); 355 354 … … 362 361 } 363 362 // http://code.spip.net/@afficher_articles_trad 364 function afficher_articles_trad($titre_table, $requete, $formater, $hash, $cpt, $trad =0) {363 function afficher_articles_trad($titre_table, $requete, $formater, $hash, $cpt, $trad = 0) { 365 364 366 365 global $spip_lang_right; … … 434 433 435 434 // http://code.spip.net/@afficher_articles_trad_boucle 436 function afficher_articles_trad_boucle($row, $own ='')435 function afficher_articles_trad_boucle($row, $own = '') 437 436 { 438 437 global $spip_lang_right, $spip_display; 439 438 440 439 $id_article = $row['id_article']; 441 if (!autoriser('voir', 'article',$id_article)) return '';440 if (!autoriser('voir', 'article', $id_article)) return ''; 442 441 443 442 $titre = $row['titre']; … … 464 463 // faudrait sortir ces invariants de boucle 465 464 466 if (($GLOBALS['meta']['multi_rubriques'] == 'oui' AND (!isset($GLOBALS['id_rubrique']))) OR$GLOBALS['meta']['multi_articles'] == 'oui') {465 if (($GLOBALS['meta']['multi_rubriques'] == 'oui' and (!isset($GLOBALS['id_rubrique']))) or $GLOBALS['meta']['multi_articles'] == 'oui') { 467 466 $langue_defaut = isset($GLOBALS['langue_rubrique']) 468 467 ? $GLOBALS['meta']['langue_site'] … … 473 472 474 473 foreach(explode(',', $GLOBALS['meta']['langues_multilingue']) as $k){ 475 if (isset($langues_art[$k]) AND $langues_art[$k]<> $id_trad){474 if (isset($langues_art[$k]) and $langues_art[$k] <> $id_trad){ 476 475 $h = generer_url_ecrire("articles", "id_article=".$langues_art[$k]); 477 476 $style = strtotime($dates_art[$k]) < strtotime($date_ref); … … 493 492 . $img 494 493 . "<a href='$h' dir='$lang_dir' style=\"display:block;\">" 495 . typo(supprime_img($titre, ''))494 . typo(supprime_img($titre, '')) 496 495 . "</a></div>"; 497 496 … … 502 501 // La petite puce de changement de statut 503 502 $puce_statut = charger_fonction('puce_statut', 'inc'); 504 $puce = $puce_statut($id_article, $statut, $id_rubrique, 'article');503 $puce = $puce_statut($id_article, $statut, $id_rubrique, 'article'); 505 504 506 505 return array($puce, … … 513 512 514 513 // http://code.spip.net/@afficher_auteurs_boucle 515 function afficher_auteurs_boucle($row, $own) {514 function afficher_auteurs_boucle($row, $own) { 516 515 $vals = array(); 517 list($afficher_langue, $affrub, $langue_defaut, $formater, $type,$primary) = $own;516 list($afficher_langue, $affrub, $langue_defaut, $formater, $type, $primary) = $own; 518 517 $formater_auteur = $formater ? $formater : charger_fonction('formater_auteur', 'inc'); 519 518 if ($row['statut'] == '0minirezo') 520 519 $row['restreint'] = sql_countsel('spip_auteurs_liens', "objet='rubrique' AND id_auteur=".intval($row['id_auteur'])); 521 520 522 list($s, $mail, $nom, $w, $p) = $formater_auteur($row['id_auteur'], $row);521 list($s, $mail, $nom, $w, $p) = $formater_auteur($row['id_auteur'], $row); 523 522 if ($w) { 524 if (preg_match(',^([^>]*>)[^<]*(.*)$,', $w, $r)) {525 $w = $r[1] . substr($row['site'], 0,20) . $r[2];523 if (preg_match(',^([^>]*>)[^<]*(.*)$,', $w, $r)) { 524 $w = $r[1] . substr($row['site'], 0, 20) . $r[2]; 526 525 } 527 526 } … … 529 528 $vals[] = $mail; 530 529 $vals[] = $nom 531 . ((isset($row['restreint']) AND$row['restreint'])530 . ((isset($row['restreint']) and $row['restreint']) 532 531 ? (" <small>"._T('statut_admin_restreint')."</small>") 533 532 : ''); … … 536 535 return $vals; 537 536 } 538 ?>
Note: See TracChangeset
for help on using the changeset viewer.