当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getArray方法代码示例

本文整理汇总了PHP中Xoops\Core\Request::getArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getArray方法的具体用法?PHP Request::getArray怎么用?PHP Request::getArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xoops\Core\Request的用法示例。


在下文中一共展示了Request::getArray方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dirname

 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$search = Search::getInstance();
if (!$search->getConfig('enable_search')) {
    header('Location: ' . XOOPS_URL . '/index.php');
    exit;
}
$xoops = Xoops::getInstance();
$action = Request::getCmd('action', 'search');
$query = Request::getString('query', '');
$andor = Request::getWord('andor', 'AND');
$mid = Request::getInt('mid', 0);
$uid = Request::getInt('uid', 0);
$start = Request::getInt('start', 0);
$mids = Request::getArray('mids', array());
$queries = array();
if ($action === "results") {
    if ($query == "") {
        $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER);
    }
} else {
    if ($action === "showall") {
        if ($query == "" || empty($mid)) {
            $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER);
        }
    } else {
        if ($action === "showallbyuser") {
            if (empty($mid) || empty($uid)) {
                $xoops->redirect("index.php", 1, _MD_SEARCH_PLZENTER);
            }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:index.php

示例2: implode

 if (!$xoops->security()->check()) {
     $xoops->redirect('related.php', 3, implode(',', $xoops->security()->getErrors()));
 }
 $related_id = Request::getInt('related_id', 0);
 if ($related_id > 0) {
     $obj = $related_Handler->get($related_id);
 } else {
     $obj = $related_Handler->create();
 }
 //main
 $obj->setVar('related_name', Request::getString('related_name', ''));
 $obj->setVar('related_domenu', Request::getInt('related_domenu', 1));
 $obj->setVar('related_navigation', Request::getInt('related_navigation', 1));
 if ($related_newid = $related_Handler->insert($obj)) {
     $related_id = $related_id != 0 ? $related_id : $related_newid;
     $datas = Request::getArray('datas');
     $datas_exists = $link_Handler->getContentByRelated($related_newid);
     $datas_delete = array_diff(array_values($datas_exists), $datas);
     $datas_add = array_diff($datas, array_values($datas_exists));
     // delete
     if (count($datas_delete) != 0) {
         $criteria = $criteria = new CriteriaCompo();
         $criteria->add(new Criteria('link_related_id', $related_id));
         $criteria->add(new Criteria('link_content_id', '(' . implode(', ', $datas_delete) . ')', 'IN'));
         $links_ids = $link_Handler->getIds($criteria);
         if (!$link_Handler->DeleteByIds($links_ids)) {
         }
     }
     // Add
     if (count($datas_add) != 0) {
         foreach ($datas_add as $weight => $content_id) {
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:related.php

示例3: implode

$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)) {
        $xoops->redirect('xoops_smilies.php', 2, implode('<br />', $msg));
    }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:xoops_smilies.php

示例4: array

    $xoops->redirect(PUBLISHER_URL, 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$xoops->disableModuleCache();
$xoops->header('module:publisher/publisher_search.tpl');
$xoopsTpl = $xoops->tpl();
$module_info_search = $publisher->getModule()->getInfo("search");
XoopsLoad::loadFile($publisher->path($module_info_search["file"]));
$limit = 10;
//$publisher->getConfig('idxcat_perpage');
$uid = 0;
$queries = array();
$andor = Request::getString('andor');
$start = Request::getInt('start');
$category = Request::getArray('category');
$username = Request::getString('uname');
$searchin = Request::getArray('searchin');
$sortby = Request::getString('sortby');
$term = Request::getString('term');
if (empty($category) || is_array($category) && in_array("all", $category)) {
    $category = array();
} else {
    $category = !is_array($category) ? explode(",", $category) : $category;
    $category = array_map("intval", $category);
}
$andor = in_array(strtoupper($andor), array("OR", "AND", "EXACT")) ? strtoupper($andor) : "OR";
$sortby = in_array(strtolower($sortby), array("itemid", "datesub", "title", "categoryid")) ? strtolower($sortby) : "itemid";
if (!(empty($_POST["submit"]) && empty($term))) {
    $next_search["category"] = implode(",", $category);
    $next_search["andor"] = $andor;
    $next_search["term"] = $term;
    $query = trim($term);
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:search.php

示例5: array

$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
$form = new Xoops\Form\SimpleForm('', 'form_id', 'request.php?id=666', true);
$form->setExtra('enctype="multipart/form-data"');
$code = new Xoops\Form\Text('String', 'string', 2, 25, '', 'string...');
$code->setDescription('Description text');
$code->setPattern('^.{3,}$', 'You need at least 3 characters');
$code->setDatalist(array('list 1', 'list 2', 'list 3'));
$form->addElement($code, true);
$select = new Xoops\Form\Select('Select', 'id', '', 1, false);
$select->addOption(1, 'Select 1');
$select->addOption(2, 'Select 2');
$select->addOption('somebad id here', 'Select with bad id');
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:request.php

示例6: array

 $obj->setVar('content_dotitle', in_array('title', $content_option));
 $obj->setVar('content_donotifications', in_array('notifications', $content_option));
 if (preg_match('/^\\d+$/', Request::getInt('content_weight', 0)) == false) {
     $error = true;
     $error_message .= PageLocale::E_WEIGHT . '<br />';
     $obj->setVar('content_weight', 0);
 } else {
     $obj->setVar('content_weight', Request::getInt('content_weight', 0));
 }
 if ($error == true) {
     $xoops->tpl()->assign('error_message', $error_message);
 } else {
     if ($newcontent_id = $content_Handler->insert($obj)) {
         // update permissions
         $perm_id = $content_id > 0 ? $content_id : $newcontent_id;
         $groups_view_item = Request::getArray('groups_view_item', array());
         $gperm_Handler->updatePerms($perm_id, $groups_view_item);
         //notifications
         if ($content_id == 0 && $xoops->isActiveModule('notifications')) {
             $notification_handler = Notifications::getInstance()->getHandlerNotification();
             $tags = array();
             $tags['MODULE_NAME'] = 'page';
             $tags['ITEM_NAME'] = Request::getString('content_title', '');
             $tags['ITEM_URL'] = \XoopsBaseConfig::get('url') . '/modules/page/viewpage.php?id=' . $newcontent_id;
             $notification_handler->triggerEvent('global', 0, 'newcontent', $tags);
             $notification_handler->triggerEvent('item', $newcontent_id, 'newcontent', $tags);
         }
         $xoops->redirect('content.php', 2, XoopsLocale::S_DATABASE_UPDATED);
     }
     echo $xoops->alert('error', $obj->getHtmlErrors());
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:content.php

示例7: array

     // Send
 // Send
 case 'send':
     $mail_send_to = Request::getArray('mail_send_to', array('mail'));
     $mail_inactive = Request::getInt('mail_inactive', 0);
     $mail_mailok = Request::getInt('mail_mailok', 0);
     $mail_lastlog_min = Request::getString('mail_lastlog_min', '');
     $mail_lastlog_max = Request::getString('mail_lastlog_max', '');
     $mail_idle_more = Request::getInt('mail_idle_more', 0);
     $mail_idle_less = Request::getInt('mail_idle_less', 0);
     $mail_regd_min = Request::getString('mail_regd_min', '');
     $mail_regd_max = Request::getString('mail_regd_max', '');
     $mail_to_group = Request::getArray('mail_to_group', array());
     $mail_to_group = array_map("intval", $mail_to_group);
     $mail_start = Request::getInt('mail_start', 0);
     $mail_to_user = Request::getArray('mail_to_user', array());
     $mail_to_user = array_map("intval", $mail_to_user);
     $mail_fromname = Request::getString('mail_fromname');
     $mail_fromemail = Request::getString('mail_fromemail');
     $mail_subject = Request::getString('mail_subject');
     $mail_body = Request::getString('mail_body');
     $count_criteria = 0;
     // user count via criteria;
     if (!empty($mail_send_to)) {
         $added = array();
         $added_id = array();
         $criteria = array();
         if ($mail_inactive) {
             $criteria[] = "level = 0";
         } else {
             if ($mail_mailok) {
开发者ID:redmexico,项目名称:XoopsCore,代码行数:31,代码来源:send_mails.php

示例8: setVarsFromRequest

 /**
  * The name says it all
  */
 public function setVarsFromRequest()
 {
     $xoops = Xoops::getInstance();
     //Required fields
     if (isset($_REQUEST['categoryid'])) {
         $this->setVar('categoryid', Request::getInt('categoryid'));
     }
     if (isset($_REQUEST['title'])) {
         $this->setVar('title', Request::getString('title'));
     }
     if (isset($_REQUEST['body'])) {
         $this->setVar('body', Request::getText('body'));
     }
     //Not required fields
     if (isset($_REQUEST['summary'])) {
         $this->setVar('summary', Request::getText('summary'));
     }
     if (isset($_REQUEST['subtitle'])) {
         $this->setVar('subtitle', Request::getString('subtitle'));
     }
     if (isset($_REQUEST['item_tag'])) {
         $this->setVar('item_tag', Request::getString('item_tag'));
     }
     if (isset($_REQUEST['image_featured'])) {
         $image_item = Request::getArray('image_item');
         $image_featured = Request::getString('image_featured');
         //Todo: get a better image class for xoops!
         //Image hack
         $image_item_ids = array();
         $qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
         $qb->select('i.image_id', 'i.image_name')->fromPrefix('image', 'i')->orderBy('i.image_id');
         $result = $qb->execute();
         while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
             $image_name = $myrow['image_name'];
             $id = $myrow['image_id'];
             if ($image_name == $image_featured) {
                 $this->setVar('image', $id);
             }
             if (in_array($image_name, $image_item)) {
                 $image_item_ids[] = $id;
             }
         }
         $this->setVar('images', implode('|', $image_item_ids));
     }
     if (isset($_REQUEST['uid'])) {
         $this->setVar('uid', Request::getInt('uid'));
     } elseif ($this->isNew()) {
         $this->setVar('uid', $xoops->isUser() ? $xoops->user->getVar('uid') : 0);
     }
     if (isset($_REQUEST['author_alias'])) {
         $this->setVar('author_alias', Request::getString('author_alias'));
         if ($this->getVar('author_alias') != '') {
             $this->setVar('uid', 0);
         }
     }
     if (isset($_REQUEST['datesub'])) {
         $this->setVar('datesub', strtotime($_REQUEST['datesub']['date']) + $_REQUEST['datesub']['time']);
     } elseif ($this->isNew()) {
         $this->setVar('datesub', time());
     }
     if (isset($_REQUEST['item_short_url'])) {
         $this->setVar('short_url', Request::getString('item_short_url'));
     }
     if (isset($_REQUEST['item_meta_keywords'])) {
         $this->setVar('meta_keywords', Request::getString('item_meta_keywords'));
     }
     if (isset($_REQUEST['item_meta_description'])) {
         $this->setVar('meta_description', Request::getString('item_meta_description'));
     }
     if (isset($_REQUEST['weight'])) {
         $this->setVar('weight', Request::getInt('weight'));
     }
     if (isset($_REQUEST['allowcomments'])) {
         $this->setVar('cancomment', Request::getInt('allowcomments'));
     } elseif ($this->isNew()) {
         $this->setVar('cancoment', $this->publisher->getConfig('submit_allowcomments'));
     }
     if (isset($_REQUEST['status'])) {
         $this->setVar('status', Request::getInt('status'));
     } elseif ($this->isNew()) {
         $this->setVar('status', $this->publisher->getConfig('submit_status'));
     }
     if (isset($_REQUEST['dohtml'])) {
         $this->setVar('dohtml', Request::getInt('dohtml'));
     } elseif ($this->isNew()) {
         $this->setVar('dohtml', $this->publisher->getConfig('submit_dohtml'));
     }
     if (isset($_REQUEST['dosmiley'])) {
         $this->setVar('dosmiley', Request::getInt('dosmiley'));
     } elseif ($this->isNew()) {
         $this->setVar('dosmiley', $this->publisher->getConfig('submit_dosmiley'));
     }
     if (isset($_REQUEST['doxcode'])) {
         $this->setVar('doxcode', Request::getInt('doxcode'));
     } elseif ($this->isNew()) {
         $this->setVar('doxcode', $this->publisher->getConfig('submit_doxcode'));
     }
//.........这里部分代码省略.........
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:101,代码来源:item.php

示例9: CriteriaCompo

 $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');
     foreach ($permissions as $k => $permission) {
         $groups = Request::getArray($k, array(FixedGroups::ADMIN));
         if (!in_array(FixedGroups::ADMIN, $groups)) {
             array_push($groups, FixedGroups::ADMIN);
         }
         foreach ($groups as $group) {
             $perm_obj = $xoops->getHandlerGroupPermission()->create();
             $perm_obj->setVar('gperm_groupid', $group);
             $perm_obj->setVar('gperm_itemid', $imgcat_id);
             $perm_obj->setVar('gperm_name', $permission);
             $perm_obj->setVar('gperm_modid', $xoops->module->getVar('mid'));
             $xoops->getHandlerGroupPermission()->insert($perm_obj);
             unset($perm_obj);
         }
     }
     $xoops->redirect('categories.php', 2, _AM_IMAGES_CAT_SAVE);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:categories.php

示例10: testGetArray

 /**
  * @covers Xoops\Core\Request::getArray
  */
 public function testGetArray()
 {
     $varname = 'RequestTest';
     $testArray = array('one', 'two', 'three');
     $_REQUEST[$varname] = $testArray;
     $get = Request::getArray($varname, null, 'request');
     $this->assertTrue(is_array($get));
     $this->assertEquals($get, $testArray);
     $testArray2 = array('one', 'two', '<script>three</script>');
     $_REQUEST[$varname] = $testArray2;
     $get = Request::getArray($varname, null, 'request');
     $this->assertTrue(is_array($get));
     $this->assertEquals($get, $testArray);
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:17,代码来源:RequestTest.php


注:本文中的Xoops\Core\Request::getArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。