Example #1
0
 /**
  * @param string $category
  * @param int    $item_id
  *
  * @return array
  */
 public function item($category, $item_id)
 {
     $xoops = Xoops::getInstance();
     $item = array();
     $item_id = (int) $item_id;
     if ($category == 'global') {
         $item['name'] = '';
         $item['url'] = '';
         return $item;
     }
     if ($category == 'category') {
         // Assume we have a valid category id
         $sql = 'SELECT name, short_url FROM ' . $xoopsDB->prefix('publisher_categories') . ' WHERE categoryid  = ' . $item_id;
         $result = $xoopsDB->query($sql);
         // TODO: error check
         $result_array = $xoopsDB->fetchArray($result);
         $item['name'] = $result_array['name'];
         $item['url'] = PublisherUtils::seoGenUrl('category', $item_id, $result_array['short_url']);
         return $item;
     }
     if ($category == 'item') {
         // Assume we have a valid story id
         $sql = 'SELECT title, short_url FROM ' . $xoopsDB->prefix('publisher_items') . ' WHERE itemid = ' . $item_id;
         $result = $xoopsDB->query($sql);
         // TODO: error check
         $result_array = $xoopsDB->fetchArray($result);
         $item['name'] = $result_array['title'];
         $item['url'] = PublisherUtils::seoGenUrl('item', $item_id, $result_array['short_url']);
         return $item;
     }
     return $item;
 }
