From a3f27c33e9310f2a508248e74d675a7942cf8841 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 15 Apr 2019 04:47:58 -0400 Subject: [PATCH] cleanup --- add.php | 15 ++- addlisting.php | 11 ++- admin/about0.php | 179 ---------------------------------- admin/admin_header.php | 4 - admin/category.php | 16 ++- admin/groupperms.php | 1 - admin/header.php | 94 ------------------ admin/install.php | 2 +- admin/main.php | 4 +- admin/options.php | 6 +- admin/validate_ads.php | 8 +- admin/view_ads.php | 8 +- blocks/maps.php | 1 - class/ClassifiedsTree.php | 3 +- class/Common/Configurator.php | 3 - class/Helper.php | 5 +- class/Pictures.php | 18 ++-- class/PicturesHandler.php | 16 +-- class/Utility.php | 5 +- include/comment_functions.php | 7 +- include/common.php | 8 +- include/notification.inc.php | 4 +- include/onupdate.php | 56 ----------- index.php | 13 +-- maps.php | 2 +- modify.php | 8 +- print.php | 2 +- rate-item.php | 7 +- rate-user.php | 4 +- report-abuse.php | 4 +- sendfriend.php | 4 +- seo_url.php | 16 +-- viewads.php | 3 +- viewcats.php | 8 +- 34 files changed, 98 insertions(+), 447 deletions(-) delete mode 100644 admin/about0.php delete mode 100644 admin/header.php diff --git a/add.php b/add.php index 6c6e2ac..6b5c140 100644 --- a/add.php +++ b/add.php @@ -68,8 +68,10 @@ // redirect_header( XOOPS_URL . "/modules/adslight/index.php", 2, $xoopsCaptcha->getMessage() ); // } if (Request::hasVar('submit', 'POST')) { + /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); - $myModule = $moduleHandler->getByDirname('adslight'); + /** @var \XoopsModule $myModule */ + $myModule = $moduleHandler->getByDirname('adslight'); $myModule->setErrors('Could not connect to the database.'); } @@ -127,10 +129,11 @@ $tags['TYPE'] = Adslight\Utility::getNameType($type); $tags['LINK_URL'] = XOOPS_URL . '/modules/adslight/viewads.php?' . '&lid=' . $lid; $sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cid); - $result2 = $xoopsDB->query($sql); - $row = $xoopsDB->fetchArray($result2); - $tags['CATEGORY_TITLE'] = $row['title']; - $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cid); + /** @var mysqli_result $result2 */ + $result2 = $xoopsDB->query($sql); + $row = $xoopsDB->fetchArray($result2); + $tags['CATEGORY_TITLE'] = $row['title']; + $tags['CATEGORY_URL'] = XOOPS_URL . '/modules/adslight/viewcats.php?cid="' . addslashes($cid); /** @var \XoopsNotificationHandler $notificationHandler */ $notificationHandler = xoops_getHandler('notification'); $notificationHandler->triggerEvent('global', 0, 'new_listing', $tags); @@ -151,6 +154,7 @@ $tags['NEED_TO_LOGIN'] = _ADSLIGHT_NEED_TO_LOGIN; $tags['ADMIN_LINK'] = XOOPS_URL . '/modules/adslight/admin/validate_ads.php'; $sql = 'SELECT title FROM ' . $xoopsDB->prefix('adslight_categories') . ' WHERE cid=' . addslashes($cid); + /** @var mysqli_result $result2 */ $result2 = $xoopsDB->query($sql); $row = $xoopsDB->fetchArray($result2); $tags['CATEGORY_TITLE'] = $row['title']; @@ -248,6 +252,7 @@ $mytree->makeMySelBox('title', 'title', $cid, 'cid'); $form->addElement(new \XoopsFormLabel(_ADSLIGHT_CAT3, ob_get_clean()), true); + /** @var mysqli_result $category */ $category = $xoopsDB->query('SELECT title, cat_moderate FROM ' . $xoopsDB->prefix('adslight_categories') . " WHERE cid='" . $xoopsDB->escape($cid) . "'"); list($cat_title, $cat_moderate) = $xoopsDB->fetchRow($category); diff --git a/addlisting.php b/addlisting.php index d136785..06e8c9b 100644 --- a/addlisting.php +++ b/addlisting.php @@ -67,10 +67,12 @@ redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors()); } - if ('' == Request::getString('title', '', 'POST')) { + if ('' === Request::getString('title', '', 'POST')) { // $eh->show('1001'); //'0001' => 'Could not connect to the forums database.', - $moduleHandler = $helper->getHandler('Module'); - $myModule = $moduleHandler->getByDirname('adslight'); + /** @var \XoopsModuleHandler $moduleHandler */ + $moduleHandler = xoops_getHandler('module'); + /** @var \XoopsModule $myModule */ + $myModule = $moduleHandler->getByDirname('adslight'); $myModule->setErrors('Could not connect to the database.'); } $cid = Request::getInt('cid', 0, 'POST'); @@ -107,7 +109,8 @@ // $xoopsDB->query($sql) || $eh->show('0013'); // '0013' => 'Could not query the database.', //
Error: ' . $GLOBALS['xoopsDB']->error() . '', $success = $xoopsDB->query($sql); if (!$success) { - $moduleHandler = $helper->getHandler('Module'); + /** @var \XoopsModuleHandler $moduleHandler */ + $moduleHandler = xoops_getHandler('module'); $myModule = $moduleHandler->getByDirname('adslight'); $myModule->setErrors('Could not query the database.'); } diff --git a/admin/about0.php b/admin/about0.php deleted file mode 100644 index 09d8239..0000000 --- a/admin/about0.php +++ /dev/null @@ -1,179 +0,0 @@ -get($xoopsModule->getVar('mid')); -echo ' - -'; -///// Présentation du Module -echo ' - - - -
' . $xoopsModule->getVar('name') . '
- -
-
' . $versioninfo->getInfo('name') . ' version ' . $versioninfo->getInfo('version') . '
- ' . $versioninfo->getInfo('release') . '
- ' . $versioninfo->getInfo('author') . '
- ' . $versioninfo->getInfo('credits') . '
- ' . $versioninfo->getInfo('license') . ' -

