public function display_form()
 {
     if ((int) $this->config->get('cmsbridge_active') == 1 && strlen($this->config->get('cmsbridge_reg_url'))) {
         redirect($this->config->get('cmsbridge_reg_url'), false, true);
     }
     //Captcha
     if ($this->config->get('enable_captcha') == 1) {
         require $this->root_path . 'libraries/recaptcha/recaptcha.class.php';
         $captcha = new recaptcha();
         $this->tpl->assign_vars(array('CAPTCHA' => $captcha->get_html($this->config->get('lib_recaptcha_okey')), 'S_DISPLAY_CATPCHA' => true));
     }
     $language_array = array();
     if ($dir = @opendir($this->root_path . 'language/')) {
         while ($file = @readdir($dir)) {
             if (!is_file($this->root_path . 'language/' . $file) && !is_link($this->root_path . 'language/' . $file) && valid_folder($file)) {
                 $language_array[$file] = ucfirst($file);
             }
         }
     }
     //User Profilefields
     $arrUserProfileFields = $this->pdh->get('user_profilefields', 'registration_fields');
     if (count($arrUserProfileFields)) {
         $form = register('form', array('register'));
         $form->validate = true;
         $form->add_fields($arrUserProfileFields);
         $form->output($this->userProfileData);
     }
     $this->tpl->assign_vars(array('S_CURRENT_PASSWORD' => false, 'S_NEW_PASSWORD' => false, 'S_SETTING_ADMIN' => false, 'S_MU_TABLE' => false, 'S_PROFILEFIELDS' => count($arrUserProfileFields) ? true : false, 'VALID_EMAIL_INFO' => $this->config->get('account_activation') == 1 ? '<br />' . $this->user->lang('valid_email_note') : '', 'AUTH_REGISTER_BUTTON' => ($arrRegisterButtons = $this->user->handle_login_functions('register_button')) ? implode(' ', $arrRegisterButtons) : '', 'REGISTER' => true, 'DD_LANGUAGE' => new hdropdown('user_lang', array('options' => $language_array, 'value' => $this->data['user_lang'])), 'DD_TIMEZONES' => new hdropdown('user_timezone', array('options' => $this->time->timezones, 'value' => $this->data['user_timezone'])), 'HIDDEN_FIELDS' => isset($this->data['auth_account']) ? new hhidden('lmethod', array('value' => $this->in->get('lmethod'))) . new hhidden('auth_account', array('value' => $this->crypt->encrypt($this->data['auth_account']))) : '', 'USERNAME' => $this->data['username'], 'USER_EMAIL' => $this->data['user_email'], 'USER_EMAIL2' => $this->data['user_email2']));
     $this->core->set_vars(array('page_title' => $this->user->lang('register_title'), 'template_file' => 'register.html', 'display' => true));
 }
Example #2
0
 public function display()
 {
     if ($this->user->is_signedin()) {
         redirect($this->controller_path_plain . 'Settings/' . $this->SID);
     }
     $blnShowCaptcha = false;
     if ((int) $this->config->get('failed_logins_inactivity') - 2 > 0) {
         if ($this->user->data['session_failed_logins'] >= (int) $this->config->get('failed_logins_inactivity') - 2) {
             $blnShowCaptcha = true;
         }
         if (!$blnShowCaptcha) {
             $objQuery = $this->db->prepare("SELECT SUM(session_failed_logins) as failed_logins FROM __sessions WHERE session_ip =?")->execute($this->env->ip);
             if ($objQuery && $objQuery->numRows) {
                 $arrResult = $objQuery->fetchAssoc();
                 if ($arrResult['failed_logins'] >= (int) $this->config->get('failed_logins_inactivity') - 2) {
                     $blnShowCaptcha = true;
                 }
             }
         }
     }
     //Captcha
     if ($blnShowCaptcha && $this->config->get('lib_recaptcha_pkey') && strlen($this->config->get('lib_recaptcha_pkey'))) {
         require $this->root_path . 'libraries/recaptcha/recaptcha.class.php';
         $captcha = new recaptcha();
         $this->tpl->assign_vars(array('CAPTCHA' => $captcha->get_html($this->config->get('lib_recaptcha_okey')), 'S_DISPLAY_CATPCHA' => true));
     }
     $arrPWresetLink = $this->core->handle_link($this->config->get('cmsbridge_pwreset_url'), $this->user->lang('lost_password'), $this->config->get('cmsbridge_embedded'), 'pwreset');
     $this->tpl->add_js('$("#username").focus();', 'docready');
     $this->tpl->assign_vars(array('S_USER_ACTIVATION' => $this->config->get('account_activation') == 1 ? true : false, 'REDIRECT' => isset($redirect) ? '<input type="hidden" name="redirect" value="' . base64_decode($redirect) . '" />' : ''));
     $this->core->set_vars(array('page_title' => $this->user->lang('login'), 'template_file' => 'login.html', 'display' => true));
 }
