From: <tr...@us...> - 2012-12-12 23:26:44
|
Revision: 10373 http://sourceforge.net/p/xoops/svn/10373 Author: trabis Date: 2012-12-12 23:26:38 +0000 (Wed, 12 Dec 2012) Log Message: ----------- First publisher revision Modified Paths: -------------- XoopsModules/publisher/trunk/publisher/admin/about.php XoopsModules/publisher/trunk/publisher/admin/admin_header.php XoopsModules/publisher/trunk/publisher/admin/category.php XoopsModules/publisher/trunk/publisher/admin/clone.php XoopsModules/publisher/trunk/publisher/admin/file.php XoopsModules/publisher/trunk/publisher/admin/import/news.php XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php XoopsModules/publisher/trunk/publisher/admin/import/xfsection.php XoopsModules/publisher/trunk/publisher/admin/import.php XoopsModules/publisher/trunk/publisher/admin/index.php XoopsModules/publisher/trunk/publisher/admin/item.php XoopsModules/publisher/trunk/publisher/admin/main.php XoopsModules/publisher/trunk/publisher/admin/menu.php XoopsModules/publisher/trunk/publisher/admin/mimetypes.php XoopsModules/publisher/trunk/publisher/admin/pagewrap.php XoopsModules/publisher/trunk/publisher/admin/permissions.php XoopsModules/publisher/trunk/publisher/admin/preferences.php XoopsModules/publisher/trunk/publisher/admin/pw_delete_file.php XoopsModules/publisher/trunk/publisher/admin/pw_upload_file.php XoopsModules/publisher/trunk/publisher/archive.php XoopsModules/publisher/trunk/publisher/author_items.php XoopsModules/publisher/trunk/publisher/backend.php XoopsModules/publisher/trunk/publisher/blocks/category_items_sel.php XoopsModules/publisher/trunk/publisher/blocks/date_to_date.php XoopsModules/publisher/trunk/publisher/blocks/items_columns.php XoopsModules/publisher/trunk/publisher/blocks/items_menu.php XoopsModules/publisher/trunk/publisher/blocks/items_new.php XoopsModules/publisher/trunk/publisher/blocks/items_random_item.php XoopsModules/publisher/trunk/publisher/blocks/items_recent.php XoopsModules/publisher/trunk/publisher/blocks/items_spot.php XoopsModules/publisher/trunk/publisher/blocks/latest_files.php XoopsModules/publisher/trunk/publisher/blocks/latest_news.php XoopsModules/publisher/trunk/publisher/blocks/search.php XoopsModules/publisher/trunk/publisher/category.php XoopsModules/publisher/trunk/publisher/class/blockform.php XoopsModules/publisher/trunk/publisher/class/category.php XoopsModules/publisher/trunk/publisher/class/file.php XoopsModules/publisher/trunk/publisher/class/form/category.php XoopsModules/publisher/trunk/publisher/class/form/file.php XoopsModules/publisher/trunk/publisher/class/form/item.php XoopsModules/publisher/trunk/publisher/class/groupperm.php XoopsModules/publisher/trunk/publisher/class/item.php XoopsModules/publisher/trunk/publisher/class/metagen.php XoopsModules/publisher/trunk/publisher/class/mimetype.php XoopsModules/publisher/trunk/publisher/class/permission.php XoopsModules/publisher/trunk/publisher/class/publisher.php XoopsModules/publisher/trunk/publisher/class/rating.php XoopsModules/publisher/trunk/publisher/class/request.php XoopsModules/publisher/trunk/publisher/class/themetabform.php XoopsModules/publisher/trunk/publisher/class/uploader.php XoopsModules/publisher/trunk/publisher/comment_delete.php XoopsModules/publisher/trunk/publisher/comment_edit.php XoopsModules/publisher/trunk/publisher/comment_new.php XoopsModules/publisher/trunk/publisher/comment_post.php XoopsModules/publisher/trunk/publisher/comment_reply.php XoopsModules/publisher/trunk/publisher/file.php XoopsModules/publisher/trunk/publisher/footer.php XoopsModules/publisher/trunk/publisher/header.php XoopsModules/publisher/trunk/publisher/include/ajax_rating.php XoopsModules/publisher/trunk/publisher/include/ajax_upload.php XoopsModules/publisher/trunk/publisher/include/comment_functions.php XoopsModules/publisher/trunk/publisher/include/common.php XoopsModules/publisher/trunk/publisher/include/notification.inc.php XoopsModules/publisher/trunk/publisher/include/plugin.tag.php XoopsModules/publisher/trunk/publisher/include/search.inc.php XoopsModules/publisher/trunk/publisher/include/seo.inc.php XoopsModules/publisher/trunk/publisher/include/update.php XoopsModules/publisher/trunk/publisher/index.php XoopsModules/publisher/trunk/publisher/item.php XoopsModules/publisher/trunk/publisher/list.tag.php XoopsModules/publisher/trunk/publisher/makepdf.php XoopsModules/publisher/trunk/publisher/notification_update.php XoopsModules/publisher/trunk/publisher/pop.php XoopsModules/publisher/trunk/publisher/print.php XoopsModules/publisher/trunk/publisher/rate.php XoopsModules/publisher/trunk/publisher/search.php XoopsModules/publisher/trunk/publisher/submit.php XoopsModules/publisher/trunk/publisher/view.tag.php XoopsModules/publisher/trunk/publisher/visit.php XoopsModules/publisher/trunk/publisher/xoops_version.php Added Paths: ----------- XoopsModules/publisher/trunk/publisher/class/utils.php XoopsModules/publisher/trunk/publisher/preloads/ XoopsModules/publisher/trunk/publisher/preloads/core.php XoopsModules/publisher/trunk/publisher/preloads/index.html Removed Paths: ------------- XoopsModules/publisher/trunk/publisher/class/highlighter.php XoopsModules/publisher/trunk/publisher/include/constants.php XoopsModules/publisher/trunk/publisher/include/functions.php XoopsModules/publisher/trunk/publisher/include/media.textsanitizer.php XoopsModules/publisher/trunk/publisher/include/seo_functions.php Modified: XoopsModules/publisher/trunk/publisher/admin/about.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/about.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/about.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -20,13 +20,12 @@ * @version $Id$ */ -include_once dirname(__FILE__) . '/admin_header.php'; +include dirname(__FILE__) . '/admin_header.php'; +$xoops = Xoops::getInstance(); +$xoops->header(); -xoops_cp_header(); +$aboutAdmin = new XoopsModuleAdmin(); +$aboutAdmin->displayNavigation('about.php'); +$aboutAdmin->displayAbout('6KJ7RW5DR3VTJ', false); -$aboutAdmin = new ModuleAdmin(); - -echo $aboutAdmin->addNavigation('about.php'); -echo $aboutAdmin->renderAbout('6KJ7RW5DR3VTJ', false); - -xoops_cp_footer(); \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsModules/publisher/trunk/publisher/admin/admin_header.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/admin_header.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/admin_header.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -20,27 +20,10 @@ */ include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; -include_once dirname(dirname(__FILE__)) . '/include/common.php'; -include_once XOOPS_ROOT_PATH . '/include/cp_header.php'; -//xoops_loadLanguage('admin', PUBLISHER_DIRNAME); -xoops_loadLanguage('modinfo', PUBLISHER_DIRNAME); +$xoops = Xoops::getInstance(); +$publisher = Publisher::getInstance(); +$publisher->loadLanguage('modinfo'); -$imagearray = array( - 'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle' />", - 'deleteimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_delete.png' alt='" . _AM_PUBLISHER_ICO_DELETE . "' align='middle' />", - 'online' => "<img src='" . PUBLISHER_IMAGES_URL . "/on.png' alt='" . _AM_PUBLISHER_ICO_ONLINE . "' align='middle' />", - 'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle' />", -); -if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ - include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); -}else{ - echo xoops_error('/Frameworks/moduleclasses/moduleadmin/ is required!!!'); -} -/* -$myts =& MyTextSanitizer::getInstance(); - -if (!isset($xoopsTpl) || !is_object($xoopsTpl)) { - include_once(XOOPS_ROOT_PATH."/class/template.php"); - $xoopsTpl = new XoopsTpl(); -} */ \ No newline at end of file +XoopsLoad::loadFile($xoops->path(dirname(dirname(__FILE__)) . '/include/common.php')); +XoopsLoad::loadFile($xoops->path(XOOPS_ROOT_PATH . '/include/cp_header.php')); Modified: XoopsModules/publisher/trunk/publisher/admin/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/category.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/category.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -21,6 +21,7 @@ include_once dirname(__FILE__) . '/admin_header.php'; +$xoops = Xoops::getInstance(); $op = PublisherRequest::getString('op'); $op = isset($_POST['editor']) ? 'mod' : $op; @@ -35,20 +36,19 @@ switch ($op) { case "del": - $categoryObj = $publisher->getHandler('category')->get($categoryid); + /* @var $categoryObj PublisherCategory */ + $categoryObj = $publisher->getCategoryHandler()->get($categoryid); $confirm = (isset($_POST['confirm'])) ? $_POST['confirm'] : 0; $name = (isset($_POST['name'])) ? $_POST['name'] : ''; if ($confirm) { - if (!$publisher->getHandler('category')->delete($categoryObj)) { - redirect_header("category.php", 1, _AM_PUBLISHER_DELETE_CAT_ERROR); - exit(); + if (!$publisher->getCategoryHandler()->delete($categoryObj)) { + $xoops->redirect("category.php", 1, _AM_PUBLISHER_DELETE_CAT_ERROR); } - redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); - exit(); + $xoops->redirect("category.php", 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); } else { - xoops_cp_header(); - xoops_confirm(array('op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()), 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->name() . "'. <br /> <br />" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE); - xoops_cp_footer(); + $xoops->header(); + $xoops->confirm(array('op' => 'del', 'categoryid' => $categoryObj->getVar('categoryid'), 'confirm' => 1, 'name' => $categoryObj->getVar('name')), 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->getVar('name') . "'. <br /> <br />" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE); + $xoops->footer(); } break; @@ -58,7 +58,7 @@ $nb_subcats = $nb_subcats + (isset($_POST['nb_sub_yet']) ? intval($_POST['nb_sub_yet']) : 4); //end of fx2024 code - publisher_cpHeader(); + PublisherUtils::cpHeader(); publisher_editCat(true, $categoryid, $nb_subcats); break; @@ -66,11 +66,11 @@ global $modify; $parentid = PublisherRequest::getInt('parentid'); - + /* @var $categoryObj PublisherCategory */ if ($categoryid != 0) { - $categoryObj = $publisher->getHandler('category')->get($categoryid); + $categoryObj = $publisher->getCategoryHandler()->get($categoryid); } else { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); } // Uploading the image, if any @@ -82,20 +82,17 @@ $max_size = $publisher->getConfig('maximum_filesize'); $max_imgwidth = $publisher->getConfig('maximum_image_width'); $max_imgheight = $publisher->getConfig('maximum_image_height'); - $allowed_mimetypes = publisher_getAllowedImagesTypes(); + $allowed_mimetypes = PublisherUtils::getAllowedImagesTypes(); if ($_FILES[$filename]['tmp_name'] == "" || !is_readable($_FILES[$filename]['tmp_name'])) { - redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); - exit(); + $xoops->redirect('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); } - xoops_load('XoopsMediaUploader'); - $uploader = new XoopsMediaUploader(publisher_getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); + $uploader = new PublisherUploader(PublisherUtils::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); if ($uploader->fetchMedia($filename) && $uploader->upload()) { $categoryObj->setVar('image', $uploader->getSavedFileName()); } else { - redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR . $uploader->getErrors()); - exit(); + $xoops->redirect('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR . $uploader->getErrors()); } } } else { @@ -146,37 +143,34 @@ } if (!$categoryObj->store()) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); - exit; + $xoops->redirect("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . PublisherUtils::formatErrors($categoryObj->getErrors())); } // TODO : put this function in the category class - publisher_saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - publisher_saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + PublisherUtils::saveCategoryPermissions($grpread, $categoryObj->getVar('categoryid'), 'category_read'); + PublisherUtils::saveCategoryPermissions($grpsubmit, $categoryObj->getVar('categoryid'), 'item_submit'); + PublisherUtils::saveCategoryPermissions($grpmoderation, $categoryObj->getVar('categoryid'), 'category_moderation'); //Added by fx2024 - $parentCat = $categoryObj->categoryid(); + $parentCat = $categoryObj->getVar('categoryid'); $sizeof = sizeof($_POST['scname']); for ($i = 0; $i < $sizeof; $i++) { if ($_POST['scname'][$i] != '') { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); $categoryObj->setVar('name', $_POST['scname'][$i]); $categoryObj->setVar('parentid', $parentCat); if (!$categoryObj->store()) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); - exit; + $xoops->redirect("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . PublisherUtils::formatErrors($categoryObj->getErrors())); } // TODO : put this function in the category class - publisher_saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - publisher_saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + PublisherUtils::saveCategoryPermissions($grpread, $categoryObj->getVar('categoryid'), 'category_read'); + PublisherUtils::saveCategoryPermissions($grpsubmit, $categoryObj->getVar('categoryid'), 'item_submit'); + PublisherUtils::saveCategoryPermissions($grpmoderation, $categoryObj->getVar('categoryid'), 'category_moderation'); } } //end of fx2024 code - redirect_header($redirect_to, 2, $redirect_msg); - exit(); + $xoops->redirect($redirect_to, 2, $redirect_msg); break; //Added by fx2024 @@ -185,7 +179,7 @@ $categoryid = 0; $nb_subcats = intval($_POST['nb_subcats']) + $_POST['nb_sub_yet']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); $categoryObj->setVar('name', $_POST['name']); $categoryObj->setVar('description', $_POST['description']); $categoryObj->setVar('weight', $_POST['weight']); @@ -193,7 +187,7 @@ $categoryObj->setVar('parentid', $parentCat); } - publisher_cpHeader(); + PublisherUtils::cpHeader(); publisher_editCat(true, $categoryid, $nb_subcats, $categoryObj); exit(); @@ -201,12 +195,11 @@ //end of fx2024 code case "cancel": - redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); - exit(); - + $xoops->redirect("category.php", 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); + break; case "default": default: - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); echo "<br />\n"; @@ -216,9 +209,9 @@ echo "</div></form>"; // Creating the objects for top categories - $categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); + $categoriesObj = $publisher->getCategoryHandler()->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); - publisher_openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); + PublisherUtils::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; echo "<tr>"; @@ -226,7 +219,7 @@ echo "<td width='60' class='bg3' width='65' align='center'><strong>" . _CO_PUBLISHER_WEIGHT . "</strong></td>"; echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; echo "</tr>"; - $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0); + $totalCategories = $publisher->getCategoryHandler()->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { publisher_displayCategory($thiscat); @@ -238,30 +231,29 @@ $categoryid = '0'; } echo "</table>\n"; - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; echo "<br />"; - publisher_closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + PublisherUtils::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); echo "<br>"; //editcat(false); break; } -xoops_cp_footer(); +$xoops->footer(); -function publisher_displayCategory($categoryObj, $level = 0) +function publisher_displayCategory(PublisherCategory $categoryObj, $level = 0) { - $publisher = PublisherPublisher::getInstance(); + $publisher = Publisher::getInstance(); - $description = $categoryObj->description(); + $description = $categoryObj->getVar('description'); if (!XOOPS_USE_MULTIBYTES) { if (strlen($description) >= 100) { $description = substr($description, 0, (100 - 1)) . "..."; } } - $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "&parentid=" . $categoryObj->parentid() . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>"; - $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>"; + $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->getVar('categoryid') . "&parentid=" . $categoryObj->getVar('parentid') . "'><img src='" . PUBLISHER_URL . "/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>"; + $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->getVar('categoryid') . "'><img src='" . PUBLISHER_URL . "/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>"; $spaces = ''; for ($j = 0; $j < $level; $j++) { @@ -269,14 +261,14 @@ } echo "<tr>"; - echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' /> " . $categoryObj->name() . "</a></td>"; - echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>"; + echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->getVar('categoryid') . "'><img src='" . PUBLISHER_URL . "/images/links/subcat.gif' alt='' /> " . $categoryObj->getVar('name') . "</a></td>"; + echo "<td class='even' align='center'>" . $categoryObj->getVar('weight') . "</td>"; echo "<td class='even' align='center'> $modify $delete </td>"; echo "</tr>"; - $subCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryObj->categoryid()); + $subCategoriesObj = $publisher->getCategoryHandler()->getCategories(0, 0, $categoryObj->getVar('categoryid')); if (count($subCategoriesObj) > 0) { $level++; - foreach ($subCategoriesObj as $key => $thiscat) { + foreach ($subCategoriesObj as $thiscat) { publisher_displayCategory($thiscat, $level); } } @@ -285,19 +277,20 @@ function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null) { - $publisher = PublisherPublisher::getInstance(); + $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->getHandler('category')->get($categoryid); + $categoryObj = $publisher->getCategoryHandler()->get($categoryid); if ($categoryObj->notLoaded()) { - redirect_header("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT); - exit(); + $xoops->redirect("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT); } } else { if (!$categoryObj) { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); } } @@ -306,34 +299,36 @@ //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING); } echo "<br />\n"; - publisher_openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO); + PublisherUtils::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); + PublisherUtils::openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO); } - $sform = $categoryObj->getForm($nb_subcats); + /* @var $sform PublisherCategoryForm */ + $sform = $publisher->getForm($categoryObj, 'category'); + $sform->setSubCatsCount($nb_subcats); $sform->display(); if (!$categoryid) { - publisher_closeCollapsableBar('createtable', 'createtableicon'); + PublisherUtils::closeCollapsableBar('createtable', 'createtableicon'); } else { - publisher_closeCollapsableBar('edittable', 'edittableicon'); + PublisherUtils::closeCollapsableBar('edittable', 'edittableicon'); } //Added by fx2024 if ($categoryid) { $sel_cat = $categoryid; - publisher_openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC); + PublisherUtils::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); + $categoriesObj = $publisher->getCategoryHandler()->get($sel_cat); + $totalsubs = $publisher->getCategoryHandler()->getCategoriesCount($sel_cat); // creating the categories objects that are published - $subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid()); - $totalSCOnPage = count($subcatsObj); + $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>"; @@ -342,13 +337,14 @@ 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&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>"; + $modify = "<a href='category.php?op=mod&categoryid=" . $subcat->getVar('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->getVar('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='head' align='left'>" . $subcat->getVar('categoryid') . "</td>"; + echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->getVar('categoryid') . "&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>"; } @@ -359,16 +355,16 @@ } echo "</table>\n"; echo "<br />\n"; - publisher_closeCollapsableBar('subcatstable', 'subcatsicon'); + PublisherUtils::closeCollapsableBar('subcatstable', 'subcatsicon'); - publisher_openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC); + PublisherUtils::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)); + $totalitems = $publisher->getItemHandler()->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); + $itemsObj = $publisher->getItemHandler()->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat); $totalitemsOnPage = count($itemsObj); - $allcats = $publisher->getHandler('category')->getObjects(null, true); + $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>"; @@ -379,19 +375,18 @@ 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>"; + $categoryObj =& $allcats[$itemsObj[$i]->getVar('categoryid')]; + $modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->getVar('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]->getVar('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='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 { - $itemid = -1; echo "<tr>"; echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>"; echo "</tr>"; @@ -400,7 +395,6 @@ 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 . "'> "; Modified: XoopsModules/publisher/trunk/publisher/admin/clone.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/clone.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/clone.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -20,28 +20,28 @@ include_once dirname(__FILE__) . "/admin_header.php"; -publisher_cpHeader(); +$xoops = Xoops::getInstance(); +PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); -publisher_openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); +PublisherUtils::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); if (@$_POST['op'] == 'submit') { - if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('clone.php', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); - exit(); + if (!$xoops->security()->check()) { + $xoops->redirect('clone.php', 3, implode('<br />', $xoops->security()->getErrors())); } $clone = $_POST['clone']; //check if name is valid if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) { - redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_INVALIDNAME, $clone)); + $xoops->redirect('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_INVALIDNAME, $clone)); exit(); } // Check wether the cloned module exists or not if ($clone && is_dir(XOOPS_ROOT_PATH . '/modules/' . $clone)) { - redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_EXISTS, $clone)); + $xoops->redirect('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_EXISTS, $clone)); } $patterns = array( @@ -67,7 +67,6 @@ 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); @@ -78,8 +77,8 @@ } // End of collapsable bar -publisher_closeCollapsableBar('clone', 'cloneicon'); -xoops_cp_footer(); +PublisherUtils::closeCollapsableBar('clone', 'cloneicon'); +$xoops->footer(); // work around for PHP < 5.0.x if (!function_exists('file_put_contents')) { @@ -162,6 +161,4 @@ imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/images/module_logo.png"); imagedestroy($imageModule); return true; -} - -?> \ No newline at end of file +} \ No newline at end of file Modified: XoopsModules/publisher/trunk/publisher/admin/file.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/file.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/file.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -20,23 +20,24 @@ */ include_once dirname(__FILE__) . '/admin_header.php'; +$xoops = Xoops::getInstance(); $op = PublisherRequest::getString('op'); function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) { - $publisher = PublisherPublisher::getInstance(); - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + $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 - $fileObj = $publisher->getHandler('file')->get($fileid); + /* @var $fileObj PublisherFile */ + $fileObj = $publisher->getFileHandler()->get($fileid); if ($fileObj->notLoaded()) { - redirect_header("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); - exit(); + $xoops->redirect("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); } if ($showmenu) { @@ -46,27 +47,27 @@ 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); + PublisherUtils::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item - $fileObj = $publisher->getHandler('file')->create(); + $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>"; - publisher_openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + PublisherUtils::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM - $files_form = $fileObj->getForm(); + $files_form = $publisher->getForm($fileObj, 'file'); $files_form->display(); if ($fileid != 0) { - publisher_closeCollapsableBar('editfile', 'editfileicon'); + PublisherUtils::closeCollapsableBar('editfile', 'editfileicon'); } else { - publisher_closeCollapsableBar('addfile', 'addfileicon'); + PublisherUtils::closeCollapsableBar('addfile', 'addfileicon'); } } @@ -75,12 +76,12 @@ /* -- Available operations -- */ switch ($op) { case "uploadfile"; - publisher_uploadFile(false, true, $false); + PublisherUtils::uploadFile(false, true, $false); exit; break; case "uploadanother"; - publisher_uploadFile(true, true, $false); + PublisherUtils::uploadFile(true, true, $false); exit; break; @@ -88,13 +89,10 @@ $fileid = isset($_GET['fileid']) ? $_GET['fileid'] : 0; $itemid = isset($_GET['itemid']) ? $_GET['itemid'] : 0; if (($fileid == 0) && ($itemid == 0)) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_NOITEMSELECTED); - exit(); + $xoops->redirect("javascript:history.go(-1)", 3, _AM_PUBLISHER_NOITEMSELECTED); } - publisher_cpHeader(); - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; - + PublisherUtils::cpHeader(); publisher_editFile(true, $fileid, $itemid); break; @@ -102,10 +100,11 @@ $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0; // Creating the file object + /* @var $fileObj PublisherFile */ if ($fileid != 0) { - $fileObj = $publisher->getHandler('file')->get($fileid); + $fileObj = $publisher->getFileHandler()->get($fileid); } else { - $fileObj = $publisher->getHandler('file')->create(); + $fileObj = $publisher->getFileHandler()->create(); } // Putting the values in the file object @@ -115,11 +114,11 @@ // Storing the file if (!$fileObj->store()) { - redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisher_formatErrors($fileObj->getErrors())); + $xoops->redirect('item.php?op=mod&itemid=' . $fileObj->getVar('itemid'), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . PublisherUtils::formatErrors($fileObj->getErrors())); exit; } - redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS); + $xoops->redirect('item.php?op=mod&itemid=' . $fileObj->getVar('itemid'), 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS); exit(); break; @@ -128,36 +127,30 @@ $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0; $fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : $fileid; - $fileObj = $publisher->getHandler('file')->get($fileid); + $fileObj = $publisher->getFileHandler()->get($fileid); $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; $title = isset($_POST['title']) ? $_POST['title'] : ''; if ($confirm) { - if (!$publisher->getHandler('file')->delete($fileObj)) { - redirect_header('item.php', 2, _AM_PUBLISHER_FILE_DELETE_ERROR); - exit; + if (!$publisher->getFileHandler()->delete($fileObj)) { + $xoops->redirect('item.php', 2, _AM_PUBLISHER_FILE_DELETE_ERROR); } - - redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->name())); - exit(); + $xoops->redirect('item.php', 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->getVar('name'))); } else { // no confirm: show deletion condition $fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : 0; - publisher_cpHeader(); - xoops_confirm(array('op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()), 'file.php', _AM_PUBLISHER_DELETETHISFILE . " <br />" . $fileObj->name() . " <br /> <br />", _AM_PUBLISHER_DELETE); - xoops_cp_footer(); + PublisherUtils::cpHeader(); + $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(); } - exit(); break; case "default": default: - publisher_cpHeader(); - //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); + PublisherUtils::cpHeader(); break; } -xoops_cp_footer(); -?> \ No newline at end of file +$xoops->footer(); \ No newline at end of file Modified: XoopsModules/publisher/trunk/publisher/admin/import/news.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/import/news.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/import/news.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -34,11 +34,10 @@ } if ($op == 'start') { - xoops_load('XoopsFormLoader'); - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + PublisherUtils::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("topics")); list ($totalCat) = $xoopsDB->fetchRow($result); @@ -92,20 +91,20 @@ } } - publisher_closeCollapsableBar('newsimport', 'newsimporticon'); - xoops_cp_footer(); + PublisherUtils::closeCollapsableBar('newsimport', 'newsimporticon'); + $xoops->footer(); } if ($op == 'go') { - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + PublisherUtils::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $module_handler = xoops_gethandler('module'); $moduleObj = $module_handler->getByDirname('news'); $news_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gperm_handler = $xoops->getHandlerGroupperm(); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -126,7 +125,7 @@ $newCat['oldid'] = $arrCat['topic_id']; $newCat['oldpid'] = $arrCat['topic_pid']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); $categoryObj->setVar('parentid', $arrCat['topic_pid']); $categoryObj->setVar('weight', 0); @@ -140,23 +139,23 @@ } } - if (!$publisher->getHandler('category')->insert($categoryObj)) { + if (!$publisher->getCategoryHandler()->insert($categoryObj)) { echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['topic_title']) . "<br/>"; continue; } - $newCat['newid'] = $categoryObj->categoryid(); + $newCat['newid'] = $categoryObj->getVar('categoryid'); $cnt_imported_cat++; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . "<br\>"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->getVar('name')) . "<br\>"; $sql = "SELECT * FROM " . $xoopsDB->prefix('stories') . " WHERE topicid=" . $arrCat['topic_id']; $resultArticles = $xoopsDB->query($sql); while ($arrArticle = $xoopsDB->fetchArray($resultArticles)) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj = $publisher->getItemHandler()->create(); - $itemObj->setVar('categoryid', $categoryObj->categoryid()); + $itemObj->setVar('categoryid', $categoryObj->getVar('categoryid')); $itemObj->setVar('title', $arrArticle['title']); $itemObj->setVar('uid', $arrArticle['uid']); $itemObj->setVar('summary', $arrArticle['hometext']); @@ -206,7 +205,7 @@ $fileObj->setVar('description', $arrFile['filedescript']); $fileObj->setVar('status', _PUBLISHER_STATUS_FILE_ACTIVE); $fileObj->setVar('uid', $arrArticle['uid']); - $fileObj->setVar('itemid', $itemObj->itemid()); + $fileObj->setVar('itemid', $itemObj->getVar('itemid')); $fileObj->setVar('mimetype', $arrFile['minetype']); $fileObj->setVar('datesub', $arrFile['date']); $fileObj->setVar('counter', $arrFile['counter']); @@ -219,7 +218,7 @@ } } */ - $newArticleArray[$arrArticle['storyid']] = $itemObj->itemid(); + $newArticleArray[$arrArticle['storyid']] = $itemObj->getVar('itemid'); echo " " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "<br />"; $cnt_imported_articles++; } @@ -228,9 +227,9 @@ // Saving category permissions $groupsIds = $gperm_handler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); - publisher_saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + PublisherUtils::saveCategoryPermissions($groupsIds, $categoryObj->getVar('categoryid'), 'category_read'); $groupsIds = $gperm_handler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id); - publisher_saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + PublisherUtils::saveCategoryPermissions($groupsIds, $categoryObj->getVar('categoryid'), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -247,7 +246,7 @@ } else { $newpid = $newCatArray[$oldpid]['newid']; } - $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria); + $publisher->getCategoryHandler()->updateAll('parentid', $newpid, $criteria); unset($criteria); } @@ -277,8 +276,8 @@ 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(); + PublisherUtils::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + $xoops->footer(); } ?> \ No newline at end of file Modified: XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -34,11 +34,10 @@ } if ($op == 'start') { - xoops_load('XoopsFormLoader'); - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + PublisherUtils::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("smartsection_categories")); list ($totalCat) = $xoopsDB->fetchRow($result); @@ -92,20 +91,20 @@ } } - publisher_closeCollapsableBar('newsimport', 'newsimporticon'); - xoops_cp_footer(); + PublisherUtils::closeCollapsableBar('newsimport', 'newsimporticon'); + $xoops->footer(); } if ($op == 'go') { - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + PublisherUtils::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $module_handler = xoops_gethandler('module'); $moduleObj = $module_handler->getByDirname('smartsection'); $smartsection_module_id = $moduleObj->getVar('mid'); - $gperm_handler = xoops_gethandler('groupperm'); + $gperm_handler = $xoops->getHandlerGroupperm(); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -126,7 +125,7 @@ $newCat['oldid'] = $arrCat['categoryid']; $newCat['oldpid'] = $arrCat['parentid']; - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); $categoryObj->setVars($arrCat); $categoryObj->setVar('categoryid', 0); @@ -136,26 +135,26 @@ copy(XOOPS_ROOT_PATH . "/uploads/smartsection/images/category/" . $arrCat['image'], XOOPS_ROOT_PATH . "/uploads/publisher/images/category/" . $arrCat['image']); } - if (!$publisher->getHandler('category')->insert($categoryObj)) { + if (!$publisher->getCategoryHandler()->insert($categoryObj)) { echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_ERROR, $arrCat['name']) . "<br/>"; continue; } - $newCat['newid'] = $categoryObj->categoryid(); + $newCat['newid'] = $categoryObj->getVar('categoryid'); $cnt_imported_cat++; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . "<br\>"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->getVar('name')) . "<br\>"; $sql = "SELECT * FROM " . $xoopsDB->prefix('smartsection_items') . " WHERE categoryid=" . $arrCat['categoryid']; $resultArticles = $xoopsDB->query($sql); while ($arrArticle = $xoopsDB->fetchArray($resultArticles)) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj = $publisher->getItemHandler()->create(); $itemObj->setVars($arrArticle); $itemObj->setVar('itemid', 0); - $itemObj->setVar('categoryid', $categoryObj->categoryid()); + $itemObj->setVar('categoryid', $categoryObj->getVar('categoryid')); // TODO: move article images to image manager @@ -187,7 +186,7 @@ $filename = XOOPS_ROOT_PATH . "/uploads/smartsection/" . $arrFile['filename']; if (file_exists($filename)) { if (copy($filename, XOOPS_ROOT_PATH . "/uploads/publisher/" . $arrFile['filename'])) { - $fileObj = $publisher->getHandler('file')->create(); + $fileObj = $publisher->getFileHandler()->create(); $fileObj->setVars($arrFile); $fileObj->setVar('fileid', 0); @@ -198,7 +197,7 @@ } } - $newArticleArray[$arrArticle['itemid']] = $itemObj->itemid(); + $newArticleArray[$arrArticle['itemid']] = $itemObj->getVar('itemid'); echo " " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "<br />"; $cnt_imported_articles++; } @@ -207,9 +206,9 @@ // Saving category permissions $groupsIds = $gperm_handler->getGroupIds('category_read', $arrCat['categoryid'], $smartsection_module_id); - publisher_saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + PublisherUtils::saveCategoryPermissions($groupsIds, $categoryObj->getVar('categoryid'), 'category_read'); $groupsIds = $gperm_handler->getGroupIds('item_submit', $arrCat['categoryid'], $smartsection_module_id); - publisher_saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + PublisherUtils::saveCategoryPermissions($groupsIds, $categoryObj->getVar('categoryid'), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -226,7 +225,7 @@ } else { $newpid = $newCatArray[$oldpid]['newid']; } - $publisher->getHandler('category')->updateAll('parentid', $newpid, $criteria); + $publisher->getCategoryHandler()->updateAll('parentid', $newpid, $criteria); unset($criteria); } @@ -256,8 +255,8 @@ 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(); + PublisherUtils::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + $xoops->footer(); } ?> \ No newline at end of file Modified: XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php 2012-12-12 22:08:20 UTC (rev 10372) +++ XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php 2012-12-12 23:26:38 UTC (rev 10373) @@ -34,11 +34,10 @@ } if ($op == 'start') { - xoops_load('XoopsFormLoader'); - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + PublisherUtils::openCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("wfs_category")); list ($totalCat) = $xoopsDB->fetchRow($result); @@ -90,14 +89,14 @@ } } - publisher_closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); - xoops_cp_footer(); + PublisherUtils::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); + $xoops->footer(); } if ($op == 'go') { - publisher_cpHeader(); + PublisherUtils::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + PublisherUtils::openCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -116,7 +115,7 @@ $newCatArray = array(); while ($arrCat = $xoopsDB->fetchArray($resultCat)) { - $categoryObj = $publisher->getHandler('category')->create(); + $categoryObj = $publisher->getCategoryHandler()->create(); $newCat = array(); @@ -145,22 +144,22 @@ continue; } - $newCat['newid'] = $categoryObj->categoryid(); + $newCat['newid'] = $categoryObj->getVar('categoryid'); // Saving category permissions - publisher_saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->categoryid(), 'item_submit'); + PublisherUtils::saveCategoryPermissions($categoryObj->getGroups_read(), $categoryObj->getVar('categoryid'), 'category_read'); + PublisherUtils::saveCategoryPermissions($categoryObj->getGroups_submit(), $categoryObj->getVar('categoryid'), 'item_submit'); $cnt_imported_cat++; - echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->name()) . "<br\>"; + echo sprintf(_AM_PUBLISHER_IMPORT_CATEGORY_SUCCESS, $categoryObj->getVar('name')) . "<br\>"; $sql = "SELECT * FROM " . $xoopsDB->prefix("wfs_article") . " WHERE categoryid=" . $arrCat['id'] . " ORDER BY weight"; $resultArticles = $xoopsDB->query($sql); while ($arrArticle = $xoopsDB->fetchArray($resultArticles)) { // insert article - $itemObj = $publisher->getHandler('item')->create(); + $itemObj = $publisher->getItemHandler()->create(); - $itemObj->setVar('categoryid', $categoryObj->categoryid()); + $itemObj->setVar('categoryid', $categoryOb... [truncated message content] |