当前位置: 首页>>代码示例>>PHP>>正文


PHP JRequest::checkToken方法代码示例

本文整理汇总了PHP中JRequest::checkToken方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::checkToken方法的具体用法?PHP JRequest::checkToken怎么用?PHP JRequest::checkToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JRequest的用法示例。


在下文中一共展示了JRequest::checkToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cancel

 function cancel()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $model = $this->getModel('css');
     $this->setRedirect('index.php?option=com_webmapplus');
 }
开发者ID:notWood,项目名称:webmapplus,代码行数:7,代码来源:css.php

示例2: generateJsonResponse

 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);
 }
开发者ID:vuchannguyen,项目名称:hoctap,代码行数:60,代码来源:kunena.ajax.helper.php

示例3: save

 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());
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:25,代码来源:clubinfo.php

示例4: remove

 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();
 }
开发者ID:educakanchay,项目名称:educa,代码行数:26,代码来源:queue.php

示例5: 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;
 }
开发者ID:notWood,项目名称:webmapplus,代码行数:25,代码来源:controller.php

示例6: publish

 /**
  * 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');
 }
开发者ID:joebushi,项目名称:joomla,代码行数:36,代码来源:messages.php

示例7: save

 /**
  * 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();
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:29,代码来源:component.php

示例8: unzip

 /**
  * 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;
 }
开发者ID:angelexevior,项目名称:jedchecker,代码行数:30,代码来源:uploads.php

示例9: install

	/**
	 * 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);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:41,代码来源:install.json.php

示例10: save

 /**
  * 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);
 }
开发者ID:RangerWalt,项目名称:ecci,代码行数:32,代码来源:settings.php

示例11: approve

 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));
 }
开发者ID:scarsroga,项目名称:blog-soa,代码行数:32,代码来源:phocagallerycs.php

示例12: saveOrder

 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');
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:27,代码来源:multiprofile.php

示例13: cancel

 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);
 }
开发者ID:pguilford,项目名称:vcomcc,代码行数:7,代码来源:edit.php

示例14: bgimagemedium

 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);
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:26,代码来源:phocagalleryt.php

示例15: editTags

 /**
  * 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);
 }
开发者ID:hideaz2011,项目名称:We-Share-Articles,代码行数:31,代码来源:controller.php


注:本文中的JRequest::checkToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。