'; - -///// People who participate in improving the module -echo ' - '; - -//// iLuc /// -echo ""; - -//// Simon Roberts /// -echo "'; - -//// TXMod Xoops /// -echo "'; - -//// Patrick Seegers /// -echo "'; - -//// Saba /// -echo "'; - -//// aitor /// -echo "'; - -//// Scasmar /// -echo "'; - -//// Nikita /// -echo "'; - -//// John Mordo / Classifieds /// -echo "'; - -//// Grandoc / Classifieds /// -echo "'; - -//// Pascal Le Boustouller [ Original Author ] /// -echo " - - -
' . _AM_ADSLIGHT_PERSONS_PARTICIPATED . '

- Luc Bizet
- www.luc-bizet.fr
- AdsLight [Author]
- Improvements, corrections, reDesign for a lighter module : 'AdsLight'
-

- Simon Roberts
- www.chronolabs.coop
- XOOPS Support Website EN
- AdsLight 1.x
- Plugin Xpayment
-

- TXMod Xoops
- www.txmodxoops.org
- AdsLight 1.x
- Traduzione italiana
-

- Patrick Seegers
- Vanuit Den Helder
- Nederlandstalige XOOPS Support Website
- AdsLight 1.056
- Dutch Vertaling
-

- Saba
- sitio : Gornja Orahovica
- Webmaster : Xoops Bosnu i Hercegovinu
- AdsLight 1.055
- Prijevod Bosanskih
-

- aitor
- sitio : Uskola Informatica
- Administrador : Xoops España
- AdsLight
- Traducción al español utf8 del módulo. Y buenos consejos...
-

- scasmar
- Miembros : Xoops España
- AdsLight 1.052
- Traducción al español del módulo.
-

- Nikita
- www.aideordi.com
- AdsLight 1.00
- Author of the url rewriting, and various improvements and corrections.
-

- John Mordo user jlm69 at www.xoops.org
- www.jlmzone.com
- Classifieds [Author]
- Improvements and corrections. Started with the MyAds module and made MANY, MANY changes
-

- Grandoc
- www.olivet-online.com
- Classifieds
- Improvements and corrections.
-

- Pascal Le Boustouller [ Original Author ]
- -
- MyAds module
- Original Author
-

