Ejemplo n.º 1
0
 /**
  * @return string
  */
 public function getAdminLinks()
 {
     $adminLinks = '';
     if (is_object($GLOBALS['xoopsUser']) && (publisherUserIsAdmin() || publisherUserIsAuthor($this) || $this->publisher->getHandler('permission')->isGranted('item_submit', $this->categoryid()))) {
         if (publisherUserIsAdmin() || publisherUserIsAuthor($this) || publisherUserIsModerator($this)) {
             if ($this->publisher->getConfig('perm_edit') || publisherUserIsModerator($this) || publisherUserIsAdmin()) {
                 // Edit button
                 $adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?itemid=' . $this->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif'" . " title='" . _CO_PUBLISHER_EDIT . "' alt='" . _CO_PUBLISHER_EDIT . "'/></a>";
                 $adminLinks .= ' ';
             }
             if ($this->publisher->getConfig('perm_delete') || publisherUserIsModerator($this) || publisherUserIsAdmin()) {
                 // Delete button
                 $adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?op=del&amp;itemid=' . $this->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png'" . " title='" . _CO_PUBLISHER_DELETE . "' alt='" . _CO_PUBLISHER_DELETE . "' /></a>";
                 $adminLinks .= ' ';
             }
         }
         if ($this->publisher->getConfig('perm_clone') || publisherUserIsModerator($this) || publisherUserIsAdmin()) {
             // Duplicate button
             $adminLinks .= "<a href='" . PUBLISHER_URL . '/submit.php?op=clone&amp;itemid=' . $this->itemid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/clone.gif'" . " title='" . _CO_PUBLISHER_CLONE . "' alt='" . _CO_PUBLISHER_CLONE . "' /></a>";
             $adminLinks .= ' ';
         }
     }
     if ($this->publisher->getConfig('display_pdf')) {
         // PDF button
         $adminLinks .= "<a href='" . PUBLISHER_URL . '/makepdf.php?itemid=' . $this->itemid() . "' rel='nofollow' target='_blank'><img src='" . PUBLISHER_URL . "/assets/images/links/pdf.gif' title='" . _CO_PUBLISHER_PDF . "' alt='" . _CO_PUBLISHER_PDF . "' /></a>";
         $adminLinks .= ' ';
     }
     // Print button
     $adminLinks .= "<a href='" . PublisherSeo::generateUrl('print', $this->itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'><img src='" . PUBLISHER_URL . "/assets/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, $GLOBALS['xoopsConfig']['sitename']);
         $subject = $this->convertForJapanese($subject);
         $maillink = publisherTellAFriend($subject);
         $adminLinks .= '<a href="' . $maillink . '"><img src="' . PUBLISHER_URL . '/assets/images/links/friend.gif" title="' . _CO_PUBLISHER_MAIL . '" alt="' . _CO_PUBLISHER_MAIL . '" /></a>';
         $adminLinks .= ' ';
     }
     return $adminLinks;
 }
Ejemplo n.º 2
0
if ($itemObj->pagescount() > 0) {
    if ($itemPageId == -1) {
        $itemPageId = 0;
    }
    include_once $GLOBALS['xoops']->path('class/pagenav.php');
    $pagenav = new XoopsPageNav($itemObj->pagescount(), 1, $itemPageId, 'page', 'itemid=' . $itemObj->itemId());
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
}
// Creating the files object associated with this item
$file = array();
$files = array();
$embededFiles = array();
$filesObj = $itemObj->getFiles();
// check if user has permission to modify files
$hasFilePermissions = true;
if (!(publisherUserIsAdmin() || publisherUserIsModerator($itemObj))) {
    $hasFilePermissions = false;
}
if (null !== $filesObj) {
    foreach ($filesObj as $fileObj) {
        $file = array();
        $file['mod'] = false;
        if ($hasFilePermissions || is_object($GLOBALS['xoopsUser']) && $fileObj->getVar('uid') == $GLOBALS['xoopsUser']->getVar('uid')) {
            $file['mod'] = true;
        }
        if ($fileObj->mimetype() === 'application/x-shockwave-flash') {
            $file['content'] = $fileObj->displayFlash();
            if (strpos($item['maintext'], '[flash-' . $fileObj->getVar('fileid') . ']')) {
                $item['maintext'] = str_replace('[flash-' . $fileObj->getVar('fileid') . ']', $file['content'], $item['maintext']);
            } else {
                $embededFiles[] = $file;
Ejemplo n.º 3
0
xoops_loadLanguage('admin', PUBLISHER_DIRNAME);
$op = XoopsRequest::getString('op', XoopsRequest::getString('op', '', 'GET'), 'POST');
$fileid = XoopsRequest::getInt('fileid', XoopsRequest::getInt('fileid', 0, 'GET'), 'POST');
if ($fileid == 0) {
    redirect_header('index.php', 2, _MD_PUBLISHER_NOITEMSELECTED);
    //    exit();
}
$fileObj =& $publisher->getHandler('file')->get($fileid);
// if the selected item was not found, exit
if (!$fileObj) {
    redirect_header('index.php', 1, _NOPERM);
    //    exit();
}
$itemObj =& $publisher->getHandler('item')->get($fileObj->getVar('itemid'));
// if the user does not have permission to modify this file, exit
if (!(publisherUserIsAdmin() || publisherUserIsModerator($itemObj) || is_object($GLOBALS['xoopsUser']) && $fileObj->getVar('uid') == $GLOBALS['xoopsUser']->getVar('uid'))) {
    redirect_header('index.php', 1, _NOPERM);
    //    exit();
}
/* -- Available operations -- */
switch ($op) {
    case 'default':
    case 'mod':
        include_once $GLOBALS['xoops']->path('header.php');
        include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
        // FILES UPLOAD FORM
        $uploadForm = $fileObj->getForm();
        $uploadForm->display();
        break;
    case 'modify':
        $fileid = XoopsRequest::getInt('fileid', 0, 'POST');