From a93e21b420d14c01dc04360f33f77152769f7f14 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 25 Nov 2017 03:39:26 -0500 Subject: [PATCH] 1.06 Alpha, namespaces --- admin/admin_header.php | 10 +-- admin/category.php | 37 +++++------ admin/clone.php | 7 +- admin/file.php | 20 +++--- admin/import.php | 7 +- admin/import/ams.php | 21 +++--- admin/import/cjaycontent.php | 13 ++-- admin/import/fmcontent.php | 25 +++---- admin/import/news.php | 17 ++--- admin/import/smartsection.php | 17 ++--- admin/import/wfsection.php | 17 ++--- admin/import/xfsection.php | 17 ++--- admin/import/xnews.php | 21 +++--- admin/index.php | 14 ++-- admin/item.php | 42 ++++++------ admin/main.php | 28 ++++---- admin/menu.php | 4 +- admin/mimetypes.php | 40 ++++++------ admin/pagewrap.php | 12 ++-- admin/permissions.php | 32 +++++---- admin/preferences.php | 18 ++++-- admin/pw_delete_file.php | 3 +- admin/pw_upload_file.php | 6 +- archive.php | 2 +- author_items.php | 2 +- blocks/category_items_sel.php | 4 +- blocks/items_columns.php | 2 +- blocks/items_menu.php | 2 +- blocks/items_new.php | 4 +- blocks/items_recent.php | 4 +- blocks/items_spot.php | 6 +- blocks/latest_files.php | 5 +- blocks/latest_news.php | 10 +-- category.php | 3 +- class/{configurator.php => Configurator.php} | 12 ++-- class/{utility.php => Utility.php} | 39 ++++++----- class/category.php | 4 +- class/file.php | 14 ++-- class/form/category.php | 14 ++-- class/form/file.php | 4 +- class/form/item.php | 8 +-- class/item.php | 39 +++++------ class/permission.php | 4 +- docs/changelog.txt | 3 +- file.php | 9 ++- footer.php | 3 + include/ajax_rating.php | 4 +- include/ajax_upload.php | 8 ++- include/comment_functions.php | 2 +- include/common.php | 68 ++++++++++++++++++-- include/config.php | 11 +++- include/oninstall.php | 51 +++++++-------- include/onupdate.php | 56 +++++++--------- include/search.inc.php | 2 +- index.php | 3 +- item.php | 7 +- language/english/blocks.php | 4 +- language/english/common.php | 25 +++++++ makepdf.php | 11 ++-- print.php | 3 +- search.php | 1 + submit.php | 19 +++--- testdata/index.php | 8 ++- xoops_version.php | 6 +- 64 files changed, 534 insertions(+), 380 deletions(-) rename class/{configurator.php => Configurator.php} (91%) rename class/{utility.php => Utility.php} (97%) diff --git a/admin/admin_header.php b/admin/admin_header.php index f2ec712d..854949fe 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -18,16 +18,18 @@ * @author The SmartFactory */ + +use Xoopsmodules\publisher; + require_once __DIR__ . '/../../../include/cp_header.php'; //require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); -//require_once __DIR__ . '/../include/common.php'; - -require_once __DIR__ . '/../class/utility.php'; +require_once __DIR__ . '/../include/common.php'; +//require_once __DIR__ . '/../class/utility.php'; require_once __DIR__ . '/../include/config.php'; $moduleDirName = basename(dirname(__DIR__)); -$helper = \Xmf\Module\Helper::getHelper($moduleDirName); +$helper = publisher\Helper::getInstance(); $adminObject = \Xmf\Module\Admin::getInstance(); $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); diff --git a/admin/category.php b/admin/category.php index a79f8385..34168354 100644 --- a/admin/category.php +++ b/admin/category.php @@ -19,6 +19,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/admin_header.php'; @@ -56,8 +57,8 @@ $nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST'); //end of fx2024 code - PublisherUtility::cpHeader(); - PublisherUtility::editCategory(true, $categoryid, $nb_subcats); + publisher\Utility::cpHeader(); + publisher\Utility::editCategory(true, $categoryid, $nb_subcats); break; case 'addcategory': @@ -81,14 +82,14 @@ $max_size = $helper->getConfig('maximum_filesize'); $max_imgwidth = $helper->getConfig('maximum_image_width'); $max_imgheight = $helper->getConfig('maximum_image_height'); - $allowed_mimetypes = PublisherUtility::getAllowedImagesTypes(); + $allowed_mimetypes = publisher\Utility::getAllowedImagesTypes(); if (('' == $temp['tmp_name']) || !is_readable($temp['tmp_name'])) { redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); // exit(); } xoops_load('XoopsMediaUploader'); - $uploader = new XoopsMediaUploader(PublisherUtility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); + $uploader = new XoopsMediaUploader(publisher\Utility::getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); if ($uploader->fetchMedia($filename) && $uploader->upload()) { $categoryObj->setVar('image', $uploader->getSavedFileName()); } else { @@ -129,13 +130,13 @@ } if (!$categoryObj->store()) { - redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . PublisherUtility::formatErrors($categoryObj->getErrors())); + redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher\Utility::formatErrors($categoryObj->getErrors())); // exit; } // TODO : put this function in the category class - PublisherUtility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - PublisherUtility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - PublisherUtility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); //Added by fx2024 $parentCat = $categoryObj->categoryid(); @@ -149,13 +150,13 @@ $categoryObj->setVar('parentid', $parentCat); if (!$categoryObj->store()) { - redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . PublisherUtility::formatErrors($categoryObj->getErrors())); + redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher\Utility::formatErrors($categoryObj->getErrors())); // exit; } // TODO : put this function in the category class - PublisherUtility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - PublisherUtility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - PublisherUtility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); } } //end of fx2024 code @@ -177,8 +178,8 @@ $categoryObj->setVar('parentid', $parentCat); } - PublisherUtility::cpHeader(); - PublisherUtility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); + publisher\Utility::cpHeader(); + publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); exit(); break; //end of fx2024 code @@ -189,7 +190,7 @@ break; case 'default': default: - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); echo "
\n"; @@ -201,7 +202,7 @@ // Creating the objects for top categories $categoriesObj = $helper->getHandler('category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0); - PublisherUtility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); + publisher\Utility::openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); echo ""; echo ''; @@ -213,7 +214,7 @@ $totalCategories = $helper->getHandler('category')->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { - PublisherUtility::displayCategory($thiscat); + publisher\Utility::displayCategory($thiscat); } unset($key, $thiscat); } else { @@ -227,7 +228,7 @@ $pagenav = new XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '
' . $pagenav->renderNav() . '
'; echo '
'; - PublisherUtility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); echo '
'; //editcat(false); break; diff --git a/admin/clone.php b/admin/clone.php index 28719111..a607ac48 100644 --- a/admin/clone.php +++ b/admin/clone.php @@ -18,12 +18,13 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/admin_header.php'; -PublisherUtility::cpHeader(); +publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); -PublisherUtility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); +publisher\Utility::openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); if ('submit' === Request::getString('op', '', 'POST')) { if (!$GLOBALS['xoopsSecurity']->check()) { @@ -78,7 +79,7 @@ } // End of collapsable bar -PublisherUtility::closeCollapsableBar('clone', 'cloneicon'); +publisher\Utility::closeCollapsableBar('clone', 'cloneicon'); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/file.php b/admin/file.php index 6470b645..2eb8e105 100644 --- a/admin/file.php +++ b/admin/file.php @@ -48,14 +48,14 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) echo "
\n"; echo "" . _AM_PUBLISHER_FILE_EDITING . ''; echo '' . _AM_PUBLISHER_FILE_EDITING_DSC . ''; - PublisherUtility::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + publisher\Utility::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item $fileObj = $helper->getHandler('file')->create(); $fileObj->setVar('itemid', $itemid); echo "" . _AM_PUBLISHER_FILE_ADDING . ''; echo '' . _AM_PUBLISHER_FILE_ADDING_DSC . ''; - PublisherUtility::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + publisher\Utility::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM @@ -63,9 +63,9 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) $uploadForm->display(); if (0 != $fileid) { - PublisherUtility::closeCollapsableBar('editfile', 'editfileicon'); + publisher\Utility::closeCollapsableBar('editfile', 'editfileicon'); } else { - PublisherUtility::closeCollapsableBar('addfile', 'addfileicon'); + publisher\Utility::closeCollapsableBar('addfile', 'addfileicon'); } } @@ -73,12 +73,12 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) /* -- Available operations -- */ switch ($op) { case 'uploadfile': - PublisherUtility::uploadFile(false, true, $false); + publisher\Utility::uploadFile(false, true, $false); exit; break; case 'uploadanother': - PublisherUtility::uploadFile(true, true, $false); + publisher\Utility::uploadFile(true, true, $false); exit; break; @@ -90,7 +90,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) // exit(); } - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); publisher_editFile(true, $fileid, $itemid); @@ -113,7 +113,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) // Storing the file if (!$fileObj->store()) { - redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . PublisherUtility::formatErrors($fileObj->getErrors())); + redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid() . '#tab_2', 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisher\Utility::formatErrors($fileObj->getErrors())); // exit; } @@ -142,7 +142,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) // no confirm: show deletion condition $fileid = Request::getInt('fileid', 0, 'GET'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); xoops_confirm(['op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()], 'file.php', _AM_PUBLISHER_DELETETHISFILE . '
' . $fileObj->name() . '

', _AM_PUBLISHER_DELETE); xoops_cp_footer(); } @@ -152,7 +152,7 @@ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) case 'default': default: - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); break; } diff --git a/admin/import.php b/admin/import.php index e83fb669..6c785e9a 100644 --- a/admin/import.php +++ b/admin/import.php @@ -19,6 +19,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/admin_header.php'; @@ -35,10 +36,10 @@ default: $importfile = 'none'; - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('import', 'importicon', _AM_PUBLISHER_IMPORT_TITLE, _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('import', 'importicon', _AM_PUBLISHER_IMPORT_TITLE, _AM_PUBLISHER_IMPORT_INFO); xoops_load('XoopsFormLoader'); /* @var $moduleHandler XoopsModuleHandler */ @@ -173,7 +174,7 @@ // End of collapsable bar - PublisherUtility::closeCollapsableBar('import', 'importicon'); + publisher\Utility::closeCollapsableBar('import', 'importicon'); break; } diff --git a/admin/import/ams.php b/admin/import/ams.php index 62973510..381c7f1f 100644 --- a/admin/import/ams.php +++ b/admin/import/ams.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -33,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('ams_topics')); list($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -152,15 +153,15 @@ } } - PublisherUtility::closeCollapsableBar('amsimport', 'amsimporticon'); + publisher\Utility::closeCollapsableBar('amsimport', 'amsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); require_once dirname(dirname(__DIR__)) . '/include/common.php'; - PublisherUtility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); /* @var $moduleHandler XoopsModuleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('ams'); @@ -263,7 +264,7 @@ $src = $GLOBALS['xoops']->path('uploads/AMS/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); - PublisherUtility::recurseCopy($src, $dst); + publisher\Utility::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -383,12 +384,12 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $ams_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('nw_submit', $arrCat['topic_id'], $ams_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $groupsIds = $gpermHandler->getGroupIds('nw_approve', $arrCat['topic_id'], $ams_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -438,6 +439,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('amsimportgo', 'amsimportgoicon'); + publisher\Utility::closeCollapsableBar('amsimportgo', 'amsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php index 3669a94d..4b1d1ea6 100644 --- a/admin/import/cjaycontent.php +++ b/admin/import/cjaycontent.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -53,9 +54,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('cjaycontentimport', 'cjaycontentimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('cjaycontentimport', 'cjaycontentimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('cjaycontent')); list($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -78,15 +79,15 @@ } // } - PublisherUtility::closeCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); + publisher\Utility::closeCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); require_once dirname(dirname(__DIR__)) . '/include/common.php'; - PublisherUtility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); /* @var $moduleHandler XoopsModuleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('cjaycontent'); @@ -182,6 +183,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); + publisher\Utility::closeCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index 023ef802..5f2e9b8d 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -21,6 +21,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -34,9 +35,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); /* @var $moduleHandler XoopsModuleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('fmcontent'); @@ -96,8 +97,8 @@ $catObjs = $categoryHdlr->getAll(); $myObjTree = new XoopsObjectTree($catObjs, 'categoryid', 'parentid'); $moduleDirName = basename(dirname(__DIR__)); - $module = XoopsModule::getByDirname($moduleDirName); - if (PublisherUtility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { + $module = \XoopsModule::getByDirname($moduleDirName); + if (publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); //$form->addElement($catSelBox); } else { @@ -125,14 +126,14 @@ } } - PublisherUtility::closeCollapsableBar('fmimport', 'fmimporticon'); + publisher\Utility::closeCollapsableBar('fmimport', 'fmimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('fmcontent'); @@ -218,9 +219,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); unset($fmContentObjs, $itemObj, $categoryObj, $thisFmContentObj); echo "
\n"; @@ -314,9 +315,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('fmcontent_submit', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$CatIds['oldid']] = $CatIds; unset($CatIds, $thisFmContentObj); @@ -372,6 +373,6 @@ . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
\n"; - PublisherUtility::closeCollapsableBar('fmimportgo', 'fmimportgoicon'); + publisher\Utility::closeCollapsableBar('fmimportgo', 'fmimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/news.php b/admin/import/news.php index 190bd0fe..2d63f5a9 100644 --- a/admin/import/news.php +++ b/admin/import/news.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -33,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('news_topics')); list($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -89,14 +90,14 @@ } } - PublisherUtility::closeCollapsableBar('newsimport', 'newsimporticon'); + publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); /* @var $moduleHandler XoopsModuleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('news'); @@ -227,9 +228,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('news_submit', $arrCat['topic_id'], $news_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -278,6 +279,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php index 858d7b51..d458d7a0 100644 --- a/admin/import/smartsection.php +++ b/admin/import/smartsection.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -33,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('newsimport', 'newsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('smartsection_categories')); list($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -89,14 +90,14 @@ } } - PublisherUtility::closeCollapsableBar('newsimport', 'newsimporticon'); + publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); /* @var $moduleHandler XoopsModuleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('smartsection'); @@ -202,9 +203,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('category_read', $arrCat['categoryid'], $smartsection_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('item_submit', $arrCat['categoryid'], $smartsection_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -253,6 +254,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php index 0bc94b1c..05912453 100644 --- a/admin/import/wfsection.php +++ b/admin/import/wfsection.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -33,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('wfsectionimport', 'wfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('wfs_category')); list($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -87,14 +88,14 @@ } } - PublisherUtility::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); + publisher\Utility::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -144,8 +145,8 @@ $newCat['newid'] = $categoryObj->categoryid(); // Saving category permissions - PublisherUtility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); - PublisherUtility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); ++$cnt_imported_cat; @@ -270,6 +271,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); + publisher\Utility::closeCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php index 25ccc97d..5c7512cb 100644 --- a/admin/import/xfsection.php +++ b/admin/import/xfsection.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -33,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('xfsectionimport', 'xfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('xfsectionimport', 'xfsectionimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xfs_category')); list($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -87,14 +88,14 @@ } } - PublisherUtility::closeCollapsableBar('xfsectionimport', 'xfsectionimporticon'); + publisher\Utility::closeCollapsableBar('xfsectionimport', 'xfsectionimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $cnt_imported_cat = 0; $cnt_imported_articles = 0; @@ -137,8 +138,8 @@ $newCat['newid'] = $categoryObj->categoryid(); // Saving category permissions - PublisherUtility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); - PublisherUtility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsSubmit(), $categoryObj->categoryid(), 'item_submit'); ++$cnt_imported_cat; @@ -269,6 +270,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); + publisher\Utility::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/xnews.php b/admin/import/xnews.php index 3abdcba9..8ffec055 100644 --- a/admin/import/xnews.php +++ b/admin/import/xnews.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); @@ -33,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - PublisherUtility::openCollapsableBar('xnewsimport', 'xnewsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisher\Utility::openCollapsableBar('xnewsimport', 'xnewsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('nw_topics')); list($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -153,15 +154,15 @@ } } - PublisherUtility::closeCollapsableBar('xnewsimport', 'xnewsimporticon'); + publisher\Utility::closeCollapsableBar('xnewsimport', 'xnewsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); require_once dirname(dirname(__DIR__)) . '/include/common.php'; - PublisherUtility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); + publisher\Utility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); /* @var $moduleHandler XoopsModuleHandler */ $moduleHandler = xoops_getHandler('module'); $moduleObj = $moduleHandler->getByDirname('xnews'); @@ -262,7 +263,7 @@ //copy all images to Image Manager $src = $GLOBALS['xoops']->path('uploads/xnews/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); - PublisherUtility::recurseCopy($src, $dst); + publisher\Utility::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -382,12 +383,12 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $xnews_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('nw_submit', $arrCat['topic_id'], $xnews_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $groupsIds = $gpermHandler->getGroupIds('nw_approve', $arrCat['topic_id'], $xnews_module_id); - PublisherUtility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); + publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -437,6 +438,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - PublisherUtility::closeCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); + publisher\Utility::closeCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/index.php b/admin/index.php index 6b431113..8b8858a0 100644 --- a/admin/index.php +++ b/admin/index.php @@ -19,16 +19,19 @@ * @author Mage, Mamba */ +use Xoopsmodules\publisher; + require_once __DIR__ . '/admin_header.php'; -require_once dirname(__DIR__) . '/class/utility.php'; +//require_once dirname(__DIR__) . '/class/utility.php'; xoops_cp_header(); -xoops_loadLanguage('main', PUBLISHER_DIRNAME); +$helper = publisher\Helper::getInstance(); +$helper->loadLanguage('main'); $adminObject = \Xmf\Module\Admin::getInstance(); /* foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - PublisherUtility::createFolder($uploadFolders[$i]); + publisher\Utility::createFolder($uploadFolders[$i]); $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder'); // $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); } @@ -37,7 +40,7 @@ $file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; foreach (array_keys($copyFiles) as $i) { $dest = $copyFiles[$i] . '/blank.png'; - PublisherUtility::copyFile($file, $dest); + publisher\Utility::copyFile($file, $dest); } */ @@ -57,4 +60,7 @@ //------------- End Test Data ---------------------------- $adminObject->displayIndex(); + +echo publisher\Utility::getServerStats(); + require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/item.php b/admin/item.php index a56bb5c2..7078947f 100644 --- a/admin/item.php +++ b/admin/item.php @@ -52,7 +52,7 @@ // exit(); } } - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); publisher_editItem(true, $itemid, true); break; @@ -65,7 +65,7 @@ } } - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); publisher_editItem(true, $itemid); break; @@ -122,13 +122,13 @@ // Storing the item if (!$itemObj->store()) { - redirect_header('javascript:history.go(-1)', 3, $error_msg . PublisherUtility::formatErrors($itemObj->getErrors())); + redirect_header('javascript:history.go(-1)', 3, $error_msg . publisher\Utility::formatErrors($itemObj->getErrors())); // exit; } // attach file if any if (($item_upload_file = Request::getArray('item_upload_file', '', 'FILES')) && '' !== $item_upload_file['name']) { - $file_upload_result = PublisherUtility::uploadFile(false, false, $itemObj); + $file_upload_result = publisher\Utility::uploadFile(false, false, $itemObj); if (true !== $file_upload_result) { redirect_header('javascript:history.go(-1)', 3, $file_upload_result); // exit; @@ -150,7 +150,7 @@ if ($confirm) { if (!$helper->getHandler('item')->delete($itemObj)) { - redirect_header('item.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . PublisherUtility::formatErrors($itemObj->getErrors())); + redirect_header('item.php', 2, _AM_PUBLISHER_ITEM_DELETE_ERROR . publisher\Utility::formatErrors($itemObj->getErrors())); // exit(); } redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_ITEMISDELETED, $itemObj->getTitle())); @@ -165,7 +165,7 @@ case 'default': default: - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); xoops_load('XoopsPageNav'); @@ -178,7 +178,7 @@ $ascOrDesc = 'DESC'; // Display Submited articles - PublisherUtility::openCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP); + publisher\Utility::openCollapsableBar('submiteditemstable', 'submiteditemsicon', _AM_PUBLISHER_SUBMISSIONSMNGMT, _AM_PUBLISHER_SUBMITTED_EXP); // Get the total number of submitted ITEM $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_SUBMITTED]); @@ -226,10 +226,10 @@ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $submittedstartitem, 'submittedstartitem'); echo '
' . $pagenav->renderNav() . '
'; - PublisherUtility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon'); + publisher\Utility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon'); // Display Published articles - PublisherUtility::openCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon', _AM_PUBLISHER_PUBLISHEDITEMS, _AM_PUBLISHER_PUBLISHED_DSC); + publisher\Utility::openCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon', _AM_PUBLISHER_PUBLISHEDITEMS, _AM_PUBLISHER_PUBLISHED_DSC); // Get the total number of published ITEM $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]); @@ -278,10 +278,10 @@ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $publishedstartitem, 'publishedstartitem'); echo '
' . $pagenav->renderNav() . '
'; - PublisherUtility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); + publisher\Utility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); // Display Offline articles - PublisherUtility::openCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . ' ' . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP); + publisher\Utility::openCollapsableBar('offlineitemstable', 'offlineitemsicon', _AM_PUBLISHER_ITEMS . ' ' . _CO_PUBLISHER_OFFLINE, _AM_PUBLISHER_OFFLINE_EXP); $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_OFFLINE]); @@ -330,10 +330,10 @@ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $offlinestartitem, 'offlinestartitem'); echo '
' . $pagenav->renderNav() . '
'; - PublisherUtility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon'); + publisher\Utility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon'); // Display Rejected articles - PublisherUtility::openCollapsableBar('Rejecteditemstable', 'rejecteditemsicon', _AM_PUBLISHER_REJECTED_ITEM, _AM_PUBLISHER_REJECTED_ITEM_EXP, _AM_PUBLISHER_SUBMITTED_EXP); + publisher\Utility::openCollapsableBar('Rejecteditemstable', 'rejecteditemsicon', _AM_PUBLISHER_REJECTED_ITEM, _AM_PUBLISHER_REJECTED_ITEM_EXP, _AM_PUBLISHER_SUBMITTED_EXP); // Get the total number of Rejected ITEM $totalitems = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]); @@ -380,7 +380,7 @@ $pagenav = new XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $rejectedstartitem, 'rejectedstartitem'); echo '
' . $pagenav->renderNav() . '
'; - PublisherUtility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon'); + publisher\Utility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon'); break; } require_once __DIR__ . '/admin_footer.php'; @@ -478,7 +478,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $categoryObj = $itemObj->getCategory(); echo "
\n"; - PublisherUtility::openCollapsableBar('edititemtable', 'edititemicon', $pageTitle, $pageInfo); + publisher\Utility::openCollapsableBar('edititemtable', 'edititemicon', $pageTitle, $pageInfo); if ($clone) { echo '
'; @@ -499,7 +499,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $categoryObj->setVar('categoryid', Request::getInt('categoryid', 0, 'GET')); - PublisherUtility::openCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC); + publisher\Utility::openCollapsableBar('createitemtable', 'createitemicon', _AM_PUBLISHER_ITEM_CREATING, _AM_PUBLISHER_ITEM_CREATING_DSC); } $sform = $itemObj->getForm(_AM_PUBLISHER_ITEMS); @@ -507,11 +507,11 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $sform->assign($formTpl); $formTpl->display('db:publisher_submit.tpl'); - PublisherUtility::closeCollapsableBar('edititemtable', 'edititemicon'); + publisher\Utility::closeCollapsableBar('edititemtable', 'edititemicon'); - PublisherUtility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); + publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); - $dir = PublisherUtility::getUploadDir(true, 'content'); + $dir = publisher\Utility::getUploadDir(true, 'content'); if (!is_writable($dir)) { echo "

