From 5c68486229523fbfe0e6dd8669500a3d0274db5c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 4 Jan 2018 18:27:21 -0500 Subject: [PATCH] namespaces --- admin/admin_header.php | 12 ++-- admin/category.php | 38 ++++++------ admin/clone.php | 8 +-- admin/file.php | 24 ++++---- admin/import.php | 8 +-- admin/import/ams.php | 22 +++---- admin/import/cjaycontent.php | 14 ++--- admin/import/fmcontent.php | 24 ++++---- admin/import/news.php | 18 +++--- admin/import/smartsection.php | 18 +++--- admin/import/wfsection.php | 18 +++--- admin/import/xfsection.php | 18 +++--- admin/import/xnews.php | 22 +++---- admin/index.php | 12 ++-- admin/item.php | 46 +++++++-------- admin/main.php | 26 ++++---- admin/menu.php | 12 ++-- admin/mimetypes.php | 58 +++++++++--------- admin/pagewrap.php | 12 ++-- admin/permissions.php | 32 +++++----- admin/preferences.php | 10 ++-- admin/pw_delete_file.php | 4 +- admin/pw_upload_file.php | 10 ++-- blocks/category_items_sel.php | 8 +-- blocks/date_to_date.php | 4 +- blocks/items_columns.php | 6 +- blocks/items_menu.php | 6 +- blocks/items_new.php | 8 +-- blocks/items_random_item.php | 4 +- blocks/items_recent.php | 8 +-- blocks/items_spot.php | 12 ++-- blocks/latest_files.php | 8 +-- blocks/latest_news.php | 10 ++-- blocks/search.php | 4 +- category.php | 4 +- class/Helper.php | 5 +- class/Utility.php | 30 +++++----- class/category.php | 10 ++-- class/common/Breadcrumb.php | 7 ++- class/{ => common}/Configurator.php | 2 +- class/common/FilesManagement.php | 54 +++++++++++++++-- class/common/ServerStats.php | 51 +++++++++------- class/common/VersionChecks.php | 5 +- class/file.php | 18 +++--- class/form/category.php | 16 ++--- class/form/file.php | 6 +- class/form/item.php | 14 ++--- class/item.php | 40 ++++++------- class/metagen.php | 4 +- class/mimetype.php | 4 +- class/permission.php | 4 +- docs/changelog.txt | 4 +- extra/seo/sample.htaccess | 2 +- file.php | 8 +-- include/ajax_rating.php | 4 +- include/ajax_upload.php | 8 +-- include/common.php | 92 ++++++++++++++++++----------- include/config.php | 74 +++++++++++------------ include/oninstall.php | 66 +++++++++++---------- include/onupdate.php | 63 ++++++++++---------- include/search.inc.php | 4 +- include/seo_functions.php | 4 +- index.php | 4 +- item.php | 8 +-- makepdf.php | 10 ++-- preloads/autoloader.php | 2 +- preloads/core.php | 2 +- print.php | 4 +- search.php | 2 +- submit.php | 18 +++--- testdata/index.php | 17 ++++-- xoops_version.php | 2 + 72 files changed, 653 insertions(+), 563 deletions(-) rename class/{ => common}/Configurator.php (98%) diff --git a/admin/admin_header.php b/admin/admin_header.php index 8d9fcc84..4f643222 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -19,17 +19,19 @@ */ -use Xoopsmodules\publisher; +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/config.php'; +include __DIR__ . '/../preloads/autoloader.php'; + $moduleDirName = basename(dirname(__DIR__)); -$helper = publisher\Helper::getInstance(); + +/** @var Publisher\Helper $helper */ +$helper = Publisher\Helper::getInstance(); +/** @var Xmf\Module\Admin $adminObject */ $adminObject = \Xmf\Module\Admin::getInstance(); $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); diff --git a/admin/category.php b/admin/category.php index 3fa4ff99..f329682b 100644 --- a/admin/category.php +++ b/admin/category.php @@ -19,7 +19,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; @@ -57,8 +57,8 @@ $nb_subcats += Request::getInt('nb_sub_yet', 4, 'POST'); //end of fx2024 code - publisher\Utility::cpHeader(); - publisher\Utility::editCategory(true, $categoryid, $nb_subcats); + Publisher\Utility::cpHeader(); + Publisher\Utility::editCategory(true, $categoryid, $nb_subcats); break; case 'addcategory': @@ -82,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 = publisher\Utility::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(publisher\Utility::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 { @@ -130,13 +130,13 @@ } if (!$categoryObj->store()) { - redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher\Utility::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 - publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - publisher\Utility::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(); @@ -150,13 +150,13 @@ $categoryObj->setVar('parentid', $parentCat); if (!$categoryObj->store()) { - redirect_header('javascript:history.go(-1)', 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher\Utility::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 - publisher\Utility::saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - publisher\Utility::saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - publisher\Utility::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 @@ -178,8 +178,8 @@ $categoryObj->setVar('parentid', $parentCat); } - publisher\Utility::cpHeader(); - publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); + Publisher\Utility::cpHeader(); + Publisher\Utility::editCategory(true, $categoryid, $nb_subcats, $categoryObj); exit(); break; //end of fx2024 code @@ -190,7 +190,7 @@ break; case 'default': default: - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); echo "
\n"; @@ -202,7 +202,7 @@ // Creating the objects for top categories $categoriesObj = $helper->getHandler('category')->getCategories($helper->getConfig('idxcat_perpage'), $startcategory, 0); - publisher\Utility::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 ''; @@ -214,7 +214,7 @@ $totalCategories = $helper->getHandler('category')->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { - publisher\Utility::displayCategory($thiscat); + Publisher\Utility::displayCategory($thiscat); } unset($key, $thiscat); } else { @@ -228,7 +228,7 @@ $pagenav = new \XoopsPageNav($totalCategories, $helper->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '
' . $pagenav->renderNav() . '
'; echo '
'; - publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + Publisher\Utility::closeCollapsableBar('createdcategories', 'createdcategoriesicon'); echo '
'; //editcat(false); break; diff --git a/admin/clone.php b/admin/clone.php index b1085c2e..8f90fe89 100644 --- a/admin/clone.php +++ b/admin/clone.php @@ -18,13 +18,13 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; -publisher\Utility::cpHeader(); +Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); -publisher\Utility::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()) { @@ -79,7 +79,7 @@ } // End of collapsable bar -publisher\Utility::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 2eb8e105..ea1cfb7e 100644 --- a/admin/file.php +++ b/admin/file.php @@ -19,7 +19,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; @@ -32,7 +32,7 @@ */ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); // if there is a parameter, and the id exists, retrieve data: we're editing a file @@ -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 . ''; - publisher\Utility::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 . ''; - publisher\Utility::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) { - publisher\Utility::closeCollapsableBar('editfile', 'editfileicon'); + Publisher\Utility::closeCollapsableBar('editfile', 'editfileicon'); } else { - publisher\Utility::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': - publisher\Utility::uploadFile(false, true, $false); + Publisher\Utility::uploadFile(false, true, $false); exit; break; case 'uploadanother': - publisher\Utility::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(); } - publisher\Utility::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 . publisher\Utility::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'); - publisher\Utility::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: - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); break; } diff --git a/admin/import.php b/admin/import.php index beabbf58..24cb5e78 100644 --- a/admin/import.php +++ b/admin/import.php @@ -19,7 +19,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; @@ -36,10 +36,10 @@ default: $importfile = 'none'; - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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 */ @@ -174,7 +174,7 @@ // End of collapsable bar - publisher\Utility::closeCollapsableBar('import', 'importicon'); + Publisher\Utility::closeCollapsableBar('import', 'importicon'); break; } diff --git a/admin/import/ams.php b/admin/import/ams.php index 72c68c93..e48b94fc 100644 --- a/admin/import/ams.php +++ b/admin/import/ams.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -34,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -153,15 +153,15 @@ } } - publisher\Utility::closeCollapsableBar('amsimport', 'amsimporticon'); + Publisher\Utility::closeCollapsableBar('amsimport', 'amsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); require_once dirname(dirname(__DIR__)) . '/include/common.php'; - publisher\Utility::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'); @@ -264,7 +264,7 @@ $src = $GLOBALS['xoops']->path('uploads/AMS/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); - publisher\Utility::recurseCopy($src, $dst); + Publisher\Utility::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -384,12 +384,12 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $ams_module_id); - publisher\Utility::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); - publisher\Utility::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); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -439,6 +439,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('amsimportgo', 'amsimportgoicon'); + Publisher\Utility::closeCollapsableBar('amsimportgo', 'amsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php index afb18e76..02dcc773 100644 --- a/admin/import/cjaycontent.php +++ b/admin/import/cjaycontent.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -54,9 +54,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -79,15 +79,15 @@ } // } - publisher\Utility::closeCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); + Publisher\Utility::closeCollapsableBar('cjaycontentimport', 'cjaycontentimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); require_once dirname(dirname(__DIR__)) . '/include/common.php'; - publisher\Utility::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'); @@ -183,6 +183,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); + Publisher\Utility::closeCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index c3300f21..da23d3bc 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -21,7 +21,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -35,9 +35,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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'); @@ -98,7 +98,7 @@ $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); $moduleDirName = basename(dirname(__DIR__)); $module = \XoopsModule::getByDirname($moduleDirName); - if (publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { + if (Publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); //$form->addElement($catSelBox); } else { @@ -126,14 +126,14 @@ } } - publisher\Utility::closeCollapsableBar('fmimport', 'fmimporticon'); + Publisher\Utility::closeCollapsableBar('fmimport', 'fmimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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'); @@ -219,9 +219,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - publisher\Utility::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); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); unset($fmContentObjs, $itemObj, $categoryObj, $thisFmContentObj); echo "
\n"; @@ -315,9 +315,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('fmcontent_view', $thisFmContentObj->getVar('topic_id'), $fm_module_id); - publisher\Utility::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); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$CatIds['oldid']] = $CatIds; unset($CatIds, $thisFmContentObj); @@ -373,6 +373,6 @@ . _AM_PUBLISHER_IMPORT_GOTOMODULE . "
\n"; - publisher\Utility::closeCollapsableBar('fmimportgo', 'fmimportgoicon'); + Publisher\Utility::closeCollapsableBar('fmimportgo', 'fmimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/news.php b/admin/import/news.php index 9f8afc12..3d049200 100644 --- a/admin/import/news.php +++ b/admin/import/news.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -34,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -90,14 +90,14 @@ } } - publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); + Publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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'); @@ -228,9 +228,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('news_view', $arrCat['topic_id'], $news_module_id); - publisher\Utility::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); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -279,6 +279,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + Publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php index d9d9e722..d6e9c3c1 100644 --- a/admin/import/smartsection.php +++ b/admin/import/smartsection.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -34,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -90,14 +90,14 @@ } } - publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); + Publisher\Utility::closeCollapsableBar('newsimport', 'newsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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'); @@ -203,9 +203,9 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('category_read', $arrCat['categoryid'], $smartsection_module_id); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_read'); $groupsIds = $gpermHandler->getGroupIds('item_submit', $arrCat['categoryid'], $smartsection_module_id); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'item_submit'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -254,6 +254,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); + Publisher\Utility::closeCollapsableBar('newsimportgo', 'newsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php index 89f7083d..6d3ee840 100644 --- a/admin/import/wfsection.php +++ b/admin/import/wfsection.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -34,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -88,14 +88,14 @@ } } - publisher\Utility::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); + Publisher\Utility::closeCollapsableBar('wfsectionimport', 'wfsectionimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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; @@ -145,8 +145,8 @@ $newCat['newid'] = $categoryObj->categoryid(); // Saving category permissions - publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); - publisher\Utility::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; @@ -271,6 +271,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); + Publisher\Utility::closeCollapsableBar('wfsectionimportgo', 'wfsectionimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php index bdd3bc2c..ddc8ba2b 100644 --- a/admin/import/xfsection.php +++ b/admin/import/xfsection.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -34,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -88,14 +88,14 @@ } } - publisher\Utility::closeCollapsableBar('xfsectionimport', 'xfsectionimporticon'); + Publisher\Utility::closeCollapsableBar('xfsectionimport', 'xfsectionimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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; @@ -138,8 +138,8 @@ $newCat['newid'] = $categoryObj->categoryid(); // Saving category permissions - publisher\Utility::saveCategoryPermissions($categoryObj->getGroupsRead(), $categoryObj->categoryid(), 'category_read'); - publisher\Utility::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 +270,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); + Publisher\Utility::closeCollapsableBar('xfsectionimportgo', 'xfsectionimportgoicon'); xoops_cp_footer(); } diff --git a/admin/import/xnews.php b/admin/import/xnews.php index c094d2d8..1d12b365 100644 --- a/admin/import/xnews.php +++ b/admin/import/xnews.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -34,9 +34,9 @@ if ('start' === $op) { xoops_load('XoopsFormLoader'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher\Utility::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); @@ -154,15 +154,15 @@ } } - publisher\Utility::closeCollapsableBar('xnewsimport', 'xnewsimporticon'); + Publisher\Utility::closeCollapsableBar('xnewsimport', 'xnewsimporticon'); xoops_cp_footer(); } if ('go' === $op) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); require_once dirname(dirname(__DIR__)) . '/include/common.php'; - publisher\Utility::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'); @@ -263,7 +263,7 @@ //copy all images to Image Manager $src = $GLOBALS['xoops']->path('uploads/xnews/topics/'); $dst = $GLOBALS['xoops']->path('uploads'); - publisher\Utility::recurseCopy($src, $dst); + Publisher\Utility::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -383,12 +383,12 @@ // Saving category permissions $groupsIds = $gpermHandler->getGroupIds('nw_view', $arrCat['topic_id'], $xnews_module_id); - publisher\Utility::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); - publisher\Utility::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); - publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); + Publisher\Utility::saveCategoryPermissions($groupsIds, $categoryObj->categoryid(), 'category_moderation'); $newCatArray[$newCat['oldid']] = $newCat; unset($newCat); @@ -438,6 +438,6 @@ echo sprintf(_AM_PUBLISHER_IMPORTED_ARTICLES, $cnt_imported_articles) . '
'; echo "
" . _AM_PUBLISHER_IMPORT_GOTOMODULE . '
'; - publisher\Utility::closeCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); + Publisher\Utility::closeCollapsableBar('xnewsimportgo', 'xnewsimportgoicon'); xoops_cp_footer(); } diff --git a/admin/index.php b/admin/index.php index 07d86b0e..7736f54a 100644 --- a/admin/index.php +++ b/admin/index.php @@ -19,19 +19,21 @@ * @author Mage, Mamba */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; +use XoopsModules\Publisher\Common; require_once __DIR__ . '/admin_header.php'; //require_once dirname(__DIR__) . '/class/Utility.php'; xoops_cp_header(); -$helper = publisher\Helper::getInstance(); +$helper = Publisher\Helper::getInstance(); $helper->loadLanguage('main'); $adminObject = \Xmf\Module\Admin::getInstance(); +$utility = new Publisher\Utility(); /* foreach (array_keys($GLOBALS['uploadFolders']) as $i) { - publisher\Utility::createFolder($uploadFolders[$i]); + Publisher\Utility::createFolder($uploadFolders[$i]); $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder'); // $adminObject->addConfigBoxLine(array($folder[$i], '777'), 'chmod'); } @@ -40,7 +42,7 @@ $file = PUBLISHER_ROOT_PATH . '/assets/images/blank.png'; foreach (array_keys($copyFiles) as $i) { $dest = $copyFiles[$i] . '/blank.png'; - publisher\Utility::copyFile($file, $dest); + Publisher\Utility::copyFile($file, $dest); } */ @@ -61,6 +63,6 @@ $adminObject->displayIndex(); -echo publisher\Utility::getServerStats(); +echo $utility::getServerStats(); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/item.php b/admin/item.php index f2a2a493..89db19ee 100644 --- a/admin/item.php +++ b/admin/item.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; @@ -52,7 +52,7 @@ // exit(); } } - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); publisher_editItem(true, $itemid, true); break; @@ -65,7 +65,7 @@ } } - publisher\Utility::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 . publisher\Utility::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 = publisher\Utility::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 . publisher\Utility::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: - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); xoops_load('XoopsPageNav'); @@ -178,7 +178,7 @@ $ascOrDesc = 'DESC'; // Display Submited articles - publisher\Utility::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() . '
'; - publisher\Utility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon'); + Publisher\Utility::closeCollapsableBar('submiteditemstable', 'submiteditemsicon'); // Display Published articles - publisher\Utility::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() . '
'; - publisher\Utility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); + Publisher\Utility::closeCollapsableBar('item_publisheditemstable', 'item_publisheditemsicon'); // Display Offline articles - publisher\Utility::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() . '
'; - publisher\Utility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon'); + Publisher\Utility::closeCollapsableBar('offlineitemstable', 'offlineitemsicon'); // Display Rejected articles - publisher\Utility::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() . '
'; - publisher\Utility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon'); + Publisher\Utility::closeCollapsableBar('Rejecteditemstable', 'rejecteditemsicon'); break; } require_once __DIR__ . '/admin_footer.php'; @@ -392,7 +392,7 @@ */ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); global $publisherCurrentPage; xoops_load('XoopsFormLoader'); @@ -478,7 +478,7 @@ function publisher_editItem($showmenu = false, $itemid = 0, $clone = false) $categoryObj = $itemObj->getCategory(); echo "
\n"; - publisher\Utility::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')); - publisher\Utility::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'); - publisher\Utility::closeCollapsableBar('edititemtable', 'edititemicon'); + Publisher\Utility::closeCollapsableBar('edititemtable', 'edititemicon'); - publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); + Publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); - $dir = publisher\Utility::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(publisher\Utility::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(); - publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); + Publisher\Utility::closeCollapsableBar('pagewraptable', 'pagewrapicon'); } diff --git a/admin/main.php b/admin/main.php index 21f2d3cb..5a12f472 100644 --- a/admin/main.php +++ b/admin/main.php @@ -19,7 +19,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; require_once $GLOBALS['xoops']->path('class/xoopslists.php'); @@ -43,7 +43,7 @@ $startentry = Request::getInt('startentry', 0, 'GET'); -publisher\Utility::cpHeader(); +Publisher\Utility::cpHeader(); //publisher_adminMenu(0, _AM_PUBLISHER_INDEX); // Total ITEMs -- includes everything on the table @@ -65,15 +65,15 @@ $totalrejected = $helper->getHandler('item')->getItemsCount(-1, [PublisherConstants::PUBLISHER_STATUS_REJECTED]); // Check Path Configuration -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(); +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(); } -publisher\Utility::openCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); +Publisher\Utility::openCollapsableBar('inventorytable', 'inventoryicon', _AM_PUBLISHER_INVENTORY); echo '
'; echo "
"; echo "'; @@ -88,10 +88,10 @@ echo "  "; echo ''; -publisher\Utility::closeCollapsableBar('inventorytable', 'inventoryicon'); +Publisher\Utility::closeCollapsableBar('inventorytable', 'inventoryicon'); // Construction of lower table -publisher\Utility::openCollapsableBar('allitemstable', 'allitemsicon', _AM_PUBLISHER_ALLITEMS, _AM_PUBLISHER_ALLITEMSMSG); +Publisher\Utility::openCollapsableBar('allitemstable', 'allitemsicon', _AM_PUBLISHER_ALLITEMS, _AM_PUBLISHER_ALLITEMSMSG); $showingtxt = ''; $selectedtxt = ''; @@ -243,7 +243,7 @@ $totalItemsOnPage = count($itemsObj); -publisher\Utility::buildTableItemTitleRow(); +Publisher\Utility::buildTableItemTitleRow(); if ($numrows > 0) { for ($i = 0; $i < $totalItemsOnPage; ++$i) { @@ -358,7 +358,7 @@ echo '
' . $pagenav->renderNav() . '
'; } // ENDs code to show active entries -publisher\Utility::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 35d4d73f..7e89430a 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -18,22 +18,18 @@ * @author The SmartFactory */ +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); - -use Xoopsmodules\publisher; - -require_once __DIR__ . '/../class/Helper.php'; -//require_once __DIR__ . '/../include/common.php'; +include __DIR__ . '/../preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); -$helper = \Xoopsmodules\publisher\Helper::getInstance(); +$helper = Publisher\Helper::getInstance(); +// get path to icons $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); -require_once dirname(__DIR__) . '/include/config.php'; - $adminmenu = [ [ 'title' => _MI_PUBLISHER_ADMENU0, diff --git a/admin/mimetypes.php b/admin/mimetypes.php index 679e5a55..402da9d5 100644 --- a/admin/mimetypes.php +++ b/admin/mimetypes.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; xoops_load('XoopsPagenav'); @@ -94,14 +94,14 @@ class PublisherMimetypesUtility { public static function add() { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); global $limit, $start; $error = []; if (!Request::getString('add_mime', '', 'POST')) { - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); - publisher\Utility::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) { - publisher\Utility::renderErrors($mimeErrors, publisher\Utility::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 . '
'; - publisher\Utility::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: ' . publisher\Utility::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(); @@ -237,7 +237,7 @@ public static function add() public static function delete() { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); global $start, $limit; $mimeId = 0; if (0 == Request::getInt('id', 0, 'GET')) { @@ -255,7 +255,7 @@ public static function delete() public static function edit() { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); global $start, $limit; $mimeId = 0; $error = []; @@ -273,14 +273,14 @@ public static function edit() $mimeErrors = $session->get('publisher_editMimeErr_' . $mimeId); // Display header - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_EDIT); - publisher\Utility::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) { - publisher\Utility::renderErrors($mimeErrors, publisher\Utility::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 - publisher\Utility::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: ' . publisher\Utility::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')); @@ -398,9 +398,9 @@ public static function edit() public static function manage() { - $helper = publisher\Helper::getInstance(); - /** @var \Xoopsmodules\publisher\Utility $utility */ - $utility = new publisher\Utility(); + $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')) { @@ -425,9 +425,9 @@ public static function manage() // exit(); } - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); ////publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); - publisher\Utility::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'); @@ -534,7 +534,7 @@ public static function manage() echo ''; echo "
" . $nav->renderNav() . '

'; - publisher\Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon'); + Publisher\Utility::closeCollapsableBar('mimemanagetable', 'mimemanageicon'); // xoops_cp_footer(); require_once __DIR__ . '/admin_footer.php'; @@ -542,7 +542,7 @@ public static function manage() public static function search() { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); global $limit, $start, $imagearray, $aSearchBy, $aOrderBy, $aLimitBy, $aSortBy; if (Request::getString('deleteMimes', '', 'POST')) { @@ -565,10 +565,10 @@ public static function search() $order = Request::getString('order', 'ASC'); $sort = Request::getString('sort', 'mime_name'); - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES . " > " . _AM_PUBLISHER_BUTTON_SEARCH); - publisher\Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH); + Publisher\Utility::openCollapsableBar('mimemsearchtable', 'mimesearchicon', _AM_PUBLISHER_MIME_SEARCH); if (!Request::hasVar('mime_search')) { echo "
"; @@ -716,7 +716,7 @@ public static function search() echo ''; echo "'; } - publisher\Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); + Publisher\Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); // require_once __DIR__ . '/admin_footer.php'; xoops_cp_footer(); } @@ -727,14 +727,14 @@ public static function search() public static function updateMimeValue() { // op=updateMimeValue&id=65&mime_admin=0&limit=15&start=0 - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); $hiddens = [ 'id' => Request::getInt('id', 0, 'GET'), 'start' => Request::getInt('start', 0, 'GET'), 'limit' => Request::getInt('limit', 15, 'GET'), ]; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $mimeTypeObj = $helper->getHandler('mimetype')->get($hiddens['id']); if (Request::hasVar('mime_admin')) { $hiddens['mime_admin'] = Request::getInt('mime_admin', 0, 'GET'); @@ -753,7 +753,7 @@ public static function updateMimeValue() public static function confirmUpdateMimeValue() { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $limit = Request::getInt('limit', 0, 'POST'); $start = Request::getInt('start', 0, 'POST'); @@ -804,7 +804,7 @@ protected static function clearAddSessionVars() public static function clearAddSession() { self::clearAddSessionVars(); - header('Location: ' . publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); + header('Location: ' . Publisher\Utility::makeUri(PUBLISHER_ADMIN_URL . '/mimetypes.php', ['op' => 'add'], false)); } /** @@ -822,6 +822,6 @@ public static function clearEditSession() { $mimeid = Request::getInt('id', '', 'GET'); self::clearEditSessionVars($mimeid); - header('Location: ' . publisher\Utility::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 2a342b62..84f0f26c 100644 --- a/admin/pagewrap.php +++ b/admin/pagewrap.php @@ -18,16 +18,16 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; -publisher\Utility::cpHeader(); +Publisher\Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_ITEMS . " > " . _AM_PUBLISHER_PAGEWRAP); -publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); +Publisher\Utility::openCollapsableBar('pagewraptable', 'pagewrapicon', _AM_PUBLISHER_PAGEWRAP, _AM_PUBLISHER_PAGEWRAPDSC); -$dir = publisher\Utility::getUploadDir(true, 'content'); +$dir = Publisher\Utility::getUploadDir(true, 'content'); if (false !== strpos(decoct(fileperms($dir)), '777')) { echo "

