1 | <?php |
---|
2 | |
---|
3 | function affdate_long($date) { |
---|
4 | return affdate_base($date, 'nom_jour').' '.affdate_base($date, 'entier'); |
---|
5 | } |
---|
6 | |
---|
7 | /*** |
---|
8 | * |me compare un id_auteur avec les auteurs d'un article |
---|
9 | * et renvoie la valeur booleenne true (vrai) si on trouve une correspondance |
---|
10 | * utilisation: <div id="forum#ID_FORUM"[(#ID_ARTICLE|me{#ID_AUTEUR}|?{' ', ''})class="me"]> |
---|
11 | ***/ |
---|
12 | function me($id_article, $id_auteur = 0) { |
---|
13 | static $deja = false; |
---|
14 | static $auteurs = array(); |
---|
15 | |
---|
16 | /* en spip 3 auteur_articles est remplacé - adapter la requete */ |
---|
17 | $table="spip_auteurs_articles"; |
---|
18 | $where="id_article"; |
---|
19 | if ($GLOBALS['meta']['version_installee'] >= '19268') { |
---|
20 | $table="spip_auteurs_liens"; |
---|
21 | $where="objet='article' AND id_objet"; |
---|
22 | } |
---|
23 | if(!$deja) { |
---|
24 | $r = spip_query("SELECT id_auteur FROM ".$table." WHERE ".$where."=$id_article"); |
---|
25 | while($row = spip_fetch_array($r)) |
---|
26 | $auteurs[] = intval($row['id_auteur']); |
---|
27 | $deja = true; |
---|
28 | } |
---|
29 | return in_array($id_auteur, $auteurs); |
---|
30 | } |
---|
31 | |
---|
32 | // lister les themes présents dans plugins/spipclear/themes |
---|
33 | function lister_themes() { |
---|
34 | $dir = _DIR_PLUGIN_SPIPCLEAR.'themes/'; |
---|
35 | $dir_perso = find_in_path('squelettes/themes/'); |
---|
36 | $Treps_themes = array(); |
---|
37 | $htm = ''; |
---|
38 | if (is_dir($dir) AND $t = @opendir($dir)) { |
---|
39 | $htm .= '<ul style="height: 350px; overflow: auto; margin: 10px 0; border: 1px solid #ccc; background: #fff;">'; |
---|
40 | while (($rt = readdir($t)) !== false) { |
---|
41 | if (is_dir($dir.$rt) AND $r = @opendir($dir.$rt) AND $rt != '..') { |
---|
42 | $capture = false; |
---|
43 | $nom_theme = false; |
---|
44 | while (($f = readdir($r)) !== false) { |
---|
45 | // à minima un theme doit avoir un fichier style.css |
---|
46 | if ($f == 'style.css') $nom_theme = $rt; |
---|
47 | if ($f == 'screenshot.jpg') $capture = true; |
---|
48 | } |
---|
49 | if ($nom_theme) { |
---|
50 | $htm .= '<li style="padding-left: 10px; border-bottom: 2px solid #ccc;"><p><a id="'. $nom_theme .'" class="theme" href="#" title="'. _T(selectionner_theme) .'">'. $nom_theme .'</p>'; |
---|
51 | if ($capture) { |
---|
52 | $htm .= '<img src="'._DIR_PLUGIN_SPIPCLEAR.'themes/'.$rt.'/screenshot.jpg" />'; |
---|
53 | } |
---|
54 | $htm .= "</a></li>\r\n"; |
---|
55 | } |
---|
56 | } |
---|
57 | } |
---|
58 | if (is_dir($dir_perso) AND $t = @opendir($dir_perso)) { |
---|
59 | while (($rt = readdir($t)) !== false) { |
---|
60 | if (is_dir($dir_perso.$rt) AND $r = @opendir($dir_perso.$rt) AND $rt != '..') { |
---|
61 | $capture = false; |
---|
62 | $nom_theme = false; |
---|
63 | while (($f = readdir($r)) !== false) { |
---|
64 | // à minima un theme doit avoir un fichier style.css |
---|
65 | if ($f == 'style.css') $nom_theme = $rt; |
---|
66 | if ($f == 'screenshot.jpg') $capture = true; |
---|
67 | } |
---|
68 | if ($nom_theme) { |
---|
69 | $htm .= '<li style="padding-left: 10px; border-bottom: 2px solid #ccc;"><p><a id="'. $nom_theme .'" class="theme" href="#" title="'. _T(selectionner_theme) .'">'. $nom_theme .'</p>'; |
---|
70 | if ($capture) { |
---|
71 | $htm .= '<img src="'.$dir_perso.$rt.'/screenshot.jpg" />'; |
---|
72 | } |
---|
73 | $htm .= "</a></li>\r\n"; |
---|
74 | } |
---|
75 | } |
---|
76 | } |
---|
77 | } |
---|
78 | $htm .= '</ul>'; |
---|
79 | } |
---|
80 | return $htm; |
---|
81 | } |
---|
82 | ?> |
---|