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


PHP Core\Request类代码示例

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


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

示例1: eventCoreImagemanager

 public static function eventCoreImagemanager($args)
 {
     $uri = '';
     foreach (Request::get() as $k => $v) {
         $uri .= urlencode($k) . '=' . urlencode($v) . '&';
     }
     Xoops::getInstance()->redirect("modules/images/imagemanager.php?{$uri}", 0);
 }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:8,代码来源:preload.php

示例2: search

    public function search($queries, $andor, $limit, $start, $userid)
    {
        $xoops = Xoops::getInstance();
        $alumni = Alumni::getInstance();
        $myts = MyTextSanitizer::getInstance();
        $by_cat = Request::getInt('by_cat', '');
        $andor = Request::getWord('andor', 'AND');
        $queries = array();
        $query = Request::getString('query', '');
        $start = Request::getInt('start', '0');
        $helper = $xoops->getModuleHelper('alumni');
        $module_id = $helper->getModule()->getVar('mid');
        $listingHandler = $helper->getHandler('listing');
        $groups = $xoops->getUserGroups();
        $alumni_ids = $xoops->getHandlerGroupperm()->getItemIds('alumni_view', $groups, $module_id);
        $all_ids = implode(', ', $alumni_ids);
        $criteria = new CriteriaCompo();
        $criteria->add(new Criteria('valid', 1, '='));
        //  $criteria->add(new Criteria('date', time(), '<='));
        $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
        if ($userid != 0) {
            $criteria->add(new Criteria('usid', $userid, '='));
        }
        if ($by_cat) {
            $criteria->add(new Criteria('cid', $by_cat, '='));
        }
        $queries = array($query);
        $queries = implode('+', $queries);
        $count = 0;
        $i = 0;
        $criteria->add(new Criteria('name', '%' . $queries . '%', 'LIKE'), 'AND');
        $criteria->add(new Criteria('mname', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('lname', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('school', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->add(new Criteria('year', '%' . $queries . '%', 'LIKE'), 'OR');
        $criteria->setLimit($limit);
        $criteria->setSort('date');
        $criteria->setOrder('DESC');
        $criteria->setStart($start);
        $numrows = $listingHandler->getCount();
        $this_search = $listingHandler->getall($criteria);
        $ret = array();
        $k = 0;
        foreach ($this_search as $obj) {
            $ret[$k]['image'] = 'images/cat/default.gif';
            $ret[$k]['link'] = 'listing.php?lid=' . $obj->getVar('lid') . '';
            $ret[$k]['title'] = $obj->getVar('name') . ' ' . $obj->getVar('mname') . ' ' . $obj->getVar('lname') . '   ---   ' . $obj->getVar('school') . '
		---   ' . $obj->getVar('year');
            $ret[$k]['time'] = $obj->getVar('date');
            $ret[$k]['uid'] = $obj->getVar('usid');
            $k++;
        }
        return $ret;
    }
开发者ID:jlm69,项目名称:alumni-26x,代码行数:54,代码来源:good_search.php

示例3: search

 public function search($queryArray, $andor, $limit, $offset, $userid)
 {
     $xoops = Xoops::getInstance();
     $helper = $xoops->getModuleHelper('alumni');
     $module_id = $helper->getModule()->getVar('mid');
     $listing_Handler = $helper->getHandler('listing');
     $groups = $xoops->getUserGroups();
     $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id);
     $all_ids = implode(', ', $alumni_ids);
     $by_cat = Request::getInt('by_cat', 0);
     $andor = strtolower($andor) == 'and' ? 'and' : 'or';
     $qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
     $eb = $qb->expr();
     $qb->select('DISTINCT *')->fromPrefix('alumni_listing')->where($eb->eq('valid', '1'))->orderBy('lname', 'DESC')->setFirstResult($offset)->setMaxResults($limit);
     if (is_array($queryArray) && !empty($queryArray)) {
         $queryParts = array();
         foreach ($queryArray as $i => $q) {
             $query = ':query' . $i;
             $qb->setParameter($query, '%' . $q . '%', \PDO::PARAM_STR);
             $queryParts[] = $eb->orX($eb->like('name', $query), $eb->like('mname', $query), $eb->like('lname', $query), $eb->like('school', $query), $eb->like('year', $query));
         }
         $qb->andWhere($eb->in('cid', array($all_ids)));
         if ($by_cat) {
             $qb->andWhere($eb->eq('cid', $by_cat));
         }
         if ($andor == 'and') {
             $qb->andWhere(call_user_func_array(array($eb, "andX"), $queryParts));
         } else {
             $qb->andWhere(call_user_func_array(array($eb, "orX"), $queryParts));
         }
     } else {
         $qb->setParameter(':uid', (int) $userid, \PDO::PARAM_INT);
         $qb->andWhere($eb->eq('usid', ':uid'));
     }
     $myts = MyTextSanitizer::getInstance();
     $items = array();
     $result = $qb->execute();
     while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
         $items[] = array('title' => $myrow['name'] . " " . $myrow['mname'] . " " . $myrow['lname'] . "   ---   " . $myrow['school'] . " ---   " . $myrow['year'], 'link' => "listing.php?lid=" . $myrow["lid"], 'time' => $myrow['date'], 'uid' => $myrow['usid'], 'image' => 'images/cat/default.gif');
     }
     return $items;
 }
开发者ID:jlm69,项目名称:alumni-26x,代码行数:42,代码来源:search.php

示例4: 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

示例5:

            }
        } else {
            echo $xoops->confirm(array('ok' => 1, 'related_id' => $related_id, 'op' => 'delete'), 'related.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br /><span class="red">' . $obj->getvar('related_name') . '<span>');
        }
        break;
    case 'update_status':
        $related_id = Request::getInt('related_id', 0);
        if ($related_id > 0) {
            $obj = $related_Handler->get($related_id);
            $old = $obj->getVar('related_domenu');
            $obj->setVar('related_domenu', !$old);
            if ($related_Handler->insert($obj)) {
                exit;
            }
            echo $obj->getHtmlErrors();
        }
        break;
    case 'view':
        $related_id = Request::getInt('related_id', 0);
        if ($related_id > 0) {
            $obj = $related_Handler->get($related_id);
            $old = $obj->getVar('related_domenu');
            $obj->setVar('related_domenu', !$old);
            if ($related_Handler->insert($obj)) {
                exit;
            }
            echo $obj->getHtmlErrors();
        }
        break;
}
$xoops->footer();
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:related.php

