private function validateForm($data) { $l = Movim\i18n\Locale::start(); if (Validator::in(array_keys($l->getList()))->validate($data['language']) && Validator::in(array('show', 'hide'))->validate($data['roster']) && ($data['cssurl'] == '' || Validator::url()->validate($data['cssurl']))) { return true; } return false; }
function prepareConfigForm() { $view = $this->tpl(); /* We load the user configuration */ $this->user->reload(); $l = Movim\i18n\Locale::start(); $view->assign('languages', $l->getList()); $view->assign('me', $this->user->getLogin()); $view->assign('conf', $this->user->getConfig()); $view->assign('submit', $this->call('ajaxSubmit', "movim_parse_form('general')") . "this.className='button color orange inactive oppose';\n this.onclick=null;"); return $view->draw('_config_form', true); }
/** * @brief Reload the user configuration */ function reload() { $session = \Sessionx::start(); if ($session->config) { $this->config = $session->config; $lang = $this->getConfig('language'); if (isset($lang)) { $l = Movim\i18n\Locale::start(); $l->load($lang); } $cd = new modl\CapsDAO(); $caps = $cd->get($session->host); $this->caps = unserialize($caps->features); } }
function display() { $cd = new \Modl\ConfigDAO(); $config = $cd->get(); $l = Movim\i18n\Locale::start(); $this->view->assign('conf', $cd->get()); $this->view->assign('logs', array(0 => $this->__('log.empty'), 1 => $this->__('log.syslog'), 2 => $this->__('log.syslog_files'))); $this->view->assign('bosh_info4', $this->__('bosh.info4', '<a href="http://wiki.movim.eu/en:install">', '</a>')); $json = requestURL(MOVIM_API . 'websockets', 1); $json = json_decode($json); if (isset($json) && $json->status != 404) { $this->view->assign('websockets', $json); } $this->view->assign('timezones', getTimezoneList()); $this->view->assign('langs', $l->getList()); }
/** * Loads up the language, either from the User or default. */ function loadLanguage() { $user = new User(); $user->reload(); $cd = new \Modl\ConfigDAO(); $config = $cd->get(); $l = Movim\i18n\Locale::start(); if ($user->isLogged()) { $lang = $user->getConfig('language'); } if (isset($lang)) { $l->load($lang); } elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $l->detect(); $l->loadPo(); } else { $l->load($config->locale); } }
function __() { $args = func_get_args(); $l = Movim\i18n\Locale::start(); $string = array_shift($args); return $l->translate($string, $args); }