/** * Handle editing aliases from the aliases * manager. cid contains the id of the * alias record we want to edit. Need to be * turned into that of the SEF url id, * so as to be able to use the editurl view * to edit all aliases for this url */ public function edit() { // hide the main menu JRequest::setVar('hidemainmenu', 1); // find and store edited item id $cid = JRequest::getVar('cid', array(0), 'default', 'array'); $this->_id = $cid[0]; // find to which url this alias record belongs to // get a model and ask for the matching URL record $model =& $this->getModel('aliases', 'Sh404sefModel'); $url = $model->getUrlByAliasId($this->_id); // push that as a request var, so that we fake editing an url if (!empty($url) && !empty($url->id)) { $cid = array($url->id); Jrequest::setVar('cid', $cid); } // need to get the view to push the url data into it $viewName = JRequest::getWord('view'); if (empty($viewName)) { JRequest::setVar('view', $this->_defaultView); } $document =& JFactory::getDocument(); $viewType = $document->getType(); $viewName = JRequest::getCmd('view'); $this->_editView = $viewName; $viewLayout = JRequest::getCmd('layout', $this->_defaultLayout); $view =& $this->getView($viewName, $viewType, '', array('base_path' => $this->_basePath)); // now we can push the url into the view $view->assign('url', $url); // will prevent user from editing the non-sef url $view->assign('noUrlEditing', true); // Call the base controller to do the rest $this->display(); }
function display($cachable = false, $urlparams = false) { global $javconfig; $layout = Jrequest::getVar('layout'); $per = FALSE; $permission = $javconfig['systems']->get('user_group', "1,6,7,2,3,4,5,10,12,8"); if ($permission) { $permissions = explode(",", $permission); $user = JFactory::getUser(); //Get all groups that the user is mapped to recursively. $groups = $user->getAuthorisedGroups(); if ($user->id) { if ($permissions[0] == "1") { $per = TRUE; } else { foreach ($groups as $gkey => $gVal) { if (in_array($gVal, $permissions)) { $per = TRUE; break; } } } } } if (!$per && ($layout == 'guide' || $layout == 'form')) { Jrequest::setVar('layout', 'list'); } Jrequest::setVar('permission', $per); parent::display($cachable = false, $urlparams = false); return TRUE; }
/** * run on formModel::setFormData() * set before form is validated * @param int repeat group counter * @return null */ public function preProcess($c) { $params =& $this->getParams(); // $$$ hugh - special case for social plugins (like CB plugin). If plugin sets // fabrik.plugin.profile_id, and 'user_use_social_plugin_profile' param is set, // and we are creating a new row, then use the session data as the user ID. // This allows user B to view a table in a CB profile for user A, do an "Add", // and have the user element set to user A's ID. // TODO - make this table/form specific, but not so easy to do in CB plugin if ((int) $params->get('user_use_social_plugin_profile', 0)) { if (JRequest::getInt('rowid') == 0 && JRequest::getCmd('task') !== 'doimport') { $session =& JFactory::getSession(); if ($session->has('fabrik.plugin.profile_id')) { $profile_id = $session->get('fabrik.plugin.profile_id'); $form =& $this->getForm(); $group =& $this->getGroup(); $joinid = $group->getGroup()->join_id; $key = $this->getFullName(true, true, false); $shortkey = $this->getFullName(false, true, false); $rawkey = $key . '_raw'; if ($group->canRepeat()) { if ($group->isJoin()) { $key = str_replace("][", '.', $key); $key = str_replace(array('[', ']'), '.', $key) . "{$c}"; $rawkey = str_replace($shortkey, $shortkey . '_raw', $key); } else { $key = $key . '.' . $c; $rawkey = $rawkey . '.' . $c; } } else { if ($group->isJoin()) { $key = str_replace("][", ".", $key); $key = str_replace(array('[', ']'), '.', $key); $key = rtrim($key, '.'); $rawkey = str_replace($shortkey, $shortkey . '_raw', $key); } } $form->updateFormData($key, "{$profile_id}"); $form->updateFormData($rawkey, "{$profile_id}"); JRequest::setVar($key, "{$profile_id}", 'POST'); Jrequest::setVar($rawkey, "{$profile_id}", 'POST'); } } } }
function submitinfo() { jimport('joomla.mail.helper'); $app =& JFactory::getApplication(); $params = JComponentHelper::getParams('com_redevent'); if (!$params->get('enable_moreinfo', 1)) { echo Jtext::_('COM_REDEVENT_MOREINFO_ERROR_DISABLED_BY_ADMIN'); $app->close(403); } $xref = JRequest::getInt('xref'); $email = JRequest::getVar('email'); $model = $this->getModel('details'); $details = $model->getDetails(); if ($xref && $email && JMailHelper::isEmailAddress($email)) { $mailer =& JFactory::getMailer(); $mailer->IsHTML(true); $mailer->setSubject(JText::sprintf('COM_REDEVENT_MOREINFO_MAIL_SUBJECT', $details->full_title)); $mailer->AddAddress($app->getCfg('mailfrom'), $app->getCfg('sitename')); $mailer->AddReplyTo(array($email, JRequest::getVar('name'))); $data = array(); if ($d = JRequest::getVar('name')) { $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_NAME'), $d); } if ($d = JRequest::getVar('email')) { $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_EMAIL'), $d); } if ($d = JRequest::getVar('company')) { $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_COMPANY'), $d); } if ($d = JRequest::getVar('phonenumber')) { $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_PHONENUMBER'), $d); } if ($d = JRequest::getVar('comments')) { $data[] = array(Jtext::_('COM_REDEVENT_MOREINFO_LABEL_COMMENTS'), str_replace("\n", "<br/>", $d)); } $table = '<table>'; foreach ($data as $d) { $table .= '<tr><td>' . $d[0] . '</td><td>' . $d[1] . '</td></tr>'; } $table .= '</table>'; $link = JRoute::_(JURI::base() . RedeventHelperRoute::getDetailsRoute($details->did, $details->xslug)); $link = JHTML::link($link, $details->full_title); $body = JText::sprintf('COM_REDEVENT_MOREINFO_MAIL_BODY', $link, $table); $mailer->setBody($body); $mailer->send(); } // confirm sending JRequest::setVar('view', 'moreinfo'); Jrequest::setVar('layout', 'final'); $this->display(); }
/** * Save configuration record */ function save() { $option = JRequest::getCmd('option'); $model = $this->getModel('configs'); $item = $model->getItems(); $data = $item->data; $params = class_exists('JRegistry') ? new JRegistry($data) : new JParameter($data); //JRequest::checkToken () or jexit ( 'Invalid Token' ); $task = $this->getTask(); $cache = JFactory::getCache($option); $cache->clean(); $group = JRequest::getVar('group', 'systems'); if ($group == '') { $group = 'systems'; } $paramsField = JRequest::getVar($group, null, 'request', 'array'); // Build parameter INI string $access = JRequest::getVar('access', NULL); if (isset($access)) { $paramsField['access'] = $access; } if ($paramsField) { if ($group == 'plugin') { if (!isset($paramsField['enable_avatar'])) { $paramsField['enable_avatar'] = 0; } if (!isset($paramsField['enable_activity_stream'])) { $paramsField['enable_activity_stream'] = 0; } if (!isset($paramsField['enable_bbcode'])) { $paramsField['enable_bbcode'] = 0; } if (!isset($paramsField['enable_youtube'])) { $paramsField['enable_youtube'] = 0; } if (!isset($paramsField['enable_tweetmeme'])) { $paramsField['enable_tweetmeme'] = 0; } if (!isset($paramsField['enable_smileys'])) { $paramsField['enable_smileys'] = 0; } if (!isset($paramsField['enable_after_the_deadline'])) { $paramsField['enable_after_the_deadline'] = 0; } if (!isset($paramsField['enable_addtoany'])) { $paramsField['enable_addtoany'] = 0; } if (!isset($paramsField['enable_addthis'])) { $paramsField['enable_addthis'] = 0; } if (!isset($paramsField['is_attach_image'])) { $paramsField['is_attach_image'] = 0; } if (!isset($paramsField['is_enable_captcha'])) { $paramsField['is_enable_captcha'] = 0; } if (!isset($paramsField['is_enable_captcha_user'])) { $paramsField['is_enable_captcha_user'] = 0; } if (!isset($paramsField['enable_pathway'])) { $paramsField['enable_pathway'] = 0; } if (!isset($paramsField['enable_your_items'])) { $paramsField['enable_your_items'] = 0; } if (!isset($paramsField['enable_login_form'])) { $paramsField['enable_login_form'] = 0; } if (!isset($paramsField['enable_button_create_new'])) { $paramsField['enable_button_create_new'] = 0; } $paramsField['attach_file_type'] = implode(",", $paramsField['attach_file_type']); } foreach ($paramsField as $k => $v) { $params->set($k, $v); } if ($group == 'systems') { $user_groups = JRequest::getVar('user_group', array(), 'post', 'array'); $user_group = 0; if ($user_groups) { $user_group = implode(",", $user_groups); foreach ($user_groups as $k => $v) { if ($v == "0") { $user_group = 0; break; } } } else { $user_group = 0; } $params->set('user_group', $user_group); } $post['data'] = $params->toString(); $model->setState('request', $post); if ($id = $model->store()) { $msg = JText::_('UPDATED_CONFIGURATION_SUCCESSFULLY'); } else { Jrequest::setVar('task', $group); Jrequest::setVar('layout', $group); Jrequest::setVar('group', $group); parent::display(); return FALSE; } } if ($task != 'saveIFrame') { $this->setRedirect("index.php?option={$option}&view=configs&group={$group}", $msg); } else { return TRUE; } return true; }