Changeset 96937 in spip-zone
- Timestamp:
- May 2, 2016, 5:49:41 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/logos_roles/trunk/inc/chercher_logo.php
r96936 r96937 30 30 * @param string $_id_objet 31 31 * Nom de la clé primaire de l'objet 32 * @param string $mode 33 * Mode de survol du logo désiré (on ou off)32 * @param string $mode Mode de survol du logo désiré (on ou off), ou alors un 33 * rôle dont l'identifiant commence par « logo ». 34 34 * @return array 35 35 * - Liste (chemin complet du fichier, répertoire de logos, nom du logo, extension du logo, date de modification) … … 37 37 **/ 38 38 function inc_chercher_logo_dist($id, $_id_objet, $mode = 'on') { 39 # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval()40 39 41 40 $type = type_du_logo($_id_objet); 41 42 /* On commence par chercher via le mécanisme historique */ 42 43 $nom = $type . $mode . intval($id); 43 44 … … 45 46 if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { 46 47 return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); 48 } 49 } 50 51 /* Si on n'a rien trouvé, on cherche un document lié avec le bon rôle */ 52 if ($type !== 'site') { 53 54 if ($mode === 'on') { 55 $role = 'logo'; 56 } elseif ($mode === 'off') { 57 $role = 'logo_survol'; 58 } else { 59 $role = $mode; 60 } 61 62 include_spip('base/abstract_sql'); 63 $ligne = sql_fetsel( 64 'fichier, extension', 65 'spip_documents as D ' 66 . 'INNER JOIN spip_documents_liens as L ON D.id_document=L.id_document', 67 array( 68 'L.objet='.sql_quote(objet_type($_id_objet)), 69 'L.id_objet='.intval($id), 70 'L.role='.sql_quote($role), 71 ) 72 ); 73 74 if ($ligne['fichier']) { 75 76 $fichier = _DIR_IMG . $ligne['fichier']; 77 $extension = $ligne['extension']; 78 79 return array( 80 $fichier, 81 dirname($fichier) . '/', 82 basename($fichier, '.' . $extension), 83 $extension, 84 @filemtime($fichier), 85 ); 47 86 } 48 87 }
Note: See TracChangeset
for help on using the changeset viewer.