From: <be...@us...> - 2015-05-26 09:32:39
|
Revision: 13069 http://sourceforge.net/p/xoops/svn/13069 Author: beckmi Date: 2015-05-26 09:32:35 +0000 (Tue, 26 May 2015) Log Message: ----------- 1.02 RC-1 for XOOPS 2.5.7.1 (see changelog.txt) Modified Paths: -------------- XoopsModules/publisher/trunk/publisher/admin/about.php XoopsModules/publisher/trunk/publisher/admin/admin_header.php XoopsModules/publisher/trunk/publisher/admin/category.php XoopsModules/publisher/trunk/publisher/admin/clone.php XoopsModules/publisher/trunk/publisher/admin/file.php XoopsModules/publisher/trunk/publisher/admin/import/ams.php XoopsModules/publisher/trunk/publisher/admin/import/cjaycontent.php XoopsModules/publisher/trunk/publisher/admin/import/news.php XoopsModules/publisher/trunk/publisher/admin/import/smartsection.php XoopsModules/publisher/trunk/publisher/admin/import/wfsection.php XoopsModules/publisher/trunk/publisher/admin/import/xfsection.php XoopsModules/publisher/trunk/publisher/admin/import/xnews.php XoopsModules/publisher/trunk/publisher/admin/import.php XoopsModules/publisher/trunk/publisher/admin/index.php XoopsModules/publisher/trunk/publisher/admin/item.php XoopsModules/publisher/trunk/publisher/admin/main.php XoopsModules/publisher/trunk/publisher/admin/menu.php XoopsModules/publisher/trunk/publisher/admin/mimetypes.php XoopsModules/publisher/trunk/publisher/admin/pagewrap.php XoopsModules/publisher/trunk/publisher/admin/permissions.php XoopsModules/publisher/trunk/publisher/admin/preferences.php XoopsModules/publisher/trunk/publisher/admin/pw_delete_file.php XoopsModules/publisher/trunk/publisher/admin/pw_upload_file.php XoopsModules/publisher/trunk/publisher/archive.php XoopsModules/publisher/trunk/publisher/assets/css/jquery.popeye.style.css XoopsModules/publisher/trunk/publisher/assets/css/publisher.css XoopsModules/publisher/trunk/publisher/assets/images/popeye/loading3.gif XoopsModules/publisher/trunk/publisher/assets/js/behavior.js XoopsModules/publisher/trunk/publisher/assets/js/funcs.js XoopsModules/publisher/trunk/publisher/assets/js/rating.js XoopsModules/publisher/trunk/publisher/assets/js/script.easing.js XoopsModules/publisher/trunk/publisher/author_items.php XoopsModules/publisher/trunk/publisher/backend.php XoopsModules/publisher/trunk/publisher/blocks/category_items_sel.php XoopsModules/publisher/trunk/publisher/blocks/date_to_date.php XoopsModules/publisher/trunk/publisher/blocks/items_columns.php XoopsModules/publisher/trunk/publisher/blocks/items_menu.php XoopsModules/publisher/trunk/publisher/blocks/items_new.php XoopsModules/publisher/trunk/publisher/blocks/items_random_item.php XoopsModules/publisher/trunk/publisher/blocks/items_recent.php XoopsModules/publisher/trunk/publisher/blocks/items_spot.php XoopsModules/publisher/trunk/publisher/blocks/latest_files.php XoopsModules/publisher/trunk/publisher/blocks/latest_news.php XoopsModules/publisher/trunk/publisher/blocks/search.php XoopsModules/publisher/trunk/publisher/category.php XoopsModules/publisher/trunk/publisher/class/blockform.php XoopsModules/publisher/trunk/publisher/class/category.php XoopsModules/publisher/trunk/publisher/class/file.php XoopsModules/publisher/trunk/publisher/class/form/category.php XoopsModules/publisher/trunk/publisher/class/form/file.php XoopsModules/publisher/trunk/publisher/class/form/item.php XoopsModules/publisher/trunk/publisher/class/formdatetime.php XoopsModules/publisher/trunk/publisher/class/groupperm.php XoopsModules/publisher/trunk/publisher/class/highlighter.php XoopsModules/publisher/trunk/publisher/class/item.php XoopsModules/publisher/trunk/publisher/class/metagen.php XoopsModules/publisher/trunk/publisher/class/mimetype.php XoopsModules/publisher/trunk/publisher/class/permission.php XoopsModules/publisher/trunk/publisher/class/publisher.php XoopsModules/publisher/trunk/publisher/class/rating.php XoopsModules/publisher/trunk/publisher/class/session.php XoopsModules/publisher/trunk/publisher/class/themetabform.php XoopsModules/publisher/trunk/publisher/class/uploader.php XoopsModules/publisher/trunk/publisher/comment_delete.php XoopsModules/publisher/trunk/publisher/comment_edit.php XoopsModules/publisher/trunk/publisher/comment_new.php XoopsModules/publisher/trunk/publisher/comment_post.php XoopsModules/publisher/trunk/publisher/comment_reply.php XoopsModules/publisher/trunk/publisher/docs/changelog.txt XoopsModules/publisher/trunk/publisher/docs/readme.txt XoopsModules/publisher/trunk/publisher/file.php XoopsModules/publisher/trunk/publisher/footer.php XoopsModules/publisher/trunk/publisher/header.php XoopsModules/publisher/trunk/publisher/include/ajax_rating.php XoopsModules/publisher/trunk/publisher/include/ajax_upload.php XoopsModules/publisher/trunk/publisher/include/comment_functions.php XoopsModules/publisher/trunk/publisher/include/common.php XoopsModules/publisher/trunk/publisher/include/functions.php XoopsModules/publisher/trunk/publisher/include/media.textsanitizer.php XoopsModules/publisher/trunk/publisher/include/notification.inc.php XoopsModules/publisher/trunk/publisher/include/plugin.tag.php XoopsModules/publisher/trunk/publisher/include/search.inc.php XoopsModules/publisher/trunk/publisher/include/seo.inc.php XoopsModules/publisher/trunk/publisher/include/seo_functions.php XoopsModules/publisher/trunk/publisher/index.php XoopsModules/publisher/trunk/publisher/item.php XoopsModules/publisher/trunk/publisher/language/english/admin.php XoopsModules/publisher/trunk/publisher/language/english/blocks.php XoopsModules/publisher/trunk/publisher/language/english/common.php XoopsModules/publisher/trunk/publisher/language/english/help/help.html XoopsModules/publisher/trunk/publisher/language/english/main.php XoopsModules/publisher/trunk/publisher/language/english/modinfo.php XoopsModules/publisher/trunk/publisher/list.tag.php XoopsModules/publisher/trunk/publisher/makepdf.php XoopsModules/publisher/trunk/publisher/notification_update.php XoopsModules/publisher/trunk/publisher/pop.php XoopsModules/publisher/trunk/publisher/print.php XoopsModules/publisher/trunk/publisher/rate.php XoopsModules/publisher/trunk/publisher/search.php XoopsModules/publisher/trunk/publisher/submit.php XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_category_items_sel.tpl XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_columns.tpl XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_new.tpl XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_recent.tpl XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_items_spot.tpl XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_latest_news.tpl XoopsModules/publisher/trunk/publisher/templates/blocks/publisher_search_block.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_addfile.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_archive.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_display_full.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_display_list.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_display_summary.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_display_wfsection.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_header.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_item.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_print.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_rss.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_search.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_singleitem.tpl XoopsModules/publisher/trunk/publisher/templates/publisher_submit.tpl XoopsModules/publisher/trunk/publisher/thumb.php XoopsModules/publisher/trunk/publisher/view.tag.php XoopsModules/publisher/trunk/publisher/visit.php XoopsModules/publisher/trunk/publisher/xoops_version.php Added Paths: ----------- XoopsModules/publisher/trunk/publisher/admin/import/fmcontent.php XoopsModules/publisher/trunk/publisher/assets/css/jquery.popeye.css XoopsModules/publisher/trunk/publisher/assets/css/style.css XoopsModules/publisher/trunk/publisher/assets/images/logo.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/compact1.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/compact2.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/compact4.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/enlarge1.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/enlarge2.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/enlarge4.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/loading1.gif XoopsModules/publisher/trunk/publisher/assets/images/popeye/loading2.gif XoopsModules/publisher/trunk/publisher/assets/images/popeye/next1.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/pause3.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/play3.png XoopsModules/publisher/trunk/publisher/assets/images/popeye/prev1.png XoopsModules/publisher/trunk/publisher/assets/js/jquery.popeye-2.1.js XoopsModules/publisher/trunk/publisher/assets/js/jquery.popeye-2.1.min.js XoopsModules/publisher/trunk/publisher/class/constants.php XoopsModules/publisher/trunk/publisher/class/plugins/ XoopsModules/publisher/trunk/publisher/class/plugins/plugin.tag.php XoopsModules/publisher/trunk/publisher/class/utilities.php XoopsModules/publisher/trunk/publisher/config/ XoopsModules/publisher/trunk/publisher/config/index.html XoopsModules/publisher/trunk/publisher/include/config.php XoopsModules/publisher/trunk/publisher/include/oninstall.php XoopsModules/publisher/trunk/publisher/include/onupdate.php XoopsModules/publisher/trunk/publisher/tests/todo.txt Removed Paths: ------------- XoopsModules/publisher/trunk/publisher/admin/import/ams0.php XoopsModules/publisher/trunk/publisher/assets/images/module_logo.png XoopsModules/publisher/trunk/publisher/assets/js/jquery.popeye-2.0.4.js XoopsModules/publisher/trunk/publisher/class/request.php XoopsModules/publisher/trunk/publisher/include/constants.php XoopsModules/publisher/trunk/publisher/include/install.php XoopsModules/publisher/trunk/publisher/include/update.php Modified: XoopsModules/publisher/trunk/publisher/admin/about.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/about.php 2015-05-25 21:36:01 UTC (rev 13068) +++ XoopsModules/publisher/trunk/publisher/admin/about.php 2015-05-26 09:32:35 UTC (rev 13069) @@ -1,14 +1,14 @@ <?php -/* - You may not change or alter any portion of this comment or credits - of supporting developers from this source code or any supporting source code - which is considered copyrighted (c) material of the original comment or credit authors. +/** + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -*/ - /** * Publisher * @@ -20,7 +20,7 @@ * @version $Id$ */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; xoops_cp_header(); @@ -29,4 +29,11 @@ echo $aboutAdmin->addNavigation('about.php'); echo $aboutAdmin->renderabout('6KJ7RW5DR3VTJ', false); +// if (version_compare(PHP_VERSION, '5.4.0') >= 0) { +// echo 'I am at least PHP version 5.4.0, my version: ' . PHP_VERSION . "\n"; +// } else { +// echo 'I am using PHP lower than 5.4, my version: ' . PHP_VERSION . "\n"; +// } + + xoops_cp_footer(); Modified: XoopsModules/publisher/trunk/publisher/admin/admin_header.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/admin_header.php 2015-05-25 21:36:01 UTC (rev 13068) +++ XoopsModules/publisher/trunk/publisher/admin/admin_header.php 2015-05-26 09:32:35 UTC (rev 13069) @@ -1,12 +1,12 @@ <?php -/* - You may not change or alter any portion of this comment or credits - of supporting developers from this source code or any supporting source code - which is considered copyrighted (c) material of the original comment or credit authors. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +/** + * You may not change or alter any portion of this comment or credits + * of supporting developers from this source code or any supporting source code + * which is considered copyrighted (c) material of the original comment or credit authors. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** @@ -19,24 +19,21 @@ * @version $Id$ */ -include_once dirname(dirname(dirname(dirname(__FILE__)))) . '/mainfile.php'; -include_once dirname(dirname(__FILE__)) . '/include/common.php'; -include_once XOOPS_ROOT_PATH . '/include/cp_header.php'; +include_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; +include_once dirname(__DIR__) . '/include/common.php'; +include_once $GLOBALS['xoops']->path('include/cp_header.php'); //xoops_loadLanguage('admin', PUBLISHER_DIRNAME); xoops_loadLanguage('modinfo', PUBLISHER_DIRNAME); $imagearray = array( - 'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle' />", + 'editimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_edit.png' alt='" . _AM_PUBLISHER_ICO_EDIT . "' align='middle' />", 'deleteimg' => "<img src='" . PUBLISHER_IMAGES_URL . "/button_delete.png' alt='" . _AM_PUBLISHER_ICO_DELETE . "' align='middle' />", - 'online' => "<img src='" . PUBLISHER_IMAGES_URL . "/on.png' alt='" . _AM_PUBLISHER_ICO_ONLINE . "' align='middle' />", - 'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle' />", + 'online' => "<img src='" . PUBLISHER_IMAGES_URL . "/on.png' alt='" . _AM_PUBLISHER_ICO_ONLINE . "' align='middle' />", + 'offline' => "<img src='" . PUBLISHER_IMAGES_URL . "/off.png' alt='" . _AM_PUBLISHER_ICO_OFFLINE . "' align='middle' />", ); -if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) { - include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); -} else { - echo xoops_error('/Frameworks/moduleclasses/moduleadmin/ is required!!!'); -} +include_once $GLOBALS['xoops']->path('Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); + /* $myts = MyTextSanitizer::getInstance(); Modified: XoopsModules/publisher/trunk/publisher/admin/category.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/category.php 2015-05-25 21:36:01 UTC (rev 13068) +++ XoopsModules/publisher/trunk/publisher/admin/category.php 2015-05-26 09:32:35 UTC (rev 13069) @@ -19,32 +19,30 @@ * @version $Id$ */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; -$op = PublisherRequest::getString('op'); +$op = XoopsRequest::getString('op', '', 'GET'); -$op = isset($_POST['editor']) ? 'mod' : $op; -if (isset($_POST['addcategory'])) { - $op = 'addcategory'; -} +$op = (XoopsRequest::getString('editor', '', 'POST')) ? 'mod' : $op; +$op = (XoopsRequest::getString('addcategory', '', 'POST')) ? 'addcategory' : $op; // Where do we start ? -$startcategory = PublisherRequest::getInt('startcategory'); -$categoryid = PublisherRequest::getInt('categoryid'); +$startcategory = XoopsRequest::getInt('startcategory', 0, 'GET'); +$categoryid = XoopsRequest::getInt('categoryid'); switch ($op) { case "del": $categoryObj = $publisher->getHandler('category')->get($categoryid); - $confirm = (isset($_POST['confirm'])) ? $_POST['confirm'] : 0; - $name = (isset($_POST['name'])) ? $_POST['name'] : ''; + $confirm = XoopsRequest::getInt('confirm', '', 'POST'); + $name = XoopsRequest::getString('name', '', 'POST'); if ($confirm) { if (!$publisher->getHandler('category')->delete($categoryObj)) { redirect_header("category.php", 1, _AM_PUBLISHER_DELETE_CAT_ERROR); - exit(); +// exit(); } redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_COLISDELETED, $name)); - exit(); +// exit(); } else { xoops_cp_header(); xoops_confirm(array('op' => 'del', 'categoryid' => $categoryObj->categoryid(), 'confirm' => 1, 'name' => $categoryObj->name()), 'category.php', _AM_PUBLISHER_DELETECOL . " '" . $categoryObj->name() . "'. <br /> <br />" . _AM_PUBLISHER_DELETE_CAT_CONFIRM, _AM_PUBLISHER_DELETE); @@ -54,18 +52,18 @@ case "mod": //Added by fx2024 - $nb_subcats = isset($_POST['nb_subcats']) ? intval($_POST['nb_subcats']) : 0; - $nb_subcats = $nb_subcats + (isset($_POST['nb_sub_yet']) ? intval($_POST['nb_sub_yet']) : 4); + $nb_subcats = XoopsRequest::getInt('nb_subcats', 0, 'POST'); + $nb_subcats = $nb_subcats + (XoopsRequest::getInt('nb_sub_yet', 4, 'POST')); //end of fx2024 code - publisher_cpHeader(); - publisher_editCat(true, $categoryid, $nb_subcats); + publisherCpHeader(); + PublisherUtilities::editCategory(true, $categoryid, $nb_subcats); break; case "addcategory": global $modify; - $parentid = PublisherRequest::getInt('parentid'); + $parentid = XoopsRequest::getInt('parentid'); if ($categoryid != 0) { $categoryObj = $publisher->getHandler('category')->get($categoryid); @@ -75,136 +73,121 @@ // Uploading the image, if any // Retreive the filename to be uploaded - if (isset($_FILES['image_file']['name']) && $_FILES['image_file']['name'] != "") { - $filename = $_POST["xoops_upload_file"][0]; - if (!empty($filename) || $filename != "") { + 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 - $max_size = $publisher->getConfig('maximum_filesize'); - $max_imgwidth = $publisher->getConfig('maximum_image_width'); - $max_imgheight = $publisher->getConfig('maximum_image_height'); - $allowed_mimetypes = publisher_getAllowedImagesTypes(); + $max_size = $publisher->getConfig('maximum_filesize'); + $max_imgwidth = $publisher->getConfig('maximum_image_width'); + $max_imgheight = $publisher->getConfig('maximum_image_height'); + $allowed_mimetypes = publisherGetAllowedImagesTypes(); - if ($_FILES[$filename]['tmp_name'] == "" || !is_readable($_FILES[$filename]['tmp_name'])) { + if (!($tmp_name = (XoopsRequest::getArray('filename', array(), 'FILES')['tmp_name'])) || !is_readable($tmp_name)) { redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR); - exit(); +// exit(); } xoops_load('XoopsMediaUploader'); - $uploader = new XoopsMediaUploader(publisher_getImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); + $uploader = new XoopsMediaUploader(publisherGetImageDir('category'), $allowed_mimetypes, $max_size, $max_imgwidth, $max_imgheight); if ($uploader->fetchMedia($filename) && $uploader->upload()) { $categoryObj->setVar('image', $uploader->getSavedFileName()); } else { redirect_header('javascript:history.go(-1)', 2, _AM_PUBLISHER_FILEUPLOAD_ERROR . $uploader->getErrors()); - exit(); +// exit(); } } } else { - if (isset($_POST['image'])) { - $categoryObj->setVar('image', $_POST['image']); - } + $categoryObj->setVar('image', XoopsRequest::getString('image', '', 'POST')); } - $categoryObj->setVar('parentid', (isset($_POST['parentid'])) ? intval($_POST['parentid']) : 0); + $categoryObj->setVar('parentid', (XoopsRequest::getInt('parentid', 0, 'POST'))); - $applyall = isset($_POST['applyall']) ? intval($_POST['applyall']) : 0; - $categoryObj->setVar('weight', isset($_POST['weight']) ? intval($_POST['weight']) : 1); + $applyall = XoopsRequest::getInt('applyall', 0, 'POST'); + $categoryObj->setVar('weight', XoopsRequest::getInt('weight', 1, 'POST')); // Groups and permissions - $grpread = isset($_POST['groups_read']) ? $_POST['groups_read'] : array(); - $grpsubmit = isset($_POST['groups_submit']) ? $_POST['groups_submit'] : array(); - $grpmoderation = isset($_POST['groups_moderation']) ? $_POST['groups_moderation'] : array(); + $grpread = XoopsRequest::getArray('groupsRead', array(), 'POST'); + $grpsubmit = XoopsRequest::getArray('groupsSubmit', array(), 'POST'); + $grpmoderation = XoopsRequest::getArray('groupsModeration', array(), 'POST'); - $categoryObj->setVar('name', $_POST['name']); + $categoryObj->setVar('name', XoopsRequest::getString('name', '', 'POST')); //Added by skalpa: custom template support - if (isset($_POST['template'])) { - $categoryObj->setVar('template', $_POST['template']); - } + $categoryObj->setVar('template', XoopsRequest::getString('template', '', 'POST')); + $categoryObj->setVar('meta_description', XoopsRequest::getString('meta_description', '', 'POST')); + $categoryObj->setVar('meta_keywords', XoopsRequest::getString('meta_keywords', '', 'POST')); + $categoryObj->setVar('short_url', XoopsRequest::getString('short_url', '', 'POST')); + $categoryObj->setVar('moderator', XoopsRequest::getInt('moderator', 0, 'POST')); + $categoryObj->setVar('description', XoopsRequest::getString('description', '', 'POST')); + $categoryObj->setVar('header', XoopsRequest::getString('header', '', 'POST')); - if (isset($_POST['meta_description'])) { - $categoryObj->setVar('meta_description', $_POST['meta_description']); - } - if (isset($_POST['meta_keywords'])) { - $categoryObj->setVar('meta_keywords', $_POST['meta_keywords']); - } - if (isset($_POST['short_url'])) { - $categoryObj->setVar('short_url', $_POST['short_url']); - } - $categoryObj->setVar('moderator', intval($_POST['moderator'])); - $categoryObj->setVar('description', $_POST['description']); - - if (isset($_POST['header'])) { - $categoryObj->setVar('header', $_POST['header']); - } - if ($categoryObj->isNew()) { $redirect_msg = _AM_PUBLISHER_CATCREATED; - $redirect_to = 'category.php?op=mod'; + $redirect_to = 'category.php?op=mod'; } else { $redirect_msg = _AM_PUBLISHER_COLMODIFIED; - $redirect_to = 'category.php'; + $redirect_to = 'category.php'; } if (!$categoryObj->store()) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); - exit; + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_CATEGORY_SAVE_ERROR . publisherFormatErrors($categoryObj->getErrors())); +// exit; } // TODO : put this function in the category class - publisher_saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - publisher_saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + publisherSaveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + publisherSaveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + publisherSaveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); //Added by fx2024 $parentCat = $categoryObj->categoryid(); - $sizeof = sizeof($_POST['scname']); + $sizeof = count(XoopsRequest::getString('scname', '', 'POST')); for ($i = 0; $i < $sizeof; ++$i) { - if ($_POST['scname'][$i] != '') { + if (XoopsRequest::getArray('scname', array(), 'POST')[$i] != '') { $categoryObj = $publisher->getHandler('category')->create(); - $categoryObj->setVar('name', $_POST['scname'][$i]); + $categoryObj->setVar('name', XoopsRequest::getArray('scname', array(), 'POST')[$i]); $categoryObj->setVar('parentid', $parentCat); if (!$categoryObj->store()) { - redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisher_formatErrors($categoryObj->getErrors())); - exit; + redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_SUBCATEGORY_SAVE_ERROR . publisherFormatErrors($categoryObj->getErrors())); +// exit; } // TODO : put this function in the category class - publisher_saveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); - publisher_saveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); - publisher_saveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); + publisherSaveCategoryPermissions($grpread, $categoryObj->categoryid(), 'category_read'); + publisherSaveCategoryPermissions($grpsubmit, $categoryObj->categoryid(), 'item_submit'); + publisherSaveCategoryPermissions($grpmoderation, $categoryObj->categoryid(), 'category_moderation'); } } //end of fx2024 code redirect_header($redirect_to, 2, $redirect_msg); - exit(); +// exit(); break; //Added by fx2024 case "addsubcats": $categoryid = 0; - $nb_subcats = intval($_POST['nb_subcats']) + $_POST['nb_sub_yet']; + $nb_subcats = XoopsRequest::getInt('nb_subcats', 0, 'POST') + XoopsRequest::getInt('nb_sub_yet', 0, 'POST'); $categoryObj = $publisher->getHandler('category')->create(); - $categoryObj->setVar('name', $_POST['name']); - $categoryObj->setVar('description', $_POST['description']); - $categoryObj->setVar('weight', $_POST['weight']); + $categoryObj->setVar('name', XoopsRequest::getString('name', '', 'POST')); + $categoryObj->setVar('description', XoopsRequest::getString('description', '', 'POST')); + $categoryObj->setVar('weight', XoopsRequest::getInt('weight', 0, 'POST')); if (isset($parentCat)) { $categoryObj->setVar('parentid', $parentCat); } - publisher_cpHeader(); - publisher_editCat(true, $categoryid, $nb_subcats, $categoryObj); + publisherCpHeader(); + PublisherUtilities::editCategory(true, $categoryid, $nb_subcats, $categoryObj); exit(); - break; //end of fx2024 code case "cancel": redirect_header("category.php", 1, sprintf(_AM_PUBLISHER_BACK2IDX, '')); - exit(); - +// exit(); + break; case "default": default: - publisher_cpHeader(); + publisherCpHeader(); //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES); echo "<br />\n"; @@ -216,7 +199,7 @@ // Creating the objects for top categories $categoriesObj = $publisher->getHandler('category')->getCategories($publisher->getConfig('idxcat_perpage'), $startcategory, 0); - publisher_openCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); + publisherOpenCollapsableBar('createdcategories', 'createdcategoriesicon', _AM_PUBLISHER_CATEGORIES_TITLE, _AM_PUBLISHER_CATEGORIES_DSC); echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; echo "<tr>"; @@ -228,8 +211,9 @@ $totalCategories = $publisher->getHandler('category')->getCategoriesCount(0); if (count($categoriesObj) > 0) { foreach ($categoriesObj as $key => $thiscat) { - publisher_displayCategory($thiscat); + PublisherUtilities::displayCategory($thiscat); } + unset($key, $thiscat); } else { echo "<tr>"; echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOCAT . "</td>"; @@ -237,174 +221,14 @@ $categoryid = '0'; } echo "</table>\n"; - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; + include_once $GLOBALS['xoops']->path('class/pagenav.php'); $pagenav = new XoopsPageNav($totalCategories, $publisher->getConfig('idxcat_perpage'), $startcategory, 'startcategory'); echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; echo "<br />"; - publisher_closeCollapsableBar('createdcategories', 'createdcategoriesicon'); + publisherCloseCollapsableBar('createdcategories', 'createdcategoriesicon'); echo "<br>"; //editcat(false); break; } xoops_cp_footer(); - -function publisher_displayCategory($categoryObj, $level = 0) -{ - $publisher = PublisherPublisher::getInstance(); - - $description = $categoryObj->description(); - if (!XOOPS_USE_MULTIBYTES) { - if (strlen($description) >= 100) { - $description = substr($description, 0, (100 - 1)) . "..."; - } - } - $modify = "<a href='category.php?op=mod&categoryid=" . $categoryObj->categoryid() . "&parentid=" . $categoryObj->parentid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITCOL . "' alt='" . _AM_PUBLISHER_EDITCOL . "' /></a>"; - $delete = "<a href='category.php?op=del&categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETECOL . "' alt='" . _AM_PUBLISHER_DELETECOL . "' /></a>"; - - $spaces = ''; - for ($j = 0; $j < $level; $j++) { - $spaces .= ' '; - } - - echo "<tr>"; - echo "<td class='even' align='center'>" . $categoryObj->categoryid() . "</td>"; - echo "<td class='even' align='left'>" . $spaces . "<a href='" . PUBLISHER_URL . "/category.php?categoryid=" . $categoryObj->categoryid() . "'><img src='" . PUBLISHER_URL . "/assets/images/links/subcat.gif' alt='' /> " . $categoryObj->name() . "</a></td>"; - echo "<td class='even' align='center'>" . $categoryObj->weight() . "</td>"; - echo "<td class='even' align='center'> $modify $delete </td>"; - echo "</tr>"; - $subCategoriesObj = $publisher->getHandler('category')->getCategories(0, 0, $categoryObj->categoryid()); - if (count($subCategoriesObj) > 0) { - $level++; - foreach ($subCategoriesObj as $key => $thiscat) { - publisher_displayCategory($thiscat, $level); - } - } - unset($categoryObj); -} - -function publisher_editCat($showmenu = false, $categoryid = 0, $nb_subcats = 4, $categoryObj = null) -{ - $publisher = PublisherPublisher::getInstance(); - - // if there is a parameter, and the id exists, retrieve data: we're editing a category - if ($categoryid != 0) { - // Creating the category object for the selected category - $categoryObj = $publisher->getHandler('category')->get($categoryid); - if ($categoryObj->notLoaded()) { - redirect_header("category.php", 1, _AM_PUBLISHER_NOCOLTOEDIT); - exit(); - } - } else { - if (!$categoryObj) { - $categoryObj = $publisher->getHandler('category')->create(); - } - } - - if ($categoryid != 0) { - if ($showmenu) { - //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_EDITING); - } - echo "<br />\n"; - publisher_openCollapsableBar('edittable', 'edittableicon', _AM_PUBLISHER_EDITCOL, _AM_PUBLISHER_CATEGORY_EDIT_INFO); - } else { - if ($showmenu) { - //publisher_adminMenu(1, _AM_PUBLISHER_CATEGORIES . " > " . _AM_PUBLISHER_CREATINGNEW); - } - publisher_openCollapsableBar('createtable', 'createtableicon', _AM_PUBLISHER_CATEGORY_CREATE, _AM_PUBLISHER_CATEGORY_CREATE_INFO); - } - - $sform = $categoryObj->getForm($nb_subcats); - $sform->display(); - - if (!$categoryid) { - publisher_closeCollapsableBar('createtable', 'createtableicon'); - } else { - publisher_closeCollapsableBar('edittable', 'edittableicon'); - } - - //Added by fx2024 - if ($categoryid) { - $sel_cat = $categoryid; - - publisher_openCollapsableBar('subcatstable', 'subcatsicon', _AM_PUBLISHER_SUBCAT_CAT, _AM_PUBLISHER_SUBCAT_CAT_DSC); - // Get the total number of sub-categories - $categoriesObj = $publisher->getHandler('category')->get($sel_cat); - $totalsubs = $publisher->getHandler('category')->getCategoriesCount($sel_cat); - // creating the categories objects that are published - $subcatsObj = $publisher->getHandler('category')->getCategories(0, 0, $categoriesObj->categoryid()); - $totalSCOnPage = count($subcatsObj); - echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; - echo "<tr>"; - echo "<td width='60' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATID . "</strong></td>"; - echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_CATCOLNAME . "</strong></td>"; - echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_SUBDESCRIPT . "</strong></td>"; - echo "<td width='60' class='bg3' align='right'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; - echo "</tr>"; - if ($totalsubs > 0) { - foreach ($subcatsObj as $subcat) { - $modify = "<a href='category.php?op=mod&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_MODIFY . "' alt='" . _AM_PUBLISHER_MODIFY . "' /></a>"; - $delete = "<a href='category.php?op=del&categoryid=" . $subcat->categoryid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETE . "' alt='" . _AM_PUBLISHER_DELETE . "' /></a>"; - echo "<tr>"; - echo "<td class='head' align='left'>" . $subcat->categoryid() . "</td>"; - echo "<td class='even' align='left'><a href='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/category.php?categoryid=" . $subcat->categoryid() . "&parentid=" . $subcat->parentid() . "'>" . $subcat->name() . "</a></td>"; - echo "<td class='even' align='left'>" . $subcat->description() . "</td>"; - echo "<td class='even' align='right'> {$modify} {$delete} </td>"; - echo "</tr>"; - } - } else { - echo "<tr>"; - echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOSUBCAT . "</td>"; - echo "</tr>"; - } - echo "</table>\n"; - echo "<br />\n"; - publisher_closeCollapsableBar('subcatstable', 'subcatsicon'); - - publisher_openCollapsableBar('bottomtable', 'bottomtableicon', _AM_PUBLISHER_CAT_ITEMS, _AM_PUBLISHER_CAT_ITEMS_DSC); - $startitem = PublisherRequest::getInt('startitem'); - // Get the total number of published ITEMS - $totalitems = $publisher->getHandler('item')->getItemsCount($sel_cat, array(_PUBLISHER_STATUS_PUBLISHED)); - // creating the items objects that are published - $itemsObj = $publisher->getHandler('item')->getAllPublished($publisher->getConfig('idxcat_perpage'), $startitem, $sel_cat); - $totalitemsOnPage = count($itemsObj); - $allcats = $publisher->getHandler('category')->getObjects(null, true); - echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; - echo "<tr>"; - echo "<td width='40' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ITEMID . "</strong></td>"; - echo "<td width='20%' class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMCOLNAME . "</strong></td>"; - echo "<td class='bg3' align='left'><strong>" . _AM_PUBLISHER_ITEMDESC . "</strong></td>"; - echo "<td width='90' class='bg3' align='center'><strong>" . _AM_PUBLISHER_CREATED . "</strong></td>"; - echo "<td width='60' class='bg3' align='center'><strong>" . _AM_PUBLISHER_ACTION . "</strong></td>"; - echo "</tr>"; - if ($totalitems > 0) { - for ($i = 0; $i < $totalitemsOnPage; ++$i) { - $categoryObj = $allcats[$itemsObj[$i]->categoryid()]; - $modify = "<a href='item.php?op=mod&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/assets/images/links/edit.gif' title='" . _AM_PUBLISHER_EDITITEM . "' alt='" . _AM_PUBLISHER_EDITITEM . "' /></a>"; - $delete = "<a href='item.php?op=del&itemid=" . $itemsObj[$i]->itemid() . "'><img src='" . XOOPS_URL . "/modules/" . $publisher->getModule()->dirname() . "/assets/images/links/delete.png' title='" . _AM_PUBLISHER_DELETEITEM . "' alt='" . _AM_PUBLISHER_DELETEITEM . "'/></a>"; - echo "<tr>"; - echo "<td class='head' align='center'>" . $itemsObj[$i]->itemid() . "</td>"; - echo "<td class='even' align='left'>" . $categoryObj->name() . "</td>"; - echo "<td class='even' align='left'>" . $itemsObj[$i]->getitemLink() . "</td>"; - echo "<td class='even' align='center'>" . $itemsObj[$i]->datesub('s') . "</td>"; - echo "<td class='even' align='center'> $modify $delete </td>"; - echo "</tr>"; - } - } else { - $itemid = -1; - echo "<tr>"; - echo "<td class='head' align='center' colspan= '7'>" . _AM_PUBLISHER_NOITEMS . "</td>"; - echo "</tr>"; - } - echo "</table>\n"; - echo "<br />\n"; - $parentid = PublisherRequest::getInt('parentid'); - $pagenav_extra_args = "op=mod&categoryid=$sel_cat&parentid=$parentid"; - xoops_load('XoopsPageNav'); - $pagenav = new XoopsPageNav($totalitems, $publisher->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenav_extra_args); - echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; - echo "<input type='button' name='button' onclick=\"location='item.php?op=mod&categoryid=" . $sel_cat . "'\" value='" . _AM_PUBLISHER_CREATEITEM . "'> "; - echo "</div>"; - } - //end of fx2024 code -} Modified: XoopsModules/publisher/trunk/publisher/admin/clone.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/clone.php 2015-05-25 21:36:01 UTC (rev 13068) +++ XoopsModules/publisher/trunk/publisher/admin/clone.php 2015-05-26 09:32:35 UTC (rev 13069) @@ -18,45 +18,45 @@ * @version $Id$ */ -include_once dirname(__FILE__) . "/admin_header.php"; +include_once __DIR__ . "/admin_header.php"; -publisher_cpHeader(); +publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_CLONE); -publisher_openCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); +publisherOpenCollapsableBar('clone', 'cloneicon', _AM_PUBLISHER_CLONE, _AM_PUBLISHER_CLONE_DSC); -if (@$_POST['op'] == 'submit') { - +if ('submit' == XoopsRequest::getString('op', '', 'POST')) { if (!$GLOBALS['xoopsSecurity']->check()) { redirect_header('clone.php', 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); - exit(); +// exit(); } - $clone = $_POST['clone']; +// $clone = $_POST['clone']; + $clone = XoopsRequest::getString('clone', '', 'POST'); //check if name is valid if (empty($clone) || preg_match('/[^a-zA-Z0-9\_\-]/', $clone)) { redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_INVALIDNAME, $clone)); - exit(); +// exit(); } // Check wether the cloned module exists or not - if ($clone && is_dir(XOOPS_ROOT_PATH . '/modules/' . $clone)) { + if ($clone && is_dir($GLOBALS['xoops']->path('modules/' . $clone))) { redirect_header('clone.php', 3, sprintf(_AM_PUBLISHER_CLONE_EXISTS, $clone)); } $patterns = array( - strtolower(PUBLISHER_DIRNAME) => strtolower($clone), - strtoupper(PUBLISHER_DIRNAME) => strtoupper($clone), + strtolower(PUBLISHER_DIRNAME) => strtolower($clone), + strtoupper(PUBLISHER_DIRNAME) => strtoupper($clone), ucfirst(strtolower(PUBLISHER_DIRNAME)) => ucfirst(strtolower($clone)) ); - $patKeys = array_keys($patterns); + $patKeys = array_keys($patterns); $patValues = array_values($patterns); - publisher_cloneFileFolder(PUBLISHER_ROOT_PATH); - $logocreated = publisher_createLogo(strtolower($clone)); + PublisherClone::cloneFileFolder(PUBLISHER_ROOT_PATH); + $logocreated = PublisherClone::createLogo(strtolower($clone)); $msg = ""; - if (is_dir(XOOPS_ROOT_PATH . '/modules/' . strtolower($clone))) { + if (is_dir($GLOBALS['xoops']->path('modules/' . strtolower($clone)))) { $msg .= sprintf(_AM_PUBLISHER_CLONE_CONGRAT, "<a href='" . XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin'>" . ucfirst(strtolower($clone)) . "</a>") . "<br />\n"; if (!$logocreated) { $msg .= _AM_PUBLISHER_CLONE_IMAGEFAIL; @@ -67,8 +67,8 @@ echo $msg; } else { - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; - $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true); + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); + $form = new XoopsThemeForm(sprintf(_AM_PUBLISHER_CLONE_TITLE, $publisher->getModule()->getVar('name', 'E')), 'clone', 'clone.php', 'post', true); $clone = new XoopsFormText(_AM_PUBLISHER_CLONE_NAME, 'clone', 20, 20, ''); $clone->setDescription(_AM_PUBLISHER_CLONE_NAME_DSC); $form->addElement($clone, true); @@ -78,89 +78,106 @@ } // End of collapsable bar -publisher_closeCollapsableBar('clone', 'cloneicon'); +publisherCloseCollapsableBar('clone', 'cloneicon'); xoops_cp_footer(); // work around for PHP < 5.0.x +/* if (!function_exists('file_put_contents')) { function file_put_contents($filename, $data, $file_append = false) { - if ($fp = fopen($filename, (!$file_append ? 'w+' : 'a+'))) { + if ($fp == fopen($filename, (!$file_append ? 'w+' : 'a+'))) { fputs($fp, $data); fclose($fp); } } } +*/ +/** + * Class PublisherClone + */ +class PublisherClone +{ + // recursive clonning script -function publisher_cloneFileFolder($path) -{ + /** + * @param $path + */ + public static function cloneFileFolder($path) + { global $patKeys; global $patValues; - $newPath = str_replace($patKeys[0], $patValues[0], $path); + $newPath = str_replace($patKeys[0], $patValues[0], $path); - if (is_dir($path)) { - // create new dir - mkdir($newPath); + if (is_dir($path)) { + // create new dir + mkdir($newPath); - // check all files in dir, and process it - if ($handle = opendir($path)) { - while ($file = readdir($handle)) { - if ($file != '.' && $file != '..' && $file != '.svn') { - publisher_cloneFileFolder("{$path}/{$file}"); + // check all files in dir, and process it + if ($handle == opendir($path)) { + while (($file = readdir($handle)) !== false) { + if ($file != '.' && $file != '..' && $file != '.svn') { + self::cloneFileFolder("{$path}/{$file}"); + } } + closedir($handle); } - closedir($handle); - } - } else { - - if (preg_match('/(.jpg|.gif|.png|.zip)$/i', $path)) { - // image - copy($path, $newPath); } else { - // file, read it - $content = file_get_contents($path); - $content = str_replace($patKeys, $patValues, $content); - file_put_contents($newPath, $content); + if (preg_match('/(.jpg|.gif|.png|.zip)$/i', $path)) { + // image + copy($path, $newPath); + } else { + // file, read it + $content = file_get_contents($path); + $content = str_replace($patKeys, $patValues, $content); + file_put_contents($newPath, $content); + } } } -} -function publisher_createLogo($dirname) -{ - if (!extension_loaded("gd")) { - return false; - } else { - $required_functions = array("imagecreatetruecolor", "imagecolorallocate", "imagefilledrectangle", "imagejpeg", "imagedestroy", "imageftbbox"); - foreach ($required_functions as $func) { - if (!function_exists($func)) { - return false; + /** + * @param $dirname + * + * @return bool + */ + public static function createLogo($dirname) + { + if (!extension_loaded("gd")) { + return false; + } else { + $required_functions = array("imagecreatetruecolor", "imagecolorallocate", "imagefilledrectangle", "imagejpeg", "imagedestroy", "imageftbbox"); + foreach ($required_functions as $func) { + if (!function_exists($func)) { + return false; + } } + unset($func); } - } - if (!file_exists($imageBase = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/module_logo.png") || !file_exists($font = XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/VeraBd.ttf")) { - return false; - } + 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; + } - $imageModule = imagecreatefrompng($imageBase); + $imageModule = imagecreatefrompng($imageBase); - //Erase old text - $grey_color = imagecolorallocate($imageModule, 237, 237, 237); - imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color); + //Erase old text + $grey_color = imagecolorallocate($imageModule, 237, 237, 237); + imagefilledrectangle($imageModule, 5, 35, 85, 46, $grey_color); - // Write text - $text_color = imagecolorallocate($imageModule, 0, 0, 0); - $space_to_border = (80 - strlen($dirname) * 6.5) / 2; - imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array()); + // Write text + $text_color = imagecolorallocate($imageModule, 0, 0, 0); + $space_to_border = (80 - strlen($dirname) * 6.5) / 2; + imagefttext($imageModule, 8.5, 0, $space_to_border, 45, $text_color, $font, ucfirst($dirname), array()); - // Set transparency color - $white = imagecolorallocatealpha($imageModule, 255, 255, 255, 127); - imagefill($imageModule, 0, 0, $white); - imagecolortransparent($imageModule, $white); - imagepng($imageModule, XOOPS_ROOT_PATH . "/modules/" . $dirname . "/assets/images/module_logo.png"); - imagedestroy($imageModule); + // Set transparency color + $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")); + imagedestroy($imageModule); - return true; + return true; + } } Modified: XoopsModules/publisher/trunk/publisher/admin/file.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/file.php 2015-05-25 21:36:01 UTC (rev 13068) +++ XoopsModules/publisher/trunk/publisher/admin/file.php 2015-05-26 09:32:35 UTC (rev 13069) @@ -19,24 +19,28 @@ * @version $Id$ */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; -$op = PublisherRequest::getString('op'); +$op = XoopsRequest::getString('op'); +/** + * @param bool $showmenu + * @param int $fileid + * @param int $itemid + */ function publisher_editFile($showmenu = false, $fileid = 0, $itemid = 0) { $publisher = PublisherPublisher::getInstance(); - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); // if there is a parameter, and the id exists, retrieve data: we're editing a file if ($fileid != 0) { - // Creating the File object $fileObj = $publisher->getHandler('file')->get($fileid); if ($fileObj->notLoaded()) { redirect_header("javascript:history.go(-1)", 1, _AM_PUBLISHER_NOFILESELECTED); - exit(); +// exit(); } if ($showmenu) { @@ -44,9 +48,9 @@ } echo "<br />\n"; - echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_EDITING . "</span>"; + echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 6px 0 0; '>" . _AM_PUBLISHER_FILE_EDITING . "</span>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_EDITING_DSC . "</span>"; - publisher_openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + publisherOpenCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item $fileObj = $publisher->getHandler('file')->create(); @@ -54,9 +58,9 @@ if ($showmenu) { //publisher_adminMenu(2, _AM_PUBLISHER_FILE . " > " . _AM_PUBLISHER_FILE_ADD); } - echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 06 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . "</span>"; + echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 6px 0 0; '>" . _AM_PUBLISHER_FILE_ADDING . "</span>"; echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_FILE_ADDING_DSC . "</span>"; - publisher_openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + publisherOpenCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM @@ -64,9 +68,9 @@ $files_form->display(); if ($fileid != 0) { - publisher_closeCollapsableBar('editfile', 'editfileicon'); + publisherCloseCollapsableBar('editfile', 'editfileicon'); } else { - publisher_closeCollapsableBar('addfile', 'addfileicon'); + publisherCloseCollapsableBar('addfile', 'addfileicon'); } } @@ -75,31 +79,31 @@ /* -- Available operations -- */ switch ($op) { case "uploadfile"; - publisher_uploadFile(false, true, $false); + publisherUploadFile(false, true, $false); exit; break; case "uploadanother"; - publisher_uploadFile(true, true, $false); + publisherUploadFile(true, true, $false); exit; break; case "mod": - $fileid = isset($_GET['fileid']) ? $_GET['fileid'] : 0; - $itemid = isset($_GET['itemid']) ? $_GET['itemid'] : 0; + $fileid = XoopsRequest::getInt('fileid', 0, 'GET'); + $itemid = XoopsRequest::getInt('itemid', 0, 'GET'); if (($fileid == 0) && ($itemid == 0)) { redirect_header("javascript:history.go(-1)", 3, _AM_PUBLISHER_NOITEMSELECTED); - exit(); +// exit(); } - publisher_cpHeader(); - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + publisherCpHeader(); + include_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); publisher_editFile(true, $fileid, $itemid); break; case "modify": - $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0; + $fileid = XoopsRequest::getInt('fileid', 0, 'POST'); // Creating the file object if ($fileid != 0) { @@ -109,43 +113,43 @@ } // Putting the values in the file object - $fileObj->setVar('name', $_POST['name']); - $fileObj->setVar('description', $_POST['description']); - $fileObj->setVar('status', intval($_POST['file_status'])); + $fileObj->setVar('name', XoopsRequest::getString('name', '', 'POST')); + $fileObj->setVar('description', XoopsRequest::getString('description', '', 'POST')); + $fileObj->setVar('status', XoopsRequest::getInt('status', 0, 'POST')); // Storing the file if (!$fileObj->store()) { - redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisher_formatErrors($fileObj->getErrors())); - exit; + redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 3, _AM_PUBLISHER_FILE_EDITING_ERROR . publisherFormatErrors($fileObj->getErrors())); +// exit; } redirect_header('item.php?op=mod&itemid=' . $fileObj->itemid(), 2, _AM_PUBLISHER_FILE_EDITING_SUCCESS); - exit(); +// exit(); break; case "del": - $fileid = isset($_POST['fileid']) ? intval($_POST['fileid']) : 0; - $fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : $fileid; + $fileid = XoopsRequest::getInt('fileid', 0, 'POST'); + $fileid = XoopsRequest::getInt('fileid', $fileid, 'GET'); $fileObj = $publisher->getHandler('file')->get($fileid); - $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; - $title = isset($_POST['title']) ? $_POST['title'] : ''; + $confirm = XoopsRequest::getInt('confirm', 0, 'POST'); + $title = XoopsRequest::getString('title', '', 'POST'); if ($confirm) { if (!$publisher->getHandler('file')->delete($fileObj)) { redirect_header('item.php', 2, _AM_PUBLISHER_FILE_DELETE_ERROR); - exit; +// exit; } redirect_header('item.php', 2, sprintf(_AM_PUBLISHER_FILEISDELETED, $fileObj->name())); - exit(); +// exit(); } else { // no confirm: show deletion condition - $fileid = isset($_GET['fileid']) ? intval($_GET['fileid']) : 0; + $fileid = XoopsRequest::getInt('fileid', 0, 'GET'); - publisher_cpHeader(); + publisherCpHeader(); xoops_confirm(array('op' => 'del', 'fileid' => $fileObj->fileid(), 'confirm' => 1, 'name' => $fileObj->name()), 'file.php', _AM_PUBLISHER_DELETETHISFILE . " <br />" . $fileObj->name() . " <br /> <br />", _AM_PUBLISHER_DELETE); xoops_cp_footer(); } @@ -155,7 +159,7 @@ case "default": default: - publisher_cpHeader(); + publisherCpHeader(); //publisher_adminMenu(2, _AM_PUBLISHER_ITEMS); break; } Modified: XoopsModules/publisher/trunk/publisher/admin/import/ams.php =================================================================== --- XoopsModules/publisher/trunk/publisher/admin/import/ams.php 2015-05-25 21:36:01 UTC (rev 13068) +++ XoopsModules/publisher/trunk/publisher/admin/import/ams.php 2015-05-26 09:32:35 UTC (rev 13069) @@ -20,52 +20,32 @@ * @version $Id$ */ -include_once dirname(dirname(__FILE__)) . '/admin_header.php'; +include_once dirname(__DIR__) . '/admin_header.php'; $myts = MyTextSanitizer::getInstance(); -$importFromModuleName = "xNews " . @$_POST['ams_version']; +$importFromModuleName = "xNews " . XoopsRequest::getString('ams_version', '', 'POST'); $scriptname = "ams.php"; -$op = 'start'; +$op = ('go' == XoopsRequest::getString('op', '', 'POST')) ? 'go' : 'start'; -if (isset($_POST['op']) && ($_POST['op'] == 'go')) { - $op = $_POST['op']; -} - -function recurse_copy($src,$dst) -{ - $dir = opendir($src); -// @mkdir($dst); - while (false !== ( $file = readdir($dir)) ) { - if (( $file != '.' ) && ( $file != '..' )) { - if ( is_dir($src . '/' . $file) ) { - recurse_copy($src . '/' . $file,$dst . '/' . $file); - } else { - copy($src . '/' . $file,$dst . '/' . $file); - } - } - } - closedir($dir); -} - if ($op == 'start') { xoops_load('XoopsFormLoader'); - publisher_cpHeader(); + publisherCpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - publisher_openCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); + publisherOpenCollapsableBar('amsimport', 'amsimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $result = $xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("ams_topics")); - list ($totalCat) = $xoopsDB->fetchRow($result); + $result = $GLOBALS['xoopsDB']->query("SELECT COUNT(*) FROM " . $GLOBALS['xoopsDB']->prefix("ams_topics")); + list ($totalCat) = $GLOBALS['xoopsDB']->fetchRow($result); if ($totalCat == 0) { echo "<span style=\"color: #567; margin: 3px 0 12px 0; font-size: small; display: block; \">" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . "</span>"; } else { - include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; + include_once $GLOBALS['xoops']->path('class/xoopstree.php'); - $result = $xoopsDB->query... [truncated message content] |