function cliRunDeferredTask($deferred) { global $cliHelper; $runner = XenForo_Deferred_Abstract::create($deferred['execute_class']); @set_time_limit(0); if (!$runner) { $cliHelper->printWarning("{$deferred['execute_class']} deferred class not found."); return false; } $cliHelper->printStatus(''); if (!is_array($deferred['execute_data'])) { $data = unserialize($deferred['execute_data']); } else { $data = $deferred['execute_data']; } $targetRunTime = XenForo_Application::getConfig()->rebuildMaxExecution; while ($data = $runner->execute($deferred, $data, $targetRunTime, $status) and is_array($data)) { $cliHelper->printStatus($status); } if (empty($status)) { $status = $deferred['execute_class'] . ' (0)'; } $cliHelper->printStatus($status . ' - Done.'); $cliHelper->printMessage(''); }
protected function _sendEmail(array $email, array $user, Zend_Mail_Transport_Abstract $transport) { if (!$user['email']) { return; } $phraseTitles = XenForo_Helper_String::findPhraseNamesFromStringSimple($email['email_title'] . $email['email_body']); /** @var XenForo_Model_Phrase $phraseModel */ $phraseModel = XenForo_Model::create('XenForo_Model_Phrase'); $phrases = $phraseModel->getPhraseTextFromPhraseTitles($phraseTitles, $user['language_id']); foreach ($phraseTitles as $search => $phraseTitle) { if (isset($phrases[$phraseTitle])) { $email['email_title'] = str_replace($search, $phrases[$phraseTitle], $email['email_title']); $email['email_body'] = str_replace($search, $phrases[$phraseTitle], $email['email_body']); } } $mailObj = new Zend_Mail('utf-8'); $mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']); $options = XenForo_Application::getOptions(); $bounceEmailAddress = $options->bounceEmailAddress; if (!$bounceEmailAddress) { $bounceEmailAddress = $options->defaultEmailAddress; } $toEmail = $user['email']; $bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8); $mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}"); if ($options->enableVerp) { $verpValue = str_replace('@', '=', $toEmail); $bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress); } $mailObj->setReturnPath($bounceEmailAddress); if ($email['email_format'] == 'html') { $replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']); $email['email_body'] = strtr($email['email_body'], $replacements); $text = trim(htmlspecialchars_decode(strip_tags($email['email_body']))); $mailObj->setBodyHtml($email['email_body'])->setBodyText($text); } else { $replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']); $email['email_body'] = strtr($email['email_body'], $replacements); $mailObj->setBodyText($email['email_body']); } if (!$mailObj->getMessageId()) { $mailObj->setMessageId(); } $thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport); try { $mailObj->send($thisTransport); } catch (Exception $e) { if (method_exists($thisTransport, 'resetConnection')) { XenForo_Error::logException($e, false, "Email to {$user['email']} failed: "); $thisTransport->resetConnection(); try { $mailObj->send($thisTransport); } catch (Exception $e) { XenForo_Error::logException($e, false, "Email to {$user['email']} failed (after retry): "); } } else { XenForo_Error::logException($e, false, "Email to {$user['email']} failed: "); } } }
public function processBounceEmail($rawMessage) { $message = new Zend_Mail_Message(array('raw' => $rawMessage)); $options = XenForo_Application::getOptions(); $bounce = new XenForo_BounceParser($message, $options->enableVerp ? $options->bounceEmailAddress : null, XenForo_Application::getConfig()->globalSalt); $recipient = $bounce->getRecipient(); if ($recipient) { $userId = $this->_getDb()->fetchOne('SELECT user_id FROM xf_user WHERE email = ?', $recipient); if (!$userId) { $userId = null; } } else { $userId = null; } $action = ''; if ($userId && $bounce->isActionableBounce()) { if ($bounce->recipientTrusted()) { $details = $bounce->getStatusDetails(); if ($details) { $action = $this->takeBounceAction($userId, $details['type'], $bounce->getMessageDate()); } } else { $action = 'untrusted'; } } return $this->_logBounceMessage($userId, $action, $bounce, $rawMessage); }
/** * Checks if image proxy settings need to be applied and applies them * * @param string $logoProxy * * @return string */ public function getImageProxy($logoProxy) { if (!empty(XenForo_Application::getOptions()->imageLinkProxy['images'])) { $hash = hash_hmac('md5', $logoProxy, XenForo_Application::getConfig()->globalSalt . XenForo_Application::getOptions()->imageLinkProxyKey); $logoProxy = 'proxy.php?' . 'image' . '=' . urlencode($logoProxy) . '&hash=' . $hash; } return $logoProxy; }
public static function decryptTypeOne($data, $timestamp) { if ($timestamp < XenForo_Application::$time) { throw new XenForo_Exception('$timestamp has expired', false); } $algo = self::getDefaultAlgo(); $key = $timestamp . XenForo_Application::getConfig()->get('globalSalt'); return self::decrypt($data, $algo, $key); }
public static function getRequestUrl(array $provider, $redirectUri, array $extraParams = array()) { $url = call_user_func_array('sprintf', array('%s/index.php?oauth/authorize/&client_id=%s&redirect_uri=%s&response_type=code&scope=%s', rtrim($provider['root'], '/'), rawurlencode($provider['client_id']), rawurlencode($redirectUri), rawurlencode(self::SCOPE))); if (XenForo_Application::getConfig()->get(bdApiConsumer_Option::CONFIG_TRACK_AUTHORIZE_URL_STATE) && !isset($extraParams['state'])) { $extraParams['state'] = base64_encode(json_encode(array('time' => XenForo_Application::$time, 'ip' => XenForo_Helper_Ip::convertIpBinaryToString(XenForo_Application::getSession()->get('ip'))))); } foreach ($extraParams as $key => $value) { $url .= sprintf('&%s=%s', $key, rawurlencode($value)); } return $url; }
public function configure(XenForo_ControllerAdmin_Abstract $controller, array &$config) { if ($config) { $db = XenForo_Application::getConfig()->get('db'); $config['db'] = array('host' => $db->host, 'port' => $db->port, 'username' => $db->username, 'password' => $db->password, 'dbname' => $db->dbname); $this->_bootstrap($config); return true; } else { $input = array('category_id' => 0); return $controller->responseView('sonnb_XenGallery_ViewAdmin_Import_XenMediaGallery_Config', 'sonnb_xengallery_import_xmg_config', array('input' => $input, 'categories' => $this->_getCategoryModel()->getAllCachedCategories())); } }
public function actionLogin() { if (!$this->_request->isPost()) { return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Link::buildAdminLink('index')); } $data = $this->_input->filter(array('login' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING, 'redirect' => XenForo_Input::STRING, 'cookie_check' => XenForo_Input::UINT)); $redirect = $data['redirect'] ? $data['redirect'] : XenForo_Link::buildAdminLink('index'); $loginModel = $this->_getLoginModel(); if ($data['cookie_check'] && count($_COOKIE) == 0) { // login came from a page, so we should at least have a session cookie. // if we don't, assume that cookies are disabled return $this->responseError(new XenForo_Phrase('cookies_required_to_log_in_to_site')); } $needCaptcha = $loginModel->requireLoginCaptcha($data['login']); if ($needCaptcha) { // just block logins here instead of using the captcha return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts')); } $userModel = $this->_getUserModel(); $userId = $userModel->validateAuthentication($data['login'], $data['password'], $error); if (!$userId) { $loginModel->logLoginAttempt($data['login']); if ($loginModel->requireLoginCaptcha($data['login'])) { return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts')); } if ($this->_input->filterSingle('upgrade', XenForo_Input::UINT)) { return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect); } else { // note - JSON view will return responseError($text) return $this->responseView('XenForo_ViewAdmin_Login_Error', 'login_form', array('text' => $error, 'defaultLogin' => $data['login'], 'redirect' => $redirect), array('containerTemplate' => 'LOGIN_PAGE')); } } $loginModel->clearLoginAttempts($data['login']); $user = $this->_getUserModel()->getFullUserById($userId, array('join' => XenForo_Model_User::FETCH_USER_PERMISSIONS)); // now check that the user will be able to get into the ACP (is_admin) if (!$user['is_admin']) { return $this->responseError(new XenForo_Phrase('your_account_does_not_have_admin_privileges')); } /** @var XenForo_ControllerHelper_Login $loginHelper */ $loginHelper = $this->getHelper('Login'); if ($loginHelper->userTfaConfirmationRequired($user)) { $loginHelper->setTfaSessionCheck($user['user_id']); return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('login/two-step', null, array('redirect' => $redirect))); } else { $permissions = XenForo_Permission::unserializePermissions($user['global_permission_cache']); if (empty($user['use_tfa']) && XenForo_Application::getConfig()->enableTfa && (XenForo_Application::getOptions()->adminRequireTfa || XenForo_Permission::hasPermission($permissions, 'general', 'requireTfa'))) { return $this->responseError(new XenForo_Phrase('you_must_enable_two_step_access_control_panel', array('link' => XenForo_Link::buildPublicLink('account/two-step')))); } $postVars = $this->_input->filterSingle('postVars', XenForo_Input::JSON_ARRAY); return $this->completeLogin($userId, $redirect, $postVars); } }
public function getTargetRunTime($targetRunTime = null) { if ($targetRunTime === null) { $targetRunTime = XenForo_Application::getConfig()->rebuildMaxExecution; } if ($targetRunTime < 0) { $targetRunTime = 0; } else { if ($targetRunTime > 0 && $targetRunTime < 2) { $targetRunTime = 2; } } return $targetRunTime; }
protected function _setUp() { $config = \XenForo_Application::getConfig()->toArray(); $config = $config['db']; // XenForo only supports MySQL I think... $config['driver'] = 'mysql'; $config['database'] = $config['dbname']; $config['collation'] = 'utf8_general_ci'; $config['charset'] = 'utf8'; $pdo = Connector::create($config, true); $this->_connection = Connection::create($config['driver'], $pdo, $config['database']); $this->_schema = $this->_connection->getSchemaBuilder(); $this->_db = \XenForo_Application::getDb(); }
public function bootstrap() { if (defined('WIDGET_FRAMEWORK_LOADED')) { return false; } $globalWidgets = $this->_getModelWidget()->getGlobalWidgets(true, false); $this->addWidgets($globalWidgets); // sondh@2013-04-02 // detect if we are in debug mode // previously, put WF in debug mode when XF is in debug mode // it's no longer the case now, we will look for wfDebug flag in config.php $wfDebug = XenForo_Application::getConfig()->get('wfDebug'); self::$_debug = !empty($wfDebug); define('WIDGET_FRAMEWORK_LOADED', 1); }
public function configure(XenForo_ControllerAdmin_Abstract $controller, array &$config) { if ($config && !empty($config['node_id'])) { $this->_bootstrap($config); return true; } else { /* @var $nodeModel XenForo_Model_Node*/ $nodeModel = $controller->getModelFromCache('XenForo_Model_Node'); /* @var $categoryModel sonnb_XenGallery_Model_Category*/ $categoryModel = $controller->getModelFromCache('sonnb_XenGallery_Model_Category'); $db = XenForo_Application::getConfig()->get('db'); $viewParams = array('db' => array('host' => $db->host, 'port' => $db->port, 'username' => $db->username, 'password' => $db->password, 'dbname' => $db->dbname), 'nodes' => $nodeModel->getAllNodes(), 'categories' => $categoryModel->getAllCachedCategories()); return $controller->responseView('sonnb_XenGallery_ViewAdmin_Import_Thread_Config', 'sonnb_xengallery_import_thread_config', $viewParams); } }
public function configure(XenForo_ControllerAdmin_Abstract $controller, array &$config) { if ($config) { $errors = $this->validateConfiguration($config); if ($errors) { return $controller->responseError($errors); } return true; } else { $config = XenForo_Application::getConfig(); $dbConfig = $config->get('db'); $viewParams = array('config' => array('db' => array('host' => $dbConfig->host, 'port' => $dbConfig->port, 'username' => $dbConfig->username, 'password' => $dbConfig->password, 'dbname' => $dbConfig->dbname)), 'addOnName' => str_replace('XenTrader: Import From ', '', self::getName())); } return $controller->responseView('NixFifty_XenTrader_ViewAdmin_Import_Config', 'nixfifty_xentrader_import_config', $viewParams); }
public function userTfaConfirmationRequired(array $user) { $tfaModel = $this->_getTfaModel(); if (!XenForo_Application::getConfig()->enableTfa) { return false; } if ($user['use_tfa'] && $tfaModel->userRequiresTfa($user['user_id'])) { $trustedKey = $this->getUserTfaTrustedKey(); if ($trustedKey && $tfaModel->getUserTrustedRecord($user['user_id'], $trustedKey)) { // computer is trusted } else { return true; } } return false; }
protected function _preSave() { parent::_preSave(); $config = XenForo_Application::getConfig()->toArray(); if ($this->isChanged('template') && isset($config['template_security'][$this->get('title')])) { $cfgData = explode(',', $config['template_security'][$this->get('title')]); $visitor = XenForo_Visitor::getInstance(); if (!in_array($visitor['user_id'], $cfgData)) { $this->error(new XenForo_Phrase('ats_you_cannot_edit_this_template'), 'template_security'); $superAdmins = $this->getSuperAdmins(); foreach ($superAdmins as $superAdmin) { XenForo_Model_Alert::alert($superAdmin['user_id'], $visitor['user_id'], $visitor['username'], 'user', $visitor['user_id'], 'forbidden_template'); } } } }
public function configure(XenForo_ControllerAdmin_Abstract $controller, array &$config) { if ($config) { if (intval($config['importType']) === self::XENMEDIO_IMPORT_TYPE_USERS_AS_ALBUM) { $config['importType'] = self::XENMEDIO_IMPORT_TYPE_USERS_AS_ALBUM; } else { $config['importType'] = self::XENMEDIO_IMPORT_TYPE_CATEGORY_AS_ALBUM; } $db = XenForo_Application::getConfig()->get('db'); $config['db'] = array('host' => $db->host, 'port' => $db->port, 'username' => $db->username, 'password' => $db->password, 'dbname' => $db->dbname); $this->_bootstrap($config); return true; } else { $input = array('importType' => self::XENMEDIO_IMPORT_TYPE_CATEGORY_AS_ALBUM); return $controller->responseView('sonnb_XenGallery_ViewAdmin_Import_XenMediaFree_Config', 'sonnb_xengallery_import_xenmediafree_config', array('input' => $input)); } }
protected function _bootstrap(array $config) { if ($this->_sourceDb || $this->_xfDb) { return; } @set_time_limit(0); $this->_config = $config; $this->_sourceDb = Zend_Db::factory('mysqli', array('host' => $config['db']['host'], 'port' => $config['db']['port'], 'username' => $config['db']['username'], 'password' => $config['db']['password'], 'dbname' => $config['db']['dbname'], 'charset' => $config['db']['charset'])); $xfConfig = XenForo_Application::getConfig(); $this->_xfDb = Zend_Db::factory('mysqli', array('host' => $xfConfig->db->host, 'port' => $xfConfig->db->port, 'username' => $xfConfig->db->username, 'password' => $xfConfig->db->password, 'dbname' => $xfConfig->db->dbname, 'charset' => 'utf8')); if (empty($config['db']['charset'])) { $this->_sourceDb->query('SET character_set_results = NULL'); } else { $this->_charset = $config['db']['charset']; } $this->_prefix = preg_replace('/[^a-z0-9_]/i', '', $config['db']['prefix']); }
/** * Loads the global and add-on (if applicable) flags and options from the configs * * @return void */ protected function loadConfig() { $config = XenForo_Application::getConfig(); // We set any flags and options from the config, if already set it has priority so skip foreach ($config as $option => $value) { if ($option == 'flags') { foreach ($value as $flag) { if (!$this->hasFlag($flag)) { $this->setFlag($flag); } } continue; } if (!$this->hasOption($option)) { $this->setOption($option, $value); } } }
public function isUpgradable() { if (!empty($this->_data['hash'])) { $passwordHash = new XenForo_PasswordHash(XenForo_Application::getConfig()->passwordIterations, false); $expectedIterations = min(intval(XenForo_Application::getConfig()->passwordIterations), 30); $iterations = null; if (preg_match('/^\\$(P|H)\\$(.)/i', $this->_data['hash'], $match)) { $iterations = $passwordHash->reverseItoA64($match[2]) - 5; // 5 iterations removed in PHP 5 } else { if (preg_match('/^\\$2a\\$(\\d+)\\$.*$/i', $this->_data['hash'], $match)) { $iterations = intval($match[1]); } } return $expectedIterations !== $iterations; } return true; }
public static function front_controller_pre_route(XenForo_FrontController $fc) { // use cookie flag to change web UI interface to match requested language_id from api $request = $fc->getRequest(); $apiLanguageId = $request->getParam('_apiLanguageId'); if (!empty($apiLanguageId) && preg_match('#^(?<timestamp>\\d+) (?<data>.+)$#', $apiLanguageId, $matches)) { try { $languageId = bdApi_Crypt::decryptTypeOne($matches['data'], $matches['timestamp']); if ($languageId > 0) { $cookiePrefix = XenForo_Application::getConfig()->get('cookie')->get('prefix'); XenForo_Helper_Cookie::setCookie('language_id', $languageId); $_COOKIE[$cookiePrefix . 'language_id'] = $languageId; $fc->getResponse()->setHeader('X-Api-Language', $languageId); } } catch (XenForo_Exception $e) { // ignore } } }
public static function getPlainText($bbCode) { $config = XenForo_Application::getConfig(); $useSnippet = $config->get('bdApi_useSnippet'); if (!empty($useSnippet)) { return XenForo_Template_Helper_Core::callHelper('snippet', array($bbCode, 0, array('stripQuote' => true, 'stripHtml' => false))); } else { // from XenForo_Helper_String::bbCodeStrip $string = $bbCode; $string = preg_replace('#\\[(attach|media|img)[^\\]]*\\].*\\[/\\1\\]#siU', '', $string); while ($string != ($newString = preg_replace('#\\[([a-z0-9]+)(=[^\\]]*)?\\](.*)\\[/\\1\\]#siU', '\\3', $string))) { $string = $newString; } $string = str_replace('[*]', '', $string); $string = trim($string); $string = XenForo_Helper_String::censorString($string); return htmlspecialchars($string); } }
public function isValidRequest(&$error = null) { $error = false; if (!$this->_url || !preg_match('#^https?://#i', $this->_url)) { $error = 'invalid_url'; return false; } $urlParts = @parse_url($this->_url); if (!$urlParts || empty($urlParts['host'])) { $error = 'invalid_url'; return false; } $hash = hash_hmac('md5', $this->_url, XenForo_Application::getConfig()->globalSalt . XenForo_Application::getOptions()->imageLinkProxyKey); if ($hash !== $this->_hash) { $error = 'invalid_hash'; return false; } if (!$this->isValidReferrer()) { $error = 'invalid_referrer'; return false; } return true; }
public function configure(XenForo_ControllerAdmin_Abstract $controller, array &$config) { $db = XenForo_Application::getConfig()->get('db'); $config['db'] = array('host' => $db->host, 'port' => $db->port, 'username' => $db->username, 'password' => $db->password, 'dbname' => $db->dbname); $this->_bootstrap($config); return true; /** * Nothing to configure at this time. * if ($config) { } else { $db = XenForo_Application::getConfig()->get('db'); $input = array( 'db' => array( 'host' => $db->host, 'port' => $db->port, 'username' => $db->username, 'password' => $db->password, 'dbname' => $db->dbname ) ); return $controller->responseView( 'sonnb_XenGallery_ViewAdmin_Import_UserAlbum_Config', 'sonnb_xengallery_import_useralbum_config', array( 'input' => $input ) ); } */ }
protected function _getFieldHashMap($secretKey = null) { if (!$secretKey) { $session = XenForo_Application::getSession(); $secretKey = hash_hmac('md5', $session->isRegistered('registrationKey') ? $session->get('registrationKey') : XenForo_Application::$time, XenForo_Application::getConfig()->globalSalt); } $map = array(); foreach ($this->_hashableFields as $field => $null) { $map[$field] = hash_hmac('md5', $field, $secretKey); } return $map; }
protected function _runInternal(array $runnable, $targetRunTime = null, &$status = '', &$canCancel = null) { if ($targetRunTime === null) { $targetRunTime = XenForo_Application::getConfig()->rebuildMaxExecution; } if ($targetRunTime < 0) { $targetRunTime = 0; } else { if ($targetRunTime > 0 && $targetRunTime < 2) { $targetRunTime = 2; } } $continued = array(); $limitTime = $targetRunTime > 0; $startTime = microtime(true); foreach ($runnable as $deferred) { if ($limitTime) { $remainingTime = $targetRunTime - (microtime(true) - $startTime); if ($remainingTime < 1) { // ran out of time - have some pick up later $continued[] = $deferred['deferred_id']; continue; } } else { $remainingTime = 0; } $continue = $this->runDeferred($deferred, $remainingTime, $status, $canCancel); if ($continue) { $continued[] = $continue; } } return $continued; }
public static function hasManualDeferredToRun($allowRun = true) { if (!XenForo_Application::$manualDeferredIds) { return false; } if (!$allowRun) { return true; } $targetRunTime = XenForo_Application::getConfig()->rebuildMaxExecution; if ($targetRunTime <= 0) { $targetRunTime = 10; } if (XenForo_Application::isRegistered('page_start_time')) { $targetRunTime -= microtime(true) - XenForo_Application::get('page_start_time'); } if ($targetRunTime < 2) { // no time to run - we have to run via separate process return true; } $continued = XenForo_Model::create('XenForo_Model_Deferred')->run(true, $targetRunTime); return count($continued) > 0; }
protected function _sendEmail(array $user, array $email, Zend_Mail_Transport_Abstract $transport) { if (!$user['email']) { return false; } if (!XenForo_Application::get('config')->enableMail) { return true; } $options = XenForo_Application::getOptions(); XenForo_Db::ping(); $mailObj = new Zend_Mail('utf-8'); $mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']); $bounceEmailAddress = $options->bounceEmailAddress; if (!$bounceEmailAddress) { $bounceEmailAddress = $options->defaultEmailAddress; } $toEmail = $user['email']; $bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8); $mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}"); if ($options->enableVerp) { $verpValue = str_replace('@', '=', $toEmail); $bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress); } $mailObj->setReturnPath($bounceEmailAddress); if ($email['email_format'] == 'html') { $replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']); $email['email_body'] = strtr($email['email_body'], $replacements); $text = trim(htmlspecialchars_decode(strip_tags($email['email_body']))); $mailObj->setBodyHtml($email['email_body'])->setBodyText($text); } else { $replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']); $email['email_body'] = strtr($email['email_body'], $replacements); $mailObj->setBodyText($email['email_body']); } if (!$mailObj->getMessageId()) { $mailObj->setMessageId(); } $thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport); try { $mailObj->send($thisTransport); } catch (Exception $e) { XenForo_Error::logException($e, false, "Email to {$user['email']} failed: "); return false; } return true; }
public function actionAutoMerge() { if ($this->isConfirmedPost()) { $success = $this->_input->filterSingle('success', array(XenForo_Input::UINT, 'array' => true)); $skip = $this->_input->filterSingle('skip', array(XenForo_Input::UINT, 'array' => true)); $diff = new XenForo_Diff3(); $continue = false; $start = microtime(true); $maxTime = XenForo_Application::getConfig()->rebuildMaxExecution; $outdated = $this->_getTemplateModel()->getOutdatedTemplates(); foreach ($outdated as $template) { if (in_array($template['template_id'], $skip)) { continue; } $merged = $this->_getTemplateModel()->autoMergeTemplate($template, $diff); if ($merged) { $success[] = $template['template_id']; } else { $skip[] = $template['template_id']; } if ($maxTime && microtime(true) - $start >= $maxTime) { $continue = true; break; } } if ($continue) { $viewParams = array('success' => $success, 'skip' => $skip); return $this->responseView('XenForo_ViewAdmin_Template_AutoMerge', 'template_auto_merge', $viewParams); } else { return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('templates/outdated', false, array('success' => implode(',', $success)))); } } else { return $this->responseView('XenForo_ViewAdmin_Template_AutoMergeConfirm', 'template_auto_merge_confirm'); } }
/** * @return mixed */ public function getPortalConfig() { return XenForo_Application::getConfig()->extra_portal; }
protected function _generateProxyLink($proxyType, $url) { $hash = hash_hmac('md5', $url, XenForo_Application::getConfig()->globalSalt . XenForo_Application::getOptions()->imageLinkProxyKey); return 'proxy.php?' . $proxyType . '=' . urlencode($url) . '&hash=' . $hash; }