本文整理汇总了PHP中JRequest::getUInt方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::getUInt方法的具体用法?PHP JRequest::getUInt怎么用?PHP JRequest::getUInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRequest
的用法示例。
在下文中一共展示了JRequest::getUInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Generates a list of JSON items.
*
* @return void
*/
public function display($tpl = null)
{
$user = JFactory::getUser();
$access = JRequest::getUInt('filter_access');
// No access if not logged in
if ($user->id == 0) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
// Check Access for non-admins
if (!$user->authorise('core.admin')) {
$allowed = PFAccessHelper::getGroupsByAccessLevel($access, true);
$groups = $user->getAuthorisedGroups();
$can_access = false;
foreach ($groups as $group) {
if (in_array($group, $allowed)) {
$can_access = true;
break;
}
}
if (!$can_access) {
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
}
$this->items = $this->get('Items');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseWarning(500, implode("\n", $errors));
return false;
}
parent::display($tpl);
}
示例2: display
/**
* Displays the current view
*
* @param boolean $cachable If true, the view output will be cached (Not Used!)
* @param array $urlparams An array of safe url parameters and their variable types (Not Used!)
*
* @return jcontroller A JController object to support chaining.
*/
public function display($cachable = false, $urlparams = false)
{
// Load CSS and JS assets
JHtml::_('pfhtml.style.bootstrap');
JHtml::_('pfhtml.style.projectfork');
JHtml::_('pfhtml.script.jQuery');
JHtml::_('pfhtml.script.bootstrap');
JHtml::_('pfhtml.script.projectfork');
JHtml::_('behavior.tooltip');
$view = JRequest::getCmd('view');
$id = JRequest::getUInt('id');
$urlparams = array('id' => 'INT', 'cid' => 'ARRAY', 'limit' => 'INT', 'limitstart' => 'INT', 'showall' => 'INT', 'return' => 'BASE64', 'filter' => 'STRING', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'filter_search' => 'STRING', 'filter_published' => 'CMD');
// Inject default view if not set
if (empty($view)) {
JRequest::setVar('view', $this->default_view);
}
// Check for edit form.
if ($view == 'form' && !$this->checkEditId('com_pftime.edit.form', $id)) {
// Somehow the person just went to the form - we don't allow that.
return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
}
// Display the view
parent::display($cachable, $urlparams);
// Return own instance for chaining
return $this;
}
示例3: populateState
/**
* State
*/
protected function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
// start and limit
$start = JRequest::getUInt('start', 0);
$this->setState('list.start', $start);
}
示例4: populateState
function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
$app = JFactory::getApplication('site');
$user = JFactory::getUser();
$pk = JRequest::getInt('id');
$this->setState('tags.id', $pk);
$offset = JRequest::getUInt('limitstart', 0);
$this->setState('offset', $offset);
$this->setState('list.start', JRequest::getVar('limitstart', 0, '', 'int'));
$this->setState('tags.catid', null);
$params = $app->getParams();
// Set value again for option tz_portfolio_redirect
if ($params->get('tz_portfolio_redirect') == 'default') {
$params->set('tz_portfolio_redirect', 'article');
}
if ($params->get('show_limit_box', 0)) {
$limit = $app->getUserStateFromRequest('com_tz_portfolio.users.limit', 'limit', 10);
} else {
$limit = $params->get('tz_article_limit');
}
if (!$user->authorise('core.edit.state', 'com_tz_portfolio') && !$user->authorise('core.edit', 'com_tz_portfolio')) {
// limit to published for people who can't edit or edit.state.
$this->setState('filter.published', 1);
} else {
$this->setState('filter.published', array(0, 1, 2));
}
$this->setState('filter.language', $app->getLanguageFilter());
$params->set('access-view', true);
$this->setState('list.limit', $limit);
$this->setState('params', $params);
$this->setState('char', JRequest::getString('char', null));
}
示例5: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
*/
protected function populateState($ordering = 'ordering', $direction = 'ASC')
{
$app = JFactory::getApplication();
// List state information
$value = JRequest::getUInt('limit', $app->getCfg('list_limit', 0));
$this->setState('list.limit', $value);
$value = JRequest::getUInt('limitstart', 0);
$this->setState('list.start', $value);
$orderCol = JRequest::getCmd('order_field', $ordering);
if (!in_array($orderCol, $this->filter_fields)) {
$orderCol = 'ordering';
}
$this->setState('list.ordering', $orderCol);
$country_code = $this->getUserStateFromRequest($this->context . '.filter.country_code', 'country_code');
$this->setState('filter.country_code', $country_code);
$city = $this->getUserStateFromRequest($this->context . '.filter.access', 'city');
$this->setState('filter.city', $city);
$featured = $app->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured');
$this->setState('filter.featured', $featured);
$tourismTypeId = $this->getUserStateFromRequest($this->context . '.filter.tourismtype_id', 'tourismtype_id', '');
$this->setState('filter.tourismtype_id', $tourismTypeId);
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'category_id');
$this->setState('filter.category_id', $categoryId);
// List state information.
//parent::populateState($ordering, 'ASC');
}
示例6: populateState
function populateState($ordering = null, $direction = null)
{
parent::populateState($ordering, $direction);
$app = JFactory::getApplication();
$params = $app->getParams();
if ($params->get('tz_portfolio_redirect') == 'default') {
$params->set('tz_portfolio_redirect', 'article');
}
$user = JFactory::getUser();
$this->params = $params;
if ($params->get('show_limit_box', 0) && $params->get('tz_timeline_layout', 'default') == 'classic') {
$limit = $app->getUserStateFromRequest('com_tz_portfolio.timeline.limit', 'limit', $params->get('tz_article_limit', 10));
} else {
$limit = $params->get('tz_article_limit', 10);
}
if (!$user->authorise('core.edit.state', 'com_tz_portfolio') && !$user->authorise('core.edit', 'com_tz_portfolio')) {
// limit to published for people who can't edit or edit.state.
$this->setState('filter.published', 1);
} else {
$this->setState('filter.published', array(0, 1, 2));
}
$this->setState('filter.language', $app->getLanguageFilter());
$params->set('useCloudZoom', 0);
$this->setState('list.start', JRequest::getUInt('limitstart', 0));
$this->setState('list.limit', $limit);
$this->setState('params', $this->params);
$this->setState('char', JRequest::getString('char', null));
}
示例7: __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);
}
示例8: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState($ordering = 'ordering', $direction = 'ASC')
{
$app = JFactory::getApplication();
// List state information
$value = JRequest::getUInt('limit', $app->getCfg('list_limit', 0));
$this->setState('list.limit', $value);
$value = JRequest::getUInt('limitstart', 0);
$this->setState('list.start', $value);
$orderCol = JRequest::getCmd('filter_order', 'a.ordering');
if (!in_array($orderCol, $this->filter_fields)) {
$orderCol = 'a.ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = JRequest::getCmd('filter_order_Dir', 'ASC');
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) {
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
if (!$user->authorise('core.edit.state', 'com_content') && !$user->authorise('core.edit', 'com_content')) {
// filter on published for those who do not have edit or edit.state rights.
$this->setState('filter.published', 1);
}
$this->setState('filter.language', $app->getLanguageFilter());
// process show_noauth parameter
if (!$params->get('show_noauth')) {
$this->setState('filter.access', true);
} else {
$this->setState('filter.access', false);
}
$this->setState('layout', JRequest::getCmd('layout'));
}
示例9: display
/**
* Generates a list of JSON items.
*
* @return void
*/
function display($tpl = null)
{
$ta = (int) JRequest::getUInt('typeahead');
$s2 = (int) JRequest::getUInt('select2');
$resp = array();
// Get model data
$rows = $this->get('Items');
if ($ta) {
$tmp_rows = array();
foreach ($rows as &$row) {
$id = (int) $row->id;
$tmp_rows[$id] = $this->escape($row->title);
}
$rows = $tmp_rows;
} elseif ($s2) {
$tmp_rows = array();
foreach ($rows as &$row) {
$id = (int) $row->id;
$item = new stdClass();
$item->id = $id;
$item->text = $this->escape($row->title);
$tmp_rows[] = $item;
}
$rows = $tmp_rows;
$total = (int) $this->get('Total');
$rows = array('total' => $total, 'items' => $rows);
}
// Set the MIME type for JSON output.
JFactory::getDocument()->setMimeEncoding('application/json');
// Change the suggested filename.
JResponse::setHeader('Content-Disposition', 'attachment;filename="' . $this->getName() . '.json"');
// Output the JSON data.
echo json_encode($rows);
jexit();
}
示例10: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState($ordering = 'ordering', $direction = 'ASC')
{
$app = JFactory::getApplication();
// List state information
//$value = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'));
$value = JRequest::getUInt('limit', $app->getCfg('list_limit', 0));
$this->setState('list.limit', $value);
//$value = $app->getUserStateFromRequest($this->context.'.limitstart', 'limitstart', 0);
$value = JRequest::getUInt('limitstart', 0);
$this->setState('list.start', $value);
$orderCol = JRequest::getCmd('filter_order', 'a.ordering');
if (!in_array($orderCol, $this->filter_fields)) {
$orderCol = 'a.ordering';
}
$this->setState('list.ordering', $orderCol);
$listOrder = JRequest::getCmd('filter_order_Dir', 'ASC');
if (!in_array(strtoupper($listOrder), array('ASC', 'DESC', ''))) {
$listOrder = 'ASC';
}
$this->setState('list.direction', $listOrder);
$params = $app->getParams();
$this->setState('params', $params);
$user = JFactory::getUser();
$this->setState('layout', JRequest::getCmd('layout'));
}
示例11: publish
/**
* Method to publish a list of items
*
* @return void
*/
public function publish()
{
parent::publish();
$project = JRequest::getUInt('filter_project');
$topic = JRequest::getUInt('filter_topic');
$link = 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&filter_project=' . $project . '&filter_topic=' . $topic;
$this->setRedirect(JRoute::_($link, false));
}
示例12: populateState
protected function populateState($ordering = null, $direction = null)
{
$id = JRequest::getInt('id');
$this->setState('filter.category_id', $id);
$this->setState('list.start', JRequest::getUInt('limitstart', 0));
$limit = 10;
$this->setState('list.limit', $limit);
}
示例13: display
function display($tpl = null)
{
$user = JFactory::getUser();
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// Check access
if ($this->item->params->get('access-view') != true) {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
$rev = JRequest::getUInt('rev');
if ($rev) {
$rev_model = JModelLegacy::getInstance('FileRevision', 'PFrepoModel', $c = array('ignore_request' => true));
$file_rev = $rev_model->getItem($rev);
if (!$file_rev || empty($file_rev->id)) {
JError::raiseError(404, JText::_('COM_PROJECTFORK_ERROR_FILE_NOT_FOUND'));
return false;
}
// Check access
if ($file_rev->parent_id != $this->item->id) {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return false;
}
$filepath = PFrepoHelper::getBasePath($this->item->project_id) . '/_revs/file_' . $this->item->id;
$filename = $file_rev->file_name;
} else {
$filepath = $this->item->physical_path;
$filename = $this->item->file_name;
}
// Check if the file exists
if (empty($filepath) || !JFile::exists($filepath . '/' . $filename)) {
JError::raiseError(404, JText::_('COM_PROJECTFORK_ERROR_FILE_NOT_FOUND'));
return false;
}
if (headers_sent($file, $line)) {
JError::raiseError(500, JText::sprintf('COM_PROJECTFORK_WARNING_FILE_DL_ERROR_HEADERS_SENT', $file, $line));
return false;
}
while (ob_get_level()) {
ob_end_clean();
}
header("Content-Type: APPLICATION/OCTET-STREAM");
header("Content-Length: " . filesize($filepath . '/' . $filename));
header("Content-Disposition: attachment; filename=\"" . $filename . "\";");
header("Content-Transfer-Encoding: Binary");
if (function_exists('readfile')) {
readfile($filepath . '/' . $filename);
} else {
echo file_get_contents($filepath . '/' . $filename);
}
jexit();
}
示例14: populateState
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @return void
* @since 1.6
*/
protected function populateState($ordering = 'ordering', $direction = 'ASC')
{
$app = JFactory::getApplication();
// List state information
$value = JRequest::getUInt('limit', CFG_LIST_USER_CONTENT);
$this->setState('list.limit', $value);
$value = JRequest::getUInt('limitstart', 0);
$this->setState('list.start', $value);
}
示例15: allowAdd
/**
* Method to check if you can add a new record.
*
* @param array $data An array of input data.
*
* @return boolean
*/
protected function allowAdd($data = array())
{
$topic = isset($data['topic_id']) ? (int) $data['topic_id'] : JRequest::getUInt('filter_topic');
$access = PFforumHelper::getActions($topic);
if (!$topic) {
$this->setError(JText::_('COM_PROJECTFORK_WARNING_TOPIC_NOT_FOUND'));
return false;
}
$access = PFforumHelper::getReplyActions();
return $access->get('core.create');
}