Example #1
0
 /**
  * @return string
  */
 public function getAdminLinks()
 {
     global $xoopsConfig, $xoopsUser;
     $adminLinks = '';
     if (is_object($xoopsUser) && (publisher_userIsAdmin() || publisher_userIsAuthor($this) || $this->publisher->getHandler('permission')->isGranted('item_submit', $this->categoryid()))) {
         if (publisher_userIsAdmin() || publisher_userIsAuthor($this) || publisher_userIsModerator($this)) {
             if ($this->publisher->getConfig('perm_edit') || publisher_userIsModerator($this) || publisher_userIsAdmin()) {
                 // Edit button
                 $adminLinks .= "<a href='" . PUBLISHER_URL . "/submit.php?itemid=" . $this->itemid() . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif'" . " title='" . _CO_PUBLISHER_EDIT . "' alt='" . _CO_PUBLISHER_EDIT . "'/></a>";
                 $adminLinks .= " ";
             }
             if ($this->publisher->getConfig('perm_delete') || publisher_userIsModerator($this) || publisher_userIsAdmin()) {
                 // Delete button
                 $adminLinks .= "<a href='" . PUBLISHER_URL . "/submit.php?op=del&amp;itemid=" . $this->itemid() . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png'" . " title='" . _CO_PUBLISHER_DELETE . "' alt='" . _CO_PUBLISHER_DELETE . "' /></a>";
                 $adminLinks .= " ";
             }
         }
         if ($this->publisher->getConfig('perm_clone') || publisher_userIsModerator($this) || publisher_userIsAdmin()) {
             // Duplicate button
             $adminLinks .= "<a href='" . PUBLISHER_URL . "/submit.php?op=clone&amp;itemid=" . $this->itemid() . "'><img src='" . PUBLISHER_URL . "/images/links/clone.gif'" . " title='" . _CO_PUBLISHER_CLONE . "' alt='" . _CO_PUBLISHER_CLONE . "' /></a>";
             $adminLinks .= " ";
         }
     }
     // PDF button
     $adminLinks .= "<a href='" . PUBLISHER_URL . "/makepdf.php?itemid=" . $this->itemid() . "' rel='nofollow' target='_blank'><img src='" . PUBLISHER_URL . "/images/links/pdf.gif' title='" . _CO_PUBLISHER_PDF . "' alt='" . _CO_PUBLISHER_PDF . "' /></a>";
     $adminLinks .= " ";
     // Print button
     $adminLinks .= "<a href='" . publisher_seo_genUrl("print", $this->itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'><img src='" . PUBLISHER_URL . "/images/links/print.gif' title='" . _CO_PUBLISHER_PRINT . "' alt='" . _CO_PUBLISHER_PRINT . "' /></a>";
     $adminLinks .= " ";
     // Email button
     if (xoops_isActiveModule('tellafriend')) {
         $subject = sprintf(_CO_PUBLISHER_INTITEMFOUND, $xoopsConfig['sitename']);
         $subject = $this->_convert_for_japanese($subject);
         $maillink = publisher_tellafriend($subject);
         $adminLinks .= '<a href="' . $maillink . '"><img src="' . PUBLISHER_URL . '/images/links/friend.gif" title="' . _CO_PUBLISHER_MAIL . '" alt="' . _CO_PUBLISHER_MAIL . '" /></a>';
         $adminLinks .= " ";
     }
     return $adminLinks;
 }
Example #2
0
include_once dirname(__FILE__) . '/header.php';
xoops_loadLanguage('admin', PUBLISHER_DIRNAME);
// Get the total number of categories
$categoriesArray = $publisher->getHandler('category')->getCategoriesForSubmit();
if (!$categoriesArray) {
    redirect_header("index.php", 1, _MD_PUBLISHER_NEED_CATEGORY_ITEM);
    exit;
}
$groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
$gperm_handler = xoops_getmodulehandler('groupperm');
$module_id = $publisher->getModule()->getVar('mid');
$itemid = PublisherRequest::getInt('itemid');
if ($itemid != 0) {
    // We are editing or deleting an article
    $itemObj = $publisher->getHandler('item')->get($itemid);
    if (!(publisher_userIsAdmin() || publisher_userIsAuthor($itemObj) || publisher_userIsModerator($itemObj))) {
        redirect_header("index.php", 1, _NOPERM);
        exit;
    }
    if (!publisher_userIsAdmin() || !publisher_userIsModerator($itemObj)) {
        if (isset($_GET['op']) && $_GET['op'] == 'del' && !$publisher->getConfig('perm_delete')) {
            redirect_header("index.php", 1, _NOPERM);
            exit;
        } else {
            if (!$publisher->getConfig('perm_edit')) {
                redirect_header("index.php", 1, _NOPERM);
                exit;
            }
        }
    }
    $categoryObj = $itemObj->category();