diff --git a/.scrutinizer.yml b/.scrutinizer.yml index d758d13..c2e1c41 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -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/* diff --git a/admin/modify_ads.php b/admin/modify_ads.php index f1bbe0c..b799958 100644 --- a/admin/modify_ads.php +++ b/admin/modify_ads.php @@ -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); @@ -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); } diff --git a/class/Utility.php b/class/Utility.php index 0919d7b..28bc6e0 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -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) { diff --git a/docs/changelog.txt b/docs/changelog.txt index a0f0c97..c061ea2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,7 +1,14 @@ +
2.3 RC4 [2021-08-12]
Dev: XOOPS 2.5.10, PHP 7.4.22, PHP 8.0.9 +
+- updates, fixes (mamba) +- fix for https://github.com/XoopsModules25x/adslight/issues/12 (cesagonchu/mamba) +- PHP8 Smarty defaults (mamba) +
2.3 RC3 [2019-04-22]
Dev: XOOPS 2.5.10, PHP 7.3.4
- updates, fixes (mamba) +
2.3 RC2 [2019-04-14]
Dev: XOOPS 2.5.10, PHP 7.3.4
- updates, fixes (mamba) diff --git a/members.php b/members.php index bc87eab..186c319 100644 --- a/members.php +++ b/members.php @@ -21,7 +21,10 @@ */ use Xmf\Request; -use XoopsModules\Adslight; +use XoopsModules\Adslight\{ + ClassifiedsTree, + Utility +}; require_once __DIR__ . '/header.php'; @@ -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'; @@ -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) . ') '; } @@ -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 = "\""'; $GLOBALS['xoopsTpl']->assign('isadmin', $isadmin); @@ -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', '' . _ADSLIGHT_PRICE . "$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 = '' . _ADSLIGHT_PRICE2 . '' . $price . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_currency_symbol'] . ' - ' . $typeprice; + $priceHtml = '' . _ADSLIGHT_PRICE2 . '' . $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); diff --git a/templates/adslight_category.tpl b/templates/adslight_category.tpl index 5478267..26cb597 100644 --- a/templates/adslight_category.tpl +++ b/templates/adslight_category.tpl @@ -3,7 +3,7 @@ <{/if}> <{include file='db:adslight_search.tpl'}>
-<{$select_go_cats}> +<{$select_go_cats|default:''}>

<{$cat_title}><{$Feed_RSS_cat}>

<{$category_path}>

@@ -11,7 +11,7 @@ - <{if $lang_subcat}> + <{if $lang_subcat|default:''}>
<{$lang_subcat}> @@ -27,7 +27,7 @@
- <{foreach item=subcat from=$subcategories}> + <{foreach item=subcat from=$subcategories|default:null}> <{/if}> <{/if}> <{/foreach}>
@@ -54,7 +54,7 @@
- <{if $lang_subcat}> + <{if $lang_subcat|default:''}> <{if $adslight_use_catscode == 1}> <{$adslight_cats_code}> <{/if}> @@ -67,7 +67,7 @@
- <{if $show_nav == true}> + <{if $show_nav|default:false == true}>
<{$lang_sortby}> <{$lang_title}> @@ -86,7 +86,7 @@ <{$lang_cursortedby}>
<{/if}> -
<{$nav_page}>
+
<{$nav_page|default:false}>
<{if $use_extra_code == 1}> <{foreach from=$items item=item name=items}> <{if $smarty.foreach.items.iteration eq $index_code_place}> @@ -111,7 +111,7 @@
- <{if $item.photo}> + <{if $item.photo|default:''}> <{$item.photo}> <{else}> <{$item.no_photo}> @@ -143,7 +143,7 @@ - <{if $item.photo}> + <{if $item.photo|default:''}> <{$item.photo}> <{else}> <{$item.no_photo}> @@ -157,7 +157,7 @@ <{$item.price}> - <{$item.price_typeprice}> <{else}>  <{/if}>
- <{if $item.sold}><{$item.sold}><{/if}> + <{if $item.sold|default:''}><{$item.sold}><{/if}>
<{$item.local}> @@ -165,7 +165,7 @@
- <{/if}><{if !$lang_subcat}><{if !$item}> + <{/if}><{if !$lang_subcat|default:''}><{if !$item}>
<{$not_adds_in_this_cat}>

