示例#1
0
 * $Id: submit.php,v 1.1 2005/05/13 18:21:55 malanciault Exp $
 * Module: SmartMedia
 * Author: The SmartFactory <www.smartfactory.ca>
 * Licence: GNU
 */
include_once "header.php";
include_once XOOPS_ROOT_PATH . "/header.php";
global $smartmedia_category_handler, $smartmedia_item_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
// Get the total number of categories
$totalCategories = count($smartmedia_category_handler->getCategories());
if ($totalCategories == 0) {
    redirect_header("index.php", 1, _AM_SMEDIA_NOCOLEXISTS);
    exit;
}
// Find if the user is admin of the module
$isAdmin = smartmedia_userIsAdmin();
// If the user is not admin AND we don't allow user submission, exit
if (!($isAdmin || isset($xoopsModuleConfig['allowsubmit']) && $xoopsModuleConfig['allowsubmit'] == 1 && (is_object($xoopsUser) || isset($xoopsModuleConfig['anonpost']) && $xoopsModuleConfig['anonpost'] == 1))) {
    redirect_header("index.php", 1, _NOPERM);
    exit;
}
$op = '';
if (isset($_GET['op'])) {
    $op = $_GET['op'];
}
if (isset($_POST['op'])) {
    $op = $_POST['op'];
}
switch ($op) {
    case 'preview':
        global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsDB;
示例#2
0
function smartmedia_itemAccessGranted($itemid, $categoryid)
{
    global $xoopsUser;
    if (smartmedia_userIsAdmin()) {
        $result = true;
    } else {
        $result = false;
        $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
        $gperm_handler =& xoops_gethandler('groupperm');
        $hModule =& xoops_gethandler('module');
        $hModConfig =& xoops_gethandler('config');
        $smartModule =& $hModule->getByDirname('smartmedia');
        $module_id = $smartModule->getVar('mid');
        // Do we have access to the parent category
        if ($gperm_handler->checkRight('category_read', $categoryid, $groups, $module_id)) {
            // Do we have access to the item ?
            if ($gperm_handler->checkRight('item_read', $itemid, $groups, $module_id)) {
                $result = true;
            } else {
                // No we don't !
                $result = false;
            }
        } else {
            // No we don't !
            $result = false;
        }
    }
    return $result;
}
示例#3
0
}
if (!defined("SMARTMEDIA_URL")) {
    define("SMARTMEDIA_URL", XOOPS_URL . '/modules/' . SMARTMEDIA_DIRNAME . '/');
}
if (!defined("SMARTMEDIA_ROOT_PATH")) {
    define("SMARTMEDIA_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTMEDIA_DIRNAME . '/');
}
if (!defined("SMARTMEDIA_IMAGES_URL")) {
    define("SMARTMEDIA_IMAGES_URL", SMARTMEDIA_URL . "images/");
}
include_once SMARTMEDIA_ROOT_PATH . "include/functions.php";
// Creating the SmartModule object
$smartModule =& smartmedia_getModuleInfo();
$myts = MyTextSanitizer::getInstance();
$smartmedia_moduleName = $myts->displayTarea($smartModule->getVar('name'));
$is_smartmedia_admin = smartmedia_userIsAdmin();
// Creating the SmartModule config Object
$smartConfig =& smartmedia_getModuleConfig();
include_once SMARTMEDIA_ROOT_PATH . "class/permission.php";
include_once SMARTMEDIA_ROOT_PATH . "class/category.php";
include_once SMARTMEDIA_ROOT_PATH . "class/category_text.php";
include_once SMARTMEDIA_ROOT_PATH . "class/folder.php";
include_once SMARTMEDIA_ROOT_PATH . "class/folder_text.php";
include_once SMARTMEDIA_ROOT_PATH . "class/clip.php";
include_once SMARTMEDIA_ROOT_PATH . "class/clip_text.php";
include_once SMARTMEDIA_ROOT_PATH . "class/tabs.php";
include_once SMARTMEDIA_ROOT_PATH . "class/format.php";
include_once SMARTMEDIA_ROOT_PATH . "class/keyhighlighter.class.php";
// Creating the permission handler object
$smartmedia_permission_handler =& xoops_getmodulehandler('permission', SMARTMEDIA_DIRNAME);
// Creating the category handler object