420 |
florian |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
// Partie publique
|
|
|
4 |
|
|
|
5 |
if (!defined("WIKINI_VERSION"))
|
|
|
6 |
{
|
|
|
7 |
die ("accès direct interdit");
|
|
|
8 |
}
|
|
|
9 |
define ('CSS_PAR_DEFAUT', 'default.css');
|
|
|
10 |
define ('SQUELETTE_PAR_DEFAUT', 'default');
|
|
|
11 |
define ('THEME_PAR_DEFAUT', 'mandarine');
|
|
|
12 |
|
|
|
13 |
//=======Changer de theme=================================================================================================
|
|
|
14 |
//on cherche tous les dossiers du repertoire themes et on les range dans le tableau $wakkaConfig['themes']
|
|
|
15 |
$repertoire = 'tools/templates/themes';
|
|
|
16 |
$dir = opendir($repertoire);
|
|
|
17 |
while (false !== ($file = readdir($dir))) {
|
|
|
18 |
if ($file!='.' && $file!='..') $wakkaConfig['themes'][$file]=$file;
|
|
|
19 |
}
|
|
|
20 |
closedir($dir);
|
|
|
21 |
|
|
|
22 |
if (isset($_POST['theme']) && array_key_exists($_POST['theme'], $wakkaConfig['themes'])) {
|
|
|
23 |
$wakkaConfig['favorite_theme'] = $_POST['theme'];
|
|
|
24 |
}
|
|
|
25 |
elseif (isset($_COOKIE['favorite_theme'])) {
|
|
|
26 |
$wakkaConfig['favorite_theme'] = $_COOKIE['favorite_theme'];
|
|
|
27 |
}
|
|
|
28 |
else {
|
|
|
29 |
$wakkaConfig['favorite_theme'] = THEME_PAR_DEFAUT;
|
|
|
30 |
|
|
|
31 |
}
|
|
|
32 |
setcookie('favorite_theme', $wakkaConfig['favorite_theme'], time() + 63115200);
|
|
|
33 |
|
|
|
34 |
//=======Changer de style=====================================================================================================
|
|
|
35 |
//on cherche tous les fichiers avec l'extension .css du répertoire des styles et on les range dans le tableau $wakkaConfig['styles']
|
|
|
36 |
$repertoire = 'tools/templates/themes/'.$wakkaConfig['favorite_theme'].'/styles';
|
|
|
37 |
$dir = opendir($repertoire);
|
|
|
38 |
$styles['none']='pas de style';
|
|
|
39 |
while (false !== ($file = readdir($dir))) {
|
|
|
40 |
if (substr($file, -4, 4)=='.css') $wakkaConfig['styles'][$file]=$file;
|
|
|
41 |
}
|
|
|
42 |
closedir($dir);
|
|
|
43 |
|
|
|
44 |
if (isset($_POST['style']) && array_key_exists($_POST['style'], $wakkaConfig['styles'])) {
|
|
|
45 |
$wakkaConfig['favorite_style'] = $_POST['style'];
|
|
|
46 |
}
|
|
|
47 |
elseif (isset($_COOKIE['favorite_style'])) {
|
|
|
48 |
$wakkaConfig['favorite_style'] = $_COOKIE['favorite_style'];
|
|
|
49 |
}
|
|
|
50 |
else {
|
|
|
51 |
$wakkaConfig['favorite_style'] = CSS_PAR_DEFAUT;
|
|
|
52 |
}
|
|
|
53 |
setcookie('favorite_style', $wakkaConfig['favorite_style'], time() + 63115200);
|
|
|
54 |
|
|
|
55 |
//=======Changer de squelette=================================================================================================
|
|
|
56 |
//on cherche tous les fichiers avec l'extension .html du répertoire des squelettes et on les range dans $wakkaConfig['squelettes']
|
|
|
57 |
$repertoire = 'tools/templates/themes/'.$wakkaConfig['favorite_theme'].'/squelettes';
|
|
|
58 |
$dir = opendir($repertoire);
|
|
|
59 |
while (false !== ($file = readdir($dir))) {
|
|
|
60 |
$nom_extension_squelette=substr($file, -9, 9);
|
|
|
61 |
$nom_squelette=str_replace($nom_extension_squelette, '', $file);
|
|
|
62 |
if ($nom_extension_squelette=='.tpl.html') $wakkaConfig['squelettes'][$nom_squelette]=$file;
|
|
|
63 |
}
|
|
|
64 |
closedir($dir);
|
|
|
65 |
|
|
|
66 |
if(isset($_POST['squelette']) && array_key_exists($_POST['squelette'], $wakkaConfig['squelettes'])) {
|
|
|
67 |
$wakkaConfig['favorite_squelette'] = $_POST['squelette'];
|
|
|
68 |
}
|
|
|
69 |
elseif(isset($_COOKIE['favorite_squelette'])) {
|
|
|
70 |
$wakkaConfig['favorite_squelette'] = $_COOKIE['favorite_squelette'];
|
|
|
71 |
}
|
|
|
72 |
else {
|
|
|
73 |
$wakkaConfig['favorite_squelette'] = SQUELETTE_PAR_DEFAUT;
|
|
|
74 |
}
|
|
|
75 |
setcookie('favorite_squelette', $wakkaConfig['favorite_squelette'], time() + 63115200);
|
|
|
76 |
?>
|