function display($tpl = null) { $mainframe =& JFactory::getApplication(); $params = clone $mainframe->getParams('com_rsmembership'); $this->assignRef('params', $params); $this->assignRef('memberships', $this->get('memberships')); $this->assignRef('pagination', $this->get('pagination')); $this->assignRef('total', $this->get('total')); $this->assignRef('action', JRequest::getURI()); $this->assignRef('date_format', RSMembershipHelper::getConfig('date_format')); $this->assignRef('transactions', $this->get('transactions')); $this->assignRef('limitstart', JRequest::getInt('limitstart', 0)); $Itemid = JRequest::getInt('Itemid', 0); if ($Itemid > 0) { $this->assign('Itemid', '&Itemid=' . $Itemid); } else { $this->assign('Itemid', ''); } if (RSMembershipHelper::isJ16()) { // Description if ($params->get('menu-meta_description')) { $this->document->setDescription($params->get('menu-meta_description')); } // Keywords if ($params->get('menu-meta_keywords')) { $this->document->setMetadata('keywords', $params->get('menu-meta_keywords')); } // Robots if ($params->get('robots')) { $this->document->setMetadata('robots', $params->get('robots')); } } parent::display(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $ticket_viewing_history = RSTicketsProHelper::getConfig('ticket_viewing_history'); if (!$ticket_viewing_history) { JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_HISTORY')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if ($ticket_viewing_history == 1 && !RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_CANNOT_VIEW_HISTORY')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.history.limit', $limit); $this->setState($option . '.history.limitstart', $limitstart); $this->_query = $this->_buildQuery(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); }
/** * Display the view */ function display() { $document = JFactory::getDocument(); $viewName = str_replace('FabrikControllerVisualization', '', get_class($this)); if ($viewName == '') { // if we are using a url like http://localhost/fabrik3.0.x/index.php?option=com_fabrik&view=visualization&id=6 // then we need to ascertain which viz to use $viewName = $this->getViewName(); } $viewType = $document->getType(); // Set the default view name from the Request $view = $this->getView($viewName, $viewType); // Push a model into the view $model = $this->getModel($viewName); if (!JError::isError($model)) { $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); // f3 cache with raw view gives error if (in_array(JRequest::getCmd('format'), array('raw', 'csv'))) { $view->display(); } else { $post = JRequest::get('post'); //build unique cache id on url, post and user id $user = JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); $cache->get($view, 'display', $cacheid); } }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_permissions = RSTicketsProHelper::getCurrentPermissions(); if (!$this->_permissions->add_ticket_customers && !$this->_permissions->add_ticket_staff) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_USERS')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.users.limit', $limit); $this->setState($option . '.users.limitstart', $limitstart); $this->_query = $this->_buildQuery(); }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); // get parameters $params = clone $mainframe->getParams('com_rsmembership'); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('RSM_RENEW'), ''); // token $token = JHTML::_('form.token'); // get the current layout $layout = $this->getLayout(); if ($layout == 'default') { $this->assign('payments', RSMembership::getPlugins()); // get the encoded return url $return = base64_encode(JRequest::getURI()); $this->assignRef('return', $return); $data = $this->get('data'); $this->assignRef('data', $data); // get the membership $membership = $this->get('membership'); $this->assignRef('membership', $membership); $this->assignRef('fields', RSMembershipHelper::getFields(false)); } elseif ($layout == 'payment') { $this->assignRef('html', $this->get('html')); } // get the extra $this->assignRef('extra', $this->get('extra')); $this->assignRef('cid', $this->get('cid')); $this->assignRef('config', $this->get('config')); $this->assignRef('params', $params); $this->assignRef('user', $this->get('user')); $this->assignRef('token', $token); $this->assign('currency', RSMembershipHelper::getConfig('currency')); parent::display(); }
/** * Display the view */ function display() { $document =& JFactory::getDocument(); $viewName = str_replace('FabrikControllerVisualization', '', get_class($this)); $viewType = $document->getType(); // Set the default view name from the Request $view =& $this->getView($viewName, $viewType); //create a form view as well to render the add event form. $view->_formView =& $this->getView('Form', $viewType); $formModel =& $this->getModel('Form'); $view->_formView->setModel($formModel, true); // Push a model into the view $model =& $this->getModel($viewName); if (!JError::isError($model)) { //$model->setAdmin( false); $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); $post = JRequest::get('post'); //build unique cache id on url, post and user id $user =& JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache =& JFactory::getCache('com_fabrik', 'view'); echo $cache->get($view, 'display', $cacheid); }
/** * Display the view */ function display($model = null) { //menu links use fabriklayout parameters rather than layout $flayout = JRequest::getVar('fabriklayout'); if ($flayout != '') { JRequest::setVar('layout', $flayout); } $document =& JFactory::getDocument(); $viewName = JRequest::getVar('view', 'table', 'default', 'cmd'); $modelName = $viewName; $layout = JRequest::getWord('layout', 'default'); $viewType = $document->getType(); // Set the default view name from the Request $view =& $this->getView($viewName, $viewType); $view->setLayout($layout); // Push a model into the view if (is_null($model)) { $model =& $this->getModel($modelName); } if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); $post = JRequest::get('post'); if ($model->getParams()->get('list_disable_caching', '0') !== '1') { //build unique cache id on url, post and user id $user =& JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache =& JFactory::getCache('com_fabrik', 'view'); $cache->get($view, 'display', $cacheid); } else { $view->display(); } }
/** * Show the form in the admin * * @return null */ public function view() { $document = JFactory::getDocument(); $model = JModel::getInstance('Form', 'FabrikFEModel'); $viewType = $document->getType(); $this->setPath('view', COM_FABRIK_FRONTEND . '/views'); $viewLayout = JRequest::getCmd('layout', 'default'); $view = $this->getView('form', $viewType, ''); $view->setModel($model, true); $view->isMambot = $this->isMambot; // Set the layout $view->setLayout($viewLayout); // @TODO check for cached version JToolBarHelper::title(JText::_('COM_FABRIK_MANAGER_FORMS'), 'forms.png'); if (in_array(JRequest::getCmd('format'), array('raw', 'csv', 'pdf'))) { $view->display(); } else { $user = JFactory::getUser(); $post = JRequest::get('post'); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); ob_start(); $cache->get($view, 'display', $cacheid); $contents = ob_get_contents(); ob_end_clean(); $token = JUtility::getToken(); $search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#'; $replacement = '<input type="hidden" name="' . $token . '" value="1" />'; echo preg_replace($search, $replacement, $contents); } FabrikAdminHelper::addSubmenu(JRequest::getWord('view', 'lists')); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_CUSTOMER_CANNOT_VIEW_SEARCHES')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $task = JRequest::getVar('task'); if ($task == 'edit' || $task == 'save' || $task == 'search') { $this->_getSearch(); } $filter_order = $mainframe->getUserStateFromRequest($option . '.searches.filter_order', 'filter_order', 'ordering'); $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.searches.filter_order_Dir', 'filter_order_Dir', 'ASC'); $this->setState($option . '.searches.filter_order', $filter_order); $this->setState($option . '.searches.filter_order_Dir', $filter_order_Dir); $this->_query = $this->_buildQuery(); }
/** * Display the view */ function display($model = null) { $document = JFactory::getDocument(); $viewName = JRequest::getVar('view', 'list', 'default', 'cmd'); $modelName = $viewName; $layout = JRequest::getWord('layout', 'default'); $viewType = $document->getType(); // Set the default view name from the Request $view = $this->getView($viewName, $viewType); $view->setLayout($layout); // Push a model into the view if (is_null($model)) { $model = $this->getModel($modelName, 'FabrikFEModel'); } if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); $post = JRequest::get('post'); //build unique cache id on url, post and user id $user = JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); // f3 cache with raw view gives error if (in_array(JRequest::getCmd('format'), array('raw', 'csv', 'pdf', 'json', 'fabrikfeed'))) { $view->display(); } else { $cache->get($view, 'display', $cacheid); } }
/** * Display the view * * @return null */ public function display() { $document = JFactory::getDocument(); $viewName = $this->getViewName(); $viewType = $document->getType(); // Set the default view name from the Request $view = $this->getView($viewName, $viewType); // Push a model into the view $model = $this->getModel($viewName); if (!JError::isError($model)) { $view->setModel($model, true); } // Display the view $view->assign('error', $this->getError()); // F3 cache with raw view gives error if (in_array(JRequest::getCmd('format'), array('raw', 'csv'))) { $view->display(); } else { $post = JRequest::get('post'); // Build unique cache id on url, post and user id $user = JFactory::getUser(); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); $cache->get($view, 'display', $cacheid); } }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } if (!RSTicketsProHelper::isStaff()) { JError::raiseWarning(500, JText::_('RST_CANNOT_CHANGE_SIGNATURE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); $this->_db->setQuery("SELECT id FROM #__rsticketspro_staff WHERE user_id='" . (int) $user->get('id') . "' LIMIT 1"); if (!$this->_db->loadResult()) { JError::raiseWarning(500, JText::_('RST_CANNOT_CHANGE_SIGNATURE_MUST_BE_STAFF')); $referer = @$_SERVER['HTTP_REFERER']; if (empty($referer)) { $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } else { $mainframe->redirect($referer); } } }
function getDisplayTab($tab, $user, $ui) { // $$$ hugh - added privacy option, so you can restrict who sees the tab, requested on forums: // http://fabrikar.com/forums/showthread.php?p=128127#post128127 // privacy setting: // 0 = public // 1 = profile owner only // 2 = profile owner and admins $private = (int) $this->params->get('fabrik_private', '0'); if ($private > 0) { $viewer = JFactory::getuser(); if ($private === 1) { if ($user->get('user_id') != $viewer->get('id')) { return false; } } else { if ($private === 2) { if ($user->get('id') !== $viewer->get('id') && ($viewer->get('gid') != 24 && $viewer->get('gid') != 25)) { return false; } } } } $dispatcher = new JDispatcher(); JPluginHelper::importPlugin('content', 'fabrik', true, $dispatcher); $dispatcher->register('content', 'plgContentFabrik'); $args = array(); $article = new stdClass(); $txt = $this->params->get('plugintext'); // $$$ hugh - set profile user in session so Fabrik user element can get at it // TODO - should really make this table/form specific! $session =& JFactory::getSession(); // $$$ hugh - testing using a unique session hash, which we will stuff in the // plugin args, and will get added where necessary in Fabrik lists and forms so // we can actually track the right form submissions with their coresponding CB // profiles. $social_hash = md5(serialize(array(JRequest::getURI(), $tab, $user))); $session->set('fabrik.plugin.' . $social_hash . '.profile_id', $user->get('id')); // do the old style one without the hash for backward compat $session->set('fabrik.plugin.profile_id', $user->get('id')); $txt = rtrim($txt, '}') . " fabrik_social_profile_hash=" . $social_hash . '}'; //do some dynamic replacesments with the owner's data foreach ($user as $k => $v) { if (strstr($txt, "{\$my->{$k}}")) { $txt = str_replace("{\$my->{$k}}", $v, $txt); } // $$$ hugh - might as well stuff the entire CB user object in the session $session->set('fabrik.plugin.' . $social_hash . '.' . $k, $v); } $params = new stdClass(); $args[] = 0; $article->text = $txt; $args[] =& $article; $args[] =& $params; $res = $dispatcher->trigger('onContentPrepare', $args); // $$$ peamak http://fabrikar.com/forums/showthread.php?t=10446&page=2 $dispatcher->register('content', 'plgContentFabrik'); return $article->text; }
/** * Constructor * * @access protected * @param object $subject The object to observe * @param array $config An array that holds the plugin configuration * @since 1.0 */ function __construct(&$subject, $config) { parent::__construct($subject, $config); //Set the language in the class $config = JFactory::getConfig(); $options = array('defaultgroup' => 'page', 'browsercache' => $this->params->get('browsercache', false), 'caching' => false); $this->_cache = JCache::getInstance('page', $options); $this->_cache_key = JRequest::getURI(); }
/** * Display the view */ function display() { $session = JFactory::getSession(); //menu links use fabriklayout parameters rather than layout $flayout = JRequest::getVar('fabriklayout'); if ($flayout != '') { JRequest::setVar('layout', $flayout); } $document = JFactory::getDocument(); $viewName = JRequest::getVar('view', 'form', 'default', 'cmd'); $modelName = $viewName; if ($viewName == 'emailform') { $modelName = 'form'; } $viewType = $document->getType(); // Set the default view name from the Request $view = &$this->getView($viewName, $viewType); // Push a model into the view (may have been set in content plugin already $model = !isset($this->_model) ? $this->getModel($modelName, 'FabrikFEModel') : $this->_model; //if errors made when submitting from a J plugin they are stored in the session //lets get them back and insert them into the form model if (empty($model->_arErrors)) { $context = 'com_fabrik.form.'.JRequest::getInt('formid'); $model->_arErrors = $session->get($context.'.errors', array()); $session->clear($context.'.errors'); } if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } $view->isMambot = $this->isMambot; // Display the view $view->assign('error', $this->getError()); // Workaround for token caching if (in_array(JRequest::getCmd('format'), array('raw', 'csv'))) { $view->display(); } else { $user = JFactory::getUser(); $post = JRequest::get('post'); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); ob_start(); $cache->get($view, 'display', $cacheid); $contents = ob_get_contents(); ob_end_clean(); $token = JUtility::getToken(); $search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#'; $replacement = '<input type="hidden" name="'.$token.'" value="1" />'; echo preg_replace($search, $replacement, $contents); } }
function getCurrentURL() { $cururl = JRequest::getURI(); if (($pos = strpos($cururl, "index.php")) !== false) { $cururl = substr($cururl, $pos); } $cururl = JRoute::_($cururl, true, 0); return $cururl; }
public function rerouteCurrentUrlCached($code = null, $cachable = false) { $uri = JRequest::getURI(); if ($cachable == true) { $cache = JFactory::getCache('com_joomfish', 'callback'); $url = $cache->get(array($jfrouter, "rerouteCurrentUrl"), array($code), md5(serialize(array($code, $uri)))); } else { $url = $this->rerouteCurrentUrl($code); } return $url; }
function __construct() { parent::__construct(); $user = JFactory::getUser(); if ($user->get('guest')) { $mainframe =& JFactory::getApplication(); $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSMembershipHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(JRoute::_('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->_execute(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->_db = JFactory::getDBO(); $this->_getIsStaff(); if ($this->is_staff) { $this->_getPermissions(); $departments = RSTicketsProHelper::getCurrentDepartments(); } $this->_getTicket(); if (!$this->is_staff && $this->_ticket->customer_id != $user->get('id')) { JError::raiseWarning(500, JText::_('RST_CUSTOMER_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if ($this->is_staff) { // staff - check if belongs to department only if he is not the customer if ($this->_ticket->customer_id != $user->get('id') && !in_array($this->_ticket->department_id, $departments)) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if (RSTicketsProHelper::getConfig('staff_force_departments') && !in_array($this->_ticket->department_id, $departments)) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if (!$this->_permissions->see_unassigned_tickets && $this->_ticket->staff_id == 0) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } if (!$this->_permissions->see_other_tickets && $this->_ticket->staff_id > 0 && $this->_ticket->staff_id != $user->get('id')) { JError::raiseWarning(500, JText::_('RST_STAFF_CANNOT_VIEW_TICKET')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } } if ($mainframe->isSite()) { $pathway =& $mainframe->getPathway(); $pathway->addItem('[' . $this->_ticket->code . '] ' . $this->_ticket->subject, ''); } $document =& JFactory::getDocument(); $document->setTitle('[' . $this->_ticket->code . '] ' . $this->_ticket->subject, ''); $this->_setData(); $this->_processData(); }
/** * Generates the report link to allow users to report on an item * * @since 1.0 * @access public * @param string * @return */ public function getForm($extension, $type, $uid, $itemTitle, $text, $title = '', $description = '', $url = '', $icon = false) { // Determine if the user is a guest $my = FD::user(); $config = FD::config(); if (!$my->id) { if (!$config->get('reports.guests', false)) { return; } } else { // Check if user is allowed to report. $access = FD::access(); // @access: reports.submit // Check if user is allowed to create reports if (!$access->allowed('reports.submit')) { return; } $model = FD::model('Reports'); $usage = $model->getCount(array('created_by' => $my->id)); // Check if the current user exceeded the reports limit if ($access->exceeded('reports.limit', $usage)) { return; } } $theme = FD::themes(); // Set a default text if API wasn't provided with a custom text. if (empty($text)) { $text = JText::_('COM_EASYSOCIAL_REPORTS_REPORT_ITEM'); } // If url is not provided, use the current URL. if (empty($url)) { $url = JRequest::getURI(); } // If title is not supplied, we use the text if (empty($title)) { $title = $text; } $theme->set('url', $url); $theme->set('extension', $extension); $theme->set('itemTitle', $itemTitle); $theme->set('title', $title); $theme->set('text', $text); $theme->set('type', $type); $theme->set('uid', $uid); $theme->set('description', $description); $theme->set('icon', $icon); $contents = $theme->output('site/reports/default.link'); return $contents; }
/** * Display the view */ function display() { $session = JFactory::getSession(); //menu links use fabriklayout parameters rather than layout $flayout = JRequest::getVar('fabriklayout'); if ($flayout != '') { JRequest::setVar('layout', $flayout); } $document = JFactory::getDocument(); $viewName = JRequest::getVar('view', 'form', 'default', 'cmd'); $modelName = $viewName; if ($viewName == 'emailform') { $modelName = 'form'; } $viewName = 'form'; $modelName = 'form'; $viewType = $document->getType(); // Set the default view name from the Request $view = &$this->getView($viewName, $viewType); // Push a model into the view $model = &$this->getModel($modelName, 'FabrikFEModel'); //if errors made when submitting from a J plugin they are stored in the session //lets get them back and insert them into the form model if (!empty($model->_arErrors)) { $context = 'com_fabrik.form.'.JRequest::getInt('formid'); $model->_arErrors = $session->get($context.'.errors', array()); $session->clear($context.'.errors'); } if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } $view->isMambot = $this->isMambot; // Display the view $view->assign('error', $this->getError()); $user = JFactory::getUser(); $post = JRequest::get('post'); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); echo $cache->get($view, 'display', $cacheid); }
function _addBreadCrumb() { $app = JFactory::getApplication(); $pathway = $app->getPathway(); // add breadcrumb if category id or download id is passed $categoryId = JRequest::getInt('cid', null); // if categoryId is not passed, try to get it from selected download if ($categoryId == null) { $downloadId = JRequest::getInt('dlid', null); if ($downloadId !== null) { $model = $this->getModel('downloads'); if ($model !== null) { $download = $model->getDownload($downloadId); if ($download !== null && !empty($download->cid)) { $categoryId = $download->cid; } } } } $elements = array(); if ($categoryId !== null) { do { // get category $model = $this->getModel('downloads'); $category = $model->getCategory($categoryId); // add bread only if category exists / was found if (!empty($category)) { $elements[] = array('name' => $category->name, 'route' => JRoute::_('index.php?cid=' . $categoryId)); //$pathway->addItem( $category->name, JRoute::_( 'index.php?cid=' . $categoryId ) ); } $categoryId = $category->pid; } while ($categoryId != 0); } $elements = array_reverse($elements); foreach ($elements as $el) { $pathway->addItem($el['name'], $el['route']); } // add download if selected if (!empty($download)) { //TODO add correct URI (this is only valid on last pathway element, which is not linked anyway, which currently is always but may change) $pathway->addItem(htmlspecialchars($download->name), JRequest::getURI()); } }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('RSM_MEMBERSHIP'), ''); $params = clone $mainframe->getParams('com_rsmembership'); $this->assignRef('params', $params); $terms = $this->get('terms'); if (!empty($terms)) { $this->assignRef('terms', $terms); $this->assignRef('action', JRequest::getURI()); parent::display('terms'); } else { $this->assignRef('cid', $this->get('cid')); $this->assignRef('membership', $this->get('membership')); $this->assignRef('membershipterms', $this->get('membershipterms')); $this->assignRef('boughtextras', $this->get('boughtextras')); $this->assignRef('extras', $this->get('extras')); $upgrades_array = $this->get('upgrades'); $upgrades = array(); foreach ($upgrades_array as $upgrade) { $upgrades[] = JHTML::_('select.option', $upgrade->membership_to_id, $upgrade->name); } $has_upgrades = !empty($upgrades); $this->assign('has_upgrades', $has_upgrades); $lists['upgrades'] = JHTML::_('select.genericlist', $upgrades, 'to_id', 'class="inputbox"'); $this->assignRef('folders', $this->get('folders')); $this->assignRef('files', $this->get('files')); $this->assignRef('previous', $this->get('previous')); $this->assignRef('date_format', RSMembershipHelper::getConfig('date_format')); $this->assignRef('from', $this->get('from')); $this->assignRef('lists', $lists); $Itemid = JRequest::getInt('Itemid', 0); if ($Itemid > 0) { $this->assign('Itemid', '&Itemid=' . $Itemid); } else { $this->assign('Itemid', ''); } $this->assign('currency', RSMembershipHelper::getConfig('currency')); parent::display(); } }
/** * Display the view * * @return null */ public function display() { $session = JFactory::getSession(); $document = JFactory::getDocument(); $viewName = JRequest::getVar('view', 'form', 'default', 'cmd'); $modelName = $viewName; if ($viewName == 'emailform') { $modelName = 'form'; } $viewName = 'form'; $modelName = 'form'; $viewType = $document->getType(); if ($viewType == 'pdf') { // In PDF view only shown the main component content. JRequest::setVar('tmpl', 'component'); } // Set the default view name from the Request $view =& $this->getView($viewName, $viewType); // Push a model into the view $model = !isset($this->_model) ? $this->getModel($modelName, 'FabrikFEModel') : $this->_model; // If errors made when submitting from a J plugin they are stored in the session lets get them back and insert them into the form model if (!empty($model->_arErrors)) { $context = 'com_fabrik.form.' . JRequest::getInt('formid'); $model->_arErrors = $session->get($context . '.errors', array()); $session->clear($context . '.errors'); } if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } $view->isMambot = $this->isMambot; // Display the view $view->assign('error', $this->getError()); if (in_array(JRequest::getCmd('format'), array('raw', 'csv', 'pdf'))) { $view->display(); } else { $user = JFactory::getUser(); $post = JRequest::get('post'); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); echo $cache->get($view, 'display', $cacheid); } }
/** * Renders a module script and returns the results as a string * * @param string $name The name of the module to render * @param array $params Associative array of values * @return string The output of the script */ public function render($module, $params = array(), $content = null) { if (!is_object($module)) { $title = isset($params['title']) ? $params['title'] : null; $module =& JModuleHelper::getModule($module, $title); if (!is_object($module)) { if (is_null($content)) { return ''; } else { /** * If module isn't found in the database but data has been pushed in the buffer * we want to render it */ $tmp = $module; $module = new stdClass(); $module->params = null; $module->module = $tmp; $module->id = 0; $module->user = 0; } } } // get the user and configuration object $user =& JFactory::getUser(); $conf =& JFactory::getConfig(); // set the module content if (!is_null($content)) { $module->content = $content; } //get module parameters $mod_params = new JParameter($module->params); $contents = ''; if ($mod_params->get('cache', 0) && $conf->getValue('config.caching')) { $cache =& JFactory::getCache($module->module); $cache->setLifeTime($mod_params->get('cache_time', $conf->getValue('config.cachetime') * 60)); $contents = $cache->get(array('JModuleHelper', 'renderModule'), array($module, $params), $module->id . $user->get('aid', 0) . md5(JRequest::getURI())); } else { $contents = JModuleHelper::renderModule($module, $params); } return $contents; }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsticketspro'; if ($mainframe->isAdmin()) { $data = "staff_itemid=\n"; $data .= "customer_itemid=\n"; jimport('joomla.html.parameter'); $this->params = new JParameter($data); } else { $this->params = $mainframe->getParams('com_rsticketspro'); } $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $option = 'com_rsmembership'; $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSMembershipHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect('index.php?option=' . $user_option . '&view=login&return=' . $link); } // Get pagination request variables $limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'), '', 'int'); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); // In case limit has been changed, adjust it $limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0; $this->setState($option . '.memberships.limit', $limit); $this->setState($option . '.memberships.limitstart', $limitstart); $this->_query = $this->_buildQuery(); }
function __construct() { parent::__construct(); $mainframe =& JFactory::getApplication(); $user = JFactory::getUser(); if ($user->get('guest')) { $link = JRequest::getURI(); $link = base64_encode($link); $user_option = RSTicketsProHelper::isJ16() ? 'com_users' : 'com_user'; $mainframe->redirect(RSTicketsProHelper::route('index.php?option=' . $user_option . '&view=login&return=' . $link, false)); } $this->is_staff = RSTicketsProHelper::isStaff(); if (!$this->is_staff) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $permissions = RSTicketsProHelper::getCurrentPermissions(); $message = $this->getRow(); // can update his own replies if (!$permissions->update_ticket_replies && $message->user_id == $user->get('id')) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } // can update customer replies $is_customer = !RSTicketsProHelper::isStaff($message->user_id); if (!$permissions->update_ticket_replies_customers && $is_customer) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } // can update staff replies $is_other_staff = !$is_customer && $message->user_id != $user->get('id'); if (!$permissions->update_ticket_replies_staff && $is_other_staff) { JError::raiseWarning(500, JText::_('RST_CANNOT_UPDATE_TICKET_MESSAGE')); $mainframe->redirect(RSTicketsProHelper::route('index.php?option=com_rsticketspro&view=rsticketspro', false)); } $this->_db = JFactory::getDBO(); $document =& JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/system.css'); $document->addStyleSheet(JURI::root(true) . '/templates/system/css/general.css'); }
/** * Display the view */ function display() { $session = JFactory::getSession(); $document = JFactory::getDocument(); $viewName = JRequest::getVar('view', 'form', 'default', 'cmd'); $modelName = $viewName; if ($viewName == 'emailform') { $modelName = 'form'; } $viewType = $document->getType(); // Set the default view name from the Request $view = $this->getView($viewName, $viewType); // Push a model into the view (may have been set in content plugin already $model = !isset($this->_model) ? $this->getModel($modelName, 'FabrikFEModel') : $this->_model; //test for failed validation then page refresh $model->getErrors(); if (!JError::isError($model) && is_object($model)) { $view->setModel($model, true); } $view->isMambot = $this->isMambot; // Display the view $view->assign('error', $this->getError()); // Workaround for token caching if (in_array(JRequest::getCmd('format'), array('raw', 'csv', 'pdf'))) { $view->display(); } else { $user = JFactory::getUser(); $post = JRequest::get('post'); $cacheid = serialize(array(JRequest::getURI(), $post, $user->get('id'), get_class($view), 'display', $this->cacheId)); $cache = JFactory::getCache('com_fabrik', 'view'); ob_start(); $cache->get($view, 'display', $cacheid); $contents = ob_get_contents(); ob_end_clean(); $token = JUtility::getToken(); $search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#'; $replacement = '<input type="hidden" name="' . $token . '" value="1" />'; echo preg_replace($search, $replacement, $contents); } }
public function load($options = array()) { if (!isset($options['url'])) { $options['url'] = FRoute::_(JRequest::getURI()); } $this->url = $options['url']; // If display mode is specified, set it accordingly. if (isset($options['display'])) { $this->display = $options['display']; } // Set the default text to our own text. $this->text = JText::_('COM_EASYSOCIAL_SHARING_SHARE_THIS'); // If text is provided, allow user to override the default text. if (isset($options['text'])) { $this->text = $options['text']; } // Obey settings $config = FD::config(); foreach (self::$availableVendors as $vendor) { if ($config->get('sharing.vendors.' . $vendor)) { $this->vendors[] = $vendor; } } // Force exclude if (isset($options['exclude'])) { $this->vendors = array_diff($this->vendors, self::$availableVendors); unset($options['exclude']); } // Force include if (isset($options['include'])) { $notInList = array_diff($options['include'], $this->vendors); $this->vendors = array_merge($this->vendors, $options['include']); unset($options['include']); } if (isset($options['css'])) { $this->css = $options['css']; } $this->options = $options; }