Example #2
0
function publisher_pagewrap_upload(&$errors)
{
    $publisher = Publisher::getInstance();
    $post_field = 'fileupload';
    $max_size = $publisher->getConfig('maximum_filesize');
    $max_imgwidth = $publisher->getConfig('maximum_image_width');
    $max_imgheight = $publisher->getConfig('maximum_image_height');
    if (!is_dir(PublisherUtils::getUploadDir(true, 'content'))) {
        mkdir(PublisherUtils::getUploadDir(true, 'content'), 0757);
    }
    $allowed_mimetypes = array('text/html', 'text/plain', 'application/xhtml+xml');
    $uploader = new XoopsMediaUploader(PublisherUtils::getUploadDir(true, 'content') . '/', $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight);
    if ($uploader->fetchMedia($post_field)) {
        $uploader->setTargetFileName($uploader->getMediaName());
        if ($uploader->upload()) {
            return true;
        } else {
            $errors = array_merge($errors, $uploader->getErrors(false));
            return false;
        }
    } else {
        $errors = array_merge($errors, $uploader->getErrors(false));
        return false;
    }
}
Example #3
0
function publisher_items_menu_edit($options)
{
    $form = new Xoops\Form\BlockForm();
    $catEle = new Xoops\Form\Label(_MB_PUBLISHER_SELECTCAT, PublisherUtils::createCategorySelect($options[0], 0, true, 'options[0]'));
    $orderEle = new Xoops\Form\Select(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
    $orderEle->addOptionArray(array('datesub' => _MB_PUBLISHER_DATE, 'counter' => _MB_PUBLISHER_HITS, 'weight' => _MB_PUBLISHER_WEIGHT));
    $dispEle = new Xoops\Form\Text(_MB_PUBLISHER_DISP, 'options[2]', 10, 255, $options[2]);
    $form->addElement($catEle);
    $form->addElement($orderEle);
    $form->addElement($dispEle);
    return $form->render();
}
Example #4
0
function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0)
{
    $publisher = Publisher::getInstance();
    $xoops = Xoops::getInstance();
    // if there is a parameter, and the id exists, retrieve data: we're editing a file
    if ($fileid != 0) {
        // Creating the File object
        /* @var $fileObj PublisherFile */
        $fileObj = $publisher->getFileHandler()->get($fileid);
        if ($fileObj->notLoaded()) {
            $xoops->redirect("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED);
        }
        if ($showmenu) {
            //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_EDITING);
        }
        echo "<br />\n";
        echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_EDITING . "</span>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_EDITING_DSC . "</span>";
        PublisherUtils::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
    } else {
        // there's no parameter, so we're adding an item
        $fileObj = $publisher->getFileHandler()->create();
        $fileObj->setVar('itemid', $itemid);
        if ($showmenu) {
            //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_FILE_ADD);
        }
        echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . "</span>";
        echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_ADDING_DSC . "</span>";
        PublisherUtils::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS);
    }
    // FILES UPLOAD FORM
    $files_form = $publisher->getForm($fileObj, 'file');
    $files_form->display();
    if ($fileid != 0) {
        PublisherUtils::closeCollapsableBar('editfile', 'editfileicon');
    } else {
        PublisherUtils::closeCollapsableBar('addfile', 'addfileicon');
    }
}
Example #5
0
        }
        $publisher->getCategoryHandler()->updateAll('parentid', $newpid, $criteria);
        unset($criteria);
    }
    // Looping through the comments to link them to the new articles and module
    echo _AM_PUBLISHER_IMPORT_COMMENTS . "<br />";
    $module_handler = xoops_getHandler('module');
    $moduleObj = $module_handler->getByDirname('xfsection');
    $news_module_id = $moduleObj->getVar('mid');
    $publisher_module_id = $publisher->getModule()->mid();
    $comment_handler = xoops_getHandler('comment');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('com_modid', $news_module_id));
    $comments = $comment_handler->getObjects($criteria);
    foreach ($comments as $comment) {
        $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
        $comment->setVar('com_modid', $publisher_module_id);
        $comment->setNew();
        if (!$comment_handler->insert($comment)) {
            echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />";
        } else {
            echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />";
        }
    }
    echo "<br/><br/>Done.<br/>";
    echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "<br/>";
    echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "<br/>";
    echo "<br/><a href='" . publisher_URL . "'>" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "</a><br/>";
    PublisherUtils::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon');
    $xoops->footer();
}
Example #6
0
     if (isset($_FILES['item_upload_file']) && $_FILES['item_upload_file']['name'] != "") {
         $oldfile = $fileObj->getFilePath();
         // Get available mimetypes for file uploading
         $allowed_mimetypes = $publisher->getMimetypeHandler()->getArrayByType();
         // TODO : display the available mimetypes to the user
         $errors = array();
         if ($publisher->getConfig('perm_upload') && is_uploaded_file($_FILES['item_upload_file']['tmp_name'])) {
             if ($fileObj->checkUpload('item_upload_file', $allowed_mimetypes, $errors)) {
                 if ($fileObj->storeUpload('item_upload_file', $allowed_mimetypes, $errors)) {
                     unlink($oldfile);
                 }
             }
         }
     }
     if (!$publisher->getFileHandler()->insert($fileObj)) {
         $xoops->redirect('item.php?itemid=' . $fileObj->getVar('itemid'), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . PublisherUtils::formatErrors($fileObj->getErrors()));
     }
     $xoops->redirect('item.php?itemid=' . $fileObj->getVar('itemid'), 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS);
     break;
 case "del":
     $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0;
     if ($confirm) {
         if (!$publisher->getFileHandler()->delete($fileObj)) {
             $xoops->redirect('item.php?itemid=' . $fileObj->getVar('itemid'), 2, _AM_PUBLISHER_FILE_DELETE_ERROR);
         }
         $xoops->redirect('item.php?itemid=' . $fileObj->getVar('itemid'), 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->getVar('name')));
     } else {
         // no confirm: show deletion condition
         $xoops->header();
         echo $xoops->confirm(array('op' => 'del', 'fileid' => $fileObj->getVar('fileid'), 'confirm' => 1, 'name' => $fileObj->getVar('name')), 'file.php', _AM_PUBLISHER_DELETETHISFILE . " <br />" . $fileObj->getVar('name') . " <br /> <br />", _AM_PUBLISHER_DELETE);
         $xoops->footer();
Example #7
0
function publisher_items_columns_edit($options)
{
    $form = new Xoops\Form\BlockForm();
    $colEle = new Xoops\Form\Select(_MB_PUBLISHER_NUMBER_COLUMN_VIEW, 'options[0]', $options[0]);
    $colEle->addOptionArray(array('1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5));
    $catEle = new Xoops\Form\Label(_MB_PUBLISHER_SELECTCAT, PublisherUtils::createCategorySelect($options[1], 0, true, 'options[1]'));
    $cItemsEle = new Xoops\Form\Text(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]);
    $truncateEle = new Xoops\Form\Text(_MB_PUBLISHER_TRUNCATE, 'options[3]', 4, 255, $options[3]);
    $tempEle = new Xoops\Form\Select(_MB_PUBLISHER_TEMPLATE, 'options[4]', $options[4]);
    $tempEle->addOptionArray(array('normal' => _MB_PUBLISHER_TEMPLATE_NORMAL, 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED));
    $form->addElement($colEle);
    $form->addElement($catEle);
    $form->addElement($cItemsEle);
    $form->addElement($truncateEle);
    $form->addElement($tempEle);
    return $form->render();
}
Example #8
0
if (!$itemObj->accessGranted()) {
    $xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
$categoryObj = $itemObj->category();
$xoopsTpl = new XoopsTpl();
$myts = MyTextSanitizer::getInstance();
$item['title'] = $itemObj->title();
$item['body'] = $itemObj->body();
$item['categoryname'] = $myts->displayTarea($categoryObj->getVar('name'));
$mainImage = $itemObj->getMainImage();
if ($mainImage['image_path'] != '') {
    $item['image'] = '<img src="' . $mainImage['image_path'] . '" alt="' . $myts->undoHtmlSpecialChars($mainImage['image_name']) . '"/>';
}
$xoopsTpl->assign('item', $item);
$xoopsTpl->assign('printtitle', $xoops->getConfig('sitename') . " - " . PublisherUtils::html2text($categoryObj->getCategoryPath()) . " > " . $myts->displayTarea($itemObj->title()));
$xoopsTpl->assign('printlogourl', $publisher->getConfig('print_logourl'));
$xoopsTpl->assign('printheader', $myts->displayTarea($publisher->getConfig('print_header'), 1));
$xoopsTpl->assign('lang_category', _CO_PUBLISHER_CATEGORY);
$xoopsTpl->assign('lang_author_date', sprintf(_MD_PUBLISHER_WHO_WHEN, $itemObj->posterName(), $itemObj->datesub()));
$doNotStartPrint = false;
$noTitle = false;
$noCategory = false;
$smartPopup = false;
$xoopsTpl->assign('doNotStartPrint', $doNotStartPrint);
$xoopsTpl->assign('noTitle', $noTitle);
$xoopsTpl->assign('smartPopup', $smartPopup);
$xoopsTpl->assign('current_language', $xoops->getConfig('language'));
if ($publisher->getConfig('print_footer') == 'item footer' || $publisher->getConfig('print_footer') == 'both') {
    $xoopsTpl->assign('itemfooter', $myts->displayTarea($publisher->getConfig('item_footer'), 1));
}
Example #9
0
function clearEditSession()
{
    $mimeid = $_REQUEST['id'];
    _clearEditSessionVars($mimeid);
    header('Location: ' . PublisherUtils::makeURI(PUBLISHER_ADMIN_URL . '/mimetypes.php', array('op' => 'edit', 'id' => $mimeid), false));
}
Example #10
0
 /**
  * @return string
  */
 public function displayFlash()
 {
     return PublisherUtils::displayFlash($this->getFileUrl());
 }
Example #11
0
function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null)
{
    $xoops = Xoops::getInstance();
    $publisher = Publisher::getInstance();
    /* @var $categoryObj PublisherCategory */
    // if there is a parameter, and the id exists, retrieve data: we're editing a category
    if ($categoryid != 0) {
        // Creating the category object for the selected category
        $categoryObj = $publisher->getCategoryHandler()->get($categoryid);
        if ($categoryObj->notLoaded()) {
            $xoops->redirect("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT);
        }
    } else {
        if (!$categoryObj) {
            $categoryObj = $publisher->getCategoryHandler()->create();
        }
    }
    if ($categoryid != 0) {
        if ($showmenu) {
            //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING);
        }
        echo "<br />\n";
        PublisherUtils::openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO);
    } else {
        if ($showmenu) {
            //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW);
        }
        PublisherUtils::openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO);
    }
    /* @var $sform PublisherCategoryForm */
    $sform = $publisher->getForm($categoryObj, 'category');
    $sform->setSubCatsCount($nb_subcats);
    $sform->display();
    if (!$categoryid) {
        PublisherUtils::closeCollapsableBar('createtable', 'createtableicon');
    } else {
        PublisherUtils::closeCollapsableBar('edittable', 'edittableicon');
    }
    //Added by fx2024
    if ($categoryid) {
        $sel_cat = $categoryid;
        PublisherUtils::openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC);
        // Get the total number of sub-categories
        $categoriesObj = $publisher->getCategoryHandler()->get($sel_cat);
        $totalsubs = $publisher->getCategoryHandler()->getCategoriesCount($sel_cat);
        // creating the categories objects that are published
        $subcatsObj = $publisher->getCategoryHandler()->getCategories(0, 0, $categoriesObj->getVar('categoryid'));
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
        echo "<tr>";
        echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . "</strong></td>";
        echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . "</strong></td>";
        echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . "</strong></td>";
        echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>";
        echo "</tr>";
        if ($totalsubs > 0) {
            /* @var $subcat PublisherCategory */
            foreach ($subcatsObj as $subcat) {
                $modify = "<a href='category.php?op=mod&amp;categoryid=" . $subcat->getVar('categoryid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>";
                $delete = "<a href='category.php?op=del&amp;categoryid=" . $subcat->getVar('categoryid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>";
                echo "<tr>";
                echo "<td class='head' align='left'>" . $subcat->getVar('categoryid') . "</td>";
                echo "<td class='even' align='left'><a href='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->getVar('categoryid') . "&amp;parentid=" . $subcat->getVar('parentid') . "'>" . $subcat->getVar('name') . "</a></td>";
                echo "<td class='even' align='left'>" . $subcat->getVar('description') . "</td>";
                echo "<td class='even' align='right'> {$modify} {$delete} </td>";
                echo "</tr>";
            }
        } else {
            echo "<tr>";
            echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . "</td>";
            echo "</tr>";
        }
        echo "</table>\n";
        echo "<br />\n";
        PublisherUtils::closeCollapsableBar('subcatstable', 'subcatsicon');
        PublisherUtils::openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC);
        $startitem = Request::getInt('startitem');
        // Get the total number of published ITEMS
        $totalitems = $publisher->getItemHandler()->getItemsCount($sel_cat, array(_PUBLISHER_STATUS_PUBLISHED));
        // creating the items objects that are published
        $itemsObj = $publisher->getItemHandler()->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat);
        $totalitemsOnPage = count($itemsObj);
        $allcats = $publisher->getCategoryHandler()->getObjects(null, true);
        echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
        echo "<tr>";
        echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . "</strong></td>";
        echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . "</strong></td>";
        echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . "</strong></td>";
        echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . "</strong></td>";
        echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>";
        echo "</tr>";
        if ($totalitems > 0) {
            for ($i = 0; $i < $totalitemsOnPage; ++$i) {
                $categoryObj = $allcats[$itemsObj[$i]->getVar('categoryid')];
                $modify = "<a href='item.php?op=mod&amp;itemid=" . $itemsObj[$i]->getVar('itemid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>";
                $delete = "<a href='item.php?op=del&amp;itemid=" . $itemsObj[$i]->getVar('itemid') . "'><img src='" . \XoopsBaseConfig::get('url') . "/modules/" . $publisher->getModule()->dirname() . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>";
                echo "<tr>";
                echo "<td class='head' align='center'>" . $itemsObj[$i]->getVar('itemid') . "</td>";
                echo "<td class='even' align='left'>" . $categoryObj->getVar('name') . "</td>";
                echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . "</td>";
                echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub('s') . "</td>";
                echo "<td class='even' align='center'> {$modify} {$delete} </td>";
                echo "</tr>";
            }
        } else {
            echo "<tr>";
            echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>";
            echo "</tr>";
        }
        echo "</table>\n";
        echo "<br />\n";
        $parentid = Request::getInt('parentid');
        $pagenav_extra_args = "op=mod&categoryid={$sel_cat}&parentid={$parentid}";
        $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenav_extra_args);
        echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
        echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $sel_cat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'>&nbsp;&nbsp;";
        echo "</div>";
    }
    //end of fx2024 code
}
Example #12
0
            $image = $image_handler->create();
            $image->setVar('image_name', $uploader->getSavedFileName());
            $image->setVar('image_nicename', $image_nicename);
            $image->setVar('image_mimetype', $uploader->getMediaType());
            $image->setVar('image_created', time());
            $image->setVar('image_display', 1);
            $image->setVar('image_weight', 0);
            $image->setVar('imgcat_id', $imgcat_id);
            if ($imgcat->getVar('imgcat_storetype') === 'db') {
                $fp = @fopen($uploader->getSavedDestination(), 'rb');
                $fbinary = @fread($fp, filesize($uploader->getSavedDestination()));
                @fclose($fp);
                $image->setVar('image_body', $fbinary);
                @unlink($uploader->getSavedDestination());
            }
            if (!$image_handler->insert($image)) {
                $error = sprintf(_CO_PUBLISHER_FAILSAVEIMG, $image->getVar('image_nicename'));
            }
        }
    } else {
        $error = sprintf(_CO_PUBLISHER_FAILSAVEIMG, $filename) . "<br>" . implode("<br>", $uploader->getErrors(false));
    }
}
if ($error) {
    $arr = array('error', PublisherUtils::convertCharset($error));
} else {
    $arr = array('success', $image->getVar("image_name"), PublisherUtils::convertCharset($image->getVar("image_nicename")));
}
$echo = json_encode($arr);
echo $echo;
exit;
Example #13
0
function publisher_latest_news_edit($options)
{
    $tabletag1 = '<tr><td style="padding:3px" width="37%">';
    $tabletag2 = '</td><td style="padding:3px">';
    $tabletag3 = '<tr><td style="padding-top:20px;border-bottom:1px solid #000" colspan="2">';
    $tabletag4 = '</td></tr>';
    $form = "<table border='0' cellpadding='0' cellspacing='0'>";
    $form .= $tabletag3 . _MB_PUBLISHER_GENERALCONFIG . $tabletag4;
    // General Options
    $form .= $tabletag1 . _MB_PUBLISHER_FIRST . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[0] . "' size='4'>&nbsp;" . _MB_PUBLISHER_ITEMS . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_DISP . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[1] . "' size='4'>&nbsp;" . _MB_PUBLISHER_ITEMS . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_COLUMNS . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[2] . "' size='4'>&nbsp;" . _MB_PUBLISHER_COLUMN . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_TEXTLENGTH . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[3] . "' size='4'>&nbsp;" . _MB_PUBLISHER_LETTER . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_SELECTEDSTORIES . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[4] . "' size='16'></td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_SCROLL . $tabletag2;
    $form .= publisher_mk_chkbox($options, 5);
    $form .= $tabletag1 . _MB_PUBLISHER_SCROLLHEIGHT . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[6] . "' size='4'></td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_SCROLLSPEED . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[7] . "' size='4'></td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_SCROLLDIR . $tabletag2;
    $form .= "<select size='1' name='options[8]'>";
    $directions = array('right' => _MB_PUBLISHER_SCROLL_RIGHT, 'left' => _MB_PUBLISHER_SCROLL_LEFT, 'up' => _MB_PUBLISHER_SCROLL_UP, 'down' => _MB_PUBLISHER_SCROLL_DOWN);
    foreach ($directions as $key => $value) {
        $form .= "<option value='{$key}'";
        if ($options[8] == $key) {
            $form .= " selected='selected'";
        }
        $form .= ">{$value}</option>";
    }
    $form .= "</select></td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_ORDER . $tabletag2;
    $form .= "<select name='options[9]'>";
    $form .= "<option value='datesub'";
    if ($options[9] == "datesub") {
        $form .= " selected='selected'";
    }
    $form .= ">" . _MB_PUBLISHER_DATE . "</option>";
    $form .= "<option value='counter'";
    if ($options[9] == "counter") {
        $form .= " selected='selected'";
    }
    $form .= ">" . _MB_PUBLISHER_HITS . "</option>";
    $form .= "<option value='weight'";
    if ($options[9] == "weight") {
        $form .= " selected='selected'";
    }
    $form .= ">" . _MB_PUBLISHER_WEIGHT . "</option>";
    $form .= "</select></td></tr>";
    $form .= $tabletag3 . _MB_PUBLISHER_PHOTOSCONFIG . $tabletag4;
    // Photos Options
    $form .= $tabletag1 . _MB_PUBLISHER_IMGDISPLAY . $tabletag2;
    $form .= publisher_mk_chkbox($options, 10);
    $form .= $tabletag1 . _MB_PUBLISHER_IMGWIDTH . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[11] . "' size='4'>&nbsp;" . _MB_PUBLISHER_PIXEL . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_IMGHEIGHT . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[12] . "' size='4'>&nbsp;" . _MB_PUBLISHER_PIXEL . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_BORDER . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[13] . "' size='4'>&nbsp;" . _MB_PUBLISHER_PIXEL . "</td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_BORDERCOLOR . $tabletag2;
    $form .= "<input type='text' name='options[]' value='" . $options[14] . "' size='8'></td></tr>";
    $form .= $tabletag1 . _MB_PUBLISHER_IMGPOSITION . $tabletag2;
    $form .= "<select name='options[]'>";
    $form .= "<option value='LEFT'";
    if ($options[15] == 'LEFT') {
        $form .= " selected='selected'";
    }
    $form .= '>' . XoopsLocale::LEFT . "</option>\n";
    $form .= "<option value='CENTER'";
    if ($options[15] == 'CENTER') {
        $form .= " selected='selected'";
    }
    $form .= '>' . XoopsLocale::CENTER . "</option>\n";
    $form .= "<option value='RIGHT'";
    if ($options[15] == 'RIGHT') {
        $form .= " selected='selected'";
    }
    $form .= '>' . XoopsLocale::RIGHT . '</option>';
    $form .= "</select></td></tr>";
    $form .= $tabletag3 . _MB_PUBLISHER_LINKSCONFIG . $tabletag4;
    // Links Options
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_TOPICLINK . $tabletag2;
    $form .= publisher_mk_chkbox($options, 16);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_ARCHIVELINK . $tabletag2;
    $form .= publisher_mk_chkbox($options, 17);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_SUBMITLINK . $tabletag2;
    $form .= publisher_mk_chkbox($options, 18);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_POSTEDBY . $tabletag2;
    $form .= publisher_mk_chkbox($options, 19);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_POSTTIME . $tabletag2;
    $form .= publisher_mk_chkbox($options, 20);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_TOPICTITLE . $tabletag2;
    $form .= publisher_mk_chkbox($options, 21);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_READ . $tabletag2;
    $form .= publisher_mk_chkbox($options, 22);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_COMMENT . $tabletag2;
    $form .= publisher_mk_chkbox($options, 23);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_PRINT . $tabletag2;
    $form .= publisher_mk_chkbox($options, 24);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_PDF . $tabletag2;
    $form .= publisher_mk_chkbox($options, 25);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_EMAIL . $tabletag2;
    $form .= publisher_mk_chkbox($options, 26);
    $form .= $tabletag1 . _MB_PUBLISHER_DISPLAY_MORELINK . $tabletag2;
    $form .= publisher_mk_chkbox($options, 27);
    $form .= $tabletag3 . _MB_PUBLISHER_TEMPLATESCONFIG . $tabletag4;
    // Templates Options
    $form .= $tabletag1 . _MB_PUBLISHER_TEMPLATE . $tabletag2;
    $form .= "<select size='1' name='options[28]'>";
    $templates = array('normal' => _MB_PUBLISHER_TEMPLATE_NORMAL, 'extended' => _MB_PUBLISHER_TEMPLATE_EXTENDED, 'ticker' => _MB_PUBLISHER_TEMPLATE_TICKER, 'slider1' => _MB_PUBLISHER_TEMPLATE_SLIDER1, 'slider2' => _MB_PUBLISHER_TEMPLATE_SLIDER2);
    foreach ($templates as $key => $value) {
        $form .= "<option value='{$key}'";
        if ($options[28] == $key) {
            $form .= " selected='selected'";
        }
        $form .= ">{$value}</option>";
    }
    $form .= "</select></td></tr>";
    //Select Which Categories To Show
    $form .= $tabletag3 . _MB_PUBLISHER_TOPICSCONFIG . $tabletag4;
    // Topics Options
    $form .= $tabletag1 . _MB_PUBLISHER_TOPICSDISPLAY . $tabletag2;
    $form .= PublisherUtils::createCategorySelect($options[29], 0, true, 'options[29]');
    $form .= '</td></tr>';
    $form .= "</table>";
    return $form;
}
Example #14
0
 /**
  * Get all subcats and put them in an array indexed by parent id
  *
  * @param array $categories
  *
  * @return array
  */
 public function &getSubCats($categories)
 {
     $xoops = Xoops::getInstance();
     $criteria = new CriteriaCompo(new Criteria('parentid', "(" . implode(',', array_keys($categories)) . ")", 'IN'));
     $ret = array();
     if (!PublisherUtils::IsUserAdmin()) {
         $categoriesGranted = $this->publisher->getPermissionHandler()->getGrantedItems('category_read');
         if (count($categoriesGranted) > 0) {
             $criteria->add(new Criteria('categoryid', '(' . implode(',', $categoriesGranted) . ')', 'IN'));
         } else {
             return $ret;
         }
         if ($xoops->isUser()) {
             $criteria->add(new Criteria('moderator', $xoops->user->getVar('uid')), 'OR');
         }
     }
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $subcats = $this->getObjects($criteria, true);
     /* @var $subcat PublisherCategory */
     foreach ($subcats as $subcat) {
         $ret[$subcat->getVar('parentid')][$subcat->getVar('categoryid')] = $subcat;
     }
     return $ret;
 }
