Example #1
0
if ($itemObj->pagescount() > 0) {
    if ($item_page_id == -1) {
        $item_page_id = 0;
    }
    include_once XOOPS_ROOT_PATH . '/class/pagenav.php';
    $pagenav = new XoopsPageNav($itemObj->pagescount(), 1, $item_page_id, 'page', 'itemid=' . $itemObj->itemid());
    $xoopsTpl->assign('pagenav', $pagenav->renderNav());
}
// Creating the files object associated with this item
$file = array();
$files = array();
$embeded_files = array();
$filesObj = $itemObj->getFiles();
// check if user has permission to modify files
$hasFilePermissions = true;
if (!(publisher_userIsAdmin() || publisher_userIsModerator($itemObj))) {
    $hasFilePermissions = false;
}
foreach ($filesObj as $fileObj) {
    $file = array();
    $file['mod'] = false;
    if ($hasFilePermissions || is_object($xoopsUser) && $fileObj->getVar('uid') == $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 {
            $embeded_files[] = $file;
        }
Example #2
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 #3
0
xoops_loadLanguage('admin', PUBLISHER_DIRNAME);
$op = PublisherRequest::getString('op');
$fileid = PublisherRequest::getInt('fileid');
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 (!(publisher_userIsAdmin() || publisher_userIsModerator($itemObj) || is_object($xoopsUser) && $fileObj->getVar('uid') == $xoopsUser->getVar('uid'))) {
    redirect_header("index.php", 1, _NOPERM);
    exit;
}
/* -- Available operations -- */
switch ($op) {
    case "default":
    case "mod":
        include_once XOOPS_ROOT_PATH . '/header.php';
        include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
        // FILES UPLOAD FORM
        $files_form = $fileObj->getForm();
        $files_form->display();
        break;
    case "modify":
        $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0;