예제 #1
0
 function assignOtherProperties()
 {
     global $xoopsUser;
     $hModule =& xoops_gethandler('module');
     $smartModule =& ss_getModuleInfo();
     $module_id = $smartModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
     $this->_groups_read = $gperm_handler->getGroupIds('category_read', $this->categoryid(), $module_id);
 }
예제 #2
0
/**
* $Id: items_recent.php,v 1.2 2005/08/02 03:47:51 mauriciodelima Exp $
* Module: SmartSection
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
function b_items_recent_show($options)
{
    include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php";
    $myts =& MyTextSanitizer::getInstance();
    $smartModule =& ss_getModuleInfo();
    $block = array();
    if ($options[0] == 0) {
        $categoryid = -1;
    } else {
        $categoryid = $options[0];
    }
    $sort = $options[1];
    $order = smartsection_getOrderBy($sort);
    $limit = $options[2];
    $smartsection_item_handler =& ss_gethandler('item');
    // creating the ITEM objects that belong to the selected category
    $itemsObj = $smartsection_item_handler->getAllPublished($limit, 0, $categoryid, $sort, $order);
    $totalItems = count($itemsObj);
    if ($itemsObj) {
        for ($i = 0; $i < $totalItems; $i++) {
            $newItems['itemid'] = $itemsObj[$i]->itemid();
            $newItems['title'] = $itemsObj[$i]->title();
            $newItems['categoryname'] = $itemsObj[$i]->getCategoryName();
            $newItems['categoryid'] = $itemsObj[$i]->categoryid();
            $newItems['date'] = $itemsObj[$i]->datesub();
            $newItems['poster'] = xoops_getLinkedUnameFromId($itemsObj[$i]->uid());
            $block['items'][] = $newItems;
        }
        $block['lang_title'] = _MB_SS_ITEMS;
        $block['lang_category'] = _MB_SS_CATEGORY;
        $block['lang_poster'] = _MB_SS_POSTEDBY;
        $block['lang_date'] = _MB_SS_DATE;
        $modulename = $myts->makeTboxData4Show($smartModule->getVar('name'));
        $block['lang_visitItem'] = _MB_SS_VISITITEM . " " . $modulename;
    }
    return $block;
}
예제 #3
0
function ss_getAdminLinks($itemid = 0)
{
    // include language file
    global $xoopsConfig;
    $filePath = XOOPS_ROOT_PATH . "/modules/smartsection/language/" . $xoopsConfig['language'] . "/main.php";
    if (file_exists($filePath)) {
        include_once XOOPS_ROOT_PATH . "/modules/smartsection/language/" . $xoopsConfig['language'] . "/main.php";
    } else {
        include_once XOOPS_ROOT_PATH . "/modules/smartsection/language/english/main.php";
    }
    global $xoopsUser, $xoopsDB;
    $smartModule =& ss_getModuleInfo();
    $smartConfig =& ss_getModuleConfig();
    $adminLinks = '';
    $modulePath = XOOPS_URL . "/modules/" . $smartModule->dirname() . "/";
    if ($xoopsUser && $xoopsUser->isAdmin($smartModule->getVar('mid'))) {
        // Edit button
        $adminLinks .= "<a href='" . $modulePath . "admin/item.php?op=mod&itemid=" . $itemid . "'><img src='" . $modulePath . "images/links/edit.gif'" . " title='" . _MD_SS_EDIT . "' alt='" . _MD_SS_EDIT . "'/></a>";
        $adminLinks .= " ";
        // Delete button
        $adminLinks .= "<a href='" . $modulePath . "admin/item.php?op=del&itemid=" . $itemid . "'><img src='" . $modulePath . "images/links/delete.gif'" . " title='" . _MD_SS_DELETE . "' alt='" . _MD_SS_DELETE . "'/></a>";
        $adminLinks .= " ";
    }
    // Print button
    $adminLinks .= "<a href='" . $modulePath . "print.php?itemid=" . $itemid . "' target='_blank'><img src='" . $modulePath . "images/links/print.gif' title='" . _MD_SS_PRINT . "' alt='" . _MD_SS_PRINT . "'/></a>";
    $adminLinks .= " ";
    // Email button
    $maillink = 'mailto:?subject=' . sprintf(_MD_SS_INTITEM, $xoopsConfig['sitename']) . '&amp;body=' . sprintf(_MD_SS_INTITEMFOUND, $xoopsConfig['sitename']) . ':  ' . $modulePath . '/item.php?itemid=' . $itemid;
    $adminLinks .= "<a href='" . $maillink . "'><img src='" . $modulePath . "images/links/friend.gif' title='" . _MD_SS_MAIL . "' alt='" . _MD_SS_MAIL . "'/></a>";
    $adminLinks .= " ";
    if ($smartConfig['allowupload']) {
        // Add a file button
        $adminLinks .= "<a href='" . $modulePath . "addfile.php?itemid=" . $itemid . "'><img src='" . $modulePath . "images/icon/file.gif' title='" . _MD_SS_ADD_FILE . "' alt='" . _MD_SS_ADD_FILE . "'/></a>";
        $adminLinks .= " ";
    }
    return $adminLinks;
}
예제 #4
0
 function assignOtherProperties()
 {
     $smartModule =& ss_getModuleInfo();
     $module_id = $smartModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
     $this->_category = new ssCategory($this->getVar('categoryid'));
     $this->_groups_read = $gperm_handler->getGroupIds('item_read', $this->itemid(), $module_id);
 }
예제 #5
0
 /**
  * Delete all permission for a specific item
  *
  *  deletePermissions()
  *
  * @param integer $itemid : id of the item for which to delete the permissions
  * @return boolean : TRUE if the no errors occured
  **/
 function deletePermissions($itemid, $type = 'item')
 {
     global $xoopsModule;
     $smartModule =& ss_getModuleInfo();
     $result = true;
     $module_id = $smartModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
     switch ($type) {
         case "item":
             $gperm_name = "item_read";
             break;
         case "category":
             $gperm_name = "category_read";
             break;
     }
     $gperm_handler->deleteByModule($module_id, $gperm_name, $itemid);
     return $result;
 }
