Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mambax7 committed Apr 15, 2019
1 parent 61d4788 commit a3f27c3
Show file tree
Hide file tree
Showing 34 changed files with 98 additions and 447 deletions.
15 changes: 10 additions & 5 deletions add.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}

Expand Down Expand Up @@ -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);
Expand All @@ -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'];
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 7 additions & 4 deletions addlisting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -107,7 +109,8 @@
// $xoopsDB->query($sql) || $eh->show('0013'); // '0013' => 'Could not query the database.', // <br>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.');
}
Expand Down
179 changes: 0 additions & 179 deletions admin/about0.php

This file was deleted.

4 changes: 0 additions & 4 deletions admin/admin_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
16 changes: 6 additions & 10 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_ADSLIGHT_ADDSUBCAT . '</legend>';
// ShowImg();

Adslight\Utility::showImage();

echo '<form method="post" action="category.php" name="imcat"><input type="hidden" name="op" value="AdsAddCat"></font><br><br>
Expand Down Expand Up @@ -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');

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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}");
Expand Down
1 change: 0 additions & 1 deletion admin/groupperms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading

0 comments on commit a3f27c3

Please sign in to comment.