" . _AM_PUBLISHER_PERMERROR . '

'; @@ -45,7 +45,7 @@ // Delete File $form = new \XoopsThemeForm(_CO_PUBLISHER_DELETEFILE, 'form_name', 'pw_delete_file.php'); -$pWrapSelect = new \XoopsFormSelect(publisher\Utility::getUploadDir(true, 'content'), 'address'); +$pWrapSelect = new \XoopsFormSelect(Publisher\Utility::getUploadDir(true, 'content'), 'address'); $folder = dir($dir); while ($file == $folder->read()) { if ('.' !== $file && '..' !== $file) { @@ -61,6 +61,6 @@ $form->addElement($submit); $form->display(); -publisher\Utility::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 9590b40b..38c0a772 100644 --- a/admin/permissions.php +++ b/admin/permissions.php @@ -18,21 +18,21 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +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(); -publisher\Utility::cpHeader(); +Publisher\Utility::cpHeader(); //publisher_adminMenu(3, _AM_PUBLISHER_PERMISSIONS); -$helper = publisher\Helper::getInstance(); +$helper = Publisher\Helper::getInstance(); // View Categories permissions $item_list_view = []; $block_view = []; -publisher\Utility::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)) { @@ -44,11 +44,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -publisher\Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view'); +Publisher\Utility::closeCollapsableBar('permissionstable_view', 'permissionsicon_view'); // Submit Categories permissions echo "
\n"; -publisher\Utility::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'); @@ -59,11 +59,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -publisher\Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit'); +Publisher\Utility::closeCollapsableBar('permissionstable_submit', 'permissionsicon_submit'); // Moderators Categories permissions echo "
\n"; -publisher\Utility::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'); @@ -74,11 +74,11 @@ } else { echo _AM_PUBLISHER_NOPERMSSET; } -publisher\Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation'); +Publisher\Utility::closeCollapsableBar('permissionstable_moderation', 'permissionsicon_moderation'); // Form permissions echo "
\n"; -publisher\Utility::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, @@ -113,23 +113,23 @@ } unset($key, $value); echo $form_submit->render(); -publisher\Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); +Publisher\Utility::closeCollapsableBar('permissionstable_form', 'permissionsicon_form'); // Editors permissions echo "
\n"; -publisher\Utility::openCollapsableBar('permissionstable_editors', 'permissions_editors', _AM_PUBLISHER_PERMISSIONS_EDITORS, _AM_PUBLISHER_PERMISSIONS_EDITORS_DSC); -$editors = publisher\Utility::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(); -publisher\Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); +Publisher\Utility::closeCollapsableBar('permissionstable_editors', 'permissionsicon_editors'); // Global permissions echo "
\n"; -publisher\Utility::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 @@ -140,6 +140,6 @@ } unset($key, $value); echo $form_submit->render(); -publisher\Utility::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 0c0f8d86..9a87c1f8 100644 --- a/admin/preferences.php +++ b/admin/preferences.php @@ -19,11 +19,11 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; -$helper = publisher\Helper::getInstance(); +$helper = Publisher\Helper::getInstance(); $module = $helper->getModule(); $modId = $module->mid(); @@ -177,7 +177,7 @@ unset($ele, $hidden); } - publisher\Utility::cpHeader(); + Publisher\Utility::cpHeader(); //publisher_adminMenu(5, _PREFERENCES); foreach ($config_cats as $formCat => $info) { if ('others' === $formCat && !$cat_others_used) { @@ -185,9 +185,9 @@ } $$formCat->addElement(new \XoopsFormHidden('op', 'save')); $$formCat->addElement(new \XoopsFormButton('', 'button', _GO, 'submit')); - publisher\Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); + Publisher\Utility::openCollapsableBar($formCat . '_table', $formCat . '_icon', $info['name'], $info['description']); $$formCat->display(); - publisher\Utility::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 eb3c6272..4194ae24 100644 --- a/admin/pw_delete_file.php +++ b/admin/pw_delete_file.php @@ -20,7 +20,7 @@ use Xmf\Assert; use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; @@ -29,7 +29,7 @@ redirect_header(XOOPS_URL . '/modules/publisher/admin/item.php', 3, _AM_PUBLISHER_FILE_DELETE_ERROR); } - $dir = publisher\Utility::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 fa619161..6a2f427f 100644 --- a/admin/pw_upload_file.php +++ b/admin/pw_upload_file.php @@ -19,7 +19,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/admin_header.php'; @@ -43,18 +43,18 @@ function publisher_pagewrap_upload(&$errors) // require_once PUBLISHER_ROOT_PATH . '/class/uploader.php'; xoops_load('XoopsMediaUploader'); - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $postField = 'fileupload'; $maxFileSize = $helper->getConfig('maximum_filesize'); $maxImageWidth = $helper->getConfig('maximum_image_width'); $maxImageHeight = $helper->getConfig('maximum_image_height'); - if (!is_dir(publisher\Utility::getUploadDir(true, 'content'))) { - mkdir(publisher\Utility::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(publisher\Utility::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/blocks/category_items_sel.php b/blocks/category_items_sel.php index 61324608..94a2c007 100644 --- a/blocks/category_items_sel.php +++ b/blocks/category_items_sel.php @@ -18,7 +18,7 @@ * @author trabis */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -31,7 +31,7 @@ */ function publisher_category_items_sel_show($options) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $block = $item = []; @@ -43,7 +43,7 @@ function publisher_category_items_sel_show($options) $selectedcatids = explode(',', $options[0]); $sort = $options[1]; - $order = publisher\Utility::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, publisher\Utility::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/date_to_date.php b/blocks/date_to_date.php index 6953d455..45c3639b 100644 --- a/blocks/date_to_date.php +++ b/blocks/date_to_date.php @@ -19,7 +19,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -33,7 +33,7 @@ function publisher_date_to_date_show($options) { $myts = \MyTextSanitizer::getInstance(); - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $block = $newItems = []; diff --git a/blocks/items_columns.php b/blocks/items_columns.php index ad74488a..7b09c8fa 100644 --- a/blocks/items_columns.php +++ b/blocks/items_columns.php @@ -19,7 +19,7 @@ * @author Bandit-x */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -35,7 +35,7 @@ function publisher_items_columns_show($options) { // global $xoTheme; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); //Column Settings $optNumColumns = isset($options[0]) ? (int)$options[0] : '2'; @@ -159,7 +159,7 @@ function publisher_items_columns_edit($options) '4' => 4, '5' => 5 ]); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::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 32a2dd88..8376b835 100644 --- a/blocks/items_menu.php +++ b/blocks/items_menu.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -35,7 +35,7 @@ function publisher_items_menu_show($options) { $block = []; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); // Getting all top cats $blockCategoriesObj = $helper->getHandler('category')->getCategories(0, 0, 0); @@ -84,7 +84,7 @@ function publisher_items_menu_edit($options) $form = new PublisherBlockForm(); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::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 bbac1b30..9fc10488 100644 --- a/blocks/items_new.php +++ b/blocks/items_new.php @@ -19,7 +19,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -32,7 +32,7 @@ */ function publisher_items_new_show($options) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $selectedcatids = explode(',', $options[0]); @@ -43,7 +43,7 @@ function publisher_items_new_show($options) } $sort = $options[1]; - $order = publisher\Utility::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, publisher\Utility::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_random_item.php b/blocks/items_random_item.php index 53a47cec..0cf4cba8 100644 --- a/blocks/items_random_item.php +++ b/blocks/items_random_item.php @@ -19,7 +19,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -33,7 +33,7 @@ function publisher_items_random_item_show($options) { $block = []; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); // creating the ITEM object $itemsObj = $helper->getHandler('item')->getRandomItem('', [PublisherConstants::PUBLISHER_STATUS_PUBLISHED]); diff --git a/blocks/items_recent.php b/blocks/items_recent.php index 97c2e176..55c4fa93 100644 --- a/blocks/items_recent.php +++ b/blocks/items_recent.php @@ -19,7 +19,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -32,7 +32,7 @@ */ function publisher_items_recent_show($options) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $myts = \MyTextSanitizer::getInstance(); $block = $newItems = []; @@ -45,7 +45,7 @@ function publisher_items_recent_show($options) } $sort = $options[1]; - $order = publisher\Utility::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, publisher\Utility::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 bd88b1c6..786999d3 100644 --- a/blocks/items_spot.php +++ b/blocks/items_spot.php @@ -18,7 +18,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -32,7 +32,7 @@ function publisher_items_spot_show($options) { // global $xoTheme; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $optDisplayLast = $options[0]; $optItemsCount = $options[1]; $optCategoryId = $options[2]; @@ -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'] = publisher\Utility::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'] = publisher\Utility::truncateTagSafe($item['summary'], $optTruncate); + $item['summary'] = Publisher\Utility::truncateTagSafe($item['summary'], $optTruncate); } $block['items'][] = $item; ++$i; @@ -126,8 +126,8 @@ 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, publisher\Utility::createCategorySelect($options[2], 0, true, 'options[2]')); - $helper = publisher\Helper::getInstance(); + $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'); $criteria->setOrder('DESC'); diff --git a/blocks/latest_files.php b/blocks/latest_files.php index 81cd366c..e81658cc 100644 --- a/blocks/latest_files.php +++ b/blocks/latest_files.php @@ -19,7 +19,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -32,7 +32,7 @@ */ function publisher_latest_files_show($options) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); /** * $options[0] : Category @@ -44,7 +44,7 @@ function publisher_latest_files_show($options) $block = []; $sort = $options[1]; - $order = publisher\Utility::getOrderBy($sort); + $order = Publisher\Utility::getOrderBy($sort); $limit = $options[2]; $directDownload = $options[3]; @@ -78,7 +78,7 @@ function publisher_latest_files_edit($options) $form = new PublisherBlockForm(); - $catEle = new \XoopsFormLabel(_MB_PUBLISHER_SELECTCAT, publisher\Utility::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 2814f25e..40a44385 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -20,7 +20,7 @@ * @author Mowaffak */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -35,7 +35,7 @@ function publisher_latest_news_show($options) { $block = []; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $helper->loadLanguage('main'); // xoops_loadLanguage('main', 'publisher'); @@ -46,7 +46,7 @@ function publisher_latest_news_show($options) $letters = $options[3]; $selectedStories = $options[4]; $sort = $options[9]; - $order = publisher\Utility::getOrderBy($sort); + $order = Publisher\Utility::getOrderBy($sort); $imgWidth = $options[11]; $imgHeight = $options[12]; $border = $options[13]; @@ -211,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 = publisher\Utility::tellAFriend($subject); + $maillink = Publisher\Utility::tellAFriend($subject); $item['email'] = '' . _CO_PUBLISHER_MAIL . ' '; } @@ -395,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 .= publisher\Utility::createCategorySelect($options[29], 0, true, 'options[29]'); + $form .= Publisher\Utility::createCategorySelect($options[29], 0, true, 'options[29]'); $form .= ''; $form .= ''; diff --git a/blocks/search.php b/blocks/search.php index e86941b5..84723757 100644 --- a/blocks/search.php +++ b/blocks/search.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -34,7 +34,7 @@ function publisher_search_show($options) { $block = []; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $categories = $helper->getHandler('category')->getCategoriesForSearch(); if (0 == count($categories)) { return $block; diff --git a/category.php b/category.php index 1629c9bb..bf2a5871 100644 --- a/category.php +++ b/category.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; require_once __DIR__ . '/header.php'; @@ -224,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', publisher\Utility::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/Helper.php b/class/Helper.php index 292ce4e9..9ed72299 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -1,4 +1,4 @@ -description(); if (!XOOPS_USE_MULTIBYTES) { @@ -222,7 +222,7 @@ public static function displayCategory(\PublisherCategory $categoryObj, $level = */ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCats = 4, $categoryObj = null) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); // if there is a parameter, and the id exists, retrieve data: we're editing a category /* @var $categoryObj PublisherCategory */ @@ -499,7 +499,7 @@ public static function getAllowedImagesTypes() */ public static function moduleHome($withLink = true) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); if (!$helper->getConfig('format_breadcrumb_modname')) { return ''; @@ -691,8 +691,8 @@ public static function formatErrors($errors = []) */ public static function userIsAdmin() { - /** @var publisher\Helper $helper */ - $helper = publisher\Helper::getInstance(); + /** @var Publisher\Helper $helper */ + $helper = Publisher\Helper::getInstance(); static $publisherIsAdmin; @@ -728,7 +728,7 @@ public static function userIsAuthor($itemObj) */ public static function userIsModerator($itemObj) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $categoriesGranted = $helper->getHandler('permission')->getGrantedItems('category_moderation'); return (is_object($itemObj) && in_array($itemObj->categoryid(), $categoriesGranted)); @@ -744,7 +744,7 @@ public static function userIsModerator($itemObj) */ public static function saveCategoryPermissions($groups, $categoryId, $permName) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $result = true; @@ -892,7 +892,7 @@ public static function getCurrentPage() */ public static function addCategoryOption(\PublisherCategory $categoryObj, $selectedid = 0, $level = 0, $ret = '') { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $spaces = ''; for ($j = 0; $j < $level; ++$j) { @@ -927,7 +927,7 @@ public static function addCategoryOption(\PublisherCategory $categoryObj, $selec */ public static function createCategorySelect($selectedid = 0, $parentcategory = 0, $allCatOption = true, $selectname = 'options[0]') { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $selectedid = explode(',', $selectedid); @@ -961,7 +961,7 @@ public static function createCategorySelect($selectedid = 0, $parentcategory = 0 */ public static function createCategoryOptions($selectedid = 0, $parentcategory = 0, $allCatOption = true) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $ret = ''; if ($allCatOption) { @@ -1067,7 +1067,7 @@ public static function uploadFile($another = false, $withRedirect = true, &$item // require_once PUBLISHER_ROOT_PATH . '/class/uploader.php'; // global $publisherIsAdmin; - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $itemId = Request::getInt('itemid', 0, 'POST'); $uid = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; @@ -1228,7 +1228,7 @@ public static function closeTags($string) */ public static function ratingBar($itemId) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $ratingUnitWidth = 30; $units = 5; diff --git a/class/category.php b/class/category.php index 8924222b..d179ebfa 100644 --- a/class/category.php +++ b/class/category.php @@ -17,7 +17,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -44,7 +44,7 @@ class PublisherCategory extends XoopsObject */ public function __construct() { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); $this->initVar('categoryid', XOBJ_DTYPE_INT, null, false); $this->initVar('parentid', XOBJ_DTYPE_INT, null, false); $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 100); @@ -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'] = publisher\Utility::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'] = publisher\Utility::getImageDir('category', false) . $this->getImage(); + $category['image_path'] = Publisher\Utility::getImageDir('category', false) . $this->getImage(); } else { $category['image_path'] = ''; } @@ -375,7 +375,7 @@ class PublisherCategoryHandler extends XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); parent::__construct($db, 'publisher_categories', 'PublisherCategory', 'categoryid', 'name'); } diff --git a/class/common/Breadcrumb.php b/class/common/Breadcrumb.php index 5c0f500d..3221ebd1 100644 --- a/class/common/Breadcrumb.php +++ b/class/common/Breadcrumb.php @@ -1,4 +1,4 @@ - * @package xxxxx @@ -23,10 +23,11 @@ * $breadcrumb->addLink( 'bread 3', 'index3.php' ); * echo $breadcrumb->render(); */ + defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); /** - * Class PedigreeBreadcrumb + * Class Breadcrumb */ class Breadcrumb { diff --git a/class/Configurator.php b/class/common/Configurator.php similarity index 98% rename from class/Configurator.php rename to class/common/Configurator.php index dcd06c6d..56ab0c2e 100644 --- a/class/Configurator.php +++ b/class/common/Configurator.php @@ -1,4 +1,4 @@ -getMessage(), "\n", '
    '; + echo 'Caught exception: ', $e->getMessage(), '
    '; } } @@ -57,8 +58,7 @@ public static function copyFile($file, $folder) public static function recurseCopy($src, $dst) { $dir = opendir($src); - // @mkdir($dst); - if (!mkdir($dst) && !is_dir($dst)) { + @mkdir($dst); while (false !== ($file = readdir($dir))) { if (('.' !== $file) && ('..' !== $file)) { if (is_dir($src . '/' . $file)) { @@ -68,10 +68,54 @@ public static function recurseCopy($src, $dst) } } } - } closedir($dir); } + /** + * Copy a file, or recursively copy a folder and its contents + * @author Aidan Lister + * @version 1.0.1 + * @link http://aidanlister.com/2004/04/recursively-copying-directories-in-php/ + * @param string $source Source path + * @param string $dest Destination path + * @param int $permissions New folder creation permissions + * @return bool Returns true on success, false on failure + */ + public static function xcopy($source, $dest) + { + // Check for symlinks + if (is_link($source)) { + return symlink(readlink($source), $dest); + } + + // Simple copy for a file + if (is_file($source)) { + return copy($source, $dest); + } + + // Make destination directory + if (!is_dir($dest)) { + mkdir($dest); + } + + // Loop through the folder + $dir = dir($source); + if (@is_dir($dir)) { + while (false !== $entry = $dir->read()) { + // Skip pointers + if ('.' === $entry || '..' === $entry) { + continue; + } + // Deep copy directories + self::xcopy("$source/$entry", "$dest/$entry"); + } + // Clean up + $dir->close(); + } + return true; + } + + /** * * Remove files and (sub)directories diff --git a/class/common/ServerStats.php b/class/common/ServerStats.php index 092a47b7..1fd39fd6 100644 --- a/class/common/ServerStats.php +++ b/class/common/ServerStats.php @@ -1,4 +1,4 @@ -query($sql); // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= "
    " . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; - $html .= "
    \n"; - // $html .= '
    ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
    \n"; - // $html .= "
    \n"; - // $html .= "
    \n"; - $html .= '
    ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
    \n"; - $html .= "
      \n"; - // + + $html .= '
      '; + $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ""; + + $html .= "
      "; + + // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; + // $html .= "
      "; + // $html .= "
      "; + + $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
      "; + $html .= "
        "; + + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { @@ -49,25 +55,26 @@ public static function getServerStats() $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } - // + + // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - // + // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - // + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - // - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; - $html .= "
      \n"; - $html .= "
        \n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; - $html .= "
      \n"; - $html .= "
      \n"; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; + + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ""; + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ""; + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ""; + $html .= "
    "; + $html .= "
      "; + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ""; + $html .= "
    "; + $html .= "
    "; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ""; $html .= '
    '; $html .= '

    '; diff --git a/class/common/VersionChecks.php b/class/common/VersionChecks.php index 61a46195..bbfacaed 100644 --- a/class/common/VersionChecks.php +++ b/class/common/VersionChecks.php @@ -1,4 +1,4 @@ -dirname()); // check for minimum PHP version $success = true; diff --git a/class/file.php b/class/file.php index ba187183..20c261ed 100644 --- a/class/file.php +++ b/class/file.php @@ -17,7 +17,7 @@ * @author The SmartFactory */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); @@ -44,7 +44,7 @@ class PublisherFile extends XoopsObject */ public function __construct($id = null) { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); $this->initVar('fileid', XOBJ_DTYPE_INT, 0, false); $this->initVar('itemid', XOBJ_DTYPE_INT, null, true); @@ -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(publisher\Utility::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(publisher\Utility::getUploadDir())) { - mkdir(publisher\Utility::getUploadDir(), 0757); + if (!is_dir(Publisher\Utility::getUploadDir())) { + mkdir(Publisher\Utility::getUploadDir(), 0757); } xoops_load('XoopsMediaUploader'); - $uploader = new \XoopsMediaUploader(publisher\Utility::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 publisher\Utility::getUploadDir(false) . $this->filename(); + return Publisher\Utility::getUploadDir(false) . $this->filename(); } /** @@ -214,7 +214,7 @@ public function getFileUrl() */ public function getFilePath() { - return publisher\Utility::getUploadDir() . $this->filename(); + return Publisher\Utility::getUploadDir() . $this->filename(); } /** @@ -301,7 +301,7 @@ class PublisherFileHandler extends XoopsPersistableObjectHandler */ public function __construct(\XoopsDatabase $db) { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); parent::__construct($db, 'publisher_files', 'PublisherFile', 'fileid', 'name'); } diff --git a/class/form/category.php b/class/form/category.php index bdc95d30..504a118e 100644 --- a/class/form/category.php +++ b/class/form/category.php @@ -20,7 +20,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined"); @@ -52,7 +52,7 @@ class PublisherCategoryForm extends XoopsThemeForm */ public function __construct(&$target, $subCatsCount = 4) { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); $this->targetObject =& $target; $this->subCatsCount = $subCatsCount; @@ -77,7 +77,7 @@ public function createElements() $myTree = new \XoopsObjectTree($this->publisher->getHandler('category')->getObjects($criteria), 'categoryid', 'parentid'); $moduleDirName = basename(dirname(__DIR__)); $module = \XoopsModule::getByDirname($moduleDirName); - if (publisher\Utility::checkVerXoops($GLOBALS['xoopsModule'], '2.5.9')) { + 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 = publisher\Utility::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)) { - publisher\Utility::setCookieVar('publisher_editor', $editor); + Publisher\Utility::setCookieVar('publisher_editor', $editor); } else { - $editor = publisher\Utility::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(publisher\Utility::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 c2d68f76..5d4707e6 100644 --- a/class/form/file.php +++ b/class/form/file.php @@ -19,7 +19,7 @@ * @author trabis */ -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined"); @@ -28,7 +28,7 @@ xoops_load('XoopsFormLoader'); //todo: move to admin? //xoops_loadLanguage('main', 'publisher'); -$helper = publisher\Helper::getInstance(); +$helper = Publisher\Helper::getInstance(); $helper->loadLanguage('main'); /** @@ -49,7 +49,7 @@ class PublisherFileForm extends XoopsThemeForm */ public function __construct(&$target) { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); $this->targetObject =& $target; parent::__construct(_AM_PUBLISHER_UPLOAD_FILE, 'form', xoops_getenv('PHP_SELF'), 'post', true); diff --git a/class/form/item.php b/class/form/item.php index 08b36ed7..e6e22b21 100644 --- a/class/form/item.php +++ b/class/form/item.php @@ -21,7 +21,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; // defined('XOOPS_ROOT_PATH') || exit("XOOPS root path not defined"); @@ -94,7 +94,7 @@ public function setCheckPermissions($checkperm) */ public function isGranted($item) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); $ret = false; if (!$this->checkperm || $helper->getHandler('permission')->isGranted('form_view', $item)) { $ret = true; @@ -132,9 +132,9 @@ public function hasTab($tab) */ public function createElements($obj) { - $helper = publisher\Helper::getInstance(); + $helper = Publisher\Helper::getInstance(); - $allowedEditors = publisher\Utility::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)) { - publisher\Utility::setCookieVar('publisher_editor', $editor); + Publisher\Utility::setCookieVar('publisher_editor', $editor); } else { - $editor = publisher\Utility::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(publisher\Utility::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 ab4d9e5d..52dd084a 100644 --- a/class/item.php +++ b/class/item.php @@ -19,7 +19,7 @@ */ use Xmf\Request; -use Xoopsmodules\publisher; +use XoopsModules\Publisher; //namespace Publisher; @@ -49,7 +49,7 @@ class PublisherItem extends XoopsObject */ public function __construct($id = null) { - $this->publisher = publisher\Helper::getInstance(); + $this->publisher = Publisher\Helper::getInstance(); $this->db = \XoopsDatabaseFactory::getDatabaseConnection(); $this->initVar('itemid', XOBJ_DTYPE_INT, 0); $this->initVar('categoryid', XOBJ_DTYPE_INT, 0, false); @@ -126,7 +126,7 @@ public function getTitle($maxLength = 0, $format = 'S') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - $ret = publisher\Utility::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 = publisher\Utility::substr($ret, 0, $maxLength); + $ret = Publisher\Utility::substr($ret, 0, $maxLength); } } } @@ -170,9 +170,9 @@ public function getSummary($maxLength = 0, $format = 'S', $stripTags = '') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - //$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); + //$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); } } } @@ -209,7 +209,7 @@ public function getBlockSummary($maxLength = 0, $fullSummary = false) public function wrapPage($fileName) { $content = ''; - $page = publisher\Utility::getUploadDir(true, 'content') . $fileName; + $page = Publisher\Utility::getUploadDir(true, 'content') . $fileName; if (file_exists($page)) { // this page uses smarty template ob_start(); @@ -273,8 +273,8 @@ public function getBody($maxLength = 0, $format = 'S', $stripTags = '') if (0 != $maxLength) { if (!XOOPS_USE_MULTIBYTES) { if (strlen($ret) >= $maxLength) { - //$ret = publisher\Utility::substr($ret , 0, $maxLength); - $ret = publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); + //$ret = Publisher\Utility::substr($ret , 0, $maxLength); + $ret = Publisher\Utility::truncateTagSafe($ret, $maxLength, $etc = '...', $breakWords = false); } } } @@ -421,7 +421,7 @@ public function getCategoryPath($withAllLink = true) */ public function getCategoryImagePath() { - return publisher\Utility::getImageDir('category', false) . $this->getCategory()->getImage(); + return Publisher\Utility::getImageDir('category', false) . $this->getCategory()->getImage(); } /** @@ -439,21 +439,21 @@ public function getAdminLinks() { $adminLinks = ''; if (is_object($GLOBALS['xoopsUser']) - && (publisher\Utility::userIsAdmin() || publisher\Utility::userIsAuthor($this) + && (Publisher\Utility::userIsAdmin() || Publisher\Utility::userIsAuthor($this) || $this->publisher->getHandler('permission')->isGranted('item_submit', $this->categoryid()))) { - 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()) { + 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') || publisher\Utility::userIsModerator($this) || publisher\Utility::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') || publisher\Utility::userIsModerator($this) || publisher\Utility::userIsAdmin()) { + if ($this->publisher->getConfig('perm_clone') || Publisher\Utility::userIsModerator($this) || Publisher\Utility::userIsAdmin()) { // Duplicate button $adminLinks .= "itemid() . "'>" . _CO_PUBLISHER_CLONE . ""; $adminLinks .= ' '; @@ -463,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']) && publisher\Utility::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 .= '