/** * Show the captcha image * Refreshes the captcha image. * * @access public * @return void */ public function refreshImage() { /* INIT */ $captcha_unique_id = trim($this->request['captcha_unique_id']); /* Throw away */ $blah = $this->class_captcha->getTemplate(); require_once IPS_KERNEL_PATH . 'classAjax.php'; $ajax = new classAjax(); /* Show Image... */ $ajax->returnString($this->class_captcha->captchaKey); exit; }
/** * Perform first pass through login handler routine * * @access private * @return mixed Boolean on failure else output/redirect */ private function _doFirstPass() { //----------------------------------------- // Do the same cleaning we do when storing url //----------------------------------------- $url = trim($this->request['openid_url']); $url = rtrim($url, "/"); if (!strpos($url, 'http://') === 0 and !strpos($url, 'https://') === 0) { $url = 'http://' . $url; } if (!IPSText::xssCheckUrl($url)) { $this->auth_errors[] = 'bad_url'; $this->return_code = 'WRONG_AUTH'; return false; } $consumer = $this->_getConsumer(); if (!is_object($consumer)) { return false; } //----------------------------------------- // Store some of the input data.. //----------------------------------------- $id = md5(uniqid(mt_rand(), true)); $this->DB->delete('openid_temp', "fullurl='" . $url . "'"); $this->DB->insert('openid_temp', array('id' => $id, 'referrer' => $this->request['referer'], 'cookiedate' => intval($this->request['rememberMe']), 'privacy' => intval($this->request['anonymous']), 'fullurl' => $url)); //----------------------------------------- // Set the URLs //----------------------------------------- $openid = $url; if ($this->is_admin_auth) { $process_url = $this->settings['base_url'] . 'app=core&module=login&do=login-complete&firstpass=1&myopenid=' . $id; } else { $process_url = $this->settings['base_url'] . 'app=core&module=global§ion=login&do=process&firstpass=1&myopenid=' . $id; } $trust_root = strpos($this->settings['base_url'], '.php') !== false ? substr($this->settings['base_url'], 0, strpos($this->settings['base_url'], '.php') + 4) : $this->settings['base_url']; $policy_url = $this->openid_config['openid_policy']; //----------------------------------------- // Begin OpenID Auth //----------------------------------------- $auth_request = $consumer->begin($openid); if (!$auth_request) { $this->return_code = 'WRONG_OPENID'; $this->auth_errors[] = 'bad_request'; return false; } //----------------------------------------- // Set required, optional, policy attribs //----------------------------------------- $sreg_request = Auth_OpenID_SRegRequest::build(explode(',', $this->openid_config['args_req']), explode(',', $this->openid_config['args_opt']), $policy_url); if ($sreg_request) { $auth_request->addExtension($sreg_request); } //----------------------------------------- // Redirect user //----------------------------------------- $redirect_url = $auth_request->redirectURL($trust_root, $process_url); if ($this->request['module'] == 'ajax') { require_once IPS_KERNEL_PATH . 'classAjax.php'; $ajax = new classAjax(); $ajax->returnJsonArray(array('url' => $redirect_url)); } // If the redirect URL can't be built, try HTML inline if (!Auth_OpenID::isFailure($redirect_url)) { header("Location: " . $redirect_url); exit; } else { $form_id = 'openid_message'; $form_html = $auth_request->formMarkup($trust_root, $process_url, false, array('id' => $form_id)); // Display an error if the form markup couldn't be generated; if (Auth_OpenID::isFailure($form_html)) { $this->return_code = 'WRONG_AUTH'; $this->auth_errors[] = 'bad_request'; return false; } else { $page_contents = array("<html><head><title>", "OpenID transaction in progress", "</title></head>", "<body onload='document.getElementById(\"" . $form_id . "\").submit()'>", $form_html, "</body></html>"); print implode("\n", $page_contents); exit; } } }
/** * Reorder fields * * @access private * @return void [Outputs to screen] */ private function reorder() { //----------------------------------------- // INIT //----------------------------------------- require_once IPS_KERNEL_PATH . 'classAjax.php'; $ajax = new classAjax(); //----------------------------------------- // Checks... //----------------------------------------- if ($this->registry->adminFunctions->checkSecurityKey($this->request['md5check'], true) === false) { $ajax->returnString($this->lang->words['postform_badmd5']); exit; } //----------------------------------------- // Save new position //----------------------------------------- $position = 1; if (is_array($this->request['fields']) and count($this->request['fields'])) { foreach ($this->request['fields'] as $this_id) { $this->DB->update('pfields_data', array('pf_position' => $position), 'pf_id=' . $this_id); $position++; } } $this->rebuildCache(); $ajax->returnString('OK'); exit; }
/** * Reorders help files * * @access public * @return void */ public function helpFilesReorder() { //----------------------------------------- // INIT //----------------------------------------- require_once IPS_KERNEL_PATH . 'classAjax.php'; $ajax = new classAjax(); //----------------------------------------- // Checks... //----------------------------------------- if ($this->registry->adminFunctions->checkSecurityKey($this->request['md5check'], true) === false) { $ajax->returnString($this->lang->words['postform_badmd5']); exit; } //----------------------------------------- // Save new position //----------------------------------------- $position = 1; if (is_array($this->request['faq']) and count($this->request['faq'])) { foreach ($this->request['faq'] as $this_id) { $this->DB->update('faq', array('position' => $position), 'id=' . $this_id); $position++; } } //$this->registry->output->silentRedirect( $this->settings['base_url'] . $this->form_code ); $ajax->returnString('OK'); exit; }
/** * Displays a help file * * @access public * @return void */ public function helpShowSection() { /* Check ID */ $id = $this->request['HID'] ? intval($this->request['HID']) : 0; if (!$id) { $this->helpShowTitles(); return; } /* Query the hel topic */ $topic = $this->DB->buildAndFetch(array('select' => 'id, title, text', 'from' => 'faq', 'where' => 'id=' . $id)); if (!$topic['id']) { $this->registry->output->showError('help_no_id', 10128); } /* Load the Parser */ IPSText::getTextClass('bbcode')->bypass_badwords = 1; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass('bbcode')->parse_html = 1; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parsing_section = 'help'; $topic['text'] = IPSText::getTextClass('bbcode')->preDisplayParse($topic['text']); /* Parse out board URL */ $topic['text'] = str_replace('{board_url}', $this->settings['base_url'], $topic['text']); if ($this->request['hl']) { $topic['text'] = IPSText::searchHighlight($topic['text'], $this->request['hl']); $topic['title'] = IPSText::searchHighlight($topic['title'], $this->request['hl']); } /* Output */ $this->output .= $this->registry->output->getTemplate('help')->helpShowSection($this->lang->words['help_topic'], $this->lang->words['topic_text'], $topic['title'], $topic['text']); /* Navigation */ $this->registry->output->setTitle($this->lang->words['help_topic']); $this->registry->output->addNavigation($this->lang->words['help_topics'], "app=core&module=help"); $this->registry->output->addNavigation($this->lang->words['help_topic'], ''); if ($this->request['xml'] == 1) { require_once IPS_KERNEL_PATH . 'classAjax.php'; $classAjax = new classAjax(); $classAjax->returnHtml($this->output); } }
/** * Move an application up/down * * @access private * @return void [Outputs to screen] */ private function applicationManagePosition() { //----------------------------------------- // INIT //----------------------------------------- require_once IPS_KERNEL_PATH . 'classAjax.php'; $ajax = new classAjax(); //----------------------------------------- // Checks... //----------------------------------------- if ($this->registry->adminFunctions->checkSecurityKey($this->request['md5check'], true) === false) { $ajax->returnString($this->lang->words['postform_badmd5']); exit; } //----------------------------------------- // Save new position //----------------------------------------- $position = 1; if (is_array($this->request['apps']) and count($this->request['apps'])) { foreach ($this->request['apps'] as $this_id) { $this->DB->update('core_applications', array('app_position' => $position), 'app_id=' . $this_id); $position++; } } $this->applicationsRecache(); $this->applicationsMenuDataRecache(); $ajax->returnString('OK'); exit; }