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 process() { // general input $formElements = array(array('text', 'form_name', $GLOBALS['lang']['admin_name'], 'value="' . $this->pdfName . '"'), array('hidden', 'form_id', $this->pdfId), array('hidden', 'form_site_admin', $this->siteAdmin)); $this->addElements($formElements); // launche process return parent::process('admin_pdf_title'); }
function process() { $listType = array('admin' => 'Admin', 'menu' => 'Menu', 'all' => 'All'); $this->tpl->assign('listType', $listType); $listMenu = array("view_visits" => 'menu_visites', "view_frequency" => 'frequence_titremenu', "view_pages" => 'menu_pagesvues', "view_followup" => 'menu_suivi', "view_source" => 'menu_provenance', "view_settings" => 'menu_configurations', "view_referers" => 'menu_affluents'); $this->tpl->assign('listMenu', $listMenu); // Get plugin list $this->tpl->assign('listPlugin', $this->listAvailablePlugin); // launche process return parent::process('admin_pdf_title'); }
function process() { $urlToGoAfter = str_replace('mod=login', '', Request::getCurrentCompleteUrl()); // general input $formElements = array(array('text', 'form_login', $GLOBALS['lang']['login_login']), array('password', 'form_password', $GLOBALS['lang']['login_password']), array('hidden', 'form_url', $urlToGoAfter)); $this->addElements($formElements); // validation rules $formRules = array(array('form_login', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['login_login']), 'required'), array('form_password', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['login_password']), 'required')); $this->addRules($formRules); // launche process return parent::process(); }
function process() { // general input $formElements = array(); for ($i = 0; $i < NB_URLS_ALIAS_AVAILABLE; $i++) { $formElements[] = array('text', 'form_url' . $i, sprintf($GLOBALS['lang']['admin_url_n'], $i), 'value="' . @$this->a_urls[$i] . '"'); $formRules[] = $this->getRuleCheckUrl('form_url' . $i); } $this->addElements($formElements); $this->addRules($formRules); // launche process return parent::process('admin_alias_title'); }
function process() { // general input $formElements = array(array('text', 'form_name', $GLOBALS['lang']['admin_name'], 'value="' . @$this->partnerName . '"'), array('hidden', 'form_id', $this->partnerId)); $this->addElements($formElements, $GLOBALS['lang']['generique_general']); for ($i = 0; $i < NB_URLS_ALIAS_AVAILABLE; $i++) { $formElements2[] = array('text', 'form_url' . $i, sprintf($GLOBALS['lang']['admin_url_n'], $i), 'value="' . @$this->partnerUrls[$i] . '"'); $formRules[] = $this->getRuleCheckUrl('form_url' . $i); } $this->addElements($formElements2, $GLOBALS['lang']['admin_url_aliases']); $this->addRules($formRules); // launche process return parent::process('admin_partner_title'); }
function process() { // general input $formElements = array(); for ($i = 0; $i < NB_IPS_RANGE_AVAILABLE; $i++) { $formElements[] = array('text', 'form_ipa' . $i, '', 'value="' . long2ip(@$this->a_ips[$i][0]) . '"'); $formElements[] = array('text', 'form_ipb' . $i, '', 'value="' . long2ip(@$this->a_ips[$i][1]) . '"'); } $this->addElements($formElements, 'General'); // validation rules $formRules = array(array('__ALL__', sprintf($GLOBALS['lang']['admin_error_ip'], IP_EXAMPLE), 'checkCorrectIp')); $this->addRules($formRules); // launche process return parent::process('admin_ip_exclude_title'); }
function process() { $cst = array('DB_LOGIN', 'DB_PASSWORD', 'DB_HOST', 'DB_NAME', 'DB_TABLES_PREFIX'); foreach ($cst as $name) { if (defined($name)) { $values[$name] = constant($name); } elseif ($name == 'DB_TABLES_PREFIX') { $values[$name] = 'phpmv_'; } else { $values[$name] = ''; } } $password = !empty($values['DB_PASSWORD']) ? md5($values['DB_PASSWORD']) : ''; $formElements = array(array('text', 'form_dblogin', $GLOBALS['lang']['install_loginmysql'], 'value=' . $values['DB_LOGIN']), array('password', 'form_dbpassword', $GLOBALS['lang']['install_mdpmysql'], 'value=' . $password), array('text', 'form_dbhost', $GLOBALS['lang']['install_serveurmysql'], 'value=' . $values['DB_HOST']), array('text', 'form_dbname', $GLOBALS['lang']['install_basemysql'], 'value=' . $values['DB_NAME']), array('text', 'form_dbprefix', $GLOBALS['lang']['install_prefixetable'], 'value=' . $values['DB_TABLES_PREFIX'])); $this->addElements($formElements, $GLOBALS['lang']['generique_general']); $formRules = array(array('form_dblogin', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_loginmysql']), 'required'), array('form_dbhost', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_serveurmysql']), 'required'), array('form_dbname', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_basemysql']), 'required'), array('form_dbprefix', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['install_prefixetable']), 'required')); $this->addRules($formRules); return parent::process('install_database_setup'); }
function process() { if ($this->login == 'anonymous') { return false; } if ($this->login) { $info = User::getInfo($this->login); } $req =& Request::getInstance(); $tmpPassword = @$info['password']; $passwordMd5OrNot = !empty($tmpPassword) ? $tmpPassword : ''; if ($req->getActionName() === 'modCur') { $formElements = array(array('hidden', 'form_login', $this->login), array('password', 'form_passwordold', "Old password:"******""'), array('password', 'form_password', "New password:"******""'), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value=""'), array('text', 'form_alias', "Alias", 'size=40 value="' . @$info['alias'] . '"'), array('text', 'form_email', "email", 'value="' . @$info['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')); $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_passwordold', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_user_oldPwd']), 'required'), array('form_passwordold', $GLOBALS['lang']['admin_user_oldPwd_bad'], 'checkOldCurrentPassword'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'complexPassword'), array('form_password', $GLOBALS['lang']['admin_match_pass'], 'compareField', 'form_password2'), array('form_password', $GLOBALS['lang']['admin_valid_pass'], 'changePassword')); } else { $formElements = array(array('password', 'form_password', "Password:"******"' . $passwordMd5OrNot . '"'), array('password', 'form_password2', $GLOBALS['lang']['admin_type_again'], 'value="' . $passwordMd5OrNot . '"'), array('text', 'form_alias', "Alias", 'size=40 value="' . @$info['alias'] . '"'), array('text', 'form_email', "email", 'value="' . @$info['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')); $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_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')); } // when adding a new element, add an input named login // else read the login in url if ($req->getActionName() === 'add') { $formElements = array_merge(array(array('text', 'form_login', "Login:"******""')), $formElements); $formRules[] = array('form_login', sprintf($GLOBALS['lang']['admin_required'], "Login"), 'required'); $formRules[] = array('form_login', "Alpha numeric only", 'alphanumeric'); if ($login = $this->getSubmitValue('form_login')) { $all = array_keys(User::getAllUsers()); if (in_array($login, $all)) { $this->setElementError('form_login', 'Login already exist in database!'); } } } $this->addElements($formElements, 'User Information'); $this->setChecked('form_send_mail', @$info['send_mail'] == '1' ? 'yes' : 'no'); $this->addRules($formRules); return parent::process('install_general_setup'); }
function process() { // general input $tmpImg = isset($this->valueLogo) && $this->valueLogo != 'pixel.gif' ? $this->valueLogo : '1.png'; $formElements = array(array('text', 'form_name', $GLOBALS['lang']['admin_site_name'], 'value="' . str_replace('"', "'", $this->valueName) . '"'), array('text', 'form_url', $GLOBALS['lang']['admin_site_url'], 'value="' . $this->valueMainUrl . '"'), array('radio', 'form_logo', sprintf($GLOBALS['lang']['install_afficherlogo'], '<img alt="logo" name="logo_phpmv" src="' . DIR_IMG_LOGOS . '/' . $tmpImg . '"/> '), $GLOBALS['lang']['install_oui'] . '<br><br><a href="javascript:popup(\'index.php?mod=list_logos\');">-> ' . $GLOBALS['lang']['install_logodispo'] . '</a>', 'yes'), array('radio', 'form_logo', null, $GLOBALS['lang']['install_non'], 'no'), array('hidden', 'form_logo_no', $tmpImg)); $this->addElements($formElements, 'General'); // Prepare PDF list $listPdf = array(); $listPdfOption = array(); $listPdf["-1"] = $GLOBALS['lang']['admin_get_default_pdfdefault']; if (isset($this->siteAdmin)) { $pdfDb = new PdfConfigDb($this->siteAdmin); $tmpLstPdf = $pdfDb->getListPdf(); foreach ($tmpLstPdf as $key => $info) { $listPdf[$key] = $info->pdfName . " (" . PARAM_URL_NEWSLETTER . "=" . $key . ")"; } } // Get List of theme $dir = INCLUDE_PATH . "/themes/"; $d = dir($dir); $arDir = array(); while (false !== ($entry = $d->read())) { if (is_dir($dir . $entry) && $entry[0] != '.') { $arDir[$entry] = ucfirst($entry); } } $d->close(); // optional input (relative to GET variable recording) $formElements = array(array('radio', 'form_params', $GLOBALS['lang']['admin_get_question'], $GLOBALS['lang']['admin_get_a1'], 'all'), array('radio', 'form_params', null, $GLOBALS['lang']['admin_get_a2'], 'none'), array('radio', 'form_params', null, $GLOBALS['lang']['admin_get_a3'], 'only'), array('radio', 'form_params', null, $GLOBALS['lang']['admin_get_a4'], 'except'), array('text', 'form_params_names', sprintf($GLOBALS['lang']['admin_get_list'], GET_LIST_EXAMPLE), 'value="' . $this->valueVariableNames . '"'), array('select', 'form_idpdf'), array('select', 'form_path_theme')); $this->addElements($formElements, $GLOBALS['lang']['install_utilisateursavances']); // Set list PDF with default value $s =& $this->createElement('select', 'form_idpdf', $GLOBALS['lang']['admin_get_default_pdf']); $s->loadArray($listPdf, $this->idPdf); // Default value $this->addElement($s); // Set list theme with default value $s =& $this->createElement('select', 'form_path_theme', $GLOBALS['lang']['admin_get_default_theme']); $s->loadArray($arDir, $this->pathTheme); // Default value $this->addElement($s); // set first radio checked for variables recording //$radio =& $this->getElement('form_params'); //$radio->_attributes['checked'] = 'checked'; $this->setChecked('form_params', $this->valueRecordGet); // set first radio checked for logo display $this->setChecked('form_logo', $this->valueLogo == 'pixel.gif' ? 'no' : 'yes'); // validation rules $formRules = array(array('form_name', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_site_name']), 'required'), array('form_url', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_site_url']), 'required'), $this->getRuleCheckUrl('form_url'), array('form_logo', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_logo_question']), 'required'), array('form_params', sprintf($GLOBALS['lang']['admin_required'], $GLOBALS['lang']['admin_get_question']), 'required')); $this->addRules($formRules); // launche process return parent::process('admin_configetperso'); }
function process() { /* * OLD VERSION $this->user = new UserConfigDb(); $groups = $this->user->getGroups(); $groups['no_permission'] = "No permission"; foreach($groups as $id => $name) { $usersInGroup = $this->user->getUserByGroup( $id, $this->idSite ); $formElements = array(); foreach($usersInGroup as $info) { // general input $formElements[] = array('checkbox', $info['login'], ' ', $info['alias'] . " (login : "******")" // ". $info['email'] ); } $groupCopy = $groups; $groupCopy = array_merge( array( 0 => $GLOBALS['lang']['admin_move_select']), $groupCopy); unset($groupCopy[$id]); $formElements[] = array('select', 'group_to_move_to_'.$id, $GLOBALS['lang']['admin_move_group'], $groupCopy ); $description = array(); if($name == 'admin') { $description['name'] = $GLOBALS['lang']['admin_group_admin_n']; $description['description'] = $GLOBALS['lang']['admin_group_admin_d']; } elseif($name == 'view') { $description['name'] = $GLOBALS['lang']['admin_group_view_n']; $description['description'] = $GLOBALS['lang']['admin_group_view_d']; } else { $description['name'] = $GLOBALS['lang']['admin_group_noperm_n']; $description['description'] = $GLOBALS['lang']['admin_group_noperm_d']; } $descriptionTxt = "<u>".$GLOBALS['lang']['generique_name']."</u> <b>$name</b> (".$description['name'] . ")<br><u>".$GLOBALS['lang']['generique_description']. "</u> " . $description['description']."<br>"; $this->addElements( $formElements , $descriptionTxt); } // launche process return parent::process( 'admin_group_title' ); */ // New version $this->user = new UserConfigDb(); $o_user =& User::getInstance(); $groups = $this->user->getGroups(); $users = $o_user->getAllUsers(); $users['anonymous'] = "Anonymous"; $userRight = array(); foreach ($users as $login => $name) { $userRight[$login] = array(); if (empty($name)) { $userRight[$login][0] = $login; } else { $userRight[$login][0] = $name; } $userRight[$login][1] = "no_permission"; } foreach ($groups as $id => $name) { $usersInGroup = $this->user->getUserByGroup($id, $this->idSite); foreach ($usersInGroup as $info) { $userRight[$info['login']][1] = $id; } } $groups['no_permission'] = "No permission"; $this->tpl->assign('id_site', $this->idSite); $this->tpl->assign('groups_available', $groups); $this->tpl->assign('users_available', $userRight); $this->tpl->assign('nb_users_available', count($userRight)); // launche process return parent::process('admin_group_title'); // End new Version }
public function process() { switch ($this->mode) { /** * Задаем хэш, отправляем пользователю ссылку для восстановления пароля */ case "hash": $uid = $this->getField($this->userField); if ($hash = $this->getUserHash($uid)) { $this->setFields($this->user->toArray()); $url = $this->getCFGDef('resetTo', $this->modx->documentIdentifier); $this->setField('reset.url', $this->modx->makeUrl($url, "", "&{$this->uidField}={$this->getField($this->uidField)}&{$this->hashField}={$hash}", 'full')); $this->mailConfig['to'] = $this->user->edit($uid)->get('email'); parent::process(); } else { $this->addMessage($this->lexicon->getMsg('reminder.users_only')); } break; /** * Если пароль не задан, то создаем пароль * Отправляем пользователю письмо с паролем, если указан шаблон такого письма * Если не указан, то запрещаем отправку письма, пароль будет показан на экране */ /** * Если пароль не задан, то создаем пароль * Отправляем пользователю письмо с паролем, если указан шаблон такого письма * Если не указан, то запрещаем отправку письма, пароль будет показан на экране */ case "reset": $uid = $this->getField($this->uidField); $hash = $this->getField($this->hashField); if ($hash && $hash == $this->getUserHash($uid)) { if ($this->getField('password') == '' && !isset($this->rules['password'])) { $this->setField('password', \APIhelpers::genPass($this->getCFGDef('passwordLength', 6))); } $fields = $this->filterFields($this->getFormData('fields'), array('password')); $result = $this->user->edit($uid)->fromArray($fields)->save(true); $this->log('Update password', array('data' => $fields, 'result' => $result)); if (!$result) { $this->addMessage($this->lexicon->getMsg('reminder.update_failed')); } else { $this->setField('newpassword', $this->getField('password')); $this->setFields($this->user->toArray()); if ($this->getCFGDef('resetReportTpl')) { $this->mailConfig['to'] = $this->getField('email'); } parent::process(); } } else { $this->addMessage($this->lexicon->getMsg('reminder.update_failed')); parent::process(); } break; } }
public function process() { //регистрация без логина, по емейлу if ($this->getField('username') == '') { $this->setField('username', $this->getField('email')); } if ($this->checkSubmitProtection()) { return; } //регистрация со случайным паролем if ($this->getField('password') == '' && !isset($this->rules['password'])) { $this->setField('password', \APIhelpers::genPass($this->getCFGDef('passwordLength', 6))); } $fields = $this->filterFields($this->getFormData('fields'), $this->allowedFields, $this->forbiddenFields); $result = $this->user->create($fields)->save(true); $this->log('Register user', array('data' => $fields, 'result' => $result)); if (!$result) { $this->addMessage($this->lexicon->getMsg('register.registration_failed')); } else { $this->addWebUserToGroups($this->user->getID(), $this->getCFGDef('userGroups')); parent::process(); } }
public function process() { $fields = $this->getContentFields(); $owner = $this->getCFGDef('ownerField', 'aid'); $result = false; if ($fields && !is_null($this->content)) { $clearCache = $this->getCFGDef('clearCache', false); switch ($this->mode) { case 'create': if ($this->checkSubmitProtection() || $this->checkSubmitLimit()) { return; } if ($this->owner) { $fields[$owner] = $this->owner; } $result = $this->content->create($fields)->save(true, $clearCache); $this->log('Create record', array('data' => $fields, 'result' => $result)); break; case 'edit': $result = $this->content->fromArray($fields)->save(true, $clearCache); $this->log('Update record', array('data' => $fields, 'result' => $result)); break; default: break; } //чтобы не получился косяк, когда плагины обновят поля $this->content->close(); $this->setFields($this->content->edit($this->id)->toArray()); $this->log('Update form data', array('data' => $this->getFormData('fields'))); } if (!$result) { $this->addMessage($this->lexicon->getMsg('edit.update_fail')); } else { if ($this->mode == 'create') { $url = ''; $evtOut = $this->modx->invokeEvent('OnMakeDocUrl', array('id' => $result, 'data' => $this->getFormData('fields'))); if (is_array($evtOut) && count($evtOut) > 0) { $url = array_pop($evtOut); } if ($url) { $this->setField('content.url', $url); } } parent::process(); } }