public function initialize() { Tag::prependTitle('Fireball | '); $this->assets->collection('style')->addCss('third-party/css/bootstrap.min.css', false, false)->addCss('css/style.css')->setTargetPath('css/production.css')->setTargetUri('css/production.css')->join(true)->addFilter(new \Phalcon\Assets\Filters\Cssmin()); //takes the js or css files and combines / minifies them for faster page loads $this->assets->collection('js')->addJs('third-party/js/jquery-1.12.0.min.js', false, false)->addJs('third-party/js/bootstrap.min.js', false, false)->setTargetPath('js/production.js')->setTargetUri('js/production.js')->join(true)->addFilter(new \Phalcon\Assets\Filters\Jsmin()); }
public function initialize() { $this->view->setTemplateAfter('main'); $this->view->hdr = 'Купоны'; Tag::setTitle('Coupons Panel'); parent::initialize(); }
public function initialize() { \Phalcon\Tag::setTitle('登录'); parent::initialize(); $this->view->setTemplateAfter('login_register'); $this->operation = new UserOperation($this->di); }
public function editAction($id) { $fileStore = FileStore::findFirst($id); if ($fileStore == false) { $this->flash->error(_("Document was not found")); return $this->dispatcher->forward(array('action' => 'index')); } $request = $this->request; $userId = $this->auth->getIdentity(); $form = new FileStoreForm($fileStore, array('edit' => true)); if ($request->isPost()) { if ($form->isValid($request->getPost()) == true && $request->hasFiles() == true) { $fileStore = new FileStore(); foreach ($request->getUploadedFiles() as $file) { $fileStore->assign(array('id' => $id, 'fileName' => $file->getName(), 'fileCaption' => $request->getPost('fileCaption'), 'description' => $request->getPost('description'), 'categoriesId' => $request->getPost('categoriesId'), 'userId' => $userId['id'], 'mimeType' => $file->getType(), 'fileData' => file_get_contents($file->getTempName()))); if ($fileStore->update() == true) { $this->flash->success(_("Update Document success")); Tag::resetInput(); return $this->dispatcher->forward(array('action' => 'index')); } $this->flash->error($fileStore->getMessages()); } } } $this->view->form = $form; }
/** * The index action */ public function indexAction() { if (!$this->request->isPost()) { Tag::setDefault('username', '*****@*****.**'); Tag::setDefault('password', 'hhf'); } }
public function verifyAction($code) { if ($code) { $results = VerifyEmail::FindFirst("verifyCode = '" . $code . "'"); if (!isset($results->cid)) { return $this->response->redirect("index/index"); } $form = new RegisterForm(); if (isset($results) && $results != '') { if ($results->active == 'Y') { if (md5($results->time . '+' . $results->email) == $code) { $this->view->form = $form; Tag::setDefault('password', null); Tag::setDefault('cid', $results->cid); Tag::setDefault('email', $results->email); $this->view->setVar("email", $results->email); } else { $this->flash->error('邮箱验证错误!'); $this->response->redirect("account/index"); } } else { $this->flash->error('邮箱已经验证通过,请登录!'); $this->response->redirect("account/index"); } } else { $this->flash->error('验证码已过期!'); $this->response->redirect("index/index"); } } else { $this->response->redirect("index/index"); } }
/** * Prints the HTML for CSS resources * * @param string $collectionName the name of the collection * * @return string the result of the collection **/ public function outputCss($collectionName = null) { $collection = $this->collection($collectionName); if ($collection->getJoin()) { $filename = $collection->getTargetPath(); if (file_exists($filename)) { $time = 0; foreach ($collection->getResources() as $resource) { $tmp = filemtime($resource->getRealTargetPath()); if ($tmp > $time) { $time = $tmp; } } // If created if (filemtime($filename) > $time) { $collection->setTargetUri($collection->getTargetUri() . '?' . filemtime($filename)); return Tag::stylesheetLink($collection->getTargetUri()); } } // Else CREATE $res = parent::outputCss($collectionName); return $res; } return parent::outputCss($collectionName); }
public function statisticAction() { $id = $this->dispatcher->getParam('id'); $banner = Banners::findFirst($id); if ($id && $banner && $banner->advertiser_id == $this->auth->get_user()->id) { $this->assets->collection('bottom-js')->addJs('js/moment/moment.min.js')->addJs('js/moment/ru.js')->addJs('js/datetimepicker/js/bootstrap-datetimepicker.js'); $this->assets->collection('css')->addCss('js/datetimepicker/css/bootstrap-datetimepicker.min.css'); if (!$this->request->getQuery('start_date')) { if (!empty($banner->start_date)) { $start_date = $banner->start_date; } else { $first_view = $banner->views->getFirst()->date; if (!empty($first_view)) { $start_date = $first_view; } else { $start_date = 0; } } } else { $start_date = date_parse_from_format('d.m.Y H:i', $this->request->getQuery('start_date')); $start_date = mktime($start_date['hour'], $start_date['minute'], 0, $start_date['month'], $start_date['day'], $start_date['year']); } if (!$this->request->getQuery('end_date')) { if (!empty($banner->end_date)) { if ($banner->end_date > time()) { $end_date = time(); } else { $end_date = $banner->end_date; } } else { $end_date = time(); } } else { $end_date = date_parse_from_format('d.m.Y H:i', $this->request->getQuery('end_date')); $end_date = mktime($end_date['hour'], $end_date['minute'], 0, $end_date['month'], $end_date['day'], $end_date['year']); } $days = floor(($end_date + 10800) / 86400) - floor(($start_date + 10800) / 86400) + 1; $days_arr = []; if ($days > 0) { for ($i = 0; $i < $days; $i++) { $day = floor(($start_date + 10800) / 86400) * 86400 + $i * 86400 - 10800; if ((!empty($banner->start_date) ? $day >= floor(($banner->start_date + 10800) / 86400) * 86400 - 10800 : true) && $day < (!empty($banner->end_date) ? $banner->end_date : time())) { $days_arr[] = array('date' => $day, 'views' => $banner->countViews("date >= {$day} AND date < " . ($day + 86400)), 'clicks' => $banner->countViews("date >= {$day} AND date < " . ($day + 86400) . " AND clicked = 1")); } } } $this->view->days = $days_arr; $q = "date >= {$start_date} AND date <= {$end_date}"; $this->view->views = $banner->countViews(array($q)); $q .= " AND clicked = 1"; $this->view->clicks = $banner->countViews(array($q)); $this->view->start_date = $start_date; $this->view->end_date = $end_date; $this->view->banner = $banner; $this->view->title = "Статистика для баннера \"{$banner->name}\""; \Phalcon\Tag::prependTitle("Статистика для баннера \"{$banner->name}\""); } else { $this->dispatcher->forward(array("namespace" => 'App\\Controllers', "controller" => "error", "action" => "notFound")); } }
public function profileAction() { $auth = $this->session->get('auth'); $user = Users::findFirst($auth['id']); if ($user == false) { $this->_forward('index/index'); } $request = $this->request; if (!$request->isPost()) { Tag::setDefault('name', $user->name); Tag::setDefault('email', $user->email); } else { $name = $request->getPost('name', 'string'); $email = $request->getPost('email', 'email'); $name = strip_tags($name); $user->name = $name; $user->email = $email; if ($user->save() == false) { foreach ($user->getMessages() as $message) { $this->flash->error((string) $message); } } else { $this->flash->success('更新成功'); } } }
public function initialize() { Tag::setTitle('About'); parent::initialize(); $this->_bc->add('About', 'about'); $this->view->setVar('menus', $this->constructMenu($this)); }
public function run() { $this->assets->outputCss(); $this->assets->outputJs(); echo Tag::textArea(array("{$this->id}", "name" => "{$this->name}")); echo '<div class="hint"><a onclick="return setupElrteEditor(\'' . $this->id . '\', this, \'' . $this->theme . '\', \'' . $this->height . '\');">WYSIWYG</a></div>'; }
protected function initialize() { \Phalcon\Tag::prependTitle('PRIME | '); $this->view->setViewsDir('../app/views/'); $this->view->setLayoutsDir('/layouts/'); $this->view->setTemplateAfter('main'); }
public function initialize() { $this->view->setTemplateAfter('main'); $this->view->hdr = 'Заказы'; Tag::setTitle('Orders Panel'); parent::initialize(); }
public function run() { $faker = Faker::create(); $log = new Stream('php://stdout'); $log->info('Start ' . __CLASS__); /** @var Phalcon\Db\AdapterInterface $database */ $database = $this->getDI()->get('db'); $database->begin(); for ($i = 0; $i <= self::TAGS_TOTAL; $i++) { $title = $faker->company; $description = $faker->text; $tags = new Tags(); $tags->name = $title; $tags->slug = \Phalcon\Tag::friendlyTitle($title); $tags->numberPosts = 0; $tags->noBounty = 'N'; $tags->noDigest = 'N'; $tags->description = $description; if (!$tags->save()) { var_dump($tags->getMessages()); $database->rollback(); die; } $log->info('tags: ' . $tags->getName()); } }
/** * Starts a session in the admin backend */ public function loginAction() { \Phalcon\Tag::appendTitle(" - Вход"); $form = new LoginForm(); try { if (!$this->request->isPost()) { if ($this->auth->hasRememberMe()) { return $this->auth->loginWithRememberMe(); } } else { if ($form->isValid($this->request->getPost()) == false) { foreach ($form->getMessages() as $message) { $this->flash->error($message); } } else { $this->auth->check(array('email' => $this->request->getPost('email', 'email'), 'password' => $this->request->getPost('password'), 'remember' => $this->request->getPost('remember'))); $auth = $this->session->get('auth'); $this->flashSession->notice($auth['role']); if (!$auth) { $this->flashSession->notice("Нужно войти или зарегистрироваться"); return $this->response->redirect("session/login"); } if ($auth['role'] == 'Administrators') { $this->flashSession->success("Здравствуйте администратор. Вы находитесь в области управления сайтом, в разделе Новости."); return $this->response->redirect("backend/news"); } return $this->response->redirect(); } } } catch (AuthException $e) { $this->flash->error($e->getMessage()); } $this->view->form = $form; }
/** * 初始化 */ protected function initialize() { parent::initialize(); //Prepend the application name to the title \Phalcon\Tag::prependTitle('Blog | '); $this->view->setTemplateAfter('common'); }
public function registerAction() { $request = $this->request; if ($request->isPost()) { $name = $request->getPost('name', array('string', 'striptags')); $username = $request->getPost('username', 'alphanum'); $email = $request->getPost('email', 'email'); $password = $request->getPost('password'); $repeatPassword = $this->request->getPost('repeatPassword'); if ($password != $repeatPassword) { $this->flash->error('Passwords are diferent'); return false; } $user = new Users(); $user->username = $username; $user->password = sha1($password); $user->name = $name; $user->email = $email; $user->created_at = new Phalcon\Db\RawValue('now()'); $user->active = 'Y'; if ($user->save() == false) { foreach ($user->getMessages() as $message) { $this->flash->error((string) $message); } } else { Tag::setDefault('email', ''); Tag::setDefault('password', ''); $this->flash->success('Thanks for sign-up, please log-in to start generating invoices'); return $this->forward('session/index'); } } }
/** * Renders the element widget returning html * * @param array|null $attributes * @return string * @throws Exception */ public function render($attributes = null) { if (is_array($attributes) === false && is_null($attributes) === false) { throw new Exception('Invalid parameter type.'); } return Tag::numericField($this->prepareAttributes($attributes)); }
public function initialize() { $this->view->setTemplateAfter('main'); $this->view->hdr = 'Интер.'; Tag::setTitle('Internationalization Panel'); parent::initialize(); }
public function initialize() { $this->view->setTemplateAfter('main'); $this->view->hdr = 'Мастера'; Tag::setTitle('Makers Panel'); parent::initialize(); }
public function initialize() { // $this->view->setTemplateAfter('main'); Resource::init($this->assets); Tag::setTitle('Welcome'); parent::initialize(); }
public function indexAction() { if (!$this->request->isPost()) { Tag::setDefault('email', ' '); Tag::setDefault('password', ''); } }
public function run() { $faker = Faker::create(); $log = new Stream('php://stdout'); $log->info('Start ' . __CLASS__); /** @var Phalcon\Db\AdapterInterface $database */ $database = $this->getDI()->get('db'); $userIds = Users::find(['columns' => 'id'])->toArray(); $database->begin(); for ($i = 0; $i <= self::POSTS_TOTAL; $i++) { $title = $faker->company; $userRandId = array_rand($userIds); $posts = new Posts(); $posts->usersId = $userIds[$userRandId]['id']; $posts->type = rand(0, 1) ? 'questions' : 'tips'; $posts->title = $title; $posts->slug = \Phalcon\Tag::friendlyTitle($title); $posts->numberViews = rand(5, 100); $posts->numberReply = rand(0, 20); $posts->content = $faker->text; $posts->sticked = 'N'; $posts->status = 'A'; $posts->locked = 'N'; $posts->deleted = 0; $posts->acceptedAnswer = 'N'; if (!$posts->save()) { var_dump($posts->getMessages()); $database->rollback(); die; } $log->info('posts: ' . $posts->getTitle()); } }
public function indexAction() { if (!$this->request->isPost()) { Tag::setDefault('email', '*****@*****.**'); Tag::setDefault('password', 'phalcon'); } }
/** * Signed in users can change their password */ public function changePasswordAction() { $user = $this->auth->getUser(); if ($user === false) { $this->flash->success($this->translate->gettext('You must be signed in to change the password')); return $this->dispatcher->forward(['controller' => 'index', 'action' => 'notification']); } $form = new ChangePasswordForm(); $form->setDI($this->getDI()); if ($this->request->isPost()) { if ($form->isValid($this->request->getPost()) !== false) { $user->password = $this->request->getPost('password'); $user->mustChangePassword = '******'; $passwordChange = new PasswordChanges(); $passwordChange->user = $user; $passwordChange->ipAddress = $this->request->getClientAddress(); $passwordChange->userAgent = $this->request->getUserAgent(); if ($passwordChange->save()) { $this->auth->clearNeedToChangePassword(); $this->flash->success($this->translate->gettext('Your password was successfully changed')); Tag::resetInput(); } else { $this->flash->error($passwordChange->getMessages()); } } } $this->view->form = $form; }
public function initialize() { Tag::setTitle('Условия пользования Кладр в облаке. Кладр, ФИАС в облаке.'); $this->view->setVar('description', 'Сервис является абсолютно бесплатным с открытыми исходными кодами доступными на гитхабе.Вы можете связаться с нами для получения платной консультации об установке и настройке базы на Ваших серверах.'); $this->view->setVar('keywords', 'КЛАДР 2013, КЛАДР, ФИАС, скачать КЛАДР, скачать ФИАС, скачать базу КЛАДР, скачать базу ФИАС, доступ к базе КЛАДР, доступ к базе ФИАС, КЛАДР онлайн, ФИАС онлайн, структура базы КЛАДР, структура базы ФИАС, описание базы КЛАДР, описание базы ФИАС'); $this->view->setVar('page', 'prices'); }
public function initialize() { Tag::setTitle('Кладр, ФИАС в облаке для бизнеса'); $this->view->setVar('description', 'Описание интеграции с Кладр в облаке. Модули для jQuery, PHP, .Net, 1C-Bitrix'); $this->view->setVar('keywords', 'КЛАДР, ФИАС, скачать КЛАДР, скачать ФИАС, скачать базу КЛАДР, скачать базу ФИАС, доступ к базе КЛАДР, доступ к базе ФИАС, КЛАДР онлайн, ФИАС онлайн, структура базы КЛАДР, структура базы ФИАС, описание базы КЛАДР, описание базы ФИАС, jQuery, php, net, 1c-bitrix'); $this->view->setVar('page', 'business'); }
/** * Registers common function in Twig * * @param \Phalcon\Mvc\ViewInterface $view * @param \Phalcon\DiInterface $di * @param array $userFunctions */ protected function registryFunctions($view, DiInterface $di, $userFunctions = array()) { $options = array('is_safe' => array('html')); $functions = array(new \Twig_SimpleFunction('content', function () use($view) { return $view->getContent(); }, $options), new \Twig_SimpleFunction('partial', function ($partialPath) use($view) { return $view->partial($partialPath); }, $options), new \Twig_SimpleFunction('linkTo', function ($parameters, $text = null) { return \Phalcon\Tag::linkTo($parameters, $text); }, $options), new \Twig_SimpleFunction('textField', function ($parameters) { return \Phalcon\Tag::textField($parameters); }, $options), new \Twig_SimpleFunction('passwordField', function ($parameters) { return \Phalcon\Tag::passwordField($parameters); }, $options), new \Twig_SimpleFunction('hiddenField', function ($parameters) { return \Phalcon\Tag::hiddenField($parameters); }, $options), new \Twig_SimpleFunction('fileField', function ($parameters) { return \Phalcon\Tag::fileField($parameters); }, $options), new \Twig_SimpleFunction('checkField', function ($parameters) { return \Phalcon\Tag::checkField($parameters); }, $options), new \Twig_SimpleFunction('radioField', function ($parameters) { return \Phalcon\Tag::radioField($parameters); }, $options), new \Twig_SimpleFunction('submitButton', function ($parameters) { return \Phalcon\Tag::submitButton($parameters); }, $options), new \Twig_SimpleFunction('selectStatic', function ($parameters, $data = array()) { return \Phalcon\Tag::selectStatic($parameters, $data); }, $options), new \Twig_SimpleFunction('select', function ($parameters, $data = array()) { return \Phalcon\Tag::select($parameters, $data); }, $options), new \Twig_SimpleFunction('textArea', function ($parameters) { return \Phalcon\Tag::textArea($parameters); }, $options), new \Twig_SimpleFunction('form', function ($parameters = array()) { return \Phalcon\Tag::form($parameters); }, $options), new \Twig_SimpleFunction('endForm', function () { return \Phalcon\Tag::endForm(); }, $options), new \Twig_SimpleFunction('getTitle', function () { return \Phalcon\Tag::getTitle(); }, $options), new \Twig_SimpleFunction('stylesheetLink', function ($parameters = null, $local = true) { return \Phalcon\Tag::stylesheetLink($parameters, $local); }, $options), new \Twig_SimpleFunction('javascriptInclude', function ($parameters = null, $local = true) { return \Phalcon\Tag::javascriptInclude($parameters, $local); }, $options), new \Twig_SimpleFunction('image', function ($parameters) { return \Phalcon\Tag::image($parameters); }, $options), new \Twig_SimpleFunction('friendlyTitle', function ($text, $separator = null, $lowercase = true) { return \Phalcon\Tag::friendlyTitle($text, $separator, $lowercase); }, $options), new \Twig_SimpleFunction('getDocType', function () { return \Phalcon\Tag::getDocType(); }, $options), new \Twig_SimpleFunction('getSecurityToken', function () use($di) { return $di->get("security")->getToken(); }, $options), new \Twig_SimpleFunction('getSecurityTokenKey', function () use($di) { return $di->get("security")->getTokenKey(); }, $options), new \Twig_SimpleFunction('url', function ($route) use($di) { return $di->get("url")->get($route); }, $options)); if (!empty($userFunctions)) { $functions = array_merge($functions, $userFunctions); } foreach ($functions as $function) { $this->twig->addFunction($function); } }
public function initialize() { $this->modelService = new ProdInfoService(); $this->view->setTemplateAfter('main'); $this->view->hdr = 'Вирт. магазины'; Tag::setTitle('Seller Panel'); parent::initialize(); }
public function initialize() { $this->modelService = new ProdInfoService(); $this->view->setTemplateAfter('main'); $this->view->hdr = 'Переоценка'; Tag::setTitle('Revaluation Panel'); parent::initialize(); }