@@ -175,7 +175,7 @@

<{$category_path}> -

<{$nav_page}>
+

<{$nav_page|default:false}>
<{include file='db:system_notification_select.tpl'}>

diff --git a/templates/adslight_index.tpl b/templates/adslight_index.tpl index 1d5bc72..5098430 100644 --- a/templates/adslight_index.tpl +++ b/templates/adslight_index.tpl @@ -6,7 +6,7 @@ - <{foreach item=category from=$categories}> + <{foreach item=category from=$categories|default:null}> <{/if}>
<{if $category.image != ""}> <{$category.image}> @@ -75,7 +75,7 @@ - <{if $item.photo}> + <{if $item.photo|default:''}> <{$item.photo}> <{else}> <{$item.no_photo}> @@ -98,7 +98,7 @@
<{/foreach}><{else}> - <{foreach item=item from=$items}> + <{foreach item=item from=$items|default:null}> <{if $xoops_isadmin}> <{/if}> <{/if}> <{/if}><{/if}> @@ -63,7 +62,7 @@
@@ -106,7 +106,7 @@ - <{if $item.photo}> + <{if $item.photo|default:''}> <{$item.photo}> <{else}> <{$item.no_photo}> @@ -120,7 +120,7 @@ <{$item.price}> - <{$item.price_typeprice}> <{else}>  <{/if}>
- <{if $item.sold}><{$item.sold}><{/if}> + <{if $item.sold|default:false}><{$item.sold}><{/if}>
<{$item.local}> diff --git a/templates/adslight_item.tpl b/templates/adslight_item.tpl index ac12852..7c84c4b 100644 --- a/templates/adslight_item.tpl +++ b/templates/adslight_item.tpl @@ -11,11 +11,11 @@

<{$title}>

<{$type}> <{$price_price}> - <{$price_typeprice}> - <{$usure_typeusure}>  - <{$admin}> + <{$price_typeprice}> - <{$user_typeuser|default:''}>  + <{$admin|default:false}>

- <{if $sold}> + <{if $sold|default:false}>
<{$sold}>
@@ -30,7 +30,7 @@

<{if $photo != "0"}> - <{section name=i loop=$pics_array}> + <{section name=i loop=$pics_array|default:null}> <{/if}> <{if $xoops_isuser}> - <{if $adslight_active_xpayement == 1 }> + <{if $adslight_active_xpayement|default:false == 1 }> <{if $purchasable && !$sold && $price_amount > 0}> <{include file="db:adslight_xpayment_form.tpl"}> - +
- <{$date}>
+ <{$date|default:false}>
<{$local_head}> <{$local_town}>
<{$country_head}> <{$local_country}>

@@ -72,9 +71,9 @@ <{$printA}>
<{$friend}>

- <{$add_photos}>
- <{$modifyads}>
- <{$deleteads}>
+ <{$add_photos|default:false}>
+ <{$modifyads|default:false}>
+ <{$deleteads|default:false}>
<{$alerteabus}>

<{if $local_country}> @@ -90,15 +89,15 @@
- <{$commentsnav}> - <{$lang_notice}> + <{$commentsnav|default:false}> + <{$lang_notice|default:false}>
- <{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}>
diff --git a/templates/adslight_maps.tpl b/templates/adslight_maps.tpl index b30b6ce..fa27f84 100644 --- a/templates/adslight_maps.tpl +++ b/templates/adslight_maps.tpl @@ -23,6 +23,6 @@ -

<{$nav_page}>
+

<{$nav_page|default:false}>
<{include file='db:system_notification_select.tpl'}>
diff --git a/templates/adslight_members.tpl b/templates/adslight_members.tpl index 9dae42f..7ac9621 100644 --- a/templates/adslight_members.tpl +++ b/templates/adslight_members.tpl @@ -7,42 +7,41 @@ <{$nav_main}> - <{$all_user_listings}><{$submitter}> + <{$all_user_listings}><{$submitter|default:''}>
-<{if $istheirs == "1"}><{if $rate !='0'}> +<{if $istheirs|default:'' == "1"}><{if $rate !='0'}> <{$lang_user_rating}> <{$rating}> (<{$user_votes}>)<{/if}><{else}> <{if $rate !='0'}><{$lang_user_rating}> <{$rating}> (<{$user_votes}>)
- > - " rel="nofollow"><{$lang_ratethisuser}><{/if}> + <{$lang_ratethisuser}><{/if}> <{/if}> -

