function cancel() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $model = $this->getModel('css'); $this->setRedirect('index.php?option=com_webmapplus'); }
public function generateJsonResponse($action, $do, $data) { $response = ''; if (JDEBUG == 1 && defined('JFIREPHP')) { FB::log("Kunena JSON action: " . $action); } // Sanitize $data variable $data = $this->_db->getEscaped($data); if ($this->_my->id) { // We only entertain json requests for registered and logged in users switch ($action) { case 'autocomplete': $response = $this->_getAutoComplete($do, $data); break; case 'preview': $body = JRequest::getVar('body', '', 'post', 'string', JREQUEST_ALLOWRAW); $response = $this->_getPreview($body); break; case 'pollcatsallowed': // TODO: deprecated $response = $this->_getPollsCatsAllowed(); break; case 'pollvote': $vote = JRequest::getInt('kpollradio', ''); $id = JRequest::getInt('kpoll-id', 0); if (!JRequest::checkToken()) { return false; } $response = $this->_addPollVote($vote, $id, $this->_my->id); break; case 'pollchangevote': $vote = JRequest::getInt('kpollradio', ''); $id = JRequest::getInt('kpoll-id', 0); if (!JRequest::checkToken()) { return false; } $response = $this->_changePollVote($vote, $id, $this->_my->id); break; case 'anynomousallowed': // TODO: deprecated $response = $this->_anynomousAllowed(); break; case 'uploadfile': $response = $this->_uploadFile($do); break; case 'modtopiclist': $response = $this->_modTopicList($data); break; case 'removeattachment': $response = $this->_removeAttachment($data); break; default: break; } } else { $response = array('status' => '-1', 'error' => JText::_('COM_KUNENA_AJAX_PERMISSION_DENIED')); } // Output the JSON data. return json_encode($response); }
function save() { // Check for request forgeries JRequest::checkToken() or die('COM_JOOMLEAGUE_GLOBAL_INVALID_TOKEN'); $cid = JRequest::getInt("cid", 0); $post = JRequest::get('post'); if ($cid > 0) { $club =& JTable::getInstance("Club", "Table"); $club->load($cid); $club->bind($post); $params =& JComponentHelper::getParams('com_joomleague'); if ($club->store() && $params->get('cfg_edit_club_info_update_notify') == "1") { $db = JFactory::getDBO(); $user = JFactory::getUser(); $query = "SELECT email\n FROM #__users \n WHERE usertype = 'Super Administrator' \n OR usertype = 'Administrator'"; $db->setQuery($query); $to = $db->loadResultArray(); $subject = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_SUBJECT"), $club->name)); $message = addslashes(sprintf(JText::_("COM_JOOMLEAGUE_ADMIN_EDIT_CLUB_INFO_MESSAGE"), $user->name, $club->name)); $message .= $this->_getShowClubInfoLink(); JUtility::sendMail('', '', $to, $subject, $message); } } $this->setRedirect($this->_getShowClubInfoLink()); }
function remove() { if (!$this->isAllowed($this->aclCat, 'delete')) { return; } JRequest::checkToken() or die('Invalid Token'); $mailid = JRequest::getVar('filter_mail', 0, 'post', 'int'); $queueClass = acymailing_get('class.queue'); $search = JRequest::getString('search'); $filters = array(); if (!empty($search)) { $db = JFactory::getDBO(); $searchVal = '\'%' . acymailing_getEscaped($search, true) . '%\''; $searchFields = array('b.name', 'b.email', 'c.subject', 'a.mailid', 'a.subid'); $filters[] = implode(" LIKE {$searchVal} OR ", $searchFields) . " LIKE {$searchVal}"; } if (!empty($mailid)) { $filters[] = 'a.mailid = ' . intval($mailid); } $total = $queueClass->delete($filters); $app = JFactory::getApplication(); $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $total), 'message'); JRequest::setVar('filter_mail', 0, 'post'); JRequest::setVar('search', '', 'post'); return $this->listing(); }
function sendEmail() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $post = JRequest::get('post'); $this->addModelPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models'); $model = $this->getModel('location'); $location = $model->getData(); $contact_name = $post['contact_name']; $contact_email = $post['contact_email']; $contact_message = $post['contact_message']; if ($contact_name == null || $contact_message == null) { echo JText::_('Please enter a name and message to send.'); return false; } else { if (false) { return false; } else { JUtility::sendMail($contact_email, $contact_name, $location->email, 'Contact Message for: ' . $location->name, $contact_message, 0, null, null, null, $contact_email, $contact_name); echo JText::_('Message Sent'); return true; } } return false; }
/** * Method to change the state of a list of records. */ public function publish() { // Check for request forgeries. JRequest::checkToken() or jexit(JText::_('JInvalid_Token')); // Initialise variables. $user = JFactory::getUser(); $ids = JRequest::getVar('cid', array(), '', 'array'); $values = array('publish' => 1, 'unpublish' => 0, 'trash' => -2); $task = $this->getTask(); $value = JArrayHelper::getValue($values, $task, 0, 'int'); if (empty($ids)) { JError::raiseWarning(500, JText::_('JError_No_items_selected')); } else { // Get the model. $model = $this->getModel(); // Change the state of the records. if (!$model->publish($ids, $value)) { JError::raiseWarning(500, $model->getError()); } else { if ($value == 1) { $text = 'JSuccess_N_Items_published'; } else { if ($value == 0) { $text = 'JSuccess_N_Items_unpublished'; } else { $text = 'JSuccess_N_Items_trashed'; } } $this->setMessage(JText::sprintf($text, count($ids))); } } $this->setRedirect('index.php?option=com_messages&view=messages'); }
/** * Save the configuration */ function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $component = JRequest::getCmd('component'); $table =& JTable::getInstance('component'); if (!$table->loadByOption($component)) { JError::raiseWarning(500, 'Not a valid component'); return false; } $post = JRequest::get('post'); $post['option'] = $component; $table->bind($post); // pre-save checks if (!$table->check()) { JError::raiseWarning(500, $table->getError()); return false; } // save the changes if (!$table->store()) { JError::raiseWarning(500, $table->getError()); return false; } //$this->setRedirect( 'index.php?option=com_config', $msg ); $this->edit(); }
/** * unzip the file * @return bool */ public function unzip() { JRequest::checkToken() or die('Invalid Token'); $appl = JFactory::getApplication(); // if folder doesn't exist - create it! if (!JFolder::exists($this->pathUnzipped)) { JFolder::create($this->pathUnzipped); } else { // let us remove all previous unzipped files $folders = JFolder::folders($this->pathUnzipped); foreach ($folders as $folder) { JFolder::delete($this->pathUnzipped . '/' . $folder); } } $file = JFolder::files($this->pathArchive); $result = JArchive::extract($this->pathArchive . '/' . $file[0], $this->pathUnzipped . '/' . $file[0]); if ($result) { // scan unzipped folders if we find zip file -> unzip them as well $this->unzipAll($this->pathUnzipped . '/' . $file[0]); $message = 'COM_JEDCHECKER_UNZIP_SUCCESS'; } else { $message = 'COM_JEDCHECKER_UNZIP_FAILED'; } $appl->redirect('index.php?option=com_jedchecker&view=uploads', JText::_($message)); return $result; }
/** * Install an extension. * * @return void * @since 1.8 */ public function install() { // Check for request forgeries JRequest::checkToken() or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403)); $app = JFactory::getApplication(); $model = $this->getModel('install'); $r = new JObject(); if ($model->install()) { $cache = JFactory::getCache('mod_menu'); $cache->clean(); // TODO: Reset the users acl here as well to kill off any missing bits $r->success = true; $r->redirect = $app->getUserState('com_installer.redirect_url'); } else { $r->success = false; $r->redirect = $app->getUserState('com_installer.redirect_url'); } if (!$r->redirect) { $r->message = $app->getUserState('com_installer.message'); $r->extensionmessage = $app->getUserState('com_installer.extension_message'); // wipe out the user state $app->setUserState('com_installer.message', ''); $app->setUserState('com_installer.extension_message', ''); } // wipe out the redicrect url $app->setUserState('com_installer.redirect_url', ''); $this->sendJsonResponse($r); }
/** * saves the venue in the database * * @access public * @return void * @since 0.9 */ function save() { // Check for request forgeries JRequest::checkToken() or die('Invalid Token'); // Sanitize $task = JRequest::getVar('task'); $post = JRequest::get('post'); //get model $model = $this->getModel('settings'); if ($model->store($post)) { $msg = JText::_('SETTINGS SAVE'); } else { $msg = JText::_('SAVE SETTINGS FAILED'); } switch ($task) { case 'apply': $link = 'index.php?option=com_eventlist&controller=settings&task=edit'; break; default: $link = 'index.php?option=com_eventlist&view=eventlist'; break; } $model->checkin(); $this->setRedirect($link, $msg); }
function approve() { // Check for request forgeries JRequest::checkToken() or die(JText::_('JINVALID_TOKEN')); // Get items to publish from the request. $cid = JRequest::getVar('cid', array(), '', 'array'); $data = array('approve' => 1, 'disapprove' => 0); $task = $this->getTask(); $value = JArrayHelper::getValue($data, $task, 0, 'int'); if (empty($cid)) { JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED')); } else { // Get the model. $model = $this->getModel(); // Make sure the item ids are integers JArrayHelper::toInteger($cid); // Publish the items. if (!$model->approve($cid, $value)) { JError::raiseWarning(500, $model->getError()); } else { if ($value == 1) { $ntext = $this->text_prefix . '_N_ITEMS_APPROVED'; } else { if ($value == 0) { $ntext = $this->text_prefix . '_N_ITEMS_DISAPPROVED'; } } $this->setMessage(JText::plural($ntext, count($cid))); } } $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); }
public function saveOrder() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $db = JFactory::getDBO(); $cid = $jinput->post->get('cid', array(0), 'array'); //JRequest::getVar( 'cid', array(0), 'post', 'array' ); $order = $jinput->post->get('order', array(0), 'array'); //JRequest::getVar( 'order', array (0), 'post', 'array' ); $total = count($cid); $conditions = array(); JArrayHelper::toInteger($cid, array(0)); JArrayHelper::toInteger($order, array(0)); $row = JTable::getInstance('MultiProfile', 'CTable'); // Update the ordering for items in the cid array for ($i = 0; $i < $total; $i++) { $row->load((int) $cid[$i]); if ($row->ordering != $order[$i]) { $row->ordering = $order[$i]; $row->store(); } } $mainframe = JFactory::getApplication(); $mainframe->redirect('index.php?option=com_community&view=multiprofile', JText::_('COM_COMMUNITY_MULTIPROFILE_ORDERING_SAVED'), 'message'); }
public function cancel() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); $vars = '&ja_tbl_g=' . base64_encode($this->_table) . '&ja_qry_g=' . base64_encode($this->_query); $this->setRedirect('index.php?option=com_mijosql' . $vars, $msg); }
function bgimagemedium() { JRequest::checkToken() or die('Invalid Token'); $post = JRequest::get('post'); $data['image'] = 'shadow1'; $data['iw'] = $post['miw']; $data['ih'] = $post['mih']; $data['sbgc'] = $post['msbgc']; $data['ibgc'] = $post['mibgc']; $data['ibrdc'] = $post['mibrdc']; $data['iec'] = $post['miec']; $data['ie'] = $post['mie']; phocagalleryimport('phocagallery.image.imagebgimage'); $errorMsg = ''; $bgImage = PhocaGalleryImageBgImage::createBgImage($data, $errorMsg); if ($bgImage) { $msg = JText::_('COM_PHOCAGALLERY_SUCCESS_BG_IMAGE'); } else { $msg = JText::_('COM_PHOCAGALLERY_ERROR_BG_IMAGE'); if ($errorMsg != '') { $msg .= '<br />' . $errorMsg; } } $linkSuffix = '&miw=' . $post['miw'] . '&mih=' . $post['mih'] . '&msbgc=' . str_replace('#', '', $post['msbgc']) . '&mibgc=' . str_replace('#', '', $post['mibgc']) . '&mibrdc=' . str_replace('#', '', $post['mibrdc']) . '&mie=' . $post['mie'] . '&miec=' . str_replace('#', '', $post['miec']); $this->setRedirect('index.php?option=com_phocagallery&view=phocagalleryt' . $linkSuffix, $msg); }
/** * Add keyword */ function editTags() { JRequest::checkToken() or die('Invalid Token'); //$user =& JFactory::getUser(); //$model =& $this->getModel('akseo'); $id = JRequest::getInt('artid'); $newTag = JRequest::getWord('newTag'); $tagArray = JRequest::getVar('tags', '', 'post', 'array'); $tagEdit = JRequest::getInt('tagEdit'); $row =& JTable::getInstance('content'); $row->load($id); //if tags selected, remove from keywords if (isset($tagArray) and !empty($tagArray)) { $keywordArray = explode(",", $row->metakey); $newKeys = array_diff($keywordArray, $tagArray); $row->metakey = implode(",", $newKeys); } if (isset($newTag)) { $row->metakey = $row->metakey . ', ' . $newTag; } if (isset($newTag) or isset($newKeys)) { if (!$row->save($row)) { return JError::raiseWarning(500, $row->getError()); } } //$article = $model->getOptions($user->id); return plgSystemAddKeywords::tagList($row, $addkeyParams = null, $tagEdit, $ajax = 1); }
/** * Handles actions confirmed through the confirmation box */ public function confirmed() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // collect type of purge to make $type = JRequest::getCmd('delete_type'); switch ($type) { case 'auto': break; case 'selected': break; case '404': break; default: $this->setError('Invalid data'); $this->display(); break; } // now perform url deletion // get the model to do it, actually // Get/Create the model if ($model =& $this->getModel($this->_defaultModel, 'Sh404sefModel')) { // store initial context in model $model->setContext('com_sh404sef.urls.urls.default'); // call the delete method on our list $model->purge($type); // check errors and enqueue them for display if any $error = $model->getError(); if (!empty($error)) { $this->setError($error); } } // return result to caller $this->display(); }
/** * @see plugins/tienda/payment_paypalpro/library/plgTiendaPayment_Paypalpro_Processor#validateData() */ function validateData($validate_token = true) { /* * perform initial checks */ if (!count($this->_data)) { $this->setError(JText::_('COM_TIENDA_PAYPALPRO_NO_DATA_IS_PROVIDED')); return false; } if ($validate_token) { if (!JRequest::checkToken()) { $this->setError(JText::_('COM_TIENDA_INVALID_TOKEN')); return false; } } // if (!$this->getSubscrTypeObj()) { // $this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_INVALID_ITEM_TYPE')); // return false; // } if (!$this->_getParam('api_username') || !$this->_getParam('api_password') || !$this->_getParam('api_signature')) { $this->setError(JText::_('COM_TIENDA_PAYPALPRO_MESSAGE_MERCHANT_CREDENTIALS_ARE_INVALID')); return false; } return true; }
/** * Method to toggle the featured setting of a list of articles. * * @return void * @since 1.6 */ function featured() { // Check for request forgeries JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $user = JFactory::getUser(); $ids = JRequest::getVar('cid', array(), '', 'array'); $values = array('featured' => 1, 'unfeatured' => 0); $task = $this->getTask(); $value = JArrayHelper::getValue($values, $task, 0, 'int'); // Access checks. foreach ($ids as $i => $id) { if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) { // Prune items that you can't change. unset($ids[$i]); JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED')); } } if (empty($ids)) { JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED')); } else { // Get the model. $model = $this->getModel(); // Publish the items. if (!$model->featured($ids, $value)) { JError::raiseWarning(500, $model->getError()); } } $this->setRedirect('index.php?option=com_content&view=articles'); }
public function save() { JRequest::checkToken('request') or jexit('Invalid Token'); $mainframe = JFactory::getApplication(); $post = JRequest::get('post'); $ids = isset($post['id']) ? $post['id'] : ''; $starts = isset($post['start']) ? $post['start'] : ''; $ends = isset($post['end']) ? $post['end'] : ''; $titles = isset($post['title']) ? $post['title'] : ''; $removal = isset($post['itemRemove']) ? $post['itemRemove'] : ''; $model = DiscussHelper::getModel('Ranks', true); if (!empty($removal)) { $rids = explode(',', $removal); $model->removeRanks($rids); } if (!empty($ids)) { if (count($ids) > 0) { for ($i = 0; $i < count($ids); $i++) { $data = array(); $data['id'] = $ids[$i]; $data['start'] = $starts[$i]; $data['end'] = $ends[$i]; $data['title'] = $titles[$i]; $ranks = DiscussHelper::getTable('Ranks'); $ranks->bind($data); $ranks->store(); } } //end if } //end if $message = JText::_('COM_EASYDISCUSS_RANKING_SUCCESSFULLY_UPDATED'); DiscussHelper::setMessageQueue($message, DISCUSS_QUEUE_SUCCESS); $mainframe->redirect('index.php?option=com_easydiscuss&view=ranks'); }
/** * Logic to save */ function save() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // Get the model $model = $this->getModel('groups'); // Save $result = $model->save(); $cid = $model->getId(); $tabposition = JRequest::getInt('tabposition', 0); $task = JRequest::getCmd('task'); switch ($task) { case 'apply': $link = 'index.php?option=com_rsticketspro&controller=groups&task=edit&cid=' . $cid . '&tabposition=' . $tabposition; if ($result) { $this->setRedirect($link, JText::_('RST_GROUP_SAVED_OK')); } else { $this->setRedirect($link, JText::_('RST_GROUP_SAVED_ERROR')); } break; case 'save': $link = 'index.php?option=com_rsticketspro&view=groups'; if ($result) { $this->setRedirect($link, JText::_('RST_GROUP_SAVED_OK')); } else { $this->setRedirect($link, JText::_('RST_GROUP_SAVED_ERROR')); } break; } }
/** * Handle the save task * * @author RickG */ function save($data = 0){ JRequest::checkToken() or jexit( 'Invalid Token' ); $model = VmModel::getModel('config'); $data = JRequest::get('post'); $data['offline_message'] = JRequest::getVar('offline_message','','post','STRING',JREQUEST_ALLOWHTML); if(strpos($data['offline_message'],'|')!==false){ $data['offline_message'] = str_replace('|','',$data['offline_message']); } if ($model->store($data)) { $msg = JText::_('COM_VIRTUEMART_CONFIG_SAVED'); // Load the newly saved values into the session. VmConfig::loadConfig(); } else { $msg = $model->getError(); } $redir = 'index.php?option=com_virtuemart'; if(JRequest::getCmd('task') == 'apply'){ $redir = $this->redirectPath; } $this->setRedirect($redir, $msg); }
function apply() { JRequest::checkToken() or jexit('Invalid Token'); $applicant = JRequest::get('POST'); jimport('joomla.utilities.date'); $now = new JDate(); if ($applicant['job_id'] != 0) { $unsol_id = $applicant['id']; $applicant['id'] = false; $applicant['request_date'] = $now->toMySQL(); $record =& JTable::getInstance('Applicant', 'Table'); if (!$record->save($applicant)) { // uh oh failed to save JError::raiseError('500', JTable::getError()); } $unsol =& JTable::getInstance('Unsolicited', 'Table'); if (!$unsol->delete($unsol_id)) { // uh oh failed to delete JError::raiseError('500', JTable::getError()); } $this->extendApply($applicant); } else { $applicant['last_updated'] = $now->toMySQL(); $unsol_record =& JTable::getInstance('Unsolicited', 'Table'); if (!$unsol_record->save($applicant)) { // uh oh failed to save JError::raiseError('500', JTable::getError()); } $this->extendApply($applicant); } }
function store() { JRequest::checkToken() or die('Invalid Token'); $plugin = JRequest::getString('plugin'); $plugin = preg_replace('#[^a-zA-Z0-9]#Uis', '', $plugin); $body = JRequest::getVar('templatebody', '', '', 'string', JREQUEST_ALLOWRAW); if (empty($body)) { acymailing_display(JText::_('FILL_ALL'), 'error'); return; } $pluginsFolder = ACYMAILING_MEDIA . 'plugins'; if (!file_exists($pluginsFolder)) { acymailing_createDir($pluginsFolder); } try { jimport('joomla.filesystem.file'); $status = JFile::write($pluginsFolder . DS . $plugin . '.php', $body); } catch (Exception $e) { $status = false; } if ($status) { acymailing_display(JText::_('JOOMEXT_SUCC_SAVED'), 'success'); } else { acymailing_display(JText::sprintf('FAIL_SAVE', $pluginsFolder . DS . $plugin . '.php'), 'error'); } }
function remove() { JRequest::checkToken() or die('Invalid Token'); $app = JFactory::getApplication(); $config = acymailing_config(); $deleteBehaviour = $config->get('frontend_delete_button', 'delete'); $subscriberIds = JRequest::getVar('cid', array(), '', 'array'); if ($app->isAdmin() || $deleteBehaviour == 'delete') { if (!$this->isAllowed('subscriber', 'delete')) { return; } $subscriberObject = acymailing_get('class.subscriber'); $num = $subscriberObject->delete($subscriberIds); $app->enqueueMessage(JText::sprintf('SUCC_DELETE_ELEMENTS', $num), 'message'); } else { if (!$this->isAllowed('subscriber', 'manage')) { return; } $listId = JRequest::getInt('filter_lists', 0); if (empty($listId)) { $app->enqueueMessage('List not found', 'error'); } else { $listsubClass = acymailing_get('class.listsub'); foreach ($subscriberIds as $subid) { $listsubClass->removeSubscription($subid, array($listId)); } $listClass = acymailing_get('class.list'); $list = $listClass->get($listId); $app->enqueueMessage(JText::sprintf('IMPORT_REMOVE', count($subscriberIds), $list->name), 'message'); } } JRequest::setVar('layout', 'listing'); return parent::display(); }
public function save() { // Check for request forgeries JRequest::checkToken() or die('RESTRICTED'); $row = WFExtensionHelper::getPlugin(null, 'jcemediabox', 'system'); $task = $this->getTask(); // remove id for Joomla! 2.5+ if ($row->extension_id) { unset($row->id); } if (!$row->bind(JRequest::get('post'))) { JError::raiseError(500, $row->getError()); } if (!$row->check()) { JError::raiseError(500, $row->getError()); } if (!$row->store()) { JError::raiseError(500, $row->getError()); } $row->checkin(); $msg = JText::sprintf('WF_MEDIABOX_SAVED'); switch ($task) { case 'apply': $this->setRedirect('index.php?option=com_jce&view=mediabox', $msg); break; case 'save': default: $this->setRedirect('index.php?option=com_jce&view=cpanel', $msg); break; } }
public function makemainurl() { // Check for request forgeries JRequest::checkToken() or jexit('Invalid Token'); // find and store edited item id $cid = JRequest::getVar('cid', array(0), 'default', 'array'); // check invalid data if (!is_array($cid) || count($cid) != 1 || intval($cid[0]) == 0) { $redirect = array('c' => "duplicates", 'tmpl' => 'component', 'cid[]' => JRequest::getInt('mainurl_id')); $this->setRedirect($this->_getDefaultRedirect($redirect), JText16::_('COM_SH404SEF_SELECT_ONE_URL'), 'error'); // send back response through default view $this->display(); } // now make that url the main url // while also setting the previous // with this url current rank // get the model to do it, actually // Get/Create the model if ($model =& $this->getModel($this->_defaultModel, 'Sh404sefModel')) { // store initial context in model $model->setContext($this->_context); // call the delete method on our list $model->makeMainUrl(intval($cid[0])); // check errors and enqueue them for display if any $errors = $model->getErrors(); if (!empty($errors)) { $this > enqueuemessages($errors, 'error'); } } // send back response through default view $this->display(); }
/** * save a record (and redirect to main page) * @return void */ function save() { JRequest::checkToken() or jexit('Invalid Token'); $post = JRequest::get('post'); $task = JRequest::getVar('task'); $model =& $this->getModel('hotellinkedit'); if ($model->store($post)) { switch ($task) { case 'apply': $link = 'index.php?option=com_hotelguide&view=hotellinkedit&cid[]=' . (int) $model->get('id'); break; case 'saveandnew': $link = 'index.php?option=com_hotelguide&view=hotellinkedit'; break; default: $link = 'index.php?option=com_hotelguide&view=hotellinks'; break; } $msg = JText::_('HG_LINK_SAVED'); } else { $link = 'index.php?option=com_hotelguide&view=hotellinks'; $msg = JText::_('HG_ERROR_SAVING_LINK'); } $this->setRedirect($link, $msg); }
function emailFriend() { JRequest::checkToken() or jexit('Invalid Token'); require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_member.php'; $app = JFactory::getApplication(); if (JobBoardHelper::verifyHumans()) { if (!JobBoardMemberHelper::matchHumanCode(JRequest::getString('human_ver', ''))) { $post = JArrayHelper::toObject(JRequest::get('post')); $post->errors = 1; if (isset($post->human_ver)) { unset($post->human_ver); } $app->setUserState('com_jobboard.sfields', $post); $app->redirect(JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $post->job_id . '&Itemid=' . JRequest::getInt('Itemid')), JText::_('COM_JOBBOARD_FORM_CAPTCHA_FAILMSG'), 'error'); return; } } $message = new JObject(); $message->job_id = JRequest::getVar('job_id', '', '', 'int'); $catid = JRequest::getVar('catid', '', '', 'int'); $message->job_title = JRequest::getVar('job_title', '', '', 'string'); $message->job_city = JRequest::getVar('job_city', '', '', 'string'); $message->personal_message = JRequest::getVar('personal_message', '', '', 'string'); $uri =& JURI::getInstance(); $message->link = $uri->getScheme() . '://' . $uri->getHost() . JRequest::getVar('job_path', '', '', 'string'); $fields_valid = $this->validateFields(); $message->sender_email = $fields_valid->sender_email; $message->sender_name = $fields_valid->sender_name; $message->rec_emails = $fields_valid->rec_emails; if ($fields_valid->errors === true) { $errmsg = $fields_valid->errmsg . '</ul>'; $app->setUserState('sfields', $message); $link = JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $message->job_id . '&Itemid=' . $itemid); $this->setRedirect($link, $errmsg, ''); return; } else { if (stristr($message->rec_emails, ',') === TRUE) { $rec_emailarray = explode(',', $message->rec_emails); foreach ($rec_emailarray as $email_recipient) { $this->sendEmail($message, trim($email_recipient)); } } else { $this->sendEmail($message, trim($message->rec_emails)); } $mesgModel =& $this->getModel('Message'); $saved = $mesgModel->saveMessage($message); if ($saved) { $msg = ' ' . JText::_('SEND_MSG_SUCCESS'); $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false); $this->setRedirect($link, $msg, ''); return; } else { $msg = ' ' . JText::_('ERR_WAIT'); $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false); $this->setRedirect($link, $msg, ''); return; } } parent::display(); }
/** * Removes an item */ function delete() { // Check for request forgeries JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $user = JFactory::getUser(); $ids = JRequest::getVar('cid', array(), '', 'array'); // Access checks. foreach ($ids as $i => $id) { if (!$user->authorise('core.delete', 'com_content.article.' . (int) $id)) { // Prune items that you can't delete. unset($ids[$i]); JError::raiseNotice(403, JText::_('JERROR_CORE_DELETE_NOT_PERMITTED')); } } if (empty($ids)) { JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED')); } else { // Get the model. $model = $this->getModel(); // Remove the items. if (!$model->featured($ids, 0)) { JError::raiseWarning(500, $model->getError()); } } $this->setRedirect('index.php?option=com_content&view=featured'); }
function close() { global $mainframe; JRequest::checkToken() or jexit('Invalid Token'); $link = 'index.php?option=com_imageshow'; $mainframe->redirect($link); }