@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Logos |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -37,34 +37,34 @@ discard block |
||
| 37 | 37 | **/ |
| 38 | 38 | function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on', $compat_old_logos = true) { |
| 39 | 39 | |
| 40 | - $mode = preg_replace(",\W,", '', $mode); |
|
| 41 | - if ($mode) { |
|
| 42 | - // chercher dans la base |
|
| 43 | - $mode_document = 'logo' . $mode; |
|
| 44 | - $objet = objet_type($_id_objet); |
|
| 45 | - $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', "D.mode=".sql_quote($mode_document)." AND L.objet=".sql_quote($objet)." AND id_objet=".intval($id)); |
|
| 46 | - if ($doc) { |
|
| 47 | - include_spip('inc/documents'); |
|
| 48 | - $d = get_spip_doc($doc['fichier']); |
|
| 49 | - return array($d, _DIR_IMG, basename($d), $doc['extension'], @filemtime($d), $doc); |
|
| 50 | - } |
|
| 40 | + $mode = preg_replace(",\W,", '', $mode); |
|
| 41 | + if ($mode) { |
|
| 42 | + // chercher dans la base |
|
| 43 | + $mode_document = 'logo' . $mode; |
|
| 44 | + $objet = objet_type($_id_objet); |
|
| 45 | + $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', "D.mode=".sql_quote($mode_document)." AND L.objet=".sql_quote($objet)." AND id_objet=".intval($id)); |
|
| 46 | + if ($doc) { |
|
| 47 | + include_spip('inc/documents'); |
|
| 48 | + $d = get_spip_doc($doc['fichier']); |
|
| 49 | + return array($d, _DIR_IMG, basename($d), $doc['extension'], @filemtime($d), $doc); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - # deprecated TODO remove |
|
| 53 | - if ($compat_old_logos) { |
|
| 54 | - # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
|
| 55 | - $type = type_du_logo($_id_objet); |
|
| 56 | - $nom = $type . $mode . intval($id); |
|
| 52 | + # deprecated TODO remove |
|
| 53 | + if ($compat_old_logos) { |
|
| 54 | + # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
|
| 55 | + $type = type_du_logo($_id_objet); |
|
| 56 | + $nom = $type . $mode . intval($id); |
|
| 57 | 57 | |
| 58 | - foreach ($GLOBALS['formats_logos'] as $format) { |
|
| 59 | - if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 60 | - return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 58 | + foreach ($GLOBALS['formats_logos'] as $format) { |
|
| 59 | + if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 60 | + return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - # coherence de type pour servir comme filtre (formulaire_login) |
|
| 67 | - return array(); |
|
| 66 | + # coherence de type pour servir comme filtre (formulaire_login) |
|
| 67 | + return array(); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | * @deprecated MAIS NE PAS SUPPRIMER CAR SERT POUR L'UPGRADE des logos et leur mise en base |
| 84 | 84 | **/ |
| 85 | 85 | function type_du_logo($_id_objet) { |
| 86 | - return isset($GLOBALS['table_logos'][$_id_objet]) |
|
| 87 | - ? $GLOBALS['table_logos'][$_id_objet] |
|
| 88 | - : objet_type(preg_replace(',^id_,', '', $_id_objet)); |
|
| 86 | + return isset($GLOBALS['table_logos'][$_id_objet]) |
|
| 87 | + ? $GLOBALS['table_logos'][$_id_objet] |
|
| 88 | + : objet_type(preg_replace(',^id_,', '', $_id_objet)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Exceptions standards (historique) |
| 92 | 92 | $GLOBALS['table_logos'] = array( |
| 93 | - 'id_article' => 'art', |
|
| 94 | - 'id_auteur' => 'aut', |
|
| 95 | - 'id_rubrique' => 'rub', |
|
| 96 | - 'id_groupe' => 'groupe', |
|
| 93 | + 'id_article' => 'art', |
|
| 94 | + 'id_auteur' => 'aut', |
|
| 95 | + 'id_rubrique' => 'rub', |
|
| 96 | + 'id_groupe' => 'groupe', |
|
| 97 | 97 | ); |