本文整理汇总了PHP中JRequest类的典型用法代码示例。如果您正苦于以下问题:PHP JRequest类的具体用法?PHP JRequest怎么用?PHP JRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JRequest类的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
function save()
{
$mainframe =& JFactory::getApplication();
$row =& JTable::getInstance('K2UserGroup', 'Table');
if (!$row->bind(JRequest::get('post'))) {
$mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
}
if (!$row->check()) {
$mainframe->redirect('index.php?option=com_k2&view=userGroup&cid=' . $row->id, $row->getError(), 'error');
}
if (!$row->store()) {
$mainframe->redirect('index.php?option=com_k2&view=userGroups', $row->getError(), 'error');
}
$cache =& JFactory::getCache('com_k2');
$cache->clean();
switch (JRequest::getCmd('task')) {
case 'apply':
$msg = JText::_('Changes to User Group saved');
$link = 'index.php?option=com_k2&view=userGroup&cid=' . $row->id;
break;
case 'save':
default:
$msg = JText::_('User Group Saved');
$link = 'index.php?option=com_k2&view=userGroups';
break;
}
$mainframe->redirect($link, $msg);
}
示例3: display
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/users.php';
// Load the submenu.
UsersHelper::addSubmenu(JRequest::getCmd('view', 'users'));
$view = JRequest::getCmd('view', 'users');
$layout = JRequest::getCmd('layout', 'default');
$id = JRequest::getInt('id');
if (!$this->canView($view)) {
JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
// Check for edit form.
if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_users.edit.user', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=users', false));
return false;
} elseif ($view == 'group' && $layout == 'edit' && !$this->checkEditId('com_users.edit.group', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=groups', false));
return false;
} elseif ($view == 'level' && $layout == 'edit' && !$this->checkEditId('com_users.edit.level', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=levels', false));
return false;
}
return parent::display();
}
示例4: getFolderList
/**
* Image Manager Popup
*
* @param string $listFolder The image directory to display
* @since 1.5
*/
function getFolderList($base = null)
{
global $mainframe;
// Get some paths from the request
if (empty($base)) {
$base = JA_WORKING_DATA_FOLDER;
}
// Get the list of folders
jimport('joomla.filesystem.folder');
$folders = JFolder::folders($base, '.', 4, true);
// Load appropriate language files
$lang =& JFactory::getLanguage();
$lang->load(JRequest::getCmd('option'), JPATH_ADMINISTRATOR);
$document =& JFactory::getDocument();
$document->setTitle(JText::_('Insert Image'));
// Build the array of select options for the folder list
$options[] = JHTML::_('select.option', "", "/");
foreach ($folders as $folder) {
$folder = str_replace(JA_WORKING_DATA_FOLDER, "", $folder);
$value = substr($folder, 1);
$text = str_replace(DS, "/", $folder);
$options[] = JHTML::_('select.option', $value, $text);
}
// Sort the folder list array
if (is_array($options)) {
sort($options);
}
// Create the drop-down folder select list
$list = JHTML::_('select.genericlist', $options, 'folderlist', "class=\"inputbox\" size=\"1\" onchange=\"ImageManager.setFolder(this.options[this.selectedIndex].value)\" ", 'value', 'text', $base);
return $list;
}
示例5: display
function display($tpl = null)
{
global $mainframe, $option;
$cid = JRequest::getVar('cid_user');
if (!is_array($cid)) {
$mainframe->redirect('index.php?option=' . $option);
return;
}
$user_id = $cid[0];
$model = $this->getModel('user');
$model->load($user_id);
$this->_setToolBar();
$say = JText::sprintf('USER_RESOURCES_TITLE', $model->user->username);
$root_node = JText::_('RESOURCES_TREE_ROOT_NODE');
$nowdate = JFactory::getDate();
$str_now = JHTML::_('date', $nowdate->toMySQL(), '%Y-%m-%d %H:%M:%S');
$this->assign('nowdate', $str_now);
$this->assign('say', $say);
$this->assign('root_node', $root_node);
$this->assignRef('uid', $user_id);
$this->assignRef('option', $option);
//hide the menu
JRequest::setVar('hidemainmenu', 1);
parent::display();
}
示例6: save
function save()
{
$data = JRequest::getVar('jform', array(), 'post', 'NONE', 4);
$id = (int) $data['id'];
if (empty($id)) {
if (!igGeneralHelper::authorise('core.igalleryfront.create')) {
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
} else {
if (!igGeneralHelper::authorise('core.igalleryfront.edit', $id)) {
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
}
$model = $this->getModel();
$msg = '';
if (!$model->save($data)) {
JError::raise(2, 500, $model->getError());
} else {
$msg = JText::_('SUCCESSFULLY_SAVED');
}
switch ($this->task) {
case 'apply':
$url = 'index.php?option=com_igallery&view=icategory&id=' . $id;
break;
case 'save':
$url = 'index.php?option=com_igallery&view=categories';
}
$this->setRedirect(JRoute::_($url, false), $msg);
}
示例7: delete
/**
* 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');
}
示例8: 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;
}
示例9: addToolbar
/**
* Add the page title and toolbar.
*
*
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/jdownloadshelper.php';
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = $this->item->id == 0;
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
$canDo = JDownloadsHelper::getActions();
$document = JFactory::getDocument();
$document->addStyleSheet('components/com_jdownloads/assets/css/style.css');
$title = $isNew ? JText::_('COM_JDOWNLOADS_LICEDIT_ADD') : JText::_('COM_JDOWNLOADS_LICEDIT_EDIT');
JToolBarHelper::title(JText::_('COM_JDOWNLOADS') . ': ' . $title, 'jdlicenses');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
JToolBarHelper::apply('license.apply');
JToolBarHelper::save('license.save');
}
if (!$checkedOut && $canDo->get('core.create')) {
JToolBarHelper::save2new('license.save2new');
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::save2copy('license.save2copy');
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('license.cancel');
} else {
JToolBarHelper::cancel('license.cancel', 'JTOOLBAR_CLOSE');
}
JToolBarHelper::divider();
JToolBarHelper::help('help.license', true);
}
示例10: display
/**
* Return JSON encoded data for Statistic page
*/
function display($tpl = null)
{
$app = JFactory::getApplication();
$params = $app->getParams();
jimport('joomla.environment.request');
/* validating request */
$guild_id = $params->get('guild_id', '0');
$groups = $params->get('allowed_groups');
$by_chars = $params->get('stats_by_chars', 0);
$show_rating = $params->get('show_rating', 0);
if ($guild_id != 0) {
JRequest::setVar('guild_id', $guild_id, 'get', true);
}
if ($by_chars == 0) {
JRequest::setVar('character_id', 0, 'get', true);
}
if ($show_rating != 0) {
JRequest::setVar('show_rating', 1, 'get', true);
}
if (JRequest::getVar('group_id', '', 'get', 'int') != '') {
if (!in_array(JRequest::getVar('group_id', '', 'get', 'int'), $groups)) {
JRequest::setVar('group_id', '', 'get', true);
}
}
/* load backend controller */
JLoader::register('RaidPlannerControllerStats', JPATH_ADMINISTRATOR . '/components/com_raidplanner/controllers/stats.php');
$tmp = new RaidPlannerControllerStats();
$tmp->display();
}
示例11: display
function display($tpl = null)
{
$state = $this->get('State');
$this->params = $state->get("parameters.menu");
$categoryId = JRequest::getVar('categoryId');
$this->assignRef('categoryId', $categoryId);
$this->appSettings = JBusinessUtil::getInstance()->getApplicationSettings();
$events = $this->get('Events');
$this->assignRef('events', $events);
//dump($events);
$categories = $this->get('Categories');
$this->assignRef('categories', $categories);
if ($this->appSettings->enable_search_filter_events) {
$serachFilter = $this->get('SeachFilter');
$this->assignRef('searchFilter', $serachFilter);
}
$categoryId = $this->get('CategoryId');
if (!empty($categoryId)) {
$this->categoryId = $categoryId;
$this->category = $this->get('Category');
}
$pagination = $this->get('Pagination');
$this->assignRef('pagination', $pagination);
parent::display($tpl);
}
示例12: display
function display($tpl = null)
{
$task = JRequest::getVar('task');
if ($task == "process") {
return $this->process();
}
}
示例13: language
function language()
{
$app = JFactory::getApplication();
$code = JRequest::getString('code');
if (empty($code)) {
$app->enqueueMessage(JText::_('Code not specified', true));
return;
}
$file = new stdClass();
$file->name = $code;
$path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . DS . $code . DS . $code . getBookingExtName() . '.ini';
$file->path = $path;
jimport('joomla.filesystem.file');
$showLatest = true;
$loadLatest = false;
if (JFile::exists($path)) {
$file->content = JFile::read($path);
if (empty($file->content)) {
$app->enqueueMessage('File not found : ' . $path);
}
} else {
$loadLatest = true;
$file->content = JFile::read(JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . 'en-GB' . DS . 'en-GB.' . getBookingExtName() . '.ini');
}
$this->assignRef('file', $file);
$tpl = "language";
return $tpl;
}
示例14: bootstrap
/**
* This renders the necessary bootstrap data into the html headers.
*/
public function bootstrap()
{
static $isRendered = false;
$doc = JFactory::getDocument();
if( !$isRendered && $doc->getType() == 'html' )
{
// @task: Include dependencies from foundry.
require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'media' . DIRECTORY_SEPARATOR . 'foundry' . DIRECTORY_SEPARATOR . '3.1' . DIRECTORY_SEPARATOR . 'joomla' . DIRECTORY_SEPARATOR . 'configuration.php' );
$config = Komento::getConfig();
$environment = JRequest::getVar( 'komento_environment' , $config->get( 'komento_environment' ) );
$folder = 'scripts';
// @task: Let's see if we should load the dev scripts.
if( $environment == 'development' )
{
$folder = 'scripts_';
}
$doc->addScript( rtrim( JURI::root() , '/' ) . '/media/com_komento/' . $folder . '/abstract.js' );
$isRendered = true;
}
return $isRendered;
}
示例15: getListQuery
/**
* Method to get a JDatabaseQuery object for retrieving the data set from a database.
*
* @return object A JDatabaseQuery object to retrieve the data set.
*/
protected function getListQuery()
{
$w = explode('|', urldecode(JRequest::getVar('filterStr', '')));
$user = JFactory::getUser();
$filterStr = $w[0];
$filterAktiv = $w[1];
if ($filterAktiv == 1) {
$lezartLimit = 1;
} else {
$lezartLimit = 99;
}
if ($filterStr != '') {
$filterStr = ' and sz.megnevezes like "%' . $filterStr . '%"';
}
$db = $this->getDbo();
$query = $db->getQuery(true);
$catid = (int) $this->getState('authorlist.id', 1);
$query = '
/* szavazások amik jelenleg vita1 állapotban vannak */
/* ================================================ */
SELECT sz.megnevezes, sz.vita1, sz.vita2, sz.szavazas, sz.lezart, sz.szavazas_vege, sz.titkos, sz.vita2_vege,
sz.id, sz.temakor_id
FROM #__szavazasok sz
WHERE (sz.vita2=1) ' . $filterStr;
$query .= ' order by ' . JRequest::getVar('order', '6');
return $query;
}