コード例 #1
0
ファイル: preload.php プロジェクト: ming-hai/XoopsCore
 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);
 }
コード例 #2
0
ファイル: good_search.php プロジェクト: jlm69/alumni-26x
    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;
    }
コード例 #3
0
ファイル: search.php プロジェクト: jlm69/alumni-26x
 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;
 }
コード例 #4
0
ファイル: xoops_smilies.php プロジェクト: ming-hai/XoopsCore
$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));
    }
コード例 #5
0
ファイル: related.php プロジェクト: ming-hai/XoopsCore
            }
        } 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();
コード例 #6
0
ファイル: header.php プロジェクト: ming-hai/XoopsCore
 *
 * @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')) {
コード例 #7
0
ファイル: print.php プロジェクト: redmexico/XoopsCore
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 <*****@*****.**>
 * @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
コード例 #8
0
ファイル: jquery_rating.php プロジェクト: ming-hai/XoopsCore
 *
 * @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;
        }
コード例 #9
0
ファイル: archive.php プロジェクト: redmexico/XoopsCore
 */
// ######################################################################
// # 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();
コード例 #10
0
ファイル: index.php プロジェクト: ming-hai/XoopsCore
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Publisher
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @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) {
コード例 #11
0
ファイル: author_items.php プロジェクト: redmexico/XoopsCore
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 <*****@*****.**>
 * @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'));
コード例 #12
0
ファイル: Xoops.php プロジェクト: elitet/XoopsCore
 /**
  * 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']);
         }
     }
 }
コード例 #13
0
ファイル: request.php プロジェクト: ming-hai/XoopsCore
$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');
コード例 #14
0
ファイル: helper.php プロジェクト: ming-hai/XoopsCore
 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>.';
                                 }
                             }
                         }
                     } else {
                         if (!$comment_handler->insert($child_comments[$i])) {
                             $errs[] = 'Could not change comment parent ID from <strong>' . $id . '</strong> to <strong>' . $new_pid . '</strong>.';
                         }
                     }
                 }
                 if (count($errs) > 0) {
                     $xoops->header();
                     echo $xoops->alert('error', $errs);
                     $xoops->footer();
                     exit;
                 }
                 $xoops->redirect($redirect_page . '=' . $itemid . '&amp;com_order=' . $order . '&amp;com_mode=' . $mode, 1, _MD_COMMENTS_COMDELETED);
                 break;
             case 'delete_all':
                 $rootid = $comment->getVar('rootid');
                 // get all comments posted later within the same thread
                 $thread_comments = $comment_handler->getThread($rootid, $id);
                 // construct a comment tree
                 $xot = new XoopsObjectTree($thread_comments, 'id', 'pid', 'rootid');
                 $child_comments = $xot->getAllChild($id);
                 // add itself here
                 $child_comments[$id] = $comment;
                 $msgs = array();
                 $deleted_num = array();
                 $member_handler = $xoops->getHandlerMember();
                 foreach (array_keys($child_comments) as $i) {
                     if (!$comment_handler->delete($child_comments[$i])) {
                         $msgs[] = _MD_COMMENTS_COMDELETENG . ' (ID: ' . $child_comments[$i]->getVar('id') . ')';
                     } else {
                         $msgs[] = _MD_COMMENTS_COMDELETED . ' (ID: ' . $child_comments[$i]->getVar('id') . ')';
                         // store poster ID and deleted post number into array for later use
                         $poster_id = $child_comments[$i]->getVar('uid');
                         if ($poster_id > 0) {
                             $deleted_num[$poster_id] = !isset($deleted_num[$poster_id]) ? 1 : $deleted_num[$poster_id] + 1;
                         }
                     }
                 }
                 foreach ($deleted_num as $user_id => $post_num) {
                     // update user posts
                     $poster = $member_handler->getUser($user_id);
                     if (is_object($poster)) {
                         $member_handler->updateUserByField($poster, 'posts', $poster->getVar('posts') - $post_num);
                     }
                 }
                 $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);
                 $xoops->header();
                 echo $xoops->alert('info', $msgs);
                 echo '<br /><a href="' . $redirect_page . '=' . $itemid . '&amp;com_order=' . $order . '&amp;com_mode=' . $mode . '">' . XoopsLocale::GO_BACK . '</a>';
                 $xoops->footer();
                 break;
             case 'delete':
             default:
                 $xoops->header();
                 $comment_confirm = array('com_id' => $id, 'com_mode' => $mode, 'com_order' => $order, 'op' => array(_MD_COMMENTS_DELETEONE => 'delete_one', _MD_COMMENTS_DELETEALL => 'delete_all'));
                 if (!empty($comment_confirm_extra) && is_array($comment_confirm_extra)) {
                     $comment_confirm = $comment_confirm + $comment_confirm_extra;
                 }
                 echo $xoops->confirm($comment_confirm, 'comment_delete.php', _MD_COMMENTS_DELETESELECT);
                 $xoops->footer();
                 break;
         }
     }
 }
コード例 #15
0
ファイル: file.php プロジェクト: mambax7/publisher-26
     // 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);
                 }
             }
         }
     }
コード例 #16
0
ファイル: banners.php プロジェクト: ming-hai/XoopsCore
                        $img .= "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/ swflash.cab#version=6,0,40,0\" width=\"468\" height=\"60\">";
                        $img .= "<param name=movie value=\"{$imageurl}\">";
                        $img .= "<embed src=\"{$imageurl}\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"  type=\"application/x-shockwave-flash\" width=\"468\" height=\"60\">";
                        $img .= "</embed>";
                        $img .= "</object>";
                    } else {
                        $img .= "<img src='" . $imageurl . "' alt='' />";
                    }
                }
                echo $xoops->confirm(array("ok" => 1, "bid" => $bid, "op" => "delete"), 'banners.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br \\>' . $img . '<br \\>');
            }
        } else {
            $xoops->redirect('banners.php', 1, XoopsLocale::E_DATABASE_NOT_UPDATED);
        }
        break;
    case 'reload':
        $bid = Request::getInt('bid', 0);
        $obj = $banner_Handler->get($bid);
        $obj->setVar("banner_datestart", time());
        $obj->setVar("banner_dateend", 0);
        $obj->setVar("banner_imptotal", 0);
        $obj->setVar("banner_impmade", 0);
        $obj->setVar("banner_clicks", 0);
        $obj->setVar("banner_status", 1);
        if ($banner_Handler->insert($obj)) {
            $xoops->redirect("banners.php", 2, _AM_BANNERS_DBUPDATED);
        }
        echo $xoops->alert('error', $obj->getHtmlErrors());
        break;
}
$xoops->footer();
コード例 #17
0
ファイル: readpmsg.php プロジェクト: redmexico/XoopsCore
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         core
 * @since           2.0.0
 * @version         $Id$
 */
include __DIR__ . '/mainfile.php';
$xoops = Xoops::getInstance();
$xoops->preload()->triggerEvent('core.readpmsg.start');
if (!$xoops->isUser()) {
    $xoops->redirect("user.php", 2, XoopsLocale::E_YOU_ARE_NOT_REGISTERED);
}
$op = Request::getCmd('op', 'list');
$id = Request::getInt('msg_id', 0);
$start = Request::getInt('start', 0);
$total_messages = Request::getInt('total_messages', 0);
$pm_handler = $xoops->getHandlerPrivateMessage();
$xoops->header('module:system/system_readpmsg.tpl');
switch ($op) {
    case 'list':
    default:
        $criteria = new CriteriaCompo(new Criteria('to_userid', $xoops->user->getVar('uid')));
        if ($id > 0) {
            $criteria->add(new Criteria('msg_id', $id));
        } else {
            $criteria->setStart($start);
        }
        $criteria->setLimit(1);
        $criteria->setSort('msg_time');
        $criteria->setOrder('DESC');
        $pm_arr = $pm_handler->getObjects($criteria);
コード例 #18
0
ファイル: makepdf.php プロジェクト: elitet/XoopsCore
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          Sina Asghari (AKA stranger) <*****@*****.**>
 * @version         $Id$
 */
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$xoops->disableErrorReporting();
if (!$xoops->service('htmltopdf')->isAvailable()) {
    $xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOPDF);
}
$publisher = Publisher::getInstance();
$myts = \Xoops\Core\Text\Sanitizer::getInstance();
$itemid = Request::getInt('itemid');
$item_page_id = Request::getInt('page', -1);
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) {
    $xoops->redirect("javascript:history.go(-1)", 1, _MD_PUBLISHER_NOITEMSELECTED);
}
// Creating the category object that holds the selected item
$categoryObj = $publisher->getCategoryHandler()->get($itemObj->getVar('categoryid'));
// 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);
コード例 #19
0
ファイル: viewpage.php プロジェクト: ming-hai/XoopsCore
use Xoops\Core\Request;
/**
 * page module
 *
 * @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          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
include_once 'header.php';
// Call header
$xoops->header('module:page/page_viewpage.tpl');
// Get ID
$content_id = Request::getInt('id', 0);
// Permission to view
$perm_view = $gperm_Handler->checkRight('page_view_item', $content_id, $groups, $module_id, false);
if (!$perm_view) {
    $xoops->redirect('javascript:history.go(-1)', 2, XoopsLocale::E_NO_ACCESS_PERMISSION);
    exit;
}
// Get content
$view_content = $content_Handler->get($content_id);
// Test if the page exist
if (count($view_content) == 0 || $view_content->getVar('content_status') == 0) {
    $xoops->redirect('index.php', 3, PageLocale::E_NOT_EXIST);
    exit;
}
// hits
if ($view_content->getVar('content_author') != $uid && $view_content->getVar('content_dohits') != false) {
コード例 #20
0
ファイル: main.php プロジェクト: redmexico/XoopsCore
     if ($user_type == 'inactv') {
         $criteria->add(new Criteria('level', 0, '='));
     } elseif ($user_type == "actv") {
         $criteria->add(new Criteria('level', 0, '>'));
     }
     $requete_search .= 'actif ou inactif : ' . $user_type . '<br />';
     $requete_pagenav .= '&amp;user_type=' . $user_type;
 }
 //$groups = empty($_REQUEST['selgroups']) ? array() : array_map("intval", $_REQUEST['selgroups']);
 $validsort = array("uname", "email", "last_login", "user_regdate", "posts");
 $sort = (string) Request::getWord('user_sort', 'user_regdate');
 $sort = !in_array($sort, $validsort) ? "user_regdate" : $sort;
 $requete_pagenav .= '&amp;user_sort=' . $sort;
 $requete_search .= 'order by : ' . $sort . '<br />';
 $criteria->setSort($sort);
 $order = (string) Request::getWord('user_order', 'DESC');
 $requete_pagenav .= '&amp;user_order=' . $order;
 $requete_search .= 'tris : ' . $order . '<br />';
 $criteria->setOrder($order);
 $user_limit = $xoops->getModuleConfig('users_pager', 'system');
 if (isset($_REQUEST['user_limit'])) {
     $user_limit = $_REQUEST['user_limit'];
     $requete_pagenav .= '&amp;user_limit=' . htmlspecialchars($_REQUEST['user_limit']);
     $requete_search .= 'limit : ' . $user_limit . '<br />';
 } else {
     $requete_pagenav .= '&amp;user_limit=' . $xoops->getModuleConfig('users_pager', 'system');
     $requete_search .= 'limit : ' . $user_limit . '<br />';
 }
 $start = !empty($_REQUEST['start']) ? (int) $_REQUEST['start'] : 0;
 if (isset($_REQUEST['selgroups'])) {
     if ($_REQUEST['selgroups'] != 0) {
コード例 #21
0
 * @author          Laurent JEN (aka DuGris)
 * @version         $Id$
 */
