Browse Source

Supprime la constante 'DEFAULT_THEME'

Christophe HENRY 7 years ago
parent
commit
44eadca3d3
4 changed files with 13 additions and 8 deletions
  1. 2 2
      Plugin.class.php
  2. 3 3
      action.php
  3. 7 1
      common.php
  4. 1 2
      install.php

+ 2 - 2
Plugin.class.php

@@ -15,7 +15,7 @@ class Plugin{
     }
 
     public static function includeAll(){
-        global $i18n, $i18n_js;
+        global $i18n, $i18n_js, $theme;
         $pluginFiles = Plugin::getFiles(true);
         if(is_array($pluginFiles)) {
             foreach($pluginFiles as $pluginFile) {
@@ -24,7 +24,7 @@ class Plugin{
                 // Inclusion du coeur de plugin
                 include $pluginFile;
                 // Gestion des css du plugin en fonction du thème actif
-                $cssTheme = glob(dirname($pluginFile).'/*/'.DEFAULT_THEME.'.css');
+                $cssTheme = glob(dirname($pluginFile).'/*/'.$theme.'.css');
                 $cssDefault = glob(dirname($pluginFile).'/*/default.css');
                 if(isset($cssTheme[0])){
                     $GLOBALS['hooks']['css_files'][] = Functions::relativePath(str_replace('\\','/',dirname(__FILE__)),str_replace('\\','/',$cssTheme[0]));

+ 3 - 3
action.php

@@ -40,7 +40,7 @@ switch ($action){
         if (!$commandLine)
             echo '<html>
                 <head>
-                <link rel="stylesheet" href="./templates/'.DEFAULT_THEME.'/css/style.css">
+                <link rel="stylesheet" href="./templates/'.$theme.'/css/style.css">
                 </head>
                 <body>
                 <div class="sync">';
@@ -251,7 +251,7 @@ switch ($action){
 
     case 'importForm':
         if($myUser==false) exit(_t('YOU_MUST_BE_CONNECTED_ACTION'));
-        echo '<html style="height:auto;"><link rel="stylesheet" href="templates/'.DEFAULT_THEME.'/css/style.css">
+        echo '<html style="height:auto;"><link rel="stylesheet" href="templates/'.$theme.'/css/style.css">
                 <body style="height:auto;">
                     <form action="action.php?action=importFeed" method="POST" enctype="multipart/form-data">
                     <p>'._t('OPML_FILE').' : <input name="newImport" type="file"/> <button name="importButton">'._t('IMPORT').'</button></p>
@@ -265,7 +265,7 @@ switch ($action){
 
     case 'synchronizeForm':
      if(isset($myUser) && $myUser!=false){
-        echo '<link rel="stylesheet" href="templates/'.DEFAULT_THEME.'/css/style.css">
+        echo '<link rel="stylesheet" href="templates/'.$theme.'/css/style.css">
                 <a class="button" href="action.php?action=synchronize">'._t('SYNCHRONIZE_NOW').'</a>
                     <p>'._t('SYNCHRONIZE_COFFEE_TIME').'</p>
 

+ 7 - 1
common.php

@@ -88,11 +88,17 @@ $folderManager = new Folder();
 $configurationManager = new Configuration();
 $conf = $configurationManager->getAll();
 
+$theme = $configurationManager->get('theme');
+if (empty($theme)) {
+    $configurationManager->put('theme', 'marigolds');
+    $theme = $configurationManager->get('theme');
+}
+
 //Instanciation du template
 $tpl = new RainTPL();
 //Definition des dossiers de template
 raintpl::configure("base_url", null );
-raintpl::configure("tpl_dir", './templates/'.DEFAULT_THEME.'/' );
+raintpl::configure("tpl_dir", './templates/'.$theme.'/' );
 raintpl::configure("cache_dir", "./cache/tmp/" );
 
 i18n_init(LANGUAGE);

+ 1 - 2
install.php

@@ -124,8 +124,6 @@ if (isset($_['installButton']) && empty($test[$lib_errors])) { // Pas d'erreur,
     define('MYSQL_BDD','{$mysqlBase}');
     //Prefix des noms des tables leed pour les bases de données uniques
     define('MYSQL_PREFIX','{$mysqlPrefix}');
-    //Theme graphique
-    define('DEFAULT_THEME','marigolds');
     //Nombre de pages affichées dans la barre de pagination
     define('PAGINATION_SCALE',5);
     //Nombre de flux mis à jour lors de la synchronisation graduée
@@ -199,6 +197,7 @@ if (isset($_['installButton']) && empty($test[$lib_errors])) { // Pas d'erreur,
     $configurationManager->add('cryptographicSalt', $cryptographicSalt);
     $configurationManager->add('displayOnlyUnreadFeedFolder','false');
     $configurationManager->add('feedMaxEvents','50');
+    $configurationManager->add('theme','marigolds');
     $configurationManager->add('optionFeedIsVerbose',1);
     $configurationManager->add('synchronisationCode',$synchronisationCode);
     $configurationManager->add('synchronisationEnableCache','0');