function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) { $publisher = PublisherPublisher::getInstance(); include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; // if there is a parameter, and the id exists, retrieve data: we're editing a file if ($fileid != 0) { // Creating the File object $fileObj = $publisher->getHandler('file')->get($fileid); if ($fileObj->notLoaded()) { redirect_header("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); exit; } 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>"; publisher_openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item $fileObj = $publisher->getHandler('file')->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>"; publisher_openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM $files_form = $fileObj->getForm(); $files_form->display(); if ($fileid != 0) { publisher_closeCollapsableBar('editfile', 'editfileicon'); } else { publisher_closeCollapsableBar('addfile', 'addfileicon'); } }
function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) { $publisher = PublisherPublisher::getInstance(); global $publisher_current_page, $xoopsUser; xoops_load('XoopsFormLoader'); $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 $itemObj = $publisher->getHandler('item')->get($itemid); if (!$itemObj) { redirect_header("item.php", 1, _AM_PUBLISHER_NOITEMSELECTED); exit; } if ($clone) { $itemObj->setNew(); $itemObj->setVar('itemid', 0); $itemObj->setVar('status', _PUBLISHER_STATUS_NOTSET); $itemObj->setVar('datesub', time()); } switch ($itemObj->status()) { case _PUBLISHER_STATUS_SUBMITTED: $breadcrumb_action1 = _CO_PUBLISHER_SUBMITTED; $breadcrumb_action2 = _AM_PUBLISHER_APPROVING; $page_title = _AM_PUBLISHER_SUBMITTED_TITLE; $page_info = _AM_PUBLISHER_SUBMITTED_INFO; $button_caption = _AM_PUBLISHER_APPROVE; $new_status = _PUBLISHER_STATUS_PUBLISHED; break; case _PUBLISHER_STATUS_PUBLISHED: $breadcrumb_action1 = _CO_PUBLISHER_PUBLISHED; $breadcrumb_action2 = _AM_PUBLISHER_EDITING; $page_title = _AM_PUBLISHER_PUBLISHEDEDITING; $page_info = _AM_PUBLISHER_PUBLISHEDEDITING_INFO; $button_caption = _AM_PUBLISHER_MODIFY; $new_status = _PUBLISHER_STATUS_PUBLISHED; break; case _PUBLISHER_STATUS_OFFLINE: $breadcrumb_action1 = _CO_PUBLISHER_OFFLINE; $breadcrumb_action2 = _AM_PUBLISHER_EDITING; $page_title = _AM_PUBLISHER_OFFLINEEDITING; $page_info = _AM_PUBLISHER_OFFLINEEDITING_INFO; $button_caption = _AM_PUBLISHER_MODIFY; $new_status = _PUBLISHER_STATUS_OFFLINE; break; case _PUBLISHER_STATUS_REJECTED: $breadcrumb_action1 = _CO_PUBLISHER_REJECTED; $breadcrumb_action2 = _AM_PUBLISHER_REJECTED; $page_title = _AM_PUBLISHER_REJECTED_EDIT; $page_info = _AM_PUBLISHER_REJECTED_EDIT_INFO; $button_caption = _AM_PUBLISHER_MODIFY; $new_status = _PUBLISHER_STATUS_REJECTED; break; case _PUBLISHER_STATUS_NOTSET: // Then it's a clone... $breadcrumb_action1 = _AM_PUBLISHER_ITEMS; $breadcrumb_action2 = _AM_PUBLISHER_CLONE_NEW; $button_caption = _AM_PUBLISHER_CREATE; $new_status = _PUBLISHER_STATUS_PUBLISHED; $page_title = _AM_PUBLISHER_ITEM_DUPLICATING; $page_info = _AM_PUBLISHER_ITEM_DUPLICATING_DSC; break; case "default": default: $breadcrumb_action1 = _AM_PUBLISHER_ITEMS; $breadcrumb_action2 = _AM_PUBLISHER_EDITING; $page_title = _AM_PUBLISHER_PUBLISHEDEDITING; $page_info = _AM_PUBLISHER_PUBLISHEDEDITING_INFO; $button_caption = _AM_PUBLISHER_MODIFY; $new_status = _PUBLISHER_STATUS_PUBLISHED; break; } $categoryObj = $itemObj->category(); if ($showmenu) { //publisher_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } echo "<br />\n"; publisher_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->itemid() . "'\" value='" . _AM_PUBLISHER_CLONE_ITEM . "'> "; echo "</div></form>"; } } else { // there's no parameter, so we're adding an item $itemObj = $publisher->getHandler('item')->create(); $itemObj->setVarsFromRequest(); $categoryObj = $publisher->getHandler('category')->create(); $breadcrumb_action1 = _AM_PUBLISHER_ITEMS; $breadcrumb_action2 = _AM_PUBLISHER_CREATINGNEW; $button_caption = _AM_PUBLISHER_CREATE; $new_status = _PUBLISHER_STATUS_PUBLISHED; if ($showmenu) { //publisher_adminMenu(2, $breadcrumb_action1 . " > " . $breadcrumb_action2); } $sel_categoryid = isset($_GET['categoryid']) ? $_GET['categoryid'] : 0; $categoryObj->setVar('categoryid', $sel_categoryid); publisher_openCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC); } $sform = $itemObj->getForm(_AM_PUBLISHER_ITEMS); $sform->assign($formTpl); $formTpl->display('db:publisher_submit.html'); publisher_closeCollapsableBar('edititemtable', 'edititemicon'); publisher_openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); $dir = publisher_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 XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, "form_name", "pw_delete_file.php"); $pWrap_select = new XoopsFormSelect(publisher_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 XoopsFormHidden('op', $delfile)); $submit = new XoopsFormButton("", "submit", _AM_PUBLISHER_BUTTON_DELETE, "submit"); $form->addElement($submit); $form->addElement(new XoopsFormHidden('backto', $publisher_current_page)); $form->display(); publisher_closeCollapsableBar('pagewraptable', 'pagewrapicon'); }
$newpid = $parentId; } else { $newpid = $newCatArray[$oldpid]['newid']; } $publisher->getHandler('category')->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 " " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />"; } else { echo " " . 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/>"; publisher_closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); }
} else { $msg .= _AM_PUBLISHER_CLONE_FAIL; } echo $msg; } else { include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true); $clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, ''); $clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC); $form->addElement($clone, true); $form->addElement(new XoopsFormHidden('op', 'submit')); $form->addElement(new XoopsFormButton('', '', _SUBMIT, 'submit')); $form->display(); } // End of collapsable bar publisher_closeCollapsableBar('clone', 'cloneicon'); xoops_cp_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;
} 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}&sortsel={$sortsel}&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 publisher_closeCollapsableBar('allitemstable', 'allitemsicon'); // Close the collapsable div xoops_cp_footer(); // auto create folders---------------------------------------- //TODO rename this function? And exclude image folder? function createDir() { // auto crate folders $thePath = publisher_getUploadDir(); if (publisher_getPathStatus('root', true) < 0) { $thePath = publisher_getUploadDir(); $res = publisher_mkdir($thePath); $msg = $res ? _AM_PUBLISHER_DIRCREATED : _AM_PUBLISHER_DIRNOTCREATED; } if (publisher_getPathStatus('images', true) < 0) { $thePath = publisher_getImageDir();
publisher_openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); $dir = publisher_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 XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, "form_name", "pw_delete_file.php"); $pWrap_select = new XoopsFormSelect(publisher_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 XoopsFormHidden('op', $delfile)); $submit = new XoopsFormButton("", "submit", _AM_PUBLISHER_BUTTON_DELETE, "submit"); $form->addElement($submit); $form->display(); publisher_closeCollapsableBar('pagewraptable', 'pagewrapicon'); xoops_cp_footer();
$importfile_select = new XoopsFormSelect('', 'importfile', $importfile); $importfile_select->addOptionArray($importfile_select_array); $importfile_tray = new XoopsFormElementTray(_AM_PUBLISHER_IMPORT_SELECT_FILE, ' '); $importfile_tray->addElement($importfile_select); $importfile_tray->setDescription(_AM_PUBLISHER_IMPORT_SELECT_FILE_DSC); $sform->addElement($importfile_tray); // Buttons $button_tray = new XoopsFormElementTray('', ''); $hidden = new XoopsFormHidden('op', 'importExecute'); $button_tray->addElement($hidden); $butt_import = new XoopsFormButton('', '', _AM_PUBLISHER_IMPORT, 'submit'); $butt_import->setExtra('onclick="this.form.elements.op.value=\'importExecute\'"'); $button_tray->addElement($butt_import); $butt_cancel = new XoopsFormButton('', '', _AM_PUBLISHER_CANCEL, 'button'); $butt_cancel->setExtra('onclick="history.go(-1)"'); $button_tray->addElement($butt_cancel); $sform->addElement($button_tray); /*$sform->addElement(new XoopsFormHidden('xfs_version', $xfs_version)); $sform->addElement(new XoopsFormHidden('wfs_version', $wfs_version));*/ $sform->addElement(new XoopsFormHidden('news_version', $news_version)); $sform->addElement(new XoopsFormHidden('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 publisher_closeCollapsableBar('import', 'importicon'); break; } xoops_cp_footer();
} $publisher->getHandler('category')->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 " " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "<br />"; } else { echo " " . 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/>"; publisher_closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); xoops_cp_footer(); }
// Form permissions echo "<br />\n"; publisher_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 XoopsGroupPermForm("", $publisher->getModule()->mid(), "form_view", "", 'admin/permissions.php'); foreach ($form_options as $key => $value) { $form_submit->addItem($key, $value); } echo $form_submit->render(); publisher_closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); // Editors permissions echo "<br />\n"; publisher_openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); $editors = publisher_getEditors(); $form_submit = new XoopsGroupPermForm("", $publisher->getModule()->mid(), "editors", "", 'admin/permissions.php'); foreach ($editors as $key => $value) { $form_submit->addItem($key, $value['title']); } echo $form_submit->render(); publisher_closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); // Global permissions echo "<br />\n"; publisher_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 XoopsGroupPermForm("", $publisher->getModule()->mid(), "global", "", 'admin/permissions.php'); foreach ($form_options as $key => $value) { $form_submit->addItem($key, $value); } echo $form_submit->render(); publisher_closeCollapsableBar('permissionstable_global', 'permissionsicon_global'); xoops_cp_footer();
function search() { $publisher = PublisherPublisher::getInstance(); global $oAdminButton, $hMime, $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy; if (isset($_POST['deleteMimes'])) { $aMimes = $_POST['mimes']; $crit = new Criteria('mime_id', "(" . implode($aMimes, ',') . ")", "IN"); if ($publisher->getHandler('mimetype')->deleteAll($crit)) { header("Location: " . PUBLISHER_ADMIN_URL . "/mimetypes.php?limit={$limit}&start={$start}"); } else { redirect_header(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"; } publisher_cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH); publisher_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>\r\n <td class='even'>\r\n <select name='search_by'>"; foreach ($aSortBy as $value => $text) { echo "<option value='{$value}'>{$text}</option>"; } echo "</select>\r\n </td>\r\n </tr>"; echo "<tr><td class='head'>" . _AM_PUBLISHER_TEXT_SEARCH_TEXT . "</td>\r\n <td class='even'>\r\n <input type='text' name='search_text' id='search_text' value='' />\r\n </td>\r\n </tr>"; echo "<tr class='foot'>\r\n <td colspan='2'>\r\n <input type='submit' name='mime_search' id='mime_search' value='" . _AM_PUBLISHER_BUTTON_SEARCH . "' />\r\n </td>\r\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->getHandler('mimetype')->getCount($crit); $mimetypes = $publisher->getHandler('mimetype')->getObjects($crit); $nav = new XoopsPageNav($mime_count, $limit, $start, 'start', "op=search&limit={$limit}&order={$order}&sort={$sort}&mime_search=1&search_by={$search_field}&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 . "\r\n <select name='sort'>"; foreach ($aSortBy as $value => $text) { $sort == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_PUBLISHER_TEXT_ORDER_BY . "\r\n <select name='order'>"; foreach ($aOrderBy as $value => $text) { $order == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n \r\n " . _AM_PUBLISHER_TEXT_NUMBER_PER_PAGE . "\r\n <select name='limit'>"; foreach ($aLimitBy as $value => $text) { $limit == $value ? $selected = "selected='selected'" : ($selected = ''); echo "<option value='{$value}' {$selected}>{$text}</option>"; } echo "</select>\r\n <input type='submit' name='mime_sort' id='mime_sort' value='" . _AM_PUBLISHER_BUTTON_SUBMIT . "' />\r\n <input type='hidden' name='mime_search' id='mime_search' value='1' />\r\n <input type='hidden' name='search_by' id='search_by' value='{$search_field}' />\r\n <input type='hidden' name='search_text' id='search_text' value='{$search_text}' />\r\n </td>\r\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'>\r\n <td>" . _AM_PUBLISHER_MIME_ID . "</td>\r\n <td>" . _AM_PUBLISHER_MIME_NAME . "</td>\r\n <td>" . _AM_PUBLISHER_MIME_EXT . "</td>\r\n <td>" . _AM_PUBLISHER_MIME_ADMIN . "</td>\r\n <td>" . _AM_PUBLISHER_MIME_USER . "</td>\r\n <td>" . _AM_PUBLISHER_MINDEX_ACTION . "</td>\r\n </tr>"; foreach ($mimetypes as $mime) { echo "<tr class='even'>\r\n <td><input type='checkbox' name='mimes[]' value='" . $mime->getVar('mime_id') . "' />" . $mime->getVar('mime_id') . "</td>\r\n <td>" . $mime->getVar('mime_name') . "</td>\r\n <td>" . $mime->getVar('mime_ext') . "</td>\r\n <td>\r\n <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=updateMimeValue&id=" . $mime->getVar('mime_id') . "&mime_admin=" . $mime->getVar('mime_admin') . "&limit=" . $limit . "&start=" . $start . "'>\r\n " . ($mime->getVar('mime_admin') ? $imagearray['online'] : $imagearray['offline']) . "</a>\r\n </td>\r\n <td>\r\n <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=updateMimeValue&id=" . $mime->getVar('mime_id') . "&mime_user="******"&limit=" . $limit . "&start=" . $start . "'>\r\n " . ($mime->getVar('mime_user') ? $imagearray['online'] : $imagearray['offline']) . "</a>\r\n </td>\r\n <td>\r\n <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=edit&id=" . $mime->getVar('mime_id') . "&limit=" . $limit . "&start=" . $start . "'>" . $imagearray['editimg'] . "</a>\r\n <a href='" . PUBLISHER_ADMIN_URL . "/mimetypes.php?op=delete&id=" . $mime->getVar('mime_id') . "&limit=" . $limit . "&start=" . $start . "'>" . $imagearray['deleteimg'] . "</a>\r\n </td>\r\n </tr>"; } echo "<tr class='foot'>\r\n <td colspan='6' valign='top'>\r\n <a href='http://www.filext.com' style='float: right' target='_blank'>" . _AM_PUBLISHER_MIME_FINDMIMETYPE . "</a>\r\n <input type='checkbox' name='checkAllMimes' value='0' onclick='selectAll(this.form,\"mimes[]\",this.checked);' />\r\n <input type='submit' name='deleteMimes' id='deleteMimes' value='" . _AM_PUBLISHER_BUTTON_DELETE . "' />\r\n <input type='submit' name='add_mime' id='add_mime' value='" . _AM_PUBLISHER_MIME_CREATEF . "' class='formButton' />\r\n </td>\r\n </tr>"; } else { echo "<tr><th>" . _AM_PUBLISHER_TEXT_SEARCH_MIME . "</th></tr>"; echo "<tr class='even'>\r\n <td>" . _AM_PUBLISHER_TEXT_NO_RECORDS . "</td>\r\n </tr>"; } echo "</table>"; echo "<div id='pagenav'>" . $nav->renderNav() . "</div>"; } publisher_closeCollapsableBar('mimesearchtable', 'mimesearchicon'); xoops_cp_footer(); }
function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null) { $publisher = PublisherPublisher::getInstance(); // 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->getHandler('category')->get($categoryid); if ($categoryObj->notLoaded()) { redirect_header("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT); exit; } } else { if (!$categoryObj) { $categoryObj = $publisher->getHandler('category')->create(); } } if ($categoryid != 0) { if ($showmenu) { //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING); } echo "<br />\n"; publisher_openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO); } else { if ($showmenu) { //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW); } publisher_openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO); } $sform = $categoryObj->getForm($nb_subcats); $sform->display(); if (!$categoryid) { publisher_closeCollapsableBar('createtable', 'createtableicon'); } else { publisher_closeCollapsableBar('edittable', 'edittableicon'); } //Added by fx2024 if ($categoryid) { $sel_cat = $categoryid; publisher_openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC); // Get the total number of sub-categories $categoriesObj = $publisher->getHandler('category')->get($sel_cat); $totalsubs = $publisher->getHandler('category')->getCategoriesCount($sel_cat); // creating the categories objects that are published $subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid()); $totalSCOnPage = count($subcatsObj); 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) { foreach ($subcatsObj as $subcat) { $modify = "<a href='category.php?op=mod&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_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&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_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->categoryid() . "</td>"; echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->categoryid() . "&parentid=" . $subcat->parentid() . "'>" . $subcat->name() . "</a></td>"; echo "<td class='even' align='left'>" . $subcat->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"; publisher_closeCollapsableBar('subcatstable', 'subcatsicon'); publisher_openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC); $startitem = PublisherRequest::getInt('startitem'); // Get the total number of published ITEMS $totalitems = $publisher->getHandler('item')->getItemsCount($sel_cat, array(_PUBLISHER_STATUS_PUBLISHED)); // creating the items objects that are published $itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat); $totalitemsOnPage = count($itemsObj); $allcats = $publisher->getHandler('category')->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]->categoryid()]; $modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_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&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_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]->itemid() . "</td>"; echo "<td class='even' align='left'>" . $categoryObj->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 { $itemid = -1; echo "<tr>"; echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>"; echo "</tr>"; } echo "</table>\n"; echo "<br />\n"; $parentid = PublisherRequest::getInt('parentid'); $pagenav_extra_args = "op=mod&categoryid={$sel_cat}&parentid={$parentid}"; xoops_load('XoopsPageNav'); $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 . "'> "; echo "</div>"; } //end of fx2024 code }
${$form_cat}->addElement($ele); ${$form_cat}->addElement($hidden); unset($ele); unset($hidden); } publisher_cpHeader(); //publisher_adminMenu(5, _PREFERENCES); foreach ($config_cats as $form_cat => $info) { if ($form_cat == 'others' && !$cat_others_used) { continue; } ${$form_cat}->addElement(new XoopsFormHidden('op', 'save')); ${$form_cat}->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); publisher_openCollapsableBar($form_cat . '_table', $form_cat . '_icon', $info['name'], $info['description']); ${$form_cat}->display(); publisher_closeCollapsableBar($form_cat . '_table', $form_cat . '_icon'); } xoops_cp_footer(); exit; } if ($op == 'save') { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header($module->getInfo('adminindex'), 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); } $count = count($conf_ids); $config_handler = xoops_gethandler('config'); if ($count > 0) { for ($i = 0; $i < $count; $i++) { $config = $config_handler->getConfig($conf_ids[$i]); $new_value =& ${$config->getVar('conf_name')}; if (is_array($new_value) || $new_value != $config->getVar('conf_value')) {