From a38a4c42e5a8d1c4dfcda3cfca6dbdbfaa3d7a2d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 26 May 2015 04:58:37 -0400 Subject: [PATCH] RC1 --- publisher/admin/category.php | 4 +- publisher/admin/clone.php | 4 +- publisher/admin/import.php | 20 ++-- publisher/admin/import/ams.php | 26 ++--- publisher/admin/import/cjaycontent.php | 14 +-- publisher/admin/import/fmcontent.php | 14 +-- publisher/admin/import/news.php | 20 ++-- publisher/admin/import/smartsection.php | 20 ++-- publisher/admin/import/wfsection.php | 18 ++-- publisher/admin/import/xfsection.php | 16 ++-- publisher/admin/import/xnews.php | 94 +++++++++---------- publisher/admin/menu.php | 4 +- publisher/admin/mimetypes.php | 4 +- publisher/admin/pw_upload_file.php | 4 +- publisher/archive.php | 4 +- publisher/blocks/items_columns.php | 8 +- publisher/blocks/items_spot.php | 4 +- publisher/blocks/latest_news.php | 2 +- publisher/blocks/search.php | 75 +++++++++++---- publisher/category.php | 2 +- publisher/class/form/category.php | 2 +- publisher/class/form/item.php | 2 +- publisher/class/formdatetime.php | 2 +- publisher/class/groupperm.php | 2 +- publisher/class/item.php | 10 +- publisher/class/metagen.php | 2 +- publisher/class/mimetype.php | 4 +- publisher/class/uploader.php | 14 +-- publisher/class/utilities.php | 2 +- publisher/docs/changelog.txt | 4 +- publisher/include/functions.php | 4 +- publisher/include/oninstall.php | 3 +- publisher/include/onupdate.php | 14 +-- publisher/include/seo_functions.php | 6 +- publisher/index.php | 2 +- publisher/item.php | 2 +- publisher/search.php | 2 +- .../templates/publisher_display_wfsection.tpl | 2 +- publisher/templates/publisher_header.tpl | 11 +-- publisher/thumb.php | 2 +- publisher/xoops_version.php | 8 +- 41 files changed, 247 insertions(+), 210 deletions(-) diff --git a/publisher/admin/category.php b/publisher/admin/category.php index b8a89b07..1163fa89 100644 --- a/publisher/admin/category.php +++ b/publisher/admin/category.php @@ -73,7 +73,7 @@ // Uploading the image, if any // Retreive the filename to be uploaded - if (($image_file = XoopsRequest::getArray('image_file', '', 'FILES')['name'])) { + if ($image_file = XoopsRequest::getArray('image_file', '', 'FILES')['name']) { // $filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0]; if ($filename = XoopsRequest::getArray('xoops_upload_file', array(), 'POST')[0]) { // TODO : implement publisher mimetype management @@ -139,7 +139,7 @@ //Added by fx2024 $parentCat = $categoryObj->categoryid(); - $sizeof = sizeof(XoopsRequest::getString('scname', '', 'POST')); + $sizeof = count(XoopsRequest::getString('scname', '', 'POST')); for ($i = 0; $i < $sizeof; ++$i) { if (XoopsRequest::getArray('scname', array(), 'POST')[$i] != '') { $categoryObj = $publisher->getHandler('category')->create(); diff --git a/publisher/admin/clone.php b/publisher/admin/clone.php index bba1fab5..acdedba1 100644 --- a/publisher/admin/clone.php +++ b/publisher/admin/clone.php @@ -156,7 +156,7 @@ public static function createLogo($dirname) unset($func); } - if (!file_exists($imageBase = $GLOBALS['xoops']->path("/modules/" . $dirname . "/assets/images/module_logo.png")) || !file_exists($font = $GLOBALS['xoops']->path("/modules/" . $dirname . "/assets/images/VeraBd.ttf"))) { + if (!file_exists($imageBase = $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/module_logo.png")) || !file_exists($font = $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/VeraBd.ttf"))) { return false; } @@ -175,7 +175,7 @@ public static function createLogo($dirname) $white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); imagefill($imageModule, 0, 0, $white); imagecolortransparent($imageModule, $white); - imagepng($imageModule, $GLOBALS['xoops']->path("/modules/" . $dirname . "/assets/images/module_logo.png")); + imagepng($imageModule, $GLOBALS['xoops']->path("modules/" . $dirname . "/assets/images/module_logo.png")); imagedestroy($imageModule); return true; diff --git a/publisher/admin/import.php b/publisher/admin/import.php index 4e066c34..40d9ef7b 100644 --- a/publisher/admin/import.php +++ b/publisher/admin/import.php @@ -28,7 +28,7 @@ case "importExecute": $importfile = XoopsRequest::getString('importfile', 'nonselected', 'POST'); - $importfile_path = $GLOBALS['xoops']->path("/modules/" . $publisher->getModule()->dirname() . "/admin/import/" . $importfile . ".php"); + $importfile_path = $GLOBALS['xoops']->path("modules/" . $publisher->getModule()->dirname() . "/admin/import/" . $importfile . ".php"); include_once $importfile_path; break; @@ -44,11 +44,11 @@ xoops_load('XoopsFormLoader'); - $module_handler = xoops_gethandler('module'); + $moduleHandler = xoops_gethandler('module'); // WF-Section /*$wfs_version = 0; - $moduleObj = $module_handler->getByDirname('wfsection'); + $moduleObj = $moduleHandler->getByDirname('wfsection'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version == 1.5) || $from_module_version == 1.04 || $from_module_version == 1.01 || $from_module_version == 2.07 || $from_module_version == 2.06) { @@ -59,7 +59,7 @@ // News $news_version = 0; - $moduleObj = $module_handler->getByDirname('news'); + $moduleObj = $moduleHandler->getByDirname('news'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { @@ -70,7 +70,7 @@ // xNews $xnews_version = 0; - $moduleObj = $module_handler->getByDirname('xnews'); + $moduleObj = $moduleHandler->getByDirname('xnews'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { @@ -81,7 +81,7 @@ // AMS $ams_version = 0; - $moduleObj = $module_handler->getByDirname('AMS'); + $moduleObj = $moduleHandler->getByDirname('AMS'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { @@ -92,7 +92,7 @@ // Smartsection $smartsection_version = 0; - $moduleObj = $module_handler->getByDirname('smartsection'); + $moduleObj = $moduleHandler->getByDirname('smartsection'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { @@ -103,7 +103,7 @@ // C-Jay Content $cjaycontent_version = 0; - $moduleObj = $module_handler->getByDirname('cjaycontent'); + $moduleObj = $moduleHandler->getByDirname('cjaycontent'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { @@ -114,7 +114,7 @@ // FmContent $fmcontent_version = 0; - $moduleObj = $module_handler->getByDirname('fmcontent'); + $moduleObj = $moduleHandler->getByDirname('fmcontent'); if ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if (($from_module_version >= 1.1)) { @@ -125,7 +125,7 @@ // XF-Section /*$xfs_version = 0; - $moduleObj = $module_handler->getByDirname('xfsection'); + $moduleObj = $moduleHandler->getByDirname('xfsection'); If ($moduleObj) { $from_module_version = round($moduleObj->getVar('version') / 100, 2); if ($from_module_version > 1.00) { diff --git a/publisher/admin/import/ams.php b/publisher/admin/import/ams.php index 05d0272e..d3376160 100644 --- a/publisher/admin/import/ams.php +++ b/publisher/admin/import/ams.php @@ -161,8 +161,8 @@ include_once (dirname(dirname(__DIR__))) . '/include/common.php'; publisherOpenCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('ams'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('ams'); $ams_module_id = $moduleObj->getVar('mid'); $gperm_handler = xoops_gethandler('groupperm'); @@ -185,7 +185,7 @@ // get the total number of subcats for this category // $criteria = new CriteriaCompo(); // $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '=')); -// $childCount = intval($mylinksCatHandler->getCount($criteria)); +// $childCount = (int)($mylinksCatHandler->getCount($criteria)); $criteria = new Criteria('imgcat_name', PUBLISHER_DIRNAME); $imageCategoryId = $imageCategoryHandler->getObjects($criteria); @@ -224,7 +224,7 @@ // Category image: copying to Publisher category uploads if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) { - if (copy($GLOBALS['xoops']->path("/uploads/AMS/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("/uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']))) { + if (copy($GLOBALS['xoops']->path("uploads/AMS/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']))) { $categoryObj->setVar('image', $arrCat['topic_imgurl']); //======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder @@ -259,8 +259,8 @@ //copy all images to Image Manager - $src = $GLOBALS['xoops']->path("/uploads/AMS/topics/"); - $dst = $GLOBALS['xoops']->path("/uploads"); + $src = $GLOBALS['xoops']->path("uploads/AMS/topics/"); + $dst = $GLOBALS['xoops']->path("uploads"); PublisherUtilities::recurseCopy($src, $dst); @@ -327,9 +327,9 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) { + if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; } @@ -347,9 +347,9 @@ $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("/uploads/AMS/attached/" . $arrFile['downloadname']); + $filename = $GLOBALS['xoops']->path("uploads/AMS/attached/" . $arrFile['downloadname']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("/uploads/publisher/" . $arrFile['filerealname']))) { + if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) { $fileObj = $publisher->getHandler('file')->create(); $fileObj->setVar('name', $arrFile['filerealname']); $fileObj->setVar('description', $arrFile['filerealname']); @@ -411,15 +411,15 @@ $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $ams_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/import/cjaycontent.php b/publisher/admin/import/cjaycontent.php index 6cbffb36..e70af6f8 100644 --- a/publisher/admin/import/cjaycontent.php +++ b/publisher/admin/import/cjaycontent.php @@ -107,8 +107,8 @@ _AM_PUBLISHER_IMPORT_RESULT ); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('cjaycontent'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('cjaycontent'); $cjaycontent_module_id = $moduleObj->getVar('mid'); $gperm_handler = xoops_gethandler('groupperm'); @@ -151,9 +151,9 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) { + if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; } @@ -178,15 +178,15 @@ $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $cjaycontent_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/import/fmcontent.php b/publisher/admin/import/fmcontent.php index 0e2ec3a5..edd8476a 100644 --- a/publisher/admin/import/fmcontent.php +++ b/publisher/admin/import/fmcontent.php @@ -37,8 +37,8 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('fmcontent'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('fmcontent'); $fm_module_id = $moduleObj->getVar('mid'); $fmTopicHdlr =& xoops_getmodulehandler('topic', 'fmcontent'); @@ -122,8 +122,8 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('fmcontent'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('fmcontent'); $fm_module_id = $moduleObj->getVar('mid'); $gperm_handler = xoops_gethandler('groupperm'); @@ -319,15 +319,15 @@ $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $fm_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
\n"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
\n"; diff --git a/publisher/admin/import/news.php b/publisher/admin/import/news.php index bd32efe7..e98b0fc7 100644 --- a/publisher/admin/import/news.php +++ b/publisher/admin/import/news.php @@ -97,8 +97,8 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('news'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('news'); $news_module_id = $moduleObj->getVar('mid'); $gperm_handler = xoops_gethandler('groupperm'); @@ -131,7 +131,7 @@ // Category image if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) { - if (copy($GLOBALS['xoops']->path("/modules/news/assets/images/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("/uploads/publisher/images/category/" . $arrCat['topic_imgurl']))) { + if (copy($GLOBALS['xoops']->path("modules/news/assets/images/topics/" . $arrCat['topic_imgurl']), $GLOBALS['xoops']->path("uploads/publisher/images/category/" . $arrCat['topic_imgurl']))) { $categoryObj->setVar('image', $arrCat['topic_imgurl']); } } @@ -173,9 +173,9 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) { + if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; } @@ -194,9 +194,9 @@ $allowed_mimetypes = ''; while ($arrFile = $GLOBALS['xoopsDB']->fetchArray ($resultFiles)) { - $filename = $GLOBALS['xoops']->path("/modules/wfsection/cache/uploaded/" . $arrFile['filerealname']); + $filename = $GLOBALS['xoops']->path("modules/wfsection/cache/uploaded/" . $arrFile['filerealname']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("/uploads/publisher/" . $arrFile['filerealname']))) { + if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) { $fileObj = $publisher_file_handler->create(); $fileObj->setVar('name', $arrFile['fileshowname']); $fileObj->setVar('description', $arrFile['filedescript']); @@ -252,15 +252,15 @@ $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $news_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/import/smartsection.php b/publisher/admin/import/smartsection.php index d9046ce2..9c2a6245 100644 --- a/publisher/admin/import/smartsection.php +++ b/publisher/admin/import/smartsection.php @@ -97,8 +97,8 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); publisherOpenCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('smartsection'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('smartsection'); $smartsection_module_id = $moduleObj->getVar('mid'); $gperm_handler = xoops_gethandler('groupperm'); @@ -128,7 +128,7 @@ // Copy category image if (($arrCat['image'] != 'blank.gif') && ($arrCat['image'] != '')) { - copy($GLOBALS['xoops']->path("/uploads/smartsection/images/category/" . $arrCat['image']), $GLOBALS['xoops']->path("/uploads/publisher/images/category/" . $arrCat['image'])); + copy($GLOBALS['xoops']->path("uploads/smartsection/images/category/" . $arrCat['image']), $GLOBALS['xoops']->path("uploads/publisher/images/category/" . $arrCat['image'])); } if (!$publisher->getHandler('category')->insert($categoryObj)) { @@ -158,9 +158,9 @@ // TODO: copy contents folder /* if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) { + if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; } @@ -178,9 +178,9 @@ $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = null; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("/uploads/smartsection/" . $arrFile['filename']); + $filename = $GLOBALS['xoops']->path("uploads/smartsection/" . $arrFile['filename']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("/uploads/publisher/" . $arrFile['filename']))) { + if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filename']))) { $fileObj = $publisher->getHandler('file')->create(); $fileObj->setVars($arrFile); $fileObj->setVar('fileid', 0); @@ -229,15 +229,15 @@ $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $smartsection_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/import/wfsection.php b/publisher/admin/import/wfsection.php index 49bd180e..113c96b6 100644 --- a/publisher/admin/import/wfsection.php +++ b/publisher/admin/import/wfsection.php @@ -42,7 +42,7 @@ if ($totalCat == 0) { echo "" . _AM_PUBLISHER_IMPORT_NOCATSELECTED . ""; } else { - include_once $GLOBALS['xoops']->path("/class/xoopstree.php"); + include_once $GLOBALS['xoops']->path("class/xoopstree.php"); $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("wfs_article")); list ($totalArticles) = $GLOBALS['xoopsDB']->fetchRow($result); @@ -131,7 +131,7 @@ // Category image if (($arrCat['imgurl'] != 'blank.gif') && ($arrCat['imgurl'])) { - if (copy($GLOBALS['xoops']->path("/modules/wfsection/images/category/" . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . "/images/category/" . $arrCat['imgurl'])) { + if (copy($GLOBALS['xoops']->path("modules/wfsection/images/category/" . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . "/images/category/" . $arrCat['imgurl'])) { $categoryObj->setVar('image', $arrCat['imgurl']); } } @@ -172,7 +172,7 @@ // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" . $arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" . $arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . "/content/" . $arrArticle['htmlpage'])) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); @@ -191,7 +191,7 @@ $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("/modules/wfsection/cache/uploaded/" . $arrFile['filerealname']); + $filename = $GLOBALS['xoops']->path("modules/wfsection/cache/uploaded/" . $arrFile['filerealname']); if (file_exists($filename)) { if (copy($filename, PUBLISHER_UPLOAD_PATH . "/" . $arrFile['filerealname'])) { $fileObj = $publisher->getHandler('file')->create(); @@ -239,21 +239,21 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('wfsection'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('wfsection'); $news_module_id = $moduleObj->getVar('mid'); $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $news_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/import/xfsection.php b/publisher/admin/import/xfsection.php index ba8bcafe..4a0939b4 100644 --- a/publisher/admin/import/xfsection.php +++ b/publisher/admin/import/xfsection.php @@ -123,7 +123,7 @@ // Category image if (($arrCat['imgurl'] != 'blank.gif') && ($arrCat['imgurl'])) { - if (copy($GLOBALS['xoops']->path("/modules/xfsection/images/category/" . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . "/images/category/" . $arrCat['imgurl'])) { + if (copy($GLOBALS['xoops']->path("modules/xfsection/images/category/" . $arrCat['imgurl']), PUBLISHER_UPLOAD_PATH . "/images/category/" . $arrCat['imgurl'])) { $categoryObj->setVar('image', $arrCat['imgurl']); } } @@ -170,7 +170,7 @@ // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/xfsection/html/" . $arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/xfsection/html/" . $arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { if (copy($pagewrap_filename, PUBLISHER_UPLOAD_PATH . "/content/" . $arrArticle['htmlpage'])) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); @@ -189,7 +189,7 @@ $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("/modules/xfsection/cache/uploaded/" . $arrFile['filerealname']); + $filename = $GLOBALS['xoops']->path("modules/xfsection/cache/uploaded/" . $arrFile['filerealname']); if (file_exists($filename)) { if (copy($filename, PUBLISHER_UPLOAD_PATH . "/" . $arrFile['filerealname'])) { $fileObj = $publisher->getHandler('file')->create(); @@ -237,21 +237,21 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . "
"; - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('xfsection'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('xfsection'); $news_module_id = $moduleObj->getVar('mid'); $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $news_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/import/xnews.php b/publisher/admin/import/xnews.php index 7eee31fd..7cc8cf0a 100644 --- a/publisher/admin/import/xnews.php +++ b/publisher/admin/import/xnews.php @@ -56,33 +56,31 @@ echo "" . sprintf( _AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, - $totalArticles - ) . ""; + $totalArticles) . ""; } else { echo "" . sprintf( _AM_PUBLISHER_IMPORT_MODULE_FOUND, $importFromModuleName, $totalArticles, - $totalCat - ) . ""; + $totalCat) . ""; $form = new XoopsThemeForm(_AM_PUBLISHER_IMPORT_SETTINGS, 'import_form', PUBLISHER_ADMIN_URL . "/import/$scriptname"); -//---------- mb ------------------ -// add "publisher" category to "imagecategory" table + //---------- mb ------------------ + // add "publisher" category to "imagecategory" table -// if (!$GLOBALS['xoopsSecurity']->check()) { -// redirect_header('admin.php?fct=images', 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); -// } + // if (!$GLOBALS['xoopsSecurity']->check()) { + // redirect_header('admin.php?fct=images', 3, implode('
', $GLOBALS['xoopsSecurity']->getErrors())); + // } $imageCategoryHandler =& xoops_gethandler('imagecategory'); $imagecategory =& $imageCategoryHandler->create(); -// $imagecategory->setVar('imgcat_name', $imgcat_name); + // $imagecategory->setVar('imgcat_name', $imgcat_name); $imagecategory->setVar('imgcat_name', PUBLISHER_DIRNAME); //$imgcat_name); $imagecategory->setVar('imgcat_maxsize', $GLOBALS['xoopsModuleConfig']['maximum_filesize']); //$imgcat_maxsize); $imagecategory->setVar('imgcat_maxwidth', $GLOBALS['xoopsModuleConfig']['maximum_image_width']); //$imgcat_maxwidth); $imagecategory->setVar('imgcat_maxheight', $GLOBALS['xoopsModuleConfig']['maximum_image_height']); //$imgcat_maxheight); -// $imgcat_display = empty($imgcat_display) ? 0 : 1; + // $imgcat_display = empty($imgcat_display) ? 0 : 1; $imagecategory->setVar('imgcat_display', 1); //$imgcat_display); $imagecategory->setVar('imgcat_weight', 0); //$imgcat_weight); $imagecategory->setVar('imgcat_storetype', 'file'); //$imgcat_storetype); @@ -130,7 +128,7 @@ } unset($wgroup); -//---------- mb ------------------ + //---------- mb ------------------ // Categories to be imported $sql = "SELECT cat.topic_id, cat.topic_pid, cat.topic_title, COUNT(art.storyid) FROM " . $GLOBALS['xoopsDB']->prefix("nw_topics") @@ -182,8 +180,8 @@ _AM_PUBLISHER_IMPORT_RESULT ); - $module_handler = xoops_gethandler('module'); - $moduleObj = $module_handler->getByDirname('xnews'); + $moduleHandler = xoops_gethandler('module'); + $moduleObj = $moduleHandler->getByDirname('xnews'); $xnews_module_id = $moduleObj->getVar('mid'); $gperm_handler = xoops_gethandler('groupperm'); @@ -201,32 +199,32 @@ $newArticleArray = array(); $imageCategoryHandler =& xoops_gethandler('imagecategory'); -// $criteria = new criteriaCombo; + // $criteria = new criteriaCombo; -// get the total number of subcats for this category -// $criteria = new CriteriaCompo(); -// $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '=')); -// $childCount = intval($mylinksCatHandler->getCount($criteria)); + // get the total number of subcats for this category + // $criteria = new CriteriaCompo(); + // $criteria->add(new Criteria('imagecategory', $catObj->getVar('cid'), '=')); + // $childCount = (int)($mylinksCatHandler->getCount($criteria)); $criteria = new Criteria('imgcat_name', PUBLISHER_DIRNAME); $imageCategoryId = $imageCategoryHandler->getObjects($criteria); -// $criteria = new CriteriaCompo(); -// $criteria->add(new Criteria("imagecategory", PUBLISHER_DIRNAME, "=")); + // $criteria = new CriteriaCompo(); + // $criteria->add(new Criteria("imagecategory", PUBLISHER_DIRNAME, "=")); -// $newid = $imageCategoryId->getVar('imgcat_id'); + // $newid = $imageCategoryId->getVar('imgcat_id'); $newid = $imageCategoryId[0]->vars['imgcat_id']['value']; -// $newid = $imageCategoryId[0]->vars['imgcat_id']; + // $newid = $imageCategoryId[0]->vars['imgcat_id']; -// $select_form = new XoopsFormSelect("", $name_current, array(), 1); -// $select_form->addOption("", _SELECT); -// $select_form->addOptionArray($writer_handler->getList($criteria)); + // $select_form = new XoopsFormSelect("", $name_current, array(), 1); + // $select_form->addOption("", _SELECT); + // $select_form->addOptionArray($writer_handler->getList($criteria)); -// $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('imagecategory') . " WHERE imgcat_name=" . PUBLISHER_DIRNAME; -// $resultImageCategory = $GLOBALS['xoopsDB']->query($sql); -// -// -// $newid = $resultImageCategory->getVar('imgcat_id'); + // $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix('imagecategory') . " WHERE imgcat_name=" . PUBLISHER_DIRNAME; + // $resultImageCategory = $GLOBALS['xoopsDB']->query($sql); + // + // + // $newid = $resultImageCategory->getVar('imgcat_id'); $oldToNew = array(); while (($arrCat = $GLOBALS['xoopsDB']->fetchArray($resultCat)) !== false) { @@ -246,13 +244,13 @@ // Category image: copying to Publisher category uploads if (($arrCat['topic_imgurl'] != 'blank.gif') && ($arrCat['topic_imgurl'] != '')) { if (copy( - $GLOBALS['xoops']->path("/uploads/xnews/topics/" . $arrCat['topic_imgurl']), - $GLOBALS['xoops']->path("/uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']) + $GLOBALS['xoops']->path("uploads/xnews/topics/" . $arrCat['topic_imgurl']), + $GLOBALS['xoops']->path("uploads/" . PUBLISHER_DIRNAME . "/images/category/" . $arrCat['topic_imgurl']) ) ) { $categoryObj->setVar('image', $arrCat['topic_imgurl']); -//======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder + //======== there is no need to add the category images to Image Manager, because they are handled directly from /images/category/ folder /* @@ -272,7 +270,7 @@ */ -//============================ + //============================ } } @@ -283,8 +281,8 @@ } //copy all images to Image Manager - $src = $GLOBALS['xoops']->path("/uploads/xnews/topics/"); - $dst = $GLOBALS['xoops']->path("/uploads"); + $src = $GLOBALS['xoops']->path("uploads/xnews/topics/"); + $dst = $GLOBALS['xoops']->path("uploads"); PublisherUtilities::recurseCopy($src, $dst); //populate the Image Manager with images from xNews articles (by Bleekk) @@ -329,7 +327,7 @@ $itemObj->setVar('dobr', !$arrArticle['dobr']); $itemObj->setVar('item_tag', $arrArticle['tags']); $itemObj->setVar('notifypub', $arrArticle['notifypub']); -//-------- image + //-------- image $img_handler =& xoops_gethandler('image'); @@ -339,7 +337,7 @@ $itemObj->setVar('image', $newImageId); $itemObj->setVar('images', $newImageId); -//-------------- + //-------------- $itemObj->setVar('rating', $arrArticle['rating']); $itemObj->setVar('votes', $arrArticle['votes']); @@ -350,9 +348,9 @@ /* // HTML Wrap if ($arrArticle['htmlpage']) { - $pagewrap_filename = $GLOBALS['xoops']->path("/modules/wfsection/html/" .$arrArticle['htmlpage']); + $pagewrap_filename = $GLOBALS['xoops']->path("modules/wfsection/html/" .$arrArticle['htmlpage']); if (file_exists($pagewrap_filename)) { - if (copy($pagewrap_filename, $GLOBALS['xoops']->path("/uploads/publisher/content/" . $arrArticle['htmlpage']))) { + if (copy($pagewrap_filename, $GLOBALS['xoops']->path("uploads/publisher/content/" . $arrArticle['htmlpage']))) { $itemObj->setVar('body', "[pagewrap=" . $arrArticle['htmlpage'] . "]"); echo sprintf("    " . _AM_PUBLISHER_IMPORT_ARTICLE_WRAP, $arrArticle['htmlpage']) . "
"; } @@ -364,15 +362,15 @@ echo sprintf(" " . _AM_PUBLISHER_IMPORT_ARTICLE_ERROR, $arrArticle['storyid'] . ' ' . $arrArticle['title']) . "
"; continue; } else { -//-------------------------------------------- + //-------------------------------------------- // Linkes files $sql = "SELECT * FROM " . $GLOBALS['xoopsDB']->prefix("nw_stories_files") . " WHERE storyid=" . $arrArticle['storyid']; $resultFiles = $GLOBALS['xoopsDB']->query($sql); $allowed_mimetypes = ''; while (($arrFile = $GLOBALS['xoopsDB']->fetchArray($resultFiles)) !== false) { - $filename = $GLOBALS['xoops']->path("/uploads/xnews/attached/" . $arrFile['downloadname']); + $filename = $GLOBALS['xoops']->path("uploads/xnews/attached/" . $arrFile['downloadname']); if (file_exists($filename)) { - if (copy($filename, $GLOBALS['xoops']->path("/uploads/publisher/" . $arrFile['filerealname']))) { + if (copy($filename, $GLOBALS['xoops']->path("uploads/publisher/" . $arrFile['filerealname']))) { $fileObj = $publisher->getHandler('file')->create(); $fileObj->setVar('name', $arrFile['filerealname']); $fileObj->setVar('description', $arrFile['filerealname']); @@ -392,7 +390,7 @@ } } -//------------------------ + //------------------------ $newArticleArray[$arrArticle['storyid']] = $itemObj->itemid(); echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_ARTICLE, $itemObj->title()) . "
"; @@ -434,15 +432,15 @@ $publisher_module_id = $publisher->getModule()->mid(); - $comment_handler = xoops_gethandler('comment'); + $commentHandler = xoops_gethandler('comment'); $criteria = new CriteriaCompo(); $criteria->add(new Criteria('com_modid', $xnews_module_id)); - $comments = $comment_handler->getObjects($criteria); + $comments = $commentHandler->getObjects($criteria); foreach ($comments as $comment) { $comment->setVar('com_itemid', $newArticleArray[$comment->getVar('com_itemid')]); $comment->setVar('com_modid', $publisher_module_id); $comment->setNew(); - if (!$comment_handler->insert($comment)) { + if (!$commentHandler->insert($comment)) { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT_ERROR, $comment->getVar('com_title')) . "
"; } else { echo "  " . sprintf(_AM_PUBLISHER_IMPORTED_COMMENT, $comment->getVar('com_title')) . "
"; diff --git a/publisher/admin/menu.php b/publisher/admin/menu.php index f1a15074..40c20347 100644 --- a/publisher/admin/menu.php +++ b/publisher/admin/menu.php @@ -22,8 +22,8 @@ // defined("XOOPS_ROOT_PATH") || exit("XOOPS root path not defined"); $dirname = basename(dirname(__DIR__)); -$module_handler = xoops_gethandler('module'); -$module = $module_handler->getByDirname($dirname); +$moduleHandler = xoops_gethandler('module'); +$module = $moduleHandler->getByDirname($dirname); $pathIcon32 = $module->getInfo('icons32'); include_once dirname(__DIR__) . '/include/config.php'; diff --git a/publisher/admin/mimetypes.php b/publisher/admin/mimetypes.php index eaa40db0..c0f35aff 100644 --- a/publisher/admin/mimetypes.php +++ b/publisher/admin/mimetypes.php @@ -94,7 +94,7 @@ public static function add() $publisher = PublisherPublisher::getInstance(); global $limit, $start; $error = array(); - if (!(XoopsRequest::get('add_mime', '', 'POST'))) { + if (!(XoopsRequest::getString('add_mime', '', 'POST'))) { publisherCpHeader(); //publisher_adminMenu(4, _AM_PUBLISHER_MIMETYPES); @@ -771,7 +771,7 @@ public static function clearAddSession() */ public static function clearEditSessionVars($id) { - $id = intval($id); + $id = (int)($id); $session = PublisherSession::getInstance(); $session->del("publisher_editMime_$id"); $session->del("publisher_editMimeErr_$id"); diff --git a/publisher/admin/pw_upload_file.php b/publisher/admin/pw_upload_file.php index b534ba69..9d3c91c2 100644 --- a/publisher/admin/pw_upload_file.php +++ b/publisher/admin/pw_upload_file.php @@ -24,11 +24,11 @@ $errors = array(); if (publisher_pagewrap_upload($errors)) { - redirect_header(XoopsRequest::get('backto', '', 'POST'), 2, _AM_PUBLISHER_FILEUPLOAD_SUCCESS); + redirect_header(XoopsRequest::getString('backto', '', 'POST'), 2, _AM_PUBLISHER_FILEUPLOAD_SUCCESS); } else { $errorstxt = implode('
', $errors); $message = sprintf(_CO_PUBLISHER_MESSAGE_FILE_ERROR, $errorstxt); - redirect_header(XoopsRequest::get('backto', '', 'POST'), 5, $message); + redirect_header(XoopsRequest::getString('backto', '', 'POST'), 5, $message); } /** diff --git a/publisher/archive.php b/publisher/archive.php index eac4a13b..f2540538 100644 --- a/publisher/archive.php +++ b/publisher/archive.php @@ -81,8 +81,8 @@ foreach ($items as $item) { $time = XoopsLocal::formatTimestamp($item['datesub'], 'mysql', $useroffset); if (preg_match("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/", $time, $datetime)) { - $this_year = intval($datetime[1]); - $this_month = intval($datetime[2]); + $this_year = (int)($datetime[1]); + $this_month = (int)($datetime[2]); //first year if (empty($lastyear)) { $lastyear = $this_year; diff --git a/publisher/blocks/items_columns.php b/publisher/blocks/items_columns.php index 3e914017..e7304031 100644 --- a/publisher/blocks/items_columns.php +++ b/publisher/blocks/items_columns.php @@ -37,10 +37,10 @@ function publisher_items_columns_show($options) $publisher = PublisherPublisher::getInstance(); //Column Settings - $opt_num_columns = isset($options[0]) ? intval($options[0]) : '2'; + $opt_num_columns = isset($options[0]) ? (int)($options[0]) : '2'; $sel_categories = isset($options[1]) ? explode(',', $options[1]) : array(); - $opt_cat_items = intval($options[2]); - $opt_cat_truncate = isset($options[3]) ? intval($options[3]) : '0'; + $opt_cat_items = (int)($options[2]); + $opt_cat_truncate = isset($options[3]) ? (int)($options[3]) : '0'; $block = array(); $block['lang_reads'] = _MB_PUBLISHER_READS; @@ -130,7 +130,7 @@ function publisher_items_columns_show($options) $block['template'] = $options[4]; $block['columns'] = $columns; - $block['columnwidth'] = intval(100 / $opt_num_columns); + $block['columnwidth'] = (int)(100 / $opt_num_columns); $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/assets/css/publisher.css'); diff --git a/publisher/blocks/items_spot.php b/publisher/blocks/items_spot.php index 2dd623f6..608bcbab 100644 --- a/publisher/blocks/items_spot.php +++ b/publisher/blocks/items_spot.php @@ -38,7 +38,7 @@ function publisher_items_spot_show($options) $opt_display_poster = $options[4]; $opt_display_comment = $options[5]; $opt_display_type = $options[6]; - $opt_truncate = intval($options[7]); + $opt_truncate = (int)($options[7]); $opt_catimage = $options[8]; if ($opt_categoryid == 0) { $opt_categoryid = -1; @@ -107,7 +107,7 @@ function publisher_items_spot_show($options) $block['display_type'] = $opt_display_type; $block["publisher_url"] = PUBLISHER_URL; - $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/css/publisher.css'); + $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/' . PUBLISHER_DIRNAME . '/assets/css/publisher.css'); return $block; } diff --git a/publisher/blocks/latest_news.php b/publisher/blocks/latest_news.php index f611c48d..fa3dd458 100644 --- a/publisher/blocks/latest_news.php +++ b/publisher/blocks/latest_news.php @@ -49,7 +49,7 @@ function publisher_latest_news_show($options) $border = $options[13]; $bordercolor = $options[14]; - $block['spec']['columnwidth'] = intval(1 / $column_count * 100); + $block['spec']['columnwidth'] = (int)(1 / $column_count * 100); $allcats = false; if (!isset($options[29])) { diff --git a/publisher/blocks/search.php b/publisher/blocks/search.php index aed809a7..c342114a 100644 --- a/publisher/blocks/search.php +++ b/publisher/blocks/search.php @@ -29,8 +29,7 @@ * * @return array */ -function publisher_search_show($options) -{ +function publisher_search_show($options) { $block = array(); $publisher = PublisherPublisher::getInstance(); $categories = $publisher->getHandler('category')->getCategoriesForSearch(); @@ -40,9 +39,17 @@ function publisher_search_show($options) xoops_loadLanguage('search'); - $andor = XoopsRequest::getString('andor', XoopsRequest::getString('andor', '', 'GET'), 'POST'); + $andor = XoopsRequest::getString('andor', XoopsRequest::getString('andor', '', 'GET'), 'POST'); $username = XoopsRequest::getString('uname', XoopsRequest::getString('uname', null, 'GET'), 'POST'); - $searchin = XoopsRequest::getArray('searchin', (explode("|", XoopsRequest::getArray('searchin', array(), 'GET'))), 'POST'); +// $searchin = isset($_POST["searchin"]) ? $_POST["searchin"] : (isset($_GET["searchin"]) ? explode("|", $_GET["searchin"]) : array()); +// $searchin = XoopsRequest::getArray('searchin', (explode("|", XoopsRequest::getString('searchin', array(), 'GET'))), 'POST'); + + $searchin = XoopsRequest::getArray('searchin', '', 'POST'); + if (!isset($searchin)) { + $searchin = XoopsRequest::getString('searchin', array(), 'GET'); + $searchin = isset($searchin) ? explode("|", $searchin) : array(); + } + $sortby = XoopsRequest::getString('sortby', XoopsRequest::getString('sortby', null, 'GET'), 'POST'); $term = XoopsRequest::getString('term', XoopsRequest::getString('term', '', 'GET')); @@ -61,13 +68,19 @@ function publisher_search_show($options) /* type */ $type_select = ""; @@ -75,11 +88,15 @@ function publisher_search_show($options) $select_category = ""; $sortby_select .= ""); publisher_updateSelectOption(\'image_item\', \'image_featured\'); showImgSelected(\'image_display\', \'image_item\', \'uploads/\', \'\', \'' . XOOPS_URL . '\') diff --git a/publisher/class/formdatetime.php b/publisher/class/formdatetime.php index a8e39e25..5bae790f 100644 --- a/publisher/class/formdatetime.php +++ b/publisher/class/formdatetime.php @@ -36,7 +36,7 @@ class PublisherFormDateTime extends XoopsFormElementTray public function __construct($caption, $name, $size = 15, $value = 0) { parent::__construct($caption, ' '); - $value = intval($value); + $value = (int)($value); $value = ($value > 0) ? $value : time(); $datetime = getDate($value); $this->addElement(new XoopsFormTextDateSelect('', $name . '[date]', $size, $value)); diff --git a/publisher/class/groupperm.php b/publisher/class/groupperm.php index 40c59ba9..e53dcc43 100644 --- a/publisher/class/groupperm.php +++ b/publisher/class/groupperm.php @@ -45,7 +45,7 @@ public function checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_mo { $criteria = new CriteriaCompo(new Criteria('gperm_modid', $gperm_modid)); $criteria->add(new Criteria('gperm_name', $gperm_name)); - $gperm_itemid = intval($gperm_itemid); + $gperm_itemid = (int)($gperm_itemid); if ($gperm_itemid > 0) { $criteria->add(new Criteria('gperm_itemid', $gperm_itemid)); } diff --git a/publisher/class/item.php b/publisher/class/item.php index 4769c9f7..b1f96765 100644 --- a/publisher/class/item.php +++ b/publisher/class/item.php @@ -1004,9 +1004,9 @@ public function setVarsFromRequest() // if (version_compare(PHP_VERSION, '5.4.0') >= 0) { // $this->setVar('datesub', strtotime(XoopsRequest::getArray('datesub', array(), 'POST')['date']) + XoopsRequest::getArray('datesub', array(), 'POST')['time']); // } else { - $resDate = XoopsRequest::getArray('datesub', array(), 'POST')['date']; - $resTime = XoopsRequest::getArray('datesub', array(), 'POST')['time']; - $this->setVar('datesub', strtotime($resDate) + $resTime); + $resDate = (XoopsRequest::getArray('datesub', array(), 'POST')); + $resTime = (XoopsRequest::getArray('datesub', array(), 'POST')); + $this->setVar('datesub', strtotime($resDate['date']) + $resTime['time']); // } } elseif ($this->isnew()) { $this->setVar('datesub', time()); @@ -1812,8 +1812,8 @@ public function getCountsByCat($catId = 0, $status, $inSubCat = false) $ret = array(); $catsCount = array(); $sql = 'SELECT c.parentid, i.categoryid, COUNT(*) AS count FROM ' . $this->db->prefix('publisher_items') . ' AS i INNER JOIN ' . $this->db->prefix('publisher_categories') . ' AS c ON i.categoryid=c.categoryid'; - if (intval($catId) > 0) { - $sql .= ' WHERE i.categoryid = ' . intval($catId); + if ((int)($catId) > 0) { + $sql .= ' WHERE i.categoryid = ' . (int)($catId); $sql .= ' AND i.status IN (' . implode(',', $status) . ')'; } else { $sql .= ' WHERE i.status IN (' . implode(',', $status) . ')'; diff --git a/publisher/class/metagen.php b/publisher/class/metagen.php index 3f8302b4..55e64cd7 100644 --- a/publisher/class/metagen.php +++ b/publisher/class/metagen.php @@ -292,7 +292,7 @@ public static function generateSeoTitle($title = '', $withExt = true) $tableau = explode("-", $title); // Transforme la chaine de caractères en tableau $tableau = array_filter($tableau, array('PublisherMetagen', 'emptyString')); // Supprime les chaines vides du tableau $title = implode("-", $tableau); // Transforme un tableau en chaine de caractères séparé par un tiret - if (sizeof($title) > 0) { + if (count($title) > 0) { if ($withExt) { $title .= '.html'; } diff --git a/publisher/class/mimetype.php b/publisher/class/mimetype.php index aedb0b0b..24ce33ff 100644 --- a/publisher/class/mimetype.php +++ b/publisher/class/mimetype.php @@ -86,7 +86,7 @@ public function &create() */ public function &get($id) { - $id = intval($id); + $id = (int)($id); if ($id > 0) { $sql = $this->selectQuery(new Criteria($this->idfield, $id)); if (!$result = $this->db->query($sql)) { @@ -417,7 +417,7 @@ public function __construct(&$db) */ public function &get($id) { - $id = intval($id); + $id = (int)($id); if ($id > 0) { $sql = $this->selectQuery(new Criteria('mime_id', $id)); if (!$result = $this->db->query($sql)) { diff --git a/publisher/class/uploader.php b/publisher/class/uploader.php index 30e909c2..aa59e10c 100644 --- a/publisher/class/uploader.php +++ b/publisher/class/uploader.php @@ -121,12 +121,12 @@ public function __construct($uploadDir, $allowedMimeTypes = 0, $maxFileSize, $ma $this->allowedMimeTypes = $allowedMimeTypes; } $this->uploadDir = $uploadDir; - $this->maxFileSize = intval($maxFileSize); + $this->maxFileSize = (int)($maxFileSize); if (isset($maxWidth)) { - $this->maxWidth = intval($maxWidth); + $this->maxWidth = (int)($maxWidth); } if (isset($maxHeight)) { - $this->maxHeight = intval($maxHeight); + $this->maxHeight = (int)($maxHeight); } } @@ -155,7 +155,7 @@ public function fetchMedia($media_name, $index = null) return false; } elseif (is_array($_FILES[$media_name]['name']) && isset($index)) { - $index = intval($index); + $index = (int)($index); $this->mediaName = (get_magic_quotes_gpc()) ? stripslashes($_FILES[$media_name]['name'][$index]) : $_FILES[$media_name]['name'][$index]; $this->mediaType = $_FILES[$media_name]['type'][$index]; $this->mediaSize = $_FILES[$media_name]['size'][$index]; @@ -172,7 +172,7 @@ public function fetchMedia($media_name, $index = null) } $this->dimension = getimagesize($this->mediaTmpName); $this->errors = array(); - if (intval($this->mediaSize) < 0) { + if ((int)($this->mediaSize) < 0) { $this->setErrors('Invalid File Size'); return false; @@ -243,7 +243,7 @@ public function fetchMedia($media_name, $index = null) */ public function setTargetFileName($value) { - $this->targetFileName = strval(trim($value)); + $this->targetFileName = (string)(trim($value)); } /** @@ -253,7 +253,7 @@ public function setTargetFileName($value) */ public function setPrefix($value) { - $this->prefix = strval(trim($value)); + $this->prefix = (string)(trim($value)); } /** diff --git a/publisher/class/utilities.php b/publisher/class/utilities.php index fcc60f7b..f14e79b9 100644 --- a/publisher/class/utilities.php +++ b/publisher/class/utilities.php @@ -9,7 +9,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** - * PedigreeBreadcrumb Class + * PublisherUtilities Class * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license diff --git a/publisher/docs/changelog.txt b/publisher/docs/changelog.txt index 9fd6d97a..f1541b4c 100644 --- a/publisher/docs/changelog.txt +++ b/publisher/docs/changelog.txt @@ -1,4 +1,4 @@ -
1.02 RC1 (2015-xx-xx)
+
1.02 RC1 (2015-05-26)
- updated to XOOPS 2.5.7 version of jQuery UI Tabs (noo-b/mamba) - replaced PublisherRequest with calls to XoopsRequest (mamba) - redesigned archives section to have months horizontally (mjoel/Mithrandir/mamba) @@ -15,6 +15,8 @@ - centered mimetypes in the table (mamba) - updated popeye.js to 2.1 (mamba) - changed popeye mode to imagelist (mamba) +- replacing intval() with (int) (mamba) + TODO: - test with MySQL strict mode (STRICT_TRANS_TABLES) diff --git a/publisher/include/functions.php b/publisher/include/functions.php index a2065594..2105872d 100644 --- a/publisher/include/functions.php +++ b/publisher/include/functions.php @@ -989,9 +989,9 @@ function publisherGetEditors($allowedEditors = null) */ function publisherStringToInt($string = '', $length = 5) { - for ($i = 0, $final = "", $string = substr(md5($string), $length); $i < $length; $final .= intval($string[$i]), ++$i) ; + for ($i = 0, $final = "", $string = substr(md5($string), $length); $i < $length; $final .= (int)($string[$i]), ++$i) ; - return intval($final); + return (int)($final); } /** diff --git a/publisher/include/oninstall.php b/publisher/include/oninstall.php index c9513a30..e866f85a 100644 --- a/publisher/include/oninstall.php +++ b/publisher/include/oninstall.php @@ -34,8 +34,7 @@ function xoops_module_pre_install_publisher(XoopsModule &$xoopsModule) function xoops_module_install_publisher(XoopsModule &$xoopsModule) { xoops_loadLanguage('modinfo', $xoopsModule->getVar('dirname')); - include_once $GLOBALS['xoops']->path("/modules/" . $xoopsModule->getVar('dirname') . "/include/functions.php"); - xoops_loadLanguage('admin', $xoopsModule->getVar('dirname')); + include_once $GLOBALS['xoops']->path("modules/" . $xoopsModule->getVar('dirname') . "/include/functions.php"); $ret = true; $msg = ''; diff --git a/publisher/include/onupdate.php b/publisher/include/onupdate.php index e9495ac1..36577f11 100644 --- a/publisher/include/onupdate.php +++ b/publisher/include/onupdate.php @@ -26,7 +26,7 @@ function xoops_module_update_publisher(XoopsModule $module, $oldversion = null) if ($oldversion < 102) { // delete old html template files - $templateDirectory = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/templates/"); + $templateDirectory = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/templates/"); $template_list = array_diff(scandir($templateDirectory), array('..', '.')); foreach ($template_list as $k => $v) { $fileinfo = new SplFileInfo($templateDirectory . $v); @@ -37,7 +37,7 @@ function xoops_module_update_publisher(XoopsModule $module, $oldversion = null) } } // delete old block html template files - $templateDirectory = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/templates/blocks/"); + $templateDirectory = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/templates/blocks/"); $template_list = array_diff(scandir($templateDirectory), array('..', '.')); foreach ($template_list as $k => $v) { $fileinfo = new SplFileInfo($templateDirectory . $v); @@ -50,23 +50,23 @@ function xoops_module_update_publisher(XoopsModule $module, $oldversion = null) // Load class XoopsFile xoops_load('xoopsfile'); //delete /images directory - $imagesDirectory = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/images/"); + $imagesDirectory = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/images/"); $folderHandler = XoopsFile::getHandler("folder", $imagesDirectory); $folderHandler->delete($imagesDirectory); //delete /css directory - $cssDirectory = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/css/"); + $cssDirectory = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/css/"); $folderHandler = XoopsFile::getHandler("folder", $cssDirectory); $folderHandler->delete($cssDirectory); //delete /js directory - $jsDirectory = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/js/"); + $jsDirectory = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/js/"); $folderHandler = XoopsFile::getHandler("folder", $jsDirectory); $folderHandler->delete($jsDirectory); //delete /tcpdf directory - $tcpdfDirectory = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/tcpdf/"); + $tcpdfDirectory = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/tcpdf/"); $folderHandler = XoopsFile::getHandler("folder", $tcpdfDirectory); $folderHandler->delete($tcpdfDirectory); //delete /templates/style.css file -// $cssFile = $GLOBALS['xoops']->path("/modules/" . $module->getVar('dirname', 'n') . "/templates/style.css"); +// $cssFile = $GLOBALS['xoops']->path("modules/" . $module->getVar('dirname', 'n') . "/templates/style.css"); // $folderHandler = XoopsFile::getHandler("file", $cssFile); // $folderHandler->delete($cssFile); } diff --git a/publisher/include/seo_functions.php b/publisher/include/seo_functions.php index 452fa6ca..8df8cf33 100644 --- a/publisher/include/seo_functions.php +++ b/publisher/include/seo_functions.php @@ -62,7 +62,7 @@ public static function getTitle($title = '', $withExt = true) $rep_pat = array("-", "e", "e", "e", "e", "c", "a", "a", "a", "i", "i", "u", "u", "u", "o", "o"); $title = preg_replace($pattern, $rep_pat, $title); - if (sizeof($title) > 0) { + if (count($title) > 0) { if ($withExt) { $title .= '.html'; } @@ -84,7 +84,9 @@ public static function generateUrl($op, $id, $short_url = "") { $publisher = PublisherPublisher::getInstance(); if ($publisher->getConfig('seo_url_rewrite') != 'none') { - if (!empty($short_url)) $short_url = $short_url . '.html'; + if (!empty($short_url)) { + $short_url = $short_url . '.html'; + } if ($publisher->getConfig('seo_url_rewrite') == 'htaccess') { // generate SEO url using htaccess diff --git a/publisher/index.php b/publisher/index.php index 75e97ed0..6213e9c8 100644 --- a/publisher/index.php +++ b/publisher/index.php @@ -68,7 +68,7 @@ } // Max size of the title in the last item column -$lastitemsize = intval($publisher->getConfig('idxcat_last_item_size')); +$lastitemsize = (int)($publisher->getConfig('idxcat_last_item_size')); // Hide sub categories in main page only - hacked by Mowaffak if ($publisher->getConfig('idxcat_show_subcats') == 'nomain') { diff --git a/publisher/item.php b/publisher/item.php index b34ec147..f551fdb2 100644 --- a/publisher/item.php +++ b/publisher/item.php @@ -212,7 +212,7 @@ // Include the comments if the selected ITEM supports comments if ((($itemObj->cancomment() == 1) || !$publisher->getConfig('perm_com_art_level')) && ($publisher->getConfig('com_rule') <> 0)) { - include_once $GLOBALS['xoops']->path("/include/comment_view.php"); + include_once $GLOBALS['xoops']->path("include/comment_view.php"); // Problem with url_rewrite and posting comments : $xoopsTpl->assign(array( 'editcomment_link' => PUBLISHER_URL . '/comment_edit.php?com_itemid=' . $com_itemid . '&com_order=' . $com_order . '&com_mode=' . $com_mode . $link_extra, diff --git a/publisher/search.php b/publisher/search.php index 3bde1a29..ecaafe32 100644 --- a/publisher/search.php +++ b/publisher/search.php @@ -252,4 +252,4 @@ $xoopsTpl->assign("search_rule", sprintf(_SR_KEYIGNORE, $xoopsConfigSearch["keyword_min"])); } -include $GLOBALS['xoops']->path("/footer.php"); +include $GLOBALS['xoops']->path("footer.php"); diff --git a/publisher/templates/publisher_display_wfsection.tpl b/publisher/templates/publisher_display_wfsection.tpl index 352cfcb7..b5565f65 100644 --- a/publisher/templates/publisher_display_wfsection.tpl +++ b/publisher/templates/publisher_display_wfsection.tpl @@ -79,7 +79,7 @@ diff --git a/publisher/templates/publisher_header.tpl b/publisher/templates/publisher_header.tpl index 5fc6aa0a..da5fa46f 100644 --- a/publisher/templates/publisher_header.tpl +++ b/publisher/templates/publisher_header.tpl @@ -49,11 +49,10 @@ function toggleIcon(iconName) <{if $module_home}> <{$module_home}> <{if $title_and_welcome}> <{$lang_mainintro}> <{/if}> <{/if}> <{if $categoryPath}> - - <{if $module_home}> - > - <{/if}> - <{$categoryPath}> - + + <{if $module_home}> + > + <{/if}> + <{$categoryPath}> <{/if}> <{/if}> diff --git a/publisher/thumb.php b/publisher/thumb.php index c0229264..044308c3 100644 --- a/publisher/thumb.php +++ b/publisher/thumb.php @@ -591,7 +591,7 @@ protected function error($err) */ protected function haveErrors() { - if (sizeof($this->errors) > 0) { + if (count($this->errors) > 0) { return true; } diff --git a/publisher/xoops_version.php b/publisher/xoops_version.php index 56cfd14d..4fbd629d 100644 --- a/publisher/xoops_version.php +++ b/publisher/xoops_version.php @@ -31,8 +31,8 @@ $modversion = array( 'name' => _MI_PUBLISHER_MD_NAME, 'version' => '1.02', - 'module_status' => 'Beta 4', - 'release_date' => "2014/12/17", + 'module_status' => 'RC1', + 'release_date' => "2015/05/26", 'description' => _MI_PUBLISHER_MD_DESC, 'author' => 'Trabis (www.Xuups.com)', 'credits' => 'w4z004, hsalazar, Mithrandir, fx2024, Ackbarr, Mariuss, Marco, Michiel, phppp, outch, Xvitry, Catzwolf, Shine, McDonald, trabis, Mowaffak, Bandit-x, Shiva', @@ -77,12 +77,12 @@ ) ); -//include_once $GLOBALS['xoops']->path("/modules/" . $modversion['dirname'] . "/include/constants.php"); +//include_once $GLOBALS['xoops']->path("modules/" . $modversion['dirname'] . "/include/constants.php"); xoops_load('constants', $moduleDirName); /* $logo_filename = $modversion['dirname'] . "_logo.png"; -if (file_exists($GLOBALS['xoops']->path("/modules/" . $modversion['dirname'] . "/assets/images/" . $logo_filename))) { +if (file_exists($GLOBALS['xoops']->path("modules/" . $modversion['dirname'] . "/assets/images/" . $logo_filename))) { $modversion['image'] = "assets/images/{$logo_filename}"; } else { $modversion['image'] = "assets/images/module_logo.png";
- +