use Xoops\Core\Request;
$helper = Xoops\Module\Helper::getHelper('xlanguage');
if (!$helper) {
    ob_end_flush();
    return;
}
require_once dirname(__FILE__) . '/../../../../../../mainfile.php';
$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');
    $lang = $helper->getHandlerLanguage()->create();
    $lang->CleanVarsForDB();
    if ($helper->getHandlerLanguage()->insert($lang)) {
        $helper->getHandlerLanguage()->createConfig();
        $xoops->redirect('xoops_xlanguage.php', 2, _AM_XLANGUAGE_SAVED);
    }
}
// check user/group
$groups = $xoops->getUserGroups();
$gperm_handler = $xoops->getHandlerGroupPermission();
コード例 #22
0
ファイル: pdf.php プロジェクト: elitet/XoopsCore
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 <*****@*****.**>
 * @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();
コード例 #23
0
ファイル: visit.php プロジェクト: mambax7/publisher-26
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
 * @subpackage      Action
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 */
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$fileid = Request::getInt('fileid');
// Creating the item object for the selected item
/* @var $fileObj PublisherFile */
$fileObj = $publisher->getFileHandler()->get($fileid);
if ($fileObj->getVar('status' != _PUBLISHER_STATUS_FILE_ACTIVE)) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($fileObj->getVar('itemid'));
// Check user permissions to access this file
if (!$itemObj->accessGranted()) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
$categoryObj = $itemObj->category();
$fileObj->updateCounter();
コード例 #24
0
ファイル: search.php プロジェクト: ming-hai/XoopsCore
$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);
    if ($andor !== "EXACT") {
        $ignored_queries = array();
コード例 #25
0
ファイル: index.php プロジェクト: redmexico/XoopsCore
 * User configs
 *
 * @copyright       XOOPS Project (http://xoops.org)
 * @license         GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         userconfigs
 * @version         $Id$
 */
include dirname(dirname(__DIR__)) . '/mainfile.php';
$xoops = Xoops::getInstance();
$helper = Userconfigs::getInstance();
if (!$xoops->isUser()) {
    $xoops->redirect($xoops->url('index.php'), 3, _MD_USERCONFIGS_NOACCESS);
}
$mid = Request::getInt('mid', 0);
$uid = $xoops->user->getVar('uid');
$op = Request::getCmd('op', 'show');
$xoops->header('module:userconfigs/list.tpl');
$xoops->tpl()->assign('welcome', sprintf(_MD_USERCONFIGS_WELCOME, XoopsUserUtility::getUnameFromId($xoops->user->getVar('uid'), true)));
//Display part
switch ($op) {
    case 'showmod':
        if (!$mid) {
            $xoops->redirect($xoops->url('index.php'), 3, _MD_USERCONFIGS_NOMOD);
        }
        $module = $xoops->getModuleById($mid);
        /* @var $plugin UserconfigsPluginInterface */
        if (!($plugin = \Xoops\Module\Plugin::getPlugin($module->getVar('dirname'), 'userconfigs'))) {
            $xoops->redirect($xoops->url('index.php'), 3, _MD_USERCONFIGS_NOPLUGIN);
        }
        $config_handler = $helper->getHandlerConfig();
        $criteria = new CriteriaCompo();
コード例 #26
0
ファイル: item.php プロジェクト: ming-hai/XoopsCore
$xoops = Xoops::getInstance();
$itemid = Request::getInt('itemid');
$op = $itemid > 0 || isset($_POST['editor']) ? 'mod' : '';
$op = Request::getCmd('op', $op);
if (isset($_POST['additem'])) {
    $op = 'additem';
} else {
    if (isset($_POST['del'])) {
        $op = 'del';
    }
}
// Where shall we start ?
$submittedstartitem = Request::getInt('submittedstartitem');
$publishedstartitem = Request::getInt('publishedstartitem');
$offlinestartitem = Request::getInt('offlinestartitem');
$rejectedstartitem = Request::getInt('rejectedstartitem');
switch ($op) {
    case "clone":
        if ($itemid == 0) {
            $totalcategories = $publisher->getCategoryHandler()->getCategoriesCount(-1);
            if ($totalcategories == 0) {
                $xoops->redirect("category.php?op=mod", 3, _AM_PUBLISHER_NEED_CATEGORY_ITEM);
            }
        }
        PublisherUtils::cpHeader();
        publisher_editItem(true, $itemid, true);
        break;
    case "mod":
        if ($itemid == 0) {
            $totalcategories = $publisher->getCategoryHandler()->getCategoriesCount(-1);
            if ($totalcategories == 0) {
コード例 #27
0
ファイル: index.php プロジェクト: ming-hai/XoopsCore
 * @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);
            }
コード例 #28
0
ファイル: admin.php プロジェクト: redmexico/XoopsCore
    if (!is_writable($compile_path)) {
        $error_msg[] = sprintf(XoopsLocale::EF_FOLDER_NOT_WRITABLE, $compile_path);
    }
    //www fits inside www_private, lets add a trailing slash to make sure it doesn't
    $xoops_path = $xbc->get('lib-path');
    $xoops_root_path = $xbc->get('root-path');
    if (strpos($xoops_path, $xoops_root_path) !== false || strpos($xoops_path, $_SERVER['DOCUMENT_ROOT']) !== false) {
        $error_msg[] = sprintf(XoopsLocale::EF_FOLDER_IS_INSIDE_DOCUMENT_ROOT, $xoops_path);
    }
    $var_path = $xoops->path('var');
    if (strpos($var_path, $xoops_root_path) !== false || strpos($var_path, $_SERVER['DOCUMENT_ROOT']) !== false) {
        $error_msg[] = sprintf(XoopsLocale::EF_FOLDER_IS_INSIDE_DOCUMENT_ROOT, $var_path);
    }
    $xoops->tpl()->assign('error_msg', $error_msg);
}
$xoopsorgnews = Request::getString('xoopsorgnews', null, 'GET');
if (!empty($xoopsorgnews)) {
    // Multiple feeds
    $myts = MyTextSanitizer::getInstance();
    $rssurl = array();
    $rssurl[] = 'http://sourceforge.net/export/rss2_projnews.php?group_id=41586&rss_fulltext=1';
    $rssurl[] = 'http://www.xoops.org/backend.php';
    $rssurl = array_unique(array_merge($rssurl, XoopsLocale::getAdminRssUrls()));
    $rssfile = 'admin/rss/adminnews-' . $xoops->getConfig('locale');
    $items = $xoops->cache()->cacheRead($rssfile, 'buildRssFeedCache', 24 * 60 * 60, $rssurl);
    if ($items != '') {
        $ret = '<table class="outer width100">';
        foreach (array_keys($items) as $i) {
            $ret .= '<tr class="head"><td><a href="' . htmlspecialchars($items[$i]['link']) . '" rel="external">';
            $ret .= htmlspecialchars($items[$i]['title']) . '</a> (' . htmlspecialchars($items[$i]['pubdate']) . ')</td></tr>';
            if ($items[$i]['description'] != "") {
コード例 #29
0
ファイル: avatar_custom.php プロジェクト: ming-hai/XoopsCore
                $result = $query->execute();
                $xoops->redirect("avatar_custom.php", 2, XoopsLocale::S_ITEM_SAVED);
            } else {
                echo $xoops->alert('error', $obj->getHtmlErrors());
            }
        } else {
            if ($avatar_id > 0) {
                // Define Stylesheet
                $xoops->theme()->addStylesheet('modules/system/css/admin.css');
                $msg = '<div class="spacer"><img src="' . $xoops_upload_url . '/' . $obj->getVar('avatar_file', 's') . '" alt="" /></div><div class="txtcenter bold">' . $obj->getVar('avatar_name', 's') . '</div>' . XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM;
                // Display message
                echo $xoops->confirm(array('ok' => 1, 'op' => 'delete', 'avatar_id' => $avatar_id), 'avatar_custom.php', $msg);
            } else {
                $xoops->redirect('avatar_custom.php', 1, XoopsLocale::E_DATABASE_NOT_UPDATED);
            }
        }
        break;
    case "update_display":
        $avatar_id = Request::getInt('avatar_id', 0);
        if ($avatar_id > 0) {
            $obj = $avatar_Handler->get($avatar_id);
            $old = $obj->getVar('avatar_display');
            $obj->setVar('avatar_display', !$old);
            if ($avatar_Handler->insert($obj)) {
                exit;
            }
            echo $obj->getHtmlErrors();
        }
        break;
}
$xoops->footer();
コード例 #30
0
ファイル: permissions.php プロジェクト: ming-hai/XoopsCore
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
/**
 * page module
 *
 * @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          Mage Grégory (AKA Mage)
 * @version         $Id$
 */
include __DIR__ . '/header.php';
// Get Action type
$op = Request::getString('op', 'global');
// Call header
$xoops->header('admin:page/page_admin_permissions.tpl');
$admin_page = new \Xoops\Module\Admin();
$admin_page->renderNavigation('permissions.php');
$opform = new Xoops\Form\SimpleForm('', 'opform', 'permissions.php', 'get');
$op_select = new Xoops\Form\Select('', 'op', $op);
$op_select->setExtra('onchange="document.forms.opform.submit()"');
$op_select->addOption('global', PageLocale::PERMISSIONS_RATE);
$op_select->addOption('view', PageLocale::PERMISSIONS_VIEW);
$opform->addElement($op_select);
$xoops->tpl()->assign('form', $opform->render());
switch ($op) {
    case 'global':
    default:
        $global_perm_array = array('1' => PageLocale::PERMISSIONS_RATE);