" . _AM_PUBLISHER_PERMERROR . '

'; @@ -530,7 +530,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) // Delete File $form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); - $pWrapSelect = new XoopsFormSelect(PublisherUtility::getUploadDir(true, 'content'), 'address'); + $pWrapSelect = new XoopsFormSelect(publisher\Utility::getUploadDir(true, 'content'), 'address'); $folder = dir($dir); while (false !== ($file = $folder->read())) { if ('.' !== $file && '..' !== $file) { @@ -548,5 +548,5 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $form->addElement(new XoopsFormHidden('backto', $publisherCurrentPage)); $form->display(); - PublisherUtility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); + publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); } diff --git a/admin/main.php b/admin/main.php index fae5e74d..a3c8151b 100644 --- a/admin/main.php +++ b/admin/main.php @@ -19,11 +19,13 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/admin_header.php'; require_once $GLOBALS['xoops']->path('class/xoopslists.php'); require_once $GLOBALS['xoops']->path('class/pagenav.php'); -require_once __DIR__ . '/../class/utility.php'; +//require_once __DIR__ . '/../class/utility.php'; +require_once __DIR__ . '/../include/common.php'; $itemid = Request::getInt('itemid', 0, 'POST'); @@ -41,7 +43,7 @@ $startentry = Request::getInt('startentry', 0, 'GET'); -PublisherUtility::cpHeader(); +publisher\Utility::cpHeader(); //publisher_adminMenu(0, _AM_PUBLISHER_INDEX); // Total ITEMs -- includes everything on the table @@ -63,15 +65,15 @@ $totalrejected = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]); // Check Path Configuration -if ((PublisherUtility::getPathStatus('root', true) < 0) - || (PublisherUtility::getPathStatus('images', true) < 0) - || (PublisherUtility::getPathStatus('images/category', true) < 0) - || (PublisherUtility::getPathStatus('images/item', true) < 0) - || (PublisherUtility::getPathStatus('content', true) < 0)) { - PublisherUtility::createDir(); +if ((publisher\Utility::getPathStatus('root', true) < 0) + || (publisher\Utility::getPathStatus('images', true) < 0) + || (publisher\Utility::getPathStatus('images/category', true) < 0) + || (publisher\Utility::getPathStatus('images/item', true) < 0) + || (publisher\Utility::getPathStatus('content', true) < 0)) { + publisher\Utility::createDir(); } -PublisherUtility::openCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); +publisher\Utility::openCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); echo '
'; echo "
"; echo "'; @@ -86,10 +88,10 @@ echo "  "; echo ''; -PublisherUtility::closeCollapsableBar('inventorytable', 'inventoryicon'); +publisher\Utility::closeCollapsableBar('inventorytable', 'inventoryicon'); // Construction of lower table -PublisherUtility::openCollapsableBar('allitemstable', 'allitemsicon', _AM_PUBLISHER_ALLITEMS, _AM_PUBLISHER_ALLITEMSMSG); +publisher\Utility::openCollapsableBar('allitemstable', 'allitemsicon', _AM_PUBLISHER_ALLITEMS, _AM_PUBLISHER_ALLITEMSMSG); $showingtxt = ''; $selectedtxt = ''; @@ -241,7 +243,7 @@ $totalItemsOnPage = count($itemsObj); -PublisherUtility::buildTableItemTitleRow(); +publisher\Utility::buildTableItemTitleRow(); if ($numrows > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { @@ -356,7 +358,7 @@ echo '
' . $pagenav->renderNav() . '
'; } // ENDs code to show active entries -PublisherUtility::closeCollapsableBar('allitemstable', 'allitemsicon'); +publisher\Utility::closeCollapsableBar('allitemstable', 'allitemsicon'); // Close the collapsable div require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index ef53883e..0e33da25 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -22,12 +22,12 @@ use Xoopsmodules\publisher; -//require_once __DIR__ . '/../class/Helper.php'; +require_once __DIR__ . '/../class/Helper.php'; //require_once __DIR__ . '/../include/common.php'; $moduleDirName = basename(dirname(__DIR__)); -$helper = publisher\Helper::getInstance(); +$helper = \Xoopsmodules\publisher\Helper::getInstance(); $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); diff --git a/admin/mimetypes.php b/admin/mimetypes.php index 280644de..4f222907 100644 --- a/admin/mimetypes.php +++ b/admin/mimetypes.php @@ -98,10 +98,10 @@ public static function add() global $limit, $start; $error = []; if (!Request::getString('add_mime', '', 'POST')) { - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); - PublisherUtility::openCollapsableBar('mimemaddtable', 'mimeaddicon', _AM_PUBLISHER_MIME_ADD_TITLE); + publisher\Utility::openCollapsableBar('mimemaddtable', 'mimeaddicon', _AM_PUBLISHER_MIME_ADD_TITLE); $session = PublisherSession::getInstance(); $mimeType = $session->get('publisher_addMime'); @@ -109,7 +109,7 @@ public static function add() //Display any form errors if (false === !$mimeErrors) { - PublisherUtility::renderErrors($mimeErrors, PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession'])); + publisher\Utility::renderErrors($mimeErrors, publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearAddSession'])); } if (false === $mimeType) { @@ -179,7 +179,7 @@ public static function add() echo '
" . _AM_PUBLISHER_TOTALCAT . "" . $totalcategories . '
'; - PublisherUtility::closeCollapsableBar('mimeaddtable', 'mimeaddicon'); + publisher\Utility::closeCollapsableBar('mimeaddtable', 'mimeaddicon'); xoops_cp_footer(); } else { @@ -216,7 +216,7 @@ public static function add() $mime['mime_user'] = $mimeUser; $session->set('publisher_addMime', $mime); $session->set('publisher_addMimeErr', $error); - header('Location: ' . PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); + header('Location: ' . publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); } $mimeType = $helper->getHandler('mimetype')->create(); @@ -273,14 +273,14 @@ public static function edit() $mimeErrors = $session->get('publisher_editMimeErr_' . $mimeId); // Display header - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_EDIT); - PublisherUtility::openCollapsableBar('mimemedittable', 'mimeediticon', _AM_PUBLISHER_MIME_EDIT_TITLE); + publisher\Utility::openCollapsableBar('mimemedittable', 'mimeediticon', _AM_PUBLISHER_MIME_EDIT_TITLE); //Display any form errors if (false === !$mimeErrors) { - PublisherUtility::renderErrors($mimeErrors, PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId])); + publisher\Utility::renderErrors($mimeErrors, publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'clearEditSession', 'id' => $mimeId])); } if (false === $mimeType) { @@ -339,7 +339,7 @@ public static function edit() "; echo ''; // end of edit form - PublisherUtility::closeCollapsableBar('mimeedittable', 'mimeediticon'); + publisher\Utility::closeCollapsableBar('mimeedittable', 'mimeediticon'); // xoops_cp_footer(); require_once __DIR__ . '/admin_footer.php'; } else { @@ -378,7 +378,7 @@ public static function edit() $mime['mime_user'] = $mimeUser; $session->set('publisher_editMime_' . $mimeId, $mime); $session->set('publisher_editMimeErr_' . $mimeId, $error); - header('Location: ' . PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false)); + header('Location: ' . publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeId], false)); } $mimeTypeObj->setVar('mime_ext', Request::getString('mime_ext', '', 'POST')); @@ -399,6 +399,8 @@ public static function edit() public static function manage() { $helper = publisher\Helper::getInstance(); + /** @var \Xoopsmodules\publisher\Utility $utility */ + $utility = new publisher\Utility(); global $imagearray, $start, $limit, $aSortBy, $aOrderBy, $aLimitBy, $aSearchBy; if (Request::getString('deleteMimes', '', 'POST')) { @@ -423,9 +425,9 @@ public static function manage() // exit(); } - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); ////publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); - PublisherUtility::openCollapsableBar('mimemanagetable', 'mimemanageicon', _AM_PUBLISHER_MIME_MANAGE_TITLE, _AM_PUBLISHER_MIME_INFOTEXT); + publisher\Utility::openCollapsableBar('mimemanagetable', 'mimemanageicon', _AM_PUBLISHER_MIME_MANAGE_TITLE, _AM_PUBLISHER_MIME_INFOTEXT); $crit = new CriteriaCompo(); $order = Request::getString('order', 'ASC', 'POST'); $sort = Request::getString('sort', 'mime_ext', 'POST'); @@ -532,7 +534,7 @@ public static function manage() echo ''; echo "
" . $nav->renderNav() . '

'; - PublisherUtility::closeCollapsableBar('mimemanagetable', 'mimemanageicon'); + publisher\Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon'); // xoops_cp_footer(); require_once __DIR__ . '/admin_footer.php'; @@ -563,10 +565,10 @@ public static function search() $order = Request::getString('order', 'ASC'); $sort = Request::getString('sort', 'mime_name'); - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH); - PublisherUtility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH); + publisher\Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH); if (!Request::hasVar('mime_search')) { echo "
"; @@ -714,7 +716,7 @@ public static function search() echo ''; echo "'; } - PublisherUtility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); + publisher\Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); // require_once __DIR__ . '/admin_footer.php'; xoops_cp_footer(); } @@ -725,7 +727,7 @@ public static function search() public static function updateMimeValue() { // op=updateMimeValue&id=65&mime_admin=0&limit=15&start=0 - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); $hiddens = [ 'id' => Request::getInt('id', 0, 'GET'), 'start' => Request::getInt('start', 0, 'GET'), @@ -802,7 +804,7 @@ protected static function clearAddSessionVars() public static function clearAddSession() { self::clearAddSessionVars(); - header('Location: ' . PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); + header('Location: ' . publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); } /** @@ -820,6 +822,6 @@ public static function clearEditSession() { $mimeid = Request::getInt('id', '', 'GET'); self::clearEditSessionVars($mimeid); - header('Location: ' . PublisherUtility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeid], false)); + header('Location: ' . publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'edit', 'id' => $mimeid], false)); } } diff --git a/admin/pagewrap.php b/admin/pagewrap.php index 8f13f452..1be6e44b 100644 --- a/admin/pagewrap.php +++ b/admin/pagewrap.php @@ -18,14 +18,16 @@ * @author The SmartFactory */ +use Xoopsmodules\publisher; + require_once __DIR__ . '/admin_header.php'; -PublisherUtility::cpHeader(); +publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_ITEMS . " > " . _AM_PUBLISHER_PAGEWRAP); -PublisherUtility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); +publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); -$dir = PublisherUtility::getUploadDir(true, 'content'); +$dir = publisher\Utility::getUploadDir(true, 'content'); if (false !== strpos(decoct(fileperms($dir)), '777')) { echo "

