public function build($runData) { if (!$runData->getUser()) { $runData->setModuleTemplate('account/AccountNotLoggedInModule'); return; } $user = $runData->getUser(); $runData->contextAdd("user", $user); $pl = $runData->getParameterList(); $start = $pl->getParameterValue("start"); if ($start) { $runData->contextAdd("start", $start); } $composeTo = $pl->getParameterValue("composeto"); if ($composeTo) { $runData->contextAdd("composeTo", $composeTo); } $inboxMessage = $pl->getParameterValue("inboxmessage"); if ($inboxMessage) { $runData->contextAdd("inboxMessage", $inboxMessage); } // put the key too $runData->contextAdd("rsaKey", CryptUtils::modulus()); $this->extraJs[] = '/common--javascript/crypto/rsa.js'; }
public function build($runData) { $userId = $runData->getUserId(); if ($userId !== null) { throw new ProcessException(_("You already are logged in."), "already_logged"); } $runData->ajaxResponseAdd("key", CryptUtils::modulus()); $runData->sessionStart(); $seed = CryptUtils::generateSeed(10); $runData->sessionAdd("login_seed", $seed); $this->extraJs[] = '/common--javascript/crypto/rsa.js'; }
public function build($runData) { $pl = $runData->getParameterList(); $url = $pl->getParameterValue('url'); $siteId = $pl->getParameterValue('siteId'); if ($siteId && is_numeric($siteId)) { $site = DB_SitePeer::instance()->selectByPrimaryKey($siteId); } if (!$site) { throw new ProcessException(_('Invalid site')); } $runData->setLanguage($site->getLanguage()); $GLOBALS['lang'] = $site->getLanguage(); // and for gettext too: $lang = $site->getLanguage(); switch ($lang) { case 'pl': $glang = "pl_PL"; break; case 'en': $glang = "en_US"; break; } putenv("LANG={$glang}"); putenv("LANGUAGE={$glang}"); setlocale(LC_ALL, $glang . '.UTF-8'); // Set the text domain as 'messages' $gdomain = 'messages'; bindtextdomain($gdomain, WIKIDOT_ROOT . '/locale'); textdomain($gdomain); $themeId = $pl->getParameterValue('themeId'); if ($themeId && is_numeric($themeId)) { $theme = DB_ThemePeer::instance()->selectByPrimaryKey($themeId); } if (!$theme) { throw new ProcessException(_('Invalid theme')); } $runData->contextAdd('site', $site); $runData->contextAdd('theme', $theme); $runData->contextAdd('url', $url); $seed = CryptUtils::generateSeed(4); // put seed into session! $runData->sessionStart(); $runData->sessionAdd("login_seed", $seed); $runData->contextAdd("key", CryptUtils::modulus()); $runData->contextAdd("seed", $seed); // clear welcome cookie? if ($pl->getParameterValue("clearwelcome")) { $runData->contextAdd('reset', true); } }
public function build($runData) { $code = $runData->sessionGet('captchaCode'); $runData->ajaxResponseAdd("key", CryptUtils::modulus()); if ($code === null) { srand((double) microtime() * 1000000); $string = md5(rand(0, 9999)); $code = substr($string, 2, 4); $code = str_replace('0', 'O', $code); $code = strtoupper($code); $runData->sessionAdd("captchaCode", $code); } $runData->contextAdd("rand", rand(0, 1000)); $runData->sessionAdd("rstep", 0); $this->extraJs[] = '/common--javascript/crypto/rsa.js'; }
public function build($runData) { $runData->sessionAdd("rstep", -1); // get terms of service. // also set the crypto things $runData->ajaxResponseAdd("key", CryptUtils::modulus()); // get the TOS content $pageName = "legal:terms-of-service"; $siteName = "www"; $c = new Criteria(); $c->add("unix_name", $siteName); $site = DB_SitePeer::instance()->selectOne($c); $page = DB_PagePeer::instance()->selectByName($site->getSiteId(), $pageName); // get content $content = $page->getCompiled()->getText(); // remove toc ;-) $content = preg_replace(';<table style=".*?id="toc".*?</table>;s', '', $content, 1); $content = preg_replace(';<a ([^>]*)>;s', '<a \\1 target="_blank">', $content); $runData->contextAdd("tosContent", $content); }