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 0405fd3 commit cc9ce0e
Show file tree
Hide file tree
Showing 31 changed files with 84 additions and 92 deletions.
3 changes: 0 additions & 3 deletions add_photo.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
use Xmf\Request;
use XoopsModules\Adslight;

$moduleDirName = basename(dirname(__DIR__));
$main_lang = '_' . mb_strtoupper($moduleDirName);

/**
* Xoops header ...
*/
Expand Down
10 changes: 5 additions & 5 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
function adsNewCat($cid)
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down Expand Up @@ -123,7 +123,7 @@ function adsNewCat($cid)
*/
function adsModCat($cid)
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down Expand Up @@ -253,7 +253,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, $moduleDirName;
global $xoopsDB, $xoopsConfig, $myts;

$title = $myts->htmlSpecialChars($title);
$cidd = (int)$cidd;
Expand Down Expand Up @@ -286,7 +286,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, $moduleDirName;
global $xoopsDB, $xoopsConfig, $myts;

$moderate_subcat = (int)$moderate_subcat;
$title = $myts->htmlSpecialChars($title);
Expand All @@ -313,7 +313,7 @@ function adsAddCat($title, $cat_desc, $cat_keywords, $cid, $img, $cat_order, $af
*/
function adsDelCat($cid, $ok = 0)
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $moduleDirName;
global $xoopsDB, $xoopsConfig, $xoopsModule;

$cid = (int)$cid;
if (1 == (int)$ok) {
Expand Down
2 changes: 1 addition & 1 deletion admin/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#####################################################
function index()
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $moduleDirName;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext;
// require_once XOOPS_ROOT_PATH."/modules/adslight/class/classifiedstree.php";
$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down
2 changes: 1 addition & 1 deletion admin/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

global $mytree, $xoopsDB, $moduleDirName;
global $mytree, $xoopsDB;
xoops_cp_header();
//loadModuleAdminMenu(1, "");
$adminObject->displayNavigation(basename(__FILE__));
Expand Down
4 changes: 2 additions & 2 deletions admin/modify_ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function index()
*/
function modifyAds($lid)
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$contactselect = '';
Expand Down Expand Up @@ -370,7 +370,7 @@ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel
*/
function listingDel($lid, $photo)
{
global $xoopsDB, $moduleDirName;
global $xoopsDB;

$lid = (int)$lid;

Expand Down
14 changes: 7 additions & 7 deletions admin/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#####################################################
function index()
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $admin_lang;
// require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
// loadModuleAdminMenu(2, "");
Expand Down Expand Up @@ -137,7 +137,7 @@ function index()
*/
function listingAddType($type)
{
global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $myts, $admin_lang;

list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE nom_type='{$type}'"));
if ($numrows > 0) {
Expand Down Expand Up @@ -175,7 +175,7 @@ function listingAddType($type)
*/
function listingModType($id_type)
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $admin_lang;
// require_once __DIR__ . '/admin_header.php';
xoops_cp_header();
$id_type = (int)$id_type;
Expand Down Expand Up @@ -245,7 +245,7 @@ function listingDelType($id_type)
*/
function listingAddPrice($type)
{
global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $myts, $admin_lang;

list($numrows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE nom_price='{$nom_price}'"));
if ($numrows > 0) {
Expand Down Expand Up @@ -339,7 +339,7 @@ function listingModPriceS($id_price, $nom_price)
*/
function listingDelPrice($id_price)
{
global $xoopsDB, $moduleDirName, $admin_lang;
global $xoopsDB, $admin_lang;

$xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='{$id_price}'");
redirect_header('options.php', 1, _AM_ADSLIGHT_PRICEDEL);
Expand All @@ -352,7 +352,7 @@ function listingDelPrice($id_price)
*/
function listingAddUsure($type)
{
global $xoopsDB, $xoopsConfig, $myts, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $myts, $admin_lang;

$type = $myts->htmlSpecialChars($type);

Expand Down Expand Up @@ -447,7 +447,7 @@ function listingModUsureS($id_usure, $nom_usure)
*/
function listingDelUsure($id_usure)
{
global $xoopsDB, $moduleDirName, $admin_lang;
global $xoopsDB, $admin_lang;

$id_usure = (int)$id_usure;
$xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('adslight_usure') . " WHERE id_usure='{$id_usure}'");
Expand Down
26 changes: 15 additions & 11 deletions admin/validate_ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#####################################################
function index()
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $admin_lang;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$photo3 = '';
Expand Down Expand Up @@ -238,7 +238,7 @@ function index()
*/
function indexView($lid)
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $admin_lang;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down Expand Up @@ -388,7 +388,7 @@ function indexView($lid)
*/
function modifyAds($lid)
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $desctext, $admin_lang;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down Expand Up @@ -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, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $myts, $admin_lang;

$lid = (int)$lid;
$cat = (int)$cat;
Expand All @@ -614,9 +614,13 @@ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel
$contactby = $myts->htmlSpecialChars($contactby);
$premium = $myts->htmlSpecialChars($premium);

$xoopsDB->query('UPDATE '
. $xoopsDB->prefix('adslight_listing')
. " SET cid='{$cat}', title='{$title}', status='{$status}', expire='{$expire}', type='{$type}', desctext='{$desctext}', tel='{$tel}', price='{$price}', typeprice='{$typeprice}', typeusure='{$typeusure}', date='{$date}', email='{$email}', submitter='{$submitter}', town='{$town}', country='{$country}', contactby='{$contactby}', premium='{$premium}', valid='{$valid}', photo='{$photo}' WHERE lid={$lid}");
// $xoopsDB->query('UPDATE '
// . $xoopsDB->prefix('adslight_listing')
// . " SET cid='{$cat}', title='{$title}', status='{$status}', expire='{$expire}', type='{$type}', desctext='{$desctext}', tel='{$tel}', price='{$price}', typeprice='{$typeprice}', typeusure='{$typeusure}', date='{$date}', email='{$email}', submitter='{$submitter}', town='{$town}', country='{$country}', contactby='{$contactby}', premium='{$premium}', valid='{$valid}', photo='{$photo}' WHERE lid={$lid}");

$sql = 'UPDATE '
. $xoopsDB->prefix('adslight_listing')
. " SET cid='{$cat}', title='{$title}', status='{$status}', expire='{$expire}', type='{$type}', desctext='{$desctext}', tel='{$tel}', price='{$price}', typeprice='{$typeprice}', typeusure='{$typeusure}', date='{$date}', email='{$email}', submitter='{$submitter}', town='{$town}', country='{$country}', contactby='{$contactby}', premium='{$premium}', valid='{$valid}', photo='{$photo}' WHERE lid={$lid}";

$result = $xoopsDB->query($sql);
if (!$result) {
Expand All @@ -634,7 +638,7 @@ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel
*/
function listingDel($lid, $photo)
{
global $xoopsDB, $moduleDirName, $admin_lang;
global $xoopsDB, $admin_lang;

$lid = (int)$lid;

Expand Down Expand Up @@ -689,7 +693,7 @@ function listingDel($lid, $photo)
*/
function listingValid($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo)
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $admin_lang;

$lid = (int)$lid;
$cat = (int)$cat;
Expand All @@ -709,9 +713,9 @@ function listingValid($lid, $cat, $title, $status, $expire, $type, $desctext, $t
$contactby = $myts->htmlSpecialChars($contactby);
$premium = $myts->htmlSpecialChars($premium);
$now = time();
$xoopsDB->query('UPDATE '
$sql = 'UPDATE '
. $xoopsDB->prefix('adslight_listing')
. " SET cid='{$cat}', title='{$title}', status='{$status}', expire='{$expire}', type='{$type}', desctext='{$desctext}', tel='{$tel}', price='{$price}', typeprice='{$typeprice}', typeusure='{$typeusure}', date='{$now}', email='{$email}', submitter='{$submitter}', town='{$town}', country='{$country}', contactby='{$contactby}', premium='{$premium}', valid='{$valid}', photo='{$photo}' WHERE lid={$lid}");
. " SET cid='{$cat}', title='{$title}', status='{$status}', expire='{$expire}', type='{$type}', desctext='{$desctext}', tel='{$tel}', price='{$price}', typeprice='{$typeprice}', typeusure='{$typeusure}', date='{$now}', email='{$email}', submitter='{$submitter}', town='{$town}', country='{$country}', contactby='{$contactby}', premium='{$premium}', valid='{$valid}', photo='{$photo}' WHERE lid={$lid}";

$result = $xoopsDB->query($sql);
if (!$result) {
Expand Down
12 changes: 6 additions & 6 deletions admin/view_ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#####################################################
function index()
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $desctext, $admin_lang;

// $mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$photo3 = '';
Expand Down Expand Up @@ -194,7 +194,7 @@ function index()
*/
function indexView($lid = null)
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $admin_lang;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down Expand Up @@ -339,7 +339,7 @@ function indexView($lid = null)
*/
function modifyAds($lid)
{
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsModule, $xoopsConfig, $xoopsModuleConfig, $myts, $desctext, $admin_lang;

$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');

Expand Down Expand Up @@ -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, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $myts, $admin_lang;

$lid = (int)$lid;
$cat = (int)$cat;
Expand Down Expand Up @@ -576,7 +576,7 @@ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel
*/
function listingDel($lid, $photo)
{
global $xoopsDB, $moduleDirName, $admin_lang;
global $xoopsDB, $admin_lang;

$lid = (int)$lid;
$result2 = $xoopsDB->query('SELECT p.url FROM ' . $xoopsDB->prefix('adslight_listing') . ' l LEFT JOIN ' . $xoopsDB->prefix('adslight_pictures') . " p ON l.lid=p.lid WHERE l.lid={$lid}");
Expand Down Expand Up @@ -629,7 +629,7 @@ function listingDel($lid, $photo)
*/
function listingValid($lid, $cat, $title, $status, $expire, $type, $desctext, $tel, $price, $typeprice, $typeusure, $date, $email, $submitter, $town, $country, $contactby, $premium, $valid, $photo)
{
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $moduleDirName, $admin_lang;
global $xoopsDB, $xoopsConfig, $xoopsModule, $myts, $meta, $admin_lang;

$lid = (int)$lid;
$cid = (int)$cid;
Expand Down
2 changes: 1 addition & 1 deletion blocks/ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
function adslight_show($options)
{
global $xoopsDB, $moduleDirName, $block_lang;
global $xoopsDB, $block_lang;

$block = [];
$myts = \MyTextSanitizer::getInstance();
Expand Down
2 changes: 1 addition & 1 deletion blocks/ads_2.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
function adslight_b2_show($options)
{
global $xoopsDB, $xoopsModuleConfig, $moduleDirName, $block_lang;
global $xoopsDB, $xoopsModuleConfig, $block_lang;

$block = [];
$myts = \MyTextSanitizer::getInstance();
Expand Down
4 changes: 2 additions & 2 deletions blocks/adslight_add.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function b_adslight_add()
global $xoopsDB;
$moduleDirName = basename(dirname(__DIR__));
xoops_loadLanguage('main', $moduleDirName);
$xt = new \XoopsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$xoopsTree = new \XoopsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$jump = XOOPS_URL . '/modules/adslight/addlisting.php?cid=';
ob_start();
$xt->makeMySelBox('title', 'title', 0, 1, 'pid', "location=\"{$jump}\"+this.options[this.selectedIndex].value");
$xoopsTree->makeMySelBox('title', 'title', 0, 1, 'pid', "location=\"{$jump}\"+this.options[this.selectedIndex].value");
$block['selectbox'] = ob_get_clean();

return $block;
Expand Down
2 changes: 1 addition & 1 deletion blocks/maps.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
function adslight_maps_show($options)
{
global $xoopsConfig, $moduleDirName, $block_lang;
global $xoopsConfig, $block_lang;

$maps_name = $xoopsConfig['language'];

Expand Down
6 changes: 3 additions & 3 deletions class/PicturesHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function get($id, $lid = null)
*/
public function insert(\XoopsObject $adslightPictures, $force = false)
{
global $xoopsConfig, $lid, $moduleDirName;
global $xoopsConfig, $lid;
if (!$adslightPictures instanceof Pictures) {
return false;
}
Expand Down Expand Up @@ -287,7 +287,7 @@ public function deleteAll(\CriteriaElement $criteria = null)
*/
public function renderFormSubmit($uid, $lid, $maxbytes, $xoopsTpl)
{
global $moduleDirName, $main_lang, $xoopsUser;
global $moduleDirName, $xoopsUser;
$uid = (int)$uid;
$lid = (int)$lid;
$form = new \XoopsThemeForm(_ADSLIGHT_SUBMIT_PIC_TITLE, 'form_picture', XOOPS_URL . "/modules/adslight/add_photo.php?lid={$lid}&uid=" . $xoopsUser->getVar('uid'), 'post', true);
Expand Down Expand Up @@ -330,7 +330,7 @@ public function renderFormSubmit($uid, $lid, $maxbytes, $xoopsTpl)
*/
public function renderFormEdit($caption, $cod_img, $filename)
{
global $moduleDirName, $main_lang;
global $moduleDirName;

$form = new \XoopsThemeForm(_ADSLIGHT_EDIT_CAPTION, 'form_picture', 'editdesc.php', 'post', true);
$field_desc = new \XoopsFormText($caption, 'caption', 35, 55);
Expand Down
Loading

0 comments on commit cc9ce0e

Please sign in to comment.