" . _AM_PUBLISHER_PERMERROR . '

'; @@ -43,7 +45,7 @@ // Delete File $form = new XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); -$pWrapSelect = new XoopsFormSelect(PublisherUtility::getUploadDir(true, 'content'), 'address'); +$pWrapSelect = new XoopsFormSelect(publisher\Utility::getUploadDir(true, 'content'), 'address'); $folder = dir($dir); while ($file == $folder->read()) { if ('.' !== $file && '..' !== $file) { @@ -59,6 +61,6 @@ $form->addElement($submit); $form->display(); -PublisherUtility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); +publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/permissions.php b/admin/permissions.php index 96f5a378..65a2f18e 100644 --- a/admin/permissions.php +++ b/admin/permissions.php @@ -18,17 +18,21 @@ * @author The SmartFactory */ +use Xoopsmodules\publisher; + require_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/../include/common.php'; require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); $myts = MyTextSanitizer::getInstance(); -PublisherUtility::cpHeader(); +publisher\Utility::cpHeader(); //publisher_adminMenu(3, _AM_PUBLISHER_PERMISSIONS); +$helper = publisher\Helper::getInstance(); // View Categories permissions $item_list_view = []; $block_view = []; -PublisherUtility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS); +publisher\Utility::openCollapsableBar('permissionstable_view', 'permissionsicon_view', _AM_PUBLISHER_PERMISSIONSVIEWMAN, _AM_PUBLISHER_VIEW_CATS); $result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { @@ -40,11 +44,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -PublisherUtility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view'); +publisher\Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view'); // Submit Categories permissions echo "
\n"; -PublisherUtility::openCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC); +publisher\Utility::openCollapsableBar('permissionstable_submit', 'permissionsicon_submit', _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT, _AM_PUBLISHER_PERMISSIONS_CAT_SUBMIT_DSC); $result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { $form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'item_submit', '', 'admin/permissions.php'); @@ -55,11 +59,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -PublisherUtility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit'); +publisher\Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit'); // Moderators Categories permissions echo "
\n"; -PublisherUtility::openCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC); +publisher\Utility::openCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation', _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR, _AM_PUBLISHER_PERMISSIONS_CAT_MODERATOR_DSC); $result_view = $GLOBALS['xoopsDB']->query('SELECT categoryid, name FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_categories') . ' '); if ($GLOBALS['xoopsDB']->getRowsNum($result_view)) { $form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'category_moderation', '', 'admin/permissions.php'); @@ -70,11 +74,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -PublisherUtility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation'); +publisher\Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation'); // Form permissions echo "
\n"; -PublisherUtility::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC); +publisher\Utility::openCollapsableBar('permissionstable_form', 'permissionsicon_form', _AM_PUBLISHER_PERMISSIONS_FORM, _AM_PUBLISHER_PERMISSIONS_FORM_DSC); $form_options = [ PublisherConstants::PUBLISHER_SUMMARY => _AM_PUBLISHER_SUMMARY, //PublisherConstants::PUBLISHER_DISPLAY_SUMMARY => _CO_PUBLISHER_DISPLAY_SUMMARY, @@ -109,23 +113,23 @@ } unset($key, $value); echo $form_submit->render(); -PublisherUtility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); +publisher\Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); // Editors permissions echo "
\n"; -PublisherUtility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); -$editors = PublisherUtility::getEditors(); +publisher\Utility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); +$editors = publisher\Utility::getEditors(); $form_submit = new XoopsGroupPermForm('', $helper->getModule()->mid(), 'editors', '', 'admin/permissions.php'); foreach ($editors as $key => $value) { $form_submit->addItem($key, $value['title']); } unset($key, $value); echo $form_submit->render(); -PublisherUtility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); +publisher\Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); // Global permissions echo "
\n"; -PublisherUtility::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC); +publisher\Utility::openCollapsableBar('permissionstable_global', 'permissionsicon_global', _AM_PUBLISHER_PERMISSIONS_GLOBAL, _AM_PUBLISHER_PERMISSIONS_GLOBAL_DSC); $form_options = [ PublisherConstants::PUBLISHER_SEARCH => _AM_PUBLISHER_SEARCH, PublisherConstants::PUBLISHER_RATE => _AM_PUBLISHER_RATE @@ -136,6 +140,6 @@ } unset($key, $value); echo $form_submit->render(); -PublisherUtility::closeCollapsableBar('permissionstable_global', 'permissionsicon_global'); +publisher\Utility::closeCollapsableBar('permissionstable_global', 'permissionsicon_global'); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/preferences.php b/admin/preferences.php index 15a6dcf4..c7379200 100644 --- a/admin/preferences.php +++ b/admin/preferences.php @@ -19,12 +19,20 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/admin_header.php'; +$helper = publisher\Helper::getInstance(); + $module = $helper->getModule(); -$mod = $module->mid(); +$modId = $module->mid(); $modname = $module->name(); +$dirName = $helper->getDirname(); + +$moduleHandler = xoops_getHandler('module'); +$xoopsModule0 = $moduleHandler->getByDirname(basename(dirname(__DIR__))); +global $xoopsModule; xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/preferences', 'system'); @@ -44,7 +52,7 @@ if ('showmod' === $op) { $configHandler = xoops_getHandler('config'); - $config = $configHandler->getConfigs(new Criteria('conf_modid', $mod)); + $config = $configHandler->getConfigs(new Criteria('conf_modid', $modId)); $count = count($config); if ($count < 1) { redirect_header($module->getInfo('adminindex'), 1); @@ -169,7 +177,7 @@ unset($ele, $hidden); } - PublisherUtility::cpHeader(); + publisher\Utility::cpHeader(); //publisher_adminMenu(5, _PREFERENCES); foreach ($config_cats as $formCat => $info) { if ('others' === $formCat && !$cat_others_used) { @@ -177,9 +185,9 @@ } $$formCat->addElement(new XoopsFormHidden('op', 'save')); $$formCat->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); - PublisherUtility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); + publisher\Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); $$formCat->display(); - PublisherUtility::closeCollapsableBar($formCat . '_table', $formCat . '_icon'); + publisher\Utility::closeCollapsableBar($formCat . '_table', $formCat . '_icon'); } unset($formCat, $info); xoops_cp_footer(); diff --git a/admin/pw_delete_file.php b/admin/pw_delete_file.php index 76e5eac4..eb3c6272 100644 --- a/admin/pw_delete_file.php +++ b/admin/pw_delete_file.php @@ -20,6 +20,7 @@ use Xmf\Assert; use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/admin_header.php'; @@ -28,7 +29,7 @@ redirect_header(XOOPS_URL . '/modules/publisher/admin/item.php', 3, _AM_PUBLISHER_FILE_DELETE_ERROR); } - $dir = PublisherUtility::getUploadDir(true, 'content'); + $dir = publisher\Utility::getUploadDir(true, 'content'); $check_path = realpath($dir); $filename = Request::getString('address', '', 'POST'); diff --git a/admin/pw_upload_file.php b/admin/pw_upload_file.php index c466b316..c8fc4e36 100644 --- a/admin/pw_upload_file.php +++ b/admin/pw_upload_file.php @@ -50,11 +50,11 @@ function publisher_pagewrap_upload(&$errors) $maxImageWidth = $helper->getConfig('maximum_image_width'); $maxImageHeight = $helper->getConfig('maximum_image_height'); - if (!is_dir(PublisherUtility::getUploadDir(true, 'content'))) { - mkdir(PublisherUtility::getUploadDir(true, 'content'), 0757); + if (!is_dir(publisher\Utility::getUploadDir(true, 'content'))) { + mkdir(publisher\Utility::getUploadDir(true, 'content'), 0757); } $allowedMimeTypes = ['text/html', 'text/plain', 'application/xhtml+xml']; - $uploader = new XoopsMediaUploader(PublisherUtility::getUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight); + $uploader = new XoopsMediaUploader(publisher\Utility::getUploadDir(true, 'content') . '/', $allowedMimeTypes, $maxFileSize, $maxImageWidth, $maxImageHeight); if ($uploader->fetchMedia($postField)) { $uploader->setTargetFileName($uploader->getMediaName()); if ($uploader->upload()) { diff --git a/archive.php b/archive.php index 440f123f..57ccdb3a 100644 --- a/archive.php +++ b/archive.php @@ -95,7 +95,7 @@ $months = []; $i = 0; foreach ($items as $item) { - //mb $time = XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset); + //mb $time = \XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset); $time = formatTimestamp($item['datesub'], 'mysql', $useroffset); if (preg_match('/(\d{4})-(\d{1,2})-(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})/', $time, $datetime)) { $thisYear = (int)$datetime[1]; diff --git a/author_items.php b/author_items.php index 159018a7..b2ca2a23 100644 --- a/author_items.php +++ b/author_items.php @@ -57,7 +57,7 @@ $xoopsTpl->assign('permRating', $helper->getConfig('perm_rating')); xoops_load('XoopsUserUtility'); -$author_name = XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true); +$author_name = \XoopsUserUtility::getUnameFromId($uid, $helper->getConfig('format_realname'), true); $xoopsTpl->assign('author_name_with_link', $author_name); $xoopsTpl->assign('user_avatarurl', XOOPS_URL . '/uploads/' . $thisuser->getVar('user_avatar')); //$xoopsLocal = new XoopsLocal(); diff --git a/blocks/category_items_sel.php b/blocks/category_items_sel.php index 6e0329f3..ceb47d4d 100644 --- a/blocks/category_items_sel.php +++ b/blocks/category_items_sel.php @@ -43,7 +43,7 @@ function publisher_category_items_sel_show($options) $selectedcatids = explode(',', $options[0]); $sort = $options[1]; - $order = PublisherUtility::getOrderBy($sort); + $order = publisher\Utility::getOrderBy($sort); $limit = $options[2]; $start = 0; @@ -95,7 +95,7 @@ function publisher_category_items_sel_edit($options) $form = new PublisherBlockForm(); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[0]), 'options[0]'); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[0]), 'options[0]'); $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray([ 'datesub' => _MB_PUBLISHER_DATE, diff --git a/blocks/items_columns.php b/blocks/items_columns.php index 51d276a7..e00d8c4e 100644 --- a/blocks/items_columns.php +++ b/blocks/items_columns.php @@ -159,7 +159,7 @@ function publisher_items_columns_edit($options) '4' => 4, '5' => 5 ]); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[1], 0, true, 'options[1]')); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[1], 0, true, 'options[1]')); $cItemsEle = new XoopsFormText(_MB_PUBLISHER_NUMBER_ITEMS_CAT, 'options[2]', 4, 255, $options[2]); $truncateEle = new XoopsFormText(_MB_PUBLISHER_TRUNCATE, 'options[3]', 4, 255, $options[3]); diff --git a/blocks/items_menu.php b/blocks/items_menu.php index e67ed845..542d9b42 100644 --- a/blocks/items_menu.php +++ b/blocks/items_menu.php @@ -84,7 +84,7 @@ function publisher_items_menu_edit($options) $form = new PublisherBlockForm(); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[0], 0, true, 'options[0]')); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray([ 'datesub' => _MB_PUBLISHER_DATE, diff --git a/blocks/items_new.php b/blocks/items_new.php index d2e522fe..1bba34d7 100644 --- a/blocks/items_new.php +++ b/blocks/items_new.php @@ -43,7 +43,7 @@ function publisher_items_new_show($options) } $sort = $options[1]; - $order = PublisherUtility::getOrderBy($sort); + $order = publisher\Utility::getOrderBy($sort); $limit = $options[3]; $start = 0; $image = $options[5]; @@ -141,7 +141,7 @@ function publisher_items_new_edit($options) $form = new PublisherBlockForm(); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[0], 0, true, 'options[0]')); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray([ 'datesub' => _MB_PUBLISHER_DATE, diff --git a/blocks/items_recent.php b/blocks/items_recent.php index b7dfd70e..329b8e0a 100644 --- a/blocks/items_recent.php +++ b/blocks/items_recent.php @@ -45,7 +45,7 @@ function publisher_items_recent_show($options) } $sort = $options[1]; - $order = PublisherUtility::getOrderBy($sort); + $order = publisher\Utility::getOrderBy($sort); $limit = $options[2]; $start = 0; @@ -97,7 +97,7 @@ function publisher_items_recent_edit($options) $form = new PublisherBlockForm(); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[0], 0, true, 'options[0]')); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray([ 'datesub' => _MB_PUBLISHER_DATE, diff --git a/blocks/items_spot.php b/blocks/items_spot.php index 0b313e94..215be3f4 100644 --- a/blocks/items_spot.php +++ b/blocks/items_spot.php @@ -56,7 +56,7 @@ function publisher_items_spot_show($options) $category['name'] = $cat->name(); $category['categoryurl'] = $cat->getCategoryUrl(); if ('blank.png' !== $cat->getImage()) { - $category['image_path'] = PublisherUtility::getImageDir('category', false) . $cat->getImage(); + $category['image_path'] = publisher\Utility::getImageDir('category', false) . $cat->getImage(); } else { $category['image_path'] = ''; } @@ -91,7 +91,7 @@ function publisher_items_spot_show($options) } if ($optTruncate > 0) { $block['truncate'] = true; - $item['summary'] = PublisherUtility::truncateTagSafe($item['summary'], $optTruncate); + $item['summary'] = publisher\Utility::truncateTagSafe($item['summary'], $optTruncate); } $block['items'][] = $item; ++$i; @@ -126,7 +126,7 @@ function publisher_items_spot_edit($options) $form = new PublisherBlockForm(); $autoEle = new XoopsFormRadioYN(_MB_PUBLISHER_AUTO_LAST_ITEMS, 'options[0]', $options[0]); $countEle = new XoopsFormText(_MB_PUBLISHER_LAST_ITEMS_COUNT, 'options[1]', 2, 255, $options[1]); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[2], 0, true, 'options[2]')); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[2], 0, true, 'options[2]')); $helper = publisher\Helper::getInstance(); $criteria = new CriteriaCompo(); $criteria->setSort('datesub'); diff --git a/blocks/latest_files.php b/blocks/latest_files.php index 8f2adafc..7b76154f 100644 --- a/blocks/latest_files.php +++ b/blocks/latest_files.php @@ -33,6 +33,7 @@ function publisher_latest_files_show($options) { $helper = publisher\Helper::getInstance(); + /** * $options[0] : Category * $options[1] : Sort order - datesub | counter @@ -43,7 +44,7 @@ function publisher_latest_files_show($options) $block = []; $sort = $options[1]; - $order = PublisherUtility::getOrderBy($sort); + $order = publisher\Utility::getOrderBy($sort); $limit = $options[2]; $directDownload = $options[3]; @@ -77,7 +78,7 @@ function publisher_latest_files_edit($options) $form = new PublisherBlockForm(); - $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, PublisherUtility::createCategorySelect($options[0], 0, true, 'options[0]')); + $catEle = new XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::createCategorySelect($options[0], 0, true, 'options[0]')); $orderEle = new XoopsFormSelect(_MB_PUBLISHER_ORDER, 'options[1]', $options[1]); $orderEle->addOptionArray([ 'datesub' => _MB_PUBLISHER_DATE, diff --git a/blocks/latest_news.php b/blocks/latest_news.php index bc1dfd2b..4fdbbce7 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -35,8 +35,10 @@ function publisher_latest_news_show($options) { $block = []; - xoops_loadLanguage('main', 'publisher'); $helper = publisher\Helper::getInstance(); + $helper->loadLanguage('main'); +// xoops_loadLanguage('main', 'publisher'); + $start = $options[0]; // You can show articles from specified range $limit = $options[1]; @@ -44,7 +46,7 @@ function publisher_latest_news_show($options) $letters = $options[3]; $selectedStories = $options[4]; $sort = $options[9]; - $order = PublisherUtility::getOrderBy($sort); + $order = publisher\Utility::getOrderBy($sort); $imgWidth = $options[11]; $imgHeight = $options[12]; $border = $options[13]; @@ -209,7 +211,7 @@ function publisher_latest_news_show($options) if (1 == $options[26] && xoops_isActiveModule('tellafriend')) { $subject = sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']); $subject = $itemObj->convertForJapanese($subject); - $maillink = PublisherUtility::tellAFriend($subject); + $maillink = publisher\Utility::tellAFriend($subject); $item['email'] = '' . _CO_PUBLISHER_MAIL . ' '; } @@ -393,7 +395,7 @@ function publisher_latest_news_edit($options) //Select Which Categories To Show $form .= $tabletag3 . _MB_PUBLISHER_TOPICSCONFIG . $tabletag4; // Topics Options $form .= $tabletag1 . _MB_PUBLISHER_TOPICSDISPLAY . $tabletag2; - $form .= PublisherUtility::createCategorySelect($options[29], 0, true, 'options[29]'); + $form .= publisher\Utility::createCategorySelect($options[29], 0, true, 'options[29]'); $form .= ''; $form .= ''; diff --git a/category.php b/category.php index b1207891..1caaa3ea 100644 --- a/category.php +++ b/category.php @@ -20,6 +20,7 @@ */ use Xmf\Request; +use Xoopsmodules\publisher; require_once __DIR__ . '/header.php'; @@ -223,7 +224,7 @@ $xoopsTpl->assign('lang_category_summary', sprintf(_MD_PUBLISHER_CATEGORY_SUMMARY, $categoryObj->name())); $xoopsTpl->assign('lang_category_summary_info', sprintf(_MD_PUBLISHER_CATEGORY_SUMMARY_INFO, $categoryObj->name())); $xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name())); -$xoopsTpl->assign('module_home', PublisherUtility::moduleHome($helper->getConfig('format_linked_path'))); +$xoopsTpl->assign('module_home', publisher\Utility::moduleHome($helper->getConfig('format_linked_path'))); $xoopsTpl->assign('categoryPath', '
  • ' . $category['categoryPath'] . '
  • '); $xoopsTpl->assign('selected_category', $categoryid); diff --git a/class/configurator.php b/class/Configurator.php similarity index 91% rename from class/configurator.php rename to class/Configurator.php index 8adb9f3c..dcd06c6d 100644 --- a/class/configurator.php +++ b/class/Configurator.php @@ -1,4 +1,5 @@ -getHandler('rating')->getObjects($criteria); unset($criteria); @@ -1257,7 +1266,7 @@ public static function ratingBar($itemId) /* @var $gpermHandler XoopsGroupPermHandler */ $gpermHandler = $helper->getHandler('groupperm'); - if (!$gpermHandler->checkRight('global', PublisherConstants::PUBLISHER_RATE, $groups, $helper->getModule()->getVar('mid'))) { + if (!$gpermHandler->checkRight('global', \PublisherConstants::PUBLISHER_RATE, $groups, $helper->getModule()->getVar('mid'))) { $staticRater = []; $staticRater[] .= "\n" . '
    '; $staticRater[] .= '
    '; @@ -1308,7 +1317,7 @@ public static function getEditors($allowedEditors = null) $ret = []; $nohtml = false; xoops_load('XoopsEditorHandler'); - $editorHandler = XoopsEditorHandler::getInstance(); + $editorHandler = \XoopsEditorHandler::getInstance(); $editors = array_flip($editorHandler->getList());//$editorHandler->getList($nohtml); foreach ($editors as $name => $title) { $key = static::stringToInt($name); @@ -1369,16 +1378,16 @@ public static function convertCharset($item) * * Verifies XOOPS version meets minimum requirements for this module * @static - * @param XoopsModule $module + * @param \XoopsModule $module * * @param null|string $requiredVer * @return bool true if meets requirements, false if not */ - public static function checkVerXoops(XoopsModule $module = null, $requiredVer = null) + public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { $moduleDirName = basename(dirname(__DIR__)); if (null === $module) { - $module = XoopsModule::getByDirname($moduleDirName); + $module = \XoopsModule::getByDirname($moduleDirName); } xoops_loadLanguage('admin', $moduleDirName); diff --git a/class/category.php b/class/category.php index 0b72ed81..c6dc0c74 100644 --- a/class/category.php +++ b/class/category.php @@ -297,7 +297,7 @@ public function toArraySimple($category = []) $category['last_title_link'] = $this->getVar('last_title_link', 'n'); } if ('blank.png' !== $this->getImage()) { - $category['image_path'] = PublisherUtility::getImageDir('category', false) . $this->getImage(); + $category['image_path'] = publisher\Utility::getImageDir('category', false) . $this->getImage(); } else { $category['image_path'] = ''; } @@ -322,7 +322,7 @@ public function toArrayTable($category = []) $category['last_title_link'] = $this->getVar('last_title_link', 'n'); } if ('blank.png' !== $this->getImage()) { - $category['image_path'] = PublisherUtility::getImageDir('category', false) . $this->getImage(); + $category['image_path'] = publisher\Utility::getImageDir('category', false) . $this->getImage(); } else { $category['image_path'] = ''; } diff --git a/class/file.php b/class/file.php index b222c584..8f93e253 100644 --- a/class/file.php +++ b/class/file.php @@ -45,7 +45,7 @@ class PublisherFile extends XoopsObject public function __construct($id = null) { $this->publisher = publisher\Helper::getInstance(); - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); + $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); $this->initVar('fileid', XOBJ_DTYPE_INT, 0, false); $this->initVar('itemid', XOBJ_DTYPE_INT, null, true); $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 255); @@ -100,7 +100,7 @@ public function checkUpload($postField, $allowedMimetypes = [], &$errors) $maxfilewidth = $this->publisher->getConfig('maximum_image_width'); $maxfileheight = $this->publisher->getConfig('maximum_image_height'); xoops_load('XoopsMediaUploader'); - $uploader = new XoopsMediaUploader(PublisherUtility::getUploadDir(), $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); + $uploader = new XoopsMediaUploader(publisher\Utility::getUploadDir(), $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($postField)) { return true; } else { @@ -126,11 +126,11 @@ public function storeUpload($postField, $allowedMimetypes = [], &$errors) $maxfilesize = $this->publisher->getConfig('maximum_filesize'); $maxfilewidth = $this->publisher->getConfig('maximum_image_width'); $maxfileheight = $this->publisher->getConfig('maximum_image_height'); - if (!is_dir(PublisherUtility::getUploadDir())) { - mkdir(PublisherUtility::getUploadDir(), 0757); + if (!is_dir(publisher\Utility::getUploadDir())) { + mkdir(publisher\Utility::getUploadDir(), 0757); } xoops_load('XoopsMediaUploader'); - $uploader = new XoopsMediaUploader(PublisherUtility::getUploadDir() . '/', $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); + $uploader = new XoopsMediaUploader(publisher\Utility::getUploadDir() . '/', $allowedMimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); if ($uploader->fetchMedia($postField)) { $uploader->setTargetFileName($itemid . '_' . $uploader->getMediaName()); if ($uploader->upload()) { @@ -206,7 +206,7 @@ public function notLoaded() */ public function getFileUrl() { - return PublisherUtility::getUploadDir(false) . $this->filename(); + return publisher\Utility::getUploadDir(false) . $this->filename(); } /** @@ -214,7 +214,7 @@ public function getFileUrl() */ public function getFilePath() { - return PublisherUtility::getUploadDir() . $this->filename(); + return publisher\Utility::getUploadDir() . $this->filename(); } /** diff --git a/class/form/category.php b/class/form/category.php index b1767e9d..f0356df4 100644 --- a/class/form/category.php +++ b/class/form/category.php @@ -76,8 +76,8 @@ public function createElements() $criteria->setOrder('ASC'); $myTree = new XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), 'categoryid', 'parentid'); $moduleDirName = basename(dirname(__DIR__)); - $module = XoopsModule::getByDirname($moduleDirName); - if (PublisherUtility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { + $module = \XoopsModule::getByDirname($moduleDirName); + if (publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { $catSelect = $myTree->makeSelectElement('parentid', 'name', '--', $this->targetObject->parentid(), true, 0, '', _AM_PUBLISHER_PARENT_CATEGORY_EXP); $this->addElement($catSelect); } else { @@ -95,14 +95,14 @@ public function createElements() $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; $gpermHandler = $this->publisher->getHandler('groupperm'); $moduleId = $this->publisher->getModule()->mid(); - $allowedEditors = PublisherUtility::getEditors($gpermHandler->getItemIds('editors', $groups, $moduleId)); + $allowedEditors = publisher\Utility::getEditors($gpermHandler->getItemIds('editors', $groups, $moduleId)); $nohtml = false; if (count($allowedEditors) > 0) { $editor = Request::getString('editor', '', 'POST'); if (!empty($editor)) { - PublisherUtility::setCookieVar('publisher_editor', $editor); + publisher\Utility::setCookieVar('publisher_editor', $editor); } else { - $editor = PublisherUtility::getCookieVar('publisher_editor'); + $editor = publisher\Utility::getCookieVar('publisher_editor'); if (empty($editor) && is_object($GLOBALS['xoopsUser'])) { $editor = (null !== $GLOBALS['xoopsUser']->getVar('publisher_editor')) ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : ''; // Need set through user profile } @@ -128,14 +128,14 @@ public function createElements() $this->addElement($textHeader); // IMAGE - $imageArray = XoopsLists::getImgListAsArray(PublisherUtility::getImageDir('category')); + $imageArray = \XoopsLists::getImgListAsArray(publisher\Utility::getImageDir('category')); $imageSelect = new XoopsFormSelect('', 'image', $this->targetObject->getImage()); //$imageSelect -> addOption ('-1', '---------------'); $imageSelect->addOptionArray($imageArray); $imageSelect->setExtra("onchange='showImgSelected(\"image3\", \"image\", \"" . 'uploads/' . PUBLISHER_DIRNAME . '/images/category/' . '", "", "' . XOOPS_URL . "\")'"); $imageTray = new XoopsFormElementTray(_AM_PUBLISHER_IMAGE, ' '); $imageTray->addElement($imageSelect); - $imageTray->addElement(new XoopsFormLabel('', "

    targetObject->getImage() . "' name='image3' id='image3' alt=''>")); + $imageTray->addElement(new XoopsFormLabel('', "

    targetObject->getImage() . "' name='image3' id='image3' alt=''>")); $imageTray->setDescription(_AM_PUBLISHER_IMAGE_DSC); $this->addElement($imageTray); diff --git a/class/form/file.php b/class/form/file.php index 719199af..d9c39611 100644 --- a/class/form/file.php +++ b/class/form/file.php @@ -27,7 +27,9 @@ xoops_load('XoopsFormLoader'); //todo: move to admin? -xoops_loadLanguage('main', 'publisher'); +//xoops_loadLanguage('main', 'publisher'); +$helper = publisher\Helper::getInstance(); +$helper->loadLanguage('main'); /** * Class PublisherFileForm diff --git a/class/form/item.php b/class/form/item.php index 2ca09b84..544259e3 100644 --- a/class/form/item.php +++ b/class/form/item.php @@ -134,7 +134,7 @@ public function createElements($obj) { $helper = publisher\Helper::getInstance(); - $allowedEditors = PublisherUtility::getEditors($helper->getHandler('permission')->getGrantedItems('editors')); + $allowedEditors = publisher\Utility::getEditors($helper->getHandler('permission')->getGrantedItems('editors')); if (!is_object($GLOBALS['xoopsUser'])) { $group = [XOOPS_GROUP_ANONYMOUS]; @@ -181,9 +181,9 @@ public function createElements($obj) } elseif (count($allowedEditors) > 0) { $editor = Request::getString('editor', '', 'POST'); if (!empty($editor)) { - PublisherUtility::setCookieVar('publisher_editor', $editor); + publisher\Utility::setCookieVar('publisher_editor', $editor); } else { - $editor = PublisherUtility::getCookieVar('publisher_editor'); + $editor = publisher\Utility::getCookieVar('publisher_editor'); if (empty($editor) && is_object($GLOBALS['xoopsUser'])) { // $editor = @ $GLOBALS['xoopsUser']->getVar('publisher_editor'); // Need set through user profile $editor = (null !== $GLOBALS['xoopsUser']->getVar('publisher_editor')) ? $GLOBALS['xoopsUser']->getVar('publisher_editor') : ''; // Need set through user profile @@ -251,7 +251,7 @@ public function createElements($obj) // Available pages to wrap if ($this->isGranted(PublisherConstants::PUBLISHER_AVAILABLE_PAGE_WRAP)) { - $wrapPages = XoopsLists::getHtmlListAsArray(PublisherUtility::getUploadDir(true, 'content')); + $wrapPages = \XoopsLists::getHtmlListAsArray(publisher\Utility::getUploadDir(true, 'content')); $availableWrapPagesText = []; foreach ($wrapPages as $page) { $availableWrapPagesText[] = "$page"; diff --git a/class/item.php b/class/item.php index 746396d1..40f210d1 100644 --- a/class/item.php +++ b/class/item.php @@ -50,7 +50,7 @@ class PublisherItem extends XoopsObject public function __construct($id = null) { $this->publisher = publisher\Helper::getInstance(); - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); + $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); $this->initVar('itemid', XOBJ_DTYPE_INT, 0); $this->initVar('categoryid', XOBJ_DTYPE_INT, 0, false); $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', true, 255); @@ -126,7 +126,7 @@ public function getTitle($maxLength = 0, $format = 'S') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - $ret = PublisherUtility::substr($ret, 0, $maxLength); + $ret = publisher\Utility::substr($ret, 0, $maxLength); } } } @@ -146,7 +146,7 @@ public function getSubtitle($maxLength = 0, $format = 'S') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - $ret = PublisherUtility::substr($ret, 0, $maxLength); + $ret = publisher\Utility::substr($ret, 0, $maxLength); } } } @@ -170,8 +170,9 @@ public function getSummary($maxLength = 0, $format = 'S', $stripTags = '') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - //$ret = PublisherUtility::substr($ret , 0, $maxLength); - $ret = PublisherUtility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); + //$ret = publisher\Utility::substr($ret , 0, $maxLength); +// $ret = publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); + $ret = publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); } } } @@ -208,7 +209,7 @@ public function getBlockSummary($maxLength = 0, $fullSummary = false) public function wrapPage($fileName) { $content = ''; - $page = PublisherUtility::getUploadDir(true, 'content') . $fileName; + $page = publisher\Utility::getUploadDir(true, 'content') . $fileName; if (file_exists($page)) { // this page uses smarty template ob_start(); @@ -272,8 +273,8 @@ public function getBody($maxLength = 0, $format = 'S', $stripTags = '') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - //$ret = PublisherUtility::substr($ret , 0, $maxLength); - $ret = PublisherUtility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); + //$ret = publisher\Utility::substr($ret , 0, $maxLength); + $ret = publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); } } } @@ -309,7 +310,7 @@ public function posterName($realName = -1) } $ret = $this->author_alias(); if ('' == $ret) { - $ret = XoopsUserUtility::getUnameFromId($this->uid(), $realName); + $ret = \XoopsUserUtility::getUnameFromId($this->uid(), $realName); } return $ret; @@ -338,7 +339,7 @@ public function getLinkedPosterName() xoops_load('XoopsUserUtility'); $ret = $this->author_alias(); if ('' === $ret) { - $ret = XoopsUserUtility::getUnameFromId($this->uid(), $this->publisher->getConfig('format_realname'), true); + $ret = \XoopsUserUtility::getUnameFromId($this->uid(), $this->publisher->getConfig('format_realname'), true); } return $ret; @@ -420,7 +421,7 @@ public function getCategoryPath($withAllLink = true) */ public function getCategoryImagePath() { - return PublisherUtility::getImageDir('category', false) . $this->getCategory()->getImage(); + return publisher\Utility::getImageDir('category', false) . $this->getCategory()->getImage(); } /** @@ -438,21 +439,21 @@ public function getAdminLinks() { $adminLinks = ''; if (is_object($GLOBALS['xoopsUser']) - && (PublisherUtility::userIsAdmin() || PublisherUtility::userIsAuthor($this) + && (publisher\Utility::userIsAdmin() || publisher\Utility::userIsAuthor($this) || $this->publisher->getHandler('permission')->isGranted('item_submit', $this->categoryid()))) { - if (PublisherUtility::userIsAdmin() || PublisherUtility::userIsAuthor($this) || PublisherUtility::userIsModerator($this)) { - if ($this->publisher->getConfig('perm_edit') || PublisherUtility::userIsModerator($this) || PublisherUtility::userIsAdmin()) { + if (publisher\Utility::userIsAdmin() || publisher\Utility::userIsAuthor($this) || publisher\Utility::userIsModerator($this)) { + if ($this->publisher->getConfig('perm_edit') || publisher\Utility::userIsModerator($this) || publisher\Utility::userIsAdmin()) { // Edit button $adminLinks .= "" . _CO_PUBLISHER_EDIT . ""; $adminLinks .= ' '; } - if ($this->publisher->getConfig('perm_delete') || PublisherUtility::userIsModerator($this) || PublisherUtility::userIsAdmin()) { + if ($this->publisher->getConfig('perm_delete') || publisher\Utility::userIsModerator($this) || publisher\Utility::userIsAdmin()) { // Delete button $adminLinks .= "itemid() . "'>" . _CO_PUBLISHER_DELETE . ""; $adminLinks .= ' '; } } - if ($this->publisher->getConfig('perm_clone') || PublisherUtility::userIsModerator($this) || PublisherUtility::userIsAdmin()) { + if ($this->publisher->getConfig('perm_clone') || publisher\Utility::userIsModerator($this) || publisher\Utility::userIsAdmin()) { // Duplicate button $adminLinks .= "itemid() . "'>" . _CO_PUBLISHER_CLONE . ""; $adminLinks .= ' '; @@ -462,7 +463,7 @@ public function getAdminLinks() // PDF button if ($this->publisher->getConfig('display_pdf')) { if (!is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { - // if (is_object($GLOBALS['xoopsUser']) && PublisherUtility::userIsAdmin()) { + // if (is_object($GLOBALS['xoopsUser']) && publisher\Utility::userIsAdmin()) { // $GLOBALS['xoTheme']->addStylesheet('/modules/system/css/jquery.jgrowl.min.css'); // $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js'); // $adminLinks .= '