'; - -///// Change log du module //////// -// -// $file = XOOPS_ROOT_PATH. "/modules/adslight/changelog.txt"; -// if ( is_readable( $file ) ) { -// echo "
" . _AM_ADSLIGHT_ABOUT_CHANGELOG . " -//
-//
". utf8_encode(implode("
", file( $file ))) . "
-//
-//
-//
"; -// } - -xoops_cp_footer(); diff --git a/admin/admin_header.php b/admin/admin_header.php index c7ee244..68c9643 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -26,10 +26,6 @@ $moduleDirName = basename(dirname(__DIR__)); -//require_once dirname(__DIR__) . '/include/gtickets.php'; -// require_once dirname(__DIR__) . '/class/Utility.php'; -// require_once dirname(__DIR__) . '/class/classifiedstree.php'; -// require_once dirname(__DIR__) . '/class/grouppermform.php'; require_once dirname(dirname(dirname(__DIR__))) . '/class/xoopsform/grouppermform.php'; /** @var \XoopsModules\Adslight\Helper $helper */ diff --git a/admin/category.php b/admin/category.php index 7cc150a..be27b76 100644 --- a/admin/category.php +++ b/admin/category.php @@ -35,15 +35,12 @@ */ function adsNewCat($cid) { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts; + global $xoopsDB, $myts; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); - // require_once __DIR__ . '/header.php'; - - // loadModuleAdminMenu(1, ""); echo "
" . _AM_ADSLIGHT_ADDSUBCAT . ''; - // ShowImg(); + Adslight\Utility::showImage(); echo '


