Skip to content

Commit

Permalink
Merge pull request #14 from mambax7/master
Browse files Browse the repository at this point in the history
2.3_RC4
  • Loading branch information
mambax7 authored Aug 12, 2021
2 parents 8c1da0e + 3139c5f commit 560cb5d
Show file tree
Hide file tree
Showing 17 changed files with 146 additions and 88 deletions.
17 changes: 10 additions & 7 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ build:
analysis:
dependencies:
after:
# The following installs the most recent XOOPS CMS version, you might want
# to install a specific release tag or branch instead.
- git clone --depth=1 https://github.com/XOOPS/XoopsCore25
- git clone --depth=1 https://github.com/mambax7/tag
# The following installs the most recent XOOPS CMS version, you might want
# to install a specific release tag or branch instead.
- git clone --depth=1 https://github.com/XOOPS/XoopsCore25
- git clone --depth=1 https://github.com/mambax7/tag
project_setup:
override: true
tests:
override:
- php-scrutinizer-run --enable-security-analysis
- php-scrutinizer-run --enable-security-analysis
environment:
php:
version: "7.2"
filter:
dependency_paths:
- XoopsCore25/*
- tag/*
- XoopsCore25/*
- tag/*

12 changes: 7 additions & 5 deletions admin/modify_ads.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ function modifyAds($lid)
xoops_load('XoopsLocal');
$tempXoopsLocal = new \XoopsLocal();
// For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal
$price = $tempXoopsLocal->number_format($price, 2, ',', ' ');
$priceFormatted = $tempXoopsLocal->number_format($price, 2, ',', ' ');
// For other countries uncomment the below line and comment out the above line
// $price = $tempXoopsLocal->number_format($price);
// $priceFormatted = $tempXoopsLocal->number_format($price);

$typeprice = $myts->htmlSpecialChars($typeprice);
$typeusure = $myts->htmlSpecialChars($typeusure);
Expand Down Expand Up @@ -356,9 +356,11 @@ function modifyAdsS($lid, $cat, $title, $status, $expire, $type, $desctext, $tel
$valid = $myts->htmlSpecialChars($valid);
$photo = $myts->htmlSpecialChars($photo);

$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);

redirect_header('modify_ads.php', 1, _AM_ADSLIGHT_ANNMOD);
}
Expand Down
4 changes: 2 additions & 2 deletions class/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,11 @@ public static function cloneRecord($tableName, $id_field, $id)
{
$new_id = false;
$table = $GLOBALS['xoopsDB']->prefix($tableName);
// copy content of the record you wish to clone 
// copy content of the record you wish to clone
$tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query("SELECT * FROM $table WHERE $id_field='$id' "), MYSQLI_ASSOC) or exit('Could not select record');
// set the auto-incremented id's value to blank.
unset($tempTable[$id_field]);
// insert cloned copy of the original  record 
// insert cloned copy of the original record
$result = $GLOBALS['xoopsDB']->queryF("INSERT INTO $table (" . implode(', ', array_keys($tempTable)) . ") VALUES ('" . implode("', '", array_values($tempTable)) . "')") or exit($GLOBALS['xoopsDB']->error());

if ($result) {
Expand Down
7 changes: 7 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<h5>2.3 RC4 [2021-08-12]</h5> Dev: XOOPS 2.5.10, PHP 7.4.22, PHP 8.0.9
<hr>
- updates, fixes (mamba)
- fix for https://github.com/XoopsModules25x/adslight/issues/12 (cesagonchu/mamba)
- PHP8 Smarty defaults (mamba)

<h5>2.3 RC3 [2019-04-22]</h5> Dev: XOOPS 2.5.10, PHP 7.3.4
<hr>
- updates, fixes (mamba)


<h5>2.3 RC2 [2019-04-14]</h5> Dev: XOOPS 2.5.10, PHP 7.3.4
<hr>
- updates, fixes (mamba)
Expand Down
45 changes: 41 additions & 4 deletions members.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
*/

use Xmf\Request;
use XoopsModules\Adslight;
use XoopsModules\Adslight\{
ClassifiedsTree,
Utility
};

require_once __DIR__ . '/header.php';

Expand All @@ -32,7 +35,7 @@
$moduleDirName = basename(__DIR__);

