protected function doBuild(PageContext $ctxt, PageBuilderContext $builderCtxt, RequestArrayAdapter $requestParams, ArrayAdapter $buildParams) { //1. ЗАГОЛОВОК $builderCtxt->setTitle($this->basicPage->getTitle()); //2. JAVASCRIPT $jsParams['postId'] = $ctxt->getPostId(); $jsParams['rubricId'] = $ctxt->getRubricId(); $jsParams['postType'] = $ctxt->getPostType(); $jsParams['isPostsListPage'] = $ctxt->isPostsListPage(); $jsParams['isRubricPage'] = $ctxt->isRubricPage(); $jsParams['isPostPage'] = $ctxt->isPostPage(); //Разборы, пройденные пользователем $passed = TrainManager::inst()->getUserPassedLessons(); $jsParams['passedLessons'] = empty($passed) ? null : $passed; //Структура проекта $jsParams['structure'] = NavigationManager::inst()->getStructure(); $builderCtxt->setJsParams($jsParams); //Параметры, зависимые от страницы $builderCtxt->setJsParams($this->basicPage->getJsParams()); //3. SMARTY RESOURCES $builderCtxt->setSmartyParams4Resources($this->basicPage->getSmartyParams4Resources()); //4. GET SMARTY PARAMS FOR TPL $smartyParams['host'] = ServerArrayAdapter::HTTP_HOST(); $smartyParams['content'] = BasicPagesManager::inst()->getResourcesLinks($this->basicPage->getIdent(), ContentHelper::getContent($this->basicPage)); return $smartyParams; }
protected function doBuild(PageContext $ctxt, PageBuilderContext $builderCtxt, RequestArrayAdapter $requestParams, ArrayAdapter $buildParams) { //1. ЗАГОЛОВОК $builderCtxt->setTitle('Моя страница'); //2. JAVASCRIPT $jsParams['param1'] = $ctxt->getPostId(); $jsParams['param2'] = 'My value'; $builderCtxt->setJsParams($jsParams); //3. SMARTY RESOURCES $builderCtxt->setSmartyParam4Resources('TIMELINE_ENABE', true); //4. GET SMARTY PARAMS FOR TPL $smartyParams['host'] = ServerArrayAdapter::HTTP_HOST(); return $smartyParams; }
public function send($email) { //Загружаем код пользователя по e-mail $userId = PsUser::instByMail($email)->getId(); //Генерируем код $CODE = PsUserCode::passRecover()->generateAndSave($userId); //Отправляем письмо try { $content = $this->foldedEntity->fetchTpl(array('code' => $CODE->getCode())); PsMailSender::fastSend('Восстановление пароля на ' . ServerArrayAdapter::HTTP_HOST(), $content, $email); } catch (Exception $ex) { //Коды, высланные пользователю, нужно удалить $CODE->dropUnusedCodes($userId); throw $ex; } }
/** * Метод приводит переданный URL к адресу для текущего сайта. * * PsUrl::toHttp(): http://postupayu.ru/ * PsUrl::toHttp('path.php?a=b'): http://postupayu.ru/path.php?a=b * * @param str $uri - урл адрес, добавляемый после пути * @return type */ public static function toHttp($uri = '') { if (self::isHttp($uri)) { return $uri; //--- } /* if (ServerArrayAdapter::IS_SHELL()) { return null; //Программа запущена из командной строки } */ $protocol = ServerArrayAdapter::PROTOCOL(); $host = ServerArrayAdapter::HTTP_HOST(); $host = $host ? $host : '127.0.0.1'; $port = ServerArrayAdapter::SERVER_PORT(); $port = !$port || $port == 80 || contains_substring($host, ':') ? '' : ":{$port}"; $uri = str_replace('\\', '/', trim($uri)); $uri = $uri ? ensure_starts_with($uri, '/') : ''; return "{$protocol}://{$host}{$port}{$uri}"; }
/** * Метод полностью очищает состояние отправщика писем, подготовливая его к отправке нового письма * * @return PsMailSender */ public function reset() { $this->ClearAllRecipients(); $this->ClearAttachments(); $this->ClearCustomHeaders(); $this->SetSubject(''); $this->SetBody(''); $this->SetFrom(PS_MAIL_NO_REPLY . '@' . ServerArrayAdapter::HTTP_HOST(), PS_MAIL_NO_REPLY); return $this; }
function smarty_function_PSHOST($params, Smarty_Internal_Template &$smarty) { $host = ServerArrayAdapter::HTTP_HOST(); $ucf = ArrayAdapter::inst($params)->bool('ucf'); echo $ucf ? ucfirst($host) : $host; }