示例6: dirname

 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @since           2.6.0
 * @author          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php';
XoopsLoad::load('system', 'system');
$xoops = Xoops::getInstance();
$system = System::getInstance();
$helper = Xoops\Module\Helper::getHelper('images');
// Get Action type
$op = Request::getCmd('op', 'list');
$start = Request::getInt('start', 0);
$imgcat_id = Request::getInt('imgcat_id', 0);
$redirect = basename($xoops->getEnv('SCRIPT_NAME'));
if (!$xoops->isUser() || !$xoops->isModule() || !$xoops->user->isAdmin($xoops->module->mid())) {
    exit(XoopsLocale::E_NO_ACCESS_PERMISSION);
}
$gperm_handler = $xoops->getHandlerGroupPermission();
$groups = $xoops->getUserGroups();
// check WRITE right by category before continue
if (isset($imgcat_id) && ($op === 'addfile' || $op === 'editcat' || $op === 'updatecat' || $op === 'delcatok' || $op === 'delcat')) {
    $imgcat_write = $gperm_handler->checkRight('imgcat_write', $imgcat_id, $groups, $xoops->module->mid());
    if (!$imgcat_write) {
        $xoops->redirect($redirect, 1);
    }
}
// Only website administator can delete categories or images
if (!in_array(FixedGroups::ADMIN, $groups) && ($op === 'delfile' || $op === 'delfileok' || $op === 'delcatok' || $op === 'delcat')) {
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:header.php

示例7:

MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Publisher
 * @since           1.0
 * @author          trabis <lusopoemas@gmail.com>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id$
 */
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
$itemid = Request::getInt('itemid');
if ($itemid == 0) {
    $xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the ITEM object for the selected ITEM
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($itemid);
// if the selected ITEM was not found, exit
if ($itemObj->notLoaded()) {
    $xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Check user permissions to access that category of the selected ITEM
if (!$itemObj->accessGranted()) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
开发者ID:redmexico,项目名称:XoopsCore,代码行数:31,代码来源:print.php

示例8: time

 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         page
 * @since           2.6.0
 * @author          DuGris (aka Laurent JEN)
 * @version         $Id$
 */
include_once 'header.php';
$xoops->logger()->quiet();
$ret['error'] = 1;
if ($xoops->security()->check()) {
    $time = time();
    if (!isset($_SESSION['page_rating' . $content_id]) || $_SESSION['page_rating' . $content_id] < $time) {
        $content_id = Request::getInt('content_id', 0);
        $option = Request::getInt('option', 0);
        $_SESSION['page_rating' . $content_id] = $time + $interval;
        // Test if the page exist
        $contentObj = $content_Handler->get($content_id);
        if (count($contentObj) == 0 || $contentObj->getVar('content_status') == 0 || $contentObj->getVar('content_dorating') == 0) {
            echo json_encode($ret);
            exit;
        }
        // Permission to view
        $perm_view = $gperm_Handler->checkRight('page_view_item', $content_id, $groups, $module_id, false);
        // Permission to vote
        $perm_vote = $gperm_Handler->checkRight('page_global', 0, $groups, $module_id, false);
        if (!$perm_view || !$perm_vote) {
            echo json_encode($ret);
            exit;
        }
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:jquery_rating.php

示例9: array

 */
// ######################################################################
// # Original version:
// # [11-may-2001] Kenneth Lee - http://www.nexgear.com/
// ######################################################################
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$xoops->header('module:publisher/publisher_archive.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
$lastyear = 0;
$lastmonth = 0;
$months_arr = array(1 => XoopsLocale::L_MONTH_JANUARY, 2 => XoopsLocale::L_MONTH_FEBRUARY, 3 => XoopsLocale::L_MONTH_MARCH, 4 => XoopsLocale::L_MONTH_APRIL, 5 => XoopsLocale::L_MONTH_MAY, 6 => XoopsLocale::L_MONTH_JUNE, 7 => XoopsLocale::L_MONTH_JULY, 8 => XoopsLocale::L_MONTH_AUGUST, 9 => XoopsLocale::L_MONTH_SEPTEMBER, 10 => XoopsLocale::L_MONTH_OCTOBER, 11 => XoopsLocale::L_MONTH_NOVEMBER, 12 => XoopsLocale::L_MONTH_DECEMBER);
$fromyear = Request::getInt('year');
$frommonth = Request::getInt('month');
$pgtitle = '';
if ($fromyear && $frommonth) {
    $pgtitle = sprintf(" - %d - %d", $fromyear, $frommonth);
}
$dateformat = $publisher->getConfig('format_date');
if ($dateformat == '') {
    $dateformat = 'm';
}
$myts = MyTextSanitizer::getInstance();
$xoopsTpl->assign('xoops_pagetitle', $myts->htmlSpecialChars(_MD_PUBLISHER_ARCHIVES) . $pgtitle . ' - ' . $myts->htmlSpecialChars($xoopsModule->getVar('name')));
$useroffset = '';
if ($xoops->isUser()) {
    $timezone = $xoops->user->timezone();
    if (isset($timezone)) {
        $useroffset = $xoops->user->timezone();
开发者ID:redmexico,项目名称:XoopsCore,代码行数:31,代码来源:archive.php

示例10: count

 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Publisher
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <lusopoemas@gmail.com>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id$
 */
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
// At which record shall we start for the Categories
$catstart = Request::getInt('catstart');
// At which record shall we start for the ITEM
$start = Request::getInt('start');
// Number of categories at the top level
$totalCategories = $publisher->getCategoryHandler()->getCategoriesCount(0);
// if there ain't no category to display, let's get out of here
if ($totalCategories == 0) {
    $xoops->redirect(\XoopsBaseConfig::get('url'), 2, _MD_PUBLISHER_NO_TOP_PERMISSIONS);
}
$xoops->header('module:publisher/publisher_display' . '_' . $publisher->getConfig('idxcat_items_display_type') . '.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
$gperm_handler = $xoops->getHandlerGroupPermission();
// Creating the top categories objects
$categoriesObj = $publisher->getCategoryHandler()->getCategories($publisher->getConfig('idxcat_cat_perpage'), $catstart);
// if no categories are found, exit
$totalCategoriesOnPage = count($categoriesObj);
if ($totalCategoriesOnPage == 0) {
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:index.php

示例11:

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       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Publisher
 * @since           1.0
 * @author          trabis <lusopoemas@gmail.com>
 * @version         $Id$
 */
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$uid = Request::getInt('uid');
if (!$uid) {
    $xoops->redirect('index.php', 2, _CO_PUBLISHER_ERROR);
}
$member_handler = $xoops->getHandlerMember();
$thisuser = $member_handler->getUser($uid);
if (!is_object($thisuser)) {
    $xoops->redirect('index.php', 2, _CO_PUBLISHER_ERROR);
}
if (!$publisher->getConfig('perm_author_items')) {
    $xoops->redirect('index.php', 2, _CO_PUBLISHER_ERROR);
}
$myts = MyTextSanitizer::getInstance();
$xoops->header('publisher_author_items.tpl');
$xoopsTpl = $xoops->tpl();
XoopsLoad::loadFile($publisher->path('footer.php'));
开发者ID:redmexico,项目名称:XoopsCore,代码行数:31,代码来源:author_items.php

示例12: themeSelect

 /**
  * Select Theme
  *
  * @return void
  */
 public function themeSelect()
 {
     $xoopsThemeSelect = Request::getString('xoops_theme_select', '', 'POST');
     if (!empty($xoopsThemeSelect) && in_array($xoopsThemeSelect, $this->getConfig('theme_set_allowed'))) {
         $this->setConfig('theme_set', $xoopsThemeSelect);
         $_SESSION['xoopsUserTheme'] = $xoopsThemeSelect;
     } else {
         if (!empty($_SESSION['xoopsUserTheme']) && in_array($_SESSION['xoopsUserTheme'], $this->getConfig('theme_set_allowed'))) {
             $this->setConfig('theme_set', $_SESSION['xoopsUserTheme']);
         }
     }
 }
开发者ID:elitet,项目名称:XoopsCore,代码行数:17,代码来源:Xoops.php

示例13: 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

示例14: displayDelete

 public function displayDelete()
 {
     $xoops = Xoops::getInstance();
     $op = Request::getCmd('op', 'delete', 'POST');
     $mode = Request::getString('com_mode', 'flat');
     $order = Request::getString('com_order', COMMENTS_OLD1ST);
     $id = Request::getInt('com_id');
     /* @var $comment CommentsComment */
     /* @var $comment_handler CommentsCommentHandler */
     $comment_handler = $this->getHandlerComment();
     $comment = $comment_handler->get($id);
     if (!is_object($comment)) {
         $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
     }
     $module = $xoops->getModuleById($comment->getVar('modid'));
     if (!is_object($module)) {
         $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
     }
     if (!$xoops->isAdminSide && COMMENTS_APPROVENONE == $xoops->getModuleConfig('com_rule', $module->getVar('dirname')) || !$xoops->isUser() && !$xoops->getModuleConfig('com_anonpost', $module->getVar('dirname')) || !$xoops->isModule()) {
         $xoops->redirect(\XoopsBaseConfig::get('url'), 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
     }
     $modid = $module->getVar('mid');
     /* @var $plugin CommentsPluginInterface */
     if ($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'comments')) {
         if ($xoops->isAdminSide) {
             $redirect_page = $this->url('admin/main.php?com_modid=' . $modid . '&amp;com_itemid');
         } else {
             $redirect_page = $xoops->url('modules/' . $module->getVar('dirname') . '/' . $plugin->pageName() . '?');
             $comment_confirm_extra = array();
             if (is_array($extraParams = $plugin->extraParams())) {
                 foreach ($extraParams as $extra_param) {
                     if (isset($_GET[$extra_param])) {
                         $redirect_page .= $extra_param . '=' . $_GET[$extra_param] . '&amp;';
                         // for the confirmation page
                         $comment_confirm_extra[$extra_param] = $_GET[$extra_param];
                     }
                 }
             }
             $redirect_page .= $plugin->itemName();
         }
         $accesserror = false;
         if (!$xoops->isUser()) {
             $accesserror = true;
         } else {
             if (!$xoops->user->isAdmin($modid)) {
                 $accesserror = true;
             }
         }
         if (false != $accesserror) {
             $ref = $xoops->getEnv('HTTP_REFERER');
             if ($ref != '') {
                 $xoops->redirect($ref, 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
             } else {
                 $xoops->redirect($redirect_page . '?' . $plugin->itemName() . '=' . (int) $id, 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
             }
         }
         switch ($op) {
             case 'delete_one':
                 if (!$comment_handler->delete($comment)) {
                     $xoops->header();
                     echo $xoops->alert('error', _MD_COMMENTS_COMDELETENG . ' (ID: ' . $comment->getVar('id') . ')');
                     $xoops->footer();
                 }
                 $itemid = $comment->getVar('itemid');
                 $criteria = new CriteriaCompo(new Criteria('modid', $modid));
                 $criteria->add(new Criteria('itemid', $itemid));
                 $criteria->add(new Criteria('status', COMMENTS_ACTIVE));
                 $comment_count = $comment_handler->getCount($criteria);
                 $plugin->update($itemid, $comment_count);
                 // update user posts if its not an anonymous post
                 if ($comment->getVar('uid') != 0) {
                     $member_handler = $xoops->getHandlerMember();
                     $poster = $member_handler->getUser($comment->getVar('uid'));
                     if (is_object($poster)) {
                         $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') - 1);
                     }
                 }
                 // get all comments posted later within the same thread
                 $thread_comments = $comment_handler->getThread($comment->getVar('rootid'), $id);
                 $xot = new XoopsObjectTree($thread_comments, 'id', 'pid', 'rootid');
                 $child_comments = $xot->getFirstChild($id);
                 // now set new parent ID for direct child comments
                 $new_pid = $comment->getVar('pid');
                 $errs = array();
                 foreach (array_keys($child_comments) as $i) {
                     $child_comments[$i]->setVar('pid', $new_pid);
                     // if the deleted comment is a root comment, need to change root id to own id
                     if (false != $comment->isRoot()) {
                         $new_rootid = $child_comments[$i]->getVar('id');
                         $child_comments[$i]->setVar('rootid', $child_comments[$i]->getVar('id'));
                         if (!$comment_handler->insert($child_comments[$i])) {
                             $errs[] = 'Could not change comment parent ID from <strong>' . $id . '</strong> to <strong>' . $new_pid . '</strong>. (ID: ' . $new_rootid . ')';
                         } else {
                             // need to change root id for all its child comments as well
                             $c_child_comments = $xot->getAllChild($new_rootid);
                             $cc_count = count($c_child_comments);
                             foreach (array_keys($c_child_comments) as $j) {
                                 $c_child_comments[$j]->setVar('rootid', $new_rootid);
                                 if (!$comment_handler->insert($c_child_comments[$j])) {
                                     $errs[] = 'Could not change comment root ID from <strong>' . $id . '</strong> to <strong>' . $new_rootid . '</strong>.';
//.........这里部分代码省略.........
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:101,代码来源:helper.php

示例15: isset

     // FILES UPLOAD FORM
     $files_form = $publisher->getForm($fileObj, 'file');
     $files_form->display();
     break;
 case "modify":
     $fileid = isset($_POST['fileid']) ? (int) $_POST['fileid'] : 0;
     // Creating the file object
     if ($fileid != 0) {
         $fileObj = $publisher->getFileHandler()->get($fileid);
     } else {
         $xoops->redirect("index.php", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
     }
     // Putting the values in the file object
     $fileObj->setVar('name', Request::getString('name'));
     $fileObj->setVar('description', Request::getString('description'));
     $fileObj->setVar('status', Request::getInt('file_status'));
     // attach file if any
     if (isset($_FILES['item_upload_file']) && $_FILES['item_upload_file']['name'] != "") {
         $oldfile = $fileObj->getFilePath();
         // Get available mimetypes for file uploading
         $allowed_mimetypes = $publisher->getMimetypeHandler()->getArrayByType();
         // TODO : display the available mimetypes to the user
         $errors = array();
         if ($publisher->getConfig('perm_upload') && is_uploaded_file($_FILES['item_upload_file']['tmp_name'])) {
             if ($fileObj->checkUpload('item_upload_file', $allowed_mimetypes, $errors)) {
                 if ($fileObj->storeUpload('item_upload_file', $allowed_mimetypes, $errors)) {
                     unlink($oldfile);
                 }
             }
         }
     }
开发者ID:mambax7,项目名称:publisher-26,代码行数:31,代码来源:file.php


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