<{$nav_page}>

+

<{$nav_page|default:false}>

- <{if $isadmin}> + <{if $isadmin|default:''}> <{/if}> - <{if $istheirs}><{if $permit}> + <{if $istheirs|default:''}><{if $permit}> <{/if}><{/if}> - <{if $istheirs}> + <{if $istheirs|default:''}> <{/if}> - - <{if $istheirs}><{if $permit}> + + <{if $istheirs|default:''}><{if $permit}> <{/if}><{/if}> - <{foreach item=item from=$items}> + <{foreach item=item from=$items|default:null}> > <{if $isadmin}> <{/if}> @@ -52,8 +51,12 @@ <{/if}><{/if}> *}> + <{$type}>
<{$priceHtml|default:''}> + <{if $item.sold}><{$item.sold}><{/if}>
<{if $istheirs}> @@ -73,7 +76,7 @@
<{$status_head}><{$title_head}><{$edit_ad}><{$expires_head}><{$local_head}><{$local_head|default:''}><{$replies_head}><{$views_head}>
<{$item.adminlink}><{$item.status}><{$item.title}> <{$item.new}>
- <{$item.type}>
- <{$item.price}> <{$money_sign}> <{$item.typeprice}>

+<{* <{$item.type}>
*}> +<{* <{$item.price}> <{$money_sign}> <{$item.typeprice}>

*}> + +<{*
<{$type}>
-

<{$nav_page}>

+

<{$nav_page|default:false}>

<{$comments_head}>
diff --git a/templates/adslight_menu.tpl b/templates/adslight_menu.tpl index 4f2aaa9..831b203 100644 --- a/templates/adslight_menu.tpl +++ b/templates/adslight_menu.tpl @@ -24,7 +24,7 @@   <{else}> - <{$smarty.const._ADSLIGHT_ADD_TITLEMENU1}>   diff --git a/templates/adslight_replies.tpl b/templates/adslight_replies.tpl index 96c0a33..7571e9a 100644 --- a/templates/adslight_replies.tpl +++ b/templates/adslight_replies.tpl @@ -9,7 +9,7 @@


- <{$nav_page}> + <{$nav_page|default:false}>

<{foreach item=item from=$items}> @@ -21,7 +21,7 @@ <{$submitter_head}>  <{$submitter}>

- <{$date_head}>  <{$item.date}>

+ <{$date_head}>  <{$item.date_created}>

<{$email_head}>  <{$email}>

@@ -40,7 +40,7 @@ <{/foreach}>
- <{$nav_page}> + <{$nav_page|default:false}>

<{else}> diff --git a/templates/adslight_search.tpl b/templates/adslight_search.tpl index bfd43e7..6a512a6 100644 --- a/templates/adslight_search.tpl +++ b/templates/adslight_search.tpl @@ -2,7 +2,7 @@ <{$add_from_title}> <{$add_from_sitename}> - <{if $moderated}> + <{if $moderated|default:false}> <{if $xoops_isadmin}> @@ -65,8 +65,7 @@ diff --git a/templates/adslight_tips_writing_ad.tpl b/templates/adslight_tips_writing_ad.tpl index 2bf999a..f64d0ff 100644 --- a/templates/adslight_tips_writing_ad.tpl +++ b/templates/adslight_tips_writing_ad.tpl @@ -23,7 +23,7 @@ -

<{$nav_page}>
+

<{$nav_page|default:false}>
<{include file='db:system_notification_select.tpl'}>

diff --git a/templates/adslight_view_photos.tpl b/templates/adslight_view_photos.tpl index 16154bb..093eca9 100644 --- a/templates/adslight_view_photos.tpl +++ b/templates/adslight_view_photos.tpl @@ -16,7 +16,7 @@
<{$lang_upgrade_now}> <{/if}> -

<{$lang_nopicyet}>

+

<{$lang_nopicyet|default:''}>