本文整理汇总了PHP中Xoops\Core\Request::getBool方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getBool方法的具体用法?PHP Request::getBool怎么用?PHP Request::getBool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xoops\Core\Request
的用法示例。
在下文中一共展示了Request::getBool方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
which is considered copyrighted (c) material of the original comment or credit authors.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
/**
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
if (Request::getBool('pdf', false)) {
$content = \Xoops\Utils::dumpVar($xoops->getConfigs(), false);
$tpl = new XoopsTpl();
$tpl->assign('dummy_content', $content);
$content2 = $tpl->fetch('module:system/system_dummy.tpl');
if ($xoops->service('htmltopdf')->isAvailable()) {
$xoops->service('htmltopdf')->addHtml($content2);
$xoops->service('htmltopdf')->outputPdfInline('codex_example.pdf');
} else {
$xoops->header();
echo 'Please install an HtmlToPdf provider!';
\Xoops\Utils::dumpFile(__FILE__);
$xoops->footer();
}
} else {
$xoops->header();
示例2: implode
}
$error_msg .= $obj->getHtmlErrors();
}
$admin_page->addItemButton(AvatarsLocale::LIST_OF_AVATARS, 'avatar_custom.php', 'application-view-detail');
$admin_page->renderButton();
$xoops->tpl()->assign('info_msg', $xoops->alert('info', $info_msg, XoopsLocale::INFORMATION_FOR_UPLOADS));
$xoops->tpl()->assign('error_msg', $xoops->alert('error', $error_msg, XoopsLocale::ERRORS));
$form = $xoops->getModuleForm($obj, 'avatar');
$xoops->tpl()->assign('form', $form->render());
break;
//Delete
//Delete
case "delete":
$avatar_id = Request::getInt('avatar_id', 0);
$obj = $avatar_Handler->get($avatar_id);
if (Request::getBool('ok', false, 'POST')) {
if (!$xoops->security()->check()) {
$xoops->redirect("avatar_custom.php", 3, implode(",", $xoops->security()->getErrors()));
}
if ($avatar_Handler->delete($obj)) {
// Delete file
$file = $obj->getVar('avatar_file');
if ($file !== 'avatars/blank.gif') {
$fullname = $xoops_upload_path . '/' . $file;
if (is_file($fullname)) {
chmod($fullname, 0777);
unlink($fullname);
}
}
// Update member profiles
$qb = $xoops->db()->createXoopsQueryBuilder();
示例3: dirname
use Xoops\Core\Request;
/**
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
// Warning: code depending on Xoops\Core\HttpRequest may need to change
$request = \Xoops\Core\HttpRequest::getInstance();
$xoops->header();
\Xoops\Utils::dumpVar(Request::get());
$result['id'] = Request::getInt('id', 13);
$result['string'] = Request::getString('string', 'defaultValueHere');
$result['bool'] = Request::getBool('bool', false);
$result['order'] = Request::getString('order', 'ASC');
$result['url'] = $request->getUrl();
$result['uri'] = $request->getUri();
$result['referer'] = $request->getReferer();
$result['phpsessid_cookie'] = Request::getString('PHPSESSID', '', 'cookie');
$result['ip'] = $request->getClientIp();
$result['isget'] = 'GET' === Request::getMethod();
$result['ispost'] = 'POST' === Request::getMethod();
$result['ismobile'] = $request->is('mobile');
$result['isrobot'] = $request->is('robot');
$result['files'] = Request::getArray('file_identifier', array(), 'files');
\Xoops\Utils::dumpVar($result);
echo '<a href="?id=12&string=I love you&bool=everythingsistrue&order=DESC">Good uri</a>';
echo ' - <a href="?id=test&order=DESCENDING">Bad uri</a>';
// Form
示例4: implode
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$xoops->simpleHeader(false);
$helper->loadLanguage('admin');
$helper->loadLanguage('tinymce');
$op = Request::getCmd('op', '');
if ($op === 'save') {
if (!$xoops->security()->check()) {
$xoops->redirect('xoops_xlanguage.php', 2, implode(',', $xoops->security()->getErrors()));
}
XoopsLoad::load('system', 'system');
$msg[] = _AM_SMILIES_SAVE;
$obj = $helper->getHandlerSmilies()->create();
$obj->setVar('smiley_code', Request::getString('smiley_code', ''));
$obj->setVar('smiley_emotion', Request::getString('smiley_emotion', ''));
$obj->setVar('smiley_display', Request::getBool('smiley_display', 1));
$obj->setVar('smiley_url', 'smilies/' . Request::getPath('smiley_url', ''));
$xoops_upload_file = Request::getArray('xoops_upload_file', array());
$mimetypes = array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png');
$upload_size = 500000;
$uploader = new XoopsMediaUploader(\XoopsBaseConfig::get('uploads-path') . '/smilies', $mimetypes, $upload_size, null, null);
if ($uploader->fetchMedia($xoops_upload_file[0])) {
$uploader->setPrefix('smil');
if (!$uploader->upload()) {
$msg[] = $uploader->getErrors();
$obj->setVar('smiley_url', 'blank.gif');
} else {
$obj->setVar('smiley_url', 'smilies/' . $uploader->getSavedFileName());
}
}
if ($helper->getHandlerSmilies()->insert($obj)) {
示例5: displayPost
public function displayPost()
{
$xoops = Xoops::getInstance();
if (Request::getMethod() !== 'POST') {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$id = Request::getInt('com_id');
$modid = Request::getInt('com_modid');
if (empty($modid)) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
/* @var $comment CommentsComment */
$comment = $this->getHandlerComment()->get($id);
if (!is_object($comment)) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
if (!$comment->isNew()) {
$modid = $comment->getVar('modid');
} else {
$comment->setVar('modid', $modid);
}
$module = $xoops->getModuleById($modid);
if (!is_object($module)) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$moddir = $module->getVar('dirname');
if ($xoops->isAdminSide) {
if (empty($id)) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$redirect_page = $this->url('admin/main.php?com_modid=' . $modid . '&com_itemid');
} else {
if (COMMENTS_APPROVENONE == $xoops->getModuleConfig('com_rule', $module->getVar('dirname'))) {
$xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$redirect_page = '';
}
/* @var $plugin CommentsPluginInterface */
if ($plugin = \Xoops\Module\Plugin::getPlugin($moddir, 'comments')) {
if (!$xoops->isAdminSide) {
$redirect_page = $xoops->url('modules/' . $moddir . '/' . $plugin->pageName() . '?');
if (is_array($extraParams = $plugin->extraParams())) {
$extra_params = '';
foreach ($extraParams as $extra_param) {
$extra_params .= isset($_POST[$extra_param]) ? $extra_param . '=' . htmlspecialchars($_POST[$extra_param]) . '&' : $extra_param . '=amp;';
}
$redirect_page .= $extra_params;
}
$redirect_page .= $plugin->itemName();
}
$comment_url = $redirect_page;
$op = Request::getBool('com_dopost') ? 'post' : '';
$op = Request::getBool('com_dopreview') ? 'preview' : $op;
$op = Request::getBool('com_dodelete') ? 'delete' : $op;
if ($op === 'preview' || $op === 'post') {
if (!$xoops->security()->check()) {
$op = '';
}
}
if ($op === 'post' && !$xoops->isUser()) {
$xoopsCaptcha = XoopsCaptcha::getInstance();
if (!$xoopsCaptcha->verify()) {
$captcha_message = $xoopsCaptcha->getMessage();
$op = 'preview';
}
}
$title = XoopsLocale::trim(Request::getString('com_title'));
$text = XoopsLocale::trim(Request::getString('com_text'));
$mode = XoopsLocale::trim(Request::getString('com_mode', 'flat'));
$order = XoopsLocale::trim(Request::getString('com_order', COMMENTS_OLD1ST));
$itemid = Request::getInt('com_itemid');
$pid = Request::getInt('com_pid');
$rootid = Request::getInt('com_rootid');
$status = Request::getInt('com_status');
$dosmiley = Request::getBool('com_dosmiley');
$doxcode = Request::getBool('com_doxcode');
$dobr = Request::getBool('com_dobr');
$dohtml = Request::getBool('com_html');
$doimage = Request::getBool('com_doimage');
$icon = XoopsLocale::trim(Request::getString('com_icon'));
$comment->setVar('title', $title);
$comment->setVar('text', $text);
$comment->setVar('itemid', $itemid);
$comment->setVar('pid', $pid);
$comment->setVar('rootid', $rootid);
$comment->setVar('status', $status);
$comment->setVar('dosmiley', $dosmiley);
$comment->setVar('doxcode', $doxcode);
$comment->setVar('dobr', $dobr);
$comment->setVar('dohtml', $dohtml);
$comment->setVar('doimage', $doimage);
$comment->setVar('icon', $icon);
switch ($op) {
case "delete":
$this->displayDelete();
break;
case "preview":
$comment->setVar('doimage', 1);
if ($comment->getVar('dohtml') != 0) {
if ($xoops->isUser()) {
//.........这里部分代码省略.........
示例6: implode
if (!$xoops->security()->check()) {
$xoops->redirect('categories.php', 3, implode('<br />', $xoops->security()->getErrors()));
}
$imgcat_id = Request::getInt('imgcat_id', 0);
if (isset($imgcat_id) && $imgcat_id != 0) {
$obj = $helper->getHandlerCategories()->get($imgcat_id);
$isnew = false;
} else {
$obj = $helper->getHandlerCategories()->create();
$isnew = true;
}
$obj->setVar('imgcat_name', Request::getString('imgcat_name', ''));
$obj->setVar('imgcat_maxsize', Request::getInt('imgcat_maxsize', 100000));
$obj->setVar('imgcat_maxwidth', Request::getInt('imgcat_maxwidth', 128));
$obj->setVar('imgcat_maxheight', Request::getInt('imgcat_maxheight', 128));
$obj->setVar('imgcat_display', Request::getBool('imgcat_display', 1));
$obj->setVar('imgcat_weight', Request::getInt('imgcat_weight', 0));
$obj->setVar('imgcat_storetype', Request::getString('imgcat_storetype', 'file'));
$obj->setVar('imgcat_type', 'C');
if ($imgcat_id = $helper->getHandlerCategories()->insert($obj)) {
// delete permissions
if (!$isnew) {
$criteria = new CriteriaCompo(new Criteria('gperm_itemid', $imgcat_id));
$criteria->add(new Criteria('gperm_modid', $xoops->module->getVar('mid')));
$criteria2 = new CriteriaCompo(new Criteria('gperm_name', 'imgcat_write'));
$criteria2->add(new Criteria('gperm_name', 'imgcat_read'), 'OR');
$criteria->add($criteria2);
$xoops->getHandlerGroupPermission()->deleteAll($criteria);
}
// Save permissions
$permissions = array('readgroup' => 'imgcat_read', 'writegroup' => 'imgcat_write');
示例7:
$edituser->setVar('user_from', Request::getString('user_from', ''));
$edituser->setVar('user_sig', XoopsLocale::substr(Request::getString('user_sig', ''), 0, 255));
$edituser->setVar('user_viewemail', Request::getBool('user_viewemail', 0));
$edituser->setVar('user_aim', Request::getString('user_aim', ''));
$edituser->setVar('user_yim', Request::getString('user_yim', ''));
$edituser->setVar('user_msnm', Request::getString('user_msnm', ''));
$edituser->setVar('attachsig', Request::getBool('attachsig', 0));
$edituser->setVar('timezone', Request::getString('timezone', 'UTC'));
$edituser->setVar('uorder', Request::getInt('uorder', 0));
$edituser->setVar('umode', Request::getString('umode', 'flat'));
$edituser->setVar('notify_method', Request::getInt('notify_method', 1));
$edituser->setVar('notify_mode', Request::getInt('notify_mode', 1));
$edituser->setVar('bio', XoopsLocale::substr(Request::getString('bio', ''), 0, 255));
$edituser->setVar('user_occ', Request::getString('user_occ', ''));
$edituser->setVar('user_intrest', Request::getString('user_intrest', ''));
$edituser->setVar('user_mailok', Request::getBool('user_mailok', 0));
if (!$member_handler->insertUser($edituser)) {
$xoops->header();
echo $edituser->getHtmlErrors();
$xoops->footer();
} else {
$xoops->redirect('userinfo.php?uid=' . $uid, 1, XoopsLocale::S_YOUR_PROFILE_UPDATED);
}
exit;
}
}
if ($op === 'editprofile') {
$xoops->header('module:system/system_edituser.tpl');
$xoops->tpl()->assign('uid', $xoops->user->getVar("uid"));
$xoops->tpl()->assign('editprofile', true);
$form = new Xoops\Form\ThemeForm(XoopsLocale::EDIT_PROFILE, 'userinfo', 'edituser.php', 'post', true);
示例8: testGetBool
/**
* @covers Xoops\Core\Request::getBool
*/
public function testGetBool()
{
$varname = 'RequestTest';
$_REQUEST[$varname] = '9';
$this->assertTrue(Request::getBool($varname));
$_REQUEST[$varname] = 'a string';
$this->assertTrue(Request::getBool($varname));
$_REQUEST[$varname] = true;
$this->assertTrue(Request::getBool($varname));
$_REQUEST[$varname] = '';
$this->assertFalse(Request::getBool($varname));
$_REQUEST[$varname] = false;
$this->assertFalse(Request::getBool($varname));
$this->assertFalse(Request::getBool($varname . 'no-such-key'));
}
示例9: dirname
* @author trabis <lusopoemas@gmail.com>
* @version $Id$
*/
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->header();
// we ask Xoops for our cache
$cache = $xoops->cache();
/**
* If requested, delete the caches for our module. The cache has hierarchical
* keys, so we can treat them similar to a directory tree. One delete clears
* everything underneath, so we don't have to delete each item.
*
* module/{dirname} is the naming standard for module specific cache entries.
*/
if (Request::getBool('delete', false, 'GET')) {
$cache->delete('module/codex');
}
$keys = array('module/codex/firstkey', 'module/codex/secondkey', 'module/codex/alternate', 'module/codex/xmfdemo');
echo '<h3>Current Cache State</h3>';
echo '<dl>';
foreach ($keys as $key) {
echo "<dt>{$key}</dt>";
$value = '<em>Not Found</em>';
if (!($value = $cache->read($key))) {
$value = '<em>Not Found</em>';
}
echo "<dd>{$value}</dd>";
}
echo '</dl>';
echo '<h3>Caching Content</h3>';