Example #1
0
 /**
  * Method to check out a user for editing and redirect to the edit form.
  *
  * @since	1.6
  */
 public function edit()
 {
     $app = JFactory::getApplication();
     $user = User::getRoot();
     $loginUserId = (int) $user->get('id');
     // Get the previous user id (if any) and the current user id.
     $previousId = (int) User::setState('com_users.edit.profile.id');
     $userId = (int) Request::getInt('user_id', null, '', 'array');
     // Check if the user is trying to edit another users profile.
     if ($userId != $loginUserId) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
         return false;
     }
     // Set the user id for the user to edit in the session.
     User::setState('com_users.edit.profile.id', $userId);
     // Get the model.
     $model = $this->getModel('Profile', 'UsersModel');
     // Check out the user.
     if ($userId) {
         $model->checkout($userId);
     }
     // Check in the previous user.
     if ($previousId) {
         $model->checkin($previousId);
     }
     // Redirect to the edit screen.
     $this->setRedirect(Route::url('index.php?option=com_users&view=profile&layout=edit', false));
 }
Example #2
0
 /**
  * Image Manager Popup
  *
  * @param string $listFolder The image directory to display
  * @since 1.5
  */
 function getFolderList($base = null)
 {
     // Get some paths from the request
     if (empty($base)) {
         $base = COM_MEDIA_BASE;
     }
     //corrections for windows paths
     $base = str_replace(DIRECTORY_SEPARATOR, '/', $base);
     $com_media_base_uni = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE);
     // Get the list of folders
     $folders = Filesystem::directories($base, '.', true, true);
     Document::setTitle(Lang::txt('COM_MEDIA_INSERT_IMAGE'));
     // Build the array of select options for the folder list
     $options[] = Html::select('option', "", "/");
     foreach ($folders as $folder) {
         $folder = str_replace($com_media_base_uni, "", str_replace(DIRECTORY_SEPARATOR, '/', $folder));
         $value = substr($folder, 1);
         $text = str_replace(DIRECTORY_SEPARATOR, "/", $folder);
         $options[] = Html::select('option', $value, $text);
     }
     // Sort the folder list array
     if (is_array($options)) {
         sort($options);
     }
     // Get asset and author id (use integer filter)
     $asset = Request::getInt('asset', 0);
     $author = Request::get('author', 0);
     // Create the drop-down folder select list
     $list = Html::select('genericlist', $options, 'folderlist', 'class="inputbox" size="1" onchange="ImageManager.setFolder(this.options[this.selectedIndex].value, ' . $asset . ', ' . $author . ')" ', 'value', 'text', $base);
     return $list;
 }
Example #3
0
 /**
  * Display a list of all downloads
  *
  * @return  void
  */
 public function displayTask()
 {
     // Get filters
     $this->view->filters = array('sort' => Request::getState($this->_option . '.' . $this->_controller . '.sort', 'filter_order', 'dDownloaded'), 'sort_Dir' => Request::getState($this->_option . '.' . $this->_controller . '.sortdir', 'filter_order_Dir', 'ASC'), 'limit' => Request::getState($this->_option . '.' . $this->_controller . '.limit', 'limit', Config::get('list_limit'), 'int'), 'start' => Request::getState($this->_option . '.' . $this->_controller . '.limitstart', 'limitstart', 0, 'int'), 'skuRequested' => Request::getState($this->_option . '.' . $this->_controller . '.skuRequested', 'skuRequested', 0));
     // Is a particular SKU requested?
     $skuRequested = Request::getInt('sku', 0);
     if (!$skuRequested && !empty($this->view->filters['skuRequested'])) {
         $skuRequested = $this->view->filters['skuRequested'];
     }
     if ($skuRequested) {
         $warehouse = new Warehouse();
         $skuInfo = $warehouse->getSkuInfo($skuRequested);
         if ($skuInfo) {
             $skuName = $skuInfo['info']->pName . ', ' . $skuInfo['info']->sSku;
         } else {
             $skuName = 'Product no longer exists';
         }
         $this->view->filters['skuRequested'] = $skuRequested;
         $this->view->skuRequestedName = $skuName;
     }
     //print_r($this->view->filters); die;
     // Clean filters -- reset to default if needed
     $allowedSorting = array('product', 'dName', 'dDownloaded', 'dStatus');
     if (!in_array($this->view->filters['sort'], $allowedSorting)) {
         $this->view->filters['sort'] = 'dDownloaded';
     }
     // Get record count
     $this->view->total = CartDownload::getDownloads('count', $this->view->filters);
     // Get records
     $this->view->rows = CartDownload::getDownloads('list', $this->view->filters);
     //print_r($this->view->rows); die;
     // Output the HTML
     $this->view->display();
 }
