本文整理汇总了PHP中JRequest::getString方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::getString方法的具体用法?PHP JRequest::getString怎么用?PHP JRequest::getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRequest
的用法示例。
在下文中一共展示了JRequest::getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$params = $this->form->getValue('params');
//remove request param lable
$doc = JFactory::getDocument();
$doc->addScriptDeclaration("\$(window).addEvent('load', function(){jQuery('#jform_params_jarequest-lbl').parent().remove();});");
$task = JRequest::getString('task', '');
$jarequest = strtolower(JRequest::getString('jarequest'));
//process
if ($jarequest && $task) {
//load file to excute task
require_once dirname(dirname(dirname(__FILE__))) . '/admin/jarequest/' . $jarequest . '.php';
$obLevel = ob_get_level();
if ($obLevel) {
while ($obLevel > 0) {
ob_end_clean();
$obLevel--;
}
} else {
ob_clean();
}
$obj = new $jarequest();
$data = $obj->{$task}($params);
echo json_encode($data);
exit;
}
}
示例2: login
/**
* Method to log in a user.
*
* @access public
* @since 1.0
*/
function login()
{
JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token'));
$app =& JFactory::getApplication();
$data = $app->getUserState('users.login.form.data', array());
// Set the return URL if empty.
if (!isset($data['return']) || empty($data['return'])) {
$data['return'] = 'index.php?option=com_users&view=profile';
}
// Get the log in options.
$options = array();
$options['remember'] = JRequest::getBool('remember', false);
$options['return'] = $data['return'];
// Get the log in credentials.
$credentials = array();
$credentials['username'] = JRequest::getVar('username', '', 'method', 'username');
$credentials['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
// Perform the log in.
$error = $app->login($credentials, $options);
// Check if the log in succeeded.
if (!JError::isError($error)) {
$app->setUserState('users.login.form.data', array());
$app->redirect(JRoute::_($data['return'], false));
} else {
$data['remember'] = (int) $options['remember'];
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}
}
示例3: fetchMethodForm
function fetchMethodForm($uid, $step, $update = false)
{
global $task;
switch ($step) {
case 2:
$lists = array();
$lists['action'] = _taskLink($task, $uid, array('step' => $step + 1), false);
return HTML_DMUploadMethod::linkFileForm($lists);
break;
case 3:
$url = stripslashes(JRequest::getString('url', 'http://'));
$err = DMUploadMethod::linkFileProcess($uid, $step, $url);
if ($err['_error']) {
_returnTo($task, $err['_errmsg'], '', array("method" => 'link', "step" => $step - 1, "localfile" => '', "url" => DOCMAN_Utils::safeEncodeURL($url)));
}
$uploaded = DOCMAN_Utils::safeEncodeURL(_DM_DOCUMENT_LINK . $url);
$catid = $update ? 0 : $uid;
$docid = $update ? $uid : 0;
$session = JFactory::getSession();
$session->set('docman.dmfilename', _DM_DOCUMENT_LINK);
$session->set('docman.document_url', $url);
return fetchEditDocumentForm($docid, $uploaded, $catid);
break;
default:
break;
}
return true;
}
示例4: send_certificate
function send_certificate()
{
$app = JFactory::getApplication();
$params = $app->getParams();
$moodle_url = $params->get('MOODLE_URL');
$cert_id = JRequest::getVar('cert_id');
$simple = JRequest::getVar('simple');
$email = JRequest::getString('mailto', '', 'post');
$sender = JRequest::getString('sender', '', 'post');
$from = JRequest::getString('from', '', 'post');
$user = JFactory::getUser();
$username = $user->username;
$subject_default = JText::sprintf('COM_JOOMDLE_CERTIFICATE_EMAIL_SUBJECT', $user->name);
$subject = JRequest::getString('subject', $subject_default, 'post');
if (!$subject) {
$subject = $subject_default;
}
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array($config->get('mailfrom'), $config->get('fromname'));
$mailer->setSender($sender);
$mailer->addRecipient($email);
$body = JText::sprintf('COM_JOOMDLE_CERTIFICATE_EMAIL_BODY', $user->name);
$mailer->setSubject($subject);
$mailer->setBody($body);
$session = JFactory::getSession();
$token = md5($session->getId());
$pdf = file_get_contents($moodle_url . '/auth/joomdle/' . $simple . 'certificate_view.php?id=' . $cert_id . '&certificate=1&action=review&username=' . $username . '&token=' . $token);
$tmp_path = $config->get('tmp_path');
$filename = 'certificate-' . $cert_id . '-' . $user->name . '.pdf';
file_put_contents($tmp_path . '/' . $filename, $pdf);
$mailer->addAttachment($tmp_path . '/' . $filename);
$send = $mailer->Send();
unlink($tmp_path . '/' . $filename);
if ($send !== true) {
JError::raiseNotice(500, JText::_('COM_JOOMDLE_EMAIL_NOT_SENT'));
} else {
?>
<div style="padding: 10px;">
<div style="text-align:right">
<a href="javascript: void window.close()">
<?php
echo JText::_('COM_JOOMDLE_CLOSE_WINDOW');
?>
<?php
echo JHtml::_('image', 'mailto/close-x.png', NULL, NULL, true);
?>
</a>
</div>
<h2>
<?php
echo JText::_('COM_JOOMDLE_EMAIL_SENT');
?>
</h2>
</div>
<?php
}
}
示例5: getMtCats
public static function getMtCats($params = array())
{
$db = oseDB::instance();
$user = JFactory::getUser();
$user_id = JRequest::getInt('member_id', 0);
$rootName = 'root';
$node = JRequest::getString('node', $rootName);
$node_id = explode('/', $node);
$node_id = $node_id[count($node_id) - 1];
//oseExit($node_id);
$parant_id = $node_id == $rootName ? 0 : $node_id;
//oseExit($parant_id);
$query = " SELECT * FROM `#__mt_cats` " . " WHERE cat_parent = {$parant_id}";
$db->setQuery($query);
//oseExit($db->_sql);
$items = oseDB::loadList();
foreach ($items as $key => $item) {
$item['id'] = $node . '/' . $item['cat_id'];
$item['leaf'] = false;
$item['cls'] = 'folder';
$item['text'] = $item['cat_name'];
$items[$key] = $item;
}
if (empty($items)) {
$result['total'] = 0;
$result['results'] = '';
} else {
$result['total'] = count($items);
$result['results'] = $items;
}
return $items;
}
示例6: export
function export()
{
$selectedMail = JRequest::getInt('filter_mail', 0);
$selectedStatus = JRequest::getString('filter_status', '');
$filters = array();
if (!empty($selectedMail)) {
$filters[] = 'a.mailid = ' . $selectedMail;
}
if (!empty($selectedStatus)) {
if ($selectedStatus == 'bounce') {
$filters[] = 'a.bounce > 0';
} elseif ($selectedStatus == 'open') {
$filters[] = 'a.open > 0';
} elseif ($selectedStatus == 'notopen') {
$filters[] = 'a.open < 1';
} elseif ($selectedStatus == 'failed') {
$filters[] = 'a.fail > 0';
}
}
$query = 'SELECT `subid` FROM `#__acymailing_userstats` as a ';
if (!empty($filters)) {
$query .= ' WHERE (' . implode(') AND (', $filters) . ')';
}
$currentSession =& JFactory::getSession();
$currentSession->set('acyexportquery', $query);
$this->setRedirect(acymailing_completeLink('data&task=export&sessionquery=1', false, true));
}
示例7: store
function store()
{
$table =& $this->getTable();
$info = JRequest::get('post');
// Fix HTML
$info['htmltext'] = JRequest::getString('htmltext', '', 'post', JREQUEST_ALLOWRAW);
$info['htmlsmall'] = JRequest::getString('htmlsmall', '', 'post', JREQUEST_ALLOWRAW);
$info['htmllarge'] = JRequest::getString('htmllarge', '', 'post', JREQUEST_ALLOWRAW);
$info['htmlbutton'] = JRequest::getString('htmlbutton', '', 'post', JREQUEST_ALLOWRAW);
$info['htmlcustom'] = JRequest::getString('htmlcustom', '', 'post', JREQUEST_ALLOWRAW);
// Bind form data to table fields
if (!$table->bind($info)) {
$this->setError($table->getError());
return false;
}
// Make sure the record is a valid one
if (!$table->check()) {
$this->setError($table->getError());
return false;
}
// Save bookmark
if (!$table->store()) {
$this->setError($table->getError());
return false;
}
return $table->get('id');
}
示例8: update
function update()
{
$currency = JRequest::getInt('hikashopcurrency', 0);
if (!empty($currency)) {
$app = JFactory::getApplication();
$app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
$app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
$app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null);
$app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null);
$app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null);
$url = JRequest::getString('return_url', '');
if (HIKASHOP_J30) {
$plugin = JPluginHelper::getPlugin('system', 'cache');
$params = new JRegistry(@$plugin->params);
$options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false);
$cache = JCache::getInstance('page', $options);
$cache->clean();
}
if (!empty($url)) {
if (hikashop_disallowUrlRedirect($url)) {
return false;
}
$app->redirect(urldecode($url));
}
}
return true;
}
示例9: __construct
/**
* Constructor
*
* @since 1.5
*/
function __construct()
{
parent::__construct();
//Get configuration
$app = JFactory::getApplication();
$config = JFactory::getConfig();
// Get the pagination request variables
$this->setState('limit', $app->getUserStateFromRequest('com_search.limit', 'limit', $config->get('list_limit'), 'uint'));
$this->setState('limitstart', JRequest::getUInt('limitstart', 0));
// Get parameters.
$params = $app->getParams();
if ($params->get('searchphrase') == 1) {
$searchphrase = 'any';
} elseif ($params->get('searchphrase') == 2) {
$searchphrase = 'exact';
} else {
$searchphrase = 'all';
}
// Set the search parameters
$keyword = urldecode(JRequest::getString('searchword'));
$match = JRequest::getWord('searchphrase', $searchphrase);
$ordering = JRequest::getWord('ordering', $params->get('ordering', 'newest'));
$this->setSearch($keyword, $match, $ordering);
//Set the search areas
$areas = JRequest::getVar('areas');
$this->setAreas($areas);
}
示例10: tag
function tag()
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(ACYMAILING_CSS . 'frontendedition.css?v=' . filemtime(ACYMAILING_MEDIA . 'css' . DS . 'frontendedition.css'));
JPluginHelper::importPlugin('acymailing');
$dispatcher = JDispatcher::getInstance();
$tagsfamilies = $dispatcher->trigger('acymailing_getPluginType');
$defaultFamily = reset($tagsfamilies);
$app = JFactory::getApplication();
$fctplug = $app->getUserStateFromRequest(ACYMAILING_COMPONENT . ".tag", 'fctplug', $defaultFamily->function, 'cmd');
ob_start();
$defaultContents = $dispatcher->trigger($fctplug);
$defaultContent = ob_get_clean();
$js = 'function insertTag(){if(window.parent.insertTag(window.document.getElementById(\'tagstring\').value)) {acymailing_js.closeBox(true);}}';
$js .= 'function setTag(tagvalue){window.document.getElementById(\'tagstring\').value = tagvalue;}';
$js .= 'function showTagButton(){window.document.getElementById(\'insertButton\').style.display = \'inline\'; window.document.getElementById(\'tagstring\').style.display=\'inline\';}';
$js .= 'function hideTagButton(){}';
$js .= 'try{window.parent.previousSelection = window.parent.getPreviousSelection(); }catch(err){window.parent.previousSelection=false; }';
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
$this->assignRef('fctplug', $fctplug);
$type = JRequest::getString('type', 'news');
$this->assignRef('type', $type);
$this->assignRef('defaultContent', $defaultContent);
$this->assignRef('tagsfamilies', $tagsfamilies);
$app = JFactory::getApplication();
$this->assignRef('app', $app);
$ctrl = JRequest::getString('ctrl');
$this->assignRef('ctrl', $ctrl);
}
示例11: display
function display($tpl = null)
{
if (JRequest::getString('task') != 'edit' && JRequest::getString('task') != 'add') {
JToolBarHelper::title('J-Hotel Reservation : ' . JText::_('LNG_MANAGE_AIRPORT_TRANSFER_TYPES', true), 'generic.png');
//JRequest::setVar( 'hidemainmenu', 1 );
$hotel_id = $this->get('HotelId');
if ($hotel_id > 0) {
JToolBarHelper::addNew('manageairporttransfertypes.edit');
JToolBarHelper::editList('manageairporttransfertypes.edit');
JToolBarHelper::deleteList('', 'manageairporttransfertypes.delete', JText::_('LNG_DELETE', true));
}
JToolBarHelper::custom('back', JHotelUtil::getDashBoardIcon(), 'home', 'Back', false, false);
$this->hotel_id = $hotel_id;
$items = $this->get('Datas');
$this->items = $items;
$hotels = $this->get('Hotels');
$hotels = checkHotels(JFactory::getUser()->id, $hotels);
$this->hotels = $hotels;
} else {
$item = $this->get('Data');
$this->item = $item;
$hotel_id = $this->get('HotelId');
$this->hotel_id = $hotel_id;
$hotel = $this->get('Hotel');
$this->hotel = $hotel;
JToolBarHelper::title('J-Hotel Reservation : ' . ($item->airport_transfer_type_id > 0 ? JText::_('LNG_EDIT', true) : JText::_('LNG_ADD_NEW', true)) . ' ' . JText::_('LNG_AIRPORT_TRANSFER_TYPE', true), 'generic.png');
JRequest::setVar('hidemainmenu', 1);
JToolBarHelper::cancel('manageairporttransfertypes.cancel');
JToolBarHelper::save('manageairporttransfertypes.save');
}
parent::display($tpl);
}
示例12: 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();
}
示例13: stdClass
function &getData()
{
$user = JFactory::getUser();
$data = new stdClass();
$data->link = urldecode(JRequest::getVar('link', '', 'method', 'base64'));
if ($data->link == '') {
JError::raiseError(403, JText::_('COM_MAILTO_LINK_IS_MISSING'));
$false = false;
return $false;
}
// Load with previous data, if it exists
$mailto = JRequest::getString('mailto', '', 'post');
$sender = JRequest::getString('sender', '', 'post');
$from = JRequest::getString('from', '', 'post');
$subject = JRequest::getString('subject', '', 'post');
if ($user->get('id') > 0) {
$data->sender = $user->get('name');
$data->from = $user->get('email');
} else {
$data->sender = $sender;
$data->from = $from;
}
$data->subject = $subject;
$data->mailto = $mailto;
return $data;
}
示例14: getList
function getList($params)
{
global $mainframe;
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$temp = JRequest::getString('id');
$temp = explode(':', $temp);
$id = $temp[0];
$aid = $user->get('aid', 0);
$showDate = $params->get('showDate', 0);
$conf =& JFactory::getConfig();
if ($option == 'com_content' && $view == 'article' && $id) {
if ($params->get('cache_items', 0) == 1 && $conf->getValue('config.caching')) {
$cache =& JFactory::getCache('mod_related_items', 'callback');
$cache->setLifeTime($params->get('cache_time', $conf->getValue('config.cachetime') * 60));
$cache->setCacheValidation(true);
$related = $cache->get(array('modRelatedItemsHelper', 'getRelatedItemsById'), array($id, $aid, $showDate));
} else {
$related = modRelatedItemsHelper::getRelatedItemsById($id, $aid, $showDate);
}
} else {
$related = array();
}
return $related;
}
示例15: login
/**
* Method to log in a user.
*
* @since 1.6
*/
public function login()
{
JSession::checkToken('post') or jexit(JText::_('JInvalid_Token'));
$app = JFactory::getApplication();
// Populate the data array:
$data = array();
$data['return'] = base64_decode(JRequest::getVar('return', '', 'POST', 'BASE64'));
$data['username'] = JRequest::getVar('username', '', 'method', 'username');
$data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
// Set the return URL if empty.
if (empty($data['return'])) {
$data['return'] = 'index.php?option=com_users&view=profile';
}
// Set the return URL in the user state to allow modification by plugins
$app->setUserState('users.login.form.return', $data['return']);
// Get the log in options.
$options = array();
$options['remember'] = JRequest::getBool('remember', false);
$options['return'] = $data['return'];
// Get the log in credentials.
$credentials = array();
$credentials['username'] = $data['username'];
$credentials['password'] = $data['password'];
// Perform the log in.
if (true === $app->login($credentials, $options)) {
// Success
$app->setUserState('users.login.form.data', array());
$app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false));
} else {
// Login failed !
$data['remember'] = (int) $options['remember'];
$app->setUserState('users.login.form.data', $data);
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
}
}