예제 #6
0
if (!defined("SMARTSECTION_DIRNAME")) {
    define("SMARTSECTION_DIRNAME", 'smartsection');
}
if (!defined("SMARTSECTION_URL")) {
    define("SMARTSECTION_URL", XOOPS_URL . '/modules/' . SMARTSECTION_DIRNAME . '/');
}
if (!defined("SMARTSECTION_ROOT_PATH")) {
    define("SMARTSECTION_ROOT_PATH", XOOPS_ROOT_PATH . '/modules/' . SMARTSECTION_DIRNAME . '/');
}
if (!defined("SMARTSECTION_IMAGES_URL")) {
    define("SMARTSECTION_IMAGES_URL", SMARTSECTION_URL . '/images/');
}
include_once SMARTSECTION_ROOT_PATH . "include/functions.php";
include_once SMARTSECTION_ROOT_PATH . "class/keyhighlighter.class.php";
// Creating the SmartModule object
$smartModule =& ss_getModuleInfo();
$myts = MyTextSanitizer::getInstance();
$smartsection_moduleName = $myts->displayTarea($smartModule->getVar('name'));
// Creating the SmartModule config Object
$smartConfig =& ss_getModuleConfig();
include_once SMARTSECTION_ROOT_PATH . "class/permission.php";
include_once SMARTSECTION_ROOT_PATH . "class/category.php";
include_once SMARTSECTION_ROOT_PATH . "class/item.php";
include_once SMARTSECTION_ROOT_PATH . "class/file.php";
// Creating the item handler object
$smartsection_item_handler =& xoops_getmodulehandler('item', SMARTSECTION_DIRNAME);
// Creating the category handler object
$smartsection_category_handler =& xoops_getmodulehandler('category', SMARTSECTION_DIRNAME);
// Creating the permission handler object
$smartsection_permission_handler =& xoops_getmodulehandler('permission', SMARTSECTION_DIRNAME);
// Creating the file handler object