Example #15
0
    /**
     * @param PublisherItem $obj
     */
    public function __construct(PublisherItem $obj)
    {
        $xoops = Xoops::getInstance();
        $publisher = Publisher::getInstance();
        $allowed_editors = PublisherUtils::getEditors($publisher->getPermissionHandler()->getGrantedItems('editors'));
        $group = $xoops->getUserGroups();
        parent::__construct('title', 'form', $xoops->getEnv('PHP_SELF'));
        $this->setExtra('enctype="multipart/form-data"');
        $tabtray = new Xoops\Form\TabTray('', 'uniqueid', $xoops->getModuleConfig('jquery_theme', 'system'));
        $mainTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_MAIN, 'maintab');
        // Category
        $category_select = new Xoops\Form\Select(_CO_PUBLISHER_CATEGORY, 'categoryid', $obj->getVar('categoryid', 'e'));
        $category_select->setDescription(_CO_PUBLISHER_CATEGORY_DSC);
        $category_select->addOptionArray($publisher->getCategoryHandler()->getCategoriesForSubmit());
        $mainTab->addElement($category_select);
        // ITEM TITLE
        $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_TITLE, 'title', 50, 255, $obj->getVar('title', 'e')), true);
        // SUBTITLE
        if ($this->_isGranted(_PUBLISHER_SUBTITLE)) {
            $mainTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_SUBTITLE, 'subtitle', 50, 255, $obj->getVar('subtitle', 'e')));
        }
        // SHORT URL
        if ($this->_isGranted(_PUBLISHER_ITEM_SHORT_URL)) {
            $text_short_url = new Xoops\Form\Text(_CO_PUBLISHER_ITEM_SHORT_URL, 'item_short_url', 50, 255, $obj->getVar('short_url', 'e'));
            $text_short_url->setDescription(_CO_PUBLISHER_ITEM_SHORT_URL_DSC);
            $mainTab->addElement($text_short_url);
        }
        // TAGS
        if ($xoops->isActiveModule('tag') && $this->_isGranted(_PUBLISHER_ITEM_TAG)) {
            include_once \XoopsBaseConfig::get('root-path') . '/modules/tag/include/formtag.php';
            $text_tags = new Xoops\Form\Tag('item_tag', 60, 255, $obj->getVar('item_tag', 'e'), 0);
            $mainTab->addElement($text_tags);
        }
        // SELECT EDITOR
        $nohtml = false;
        if (count($allowed_editors) == 1) {
            $editor = $allowed_editors[0];
        } else {
            if (count($allowed_editors) > 0) {
                $editor = @$_POST['editor'];
                if (!empty($editor)) {
                    PublisherUtils::setCookieVar('publisher_editor', $editor);
                } else {
                    $editor = PublisherUtils::getCookieVar('publisher_editor');
                    if (empty($editor) && $xoops->isUser()) {
                        $editor = $xoops->user->getVar('publisher_editor');
                        // Need set through user profile
                    }
                }
                $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $publisher->getConfig('submit_editor') : $editor;
                $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
                $mainTab->addElement($form_editor);
            } else {
                $editor = $publisher->getConfig('submit_editor');
            }
        }
        $editor_configs = array();
        $editor_configs["rows"] = !$publisher->getConfig('submit_editor_rows') ? 35 : $publisher->getConfig('submit_editor_rows');
        $editor_configs["cols"] = !$publisher->getConfig('submit_editor_cols') ? 60 : $publisher->getConfig('submit_editor_cols');
        $editor_configs["width"] = !$publisher->getConfig('submit_editor_width') ? "100%" : $publisher->getConfig('submit_editor_width');
        $editor_configs["height"] = !$publisher->getConfig('submit_editor_height') ? "400px" : $publisher->getConfig('submit_editor_height');
        // SUMMARY
        if ($this->_isGranted(_PUBLISHER_SUMMARY)) {
            // Description
            //$summary_text = new Xoops\Form\TextArea(_CO_PUBLISHER_SUMMARY, 'summary', $obj->getVar('summary', 'e'), 7, 60);
            $editor_configs["name"] = "summary";
            $editor_configs["value"] = $obj->getVar('summary', 'e');
            $summary_text = new Xoops\Form\Editor(_CO_PUBLISHER_SUMMARY, $editor, $editor_configs, $nohtml, $onfailure = null);
            $summary_text->setDescription(_CO_PUBLISHER_SUMMARY_DSC);
            $mainTab->addElement($summary_text);
        }
        // BODY
        $editor_configs["name"] = "body";
        $editor_configs["value"] = $obj->getVar('body', 'e');
        $body_text = new Xoops\Form\Editor(_CO_PUBLISHER_BODY, $editor, $editor_configs, $nohtml, $onfailure = null);
        $body_text->setDescription(_CO_PUBLISHER_BODY_DSC);
        $mainTab->addElement($body_text);
        // VARIOUS OPTIONS
        if ($this->_isGranted(_PUBLISHER_DOHTML) || $this->_isGranted(_PUBLISHER_DOSMILEY) || $this->_isGranted(_PUBLISHER_DOXCODE) || $this->_isGranted(_PUBLISHER_DOIMAGE) || $this->_isGranted(_PUBLISHER_DOLINEBREAK)) {
            if ($this->_isGranted(_PUBLISHER_DOHTML)) {
                $html_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOHTML, 'dohtml', $obj->getVar('dohtml'));
                $mainTab->addElement($html_radio);
            }
            if ($this->_isGranted(_PUBLISHER_DOSMILEY)) {
                $smiley_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOSMILEY, 'dosmiley', $obj->getVar('dosmiley'));
                $mainTab->addElement($smiley_radio);
            }
            if ($this->_isGranted(_PUBLISHER_DOXCODE)) {
                $xcode_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOXCODE, 'doxcode', $obj->getVar('doxcode'));
                $mainTab->addElement($xcode_radio);
            }
            if ($this->_isGranted(_PUBLISHER_DOIMAGE)) {
                $image_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOIMAGE, 'doimage', $obj->getVar('doimage'));
                $mainTab->addElement($image_radio);
            }
            if ($this->_isGranted(_PUBLISHER_DOLINEBREAK)) {
                $linebreak_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_DOLINEBREAK, 'dolinebreak', $obj->getVar('dobr'));
                $mainTab->addElement($linebreak_radio);
            }
        }
        // Available pages to wrap
        if ($this->_isGranted(_PUBLISHER_AVAILABLE_PAGE_WRAP)) {
            $wrap_pages = XoopsLists::getHtmlListAsArray(PublisherUtils::getUploadDir(true, 'content'));
            $available_wrap_pages_text = array();
            foreach ($wrap_pages as $page) {
                $available_wrap_pages_text[] = "<span onclick='publisherPageWrap(\"body\", \"[pagewrap={$page}] \");' onmouseover='style.cursor=\"pointer\"'>{$page}</span>";
            }
            $available_wrap_pages = new Xoops\Form\Label(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP, implode(', ', $available_wrap_pages_text));
            $available_wrap_pages->setDescription(_CO_PUBLISHER_AVAILABLE_PAGE_WRAP_DSC);
            $mainTab->addElement($available_wrap_pages);
        }
        // Uid
        /*  We need to retrieve the users manually because for some reason, on the frxoops.org server,
            the method users::getobjects encounters a memory error
            */
        // Trabis : well, maybe is because you are getting 6000 objects into memory , no??? LOL
        if ($this->_isGranted(_PUBLISHER_UID)) {
            $uid_select = new Xoops\Form\SelectUser(_CO_PUBLISHER_UID, 'uid', true, array($obj->getVar('uid', 'e')), 1, false);
            $uid_select->setDescription(_CO_PUBLISHER_UID_DSC);
            //$sql = "SELECT uid, uname FROM " . $obj->db->prefix('users') . " ORDER BY uname ASC";
            //$result = $obj->db->query($sql);
            //$users_array = array();
            //$users_array[0] = $xoops->getConfig('anonymous');
            //while ($myrow = $obj->db->fetchArray($result)) {
            //    $users_array[$myrow['uid']] = $myrow['uname'];
            //}
            //$uid_select->addOptionArray($users_array);
            $mainTab->addElement($uid_select);
        }
        /* else {
           $hidden = new Xoops\Form\Hidden('uid', $obj->getVar('uid'));
           $this->addElement($hidden);
           unset($hidden);
           }*/
        // Author Alias
        if ($this->_isGranted(_PUBLISHER_AUTHOR_ALIAS)) {
            $element = new Xoops\Form\Text(_CO_PUBLISHER_AUTHOR_ALIAS, 'author_alias', 50, 255, $obj->getVar('author_alias', 'e'));
            $element->setDescription(_CO_PUBLISHER_AUTHOR_ALIAS_DSC);
            $mainTab->addElement($element);
            unset($element);
        }
        // STATUS
        if ($this->_isGranted(_PUBLISHER_STATUS)) {
            $options = array(_PUBLISHER_STATUS_PUBLISHED => _CO_PUBLISHER_PUBLISHED, _PUBLISHER_STATUS_OFFLINE => _CO_PUBLISHER_OFFLINE, _PUBLISHER_STATUS_SUBMITTED => _CO_PUBLISHER_SUBMITTED, _PUBLISHER_STATUS_REJECTED => _CO_PUBLISHER_REJECTED);
            $status_select = new Xoops\Form\Select(_CO_PUBLISHER_STATUS, 'status', $obj->getVar('status'));
            $status_select->addOptionArray($options);
            $status_select->setDescription(_CO_PUBLISHER_STATUS_DSC);
            $mainTab->addElement($status_select);
            unset($status_select);
        }
        // Datesub
        if ($this->_isGranted(_PUBLISHER_DATESUB)) {
            $datesub = $obj->getVar('datesub') == 0 ? time() : $obj->getVar('datesub');
            $datesub_datetime = new PublisherFormDateTime(_CO_PUBLISHER_DATESUB, 'datesub', $size = 15, $datesub);
            $datesub_datetime->setDescription(_CO_PUBLISHER_DATESUB_DSC);
            $mainTab->addElement($datesub_datetime);
        }
        // NOTIFY ON PUBLISH
        if ($this->_isGranted(_PUBLISHER_NOTIFY)) {
            $notify_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_NOTIFY, 'notify', $obj->getVar('notifypub'));
            $mainTab->addElement($notify_radio);
        }
        $tabtray->addElement($mainTab);
        if ($xoops->isActiveModule('images') && $this->_hasTab(_CO_PUBLISHER_TAB_IMAGES)) {
            $imagesTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_IMAGES, 'imagestab');
            // IMAGE
            if ($this->_isGranted(_PUBLISHER_IMAGE_ITEM)) {
                $imgcat_handler = Images::getInstance()->getHandlerCategories();
                $image_handler = Images::getInstance()->getHandlerImages();
                $objimages = $obj->getImages();
                $mainarray = is_object($objimages['main']) ? array($objimages['main']) : array();
                $mergedimages = array_merge($mainarray, $objimages['others']);
                $objimage_array = array();
                /* @var $imageObj ImagesImage */
                foreach ($mergedimages as $imageObj) {
                    $objimage_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
                }
                $catlist = $imgcat_handler->getListByPermission($group, 'imgcat_read', 1);
                $catids = array_keys($catlist);
                $imageObjs = array();
                if (!empty($catids)) {
                    $criteria = new CriteriaCompo(new Criteria('imgcat_id', '(' . implode(',', $catids) . ')', 'IN'));
                    $criteria->add(new Criteria('image_display', 1));
                    $criteria->setSort('image_nicename');
                    $criteria->setOrder('ASC');
                    $imageObjs = $image_handler->getObjects($criteria, true);
                    unset($criteria);
                }
                $image_array = array();
                foreach ($imageObjs as $imageObj) {
                    $image_array[$imageObj->getVar('image_name')] = $imageObj->getVar('image_nicename');
                }
                $image_array = array_diff($image_array, $objimage_array);
                $image_select = new Xoops\Form\Select('', 'image_notused', '', 5);
                $image_select->addOptionArray($image_array);
                $image_select->setExtra("onchange='showImgSelected(\"image_display\", \"image_notused\", \"uploads/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
                //$image_select->setExtra( "onchange='appendMySelectOption(\"image_notused\", \"image_item\")'");
                unset($image_array);
                $image_select2 = new Xoops\Form\Select('', 'image_item', '', 5, true);
                $image_select2->addOptionArray($objimage_array);
                $image_select2->setExtra("onchange='publisher_updateSelectOption(\"image_item\", \"image_featured\"), showImgSelected(\"image_display\", \"image_item\", \"uploads/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
                $buttonadd = new Xoops\Form\Button('', 'buttonadd', _CO_PUBLISHER_ADD);
                $buttonadd->setExtra("onclick='publisher_appendSelectOption(\"image_notused\", \"image_item\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
                $buttonremove = new Xoops\Form\Button('', 'buttonremove', _CO_PUBLISHER_REMOVE);
                $buttonremove->setExtra("onclick='publisher_appendSelectOption(\"image_item\", \"image_notused\"), publisher_updateSelectOption(\"image_item\", \"image_featured\")'");
                $opentable = new Xoops\Form\Label('', "<table><tr><td>");
                $addcol = new Xoops\Form\Label('', "</td><td>");
                $addbreak = new Xoops\Form\Label('', "<br />");
                $closetable = new Xoops\Form\Label('', "</td></tr></table>");
                $xoops->theme()->addScript(PUBLISHER_URL . '/js/ajaxupload.3.9.js');
                //todo, find replacement for error class
                $js_data = new Xoops\Form\Label('', '
<script type= "text/javascript">/*<![CDATA[*/
$(document).ready(function(){
    var button = $("#publisher_upload_button"), interval;
    new AjaxUpload(button,{
        action: "' . PUBLISHER_URL . '/include/ajax_upload.php", // I disabled uploads in this example for security reasons
        responseType: "text/html",
        name: "publisher_upload_file",
        onSubmit : function(file, ext){
            // change button text, when user selects file
            $("#publisher_upload_message").html(" ");
            button.html("<img src=\'' . PUBLISHER_URL . '/images/loadingbar.gif\'/>"); this.setData({
                "image_nicename": $("#image_nicename").val(),
                "imgcat_id" : $("#imgcat_id").val()
            });
            // If you want to allow uploading only 1 file at time,
            // you can disable upload button
            this.disable();
            interval = window.setInterval(function(){
            }, 200);
        },
        onComplete: function(file, response){
            button.text("' . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . '");
            window.clearInterval(interval);
            // enable upload button
            this.enable();
            // add file to the list
            var result = eval(response);
            if (result[0] == "success") {
                 $("#image_item").append("<option value=\'" + result[1] + "\' selected=\'selected\'>" + result[2] + "</option>");
                 publisher_updateSelectOption(\'image_item\', \'image_featured\');
                 showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . \XoopsBaseConfig::get('url') . '\')
            } else {
                 $("#publisher_upload_message").html("<div class=\'errorMsg\'>" + result[1] + "</div>");
            }
        }
    });
});
/*]]>*/</script>
');
                $messages = new Xoops\Form\Label('', "<div id='publisher_upload_message'></div>");
                $button = new Xoops\Form\Label('', "<div id='publisher_upload_button'>" . _CO_PUBLISHER_IMAGE_UPLOAD_NEW . "</div>");
                $nicename = new Xoops\Form\Text('', 'image_nicename', 30, 30, _CO_PUBLISHER_IMAGE_NICENAME);
                $catlist = $imgcat_handler->getListByPermission($group, 'imgcat_read', 1);
                $imagecat = new Xoops\Form\Select('', 'imgcat_id', '', 1);
                $imagecat->addOptionArray($catlist);
                $image_upload_tray = new Xoops\Form\ElementTray(_CO_PUBLISHER_IMAGE_UPLOAD, '');
                $image_upload_tray->addElement($js_data);
                $image_upload_tray->addElement($messages);
                $image_upload_tray->addElement($opentable);
                $image_upload_tray->addElement($imagecat);
                $image_upload_tray->addElement($addbreak);
                $image_upload_tray->addElement($nicename);
                $image_upload_tray->addElement($addbreak);
                $image_upload_tray->addElement($button);
                $image_upload_tray->addElement($closetable);
                $imagesTab->addElement($image_upload_tray);
                $image_tray = new Xoops\Form\ElementTray(_CO_PUBLISHER_IMAGE_ITEMS, '');
                $image_tray->addElement($opentable);
                $image_tray->addElement($image_select);
                $image_tray->addElement($addbreak);
                $image_tray->addElement($buttonadd);
                $image_tray->addElement($addcol);
                $image_tray->addElement($image_select2);
                $image_tray->addElement($addbreak);
                $image_tray->addElement($buttonremove);
                $image_tray->addElement($closetable);
                $image_tray->setDescription(_CO_PUBLISHER_IMAGE_ITEMS_DSC);
                $imagesTab->addElement($image_tray);
                $imagename = is_object($objimages['main']) ? $objimages['main']->getVar('image_name') : '';
                $imageforpath = $imagename != '' ? $imagename : 'blank.gif';
                $image_select3 = new Xoops\Form\Select(_CO_PUBLISHER_IMAGE_ITEM, 'image_featured', $imagename, 1);
                $image_select3->addOptionArray($objimage_array);
                $image_select3->setExtra("onchange='showImgSelected(\"image_display\", \"image_featured\", \"uploads/\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
                $image_select3->setDescription(_CO_PUBLISHER_IMAGE_ITEM_DSC);
                $imagesTab->addElement($image_select3);
                $image_preview = new Xoops\Form\Label(_CO_PUBLISHER_IMAGE_PREVIEW, "<img width='500' src='" . \XoopsBaseConfig::get('url') . "/uploads/" . $imageforpath . "' name='image_display' id='image_display' alt='' />");
                $imagesTab->addElement($image_preview);
            }
            $tabtray->addElement($imagesTab);
        }
        if ($this->_hasTab(_CO_PUBLISHER_TAB_FILES)) {
            $filesTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_FILES, 'filestab');
            // File upload UPLOAD
            if ($this->_isGranted(_PUBLISHER_ITEM_UPLOAD_FILE)) {
                // NAME
                $name_text = new Xoops\Form\Text(_CO_PUBLISHER_FILENAME, 'item_file_name', 50, 255, '');
                $name_text->setDescription(_CO_PUBLISHER_FILE_NAME_DSC);
                $filesTab->addElement($name_text);
                unset($name_text);
                // DESCRIPTION
                $description_text = new Xoops\Form\TextArea(_CO_PUBLISHER_FILE_DESCRIPTION, 'item_file_description', '');
                $description_text->setDescription(_CO_PUBLISHER_FILE_DESCRIPTION_DSC);
                $filesTab->addElement($description_text);
                unset($description_text);
                $status_select = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_FILE_STATUS, 'item_file_status', 1);
                //1 - active
                $status_select->setDescription(_CO_PUBLISHER_FILE_STATUS_DSC);
                $filesTab->addElement($status_select);
                unset($status_select);
                $file_box = new Xoops\Form\File(_CO_PUBLISHER_ITEM_UPLOAD_FILE, "item_upload_file");
                $file_box->setDescription(_CO_PUBLISHER_ITEM_UPLOAD_FILE_DSC);
                $file_box->setExtra("size ='50'");
                $filesTab->addElement($file_box);
                unset($file_box);
                if (!$obj->isNew()) {
                    $filesObj = $publisher->getFileHandler()->getAllFiles($obj->getVar('itemid'));
                    if (count($filesObj) > 0) {
                        $table = '';
                        $table .= "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>";
                        $table .= "<tr>";
                        $table .= "<td width='50' class='bg3' align='center'><strong>ID</strong></td>";
                        $table .= "<td width='150' class='bg3' align='left'><strong>" . _AM_PUBLISHER_FILENAME . "</strong></td>";
                        $table .= "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_DESCRIPTION . "</strong></td>";
                        $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_HITS . "</strong></td>";
                        $table .= "<td width='100' class='bg3' align='center'><strong>" . _AM_PUBLISHER_UPLOADED_DATE . "</strong></td>";
                        $table .= "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>";
                        $table .= "</tr>";
                        /* @var $fileObj PublisherFile */
                        foreach ($filesObj as $fileObj) {
                            $modify = "<a href='file.php?op=mod&fileid=" . $fileObj->getVar('fileid') . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _CO_PUBLISHER_EDITFILE . "' alt='" . _CO_PUBLISHER_EDITFILE . "' /></a>";
                            $delete = "<a href='file.php?op=del&fileid=" . $fileObj->getVar('fileid') . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _CO_PUBLISHER_DELETEFILE . "' alt='" . _CO_PUBLISHER_DELETEFILE . "'/></a>";
                            if ($fileObj->getVar('status') == 0) {
                                $not_visible = "<img src='" . PUBLISHER_URL . "/images/no.gif'/>";
                            } else {
                                $not_visible = '';
                            }
                            $table .= "<tr>";
                            $table .= "<td class='head' align='center'>" . $fileObj->getVar('fileid') . "</td>";
                            $table .= "<td class='odd' align='left'>" . $not_visible . $fileObj->getFileLink() . "</td>";
                            $table .= "<td class='even' align='left'>" . $fileObj->getVar('description') . "</td>";
                            $table .= "<td class='even' align='center'>" . $fileObj->getVar('counter') . "";
                            $table .= "<td class='even' align='center'>" . $fileObj->datesub() . "</td>";
                            $table .= "<td class='even' align='center'> {$modify} {$delete} </td>";
                            $table .= "</tr>";
                        }
                        $table .= "</table>";
                        $files_box = new Xoops\Form\Label(_CO_PUBLISHER_FILES_LINKED, $table);
                        $filesTab->addElement($files_box);
                        unset($files_box, $filesObj, $fileObj);
                    }
                }
            }
            $tabtray->addElement($filesTab);
        }
        if ($this->_hasTab(_CO_PUBLISHER_TAB_OTHERS)) {
            $othersTab = new Xoops\Form\Tab(_CO_PUBLISHER_TAB_OTHERS, 'otherstab');
            // Meta Keywords
            if ($this->_isGranted(_PUBLISHER_ITEM_META_KEYWORDS)) {
                $text_meta_keywords = new Xoops\Form\TextArea(_CO_PUBLISHER_ITEM_META_KEYWORDS, 'item_meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60);
                $text_meta_keywords->setDescription(_CO_PUBLISHER_ITEM_META_KEYWORDS_DSC);
                $othersTab->addElement($text_meta_keywords);
            }
            // Meta Description
            if ($this->_isGranted(_PUBLISHER_ITEM_META_DESCRIPTION)) {
                $text_meta_description = new Xoops\Form\TextArea(_CO_PUBLISHER_ITEM_META_DESCRIPTION, 'item_meta_description', $obj->getVar('meta_description', 'e'), 7, 60);
                $text_meta_description->setDescription(_CO_PUBLISHER_ITEM_META_DESCRIPTION_DSC);
                $othersTab->addElement($text_meta_description);
            }
            // COMMENTS
            if ($this->_isGranted(_PUBLISHER_ALLOWCOMMENTS)) {
                $addcomments_radio = new Xoops\Form\RadioYesNo(_CO_PUBLISHER_ALLOWCOMMENTS, 'allowcomments', $obj->getVar('cancomment'));
                $othersTab->addElement($addcomments_radio);
            }
            // WEIGHT
            if ($this->_isGranted(_PUBLISHER_WEIGHT)) {
                $othersTab->addElement(new Xoops\Form\Text(_CO_PUBLISHER_WEIGHT, 'weight', 5, 5, $obj->getVar('weight')));
            }
            $tabtray->addElement($othersTab);
        }
        $this->addElement($tabtray);
        //COMMON TO ALL TABS
        $button_tray = new Xoops\Form\ElementTray('', '');
        if (!$obj->isNew()) {
            $button_tray->addElement(new Xoops\Form\Button('', 'additem', XoopsLocale::A_SUBMIT, 'submit'));
            //orclone
        } else {
            $button_tray->addElement(new Xoops\Form\Button('', 'additem', _CO_PUBLISHER_CREATE, 'submit'));
            $button_tray->addElement(new Xoops\Form\Button('', '', _CO_PUBLISHER_CLEAR, 'reset'));
        }
        $button_tray->addElement(new Xoops\Form\Button('', 'preview', _CO_PUBLISHER_PREVIEW, 'submit'));
        $butt_cancel = new Xoops\Form\Button('', '', _CO_PUBLISHER_CANCEL, 'button');
        $butt_cancel->setExtra('onclick="history.go(-1)"');
        $button_tray->addElement($butt_cancel);
        $this->addElement($button_tray);
        $hidden = new Xoops\Form\Hidden('itemid', $obj->getVar('itemid'));
        $this->addElement($hidden);
        unset($hidden);
    }
Example #16
0
// Form permissions
echo "<br />\n";
PublisherUtils::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC);
$form_options = array(_PUBLISHER_SUMMARY => _AM_PUBLISHER_SUMMARY, _PUBLISHER_AVAILABLE_PAGE_WRAP => _CO_PUBLISHER_AVAILABLE_PAGE_WRAP, _PUBLISHER_ITEM_TAG => _AM_PUBLISHER_ITEM_TAG, _PUBLISHER_IMAGE_ITEM => _AM_PUBLISHER_IMAGE_ITEM, _PUBLISHER_ITEM_UPLOAD_FILE => _CO_PUBLISHER_ITEM_UPLOAD_FILE, _PUBLISHER_UID => _CO_PUBLISHER_UID, _PUBLISHER_DATESUB => _CO_PUBLISHER_DATESUB, _PUBLISHER_STATUS => _CO_PUBLISHER_STATUS, _PUBLISHER_ITEM_SHORT_URL => _CO_PUBLISHER_ITEM_SHORT_URL, _PUBLISHER_ITEM_META_KEYWORDS => _CO_PUBLISHER_ITEM_META_KEYWORDS, _PUBLISHER_ITEM_META_DESCRIPTION => _CO_PUBLISHER_ITEM_META_DESCRIPTION, _PUBLISHER_WEIGHT => _CO_PUBLISHER_WEIGHT, _PUBLISHER_ALLOWCOMMENTS => _CO_PUBLISHER_ALLOWCOMMENTS, _PUBLISHER_DOHTML => _CO_PUBLISHER_DOHTML, _PUBLISHER_DOSMILEY => _CO_PUBLISHER_DOSMILEY, _PUBLISHER_DOXCODE => _CO_PUBLISHER_DOXCODE, _PUBLISHER_DOIMAGE => _CO_PUBLISHER_DOIMAGE, _PUBLISHER_DOLINEBREAK => _CO_PUBLISHER_DOLINEBREAK, _PUBLISHER_NOTIFY => _AM_PUBLISHER_NOTIFY, _PUBLISHER_SUBTITLE => _CO_PUBLISHER_SUBTITLE, _PUBLISHER_AUTHOR_ALIAS => _CO_PUBLISHER_AUTHOR_ALIAS);
$form_submit = new Xoops\Form\GroupPermissionForm("", $publisher->getModule()->mid(), "form_view", "", 'admin/permissions.php');
foreach ($form_options as $key => $value) {
    $form_submit->addItem($key, $value);
}
echo $form_submit->render();
PublisherUtils::closeCollapsableBar('permissionstable_form', 'permissionsicon_form');
// Editors permissions
echo "<br />\n";
PublisherUtils::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC);
$editors = PublisherUtils::getEditors();
$form_submit = new Xoops\Form\GroupPermissionForm("", $publisher->getModule()->mid(), "editors", "", 'admin/permissions.php');
foreach ($editors as $key => $value) {
    $form_submit->addItem($key, $value['title']);
}
echo $form_submit->render();
PublisherUtils::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors');
// Global permissions
echo "<br />\n";
PublisherUtils::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC);
$form_options = array(_PUBLISHER_SEARCH => _AM_PUBLISHER_SEARCH, _PUBLISHER_RATE => _AM_PUBLISHER_RATE);
$form_submit = new Xoops\Form\GroupPermissionForm("", $publisher->getModule()->mid(), "global", "", 'admin/permissions.php');
foreach ($form_options as $key => $value) {
    $form_submit->addItem($key, $value);
}
echo $form_submit->render();
PublisherUtils::closeCollapsableBar('permissionstable_global', 'permissionsicon_global');
$xoops->footer();
Example #17
0
 /**
  * @param array  $queryarray
  * @param string $andor
  * @param int    $limit
  * @param int    $offset
  * @param int    $userid
  * @param array  $categories
  * @param int    $sortby
  * @param string $searchin
  * @param string $extra
  *
  * @return array
  */
 public function getItemsFromSearch($queryarray = array(), $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = array(), $sortby = 0, $searchin = "", $extra = "")
 {
     $xoops = Xoops::getInstance();
     $ret = array();
     $gperm_handler = $xoops->getHandlerGroupPermission();
     $groups = $xoops->getUserGroups();
     $searchin = empty($searchin) ? array("title", "body", "summary") : (is_array($searchin) ? $searchin : array($searchin));
     if (in_array("all", $searchin) || count($searchin) == 0) {
         $searchin = array("title", "subtitle", "body", "summary", "meta_keywords");
     }
     if (is_array($userid) && count($userid) > 0) {
         $userid = array_map("intval", $userid);
         $criteriaUser = new CriteriaCompo();
         $criteriaUser->add(new Criteria('uid', '(' . implode(',', $userid) . ')', 'IN'), 'OR');
     } elseif (is_numeric($userid) && $userid > 0) {
         $criteriaUser = new CriteriaCompo();
         $criteriaUser->add(new Criteria('uid', $userid), 'OR');
     }
     $count = count($queryarray);
     if (is_array($queryarray) && $count > 0) {
         $criteriaKeywords = new CriteriaCompo();
         for ($i = 0; $i < count($queryarray); ++$i) {
             $criteriaKeyword = new CriteriaCompo();
             if (in_array('title', $searchin)) {
                 $criteriaKeyword->add(new Criteria('title', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
             }
             if (in_array('subtitle', $searchin)) {
                 $criteriaKeyword->add(new Criteria('subtitle', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
             }
             if (in_array('body', $searchin)) {
                 $criteriaKeyword->add(new Criteria('body', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
             }
             if (in_array('summary', $searchin)) {
                 $criteriaKeyword->add(new Criteria('summary', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
             }
             if (in_array('meta_keywords', $searchin)) {
                 $criteriaKeyword->add(new Criteria('meta_keywords', '%' . $queryarray[$i] . '%', 'LIKE'), 'OR');
             }
             $criteriaKeywords->add($criteriaKeyword, $andor);
             unset($criteriaKeyword);
         }
     }
     if (!PublisherUtils::IsUserAdmin() && count($categories) > 0) {
         $criteriaPermissions = new CriteriaCompo();
         // Categories for which user has access
         $categoriesGranted = $gperm_handler->getItemIds('category_read', $groups, $this->publisher->getModule()->getVar('mid'));
         if (count($categories) > 0) {
             $categoriesGranted = array_intersect($categoriesGranted, $categories);
         }
         if (count($categoriesGranted) == 0) {
             return $ret;
         }
         $grantedCategories = new Criteria('categoryid', "(" . implode(',', $categoriesGranted) . ")", 'IN');
         $criteriaPermissions->add($grantedCategories, 'AND');
     } elseif (count($categories) > 0) {
         $criteriaPermissions = new CriteriaCompo();
         $grantedCategories = new Criteria('categoryid', "(" . implode(',', $categories) . ")", 'IN');
         $criteriaPermissions->add($grantedCategories, 'AND');
     }
     $criteriaItemsStatus = new CriteriaCompo();
     $criteriaItemsStatus->add(new Criteria('status', _PUBLISHER_STATUS_PUBLISHED));
     $criteria = new CriteriaCompo();
     if (!empty($criteriaUser)) {
         $criteria->add($criteriaUser, 'AND');
     }
     if (!empty($criteriaKeywords)) {
         $criteria->add($criteriaKeywords, 'AND');
     }
     if (!empty($criteriaPermissions)) {
         $criteria->add($criteriaPermissions);
     }
     if (!empty($criteriaItemsStatus)) {
         $criteria->add($criteriaItemsStatus, 'AND');
     }
     $criteria->setLimit($limit);
     $criteria->setStart($offset);
     if (empty($sortby)) {
         $sortby = "datesub";
     }
     $criteria->setSort($sortby);
     $order = 'ASC';
     if ($sortby === "datesub") {
         $order = 'DESC';
     }
     $criteria->setOrder($order);
     $ret = $this->getItemObjects($criteria);
     return $ret;
 }
Example #18
0
<?php

/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
/**
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Publisher
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 * @version         $Id$
 */
include_once __DIR__ . '/admin_header.php';
$xoops = Xoops::getInstance();
if (isset($_POST["op"]) && $_POST["op"] == "delfileok") {
    $dir = PublisherUtils::getUploadDir(true, 'content');
    @unlink($dir . '/' . $_POST["address"]);
    $xoops->redirect($_POST['backto'], 2, _AM_PUBLISHER_FDELETED);
} else {
    $xoops->header();
    echo $xoops->confirm(array('backto' => $_POST['backto'], 'address' => $_POST["address"], 'op' => 'delfileok'), 'pw_delete_file.php', _AM_PUBLISHER_RUSUREDELF, XoopsLocale::YES);
    $xoops->footer();
}
Example #19
0
 * @copyright       The XUUPS Project http://sourceforge.net/projects/xuups/
 * @license         GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
 * @package         Publisher
 * @subpackage      Utils
 * @since           1.0
 * @author          trabis <*****@*****.**>
 * @author          The SmartFactory <www.smartfactory.ca>
 */
include_once __DIR__ . '/include/common.php';
$publisher = Publisher::getInstance();
$xoops = Xoops::getInstance();
$xoops->theme()->addStylesheet(PUBLISHER_URL . '/css/publisher.css');
$xoopsTpl = $xoops->tpl();
$xoopsTpl->assign("xoops_module_header", '<link rel="alternate" type="application/rss+xml" title="' . $publisher->getModule()->getVar('name') . '" href="' . $publisher->url('backend.php') . '" />' . @$xoopsTpl->getTemplateVars("xoops_module_header"));
$xoopsTpl->assign("publisher_adminpage", "<a href='" . $publisher->url("admin/index.php") . "'>" . _MD_PUBLISHER_ADMIN_PAGE . "</a>");
$xoopsTpl->assign("isAdmin", PublisherUtils::IsUserAdmin());
$xoopsTpl->assign('publisher_url', $publisher->url());
$xoopsTpl->assign('publisher_images_url', $publisher->url('images'));
$xoopsTpl->assign('displayType', $publisher->getConfig('idxcat_items_display_type'));
// display_category_summary enabled by Freeform Solutions March 21 2006
$xoopsTpl->assign('display_category_summary', $publisher->getConfig('cat_display_summary'));
$xoopsTpl->assign('displayList', $publisher->getConfig('idxcat_items_display_type') == 'list');
$xoopsTpl->assign('displayFull', $publisher->getConfig('idxcat_items_display_type') == 'full');
$xoopsTpl->assign('modulename', $publisher->getModule()->dirname());
$xoopsTpl->assign('displaylastitem', $publisher->getConfig('idxcat_display_last_item'));
$xoopsTpl->assign('displaysubcatdsc', $publisher->getConfig('idxcat_display_subcat_dsc'));
$xoopsTpl->assign('publisher_display_breadcrumb', $publisher->getConfig('display_breadcrumb'));
$xoopsTpl->assign('collapsable_heading', $publisher->getConfig('idxcat_collaps_heading'));
$xoopsTpl->assign('display_comment_link', $publisher->getConfig('item_disp_comment_link'));
$xoopsTpl->assign('display_whowhen_link', $publisher->getConfig('item_disp_whowhen_link'));
$xoopsTpl->assign('displayarticlescount', $publisher->getConfig('idxcat_display_art_count'));
Example #20
0
 /**
  * @param PublisherCategory $obj
  */
 public function __construct(PublisherCategory $obj)
 {
     $xoops = Xoops::getInstance();
     $publisher = Publisher::getInstance();
     $member_handler = $xoops->getHandlerMember();
     $userGroups = $member_handler->getGroupList();
     parent::__construct(_AM_PUBLISHER_CATEGORY, "form", $xoops->getEnv('PHP_SELF'));
     $this->setExtra('enctype="multipart/form-data"');
     // Category
     $criteria = new Criteria(null);
     $criteria->setSort('weight');
     $criteria->setOrder('ASC');
     $categories = $publisher->getCategoryHandler()->getObjects($criteria);
     $mytree = new XoopsObjectTree($categories, "categoryid", "parentid");
     $cat_select = $mytree->makeSelBox('parentid', 'name', '--', $obj->getVar('parentid'), true);
     $this->addElement(new Xoops\Form\Label(_AM_PUBLISHER_PARENT_CATEGORY_EXP, $cat_select));
     // Name
     $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY, 'name', 50, 255, $obj->getVar('name', 'e')), true);
     // Description
     $this->addElement(new Xoops\Form\TextArea(_AM_PUBLISHER_COLDESCRIPT, 'description', $obj->getVar('description', 'e'), 7, 60));
     // EDITOR
     $groups = $xoops->getUserGroups();
     $gperm_handler = $publisher->getGrouppermHandler();
     $module_id = $publisher->getModule()->mid();
     $allowed_editors = PublisherUtils::getEditors($gperm_handler->getItemIds('editors', $groups, $module_id));
     $nohtml = false;
     if (count($allowed_editors) > 0) {
         $editor = @$_POST['editor'];
         if (!empty($editor)) {
             PublisherUtils::setCookieVar('publisher_editor', $editor);
         } else {
             $editor = PublisherUtils::getCookieVar('publisher_editor');
             if (empty($editor) && $xoops->isUser()) {
                 $editor = $xoops->user->getVar('publisher_editor');
                 // Need set through user profile
             }
         }
         $editor = empty($editor) || !in_array($editor, $allowed_editors) ? $publisher->getConfig('submit_editor') : $editor;
         $form_editor = new Xoops\Form\SelectEditor($this, 'editor', $editor, $nohtml, $allowed_editors);
         $this->addElement($form_editor);
     } else {
         $editor = $publisher->getConfig('submit_editor');
     }
     $editor_configs = array();
     $editor_configs['rows'] = $publisher->getConfig('submit_editor_rows') == '' ? 35 : $publisher->getConfig('submit_editor_rows');
     $editor_configs['cols'] = $publisher->getConfig('submit_editor_cols') == '' ? 60 : $publisher->getConfig('submit_editor_cols');
     $editor_configs['width'] = $publisher->getConfig('submit_editor_width') == '' ? "100%" : $publisher->getConfig('submit_editor_width');
     $editor_configs['height'] = $publisher->getConfig('submit_editor_height') == '' ? "400px" : $publisher->getConfig('submit_editor_height');
     $editor_configs['name'] = 'header';
     $editor_configs['value'] = $obj->getVar('header', 'e');
     $text_header = new Xoops\Form\Editor(_AM_PUBLISHER_CATEGORY_HEADER, $editor, $editor_configs, $nohtml, $onfailure = null);
     $text_header->setDescription(_AM_PUBLISHER_CATEGORY_HEADER_DSC);
     $this->addElement($text_header);
     // IMAGE
     $image_array = XoopsLists::getImgListAsArray(PublisherUtils::getImageDir('category'));
     $image_select = new Xoops\Form\Select('', 'image', $obj->image());
     //$image_select -> addOption ('-1', '---------------');
     $image_select->addOptionArray($image_array);
     $image_select->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . "\", \"\", \"" . \XoopsBaseConfig::get('url') . "\")'");
     $image_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMAGE, '&nbsp;');
     $image_tray->addElement($image_select);
     $image_tray->addElement(new Xoops\Form\Label('', "<br /><br /><img src='" . PublisherUtils::getImageDir('category', false) . $obj->image() . "' name='image3' id='image3' alt='' />"));
     $image_tray->setDescription(_AM_PUBLISHER_IMAGE_DSC);
     $this->addElement($image_tray);
     // IMAGE UPLOAD
     //$max_size = 5000000;
     $file_box = new Xoops\Form\File(_AM_PUBLISHER_IMAGE_UPLOAD, "image_file");
     $file_box->setExtra("size ='45'");
     $file_box->setDescription(_AM_PUBLISHER_IMAGE_UPLOAD_DSC);
     $this->addElement($file_box);
     // Short url
     $text_short_url = new Xoops\Form\Text(_AM_PUBLISHER_CATEGORY_SHORT_URL, 'short_url', 50, 255, $obj->getVar('short_url', 'e'));
     $text_short_url->setDescription(_AM_PUBLISHER_CATEGORY_SHORT_URL_DSC);
     $this->addElement($text_short_url);
     // Meta Keywords
     $text_meta_keywords = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_KEYWORDS, 'meta_keywords', $obj->getVar('meta_keywords', 'e'), 7, 60);
     $text_meta_keywords->setDescription(_AM_PUBLISHER_CATEGORY_META_KEYWORDS_DSC);
     $this->addElement($text_meta_keywords);
     // Meta Description
     $text_meta_description = new Xoops\Form\TextArea(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION, 'meta_description', $obj->getVar('meta_description', 'e'), 7, 60);
     $text_meta_description->setDescription(_AM_PUBLISHER_CATEGORY_META_DESCRIPTION_DSC);
     $this->addElement($text_meta_description);
     // Weight
     $this->addElement(new Xoops\Form\Text(_AM_PUBLISHER_COLPOSIT, 'weight', 4, 4, $obj->getVar('weight')));
     // Added by skalpa: custom template support
     //todo, check this
     $this->addElement(new Xoops\Form\Text("Custom template", 'template', 50, 255, $obj->getVar('template', 'e')), false);
     // READ PERMISSIONS
     $groups_read_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_READ, 'groups_read[]', $obj->getGroups_read());
     foreach ($userGroups as $group_id => $group_name) {
         $groups_read_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_read_checkbox);
     // SUBMIT PERMISSIONS
     $groups_submit_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, 'groups_submit[]', $obj->getGroups_submit());
     $groups_submit_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC);
     foreach ($userGroups as $group_id => $group_name) {
         $groups_submit_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_submit_checkbox);
     // MODERATION PERMISSIONS
     $groups_moderation_checkbox = new Xoops\Form\Checkbox(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, 'groups_moderation[]', $obj->getGroups_moderation());
     $groups_moderation_checkbox->setDescription(_AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC);
     foreach ($userGroups as $group_id => $group_name) {
         $groups_moderation_checkbox->addOption($group_id, $group_name);
     }
     $this->addElement($groups_moderation_checkbox);
     $moderator = new Xoops\Form\SelectUser(_AM_PUBLISHER_CATEGORY_MODERATOR, 'moderator', true, $obj->getVar('moderator', 'e'), 1, false);
     $moderator->setDescription(_AM_PUBLISHER_CATEGORY_MODERATOR_DSC);
     $this->addElement($moderator);
     $cat_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_SCATEGORYNAME, '<br /><br />');
     for ($i = 0; $i < $this->_subCatsCount; ++$i) {
         if ($i < (isset($_POST['scname']) ? sizeof($_POST['scname']) : 0)) {
             $subname = isset($_POST['scname']) ? $_POST['scname'][$i] : '';
         } else {
             $subname = '';
         }
         $cat_tray->addElement(new Xoops\Form\Text('', 'scname[' . $i . ']', 50, 255, $subname));
     }
     $t = new Xoops\Form\Text('', 'nb_subcats', 3, 2);
     $l = new Xoops\Form\Label('', sprintf(_AM_PUBLISHER_ADD_OPT, $t->render()));
     $b = new Xoops\Form\Button('', 'submit_subcats', _AM_PUBLISHER_ADD_OPT_SUBMIT, 'submit');
     if (!$obj->getVar('categoryid')) {
         $b->setExtra('onclick="this.form.elements.op.value=\'addsubcats\'"');
     } else {
         $b->setExtra('onclick="this.form.elements.op.value=\'mod\'"');
     }
     $r = new Xoops\Form\ElementTray('');
     $r->addElement($l);
     $r->addElement($b);
     $cat_tray->addElement($r);
     $this->addElement($cat_tray);
     $this->addElement(new Xoops\Form\Hidden('categoryid', $obj->getVar('categoryid')));
     $this->addElement(new Xoops\Form\Hidden('nb_sub_yet', $this->_subCatsCount));
     // Action buttons tray
     $button_tray = new Xoops\Form\ElementTray('', '');
     // No ID for category -- then it's new category, button says 'Create'
     if (!$obj->getVar('categoryid')) {
         $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_CREATE, 'submit'));
         $butt_clear = new Xoops\Form\Button('', '', _AM_PUBLISHER_CLEAR, 'reset');
         $button_tray->addElement($butt_clear);
         $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
         $butt_cancel->setExtra('onclick="history.go(-1)"');
         $button_tray->addElement($butt_cancel);
         $this->addElement($button_tray);
     } else {
         $button_tray->addElement(new Xoops\Form\Button('', 'addcategory', _AM_PUBLISHER_MODIFY, 'submit'));
         $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
         $butt_cancel->setExtra('onclick="history.go(-1)"');
         $button_tray->addElement($butt_cancel);
         $this->addElement($button_tray);
     }
 }
