예제 #1
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)
 {
     $app = JFactory::getApplication('administrator');
     $search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search');
     $this->setState('filter.search', $search);
     $published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', '');
     $this->setState('filter.published', $published);
     $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
     $this->setState('filter.access', $access);
     $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int');
     $this->setState('filter.parent_id', $parentId);
     $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int');
     $this->setState('filter.level', $level);
     $menuType = Request::getVar('menutype', null);
     if ($menuType) {
         if ($menuType != $app->getUserState($this->context . '.filter.menutype')) {
             $app->setUserState($this->context . '.filter.menutype', $menuType);
             Request::setVar('limitstart', 0);
         }
     } else {
         $menuType = $app->getUserState($this->context . '.filter.menutype');
         if (!$menuType) {
             $menuType = $this->getDefaultMenuType();
         }
     }
     $this->setState('filter.menutype', $menuType);
     $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
     $this->setState('filter.language', $language);
     // Component parameters.
     $params = Component::params('com_menus');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('a.lft', 'asc');
 }
예제 #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $userId = User::get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     // Since we don't track these assets at the item level, use the category id.
     $canDo = NewsfeedsHelper::getActions($this->item->catid, 0);
     Toolbar::title(Lang::txt('COM_NEWSFEEDS_MANAGER_NEWSFEED'), 'newsfeeds.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0)) {
         Toolbar::apply('newsfeed.apply');
         Toolbar::save('newsfeed.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_newsfeeds', 'core.create')) > 0) {
         Toolbar::save2new('newsfeed.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('newsfeed.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('newsfeed.cancel');
     } else {
         Toolbar::cancel('newsfeed.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('JHELP_COMPONENTS_NEWSFEEDS_FEEDS_EDIT');
 }
예제 #3
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = TemplatesHelper::getActions();
     Toolbar::title($isNew ? Lang::txt('COM_TEMPLATES_MANAGER_ADD_STYLE') : Lang::txt('COM_TEMPLATES_MANAGER_EDIT_STYLE'), 'thememanager');
     // If not checked out, can save the item.
     if ($canDo->get('core.edit')) {
         Toolbar::apply('style.apply');
         Toolbar::save('style.save');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('style.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('style.cancel');
     } else {
         Toolbar::cancel('style.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     // Get the help information for the template item.
     $lang = Lang::getRoot();
     $help = $this->get('Help');
     if ($lang->hasKey($help->url)) {
         $debug = $lang->setDebug(false);
         $url = Lang::txt($help->url);
         $lang->setDebug($debug);
     } else {
         $url = null;
     }
     Toolbar::help('style');
     //$help->key, false, $url);
 }
예제 #4
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $isNew = $this->item->id == 0;
     $canDo = MenusHelper::getActions($this->state->get('filter.parent_id'));
     Toolbar::title(Lang::txt($isNew ? 'COM_MENUS_VIEW_NEW_MENU_TITLE' : 'COM_MENUS_VIEW_EDIT_MENU_TITLE'), 'menu.png');
     // If a new item, can save the item.  Allow users with edit permissions to apply changes to prevent returning to grid.
     if ($isNew && $canDo->get('core.create')) {
         if ($canDo->get('core.edit')) {
             Toolbar::apply('menu.apply');
         }
         Toolbar::save('menu.save');
     }
     // If user can edit, can save the item.
     if (!$isNew && $canDo->get('core.edit')) {
         Toolbar::apply('menu.apply');
         Toolbar::save('menu.save');
     }
     // If the user can create new items, allow them to see Save & New
     if ($canDo->get('core.create')) {
         Toolbar::save2new('menu.save2new');
     }
     if ($isNew) {
         Toolbar::cancel('menu.cancel');
     } else {
         Toolbar::cancel('menu.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('menu');
 }
예제 #5
0
 public function actionDisplay()
 {
     $id = Request::getVar('id', null);
     $alias = Request::getVar('alias', null);
     $model = Video::getInstance();
     if ($id == null or $id == "") {
         if ($alias != null and $alias != "") {
             $obj_item = $model->getItemByAlias($alias);
         } else {
             header("Location: /");
         }
     } else {
         $obj_item = $model->getItem($id);
     }
     $items = $model->getItems($obj_item['catID'], true, 4);
     $items2 = $model->getItems($obj_item['catID'], false, 9);
     $obj_category = $model->getCategory($obj_item['catID']);
     $data['item'] = $obj_item;
     $data['items'] = $items;
     $data['items2'] = $items2;
     $data['category'] = $obj_category;
     $page_title = $obj_item['title'];
     $page_keyword = $obj_item['metakey'] != "" ? $obj_item['metakey'] : $page_title;
     $page_description = $obj_item['metadesc'] != "" ? $obj_item['metadesc'] : $page_title;
     setSysConfig("seopage.title", $page_title);
     setSysConfig("seopage.keyword", $page_keyword);
     setSysConfig("seopage.description", $page_description);
     Request::setVar('alias', $obj_category['alias']);
     $this->render('default', $data);
 }
예제 #6
0
 /**
  * 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;
 }
예제 #7
0
 /**
  * Display the toolbar.
  *
  * @return  void
  *
  * @since   2.5
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == User::get('id'));
     $canDo = UsersHelper::getActions($this->state->get('filter.category_id'), $this->item->id);
     Toolbar::title(Lang::txt('COM_USERS_NOTES'), 'user');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count(User::getAuthorisedCategories('com_users', 'core.create')))) {
         Toolbar::apply('note.apply');
         Toolbar::save('note.save');
     }
     if (!$checkedOut && count(User::getAuthorisedCategories('com_users', 'core.create'))) {
         Toolbar::save2new('note.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && count(User::getAuthorisedCategories('com_users', 'core.create')) > 0) {
         Toolbar::save2copy('note.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('note.cancel');
     } else {
         Toolbar::cancel('note.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('note');
 }
예제 #8
0
 /**
  * Edit a role
  *
  * @return     void
  */
 public function editTask($row = null)
 {
     Request::setVar('hidemainmenu', 1);
     if (!is_object($row)) {
         // Incoming (expecting an array)
         $id = Request::getVar('id', array(0));
         if (is_array($id)) {
             $id = !empty($id) ? $id[0] : 0;
         }
         // Load the object
         $row = new Tables\Role($this->database);
         $row->load($id);
     }
     $this->view->row = $row;
     if (!$this->view->row->id) {
         $this->view->row->created_by = User::get('id');
         $this->view->row->created = Date::toSql();
     }
     require_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'courses.php';
     $model = \Components\Courses\Models\Courses::getInstance();
     $this->view->courses = $model->courses();
     // Set any errors
     foreach ($this->getErrors() as $error) {
         \Notify::error($error);
     }
     // Output the HTML
     $this->view->setLayout('edit')->display();
 }
예제 #9
0
 /**
  * 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)
 {
     if (!$offering->access('manage', 'section')) {
         return;
     }
     $response = with(new \Hubzero\Base\Object())->set('name', $this->_name)->set('title', Lang::txt('PLG_COURSES_' . strtoupper($this->_name)))->set('description', Lang::txt('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'managers'))->set('display_menu_tab', true)->set('icon', 'f083');
     if ($describe) {
         return $response;
     }
     $nonadmin = Request::getState('com_courses.offering' . $offering->get('id') . '.nonadmin', 0);
     if (!($active = Request::getVar('active')) && !$nonadmin) {
         Request::setVar('active', $active = $this->_name);
     }
     if ($response->get('name') == $active) {
         // Set the page title
         Document::setTitle(Document::getTitle() . ': ' . Lang::txt('PLG_COURSES_' . strtoupper($this->_name)));
         Pathway::append(Lang::txt('PLG_COURSES_' . strtoupper($this->_name)), $offering->link() . '&active=' . $this->_name);
         $view = with($this->view('default', 'overview'))->set('option', Request::getVar('option', 'com_courses'))->set('course', $course)->set('offering', $offering)->set('params', $this->params);
         foreach ($this->getErrors() as $error) {
             $view->setError($error);
         }
         $response->set('html', $view->loadTemplate());
     }
     // Return the output
     return $response;
 }
예제 #10
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/languages.php';
     Request::setVar('hidemainmenu', 1);
     $isNew = empty($this->item->lang_id);
     $canDo = LanguagesHelper::getActions();
     Toolbar::title(Lang::txt($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'langmanager.png');
     // If a new item, can save.
     if ($isNew && $canDo->get('core.create')) {
         Toolbar::save('language.save');
     }
     //If an existing item, allow to Apply and Save.
     if (!$isNew && $canDo->get('core.edit')) {
         Toolbar::apply('language.apply');
         Toolbar::save('language.save');
     }
     // If an existing item, can save to a copy only if we have create rights.
     if ($canDo->get('core.create')) {
         Toolbar::save2new('language.save2new');
     }
     if ($isNew) {
         Toolbar::cancel('language.cancel');
     } else {
         Toolbar::cancel('language.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('language');
 }
예제 #11
0
 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_members.changepassword', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         $badpassword = Session::get('badpassword', false);
         $expiredpassword = Session::get('expiredpassword', false);
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && ($badpassword || $expiredpassword)) {
             Request::setVar('option', 'com_members');
             Request::setVar('task', 'changepassword');
             Request::setVar('id', 0);
             if ($badpassword) {
                 Request::setVar('Your password does not meet current site requirements. Please change your password now.');
             }
             if ($expiredpassword) {
                 Request::setVar('Your password has expired. Please change your password now.');
             }
             $this->event->stop();
         }
     }
 }
예제 #12
0
 /**
  * Display admin control panel
  *
  * @return  void
  */
 public function displayTask()
 {
     // Set the template - this will display cpanel.php
     // from the selected admin template.
     \Request::setVar('tmpl', 'cpanel');
     $this->view->setLayout('default')->display();
 }
예제 #13
0
 /**
  * Method to catch the onAfterRoute event.
  *
  * @return  boolean
  */
 public function onAfterRoute()
 {
     $task = Request::getVar('task', 'none');
     if (User::isGuest() || !App::isSite() || $task == 'user.logout') {
         return false;
     }
     $menuId = $this->params->get('menuId', 0);
     if (!$menuId) {
         return false;
     }
     $menu = App::get('menu');
     $activeMenu = $menu->getActive();
     $defaultMenu = $menu->getDefault();
     // If routing to the home page...
     if ($activeMenu == $defaultMenu) {
         // Reset the active menu item and
         // overwrite request vars
         $menu->setActive($menuId);
         $menu->setDefault($menuId, $defaultMenu->language);
         $item = $menu->getItem($menuId);
         $vars = $item->query;
         $vars['Itemid'] = $menuId;
         foreach ($vars as $key => $var) {
             Request::setVar($key, $var);
         }
     }
     return true;
 }
예제 #14
0
 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     // First, check for presence of subject dn, which is the minimum required field
     if (!isset($_SERVER['SSL_CLIENT_S_DN']) || !$_SERVER['SSL_CLIENT_S_DN']) {
         \App::redirect($this->params->get('failure_location', '/invalidcert.php'));
         return;
     }
     if (\User::isGuest()) {
         // If so, redirect to login
         Request::setVar('option', 'com_users');
         Request::setVar('task', 'user.login');
         Request::setVar('authenticator', 'certificate');
         Request::setVar('return', base64_encode(\Request::current()));
         return;
     }
     // Check if user is registered and if current session is linked to cert identity
     $hzad = \Hubzero\Auth\Domain::getInstance('authentication', 'certificate', $_SERVER['SSL_CLIENT_I_DN_CN']);
     if ($link = \Hubzero\Auth\Link::getInstance($hzad->id, $_SERVER['SSL_CLIENT_S_DN_CN'])) {
         if ($link->user_id == \User::get('id')) {
             // All clear...return nothing
             return;
         }
     }
     // Otherwise, we have a cert-based user that doesn't match the current user
     Request::setVar('option', 'com_users');
     Request::setVar('task', 'user.logout');
     $this->event->stop();
 }
예제 #15
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = UsersHelper::getActions();
     Toolbar::title(Lang::txt($isNew ? 'COM_USERS_VIEW_NEW_LEVEL_TITLE' : 'COM_USERS_VIEW_EDIT_LEVEL_TITLE'), 'levels-add');
     if ($canDo->get('core.edit') || $canDo->get('core.create')) {
         Toolbar::apply('level.apply');
         Toolbar::save('level.save');
     }
     if ($canDo->get('core.create')) {
         Toolbar::save2new('level.save2new');
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         Toolbar::save2copy('level.save2copy');
     }
     if (empty($this->item->id)) {
         Toolbar::cancel('level.cancel');
     } else {
         Toolbar::cancel('level.cancel', 'JTOOLBAR_CLOSE');
     }
     Toolbar::divider();
     Toolbar::help('level');
 }
예제 #16
0
 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (User::isGuest()) {
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         if (App::isSite()) {
             $pages = ['com_users.login'];
             $granted = Session::get('user_consent', false);
             if (in_array($current, $pages) && !$granted) {
                 Request::setVar('option', 'com_users');
                 Request::setVar('view', 'userconsent');
             }
         } else {
             if (App::isAdmin()) {
                 $exceptions = ['com_login.grantconsent'];
                 $granted = Session::get('user_consent', false);
                 if (!in_array($current, $exceptions) && !$granted) {
                     Request::setVar('option', 'com_login');
                     Request::setVar('task', 'consent');
                 }
             }
         }
     }
 }
예제 #17
0
 function display($tpl = null)
 {
     // Parameters
     $app = JFactory::getApplication();
     $doc = Document::instance();
     $params = $app->getParams();
     $feedEmail = Config::get('feed_email', 'author');
     $siteEmail = Config::get('mailfrom');
     $doc->link = Route::url('index.php?option=com_content&view=featured');
     // Get some data from the model
     Request::setVar('limit', Config::get('feed_limit'));
     $categories = JCategories::getInstance('Content');
     $rows = $this->get('Items');
     foreach ($rows as $row) {
         // strip html from feed item title
         $title = $this->escape($row->title);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         // Compute the article slug
         $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
         // Url link to article
         $link = Route::url(ContentHelperRoute::getArticleRoute($row->slug, $row->catid, $row->language));
         // Get row fulltext
         $db = App::get('db');
         $query = 'SELECT' . $db->quoteName('fulltext') . 'FROM #__content WHERE id =' . $row->id;
         $db->setQuery($query);
         $row->fulltext = $db->loadResult();
         $description = $params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         // Load individual item creator class
         $item = new \Hubzero\Document\Type\Feed\Item();
         $item->title = $title;
         $item->link = $link;
         $item->date = $row->publish_up;
         $item_category = $categories->get($row->catid);
         $item->category = array();
         $item->category[] = Lang::txt('JFEATURED');
         // All featured articles are categorized as "Featured"
         for ($item_category = $categories->get($row->catid); $item_category !== null; $item_category = $item_category->getParent()) {
             // Only add non-root categories
             if ($item_category->id > 1) {
                 $item->category[] = $item_category->title;
             }
         }
         $item->author = $author;
         if ($feedEmail == 'site') {
             $item->authorEmail = $siteEmail;
         } elseif ($feedEmail === 'author') {
             $item->authorEmail = $row->author_email;
         }
         // Add readmore link to description if introtext is shown, show_readmore is true and fulltext exists
         if (!$params->get('feed_summary', 0) && $params->get('feed_show_readmore', 0) && $row->fulltext) {
             $description .= '<p class="feed-readmore"><a target="_blank" href ="' . $item->link . '">' . Lang::txt('COM_CONTENT_FEED_READMORE') . '</a></p>';
         }
         // Load item description and add div
         $item->description = '<div class="feed-description">' . $description . '</div>';
         // Loads item info into rss array
         $doc->addItem($item);
     }
 }
예제 #18
0
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // Ensure that constructor is called one time
     self::$cookie = SID == '';
     if (!self::$default_lang) {
         $app = JFactory::getApplication();
         $router = $app->getRouter();
         if (App::isSite()) {
             // setup language data
             self::$mode_sef = $router->getMode() == JROUTER_MODE_SEF ? true : false;
             self::$sefs = JLanguageHelper::getLanguages('sef');
             self::$lang_codes = JLanguageHelper::getLanguages('lang_code');
             self::$default_lang = Component::params('com_languages')->get('site', 'en-GB');
             self::$default_sef = self::$lang_codes[self::$default_lang]->sef;
             self::$homes = MultilangstatusHelper::getHomepages();
             $user = User::getRoot();
             $levels = $user->getAuthorisedViewLevels();
             foreach (self::$sefs as $sef => &$language) {
                 if (isset($language->access) && $language->access && !in_array($language->access, $levels)) {
                     unset(self::$sefs[$sef]);
                 }
             }
             App::forget('language.filter');
             App::set('language.filter', true);
             $uri = JFactory::getURI();
             if (self::$mode_sef) {
                 // Get the route path from the request.
                 $path = JString::substr($uri->toString(), JString::strlen($uri->base()));
                 // Apache mod_rewrite is Off
                 $path = Config::get('sef_rewrite') ? $path : JString::substr($path, 10);
                 // Trim any spaces or slashes from the ends of the path and explode into segments.
                 $path = JString::trim($path, '/ ');
                 $parts = explode('/', $path);
                 // The language segment is always at the beginning of the route path if it exists.
                 $sef = $uri->getVar('lang');
                 if (!empty($parts) && empty($sef)) {
                     $sef = reset($parts);
                 }
             } else {
                 $sef = $uri->getVar('lang');
             }
             if (isset(self::$sefs[$sef])) {
                 $lang_code = self::$sefs[$sef]->lang_code;
                 // Create a cookie
                 $cookie_domain = Config::get('cookie_domain', '');
                 $cookie_path = Config::get('cookie_path', '/');
                 setcookie(App::hash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain);
                 // set the request var
                 Request::setVar('language', $lang_code);
             }
         }
         parent::__construct($subject, $config);
         // 	Detect browser feature
         if (App::isSite()) {
             $app->setDetectBrowser($this->params->get('detect_browser', '1') == '1');
         }
     }
 }
예제 #19
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $canDo = TemplatesHelper::getActions();
     Toolbar::title(Lang::txt('COM_TEMPLATES_MANAGER_VIEW_TEMPLATE'), 'thememanager');
     Toolbar::cancel('template.cancel', 'JTOOLBAR_CLOSE');
     Toolbar::divider();
     Toolbar::help('template');
 }
