function process()
 {
     $cst = array('SU_LOGIN', 'SU_PASSWORD', 'SU_EMAIL', 'PHPMV_URL', 'SEND_MAIL', 'MONDAY_FIRST', 'INTERFACE_DEFAULT_LANG');
     foreach ($cst as $name) {
         if (defined($name)) {
             $values[$name] = constant($name);
         } elseif ($name == 'PHPMV_URL') {
             $values[$name] = Request::getCurrentCompletePath();
         } else {
             $values[$name] = '';
         }
     }
     $passwordMd5OrNot = !empty($values['SU_PASSWORD']) ? md5($values['SU_PASSWORD']) : '';
     $formElements = array(array('text', 'form_login', $GLOBALS['lang']['install_loginadmin'], 'value=' . $values['SU_LOGIN']), array('password', 'form_password', $GLOBALS['lang']['install_mdpadmin'], 'value=' . $passwordMd5OrNot), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value=' . $passwordMd5OrNot), array('text', 'form_email', $GLOBALS['lang']['admin_admin_mail'], 'value=' . $values['SU_EMAIL']), array('radio', 'form_send_mail', $GLOBALS['lang']['install_send_mail'], $GLOBALS['lang']['install_oui'], 'yes'), array('radio', 'form_send_mail', null, $GLOBALS['lang']['install_non'], 'no'), array('radio', 'form_monday_first', $GLOBALS['lang']['admin_general_config_firstday'], $GLOBALS['lang']['jsemaine']['Mon'], 'yes'), array('radio', 'form_monday_first', null, $GLOBALS['lang']['jsemaine']['Sun'], 'no'), array('text', 'form_phpmvurl', $GLOBALS['lang']['admin_phpmv_path'], 'size=40 value=' . $values['PHPMV_URL']));
     $lang =& Lang::getInstance();
     $allLangs = $lang->getArrayLangs();
     unset($allLangs['other']);
     $formElements[] = array('select', 'form_interface_default_lang', $GLOBALS['lang']['admin_default_language'], $allLangs);
     $this->addElements($formElements, 'General - phpMyVisites');
     $this->setSelected('form_interface_default_lang', $lang->getFileName());
     $this->setChecked('form_send_mail', defined('SEND_MAIL') ? SEND_MAIL : 'yes');
     $this->setChecked('form_monday_first', defined('MONDAY_FIRST') ? MONDAY_FIRST : 'yes');
     $formRules = array(array('form_email', $GLOBALS['lang']['admin_valid_email'], 'email', '', 'server'), array('form_email', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_admin_mail']), 'required'), array('form_login', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_loginadmin']), 'required'), array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_mdpadmin']), 'required'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'), array('form_phpmvurl', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_phpmv_path']), 'required'));
     $this->addRules($formRules);
     return parent::process('install_general_setup');
 }
 function showAll($return = false, $mail = false)
 {
     $this->viewTemplate = $mail ? "common/structure_mail.tpl" : "common/structure_rss.tpl";
     $date = $this->data->archive->date->get();
     $this->tpl->assign("url_phpmv", Request::getCurrentCompletePath() . "/index.php?site=" . $this->site->getId() . "&mod=view_visits&date=" . $date);
     $this->tpl->assign("site_name", $this->site->getName());
     $methods = array("statistics" => array());
     $this->getDataMethod($methods);
     if ($return) {
         return $this->fetch($this->viewTemplate);
     } else {
         $this->display();
         return true;
     }
 }
 function postProcess()
 {
     $login = $this->getSubmitValue('form_login');
     $password = md5($this->getSubmitValue('form_password'));
     $url = $this->getSubmitValue('form_url');
     $me = new User();
     if ($me->isCorrect($login, $password)) {
         $me->loadPermissions();
         if ($me->NoSitePermission()) {
             header("Location: " . Request::getCurrentCompletePath() . "/index.php?mod=login&error_login=2");
             exit;
         }
         header("Location: {$url}");
         exit;
     } else {
         header("Location: " . Request::getCurrentCompletePath() . "/index.php?mod=login&error_login=1");
         exit;
     }
 }
 function getCurrentCompleteUrl()
 {
     return Request::getCurrentCompletePath() . "/" . Request::getCurrentUrl();
 }