//require_once XOOPS_ROOT_PATH . '/modules/adslight/class/classifiedstree.php';
$mytree = new Adslight\ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$mytree = new ClassifiedsTree($xoopsDB->prefix('adslight_categories'), 'cid', 'pid');
$GLOBALS['xoopsOption']['template_main'] = 'adslight_members.tpl';
require_once XOOPS_ROOT_PATH . '/header.php';
require_once XOOPS_ROOT_PATH . '/include/comment_view.php';
Expand Down Expand Up @@ -92,7 +95,7 @@
}

$cat_perms = '';
$categories = Adslight\Utility::getMyItemIds('adslight_view');
$categories = Utility::getMyItemIds('adslight_view');
if (is_array($categories) && count($categories) > 0) {
$cat_perms .= ' AND cid IN (' . implode(',', $categories) . ') ';
}
Expand Down Expand Up @@ -165,6 +168,12 @@
$result2 = $xoopsDB->query('SELECT r_lid, lid, date, submitter, message, email, r_usid FROM ' . $xoopsDB->prefix('adslight_replies') . ' WHERE lid =' . $xoopsDB->escape($lid));
list($r_lid, $rlid, $rdate, $rsubmitter, $message, $remail, $r_usid) = $xoopsDB->fetchRow($result2);


$result8 = $xoopsDB->query('SELECT nom_price FROM ' . $xoopsDB->prefix('adslight_price') . " WHERE id_price='" . $xoopsDB->escape($typeprice) . "'");
list($nom_price) = $xoopsDB->fetchRow($result8);