Example #4
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Get the document object.
     $document = App::get('document');
     // Set the default view name and format from the Request.
     $vName = Request::getCmd('view', 'categories');
     $vFormat = $document->getType();
     $lName = Request::getCmd('layout', 'default');
     $id = Request::getInt('id');
     // Check for edit form.
     if ($vName == 'category' && $lName == 'edit' && !$this->checkEditId('com_categories.edit.category', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_categories&view=categories&extension=' . $this->extension, false));
         return false;
     }
     // Get and render the view.
     if ($view = $this->getView($vName, $vFormat)) {
         // Get the model for the view.
         $model = $this->getModel($vName, 'CategoriesModel', array('name' => $vName . '.' . substr($this->extension, 4)));
         // Push the model into the view (as default).
         $view->setModel($model, true);
         $view->setLayout($lName);
         // Push document object into the view.
         $view->assignRef('document', $document);
         // Load the submenu.
         require_once JPATH_COMPONENT . '/helpers/categories.php';
         CategoriesHelper::addSubmenu($model->getState('filter.extension'));
         $view->display();
     }
     return $this;
 }
 /**
  * Render
  *
  * @return  object
  */
 public function render($elementid, $manifest, $pub = NULL, $viewname = 'edit', $status = NULL, $master = NULL, $order = 0)
 {
     $html = '';
     // Get project path
     $this->path = $pub->_project->repo()->get('path');
     $showElement = $master->props['showElement'];
     $total = $master->props['total'];
     // Incoming
     $activeElement = Request::getInt('el', $showElement);
     // Git helper
     if (!$this->_git) {
         include_once PATH_CORE . DS . 'components' . DS . 'com_projects' . DS . 'helpers' . DS . 'githelper.php';
         $this->_git = new \Components\Projects\Helpers\Git($this->path);
     }
     // Do we need to collapse inactive elements?
     $collapse = isset($master->params->collapse_elements) && $master->params->collapse_elements ? 1 : 0;
     switch ($viewname) {
         case 'edit':
         default:
             $html = $this->drawSelector($elementid, $manifest, $pub, $status->elements->{$elementid}, $activeElement, $collapse, $total, $master, $order);
             break;
         case 'freeze':
         case 'curator':
             $html = $this->drawItem($elementid, $manifest, $pub, $status->elements->{$elementid}, $master, $viewname);
             break;
     }
     return $html;
 }
Example #6
0
 /**
  * Save permissions to asset
  *
  * @return void
  */
 public function saveTask()
 {
     $scope = Request::getWord('scope', false);
     $scope_id = Request::getInt('scope_id', false);
     if (!$scope || !$scope_id) {
         echo json_encode(array('success' => false));
         exit;
     }
     // Process Rules
     $data = Request::getVar(strtolower($scope));
     $rules = array();
     if ($data && count($data) > 0) {
         foreach ($data as $rule => $parts) {
             if ($parts && count($parts) > 0) {
                 foreach ($parts as $group => $perms) {
                     if ($perms == '') {
                         continue;
                     }
                     $rules[$rule][$group] = $perms;
                 }
             }
         }
     }
     $class = 'Components\\Time\\Models\\' . $scope;
     $model = $class::oneOrFail($scope_id);
     $model->assetRules = new \JAccessRules($rules);
     $model->save();
     echo json_encode(array('success' => true));
     exit;
 }
