::login */ function login($credentials, $options = array()) { //Set the application login entry point if(!array_key_exists('entry_url', $options)) { $options['entry_url'] = JURI::base().'index.php?option=com_user&task=login'; } return parent::login($credentials, $options); } /** * Check if the user can access the application * * @access public */ function authorize($itemid) { $menus =& JSite::getMenu(); $user =& JFactory::getUser(); $aid = $user->get('aid'); if(!$menus->authorize($itemid, $aid)) { if ( ! $aid ) { // Redirect to login $uri = JFactory::getURI(); $return = $uri->toString(); $url = 'index.php?option=com_user&view=login'; $url .= '&return='.base64_encode($return);; //$url = JRoute::_($url, false); $this->redirect($url, JText::_('You must login first') ); } else { JError::raiseError( 403, JText::_('ALERTNOTAUTH') ); } } } /** * Get the appliaction parameters * * @param string The component option * @return object The parameters object * @since 1.5 */ function &getParams($option = null) { static $params = array(); $hash = '__default'; if(!empty($option)) $hash = $option; if (!isset($params[$hash])) { // Get component parameters if (!$option) { $option = JRequest::getCmd('option'); } $params[$hash] =& JComponentHelper::getParams($option); // Get menu parameters $menus =& JSite::getMenu(); $menu = $menus->getActive(); $title = htmlspecialchars_decode($this->getCfg('sitename' )); $description = $this->getCfg('MetaDesc'); // Lets cascade the parameters if we have menu item parameters if (is_object($menu)) { $params[$hash]->merge(new JParameter($menu->params)); $title = $menu->name; } $params[$hash]->def( 'page_title' , $title ); $params[$hash]->def( 'page_description', $description ); } return $params[$hash]; } /** * Get the appliaction parameters * * @param string The component option * @return object The parameters object * @since 1.5 */ function &getPageParameters( $option = null ) { return $this->getParams( $option ); } /** * Get the template * * @return string The template name * @since 1.0 */ function getTemplate() { // Allows for overriding the active template from a component, and caches the result of this function // e.g. $mainframe->setTemplate('solar-flare-ii'); if ($template = $this->get('setTemplate')) { return $template; } // Get the id of the active menu item $menu =& JSite::getMenu(); $item = $menu->getActive(); $id = 0; if(is_object($item)) { // valid item retrieved $id = $item->id; } // Load template entries for the active menuid and the default template $db =& JFactory::getDBO(); $query = 'SELECT template' . ' FROM #__templates_menu' . ' WHERE client_id = 0 AND (menuid = 0 OR menuid = '.(int) $id.')' . ' ORDER BY menuid DESC' ; $db->setQuery($query, 0, 1); $template = $db->loadResult(); // Allows for overriding the active template from the request $template = JRequest::getCmd('template', $template); $template = JFilterInput::clean($template, 'cmd'); // need to filter the default value as well // Fallback template if (!file_exists(JPATH_THEMES.DS.$template.DS.'index.php')) { $template = 'rhuk_milkyway'; } // Cache the result $this->set('setTemplate', $template); return $template; } /** * Overrides the default template that would be used * * @param string The template name */ function setTemplate( $template ) { if (is_dir(JPATH_THEMES.DS.$template)) { $this->set('setTemplate', $template); } } /** * Return a reference to the JPathway object. * * @access public * @return object JPathway. * @since 1.5 */ function &getMenu() { $options = array(); $menu =& parent::getMenu('site', $options); return $menu; } /** * Return a reference to the JPathway object. * * @access public * @return object JPathway. * @since 1.5 */ function &getPathWay() { $options = array(); $pathway =& parent::getPathway('site', $options); return $pathway; } /** * Return a reference to the JRouter object. * * @access public * @return JRouter. * @since 1.5 */ function &getRouter() { $config =& JFactory::getConfig(); $options['mode'] = $config->getValue('config.sef'); $router =& parent::getRouter('site', $options); return $router; } }