本文整理汇总了PHP中JRequest::getBool方法的典型用法代码示例。如果您正苦于以下问题:PHP JRequest::getBool方法的具体用法?PHP JRequest::getBool怎么用?PHP JRequest::getBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRequest
的用法示例。
在下文中一共展示了JRequest::getBool方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateWeekend
/**
* Update the current walk with passed in form data
*/
public function updateWeekend(array $formData)
{
$this->loadWeekend($formData['id']);
// Update all basic fields
// Fields that can't be saved are just ignored
// Invalid fields throw an exception - display this to the user and continue
foreach ($formData as $name => $value) {
try {
$this->weekend->{$name} = $value;
} catch (UnexpectedValueException $e) {
// TODO: Error message
echo "<p>";
var_dump($name);
var_dump($value);
var_dump($e->getMessage());
echo "</p>";
}
}
// Date fields need to be converted
if (!empty($formData['startdate'])) {
$this->weekend->start = strtotime($formData['startdate']);
} else {
$this->weekend->start = null;
}
if (!empty($formData['enddate'])) {
$this->weekend->endDate = strtotime($formData['enddate']);
} else {
$this->weekend->endDate = null;
}
// Alterations
$this->weekend->alterations->incrementVersion();
$this->weekend->alterations->setDetails(!empty($formData['alterations_details']));
$this->weekend->alterations->setCancelled(!empty($formData['alterations_cancelled']));
$this->weekend->alterations->setOrganiser(!empty($formData['alterations_organiser']));
$this->weekend->alterations->setDate(!empty($formData['alterations_date']));
if ($this->weekend->isValid()) {
$this->weekend->save();
// Redirect to the list page
$itemid = JRequest::getInt('returnPage');
if (empty($itemid)) {
return false;
}
$item = JFactory::getApplication()->getMenu()->getItem($itemid);
$link = new JURI("/" . $item->route);
// Jump to the event?
if (JRequest::getBool('jumpToEvent')) {
$link->setFragment("weekend_" . $this->weekend->id);
}
JFactory::getApplication()->redirect($link, "Weekend saved");
}
}
示例2: logCustomerIn
function logCustomerIn()
{
$app = JFactory::getApplication("site");
$Itemid = JRequest::getInt('Itemid', 0);
// $returnpage = JRequest::getVar("returnpage", "");
// if($return = JRequest::getVar('return', '', 'request', 'base64'))
// {
// $return = base64_decode($return);
// }
$return = JRoute::_('index.php?option=com_digicom&view=cart&layout=summary');
$options = array();
$options['remember'] = JRequest::getBool('remember', false);
$options['return'] = $returnpage;
$username = JRequest::getVar("username", "", 'request', 'username');
$password = JRequest::getVar("passwd", "", 'post', JREQUEST_ALLOWRAW);
$credentials = array();
$credentials['username'] = $username;
//JRequest::getVar('username', '', 'method', 'username');
$credentials['password'] = $password;
//JRequest::getString('passwd', '', 'post', JREQUEST_ALLOWRAW);
$err = $app->login($credentials, $options);
// if($return){
$this->setRedirect($return);
return true;
// }
// $link = $this->getLink();
// if($returnpage != 'checkout'){
// $this->setRedirect($link);
// return true;
// }
//$this->checkNextAction($err);
}
示例3: count
/**
* Method to get the Events
*
* @access public
* @return array
*/
function &getData()
{
$pop = JRequest::getBool('pop');
// Lets load the content if it doesn't already exist
if (empty($this->_data)) {
$query = $this->_buildQuery();
$pagination = $this->getPagination();
if ($pop) {
$this->_data = $this->_getList($query);
} else {
$this->_data = $this->_getList($query, $pagination->limitstart, $pagination->limit);
}
$k = 0;
$count = count($this->_data);
for ($i = 0; $i < $count; $i++) {
$item =& $this->_data[$i];
$item->categories = $this->getCategories($item->id);
//remove events without categories (users have no access to them)
if (empty($item->categories)) {
unset($this->_data[$i]);
}
$k = 1 - $k;
}
}
return $this->_data;
}
示例4: display
public function display($cachable = false, $urlparams = array())
{
/**
* @var JApplicationSite $app
*/
$app = JFactory::getApplication();
$params = $app->getParams();
$str_folder = JRequest::getVar('folder', null);
$str_file = JRequest::getVar('file', null);
$is_sharing_download = JRequest::getBool('is_for_sharing', false);
/**
* @var EventgalleryLibraryManagerFile $fileMgr
*/
$fileMgr = EventgalleryLibraryManagerFile::getInstance();
$file = $fileMgr->getFile($str_folder, $str_file);
if (!is_object($file) || !$file->isPublished()) {
JError::raiseError(404, JText::_('COM_EVENTGALLERY_SINGLEIMAGE_NO_PUBLISHED_MESSAGE'));
}
$folder = $file->getFolder();
if (!$folder->isPublished() || !$folder->isVisible()) {
JError::raiseError(404, JText::_('COM_EVENTGALLERY_EVENT_NO_PUBLISHED_MESSAGE'));
}
// deny downloads if the social sharing option is disabled
if ($params->get('use_social_sharing_button', 0) == 0) {
JError::raiseError(404, JText::_('COM_EVENTGALLERY_FILE_NOT_DOWNLOADABLE_MESSAGE'));
}
// allow the download if at least one sharing type is enabled both global and for the event
if ($params->get('use_social_sharing_facebook', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_facebook', 1) == 1 || $params->get('use_social_sharing_google', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_google', 1) == 1 || $params->get('use_social_sharing_twitter', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_twitter', 1) == 1 || $params->get('use_social_sharing_pinterest', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_pinterest', 1) == 1 || $params->get('use_social_sharing_email', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_email', 1) == 1 || $params->get('use_social_sharing_download', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_download', 1) == 1) {
} else {
JError::raiseError(404, JText::_('COM_EVENTGALLERY_FILE_NOT_DOWNLOADABLE_MESSAGE'));
}
$basename = COM_EVENTGALLERY_IMAGE_FOLDER_PATH . $folder->getFolderName() . '/';
$filename = $basename . $file->getFileName();
if ($params->get('download_original_images', 0) == 1) {
$mime = ($mime = getimagesize($filename)) ? $mime['mime'] : $mime;
$size = filesize($filename);
$fp = fopen($filename, "rb");
if (!($mime && $size && $fp)) {
// Error.
return;
}
header("Content-type: " . $mime);
header("Content-Length: " . $size);
if (!$is_sharing_download) {
header("Content-Disposition: attachment; filename=" . $file->getFileName());
}
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
fpassthru($fp);
die;
} else {
if (!$is_sharing_download) {
header("Content-Disposition: attachment; filename=" . $file->getFileName());
}
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
$this->resize($file->getFolderName(), $file->getFileName(), COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH, null, null);
die;
}
}
示例5: display
function display($tpl = null)
{
$option = JRequest::getCMD('option');
$mainframe = JFactory::getApplication();
$app =& JFactory::getApplication();
$helper = new comZonalesHelper();
// url de retorno según sección del menu actual
$menu =& JSite::getMenu();
$item = $menu->getActive();
$return = $item ? $item->link . '&Itemid=' . $item->id : 'index.php';
// si debe retornarse una respuesta mediante ajax
$this->ajax = JRequest::getBool('ajax');
$this->task = JRequest::getBool('ajax') ? 'setZonalAjax' : 'setZonal';
$zName = $helper->getZonal();
$this->zonal = is_object($zName) ? $zName->name : $zName;
// parametros - alto y ancho
$zonalesParams =& JFactory::getApplication('site')->getParams('com_zonales');
$this->width = $zonalesParams->get('width_mapa_flash', '');
$this->height = $zonalesParams->get('height_mapa_flash', '');
$this->flashfile = $zonalesParams->get('flash_file', '');
$this->assignRef('j2f', $helper->getZif2SifMap());
$this->assignRef('template', $app->getTemplate());
$this->assignRef('return', $return);
parent::display($tpl);
}
示例6: unblock
/**
* Permite habilitar o deshabilitar los alias seleccionados
*
*/
function unblock()
{
JRequest::checkToken() or jexit('Invalid Token');
$db =& JFactory::getDBO();
$user =& JFactory::getUser();
//$row =& JTable::getInstance('alias', 'Table');
//$row = new JTableAlias($db);
// recupero los alias del usuario
$userid = $user->id;
$query = 'select a.id from #__alias a where user_id=' . $userid;
$db->setQuery($query);
$dbaliaslist = $db->loadObjectList();
// a cada alias del usuario le actualizo su estado (habilitado o dehabilitado)
// segun lo especificado por el usuario
foreach ($dbaliaslist as $alias) {
$unblock = JRequest::getBool('alias' . $alias->id, false, 'method');
$block = $unblock ? '0' : '1';
$this->logme($db, 'alias' . $alias->id);
$this->logme($db, 'el bloqueo es: ' . $block);
// $row->load($alias->id);
// $row->block = (int) $block;
// if (!$row->store()) {
// JError::raiseError(500, $row->getError() );
// }
$update = 'update #__alias set block=' . $block . ' where id=' . $alias->id;
$db->setQuery($update);
$db->query();
}
}
示例7: section
public function section()
{
$ajax = FD::ajax();
// TODO: Exact section copy. Refactor.
$location = JRequest::getCmd('location');
$name = JRequest::getCmd('name');
$override = JRequest::getBool('override', false);
$section = JRequest::getVar('section');
// Get stylesheet
$stylesheet = FD::stylesheet($location, $name, $override);
$theme = FD::themes();
$theme->set('location', $location);
$theme->set('name', $name);
// TODO: Find a proper way to do this
$theme->set('element', ucwords(str_ireplace('_', ' ', str_ireplace('mod_easysocial_', '', $name))));
$theme->set('override', $override);
$theme->set('section', $section);
$theme->set('stylesheet', $stylesheet);
// Also pass in server memory limit.
$memory_limit = ini_get('memory_limit');
$memory_limit = FD::math()->convertBytes($memory_limit) / 1024 / 1024;
$theme->set('memory_limit', $memory_limit);
$html = $theme->output('admin/themes/compiler/section');
/* Exact section copy */
$ajax->resolve($html);
$ajax->send();
}
示例8: __construct
public function __construct($config = array())
{
parent::__construct($config);
$this->_dbg = JRequest::getBool('dbg', 0);
$this->_japp = JFactory::getApplication();
$user = JFactory::getUser();
$this->_user_id = $user->get('id');
$this->_id_elemento = JRequest::getInt('id', 0);
$this->SCOInstanceID = $this->_id_elemento;
$this->_user =& JFactory::getUser();
// if ($this->_user->guest) {
// //TODO Personalizzare il messaggio per i non registrati
// $msg = "Per accedere al corso è necessario loggarsi";
// //TODO Sistemare per fare in modo che dopo il login torni al corso
// $uri = JFactory::getURI();
// $return = $uri->toString();
// $url = 'index.php?option=com_users&view=login';
// $url .= '&return='.base64_encode($return);
// $this->_japp->redirect(JRoute::_($url), $msg);
// FB::error("E' NECESSARIO LOGGARSI");
// }
//$this->initializeTrack();
//bypasso check iscrizione
//$this->checkIscrizione();
// $this->_checkCoupon();
$this->_checkPermessi();
}
示例9: 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));
}
}
示例10: sync
function sync() {
// FIXME: remove option:
$usercache = JRequest::getBool ( 'usercache', 0 );
$useradd = JRequest::getBool ( 'useradd', 0 );
$userdel = JRequest::getBool ( 'userdel', 0 );
$userrename = JRequest::getBool ( 'userrename', 0 );
$app = JFactory::getApplication ();
$db = JFactory::getDBO ();
if (!JRequest::checkToken()) {
$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
return;
}
if ($useradd) {
$db->setQuery ( "INSERT INTO #__kunena_users (userid) SELECT a.id FROM #__users AS a LEFT JOIN #__kunena_users AS b ON b.userid=a.id WHERE b.userid IS NULL" );
$db->query ();
if (KunenaError::checkDatabaseError()) return;
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_ADD') . ' ' . $db->getAffectedRows () );
}
if ($userdel) {
$db->setQuery ( "DELETE a FROM #__kunena_users AS a LEFT JOIN #__users AS b ON a.userid=b.id WHERE b.username IS NULL" );
$db->query ();
if (KunenaError::checkDatabaseError()) return;
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_DEL') . ' ' . $db->getAffectedRows () );
}
if ($userrename) {
$model = $this->getModel('Syncusers');
$cnt = $model->KupdateNameInfo ();
$app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_RENAME') . " $cnt" );
}
$this->setRedirect(KunenaRoute::_($this->baseurl, false));
}
示例11: buildEmbedcode
function buildEmbedcode($media, $env = null)
{
global $vparams;
// Set player size dynamically
if (!empty($this->playerwidth)) {
$vparams->playerwidth = $this->playerwidth;
}
if (!empty($this->playerheight)) {
$vparams->playerheight = $this->playerheight;
}
//Player size in lightbox popup. Normally bigger than default size.
$layout = JRequest::getString('layout');
if ($layout == 'lightbox') {
$vparams->playerheight = $vparams->lplayerheight;
$vparams->playerwidth = $vparams->lplayerwidth;
}
//Set set a default preview image, if there is none associated with current media file
if (!empty($media->pixlink)) {
$pixlink = $media->pixlink;
} else {
$pixlink = JURI::root() . 'components/com_videoflow/players/preview.jpg';
}
//Facebook embedcode - Embeds video on Facebook. Not required if you are not using the Facebook application
$c = JRequest::getCmd('c');
$frm = JRequest::getBool('iframe');
if (!$frm && $c == 'fb' || $env == 'fb') {
$vfplayer = 'http://vimeo.com/moogaloop.swf?clip_id=' . $media->file . '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00ADEF&fullscreen=1&autoplay=1&loop=0;';
$embedcode = '';
return array('player' => $vfplayer, 'flashvars' => $embedcode);
}
$embedcode = '<div class="vfrespiframe"><iframe src="http://player.vimeo.com/video/' . $media->file . '?portrait=0&title=0&byline=0&color=97b8c7&autoplay=1" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>';
return $embedcode;
}
示例12: 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));
}
}
示例13: display
function display($tpl = null)
{
// Initialise variables.
$app = JFactory::getApplication();
$user = JFactory::getUser();
$userId = $user->get('id');
$dispatcher = JDispatcher::getInstance();
$this->print = JRequest::getBool('print');
$this->state = $this->get('State');
$this->user = $user;
$this->user = ideary::getUserInfoById($this->user->id);
$userextra = Ideary::getExtraUserData($_GET["id"]);
$this->assignRef('userextra', $userextra);
$this->userDatafinal = Ideary::getuserData($this->user->id);
$this->userDatafinal = $this->userDatafinal[0];
$this->userExtraData = Ideary::getExtraUserData($this->user->id);
$this->period = isset($_POST['period']) ? $_POST['period'] : 'LAST-WEEK';
$this->messages = Ideary::getUserMessages($this->user->id);
$user_followers = Ideary::getUserFollowers($this->user->id);
$followers = array();
foreach ($user_followers as $follower) {
$followers[] = $follower->follower_id;
}
$this->user_followers = $followers;
$this->messages_sent = Ideary::getUserMessagesSent($this->user->id);
$this->inbox_messages = Ideary::getMessagesOfFollowedUsersByUserId($this->user->id);
$this->unknown_users_messages = Ideary::getMessagesOfNoFollowedUsersByUserId($this->user->id);
$this->sent_messages = Ideary::getMessagesSentByUserId($this->user->id);
Ideary::setAllMailsAsReaded($this->user->id);
//$this->_prepareDocument();
parent::display($tpl);
}
示例14: __construct
public function __construct()
{
$this->db = JFactory::getDBO();
jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
$this->update = JRequest::getBool('update');
}
示例15: save
function save($apply = false)
{
jimport('joomla.version');
$version = new JVersion();
if (JFactory::getApplication()->isSite() && JRequest::getInt('Itemid', 0)) {
if (version_compare($version->getShortVersion(), '1.6', '>=')) {
$menu = JSite::getMenu();
$item = $menu->getActive();
if (is_object($item)) {
JRequest::setVar('cb_controller', $item->params->get('cb_controller', null));
JRequest::setVar('cb_category_id', $item->params->get('cb_category_id', null));
}
} else {
$params = JComponentHelper::getParams('com_contentbuilder');
JRequest::setVar('cb_controller', $params->get('cb_controller', null));
JRequest::setVar('cb_category_id', $params->get('cb_category_id', null));
}
}
JRequest::setVar('cbIsNew', 0);
JRequest::setVar('cbInternalCheck', 1);
if (JRequest::getCmd('record_id', '')) {
contentbuilder::checkPermissions('edit', JText::_('COM_CONTENTBUILDER_PERMISSIONS_EDIT_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
} else {
JRequest::setVar('cbIsNew', 1);
contentbuilder::checkPermissions('new', JText::_('COM_CONTENTBUILDER_PERMISSIONS_NEW_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : '');
}
$model = $this->getModel('edit');
$id = $model->store();
$submission_failed = JRequest::getBool('cb_submission_failed', false);
$cb_submit_msg = JRequest::setVar('cb_submit_msg', '');
$type = 'message';
if ($id && !$submission_failed) {
$msg = JText::_('COM_CONTENTBUILDER_SAVED');
$return = JRequest::getVar('return', '');
if ($return) {
$return = base64_decode($return);
if (!JRequest::getBool('cbInternalCheck', 1)) {
JFactory::getApplication()->redirect($return, $msg);
}
if (JURI::isInternal($return)) {
JFactory::getApplication()->redirect($return, $msg);
}
}
} else {
$apply = true;
// forcing to stay in form on errors
$type = 'error';
}
if (JRequest::getVar('cb_controller') == 'edit') {
$link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=edit&return=' . JRequest::getVar('return', '') . '&Itemid=' . JRequest::getInt('Itemid', 0), false);
} else {
if ($apply) {
$link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=edit&return=' . JRequest::getVar('return', '') . '&backtolist=' . JRequest::getInt('backtolist', 0) . '&id=' . JRequest::getInt('id', 0) . '&record_id=' . $id . '&Itemid=' . JRequest::getInt('Itemid', 0) . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order'), false);
} else {
$link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=list&id=' . JRequest::getInt('id', 0) . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order') . '&Itemid=' . JRequest::getInt('Itemid', 0), false);
}
}
$this->setRedirect($link, $msg, $type);
}