예제 #20
0
 /**
  * Execute a task
  *
  * @return  void
  */
 public function execute()
 {
     $parts = explode('/', $_SERVER['REQUEST_URI']);
     $file = array_pop($parts);
     if (substr(strtolower($file), 0, 5) == 'image' || substr(strtolower($file), 0, 4) == 'file') {
         Request::setVar('task', 'download');
     }
     parent::execute();
 }
예제 #21
0
 /**
  * Show a form for adding an entry
  *
  * @return     void
  */
 public function addTask()
 {
     $id = Request::getVar('id', array());
     if (is_array($id)) {
         $id = !empty($id) ? $id[0] : 0;
     }
     Request::setVar('id', array());
     $this->editTask($id);
 }
예제 #22
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     Toolbar::title(Lang::txt('COM_ADMIN_VIEW_PROFILE_TITLE'), 'user-profile');
     Toolbar::apply('profile.apply');
     Toolbar::save('profile.save');
     Toolbar::cancel('profile.cancel', 'JTOOLBAR_CLOSE');
     Toolbar::divider();
     Toolbar::help('JHELP_ADMIN_USER_PROFILE_EDIT');
 }
예제 #23
0
 /**
  * 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('description', JText::_('PLG_COURSES_' . strtoupper($this->_name) . '_BLURB'))->set('default_access', $this->params->get('plugin_access', 'members'))->set('display_menu_tab', true)->set('icon', '270D');
     if ($describe) {
         return $response;
     }
     if (!($active = Request::getVar('active'))) {
         Request::setVar('active', $active = $this->_name);
     }
     if ($response->get('name') == $active) {
         $this->course = $course;
         $this->offering = $offering;
         $this->database = App::get('db');
         $this->view = with($this->view('default', 'notes'))->set('option', Request::getCmd('option', 'com_courses'))->set('controller', Request::getWord('controller', 'course'))->set('course', $course)->set('offering', $offering)->set('no_html', Request::getInt('no_html', 0));
         $this->view->filters = array('section_id' => $offering->section()->get('id'), 'search' => Request::getVar('search', ''));
         $this->view->model = new \Plugins\Courses\Notes\Models\Note(0);
         if ($action = strtolower(Request::getWord('action', ''))) {
             switch ($action) {
                 case 'add':
                     $result = $this->_edit();
                     break;
                 case 'edit':
                     $result = $this->_edit();
                     break;
                 case 'save':
                     $result = $this->_save();
                     break;
                 case 'delete':
                     $result = $this->_delete();
                     break;
                 case 'download':
                     $result = $this->_download();
                     break;
                 default:
                     $result = $this->_list();
                     break;
             }
         }
         if ($this->view->no_html && $result) {
             $note = new stdClass();
             $note->id = $result;
             $note->success = true;
             if ($this->getError()) {
                 $note->success = false;
                 $note->error = $this->getError();
             }
             ob_clean();
             echo json_encode($note);
             return;
         }
         $response->set('html', $this->view->loadTemplate());
     }
     // Return the output
     return $response;
 }
예제 #24
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', 1);
     Toolbar::title(Lang::txt('COM_USERS_MASS_MAIL'), 'massmail.png');
     Toolbar::custom('mail.send', 'send.png', 'send_f2.png', 'COM_USERS_TOOLBAR_MAIL_SEND_MAIL', false);
     Toolbar::cancel('mail.cancel');
     Toolbar::divider();
     Toolbar::preferences('com_users');
     Toolbar::divider();
     Toolbar::help('mail');
 }
예제 #25
0
 /**
  * Method to show a newsfeeds 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;
     // Set the default view name and format from the Request.
     $vName = Request::getCmd('view', 'categories');
     Request::setVar('view', $vName);
     if (User::get('id') || $_SERVER['REQUEST_METHOD'] == 'POST' && ($vName = 'category')) {
         $cachable = false;
     }
     $safeurlparams = array('id' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'lang' => 'CMD');
     parent::display($cachable, $safeurlparams);
 }
예제 #26
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     Request::setVar('hidemainmenu', true);
     $canDo = TemplatesHelper::getActions();
     Toolbar::title(Lang::txt('COM_TEMPLATES_MANAGER_EDIT_FILE'), 'thememanager');
     // Can save the item.
     if ($canDo->get('core.edit')) {
         Toolbar::apply('source.apply');
         Toolbar::save('source.save');
     }
     Toolbar::cancel('source.cancel');
     Toolbar::divider();
     Toolbar::help('source');
 }
예제 #27
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->form = $this->get('Form');
     $this->item = $this->get('Item');
     $this->state = $this->get('State');
     $this->canDo = CategoriesHelper::getActions($this->state->get('category.component'));
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors), 500);
     }
     parent::display($tpl);
     Request::setVar('hidemainmenu', true);
     $this->addToolbar();
 }
예제 #28
0
 /**
  * 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', $this->params->get('plugin_access', 'members'))->set('display_menu_tab', true)->set('icon', 'f059');
     if ($describe) {
         return $response;
     }
     $tmpl = Request::getWord('tmpl', null);
     if (!isset($tmpl) || $tmpl != 'component') {
         $this->css()->js('jquery.fancybox', 'system')->js('guide.overlay');
     }
     if (!($active = Request::getVar('active'))) {
         Request::setVar('active', $active = $this->_name);
     }
     // Determine if we need to return any HTML (meaning this is the active plugin)
     if ($response->get('name') == $active) {
         $active = strtolower(Request::getWord('unit', ''));
         $action = '';
         if ($active == 'mark') {
             $action = 'mark';
         }
         if ($act = strtolower(Request::getWord('action', ''))) {
             $action = $act;
         }
         $this->view = $this->view('default', $this->_name);
         $this->view->option = Request::getCmd('option', 'com_courses');
         $this->view->controller = Request::getWord('controller', 'course');
         $this->view->course = $course;
         $this->view->offering = $offering;
         $this->view->config = $this->params;
         $this->view->plugin = $this->_name;
         switch ($action) {
             case 'mark':
                 $this->_mark();
                 break;
             default:
                 $this->_default();
                 break;
         }
         if (Request::getInt('no_html', 0)) {
             ob_clean();
             header('Content-type: text/plain');
             echo $this->view->loadTemplate();
             exit;
         }
         $response->set('html', $this->view->loadTemplate());
     }
     // Return the output
     return $response;
 }
예제 #29
0
 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_support.tickets.save.index', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && User::getInstance()->reputation->isJailed()) {
             Request::setVar('option', 'com_users');
             Request::setVar('view', 'spamjail');
         }
     }
 }
예제 #30
0
 /**
  * Hook for after parsing route
  *
  * @return void
  */
 public function onAfterRoute()
 {
     if (App::isSite() && !User::isGuest()) {
         $exceptions = ['com_users.logout', 'com_users.userlogout', 'com_support.tickets.save.index', 'com_support.tickets.new.index', 'com_members.media.download.profiles'];
         $current = Request::getWord('option', '');
         $current .= ($controller = Request::getWord('controller', false)) ? '.' . $controller : '';
         $current .= ($task = Request::getWord('task', false)) ? '.' . $task : '';
         $current .= ($view = Request::getWord('view', false)) ? '.' . $view : '';
         // If guest, proceed as normal and they'll land on the login page
         if (!in_array($current, $exceptions) && !User::get('approved')) {
             Request::setVar('option', 'com_users');
             Request::setVar('view', 'unapproved');
             $this->event->stop();
         }
     }
 }