本文整理汇总了PHP中jexit函数的典型用法代码示例。如果您正苦于以下问题:PHP jexit函数的具体用法?PHP jexit怎么用?PHP jexit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jexit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: featured
/**
* Method to toggle the featured setting of a list of articles.
*
* @return void
* @since 1.6
*/
function featured()
{
// Check for request forgeries
JSession::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');
}
示例2: save
/**
* 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;
}
}
示例3: getInstance
/**
* Returns a session storage handler object, only creating it if it doesn't already exist.
*
* @param name $name The session store to instantiate
* @param array $options Array of options
*
* @return JSessionStorage
*
* @since 11.1
*/
public static function getInstance($name = 'none', $options = array())
{
static $instances;
if (!isset($instances))
{
$instances = array();
}
$name = strtolower(JFilterInput::getInstance()->clean($name, 'word'));
if (empty($instances[$name]))
{
$class = 'JSessionStorage' . ucfirst($name);
if (!class_exists($class))
{
$path = dirname(__FILE__) . '/storage/' . $name . '.php';
if (file_exists($path))
{
require_once $path;
}
else
{
// No call to JError::raiseError here, as it tries to close the non-existing session
jexit('Unable to load session storage class: ' . $name);
}
}
$instances[$name] = new $class($options);
}
return $instances[$name];
}
示例4: featured
/**
* Method to toggle the featured setting of a list of memberss.
*
* @return void
*
* @since 1.7.0
*/
public function featured()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Initialise variables.
$user = JFactory::getUser();
$app = JFactory::getApplication();
$ids = $app->input->get('id', [], 'array');
$task = $this->getTask();
$value = Joomla\Utilities\ArrayHelper::getValue($values, $task, 0, 'int');
// Get the model.
$model = $this->getModel();
// Access checks.
foreach ($ids as $i => $id) {
if (!$user->authorise('core.edit.state')) {
// Prune items that you can't change.
unset($ids[$i]);
$app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice');
}
}
if (empty($ids)) {
$app->enqueueMessage(JText::_('COM_CHURCHDIRECTORY_NO_ITEM_SELECTED'), 'warning');
} else {
// Publish the items.
if (!$model->featured($ids, $value)) {
$app->enqueueMessage($model->getError(), 'warning');
}
}
$this->setRedirect('index.php?option=com_churchdirectory&view=postions');
}
示例5: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$data = $this->input->post->get('jform', array(), 'array');
$itemId = Joomla\Utilities\ArrayHelper::getValue($data, "id");
$redirectOptions = array("task" => $this->getTask(), "id" => $itemId);
$model = $this->getModel();
/** @var $model CrowdfundingModelComment */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED"), 500);
}
// Validate the form data
$validData = $model->validate($form, $data);
// Check for errors
if ($validData === false) {
$this->displayNotice($form->getErrors(), $redirectOptions);
return;
}
try {
$itemId = $model->save($validData);
$redirectOptions["id"] = $itemId;
} catch (Exception $e) {
JLog::add($e->getMessage());
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
}
$this->displayMessage(JText::_('COM_CROWDFUNDING_COMMENT_SAVED'), $redirectOptions);
}
示例6: sendEmail
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;
}
示例7: save
public function save()
{
// check for request forgeries
YRequest::checkToken() or jexit('Invalid Token');
// init vars
$post = YRequest::get('post');
try {
// bind post
$this->application->bind($post, array('params'));
// set params
$params = $this->application->getParams()->remove('global.')->set('group', @$post['group'])->set('template', @$post['template'])->set('global.config.', @$post['params']['config'])->set('global.template.', @$post['params']['template']);
if (isset($post['addons']) && is_array($post['addons'])) {
foreach ($post['addons'] as $addon => $value) {
$params->set("global.{$addon}.", $value);
}
}
$this->application->params = $params->toString();
// save application
YTable::getInstance('application')->save($this->application);
// set redirect
$msg = JText::_('Application Saved');
$link = $this->link_base . '&changeapp=' . $this->application->id;
} catch (YException $e) {
// raise notice on exception
JError::raiseNotice(0, JText::_('Error Saving Application') . ' (' . $e . ')');
// set redirect
$msg = null;
$link = $this->baseurl . '&task=add';
}
$this->setRedirect($link, $msg);
}
示例8: emailFriend
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();
}
示例9: help
public function help()
{
$user = JFactory::getUser();
$jinput = JFactory::getApplication()->input;
// Check Token!
$token = JSession::getFormToken();
$call_token = $jinput->get('token', 0, 'ALNUM');
if ($user->id != 0 && $token == $call_token) {
$task = $this->getTask();
switch ($task) {
case 'getText':
try {
$idValue = $jinput->get('id', 0, 'INT');
if ($idValue) {
$result = $this->getHelpDocumentText($idValue);
} else {
$result = '';
}
echo $result;
// stop execution gracefully
jexit();
} catch (Exception $e) {
// stop execution gracefully
jexit();
}
break;
}
} else {
// stop execution gracefully
jexit();
}
}
示例10: makemainurl
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();
}
示例11: geoupdate
/**
* Method to update members geoupdate location.
*
* @return void
*
* @since 1.7.0
*/
public function geoupdate()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$user = JFactory::getUser();
$ids = $this->input->get('cid', [], 'array');
// Get the model.
/** @var ChurchDirectoryModelGeoStatus $model */
$model = $this->getModel();
// Access checks.
foreach ($ids as $i => $id) {
$item = $model->getItem($id);
if (!$user->authorise('core.edit.state', 'com_churchdirectory.category.' . (int) $item->catid)) {
// Prune items that you can't change.
unset($ids[$i]);
$app->enqueueMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'notice');
}
}
if (empty($ids)) {
$app->enqueueMessage(JText::_('COM_CHURCHDIRECTORY_NO_ITEM_SELECTED'), 'error');
} else {
// Publish the items.
if (!$model->update($ids)) {
$app->enqueueMessage($model->getError(), 'error');
}
}
$this->setRedirect('index.php?option=com_churchdirectory&view=geostatus');
}
示例12: display
/**
* Display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{
$document = JFactory::getDocument();
$document->setMimeEncoding('application/json');
$showcaseID = JRequest::getVar('showcase_id');
$objJSNShowcase = JSNISFactory::getObj('classes.jsn_is_showcase');
$objShowcaseTheme = JSNISFactory::getObj('classes.jsn_is_showcasetheme');
$themeProfile = $objShowcaseTheme->getThemeProfile($showcaseID);
if ($showcaseID > 0 && !is_null($themeProfile)) {
$showcaseData = $objJSNShowcase->getShowcaseByID($showcaseID);
} elseif ($showcaseID > 0 && is_null($themeProfile)) {
$theme = JRequest::getVar('theme');
$showcaseTable = JTable::getInstance('showcase', 'Table');
$showcaseTable->showcase_id = $showcaseID;
$showcaseTable->theme_name = $theme;
$showcaseData = $showcaseTable;
} else {
$theme = JRequest::getVar('theme');
$showcaseTable = JTable::getInstance('showcase', 'Table');
$showcaseTable->showcase_id = 0;
$showcaseTable->theme_name = $theme;
$showcaseData = $showcaseTable;
}
$objJSNUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$URL = dirname($objJSNUtils->overrideURL()) . '/';
$dataObj = $objJSNShowcase->getShowcase2JSON($showcaseData, $URL);
echo json_encode($dataObj);
jexit();
}
示例13: revert
public function revert()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$pks = $app->input->post->get('cid', array(), 'array');
$pk = (int) count($pks) ? $pks[0] : 0;
$type = $app->input->post->getString('element_type', 'type');
$model = $this->getModel();
$user = JFactory::getUser();
$res = $user->authorise('core.edit', CCK_COM) ? $model->revert($pk, $type) : false;
if ($res) {
if ($type == 'search') {
$link = _C4_LINK;
} elseif ($type == 'type') {
$link = _C2_LINK;
}
$msg = JText::_('COM_CCK_SUCCESSFULLY_RESTORED');
$type = 'message';
} else {
$link = _C6_LINK . '&filter_e_type=' . $type;
$msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
$type = 'error';
}
$this->setRedirect($link, $msg, $type);
}
示例14: apply
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);
}
}
示例15: display
public function display($cachable = false, $urlparams = false)
{
header('Content-type: text/html; charset=ISO-8859-1');
$params = JComponentHelper::getParams('com_jak2filter');
$indexing = (int) $params->get('indexing_cron', 1);
$interval = (int) $params->get('indexing_interval', 900);
$interval = $interval * 60;
$cronkey = $params->get('indexing_cron_key', 'indexing');
if (!$indexing) {
return;
}
$db = JFactory::getDbo();
$query = "SELECT updatetime FROM #__jak2filter WHERE `name` = 'cron'";
$db->setQuery($query);
$updatetime = $db->loadResult();
$updatetime = !$updatetime ? 0 : strtotime($updatetime);
$key = JRequest::getVar('jakey');
$run = $updatetime + $interval < time() || $key == $cronkey;
if ($run) {
$now = date('Y-m-d H:i:s');
$query = "\n\t\t\t\t\tINSERT INTO #__jak2filter\n\t\t\t\t\tSET \n\t\t\t\t\t\t`name` = 'cron',\n\t\t\t\t\t\t`updatetime` = " . $db->quote($now) . ",\n\t\t\t\t\t\t`value` = 1\n\t\t\t\t\tON DUPLICATE KEY UPDATE\n\t\t\t\t\t\t`updatetime` = " . $db->quote($now) . ",\n\t\t\t\t\t\t`value` = 1\n\t\t\t\t\t";
$db->setQuery($query);
$db->query();
//
$helper = new JAK2FilterHelper();
$helper->indexingData('cron');
} else {
$msg = JText::sprintf('The cron job will be run on %s', date('Y-m-d H:i:s', $updatetime + $interval));
jexit($msg);
}
}