Example #7
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     require_once JPATH_COMPONENT . '/helpers/menus.php';
     // Load the submenu.
     MenusHelper::addSubmenu(Request::getCmd('view'));
     $view = Request::getCmd('view', 'menus');
     $layout = Request::getCmd('layout', 'default');
     $id = Request::getInt('id');
     // Check for edit form.
     if ($view == 'menu' && $layout == 'edit' && !$this->checkEditId('com_menus.edit.menu', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_menus&view=menus', false));
         return false;
     } elseif ($view == 'item' && $layout == 'edit' && !$this->checkEditId('com_menus.edit.item', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_menus&view=items', false));
         return false;
     }
     parent::display();
     return $this;
 }
 /**
  * Return data on a course view (this will be some form of HTML)
  *
  * @param   object   $course    Current course
  * @param   object   $offering  Name of the component
  * @param   boolean  $describe  Return plugin description only?
  * @return  object
  */
 public function onCourse($course, $offering, $describe = false)
 {
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('default_access', 'registered')->set('display_menu_tab', false);
     if ($describe) {
         return $response;
     }
     if (!($active = Request::getVar('active'))) {
         Request::setVar('active', $active = $this->_name);
     }
     if ($response->get('name') == $active) {
         // Things we need from the form
         $recvEmailOptionID = Request::getInt('memberoptionid', 0);
         $recvEmailOptionValue = Request::getInt('recvpostemail', 0);
         include_once __DIR__ . DS . 'memberoption.class.php';
         switch ($action) {
             case 'editmemberoptions':
                 $response->set('html', $this->edit($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
                 break;
             case 'savememberoptions':
                 $response->set('html', $this->save($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
                 break;
             default:
                 $response->set('html', $this->edit($course, $user, $recvEmailOptionID, $recvEmailOptionValue));
                 break;
         }
     }
     // Return the output
     return $response;
 }
Example #9
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState()
 {
     parent::populateState();
     $this->setState('user.id', \User::get('id'));
     $messageId = (int) \Request::getInt('message_id');
     $this->setState('message.id', $messageId);
     $replyId = (int) \Request::getInt('reply_id');
     $this->setState('reply.id', $replyId);
 }
Example #10
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState()
 {
     // Load the User state.
     $pk = (int) Request::getInt('id');
     $this->setState('style.id', $pk);
     // Load the parameters.
     $params = Component::params('com_templates');
     $this->setState('params', $params);
 }
Example #11
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return	void
  * @since	1.6
  */
 protected function populateState()
 {
     $params = Component::params('com_languages');
     // Load the User state.
     $langId = (int) Request::getInt('lang_id');
     $this->setState('language.id', $langId);
     // Load the parameters.
     $this->setState('params', $params);
 }
Example #12
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState()
 {
     $app = JFactory::getApplication('administrator');
     // Load the User state.
     $id = (int) Request::getInt('id');
     $this->setState('menu.id', $id);
     // Load the parameters.
     $params = Component::params('com_menus');
     $this->setState('params', $params);
 }
Example #13
0
 /**
  * Compare answer to key
  *
  * @return     boolean True if answer is valid
  */
 public function onValidateCaptcha()
 {
     $key = Request::getVar('captcha_krhash', 0);
     $answer = Request::getInt('captcha_answer', 0);
     $answer = $this->_generateHash($answer, date('j'));
     if ($answer == $key) {
         return true;
     }
     return false;
 }
Example #14
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication();
     $this->setState('filter.extension', $this->_extension);
     // Get the parent id if defined.
     $parentId = Request::getInt('id');
     $this->setState('filter.parentId', $parentId);
     $params = $app->getParams();
     $this->setState('params', $params);
     $this->setState('filter.published', 1);
     $this->setState('filter.access', true);
 }
Example #15
0
 /**
  * @covers Xmf\Request::getInt
  * @todo   Implement testGetInt().
  */
 public function testGetInt()
 {
     $varname = 'RequestTest';
     $_REQUEST[$varname] = '9';
     $this->assertEquals(9, Request::getInt($varname));
     $_REQUEST[$varname] = '123fred5';
     $this->assertEquals(123, Request::getInt($varname));
     $_REQUEST[$varname] = '-123.45';
     $this->assertEquals(-123, Request::getInt($varname));
     $_REQUEST[$varname] = 'notanumber';
     $this->assertEquals(0, Request::getInt($varname));
     $this->assertEquals(0, Request::getInt($varname . 'no-such-key'));
 }
Example #16
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return	void
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication('administrator');
     // Load the filter state.
     $clientId = Request::getInt('client');
     $this->setState('filter.client_id', $clientId);
     // Load the parameters.
     $params = Component::params('com_languages');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('a.name', 'asc');
 }
Example #17
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState()
 {
     $app = JFactory::getApplication();
     // Load state from the request.
     $pk = Request::getInt('a_id');
     $this->setState('article.id', $pk);
     $this->setState('article.catid', Request::getInt('catid'));
     $return = Request::getVar('return', null, 'default', 'base64');
     $this->setState('return_page', urldecode(base64_decode($return)));
     // Load the parameters.
     $params = $app->getParams();
     $this->setState('params', $params);
     $this->setState('layout', Request::getCmd('layout'));
 }
Example #18
0
 /**
  * Rate a resource
  *
  * @param      string $option Name of the component
  * @return     array
  */
 public function onResourcesRateItem($option)
 {
     $id = Request::getInt('rid', 0);
     $arr = array('area' => $this->_name, 'html' => '', 'metadata' => '');
     $database = App::get('db');
     $resource = new \Components\Resources\Tables\Resource($database);
     $resource->load($id);
     $h = new PlgResourcesReviewsHelper();
     $h->resource = $resource;
     $h->option = $option;
     $h->_option = $option;
     $h->execute();
     return $arr;
 }
Example #19
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function populateState()
 {
     $app = JFactory::getApplication('administrator');
     // Load the User state.
     if (!($pk = (int) Request::getInt('id'))) {
         if ($extensionId = (int) User::getState('com_modules.add.module.extension_id')) {
             $this->setState('extension.id', $extensionId);
         }
     }
     $this->setState('module.id', $pk);
     // Load the parameters.
     $params = Component::params('com_modules');
     $this->setState('params', $params);
 }
Example #20
0
 /**
  * Return data on a resource view (this will be some form of HTML)
  *
  * @param   object  $resource  Current resource
  * @param   string  $option    Name of the component
  * @param   array   $areas     Active area(s)
  * @param   string  $rtrn      Data to be returned
  * @return  void
  */
 public function onResources($model, $option, $areas, $rtrn = 'all')
 {
     if (!App::isSite()) {
         return;
     }
     if (Request::getWord('tmpl') || Request::getWord('format') || Request::getInt('no_html')) {
         return;
     }
     $view = $this->view();
     Document::addCustomTag('<meta property="og:title" content="' . $view->escape($model->resource->title) . '" />');
     Document::addCustomTag('<meta property="og:description" content="' . $view->escape($model->resource->introtext) . '" />');
     Document::addCustomTag('<meta property="og:type" content="article" />');
     $url = Route::url('index.php?option=com_resources&' . ($model->resource->alias ? 'alias=' . $model->resource->alias : 'id=' . $model->resource->id));
     $url = rtrim(Request::root(), '/') . '/' . trim($url, '/');
     Document::addCustomTag('<meta property="og:url" content="' . $url . '" />');
 }
Example #21
0
 function store()
 {
     global $mainframe, $user;
     $u_id = Request::getInt("id", 0);
     $query = "DELETE FROM " . TBL_RSM_RESOURCE_XREF . " WHERE objectID = {$u_id} AND object_type = 1";
     Yii::app()->db->createCommand($query)->execute();
     if (count($_POST['form'])) {
         foreach ($_POST['form'] as $key => $value) {
             $key = str_replace("resource-", "", $key);
             $obj_table = YiiTables::getInstance(TBL_RSM_RESOURCE_XREF);
             $query = "INSERT INTO " . TBL_RSM_RESOURCE_XREF . " " . "SET objectID = {$u_id}" . ", object_type = 1" . ", resourceID = {$key}" . ", value = {$value}";
             Yii::app()->db->createCommand($query)->execute();
         }
     }
     return $u_id;
 }
Example #22
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return	void
  * @since	1.6
  */
 protected function populateState()
 {
     $app = JFactory::getApplication('site');
     // Load state from the request.
     $pk = Request::getInt('id');
     $this->setState('newsfeed.id', $pk);
     $offset = Request::getUInt('limitstart', 0);
     $this->setState('list.offset', $offset);
     // Load the parameters.
     $params = $app->getParams();
     $this->setState('params', $params);
     if (!User::authorise('core.edit.state', 'com_newsfeeds') && !User::authorise('core.edit', 'com_newsfeeds')) {
         $this->setState('filter.published', 1);
         $this->setState('filter.archived', 2);
     }
 }
Example #23
0
 /**
  * Method override to check if you can add a new record.
  *
  * @param   array  $data  An array of input data.
  *
  * @return  boolean
  *
  * @since   1.6
  */
 protected function allowAdd($data = array())
 {
     // Initialise variables.
     $categoryId = \Hubzero\Utility\Arr::getValue($data, 'catid', Request::getInt('filter_category_id'), 'int');
     $allow = null;
     if ($categoryId) {
         // If the category has been passed in the URL check it.
         $allow = User::authorise('core.create', $this->option . '.category.' . $categoryId);
     }
     if ($allow === null) {
         // In the absence of better information, revert to the component permissions.
         return parent::allowAdd($data);
     } else {
         return $allow;
     }
 }
Example #24
0
 /**
  * display
  */
 public function displayTask()
 {
     Pathway::append(Lang::txt('COM_GEOSEARCH_TITLE'), 'index.php?option=' . $this->_option);
     Document::setTitle(Lang::txt('COM_GEOSEARCH_TITLE'));
     $filters = array();
     $filters['limit'] = 1000;
     //Request::getInt('limit', 1000, 'request');
     $filters['start'] = 0;
     //Request::getInt('limitstart', 0, 'request');
     $resources = Request::getVar('resource', '', 'request');
     $tags = trim(Request::getString('tags', '', 'request'));
     $distance = Request::getInt('distance', '', 'request');
     $location = Request::getVar('location', '', 'request');
     $unit = Request::getVar('dist_units', '', 'request');
     $this->view->display();
 }
Example #25
0
 /**
  * Execute a task
  *
  * @return  void
  */
 public function execute()
 {
     // Incoming member ID
     $id = Request::getInt('citation', 0);
     if ($id == 0) {
         $this->setError(Lang::txt('COM_CITATIONS_ERROR_MISSING_CITATION'));
     }
     $this->citation = new Citation($this->database);
     $this->citation->id = $id;
     if ($id > 0) {
         $this->citation->load($id);
     }
     if ($this->citation->id == 0) {
         $this->setError(Lang::txt('COM_CITATIONS_ERROR_INVALID_CITATION'));
     }
     parent::execute();
 }
Example #26
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Load the submenu.
     TemplatesHelper::addSubmenu(Request::getCmd('view', 'styles'));
     $view = Request::getCmd('view', 'styles');
     $layout = Request::getCmd('layout', 'default');
     $id = Request::getInt('id');
     // Check for edit form.
     if ($view == 'style' && $layout == 'edit' && !$this->checkEditId('com_templates.edit.style', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_templates&view=styles', false));
         return false;
     }
     parent::display();
 }
Example #27
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     parent::populateState();
     // Add archive properties
     $params = $this->state->params;
     // Filter on archived articles
     $this->setState('filter.published', 2);
     // Filter on month, year
     $this->setState('filter.month', Request::getInt('month'));
     $this->setState('filter.year', Request::getInt('year'));
     // Optional filter text
     $this->setState('list.filter', Request::getString('filter-search'));
     // Get list limit
     $app = JFactory::getApplication();
     $itemid = Request::getInt('Itemid', 0);
     $limit = $app->getUserStateFromRequest('com_content.archive.list' . $itemid . '.limit', 'limit', $params->get('display_num'), 'uint');
     $this->setState('list.limit', $limit);
 }
Example #28
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @since	1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication('administrator');
     // Load the filter state.
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
     $this->setState('filter.state', $state);
     $clientId = Request::getInt('client_id', 0);
     $this->setState('filter.client_id', $clientId);
     $template = $this->getUserStateFromRequest($this->context . '.filter.template', 'filter_template', '', 'string');
     $this->setState('filter.template', $template);
     $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type', '', 'string');
     $this->setState('filter.type', $type);
     // Load the parameters.
     $params = Component::params('com_modules');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('value', 'asc');
 }
Example #29
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     $cachable = true;
     Html::behavior('caption');
     // Set the default view name and format from the Request.
     // Note we are using a_id to avoid collisions with the router and the return page.
     // Frontend is a bit messier than the backend.
     $id = Request::getInt('a_id');
     $vName = Request::getCmd('view', 'categories');
     Request::setVar('view', $vName);
     if (User::get('id') || $_SERVER['REQUEST_METHOD'] == 'POST' && ($vName == 'category' && Request::getCmd('layout') != 'blog' || $vName == 'archive')) {
         $cachable = false;
     }
     $safeurlparams = array('catid' => 'INT', 'id' => 'INT', 'cid' => 'ARRAY', 'year' => 'INT', 'month' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter-search' => 'STRING', 'print' => 'BOOLEAN', 'lang' => 'CMD', 'Itemid' => 'INT');
     // Check for edit form.
     if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         return App::abort(403, Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
     }
     parent::display($cachable, $safeurlparams);
     return $this;
 }
Example #30
0
 /**
  * Method to display a view.
  *
  * @param	boolean			If true, the view output will be cached
  * @param	array			An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
  *
  * @return	JController		This object to support chaining.
  * @since	1.5
  */
 public function display($cachable = false, $urlparams = false)
 {
     // Load the submenu.
     UsersHelper::addSubmenu(Request::getCmd('view', 'users'));
     $view = Request::getCmd('view', 'users');
     $layout = Request::getCmd('layout', 'default');
     $id = Request::getInt('id');
     if (!$this->canView($view)) {
         throw new Exception(Lang::txt('JERROR_ALERTNOAUTHOR'), 404);
         return;
     }
     // Check for edit form.
     if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_users.edit.user', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_users&view=users', false));
         return false;
     } elseif ($view == 'group' && $layout == 'edit' && !$this->checkEditId('com_users.edit.group', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_users&view=groups', false));
         return false;
     } elseif ($view == 'level' && $layout == 'edit' && !$this->checkEditId('com_users.edit.level', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_users&view=levels', false));
         return false;
     } elseif ($view == 'note' && $layout == 'edit' && !$this->checkEditId('com_users.edit.note', $id)) {
         // Somehow the person just went to the form - we don't allow that.
         $this->setError(Lang::txt('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
         $this->setMessage($this->getError(), 'error');
         $this->setRedirect(Route::url('index.php?option=com_users&view=notes', false));
         return false;
     }
     return parent::display();
 }