Example #21
0
function publisher_editItem($showmenu = false, $itemid = 0, $clone = false)
{
    $xoops = Xoops::getInstance();
    $publisher = Publisher::getInstance();
    global $publisher_current_page;
    $formTpl = new XoopsTpl();
    //publisher_submit.html
    // if there is a parameter, and the id exists, retrieve data: we're editing a item
    if ($itemid != 0) {
        // Creating the ITEM object
        /* @var $itemObj PublisherItem */
        $itemObj = $publisher->getItemHandler()->get($itemid);
        if (!$itemObj) {
            $xoops->redirect("item.php", 1, _AM_PUBLISHER_NOITEMSELECTED);
        }
        if ($clone) {
            $itemObj->setNew();
            $itemObj->setVar('itemid', 0);
            $itemObj->setVar('status', _PUBLISHER_STATUS_NOTSET);
            $itemObj->setVar('datesub', time());
        }
        switch ($itemObj->getVar('status')) {
            case _PUBLISHER_STATUS_SUBMITTED:
                $page_title = _AM_PUBLISHER_SUBMITTED_TITLE;
                $page_info = _AM_PUBLISHER_SUBMITTED_INFO;
                break;
            case _PUBLISHER_STATUS_PUBLISHED:
                $page_title = _AM_PUBLISHER_PUBLISHEDEDITING;
                $page_info = _AM_PUBLISHER_PUBLISHEDEDITING_INFO;
                break;
            case _PUBLISHER_STATUS_OFFLINE:
                $page_title = _AM_PUBLISHER_OFFLINEEDITING;
                $page_info = _AM_PUBLISHER_OFFLINEEDITING_INFO;
                break;
            case _PUBLISHER_STATUS_REJECTED:
                $page_title = _AM_PUBLISHER_REJECTED_EDIT;
                $page_info = _AM_PUBLISHER_REJECTED_EDIT_INFO;
                break;
            case _PUBLISHER_STATUS_NOTSET:
                // Then it's a clone...
                $page_title = _AM_PUBLISHER_ITEM_DUPLICATING;
                $page_info = _AM_PUBLISHER_ITEM_DUPLICATING_DSC;
                break;
            case "default":
            default:
                $page_title = _AM_PUBLISHER_PUBLISHEDEDITING;
                $page_info = _AM_PUBLISHER_PUBLISHEDEDITING_INFO;
                break;
        }
        echo "<br />\n";
        PublisherUtils::openCollapsableBar('edititemtable', 'edititemicon', $page_title, $page_info);
        if (!$clone) {
            echo "<form><div style=\"margin-bottom: 10px;\">";
            echo "<input type='button' name='button' onclick=\"location='item.php?op=clone&itemid=" . $itemObj->getVar('itemid') . "'\" value='" . _AM_PUBLISHER_CLONE_ITEM . "'>&nbsp;&nbsp;";
            echo "</div></form>";
        }
    } else {
        // there's no parameter, so we're adding an item
        /* @var $itemObj PublisherItem */
        $itemObj = $publisher->getItemHandler()->create();
        $itemObj->setVarsFromRequest();
        $categoryObj = $publisher->getCategoryHandler()->create();
        $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0;
        $categoryObj->setVar('categoryid', $sel_categoryid);
        PublisherUtils::openCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC);
    }
    /* @var $sform PublisherItemForm */
    $sform = $publisher->getForm($itemObj, 'item');
    $sform->setTitle(_AM_PUBLISHER_ITEMS);
    $sform->assign($formTpl);
    $formTpl->display('module:publisher/publisher_submit.tpl');
    PublisherUtils::closeCollapsableBar('edititemtable', 'edititemicon');
    PublisherUtils::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
    $dir = PublisherUtils::getUploadDir(true, 'content');
    if (!preg_match('/777/i', decoct(fileperms($dir)))) {
        echo "<font color='FF0000'><h4>" . _AM_PUBLISHER_PERMERROR . "</h4></font>";
    }
    // Upload File
    echo "<form name='form_name2' id='form_name2' action='pw_upload_file.php' method='post' enctype='multipart/form-data'>";
    echo "<table cellspacing='1' width='100%' class='outer'>";
    echo "<tr><th colspan='2'>" . _AM_PUBLISHER_UPLOAD_FILE . "</th></tr>";
    echo "<tr valign='top' align='left'><td class='head'>" . _AM_PUBLISHER_SEARCH_PW . "</td><td class='even'><input type='file' name='fileupload' id='fileupload' size='30' /></td></tr>";
    echo "<tr valign='top' align='left'><td class='head'><input type='hidden' name='MAX_FILE_SIZE' id='op' value='500000' /></td><td class='even'><input type='submit' name='submit' value='" . _AM_PUBLISHER_UPLOAD . "' /></td></tr>";
    echo "<input type='hidden' name='backto' value='{$publisher_current_page}'/>";
    echo "</table>";
    echo "</form>";
    // Delete File
    $form = new Xoops\Form\ThemeForm(_CO_PUBLISHER_DELETEFILE, "form_name", "pw_delete_file.php");
    $pWrap_select = new Xoops\Form\Select(PublisherUtils::getUploadDir(true, 'content'), "address");
    $folder = dir($dir);
    while ($file = $folder->read()) {
        if ($file !== "." && $file !== "..") {
            $pWrap_select->addOption($file, $file);
        }
    }
    $folder->close();
    $form->addElement($pWrap_select);
    $delfile = "delfile";
    $form->addElement(new Xoops\Form\Hidden('op', $delfile));
    $submit = new Xoops\Form\Button("", "submit", _AM_PUBLISHER_BUTTON_DELETE, "submit");
    $form->addElement($submit);
    $form->addElement(new Xoops\Form\Hidden('backto', $publisher_current_page));
    $form->display();
    PublisherUtils::closeCollapsableBar('pagewraptable', 'pagewrapicon');
}
Example #22
0
        $category['last_title_link'] = $last_itemObj[$categoryObj->getVar('categoryid')]->getItemLink(false, $lastitemsize);
    }
    $xoopsTpl->assign('show_subtitle', $publisher->getConfig('cat_disp_subtitle'));
}
$categories = array();
$categories[] = $category;
$xoopsTpl->assign('category', $category);
$xoopsTpl->assign('categories', $categories);
// Language constants
$xoopsTpl->assign('sectionname', $publisher->getModule()->getVar('name'));
$xoopsTpl->assign('whereInSection', $publisher->getModule()->getVar('name'));
$xoopsTpl->assign('modulename', $publisher->getModule()->getVar('dirname'));
$xoopsTpl->assign('lang_category_summary', sprintf(_MD_PUBLISHER_CATEGORY_SUMMARY, $categoryObj->getVar('name')));
$xoopsTpl->assign('lang_category_summary_info', sprintf(_MD_PUBLISHER_CATEGORY_SUMMARY_INFO, $categoryObj->getVar('name')));
$xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->getVar('name')));
$xoopsTpl->assign('module_home', PublisherUtils::moduleHome($publisher->getConfig('format_linked_path')));
$xoopsTpl->assign('categoryPath', $category['categoryPath']);
$xoopsTpl->assign('selected_category', $categoryid);
// The Navigation Bar
$pagenav = new XoopsPageNav($thiscategory_itemcount, $publisher->getConfig('idxcat_index_perpage'), $start, 'start', 'categoryid=' . $categoryObj->getVar('categoryid'));
if ($publisher->getConfig('format_image_nav') == 1) {
    $navbar = '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>';
} else {
    $navbar = '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>';
}
$xoopsTpl->assign('navbar', $navbar);
/**
 * Generating meta information for this page
 */