if ($isadmin) {
$adminlink = "<a href='" . XOOPS_URL . '/modules/adslight/admin/validate_ads.php?op=modifyAds&amp;lid=' . $lid . "'><img src='" . $pathIcon16 . "/edit.png' border=0 alt=\"" . _ADSLIGHT_MODADMIN . '" ></a>';
$GLOBALS['xoopsTpl']->assign('isadmin', $isadmin);
Expand All @@ -191,13 +200,41 @@
$GLOBALS['xoopsTpl']->assign('status_head', _ADSLIGHT_STATUS);
$tempXoopsLocal = new \XoopsLocal();
// For US currency with 2 numbers after the decimal comment out if you dont want 2 numbers after decimal
$price = $tempXoopsLocal->number_format($price, 2, ',', ' ');
$price2 = $tempXoopsLocal->number_format($price, 2, ',', ' ');
// For other countries uncomment the below line and comment out the above line
// $price = $tempXoopsLocal->number_format($price);
$GLOBALS['xoopsTpl']->assign('price', '<strong>' . _ADSLIGHT_PRICE . "</strong>$price" . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . " - $typeprice");
$GLOBALS['xoopsTpl']->assign('price_head', _ADSLIGHT_PRICE);
$GLOBALS['xoopsTpl']->assign('money_sign', '' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol']);
$GLOBALS['xoopsTpl']->assign('price_typeprice', $typeprice);





$result7 = $xoopsDB->query('SELECT nom_type FROM ' . $xoopsDB->prefix('adslight_type') . " WHERE id_type='" . $xoopsDB->escape($type) . "'");
list($nom_type) = $xoopsDB->fetchRow($result7);
$GLOBALS['xoopsTpl']->assign('type', $myts->htmlSpecialChars($nom_type));

$priceFormatted = Utility::getMoneyFormat('%.2n', $price);
$priceTypeprice = $myts->htmlSpecialChars($nom_price);
$priceCurrency = $GLOBALS['xoopsModuleConfig']['adslight_currency_code'];
// $GLOBALS['xoopsTpl']->assign('price_price', $price.' '.$GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'].' ');
// $priceHtml = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . ' - ' . $typeprice;
$priceHtml = '<strong>' . _ADSLIGHT_PRICE2 . '</strong>' . $priceFormatted . ' - ' . $priceTypeprice;

$GLOBALS['xoopsTpl']->assign('price_head', _ADSLIGHT_PRICE2);
$GLOBALS['xoopsTpl']->assign('price_price', $priceFormatted);
$GLOBALS['xoopsTpl']->assign('price_typeprice', $priceTypeprice);
$GLOBALS['xoopsTpl']->assign('price_currency', $priceCurrency);
$GLOBALS['xoopsTpl']->assign('price', $priceHtml);
$GLOBALS['xoopsTpl']->assign('priceHtml', $priceHtml);






$GLOBALS['xoopsTpl']->assign('local_town', (string)$town);
$GLOBALS['xoopsTpl']->assign('local_country', (string)$country);
$GLOBALS['xoopsTpl']->assign('local_head', _ADSLIGHT_LOCAL2);
Expand Down
22 changes: 11 additions & 11 deletions templates/adslight_category.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<{/if}>
<{include file='db:adslight_search.tpl'}>
<br>
<{$select_go_cats}>
<{$select_go_cats|default:''}>
<br><br>
<h1><{$cat_title}><{$Feed_RSS_cat}></h1>
<{$category_path}><br><br>
<table cellspacing="1" class="outer" style="width:100%;">
<tr>
<td class="odd" align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<{if $lang_subcat}>
<{if $lang_subcat|default:''}>
<tr>
<td colspan="3">
<{$lang_subcat}>
Expand All @@ -27,7 +27,7 @@
<td colspan="2">
<table width="90%"><br>
<tr>
<{foreach item=subcat from=$subcategories}>
<{foreach item=subcat from=$subcategories|default:null}>
<td align="left">
<table cellspacing="2" cellpadding='0' align="left">
<tr>
Expand All @@ -54,7 +54,7 @@
</table>
</td>
<td align="right">
<{if $lang_subcat}>
<{if $lang_subcat|default:''}>
<{if $adslight_use_catscode == 1}>
<{$adslight_cats_code}>
<{/if}>
Expand All @@ -67,7 +67,7 @@
</tr>
<tr>
<td>
<{if $show_nav == true}>
<{if $show_nav|default:false == true}>
<div align="center">
<strong><{$lang_sortby}></strong>
<{$lang_title}>
Expand All @@ -86,7 +86,7 @@
<{$lang_cursortedby}>
</span></div>
<{/if}>
<div align="center"><{$nav_page}><br></div>
<div align="center"><{$nav_page|default:false}><br></div>
<{if $use_extra_code == 1}>
<{foreach from=$items item=item name=items}>
<{if $smarty.foreach.items.iteration eq $index_code_place}>
Expand All @@ -111,7 +111,7 @@
</td>
<{/if}>
<td width="24" align="right">
<{if $item.photo}>
<{if $item.photo|default:''}>
<{$item.photo}>
<{else}>
<{$item.no_photo}>
Expand Down Expand Up @@ -143,7 +143,7 @@
</td>
<{/if}>
<td width="24" align="right">
<{if $item.photo}>
<{if $item.photo|default:''}>
<{$item.photo}>
<{else}>
<{$item.no_photo}>
Expand All @@ -157,15 +157,15 @@
<strong><{$item.price}></strong>&nbsp;-&nbsp;<{$item.price_typeprice}>
<{else}>&nbsp;
<{/if}><br>
<{if $item.sold}><{$item.sold}><{/if}>
<{if $item.sold|default:''}><{$item.sold}><{/if}>
</td>
<td align="center">
<{$item.local}>
</td>
</tr>
<{/foreach}>
</table>
<{/if}><{if !$lang_subcat}><{if !$item}>
<{/if}><{if !$lang_subcat|default:''}><{if !$item}>
<br>
<div style="text-align: center;"><{$not_adds_in_this_cat}></div>
<br>
Expand All @@ -175,7 +175,7 @@
</tr>
</table>
<br><{$category_path}>
<div align="center"><br><{$nav_page}></div>
<div align="center"><br><{$nav_page|default:false}></div>
<{include file='db:system_notification_select.tpl'}>
<br>
<br>
10 changes: 5 additions & 5 deletions templates/adslight_index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<table border="0" cellspacing="0" cellpadding="0" align="center">
<td colspan="2" valign="top"></td>
<tr>
<{foreach item=category from=$categories}>
<{foreach item=category from=$categories|default:null}>
<td valign="top">
<{if $category.image != ""}>
<{$category.image}>
Expand Down Expand Up @@ -75,7 +75,7 @@
</td>
<{/if}>
<td width="24" align="right">
<{if $item.photo}>
<{if $item.photo|default:''}>
<{$item.photo}>
<{else}>
<{$item.no_photo}>
Expand All @@ -98,15 +98,15 @@
</table>
<{/foreach}><{else}>
<table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
<{foreach item=item from=$items}>
<{foreach item=item from=$items|default:null}>
<tr class='<{cycle values="odd,even"}>'>
<{if $xoops_isadmin}>
<td width="20">
<{$item.admin}>
</td>
<{/if}>
<td width="24" align="right">
<{if $item.photo}>
<{if $item.photo|default:''}>
<{$item.photo}>
<{else}>
<{$item.no_photo}>
Expand All @@ -120,7 +120,7 @@
<strong><{$item.price}></strong>&nbsp;-&nbsp;<{$item.price_typeprice}>
<{else}>&nbsp;
<{/if}><br>
<{if $item.sold}><{$item.sold}><{/if}>
<{if $item.sold|default:false}><{$item.sold}><{/if}>
</td>
<td align="center">
<{$item.local}>
Expand Down
31 changes: 15 additions & 16 deletions templates/adslight_item.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<h1><{$title}></h1>
<strong><{$type}></strong>
<strong><{$price_price}></strong>
<{$price_typeprice}>&nbsp;-&nbsp;<{$usure_typeusure}>&nbsp;
<{$admin}>
<{$price_typeprice}>&nbsp;-&nbsp;<{$user_typeuser|default:''}>&nbsp;
<{$admin|default:false}>
<hr>
<br>
<{if $sold}>
<{if $sold|default:false}>
<br>
<{$sold}>
<br>
Expand All @@ -30,7 +30,7 @@
<br>
<hr>
<{if $photo != "0"}>
<{section name=i loop=$pics_array}>
<{section name=i loop=$pics_array|default:null}>
<a href="<{$path_uploads}>/midsize/resized_<{$pics_array[i].url}>" target="_self"
rel="lightbox[album]" title="<{$pics_array[i].desc}>">
<img class="thumb" src="<{$path_uploads}>/thumbs/thumb_<{$pics_array[i].url}>"
Expand All @@ -46,12 +46,11 @@
</div>
<{/if}>
<{if $xoops_isuser}>
<{if $adslight_active_xpayement == 1 }>
<{if $adslight_active_xpayement|default:false == 1 }>
<!-- xpayment -->
<{if $purchasable && !$sold && $price_amount > 0}>
<{include file="db:adslight_xpayment_form.tpl"}>
</
tr>
</tr>
<{/if}>
<!-- xpayment -->
<{/if}><{/if}>
Expand All @@ -63,7 +62,7 @@
<table border="0" cellspacing="1" class="outer" style="width:200px;">
<tr>
<td class="blockright">
<{$date}><br>
<{$date|default:false}><br>
<strong><{$local_head}></strong> <{$local_town}><br>
<strong><{$country_head}></strong> <{$local_country}><br>
<hr>
Expand All @@ -72,9 +71,9 @@
<{$printA}><br>
<{$friend}><br>
<hr>
<{$add_photos}><br>
<{$modifyads}><br>
<{$deleteads}><br>
<{$add_photos|default:false}><br>
<{$modifyads|default:false}><br>
<{$deleteads|default:false}><br>
<{$alerteabus}><br>
<br>
<{if $local_country}>
Expand All @@ -90,15 +89,15 @@
</table>
<!-- Block Comment -->
<div style="text-align: center; padding: 3px; margin:3px;">
<{$commentsnav}>
<{$lang_notice}>
<{$commentsnav|default:false}>
<{$lang_notice|default:false}>
</div>
<div style="margin:3px; padding: 3px;">
<{if $comment_mode == "flat"}>
<{if $comment_mode|default:false == "flat"}>
<{include file="db:system_comments_flat.tpl"}>
<{elseif $comment_mode == "thread"}>
<{elseif $comment_mode|default:false == "thread"}>
<{include file="db:system_comments_thread.tpl"}>
<{elseif $comment_mode == "nest"}>
<{elseif $comment_mode|default:false == "nest"}>
<{include file="db:system_comments_nest.tpl"}>
<{/if}>
</div>
Expand Down
Loading

0 comments on commit 560cb5d

Please sign in to comment.