Administrator Plugin
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 29 Jan 2002 18:33:57 +0000 (18:33 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 29 Jan 2002 18:33:57 +0000 (18:33 +0000)
GLOBALS removed, final options defined.

Start of world-wide testing.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2288 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/administrator/defines.php
plugins/administrator/options.php

index d803e1a5d68eb02673c3e6a328e84085ee3b17c0..5d571c3a904e27a80fc3c2ad172bc3ff2b93fde9 100644 (file)
@@ -23,22 +23,9 @@ define('SMOPT_TYPE_BOOLEAN', 5);
 define('SMOPT_TYPE_HIDDEN', 6);
 define('SMOPT_TYPE_COMMENT', 7);
 define('SMOPT_TYPE_NUMLIST', 8);
-define('SMOPT_TYPE_TITLE', 128);
-
-/* Define constants for the options refresh levels. */
-define('SMOPT_REFRESH_NONE', 0);
-define('SMOPT_REFRESH_FOLDERLIST', 1);
-define('SMOPT_REFRESH_ALL', 2);
-
-/* Define constants for the options size. */
-define('SMOPT_SIZE_TINY', 0);
-define('SMOPT_SIZE_SMALL', 1);
-define('SMOPT_SIZE_MEDIUM', 2);
-define('SMOPT_SIZE_LARGE', 3);
-define('SMOPT_SIZE_HUGE', 4);
-
-define('SMOPT_SAVE_DEFAULT', 'save_option');
-define('SMOPT_SAVE_NOOP', 'save_option_noop');
+define('SMOPT_TYPE_TITLE', 9);
+define('SMOPT_TYPE_THEME', 10);
+define('SMOPT_TYPE_PLUGINS', 11);
 
 global $languages;
 
@@ -100,6 +87,7 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
                                                                    'other' => _("Not one of the above servers") ) ),
                  '$optional_delimiter' => array( 'name' => _("IMAP Folder Delimiter"),
                                                  'type' => SMOPT_TYPE_STRING,
+                                                 'comment' => _("Use \"detect\" to auto-detect."),
                                                  'size' => 10 ),
                  '$useSendmail' => array( 'name' => _("Use Sendmail"),
                                           'type' => SMOPT_TYPE_BOOLEAN ),
@@ -160,8 +148,16 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
                  'Group4' => array( 'name' => _("General Options"),
                                     'type' => SMOPT_TYPE_TITLE ),
                  '$default_charset' => array( 'name' => _("Default Charset"),
-                                              'type' => SMOPT_TYPE_STRING,
-                                              'size' => 10 ),
+                                              'type' => SMOPT_TYPE_STRLIST,
+                                              'posvals' => array( 'iso_8859_1' => 'iso_8859_1',
+                                                                  'iso_8859_2' => 'iso_8859_2',
+                                                                  'iso_8859_7' => 'iso_8859_7',
+                                                                  'iso_8859_15' => 'iso_8859_15',
+                                                                  'iso_8859_15' => 'iso_8859_15',
+                                                                  'ns_4551_1' => 'ns_4551_1',
+                                                                  'koi8-r' => 'koi8-r',
+                                                                  'euc-KR' => 'euc-KR',
+                                                                  'windows-1251' => 'windows-1251' ) ),
                  '$data_dir' => array( 'name' => _("Data Directory"),
                                        'type' => SMOPT_TYPE_STRING,
                                        'size' => 40 ),
@@ -175,7 +171,7 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
                                                                  2 => _("Moderate"),
                                                                  3 => _("Medium"),
                                                                  4 => _("High") ) ),