$publisher_metagen = new PublisherMetagen($categoryObj->getVar('name'), $categoryObj->getVar('meta_keywords', 'n'), $categoryObj->getVar('meta_description', 'n'), $categoryObj->getCategoryPathForMetaTitle());
$publisher_metagen->createMetaTags();
Example #23
0
        foreach ($itemsObj as $itemObj) {
            $xoopsTpl->append('items', $itemObj->toArray($publisher->getConfig('idxcat_items_display_type'), $publisher->getConfig('item_title_size'), 300, true));
            //if no summary truncate body to 300
        }
        $xoopsTpl->assign('show_subtitle', $publisher->getConfig('index_disp_subtitle'));
        unset($allcategories);
    }
    unset($itemsObj);
}
// Language constants
$xoopsTpl->assign('title_and_welcome', $publisher->getConfig('index_title_and_welcome'));
//SHINE ADDED DEBUG mainintro txt
$xoopsTpl->assign('lang_mainintro', $myts->displayTarea($publisher->getConfig('index_welcome_msg'), 1));
$xoopsTpl->assign('sectionname', $publisher->getModule()->getVar('name'));
$xoopsTpl->assign('whereInSection', $publisher->getModule()->getVar('name'));
$xoopsTpl->assign('module_home', PublisherUtils::moduleHome(false));
$xoopsTpl->assign('indexfooter', $myts->displayTarea($publisher->getConfig('index_footer'), 1));
$xoopsTpl->assign('lang_category_summary', _MD_PUBLISHER_INDEX_CATEGORIES_SUMMARY);
$xoopsTpl->assign('lang_category_summary_info', _MD_PUBLISHER_INDEX_CATEGORIES_SUMMARY_INFO);
$xoopsTpl->assign('lang_items_title', _MD_PUBLISHER_INDEX_ITEMS);
$xoopsTpl->assign('indexpage', true);
// Category Navigation Bar
$pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_cat_perpage'), $catstart, 'catstart', '');
if ($publisher->getConfig('format_image_nav') == 1) {
    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderImageNav() . '</div>');
} else {
    $xoopsTpl->assign('catnavbar', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>');
}
// ITEM Navigation Bar
$pagenav = new XoopsPageNav($real_total_items, $publisher->getConfig('idxcat_index_perpage'), $start, 'start', '');
if ($publisher->getConfig('format_image_nav') == 1) {
Example #24
0
        }
    } else {
        $msg .= _AM_PUBLISHER_CLONE_FAIL;
    }
    echo $msg;
} else {
    $form = new Xoops\Form\ThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true);
    $clone = new Xoops\Form\Text(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, '');
    $clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC);
    $form->addElement($clone, true);
    $form->addElement(new Xoops\Form\Hidden('op', 'submit'));
    $form->addElement(new Xoops\Form\Button('', '', XoopsLocale::A_SUBMIT, 'submit'));
    $form->display();
}
// End of collapsable bar
PublisherUtils::closeCollapsableBar('clone', 'cloneicon');
$xoops->footer();
// work around for PHP < 5.0.x
if (!function_exists('file_put_contents')) {
    function file_put_contents($filename, $data, $file_append = false)
    {
        if ($fp = fopen($filename, !$file_append ? 'w+' : 'a+')) {
            fputs($fp, $data);
            fclose($fp);
        }
    }
}
// recursive clonning script
function publisher_cloneFileFolder($path)
{
    global $patKeys;
Example #25
0
function publisher_items_new_edit($options)
{
    $form = new Xoops\Form\BlockForm();
    $catEle = new Xoops\Form\Label(_MB_PUBLISHER_SELECTCAT, PublisherUtils::createCategorySelect($options[0], 0, true, 'options[0]'));
    $orderEle = new Xoops\Form\Select(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]);
    $orderEle->addOptionArray(array('datesub' => _MB_PUBLISHER_DATE, 'counter' => _MB_PUBLISHER_HITS, 'weight' => _MB_PUBLISHER_WEIGHT));
    $showEle = new Xoops\Form\RadioYesNo(_MB_PUBLISHER_ORDER_SHOW, 'options[2]', $options[2]);
    $dispEle = new Xoops\Form\Text(_MB_PUBLISHER_DISP, 'options[3]', 2, 255, $options[3]);
    $charsEle = new Xoops\Form\Text(_MB_PUBLISHER_CHARS, 'options[4]', 2, 255, $options[4]);
    $imageEle = new Xoops\Form\Select(_MB_PUBLISHER_IMAGE_TO_DISPLAY, 'options[5]', $options[5]);
    $imageEle->addOptionArray(array('none' => XoopsLocale::NONE, 'article' => _MB_PUBLISHER_IMAGE_ARTICLE, 'category' => _MB_PUBLISHER_IMAGE_CATEGORY, 'avatar' => _MB_PUBLISHER_IMAGE_AVATAR));
    $form->addElement($catEle);
    $form->addElement($orderEle);
    $form->addElement($showEle);
    $form->addElement($dispEle);
    $form->addElement($charsEle);
    $form->addElement($imageEle);
    return $form->render();
}
Example #26
0
PublisherUtils::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC);
$dir = PublisherUtils::getUploadDir(true, 'content');
if (!preg_match('/777/i', decoct(fileperms($dir)))) {
    echo "<font color='FF0000'><h4>" . _AM_PUBLISHER_PERMERROR . "</h4></font>";
}
// Upload File
echo "<form name='form_name2' id='form_name2' action='pw_upload_file.php' method='post' enctype='multipart/form-data'>";
echo "<table cellspacing='1' width='100%' class='outer'>";
echo "<tr><th colspan='2'>" . _AM_PUBLISHER_UPLOAD_FILE . "</th></tr>";
echo "<tr valign='top' align='left'><td class='head'>" . _AM_PUBLISHER_SEARCH . "</td><td class='even'><input type='file' name='fileupload' id='fileupload' size='30' /></td></tr>";
echo "<tr valign='top' align='left'><td class='head'><input type='hidden' name='MAX_FILE_SIZE' id='op' value='500000' /></td><td class='even'><input type='submit' name='submit' value='" . _AM_PUBLISHER_UPLOAD . "' /></td></tr>";
echo "</table>";
echo "</form>";
// Delete File
$form = new Xoops\Form\ThemeForm(_CO_PUBLISHER_DELETEFILE, "form_name", "pw_delete_file.php");
$pWrap_select = new Xoops\Form\Select(PublisherUtils::getUploadDir(true, 'content'), "address");
$folder = dir($dir);
while ($file = $folder->read()) {
    if ($file != "." && $file != "..") {
        $pWrap_select->addOption($file, $file);
    }
}
$folder->close();
$form->addElement($pWrap_select);
$delfile = "delfile";
$form->addElement(new Xoops\Form\Hidden('op', $delfile));
$submit = new Xoops\Form\Button("", "submit", _AM_PUBLISHER_BUTTON_DELETE, "submit");
$form->addElement($submit);
$form->display();
PublisherUtils::closeCollapsableBar('pagewraptable', 'pagewrapicon');
$xoops->footer();
Example #27
0
            $newpid = $parentId;
        } else {
            $newpid = $newCatArray[$oldpid]['newid'];
        }
        $publisher->getCategoryHandler()->updateAll('parentid', $newpid, $criteria);
        unset($criteria);
    }
    // Looping through the comments to link them to the new articles and module
    echo _AM_PUBLISHER_IMPORT_COMMENTS . "<br />";
    $publisher_module_id = $publisher->getModule()->mid();
    $comment_handler = xoops_getHandler('comment');
    $criteria = new CriteriaCompo();
    $criteria->add(new Criteria('com_modid', $news_module_id));
    $comments = $comment_handler->getObjects($criteria);
    foreach ($comments as $comment) {
        $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]);
        $comment->setVar('com_modid', $publisher_module_id);
        $comment->setNew();
        if (!$comment_handler->insert($comment)) {
            echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />";
        } else {
            echo "&nbsp;&nbsp;" . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "<br />";
        }
    }
    echo "<br/><br/>Done.<br/>";
    echo sprintf(_AM_PUBLISHER_IMPORTED_CATEGORIES, $cnt_imported_cat) . "<br/>";
    echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . "<br/>";
    echo "<br/><a href='" . PUBLISHER_URL . "/'>" . _AM_PUBLISHER_IMPORT_GOTOMODULE . "</a><br/>";
    PublisherUtils::closeCollapsableBar('newsimportgo', 'newsimportgoicon');
    $xoops->footer();
}
Example #28
0
            $importfile_select = new Xoops\Form\Select('', 'importfile', $importfile);
            $importfile_select->addOptionArray($importfile_select_array);
            $importfile_tray = new Xoops\Form\ElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, '&nbsp;');
            $importfile_tray->addElement($importfile_select);
            $importfile_tray->setDescription(_AM_PUBLISHER_IMPORT_SELECT_FILE_DSC);
            $sform->addElement($importfile_tray);
            // Buttons
            $button_tray = new Xoops\Form\ElementTray('', '');
            $hidden = new Xoops\Form\Hidden('op', 'importExecute');
            $button_tray->addElement($hidden);
            $butt_import = new Xoops\Form\Button('', '', _AM_PUBLISHER_IMPORT, 'submit');
            $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"');
            $button_tray->addElement($butt_import);
            $butt_cancel = new Xoops\Form\Button('', '', _AM_PUBLISHER_CANCEL, 'button');
            $butt_cancel->setExtra('onclick="history.go(-1)"');
            $button_tray->addElement($butt_cancel);
            $sform->addElement($button_tray);
            /*$sform->addElement(new Xoops\Form\Hidden('xfs_version', $xfs_version));
              $sform->addElement(new Xoops\Form\Hidden('wfs_version', $wfs_version));*/
            $sform->addElement(new Xoops\Form\Hidden('news_version', $news_version));
            $sform->addElement(new Xoops\Form\Hidden('smartsection_version', $smartsection_version));
            $sform->display();
            unset($hidden);
        } else {
            echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-weight: bold; font-size: small; display: block; \">" . _AM_PUBLISHER_IMPORT_NO_MODULE . "</span>";
        }
        // End of collapsable bar
        PublisherUtils::closeCollapsableBar('import', 'importicon');
        break;
}
$xoops->footer();
Example #29
0
function createDir()
{
    // auto crate folders
    $thePath = PublisherUtils::getUploadDir();
    if (PublisherUtils::getPathStatus('root', true) < 0) {
        $thePath = PublisherUtils::getUploadDir();
        $res = PublisherUtils::mkdir($thePath);
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('images', true) < 0) {
        $thePath = PublisherUtils::getImageDir();
        $res = PublisherUtils::mkdir($thePath);
        if ($res) {
            $source = PUBLISHER_ROOT_PATH . "/images/blank.png";
            $dest = $thePath . "blank.png";
            PublisherUtils::copyr($source, $dest);
        }
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('images/category', true) < 0) {
        $thePath = PublisherUtils::getImageDir('category');
        $res = PublisherUtils::mkdir($thePath);
        if ($res) {
            $source = PUBLISHER_ROOT_PATH . '/images/blank.png';
            $dest = $thePath . 'blank.png';
            PublisherUtils::copyr($source, $dest);
        }
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('images/item', true) < 0) {
        $thePath = PublisherUtils::getImageDir('item');
        $res = PublisherUtils::mkdir($thePath);
        if ($res) {
            $source = PUBLISHER_ROOT_PATH . '/images/blank.png';
            $dest = $thePath . 'blank.png';
            PublisherUtils::copyr($source, $dest);
        }
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
    if (PublisherUtils::getPathStatus('content', true) < 0) {
        $thePath = PublisherUtils::getUploadDir(true, 'content');
        $res = PublisherUtils::mkdir($thePath);
        $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED;
    }
}
Example #30
0
if ($xoops->isActiveModule('tag')) {
    include_once \XoopsBaseConfig::get('root-path') . '/modules/tag/include/tagbar.php';
    $xoopsTpl->assign('tagbar', tagBar($itemid, $catid = 0));
}
/**
 * Generating meta information for this page
 */
$publisher_metagen = new PublisherMetagen($itemObj->getVar('title'), $itemObj->getVar('meta_keywords', 'n'), $itemObj->getVar('meta_description', 'n'), $itemObj->getCategoryPath());
$publisher_metagen->createMetaTags();
// Include the comments if the selected ITEM supports comments
if ($xoops->isActiveModule('comments') && ($itemObj->getVar('cancomment') == 1 || !$publisher->getConfig('perm_com_art_level')) && $publisher->getConfig('com_rule') != 0) {
    $xoopsTpl->assign('canComment', true);
    //Comments::getInstance()->renderView();
    // Problem with url_rewrite and posting comments :
    /*
    $xoopsTpl->assign(array(
        'editcomment_link' => PUBLISHER_URL . '/comment_edit.php?com_itemid=' . $com_itemid . '&amp;com_order=' . $com_order . '&amp;com_mode=' . $com_mode . $link_extra,
        'deletecomment_link' => PUBLISHER_URL . '/comment_delete.php?com_itemid=' . $com_itemid . '&amp;com_order=' . $com_order . '&amp;com_mode=' . $com_mode . $link_extra,
        'replycomment_link' => PUBLISHER_URL . '/comment_reply.php?com_itemid=' . $com_itemid . '&amp;com_order=' . $com_order . '&amp;com_mode=' . $com_mode . $link_extra));
    $xoopsTpl->_tpl_vars['commentsnav'] = str_replace("self.location.href='", "self.location.href='" . PUBLISHER_URL . '/', $xoopsTpl->_tpl_vars['commentsnav']);
    */
}
// Include support for AJAX rating
if ($publisher->getConfig('perm_rating')) {
    $xoopsTpl->assign('rating_enabled', true);
    $item['ratingbar'] = PublisherUtils::ratingBar($itemid);
    $xoTheme->addScript(PUBLISHER_URL . '/js/behavior.js');
    $xoTheme->addScript(PUBLISHER_URL . '/js/rating.js');
}
$xoopsTpl->assign('item', $item);
$xoops->footer();