[ghelda-devel] [39] BIG RUN of expand: this commit switches indenting from tabs to 4-spaces. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/ghelda-devel Archives
]
Revision: 39
Author: odyx
Date: 2009-05-01 14:15:28 +0200 (Fri, 01 May 2009)
Log Message:
-----------
BIG RUN of expand: this commit switches indenting from tabs to 4-spaces.
FROM NOW ON, please use 4 spaces for indenting.
Modified Paths:
--------------
trunk/config.php
trunk/core/config.php
trunk/inc/Auth_Log_Observer.php
trunk/inc/Log_Display.php
trunk/inc/Plugin.php
trunk/inc/Plugins_Handler.php
trunk/inc/date.php
trunk/inc/error_handlers.php
trunk/inc/functions.php
trunk/inc/g_Auth.php
trunk/inc/g_functions.php
trunk/inc/g_output.inc.php
trunk/inc/output.class.php
trunk/inc/outputs/xHTML.class.php
trunk/index.php
trunk/init/auth.php
trunk/init/db.php
trunk/init/gettext.php
trunk/init/log.php
trunk/plugins/Address/config_core.php
trunk/plugins/Address.php
trunk/plugins/Childhood.php
trunk/plugins/Dummy.php
trunk/plugins/Groups/config_core.php
trunk/plugins/Groups.php
trunk/plugins/ISO3166_CountryCode.php
trunk/plugins/People.php
Modified: trunk/config.php
===================================================================
--- trunk/config.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/config.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -22,27 +22,27 @@
// Data Source Name
// phptype(dbsyntax)://username:password@protocol+hostspec/database?option=value
-$conf['DB']['DSN'] = array(
- 'phptype' => 'mysqli', // Database backend used in PHP (i.e. mysql , odbc etc.)
- 'dbsyntax' => false, // Database used with regards to SQL syntax etc.
- // When using ODBC as the phptype, set this to the DBMS type the ODBC driver is connecting to.
- // Examples: access, db2, mssql, navision, solid, etc.
- 'username' => 'ghelda',
- 'password' => 'GheldaGhelda',
- 'protocol' => false, // Communication protocol to use ( i.e. tcp, unix etc.)
- 'hostspec' => 'localhost', // Host specification (hostname[:port])
- 'port' => false,
- 'socket' => false,
- 'database' => 'ghelda',
+$conf['DB']['DSN'] = array(
+ 'phptype' => 'mysqli', // Database backend used in PHP (i.e. mysql , odbc etc.)
+ 'dbsyntax' => false, // Database used with regards to SQL syntax etc.
+ // When using ODBC as the phptype, set this to the DBMS type the ODBC driver is connecting to.
+ // Examples: access, db2, mssql, navision, solid, etc.
+ 'username' => 'ghelda',
+ 'password' => 'GheldaGhelda',
+ 'protocol' => false, // Communication protocol to use ( i.e. tcp, unix etc.)
+ 'hostspec' => 'localhost', // Host specification (hostname[:port])
+ 'port' => false,
+ 'socket' => false,
+ 'database' => 'ghelda',
);
-$conf['DB']['prefix'] = 'G_';
+$conf['DB']['prefix'] = 'G_';
$conf['Output']['Title'] = 'CONFIG - Output.Title - CONFIG';
$conf['Auth']['cryptType'] = 'sha1';
-$conf['Auth']['expire'] = 86400; // in seconds 3600 = 1 hour // (86400 = a day) // 0 = never
-$conf['Auth']['idle'] = 0; // in seconds 3600 = 1 hour // 0 = don't check idleness
+$conf['Auth']['expire'] = 86400; // in seconds 3600 = 1 hour // (86400 = a day) // 0 = never
+$conf['Auth']['idle'] = 0; // in seconds 3600 = 1 hour // 0 = don't check idleness
$conf['css']['screen'][0] = 'main.css';
// $conf['css']['screen'][1] = 'auther.css';
Modified: trunk/core/config.php
===================================================================
--- trunk/core/config.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/core/config.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -29,16 +29,16 @@
$conf['cookies']['locale'] = 'Ghelda_locale';
$conf['Auth']['sessionName'] = 'Ghelda_authsession';
-$conf['gettext']['encoding'] = 'UTF-8';
+$conf['gettext']['encoding'] = 'UTF-8';
$conf['Output']['incrementChar'] = " ";
$conf['localeNames']= array(
- "en.UTF-8" => "english",
- "fr.UTF-8" => "français",
- "vd.UTF-8" => "vaudois",
- "de.UTF-8" => "deutsch",
- );
+ "en.UTF-8" => "english",
+ "fr.UTF-8" => "français",
+ "vd.UTF-8" => "vaudois",
+ "de.UTF-8" => "deutsch",
+ );
?>
\ No newline at end of file
Modified: trunk/inc/Auth_Log_Observer.php
===================================================================
--- trunk/inc/Auth_Log_Observer.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/Auth_Log_Observer.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,17 +21,17 @@
class Auth_Log_Observer extends Log_observer
{
- private $_g_H_Log;
+ private $_g_H_Log;
- function __construct(&$LogHandler,$priority = PEAR_LOG_INFO)
- {
- $this->_g_H_Log = $LogHandler;
- parent::__construct($priority);
- }
- function notify($event)
- {
- $this->_g_H_Log->log($event);
- }
+ function __construct(&$LogHandler,$priority = PEAR_LOG_INFO)
+ {
+ $this->_g_H_Log = $LogHandler;
+ parent::__construct($priority);
+ }
+ function notify($event)
+ {
+ $this->_g_H_Log->log($event);
+ }
}
?>
Modified: trunk/inc/Log_Display.php
===================================================================
--- trunk/inc/Log_Display.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/Log_Display.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,43 +21,43 @@
class Log_Display extends Log
{
- private $messages_Buffer = array();
+ private $messages_Buffer = array();
- function __construct($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
- {
- $this->_id = md5(microtime());
- $this->_name = $name;
- $this->_ident = $ident;
- $this->_mask = Log::UPTO($level);
- }
+ function __construct($name, $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
+ {
+ $this->_id = md5(microtime());
+ $this->_name = $name;
+ $this->_ident = $ident;
+ $this->_mask = Log::UPTO($level);
+ }
- function log($message, $priority = null)
- {
- /* If a priority hasn't been specified, use the default value. */
- if ($priority === null) {
- $priority = $this->_priority;
- }
- /* Abort early if the priority is above the maximum logging level. */
- if (!$this->_isMasked($priority)) {
- return false;
- }
-
- /* Extract the string representation of the message. */
- $message = $this->_extractMessage($message);
+ function log($message, $priority = null)
+ {
+ /* If a priority hasn't been specified, use the default value. */
+ if ($priority === null) {
+ $priority = $this->_priority;
+ }
+ /* Abort early if the priority is above the maximum logging level. */
+ if (!$this->_isMasked($priority)) {
+ return false;
+ }
+
+ /* Extract the string representation of the message. */
+ $message = $this->_extractMessage($message);
- $this->messages_Buffer[] = array($message,$priority);
-
- /* Notify observers about this log message. */
- $this->_announce(array('priority' => $priority, 'message' => $message));
-
- return true;
- }
+ $this->messages_Buffer[] = array($message,$priority);
+
+ /* Notify observers about this log message. */
+ $this->_announce(array('priority' => $priority, 'message' => $message));
+
+ return true;
+ }
- public function get_messages()
- {
- return $this->messages_Buffer;
- }
-
+ public function get_messages()
+ {
+ return $this->messages_Buffer;
+ }
+
}
?>
Modified: trunk/inc/Plugin.php
===================================================================
--- trunk/inc/Plugin.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/Plugin.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,87 +21,87 @@
abstract class Plugin
{
- // Pointer to the parent to get all the needed informations
- protected $_parent; // ( Plugins_Handler )
-
- // Configuration handler
- protected $configH;
+ // Pointer to the parent to get all the needed informations
+ protected $_parent; // ( Plugins_Handler )
+
+ // Configuration handler
+ protected $configH;
- // Authorisation Handler
- protected $authH;
+ // Authorisation Handler
+ protected $authH;
- // URL handler
- protected $url;
+ // URL handler
+ protected $url;
- // Output handler
- protected $output;
+ // Output handler
+ protected $output;
- // DB handler
- protected $db;
+ // DB handler
+ protected $db;
- protected $name;
+ protected $name;
- // The translated name of the plugin
- protected $T_name;
+ // The translated name of the plugin
+ protected $T_name;
- private $coreDomain;
+ private $coreDomain;
- function __construct(&$parentRef,$name)
- {
- $this->_parent =& $parentRef;
+ function __construct(&$parentRef,$name)
+ {
+ $this->_parent =& $parentRef;
- $this->name =& $name;
+ $this->name =& $name;
- $this->configH =& $this->_parent->configH;
- $this->authH =& $this->_parent->authH;
- $this->url =& $this->_parent->url;
- $this->output =& $this->_parent->output;
- $this->db =& $this->_parent->db;
-
- $this->T_name = T_($name);
- }
+ $this->configH =& $this->_parent->configH;
+ $this->authH =& $this->_parent->authH;
+ $this->url =& $this->_parent->url;
+ $this->output =& $this->_parent->output;
+ $this->db =& $this->_parent->db;
+
+ $this->T_name = T_($name);
+ }
- // This function is to be called for initialisation (After every class has been constructed).
- // It is not abstract so as not to force downstream classes writers to implement it.
- function init() {}
+ // This function is to be called for initialisation (After every class has been constructed).
+ // It is not abstract so as not to force downstream classes writers to implement it.
+ function init() {}
- //! The core usage of the plugin.
- /*! Takes no arguments.*/
- abstract function main();
+ //! The core usage of the plugin.
+ /*! Takes no arguments.*/
+ abstract function main();
- //! Standard functionality caller
- /*!
- * @param $funcStr The functionality string (e.g. 'coffee')
- * @param $funcArgs The arguments to the functionality as an array of keyed entries.
- */
- function functionality($funcStr,$funcArgs = ''){return false;}
+ //! Standard functionality caller
+ /*!
+ * @param $funcStr The functionality string (e.g. 'coffee')
+ * @param $funcArgs The arguments to the functionality as an array of keyed entries.
+ */
+ function functionality($funcStr,$funcArgs = ''){return false;}
- //! Standard permission granter
- /*!
- * @param $permissionString The permission string (e.g. 'Member.UPDATE')
- * @param $arguments The arguments to the granting of the permission as an array of keyed entries
- */
- function getPermission($premissionString,$arguments){return false;}
+ //! Standard permission granter
+ /*!
+ * @param $permissionString The permission string (e.g. 'Member.UPDATE')
+ * @param $arguments The arguments to the granting of the permission as an array of keyed entries
+ */
+ function getPermission($premissionString,$arguments){return false;}
- //! The menu for the plugin (lists its various modes)
- function modesMenu(){ return false; }
+ //! The menu for the plugin (lists its various modes)
+ function modesMenu(){ return false; }
- //! Start the translations of the plugins.
- protected function startTrad()
- {
- $this->coreDomain = g_setDomain($this->name);
- return $this->coreDomain;
- }
-
- protected function stopTrad()
- {
- g_setDomain($this->coreDomain);
- }
+ //! Start the translations of the plugins.
+ protected function startTrad()
+ {
+ $this->coreDomain = g_setDomain($this->name);
+ return $this->coreDomain;
+ }
+
+ protected function stopTrad()
+ {
+ g_setDomain($this->coreDomain);
+ }
- public function name()
- {
- return $this->T_name;
- }
+ public function name()
+ {
+ return $this->T_name;
+ }
}
?>
Modified: trunk/inc/Plugins_Handler.php
===================================================================
--- trunk/inc/Plugins_Handler.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/Plugins_Handler.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -27,146 +27,146 @@
class Plugins_Handler
{
- // Array containing the plugins names list.
- private $pluginsNamesList = array();
+ // Array containing the plugins names list.
+ private $pluginsNamesList = array();
- // Array containing the plugins references list.
- private $pluginsList = array();
-
- // Index of the actual plugin
- private $thePluginIndex;
-
- // Pointer to it
- protected $thePlugin;
+ // Array containing the plugins references list.
+ private $pluginsList = array();
+
+ // Index of the actual plugin
+ private $thePluginIndex;
+
+ // Pointer to it
+ protected $thePlugin;
- // Configuration handler
- public $configH;
+ // Configuration handler
+ public $configH;
- // Authorisation Handler
- public $authH;
+ // Authorisation Handler
+ public $authH;
- // URL handler
- public $url;
-
- // DB handler
- public $db;
+ // URL handler
+ public $url;
+
+ // DB handler
+ public $db;
- // Output handler
- public $output;
+ // Output handler
+ public $output;
- public function __construct(&$h_Config,&$h_Auth,&$h_URL,&$h_Output,&$h_DB)
- {
- $this->configH =& $h_Config;
- $this->authH =& $h_Auth;
- $this->output =& $h_Output;
- $this->db =& $h_DB;
+ public function __construct(&$h_Config,&$h_Auth,&$h_URL,&$h_Output,&$h_DB)
+ {
+ $this->configH =& $h_Config;
+ $this->authH =& $h_Auth;
+ $this->output =& $h_Output;
+ $this->db =& $h_DB;
- // This one is cloned to get "inside" behavior
- $this->url = clone $h_URL;
+ // This one is cloned to get "inside" behavior
+ $this->url = clone $h_URL;
- $this->getPluginsList();
- }
+ $this->getPluginsList();
+ }
- private function getPluginsList()
- {
- // Get the list of supported locales
- $pluginsList = scandir(PLUGINS_DIR,1);
- // Strip the "." and ".." entries and add the default one
- $pluginsList = array_diff($pluginsList,array(".","..",".svn"));
+ private function getPluginsList()
+ {
+ // Get the list of supported locales
+ $pluginsList = scandir(PLUGINS_DIR,1);
+ // Strip the "." and ".." entries and add the default one
+ $pluginsList = array_diff($pluginsList,array(".","..",".svn"));
- // Strip out cache files and non-files
- function filtCacheFiles($str) { return ((substr($str,-1) != '~') and (substr($str,-4) != '.swp') and is_file(PLUGINS_DIR.'/'.$str));}
- $pluginsList = array_filter($pluginsList,'filtCacheFiles');
+ // Strip out cache files and non-files
+ function filtCacheFiles($str) { return ((substr($str,-1) != '~') and (substr($str,-4) != '.swp') and is_file(PLUGINS_DIR.'/'.$str));}
+ $pluginsList = array_filter($pluginsList,'filtCacheFiles');
- // Strip extension
- foreach($pluginsList as $key => $plugin) {
- $pluginsList[$key] = substr($plugin, 0, strrpos($plugin, '.'));
- }
+ // Strip extension
+ foreach($pluginsList as $key => $plugin) {
+ $pluginsList[$key] = substr($plugin, 0, strrpos($plugin, '.'));
+ }
- $this->pluginsNamesList = $pluginsList;
+ $this->pluginsNamesList = $pluginsList;
- return $pluginsList;
- }
+ return $pluginsList;
+ }
- public function loadPlugins()
- {
- foreach($this->pluginsNamesList as $pluginName) {
- require_once PLUGINS_DIR."/".$pluginName.".php";
+ public function loadPlugins()
+ {
+ foreach($this->pluginsNamesList as $pluginName) {
+ require_once PLUGINS_DIR."/".$pluginName.".php";
- unset($confLoc);
- unset($conf);
- // Get its eventual configuration
- // Include the standard configuration
- $coreDomain = g_setDomain($pluginName); // This ensures translation
- $confLoc[] = PLUGINS_DIR."/".$pluginName.'/'.PLUGIN_CONFIG_CORE;
- $confLoc[] = PLUGINS_DIR."/".$pluginName.'/'.PLUGIN_CONFIG;
- $this->configH[$pluginName] = array();
- foreach($confLoc as $confF) {
- if(is_file($confF)) {
- include $confF;
- $this->configH[$pluginName] = array_merge($this->configH[$pluginName],$conf);
- }
- }
- g_setDomain($coreDomain); // ... of the rest of the webapp ;)
+ unset($confLoc);
+ unset($conf);
+ // Get its eventual configuration
+ // Include the standard configuration
+ $coreDomain = g_setDomain($pluginName); // This ensures translation
+ $confLoc[] = PLUGINS_DIR."/".$pluginName.'/'.PLUGIN_CONFIG_CORE;
+ $confLoc[] = PLUGINS_DIR."/".$pluginName.'/'.PLUGIN_CONFIG;
+ $this->configH[$pluginName] = array();
+ foreach($confLoc as $confF) {
+ if(is_file($confF)) {
+ include $confF;
+ $this->configH[$pluginName] = array_merge($this->configH[$pluginName],$conf);
+ }
+ }
+ g_setDomain($coreDomain); // ... of the rest of the webapp ;)
- // Create each instance (so call its constructor
- $this->pluginsList[$pluginName] =& new $pluginName(&$this,$pluginName);
-
- }
+ // Create each instance (so call its constructor
+ $this->pluginsList[$pluginName] =& new $pluginName(&$this,$pluginName);
+
+ }
- // Make another run for init's
- foreach($this->pluginsList as $pluginName => $pluginInstance) {
- $pluginInstance->init();
- }
+ // Make another run for init's
+ foreach($this->pluginsList as $pluginName => $pluginInstance) {
+ $pluginInstance->init();
+ }
- return true;
- }
+ return true;
+ }
- public function &choosePlugin()
- {
- $pluginURL = $this->configH['URL']['plugin'];
- $thePluginName = array_key_exists($pluginURL,$this->url->querystring) ? $this->url->querystring[$pluginURL] : $this->configH['plugins']['default'];
+ public function &choosePlugin()
+ {
+ $pluginURL = $this->configH['URL']['plugin'];
+ $thePluginName = array_key_exists($pluginURL,$this->url->querystring) ? $this->url->querystring[$pluginURL] : $this->configH['plugins']['default'];
- $this->thePlugin =& $this->pluginsList[$thePluginName];
+ $this->thePlugin =& $this->pluginsList[$thePluginName];
- // Add thePlugin identifier for future uses.
- $this->url->addQueryString($pluginURL,$thePluginName);
+ // Add thePlugin identifier for future uses.
+ $this->url->addQueryString($pluginURL,$thePluginName);
- return $this->thePlugin;
- }
+ return $this->thePlugin;
+ }
- // Intended for interplugins communication
- public function functionality($funcStr,$funcArgs = '')
- {
- foreach($this->pluginsNamesList as $pluginName) {
- $result = $this->pluginsList[$pluginName]->functionality($funcStr,$funcArgs);
- if( $result !== false && !is_null($result) )
- $results[$pluginName] = $result;
- }
+ // Intended for interplugins communication
+ public function functionality($funcStr,$funcArgs = '')
+ {
+ foreach($this->pluginsNamesList as $pluginName) {
+ $result = $this->pluginsList[$pluginName]->functionality($funcStr,$funcArgs);
+ if( $result !== false && !is_null($result) )
+ $results[$pluginName] = $result;
+ }
- return $results;
- }
+ return $results;
+ }
- public function getPermission($premissionString,$arguments)
- {
- $result = false;
- foreach($this->pluginsNamesList as $pluginName) {
- // One "true" answer is OK to grant the permission
- $result = $result || $this->pluginsList[$pluginName]->getPermission($premissionString,$arguments);
- }
- return $result;
- }
+ public function getPermission($premissionString,$arguments)
+ {
+ $result = false;
+ foreach($this->pluginsNamesList as $pluginName) {
+ // One "true" answer is OK to grant the permission
+ $result = $result || $this->pluginsList[$pluginName]->getPermission($premissionString,$arguments);
+ }
+ return $result;
+ }
- public function menu()
- {
- $targets = array();
- foreach($this->pluginsNamesList as $pluginName) {
- $result = $this->pluginsList[$pluginName]->modesMenu();
- if( $result !== false )
- $targets[$pluginName] = $result;
- }
- return $this->output->displayMenu($targets);
- }
+ public function menu()
+ {
+ $targets = array();
+ foreach($this->pluginsNamesList as $pluginName) {
+ $result = $this->pluginsList[$pluginName]->modesMenu();
+ if( $result !== false )
+ $targets[$pluginName] = $result;
+ }
+ return $this->output->displayMenu($targets);
+ }
}
?>
Modified: trunk/inc/date.php
===================================================================
--- trunk/inc/date.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/date.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -23,47 +23,47 @@
set_include_path(implode(PATH_SEPARATOR,$g_Paths));
$MONTHS = array(
- 0=> '-',
- 1=> T_('January'),
- 2=> T_('February'),
- 3=> T_('March'),
- 4=> T_('April'),
- 5=> T_('May'),
- 6=> T_('June'),
- 7=> T_('July'),
- 8=> T_('August'),
- 9=> T_('September'),
- 10=> T_('October'),
- 11=> T_('November'),
- 12=> T_('December'));
+ 0=> '-',
+ 1=> T_('January'),
+ 2=> T_('February'),
+ 3=> T_('March'),
+ 4=> T_('April'),
+ 5=> T_('May'),
+ 6=> T_('June'),
+ 7=> T_('July'),
+ 8=> T_('August'),
+ 9=> T_('September'),
+ 10=> T_('October'),
+ 11=> T_('November'),
+ 12=> T_('December'));
// Create the standard DAYS range
$DAYS = array(
- 0=> '-',
- 1=> T_('1st'),
- 2=> T_('2nd'),
- 3=> T_('3rd'),
- 4=> T_('4th'),
- 5=> T_('5th'),
- 6=> T_('6th'),
- 7=> T_('7th'),
- 8=> T_('8th'),
- 9=> T_('9th'),
- );
+ 0=> '-',
+ 1=> T_('1st'),
+ 2=> T_('2nd'),
+ 3=> T_('3rd'),
+ 4=> T_('4th'),
+ 5=> T_('5th'),
+ 6=> T_('6th'),
+ 7=> T_('7th'),
+ 8=> T_('8th'),
+ 9=> T_('9th'),
+ );
for($i = 10;$i<=31;$i++){
- $DAYS[$i] = $i;
+ $DAYS[$i] = $i;
}
// Create the standard YEAR range (-100, + 100 from today)
$y_now = date('Y');
$YEARS[0] = '-';
for($y = $y_now - 100;$y<=$y_now + 100;$y++){
- $YEARS[$y] = $y;
+ $YEARS[$y] = $y;
}
function monthName($no)
{
- global $MONTHS;
- return $MONTHS[$no];
+ global $MONTHS;
+ return $MONTHS[$no];
}
?>
\ No newline at end of file
Modified: trunk/inc/error_handlers.php
===================================================================
--- trunk/inc/error_handlers.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/error_handlers.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -51,14 +51,14 @@
// For user displayed errors, be nice (hey. these are PHP errors => no NICE'ness !
switch ($code) {
- case E_USER_WARNING:
- case E_USER_NOTICE:
- case E_USER_ERROR:
- $Logger->log($message,$priority);
- break;
- default:
- $Logger->log($message . ' (' . $file . ':' . $line.') [PHP]',$priority);
- break;
+ case E_USER_WARNING:
+ case E_USER_NOTICE:
+ case E_USER_ERROR:
+ $Logger->log($message,$priority);
+ break;
+ default:
+ $Logger->log($message . ' (' . $file . ':' . $line.') [PHP]',$priority);
+ break;
}
return true;
Modified: trunk/inc/functions.php
===================================================================
--- trunk/inc/functions.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/functions.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,9 +21,9 @@
// Include all the paths (PEAR, gettext, ...)
$g_Paths = array(
- 'inc/', //Needed too
- get_include_path(), // NEEDED !
- );
+ 'inc/', //Needed too
+ get_include_path(), // NEEDED !
+ );
set_include_path(implode($g_Paths,PATH_SEPARATOR));
?>
\ No newline at end of file
Modified: trunk/inc/g_Auth.php
===================================================================
--- trunk/inc/g_Auth.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/g_Auth.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,62 +21,62 @@
class g_Auth extends Auth
{
- //! This is my 'db' handler
- private $db;
+ //! This is my 'db' handler
+ private $db;
- //! Add the valuable strings
- function __construct($H_DB,$storageDriver, $options = '', $loginFunction = '', $showLogin = true)
- {
- // Get the pointer to the DB connection handler
- $this->db =& $H_DB;
-
- // This overloading constructor adds the needed fields to the query
- $dbF = 'db_fields';
- // For the locale
- $options[$dbF][] = G_DB_PEOPLE_LOCALE;
- // The id for display and such
- $options[$dbF][] = G_DB_PEOPLE_ID;
+ //! Add the valuable strings
+ function __construct($H_DB,$storageDriver, $options = '', $loginFunction = '', $showLogin = true)
+ {
+ // Get the pointer to the DB connection handler
+ $this->db =& $H_DB;
+
+ // This overloading constructor adds the needed fields to the query
+ $dbF = 'db_fields';
+ // For the locale
+ $options[$dbF][] = G_DB_PEOPLE_LOCALE;
+ // The id for display and such
+ $options[$dbF][] = G_DB_PEOPLE_ID;
- return parent::__construct($storageDriver, $options, $loginFunction, $showLogin);
- }
+ return parent::__construct($storageDriver, $options, $loginFunction, $showLogin);
+ }
- public function setLocale($locale)
- {
- if($this->getLocale() != $locale) {
- $b_1 = $this->setUserVar(G_DB_PEOPLE_LOCALE,$locale);
- $b_2 = $this->setAuthData(G_DB_PEOPLE_LOCALE,$locale);
- return $b_1 and $b_2;
- } else {
- return true;
- }
- }
-
- public function getLocale()
- {
- return $this->getAuthData(G_DB_PEOPLE_LOCALE);
- }
+ public function setLocale($locale)
+ {
+ if($this->getLocale() != $locale) {
+ $b_1 = $this->setUserVar(G_DB_PEOPLE_LOCALE,$locale);
+ $b_2 = $this->setAuthData(G_DB_PEOPLE_LOCALE,$locale);
+ return $b_1 and $b_2;
+ } else {
+ return true;
+ }
+ }
+
+ public function getLocale()
+ {
+ return $this->getAuthData(G_DB_PEOPLE_LOCALE);
+ }
- public function getId()
- {
- return $this->getAuthData(G_DB_PEOPLE_ID);
- }
+ public function getId()
+ {
+ return $this->getAuthData(G_DB_PEOPLE_ID);
+ }
- protected function setUserVar($varName,$varContent)
- {
- if($this->getAuth()) {
- $query = sprintf("UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s'",
- $this->storage_options['table'],
- $varName,
- $varContent,
- $this->storage_options['usernamecol'],
- $this->getUsername()
- );
- $queryR =& $this->db->query($query);
- return !PEAR::isError($queryR);
- } else {
- return false;
- }
- }
+ protected function setUserVar($varName,$varContent)
+ {
+ if($this->getAuth()) {
+ $query = sprintf("UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s'",
+ $this->storage_options['table'],
+ $varName,
+ $varContent,
+ $this->storage_options['usernamecol'],
+ $this->getUsername()
+ );
+ $queryR =& $this->db->query($query);
+ return !PEAR::isError($queryR);
+ } else {
+ return false;
+ }
+ }
}
?>
\ No newline at end of file
Modified: trunk/inc/g_functions.php
===================================================================
--- trunk/inc/g_functions.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/g_functions.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,8 +21,8 @@
// Include all the paths (PEAR, gettext, ...)
$g_Paths = array(
- get_include_path(), // NEEDED !
- );
+ get_include_path(), // NEEDED !
+ );
// Include the path to PEAR
set_include_path(implode(PATH_SEPARATOR,$g_Paths));
@@ -34,70 +34,70 @@
define('G_DB_PEOPLE_ID','people_id');
function g_getFormattedField($ArrayVals,$type,$fieldName,$fieldName_,$fieldsSpec) {
- // For dates
- if(stripos($type,'date') !== false) {
- // It's a date
- if(empty($ArrayVals[$fieldName.'_year']) || empty($ArrayVals[$fieldName.'_month']) || empty($ArrayVals[$fieldName.'_day'])) {
- return '0000-00-00';
- } elseif(checkdate((int)$ArrayVals[$fieldName.'_month'],(int)$ArrayVals[$fieldName.'_day'],(int)$ArrayVals[$fieldName.'_year'])) {
- return $ArrayVals[$fieldName.'_year'].'-'.$ArrayVals[$fieldName.'_month'].'-'.$ArrayVals[$fieldName.'_day'];
- }
- } elseif(array_key_exists('ereg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
- if(ereg($fieldsSpec[$fieldName_]['ereg'],$ArrayVals[$fieldName]) || empty($ArrayVals[$fieldName])) {
- return $ArrayVals[$fieldName];
- }
- return false;
- } elseif(array_key_exists('preg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
- if(preg_match($fieldsSpec[$fieldName_]['preg'],$ArrayVals[$fieldName])|| empty($ArrayVals[$fieldName])) {
- return $ArrayVals[$fieldName];
- }
- } else {
- return $ArrayVals[$fieldName];
- }
- return false;
+ // For dates
+ if(stripos($type,'date') !== false) {
+ // It's a date
+ if(empty($ArrayVals[$fieldName.'_year']) || empty($ArrayVals[$fieldName.'_month']) || empty($ArrayVals[$fieldName.'_day'])) {
+ return '0000-00-00';
+ } elseif(checkdate((int)$ArrayVals[$fieldName.'_month'],(int)$ArrayVals[$fieldName.'_day'],(int)$ArrayVals[$fieldName.'_year'])) {
+ return $ArrayVals[$fieldName.'_year'].'-'.$ArrayVals[$fieldName.'_month'].'-'.$ArrayVals[$fieldName.'_day'];
+ }
+ } elseif(array_key_exists('ereg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
+ if(ereg($fieldsSpec[$fieldName_]['ereg'],$ArrayVals[$fieldName]) || empty($ArrayVals[$fieldName])) {
+ return $ArrayVals[$fieldName];
+ }
+ return false;
+ } elseif(array_key_exists('preg',$fieldsSpec[$fieldName_])) { // for fields which have a verification pattern
+ if(preg_match($fieldsSpec[$fieldName_]['preg'],$ArrayVals[$fieldName])|| empty($ArrayVals[$fieldName])) {
+ return $ArrayVals[$fieldName];
+ }
+ } else {
+ return $ArrayVals[$fieldName];
+ }
+ return false;
}
// log == inv(gol)
// Inverse of log - allow simple logging (aka debugging)
function gol($text,$var) {
- trigger_error($text.var_export($var,true),G_E_LOG);
+ trigger_error($text.var_export($var,true),G_E_LOG);
}
function gold($text,$var) {
- trigger_error($text.var_export($var,true),G_E_DISPLAY);
+ trigger_error($text.var_export($var,true),G_E_DISPLAY);
}
function concat_to_each(&$item, $key, $prepostfix) {
- if( is_array($prepostfix) ) {
- $item = $prepostfix[0].$item.$prepostfix[1];
- } else {
- $item = $prepostfix.$item;
- }
+ if( is_array($prepostfix) ) {
+ $item = $prepostfix[0].$item.$prepostfix[1];
+ } else {
+ $item = $prepostfix.$item;
+ }
}
function g_Age($date){
- preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $date, $regs);
- $year_diff = date("Y") - $regs[1];
- $month_diff = date("m") - $regs[2];
- $day_diff = date("d") - $regs[3];
- if ($month_diff < 0) {
- $year_diff--;
- $month_diff += 12;
- }
- elseif (($month_diff==0) && ($day_diff < 0)) {
- $year_diff--;
- $day_diff += 30; // TODO better...
- }
+ preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $date, $regs);
+ $year_diff = date("Y") - $regs[1];
+ $month_diff = date("m") - $regs[2];
+ $day_diff = date("d") - $regs[3];
+ if ($month_diff < 0) {
+ $year_diff--;
+ $month_diff += 12;
+ }
+ elseif (($month_diff==0) && ($day_diff < 0)) {
+ $year_diff--;
+ $day_diff += 30; // TODO better...
+ }
- $ret['years'] = $year_diff;
- $ret['months'] = $month_diff;
- $ret['days'] = $day_diff;
- return $ret;
+ $ret['years'] = $year_diff;
+ $ret['months'] = $month_diff;
+ $ret['days'] = $day_diff;
+ return $ret;
}
function g_AgeYears($date){
- $rawArrayAge = g_Age($date);
- return sprintf(T_('%d years old'),$rawArrayAge['years']);
+ $rawArrayAge = g_Age($date);
+ return sprintf(T_('%d years old'),$rawArrayAge['years']);
}
/**
@@ -106,8 +106,8 @@
*/
function g_appendOld($name,$to_append = "_old")
{
- if( ($crochet = strpos($name,"[")) )
- return substr($name,0,$crochet).$to_append.substr($name,$crochet);
- else
- return $name.$to_append;
+ if( ($crochet = strpos($name,"[")) )
+ return substr($name,0,$crochet).$to_append.substr($name,$crochet);
+ else
+ return $name.$to_append;
}
Modified: trunk/inc/g_output.inc.php
===================================================================
--- trunk/inc/g_output.inc.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/g_output.inc.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,56 +21,56 @@
abstract class G_Output
{
- // Authentication handler
- protected $auth;
- // URL handler
- protected $url;
- // locale container
- protected $locale;
- // language
- protected $language;
- // config
- protected $config;
-
- protected $MIME = "text/html";
+ // Authentication handler
+ protected $auth;
+ // URL handler
+ protected $url;
+ // locale container
+ protected $locale;
+ // language
+ protected $language;
+ // config
+ protected $config;
+
+ protected $MIME = "text/html";
- protected $charset = "utf-8";
+ protected $charset = "utf-8";
- // Constructor - Handles all the needed pointers
- function __construct(&$Auth,&$URL,&$locale,&$config)
- {
- $this->auth =& $Auth;
- $this->url =& $URL;
- $this->locale =& $locale;
- $this->config =& $config;
+ // Constructor - Handles all the needed pointers
+ function __construct(&$Auth,&$URL,&$locale,&$config)
+ {
+ $this->auth =& $Auth;
+ $this->url =& $URL;
+ $this->locale =& $locale;
+ $this->config =& $config;
- // compute language from locale (will give en_US from "en_US.UTF-8"
- $this->language = str_replace('_','-',substr($this->locale, 0,strpos($this->locale,".")));
- }
+ // compute language from locale (will give en_US from "en_US.UTF-8"
+ $this->language = str_replace('_','-',substr($this->locale, 0,strpos($this->locale,".")));
+ }
- public function HTTP_header(){}
- public function top_header(){}
- public function login_box(){}
- public function error_box($errors_array = array()){}
- public function languages_box(){}
- public function displayFields($fullFieldsSpec,$fieldsContents,$type = 'view',$options = array()){}
+ public function HTTP_header(){}
+ public function top_header(){}
+ public function login_box(){}
+ public function error_box($errors_array = array()){}
+ public function languages_box(){}
+ public function displayFields($fullFieldsSpec,$fieldsContents,$type = 'view',$options = array()){}
- public function stats($timeStart)
- {
- $totalComputationTime = microtime(true) - $timeStart;
+ public function stats($timeStart)
+ {
+ $totalComputationTime = microtime(true) - $timeStart;
- printf(T_('Total computation time: %.3f seconds.')."\n",$totalComputationTime);
- printf(T_('Powered by Ghelda, version %s'),$this->config['VERSION']);
- }
+ printf(T_('Total computation time: %.3f seconds.')."\n",$totalComputationTime);
+ printf(T_('Powered by Ghelda, version %s'),$this->config['VERSION']);
+ }
- public function PigsExample()
- {
- echo T_("This is a pig too.")."\n";
- for ($number=6; $number>=0; $number--) {
- printf(T_ngettext("%d pig went to the market\n", "%d pigs went to the market\n", $number), $number );
- echo "\n";
- }
- echo T_("This is a pig too.");
- }
+ public function PigsExample()
+ {
+ echo T_("This is a pig too.")."\n";
+ for ($number=6; $number>=0; $number--) {
+ printf(T_ngettext("%d pig went to the market\n", "%d pigs went to the market\n", $number), $number );
+ echo "\n";
+ }
+ echo T_("This is a pig too.");
+ }
}
?>
\ No newline at end of file
Modified: trunk/inc/output.class.php
===================================================================
--- trunk/inc/output.class.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/output.class.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,121 +21,121 @@
//! The main abstract output (display) class
/*!
-* It provides all the standard methods with empty bodies so that the
-* extending classes don't have to re-implement them.
+* It provides all the standard methods with empty bodies so that the
+* extending classes don't have to re-implement them.
*/
abstract class Output
{
- //! Authentication handler
- protected $auth;
- //! URL handler
- protected $url;
- //! locale container
- protected $locale;
- //! language handler
- protected $language;
- //! config handler
- protected $config;
- //! Plugins handler
- protected $plugins;
-
- //! contains the destination MIME
- protected $MIME = "text/html";
+ //! Authentication handler
+ protected $auth;
+ //! URL handler
+ protected $url;
+ //! locale container
+ protected $locale;
+ //! language handler
+ protected $language;
+ //! config handler
+ protected $config;
+ //! Plugins handler
+ protected $plugins;
+
+ //! contains the destination MIME
+ protected $MIME = "text/html";
- //! contains the destination charset
- protected $charset = "utf-8";
+ //! contains the destination charset
+ protected $charset = "utf-8";
- //! Constructor
- /*!
- * Initializes the various handlers and prepare the language
- *
- * @param &$Auth Authentication handler
- * @param &$URL URL handler
- * @param &$locale locale handler
- * @param &$config configuration handler
- */
- function __construct(&$Auth,&$URL,&$locale,&$config,&$plugins)
- {
- $this->auth =& $Auth;
- $this->url =& $URL;
- $this->locale =& $locale;
- $this->config =& $config;
- $this->plugins =& $plugins;
+ //! Constructor
+ /*!
+ * Initializes the various handlers and prepare the language
+ *
+ * @param &$Auth Authentication handler
+ * @param &$URL URL handler
+ * @param &$locale locale handler
+ * @param &$config configuration handler
+ */
+ function __construct(&$Auth,&$URL,&$locale,&$config,&$plugins)
+ {
+ $this->auth =& $Auth;
+ $this->url =& $URL;
+ $this->locale =& $locale;
+ $this->config =& $config;
+ $this->plugins =& $plugins;
- // compute language from locale (will give en_US from "en_US.UTF-8"
- $this->language = str_replace('_','-',substr($this->locale, 0,strpos($this->locale,".")));
- }
- //! HTTP headers
- public function HTTP_header(){}
- //! Displays an in-page top header
- public function top_header(){}
- //! Displays the login box
- public function login_box(){}
-
- //! Display the error box
- /*! @param $errors_array The array of "array(Message,priority)" errors
- */
- public function error_box($errors_array = array()){}
+ // compute language from locale (will give en_US from "en_US.UTF-8"
+ $this->language = str_replace('_','-',substr($this->locale, 0,strpos($this->locale,".")));
+ }
+ //! HTTP headers
+ public function HTTP_header(){}
+ //! Displays an in-page top header
+ public function top_header(){}
+ //! Displays the login box
+ public function login_box(){}
+
+ //! Display the error box
+ /*! @param $errors_array The array of "array(Message,priority)" errors
+ */
+ public function error_box($errors_array = array()){}
- //! Displays the languages box
- /*! Uses the list of supported locales and the actual locale for accurate display.
- * \return The displayed xHTML code
- */
- public function languages_box(){}
-
- //! Display a list of fields
- /*! @param $fields Array of fields specifications.
- * - [field code] => Array (
- * - [type] => MySQL type (e.g. INT( 10 ) or VARCHAR( 50 ), ... )
- * - [name] => T_('Description') (can be an array for password arrays)
- * - [restricted] => {key,unique,password}
- * - [noShow] => {0,1}
- * - [default] => default value
- * - [preg] => preg_match verification pattern (e.g. ~^[0-9]{3}[.][0-9]{2}[.][0-9]{3}[.][0-9]{3}$~ )
- * - [ereg] => ereg verification pattern (e.g. [0-9]{3}\.[0-9]{2}\.[0-9]{3}\.[0-9]{3} )
- * - )
- * - [following one] => Array(...)
- * @param $fieldsContents Array of fields contents
- * - [id] => Array (
- * - [field code] => value
- * - [...]
- * - )
- * @param $options Array of options for the display and such
- * - ['id'] 'identifier' field
- * @param $mode Array of the various possible modes for each entry (row)
- * - [mode code] => Array (
- * - ['image'] => image code
- * - ['name'] => T_('Textual description')
- */
- public function displayList($fieldsSpec,$fieldsContents,$options = array(),$modes = array()) {}
+ //! Displays the languages box
+ /*! Uses the list of supported locales and the actual locale for accurate display.
+ * \return The displayed xHTML code
+ */
+ public function languages_box(){}
+
+ //! Display a list of fields
+ /*! @param $fields Array of fields specifications.
+ * - [field code] => Array (
+ * - [type] => MySQL type (e.g. INT( 10 ) or VARCHAR( 50 ), ... )
+ * - [name] => T_('Description') (can be an array for password arrays)
+ * - [restricted] => {key,unique,password}
+ * - [noShow] => {0,1}
+ * - [default] => default value
+ * - [preg] => preg_match verification pattern (e.g. ~^[0-9]{3}[.][0-9]{2}[.][0-9]{3}[.][0-9]{3}$~ )
+ * - [ereg] => ereg verification pattern (e.g. [0-9]{3}\.[0-9]{2}\.[0-9]{3}\.[0-9]{3} )
+ * - )
+ * - [following one] => Array(...)
+ * @param $fieldsContents Array of fields contents
+ * - [id] => Array (
+ * - [field code] => value
+ * - [...]
+ * - )
+ * @param $options Array of options for the display and such
+ * - ['id'] 'identifier' field
+ * @param $mode Array of the various possible modes for each entry (row)
+ * - [mode code] => Array (
+ * - ['image'] => image code
+ * - ['name'] => T_('Textual description')
+ */
+ public function displayList($fieldsSpec,$fieldsContents,$options = array(),$modes = array()) {}
- //! Display one set of fields
- /*! @param $fields Array of fields specifications.
- * @param $fieldsContents Array of fields contents
- * - [field code] => field content.
- * @param $options Array of options for the display and such
- * - ['id'] 'identifier' field
- * - ['title'] h2 title of the set of fields
- * - ['command'] Content of the "Execute" field
- * - ['target'] url target for the generated formular
- * - ['action'] command for the generated formular (the plugin talks to itself)
- *
- * @sa displayList
- */
- public function displayFields($fields,$fieldsContents,$options = array()){}
+ //! Display one set of fields
+ /*! @param $fields Array of fields specifications.
+ * @param $fieldsContents Array of fields contents
+ * - [field code] => field content.
+ * @param $options Array of options for the display and such
+ * - ['id'] 'identifier' field
+ * - ['title'] h2 title of the set of fields
+ * - ['command'] Content of the "Execute" field
+ * - ['target'] url target for the generated formular
+ * - ['action'] command for the generated formular (the plugin talks to itself)
+ *
+ * @sa displayList
+ */
+ public function displayFields($fields,$fieldsContents,$options = array()){}
- //! Display the plugin's mode menu
- /*! @param $targets Array of targets specifications
- * @TODO
- * - [mode name] => Array(
- * - [name] => T_('Displayed name')
- * - )
- */
- public function displayMenu($targets){}
+ //! Display the plugin's mode menu
+ /*! @param $targets Array of targets specifications
+ * @TODO
+ * - [mode name] => Array(
+ * - [name] => T_('Displayed name')
+ * - )
+ */
+ public function displayMenu($targets){}
- //! Display some stats about the calculation time of the page and such
- /*! @param $timeStart Result of the starting microtime
- */
- public function stats($timeStart){}
+ //! Display some stats about the calculation time of the page and such
+ /*! @param $timeStart Result of the starting microtime
+ */
+ public function stats($timeStart){}
}
?>
\ No newline at end of file
Modified: trunk/inc/outputs/xHTML.class.php
===================================================================
--- trunk/inc/outputs/xHTML.class.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/inc/outputs/xHTML.class.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -29,737 +29,737 @@
*/
class Output_xHTML extends Output
{
- //! Buffer for transfering stuff between methods
- private $buffer;
+ //! Buffer for transfering stuff between methods
+ private $buffer;
- //! Indentation buffer
- private $indent = "";
+ //! Indentation buffer
+ private $indent = "";
- //! Boolean buffer to prevent output before the HTTP headers
- private $headerSent;
+ //! Boolean buffer to prevent output before the HTTP headers
+ private $headerSent;
- //! Increment character(s)
- private $incrementChar;
+ //! Increment character(s)
+ private $incrementChar;
- //! Increment character(s) length
- private $incrementCharLen;
+ //! Increment character(s) length
+ private $incrementCharLen;
- //! List of the CountryCodes
- private $countryCodes;
+ //! List of the CountryCodes
+ private $countryCodes;
- //! Constructor
- /*!
- * Additionally initializes the incrementation
- */
- public function __construct(&$Auth,&$URL,&$locale,&$config,&$plugins)
- {
- $result = parent::__construct(&$Auth,&$URL,&$locale,&$config,&$plugins);
+ //! Constructor
+ /*!
+ * Additionally initializes the incrementation
+ */
+ public function __construct(&$Auth,&$URL,&$locale,&$config,&$plugins)
+ {
+ $result = parent::__construct(&$Auth,&$URL,&$locale,&$config,&$plugins);
- $this->incrementChar = $this->config['Output']['incrementChar'];
- $this->incrementCharLen = strlen($this->incrementChar);
+ $this->incrementChar = $this->config['Output']['incrementChar'];
+ $this->incrementCharLen = strlen($this->incrementChar);
- $this->countryCodes =& $this->plugins->functionality('BigFatAndDirty_ListOfAllCountryCodes');
- $this->countryCodes = $this->countryCodes['ISO3166_CountryCode'];
+ $this->countryCodes =& $this->plugins->functionality('BigFatAndDirty_ListOfAllCountryCodes');
+ $this->countryCodes = $this->countryCodes['ISO3166_CountryCode'];
- return $result;
- }
+ return $result;
+ }
- //! Launches the HTTP headers
- /*!
- * Code taken from http://www.presence-pc.com/forum/ppc/Programmation/retro-compatibilite-html-automatique-site-xhtml-sujet-2764-1.htm
- * Considered as public domain
- */
- public function HTTP_header()
- {
- // Reads the UserAgent field.
- $navigator = $_SERVER['HTTP_USER_AGENT'];
+ //! Launches the HTTP headers
+ /*!
+ * Code taken from http://www.presence-pc.com/forum/ppc/Programmation/retro-compatibilite-html-automatique-site-xhtml-sujet-2764-1.htm
+ * Considered as public domain
+ */
+ public function HTTP_header()
+ {
+ // Reads the UserAgent field.
+ $navigator = $_SERVER['HTTP_USER_AGENT'];
- // If the navigator announces it self correctly
- if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml" )) {
- // Test its q-rating
- if (preg_match("/application\/xhtml\+xml;q=([01]|0\.\d{1,3}|1\.0)/i", $_SERVER["HTTP_ACCEPT"], $matches)) {
- $xhtml_q = $matches[1];
- if (preg_match("/text\/html;q=([01]|0\.\d{1,3}|1\.0)/i", $_SERVER["HTTP_ACCEPT"], $matches)) {
- $html_q = $matches[1];
- if ((float)$xhtml_q >= (float)$html_q) {
- $this->MIME = "application/xhtml+xml"; // Cas du q_rating favorable..
- }
- } // Un q_rating défavorable laissera '$mime' à sa valeur par défaut..
- }
- else {
- $this->MIME = "application/xhtml+xml"; // Cas du q_rating absent..
- }
- }
- // Cas des validateurs du World Wide Web Consortium (W3C) et du Web Design Group (WDG)..
- // les adresses sont respectivement :
- // - http://validator.w3.org/
- // - http://www.htmlhelp.com/tools/validator/
- if (stristr($navigator, "W3C_Validator" ) || stristr($navigator, "WDG_Validator" )) {
- $this->MIME = "application/xhtml+xml";
- }
- // Détermination de la DTD..
- // Page du W3C répertoriant les DTD valides >> http://www.w3.org/QA/2002/04/valid-dtd-list
- if ($this->MIME == "application/xhtml+xml" ) {
- // Prolog pour les navigateurs ayant passé le test..
- $prolog_type = '<?xml version="1.0" encoding="'.$this->charset.'" ?>'.LB;
- $prolog_type .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"'.LB.' "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.LB;
- $prolog_type .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->language.'">';
- }
- elseif ((eregi("((MSIE (6|7))|(KHTML))", $navigator)) && !eregi("Opera", $navigator)) {
- // Cas particuliers d'IE 6/7 et de Konqueror/Safari (XHTML est supporté, mais en restant en compatibilité HTML)..
- $prolog_type = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"'.LB.' "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.LB;
- $prolog_type .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->language.'">';
- }
- else { // Prolog pour tous les autres navigateurs..
- $prolog_type = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"'.LB.' "http://www.w3.org/TR/html4/strict.dtd">'.LB;
- $prolog_type .= '<html lang="'.$this->language.'">';
- }
+ // If the navigator announces it self correctly
+ if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml" )) {
+ // Test its q-rating
+ if (preg_match("/application\/xhtml\+xml;q=([01]|0\.\d{1,3}|1\.0)/i", $_SERVER["HTTP_ACCEPT"], $matches)) {
+ $xhtml_q = $matches[1];
+ if (preg_match("/text\/html;q=([01]|0\.\d{1,3}|1\.0)/i", $_SERVER["HTTP_ACCEPT"], $matches)) {
+ $html_q = $matches[1];
+ if ((float)$xhtml_q >= (float)$html_q) {
+ $this->MIME = "application/xhtml+xml"; // Cas du q_rating favorable..
+ }
+ } // Un q_rating défavorable laissera '$mime' à sa valeur par défaut..
+ }
+ else {
+ $this->MIME = "application/xhtml+xml"; // Cas du q_rating absent..
+ }
+ }
+ // Cas des validateurs du World Wide Web Consortium (W3C) et du Web Design Group (WDG)..
+ // les adresses sont respectivement :
+ // - http://validator.w3.org/
+ // - http://www.htmlhelp.com/tools/validator/
+ if (stristr($navigator, "W3C_Validator" ) || stristr($navigator, "WDG_Validator" )) {
+ $this->MIME = "application/xhtml+xml";
+ }
+ // Détermination de la DTD..
+ // Page du W3C répertoriant les DTD valides >> http://www.w3.org/QA/2002/04/valid-dtd-list
+ if ($this->MIME == "application/xhtml+xml" ) {
+ // Prolog pour les navigateurs ayant passé le test..
+ $prolog_type = '<?xml version="1.0" encoding="'.$this->charset.'" ?>'.LB;
+ $prolog_type .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"'.LB.' "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.LB;
+ $prolog_type .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->language.'">';
+ }
+ elseif ((eregi("((MSIE (6|7))|(KHTML))", $navigator)) && !eregi("Opera", $navigator)) {
+ // Cas particuliers d'IE 6/7 et de Konqueror/Safari (XHTML est supporté, mais en restant en compatibilité HTML)..
+ $prolog_type = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"'.LB.' "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'.LB;
+ $prolog_type .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$this->language.'">';
+ }
+ else { // Prolog pour tous les autres navigateurs..
+ $prolog_type = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"'.LB.' "http://www.w3.org/TR/html4/strict.dtd">'.LB;
+ $prolog_type .= '<html lang="'.$this->language.'">';
+ }
- $prolog_type .= LB;
- #############################################################
- # Envoi des en-têtes HTTP #
- # Affichage du XML et/ou DOCTYPE Prolog #
- #############################################################
- header("Content-Type: ".$this->MIME."; charset=".$this->charset); // Envoie depuis le serveur l'en-tête HTTP correspondant au navigateur..
- header("Content-Language: ".$this->language);
- header("Vary: Accept,Accept-language" ); // Indique aux systèmes de cache intermédiaires, tels que les serveurs de proxy, que le Content-Type dépend des capacités du client à recevoir le document..
- $this->buffer = $prolog_type;
- }
+ $prolog_type .= LB;
+ #############################################################
+ # Envoi des en-têtes HTTP #
+ # Affichage du XML et/ou DOCTYPE Prolog #
+ #############################################################
+ header("Content-Type: ".$this->MIME."; charset=".$this->charset); // Envoie depuis le serveur l'en-tête HTTP correspondant au navigateur..
+ header("Content-Language: ".$this->language);
+ header("Vary: Accept,Accept-language" ); // Indique aux systèmes de cache intermédiaires, tels que les serveurs de proxy, que le Content-Type dépend des capacités du client à recevoir le document..
+ $this->buffer = $prolog_type;
+ }
- public function top_header()
- {
- // Prints the doctype and the <html prepared above.
- $this->echo_($this->buffer);
+ public function top_header()
+ {
+ // Prints the doctype and the <html prepared above.
+ $this->echo_($this->buffer);
- // Prints the <head>
- $headC = $this->tag("title",sprintf(T_('Online hierarchical addresses handling for %s'),$this->config['Output']['Title']),array(),true);
- $headC .= $this->stag('meta',array('http-equiv'=>'Content-Type','content'=>$this->MIME."; charset=".$this->charset),true);
- $headC .= $this->stag('meta',array('http-equiv'=>'Content-Language','content'=>$this->language),true);
- $headC .= $this->stag('meta',array('http-equiv'=>'Content-Style-Type','content'=>"text/css"),true);
-
- if(array_key_exists('css',$this->config)) {
- foreach($this->config['css'] as $media => $sheets) {
- if(is_array($sheets)){
- foreach($sheets as $sheet){
- $headC .= $this->stag('link',array('rel'=>'stylesheet','type'=>"text/css", "href"=>'style/'.$sheet,"media"=>$media),true);
- }
- }
- else {
- $headC .= $this->stag('link',array('rel'=>'stylesheet','type'=>"text/css", "href"=>'style/'.$sheets,"media"=>$media),true);
-
- }
- }
- }
- $headC .= $this->stag('link',array('rel'=>'shortcut icon','type'=>'image/x-icon','href'=>'style/favicon.ico'));
+ // Prints the <head>
+ $headC = $this->tag("title",sprintf(T_('Online hierarchical addresses handling for %s'),$this->config['Output']['Title']),array(),true);
+ $headC .= $this->stag('meta',array('http-equiv'=>'Content-Type','content'=>$this->MIME."; charset=".$this->charset),true);
+ $headC .= $this->stag('meta',array('http-equiv'=>'Content-Language','content'=>$this->language),true);
+ $headC .= $this->stag('meta',array('http-equiv'=>'Content-Style-Type','content'=>"text/css"),true);
+
+ if(array_key_exists('css',$this->config)) {
+ foreach($this->config['css'] as $media => $sheets) {
+ if(is_array($sheets)){
+ foreach($sheets as $sheet){
+ $headC .= $this->stag('link',array('rel'=>'stylesheet','type'=>"text/css", "href"=>'style/'.$sheet,"media"=>$media),true);
+ }
+ }
+ else {
+ $headC .= $this->stag('link',array('rel'=>'stylesheet','type'=>"text/css", "href"=>'style/'.$sheets,"media"=>$media),true);
+
+ }
+ }
+ }
+ $headC .= $this->stag('link',array('rel'=>'shortcut icon','type'=>'image/x-icon','href'=>'style/favicon.ico'));
- $this->mark('head',$headC,array(),true);
+ $this->mark('head',$headC,array(),true);
- // Prints the <body> start
- $this->echo_("<body>".LB);
+ // Prints the <body> start
+ $this->echo_("<body>".LB);
- $this->headerSent = true;
- }
+ $this->headerSent = true;
+ }
- public function login_box()
- {
- $formular = $this->tag('h2',T_('Connection'),array(),true);
- if($this->auth->getAuth()) {
- $formular .= $this->mark('p',sprintf(T_("Welcome %s!"),$this->tag('span',$this->auth->getUsername(),array('class'=>'pseudo'))));
+ public function login_box()
+ {
+ $formular = $this->tag('h2',T_('Connection'),array(),true);
+ if($this->auth->getAuth()) {
+ $formular .= $this->mark('p',sprintf(T_("Welcome %s!"),$this->tag('span',$this->auth->getUsername(),array('class'=>'pseudo'))));
- $fields = $this->mark('p',$this->stag('input',array('type'=>'submit','value'=>T_("Disconnect"))));
- $disco = $this->config['URL']['disconnect'];
- $oldQS = $this->url->querystring;
- $this->url->addQueryString($disco,1);
- $formular .= $this->mark('form',$fields,array('method'=>'post','action'=> $this->url->getURL()));
- $this->url->querystring = $oldQS;
- }
- else {
- $passFieldArgs = array();
- switch($this->auth->getStatus()) {
- case AUTH_WRONG_LOGIN:
- $formular .= $this->mark('p',T_('Bad password'),array("class"=>"error"));
- $passFieldArgs = array("class" => "input_error");
- break;
- case AUTH_IDLED:
- case AUTH_EXPIRED:
- $formular .= $this->mark('p',T_('Your session expired.'),array("class"=>"error"));
- break;
- }
- $label = $this->tag('label',T_('Username'),array('for'=>'username'));
- $field = $this->stag('input',array('type'=>"text",'name'=>"username","id"=>"username","value"=>$this->auth->username));
- $fields = $this->mark('p',$label.$field);
+ $fields = $this->mark('p',$this->stag('input',array('type'=>'submit','value'=>T_("Disconnect"))));
+ $disco = $this->config['URL']['disconnect'];
+ $oldQS = $this->url->querystring;
+ $this->url->addQueryString($disco,1);
+ $formular .= $this->mark('form',$fields,array('method'=>'post','action'=> $this->url->getURL()));
+ $this->url->querystring = $oldQS;
+ }
+ else {
+ $passFieldArgs = array();
+ switch($this->auth->getStatus()) {
+ case AUTH_WRONG_LOGIN:
+ $formular .= $this->mark('p',T_('Bad password'),array("class"=>"error"));
+ $passFieldArgs = array("class" => "input_error");
+ break;
+ case AUTH_IDLED:
+ case AUTH_EXPIRED:
+ $formular .= $this->mark('p',T_('Your session expired.'),array("class"=>"error"));
+ break;
+ }
+ $label = $this->tag('label',T_('Username'),array('for'=>'username'));
+ $field = $this->stag('input',array('type'=>"text",'name'=>"username","id"=>"username","value"=>$this->auth->username));
+ $fields = $this->mark('p',$label.$field);
- $label = $this->tag('label',T_('Password'),array('for'=>'password'));
- $field = $this->stag('input',array('type'=>"password",'name'=>"password","id"=>"password"));
- $fields .= $this->mark('p',$label.$field,$passFieldArgs);
+ $label = $this->tag('label',T_('Password'),array('for'=>'password'));
+ $field = $this->stag('input',array('type'=>"password",'name'=>"password","id"=>"password"));
+ $fields .= $this->mark('p',$label.$field,$passFieldArgs);
- $fields .= $this->mark('p',$this->stag('input',array('type'=>'submit','value'=>T_("Connection"))));
- // Empty it to get correct behaviour
- $this->url->querystring = array();
- $formular .= $this->mark('form',$fields,array('method'=>'post','action'=> $this->url->getURL()));
+ $fields .= $this->mark('p',$this->stag('input',array('type'=>'submit','value'=>T_("Connection"))));
+ // Empty it to get correct behaviour
+ $this->url->querystring = array();
+ $formular .= $this->mark('form',$fields,array('method'=>'post','action'=> $this->url->getURL()));
- }
- return $this->mark('div',$formular,array("id"=>"login_form"),true);
- }
+ }
+ return $this->mark('div',$formular,array("id"=>"login_form"),true);
+ }
- public function error_box($errors_array = array())
- {
- global $errorLevels;
- $buffer = '';
- foreach($errors_array as $error) {
- $message = $error[0];
- $priority = $errorLevels[$error[1]];
- $buffer .= $this->mark('div',$this->tag('p',$message),array("class"=>"error $priority"));
- }
- if(isset($buffer)) {
- return $this->mark('div',$buffer,array('id'=>'errors'),true);
- } else {
- return true;
- }
- }
+ public function error_box($errors_array = array())
+ {
+ global $errorLevels;
+ $buffer = '';
+ foreach($errors_array as $error) {
+ $message = $error[0];
+ $priority = $errorLevels[$error[1]];
+ $buffer .= $this->mark('div',$this->tag('p',$message),array("class"=>"error $priority"));
+ }
+ if(isset($buffer)) {
+ return $this->mark('div',$buffer,array('id'=>'errors'),true);
+ } else {
+ return true;
+ }
+ }
- public function languages_box()
- {
- // Get the global variables about locales
- global $g_GT_supportedLocales,$g_GT_locale;
+ public function languages_box()
+ {
+ // Get the global variables about locales
+ global $g_GT_supportedLocales,$g_GT_locale;
- $localesBox = '';
- // Go through the available locales
- foreach($g_GT_supportedLocales as $locale) {
- // Get the native language name (or the two first letters) : en_US.UTF-8 => "english" or "en"
- $languageName = array_key_exists($locale,$this->config['localeNames']) ? $this->config['localeNames'][$locale] : substr($locale,0,2);
- // Create the link
- $this->url->addQueryString('locale',$locale);
- if($locale == $g_GT_locale) {
- $localesBox .= $this->tag('li',$languageName,array('class'=>'actual'),true); // Lacks Title and such
- } else {
- $localesBox .= $this->tag('li',$this->tag('a',$languageName,array("href" => $this->url->getURL())),array(),true);
- }
- }
- // Render the link correctly back
- $this->url->removeQueryString('locale');
- //
- return $this->mark('div',$this->tag('h2',T_('Select your language'),array(),true).$this->mark('ul',$localesBox),array('id'=>'languages'),true);
- }
+ $localesBox = '';
+ // Go through the available locales
+ foreach($g_GT_supportedLocales as $locale) {
+ // Get the native language name (or the two first letters) : en_US.UTF-8 => "english" or "en"
+ $languageName = array_key_exists($locale,$this->config['localeNames']) ? $this->config['localeNames'][$locale] : substr($locale,0,2);
+ // Create the link
+ $this->url->addQueryString('locale',$locale);
+ if($locale == $g_GT_locale) {
+ $localesBox .= $this->tag('li',$languageName,array('class'=>'actual'),true); // Lacks Title and such
+ } else {
+ $localesBox .= $this->tag('li',$this->tag('a',$languageName,array("href" => $this->url->getURL())),array(),true);
+ }
+ }
+ // Render the link correctly back
+ $this->url->removeQueryString('locale');
+ //
+ return $this->mark('div',$this->tag('h2',T_('Select your language'),array(),true).$this->mark('ul',$localesBox),array('id'=>'languages'),true);
+ }
- public function displayList($fieldsSpec,$fieldsContents,$options = array(),$modes = array())
- {
- // Ensure that the translation is correctly handled in the core.
- $oldDomain = g_setDomain('g_core');
- // Define the correct defaults in the $options array()
- if(!array_key_exists('id',$options)) $options['id'] = 'NOID';
+ public function displayList($fieldsSpec,$fieldsContents,$options = array(),$modes = array())
+ {
+ // Ensure that the translation is correctly handled in the core.
+ $oldDomain = g_setDomain('g_core');
+ // Define the correct defaults in the $options array()
+ if(!array_key_exists('id',$options)) $options['id'] = 'NOID';
- // Display the first Line ( beginning by the empty space for the specs)
- $line .= $this->tag('th','',array('colspan'=>count($modes)));
- // Display the titles
- foreach($fieldsSpec as $fieldName => $fieldProperties) {
- if($fieldProperties['restricted'] == 'key') { /* == 'id' */
- $formKey = array('name' => $fieldName);
- continue;
- } elseif ($fieldProperties['noShow']) {
- continue;
- }
- $line .= $this->tag('th',$fieldProperties['name']);
- }
- // Display the first line as title
- $table .= $this->mark('tr',$line);
- // Display the following lines as normal ones
- foreach($fieldsContents as $id => $row) {
- $line = '';
- // Store the old queryString
- $oldQS = $this->url->querystring;
- $this->url->addQueryString($formKey['name'],$id);
- // Go through the modes and display them with the correct image
- foreach($modes as $mode => $modeSpec) {
- $this->url->addQueryString('mode',$mode);
- $fieldContent = $this->image($modeSpec['image'],$modeSpec['name']);
- $line .= $this->tag('td',$this->tag('a',$fieldContent,array('href'=> $this->url->getURL())));
- }
- $this->url->removeQueryString('mode');
- foreach($row as $fieldName => $fieldContent) {
- if ($fieldsSpec[$fieldName]['noShow']) {
- continue;
- }
- if(stripos($fieldsSpec[$fieldName]['type'],'date') !== false) { // If we have a date
- $fieldContent = $this->formatDate($fieldContent);
- }
- elseif( stripos($fieldsSpec[$fieldName]['type'],'select') !== false or
- stripos($fieldsSpec[$fieldName]['type'],'enum') !== false) { // If we have a select
- $tmpVar = $fieldsSpec[$fieldName]['values'][$fieldContent];
- $fieldContent = array_key_exists('name',$tmpVar) ? $tmpVar['name'] : $tmpVar;
- }
- $line .= $this->tag('td',$fieldContent);
- }
- // Restore the old querystring
- $this->url->querystring = $oldQS;
- $table .= $this->mark('tr',$line);
- }
- // Re-set the original domain
- g_setDomain($oldDomain);
- // Display and return the table
- return $this->mark('table',$table,array('id' => $options['id']),true);
- }
-
- public function displayFields($fullFieldsSpec,$fullFieldsContents,$options = array(), $single = '')
- {
- // Ensure that the translation is correctly handled in the core.
- $oldDomain = g_setDomain('g_core');
+ // Display the first Line ( beginning by the empty space for the specs)
+ $line .= $this->tag('th','',array('colspan'=>count($modes)));
+ // Display the titles
+ foreach($fieldsSpec as $fieldName => $fieldProperties) {
+ if($fieldProperties['restricted'] == 'key') { /* == 'id' */
+ $formKey = array('name' => $fieldName);
+ continue;
+ } elseif ($fieldProperties['noShow']) {
+ continue;
+ }
+ $line .= $this->tag('th',$fieldProperties['name']);
+ }
+ // Display the first line as title
+ $table .= $this->mark('tr',$line);
+ // Display the following lines as normal ones
+ foreach($fieldsContents as $id => $row) {
+ $line = '';
+ // Store the old queryString
+ $oldQS = $this->url->querystring;
+ $this->url->addQueryString($formKey['name'],$id);
+ // Go through the modes and display them with the correct image
+ foreach($modes as $mode => $modeSpec) {
+ $this->url->addQueryString('mode',$mode);
+ $fieldContent = $this->image($modeSpec['image'],$modeSpec['name']);
+ $line .= $this->tag('td',$this->tag('a',$fieldContent,array('href'=> $this->url->getURL())));
+ }
+ $this->url->removeQueryString('mode');
+ foreach($row as $fieldName => $fieldContent) {
+ if ($fieldsSpec[$fieldName]['noShow']) {
+ continue;
+ }
+ if(stripos($fieldsSpec[$fieldName]['type'],'date') !== false) { // If we have a date
+ $fieldContent = $this->formatDate($fieldContent);
+ }
+ elseif( stripos($fieldsSpec[$fieldName]['type'],'select') !== false or
+ stripos($fieldsSpec[$fieldName]['type'],'enum') !== false) { // If we have a select
+ $tmpVar = $fieldsSpec[$fieldName]['values'][$fieldContent];
+ $fieldContent = array_key_exists('name',$tmpVar) ? $tmpVar['name'] : $tmpVar;
+ }
+ $line .= $this->tag('td',$fieldContent);
+ }
+ // Restore the old querystring
+ $this->url->querystring = $oldQS;
+ $table .= $this->mark('tr',$line);
+ }
+ // Re-set the original domain
+ g_setDomain($oldDomain);
+ // Display and return the table
+ return $this->mark('table',$table,array('id' => $options['id']),true);
+ }
+
+ public function displayFields($fullFieldsSpec,$fullFieldsContents,$options = array(), $single = '')
+ {
+ // Ensure that the translation is correctly handled in the core.
+ $oldDomain = g_setDomain('g_core');
- $formular = '';
+ $formular = '';
- //* $options = array(
- if(!array_key_exists('id',$options)) $options['id'] = 'NOID';
- if(!array_key_exists('command',$options)) $options['command'] = 'Execute';
- if(!array_key_exists('target',$options)) $options['target'] = $this->url->getQueryString();
- if(!array_key_exists('action',$options)) $options['action'] = 'change';
+ //* $options = array(
+ if(!array_key_exists('id',$options)) $options['id'] = 'NOID';
+ if(!array_key_exists('command',$options)) $options['command'] = 'Execute';
+ if(!array_key_exists('target',$options)) $options['target'] = $this->url->getQueryString();
+ if(!array_key_exists('action',$options)) $options['action'] = 'change';
- if(array_key_exists('title',$options))
- $formular = $this->tag('h2',$options['title']);
+ if(array_key_exists('title',$options))
+ $formular = $this->tag('h2',$options['title']);
-
- $submit = $this->stag('input',array('type'=>'submit', 'value'=>$options['command']));
- $fields = $this->mark('p',$submit);
+
+ $submit = $this->stag('input',array('type'=>'submit', 'value'=>$options['command']));
+ $fields = $this->mark('p',$submit);
- // Initialise the $formKey
- $formKey = array('name' => 'ERROR', 'value' => 'ERROR');
+ // Initialise the $formKey
+ $formKey = array('name' => 'ERROR', 'value' => 'ERROR');
- // If we handle only one plugin
- if( !empty($single) ) {
- $fieldsSpec = $fullFieldsSpec;
- $fieldsContents = $fullFieldsContents;
- unset($fullFieldsSpec);
- unset($fullFieldsContents);
+ // If we handle only one plugin
+ if( !empty($single) ) {
+ $fieldsSpec = $fullFieldsSpec;
+ $fieldsContents = $fullFieldsContents;
+ unset($fullFieldsSpec);
+ unset($fullFieldsContents);
- $fullFieldsSpec[$single] = $fieldsSpec;
- $fullFieldsContents[$single] = $fieldsContents;
- }
- foreach($fullFieldsSpec as $pluginName => $fieldsSpec) {
- if( is_null($fieldsSpec) ) continue;
- $fieldsContents = $fullFieldsContents[$pluginName];
- foreach($fieldsSpec as $fieldName_ => $fieldProperties) {
+ $fullFieldsSpec[$single] = $fieldsSpec;
+ $fullFieldsContents[$single] = $fieldsContents;
+ }
+ foreach($fullFieldsSpec as $pluginName => $fieldsSpec) {
+ if( is_null($fieldsSpec) ) continue;
+ $fieldsContents = $fullFieldsContents[$pluginName];
+ foreach($fieldsSpec as $fieldName_ => $fieldProperties) {
- // Particularize the $fieldName to the plugin
- $fieldName = $pluginName.'_'.$fieldName_;
+ // Particularize the $fieldName to the plugin
+ $fieldName = $pluginName.'_'.$fieldName_;
- // Jump the complete 'id' fields
- if(array_key_exists('restricted',$fieldProperties) && $fieldProperties['restricted'] == 'key') { /* == 'id' */
- $formKey = array('name' => $fieldName, 'value' => $fieldsContents[$fieldName_]);
- continue;
- }
- // Jump the "no-show" fields
- if(array_key_exists('noShow',$fieldProperties) && $fieldProperties['noShow'] === true) continue;
- // Initialize the parameters
- $paramsArray = array();
- // Get the maximum length
- unset($regs); ereg("\([[:space:]]*([0-9]*)[[:space:]]*\)", $fieldProperties['type'], $regs);
- $maxlength = $regs[1];
+ // Jump the complete 'id' fields
+ if(array_key_exists('restricted',$fieldProperties) && $fieldProperties['restricted'] == 'key') { /* == 'id' */
+ $formKey = array('name' => $fieldName, 'value' => $fieldsContents[$fieldName_]);
+ continue;
+ }
+ // Jump the "no-show" fields
+ if(array_key_exists('noShow',$fieldProperties) && $fieldProperties['noShow'] === true) continue;
+ // Initialize the parameters
+ $paramsArray = array();
+ // Get the maximum length
+ unset($regs); ereg("\([[:space:]]*([0-9]*)[[:space:]]*\)", $fieldProperties['type'], $regs);
+ $maxlength = $regs[1];
- if(!empty($maxlength)) $paramsArray['maxlength'] = $maxlength;
- // Treat the eventual error (TODO: rise a corresponding error).
- if(array_key_exists('error',$fieldProperties) && $fieldProperties['error']) $paramsArray['class'] = 'input_error';
-
- if($fieldName_ == 'password') {
- $label = $this->tag('label',$fieldProperties['name'][0],array('for'=>$fieldName));
- // Standard parameters
- $paramsArray['type'] = "password";
- $paramsArray['name'] = $fieldName;
- $paramsArray['id'] = $fieldName;
- $paramsArray['value']= $fieldsContents[$fieldName_];
-
- // Put the field
- $field= $this->stag('input',$paramsArray);
-
-
- // Add the "_old" hidden stag
- $paramsArray['type'] = 'hidden';
- $paramsArray['name'] = g_appendOld($fieldName);
- $paramsArray['id'] = g_appendOld($fieldName);
- $field .= $this->stag('input',$paramsArray);
-
-
- // Stack the fields
- $fields .= $this->mark('p',$label.$field);
-
- // //// ////
- // Repeat the field
- $fieldName = $fieldName.'_repeat';
- $label = $this->tag('label',$fieldProperties['name'][1],array('for'=>$fieldName));
- // Standard parameters
- $paramsArray['type'] = "password";
- $paramsArray['name'] = $fieldName;
- $paramsArray['id'] = $fieldName;
-
- // Put the field
- $field = $this->stag('input',$paramsArray);
-
- // Stack the fields
- $fields .= $this->mark('p',$label.$field);
- //
- } elseif(stripos($fieldProperties['type'],'varchar') !== false ||
- stripos($fieldProperties['type'],'int') !== false) {
- $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
- // Standard parameters
- $paramsArray['type'] = "text";
- $paramsArray['name'] = $fieldName;
- $paramsArray['id'] = $fieldName;
- $paramsArray['value']= !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
-
- if(array_key_exists('restricted',$fieldProperties)) {
- // Additional parameters
- if($fieldProperties['restricted'] == 'key') $paramsArray['disabled'] = 'disabled';
- if($fieldProperties['restricted'] == 'unique') $paramsArray['disabled'] = 'disabled';
- }
+ if(!empty($maxlength)) $paramsArray['maxlength'] = $maxlength;
+ // Treat the eventual error (TODO: rise a corresponding error).
+ if(array_key_exists('error',$fieldProperties) && $fieldProperties['error']) $paramsArray['class'] = 'input_error';
+
+ if($fieldName_ == 'password') {
+ $label = $this->tag('label',$fieldProperties['name'][0],array('for'=>$fieldName));
+ // Standard parameters
+ $paramsArray['type'] = "password";
+ $paramsArray['name'] = $fieldName;
+ $paramsArray['id'] = $fieldName;
+ $paramsArray['value']= $fieldsContents[$fieldName_];
+
+ // Put the field
+ $field= $this->stag('input',$paramsArray);
+
+
+ // Add the "_old" hidden stag
+ $paramsArray['type'] = 'hidden';
+ $paramsArray['name'] = g_appendOld($fieldName);
+ $paramsArray['id'] = g_appendOld($fieldName);
+ $field .= $this->stag('input',$paramsArray);
+
+
+ // Stack the fields
+ $fields .= $this->mark('p',$label.$field);
+
+ // //// ////
+ // Repeat the field
+ $fieldName = $fieldName.'_repeat';
+ $label = $this->tag('label',$fieldProperties['name'][1],array('for'=>$fieldName));
+ // Standard parameters
+ $paramsArray['type'] = "password";
+ $paramsArray['name'] = $fieldName;
+ $paramsArray['id'] = $fieldName;
+
+ // Put the field
+ $field = $this->stag('input',$paramsArray);
+
+ // Stack the fields
+ $fields .= $this->mark('p',$label.$field);
+ //
+ } elseif(stripos($fieldProperties['type'],'varchar') !== false ||
+ stripos($fieldProperties['type'],'int') !== false) {
+ $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
+ // Standard parameters
+ $paramsArray['type'] = "text";
+ $paramsArray['name'] = $fieldName;
+ $paramsArray['id'] = $fieldName;
+ $paramsArray['value']= !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
+
+ if(array_key_exists('restricted',$fieldProperties)) {
+ // Additional parameters
+ if($fieldProperties['restricted'] == 'key') $paramsArray['disabled'] = 'disabled';
+ if($fieldProperties['restricted'] == 'unique') $paramsArray['disabled'] = 'disabled';
+ }
- // Put the field
- $field = $this->stag('input',$paramsArray);
- // Add the "_old" hidden stag
- $paramsArray['type'] = 'hidden';
- $paramsArray['name'] = g_appendOld($fieldName);
- $paramsArray['id'] = g_appendOld($fieldName);
- unset($paramsArray['maxlength']);
- $field .= LB.$this->stag('input',$paramsArray);
-
- // Stack the fields
- $fields .= $this->mark('p',$label.LB.$field);
- } elseif(stripos($fieldProperties['type'],'text') !== false) {
- $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
- // Standard parameters
- $paramsArray['name'] = $fieldName;
- $paramsArray['id'] = $fieldName;
- $paramsArray['rows'] = $fieldProperties['rows'];
- $paramsArray['cols'] = $fieldProperties['cols'];
- $value = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
-
- // Avoids the linereturn and so it's good
- $value = str_replace("\n",'',$value);
-
- $field = $this->textarea($value,$paramsArray);
-
- // Stack the fields
- $fields .= $this->mark('p',$label.LB.$field);
-
- } elseif(stripos($fieldProperties['type'],'date') !== false) {
- $field = $this->xdate($fieldProperties,$fieldsContents[$fieldName_],$fieldName,$paramsArray);
- // Add the "_old" hidden stag
- $paramsArray['type'] = 'hidden';
- $paramsArray['name'] = g_appendOld($fieldName);
- $paramsArray['id'] = g_appendOld($fieldName);
- $paramsArray['value'] = $this->formatDateSimple($fieldsContents[$fieldName_]);
- $field .= LB.$this->stag('input',$paramsArray);
- $fields .= $this->mark('p',LB.$field);
- } elseif(stripos($fieldProperties['type'],'enum') !== false) {
- $label = $this->tag('legend',$fieldProperties['name'],array());
- // Standard parameters
- $paramsArray['type'] = "radio";
- $paramsArray['name'] = $fieldName;
- $field = '';
- foreach($fieldProperties['values'] as $codeName => $codeTranslation) {
- $paramsArray['id'] = $fieldName.'_'.$codeName;
- $paramsArray['value'] = $codeName;
-
- if( $fieldsContents[$fieldName_] == $codeName ) {
- $paramsArray['checked'] = 'checked';
- } else {
- unset($paramsArray['checked']);
- }
-
- $sub_label = $this->tag('label',$codeTranslation,array('for'=>$paramsArray['id']));
- $field .= LB.$sub_label . $this->stag('input',$paramsArray);
- }
- // Add the "_old" hidden stag
- $paramsArray['type'] = 'hidden';
- $paramsArray['name'] = g_appendOld($fieldName);
- $paramsArray['id'] = g_appendOld($fieldName);
- $paramsArray['value'] = $fieldsContents[$fieldName_];
- unset($paramsArray['checked']);
- $field .= LB.$this->stag('input',$paramsArray);
- // Stack the fields
- $fields .= $this->mark('fieldset',$label.$field);
- // SELECT
- } elseif(stripos($fieldProperties['type'],'select') !== false) {
- $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
- // Standard parameters
- $paramsArray['name'] = $fieldName;
- $paramsArray['id'] = $fieldName;
+ // Put the field
+ $field = $this->stag('input',$paramsArray);
+ // Add the "_old" hidden stag
+ $paramsArray['type'] = 'hidden';
+ $paramsArray['name'] = g_appendOld($fieldName);
+ $paramsArray['id'] = g_appendOld($fieldName);
+ unset($paramsArray['maxlength']);
+ $field .= LB.$this->stag('input',$paramsArray);
+
+ // Stack the fields
+ $fields .= $this->mark('p',$label.LB.$field);
+ } elseif(stripos($fieldProperties['type'],'text') !== false) {
+ $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
+ // Standard parameters
+ $paramsArray['name'] = $fieldName;
+ $paramsArray['id'] = $fieldName;
+ $paramsArray['rows'] = $fieldProperties['rows'];
+ $paramsArray['cols'] = $fieldProperties['cols'];
+ $value = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
+
+ // Avoids the linereturn and so it's good
+ $value = str_replace("\n",'',$value);
+
+ $field = $this->textarea($value,$paramsArray);
+
+ // Stack the fields
+ $fields .= $this->mark('p',$label.LB.$field);
+
+ } elseif(stripos($fieldProperties['type'],'date') !== false) {
+ $field = $this->xdate($fieldProperties,$fieldsContents[$fieldName_],$fieldName,$paramsArray);
+ // Add the "_old" hidden stag
+ $paramsArray['type'] = 'hidden';
+ $paramsArray['name'] = g_appendOld($fieldName);
+ $paramsArray['id'] = g_appendOld($fieldName);
+ $paramsArray['value'] = $this->formatDateSimple($fieldsContents[$fieldName_]);
+ $field .= LB.$this->stag('input',$paramsArray);
+ $fields .= $this->mark('p',LB.$field);
+ } elseif(stripos($fieldProperties['type'],'enum') !== false) {
+ $label = $this->tag('legend',$fieldProperties['name'],array());
+ // Standard parameters
+ $paramsArray['type'] = "radio";
+ $paramsArray['name'] = $fieldName;
+ $field = '';
+ foreach($fieldProperties['values'] as $codeName => $codeTranslation) {
+ $paramsArray['id'] = $fieldName.'_'.$codeName;
+ $paramsArray['value'] = $codeName;
+
+ if( $fieldsContents[$fieldName_] == $codeName ) {
+ $paramsArray['checked'] = 'checked';
+ } else {
+ unset($paramsArray['checked']);
+ }
+
+ $sub_label = $this->tag('label',$codeTranslation,array('for'=>$paramsArray['id']));
+ $field .= LB.$sub_label . $this->stag('input',$paramsArray);
+ }
+ // Add the "_old" hidden stag
+ $paramsArray['type'] = 'hidden';
+ $paramsArray['name'] = g_appendOld($fieldName);
+ $paramsArray['id'] = g_appendOld($fieldName);
+ $paramsArray['value'] = $fieldsContents[$fieldName_];
+ unset($paramsArray['checked']);
+ $field .= LB.$this->stag('input',$paramsArray);
+ // Stack the fields
+ $fields .= $this->mark('fieldset',$label.$field);
+ // SELECT
+ } elseif(stripos($fieldProperties['type'],'select') !== false) {
+ $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
+ // Standard parameters
+ $paramsArray['name'] = $fieldName;
+ $paramsArray['id'] = $fieldName;
- $options_selected = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
+ $options_selected = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
- if( $fieldProperties['multiple'] === true ) {
- $paramsArray['multiple'] = 'multiple';
- }
+ if( $fieldProperties['multiple'] === true ) {
+ $paramsArray['multiple'] = 'multiple';
+ }
- // Defaults to no optgroups
- if( !array_key_exists('optgroups',$fieldProperties)) {
- $fieldProperties['optgroups'] = false;
- }
+ // Defaults to no optgroups
+ if( !array_key_exists('optgroups',$fieldProperties)) {
+ $fieldProperties['optgroups'] = false;
+ }
- $field = $this->select($fieldProperties['values'],$options_selected,$paramsArray,false,$fieldProperties['optgroups']);
- // Stack the fields
- $fields .= $this->mark('p',$label.LB.$field);
- } elseif(stripos($fieldProperties['type'],'COUNTRY') !== false ) {
- $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
- // Standard parameters
- $paramsArray['name'] = $fieldName;
- $paramsArray['id'] = $fieldName;
+ $field = $this->select($fieldProperties['values'],$options_selected,$paramsArray,false,$fieldProperties['optgroups']);
+ // Stack the fields
+ $fields .= $this->mark('p',$label.LB.$field);
+ } elseif(stripos($fieldProperties['type'],'COUNTRY') !== false ) {
+ $label = $this->tag('label',$fieldProperties['name'],array('for'=>$fieldName));
+ // Standard parameters
+ $paramsArray['name'] = $fieldName;
+ $paramsArray['id'] = $fieldName;
- $options_selected = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
-
- $field = $this->select($this->countryCodes,$options_selected,$paramsArray);
- $fields .= $this->mark('p',$label.LB.$field);
- }
- // maxlength and various types...
- }
- }
- $submit = $this->stag('input',array('type'=>'submit', 'value'=>$options['command']));
- // Display the 'key' with its values
- $submit .= $this->stag('input',array('type'=>'hidden','name'=>$formKey['name'],'value'=>$formKey['value']));
- $submit .= $this->stag('input',array('type'=>'hidden','name'=>$this->config['URL']['action'],'value'=>$options['action']));
- $fields .= $this->mark('p',$submit);
- $formular .= $this->mark('form',$fields,array('method'=>'post','action'=> $options['target']));
-
- // Re-set the original domain
- g_setDomain($oldDomain);
- // Return it and display it.
- return $this->mark('div',$formular,array("id"=>$options['id']),true);
- }
+ $options_selected = !empty($fieldsContents[$fieldName_]) ? $fieldsContents[$fieldName_] : $fieldProperties['default'];
+
+ $field = $this->select($this->countryCodes,$options_selected,$paramsArray);
+ $fields .= $this->mark('p',$label.LB.$field);
+ }
+ // maxlength and various types...
+ }
+ }
+ $submit = $this->stag('input',array('type'=>'submit', 'value'=>$options['command']));
+ // Display the 'key' with its values
+ $submit .= $this->stag('input',array('type'=>'hidden','name'=>$formKey['name'],'value'=>$formKey['value']));
+ $submit .= $this->stag('input',array('type'=>'hidden','name'=>$this->config['URL']['action'],'value'=>$options['action']));
+ $fields .= $this->mark('p',$submit);
+ $formular .= $this->mark('form',$fields,array('method'=>'post','action'=> $options['target']));
+
+ // Re-set the original domain
+ g_setDomain($oldDomain);
+ // Return it and display it.
+ return $this->mark('div',$formular,array("id"=>$options['id']),true);
+ }
- public function displayMenu($targets)
- { // Store the old querystring
- $oldQS = $this->url->querystring;
- // Use a pristine querystring
- $this->url->querystring = '';
- $modules = '';
- // Go along all the plugins
- foreach($targets as $plugin => $pluginMenu) {
- $this->url->addQueryString('plugin',$plugin);
- if(array_key_exists('Tname',$pluginMenu)) {
- $submenu = $pluginMenu['Tname'].LB;
- unset($pluginMenu['Tname']);
- } else {
- $submenu = $this->$plugin.LB;
- }
- $submenu = $this->tag('a',$submenu,array('href'=> $this->url->getURL()));
- // Reset the (subsub-)menu for each plugin
- $subsubmenu = '';
- foreach($pluginMenu as $target => $targetSpec) {
- $this->url->addQueryString('mode',$target);
- $link = $this->tag('a',$targetSpec['name'],array('href'=> $this->url->getURL()));
- $subsubmenu .= $this->tag('li',$link,array(),true);
- }
- $this->url->removeQueryString('mode');
- $submenu .= $this->mark('ul',$subsubmenu);
- $modules .= $this->tag('li',$submenu);
- }
- // ReStore the old QS
- $this->url->querystring = $oldQS;
- return $this->mark('ul',$modules,array('id'=>'modules_menu'),true);
- }
+ public function displayMenu($targets)
+ { // Store the old querystring
+ $oldQS = $this->url->querystring;
+ // Use a pristine querystring
+ $this->url->querystring = '';
+ $modules = '';
+ // Go along all the plugins
+ foreach($targets as $plugin => $pluginMenu) {
+ $this->url->addQueryString('plugin',$plugin);
+ if(array_key_exists('Tname',$pluginMenu)) {
+ $submenu = $pluginMenu['Tname'].LB;
+ unset($pluginMenu['Tname']);
+ } else {
+ $submenu = $this->$plugin.LB;
+ }
+ $submenu = $this->tag('a',$submenu,array('href'=> $this->url->getURL()));
+ // Reset the (subsub-)menu for each plugin
+ $subsubmenu = '';
+ foreach($pluginMenu as $target => $targetSpec) {
+ $this->url->addQueryString('mode',$target);
+ $link = $this->tag('a',$targetSpec['name'],array('href'=> $this->url->getURL()));
+ $subsubmenu .= $this->tag('li',$link,array(),true);
+ }
+ $this->url->removeQueryString('mode');
+ $submenu .= $this->mark('ul',$subsubmenu);
+ $modules .= $this->tag('li',$submenu);
+ }
+ // ReStore the old QS
+ $this->url->querystring = $oldQS;
+ return $this->mark('ul',$modules,array('id'=>'modules_menu'),true);
+ }
- public function stats($timeStart)
- {
- $totalComputationTime = microtime(true) - $timeStart;
+ public function stats($timeStart)
+ {
+ $totalComputationTime = microtime(true) - $timeStart;
- $statsCode = $this->mark('p',sprintf(T_('Total computation time: %.3f seconds.'),$totalComputationTime),array(),false);
- $statsCode .= $this->mark('p',sprintf(T_('Powered by Ghelda, version %s'),GHELDA_VERSION),array(),false);
- $statsCode .= $this->mark('p',$this->tag('a',$this->stag('img',array(
- 'src'=>"http://www.w3.org/Icons/valid-xhtml11-blue",
- 'alt'=>"Valid XHTML 1.1", "height"=>"31", "width"=>"88")),
- array(
- 'href'=> "http://validator.w3.org/check?uri=referer")));
- return $this->mark('div',$statsCode,array(),true);
- }
- //! Destructor
- /*! Automagically display the closing body-html tags
- */
- public function __destruct()
- {
- if($this->headerSent) echo "</body>".LB."</html>";
- }
+ $statsCode = $this->mark('p',sprintf(T_('Total computation time: %.3f seconds.'),$totalComputationTime),array(),false);
+ $statsCode .= $this->mark('p',sprintf(T_('Powered by Ghelda, version %s'),GHELDA_VERSION),array(),false);
+ $statsCode .= $this->mark('p',$this->tag('a',$this->stag('img',array(
+ 'src'=>"http://www.w3.org/Icons/valid-xhtml11-blue",
+ 'alt'=>"Valid XHTML 1.1", "height"=>"31", "width"=>"88")),
+ array(
+ 'href'=> "http://validator.w3.org/check?uri=referer")));
+ return $this->mark('div',$statsCode,array(),true);
+ }
+ //! Destructor
+ /*! Automagically display the closing body-html tags
+ */
+ public function __destruct()
+ {
+ if($this->headerSent) echo "</body>".LB."</html>";
+ }
- // PRIVATE functions
+ // PRIVATE functions
- private function echo_($code,$offset = 0,$do_echo = true)
- {
- // Pre-decrement
- if($offset < 0) {
- $this->indent = substr($this->indent,0,-$this->incrementCharLen);
- }
+ private function echo_($code,$offset = 0,$do_echo = true)
+ {
+ // Pre-decrement
+ if($offset < 0) {
+ $this->indent = substr($this->indent,0,-$this->incrementCharLen);
+ }
- // Replace all the occurences of the linebreak and indent
- $code = str_replace(LB,LB.$this->indent,$code);
- $code = $this->indent.$code;
+ // Replace all the occurences of the linebreak and indent
+ $code = str_replace(LB,LB.$this->indent,$code);
+ $code = $this->indent.$code;
- // Post-Increment
- if($offset > 0) {
- $this->indent .= $this->incrementChar;
- }
-
- if($do_echo) echo $code;
+ // Post-Increment
+ if($offset > 0) {
+ $this->indent .= $this->incrementChar;
+ }
+
+ if($do_echo) echo $code;
- return $code;
- }
+ return $code;
+ }
- private function textarea($code,$attributes_array = array(),$do_break = false,$do_echo = false)
- {
- $mark = 'textarea';
- $attributes = '';
- foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
- }
- $LB = '';
- if($do_break) $LB = LB;
+ private function textarea($code,$attributes_array = array(),$do_break = false,$do_echo = false)
+ {
+ $mark = 'textarea';
+ $attributes = '';
+ foreach($attributes_array as $aa_key => $aa_value) {
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
+ }
+ $LB = '';
+ if($do_break) $LB = LB;
- return $this->echo_("<$mark$attributes>".$code."</$mark>".$LB,0,$do_echo);
- }
+ return $this->echo_("<$mark$attributes>".$code."</$mark>".$LB,0,$do_echo);
+ }
- private function tag($mark,$code,$attributes_array = array(),$do_break = false,$do_echo = false)
- {
- $attributes = '';
- foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
- }
- $LB = '';
- if($do_break) $LB = LB;
+ private function tag($mark,$code,$attributes_array = array(),$do_break = false,$do_echo = false)
+ {
+ $attributes = '';
+ foreach($attributes_array as $aa_key => $aa_value) {
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
+ }
+ $LB = '';
+ if($do_break) $LB = LB;
- return $this->echo_("<$mark$attributes>".$code."</$mark>".$LB,0,$do_echo);
- }
+ return $this->echo_("<$mark$attributes>".$code."</$mark>".$LB,0,$do_echo);
+ }
- private function stag($smark,$attributes_array = array(),$do_break = false,$do_echo = false)
- {
- $attributes = '';
- foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
- }
+ private function stag($smark,$attributes_array = array(),$do_break = false,$do_echo = false)
+ {
+ $attributes = '';
+ foreach($attributes_array as $aa_key => $aa_value) {
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
+ }
- $LB = "";
- if($do_break) $LB = LB;
+ $LB = "";
+ if($do_break) $LB = LB;
- return $this->echo_("<$smark$attributes />".$LB,0,$do_echo);
- }
-
- private function mark($tag,$code,$attributes_array = array(),$do_echo = false, $do_indent = true)
- {
- $attributes = '';
- foreach($attributes_array as $aa_key => $aa_value) {
- $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
- }
- $to_return = $this->echo_("<$tag$attributes>".LB,1,$do_echo,$do_indent);
- $to_return .= $this->echo_($code,0,$do_echo,$do_indent);
- $to_return .= $this->echo_(LB."</$tag>",-1,$do_echo,$do_indent);
- $to_return .= $this->echo_(LB,0,$do_echo,$do_indent);
+ return $this->echo_("<$smark$attributes />".$LB,0,$do_echo);
+ }
+
+ private function mark($tag,$code,$attributes_array = array(),$do_echo = false, $do_indent = true)
+ {
+ $attributes = '';
+ foreach($attributes_array as $aa_key => $aa_value) {
+ $attributes .= ' '.$aa_key.'="'.$this->hsc($aa_key,$aa_value).'"';
+ }
+ $to_return = $this->echo_("<$tag$attributes>".LB,1,$do_echo,$do_indent);
+ $to_return .= $this->echo_($code,0,$do_echo,$do_indent);
+ $to_return .= $this->echo_(LB."</$tag>",-1,$do_echo,$do_indent);
+ $to_return .= $this->echo_(LB,0,$do_echo,$do_indent);
- return $to_return;
- }
+ return $to_return;
+ }
- private function select($options,$options_selected = array(),$attributes_array = array(),$do_echo = false, $optgroups = false)
- {
- // Convert the string input into one-cell array.
- if(is_string($options_selected)) $options_selected = array($options_selected);
+ private function select($options,$options_selected = array(),$attributes_array = array(),$do_echo = false, $optgroups = false)
+ {
+ // Convert the string input into one-cell array.
+ if(is_string($options_selected)) $options_selected = array($options_selected);
- if( $optgroups === false ) {
- $optionsTxt = '';
- // Go through all the options and draw the correct section
- foreach($options as $value => $name) {
+ if( $optgroups === false ) {
+ $optionsTxt = '';
+ // Go through all the options and draw the correct section
+ foreach($options as $value => $name) {
- // Set the value iff the value is different
- $attributes = $value !== $name ? array('value' => $value) : array();
-
- if(!is_null($options_selected) && in_array($value,$options_selected)) {
- $attributes['selected'] = 'selected';
- }
- $optionsTxt .= $this->tag('option',is_array($name) && array_key_exists('name',$name) ? $name['name'] : $name,$attributes); // Add "true" at the end for easier formatting
- }
- } else {
- // Go along all the optgroups
- $optionsTxt = '';
- foreach($options as $optgroup_id => $optgroup) {
- $opt_name = $optgroup['name'];
- $options = $optgroup['values'];
+ // Set the value iff the value is different
+ $attributes = $value !== $name ? array('value' => $value) : array();
+
+ if(!is_null($options_selected) && in_array($value,$options_selected)) {
+ $attributes['selected'] = 'selected';
+ }
+ $optionsTxt .= $this->tag('option',is_array($name) && array_key_exists('name',$name) ? $name['name'] : $name,$attributes); // Add "true" at the end for easier formatting
+ }
+ } else {
+ // Go along all the optgroups
+ $optionsTxt = '';
+ foreach($options as $optgroup_id => $optgroup) {
+ $opt_name = $optgroup['name'];
+ $options = $optgroup['values'];
- $opt_attributes['label'] = $opt_name;
- $optionsInTxt = '';
- // Go through all the options and draw the correct section
- foreach($options as $value => $name) {
- // Set the value iff the value is different
- $attributes = $value !== $name ? array('value' => $value) : array();
-
- if(!is_null($options_selected) && in_array($value,$options_selected)) {
- $attributes['selected'] = 'selected';
- }
- $optionsInTxt .= $this->tag('option', is_array($name) && array_key_exists('name',$name) ? $name['name'] : $name,$attributes); // Add "true" at the end for easier formatting
- }
- $optionsTxt .= $this->mark('optgroup',$optionsInTxt,$opt_attributes);
- }
- }
- return $this->mark('select',$optionsTxt,$attributes_array,$do_echo);
- }
+ $opt_attributes['label'] = $opt_name;
+ $optionsInTxt = '';
+ // Go through all the options and draw the correct section
+ foreach($options as $value => $name) {
+ // Set the value iff the value is different
+ $attributes = $value !== $name ? array('value' => $value) : array();
+
+ if(!is_null($options_selected) && in_array($value,$options_selected)) {
+ $attributes['selected'] = 'selected';
+ }
+ $optionsInTxt .= $this->tag('option', is_array($name) && array_key_exists('name',$name) ? $name['name'] : $name,$attributes); // Add "true" at the end for easier formatting
+ }
+ $optionsTxt .= $this->mark('optgroup',$optionsInTxt,$opt_attributes);
+ }
+ }
+ return $this->mark('select',$optionsTxt,$attributes_array,$do_echo);
+ }
- private function xdate($fieldProperties,$fieldContent,$fieldName,$paramsArray)
- {
- // $fieldContent = $fieldsContents[$fieldName];
- $label = $this->tag('label',$fieldProperties['name'],array('for'=>g_appendOld($fieldName,'_year')));
- $formattedDate = T_('%YEAR%-%MONTH%-%DAY%');
- preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $fieldContent, $regs);
- $dateOptions = array_key_exists('error',$fieldProperties) ? ($fieldProperties['error'] ? array("class" => "input_error") : array() ) : array();
- // Get the global lists
- global $DAYS,$MONTHS,$YEARS;
- $year = $this->select($YEARS,$regs[1],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_year'),'id'=>g_appendOld($fieldName,'_year'))));
- $month = $this->select($MONTHS,$regs[2],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_month'))));
- $day = $this->select($DAYS,$regs[3],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_day'))));
-
- $formattedDate = str_replace('%YEAR%',$year,$formattedDate);
- $formattedDate = str_replace('%MONTH%',$month,$formattedDate);
- $formattedDate = str_replace('%DAY%',$day,$formattedDate);
- // Stack the fields
- return $label.$formattedDate;
- }
-
- private function formatDate($date)
- {
- // Get the i18n'ed version of the date
- $formattedDate = T_('%YEAR%-%MONTH%-%DAY%');
- // Parse the date according to the standard scheme
- preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $date, $regs);
- // Get the global lists
- global $DAYS,$MONTHS,$YEARS;
-
- // If zaroo date => return empty string
+ private function xdate($fieldProperties,$fieldContent,$fieldName,$paramsArray)
+ {
+ // $fieldContent = $fieldsContents[$fieldName];
+ $label = $this->tag('label',$fieldProperties['name'],array('for'=>g_appendOld($fieldName,'_year')));
+ $formattedDate = T_('%YEAR%-%MONTH%-%DAY%');
+ preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $fieldContent, $regs);
+ $dateOptions = array_key_exists('error',$fieldProperties) ? ($fieldProperties['error'] ? array("class" => "input_error") : array() ) : array();
+ // Get the global lists
+ global $DAYS,$MONTHS,$YEARS;
+ $year = $this->select($YEARS,$regs[1],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_year'),'id'=>g_appendOld($fieldName,'_year'))));
+ $month = $this->select($MONTHS,$regs[2],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_month'))));
+ $day = $this->select($DAYS,$regs[3],array_merge($paramsArray,array('name'=>g_appendOld($fieldName,'_day'))));
+
+ $formattedDate = str_replace('%YEAR%',$year,$formattedDate);
+ $formattedDate = str_replace('%MONTH%',$month,$formattedDate);
+ $formattedDate = str_replace('%DAY%',$day,$formattedDate);
+ // Stack the fields
+ return $label.$formattedDate;
+ }
+
+ private function formatDate($date)
+ {
+ // Get the i18n'ed version of the date
+ $formattedDate = T_('%YEAR%-%MONTH%-%DAY%');
+ // Parse the date according to the standard scheme
+ preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $date, $regs);
+ // Get the global lists
+ global $DAYS,$MONTHS,$YEARS;
+
+ // If zaroo date => return empty string
- if((int)$regs[1] == 0) return '';
- $formattedDate = str_replace('%YEAR%',$YEARS[(int)$regs[1]],$formattedDate);
- $formattedDate = str_replace('%MONTH%',$MONTHS[(int)$regs[2]],$formattedDate);
- $formattedDate = str_replace('%DAY%',$DAYS[(int)$regs[3]],$formattedDate);
+ if((int)$regs[1] == 0) return '';
+ $formattedDate = str_replace('%YEAR%',$YEARS[(int)$regs[1]],$formattedDate);
+ $formattedDate = str_replace('%MONTH%',$MONTHS[(int)$regs[2]],$formattedDate);
+ $formattedDate = str_replace('%DAY%',$DAYS[(int)$regs[3]],$formattedDate);
- return $formattedDate;
- }
+ return $formattedDate;
+ }
- // Reduce the date to delete leading zeros
- private function formatDateSimple($date)
- {
- preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $date, $regs);
- return (int)$regs[1].'-'.(int)$regs[2].'-'.(int)$regs[3];
- }
+ // Reduce the date to delete leading zeros
+ private function formatDateSimple($date)
+ {
+ preg_match("`([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})`", $date, $regs);
+ return (int)$regs[1].'-'.(int)$regs[2].'-'.(int)$regs[3];
+ }
- private function comment($code, $do_echo = false)
- {
- return $this->echo_("<!--".LB,1,$do_echo).$this->echo_($code,0,$do_echo).$this->echo_(LB."-->",-1,$do_echo).$this->echo_(LB,0,$do_echo);
- }
+ private function comment($code, $do_echo = false)
+ {
+ return $this->echo_("<!--".LB,1,$do_echo).$this->echo_($code,0,$do_echo).$this->echo_(LB."-->",-1,$do_echo).$this->echo_(LB,0,$do_echo);
+ }
- private function image($imageCode,$imageTitle)
- {
- if(array_key_exists($imageCode,$this->config['images'])) {
- $image = $this->config['images'][$imageCode];
- return $this->stag('img',array('src' => 'style/default/'.$image['source'],'title' => $imageTitle, 'alt' => $imageTitle, 'width' => $image['size'][0],'height' => $image['size'][1]));
- } else {
- return $imageTitle;
- }
- }
+ private function image($imageCode,$imageTitle)
+ {
+ if(array_key_exists($imageCode,$this->config['images'])) {
+ $image = $this->config['images'][$imageCode];
+ return $this->stag('img',array('src' => 'style/default/'.$image['source'],'title' => $imageTitle, 'alt' => $imageTitle, 'width' => $image['size'][0],'height' => $image['size'][1]));
+ } else {
+ return $imageTitle;
+ }
+ }
- private function hsc($key,$value) {
- // xHTML Validity
- if( $key == "id" || $key == "for")
- $value = str_replace(array('[',']'),array('',''),$value);
- return htmlspecialchars($value);
- }
-}
+ private function hsc($key,$value) {
+ // xHTML Validity
+ if( $key == "id" || $key == "for")
+ $value = str_replace(array('[',']'),array('',''),$value);
+ return htmlspecialchars($value);
+ }
+}
?>
Modified: trunk/index.php
===================================================================
--- trunk/index.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/index.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -49,7 +49,7 @@
require_once "init/gettext.php"; // Allows the use of T_ for "automatic" translation
// Handles day, month and years ranges (T_'ed)
-require_once "inc/date.php"; // $MONTHS, $DAYS, $YEARS
+require_once "inc/date.php"; // $MONTHS, $DAYS, $YEARS
// Handle the plugins
require_once "init/plugins.php"; // Gives $g_H_Plugins
@@ -63,9 +63,9 @@
// Body
if($g_H_Auth->getAuth()) {
- $g_H_Plugins->menu();
+ $g_H_Plugins->menu();
- $g_H_Plugin->main();
+ $g_H_Plugin->main();
}
$g_H_Output->error_box($g_H_DisplayLogger->get_messages());
Modified: trunk/init/auth.php
===================================================================
--- trunk/init/auth.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/init/auth.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -28,13 +28,13 @@
// Create the Authentication Handler
// setting the database connection options
$g_AuthOptions = array(
- 'dsn' => $g_Config['DB']['DSN'],
- 'table' => $g_Config['DB']['prefix'].'people',
- 'usernamecol'=> G_DB_PEOPLE_USERNAME,
- 'passwordcol'=> G_DB_PEOPLE_PASSWORD,
- 'cryptType'=> $g_Config['Auth']['cryptType'],
- 'sessionName' => $g_Config['Auth']['sessionName'],
- 'enableLogging' => true
+ 'dsn' => $g_Config['DB']['DSN'],
+ 'table' => $g_Config['DB']['prefix'].'people',
+ 'usernamecol'=> G_DB_PEOPLE_USERNAME,
+ 'passwordcol'=> G_DB_PEOPLE_PASSWORD,
+ 'cryptType'=> $g_Config['Auth']['cryptType'],
+ 'sessionName' => $g_Config['Auth']['sessionName'],
+ 'enableLogging' => true
);
// TODO: Use the same DataBase Handler
@@ -48,8 +48,8 @@
// If the disconnection was asked
if(array_key_exists($g_Config['URL']['disconnect'],$g_H_URL->querystring)) {
- $g_H_URL->removeQueryString($g_Config['URL']['disconnect']);
- $g_H_Auth->logout();
+ $g_H_URL->removeQueryString($g_Config['URL']['disconnect']);
+ $g_H_Auth->logout();
}
$g_H_Auth->start(); // starting the authentication process
Modified: trunk/init/db.php
===================================================================
--- trunk/init/db.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/init/db.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -27,17 +27,17 @@
//! Automagically report of the queries sent in class DB_mysqli
class MDB2_Driver_mysqllog extends MDB2_Driver_mysql
{
- //! Standard error level of the given queries
- /*!
- * @sa log.php
- */
- private $errorLevel = E_USER_WARNING;
+ //! Standard error level of the given queries
+ /*!
+ * @sa log.php
+ */
+ private $errorLevel = E_USER_WARNING;
- function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
- {
- trigger_error('[SQL] '.$query,$this->errorLevel);
- return parent::_doQuery($query, $is_manip = false, $connection = null, $database_name = null);
- }
+ function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
+ {
+ trigger_error('[SQL] '.$query,$this->errorLevel);
+ return parent::_doQuery($query, $is_manip = false, $connection = null, $database_name = null);
+ }
}
$g_Config['DB']['DSN']['phptype'] = 'mysqllog';
@@ -49,10 +49,10 @@
$g_H_DB->loadModule('Extended');
if (PEAR::isError($g_H_DB)) {
- $Logger->err($g_H_DB->getMessage());
+ $Logger->err($g_H_DB->getMessage());
} else {
- // Configure it to always render results in "assoc" mode
- $g_H_DB->setFetchMode(MDB2_FETCHMODE_ASSOC);
+ // Configure it to always render results in "assoc" mode
+ $g_H_DB->setFetchMode(MDB2_FETCHMODE_ASSOC);
}
/*
Modified: trunk/init/gettext.php
===================================================================
--- trunk/init/gettext.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/init/gettext.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-require_once "php-gettext/gettext.inc";
+require_once "php-gettext/gettext.inc";
// Create the gettext handling environment
define('LOCALE_DIR', realpath('./locale'));
@@ -27,38 +27,38 @@
function g_setDomain($newDomain)
{
- global $g_GT_locale,$g_GT_domain;
-
- // Store the actual locale and domain
- $g_GT_oldDomain = $g_GT_domain;
- // Set the new ones
- $g_GT_domain = $newDomain;
-
- // gettext setup
- T_setlocale(LC_MESSAGES, $g_GT_locale);
- T_bindtextdomain($g_GT_domain, LOCALE_DIR);
- T_bind_textdomain_codeset($g_GT_domain, substr($g_GT_locale, 3));
- T_textdomain($g_GT_domain);
+ global $g_GT_locale,$g_GT_domain;
+
+ // Store the actual locale and domain
+ $g_GT_oldDomain = $g_GT_domain;
+ // Set the new ones
+ $g_GT_domain = $newDomain;
+
+ // gettext setup
+ T_setlocale(LC_MESSAGES, $g_GT_locale);
+ T_bindtextdomain($g_GT_domain, LOCALE_DIR);
+ T_bind_textdomain_codeset($g_GT_domain, substr($g_GT_locale, 3));
+ T_textdomain($g_GT_domain);
- return $g_GT_oldDomain;
+ return $g_GT_oldDomain;
}
function g_setLocale($newLocale)
-{
- global $g_GT_locale,$g_GT_domain;
-
- // Store the actual locale
- $g_GT_oldLocale = $g_GT_locale;
- // Set the new ones
- $g_GT_locale = $newLocale;
-
- // gettext setup
- T_setlocale(LC_MESSAGES, $g_GT_locale);
- T_bindtextdomain($g_GT_domain, LOCALE_DIR);
- T_bind_textdomain_codeset($g_GT_domain, substr($g_GT_locale, 6));
- T_textdomain($g_GT_domain);
+{
+ global $g_GT_locale,$g_GT_domain;
+
+ // Store the actual locale
+ $g_GT_oldLocale = $g_GT_locale;
+ // Set the new ones
+ $g_GT_locale = $newLocale;
+
+ // gettext setup
+ T_setlocale(LC_MESSAGES, $g_GT_locale);
+ T_bindtextdomain($g_GT_domain, LOCALE_DIR);
+ T_bind_textdomain_codeset($g_GT_domain, substr($g_GT_locale, 6));
+ T_textdomain($g_GT_domain);
- return $g_GT_oldLocale;
+ return $g_GT_oldLocale;
}
// TODO: Use Pear::HTTP
@@ -81,12 +81,12 @@
//Get the locale from url (what the user asked NOW)
if(array_key_exists($g_Config['URL']['locale'],$g_H_URL->querystring)) {
- $g_GT_urlLocale = $g_H_URL_qs[$g_Config['URL']['locale']];
- $g_H_URL->removeQueryString($g_Config['URL']['locale']);
+ $g_GT_urlLocale = $g_H_URL_qs[$g_Config['URL']['locale']];
+ $g_H_URL->removeQueryString($g_Config['URL']['locale']);
}
// Get it by the cookie (what the user used to ask)
if(array_key_exists($cookieCode,$_COOKIE)) {
- $g_GT_cookieLocale = $_COOKIE[$cookieCode];
+ $g_GT_cookieLocale = $_COOKIE[$cookieCode];
}
// Priority order :
@@ -98,53 +98,53 @@
// Define the locale
if(isset($g_GT_urlLocale)) {
- $g_GT_locale = $g_GT_urlLocale;
+ $g_GT_locale = $g_GT_urlLocale;
} elseif (!empty($g_GT_userLocale)) {
- $g_GT_locale = $g_GT_userLocale;
+ $g_GT_locale = $g_GT_userLocale;
} elseif (isset($g_GT_cookieLocale)) {
- $g_GT_locale = $g_GT_cookieLocale;
+ $g_GT_locale = $g_GT_cookieLocale;
} else {
- $g_GT_locale = LOCALE_DEFAULT;
- // Get the language given by the "Accept-Language" HTTP header
- if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
- // Create the list of charsets
- foreach(explode(',',$_SERVER['HTTP_ACCEPT_CHARSET']) as $ccharset) {
- preg_match("#^(.*?)([-_].*?)?(\;q\=(.*))?$#i", $ccharset, $ayM);
- $q = isset($ayM[4]) ? $ayM[4] : '1.0';
- $charset = strtolower(trim($ayM[1]));
- $charsets[$charset] = $q;
- }
- arsort($charsets,SORT_NUMERIC);
+ $g_GT_locale = LOCALE_DEFAULT;
+ // Get the language given by the "Accept-Language" HTTP header
+ if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
+ // Create the list of charsets
+ foreach(explode(',',$_SERVER['HTTP_ACCEPT_CHARSET']) as $ccharset) {
+ preg_match("#^(.*?)([-_].*?)?(\;q\=(.*))?$#i", $ccharset, $ayM);
+ $q = isset($ayM[4]) ? $ayM[4] : '1.0';
+ $charset = strtolower(trim($ayM[1]));
+ $charsets[$charset] = $q;
+ }
+ arsort($charsets,SORT_NUMERIC);
- // Create the list of languages
- $selected_q = 0.0;
- foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $llang) {
- preg_match("#^(.*?)([-_].*?)?(\;q\=(.*))?$#i", $llang, $ayM);
- $q = isset($ayM[4]) ? $ayM[4] : '1.0';
- $lang = strtolower(trim($ayM[1]));
- $languages[$lang] = $q;
- }
- arsort($languages,SORT_NUMERIC);
+ // Create the list of languages
+ $selected_q = 0.0;
+ foreach(explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']) as $llang) {
+ preg_match("#^(.*?)([-_].*?)?(\;q\=(.*))?$#i", $llang, $ayM);
+ $q = isset($ayM[4]) ? $ayM[4] : '1.0';
+ $lang = strtolower(trim($ayM[1]));
+ $languages[$lang] = $q;
+ }
+ arsort($languages,SORT_NUMERIC);
- $charsetsToUpper['utf'] = "UTF-8";
+ $charsetsToUpper['utf'] = "UTF-8";
- // Assume that both arrays are already sorted in descending order (of q) (THEY ARE NOT) TODO
+ // Assume that both arrays are already sorted in descending order (of q) (THEY ARE NOT) TODO
- $i = 0; $found = false;
- foreach($languages as $lang) {
- foreach($charsets as $charset) {
- $charset = array_key_exists($charset[0],$charsetsToUpper) ? $charsetsToUpper[$charset[0]] : $charset[0];
- $localeName = $lang[0].'.'.$charset;
- if(array_search($localeName,$g_GT_supportedLocales) !== false) {
- $g_GT_locale = $localeName;
- $found = true;
- break;
- }
- }
- if($found) break;
- }
- }
-
+ $i = 0; $found = false;
+ foreach($languages as $lang) {
+ foreach($charsets as $charset) {
+ $charset = array_key_exists($charset[0],$charsetsToUpper) ? $charsetsToUpper[$charset[0]] : $charset[0];
+ $localeName = $lang[0].'.'.$charset;
+ if(array_search($localeName,$g_GT_supportedLocales) !== false) {
+ $g_GT_locale = $localeName;
+ $found = true;
+ break;
+ }
+ }
+ if($found) break;
+ }
+ }
+
}
// header += "Accept-Language: " + m_request.languages + ";q=0.1\r\n";
Modified: trunk/init/log.php
===================================================================
--- trunk/init/log.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/init/log.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -44,8 +44,8 @@
//! If the debug/ folder exists, add a singleton for logging
if( is_dir('debug') ) {
- $g_H_FileLogger = &Log::singleton('file', 'debug/'.date('Ymd').'.log', 'G', array('mode' => 0666, 'timeFormat' => '%T', 'lineFormat' => '%{priority} %{message}'),PEAR_LOG_NOTICE);
- $Logger->addChild($g_H_FileLogger);
+ $g_H_FileLogger = &Log::singleton('file', 'debug/'.date('Ymd').'.log', 'G', array('mode' => 0666, 'timeFormat' => '%T', 'lineFormat' => '%{priority} %{message}'),PEAR_LOG_NOTICE);
+ $Logger->addChild($g_H_FileLogger);
}
// Require both errors handlers
@@ -59,14 +59,14 @@
//! Array of error levels names
$errorLevels = array(
- PEAR_LOG_EMERG => "emerg", /* System is unusable */
- PEAR_LOG_ALERT => "alert", /* Immediate action required */
- PEAR_LOG_CRIT => "crit", /* Critical conditions */
- PEAR_LOG_ERR => "err", /* Error conditions */
- PEAR_LOG_WARNING=> "warning", /* Warning conditions */
- PEAR_LOG_NOTICE => "notice", /* Normal but significant */
- PEAR_LOG_INFO => "info", /* Informational */
- PEAR_LOG_DEBUG => "debug", /* Debug-level messages */
+ PEAR_LOG_EMERG => "emerg", /* System is unusable */
+ PEAR_LOG_ALERT => "alert", /* Immediate action required */
+ PEAR_LOG_CRIT => "crit", /* Critical conditions */
+ PEAR_LOG_ERR => "err", /* Error conditions */
+ PEAR_LOG_WARNING=> "warning", /* Warning conditions */
+ PEAR_LOG_NOTICE => "notice", /* Normal but significant */
+ PEAR_LOG_INFO => "info", /* Informational */
+ PEAR_LOG_DEBUG => "debug", /* Debug-level messages */
);
Modified: trunk/plugins/Address/config_core.php
===================================================================
--- trunk/plugins/Address/config_core.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/Address/config_core.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -25,7 +25,7 @@
$conf['fields']['address_id']['type'] = 'INT( 10 )';
$conf['fields']['address_id']['name'] = T_('Identifier');
$conf['fields']['address_id']['restricted'] = 'key';
-$conf['fields']['address_id']['order'] = 1000; // Has to be the highest
+$conf['fields']['address_id']['order'] = 1000; // Has to be the highest
// Optional
Modified: trunk/plugins/Address.php
===================================================================
--- trunk/plugins/Address.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/Address.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -25,344 +25,344 @@
define('G_ADDRESS_ID','address_id');
class Address extends Plugin {
- // List of the modes
- private $modes = array('edit','list','new','del');
- // Actual mode
- private $mode;
- // List of the fields
- private $fields = array();
- // Formatted list of fields
- private $formattedFields;
- // Name of the table
- private $tableName;
- // Name of the link table
- private $linkPeopleTableName;
-
- //! Constructor
- function __construct(&$parentRef,$name)
- {
- $to_return = parent::__construct(&$parentRef,$name);
+ // List of the modes
+ private $modes = array('edit','list','new','del');
+ // Actual mode
+ private $mode;
+ // List of the fields
+ private $fields = array();
+ // Formatted list of fields
+ private $formattedFields;
+ // Name of the table
+ private $tableName;
+ // Name of the link table
+ private $linkPeopleTableName;
+
+ //! Constructor
+ function __construct(&$parentRef,$name)
+ {
+ $to_return = parent::__construct(&$parentRef,$name);
- $this->fields = $this->configH[$this->name]['fields'];
- // Seek the data
- $this->formattedFields = array_keys($this->fields);
- $this->formattedFields = implode($this->formattedFields,'`,`');
+ $this->fields = $this->configH[$this->name]['fields'];
+ // Seek the data
+ $this->formattedFields = array_keys($this->fields);
+ $this->formattedFields = implode($this->formattedFields,'`,`');
- $this->tableName = $this->configH['DB']['prefix'].'address';
- $this->linkPeopleTableName = $this->configH['DB']['prefix'].'people_address';
+ $this->tableName = $this->configH['DB']['prefix'].'address';
+ $this->linkPeopleTableName = $this->configH['DB']['prefix'].'people_address';
- return $to_return;
- }
+ return $to_return;
+ }
- function modesMenu()
- {
- $this->startTrad();
- $targets['Tname'] = T_('Addresses');
- $targets['new']['name'] = T_('New');
- $targets['list']['name'] = T_('List');
- $this->stopTrad();
- return $targets;
- }
+ function modesMenu()
+ {
+ $this->startTrad();
+ $targets['Tname'] = T_('Addresses');
+ $targets['new']['name'] = T_('New');
+ $targets['list']['name'] = T_('List');
+ $this->stopTrad();
+ return $targets;
+ }
- function main()
- { $this->startTrad();
+ function main()
+ { $this->startTrad();
- // Take the mode from the URL or take the default mode
- $this->mode = array_key_exists(G_ADDRESS_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_ADDRESS_URL_MODE] : G_ADDRESS_DEFAULT_MODE;
-
- // If the mode is not know, trigger an error
- if(array_search($this->mode,$this->modes) === false) {
- trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
- return false;
- }
+ // Take the mode from the URL or take the default mode
+ $this->mode = array_key_exists(G_ADDRESS_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_ADDRESS_URL_MODE] : G_ADDRESS_DEFAULT_MODE;
+
+ // If the mode is not know, trigger an error
+ if(array_search($this->mode,$this->modes) === false) {
+ trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
+ return false;
+ }
- $i = 0;
- // Sort the fields in descending Order
- foreach( $this->fields as $fieldName => $field ) {
- $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
- }
- array_multisort($orderArray,SORT_DESC,$this->fields);
+ $i = 0;
+ // Sort the fields in descending Order
+ foreach( $this->fields as $fieldName => $field ) {
+ $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
+ }
+ array_multisort($orderArray,SORT_DESC,$this->fields);
- // Only execute if the user is authentified
- if($this->authH->getAuth()) {
- // From here, we are in know mode
- // Get the Id from a query or edit myself
- $address_id = array_key_exists(G_ADDRESS_ID,$_GET) ? $_GET[G_ADDRESS_ID] : G_ADDRESS_ID_NEW;
+ // Only execute if the user is authentified
+ if($this->authH->getAuth()) {
+ // From here, we are in know mode
+ // Get the Id from a query or edit myself
+ $address_id = array_key_exists(G_ADDRESS_ID,$_GET) ? $_GET[G_ADDRESS_ID] : G_ADDRESS_ID_NEW;
- switch($this->mode) {
- case 'edit': $this->m_edit($address_id,$this->fields); break;
- case 'list': $this->m_list(); break;
- case 'new': $this->m_edit(G_ADDRESS_ID_NEW,$this->fields); break;
- case 'del': $this->m_del($address_id); break;
- }
- }
-
- $this->stopTrad();
- }
+ switch($this->mode) {
+ case 'edit': $this->m_edit($address_id,$this->fields); break;
+ case 'list': $this->m_list(); break;
+ case 'new': $this->m_edit(G_ADDRESS_ID_NEW,$this->fields); break;
+ case 'del': $this->m_del($address_id); break;
+ }
+ }
+
+ $this->stopTrad();
+ }
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "main":
- $this->main();
- break;
- case "People.edit.bottom":
- return $this->People_edit_bottom($funcArgs);
- break;
- }
- }
+ function functionality($funcStr,$funcArgs = '')
+ {
+ switch($funcStr) {
+ case "main":
+ $this->main();
+ break;
+ case "People.edit.bottom":
+ return $this->People_edit_bottom($funcArgs);
+ break;
+ }
+ }
- private function m_list()
- {
- $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC LIMIT 0 , 30", // FIXME: No limit and no Selection of Columns
- $this->formattedFields,
- $this->tableName,
- G_ADDRESS_ID);
+ private function m_list()
+ {
+ $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC LIMIT 0 , 30", // FIXME: No limit and no Selection of Columns
+ $this->formattedFields,
+ $this->tableName,
+ G_ADDRESS_ID);
- $fieldsContents = $this->db->getAssoc($query);
- if(PEAR::isError($fieldsContents))
- return false;
+ $fieldsContents = $this->db->getAssoc($query);
+ if(PEAR::isError($fieldsContents))
+ return false;
- $this->url->addQueryString(G_ADDRESS_URL_MODE,'edit');
- // Select only the useful fields
- $fieldsSpec = $this->fields;
-
- $modes['edit'] = array(
- 'name' => T_('Edit'),
- 'image' => 'pen');
- $modes['del'] =array('name' =>T_('Delete'),'image' => 'cross');
- $this->output->displayList($fieldsSpec,$fieldsContents,array('id'=>'People_list'),$modes);
- }
+ $this->url->addQueryString(G_ADDRESS_URL_MODE,'edit');
+ // Select only the useful fields
+ $fieldsSpec = $this->fields;
+
+ $modes['edit'] = array(
+ 'name' => T_('Edit'),
+ 'image' => 'pen');
+ $modes['del'] =array('name' =>T_('Delete'),'image' => 'cross');
+ $this->output->displayList($fieldsSpec,$fieldsContents,array('id'=>'People_list'),$modes);
+ }
- private function m_edit($id,&$fieldsSpec)
- {
- // Modification asked
- if($_POST[$this->configH['URL']['action']] == 'change') {
+ private function m_edit($id,&$fieldsSpec)
+ {
+ // Modification asked
+ if($_POST[$this->configH['URL']['action']] == 'change') {
- // Get the fields from the keyed array
- $fields = array_keys($fieldsSpec);
+ // Get the fields from the keyed array
+ $fields = array_keys($fieldsSpec);
- // Go along the fields
- foreach($fields as $fieldName_) {
- $fieldName = $this->name.'_'.$fieldName_;
- // Jump the non-modified ones (and if we are creating a new user)
- if( $id != G_ADDRESS_ID_NEW &&
- isset($_POST[$fieldName]) &&
- $_POST[$fieldName] == $_POST[g_appendOld($fieldName)]) {
- continue;
- }
- // Get the type of the field and store its value
- $type = $fieldsSpec[$fieldName_]['type'];
- $fieldValue = $_POST[$fieldName];
+ // Go along the fields
+ foreach($fields as $fieldName_) {
+ $fieldName = $this->name.'_'.$fieldName_;
+ // Jump the non-modified ones (and if we are creating a new user)
+ if( $id != G_ADDRESS_ID_NEW &&
+ isset($_POST[$fieldName]) &&
+ $_POST[$fieldName] == $_POST[g_appendOld($fieldName)]) {
+ continue;
+ }
+ // Get the type of the field and store its value
+ $type = $fieldsSpec[$fieldName_]['type'];
+ $fieldValue = $_POST[$fieldName];
- // Jump id (No insert nor check)
- if($fieldName_ == G_ADDRESS_ID ) {
- continue;
- }
+ // Jump id (No insert nor check)
+ if($fieldName_ == G_ADDRESS_ID ) {
+ continue;
+ }
- $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
- if( $fieldContent === false ) { // The given date is false
- $fieldsSpec[$fieldName_]['error'] = true;
- $newError = true;
- continue;
- }
- $fieldsContents[$fieldName_] = $fieldContent;
- $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
- }
- // Strip the two last characters (border issue)
- $formattedFields = substr($formattedFields,0,-2);
- // If we are updating (thus not making a new entry)
- if($id <> G_ADDRESS_ID_NEW) {
- $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
- $this->tableName,
- $formattedFields,
- G_ADDRESS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR)) return false;
+ $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
+ if( $fieldContent === false ) { // The given date is false
+ $fieldsSpec[$fieldName_]['error'] = true;
+ $newError = true;
+ continue;
+ }
+ $fieldsContents[$fieldName_] = $fieldContent;
+ $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
+ }
+ // Strip the two last characters (border issue)
+ $formattedFields = substr($formattedFields,0,-2);
+ // If we are updating (thus not making a new entry)
+ if($id <> G_ADDRESS_ID_NEW) {
+ $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
+ $this->tableName,
+ $formattedFields,
+ G_ADDRESS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR)) return false;
- } elseif ($newError !== true) { // Creating new entry iff we have not had any error before.
- $query = sprintf("INSERT INTO `%s` SET %s",
- $this->tableName,
- $formattedFields,
- G_ADDRESS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- // Get the just produced ID (per client => thread-safe)
- $query = "SELECT LAST_INSERT_ID()";
- $queryR =& $this->db->query($query);
- $id =& current($queryR->fetchRow());
- // Success => mode = 'edit'
- $this->mode = 'edit';
- }
- $this->url->removeQueryString($this->configH['URL']['action']);
- }
+ } elseif ($newError !== true) { // Creating new entry iff we have not had any error before.
+ $query = sprintf("INSERT INTO `%s` SET %s",
+ $this->tableName,
+ $formattedFields,
+ G_ADDRESS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ // Get the just produced ID (per client => thread-safe)
+ $query = "SELECT LAST_INSERT_ID()";
+ $queryR =& $this->db->query($query);
+ $id =& current($queryR->fetchRow());
+ // Success => mode = 'edit'
+ $this->mode = 'edit';
+ }
+ $this->url->removeQueryString($this->configH['URL']['action']);
+ }
- // Display the edited user
+ // Display the edited user
- // If we are not creating a new address
- if( $id <> G_ADDRESS_ID_NEW ) {
- // Get the formatted fields list
- $formattedFields = array_keys($fieldsSpec);
- $formattedFields = implode($formattedFields,'`,`');
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- $formattedFields,
- $this->tableName,
- G_ADDRESS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $fieldsContents =& $queryR->fetchRow();
- } else { // We are creating a new user
- // Set the ID to the special one
- $fieldsContents[G_ADDRESS_ID] = $id;
- $displayOptions['title'] = T_('New address');
- }
- // Make the URL OK
- $this->url->addQueryString(G_ADDRESS_URL_MODE,$this->mode);
- $this->url->addQueryString(G_ADDRESS_ID,$id);
+ // If we are not creating a new address
+ if( $id <> G_ADDRESS_ID_NEW ) {
+ // Get the formatted fields list
+ $formattedFields = array_keys($fieldsSpec);
+ $formattedFields = implode($formattedFields,'`,`');
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ $formattedFields,
+ $this->tableName,
+ G_ADDRESS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $fieldsContents =& $queryR->fetchRow();
+ } else { // We are creating a new user
+ // Set the ID to the special one
+ $fieldsContents[G_ADDRESS_ID] = $id;
+ $displayOptions['title'] = T_('New address');
+ }
+ // Make the URL OK
+ $this->url->addQueryString(G_ADDRESS_URL_MODE,$this->mode);
+ $this->url->addQueryString(G_ADDRESS_ID,$id);
- $fieldsContents[G_ADDRESS_ID] = $id;
+ $fieldsContents[G_ADDRESS_ID] = $id;
- $displayOptions['id'] = 'Address_view';
- $displayOptions['command'] = T_('Execute');
- $displayOptions['target'] = $this->url->getURL();
- $displayOptions['action'] = 'change';
+ $displayOptions['id'] = 'Address_view';
+ $displayOptions['command'] = T_('Execute');
+ $displayOptions['target'] = $this->url->getURL();
+ $displayOptions['action'] = 'change';
- $fullFieldsSpec[$this->name] = $fieldsSpec;
+ $fullFieldsSpec[$this->name] = $fieldsSpec;
- $fullFieldsContents[$this->name] = $fieldsContents;
+ $fullFieldsContents[$this->name] = $fieldsContents;
- $this->output->displayFields($fullFieldsSpec,$fullFieldsContents,$displayOptions);
- }
+ $this->output->displayFields($fullFieldsSpec,$fullFieldsContents,$displayOptions);
+ }
- private function m_del($id)
- {
- // Delete the given id (seek for confirmation)
-
- // In case of confirmation
- if($_POST[$this->configH['URL']['action']] == 'confirm') {
- $query = sprintf("DELETE FROM `%s` WHERE `%s` = %d LIMIT 1",
- $this->tableName,
- G_ADDRESS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $this->m_list();
- } else {
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- $this->formattedFields,
- $this->tableName,
- G_ADDRESS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $fieldsContents =& $queryR->fetchRow();
+ private function m_del($id)
+ {
+ // Delete the given id (seek for confirmation)
+
+ // In case of confirmation
+ if($_POST[$this->configH['URL']['action']] == 'confirm') {
+ $query = sprintf("DELETE FROM `%s` WHERE `%s` = %d LIMIT 1",
+ $this->tableName,
+ G_ADDRESS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $this->m_list();
+ } else {
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ $this->formattedFields,
+ $this->tableName,
+ G_ADDRESS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $fieldsContents =& $queryR->fetchRow();
- // Display the fields and launch the command to confirm
- $this->output->displayFields($this->fields,$fieldsContents,array('id'=>'Address_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')),$this->name);
- }
- }
+ // Display the fields and launch the command to confirm
+ $this->output->displayFields($this->fields,$fieldsContents,array('id'=>'Address_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')),$this->name);
+ }
+ }
- private function People_edit_bottom($funcArgs)
- { $this->startTrad();
+ private function People_edit_bottom($funcArgs)
+ { $this->startTrad();
- $id_people = $funcArgs[G_DB_PEOPLE_ID];
+ $id_people = $funcArgs[G_DB_PEOPLE_ID];
- // Modification asked
- if($_POST[$this->configH['URL']['action']] == 'change') {
- $addressId = $_POST[$this->name.'_'.G_ADDRESS_ID];
+ // Modification asked
+ if($_POST[$this->configH['URL']['action']] == 'change') {
+ $addressId = $_POST[$this->name.'_'.G_ADDRESS_ID];
- if( $addressId != G_ADDRESS_ID_NEW ) {
- $query = sprintf("UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s' LIMIT 1",
- $this->authH->storage_options['table'],
- G_ADDRESS_ID,
- $addressId,
- G_DB_PEOPLE_ID,
- $id_people);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- }
- }
+ if( $addressId != G_ADDRESS_ID_NEW ) {
+ $query = sprintf("UPDATE `%s` SET `%s` = '%s' WHERE `%s` = '%s' LIMIT 1",
+ $this->authH->storage_options['table'],
+ G_ADDRESS_ID,
+ $addressId,
+ G_DB_PEOPLE_ID,
+ $id_people);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ }
+ }
- if( !isset($addressId) ) {
- // Just give me the damn address_id
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- G_ADDRESS_ID,
- $this->authH->storage_options['table'],
- G_DB_PEOPLE_ID,
- $id_people);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $addressId =& reset($queryR->fetchRow());
- }
+ if( !isset($addressId) ) {
+ // Just give me the damn address_id
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ G_ADDRESS_ID,
+ $this->authH->storage_options['table'],
+ G_DB_PEOPLE_ID,
+ $id_people);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $addressId =& reset($queryR->fetchRow());
+ }
- // Get the fields
- $fields = $this->configH[$this->name]['select']['list'];
-
- // Format them
- $fields = implode($fields,'`,`');
+ // Get the fields
+ $fields = $this->configH[$this->name]['select']['list'];
+
+ // Format them
+ $fields = implode($fields,'`,`');
- // Get the ordering ones and format them
- $fields_OrderBy = $this->configH[$this->name]['select']['orderby'];
- $fields_OrderBy = implode($fields_OrderBy,'`,`');
+ // Get the ordering ones and format them
+ $fields_OrderBy = $this->configH[$this->name]['select']['orderby'];
+ $fields_OrderBy = implode($fields_OrderBy,'`,`');
- $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC",
- $fields, // List of fields
- $this->tableName, // Table 1
- $fields_OrderBy);
- $queryR =& $this->db->query($query);
+ $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC",
+ $fields, // List of fields
+ $this->tableName, // Table 1
+ $fields_OrderBy);
+ $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
+ if(PEAR::isError($queryR))
+ return false;
- // Prepare a "fake" "empty" address
- $addresses[G_ADDRESS_ID_NEW]['name'] = '';
- $addresses[G_ADDRESS_ID_NEW]['values'] = array(G_ADDRESS_ID_NEW => '');
+ // Prepare a "fake" "empty" address
+ $addresses[G_ADDRESS_ID_NEW]['name'] = '';
+ $addresses[G_ADDRESS_ID_NEW]['values'] = array(G_ADDRESS_ID_NEW => '');
- $sourceFields = $this->configH[$this->name]['select']['list'];
- array_walk($sourceFields, 'concat_to_each', array('<','>'));
+ $sourceFields = $this->configH[$this->name]['select']['list'];
+ array_walk($sourceFields, 'concat_to_each', array('<','>'));
- $address_line_0 = $this->configH[$this->name]['select']['format'];
+ $address_line_0 = $this->configH[$this->name]['select']['format'];
- // Prepare the address to be displayed
- while($row =& $queryR->fetchRow()) {
- unset($destFields);
- foreach( $this->configH[$this->name]['select']['list'] as $fieldName) {
- if( stripos($this->fields[$fieldName]['type'],'COUNTRY') !== false ) {
- $destFields[] = reset($this->_parent->functionality('getCountryCode',$row[$fieldName]));
- } else {
- $destFields[] = $row[$fieldName];
- }
- }
- $address_line =
- str_replace($sourceFields, $destFields, $address_line_0);
- $optgroup_id =
- str_replace($sourceFields, $destFields, $this->configH[$this->name]['select']['optgroup']['id'] );
- $addresses[$optgroup_id]['name'] =
- str_replace($sourceFields, $destFields,$this->configH[$this->name]['select']['optgroup']['name'] );
- $addresses[$optgroup_id]['values'][$row[G_ADDRESS_ID]] = $address_line;
- }
+ // Prepare the address to be displayed
+ while($row =& $queryR->fetchRow()) {
+ unset($destFields);
+ foreach( $this->configH[$this->name]['select']['list'] as $fieldName) {
+ if( stripos($this->fields[$fieldName]['type'],'COUNTRY') !== false ) {
+ $destFields[] = reset($this->_parent->functionality('getCountryCode',$row[$fieldName]));
+ } else {
+ $destFields[] = $row[$fieldName];
+ }
+ }
+ $address_line =
+ str_replace($sourceFields, $destFields, $address_line_0);
+ $optgroup_id =
+ str_replace($sourceFields, $destFields, $this->configH[$this->name]['select']['optgroup']['id'] );
+ $addresses[$optgroup_id]['name'] =
+ str_replace($sourceFields, $destFields,$this->configH[$this->name]['select']['optgroup']['name'] );
+ $addresses[$optgroup_id]['values'][$row[G_ADDRESS_ID]] = $address_line;
+ }
- $to_return['spec'][G_ADDRESS_ID]['type'] = 'SELECT';
- $to_return['spec'][G_ADDRESS_ID]['name'] = T_('Address');
- $to_return['spec'][G_ADDRESS_ID]['optgroups'] = true;
- $to_return['spec'][G_ADDRESS_ID]['values'] = $addresses;
- $to_return['spec'][G_ADDRESS_ID]['multiple'] = false;
+ $to_return['spec'][G_ADDRESS_ID]['type'] = 'SELECT';
+ $to_return['spec'][G_ADDRESS_ID]['name'] = T_('Address');
+ $to_return['spec'][G_ADDRESS_ID]['optgroups'] = true;
+ $to_return['spec'][G_ADDRESS_ID]['values'] = $addresses;
+ $to_return['spec'][G_ADDRESS_ID]['multiple'] = false;
- $to_return['content'][G_ADDRESS_ID] = $addressId;
+ $to_return['content'][G_ADDRESS_ID] = $addressId;
- $this->stopTrad();
-// trigger_error(var_export($addresses,true),G_E_DISPLAY);
- return $to_return;
- }
+ $this->stopTrad();
+// trigger_error(var_export($addresses,true),G_E_DISPLAY);
+ return $to_return;
+ }
}
?>
\ No newline at end of file
Modified: trunk/plugins/Childhood.php
===================================================================
--- trunk/plugins/Childhood.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/Childhood.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -25,139 +25,139 @@
define('G_CHILDHOOD_OF_TWO','child_of_2');
class Childhood extends Plugin {
-
- //! Constructor
- function __construct(&$parentRef,$name)
- {
- $to_return = parent::__construct(&$parentRef,$name);
+
+ //! Constructor
+ function __construct(&$parentRef,$name)
+ {
+ $to_return = parent::__construct(&$parentRef,$name);
- return $to_return;
- }
+ return $to_return;
+ }
- function main(){}
+ function main(){}
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "People.edit.bottom":
- return $this->People_edit_bottom($funcArgs);
- break;
- }
- }
+ function functionality($funcStr,$funcArgs = '')
+ {
+ switch($funcStr) {
+ case "People.edit.bottom":
+ return $this->People_edit_bottom($funcArgs);
+ break;
+ }
+ }
- private function People_edit_bottom($funcArgs)
- { $this->startTrad();
+ private function People_edit_bottom($funcArgs)
+ { $this->startTrad();
- $id_people = $funcArgs[G_DB_PEOPLE_ID];
+ $id_people = $funcArgs[G_DB_PEOPLE_ID];
- // Modification asked
- if($_POST[$this->configH['URL']['action']] == 'change') {
- $people_id1 = $_POST[$this->name.'_'.G_CHILDHOOD_OF_ONE];
- $people_id2 = $_POST[$this->name.'_'.G_CHILDHOOD_OF_TWO];
+ // Modification asked
+ if($_POST[$this->configH['URL']['action']] == 'change') {
+ $people_id1 = $_POST[$this->name.'_'.G_CHILDHOOD_OF_ONE];
+ $people_id2 = $_POST[$this->name.'_'.G_CHILDHOOD_OF_TWO];
- // If the second is set and not the first => swap
- if( $people_id2 != G_PEOPLE_ID_NEW && $people_id1 == G_PEOPLE_ID_NEW ) {
- $people_id1 = $people_id2;
- $people_id2 = G_PEOPLE_ID_NEW;
- trigger_error(T_('The first parent should exist to set the second (they have been swapped).'),G_E_DISPLAY);
- }
+ // If the second is set and not the first => swap
+ if( $people_id2 != G_PEOPLE_ID_NEW && $people_id1 == G_PEOPLE_ID_NEW ) {
+ $people_id1 = $people_id2;
+ $people_id2 = G_PEOPLE_ID_NEW;
+ trigger_error(T_('The first parent should exist to set the second (they have been swapped).'),G_E_DISPLAY);
+ }
- // If both parents are the same and not empty
- if( $people_id1 == $people_id2 && $people_id1 != G_PEOPLE_ID_NEW ) {
- $people_id2 = G_PEOPLE_ID_NEW;
- trigger_error(T_('Both parents have to be different.'),G_E_DISPLAY);
- }
- // Actually commit the parents
- $query = sprintf("UPDATE `%s` SET `%s` = '%s', `%s` = '%s' WHERE `%s` = '%s' LIMIT 1",
- $this->authH->storage_options['table'],
- G_CHILDHOOD_OF_ONE,
- $people_id1,
- G_CHILDHOOD_OF_TWO,
- $people_id2,
- G_DB_PEOPLE_ID,
- $id_people);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $childhood = array(G_CHILDHOOD_OF_ONE => $people_id1, G_CHILDHOOD_OF_TWO => $people_id2);
- }
+ // If both parents are the same and not empty
+ if( $people_id1 == $people_id2 && $people_id1 != G_PEOPLE_ID_NEW ) {
+ $people_id2 = G_PEOPLE_ID_NEW;
+ trigger_error(T_('Both parents have to be different.'),G_E_DISPLAY);
+ }
+ // Actually commit the parents
+ $query = sprintf("UPDATE `%s` SET `%s` = '%s', `%s` = '%s' WHERE `%s` = '%s' LIMIT 1",
+ $this->authH->storage_options['table'],
+ G_CHILDHOOD_OF_ONE,
+ $people_id1,
+ G_CHILDHOOD_OF_TWO,
+ $people_id2,
+ G_DB_PEOPLE_ID,
+ $id_people);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $childhood = array(G_CHILDHOOD_OF_ONE => $people_id1, G_CHILDHOOD_OF_TWO => $people_id2);
+ }
- if( !isset($childhood) ) {
- // Just give me the damn parent_id's
- $query = sprintf("SELECT `%s`, `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- G_CHILDHOOD_OF_ONE,G_CHILDHOOD_OF_TWO,
- $this->authH->storage_options['table'],
- G_DB_PEOPLE_ID,
- $id_people);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $childhood =& $queryR->fetchRow();
- }
+ if( !isset($childhood) ) {
+ // Just give me the damn parent_id's
+ $query = sprintf("SELECT `%s`, `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ G_CHILDHOOD_OF_ONE,G_CHILDHOOD_OF_TWO,
+ $this->authH->storage_options['table'],
+ G_DB_PEOPLE_ID,
+ $id_people);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $childhood =& $queryR->fetchRow();
+ }
- // Get the fields
- $fields = $this->configH[$this->name]['select']['list'];
- // Format them
- $fields = implode('`,`',$fields);
+ // Get the fields
+ $fields = $this->configH[$this->name]['select']['list'];
+ // Format them
+ $fields = implode('`,`',$fields);
- // Get the ordering ones and format them
- $fields_OrderBy = $this->configH[$this->name]['select']['orderby'];
- $fields_OrderBy = implode('`,`',$fields_OrderBy);
+ // Get the ordering ones and format them
+ $fields_OrderBy = $this->configH[$this->name]['select']['orderby'];
+ $fields_OrderBy = implode('`,`',$fields_OrderBy);
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` <> '%s' ORDER BY `%s` ASC",
- $fields, // List of fields
- $this->authH->storage_options['table'], // Table "People"
- G_DB_PEOPLE_ID,
- $id_people,
- $fields_OrderBy);
- $queryR =& $this->db->query($query);
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` <> '%s' ORDER BY `%s` ASC",
+ $fields, // List of fields
+ $this->authH->storage_options['table'], // Table "People"
+ G_DB_PEOPLE_ID,
+ $id_people,
+ $fields_OrderBy);
+ $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
+ if(PEAR::isError($queryR))
+ return false;
- // Prepare a "fake" "empty" person
- $persons = array(G_PEOPLE_ID_NEW => '');
+ // Prepare a "fake" "empty" person
+ $persons = array(G_PEOPLE_ID_NEW => '');
- $sourceFields = $this->configH[$this->name]['select']['list'];
- array_walk($sourceFields, 'concat_to_each', array('<','>'));
+ $sourceFields = $this->configH[$this->name]['select']['list'];
+ array_walk($sourceFields, 'concat_to_each', array('<','>'));
- $person_line_0 = $this->configH[$this->name]['select']['format'];
+ $person_line_0 = $this->configH[$this->name]['select']['format'];
- // Prepare the address to be displayed
- while($row =& $queryR->fetchRow()) {
- unset($destFields);
- foreach( $this->configH[$this->name]['select']['list'] as $fieldName) {
- if( stripos($this->fields[$fieldName]['type'],'COUNTRY') !== false ) {
- $destFields[] = reset($this->_parent->functionality('getCountryCode',$row[$fieldName]));
- } else {
- $destFields[] = $row[$fieldName];
- }
- }
- $person_line =
- str_replace($sourceFields, $destFields, $person_line_0);
- $persons[$row[G_DB_PEOPLE_ID]] = $person_line;
- }
+ // Prepare the address to be displayed
+ while($row =& $queryR->fetchRow()) {
+ unset($destFields);
+ foreach( $this->configH[$this->name]['select']['list'] as $fieldName) {
+ if( stripos($this->fields[$fieldName]['type'],'COUNTRY') !== false ) {
+ $destFields[] = reset($this->_parent->functionality('getCountryCode',$row[$fieldName]));
+ } else {
+ $destFields[] = $row[$fieldName];
+ }
+ }
+ $person_line =
+ str_replace($sourceFields, $destFields, $person_line_0);
+ $persons[$row[G_DB_PEOPLE_ID]] = $person_line;
+ }
- // FIXME: Not ideal at all. But works.
+ // FIXME: Not ideal at all. But works.
- $to_return['spec'][G_CHILDHOOD_OF_ONE] = array(
- 'type' => 'SELECT',
- 'name' => T_('First parent'),
- 'values' => $persons );
-
- $to_return['content'][G_CHILDHOOD_OF_ONE] = $childhood[G_CHILDHOOD_OF_ONE];
+ $to_return['spec'][G_CHILDHOOD_OF_ONE] = array(
+ 'type' => 'SELECT',
+ 'name' => T_('First parent'),
+ 'values' => $persons );
+
+ $to_return['content'][G_CHILDHOOD_OF_ONE] = $childhood[G_CHILDHOOD_OF_ONE];
- $to_return['spec'][G_CHILDHOOD_OF_TWO] = array(
- 'type' => 'SELECT',
- 'name' => T_('Second parent'),
- 'values' => $persons );
+ $to_return['spec'][G_CHILDHOOD_OF_TWO] = array(
+ 'type' => 'SELECT',
+ 'name' => T_('Second parent'),
+ 'values' => $persons );
-
- $to_return['content'][G_CHILDHOOD_OF_TWO] = $childhood[G_CHILDHOOD_OF_TWO];
+
+ $to_return['content'][G_CHILDHOOD_OF_TWO] = $childhood[G_CHILDHOOD_OF_TWO];
- $this->stopTrad();
+ $this->stopTrad();
- return $to_return;
- }
+ return $to_return;
+ }
}
?>
Modified: trunk/plugins/Dummy.php
===================================================================
--- trunk/plugins/Dummy.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/Dummy.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -20,30 +20,30 @@
*/
class Dummy extends Plugin {
-
- //! Constructor
- function __construct(&$parentRef,$name)
- {
- $to_return = parent::__construct(&$parentRef,$name);
- return $to_return;
- }
+
+ //! Constructor
+ function __construct(&$parentRef,$name)
+ {
+ $to_return = parent::__construct(&$parentRef,$name);
+ return $to_return;
+ }
- function main(){}
+ function main(){}
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "xxx":
- return $this->xxx($funcArgs);
- break;
- }
- }
+ function functionality($funcStr,$funcArgs = '')
+ {
+ switch($funcStr) {
+ case "xxx":
+ return $this->xxx($funcArgs);
+ break;
+ }
+ }
- private function xxx($funcArgs)
- { $this->startTrad();
+ private function xxx($funcArgs)
+ { $this->startTrad();
- $this->stopTrad();
- return false;
- }
+ $this->stopTrad();
+ return false;
+ }
}
?>
\ No newline at end of file
Modified: trunk/plugins/Groups/config_core.php
===================================================================
--- trunk/plugins/Groups/config_core.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/Groups/config_core.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -25,7 +25,7 @@
$conf['fields'][G_GROUPS_ID]['type'] = 'INT( 10 )';
$conf['fields'][G_GROUPS_ID]['name'] = T_('Identifier');
$conf['fields'][G_GROUPS_ID]['restricted'] = 'key';
-$conf['fields'][G_GROUPS_ID]['order'] = 1000; // Has to be the highest
+$conf['fields'][G_GROUPS_ID]['order'] = 1000; // Has to be the highest
$conf['fields']['type']['type'] = 'SELECT';
$conf['fields']['type']['name'] = T_('Type');
Modified: trunk/plugins/Groups.php
===================================================================
--- trunk/plugins/Groups.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/Groups.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -26,353 +26,353 @@
define('G_PEOPLE_GROUPS_ID','people_group_id');
class Groups extends Plugin {
- // List of the modes
- private $modes = array('edit','list','new','del');
- // Actual mode
- private $mode;
- // List of the fields
- private $fields = array();
- // Formatted list of fields
- private $formattedFields;
- // Name of the table
- private $tableName;
- // Name of the link table
- private $linkPeopleTableName;
-
- //! Constructor
- function __construct(&$parentRef,$name)
- {
- $to_return = parent::__construct(&$parentRef,$name);
+ // List of the modes
+ private $modes = array('edit','list','new','del');
+ // Actual mode
+ private $mode;
+ // List of the fields
+ private $fields = array();
+ // Formatted list of fields
+ private $formattedFields;
+ // Name of the table
+ private $tableName;
+ // Name of the link table
+ private $linkPeopleTableName;
+
+ //! Constructor
+ function __construct(&$parentRef,$name)
+ {
+ $to_return = parent::__construct(&$parentRef,$name);
- $this->fields = $this->configH[$this->name]['fields'];
- // Seek the data
- $this->formattedFields = array_keys($this->fields);
- $this->formattedFields = implode($this->formattedFields,'`,`');
+ $this->fields = $this->configH[$this->name]['fields'];
+ // Seek the data
+ $this->formattedFields = array_keys($this->fields);
+ $this->formattedFields = implode($this->formattedFields,'`,`');
- $this->tableName = $this->configH['DB']['prefix'].'groups';
- $this->linkPeopleTableName = $this->configH['DB']['prefix'].'people_groups';
+ $this->tableName = $this->configH['DB']['prefix'].'groups';
+ $this->linkPeopleTableName = $this->configH['DB']['prefix'].'people_groups';
- return $to_return;
- }
+ return $to_return;
+ }
- function modesMenu()
- {
- $this->startTrad();
- $targets['Tname'] = T_('Groups');
- $targets['new']['name'] = T_('New');
- $targets['list']['name'] = T_('List');
- $this->stopTrad();
- return $targets;
- }
+ function modesMenu()
+ {
+ $this->startTrad();
+ $targets['Tname'] = T_('Groups');
+ $targets['new']['name'] = T_('New');
+ $targets['list']['name'] = T_('List');
+ $this->stopTrad();
+ return $targets;
+ }
- function main()
- { $this->startTrad();
+ function main()
+ { $this->startTrad();
- // Take the mode from the URL or take the default mode
- $this->mode = array_key_exists(G_GROUPS_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_GROUPS_URL_MODE] : G_GROUPS_DEFAULT_MODE;
-
- // If the mode is not know, trigger an error
- if(array_search($this->mode,$this->modes) === false) {
- trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
- return false;
- }
+ // Take the mode from the URL or take the default mode
+ $this->mode = array_key_exists(G_GROUPS_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_GROUPS_URL_MODE] : G_GROUPS_DEFAULT_MODE;
+
+ // If the mode is not know, trigger an error
+ if(array_search($this->mode,$this->modes) === false) {
+ trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
+ return false;
+ }
- $i = 0;
- // Sort the fields in descending Order
- foreach( $this->fields as $fieldName => $field ) {
- $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
- }
- array_multisort($orderArray,SORT_DESC,$this->fields);
+ $i = 0;
+ // Sort the fields in descending Order
+ foreach( $this->fields as $fieldName => $field ) {
+ $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
+ }
+ array_multisort($orderArray,SORT_DESC,$this->fields);
- // Only execute if the user is authentified
- if($this->authH->getAuth()) {
- // From here, we are in know mode
- // Get the Id from a query or edit myself
- $groups_id = array_key_exists(G_GROUPS_ID,$_GET) ? $_GET[G_GROUPS_ID] : G_GROUPS_ID_NEW;
+ // Only execute if the user is authentified
+ if($this->authH->getAuth()) {
+ // From here, we are in know mode
+ // Get the Id from a query or edit myself
+ $groups_id = array_key_exists(G_GROUPS_ID,$_GET) ? $_GET[G_GROUPS_ID] : G_GROUPS_ID_NEW;
- switch($this->mode) {
- case 'edit': $this->m_edit($groups_id,$this->fields); break;
- case 'list': $this->m_list(); break;
- case 'new': $this->m_edit(G_GROUPS_ID_NEW,$this->fields); break;
- case 'del': $this->m_del($groups_id); break;
- }
- }
-
- $this->stopTrad();
- }
+ switch($this->mode) {
+ case 'edit': $this->m_edit($groups_id,$this->fields); break;
+ case 'list': $this->m_list(); break;
+ case 'new': $this->m_edit(G_GROUPS_ID_NEW,$this->fields); break;
+ case 'del': $this->m_del($groups_id); break;
+ }
+ }
+
+ $this->stopTrad();
+ }
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "main":
- $this->main();
- break;
- case "People.edit.bottom":
- return $this->People_edit_bottom($funcArgs);
- break;
- }
- }
+ function functionality($funcStr,$funcArgs = '')
+ {
+ switch($funcStr) {
+ case "main":
+ $this->main();
+ break;
+ case "People.edit.bottom":
+ return $this->People_edit_bottom($funcArgs);
+ break;
+ }
+ }
- private function m_list()
- {
- $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC LIMIT 0 , 30", // FIXME: No limit and no Selection of Columns
- $this->formattedFields,
- $this->tableName,
- G_GROUPS_ID);
+ private function m_list()
+ {
+ $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC LIMIT 0 , 30", // FIXME: No limit and no Selection of Columns
+ $this->formattedFields,
+ $this->tableName,
+ G_GROUPS_ID);
- $fieldsContents = $this->db->getAssoc($query);
- if(PEAR::isError($fieldsContents))
- return false;
+ $fieldsContents = $this->db->getAssoc($query);
+ if(PEAR::isError($fieldsContents))
+ return false;
- $this->url->addQueryString(G_GROUPS_URL_MODE,'edit');
- // Select only the useful fields
- $fieldsSpec = $this->fields;
-
- $modes['edit'] = array(
- 'name' => T_('Edit'),
- 'image' => 'pen');
- $modes['del'] =array('name' =>T_('Delete'),'image' => 'cross');
- $this->output->displayList($fieldsSpec,$fieldsContents,array('id'=>'People_list'),$modes);
- }
+ $this->url->addQueryString(G_GROUPS_URL_MODE,'edit');
+ // Select only the useful fields
+ $fieldsSpec = $this->fields;
+
+ $modes['edit'] = array(
+ 'name' => T_('Edit'),
+ 'image' => 'pen');
+ $modes['del'] =array('name' =>T_('Delete'),'image' => 'cross');
+ $this->output->displayList($fieldsSpec,$fieldsContents,array('id'=>'People_list'),$modes);
+ }
- private function m_edit($id,&$fieldsSpec)
- {
- // Modification asked
- if($_POST[$this->configH['URL']['action']] == 'change') {
+ private function m_edit($id,&$fieldsSpec)
+ {
+ // Modification asked
+ if($_POST[$this->configH['URL']['action']] == 'change') {
- // Get the fields from the keyed array
- $fields = array_keys($fieldsSpec);
+ // Get the fields from the keyed array
+ $fields = array_keys($fieldsSpec);
- // Go along the fields
- foreach($fields as $fieldName_) {
- $fieldName = $this->name.'_'.$fieldName_;
- // Jump the non-modified ones (and if we are creating a new user)
- if( $id != G_GROUPS_ID_NEW &&
- isset($_POST[$fieldName]) &&
- $_POST[$fieldName] == $_POST[g_appendOld($fieldName)]) {
- continue;
- }
- // Get the type of the field and store its value
- $type = $fieldsSpec[$fieldName_]['type'];
- $fieldValue = $_POST[$fieldName];
+ // Go along the fields
+ foreach($fields as $fieldName_) {
+ $fieldName = $this->name.'_'.$fieldName_;
+ // Jump the non-modified ones (and if we are creating a new user)
+ if( $id != G_GROUPS_ID_NEW &&
+ isset($_POST[$fieldName]) &&
+ $_POST[$fieldName] == $_POST[g_appendOld($fieldName)]) {
+ continue;
+ }
+ // Get the type of the field and store its value
+ $type = $fieldsSpec[$fieldName_]['type'];
+ $fieldValue = $_POST[$fieldName];
- // Jump id (No insert nor check)
- if($fieldName_ == G_GROUPS_ID ) {
- continue;
- }
+ // Jump id (No insert nor check)
+ if($fieldName_ == G_GROUPS_ID ) {
+ continue;
+ }
- $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
- if( $fieldContent === false ) { // The given date is false
- $fieldsSpec[$fieldName_]['error'] = true;
- $newError = true;
- continue;
- }
- $fieldsContents[$fieldName_] = $fieldContent;
- $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
- }
- // Strip the two last characters (border issue)
- $formattedFields = substr($formattedFields,0,-2);
- // If we are updating (thus not making a new entry)
- if($id <> G_GROUPS_ID_NEW) {
- $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
- $this->tableName,
- $formattedFields,
- G_GROUPS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR)) return false;
+ $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
+ if( $fieldContent === false ) { // The given date is false
+ $fieldsSpec[$fieldName_]['error'] = true;
+ $newError = true;
+ continue;
+ }
+ $fieldsContents[$fieldName_] = $fieldContent;
+ $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
+ }
+ // Strip the two last characters (border issue)
+ $formattedFields = substr($formattedFields,0,-2);
+ // If we are updating (thus not making a new entry)
+ if($id <> G_GROUPS_ID_NEW) {
+ $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
+ $this->tableName,
+ $formattedFields,
+ G_GROUPS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR)) return false;
- } elseif ($newError !== true) { // Creating new entry iff we have not had any error before.
- $query = sprintf("INSERT INTO `%s` SET %s",
- $this->tableName,
- $formattedFields,
- G_GROUPS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- // Get the just produced ID (per client => thread-safe)
- $query = "SELECT LAST_INSERT_ID()";
- $queryR =& $this->db->query($query);
- $id =& current($queryR->fetchRow());
- // Success => mode = 'edit'
- $this->mode = 'edit';
- }
- $this->url->removeQueryString($this->configH['URL']['action']);
- }
+ } elseif ($newError !== true) { // Creating new entry iff we have not had any error before.
+ $query = sprintf("INSERT INTO `%s` SET %s",
+ $this->tableName,
+ $formattedFields,
+ G_GROUPS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ // Get the just produced ID (per client => thread-safe)
+ $query = "SELECT LAST_INSERT_ID()";
+ $queryR =& $this->db->query($query);
+ $id =& current($queryR->fetchRow());
+ // Success => mode = 'edit'
+ $this->mode = 'edit';
+ }
+ $this->url->removeQueryString($this->configH['URL']['action']);
+ }
- // Display the edited user
+ // Display the edited user
- // If we are not creating a new groups
- if( $id <> G_GROUPS_ID_NEW ) {
- // Get the formatted fields list
- $formattedFields = array_keys($fieldsSpec);
- $formattedFields = implode($formattedFields,'`,`');
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- $formattedFields,
- $this->tableName,
- G_GROUPS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $fieldsContents =& $queryR->fetchRow();
- } else { // We are creating a new user
- // Set the ID to the special one
- $fieldsContents[G_GROUPS_ID] = $id;
- $displayOptions['title'] = T_('New groups');
- }
- // Make the URL OK
- $this->url->addQueryString(G_GROUPS_URL_MODE,$this->mode);
- $this->url->addQueryString(G_GROUPS_ID,$id);
+ // If we are not creating a new groups
+ if( $id <> G_GROUPS_ID_NEW ) {
+ // Get the formatted fields list
+ $formattedFields = array_keys($fieldsSpec);
+ $formattedFields = implode($formattedFields,'`,`');
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ $formattedFields,
+ $this->tableName,
+ G_GROUPS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $fieldsContents =& $queryR->fetchRow();
+ } else { // We are creating a new user
+ // Set the ID to the special one
+ $fieldsContents[G_GROUPS_ID] = $id;
+ $displayOptions['title'] = T_('New groups');
+ }
+ // Make the URL OK
+ $this->url->addQueryString(G_GROUPS_URL_MODE,$this->mode);
+ $this->url->addQueryString(G_GROUPS_ID,$id);
- $fieldsContents[G_GROUPS_ID] = $id;
+ $fieldsContents[G_GROUPS_ID] = $id;
- $displayOptions['id'] = 'Groups_view';
- $displayOptions['command'] = T_('Execute');
- $displayOptions['target'] = $this->url->getURL();
- $displayOptions['action'] = 'change';
+ $displayOptions['id'] = 'Groups_view';
+ $displayOptions['command'] = T_('Execute');
+ $displayOptions['target'] = $this->url->getURL();
+ $displayOptions['action'] = 'change';
- $fullFieldsSpec[$this->name] = $fieldsSpec;
+ $fullFieldsSpec[$this->name] = $fieldsSpec;
- $fullFieldsContents[$this->name] = $fieldsContents;
+ $fullFieldsContents[$this->name] = $fieldsContents;
- $this->output->displayFields($fullFieldsSpec,$fullFieldsContents,$displayOptions);
- }
+ $this->output->displayFields($fullFieldsSpec,$fullFieldsContents,$displayOptions);
+ }
- private function m_del($id)
- {
- // Delete the given id (seek for confirmation)
-
- // In case of confirmation
- if($_POST[$this->configH['URL']['action']] == 'confirm') {
- $query = sprintf("DELETE FROM `%s` WHERE `%s` = %d LIMIT 1",
- $this->tableName,
- G_GROUPS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $this->m_list();
- } else {
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- $this->formattedFields,
- $this->tableName,
- G_GROUPS_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $fieldsContents =& $queryR->fetchRow();
+ private function m_del($id)
+ {
+ // Delete the given id (seek for confirmation)
+
+ // In case of confirmation
+ if($_POST[$this->configH['URL']['action']] == 'confirm') {
+ $query = sprintf("DELETE FROM `%s` WHERE `%s` = %d LIMIT 1",
+ $this->tableName,
+ G_GROUPS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $this->m_list();
+ } else {
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ $this->formattedFields,
+ $this->tableName,
+ G_GROUPS_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $fieldsContents =& $queryR->fetchRow();
- // Display the fields and launch the command to confirm
- $this->output->displayFields($this->fields,$fieldsContents,array('id'=>'Groups_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')),$this->name);
- }
- }
+ // Display the fields and launch the command to confirm
+ $this->output->displayFields($this->fields,$fieldsContents,array('id'=>'Groups_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')),$this->name);
+ }
+ }
- private function People_edit_bottom($funcArgs)
- { $this->startTrad();
+ private function People_edit_bottom($funcArgs)
+ { $this->startTrad();
- $id_people = $funcArgs[G_DB_PEOPLE_ID];
+ $id_people = $funcArgs[G_DB_PEOPLE_ID];
- // Modification asked
- if($_POST[$this->configH['URL']['action']] == 'change') {
- // Get the fields from the keyed array
- $fields = array_keys($this->configH[$this->name]['fields_link']);
- gold('fields = ', $fields);
- // Go along the various Group'IDs
- foreach( $_POST[$this->name.'_'.G_GROUPS_ID] as $pg_id => $group_id ) {
- trigger_error($pg_id.' => '.$group_id,G_E_DISPLAY);
- // If the group_id has not been chosen => we have nothing to write
- if( $group_id == G_GROUPS_ID_NEW ) continue;
- }
- }
+ // Modification asked
+ if($_POST[$this->configH['URL']['action']] == 'change') {
+ // Get the fields from the keyed array
+ $fields = array_keys($this->configH[$this->name]['fields_link']);
+ gold('fields = ', $fields);
+ // Go along the various Group'IDs
+ foreach( $_POST[$this->name.'_'.G_GROUPS_ID] as $pg_id => $group_id ) {
+ trigger_error($pg_id.' => '.$group_id,G_E_DISPLAY);
+ // If the group_id has not been chosen => we have nothing to write
+ if( $group_id == G_GROUPS_ID_NEW ) continue;
+ }
+ }
- // Groups table
- $tableFields = $this->configH[$this->name]['fields'];
- $tableFieldsNames = array_keys($tableFields);
- array_walk($tableFieldsNames,'concat_to_each',array('`'.$this->tableName.'`.`','`'));
+ // Groups table
+ $tableFields = $this->configH[$this->name]['fields'];
+ $tableFieldsNames = array_keys($tableFields);
+ array_walk($tableFieldsNames,'concat_to_each',array('`'.$this->tableName.'`.`','`'));
- // Get the Ordering
- $tableOrderBy = $this->configH[$this->name]['orderby'];
- array_walk($tableOrderBy,'concat_to_each',array('`'.$this->tableName.'`.`','`'));
+ // Get the Ordering
+ $tableOrderBy = $this->configH[$this->name]['orderby'];
+ array_walk($tableOrderBy,'concat_to_each',array('`'.$this->tableName.'`.`','`'));
- // Get listof groups
- $query = sprintf("SELECT %s FROM `%s` WHERE 1 ORDER BY %s ASC; ",
- implode(',',$tableFieldsNames),
- $this->tableName,
- implode(',',$tableOrderBy));
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
+ // Get listof groups
+ $query = sprintf("SELECT %s FROM `%s` WHERE 1 ORDER BY %s ASC; ",
+ implode(',',$tableFieldsNames),
+ $this->tableName,
+ implode(',',$tableOrderBy));
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
- // Create empty fake one
- $groups[G_GROUPS_ID_NEW]['name'] = '';
- $groups[G_GROUPS_ID_NEW]['values'] = array(G_GROUPS_ID_NEW => '');
+ // Create empty fake one
+ $groups[G_GROUPS_ID_NEW]['name'] = '';
+ $groups[G_GROUPS_ID_NEW]['values'] = array(G_GROUPS_ID_NEW => '');
- while (($groups_row = $queryR->fetchRow())) {
- $type = $groups_row['type'];
- $id = $groups_row[G_GROUPS_ID];
- $groups[$type]['name'] = $this->configH[$this->name]['fields']['type']['values'][$id];
- $groups[$type]['values'][$id] = $groups_row['name'];
- }
+ while (($groups_row = $queryR->fetchRow())) {
+ $type = $groups_row['type'];
+ $id = $groups_row[G_GROUPS_ID];
+ $groups[$type]['name'] = $this->configH[$this->name]['fields']['type']['values'][$id];
+ $groups[$type]['values'][$id] = $groups_row['name'];
+ }
- // Groups-to-people table
- $linkTableFields = $this->configH[$this->name]['fields_link'];
- $linkTableFieldsNames = array_keys($linkTableFields);
- array_walk($linkTableFieldsNames,'concat_to_each',array('`'.$this->linkPeopleTableName.'`.`','`'));
- $variablesChain = array_merge($tableFieldsNames,$linkTableFieldsNames);
- $variablesChain = implode(',',$variablesChain);
+ // Groups-to-people table
+ $linkTableFields = $this->configH[$this->name]['fields_link'];
+ $linkTableFieldsNames = array_keys($linkTableFields);
+ array_walk($linkTableFieldsNames,'concat_to_each',array('`'.$this->linkPeopleTableName.'`.`','`'));
+ $variablesChain = array_merge($tableFieldsNames,$linkTableFieldsNames);
+ $variablesChain = implode(',',$variablesChain);
- // Display list of connections + one empty
- // TODO: No LIMIT !
- $query = sprintf("SELECT %s FROM `%s` WHERE `%s` = `%s` AND `%s` = '%s'",
- $variablesChain,
- implode('`,`',array($this->linkPeopleTableName,$this->tableName)),
- implode('`.`',array($this->linkPeopleTableName,G_GROUPS_ID)),
- implode('`.`',array($this->tableName,G_GROUPS_ID)),
- G_DB_PEOPLE_ID,
- $id_people);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
+ // Display list of connections + one empty
+ // TODO: No LIMIT !
+ $query = sprintf("SELECT %s FROM `%s` WHERE `%s` = `%s` AND `%s` = '%s'",
+ $variablesChain,
+ implode('`,`',array($this->linkPeopleTableName,$this->tableName)),
+ implode('`.`',array($this->linkPeopleTableName,G_GROUPS_ID)),
+ implode('`.`',array($this->tableName,G_GROUPS_ID)),
+ G_DB_PEOPLE_ID,
+ $id_people);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
- while (($pg_row = $queryR->fetchRow())) {
- $key = $pg_row[G_PEOPLE_GROUPS_ID];
- $to_return['content'][G_GROUPS_ID.'['.$key.']'] = $pg_row[G_GROUPS_ID];
- $to_return['spec'][G_GROUPS_ID.'['.$key.']'] = array(
- 'type' => 'SELECT',
- 'name' => T_('Group'),
- 'optgroups' => true,
- 'values' => $groups,
- 'multiple' => false
- );
- foreach($linkTableFields as $fieldName => $fieldSpecs) {
- if( array_key_exists('restricted',$fieldSpecs) ) continue;
+ while (($pg_row = $queryR->fetchRow())) {
+ $key = $pg_row[G_PEOPLE_GROUPS_ID];
+ $to_return['content'][G_GROUPS_ID.'['.$key.']'] = $pg_row[G_GROUPS_ID];
+ $to_return['spec'][G_GROUPS_ID.'['.$key.']'] = array(
+ 'type' => 'SELECT',
+ 'name' => T_('Group'),
+ 'optgroups' => true,
+ 'values' => $groups,
+ 'multiple' => false
+ );
+ foreach($linkTableFields as $fieldName => $fieldSpecs) {
+ if( array_key_exists('restricted',$fieldSpecs) ) continue;
- $to_return['spec'][$fieldName.'['.$key.']'] = $fieldSpecs;
- $to_return['content'][$fieldName.'['.$key.']'] = $pg_row[$fieldName];
- }
- }
- // Add a fake entry
- $key = G_GROUPS_ID_NEW;
- $to_return['spec'][G_GROUPS_ID.'['.$key.']'] = array(
- 'type' => 'SELECT',
- 'name' => T_('Group'),
- 'optgroups' => true,
- 'values' => $groups,
- 'multiple' => false
- );
- // Inputs display possible with name=id='field_name[identifiant]'
- foreach($linkTableFields as $fieldName => $fieldSpecs) {
- if( array_key_exists('restricted',$fieldSpecs) ) continue;
- $to_return['spec'][$fieldName.'['.$key.']'] = $fieldSpecs;
- $to_return['content'][$fieldName.'['.$key.']'] = $pg_row[$fieldName];
- }
+ $to_return['spec'][$fieldName.'['.$key.']'] = $fieldSpecs;
+ $to_return['content'][$fieldName.'['.$key.']'] = $pg_row[$fieldName];
+ }
+ }
+ // Add a fake entry
+ $key = G_GROUPS_ID_NEW;
+ $to_return['spec'][G_GROUPS_ID.'['.$key.']'] = array(
+ 'type' => 'SELECT',
+ 'name' => T_('Group'),
+ 'optgroups' => true,
+ 'values' => $groups,
+ 'multiple' => false
+ );
+ // Inputs display possible with name=id='field_name[identifiant]'
+ foreach($linkTableFields as $fieldName => $fieldSpecs) {
+ if( array_key_exists('restricted',$fieldSpecs) ) continue;
+ $to_return['spec'][$fieldName.'['.$key.']'] = $fieldSpecs;
+ $to_return['content'][$fieldName.'['.$key.']'] = $pg_row[$fieldName];
+ }
- $this->stopTrad();
- return $to_return;
- }
+ $this->stopTrad();
+ return $to_return;
+ }
}
?>
Modified: trunk/plugins/ISO3166_CountryCode.php
===================================================================
--- trunk/plugins/ISO3166_CountryCode.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/ISO3166_CountryCode.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -21,277 +21,277 @@
class ISO3166_CountryCode extends Plugin {
- // Liste des CountryCodes
- private $CountryCodes;
+ // Liste des CountryCodes
+ private $CountryCodes;
- function __construct(&$parentRef,$name)
- {
- $to_return = parent::__construct(&$parentRef,$name);
+ function __construct(&$parentRef,$name)
+ {
+ $to_return = parent::__construct(&$parentRef,$name);
- $this->startTrad();
- // Initialize the CountryCodes Array
- $this->CountryCodes = array(
- ' ' => '',
- 'AF' => T_("Afghanistan"),
- 'AL' => T_("Albania"),
- 'DZ' => T_("Algeria"),
- 'AS' => T_("American Samoa"),
- 'AD' => T_("Andorra"),
- 'AO' => T_("Angola"),
- 'AI' => T_("Anguilla"),
- 'AQ' => T_("Antarctica"),
- 'AG' => T_("Antigua and Barbuda"),
- 'AR' => T_("Argentina"),
- 'AM' => T_("Armenia"),
- 'AW' => T_("Aruba"),
- 'AU' => T_("Australia"),
- 'AT' => T_("Austria"),
- 'AZ' => T_("Azerbaijan"),
- 'BS' => T_("Bahamas"),
- 'BH' => T_("Bahrain"),
- 'BD' => T_("Bangladesh"),
- 'BB' => T_("Barbados"),
- 'BY' => T_("Belarus"),
- 'BE' => T_("Belgium"),
- 'BZ' => T_("Belize"),
- 'BJ' => T_("Benin"),
- 'BM' => T_("Bermuda"),
- 'BT' => T_("Bhutan"),
- 'BO' => T_("Bolivia"),
- 'BA' => T_("Bosnia and Herzegovina"),
- 'BW' => T_("Botswana"),
- 'BV' => T_("Bouvet Island"),
- 'BR' => T_("Brazil"),
- 'IO' => T_("British Indian Ocean Territory"),
- 'BN' => T_("Brunei Darussalam"),
- 'BG' => T_("Bulgaria"),
- 'BF' => T_("Burkina Faso"),
- 'BI' => T_("Burundi"),
- 'KH' => T_("Cambodia"),
- 'CM' => T_("Cameroon"),
- 'CA' => T_("Canada"),
- 'CV' => T_("Cape Verde"),
- 'KY' => T_("Cayman Islands"),
- 'CF' => T_("Central African Republic"),
- 'TD' => T_("Chad"),
- 'CL' => T_("Chile"),
- 'CN' => T_("China"),
- 'CX' => T_("Christmas Island"),
- 'CC' => T_("Cocos (Keeling) Islands"),
- 'CO' => T_("Colombia"),
- 'KM' => T_("Comoros"),
- 'CG' => T_("Congo"),
- 'CD' => T_("Congo, the Democratic Republic of the"),
- 'CK' => T_("Cook Islands"),
- 'CR' => T_("Costa Rica"),
- 'CI' => T_("Cote D'Ivoire"),
- 'HR' => T_("Croatia"),
- 'CU' => T_("Cuba"),
- 'CY' => T_("Cyprus"),
- 'CZ' => T_("Czech Republic"),
- 'DK' => T_("Denmark"),
- 'DJ' => T_("Djibouti"),
- 'DM' => T_("Dominica"),
- 'DO' => T_("Dominican Republic"),
- 'EC' => T_("Ecuador"),
- 'EG' => T_("Egypt"),
- 'SV' => T_("El Salvador"),
- 'GQ' => T_("Equatorial Guinea"),
- 'ER' => T_("Eritrea"),
- 'EE' => T_("Estonia"),
- 'ET' => T_("Ethiopia"),
- 'FK' => T_("Falkland Islands (Malvinas)"),
- 'FO' => T_("Faroe Islands"),
- 'FJ' => T_("Fiji"),
- 'FI' => T_("Finland"),
- 'FR' => T_("France"),
- 'GF' => T_("French Guiana"),
- 'PF' => T_("French Polynesia"),
- 'TF' => T_("French Southern Territories"),
- 'GA' => T_("Gabon"),
- 'GM' => T_("Gambia"),
- 'GE' => T_("Georgia"),
- 'DE' => T_("Germany"),
- 'GH' => T_("Ghana"),
- 'GI' => T_("Gibraltar"),
- 'GR' => T_("Greece"),
- 'GL' => T_("Greenland"),
- 'GD' => T_("Grenada"),
- 'GP' => T_("Guadeloupe"),
- 'GU' => T_("Guam"),
- 'GT' => T_("Guatemala"),
- 'GN' => T_("Guinea"),
- 'GW' => T_("Guinea-Bissau"),
- 'GY' => T_("Guyana"),
- 'HT' => T_("Haiti"),
- 'HM' => T_("Heard Island and Mcdonald Islands"),
- 'VA' => T_("Holy See (Vatican City State)"),
- 'HN' => T_("Honduras"),
- 'HK' => T_("Hong Kong"),
- 'HU' => T_("Hungary"),
- 'IS' => T_("Iceland"),
- 'IN' => T_("India"),
- 'ID' => T_("Indonesia"),
- 'IR' => T_("Iran, Islamic Republic of"),
- 'IQ' => T_("Iraq"),
- 'IE' => T_("Ireland"),
- 'IL' => T_("Israel"),
- 'IT' => T_("Italy"),
- 'JM' => T_("Jamaica"),
- 'JP' => T_("Japan"),
- 'JO' => T_("Jordan"),
- 'KZ' => T_("Kazakhstan"),
- 'KE' => T_("Kenya"),
- 'KI' => T_("Kiribati"),
- 'KP' => T_("Korea, Democratic People's Republic of"),
- 'KR' => T_("Korea, Republic of"),
- 'KW' => T_("Kuwait"),
- 'KG' => T_("Kyrgyzstan"),
- 'LA' => T_("Lao People's Democratic Republic"),
- 'LV' => T_("Latvia"),
- 'LB' => T_("Lebanon"),
- 'LS' => T_("Lesotho"),
- 'LR' => T_("Liberia"),
- 'LY' => T_("Libyan Arab Jamahiriya"),
- 'LI' => T_("Liechtenstein"),
- 'LT' => T_("Lithuania"),
- 'LU' => T_("Luxembourg"),
- 'MO' => T_("Macao"),
- 'MK' => T_("Macedonia, the Former Yugoslav Republic of"),
- 'MG' => T_("Madagascar"),
- 'MW' => T_("Malawi"),
- 'MY' => T_("Malaysia"),
- 'MV' => T_("Maldives"),
- 'ML' => T_("Mali"),
- 'MT' => T_("Malta"),
- 'MH' => T_("Marshall Islands"),
- 'MQ' => T_("Martinique"),
- 'MR' => T_("Mauritania"),
- 'MU' => T_("Mauritius"),
- 'YT' => T_("Mayotte"),
- 'MX' => T_("Mexico"),
- 'FM' => T_("Micronesia, Federated States of"),
- 'MD' => T_("Moldova, Republic of"),
- 'MC' => T_("Monaco"),
- 'MN' => T_("Mongolia"),
- 'MS' => T_("Montserrat"),
- 'MA' => T_("Morocco"),
- 'MZ' => T_("Mozambique"),
- 'MM' => T_("Myanmar"),
- 'NA' => T_("Namibia"),
- 'NR' => T_("Nauru"),
- 'NP' => T_("Nepal"),
- 'NL' => T_("Netherlands"),
- 'AN' => T_("Netherlands Antilles"),
- 'NC' => T_("New Caledonia"),
- 'NZ' => T_("New Zealand"),
- 'NI' => T_("Nicaragua"),
- 'NE' => T_("Niger"),
- 'NG' => T_("Nigeria"),
- 'NU' => T_("Niue"),
- 'NF' => T_("Norfolk Island"),
- 'MP' => T_("Northern Mariana Islands"),
- 'NO' => T_("Norway"),
- 'OM' => T_("Oman"),
- 'PK' => T_("Pakistan"),
- 'PW' => T_("Palau"),
- 'PS' => T_("Palestinian Territory, Occupied"),
- 'PA' => T_("Panama"),
- 'PG' => T_("Papua New Guinea"),
- 'PY' => T_("Paraguay"),
- 'PE' => T_("Peru"),
- 'PH' => T_("Philippines"),
- 'PN' => T_("Pitcairn"),
- 'PL' => T_("Poland"),
- 'PT' => T_("Portugal"),
- 'PR' => T_("Puerto Rico"),
- 'QA' => T_("Qatar"),
- 'RE' => T_("Reunion"),
- 'RO' => T_("Romania"),
- 'RU' => T_("Russian Federation"),
- 'RW' => T_("Rwanda"),
- 'SH' => T_("Saint Helena"),
- 'KN' => T_("Saint Kitts and Nevis"),
- 'LC' => T_("Saint Lucia"),
- 'PM' => T_("Saint Pierre and Miquelon"),
- 'VC' => T_("Saint Vincent and the Grenadines"),
- 'WS' => T_("Samoa"),
- 'SM' => T_("San Marino"),
- 'ST' => T_("Sao Tome and Principe"),
- 'SA' => T_("Saudi Arabia"),
- 'SN' => T_("Senegal"),
- 'CS' => T_("Serbia and Montenegro"),
- 'SC' => T_("Seychelles"),
- 'SL' => T_("Sierra Leone"),
- 'SG' => T_("Singapore"),
- 'SK' => T_("Slovakia"),
- 'SI' => T_("Slovenia"),
- 'SB' => T_("Solomon Islands"),
- 'SO' => T_("Somalia"),
- 'ZA' => T_("South Africa"),
- 'GS' => T_("South Georgia and the South Sandwich Islands"),
- 'ES' => T_("Spain"),
- 'LK' => T_("Sri Lanka"),
- 'SD' => T_("Sudan"),
- 'SR' => T_("Suriname"),
- 'SJ' => T_("Svalbard and Jan Mayen"),
- 'SZ' => T_("Swaziland"),
- 'SE' => T_("Sweden"),
- 'CH' => T_("Switzerland"),
- 'SY' => T_("Syrian Arab Republic"),
- 'TW' => T_("Taiwan, Province of China"),
- 'TJ' => T_("Tajikistan"),
- 'TZ' => T_("Tanzania, United Republic of"),
- 'TH' => T_("Thailand"),
- 'TL' => T_("Timor-Leste"),
- 'TG' => T_("Togo"),
- 'TK' => T_("Tokelau"),
- 'TO' => T_("Tonga"),
- 'TT' => T_("Trinidad and Tobago"),
- 'TN' => T_("Tunisia"),
- 'TR' => T_("Turkey"),
- 'TM' => T_("Turkmenistan"),
- 'TC' => T_("Turks and Caicos Islands"),
- 'TV' => T_("Tuvalu"),
- 'UG' => T_("Uganda"),
- 'UA' => T_("Ukraine"),
- 'AE' => T_("United Arab Emirates"),
- 'GB' => T_("United Kingdom"),
- 'US' => T_("United States"),
- 'UM' => T_("United States Minor Outlying Islands"),
- 'UY' => T_("Uruguay"),
- 'UZ' => T_("Uzbekistan"),
- 'VU' => T_("Vanuatu"),
- 'VE' => T_("Venezuela"),
- 'VN' => T_("Viet Nam"),
- 'VG' => T_("Virgin Islands, British"),
- 'VI' => T_("Virgin Islands, U.s."),
- 'WF' => T_("Wallis and Futuna"),
- 'EH' => T_("Western Sahara"),
- 'YE' => T_("Yemen"),
- 'ZM' => T_("Zambia"),
- 'ZW' => T_("Zimbabwe")
- );
+ $this->startTrad();
+ // Initialize the CountryCodes Array
+ $this->CountryCodes = array(
+ ' ' => '',
+ 'AF' => T_("Afghanistan"),
+ 'AL' => T_("Albania"),
+ 'DZ' => T_("Algeria"),
+ 'AS' => T_("American Samoa"),
+ 'AD' => T_("Andorra"),
+ 'AO' => T_("Angola"),
+ 'AI' => T_("Anguilla"),
+ 'AQ' => T_("Antarctica"),
+ 'AG' => T_("Antigua and Barbuda"),
+ 'AR' => T_("Argentina"),
+ 'AM' => T_("Armenia"),
+ 'AW' => T_("Aruba"),
+ 'AU' => T_("Australia"),
+ 'AT' => T_("Austria"),
+ 'AZ' => T_("Azerbaijan"),
+ 'BS' => T_("Bahamas"),
+ 'BH' => T_("Bahrain"),
+ 'BD' => T_("Bangladesh"),
+ 'BB' => T_("Barbados"),
+ 'BY' => T_("Belarus"),
+ 'BE' => T_("Belgium"),
+ 'BZ' => T_("Belize"),
+ 'BJ' => T_("Benin"),
+ 'BM' => T_("Bermuda"),
+ 'BT' => T_("Bhutan"),
+ 'BO' => T_("Bolivia"),
+ 'BA' => T_("Bosnia and Herzegovina"),
+ 'BW' => T_("Botswana"),
+ 'BV' => T_("Bouvet Island"),
+ 'BR' => T_("Brazil"),
+ 'IO' => T_("British Indian Ocean Territory"),
+ 'BN' => T_("Brunei Darussalam"),
+ 'BG' => T_("Bulgaria"),
+ 'BF' => T_("Burkina Faso"),
+ 'BI' => T_("Burundi"),
+ 'KH' => T_("Cambodia"),
+ 'CM' => T_("Cameroon"),
+ 'CA' => T_("Canada"),
+ 'CV' => T_("Cape Verde"),
+ 'KY' => T_("Cayman Islands"),
+ 'CF' => T_("Central African Republic"),
+ 'TD' => T_("Chad"),
+ 'CL' => T_("Chile"),
+ 'CN' => T_("China"),
+ 'CX' => T_("Christmas Island"),
+ 'CC' => T_("Cocos (Keeling) Islands"),
+ 'CO' => T_("Colombia"),
+ 'KM' => T_("Comoros"),
+ 'CG' => T_("Congo"),
+ 'CD' => T_("Congo, the Democratic Republic of the"),
+ 'CK' => T_("Cook Islands"),
+ 'CR' => T_("Costa Rica"),
+ 'CI' => T_("Cote D'Ivoire"),
+ 'HR' => T_("Croatia"),
+ 'CU' => T_("Cuba"),
+ 'CY' => T_("Cyprus"),
+ 'CZ' => T_("Czech Republic"),
+ 'DK' => T_("Denmark"),
+ 'DJ' => T_("Djibouti"),
+ 'DM' => T_("Dominica"),
+ 'DO' => T_("Dominican Republic"),
+ 'EC' => T_("Ecuador"),
+ 'EG' => T_("Egypt"),
+ 'SV' => T_("El Salvador"),
+ 'GQ' => T_("Equatorial Guinea"),
+ 'ER' => T_("Eritrea"),
+ 'EE' => T_("Estonia"),
+ 'ET' => T_("Ethiopia"),
+ 'FK' => T_("Falkland Islands (Malvinas)"),
+ 'FO' => T_("Faroe Islands"),
+ 'FJ' => T_("Fiji"),
+ 'FI' => T_("Finland"),
+ 'FR' => T_("France"),
+ 'GF' => T_("French Guiana"),
+ 'PF' => T_("French Polynesia"),
+ 'TF' => T_("French Southern Territories"),
+ 'GA' => T_("Gabon"),
+ 'GM' => T_("Gambia"),
+ 'GE' => T_("Georgia"),
+ 'DE' => T_("Germany"),
+ 'GH' => T_("Ghana"),
+ 'GI' => T_("Gibraltar"),
+ 'GR' => T_("Greece"),
+ 'GL' => T_("Greenland"),
+ 'GD' => T_("Grenada"),
+ 'GP' => T_("Guadeloupe"),
+ 'GU' => T_("Guam"),
+ 'GT' => T_("Guatemala"),
+ 'GN' => T_("Guinea"),
+ 'GW' => T_("Guinea-Bissau"),
+ 'GY' => T_("Guyana"),
+ 'HT' => T_("Haiti"),
+ 'HM' => T_("Heard Island and Mcdonald Islands"),
+ 'VA' => T_("Holy See (Vatican City State)"),
+ 'HN' => T_("Honduras"),
+ 'HK' => T_("Hong Kong"),
+ 'HU' => T_("Hungary"),
+ 'IS' => T_("Iceland"),
+ 'IN' => T_("India"),
+ 'ID' => T_("Indonesia"),
+ 'IR' => T_("Iran, Islamic Republic of"),
+ 'IQ' => T_("Iraq"),
+ 'IE' => T_("Ireland"),
+ 'IL' => T_("Israel"),
+ 'IT' => T_("Italy"),
+ 'JM' => T_("Jamaica"),
+ 'JP' => T_("Japan"),
+ 'JO' => T_("Jordan"),
+ 'KZ' => T_("Kazakhstan"),
+ 'KE' => T_("Kenya"),
+ 'KI' => T_("Kiribati"),
+ 'KP' => T_("Korea, Democratic People's Republic of"),
+ 'KR' => T_("Korea, Republic of"),
+ 'KW' => T_("Kuwait"),
+ 'KG' => T_("Kyrgyzstan"),
+ 'LA' => T_("Lao People's Democratic Republic"),
+ 'LV' => T_("Latvia"),
+ 'LB' => T_("Lebanon"),
+ 'LS' => T_("Lesotho"),
+ 'LR' => T_("Liberia"),
+ 'LY' => T_("Libyan Arab Jamahiriya"),
+ 'LI' => T_("Liechtenstein"),
+ 'LT' => T_("Lithuania"),
+ 'LU' => T_("Luxembourg"),
+ 'MO' => T_("Macao"),
+ 'MK' => T_("Macedonia, the Former Yugoslav Republic of"),
+ 'MG' => T_("Madagascar"),
+ 'MW' => T_("Malawi"),
+ 'MY' => T_("Malaysia"),
+ 'MV' => T_("Maldives"),
+ 'ML' => T_("Mali"),
+ 'MT' => T_("Malta"),
+ 'MH' => T_("Marshall Islands"),
+ 'MQ' => T_("Martinique"),
+ 'MR' => T_("Mauritania"),
+ 'MU' => T_("Mauritius"),
+ 'YT' => T_("Mayotte"),
+ 'MX' => T_("Mexico"),
+ 'FM' => T_("Micronesia, Federated States of"),
+ 'MD' => T_("Moldova, Republic of"),
+ 'MC' => T_("Monaco"),
+ 'MN' => T_("Mongolia"),
+ 'MS' => T_("Montserrat"),
+ 'MA' => T_("Morocco"),
+ 'MZ' => T_("Mozambique"),
+ 'MM' => T_("Myanmar"),
+ 'NA' => T_("Namibia"),
+ 'NR' => T_("Nauru"),
+ 'NP' => T_("Nepal"),
+ 'NL' => T_("Netherlands"),
+ 'AN' => T_("Netherlands Antilles"),
+ 'NC' => T_("New Caledonia"),
+ 'NZ' => T_("New Zealand"),
+ 'NI' => T_("Nicaragua"),
+ 'NE' => T_("Niger"),
+ 'NG' => T_("Nigeria"),
+ 'NU' => T_("Niue"),
+ 'NF' => T_("Norfolk Island"),
+ 'MP' => T_("Northern Mariana Islands"),
+ 'NO' => T_("Norway"),
+ 'OM' => T_("Oman"),
+ 'PK' => T_("Pakistan"),
+ 'PW' => T_("Palau"),
+ 'PS' => T_("Palestinian Territory, Occupied"),
+ 'PA' => T_("Panama"),
+ 'PG' => T_("Papua New Guinea"),
+ 'PY' => T_("Paraguay"),
+ 'PE' => T_("Peru"),
+ 'PH' => T_("Philippines"),
+ 'PN' => T_("Pitcairn"),
+ 'PL' => T_("Poland"),
+ 'PT' => T_("Portugal"),
+ 'PR' => T_("Puerto Rico"),
+ 'QA' => T_("Qatar"),
+ 'RE' => T_("Reunion"),
+ 'RO' => T_("Romania"),
+ 'RU' => T_("Russian Federation"),
+ 'RW' => T_("Rwanda"),
+ 'SH' => T_("Saint Helena"),
+ 'KN' => T_("Saint Kitts and Nevis"),
+ 'LC' => T_("Saint Lucia"),
+ 'PM' => T_("Saint Pierre and Miquelon"),
+ 'VC' => T_("Saint Vincent and the Grenadines"),
+ 'WS' => T_("Samoa"),
+ 'SM' => T_("San Marino"),
+ 'ST' => T_("Sao Tome and Principe"),
+ 'SA' => T_("Saudi Arabia"),
+ 'SN' => T_("Senegal"),
+ 'CS' => T_("Serbia and Montenegro"),
+ 'SC' => T_("Seychelles"),
+ 'SL' => T_("Sierra Leone"),
+ 'SG' => T_("Singapore"),
+ 'SK' => T_("Slovakia"),
+ 'SI' => T_("Slovenia"),
+ 'SB' => T_("Solomon Islands"),
+ 'SO' => T_("Somalia"),
+ 'ZA' => T_("South Africa"),
+ 'GS' => T_("South Georgia and the South Sandwich Islands"),
+ 'ES' => T_("Spain"),
+ 'LK' => T_("Sri Lanka"),
+ 'SD' => T_("Sudan"),
+ 'SR' => T_("Suriname"),
+ 'SJ' => T_("Svalbard and Jan Mayen"),
+ 'SZ' => T_("Swaziland"),
+ 'SE' => T_("Sweden"),
+ 'CH' => T_("Switzerland"),
+ 'SY' => T_("Syrian Arab Republic"),
+ 'TW' => T_("Taiwan, Province of China"),
+ 'TJ' => T_("Tajikistan"),
+ 'TZ' => T_("Tanzania, United Republic of"),
+ 'TH' => T_("Thailand"),
+ 'TL' => T_("Timor-Leste"),
+ 'TG' => T_("Togo"),
+ 'TK' => T_("Tokelau"),
+ 'TO' => T_("Tonga"),
+ 'TT' => T_("Trinidad and Tobago"),
+ 'TN' => T_("Tunisia"),
+ 'TR' => T_("Turkey"),
+ 'TM' => T_("Turkmenistan"),
+ 'TC' => T_("Turks and Caicos Islands"),
+ 'TV' => T_("Tuvalu"),
+ 'UG' => T_("Uganda"),
+ 'UA' => T_("Ukraine"),
+ 'AE' => T_("United Arab Emirates"),
+ 'GB' => T_("United Kingdom"),
+ 'US' => T_("United States"),
+ 'UM' => T_("United States Minor Outlying Islands"),
+ 'UY' => T_("Uruguay"),
+ 'UZ' => T_("Uzbekistan"),
+ 'VU' => T_("Vanuatu"),
+ 'VE' => T_("Venezuela"),
+ 'VN' => T_("Viet Nam"),
+ 'VG' => T_("Virgin Islands, British"),
+ 'VI' => T_("Virgin Islands, U.s."),
+ 'WF' => T_("Wallis and Futuna"),
+ 'EH' => T_("Western Sahara"),
+ 'YE' => T_("Yemen"),
+ 'ZM' => T_("Zambia"),
+ 'ZW' => T_("Zimbabwe")
+ );
- $this->stopTrad();
+ $this->stopTrad();
- asort($this->CountryCodes,SORT_STRING);
+ asort($this->CountryCodes,SORT_STRING);
- return $to_return;
- }
+ return $to_return;
+ }
- function main(){return false;}
+ function main(){return false;}
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "getCountryCode":
- return array_key_exists($funcArgs,$this->CountryCodes) ? $this->CountryCodes[$funcArgs] : false;
- break;
- case "BigFatAndDirty_ListOfAllCountryCodes":
- return $this->CountryCodes;
- break;
- }
- }
+ function functionality($funcStr,$funcArgs = '')
+ {
+ switch($funcStr) {
+ case "getCountryCode":
+ return array_key_exists($funcArgs,$this->CountryCodes) ? $this->CountryCodes[$funcArgs] : false;
+ break;
+ case "BigFatAndDirty_ListOfAllCountryCodes":
+ return $this->CountryCodes;
+ break;
+ }
+ }
}
\ No newline at end of file
Modified: trunk/plugins/People.php
===================================================================
--- trunk/plugins/People.php 2009-05-01 12:15:20 UTC (rev 38)
+++ trunk/plugins/People.php 2009-05-01 12:15:28 UTC (rev 39)
@@ -24,330 +24,330 @@
define('G_PEOPLE_ID_NEW','-1');
class People extends Plugin {
- // List of the modes
- private $modes = array('edit','edit_base','list','new','del');
- // Actual mode
- private $mode;
- // List of the fields
- private $fields = array();
- // List of the fields
- private $fieldsCore = array();
- // List of the fields
- private $fieldsAll = array();
+ // List of the modes
+ private $modes = array('edit','edit_base','list','new','del');
+ // Actual mode
+ private $mode;
+ // List of the fields
+ private $fields = array();
+ // List of the fields
+ private $fieldsCore = array();
+ // List of the fields
+ private $fieldsAll = array();
- function modesMenu()
- {
- $this->startTrad();
- $targets['Tname'] = T_('People');
- $targets['edit']['name'] = T_('My Data');
- $targets['edit_base']['name'] = T_('Connection settings');
- $targets['new']['name'] = T_('New');
- $targets['list']['name'] = T_('List');
- $this->stopTrad();
- return $targets;
- }
+ function modesMenu()
+ {
+ $this->startTrad();
+ $targets['Tname'] = T_('People');
+ $targets['edit']['name'] = T_('My Data');
+ $targets['edit_base']['name'] = T_('Connection settings');
+ $targets['new']['name'] = T_('New');
+ $targets['list']['name'] = T_('List');
+ $this->stopTrad();
+ return $targets;
+ }
- function main()
- { $this->startTrad();
+ function main()
+ { $this->startTrad();
- // Take the mode from the URL or take the default mode
- $this->mode = array_key_exists(G_PEOPLE_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_PEOPLE_URL_MODE] : G_PEOPLE_DEFAULT_MODE;
-
- // If the mode is not know, trigger an error
- if(array_search($this->mode,$this->modes) === false) {
- trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
- return false;
- }
+ // Take the mode from the URL or take the default mode
+ $this->mode = array_key_exists(G_PEOPLE_URL_MODE,$this->url->querystring) ? $this->url->querystring[G_PEOPLE_URL_MODE] : G_PEOPLE_DEFAULT_MODE;
+
+ // If the mode is not know, trigger an error
+ if(array_search($this->mode,$this->modes) === false) {
+ trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
+ return false;
+ }
- // Fill the necessary attributes
- $this->fields = $this->configH[$this->name]['fields'];
- $this->fieldsCore = $this->configH[$this->name]['fields_core'];
+ // Fill the necessary attributes
+ $this->fields = $this->configH[$this->name]['fields'];
+ $this->fieldsCore = $this->configH[$this->name]['fields_core'];
- $this->fieldsAll = array_merge($this->fields,$this->fieldsCore);
+ $this->fieldsAll = array_merge($this->fields,$this->fieldsCore);
- $i = 0;
- // Sort the fields in descending Order
- foreach( $this->fieldsAll as $fieldName => $field ) {
- $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
- }
- array_multisort($orderArray,SORT_DESC,$this->fieldsAll);
-
- // Only execute if the user is authentified
- if($this->authH->getAuth()) {
- // From here, we are in know mode
- // Get the Id from a query or edit myself
- $id = array_key_exists(G_DB_PEOPLE_ID,$_POST) ? $_POST[G_DB_PEOPLE_ID] : $this->url->querystring[G_DB_PEOPLE_ID];
- $id = is_null($id)? $this->authH->getId() : $id;
+ $i = 0;
+ // Sort the fields in descending Order
+ foreach( $this->fieldsAll as $fieldName => $field ) {
+ $orderArray[$fieldName] = !empty($field['order']) ? $field['order'] : $i--;
+ }
+ array_multisort($orderArray,SORT_DESC,$this->fieldsAll);
+
+ // Only execute if the user is authentified
+ if($this->authH->getAuth()) {
+ // From here, we are in know mode
+ // Get the Id from a query or edit myself
+ $id = array_key_exists(G_DB_PEOPLE_ID,$_POST) ? $_POST[G_DB_PEOPLE_ID] : $this->url->querystring[G_DB_PEOPLE_ID];
+ $id = is_null($id)? $this->authH->getId() : $id;
- switch($this->mode) {
- case 'edit': $this->m_edit($id,$this->fieldsAll); break;
- case 'edit_base': $this->m_edit($id,$this->fieldsCore,true); break;
- case 'list': $this->m_list(); break;
- case 'new': $this->m_edit(G_PEOPLE_ID_NEW,$this->fieldsAll); break;
- case 'del': $this->m_del($this->url->querystring[G_DB_PEOPLE_ID]); break;
- }
- }
- $this->stopTrad();
- }
+ switch($this->mode) {
+ case 'edit': $this->m_edit($id,$this->fieldsAll); break;
+ case 'edit_base': $this->m_edit($id,$this->fieldsCore,true); break;
+ case 'list': $this->m_list(); break;
+ case 'new': $this->m_edit(G_PEOPLE_ID_NEW,$this->fieldsAll); break;
+ case 'del': $this->m_del($this->url->querystring[G_DB_PEOPLE_ID]); break;
+ }
+ }
+ $this->stopTrad();
+ }
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "main": $this->main(); break;
- }
- return false;
- }
+ function functionality($funcStr,$funcArgs = '')
+ {
+ switch($funcStr) {
+ case "main": $this->main(); break;
+ }
+ return false;
+ }
- private function m_list()
- {
- // Get the formatted fields list and Add 'id' (mandatory)
- $desiredFields = array_keys($this->fieldsAll);
+ private function m_list()
+ {
+ // Get the formatted fields list and Add 'id' (mandatory)
+ $desiredFields = array_keys($this->fieldsAll);
- // Prepare it for MySQL
- $formattedFields = implode($desiredFields,'`,`');
- $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC", // FIXME: No limit and no Selection of Columns
- $formattedFields,
- $this->authH->storage_options['table'],
- G_DB_PEOPLE_ID);
+ // Prepare it for MySQL
+ $formattedFields = implode($desiredFields,'`,`');
+ $query = sprintf("SELECT `%s` FROM `%s` ORDER BY `%s` ASC", // FIXME: No limit and no Selection of Columns
+ $formattedFields,
+ $this->authH->storage_options['table'],
+ G_DB_PEOPLE_ID);
- $fieldsContents = $this->db->getAssoc($query);
- if(PEAR::isError($fieldsContents))
- return false;
+ $fieldsContents = $this->db->getAssoc($query);
+ if(PEAR::isError($fieldsContents))
+ return false;
- $this->url->addQueryString(G_PEOPLE_URL_MODE,'edit');
- // Select only the useful fields
- $fieldsSpec = array_intersect_key($this->fieldsAll,array_flip($desiredFields));
-
- $modes['edit'] = array(
- 'name' => T_('Edit'),
- 'image' => 'pen');
- $modes['edit_base'] =array('name' =>T_('Edit connection settings'),'image' => 'red_pen');
- $modes['del'] =array('name' =>T_('Delete'),'image' => 'cross');
- $this->output->displayList($fieldsSpec,$fieldsContents,array('id'=>'People_list'),$modes);
- }
+ $this->url->addQueryString(G_PEOPLE_URL_MODE,'edit');
+ // Select only the useful fields
+ $fieldsSpec = array_intersect_key($this->fieldsAll,array_flip($desiredFields));
+
+ $modes['edit'] = array(
+ 'name' => T_('Edit'),
+ 'image' => 'pen');
+ $modes['edit_base'] =array('name' =>T_('Edit connection settings'),'image' => 'red_pen');
+ $modes['del'] =array('name' =>T_('Delete'),'image' => 'cross');
+ $this->output->displayList($fieldsSpec,$fieldsContents,array('id'=>'People_list'),$modes);
+ }
- private function m_edit($id,&$fieldsSpec,$editBase = false)
- {
- // if we are editing the core resources only
- if($editBase) {
- unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
- unset($fieldsSpec[G_DB_PEOPLE_PASSWORD]['noShow']);
- }
+ private function m_edit($id,&$fieldsSpec,$editBase = false)
+ {
+ // if we are editing the core resources only
+ if($editBase) {
+ unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
+ unset($fieldsSpec[G_DB_PEOPLE_PASSWORD]['noShow']);
+ }
- // Modification asked
- if($_POST[$this->configH['URL']['action']] == 'change') {
+ // Modification asked
+ if($_POST[$this->configH['URL']['action']] == 'change') {
- // Get the fields from the keyed array
- $fields = array_keys($fieldsSpec);
+ // Get the fields from the keyed array
+ $fields = array_keys($fieldsSpec);
- $formattedFields = '';
- // Go along the fields
- foreach($fields as $fieldName_) {
- $fieldName = $this->name.'_'.$fieldName_;
- // Jump the non-modified ones (and if we are creating a new user)
- if( $id != G_PEOPLE_ID_NEW &&
- array_key_exists(g_appendOld($fieldName),$_POST) &&
- $_POST[$fieldName] == $_POST[g_appendOld($fieldName)]) {
- continue;
- }
- // Get the type of the field and store its value
- $type = $fieldsSpec[$fieldName_]['type'];
- $fieldValue = array_key_exists($fieldName,$_POST) ? $_POST[$fieldName] : '';
+ $formattedFields = '';
+ // Go along the fields
+ foreach($fields as $fieldName_) {
+ $fieldName = $this->name.'_'.$fieldName_;
+ // Jump the non-modified ones (and if we are creating a new user)
+ if( $id != G_PEOPLE_ID_NEW &&
+ array_key_exists(g_appendOld($fieldName),$_POST) &&
+ $_POST[$fieldName] == $_POST[g_appendOld($fieldName)]) {
+ continue;
+ }
+ // Get the type of the field and store its value
+ $type = $fieldsSpec[$fieldName_]['type'];
+ $fieldValue = array_key_exists($fieldName,$_POST) ? $_POST[$fieldName] : '';
- // Jump id (No insert nor check)
- if($fieldName_ == G_DB_PEOPLE_ID ) {
- continue;
- }
+ // Jump id (No insert nor check)
+ if($fieldName_ == G_DB_PEOPLE_ID ) {
+ continue;
+ }
- // For the username
- if( $fieldName_ == G_DB_PEOPLE_USERNAME ) {
- // If we are creating a new user
- if( $id == G_PEOPLE_ID_NEW || $editBase ) { // We are creating a new one or editing an existing one
- if( empty( $fieldValue ) ) {
- // Trigger an error
- trigger_error(T_('The provided username is empty!'), G_E_DISPLAY);
- // Mark it as "error"
- $fieldsSpec[G_DB_PEOPLE_USERNAME]['error'] = true;
- // And allow re-writing it
- unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
- $newError = true;
+ // For the username
+ if( $fieldName_ == G_DB_PEOPLE_USERNAME ) {
+ // If we are creating a new user
+ if( $id == G_PEOPLE_ID_NEW || $editBase ) { // We are creating a new one or editing an existing one
+ if( empty( $fieldValue ) ) {
+ // Trigger an error
+ trigger_error(T_('The provided username is empty!'), G_E_DISPLAY);
+ // Mark it as "error"
+ $fieldsSpec[G_DB_PEOPLE_USERNAME]['error'] = true;
+ // And allow re-writing it
+ unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
+ $newError = true;
- // Proposition (which should be unique)
- $fieldsContents[G_DB_PEOPLE_USERNAME] = md5(md5(microtime()));
- // Done
- continue;
- } else { // We are not creating a new one => check its uniqueness and size
- $query = sprintf("SELECT COUNT( * ) FROM `%s` WHERE `username` = '%s'",$this->authH->storage_options['table'],$fieldValue);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $result =& $queryR->fetchRow();
- if(current($result) <> 0) { // If the only result (the counting) is different from zero, we already have something
- // Error
- $fieldsSpec[$fieldName_]['error'] = true;
- // Warning
- trigger_error(T_('The provided username is already defined.'), G_E_DISPLAY);
- // Allow rewriting to it
- unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
- $newError = true;
- // Done
- continue;
- }
- // In absence of error => attribute value
- $fieldContent = $fieldValue;
- }
- } else continue;
- } elseif ($fieldName_ == G_DB_PEOPLE_PASSWORD) { // If we have one password entry, we have two
- if($id == G_PEOPLE_ID_NEW || $editBase) { // We are creating a new one or editing an existing one
- if( empty( $fieldValue ) ) { // Provided password is empty
- $fieldsSpec[$fieldName_]['error'] = true;
- trigger_error(T_('The provided password is empty (a random one has been provided).'), G_E_DISPLAY);
- unset($fieldsSpec[$fieldName_]['noShow']);
- $newError = true;
- $fieldsContents[G_DB_PEOPLE_PASSWORD] = md5(microtime());
- continue;
- } elseif ($_POST[$fieldName] == $_POST[$fieldName.'_repeat'] && !empty($_POST[$fieldName])) { // Both passwords are the same and non-empty
- // Get the hashing algorithm
- $hash = $this->configH['Auth']['cryptType'];
- $fieldContent = $hash($_POST[$fieldName]);
- } else { // Both passwords are differents
- $fieldsSpec[$fieldName_]['error'] = true;
- trigger_error(T_('The two provided passwords are different.'), G_E_DISPLAY);
- unset($fieldsSpec[$fieldName_]['noShow']);
- $newError = true;
- // Empty password (no leaks)
- unset($fieldsContents[G_DB_PEOPLE_PASSWORD]);
- continue;
- }
- } else continue;
- } else {
- $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
- if( $fieldContent === false ) { // The given date is false
- $fieldsSpec[$fieldName]['error'] = true;
- $newError = true;
- continue;
- }
- // Re-check for the dates…
- elseif(array_key_exists(g_appendOld($fieldName),$_POST) && $fieldContent == $_POST[g_appendOld($fieldName)])
- continue;
- }
- $fieldsContents[$fieldName_] = $fieldContent;
- $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
- }
- // Strip the two last characters (border issue)
- $formattedFields = substr($formattedFields,0,-2);
- // If we are updating (thus not making a new entry)
- if($id <> G_PEOPLE_ID_NEW) {
- $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
- $this->authH->storage_options['table'],
- $formattedFields,
- G_DB_PEOPLE_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR)) return false;
+ // Proposition (which should be unique)
+ $fieldsContents[G_DB_PEOPLE_USERNAME] = md5(md5(microtime()));
+ // Done
+ continue;
+ } else { // We are not creating a new one => check its uniqueness and size
+ $query = sprintf("SELECT COUNT( * ) FROM `%s` WHERE `username` = '%s'",$this->authH->storage_options['table'],$fieldValue);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $result =& $queryR->fetchRow();
+ if(current($result) <> 0) { // If the only result (the counting) is different from zero, we already have something
+ // Error
+ $fieldsSpec[$fieldName_]['error'] = true;
+ // Warning
+ trigger_error(T_('The provided username is already defined.'), G_E_DISPLAY);
+ // Allow rewriting to it
+ unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
+ $newError = true;
+ // Done
+ continue;
+ }
+ // In absence of error => attribute value
+ $fieldContent = $fieldValue;
+ }
+ } else continue;
+ } elseif ($fieldName_ == G_DB_PEOPLE_PASSWORD) { // If we have one password entry, we have two
+ if($id == G_PEOPLE_ID_NEW || $editBase) { // We are creating a new one or editing an existing one
+ if( empty( $fieldValue ) ) { // Provided password is empty
+ $fieldsSpec[$fieldName_]['error'] = true;
+ trigger_error(T_('The provided password is empty (a random one has been provided).'), G_E_DISPLAY);
+ unset($fieldsSpec[$fieldName_]['noShow']);
+ $newError = true;
+ $fieldsContents[G_DB_PEOPLE_PASSWORD] = md5(microtime());
+ continue;
+ } elseif ($_POST[$fieldName] == $_POST[$fieldName.'_repeat'] && !empty($_POST[$fieldName])) { // Both passwords are the same and non-empty
+ // Get the hashing algorithm
+ $hash = $this->configH['Auth']['cryptType'];
+ $fieldContent = $hash($_POST[$fieldName]);
+ } else { // Both passwords are differents
+ $fieldsSpec[$fieldName_]['error'] = true;
+ trigger_error(T_('The two provided passwords are different.'), G_E_DISPLAY);
+ unset($fieldsSpec[$fieldName_]['noShow']);
+ $newError = true;
+ // Empty password (no leaks)
+ unset($fieldsContents[G_DB_PEOPLE_PASSWORD]);
+ continue;
+ }
+ } else continue;
+ } else {
+ $fieldContent = g_getFormattedField($_POST,$type,$fieldName,$fieldName_,$fieldsSpec);
+ if( $fieldContent === false ) { // The given date is false
+ $fieldsSpec[$fieldName]['error'] = true;
+ $newError = true;
+ continue;
+ }
+ // Re-check for the dates…
+ elseif(array_key_exists(g_appendOld($fieldName),$_POST) && $fieldContent == $_POST[g_appendOld($fieldName)])
+ continue;
+ }
+ $fieldsContents[$fieldName_] = $fieldContent;
+ $formattedFields .= "`$fieldName_` = '".$fieldContent."', ";
+ }
+ // Strip the two last characters (border issue)
+ $formattedFields = substr($formattedFields,0,-2);
+ // If we are updating (thus not making a new entry)
+ if($id <> G_PEOPLE_ID_NEW) {
+ $query = sprintf("UPDATE `%s` SET %s WHERE `%s` = '%s' LIMIT 1",
+ $this->authH->storage_options['table'],
+ $formattedFields,
+ G_DB_PEOPLE_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR)) return false;
- } elseif ($newError !== true) { // Creating new entry iff we have not had any error before.
- $query = sprintf("INSERT INTO `%s` SET %s",
- $this->authH->storage_options['table'],
- $formattedFields,
- G_DB_PEOPLE_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- // Get the just produced ID (per client => thread-safe)
- $query = "SELECT LAST_INSERT_ID()";
- $queryR =& $this->db->query($query);
- $id =& current($queryR->fetchRow());
- // Success => mode = 'edit'
- $this->mode = 'edit';
-// } else { // We had errors while preparing the new user
- }
- $this->url->removeQueryString($this->configH['URL']['action']);
- }
+ } elseif ($newError !== true) { // Creating new entry iff we have not had any error before.
+ $query = sprintf("INSERT INTO `%s` SET %s",
+ $this->authH->storage_options['table'],
+ $formattedFields,
+ G_DB_PEOPLE_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ // Get the just produced ID (per client => thread-safe)
+ $query = "SELECT LAST_INSERT_ID()";
+ $queryR =& $this->db->query($query);
+ $id =& current($queryR->fetchRow());
+ // Success => mode = 'edit'
+ $this->mode = 'edit';
+// } else { // We had errors while preparing the new user
+ }
+ $this->url->removeQueryString($this->configH['URL']['action']);
+ }
- // Display the edited user
+ // Display the edited user
- // If we are not creating a new user
- if($id <> G_PEOPLE_ID_NEW) {
- // Get the formatted fields list
- $formattedFields = array_keys($fieldsSpec);
- $formattedFields = implode($formattedFields,'`,`');
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- $formattedFields,
- $this->authH->storage_options['table'],
- G_DB_PEOPLE_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $fieldsContents =& $queryR->fetchRow();
- } else { // We are creating a new user
- // Set the ID to the special one
- $fieldsContents[G_DB_PEOPLE_ID] = $id;
- // Allow some stuff to be edited.
- unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
- unset($fieldsSpec[G_DB_PEOPLE_PASSWORD]['noShow']);
- $displayOptions['title'] = T_('New person');
- }
- $this->url->addQueryString(G_PEOPLE_URL_MODE,$this->mode);
- $this->url->addQueryString(G_DB_PEOPLE_ID,$id);
+ // If we are not creating a new user
+ if($id <> G_PEOPLE_ID_NEW) {
+ // Get the formatted fields list
+ $formattedFields = array_keys($fieldsSpec);
+ $formattedFields = implode($formattedFields,'`,`');
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ $formattedFields,
+ $this->authH->storage_options['table'],
+ G_DB_PEOPLE_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $fieldsContents =& $queryR->fetchRow();
+ } else { // We are creating a new user
+ // Set the ID to the special one
+ $fieldsContents[G_DB_PEOPLE_ID] = $id;
+ // Allow some stuff to be edited.
+ unset($fieldsSpec[G_DB_PEOPLE_USERNAME]['restricted']);
+ unset($fieldsSpec[G_DB_PEOPLE_PASSWORD]['noShow']);
+ $displayOptions['title'] = T_('New person');
+ }
+ $this->url->addQueryString(G_PEOPLE_URL_MODE,$this->mode);
+ $this->url->addQueryString(G_DB_PEOPLE_ID,$id);
- $fieldsContents[G_DB_PEOPLE_ID] = $id;
+ $fieldsContents[G_DB_PEOPLE_ID] = $id;
- $displayOptions['id'] = 'People_view';
- $displayOptions['command'] = T_('Execute');
- $displayOptions['target'] = $this->url->getURL();
- $displayOptions['action'] = 'change';
+ $displayOptions['id'] = 'People_view';
+ $displayOptions['command'] = T_('Execute');
+ $displayOptions['target'] = $this->url->getURL();
+ $displayOptions['action'] = 'change';
- $fullFieldsSpec[$this->name] = $fieldsSpec;
+ $fullFieldsSpec[$this->name] = $fieldsSpec;
- $fullFieldsContents[$this->name] = $fieldsContents;
+ $fullFieldsContents[$this->name] = $fieldsContents;
- if( !$editBase ) {
- // Call the functionality
- $functionalityResult = $this->_parent->functionality('People.edit.bottom',&$fieldsContents);
+ if( !$editBase ) {
+ // Call the functionality
+ $functionalityResult = $this->_parent->functionality('People.edit.bottom',&$fieldsContents);
- foreach( $functionalityResult as $pluginName => $biDimResult ) {
- $fullFieldsSpec[$pluginName] = $biDimResult['spec'];
- $fullFieldsContents[$pluginName] = $biDimResult['content'];
- }
- }
+ foreach( $functionalityResult as $pluginName => $biDimResult ) {
+ $fullFieldsSpec[$pluginName] = $biDimResult['spec'];
+ $fullFieldsContents[$pluginName] = $biDimResult['content'];
+ }
+ }
- $this->output->displayFields($fullFieldsSpec,$fullFieldsContents,$displayOptions);
- }
+ $this->output->displayFields($fullFieldsSpec,$fullFieldsContents,$displayOptions);
+ }
- private function m_del($id)
- {
- // Delete the given id (seek for confirmation)
-
- // In case of confirmation
- if($_POST[$this->configH['URL']['action']] == 'confirm') {
- $query = sprintf("DELETE FROM `%s` WHERE `%s` = %d LIMIT 1",
- $this->authH->storage_options['table'],
- G_DB_PEOPLE_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $this->m_list();
- } else {
- // Get the formatted fields list
- $formattedFields = array_keys($this->fields);
- $formattedFields = implode($formattedFields,'`,`');
- $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
- $formattedFields,
- $this->authH->storage_options['table'],
- G_DB_PEOPLE_ID,
- $id);
- $queryR =& $this->db->query($query);
- if(PEAR::isError($queryR))
- return false;
- $fieldsContents =& $queryR->fetchRow();
+ private function m_del($id)
+ {
+ // Delete the given id (seek for confirmation)
+
+ // In case of confirmation
+ if($_POST[$this->configH['URL']['action']] == 'confirm') {
+ $query = sprintf("DELETE FROM `%s` WHERE `%s` = %d LIMIT 1",
+ $this->authH->storage_options['table'],
+ G_DB_PEOPLE_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $this->m_list();
+ } else {
+ // Get the formatted fields list
+ $formattedFields = array_keys($this->fields);
+ $formattedFields = implode($formattedFields,'`,`');
+ $query = sprintf("SELECT `%s` FROM `%s` WHERE `%s` = '%s' LIMIT 1",
+ $formattedFields,
+ $this->authH->storage_options['table'],
+ G_DB_PEOPLE_ID,
+ $id);
+ $queryR =& $this->db->query($query);
+ if(PEAR::isError($queryR))
+ return false;
+ $fieldsContents =& $queryR->fetchRow();
- // Display the fields and launch the command to confirm
- $this->output->displayFields($this->fields,$fieldsContents,array('id'=>'People_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')),$this->name);
- }
- }
+ // Display the fields and launch the command to confirm
+ $this->output->displayFields($this->fields,$fieldsContents,array('id'=>'People_view','command'=>T_('Confirm deletion'),'target'=>$this->url->getURL(),'action'=>'confirm','title'=>T_('Do you really want to delete the following entry?')),$this->name);
+ }
+ }
}
?>
\ No newline at end of file