-                 '$default_left_size' => array( 'name' => _("Hash Level"),
+                 '$default_left_size' => array( 'name' => _("Default Left Size"),
                                                 'type' => SMOPT_TYPE_NUMLIST,
                                                 'posvals' => $left_size_values ),
                  '$force_username_lowercase' => array( 'name' => _("Usernames in Lowercase"),
@@ -185,13 +181,20 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"),
                  '$hide_sm_attributions' => array( 'name' => _("Hide SM attributions"),
                                                    'type' => SMOPT_TYPE_BOOLEAN ),
                  /* --------------------------------------------------------*/
-                 'Group5' => array( 'name' => _("Themes"),
-                                    'type' => SMOPT_TYPE_TITLE )
-               );
-
+                 'Group5' => array( 'name' => _("Message of the Day"),
+                                    'type' => SMOPT_TYPE_TITLE ),
+                 '$motd' => array( 'name' => _("Message of the Day"),
+                                   'type' => SMOPT_TYPE_TEXTAREA,
+                                   'size' => 40 ),
+                 /* --------------------------------------------------------*/
+                 'Group6' => array( 'name' => _("Themes"),
+                                    'type' => SMOPT_TYPE_TITLE ),
+                 '$theme_css' => array( 'name' => _("Style Sheet URL (css)"),
+                                        'type' => SMOPT_TYPE_STRING,
+                                        'size' => 40 ),
+                 /* --------------------------------------------------------*/
+                 '$config_use_color' => array( 'type' => SMOPT_TYPE_HIDDEN )
 
-$defcfg['$motd'] = array( 'name' => _("Message of the Day"),
-                          'type' => SMOPT_TYPE_STRING,
-                          'size' => 40 );
+               );
 
 ?>
index cc45f04edce2d2a6ca2834ddd3663b13719e3e81..02cdc2945cc385a7dc49810d4c80f48bdc071859 100644 (file)
@@ -191,7 +191,17 @@ foreach ( $newcfg as $k => $v ) {
         $type = SMOPT_TYPE_STRING;
     }
 
+    if ( substr( $k, 0, 7 ) == '$theme[' ) {
+        $type = SMOPT_TYPE_THEME;
+    } else if ( substr( $k, 0, 9 ) == '$plugins[' ) {
+        $type = SMOPT_TYPE_PLUGINS;
+    }
+
     switch ( $type ) {
+    case SMOPT_TYPE_PLUGINS:
+    case SMOPT_TYPE_THEME:
+    case SMOPT_TYPE_HIDDEN:
+        break;
     case SMOPT_TYPE_TITLE:
         echo "<tr bgcolor=\"$color[0]\"><th colspan=2>$name</th></tr>";
         break;
@@ -242,6 +252,14 @@ foreach ( $newcfg as $k => $v ) {
         echo '</select>';
         break;
 
+    case SMOPT_TYPE_TEXTAREA:
+        if ( isset( $HTTP_POST_VARS[$e] ) ) {
+            $v = '"' . $HTTP_POST_VARS[$e] . '"';
+            $newcfg[$k] = str_replace( "\n", '', $v );
+        }
+        echo "<tr><td valign=top>$name</td><td>".
+             "<textarea cols=\"$size\" name=\"adm_$n\">" . substr( $v, 1, strlen( $v ) - 2 ) . "</textarea>";
+        break;
     case SMOPT_TYPE_STRING:
         if ( isset( $HTTP_POST_VARS[$e] ) ) {
             $v = '"' . $HTTP_POST_VARS[$e] . '"';
@@ -272,6 +290,9 @@ foreach ( $newcfg as $k => $v ) {
         echo "<tr><td>$name</td><td>" .
              "<b><i>$v</i></b>";
     }
+    if ( isset( $defcfg[$k]['comment'] ) ) {
+        echo ' &nbsp; ' . $defcfg[$k]['comment'];
+    }
     echo "</td></tr>\n";
 }
 echo "<tr bgcolor=\"$color[5]\"><th colspan=2><input value=\"" .
@@ -289,6 +310,7 @@ fwrite( $fp, "<?PHP\n".
             " * Created using the Administrator Plugin\n".
             " */\n\n" );
 
+/*
 fwrite( $fp, 'GLOBAL ' );
 $not_first = FALSE;
 foreach ( $newcfg as $k => $v ) {
@@ -303,13 +325,14 @@ foreach ( $newcfg as $k => $v ) {
         } else {
             if( $not_first ) {
                 fwrite( $fp, ', ' );
-            }        
+            }
             fwrite( $fp, $k );
         }
         $not_first = TRUE;
     }
 }
 fwrite( $fp, ";\n" );
+*/
 foreach ( $newcfg as $k => $v ) {
     if ( $k{0} == '$' ) {
         if ( substr( $k, 1, 11 ) == 'ldap_server' ) {