function pfcGlobalConfig($params = array()) { // @todo find a cleaner way to forward serverid to i18n functions $GLOBALS['serverid'] = isset($params['serverid']) ? $params['serverid'] : '_serverid_'; // setup the locales for the translated messages pfcI18N::Init(isset($params['language']) ? $params['language'] : ''); // check the serverid is really defined if (!isset($params["serverid"])) { $this->errors[] = _pfc("'%s' parameter is mandatory by default use '%s' value", "serverid", "md5(__FILE__)"); } $this->serverid = $params["serverid"]; // setup data_private_path because _GetCacheFile needs it if (!isset($params["data_private_path"])) { $this->data_private_path = dirname(__FILE__) . "/../data/private"; } else { $this->data_private_path = $params["data_private_path"]; } // check if a cached configuration already exists // don't load parameters if the cache exists $cachefile = $this->_GetCacheFile(); if (!file_exists($cachefile)) { // first of all, save our current state in order to be able to check for variable types later $this->_saveParamsTypes(); if (!isset($params["data_public_path"])) { $this->data_public_path = dirname(__FILE__) . "/../data/public"; } else { $this->data_public_path = $params["data_public_path"]; } // if the user didn't specify the server_script_url, then remember it and // append QUERY_STRING to it if (!isset($params['server_script_url'])) { $this->_query_string = isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != '' ? '?' . $_SERVER['QUERY_STRING'] : ''; } // load users container or keep default one if (isset($params["container_type"])) { $this->container_type = $params["container_type"]; } // load default container's config $ct =& pfcContainer::Instance($this->container_type, true); $ct_cfg = $ct->getDefaultConfig(); foreach ($ct_cfg as $k => $v) { $attr = "container_cfg_" . $k; if (!isset($this->{$attr})) { $this->{$attr} = $v; } } // load all user's parameters which will override default ones foreach ($params as $k => $v) { if (!isset($this->{$k})) { $this->errors[] = _pfc("Error: undefined or obsolete parameter '%s', please correct or remove this parameter", $k); } if (preg_match('/^_/', $k)) { $this->errors[] = _pfc("Error: '%s' is a private parameter, you are not allowed to change it", $k); } if ($k == "proxies_cfg") { // don't replace all the proxy_cfg parameters, just replace the specified ones foreach ($params["proxies_cfg"] as $k2 => $v2) { if (is_array($v2)) { foreach ($v2 as $k3 => $v3) { $this->proxies_cfg[$k2][$k3] = $v3; } } else { $this->proxies_cfg[$k2] = $v2; } } } else { $this->{$k} = $v; } } } // load dynamic parameter even if the config exists in the cache if (isset($params['dyn_params']) && is_array($params['dyn_params'])) { $this->_dyn_params = array_merge($this->_dyn_params, $params['dyn_params']); } foreach ($this->_dyn_params as $dp) { if (isset($params[$dp])) { $this->{$dp} = $params[$dp]; } } // 'channels' is now a dynamic parameter, just check if I need to initialize it or not if (is_array($this->channels) && count($this->channels) == 0 && !isset($params['channels'])) { $this->channels = array(_pfc("My room")); } // now load or save the configuration in the cache $this->synchronizeWithCache(); // to be sure the container instance is initialized $ct =& pfcContainer::Instance($this->container_type, true); // This is a dirty workaround which fix a infinite loop when: // 'frozen_nick' is true // 'nick' length is > 'max_nick_len' $this->nick = $this->filterNickname($this->nick); }
<?php # lang require_once "../src/pfci18n.class.php"; require_once "inc.conf.php"; pfcI18N::Init($lang, "admin"); # version class require_once "version.class.php"; $version = new version(); ?> <?php // TOP // include "index_html_top.php"; ?> <div class="content"> <h2><?php echo _pfc("Administration"); ?> </h2> <div><h3><?php echo _pfc("Available Languages"); ?> </h3> <ul> <li><form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post">