Example #3
0
 public function after_login($arrOptions)
 {
     if ($arrOptions[0] && $arrOptions[0]['user_id'] != ANONYMOUS && !$this->in->exists('lmethod')) {
         //Get Auth Account
         $arrAuthAccounts = $this->pdh->get('user', 'auth_account', array($arrOptions[0]['user_id']));
         if ($arrAuthAccounts['twofactor'] != "") {
             $data = unserialize(register('encrypt')->decrypt($arrAuthAccounts['twofactor']));
             if ($data) {
                 $cookie = $this->in->getEQdkpCookie("twofactor");
                 $cookie_secret = unserialize(register('encrypt')->decrypt($cookie));
                 if ($cookie_secret['secret'] === $data['secret'] && intval($cookie_secret['user_id']) === intval($arrOptions[0]['user_id'])) {
                     return false;
                 }
                 $this->tpl->assign_vars(array('TWOFACTOR_DATA' => register('encrypt')->encrypt(serialize($arrOptions[0]['user_id'])), 'TWOFACTOR_AUTOLOGIN' => $arrOptions[4] ? 'checked' : ''));
                 $blnShowCaptcha = false;
                 if ((int) $this->config->get('failed_logins_inactivity') - 2 > 0) {
                     if ($this->user->data['session_failed_logins'] >= (int) $this->config->get('failed_logins_inactivity') - 2) {
                         $blnShowCaptcha = true;
                     }
                     if (!$blnShowCaptcha) {
                         $objQuery = $this->db->prepare("SELECT SUM(session_failed_logins) as failed_logins FROM __sessions WHERE session_ip =?")->execute($this->env->ip);
                         if ($objQuery) {
                             $arrResult = $objQuery->fetchAssoc();
                             if ((int) $arrResult['failed_logins'] >= (int) $this->config->get('failed_logins_inactivity') - 2) {
                                 $blnShowCaptcha = true;
                             }
                         }
                     }
                 }
                 //Captcha
                 if ($blnShowCaptcha) {
                     require $this->root_path . 'libraries/recaptcha/recaptcha.class.php';
                     $captcha = new recaptcha();
                     $this->tpl->assign_vars(array('CAPTCHA' => $captcha->get_html($this->config->get('lib_recaptcha_okey')), 'S_DISPLAY_CATPCHA' => true));
                 }
                 $this->core->set_vars(array('page_title' => $this->user->lang("login_twofactor"), 'template_file' => 'twofactor_login.html', 'display' => true));
             }
         }
     }
     return false;
 }
 public function display()
 {
     $arrFields = $this->pdh->get('guildrequest_fields', 'id_list', array());
     $intGroup = 0;
     $blnGroupOpen = true;
     $this->tpl->assign_block_vars('tabs', array());
     $this->add_personal_group();
     foreach ($arrFields as $id) {
         $row = $this->pdh->get('guildrequest_fields', 'id', array($id));
         $row['options'] = unserialize($row['options']);
         //Dependency
         if ($row['dep_field'] && (strlen($row['dep_value']) && in_array($row['dep_field'], $arrFields) || $row['dep_field'] == 999999999)) {
             $this->gen_dependency($row);
         }
         //Close previous group
         if ($row['type'] == 3) {
             $blnGroupOpen = false;
             $intGroup++;
         }
         //Input
         if ($row['type'] == 0) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'FIELD' => new htext('gr_field_' . $row['id'], array('js' => 'style="width:95%"', 'value' => isset($this->data[$row['id']]) ? $this->data[$row['id']]['input'] : '')), 'REQUIRED' => $row['required'], 'HELP' => $row['help'], 'ID' => 'dl_' . $row['id']));
         }
         //Textarea
         if ($row['type'] == 1) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'FIELD' => new htextarea('gr_field_' . $row['id'], array('js' => 'style="width:95%"', 'rows' => 10, 'value' => isset($this->data[$row['id']]) ? $this->data[$row['id']]['input'] : '')), 'REQUIRED' => $row['required'], 'HELP' => $row['help'], 'ID' => 'dl_' . $row['id']));
         }
         //Select
         if ($row['type'] == 2) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $arrOptions = array();
             $arrOptions[''] = $this->user->lang('cl_ms_noneselected');
             foreach ($row['options'] as $val) {
                 $val = trim(str_replace(array("\n", "\r"), "", $val));
                 $arrOptions[$val] = $val;
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'FIELD' => new hdropdown('gr_field_' . $row['id'], array('options' => $arrOptions, 'value' => isset($this->data[$row['id']]) ? $this->data[$row['id']]['input'] : '')), 'REQUIRED' => $row['required'], 'HELP' => $row['help'], 'ID' => 'dl_' . $row['id']));
         }
         //Group Label
         if ($row['type'] == 3) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $row['name'], 'ID' => utf8_strtolower(str_replace(' ', '', $row['name'])), 'FID' => 'dl_' . $row['id']));
                 $blnGroupOpen = true;
             }
         }
         //Plain text
         if ($row['type'] == 4) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'S_NO_DIVIDER' => true, 'ID' => 'dl_' . $row['id']));
         }
         //Checkboxes
         if ($row['type'] == 5) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $field = '';
             $selected = isset($this->data[$row['id']]) ? unserialize($this->data[$row['id']]['input']) : array();
             foreach ($row['options'] as $val) {
                 $field .= new hcheckbox('gr_field_' . $row['id'] . '[' . trim($val) . ']', array('options' => array(1 => trim($val)), 'value' => isset($selected[trim($val)]) ? $selected[trim($val)] : '')) . '&nbsp;&nbsp;&nbsp;';
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'FIELD' => $field, 'REQUIRED' => $row['required'], 'HELP' => $row['help'], 'ID' => 'dl_' . $row['id']));
         }
         //Radioboxes
         if ($row['type'] == 6) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $arrOptions = array();
             foreach ($row['options'] as $val) {
                 $arrOptions[trim($val)] = trim($val);
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'FIELD' => new hradio('gr_field_' . $row['id'], array('value' => isset($this->data[$row['id']]) ? $this->data[$row['id']]['input'] : '', 'options' => $arrOptions)), 'REQUIRED' => $row['required'], 'HELP' => $row['help'], 'ID' => 'dl_' . $row['id']));
         }
         //BBCode Editor
         if ($row['type'] == 7) {
             if (!$blnGroupOpen) {
                 $this->tpl->assign_block_vars('tabs.fieldset', array('NAME' => $this->user->lang('gr_default_grouplabel'), 'ID' => 'information'));
                 $blnGroupOpen = true;
             }
             $this->tpl->assign_block_vars('tabs.fieldset.field', array('NAME' => $row['name'], 'FIELD' => new hbbcodeeditor('gr_field_' . $row['id'], array('rows' => 6, 'value' => isset($this->data[$row['id']]) ? $this->data[$row['id']]['input'] : '')), 'REQUIRED' => $row['required'], 'HELP' => $row['help'], 'ID' => 'dl_' . $row['id']));
         }
     }
     if (!$this->user->is_signedin() && $this->config->get('enable_captcha')) {
         require $this->root_path . 'libraries/recaptcha/recaptcha.class.php';
         $captcha = new recaptcha();
         $this->tpl->assign_vars(array('CAPTCHA' => $captcha->get_html($this->config->get('lib_recaptcha_okey')), 'S_DISPLAY_CATPCHA' => true));
     }
     $this->tpl->assign_vars(array('S_USERNAME_CHECK' => $this->config->get('create_account', 'guildrequest') && !$this->config->get('cmsbrige_active') ? true : false, 'S_HAS_APPLICATIONS' => $this->user->is_signedin() && count($this->pdh->get('guildrequest_requests', 'id_list', array($this->user->id))) ? true : false));
     // -- EQDKP ---------------------------------------------------------------
     $this->core->set_vars(array('page_title' => $this->user->lang('gr_add'), 'template_path' => $this->pm->get_data('guildrequest', 'template_path'), 'template_file' => 'addrequest.html', 'display' => true));
 }