private function _redirect($do = false) { $redirect = ""; if (empty($do)) { if (!empty(Flash::get("redirect"))) { $redirect = Flash::get("redirect"); } else { if (!empty(Flash::get("HTTP_REFERER"))) { $redirect = Flash::get("HTTP_REFERER"); } } $redirect = $this->_sanitizeRedirect($redirect); } if ($do === true || is_string($do)) { if (is_string($do)) { $redirect = $this->_sanitizeRedirect($do); } if (empty($redirect)) { $redirect = get_url(); } redirect($redirect); die; } return $redirect; }
public function add($parent_id = 1) { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } $data = Flash::get('post_data'); $page = new Page($data); $page->parent_id = $parent_id; $page->status_id = Setting::get('default_status_id'); $page_parts = Flash::get('post_parts_data'); if (empty($page_parts)) { // check if we have a big sister ... $big_sister = Page::findBigSister($parent_id); if ($big_sister) { // get all is part and create the same for the new little sister $big_sister_parts = Record::findAllFrom('PagePart', 'page_id=? ORDER BY id', array($big_sister->id)); $page_parts = array(); foreach ($big_sister_parts as $parts) { $page_parts[] = new PagePart(array('name' => $parts->name, 'filter_id' => Setting::get('default_filter_id'))); } } else { $page_parts = array(new PagePart(array('filter_id' => Setting::get('default_filter_id')))); } } // display things ... $this->setLayout('backend'); $this->display('page/edit', array('action' => 'add', 'page' => $page, 'tags' => array(), 'filters' => Filter::findAll(), 'behaviors' => Behavior::findAll(), 'page_parts' => $page_parts, 'layouts' => Layout::find())); }
function forgot() { if (get_request_method() == 'POST') { return $this->_sendPasswordTo($_POST['forgot']['email']); } $this->display('login/forgot', array('email' => Flash::get('email'))); }
/** * Action to add a page. * * @param int $parent_id The page id for the new page's parent. Defaults to page 1. * @return <type> */ public function add($parent_id = 1) { // Check if trying to save. if (get_request_method() == 'POST') { return $this->_store('add'); } // If not trying to save, display "Add page" view. $data = Flash::get('post_data'); $page = new Page($data); $page->parent_id = $parent_id; $page->status_id = Setting::get('default_status_id'); $page->needs_login = Page::LOGIN_INHERIT; $page_parts = Flash::get('post_parts_data'); if (empty($page_parts)) { // Check if we have a big sister. $big_sister = Record::findOneFrom('Page', 'parent_id=? ORDER BY id DESC', array($parent_id)); if ($big_sister) { // Get list of parts create the same for the new little sister $big_sister_parts = Record::findAllFrom('PagePart', 'page_id=? ORDER BY id', array($big_sister->id)); $page_parts = array(); foreach ($big_sister_parts as $parts) { $page_parts[] = new PagePart(array('name' => $parts->name, 'filter_id' => Setting::get('default_filter_id'))); } } else { $page_parts = array(new PagePart(array('filter_id' => Setting::get('default_filter_id')))); } } // Display actual view. $this->setLayout('backend'); $this->display('page/edit', array('action' => 'add', 'csrf_token' => SecureToken::generateToken(BASE_URL . 'page/add'), 'page' => $page, 'tags' => array(), 'filters' => Filter::findAll(), 'behaviors' => Behavior::findAll(), 'page_parts' => $page_parts, 'layouts' => Record::findAllFrom('Layout'))); }
/** * */ public function action_logout() { $this->auto_render = false; Auth::instance()->logout(); if ($next_url = Flash::get('redirect')) { $this->go($next_url); } $this->go_home(); }
public function action_logout() { $this->auto_render = FALSE; Auth::instance()->logout(TRUE); Observer::notify('admin_after_logout', Auth::get_username()); if ($next_url = Flash::get('redirect')) { $this->go($next_url); } $this->go_home(); }
public function action_add() { $data = Flash::get('roles::add::data', array()); $role = ORM::factory('role')->values($data); if (Request::current()->method() == Request::POST) { return $this->_add($role); } $this->set_title(__('Add role')); $this->template->content = View::factory('roles/edit', array('action' => 'add', 'role' => $role)); }
public function action_add() { $data = Flash::get('post_data', array()); $job = ORM::factory('job')->values($data); // check if trying to save if (Request::current()->method() == Request::POST) { return $this->_add($job); } $this->set_title(__('Add job')); $this->template->content = View::factory('jobs/edit', array('action' => 'add', 'job' => $job)); }
public function action_add() { $data = Flash::get('users::add::data', array()); $user = ORM::factory('user')->values($data); // check if trying to save if (Request::current()->method() == Request::POST) { return $this->_add($user); } $this->set_title(__('Add user')); $this->template->content = View::factory('users/edit', array('action' => 'add', 'user' => $user, 'permissions' => array())); }
public function action_add() { // check if user have already enter something $data = Flash::get('post_data', array()); $type = ORM::factory('email_type'); // check if trying to save if (Request::current()->method() == Request::POST) { return $this->_add($type); } $this->set_title(__('Add email type')); $this->template->content = View::factory('email/types/edit', array('action' => 'add', 'type' => $type, 'templates' => $type->templates->find_all())); }
public function add() { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $tag = Flash::get('post_data'); if (empty($tag)) { $tag = new Tagger(); } $this->display('tagger/views/edit', array('action' => 'add', 'tag' => $tag)); }
function add() { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $layout = Flash::get('post_data'); if (empty($layout)) { $layout = new Layout(); } $this->display('layout/edit', array('action' => 'add', 'layout' => $layout)); }
function add() { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $snippet = Flash::get('post_data'); if (empty($snippet)) { $snippet = new Snippet(); } $this->display('snippet/edit', array('action' => 'add', 'filters' => Filter::findAll(), 'snippet' => $snippet)); }
public function add() { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $data = Flash::get('post_data'); $testimonial = null; if (isset($data)) { $testimonial = new Testimonial($data); } $this->display('testimonial/edit', array('action' => 'add', 'csrf_token' => SecureToken::generateToken(BASE_URL . 'testimonial/add'), 'testimonial' => $testimonial, 'pages' => Record::findAllFrom('Page', 'parent_id=1 order by parent_id,position'))); }
public function action_add() { // check if trying to save if (Request::current()->method() == Request::POST) { return $this->_add(); } Assets::package('ace'); $this->set_title(__('Add layout')); // check if user have already enter something $layout = Flash::get('post_data'); if (empty($layout)) { $layout = new Model_File_Layout(); } $this->template->content = View::factory('layout/edit', array('action' => 'add', 'layout' => $layout)); }
public function action_add() { // check if trying to save if (Request::current()->method() == Request::POST) { return $this->_add(); } Assets::package('ace'); $this->template->title = __('Add snippet'); $this->breadcrumbs->add($this->template->title); // check if user have already enter something $snippet = Flash::get('post_data'); if (empty($snippet)) { $snippet = new Model_File_Snippet(); } $this->template->content = View::factory('snippet/edit', array('action' => 'add', 'filters' => WYSIWYG::findAll(), 'snippet' => $snippet)); }
public function action_add() { // check if user have already enter something $data = Flash::get('post_data', array()); $email_type_id = (int) $this->request->query('email_type'); if ($email_type_id > 0 and ORM::factory('email_type', array('id' => $email_type_id))->loaded()) { $data['email_type'] = $email_type_id; } $template = ORM::factory('email_template')->values($data); // check if trying to save if (Request::current()->method() == Request::POST) { return $this->_add($template); } WYSIWYG::load_filters(); $this->set_title(__('Add email template')); $this->template->content = View::factory('email/templates/edit', array('action' => 'add', 'template' => $template)); }
private function _redirect($redirect = NULL) { if ($redirect === NULL) { if (!empty(Flash::get("redirect"))) { $redirect = Flash::get("redirect"); } else { if (!empty(Flash::get("HTTP_REFERER"))) { $redirect = Flash::get("HTTP_REFERER"); } else { $redirect = get_url(); } } } $redirect = preg_replace("#.*:\\/\\/[^\\/]+\\/#", "/", $redirect); redirect($redirect); die; }
function add() { if (!AuthUser::hasPermission('administrator')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirect(get_url()); } // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $user = Flash::get('post_data'); if (empty($user)) { $user = new User(); } $this->display('user/edit', array('action' => 'add', 'user' => $user, 'permissions' => Record::findAllFrom('Permission'))); }
public function action_create() { $type = $this->request->param('id'); $type = strtolower($type); $types = Datasource_Data_Manager::types(); if (Arr::get($types, $type) === NULL) { throw new Kohana_Exception('Datasource type :type not found', array(':type' => $type)); } if ($this->request->method() === Request::POST) { return $this->_create($type); } $this->set_title(__('Add section :type', array(':type' => Arr::get($types, $type)))); try { $this->template->content = View::factory('datasource/' . $type . '/section/create', array('type' => $type, 'data' => Flash::get('post_data'), 'users' => ORM::factory('user')->find_all()->as_array('id', 'username'))); } catch (Exception $exc) { $this->template->content = View::factory('datasource/section/create', array('type' => $type, 'data' => Flash::get('post_data'), 'users' => ORM::factory('user')->find_all()->as_array('id', 'username'))); } }
public function add() { if (!AuthUser::hasPermission('user_add')) { Flash::set('error', __('You do not have permission to access the requested page!')); redirect(get_url()); } // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $user = Flash::get('post_data'); if (empty($user)) { $user = new User(); $user->language = Setting::get('language'); } $this->display('user/edit', array('action' => 'add', 'csrf_token' => SecureToken::generateToken(BASE_URL . 'user/add'), 'user' => $user, 'permissions' => Record::findAllFrom('Role'))); }
/** * @return \Symfony\Component\HttpFoundation\Response */ protected function ajaxAction() { if ($this->request->header('X-Remote') && $this->request->wantsJson()) { try { $responseContents = []; $result = call_user_func_array([$this, $this->action], $this->params); $responseContents['success'] = true; if (is_array($result)) { $responseContents = array_merge($responseContents, $result); } elseif (is_string($result)) { $responseContents['result'] = $result; } if ($result instanceof RedirectResponse) { $responseContents['REDIRECT'] = $result->getTargetUrl(); } elseif (\Flash::check()) { $types = ['success', 'info', 'error', 'warning']; foreach (\Flash::all() as $type => $message) { } if (\Flash::get('success')) { $responseContents['FLASH']['success'] = \Flash::first('success'); } if (\Flash::get('info')) { $responseContents['FLASH']['info'] = \Flash::first('info'); } if (\Flash::get('error')) { $responseContents['FLASH']['danger'] = \Flash::first('error'); } if (\Flash::get('warning')) { $responseContents['FLASH']['warning'] = \Flash::first('warning'); } } return response()->make()->setContent($responseContents); } catch (ValidationException $ex) { \Flash::error($ex->getMessage()); $responseContents = []; $responseContents['success'] = false; $responseContents['FLASH']['danger'] = \Flash::first('error'); $responseContents['ERROR_FIELDS'] = $ex->getFields(); return response()->make()->setContent($responseContents); } } }
public function action_add() { WYSIWYG::load_filters(); Assets::package('backbone'); $parent_id = (int) $this->request->param('id', 1); $values = Flash::get('page::add::data', array()); $page = ORM::factory('page')->values($values); $page->parent_id = $parent_id; // Устанавливаем статус по умолчанию $page->status_id = Config::get('site', 'default_status_id'); $page->needs_login = Model_Page::LOGIN_INHERIT; $page->published_on = date('Y-m-d H:i:s'); // check if trying to save if ($this->request->method() == Request::POST) { return $this->_add($page); } $this->set_page_js_params($page); $this->set_title(__('Add page')); $this->template->content = View::factory('page/edit', array('action' => 'add', 'parent_id' => $parent_id, 'page' => $page, 'permissions' => ORM::factory('role')->find_all()->as_array('id', 'name'), 'page_permissions' => $page->get_permissions())); }
?> </div> <?php } if (Flash::get('success') !== null) { ?> <div id="success" class="message" style="display: none"><?php echo Flash::get('success'); ?> </div> <?php } if (Flash::get('info') !== null) { ?> <div id="info" class="message" style="display: none"><?php echo Flash::get('info'); ?> </div> <?php } ?> <div id="main"> <div id="content-wrapper"> <div id="content"> <!-- content --> <?php echo $content_for_layout; ?> <!-- end content --> </div> </div>
<?php $postdata = Flash::get('postdata'); ?> <form action="<?php echo get_url('features/edit/' . $features->id); ?> " method="post" enctype="multipart/form-data" name="thisform"> <input type=hidden name="action" value="edit"> <h1><?php echo __('Edit Feature'); ?> </h1> <h3><?php echo __('Feature Title'); ?> *</h3> <div id="meta-pages" class="pages"> <input class="textbox" id="features[title]" name="features[title]" size="40" type="text" value="<?php echo isset($postdata) ? $postdata['title'] : (isset($features) ? $features->title : ''); ?> " /> </div> <!-- <h3><?php echo __('URL'); ?> </h3> <div id="meta-pages" class="pages">
<html> <head> <title>NodeRegator - <?php echo $document->title; ?> </title> </head> <body style="padding: 10px;"> <?php while ($flash = Flash::get()) { print $flash . '<br/>'; } ?> <?php print $document->content->render($document); ?> </body> </html>
<?php /* $out = ''; $progres_path = ''; $paths = explode('/', $banner->filename); $nb_path = count($paths); foreach ($paths as $i => $path) { if ($i+1 == $nb_path) { $out .= $path; } else { $progres_path .= $path.'/'; $out .= '<a href="'.get_url('banner/browse/'.rtrim($progres_path, '/')).'">'.$path.'</a>/'; } } */ $postdata = Flash::get('villa_postdata'); $villaid = !empty($villa) ? $villa->id : ''; ?> <!-- ckeditor --> <script type="text/javascript" charset="utf-8" src="<?php echo URL_PUBLIC; ?> wolf/plugins/ckeditor/scripts/ckeditor/ckeditor.js"></script> <script type="text/javascript" charset="utf-8" src="<?php echo URL_PUBLIC; ?> wolf/plugins/ckeditor/ckeditor_custom_config.js"></script>--> <input type="hidden" value="ckeditor" class="filter-selector" name="ckeditor_trigger"> <!-- End ckeditor --> <form action="<?php
?> </h1> <?php if (Flash::get('error') != null) { ?> <div id="error" style="display: none"><?php echo Flash::get('error'); ?> </div> <script type="text/javascript">Effect.Appear('error', {duration:.5});</script> <?php } if (Flash::get('success') != null) { ?> <div id="success" style="display: none"><?php echo Flash::get('success'); ?> </div> <script type="text/javascript">Effect.Appear('success', {duration:.5});</script> <?php } ?> <form action="<?php echo get_url('login', 'forgot'); ?> " method="post"> <div> <label for="forgot-email"><?php echo __('Email address'); ?> :</label>
public function add() { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $about = Flash::get('post_data'); if (empty($about)) { $about = new About(); } // $this->display('about/index', array( // 'action' => 'add', // 'filters' => Filter::findAll(), // 'about' => $about // )); $this->browse(); }
public function add() { // check if trying to save if (get_request_method() == 'POST') { return $this->_add(); } // check if user have already enter something $news = Flash::get('post_data'); if (empty($news)) { $news = new News(); } $this->browse(); }