예제 #1
0
파일: file.php 프로젝트: ming-hai/XoopsCore
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');
    }
}
예제 #2
0
파일: main.php 프로젝트: ming-hai/XoopsCore
} else {
    // that is, $numrows = 0, there's no entries yet
    echo "<tr>";
    echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMSSEL . "</td>";
    echo "</tr>";
}
echo "</table>\n";
echo "<span style=\"color: #567; margin: 3px 0 18px 0; font-size: small; display: block; \">{$status_explaination}</span>";
$pagenav = new XoopsPageNav($numrows, $publisher->getConfig('idxcat_perpage'), $startentry, 'startentry', "statussel={$statussel}&amp;sortsel={$sortsel}&amp;ordersel={$ordersel}");
if ($publisher->getConfig('format_image_nav') == 1) {
    echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderImageNav() . '</div>';
} else {
    echo '<div style="text-align:right; background-color: white; margin: 10px 0;">' . $pagenav->renderNav() . '</div>';
}
// ENDs code to show active entries
PublisherUtils::closeCollapsableBar('allitemstable', 'allitemsicon');
// Close the collapsable div
$xoops->footer();
// auto create folders----------------------------------------
//TODO rename this function? And exclude image folder?
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();
예제 #3
0
파일: news.php 프로젝트: ming-hai/XoopsCore
            $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();
}
예제 #4
0
파일: item.php 프로젝트: ming-hai/XoopsCore
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');
}
예제 #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();
}
예제 #6
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();
예제 #7
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();
예제 #8
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;
예제 #9
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();
예제 #10
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
}
예제 #11
0
function search()
{
    $publisher = Publisher::getInstance();
    $xoops = Xoops::getInstance();
    global $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy;
    if (isset($_POST['deleteMimes'])) {
        $aMimes = $_POST['mimes'];
        $crit = new Criteria('mime_id', "(" . implode($aMimes, ',') . ")", "IN");
        if ($publisher->getMimetypeHandler()->deleteAll($crit)) {
            header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}");
        } else {
            $xoops->redirect(PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}", 3, _AM_PUBLISHER_MESSAGE_DELETE_MIME_ERROR);
        }
    }
    if (isset($_POST['add_mime'])) {
        header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=add&start={$start}&limit={$limit}");
        exit;
    }
    if (isset($_REQUEST['order'])) {
        $order = $_REQUEST['order'];
    } else {
        $order = "ASC";
    }
    if (isset($_REQUEST['sort'])) {
        $sort = $_REQUEST['sort'];
    } else {
        $sort = "mime_name";
    }
    PublisherUtils::cpHeader();
    //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH);
    PublisherUtils::openCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH);
    if (!isset($_REQUEST['mime_search'])) {
        echo "<form action='mimetypes.php?op=search' method='post'>";
        echo "<table width='100%' cellspacing='1' class='outer'>";
        echo "<tr><th colspan='2'>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>";
        echo "<tr><td class='head' width='20%'>" . _AM_PUBLISHER_TEXT_SEARCH_BY . "</td>\n        <td class='even'>\n        <select name='search_by'>";
        foreach ($aSortBy as $value => $text) {
            echo "<option value='{$value}'>{$text}</option>";
        }
        echo "</select>\n        </td>\n        </tr>";
        echo "<tr><td class='head'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "</td>\n        <td class='even'>\n        <input type='text' name='search_text' id='search_text' value='' />\n        </td>\n        </tr>";
        echo "<tr class='foot'>\n        <td colspan='2'>\n        <input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' />\n        </td>\n        </tr>";
        echo "</table></form>";
    } else {
        $search_field = $_REQUEST['search_by'];
        $search_text = $_REQUEST['search_text'];
        $crit = new Criteria($search_field, "%{$search_text}%", 'LIKE');
        $crit->setSort($sort);
        $crit->setOrder($order);
        $crit->setLimit($limit);
        $crit->setStart($start);
        $mime_count = $publisher->getMimetypeHandler()->getCount($crit);
        $mimetypes = $publisher->getMimetypeHandler()->getObjects($crit);
        $nav = new XoopsPageNav($mime_count, $limit, $start, 'start', "op=search&amp;limit={$limit}&amp;order={$order}&amp;sort={$sort}&amp;mime_search=1&amp;search_by={$search_field}&amp;search_text={$search_text}");
        // Display results
        echo '<script type="text/javascript" src="' . PUBLISHER_URL . '/include/functions.js"></script>';
        echo "<table width='100%' cellspacing='1' class='outer'>";
        echo "<tr><td colspan='6' align='right'>";
        echo "<form action='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search' style='margin:0; padding:0;' method='post'>";
        echo "<table>";
        echo "<tr>";
        echo "<td align='right'>" . _AM_PUBLISHER_TEXT_SEARCH_BY . "</td>";
        echo "<td align='left'><select name='search_by'>";
        foreach ($aSearchBy as $value => $text) {
            $search_field == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select></td>";
        echo "<td align='right'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "</td>";
        echo "<td align='left'><input type='text' name='search_text' id='search_text' value='{$search_text}' /></td>";
        echo "<td><input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' /></td>";
        echo "</tr></table></form></td></tr>";
        echo "<tr><td colspan='6'>";
        echo "<form action='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=search' style='margin:0; padding:0;' method='post'>";
        echo "<table width='100%'>";
        echo "<tr><td align='right'>" . _AM_PUBLISHER_TEXT_SORT_BY . "\n        <select name='sort'>";
        foreach ($aSortBy as $value => $text) {
            $sort == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select>\n        &nbsp;&nbsp;&nbsp;\n        " . _AM_PUBLISHER_TEXT_ORDER_BY . "\n        <select name='order'>";
        foreach ($aOrderBy as $value => $text) {
            $order == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select>\n        &nbsp;&nbsp;&nbsp;\n        " . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . "\n        <select name='limit'>";
        foreach ($aLimitBy as $value => $text) {
            $limit == $value ? $selected = "selected='selected'" : ($selected = '');
            echo "<option value='{$value}' {$selected}>{$text}</option>";
        }
        echo "</select>\n        <input type='submit' name='mime_sort' id='mime_sort' value='" . _AM_PUBLISHER_BUTTON_SUBMIT . "' />\n        <input type='hidden' name='mime_search' id='mime_search' value='1' />\n        <input type='hidden' name='search_by' id='search_by' value='{$search_field}' />\n        <input type='hidden' name='search_text' id='search_text' value='{$search_text}' />\n        </td>\n        </tr>";
        echo "</table>";
        echo "</td></tr>";
        if (count($mimetypes) > 0) {
            echo "<tr><th colspan='6'>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>";
            echo "<tr class='head'>\n            <td>" . _AM_PUBLISHER_MIME_ID . "</td>\n            <td>" . _AM_PUBLISHER_MIME_NAME . "</td>\n            <td>" . _AM_PUBLISHER_MIME_EXT . "</td>\n            <td>" . _AM_PUBLISHER_MIME_ADMIN . "</td>\n            <td>" . _AM_PUBLISHER_MIME_USER . "</td>\n            <td>" . _AM_PUBLISHER_MINDEX_ACTION . "</td>\n            </tr>";
            foreach ($mimetypes as $mime) {
                echo "<tr class='even'>\n                <td><input type='checkbox' name='mimes[]' value='" . $mime->getVar('mime_id') . "' />" . $mime->getVar('mime_id') . "</td>\n                <td>" . $mime->getVar('mime_name') . "</td>\n                <td>" . $mime->getVar('mime_ext') . "</td>\n                <td>\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=updateMimeValue&amp;id=" . $mime->getVar('mime_id') . "&amp;mime_admin=" . $mime->getVar('mime_admin') . "&amp;limit=" . $limit . "&amp;start=" . $start . "'>\n                " . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . "</a>\n                </td>\n                <td>\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=updateMimeValue&amp;id=" . $mime->getVar('mime_id') . "&amp;mime_user="******"&amp;limit=" . $limit . "&amp;start=" . $start . "'>\n                " . ($mime->getVar('mime_user') ? $imagearray['online'] : $imagearray['offline']) . "</a>\n                </td>\n                <td>\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&amp;id=" . $mime->getVar('mime_id') . "&amp;limit=" . $limit . "&amp;start=" . $start . "'>" . $imagearray['editimg'] . "</a>\n                <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=delete&amp;id=" . $mime->getVar('mime_id') . "&amp;limit=" . $limit . "&amp;start=" . $start . "'>" . $imagearray['deleteimg'] . "</a>\n                </td>\n                </tr>";
            }
            echo "<tr class='foot'>\n            <td colspan='6' valign='top'>\n            <a href='http://www.filext.com' style='float: right' target='_blank'>" . _AM_PUBLISHER_MIME_FINDMIMETYPE . "</a>\n            <input type='checkbox' name='checkAllMimes' value='0' onclick='selectAll(this.form,\"mimes[]\",this.checked);' />\n            <input type='submit' name='deleteMimes' id='deleteMimes' value='" . _AM_PUBLISHER_BUTTON_DELETE . "' />\n            <input type='submit' name='add_mime' id='add_mime' value='" . _AM_PUBLISHER_MIME_CREATEF . "' class='formButton' />\n            </td>\n            </tr>";
        } else {
            echo "<tr><th>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>";
            echo "<tr class='even'>\n            <td>" . _AM_PUBLISHER_TEXT_NO_RECORDS . "</td>\n            </tr>";
        }
        echo "</table>";
        echo "<div id='pagenav'>" . $nav->renderNav() . "</div>";
    }
    PublisherUtils::closeCollapsableBar('mimesearchtable', 'mimesearchicon');
    $xoops->footer();
}