@@ -123,7 +120,7 @@ function adsNewCat($cid) */ function adsModCat($cid) { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts; + global $xoopsDB, $myts; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); @@ -253,7 +250,7 @@ function adsModCat($cid) */ function adsModCatS($cidd, $cid, $img, $title, $cat_desc, $cat_keywords, $cat_order, $affprice, $cat_moderate, $moderate_subcat) { - global $xoopsDB, $xoopsConfig, $myts; + global $xoopsDB, $myts; $title = $myts->htmlSpecialChars($title); $cidd = (int)$cidd; @@ -286,7 +283,7 @@ function adsModCatS($cidd, $cid, $img, $title, $cat_desc, $cat_keywords, $cat_or */ function adsAddCat($title, $cat_desc, $cat_keywords, $cid, $img, $cat_order, $affprice, $cat_moderate, $moderate_subcat) { - global $xoopsDB, $xoopsConfig, $myts; + global $xoopsDB, $myts; $moderate_subcat = (int)$moderate_subcat; $title = $myts->htmlSpecialChars($title); @@ -313,10 +310,9 @@ function adsAddCat($title, $cat_desc, $cat_keywords, $cid, $img, $cat_order, $af */ function adsDelCat($cid, $ok = 0) { - global $xoopsDB, $xoopsConfig, $xoopsModule; - $cid = (int)$cid; if (1 == (int)$ok) { + /** @var \XoopsMySQLDatabase $xoopsDB */ $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection(); $xoopsDB->queryF('DELETE FROM ' . $xoopsDB->prefix('adslight_categories') . " WHERE cid={$cid} OR pid={$cid}"); $xoopsDB->queryf('DELETE FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE cid={$cid}"); diff --git a/admin/groupperms.php b/admin/groupperms.php index f37984f..422f3b4 100644 --- a/admin/groupperms.php +++ b/admin/groupperms.php @@ -24,7 +24,6 @@ use XoopsModules\Adslight; require_once __DIR__ . '/admin_header.php'; -//require_once XOOPS_ROOT_PATH."/modules/adslight/class/classifiedstree.php"; $op = Request::getString('op', 'liste'); xoops_cp_header(); diff --git a/admin/header.php b/admin/header.php deleted file mode 100644 index 26ee22a..0000000 --- a/admin/header.php +++ /dev/null @@ -1,94 +0,0 @@ -getAdminMenu()) { - return false; - } - - $breadcrumb = empty($breadcrumb) ? $adminmenu[$currentoption]['title'] : $breadcrumb; - $module_link = XOOPS_URL . '/modules/adslight/'; - $image_link = XOOPS_URL . '/modules/adslight/images'; - - $adminMenu_text = ' - -
- - - - - -
- ' . $GLOBALS['xoopsModule']->getVar('name') . ' - - ' . $GLOBALS['xoopsModule']->getVar('name') . ' ' . $breadcrumb . ' -
-
-
- -
-
'; - - return $adminMenu_text; - } - -endif; diff --git a/admin/install.php b/admin/install.php index f02e717..4abd2d4 100644 --- a/admin/install.php +++ b/admin/install.php @@ -50,7 +50,7 @@ /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); $module = $moduleHandler->getByDirname('system'); -/** @var \XoopsModuleHandler $moduleHandler */ +/** @var \XoopsConfigHandler $configHandler */ $configHandler = xoops_getHandler('config'); $config_theme = $configHandler->getConfig($conf_id, true); diff --git a/admin/main.php b/admin/main.php index b17c1ec..ed09fd2 100644 --- a/admin/main.php +++ b/admin/main.php @@ -31,8 +31,8 @@ ##################################################### function index() { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext; - // require_once XOOPS_ROOT_PATH."/modules/adslight/class/classifiedstree.php"; + global $xoopsDB, $myts, $desctext; + $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); // require_once __DIR__ . '/admin_header.php'; diff --git a/admin/options.php b/admin/options.php index 4426bb9..db9bcc2 100644 --- a/admin/options.php +++ b/admin/options.php @@ -31,7 +31,7 @@ ##################################################### function index() { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $admin_lang; + global $xoopsDB, $myts, $admin_lang; // require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); // loadModuleAdminMenu(2, ""); @@ -175,7 +175,7 @@ function listingAddType($type) */ function listingModType($id_type) { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $admin_lang; + global $xoopsDB, $xoopsConfig, $myts, $admin_lang; // require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $id_type = (int)$id_type; @@ -432,7 +432,7 @@ function listingModUsure($id_usure) */ function listingModUsureS($id_usure, $nom_usure) { - global $xoopsDB, $xoopsConfig, $myts; + global $xoopsDB, $myts; $nom_usure = $myts->htmlSpecialChars($nom_usure); diff --git a/admin/validate_ads.php b/admin/validate_ads.php index d2f50c6..fc85292 100644 --- a/admin/validate_ads.php +++ b/admin/validate_ads.php @@ -34,7 +34,7 @@ ##################################################### function index() { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $admin_lang; + global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); $photo3 = ''; @@ -238,7 +238,7 @@ function index() */ function indexView($lid) { - global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $admin_lang; + global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); @@ -388,7 +388,7 @@ function indexView($lid) */ function modifyAds($lid) { - global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $admin_lang; + global $xoopsDB, $xoopsModule, $myts, $desctext, $admin_lang; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); @@ -594,7 +594,7 @@ function modifyAds($lid) */ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) { - global $xoopsDB, $xoopsConfig, $myts, $admin_lang; + global $xoopsDB, $myts, $admin_lang; $lid = (int)$lid; $cat = (int)$cat; diff --git a/admin/view_ads.php b/admin/view_ads.php index 24590d4..1de507d 100644 --- a/admin/view_ads.php +++ b/admin/view_ads.php @@ -31,7 +31,7 @@ ##################################################### function index() { - global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $admin_lang; + global $xoopsDB, $myts, $desctext, $admin_lang; // $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); $photo3 = ''; @@ -194,7 +194,7 @@ function index() */ function indexView($lid = null) { - global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $admin_lang; + global $xoopsDB, $myts, $desctext, $admin_lang; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); @@ -339,7 +339,7 @@ function indexView($lid = null) */ function modifyAds($lid) { - global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $admin_lang; + global $xoopsDB, $myts, $desctext, $admin_lang; $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid'); @@ -541,7 +541,7 @@ function modifyAds($lid) */ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo) { - global $xoopsDB, $xoopsConfig, $myts, $admin_lang; + global $xoopsDB, $myts, $admin_lang; $lid = (int)$lid; $cat = (int)$cat; diff --git a/blocks/maps.php b/blocks/maps.php index 9e045a0..94f3f44 100644 --- a/blocks/maps.php +++ b/blocks/maps.php @@ -58,7 +58,6 @@ function adslight_maps_show($options) */ function adslight_maps_edit($options) { - global $xoopsDB; $moduleDirName = basename(dirname(__DIR__)); $block_lang = '_MB_' . mb_strtoupper($moduleDirName); diff --git a/class/ClassifiedsTree.php b/class/ClassifiedsTree.php index 2587709..bf51e69 100644 --- a/class/ClassifiedsTree.php +++ b/class/ClassifiedsTree.php @@ -225,7 +225,7 @@ public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $se } $myts = \MyTextSanitizer::getInstance(); echo '