[geeklog-cvs] Geeklog-1.x/public_html/admin configuration.php, 1.4, 1.5

Dirk Haun dhaun at qs1489.pair.com
Sun Jan 20 15:55:19 EST 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin
In directory qs1489.pair.com:/tmp/cvs-serv89817/public_html/admin

Modified Files:
	configuration.php 
Log Message:
Introduced a new config type 'fn:' that calls a specified function to provide contents of a dropdown at runtime, e.g. for the language and theme selection


Index: configuration.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/configuration.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** configuration.php	13 Jan 2008 21:47:15 -0000	1.4
--- configuration.php	20 Jan 2008 20:55:17 -0000	1.5
***************
*** 9,13 ****
  // | Loads the administration UI and sends input to config.class               |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2007 by the following authors:                              |
  // |                                                                           |
  // | Authors: Aaron Blankstein  - kantai AT gmail DOT com                      |
--- 9,13 ----
  // | Loads the administration UI and sends input to config.class               |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2007-2008 by the following authors:                         |
  // |                                                                           |
  // | Authors: Aaron Blankstein  - kantai AT gmail DOT com                      |
***************
*** 40,45 ****
  
  
! function configmanager_menu() {
!     global $config,$conf_group,$LANG_configsubgroups;
  
      $retval = COM_startBlock( 'Config Sections', '', 'blockheader.thtml');
--- 40,46 ----
  
  
! function configmanager_menu()
! {
!     global $config, $conf_group, $LANG_configsubgroups;
  
      $retval = COM_startBlock( 'Config Sections', '', 'blockheader.thtml');
***************
*** 70,73 ****
--- 71,125 ----
  }
  
+ /**
+ * Helper function: Provide language dropdown
+ *
+ * @return   Array   Array of (filename, displayname) pairs
+ *
+ * @note     Note that key/value are being swapped!
+ *
+ */
+ function configmanager_languageList()
+ {
+     global $_CONF;
+ 
+     return array_flip(MBYTE_languageList($_CONF['default_charset']));
+ }
+ 
+ /**
+ * Helper function: Provide themes dropdown
+ *
+ * @return   Array   Array of (filename, displayname) pairs
+ *
+ * @note     Beautifying code duplicated from usersettings.php
+ *
+ */
+ function configmanager_themeList()
+ {
+     $themes = array();
+ 
+     $themeFiles = COM_getThemes(true);
+     usort($themeFiles,
+           create_function('$a,$b', 'return strcasecmp($a,$b);'));
+ 
+     foreach ($themeFiles as $theme) {
+         $words = explode ('_', $theme);
+         $bwords = array ();
+         foreach ($words as $th) {
+             if ((strtolower ($th{0}) == $th{0}) &&
+                 (strtolower ($th{1}) == $th{1})) {
+                 $bwords[] = strtoupper ($th{0}) . substr ($th, 1);
+             } else {
+                 $bwords[] = $th;
+             }
+         }
+ 
+         $themes[implode(' ', $bwords)] = $theme;
+     }
+ 
+     return $themes;
+ }
+ 
+ 
+ // MAIN
  if (array_key_exists('set_action', $_POST)){
      if (SEC_inGroup('Root')) {




More information about the geeklog-cvs mailing list