From 7a9f66f6dd3ff28c205155156c57e3ab10038232 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 17:23:56 -0500 Subject: [PATCH 01/26] set $icons --- class/Form/ItemForm.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index ca1897ea..e8efbca2 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -25,7 +25,7 @@ use Xmf\Request; use XoopsModules\Publisher\{Constants, - Form, + Common\Configurator, FormDateTime, Helper, Item, @@ -140,6 +140,8 @@ public function createElements($obj) { $helper = Helper::getInstance(); $timeoffset = null; + $configurator = new Configurator(); + $icons = $configurator->icons; $allowedEditors = Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors')); From cee1d07d650f03990264197858e36542616ced52 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 17:24:44 -0500 Subject: [PATCH 02/26] testdata --- testdata/english/publisher_items.yml | 61 ++++- testdata/english/publisher_rating.yml | 315 +++++++++++++++----------- testdata/index.php | 2 +- 3 files changed, 243 insertions(+), 135 deletions(-) diff --git a/testdata/english/publisher_items.yml b/testdata/english/publisher_items.yml index 1bf0add9..c66528bf 100644 --- a/testdata/english/publisher_items.yml +++ b/testdata/english/publisher_items.yml @@ -12,7 +12,7 @@ status: '2' image: '1' images: '1' - counter: '133' + counter: '134' rating: '0.0000' votes: '1' weight: '1' @@ -29,6 +29,7 @@ short_url: example_category_1 item_tag: ItemTag1 votetype: '1' + votevalue: null - itemid: '2' categoryid: '2' @@ -60,6 +61,7 @@ short_url: example_category_1 item_tag: ItemTag2 votetype: '3' + votevalue: null - itemid: '3' categoryid: '3' @@ -91,20 +93,21 @@ short_url: example_category_1 item_tag: ItemTag3 votetype: '3' + votevalue: null - itemid: '4' categoryid: '1' title: 'Article 4' subtitle: 'Subtitle Teaser 4' - summary: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' - body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' + summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' + body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' uid: '1' author_alias: '' datesub: '1486990200' dateexpire: '0' status: '2' - image: '1' - images: '1' + image: '0' + images: '' counter: '532' rating: '0.0000' votes: '1' @@ -120,8 +123,9 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag4 - votetype: '4' + item_tag: '' + votetype: '1' + votevalue: null - itemid: '5' categoryid: '2' @@ -153,6 +157,7 @@ short_url: example_category_5 item_tag: ItemTag5 votetype: '5' + votevalue: null - itemid: '6' categoryid: '1' @@ -184,6 +189,7 @@ short_url: '' item_tag: 'Theme, Bootstrap, jQuery, bootnewage' votetype: '3' + votevalue: null - itemid: '7' categoryid: '5' @@ -215,6 +221,7 @@ short_url: test-di item_tag: '' votetype: '3' + votevalue: null - itemid: '8' categoryid: '5' @@ -246,6 +253,7 @@ short_url: test-di-future item_tag: '' votetype: '2' + votevalue: null - itemid: '9' categoryid: '5' @@ -260,7 +268,7 @@ status: '2' image: '4' images: '4' - counter: '224' + counter: '233' rating: '0.0000' votes: '1' weight: '0' @@ -277,6 +285,7 @@ short_url: test-di item_tag: '' votetype: '3' + votevalue: null - itemid: '10' categoryid: '5' @@ -308,6 +317,7 @@ short_url: test-offline item_tag: '' votetype: '1' + votevalue: null - itemid: '11' categoryid: '5' @@ -339,6 +349,7 @@ short_url: test-approval item_tag: '' votetype: '5' + votevalue: null - itemid: '12' categoryid: '1' @@ -370,6 +381,7 @@ short_url: submitted_new item_tag: '' votetype: '1' + votevalue: null - itemid: '13' categoryid: '5' @@ -401,3 +413,36 @@ short_url: rejected item_tag: '' votetype: '1' + votevalue: null +- + itemid: '14' + categoryid: '1' + title: xxxx + subtitle: '' + summary: '

xxx htdnthdnthd nthd

' + body: '

tnhd nthdnthdtnhd

' + uid: '1' + author_alias: '' + datesub: '1610439000' + dateexpire: '0' + status: '2' + image: '0' + images: '' + counter: '0' + rating: '0.0000' + votes: '0' + weight: '0' + dohtml: '1' + dosmiley: '1' + doxcode: '1' + doimage: '1' + dobr: '1' + cancomment: '1' + comments: '0' + notifypub: '0' + meta_keywords: 'xxxx,htdnthdnthd,nthd' + meta_description: 'xxx htdnthdnthd nthd' + short_url: xxxx + item_tag: '' + votetype: '4' + votevalue: null diff --git a/testdata/english/publisher_rating.yml b/testdata/english/publisher_rating.yml index 5fb31370..9998e8d8 100644 --- a/testdata/english/publisher_rating.yml +++ b/testdata/english/publisher_rating.yml @@ -1,6 +1,6 @@ - ratingid: '1' - itemid: '1' + itemid: '3' uid: '1' rate: '1' date: '1600080372' @@ -9,7 +9,7 @@ votetype: '3' - ratingid: '2' - itemid: '2' + itemid: '9' uid: '1' rate: '-1' date: '1600081774' @@ -18,7 +18,7 @@ votetype: '3' - ratingid: '3' - itemid: '1' + itemid: '9' uid: '2' rate: '1' date: '1600082767' @@ -27,7 +27,7 @@ votetype: '3' - ratingid: '4' - itemid: '2' + itemid: '6' uid: '1' rate: '1' date: '1600166527' @@ -77,11 +77,11 @@ rate: '1' date: '1600170106' ip: 78.83.87.210 - source: '3' + source: '1' votetype: '3' - ratingid: '10' - itemid: '2' + itemid: '6' uid: '6' rate: '-1' date: '1600170151' @@ -90,7 +90,7 @@ votetype: '3' - ratingid: '11' - itemid: '2' + itemid: '9' uid: '7' rate: '-1' date: '1603038378' @@ -135,7 +135,7 @@ votetype: '3' - ratingid: '16' - itemid: '2' + itemid: '1' uid: '5' rate: '1' date: '1603083350' @@ -144,7 +144,7 @@ votetype: '1' - ratingid: '17' - itemid: '2' + itemid: '10' uid: '5' rate: '1' date: '1603083452' @@ -153,7 +153,7 @@ votetype: '1' - ratingid: '18' - itemid: '7' + itemid: '13' uid: '5' rate: '1' date: '1603083468' @@ -198,16 +198,16 @@ votetype: '3' - ratingid: '23' - itemid: '7' + itemid: '6' uid: '5' - rate: '4' + rate: '1' date: '1603084835' ip: '' source: '1' votetype: '3' - ratingid: '24' - itemid: '1' + itemid: '6' uid: '5' rate: '-1' date: '1603086728' @@ -225,7 +225,7 @@ votetype: '1' - ratingid: '26' - itemid: '0' + itemid: '1' uid: '0' rate: '5' date: '1603087380' @@ -249,55 +249,55 @@ date: '1603413237' ip: '' source: '1' - votetype: '1' + votetype: '2' - ratingid: '29' itemid: '8' uid: '0' - rate: '-1' + rate: '3' date: '1603413247' ip: '' source: '1' - votetype: '1' + votetype: '2' - ratingid: '30' itemid: '8' uid: '0' - rate: '-1' + rate: '8' date: '1603413248' ip: '' source: '1' - votetype: '1' + votetype: '2' - ratingid: '31' - itemid: '8' + itemid: '4' uid: '0' - rate: '-1' + rate: '4' date: '1603413249' ip: '' source: '1' votetype: '1' - ratingid: '32' - itemid: '5' + itemid: '10' uid: '0' - rate: '1' + rate: '2' date: '1603424515' ip: '' source: '1' votetype: '1' - ratingid: '33' - itemid: '5' + itemid: '9' uid: '0' rate: '-1' date: '1603424520' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '34' - itemid: '5' + itemid: '13' uid: '0' rate: '1' date: '1603424828' @@ -306,16 +306,16 @@ votetype: '1' - ratingid: '35' - itemid: '5' + itemid: '3' uid: '0' rate: '-1' date: '1603424834' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '36' - itemid: '6' + itemid: '1' uid: '0' rate: '1' date: '1603425156' @@ -324,7 +324,7 @@ votetype: '1' - ratingid: '37' - itemid: '6' + itemid: '10' uid: '0' rate: '1' date: '1603425167' @@ -339,7 +339,7 @@ date: '1603425175' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '39' itemid: '6' @@ -348,10 +348,10 @@ date: '1603425201' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '40' - itemid: '6' + itemid: '4' uid: '0' rate: '1' date: '1603425246' @@ -360,7 +360,7 @@ votetype: '1' - ratingid: '41' - itemid: '6' + itemid: '4' uid: '0' rate: '1' date: '1603426430' @@ -369,16 +369,16 @@ votetype: '1' - ratingid: '42' - itemid: '6' + itemid: '11' uid: '0' rate: '1' date: '1603426491' ip: '' source: '1' - votetype: '1' + votetype: '5' - ratingid: '43' - itemid: '6' + itemid: '13' uid: '0' rate: '1' date: '1603426589' @@ -387,7 +387,7 @@ votetype: '1' - ratingid: '44' - itemid: '6' + itemid: '1' uid: '5' rate: '1' date: '1603426722' @@ -396,7 +396,7 @@ votetype: '1' - ratingid: '45' - itemid: '6' + itemid: '4' uid: '2' rate: '1' date: '1603426746' @@ -405,7 +405,7 @@ votetype: '1' - ratingid: '46' - itemid: '6' + itemid: '4' uid: '1' rate: '1' date: '1603426945' @@ -414,16 +414,16 @@ votetype: '1' - ratingid: '47' - itemid: '5' + itemid: '12' uid: '1' - rate: '7' + rate: '5' date: '1603430099' ip: '' source: '1' votetype: '1' - ratingid: '48' - itemid: '7' + itemid: '1' uid: '1' rate: '1' date: '1608463542' @@ -432,7 +432,7 @@ votetype: '1' - ratingid: '49' - itemid: '7' + itemid: '12' uid: '0' rate: '2' date: '1608464480' @@ -441,7 +441,7 @@ votetype: '1' - ratingid: '50' - itemid: '7' + itemid: '13' uid: '0' rate: '3' date: '1608464495' @@ -450,7 +450,7 @@ votetype: '1' - ratingid: '51' - itemid: '7' + itemid: '4' uid: '0' rate: '2' date: '1608465043' @@ -459,25 +459,25 @@ votetype: '1' - ratingid: '52' - itemid: '0' + itemid: '3' uid: '0' rate: '-1' date: '1608535960' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '53' - itemid: '0' + itemid: '10' uid: '0' - rate: '1' + rate: '3' date: '1608535984' ip: '' source: '1' votetype: '1' - ratingid: '54' - itemid: '0' + itemid: '1' uid: '0' rate: '1' date: '1608536072' @@ -486,16 +486,16 @@ votetype: '1' - ratingid: '55' - itemid: '0' + itemid: '4' uid: '0' - rate: '1' + rate: '5' date: '1608536080' ip: '' source: '1' votetype: '1' - ratingid: '56' - itemid: '0' + itemid: '1' uid: '0' rate: '1' date: '1608536311' @@ -504,7 +504,7 @@ votetype: '1' - ratingid: '57' - itemid: '0' + itemid: '12' uid: '0' rate: '1' date: '1608536378' @@ -513,16 +513,16 @@ votetype: '1' - ratingid: '58' - itemid: '0' + itemid: '14' uid: '0' - rate: '1' + rate: '7' date: '1608536854' ip: '' source: '1' - votetype: '1' + votetype: '4' - ratingid: '59' - itemid: '0' + itemid: '1' uid: '0' rate: '1' date: '1608536926' @@ -531,13 +531,13 @@ votetype: '1' - ratingid: '60' - itemid: '9' + itemid: '14' uid: '0' - rate: '1' + rate: '9' date: '1608537199' ip: '' source: '1' - votetype: '1' + votetype: '4' - ratingid: '61' itemid: '9' @@ -546,7 +546,7 @@ date: '1608537299' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '62' itemid: '9' @@ -555,7 +555,7 @@ date: '1608537304' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '63' itemid: '9' @@ -564,97 +564,97 @@ date: '1608537309' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '64' - itemid: '7' + itemid: '9' uid: '0' rate: '-1' date: '1608565406' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '65' - itemid: '0' - uid: '0' + itemid: '9' + uid: '2' rate: '-1' date: '1608870150' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '66' itemid: '6' - uid: '0' + uid: '1' rate: '-1' date: '1608870194' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '67' - itemid: '6' - uid: '0' + itemid: '9' + uid: '1' rate: '-1' date: '1608870207' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '68' itemid: '7' - uid: '0' + uid: '2' rate: '-1' date: '1608883620' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '69' itemid: '7' - uid: '0' - rate: '-1' + uid: '1' + rate: '1' date: '1608884456' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '70' - itemid: '7' - uid: '0' + itemid: '2' + uid: '2' rate: '-1' date: '1608884803' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '71' itemid: '7' - uid: '0' + uid: '1' rate: '-1' date: '1608885197' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '72' itemid: '7' - uid: '0' + uid: '2' rate: '-1' date: '1608885231' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '73' itemid: '7' - uid: '0' + uid: '1' rate: '-1' date: '1608885237' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '74' itemid: '7' @@ -663,7 +663,7 @@ date: '1608885306' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '75' itemid: '7' @@ -672,10 +672,10 @@ date: '1608885318' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '76' - itemid: '7' + itemid: '1' uid: '1' rate: '1' date: '1608886477' @@ -684,27 +684,27 @@ votetype: '1' - ratingid: '77' - itemid: '7' + itemid: '13' uid: '1' - rate: '1' + rate: '4' date: '1608886483' ip: '::1' source: '1' votetype: '1' - ratingid: '78' - itemid: '7' + itemid: '12' uid: '1' - rate: '1' + rate: '3' date: '1608886571' ip: '::1' source: '1' votetype: '1' - ratingid: '79' - itemid: '7' + itemid: '4' uid: '1' - rate: '1' + rate: '2' date: '1608886586' ip: '::1' source: '1' @@ -717,12 +717,12 @@ date: '1608886592' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '81' - itemid: '7' + itemid: '1' uid: '1' - rate: '1' + rate: '5' date: '1608887202' ip: '::1' source: '1' @@ -735,12 +735,12 @@ date: '1609066427' ip: '::1' source: '1' - votetype: '3' + votetype: '5' - ratingid: '83' - itemid: '7' + itemid: '4' uid: '3' - rate: '9' + rate: '4' date: '1608888776' ip: '::1' source: '1' @@ -749,20 +749,20 @@ ratingid: '85' itemid: '11' uid: '2' - rate: '2' + rate: '3' date: '1609070268' ip: '::1' source: '1' - votetype: '1' + votetype: '5' - ratingid: '86' itemid: '11' uid: '3' - rate: '2' + rate: '6' date: '1609070323' ip: '::1' source: '1' - votetype: '1' + votetype: '5' - ratingid: '87' itemid: '9' @@ -771,7 +771,7 @@ date: '1609070360' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '88' itemid: '9' @@ -780,12 +780,12 @@ date: '1609070367' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '89' itemid: '4' uid: '1' - rate: '8' + rate: '5' date: '1609072806' ip: '::1' source: '1' @@ -812,7 +812,7 @@ ratingid: '92' itemid: '4' uid: '2' - rate: '10' + rate: '3' date: '1609073097' ip: '::1' source: '1' @@ -873,9 +873,9 @@ votetype: '1' - ratingid: '861' - itemid: '3' + itemid: '10' uid: '1' - rate: '1' + rate: '5' date: '1609520318' ip: '::1' source: '1' @@ -888,7 +888,7 @@ date: '1609521721' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '863' itemid: '6' @@ -897,28 +897,28 @@ date: '1609536526' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '864' - itemid: '6' + itemid: '1' uid: '1' - rate: '-1' + rate: '4' date: '1609536980' ip: '::1' source: '1' votetype: '1' - ratingid: '865' - itemid: '6' + itemid: '10' uid: '1' - rate: '-1' + rate: '1' date: '1609537043' ip: '::1' source: '1' votetype: '1' - ratingid: '866' - itemid: '6' + itemid: '12' uid: '1' rate: '1' date: '1609537049' @@ -933,22 +933,85 @@ date: '1609537199' ip: '::1' source: '1' - votetype: '1' + votetype: '2' - ratingid: '868' itemid: '8' uid: '1' - rate: '10' + rate: '9' date: '1609537205' ip: '::1' source: '1' - votetype: '1' + votetype: '2' - ratingid: '869' - itemid: '8' + itemid: '14' uid: '1' - rate: '10' + rate: '2' date: '1609537211' ip: '::1' source: '1' + votetype: '4' +- + ratingid: '871' + itemid: '14' + uid: '1' + rate: '8' + date: '1610504760' + ip: '::1' + source: '1' + votetype: '4' +- + ratingid: '872' + itemid: '10' + uid: '1' + rate: '2' + date: '1613037798' + ip: '::1' + source: '1' + votetype: '1' +- + ratingid: '873' + itemid: '11' + uid: '1' + rate: '5' + date: '1613046112' + ip: '::1' + source: '1' votetype: '1' +- + ratingid: '874' + itemid: '5' + uid: '1' + rate: '2' + date: '1613046453' + ip: '::1' + source: '1' + votetype: '5' +- + ratingid: '875' + itemid: '5' + uid: '1' + rate: '4' + date: '1613046883' + ip: '::1' + source: '1' + votetype: '5' +- + ratingid: '876' + itemid: '5' + uid: '1' + rate: '6' + date: '1613047333' + ip: '::1' + source: '1' + votetype: '5' +- + ratingid: '877' + itemid: '5' + uid: '1' + rate: '6' + date: '1613047510' + ip: '::1' + source: '1' + votetype: '5' diff --git a/testdata/index.php b/testdata/index.php index bcacb54a..5f529d64 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -97,7 +97,7 @@ function loadSampleData() $utility::rcopy($src, $dest); } } - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); } function saveSampleData() From 9c0f11b4d4bca8f59ace40a7fd94b03583295bde Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 17:26:20 -0500 Subject: [PATCH 03/26] change language --- language/english/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/language/english/common.php b/language/english/common.php index 26402a3f..5bd53b2e 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -168,7 +168,7 @@ //Sample Data define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully'); +define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date imported successfully'); define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_ERROR', 'ERROR: Export of Tables to YAML failed'); From 596e2e38aa94189a988b26d6629694f88a40a496 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 17:28:59 -0500 Subject: [PATCH 04/26] add votetype --- class/Ratings.php | 1 + class/Vote.php | 1 + vote.php | 1 + 3 files changed, 3 insertions(+) diff --git a/class/Ratings.php b/class/Ratings.php index aa8b6085..8aea7911 100644 --- a/class/Ratings.php +++ b/class/Ratings.php @@ -86,6 +86,7 @@ public function getValuesRatings($keys = null, $format = null, $maxDepth = null) $ret['uid'] = \XoopsUser::getUnameFromId($this->getVar('rate_uid')); $ret['ip'] = $this->getVar('rate_ip'); $ret['date'] = \formatTimestamp($this->getVar('rate_date'), 's'); + $ret['votetype'] = $this->getVar('votetype'); return $ret; } diff --git a/class/Vote.php b/class/Vote.php index 51f52725..f4aee822 100644 --- a/class/Vote.php +++ b/class/Vote.php @@ -43,6 +43,7 @@ public function __construct() $this->initVar('uid', \XOBJ_DTYPE_INT); $this->initVar('ip', \XOBJ_DTYPE_TXTBOX); $this->initVar('date', \XOBJ_DTYPE_INT); + $this->initVar('votetype', \XOBJ_DTYPE_INT); } /** diff --git a/vote.php b/vote.php index bf695d07..82cfee03 100644 --- a/vote.php +++ b/vote.php @@ -119,6 +119,7 @@ $voteObj->setVar('uid', $itemRating['uid']); $voteObj->setVar('ip', $itemRating['ip']); $voteObj->setVar('date', \time()); + $voteObj->setVar('votetype', $votingType); // Insert Data if ($voteHandler->insert($voteObj)) { unset($voteObj); From d46550c2e609eca67ee3ce22169a4de0a95cbb15 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 12 Feb 2021 17:54:58 -0500 Subject: [PATCH 05/26] add rating type to article titles --- testdata/english/group_permission.yml | 310 +++++++++++++------------- testdata/english/publisher_items.yml | 90 ++++---- 2 files changed, 200 insertions(+), 200 deletions(-) diff --git a/testdata/english/group_permission.yml b/testdata/english/group_permission.yml index ccd33cf4..15276480 100644 --- a/testdata/english/group_permission.yml +++ b/testdata/english/group_permission.yml @@ -1,390 +1,390 @@ - gperm_groupid: '1' gperm_itemid: '1' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_moderation - gperm_groupid: '1' gperm_itemid: '2' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_moderation - gperm_groupid: '1' gperm_itemid: '3' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_moderation - gperm_groupid: '1' gperm_itemid: '4' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_moderation - gperm_groupid: '1' gperm_itemid: '6' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_moderation - gperm_groupid: '1' gperm_itemid: '5' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_moderation - - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '38' - gperm_name: category_read -- - gperm_groupid: '1' - gperm_itemid: '2' - gperm_modid: '38' + gperm_groupid: '3' + gperm_itemid: '6' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '38' + gperm_groupid: '3' + gperm_itemid: '5' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '1' + gperm_groupid: '3' gperm_itemid: '4' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '1' - gperm_itemid: '5' - gperm_modid: '38' + gperm_groupid: '3' + gperm_itemid: '3' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '2' + gperm_groupid: '3' gperm_itemid: '2' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '2' + gperm_groupid: '3' gperm_itemid: '1' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '1' + gperm_groupid: '2' gperm_itemid: '6' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '38' + gperm_itemid: '5' + gperm_modid: '206' gperm_name: category_read - gperm_groupid: '2' gperm_itemid: '4' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - gperm_groupid: '2' - gperm_itemid: '5' - gperm_modid: '38' + gperm_itemid: '3' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '2' + gperm_groupid: '1' gperm_itemid: '6' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '3' + gperm_groupid: '1' gperm_itemid: '1' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '3' + gperm_groupid: '1' gperm_itemid: '2' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '3' + gperm_groupid: '1' gperm_itemid: '3' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '3' + gperm_groupid: '1' gperm_itemid: '4' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '3' + gperm_groupid: '1' gperm_itemid: '5' - gperm_modid: '38' + gperm_modid: '206' gperm_name: category_read - - gperm_groupid: '3' - gperm_itemid: '6' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '2' + gperm_modid: '206' + gperm_name: category_read +- + gperm_groupid: '2' + gperm_itemid: '1' + gperm_modid: '206' gperm_name: category_read - gperm_groupid: '1' - gperm_itemid: '3606' - gperm_modid: '38' + gperm_itemid: '81600' + gperm_modid: '206' gperm_name: editors - gperm_groupid: '1' gperm_itemid: '6017' - gperm_modid: '38' + gperm_modid: '206' gperm_name: editors - gperm_groupid: '1' - gperm_itemid: '81600' - gperm_modid: '38' + gperm_itemid: '3606' + gperm_modid: '206' gperm_name: editors - - gperm_groupid: '2' - gperm_itemid: '25' - gperm_modid: '38' + gperm_groupid: '1' + gperm_itemid: '23' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '2' + gperm_groupid: '1' gperm_itemid: '24' - gperm_modid: '38' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '2' - gperm_itemid: '12' - gperm_modid: '38' - gperm_name: form_view -- - gperm_groupid: '2' - gperm_itemid: '11' - gperm_modid: '38' + gperm_groupid: '1' + gperm_itemid: '25' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '2' - gperm_itemid: '10' - gperm_modid: '38' + gperm_groupid: '1' + gperm_itemid: '7' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '2' - gperm_itemid: '26' - gperm_modid: '38' + gperm_groupid: '1' + gperm_itemid: '8' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '2' + gperm_groupid: '1' gperm_itemid: '9' - gperm_modid: '38' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '2' - gperm_itemid: '8' - gperm_modid: '38' + gperm_itemid: '5' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '2' - gperm_itemid: '7' - gperm_modid: '38' + gperm_groupid: '1' + gperm_itemid: '11' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '1' - gperm_modid: '38' + gperm_itemid: '12' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '3' - gperm_modid: '38' + gperm_itemid: '13' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '4' - gperm_modid: '38' + gperm_itemid: '15' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '5' - gperm_modid: '38' + gperm_itemid: '18' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '7' - gperm_modid: '38' + gperm_itemid: '19' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '8' - gperm_modid: '38' + gperm_itemid: '10' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '9' - gperm_modid: '38' + gperm_itemid: '21' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '26' - gperm_modid: '38' + gperm_itemid: '22' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '10' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '1' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '11' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '3' + gperm_modid: '206' + gperm_name: form_view +- + gperm_groupid: '2' + gperm_itemid: '4' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '12' - gperm_modid: '38' + gperm_itemid: '5' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '13' - gperm_modid: '38' + gperm_itemid: '26' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' gperm_itemid: '14' - gperm_modid: '38' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '15' - gperm_modid: '38' + gperm_itemid: '20' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '18' - gperm_modid: '38' + gperm_itemid: '4' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '19' - gperm_modid: '38' + gperm_itemid: '3' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '1' - gperm_itemid: '20' - gperm_modid: '38' + gperm_itemid: '1' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '21' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '7' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '22' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '8' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '23' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '9' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '24' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '26' + gperm_modid: '206' gperm_name: form_view - - gperm_groupid: '1' - gperm_itemid: '25' - gperm_modid: '38' + gperm_groupid: '2' + gperm_itemid: '10' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '38' + gperm_itemid: '11' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '2' - gperm_itemid: '3' - gperm_modid: '38' + gperm_itemid: '12' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '2' - gperm_itemid: '4' - gperm_modid: '38' + gperm_itemid: '24' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '2' - gperm_itemid: '5' - gperm_modid: '38' + gperm_itemid: '25' + gperm_modid: '206' gperm_name: form_view - gperm_groupid: '2' - gperm_itemid: '2' - gperm_modid: '38' + gperm_itemid: '1' + gperm_modid: '206' gperm_name: global - gperm_groupid: '2' - gperm_itemid: '1' - gperm_modid: '38' + gperm_itemid: '2' + gperm_modid: '206' gperm_name: global - gperm_groupid: '1' gperm_itemid: '1' - gperm_modid: '38' + gperm_modid: '206' gperm_name: global - gperm_groupid: '1' gperm_itemid: '2' - gperm_modid: '38' + gperm_modid: '206' gperm_name: global - gperm_groupid: '2' gperm_itemid: '3' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '2' gperm_itemid: '2' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '2' gperm_itemid: '1' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '1' gperm_itemid: '6' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '1' gperm_itemid: '5' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '1' gperm_itemid: '4' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '1' gperm_itemid: '3' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '1' gperm_itemid: '2' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '1' gperm_itemid: '1' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '2' gperm_itemid: '4' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '2' gperm_itemid: '5' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit - gperm_groupid: '2' gperm_itemid: '6' - gperm_modid: '38' + gperm_modid: '206' gperm_name: item_submit diff --git a/testdata/english/publisher_items.yml b/testdata/english/publisher_items.yml index c66528bf..0010928a 100644 --- a/testdata/english/publisher_items.yml +++ b/testdata/english/publisher_items.yml @@ -1,7 +1,7 @@ - itemid: '1' categoryid: '1' - title: 'Article 1' + title: 'Article 1 (5 Star rating)' subtitle: 'Subtitle Teaser 1' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -10,8 +10,8 @@ datesub: '1486997400' dateexpire: '0' status: '2' - image: '1' - images: '1' + image: '0' + images: '' counter: '134' rating: '0.0000' votes: '1' @@ -27,13 +27,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag1 + item_tag: '' votetype: '1' - votevalue: null + votevalue: '' - itemid: '2' categoryid: '2' - title: 'Article 2' + title: 'Article 2 (Like/Dislike rating)' subtitle: 'Subtitle Teaser 2' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -42,8 +42,8 @@ datesub: '1486997400' dateexpire: '0' status: '2' - image: '2' - images: '2' + image: '0' + images: '' counter: '240' rating: '0.0000' votes: '1' @@ -59,13 +59,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag2 + item_tag: '' votetype: '3' - votevalue: null + votevalue: '' - itemid: '3' categoryid: '3' - title: 'Article 3' + title: 'Article 3 (Like/Dislike rating)' subtitle: 'Subtitle Teaser 3' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -74,8 +74,8 @@ datesub: '1486997400' dateexpire: '0' status: '2' - image: '3' - images: '3' + image: '0' + images: '' counter: '93' rating: '0.0000' votes: '1' @@ -91,13 +91,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag3 + item_tag: '' votetype: '3' - votevalue: null + votevalue: '' - itemid: '4' categoryid: '1' - title: 'Article 4' + title: 'Article 4 (5 Star rating)' subtitle: 'Subtitle Teaser 4' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -125,13 +125,13 @@ short_url: example_category_1 item_tag: '' votetype: '1' - votevalue: null + votevalue: '' - itemid: '5' categoryid: '2' - title: 'Article 5' + title: 'Article 5 (Reactions rating)' subtitle: 'Subtitle Teaser 5' - summary: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' + summary: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' uid: '1' author_alias: '' @@ -155,13 +155,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_5 - item_tag: ItemTag5 + item_tag: '' votetype: '5' - votevalue: null + votevalue: '' - itemid: '6' categoryid: '1' - title: 'Heart of Darkness, by Joseph Conrad' + title: 'Heart of Darkness, by Joseph Conrad (Like/Dislike rating)' subtitle: '' summary: '

Heart of Darkness, by Joseph Conrad

' body: '

The Nellie, a cruising yawl, swung to her anchor without a flutter of the sails, and was at rest. The flood had made, the wind was nearly calm, and being bound down the river, the only thing for it was to come to and wait for the turn of the tide.

The sea-reach of the Thames stretched before us like the beginning of an interminable waterway. In the offing the sea and the sky were welded together without a joint, and in the luminous space the tanned sails of the barges drifting up with the tide seemed to stand still in red clusters of canvas sharply peaked, with gleams of varnished sprits. A haze rested on the low shores that ran out to sea in vanishing flatness. The air was dark above Gravesend, and farther back still seemed condensed into a mournful gloom, brooding motionless over the biggest, and the greatest, town on earth.

The Director of Companies was our captain and our host. We four affectionately watched his back as he stood in the bows looking to seaward. On the whole river there was nothing that looked half so nautical. He resembled a pilot, which to a seaman is trustworthiness personified. It was difficult to realize his work was not out there in the luminous estuary, but behind him, within the brooding gloom.

Between us there was, as I have already said somewhere, the bond of the sea. Besides holding our hearts together through long periods of separation, it had the effect of making us tolerant of each other’s yarns—and even convictions. The Lawyer—the best of old fellows—had, because of his many years and many virtues, the only cushion on deck, and was lying on the only rug. The Accountant had brought out already a box of dominoes, and was toying architecturally with the bones. Marlow sat cross-legged right aft, leaning against the mizzen-mast. He had sunken cheeks, a yellow complexion, a straight back, an ascetic aspect, and, with his arms dropped, the palms of hands outwards, resembled an idol. The director, satisfied the anchor had good hold, made his way aft and sat down amongst us. We exchanged a few words lazily. Afterwards there was silence on board the yacht. For some reason or other we did not begin that game of dominoes. We felt meditative, and fit for nothing but placid staring. The day was ending in a serenity of still and exquisite brilliance. The water shone pacifically; the sky, without a speck, was a benign immensity of unstained light; the very mist on the Essex marsh was like a gauzy and radiant fabric, hung from the wooded rises inland, and draping the low shores in diaphanous folds. Only the gloom to the west, brooding over the upper reaches, became more sombre every minute, as if angered by the approach of the sun.

And at last, in its curved and imperceptible fall, the sun sank low, and from glowing white changed to a dull red without rays and without heat, as if about to go out suddenly, stricken to death by the touch of that gloom brooding over a crowd of men.

Forthwith a change came over the waters, and the serenity became less brilliant but more profound. The old river in its broad reach rested unruffled at the decline of day, after ages of good service done to the race that peopled its banks, spread out in the tranquil dignity of a waterway leading to the uttermost ends of the earth. We looked at the venerable stream not in the vivid flush of a short day that comes and departs for ever, but in the august light of abiding memories. And indeed nothing is easier for a man who has, as the phrase goes, “followed the sea” with reverence and affection, than to evoke the great spirit of the past upon the lower reaches of the Thames. The tidal current runs to and fro in its unceasing service, crowded with memories of men and ships it had borne to the rest of home or to the battles of the sea. It had known and served all the men of whom the nation is proud, from Sir Francis Drake to Sir John Franklin, knights all, titled and untitled—the great knights-errant of the sea. It had borne all the ships whose names are like jewels flashing in the night of time, from the Golden Hind returning with her rotund flanks full of treasure, to be visited by the Queen’s Highness and thus pass out of the gigantic tale, to the Erebus and Terror, bound on other conquests—and that never returned. It had known the ships and the men. They had sailed from Deptford, from Greenwich, from Erith—the adventurers and the settlers; kings’ ships and the ships of men on ‘Change; captains, admirals, the dark “interlopers” of the Eastern trade, and the commissioned “generals” of East India fleets. Hunters for gold or pursuers of fame, they all had gone out on that stream, bearing the sword, and often the torch, messengers of the might within the land, bearers of a spark from the sacred fire. What greatness had not floated on the ebb of that river into the mystery of an unknown earth!… The dreams of men, the seed of commonwealths, the germs of empires.

The sun set; the dusk fell on the stream, and lights began to appear along the shore. The Chapman light-house, a three-legged thing erect on a mud-flat, shone strongly. Lights of ships moved in the fairway—a great stir of lights going up and going down. And farther west on the upper reaches the place of the monstrous town was still marked ominously on the sky, a brooding gloom in sunshine, a lurid glare under the stars.

“And this also,” said Marlow suddenly, “has been one of the dark places of the earth.”

He was the only man of us who still “followed the sea.” The worst that could be said of him was that he did not represent his class. He was a seaman, but he was a wanderer, too, while most seamen lead, if one may so express it, a sedentary life. Their minds are of the stay-at-home order, and their home is always with them—the ship; and so is their country—the sea. One ship is very much like another, and the sea is always the same. In the immutability of their surroundings the foreign shores, the foreign faces, the changing immensity of life, glide past, veiled not by a sense of mystery but by a slightly disdainful ignorance; for there is nothing mysterious to a seaman unless it be the sea itself, which is the mistress of his existence and as inscrutable as Destiny. For the rest, after his hours of work, a casual stroll or a casual spree on shore suffices to unfold for him the secret of a whole continent, and generally he finds the secret not worth knowing. The yarns of seamen have a direct simplicity, the whole meaning of which lies within the shell of a cracked nut. But Marlow was not typical (if his propensity to spin yarns be excepted), and to him the meaning of an episode was not inside like a kernel but outside, enveloping the tale which brought it out only as a glow brings out a haze, in the likeness of one of these misty halos that sometimes are made visible by the spectral illumination of moonshine.

His remark did not seem at all surprising. It was just like Marlow. It was accepted in silence. No one took the trouble to grunt even; and presently he said, very slow—“I was thinking of very old times, when the Romans first came here, nineteen hundred years ago—the other day …. Light came out of this river since—you say Knights? Yes; but it is like a running blaze on a plain, like a flash of lightning in the clouds. We live in the flicker—may it last as long as the old earth keeps rolling! But darkness was here yesterday. Imagine the feelings of a commander of a fine—what d’ye call ‘em?—trireme in the Mediterranean, ordered suddenly to the north; run overland across the Gauls in a hurry; put in charge of one of these craft the legionaries—a wonderful lot of handy men they must have been, too—used to build, apparently by the hundred, in a month or two, if we may believe what we read. Imagine him here—the very end of the world, a sea the colour of lead, a sky the colour of smoke, a kind of ship about as rigid as a concertina—and going up this river with stores, or orders, or what you like. Sand-banks, marshes, forests, savages,—precious little to eat fit for a civilized man, nothing but Thames water to drink. No Falernian wine here, no going ashore. Here and there a military camp lost in a wilderness, like a needle in a bundle of hay—cold, fog, tempests, disease, exile, and death—death skulking in the air, in the water, in the bush. They must have been dying like flies here. Oh, yes—he did it. Did it very well, too, no doubt, and without thinking much about it either, except afterwards to brag of what he had gone through in his time, perhaps. They were men enough to face the darkness. And perhaps he was cheered by keeping his eye on a chance of promotion to the fleet at Ravenna by and by, if he had good friends in Rome and survived the awful climate. Or think of a decent young citizen in a toga—perhaps too much dice, you know—coming out here in the train of some prefect, or tax-gatherer, or trader even, to mend his fortunes. Land in a swamp, march through the woods, and in some inland post feel the savagery, the utter savagery, had closed round him—all that mysterious life of the wilderness that stirs in the forest, in the jungles, in the hearts of wild men. There’s no initiation either into such mysteries. He has to live in the midst of the incomprehensible, which is also detestable. And it has a fascination, too, that goes to work upon him. The fascination of the abomination—you know, imagine the growing regrets, the longing to escape, the powerless disgust, the surrender, the hate.”

' @@ -186,14 +186,14 @@ notifypub: '0' meta_keywords: 'nthnthnth,dnthd,nhtd,ntdthd,nthd,nthdnthd,ntgdhnd,ntdnthdngtd' meta_description: 'tnh dnthd nhtd nhtd ntdthd nthd nthdnthd ntgdhnd ntdnthdngtd' - short_url: '' - item_tag: 'Theme, Bootstrap, jQuery, bootnewage' + short_url: heart-of-darkness-by-joseph-conrad-like-dislike-rating + item_tag: '' votetype: '3' - votevalue: null + votevalue: '' - itemid: '7' categoryid: '5' - title: 'Test Expiration Date' + title: 'Test Expiration Date (Like/Dislike rating)' subtitle: '' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -221,11 +221,11 @@ short_url: test-di item_tag: '' votetype: '3' - votevalue: null + votevalue: '' - itemid: '8' categoryid: '5' - title: 'Test DI FUTURE' + title: 'Test DI FUTURE (10 Star rating)' subtitle: '' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -234,8 +234,8 @@ datesub: '1553701200' dateexpire: '0' status: '2' - image: '4' - images: '4' + image: '0' + images: '' counter: '361' rating: '0.0000' votes: '1' @@ -253,11 +253,11 @@ short_url: test-di-future item_tag: '' votetype: '2' - votevalue: null + votevalue: '' - itemid: '9' categoryid: '5' - title: 'Test DI' + title: 'Test DI (Like/Dislike rating)' subtitle: '' summary: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

' body: '

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

' @@ -266,8 +266,8 @@ datesub: '1551368400' dateexpire: '0' status: '2' - image: '4' - images: '4' + image: '0' + images: '' counter: '233' rating: '0.0000' votes: '1' @@ -285,11 +285,11 @@ short_url: test-di item_tag: '' votetype: '3' - votevalue: null + votevalue: '' - itemid: '10' categoryid: '5' - title: 'Test OFFLINE' + title: 'Test OFFLINE (5 Star rating)' subtitle: '' summary: '

This is on OFFLINE article

' body: '

This is on OFFLINE article

Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!

Messors trabem in tectum!Indexs sunt caniss de bi-color lactea.

Racanas unda!
' @@ -317,11 +317,11 @@ short_url: test-offline item_tag: '' votetype: '1' - votevalue: null + votevalue: '' - itemid: '11' categoryid: '5' - title: 'Test Approval' + title: 'Test Approval (Reactions)' subtitle: '' summary: '

sth st hsth

' body: '

tnhsnth sthstnh th

' @@ -349,11 +349,11 @@ short_url: test-approval item_tag: '' votetype: '5' - votevalue: null + votevalue: '' - itemid: '12' categoryid: '1' - title: 'Submitted New Article' + title: 'Submitted New Article (5 Star rating)' subtitle: 'Waiting for Approval' summary: '
Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!
' body: '
Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!Messors trabem in tectum!Indexs sunt caniss de bi-color lactea.Racanas unda!
' @@ -381,11 +381,11 @@ short_url: submitted_new item_tag: '' votetype: '1' - votevalue: null + votevalue: '' - itemid: '13' categoryid: '5' - title: 'Rejected Article' + title: 'Rejected Article (5 Star rating)' subtitle: '' summary: '

This is a rejected article

' body: '
This is a rejected article
Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!Messors trabem in tectum!Indexs sunt caniss de bi-color lactea.Racanas unda!
' @@ -413,11 +413,11 @@ short_url: rejected item_tag: '' votetype: '1' - votevalue: null + votevalue: '' - itemid: '14' categoryid: '1' - title: xxxx + title: '10 Numbers rating' subtitle: '' summary: '

xxx htdnthdnthd nthd

' body: '

tnhd nthdnthdtnhd

' @@ -445,4 +445,4 @@ short_url: xxxx item_tag: '' votetype: '4' - votevalue: null + votevalue: '' From 00c239dacea051b0269d37de836945f2333bd893 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 6 Mar 2021 04:45:29 -0500 Subject: [PATCH 06/26] fix missing icons for file attachment https://github.com/XoopsModules25x/publisher/issues/161 --- class/Form/ItemForm.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index ca1897ea..78c59db1 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -25,6 +25,7 @@ use Xmf\Request; use XoopsModules\Publisher\{Constants, + Common\Configurator, Form, FormDateTime, Helper, @@ -140,6 +141,8 @@ public function createElements($obj) { $helper = Helper::getInstance(); $timeoffset = null; + $configurator = new Configurator(); + $icons = $configurator->icons; $allowedEditors = Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors')); From b66f2721cd1e3b0b5eed925c4c44c3cd030a88f9 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 6 Mar 2021 04:46:42 -0500 Subject: [PATCH 07/26] fixed archive integer issues https://github.com/XoopsModules25x/publisher/issues/162 --- archive.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archive.php b/archive.php index d5d05bcb..f051ad2e 100644 --- a/archive.php +++ b/archive.php @@ -171,7 +171,7 @@ // must adjust the selected time to server timestamp $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ']; $timeoffsethours = (int)$timeoffset; - $timeoffsetminutes = (($timeoffset - $timeoffsethours) * 60); + $timeoffsetminutes = (int)(($timeoffset - $timeoffsethours) * 60); $monthstart = mktime(0 - $timeoffsethours, 0 - $timeoffsetminutes, 0, $frommonth, 1, $fromyear); $monthend = mktime(23 - $timeoffsethours, 59 - $timeoffsetminutes, 59, $frommonth + 1, 0, $fromyear); From 006e589beb4992d24ac133566fb7dc5fe1c7d930 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 31 Mar 2021 12:12:30 -0400 Subject: [PATCH 08/26] index.html to index.php --- admin/import/index.html | 1 - assets/css/images/index.html | 1 - assets/css/index.html | 1 - assets/images/gfx/index.html | 1 - assets/images/icon/index.html | 1 - assets/images/icons/16/index.html | 1 - assets/images/icons/32/index.html | 1 - assets/images/icons/index.html | 1 - assets/images/index.html | 1 - assets/images/links/index.html | 1 - assets/images/popeye/index.html | 1 - assets/index.html | 1 - assets/js/index.html | 1 - blocks/index.html | 1 - class/Common/index.html | 1 - class/Form/index.html | 1 - class/index.html | 1 - config/index.html | 1 - docs/index.html | 1 - extra/index.html | 1 - extra/seo/index.html | 1 - include/index.html | 1 - language/english/help/index.html | 1 - language/english/index.html | 1 - language/english/mail_template/index.html | 1 - language/index.html | 1 - preloads/index.html | 1 - sql/index.html | 1 - templates/admin/index.html | 1 - templates/blocks/index.html | 1 - templates/index.html | 1 - templates_bootstrap/bootstrap3/index.html | 1 - templates_bootstrap/bootstrap3/publisher/blocks/index.html | 1 - templates_bootstrap/bootstrap3/publisher/index.html | 1 - templates_bootstrap/bootstrap4/index.html | 1 - templates_bootstrap/bootstrap4/publisher/blocks/index.html | 1 - templates_bootstrap/bootstrap4/publisher/index.html | 1 - templates_bootstrap/index.html | 1 - testdata/english/index.html | 1 - testdata/index.html | 1 - tests/index.html | 1 - 41 files changed, 41 deletions(-) delete mode 100644 admin/import/index.html delete mode 100644 assets/css/images/index.html delete mode 100644 assets/css/index.html delete mode 100644 assets/images/gfx/index.html delete mode 100644 assets/images/icon/index.html delete mode 100644 assets/images/icons/16/index.html delete mode 100644 assets/images/icons/32/index.html delete mode 100644 assets/images/icons/index.html delete mode 100644 assets/images/index.html delete mode 100644 assets/images/links/index.html delete mode 100644 assets/images/popeye/index.html delete mode 100644 assets/index.html delete mode 100644 assets/js/index.html delete mode 100644 blocks/index.html delete mode 100644 class/Common/index.html delete mode 100644 class/Form/index.html delete mode 100644 class/index.html delete mode 100644 config/index.html delete mode 100644 docs/index.html delete mode 100644 extra/index.html delete mode 100644 extra/seo/index.html delete mode 100644 include/index.html delete mode 100644 language/english/help/index.html delete mode 100644 language/english/index.html delete mode 100644 language/english/mail_template/index.html delete mode 100644 language/index.html delete mode 100644 preloads/index.html delete mode 100644 sql/index.html delete mode 100644 templates/admin/index.html delete mode 100644 templates/blocks/index.html delete mode 100644 templates/index.html delete mode 100644 templates_bootstrap/bootstrap3/index.html delete mode 100644 templates_bootstrap/bootstrap3/publisher/blocks/index.html delete mode 100644 templates_bootstrap/bootstrap3/publisher/index.html delete mode 100644 templates_bootstrap/bootstrap4/index.html delete mode 100644 templates_bootstrap/bootstrap4/publisher/blocks/index.html delete mode 100644 templates_bootstrap/bootstrap4/publisher/index.html delete mode 100644 templates_bootstrap/index.html delete mode 100644 testdata/english/index.html delete mode 100644 testdata/index.html delete mode 100644 tests/index.html diff --git a/admin/import/index.html b/admin/import/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/admin/import/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/css/images/index.html b/assets/css/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/css/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/css/index.html b/assets/css/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/css/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/gfx/index.html b/assets/images/gfx/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/gfx/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/icon/index.html b/assets/images/icon/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/icon/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/icons/16/index.html b/assets/images/icons/16/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/assets/images/icons/16/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/images/icons/32/index.html b/assets/images/icons/32/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/icons/32/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/icons/index.html b/assets/images/icons/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/icons/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/index.html b/assets/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/links/index.html b/assets/images/links/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/links/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/images/popeye/index.html b/assets/images/popeye/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/images/popeye/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/index.html b/assets/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/assets/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/js/index.html b/assets/js/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/assets/js/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/blocks/index.html b/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/Common/index.html b/class/Common/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/Form/index.html b/class/Form/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/class/Form/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/index.html b/class/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/class/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/config/index.html b/config/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/config/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/extra/index.html b/extra/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/extra/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/extra/seo/index.html b/extra/seo/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/extra/seo/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/include/index.html b/include/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/include/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/language/english/help/index.html b/language/english/help/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/language/english/help/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/language/english/index.html b/language/english/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/language/english/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/language/english/mail_template/index.html b/language/english/mail_template/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/language/english/mail_template/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/language/index.html b/language/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/language/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/preloads/index.html b/preloads/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/preloads/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sql/index.html b/sql/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates/admin/index.html b/templates/admin/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates/admin/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates/blocks/index.html b/templates/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/index.html b/templates_bootstrap/bootstrap3/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap3/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/blocks/index.html b/templates_bootstrap/bootstrap3/publisher/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap3/publisher/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/index.html b/templates_bootstrap/bootstrap3/publisher/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap3/publisher/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/index.html b/templates_bootstrap/bootstrap4/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap4/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/index.html b/templates_bootstrap/bootstrap4/publisher/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap4/publisher/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/publisher/index.html b/templates_bootstrap/bootstrap4/publisher/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap4/publisher/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/index.html b/templates_bootstrap/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/english/index.html b/testdata/english/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/english/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/index.html b/testdata/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/index.html b/tests/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/tests/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From a89063cfd44204d0c03ce87acf5d4ff9df6d22a8 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 31 Mar 2021 12:13:08 -0400 Subject: [PATCH 09/26] add index.php --- admin/import/index.php | 2 ++ assets/css/images/index.php | 2 ++ assets/css/index.php | 2 ++ assets/images/gfx/index.php | 2 ++ assets/images/icon/index.php | 2 ++ assets/images/icons/16/index.php | 3 +++ assets/images/icons/32/index.php | 2 ++ assets/images/icons/index.php | 2 ++ assets/images/index.php | 2 ++ assets/images/links/index.php | 2 ++ assets/images/popeye/index.php | 2 ++ assets/index.php | 3 +++ assets/js/index.php | 3 +++ blocks/index.php | 2 ++ class/Common/index.php | 3 +++ class/Form/index.php | 2 ++ class/Versioncontrol/index.php | 2 ++ class/index.php | 2 ++ class/versioncontrol - Copy2006/index.php | 2 ++ class/versioncontrol0/index.php | 2 ++ config/index.php | 3 +++ docs/index.php | 3 +++ extra/index.php | 2 ++ extra/seo/index.php | 2 ++ include/index.php | 2 ++ language/english/help/index.php | 3 +++ language/english/index.php | 3 +++ language/english/mail_template/index.php | 2 ++ language/index.php | 2 ++ preloads/index.php | 3 +++ sql/index.php | 2 ++ templates/admin/index.php | 2 ++ templates/blocks/index.php | 2 ++ templates/index.php | 2 ++ templates_bootstrap/bootstrap3/index.php | 2 ++ templates_bootstrap/bootstrap3/publisher/blocks/index.php | 2 ++ templates_bootstrap/bootstrap3/publisher/index.php | 2 ++ templates_bootstrap/bootstrap4/index.php | 2 ++ templates_bootstrap/bootstrap4/publisher/blocks/index.php | 2 ++ templates_bootstrap/bootstrap4/publisher/index.php | 2 ++ templates_bootstrap/index.php | 2 ++ testdata/english/index.php | 2 ++ 42 files changed, 93 insertions(+) create mode 100644 admin/import/index.php create mode 100644 assets/css/images/index.php create mode 100644 assets/css/index.php create mode 100644 assets/images/gfx/index.php create mode 100644 assets/images/icon/index.php create mode 100644 assets/images/icons/16/index.php create mode 100644 assets/images/icons/32/index.php create mode 100644 assets/images/icons/index.php create mode 100644 assets/images/index.php create mode 100644 assets/images/links/index.php create mode 100644 assets/images/popeye/index.php create mode 100644 assets/index.php create mode 100644 assets/js/index.php create mode 100644 blocks/index.php create mode 100644 class/Common/index.php create mode 100644 class/Form/index.php create mode 100644 class/Versioncontrol/index.php create mode 100644 class/index.php create mode 100644 class/versioncontrol - Copy2006/index.php create mode 100644 class/versioncontrol0/index.php create mode 100644 config/index.php create mode 100644 docs/index.php create mode 100644 extra/index.php create mode 100644 extra/seo/index.php create mode 100644 include/index.php create mode 100644 language/english/help/index.php create mode 100644 language/english/index.php create mode 100644 language/english/mail_template/index.php create mode 100644 language/index.php create mode 100644 preloads/index.php create mode 100644 sql/index.php create mode 100644 templates/admin/index.php create mode 100644 templates/blocks/index.php create mode 100644 templates/index.php create mode 100644 templates_bootstrap/bootstrap3/index.php create mode 100644 templates_bootstrap/bootstrap3/publisher/blocks/index.php create mode 100644 templates_bootstrap/bootstrap3/publisher/index.php create mode 100644 templates_bootstrap/bootstrap4/index.php create mode 100644 templates_bootstrap/bootstrap4/publisher/blocks/index.php create mode 100644 templates_bootstrap/bootstrap4/publisher/index.php create mode 100644 templates_bootstrap/index.php create mode 100644 testdata/english/index.php diff --git a/admin/import/index.php b/admin/import/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/admin/import/index.php @@ -0,0 +1,2 @@ + Date: Sun, 8 Aug 2021 14:10:44 -0400 Subject: [PATCH 10/26] replace index.html with index.php --- admin/import/index.html | 1 - admin/import/index.php | 2 ++ assets/css/images/index.html | 1 - assets/css/images/index.php | 2 ++ assets/css/index.html | 1 - assets/css/index.php | 2 ++ assets/images/gfx/index.html | 1 - assets/images/gfx/index.php | 2 ++ assets/images/icon/index.html | 1 - assets/images/icon/index.php | 2 ++ assets/images/icons/16/index.html | 1 - assets/images/icons/16/index.php | 3 +++ assets/images/icons/32/index.html | 1 - assets/images/icons/32/index.php | 2 ++ assets/images/icons/index.html | 1 - assets/images/icons/index.php | 2 ++ assets/images/index.html | 1 - assets/images/index.php | 2 ++ assets/images/links/index.html | 1 - assets/images/links/index.php | 2 ++ assets/images/popeye/index.html | 1 - assets/images/popeye/index.php | 2 ++ assets/index.html | 1 - assets/index.php | 3 +++ assets/js/index.html | 1 - assets/js/index.php | 3 +++ blocks/index.html | 1 - blocks/index.php | 2 ++ class/Common/index.html | 1 - class/Common/index.php | 3 +++ class/Form/index.html | 1 - class/Form/index.php | 2 ++ class/index.html | 1 - class/index.php | 2 ++ config/index.html | 1 - config/index.php | 3 +++ docs/index.html | 1 - docs/index.php | 3 +++ extra/index.html | 1 - extra/index.php | 2 ++ extra/seo/index.html | 1 - extra/seo/index.php | 2 ++ include/index.html | 1 - include/index.php | 2 ++ language/english/help/index.html | 1 - language/english/help/index.php | 3 +++ language/english/index.html | 1 - language/english/index.php | 3 +++ language/english/mail_template/index.html | 1 - language/english/mail_template/index.php | 2 ++ language/index.html | 1 - language/index.php | 2 ++ preloads/index.html | 1 - preloads/index.php | 3 +++ sql/index.html | 1 - sql/index.php | 2 ++ templates/admin/index.html | 1 - templates/admin/index.php | 2 ++ templates/blocks/index.html | 1 - templates/blocks/index.php | 2 ++ templates/index.html | 1 - templates/index.php | 2 ++ templates_bootstrap/bootstrap3/index.html | 1 - templates_bootstrap/bootstrap3/index.php | 2 ++ templates_bootstrap/bootstrap3/publisher/blocks/index.html | 1 - templates_bootstrap/bootstrap3/publisher/blocks/index.php | 2 ++ templates_bootstrap/bootstrap3/publisher/index.html | 1 - templates_bootstrap/bootstrap3/publisher/index.php | 2 ++ templates_bootstrap/bootstrap4/index.html | 1 - templates_bootstrap/bootstrap4/index.php | 2 ++ templates_bootstrap/bootstrap4/publisher/blocks/index.html | 1 - templates_bootstrap/bootstrap4/publisher/blocks/index.php | 2 ++ templates_bootstrap/bootstrap4/publisher/index.html | 1 - templates_bootstrap/bootstrap4/publisher/index.php | 2 ++ templates_bootstrap/index.html | 1 - templates_bootstrap/index.php | 2 ++ testdata/english/index.html | 1 - testdata/english/index.php | 2 ++ testdata/index.html | 1 - tests/index.html | 1 - tests/index.php | 2 ++ 81 files changed, 89 insertions(+), 41 deletions(-) delete mode 100644 admin/import/index.html create mode 100644 admin/import/index.php delete mode 100644 assets/css/images/index.html create mode 100644 assets/css/images/index.php delete mode 100644 assets/css/index.html create mode 100644 assets/css/index.php delete mode 100644 assets/images/gfx/index.html create mode 100644 assets/images/gfx/index.php delete mode 100644 assets/images/icon/index.html create mode 100644 assets/images/icon/index.php delete mode 100644 assets/images/icons/16/index.html create mode 100644 assets/images/icons/16/index.php delete mode 100644 assets/images/icons/32/index.html create mode 100644 assets/images/icons/32/index.php delete mode 100644 assets/images/icons/index.html create mode 100644 assets/images/icons/index.php delete mode 100644 assets/images/index.html create mode 100644 assets/images/index.php delete mode 100644 assets/images/links/index.html create mode 100644 assets/images/links/index.php delete mode 100644 assets/images/popeye/index.html create mode 100644 assets/images/popeye/index.php delete mode 100644 assets/index.html create mode 100644 assets/index.php delete mode 100644 assets/js/index.html create mode 100644 assets/js/index.php delete mode 100644 blocks/index.html create mode 100644 blocks/index.php delete mode 100644 class/Common/index.html create mode 100644 class/Common/index.php delete mode 100644 class/Form/index.html create mode 100644 class/Form/index.php delete mode 100644 class/index.html create mode 100644 class/index.php delete mode 100644 config/index.html create mode 100644 config/index.php delete mode 100644 docs/index.html create mode 100644 docs/index.php delete mode 100644 extra/index.html create mode 100644 extra/index.php delete mode 100644 extra/seo/index.html create mode 100644 extra/seo/index.php delete mode 100644 include/index.html create mode 100644 include/index.php delete mode 100644 language/english/help/index.html create mode 100644 language/english/help/index.php delete mode 100644 language/english/index.html create mode 100644 language/english/index.php delete mode 100644 language/english/mail_template/index.html create mode 100644 language/english/mail_template/index.php delete mode 100644 language/index.html create mode 100644 language/index.php delete mode 100644 preloads/index.html create mode 100644 preloads/index.php delete mode 100644 sql/index.html create mode 100644 sql/index.php delete mode 100644 templates/admin/index.html create mode 100644 templates/admin/index.php delete mode 100644 templates/blocks/index.html create mode 100644 templates/blocks/index.php delete mode 100644 templates/index.html create mode 100644 templates/index.php delete mode 100644 templates_bootstrap/bootstrap3/index.html create mode 100644 templates_bootstrap/bootstrap3/index.php delete mode 100644 templates_bootstrap/bootstrap3/publisher/blocks/index.html create mode 100644 templates_bootstrap/bootstrap3/publisher/blocks/index.php delete mode 100644 templates_bootstrap/bootstrap3/publisher/index.html create mode 100644 templates_bootstrap/bootstrap3/publisher/index.php delete mode 100644 templates_bootstrap/bootstrap4/index.html create mode 100644 templates_bootstrap/bootstrap4/index.php delete mode 100644 templates_bootstrap/bootstrap4/publisher/blocks/index.html create mode 100644 templates_bootstrap/bootstrap4/publisher/blocks/index.php delete mode 100644 templates_bootstrap/bootstrap4/publisher/index.html create mode 100644 templates_bootstrap/bootstrap4/publisher/index.php delete mode 100644 templates_bootstrap/index.html create mode 100644 templates_bootstrap/index.php delete mode 100644 testdata/english/index.html create mode 100644 testdata/english/index.php delete mode 100644 testdata/index.html delete mode 100644 tests/index.html create mode 100644 tests/index.php diff --git a/admin/import/index.html b/admin/import/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/admin/import/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/import/index.php b/admin/import/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/admin/import/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/css/images/index.php b/assets/css/images/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/css/images/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/css/index.php b/assets/css/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/css/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/gfx/index.php b/assets/images/gfx/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/gfx/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icon/index.php b/assets/images/icon/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/icon/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/assets/images/icons/16/index.php b/assets/images/icons/16/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/assets/images/icons/16/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/32/index.php b/assets/images/icons/32/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/icons/32/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/index.php b/assets/images/icons/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/icons/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/index.php b/assets/images/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/links/index.php b/assets/images/links/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/links/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/popeye/index.php b/assets/images/popeye/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/popeye/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/assets/index.php b/assets/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/assets/index.php @@ -0,0 +1,3 @@ +history.go(-1); diff --git a/assets/js/index.php b/assets/js/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/assets/js/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/blocks/index.php b/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/class/Common/index.php b/class/Common/index.php new file mode 100644 index 00000000..5d076016 --- /dev/null +++ b/class/Common/index.php @@ -0,0 +1,3 @@ + history.go(-1); \ No newline at end of file diff --git a/class/Form/index.php b/class/Form/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/class/Form/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/class/index.php b/class/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/class/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/config/index.php b/config/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/config/index.php @@ -0,0 +1,3 @@ +history.go(-1); diff --git a/docs/index.php b/docs/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/docs/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/extra/index.php b/extra/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/extra/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/extra/seo/index.php b/extra/seo/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/extra/seo/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/include/index.php b/include/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/include/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/language/english/help/index.php b/language/english/help/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/language/english/help/index.php @@ -0,0 +1,3 @@ +history.go(-1); diff --git a/language/english/index.php b/language/english/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/language/english/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/language/english/mail_template/index.php b/language/english/mail_template/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/language/english/mail_template/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/language/index.php b/language/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/language/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/preloads/index.php b/preloads/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/preloads/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/sql/index.php b/sql/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/sql/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/admin/index.php b/templates/admin/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates/admin/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/blocks/index.php b/templates/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/index.php b/templates/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/index.php b/templates_bootstrap/bootstrap3/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap3/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/blocks/index.php b/templates_bootstrap/bootstrap3/publisher/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap3/publisher/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/index.php b/templates_bootstrap/bootstrap3/publisher/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap3/publisher/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/index.php b/templates_bootstrap/bootstrap4/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap4/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/index.php b/templates_bootstrap/bootstrap4/publisher/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap4/publisher/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/publisher/index.php b/templates_bootstrap/bootstrap4/publisher/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap4/publisher/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/index.php b/templates_bootstrap/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/testdata/english/index.php b/testdata/english/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/testdata/english/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/tests/index.html b/tests/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/tests/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/index.php b/tests/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/tests/index.php @@ -0,0 +1,2 @@ + Date: Sun, 8 Aug 2021 14:15:21 -0400 Subject: [PATCH 11/26] add renameColumns, moduleStats to Configurator --- class/Common/Configurator.php | 7 ++++++- config/config.php | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 6771ad4a..db6c073c 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -32,6 +32,7 @@ class Configurator { public $name; public $paths = []; + public $icons = []; public $uploadFolders = []; public $copyBlankFiles = []; public $copyTestFolders = []; @@ -39,8 +40,9 @@ class Configurator public $oldFiles = []; public $oldFolders = []; public $renameTables = []; + public $renameColumns = []; + public $moduleStats = []; public $modCopyright; - public $icons; /** * Configurator constructor. @@ -49,6 +51,7 @@ public function __construct() { $config = require \dirname(__DIR__, 2) . '/config/config.php'; + $this->name = $config->name; $this->uploadFolders = $config->uploadFolders; $this->copyBlankFiles = $config->copyBlankFiles; $this->copyTestFolders = $config->copyTestFolders; @@ -56,6 +59,8 @@ public function __construct() $this->oldFiles = $config->oldFiles; $this->oldFolders = $config->oldFolders; $this->renameTables = $config->renameTables; + $this->renameColumns = $config->renameColumns; + $this->moduleStats = $config->moduleStats; $this->modCopyright = $config->modCopyright; $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; diff --git a/config/config.php b/config/config.php index 67ee2f1b..54af2270 100644 --- a/config/config.php +++ b/config/config.php @@ -12,7 +12,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @since * @author XOOPS Development Team @@ -23,11 +23,13 @@ Helper }; -require_once dirname(__DIR__) . '/include/common.php'; -$moduleDirName = basename(dirname(__DIR__)); +require_once \dirname(__DIR__) . '/include/common.php'; +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); return (object)[ + 'name' => $moduleDirNameUpper . ' Module Configurator', 'paths' => [ 'dirname' => $moduleDirName, 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', @@ -84,6 +86,17 @@ 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', ], + 'renameColumns' => [// 'extcal_event' => ['from' => 'event_etablissement', 'to' => 'event_location'], + ], + 'moduleStats' => [ + 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), + 'totalitems' => $helper->getHandler('Item')->getItemsCount(), + 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_SUBMITTED), + 'totalpublished' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_PUBLISHED), + 'totaloffline' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_OFFLINE), + 'totalrejected' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_REJECTED), + ], 'modCopyright' => " XOOPS Project", ]; + From b90e465aff918c33dcfb7104cc887ab8bf3c98ea Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 8 Aug 2021 14:15:37 -0400 Subject: [PATCH 12/26] logoXoopsPhp8 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77cb4951..e5ab1262 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) +![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png) # Contributing to [XOOPS CMS](https://xoops.org) [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html) From b6f523eaff40d606327d8a31d1b0c7bf134d66bb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 8 Aug 2021 14:19:03 -0400 Subject: [PATCH 13/26] Yoda, cosmetics, Unqualified function/constant reference, type hints --- admin/about.php | 2 +- admin/admin_header.php | 13 +- admin/blockform.php | 38 +++--- admin/blocksadmin.php | 110 ++++++++-------- admin/feedback.php | 4 +- admin/import/ams.php | 4 +- admin/import/cjaycontent.php | 4 +- admin/import/fmcontent.php | 4 +- admin/import/news.php | 2 +- admin/import/smartsection.php | 2 +- admin/import/wfsection.php | 2 +- admin/import/xfsection.php | 2 +- admin/import/xnews.php | 4 +- admin/index.php | 16 +-- admin/main.php | 4 +- admin/menu.php | 4 +- admin/migrate.php | 15 +-- admin/permissions.php | 2 +- archive.php | 2 +- assets/css/publisher.css | 8 ++ assets/js/funcs.js | 88 ++++++------- blocks/category_items_sel.php | 2 +- blocks/date_to_date.php | 2 +- blocks/items_columns.php | 2 +- blocks/items_menu.php | 2 +- blocks/items_new.php | 2 +- blocks/items_random_item.php | 3 +- blocks/items_recent.php | 2 +- blocks/items_spot.php | 2 +- blocks/latest_files.php | 2 +- blocks/latest_news.php | 2 +- blocks/search.php | 2 +- class/Category.php | 8 +- class/Common/Migrate.php | 18 +-- class/Common/ModuleStats.php | 16 ++- class/Common/SysUtility.php | 59 ++++++--- class/Common/TestdataButtons.php | 37 +++--- class/Common/VersionChecks.php | 38 +++++- class/Form/CategoryForm.php | 4 +- class/Form/FileForm.php | 2 +- class/Form/ItemForm.php | 14 +-- class/Helper.php | 4 +- class/Item.php | 4 +- class/MimetypesUtility.php | 2 +- class/PermissionHandler.php | 5 +- class/RatingsHandler.php | 10 +- class/Utility.php | 58 ++++----- class/VoteHandler.php | 117 +++++++++++++++++- comment_delete.php | 2 +- comment_edit.php | 2 +- comment_new.php | 2 +- comment_post.php | 2 +- comment_reply.php | 2 +- config/icons.php | 2 +- config/paths.php | 2 +- docs/changelog.txt | 8 ++ header.php | 2 +- include/ajax_rating.php | 2 +- include/ajax_upload.php | 2 +- include/common.php | 4 +- include/config.php | 2 +- include/oninstall.php | 11 +- include/onupdate.php | 4 +- include/search.inc.php | 16 ++- language/english/common.php | 37 +++--- language/english/feedback.php | 2 +- notification_update.php | 2 +- preloads/autoloader.php | 2 +- sql/mysql.sql | 1 + .../publisher_item(title_bottom).tpl | 4 + testdata/index.php | 57 +++++---- xoops_version.php | 6 +- 72 files changed, 586 insertions(+), 339 deletions(-) diff --git a/admin/about.php b/admin/about.php index 285e731a..2047d6df 100644 --- a/admin/about.php +++ b/admin/about.php @@ -24,7 +24,7 @@ /** @var Admin $adminObject */ -require __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); diff --git a/admin/admin_header.php b/admin/admin_header.php index 7354b5cd..e00eb7f4 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -23,14 +23,14 @@ use XoopsModules\Publisher\Helper; use XoopsModules\Publisher\Common\Configurator; -require dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; -require_once dirname(__DIR__, 3) . '/include/cp_header.php'; +require \dirname(__DIR__, 3) . '/include/cp_header.php'; //require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $helper = Helper::getInstance(); /** @var Admin $adminObject */ @@ -38,8 +38,9 @@ $pathIcon16 = Admin::iconUrl('', 16); $pathIcon32 = Admin::iconUrl('', 32); -if (is_object($helper->getModule())) { - $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); +$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; +if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { + $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); } // Load language files diff --git a/admin/blockform.php b/admin/blockform.php index 647e216f..deb67043 100644 --- a/admin/blockform.php +++ b/admin/blockform.php @@ -7,7 +7,6 @@ * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * - * PHP version 5 * * @category Module * @author XOOPS Development Team @@ -15,10 +14,19 @@ * @link https://xoops.org * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ + +use Xmf\Module\Admin; +use XoopsModules\Publisher\{ + Helper +}; + +/** @var Admin $adminObject */ +/** @var Helper $helper */ + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); $form = new \XoopsThemeForm($block['form_title'], 'blockform', 'blocksadmin.php', 'post', true); if (isset($block['name'])) { @@ -51,7 +59,7 @@ ksort($moduleList); $moduleSelect->addOptionArray($moduleList); $form->addElement($moduleSelect); -$form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'TITLE'), 'btitle', 50, 255, $block['title']), false); +$form->addElement(new \XoopsFormText(_AM_SYSTEM_BLOCKS_TITLE, 'btitle', 50, 255, $block['title']), false); if ($block['is_custom']) { $textarea = new \XoopsFormDhtmlTextArea(_AM_SYSTEM_BLOCKS_CONTENT, 'bcontent', $block['content'], 15, 70); $textarea->setDescription('' . _AM_SYSTEM_BLOCKS_USEFULTAGS . '
' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . ''); @@ -87,17 +95,17 @@ $cacheSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']); $cacheSelect->addOptionArray( [ - '0' => _NOCACHE, - '30' => sprintf(_SECONDS, 30), - '60' => _MINUTE, - '300' => sprintf(_MINUTES, 5), - '1800' => sprintf(_MINUTES, 30), - '3600' => _HOUR, - '18000' => sprintf(_HOURS, 5), - '86400' => _DAY, - '259200' => sprintf(_DAYS, 3), - '604800' => _WEEK, - '2592000' => _MONTH, + 0 => _NOCACHE, + 30 => sprintf(_SECONDS, 30), + 60 => _MINUTE, + 300 => sprintf(_MINUTES, 5), + 1800 => sprintf(_MINUTES, 30), + 3600 => _HOUR, + 18000 => sprintf(_HOURS, 5), + 86400 => _DAY, + 259200 => sprintf(_DAYS, 3), + 604800 => _WEEK, + 2592000 => _MONTH, ] ); $form->addElement($cacheSelect); diff --git a/admin/blocksadmin.php b/admin/blocksadmin.php index e4c64eac..1e6b21f1 100644 --- a/admin/blocksadmin.php +++ b/admin/blocksadmin.php @@ -7,7 +7,6 @@ * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * - * PHP version 5 * * @category Module * @author XOOPS Development Team @@ -24,17 +23,18 @@ }; require __DIR__ . '/admin_header.php'; -include_once $GLOBALS['xoops']->path('class/xoopsblock.php'); +//include_once $GLOBALS['xoops']->path('class/xoopsblock.php'); + require_once XOOPS_ROOT_PATH . '/kernel/block.php'; -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (!is_object($xoopsModule) || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); } if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { - require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; +// require_once XOOPS_ROOT_PATH . '/kernel/block.php'; $op = 'list'; if (isset($_POST)) { foreach ($_POST as $k => $v) { @@ -42,18 +42,16 @@ } } /* - if (Request::hasVar('op')) { - if ($_GET['op'] === "edit" || $_GET['op'] === "delete" || $_GET['op'] === "delete_ok" || $_GET['op'] === "clone" - || $_GET['op'] === "edit" - ) { + if (Request::hasVar('op', 'GET')) { + if ('edit' === $_GET['op'] || 'delete' === $_GET['op'] || 'delete_ok' === $_GET['op'] || 'clone' === $_GET['op'] + || 'edit' === $_GET['op']) { $op = $_GET['op']; - $bid = Request::getInt('bid',0 ,'GET'); //isset($_GET['bid']) ? (int) $_GET['bid'] : 0; - } + $bid = Request::getInt('bid', 0, 'GET'); } */ $op = Request::getString('op', $op); - if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'], true)) { + if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'])) { $bid = Request::getInt('bid', 0, 'GET'); } @@ -62,11 +60,15 @@ function listBlocks() global $xoopsModule, $pathIcon16; // require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; xoops_load('xoopslist'); - require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + //require_once XOOPS_ROOT_PATH . '/kernel/block.php'; + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); + + $adminObject = Admin::getInstance(); + $adminObject->displayNavigation(basename(__FILE__)); + xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); @@ -93,7 +95,7 @@ function listBlocks() echo $GLOBALS['xoopsSecurity']->getTokenHTML(); echo "'; echo "'; @@ -295,21 +295,18 @@ function listBlocks() */ function cloneBlock($bid) { - require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); - /** @var \Xmf\Module\Admin $adminObject */ $adminObject = Admin::getInstance(); $adminObject->displayNavigation(basename(__FILE__)); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); - // mpu_adm_menu(); $myblock = new \XoopsBlock($bid); $db = \XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid; @@ -361,11 +358,13 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); $block = new \XoopsBlock($bid); $clone = $block->xoopsClone(); if (empty($bmodule)) { xoops_cp_header(); - xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN)); + xoops_error(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'NOTSELNG'), constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'))); xoops_cp_footer(); exit(); } @@ -413,7 +412,7 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $sql = 'INSERT INTO ' . $db->prefix('group_permission') . ' (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (' . $iValue . ', ' . $newid . ", 1, 'block_read')"; $db->query($sql); } - redirect_header('blocksadmin.php?op=listar', 1, _AM_DBUPDATED); + redirect_header('blocksadmin.php?op=listar', 1, _AM_SYSTEM_BLOCKS_DBUPDATED); } /** @@ -433,7 +432,10 @@ function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule $myblock->setVar('visible', $visible); $myblock->setVar('side', $side); $myblock->setVar('bcachetime', $bcachetime); - $myblock->store(); + // $myblock->store(); + /** @var \XoopsBlockHandler $blockHandler */ + $blockHandler = xoops_getHandler('block'); + return $blockHandler->insert($myblock); } /** @@ -441,13 +443,12 @@ function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule */ function editBlock($bid) { - require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); /** @var \Xmf\Module\Admin $adminObject */ $adminObject = Admin::getInstance(); $adminObject->displayNavigation(basename(__FILE__)); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); @@ -503,18 +504,18 @@ function editBlock($bid) function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups) { - $myblock = new XoopsBlock($bid); + $myblock = new \XoopsBlock($bid); $myblock->setVar('title', $btitle); $myblock->setVar('weight', $bweight); $myblock->setVar('visible', $bvisible); $myblock->setVar('side', $bside); $myblock->setVar('bcachetime', $bcachetime); + $myblock->setVar('module', $bmodule); + $myblock->setVar('groups', $groups); $helper = Helper::getInstance(); $helper->loadLanguage('common'); //update block options - if (isset($options)) { - $optionsCount = count($options); - if ($optionsCount > 0) { + if (is_array($options) && count($options) > 0) { //Convert array values to comma-separated foreach ($options as $i => $iValue) { if (is_array($iValue)) { @@ -524,10 +525,15 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b $options = implode('|', $options); $myblock->setVar('options', $options); } - } - $myblock->store(); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + // $myblock->store(); + /** @var \XoopsBlockHandler $blockHandler */ + $blockHandler = xoops_getHandler('block'); + $blockHandler->insert($myblock); + + global $xoopsDB; + + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (!empty($bmodule) && count($bmodule) > 0) { $sql = sprintf('DELETE FROM `%s` WHERE block_id = %u', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid); @@ -555,7 +561,7 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b if ('list' === $op) { xoops_cp_header(); - $adminObject->displayNavigation(basename(__FILE__)); + //$adminObject->displayNavigation(basename(__FILE__)); listBlocks(); require_once __DIR__ . '/admin_footer.php'; exit(); diff --git a/admin/feedback.php b/admin/feedback.php index 66acda58..45fada48 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -25,7 +25,7 @@ use Xmf\Request; use \XoopsModules\Publisher\Common\ModuleFeedback; -require __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $adminObject = Admin::getInstance(); @@ -98,4 +98,4 @@ break; } -require __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/import/ams.php b/admin/import/ams.php index 6a90822b..e46b9459 100644 --- a/admin/import/ams.php +++ b/admin/import/ams.php @@ -31,7 +31,7 @@ const DIRNAME = 'ams'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'AMS ' . Request::getString('ams_version', '', 'POST'); @@ -169,7 +169,7 @@ if ('go' === $op) { Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $moduleId = $helper->getModule()->getVar('mid'); diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php index 281601a2..112596c5 100644 --- a/admin/import/cjaycontent.php +++ b/admin/import/cjaycontent.php @@ -29,7 +29,7 @@ const DIRNAME = 'cjaycontent'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'cjaycontent ' . Request::getString('cjaycontent_version', '', 'POST'); @@ -93,7 +93,7 @@ if ('go' === $op) { Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index 1ab6fb7b..3b5ba9ec 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -35,7 +35,7 @@ /** @var \XoopsPersistableObjectHandler $fmContentHdlr */ /** @var \XoopsPersistableObjectHandler $fmTopicHdlr */ -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'FmContent ' . Request::getString('fmcontent_version', '', 'POST'); @@ -105,7 +105,7 @@ $categoryHdlr = $helper->getHandler('Category'); $catObjs = $categoryHdlr->getAll(); $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $module = \XoopsModule::getByDirname($moduleDirName); $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); //$form->addElement($catSelBox); diff --git a/admin/import/news.php b/admin/import/news.php index 71f51d6c..76df1e07 100644 --- a/admin/import/news.php +++ b/admin/import/news.php @@ -31,7 +31,7 @@ const DIRNAME = 'news'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'News ' . Request::getString('news_version', '', 'POST'); diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php index 935fd155..f882b2f2 100644 --- a/admin/import/smartsection.php +++ b/admin/import/smartsection.php @@ -33,7 +33,7 @@ const ITEMID = 'itemid'; const DIRNAME = 'smartsection'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'Smartsection ' . Request::getString('smartsection_version', '', 'POST'); diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php index edc559e1..1d002434 100644 --- a/admin/import/wfsection.php +++ b/admin/import/wfsection.php @@ -35,7 +35,7 @@ const ARTICLEID = 'articleid'; const DIRNAME = 'wfsection'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'WF-Section ' . Request::getString('wfs_version', '', 'POST'); diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php index c63a7fdd..db763296 100644 --- a/admin/import/xfsection.php +++ b/admin/import/xfsection.php @@ -34,7 +34,7 @@ const ITEMID = 'articleid'; const DIRNAME = 'xfsection'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'XF-Section ' . Request::getString('xfs_version', '', 'POST'); diff --git a/admin/import/xnews.php b/admin/import/xnews.php index 2348d3fb..c0cdae0e 100644 --- a/admin/import/xnews.php +++ b/admin/import/xnews.php @@ -32,7 +32,7 @@ const DIRNAME = 'xnews'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'xNews ' . Request::getString('xnews_version', '', 'POST'); @@ -171,7 +171,7 @@ if ('go' === $op) { Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); $moduleId = $helper->getModule()->getVar('mid'); diff --git a/admin/index.php b/admin/index.php index 6a4e9176..1569c31c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -21,13 +21,14 @@ */ use Xmf\Module\Admin; +use Xmf\Request; +use Xmf\Yaml; use XoopsModules\Publisher\{Common, Common\Configurator, Common\TestdataButtons, Helper, Utility }; -use Xmf\Request; require_once __DIR__ . '/admin_header.php'; @@ -60,7 +61,8 @@ $adminObject->addConfigBoxLine('!' . _MD_PUBLISHER_ERROR_NO_PDF . '', 'default'); } -$moduleStats = $utility::getModuleStats(); +$modStats = []; +$moduleStats = $utility::getModuleStats($configurator, $modStats); $adminObject->addInfoBox(constant('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY')); if ($moduleStats && is_array($moduleStats)) { @@ -97,10 +99,10 @@ $adminObject->displayNavigation(basename(__FILE__)); //check for latest release -//$newRelease = $utility::checkVerModule($helper); -//if (!empty($newRelease)) { -// $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); -//} +$newRelease = $utility::checkVerModule($helper); +if (!empty($newRelease)) { + $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); +} //------------- Test Data Buttons ---------------------------- if ($helper->getConfig('displaySampleButton')) { @@ -122,4 +124,4 @@ echo $utility::getServerStats(); //codeDump(__FILE__); -require __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/main.php b/admin/main.php index dc5ea2fa..cd1183e9 100644 --- a/admin/main.php +++ b/admin/main.php @@ -27,8 +27,8 @@ require_once __DIR__ . '/admin_header.php'; require_once $GLOBALS['xoops']->path('class/xoopslists.php'); require_once $GLOBALS['xoops']->path('class/pagenav.php'); -// require_once dirname(__DIR__) . '/class/Utility.php'; -require_once dirname(__DIR__) . '/include/common.php'; +// require_once \dirname(__DIR__) . '/class/Utility.php'; +require_once \dirname(__DIR__) . '/include/common.php'; $itemId = Request::getInt('itemid', 0, 'POST'); diff --git a/admin/menu.php b/admin/menu.php index 09957ea6..78b0de39 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -22,9 +22,9 @@ use Xmf\Module\Admin; use XoopsModules\Publisher\Helper; -require_once dirname(__DIR__) . '/preloads/autoloader.php'; +require_once \dirname(__DIR__) . '/preloads/autoloader.php'; -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); diff --git a/admin/migrate.php b/admin/migrate.php index 12adf61f..793f86e7 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -32,6 +32,7 @@ // ------------------------------------------------------------------------- // use Xmf\Request; + use Xmf\Module\Admin; use XoopsModules\Publisher\{ Common\Configurator, @@ -43,7 +44,7 @@ /** @var Configurator $configurator */ /** @var Migrate $migrator */ -require __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); @@ -68,13 +69,13 @@ $migrator = new Migrate($configurator); -$op = Request::getCmd('op', 'show'); -$opShow = Request::getCmd('show', null, 'POST'); +$op = Request::getCmd('op', 'show'); +$opShow = Request::getCmd('show', null, 'POST'); $opMigrate = Request::getCmd('migrate', null, 'POST'); -$opSchema = Request::getCmd('schema', null, 'POST'); -$op = !empty($opShow) ? 'show' : $op; -$op = !empty($opMigrate) ? 'migrate' : $op; -$op = !empty($opSchema) ? 'schema' : $op; +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; $message = ''; diff --git a/admin/permissions.php b/admin/permissions.php index 26d41174..aa574a40 100644 --- a/admin/permissions.php +++ b/admin/permissions.php @@ -25,7 +25,7 @@ }; require_once __DIR__ . '/admin_header.php'; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); $myts = \MyTextSanitizer::getInstance(); diff --git a/archive.php b/archive.php index d5d05bcb..f051ad2e 100644 --- a/archive.php +++ b/archive.php @@ -171,7 +171,7 @@ // must adjust the selected time to server timestamp $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ']; $timeoffsethours = (int)$timeoffset; - $timeoffsetminutes = (($timeoffset - $timeoffsethours) * 60); + $timeoffsetminutes = (int)(($timeoffset - $timeoffsethours) * 60); $monthstart = mktime(0 - $timeoffsethours, 0 - $timeoffsetminutes, 0, $frommonth, 1, $fromyear); $monthend = mktime(23 - $timeoffsethours, 59 - $timeoffsetminutes, 59, $frommonth + 1, 0, $fromyear); diff --git a/assets/css/publisher.css b/assets/css/publisher.css index 08f39b85..477b5119 100644 --- a/assets/css/publisher.css +++ b/assets/css/publisher.css @@ -156,6 +156,14 @@ font-size: 12px; } +.article_full_category_b5 { + background: #5CB85C; + color: #fff; + padding: 4px 6px; + font-size: 12px; + position: absolute; +} + /*END CATEGORY FULL VIEW*/ /* CATEGORY LIST VIEW*/ diff --git a/assets/js/funcs.js b/assets/js/funcs.js index 5a1bff7d..b3f60f7a 100644 --- a/assets/js/funcs.js +++ b/assets/js/funcs.js @@ -1,15 +1,15 @@ function selectAll(formObj, fieldname, isInverse) { - if (fieldname.length === 0) { - for (let i = 0; i < formObj.length; i++) { - var fldObj = formObj.elements[i]; - if (fldObj.type === 'checkbox') { + if (fieldname.length == 0) { + for (var i = 0; i < formObj.length; i++) { + fldObj = formObj.elements[i]; + if (fldObj.type == 'checkbox') { fldObj.checked = isInverse; } } } else { - for (let i = 0; i < formObj.length; i++) { - var fldObj = formObj.elements[i]; - if (fldObj.type === 'checkbox') { + for (var i = 0; i < formObj.length; i++) { + fldObj = formObj.elements[i]; + if (fldObj.type == 'checkbox') { if (fldObj.name.indexOf(fieldname) > -1) { fldObj.checked = isInverse; } @@ -20,8 +20,8 @@ function selectAll(formObj, fieldname, isInverse) { function publisherPageWrap(id, page) { - let revisedMessage; - const textareaDom = xoopsGetElementById(id); + var revisedMessage; + var textareaDom = xoopsGetElementById(id); xoopsInsertText(textareaDom, page); textareaDom.focus(); } @@ -33,12 +33,12 @@ function addSelectedItemsToParent() { // Fill the selcted item list with the items already present in parent. function fillInitialDestList() { - const destList = window.document.forms[0].destList; - const srcList = self.opener.window.document.forms[0].elements['moderators[]']; - for (let count = destList.options.length - 1; count >= 0; count--) { + var destList = window.document.forms[0].destList; + var srcList = self.opener.window.document.forms[0].elements['moderators[]']; + for (var count = destList.options.length - 1; count >= 0; count--) { destList.options[count] = null; } - for (let i = 0; i < srcList.options.length; i++) { + for (var i = 0; i < srcList.options.length; i++) { if (srcList.options[i] != null) destList.options[i] = new Option(srcList.options[i].text); } @@ -46,15 +46,15 @@ function fillInitialDestList() { // Add the selected items from the source to destination list function addSrcToDestList() { - const destList = window.document.forms[0].destList; - const srcList = window.document.forms[0].srcList; - let len = destList.length; - for (let i = 0; i < srcList.length; i++) { + destList = window.document.forms[0].destList; + srcList = window.document.forms[0].srcList; + var len = destList.length; + for (var i = 0; i < srcList.length; i++) { if ((srcList.options[i] != null) && (srcList.options[i].selected)) { //Check if this value already exist in the destList or not //if not then add it otherwise do not add it. - let found = false; - for (let count = 0; count < len; count++) { + var found = false; + for (var count = 0; count < len; count++) { if (destList.options[count] != null) { if (srcList.options[i].text == destList.options[count].text) { found = true; @@ -62,7 +62,7 @@ function addSrcToDestList() { } } } - if (found !== true) { + if (found != true) { destList.options[len] = new Option(srcList.options[i].text); len++; } @@ -72,10 +72,10 @@ function addSrcToDestList() { // Deletes from the destination list. function deleteFromDestList() { - const destList = window.document.forms[0].destList; - const len = destList.options.length; - for (let i = (len - 1); i >= 0; i--) { - if ((destList.options[i] != null) && (destList.options[i].selected === true)) { + var destList = window.document.forms[0].destList; + var len = destList.options.length; + for (var i = (len - 1); i >= 0; i--) { + if ((destList.options[i] != null) && (destList.options[i].selected == true)) { destList.options[i] = null; } } @@ -84,20 +84,20 @@ function deleteFromDestList() { function small_window(myurl, w, h) { // La ventana se llama "Add_from_Src_to_Dest" - let newWindow; - const LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0; - const TopPosition = (screen.height) ? (screen.height - h) / 2 : 0; + var newWindow; + LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0; + TopPosition = (screen.height) ? (screen.height - h) / 2 : 0; newWindow = window.open(myurl, "Add_from_Src_to_Dest", 'left=' + LeftPosition + ',top=' + TopPosition + ',width=' + w + ', height=' + h + ',scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no'); } // Adds the list of selected items selected in the child // window to its list. It is called by child window to do so. function addToParentList(sourceList) { - const destinationList = window.document.forms[0].elements['moderators[]']; - for (let count = destinationList.options.length - 1; count >= 0; count--) { + destinationList = window.document.forms[0].elements['moderators[]']; + for (var count = destinationList.options.length - 1; count >= 0; count--) { destinationList.options[count] = null; } - for (let i = 0; i < sourceList.options.length; i++) { + for (var i = 0; i < sourceList.options.length; i++) { if (sourceList.options[i] != null) destinationList.options[i] = new Option(sourceList.options[i].text, sourceList.options[i].value); } @@ -106,18 +106,18 @@ function addToParentList(sourceList) { // Marks all the items as selected for the submit button. function selectList(sourceList) { sourceList = window.document.forms[0].elements['moderators[]']; - for (let arrayElement of sourceList.options) { - if (arrayElement != null) - arrayElement.selected = true; + for (var i = 0; i < sourceList.options.length; i++) { + if (sourceList.options[i] != null) + sourceList.options[i].selected = true; } return true; } // Deletes the selected items of supplied list. function deleteSelectedItemsFromList(sourceList) { - const maxCnt = sourceList.options.length; - for (let i = maxCnt - 1; i >= 0; i--) { - if ((sourceList.options[i] != null) && (sourceList.options[i].selected === true)) { + var maxCnt = sourceList.options.length; + for (var i = maxCnt - 1; i >= 0; i--) { + if ((sourceList.options[i] != null) && (sourceList.options[i].selected == true)) { sourceList.options[i] = null; } } @@ -129,24 +129,24 @@ function goto_URL(object) { function toggle(id) { if (document.getElementById) { - var obj = document.getElementById(id); + obj = document.getElementById(id); } if (document.all) { - var obj = document.all[id]; + obj = document.all[id]; } if (document.layers) { - var obj = document.layers[id]; + obj = document.layers[id]; } if (obj) { - if (obj.style.display === "none") { + if (obj.style.display == "none") { obj.style.display = ""; } else { obj.style.display = "none"; } } - const expDays = 365; - const exp = new Date(); + var expDays = 365; + var exp = new Date(); exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000)); setCookie(window.location.pathname + "_publisher_collaps_" + obj.id, obj.style.display, exp); @@ -155,9 +155,9 @@ function toggle(id) { } var iconClose = new Image(); -iconClose.src = '../assets/images/links/close12.gif'; +iconClose.src = './assets/images/links/close12.gif'; var iconOpen = new Image(); -iconOpen.src = '../assets/images/links/open12.gif'; +iconOpen.src = './assets/images/links/open12.gif'; function toggleIcon(iconName) { if (document.images[iconName].src == window.iconOpen.src) { diff --git a/blocks/category_items_sel.php b/blocks/category_items_sel.php index 3d8867a7..c1b235d8 100644 --- a/blocks/category_items_sel.php +++ b/blocks/category_items_sel.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/date_to_date.php b/blocks/date_to_date.php index 402e86e4..ae8b773d 100644 --- a/blocks/date_to_date.php +++ b/blocks/date_to_date.php @@ -24,7 +24,7 @@ ItemHandler }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/items_columns.php b/blocks/items_columns.php index 2852642f..b89753ac 100644 --- a/blocks/items_columns.php +++ b/blocks/items_columns.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /*** * Function To Show Publisher Items From Categories In Their Own Columns diff --git a/blocks/items_menu.php b/blocks/items_menu.php index 2c95fbeb..5b42fad0 100644 --- a/blocks/items_menu.php +++ b/blocks/items_menu.php @@ -27,7 +27,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/items_new.php b/blocks/items_new.php index 29638649..4e083c79 100644 --- a/blocks/items_new.php +++ b/blocks/items_new.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/items_random_item.php b/blocks/items_random_item.php index f4a40edb..0628d7f1 100644 --- a/blocks/items_random_item.php +++ b/blocks/items_random_item.php @@ -26,14 +26,13 @@ ItemHandler }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options * * @return array * @throws \Exception - * @throws \Exception */ function publisher_items_random_item_show($options) { diff --git a/blocks/items_recent.php b/blocks/items_recent.php index 0f3fa8f6..454bf57a 100644 --- a/blocks/items_recent.php +++ b/blocks/items_recent.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/items_spot.php b/blocks/items_spot.php index d01a02d8..cd3d1c6c 100644 --- a/blocks/items_spot.php +++ b/blocks/items_spot.php @@ -28,7 +28,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/latest_files.php b/blocks/latest_files.php index f611996a..50f2f628 100644 --- a/blocks/latest_files.php +++ b/blocks/latest_files.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/latest_news.php b/blocks/latest_news.php index 939a1125..92a10b1e 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -27,7 +27,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/search.php b/blocks/search.php index 2bbc667a..36440f7f 100644 --- a/blocks/search.php +++ b/blocks/search.php @@ -24,7 +24,7 @@ Helper }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/class/Category.php b/class/Category.php index 87b617fe..08ac7bd1 100644 --- a/class/Category.php +++ b/class/Category.php @@ -22,7 +22,9 @@ * @author The SmartFactory */ -use XoopsModules\Publisher\{Form +use XoopsModules\Publisher\{Form, + Helper, + Utility }; /** @var Helper $this->helper */ @@ -42,7 +44,7 @@ class Category extends \XoopsObject * @var array */ public $categoryPath = false; - public $categoryid; + public $categoryId; public $parentid; public $name; public $description; @@ -154,7 +156,7 @@ public function getTemplate($format = 'n') /** * @param bool $withAllLink * - * @return bool|string + * @return array|bool|string */ public function getCategoryPath($withAllLink = true) { diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 3e7be619..7ce29d97 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -29,16 +29,20 @@ class Migrate extends \Xmf\Database\Migrate /** * Migrate constructor. - * @param Configurator|null $configurator + * @throws \RuntimeException + * @throws \InvalidArgumentException */ - public function __construct(Configurator $configurator = null) + public function __construct() { - if (null !== $configurator) { - $this->renameTables = $configurator->renameTables; - - $moduleDirName = \basename(\dirname(__DIR__, 2)); - parent::__construct($moduleDirName); + $class = __NAMESPACE__ . '\\' . 'Configurator'; + if (!\class_exists($class)) { + throw new \RuntimeException("Class '$class' not found"); } + $configurator = new $class(); + $this->renameTables = $configurator->renameTables; + + $moduleDirName = \basename(\dirname(__DIR__, 2)); + parent::__construct($moduleDirName); } /** diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index 3b979822..6234fe98 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -4,8 +4,6 @@ namespace XoopsModules\Publisher\Common; -use XoopsModules\Publisher\Helper; -use XoopsModules\Publisher\Constants; /** * Created by PhpStorm. * User: mamba @@ -14,6 +12,20 @@ */ trait ModuleStats { + /** + * @param \XoopsModules\Publisher\Common\Configurator $configurator + * @param array $moduleStats + * @return array + */ + public static function getModuleStats($configurator, $moduleStats) + { + if (\count($configurator->moduleStats) > 0) { + foreach (\array_keys($configurator->moduleStats) as $i) { + $moduleStats[$i] = $configurator->moduleStats[$i]; + } + } + return $moduleStats; + } } diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 0d2ddda3..4c5e6935 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -35,15 +35,10 @@ */ class SysUtility { - use VersionChecks; - - //checkVerXoops, checkVerPhp Traits - + use VersionChecks; //checkVerXoops, checkVerPhp Traits use ServerStats; // getServerStats Trait - use FilesManagement; // Files Management Trait - -// use ModuleStats; // ModuleStats Trait + use ModuleStats; // ModuleStats Trait /** * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags @@ -194,7 +189,7 @@ public static function getEditor($helper = null, $options = null) * * @return bool */ - public function fieldExists($fieldname, $table) + public static function fieldExists($fieldname, $table) { global $xoopsDB; $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); @@ -214,16 +209,52 @@ 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 - $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query("SELECT * FROM $table WHERE $id_field='$id' "), MYSQLI_ASSOC) or exit('Could not select record'); + $sql = "SELECT * FROM $table WHERE $id_field='$id' "; + $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql), \MYSQLI_ASSOC); + if (!$tempTable) { + exit($GLOBALS['xoopsDB']->error()); + } // set the auto-incremented id's value to blank. unset($tempTable[$id_field]); // insert cloned copy of the original record - $result = $GLOBALS['xoopsDB']->queryF("INSERT INTO $table (" . implode(', ', array_keys($tempTable)) . ") VALUES ('" . implode("', '", $tempTable) . "')") or exit ($GLOBALS['xoopsDB']->error()); - - if ($result) { - // Return the new id - $new_id = $GLOBALS['xoopsDB']->getInsertId(); + $sql = "INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + exit($GLOBALS['xoopsDB']->error()); } + // Return the new id + $new_id = $GLOBALS['xoopsDB']->getInsertId(); + return $new_id; } + + /** + * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * + * @param string $folder The full path of the directory to check + */ + public static function prepareFolder($folder) + { + try { + if (!@\mkdir($folder) && !\is_dir($folder)) { + throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); + } + file_put_contents($folder . '/index.html', ''); + } catch (\Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n", '
'; + } + } + + + /** + * @param string $tablename + * + * @return bool + */ + public static function tableExists($tablename) + { + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); + + return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; + } } diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 21d7f625..79f66e52 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -25,54 +25,53 @@ use Xmf\Request; use Xmf\Yaml; use XoopsModules\Publisher\Helper; - /** @var Helper $helper */ /** - * Class SysUtility + * Class TestdataButtons */ class TestdataButtons { + //functions for import buttons - /** - * @param $adminObject - */ public static function loadButtonConfig($adminObject) { - $moduleDirName = basename(dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $yamlFile = dirname(__DIR__, 2) . '/config/admin.yml'; - $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps $displaySampleButton = $config['displaySampleButton']; - $helper = Helper::getInstance(); + $helper = Helper::getInstance(); if (1 == $displaySampleButton) { - xoops_loadLanguage('admin/modulesadmin', 'system'); - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); + \xoops_loadLanguage('admin/modulesadmin', 'system'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert'); // $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add'); - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); } else { - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); // $displaySampleButton = $config['displaySampleButton']; } } public static function hideButtons() { - $yamlFile = dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 0; Yaml::save($app, $yamlFile); - redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0, ''); } public static function showButtons() { - $yamlFile = dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 1; Yaml::save($app, $yamlFile); - redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0, ''); } } + diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 12b7fb2a..64f0f2c3 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -98,18 +98,46 @@ public static function checkVerPhp(\XoopsModule $module = null) */ public static function checkVerModule($helper, $source = 'github', $default = 'master') { + + +/* + // Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/ + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, 'https://api.github.com/repos/XoopsModules25x/publisher/releases/latest'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + $result = curl_exec($ch); + if (curl_errno($ch)) { + echo 'Error:' . curl_error($ch); + } + curl_close($ch); + +*/ + + + + + + + + + + + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; - // $repository = 'XoopsModules25x/publisher'; //for testing only +// $repository = 'XoopsModules25x/' . $moduleDirName; + $repository = 'XoopsModules25x/publisher'; //for testing only $ret = ''; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { \curl_setopt($curlHandle, \CURLOPT_URL, $infoReleasesUrl); \curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true); - \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true); //TODO: how to avoid an error when 'Peer's Certificate issuer is not recognized' + \curl_setopt($curlHandle, \CURLOPT_FOLLOWLOCATION, true); +// \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true); //TODO: how to avoid an error when 'Peer's Certificate issuer is not recognized' \curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { @@ -132,8 +160,8 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm } $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); //"PHP-standardized" version - $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); - // $moduleVersion = '1.0'; //for testing only +// $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); + $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'aktuelles'; //for testing only if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { $ret = []; diff --git a/class/Form/CategoryForm.php b/class/Form/CategoryForm.php index 831958a3..93f055e6 100644 --- a/class/Form/CategoryForm.php +++ b/class/Form/CategoryForm.php @@ -29,7 +29,7 @@ Utility }; -// require_once dirname(dirname(__DIR__)) . '/include/common.php'; +// require_once \dirname(__DIR__, 2) . '/include/common.php'; \xoops_load('XoopsFormLoader'); require_once $GLOBALS['xoops']->path('class/tree.php'); @@ -72,7 +72,7 @@ public function __construct(&$target, $subCatsCount = 4) public function createElements() { - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; // Category $criteria = new \Criteria(null); $criteria->setSort('weight'); diff --git a/class/Form/FileForm.php b/class/Form/FileForm.php index f90aecb2..640563a0 100644 --- a/class/Form/FileForm.php +++ b/class/Form/FileForm.php @@ -27,7 +27,7 @@ Helper }; -// require_once dirname(dirname(__DIR__)) . '/include/common.php'; +// require_once \dirname(__DIR__, 2) . '/include/common.php'; \xoops_load('XoopsFormLoader'); //todo: move to admin? diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index e8efbca2..caebb784 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -280,14 +280,14 @@ public function createElements($obj) /** @var GroupPermHandler $grouppermHandler */ $grouppermHandler = $helper->getHandler('GroupPerm'); $moduleId = $helper->getModule()->getVar('mid'); - if ($helper->getConfig('perm_rating') && $grouppermHandler->checkRight('global', _PUBLISHER_RATE, $groups, $moduleId)) { + if ($helper->getConfig('perm_rating') && $grouppermHandler->checkRight('global', \_PUBLISHER_RATE, $groups, $moduleId)) { $options = [ - Constants::RATING_NONE => _MI_BLOG_RATING_NONE, - Constants::RATING_5STARS => _MI_BLOG_RATING_5STARS, - Constants::RATING_10STARS => _MI_BLOG_RATING_10STARS, - Constants::RATING_LIKES => _MI_BLOG_RATING_LIKES, - Constants::RATING_10NUM => _MI_BLOG_RATING_10NUM, - Constants::RATING_REACTION => _MI_BLOG_RATING_REACTION, + Constants::RATING_NONE => \_MI_BLOG_RATING_NONE, + Constants::RATING_5STARS => \_MI_BLOG_RATING_5STARS, + Constants::RATING_10STARS => \_MI_BLOG_RATING_10STARS, + Constants::RATING_LIKES => \_MI_BLOG_RATING_LIKES, + Constants::RATING_10NUM => \_MI_BLOG_RATING_10NUM, + Constants::RATING_REACTION => \_MI_BLOG_RATING_REACTION, ]; $votetypeSelect = new \XoopsFormSelect(\_MI_BLOG_RATINGBARS, 'votetype', $obj->getVar('votetype')); diff --git a/class/Helper.php b/class/Helper.php index 1acbe295..346a6b53 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -49,7 +49,7 @@ public function __construct($debug = false) * * @return \XoopsModules\Publisher\Helper */ - public static function getInstance($debug = false) + public static function getInstance(bool $debug = false): Helper { static $instance; if (null === $instance) { @@ -91,4 +91,4 @@ public function getHandler($name) return $ret; } } -//require_once dirname(dirname(__DIR__)) . '/mainfile.php'; +//require_once \dirname(__DIR__, 2) . '/mainfile.php'; diff --git a/class/Item.php b/class/Item.php index c788ba61..9155860a 100644 --- a/class/Item.php +++ b/class/Item.php @@ -838,7 +838,7 @@ public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharS // Highlighting searched words $highlight = true; if ($highlight && Request::getString('keywords', '', 'GET')) { - $keywords = \htmlspecialchars(\trim(\urldecode(Request::getString('keywords', '', 'GET'))), ENT_QUOTES | ENT_HTML5); + $keywords = \htmlspecialchars(\trim(\urldecode(Request::getString('keywords', '', 'GET'))), \ENT_QUOTES | \ENT_HTML5); $fields = ['title', 'maintext', 'summary']; foreach ($fields as $field) { if (isset($item[$field])) { @@ -1176,7 +1176,7 @@ public function assignOtherProperties() $module = $this->helper->getModule(); $module_id = $module->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ - $grouppermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = \xoops_getHandler('groupperm'); $this->category = $this->helper->getHandler('Category')->get($this->getVar('categoryid')); $this->groups_read = $grouppermHandler->getGroupIds('item_read', $this->itemid(), $module_id); diff --git a/class/MimetypesUtility.php b/class/MimetypesUtility.php index 03bcf5dc..ea9f1dcb 100644 --- a/class/MimetypesUtility.php +++ b/class/MimetypesUtility.php @@ -670,7 +670,7 @@ public static function search($icons) echo '
" - . constant('CO_' . $moduleDirNameUpper . '_' . 'TITLE') + . _AM_SYSTEM_BLOCKS_TITLE . "" . constant('CO_' . $moduleDirNameUpper . '_' . 'SIDE') . '
' @@ -103,9 +105,7 @@ function listBlocks() . '-' . _RIGHT . "
" - . constant( - 'CO_' . $moduleDirNameUpper . '_' . 'WEIGHT' - ) + . constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT') . "" . constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE') . "" @@ -122,17 +122,17 @@ function listBlocks() $blockCount = count($blockArray); $class = 'even'; $cachetimes = [ - '0' => _NOCACHE, - '30' => sprintf(_SECONDS, 30), - '60' => _MINUTE, - '300' => sprintf(_MINUTES, 5), - '1800' => sprintf(_MINUTES, 30), - '3600' => _HOUR, - '18000' => sprintf(_HOURS, 5), - '86400' => _DAY, - '259200' => sprintf(_DAYS, 3), - '604800' => _WEEK, - '2592000' => _MONTH, + 0 => _NOCACHE, + 30 => sprintf(_SECONDS, 30), + 60 => _MINUTE, + 300 => sprintf(_MINUTES, 5), + 1800 => sprintf(_MINUTES, 30), + 3600 => _HOUR, + 18000 => sprintf(_HOURS, 5), + 86400 => _DAY, + 259200 => sprintf(_DAYS, 3), + 604800 => _WEEK, + 2592000 => _MONTH, ]; foreach ($blockArray as $i) { $groupsPerms = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid')); @@ -248,13 +248,13 @@ function listBlocks() echo "
'; } Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); - // require_once dirname(__DIR__) . '/admin/admin_footer.php'; + // require_once \dirname(__DIR__) . '/admin/admin_footer.php'; \xoops_cp_footer(); } diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 59b2fbcc..971a62fd 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -24,6 +24,9 @@ * @author The SmartFactory */ +use XoopsModules\Publisher\{Helper +}; + /** @var Helper $this->helper */ //require_once \dirname(__DIR__) . '/include/common.php'; @@ -67,7 +70,7 @@ public function getGrantedGroupsById($gpermName, $id) $db = \XoopsDatabaseFactory::getDatabaseConnection(); $limit = $start = 0; $sql = 'SELECT gperm_groupid FROM ' . $db->prefix('group_permission'); - if (null !== $criteria && $criteria instanceof \CriteriaCompo) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); diff --git a/class/RatingsHandler.php b/class/RatingsHandler.php index 6c4398e9..d85feb9b 100644 --- a/class/RatingsHandler.php +++ b/class/RatingsHandler.php @@ -111,7 +111,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_source', $source)); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $itemRating['nb_ratings'] = $count; foreach ($ratingObjs as $ratingObj) { @@ -148,7 +148,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '<')); $ratingObjs = $helper->getHandler('Ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); foreach ($ratingObjs as $ratingObj) { $currentRating += $ratingObj->getVar('rate_value'); @@ -166,7 +166,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '>')); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $currentRating = 0; foreach ($ratingObjs as $ratingObj) { $currentRating += $ratingObj->getVar('rate_value'); @@ -188,7 +188,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '<')); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $itemRating['nb_ratings'] = $count; foreach ($ratingObjs as $ratingObj) { @@ -207,7 +207,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '>')); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $currentRating = 0; foreach ($ratingObjs as $ratingObj) { $currentRating += $ratingObj->getVar('rate_value'); diff --git a/class/Utility.php b/class/Utility.php index 6dbeb61a..1ab011c2 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -240,20 +240,20 @@ public static function editFile($showmenu = false, $fileid = 0, $itemId = 0) $fileObj = $helper->getHandler('File')->get($fileid); if ($fileObj->notLoaded()) { - redirect_header('', 1, _AM_PUBLISHER_NOFILESELECTED); + \redirect_header('', 1, \_AM_PUBLISHER_NOFILESELECTED); } echo "
\n"; - echo "" . _AM_PUBLISHER_FILE_EDITING . ''; - echo '' . _AM_PUBLISHER_FILE_EDITING_DSC . ''; - static::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + echo "" . \_AM_PUBLISHER_FILE_EDITING . ''; + echo '' . \_AM_PUBLISHER_FILE_EDITING_DSC . ''; + static::openCollapsableBar('editfile', 'editfileicon', \_AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item $fileObj = $helper->getHandler('File')->create(); $fileObj->setVar('itemid', $itemId); - echo "" . _AM_PUBLISHER_FILE_ADDING . ''; - echo '' . _AM_PUBLISHER_FILE_ADDING_DSC . ''; - static::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + echo "" . \_AM_PUBLISHER_FILE_ADDING . ''; + echo '' . \_AM_PUBLISHER_FILE_ADDING_DSC . ''; + static::openCollapsableBar('addfile', 'addfileicon', \_AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM @@ -872,7 +872,7 @@ public static function setCookieVar($name, $value, $time = 0) $time = \time() + 3600 * 24 * 365; } // setcookie($name, $value, $time, '/'); - setcookie($name, $value, $time, '/', ini_get('session.cookie_domain'), (bool)ini_get('session.cookie_secure'), (bool)ini_get('session.cookie_httponly')); + setcookie($name, $value, $time, '/', \ini_get('session.cookie_domain'), (bool)\ini_get('session.cookie_secure'), (bool)\ini_get('session.cookie_httponly')); } /** @@ -1423,27 +1423,27 @@ public static function convertCharset($item) /** * @return array */ - public static function getModuleStats() - { - $helper = Helper::getInstance(); - // $moduleStats = []; - // if (\count($configurator->moduleStats) > 0) { - // foreach (\array_keys($configurator->moduleStats) as $i) { - // $moduleStats[$i] = $configurator->moduleStats[$i]; - // } - // } - - $moduleStats = [ - 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), - 'totalitems' => $helper->getHandler('Item')->getItemsCount(), - 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_SUBMITTED), - 'totalpublished' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_PUBLISHED), - 'totaloffline' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_OFFLINE), - 'totalrejected' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_REJECTED), - ]; - - return $moduleStats; - } +// public static function getModuleStats() +// { +// $helper = Helper::getInstance(); +// // $moduleStats = []; +// // if (\count($configurator->moduleStats) > 0) { +// // foreach (\array_keys($configurator->moduleStats) as $i) { +// // $moduleStats[$i] = $configurator->moduleStats[$i]; +// // } +// // } +// +// $moduleStats = [ +// 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), +// 'totalitems' => $helper->getHandler('Item')->getItemsCount(), +// 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_SUBMITTED), +// 'totalpublished' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_PUBLISHED), +// 'totaloffline' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_OFFLINE), +// 'totalrejected' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_REJECTED), +// ]; +// +// return $moduleStats; +// } /** * @param $path diff --git a/class/VoteHandler.php b/class/VoteHandler.php index da417487..faa584af 100644 --- a/class/VoteHandler.php +++ b/class/VoteHandler.php @@ -89,7 +89,7 @@ public function getItemRating($itemId = null, $source = null): array $ratingbarsValue = (int)$this->helper->getConfig('ratingbars'); $ratingArray = [Constants::RATING_5STARS, Constants::RATING_10STARS, Constants::RATING_10NUM]; - if (in_array($ratingbarsValue, $ratingArray)) { + if (\in_array($ratingbarsValue, $ratingArray)) { $rating_unitwidth = 25; if (Constants::RATING_5STARS === (int)$this->helper->getConfig('ratingbars')) { $max_units = 5; @@ -254,7 +254,7 @@ public function getItemRating5($itemObj = null, $source = null): array $ratingbarsValue = $itemObj->votetype(); $ratingArray = [Constants::RATING_5STARS, Constants::RATING_10STARS, Constants::RATING_10NUM]; - if (in_array($ratingbarsValue, $ratingArray)) { + if (\in_array($ratingbarsValue, $ratingArray)) { $rating_unitwidth = 25; if (Constants::RATING_5STARS === $ratingbarsValue) { $max_units = 5; @@ -408,10 +408,6 @@ public function getItemRating5($itemObj = null, $source = null): array } - - - - /** * delete vote of given item * @param mixed $itemId @@ -426,4 +422,113 @@ public function deleteAllVote($itemId, $source): bool return $this->deleteAll($criteria); } + +//TODO + // delete all votes for an item + // delete all votes + // updates Vote counts for an item after new vote + // convert vote type to another + // TopRated + // getAggregate + + // Average, Sum, Count + // getVotingElement (FiveStarts, Reaction) + // buildForm, getStyle + // + //tableName + //behaviors + //rules + //attributeLabels + //afterSave + //getModelIdByName + //getModelNameById + //getIsAllowGuests + //getIsAllowChangeVote + //updateRating + + //getId + //getVoterId + //getVoterName + //getVoteableId + //getVotableName + //getValue + //getRange + //getMinValue + //getMaxValue + //getTime + + //VoteRepositoryInterface: + //find + //findByVoter + //findByVotable + //getCountByVotable + //getAvgByVotable + //create + //delete + + + //VotesRepositoryTest + //repo + //vote + //__construct + //testRepo + //_testCreate + //_testFindByVoter + //_testFindByVotable + //_testAvg + //_testCount + //_testDelete + //_votable + //_voter + + + //FieldVoteResultBase: + //calculateResult + //getVotesForField + // + // + //VotingApiField: + //defaultFieldSettings + //defaultStorageSettings + //fieldSettingsForm + //generateSampleValue + //isEmpty + //mainPropertyName + //postSave + //propertyDefinitions + //schema + //storageSettingsForm + // + // + //VotingApiWidgetBase: + //canVote + //getEntityForVoting + //getForm + //getInitialVotingElement + //getLabel + //getResults + //getValues + //getVoteSummary + //getWindow + + //Rating + //afterSave + //attributeLabels + //behaviors + //compressIp + //expandIp + //getIsAllowChangeVote + //getIsAllowGuests + //getModelIdByName + //getModelNameById + //rules + //tableName + //updateRating + + + + + + + } diff --git a/comment_delete.php b/comment_delete.php index b1858649..18b777d1 100644 --- a/comment_delete.php +++ b/comment_delete.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_delete.php'); diff --git a/comment_edit.php b/comment_edit.php index cf345dae..2125227f 100644 --- a/comment_edit.php +++ b/comment_edit.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_edit.php'); diff --git a/comment_new.php b/comment_new.php index 3d0318b0..25b774eb 100644 --- a/comment_new.php +++ b/comment_new.php @@ -26,7 +26,7 @@ /** @var Helper $helper */ /** @var Item $itemObj */ -require_once dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; $helper = Helper::getInstance(); diff --git a/comment_post.php b/comment_post.php index f2f90f6f..bbad8f06 100644 --- a/comment_post.php +++ b/comment_post.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_post.php'); diff --git a/comment_reply.php b/comment_reply.php index 4698867f..756e0c76 100644 --- a/comment_reply.php +++ b/comment_reply.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_reply.php'); diff --git a/config/icons.php b/config/icons.php index f0135a2e..7ac6de6b 100644 --- a/config/icons.php +++ b/config/icons.php @@ -11,7 +11,7 @@ }; $pathIcon16 = Admin::iconUrl('', 16); -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $helper->loadLanguage('admin'); diff --git a/config/paths.php b/config/paths.php index 9fbc71b3..47dd9c0b 100644 --- a/config/paths.php +++ b/config/paths.php @@ -4,7 +4,7 @@ /** @return object */ -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); // $moduleDirNameUpper = mb_strtoupper($moduleDirName); return (object)[ diff --git a/docs/changelog.txt b/docs/changelog.txt index 29aff5e4..9c588923 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,11 @@ +
1.08 Alpha 5 [2021-02-14]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 +
+- updated articles testdata with voting (mamba) +- set $icons in ItemForm (mamba) +- added votetype to Vote/Ratings classes (mamba) +- fix for integer in archive #162 (liomj/mamba) + +
1.08 Alpha 4 [2021-01-12]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1
- added votetype column in update (goffy) diff --git a/header.php b/header.php index f3df9955..a4073081 100644 --- a/header.php +++ b/header.php @@ -25,7 +25,7 @@ * {@internal $helper defined in ./include/common.php }} */ -require_once dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; $myts = \MyTextSanitizer::getInstance(); diff --git a/include/ajax_rating.php b/include/ajax_rating.php index 4ed60be9..e3b9e372 100644 --- a/include/ajax_rating.php +++ b/include/ajax_rating.php @@ -25,7 +25,7 @@ Rating }; -require_once dirname(__DIR__) . '/header.php'; +require_once \dirname(__DIR__) . '/header.php'; $helper = Helper::getInstance(); error_reporting(0); diff --git a/include/ajax_upload.php b/include/ajax_upload.php index bf3344be..20d9a792 100644 --- a/include/ajax_upload.php +++ b/include/ajax_upload.php @@ -25,7 +25,7 @@ }; error_reporting(0); -require dirname(__DIR__, 3) . '/mainfile.php'; +require \dirname(__DIR__, 3) . '/mainfile.php'; require_once __DIR__ . '/common.php'; $GLOBALS['xoopsLogger']->activated = false; diff --git a/include/common.php b/include/common.php index f7d93d0a..cd474b30 100644 --- a/include/common.php +++ b/include/common.php @@ -30,10 +30,10 @@ /** @var Helper $helper */ /** @var Utility $utility */ -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -require dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); diff --git a/include/config.php b/include/config.php index 59fcb3a2..1dfa130b 100644 --- a/include/config.php +++ b/include/config.php @@ -30,7 +30,7 @@ require __DIR__ . '/common.php'; /** @return object */ -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); diff --git a/include/oninstall.php b/include/oninstall.php index 95330ec8..7b487521 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -17,7 +17,8 @@ * @author luciorota */ -use XoopsModules\Publisher\{Common\Configurator, +use XoopsModules\Publisher\{ + Common\Configurator, Helper, Utility }; @@ -32,7 +33,7 @@ */ function xoops_module_pre_install_publisher(\XoopsModule $module) { - require dirname(__DIR__) . '/preloads/autoloader.php'; + require \dirname(__DIR__) . '/preloads/autoloader.php'; $utility = new Utility(); //check for minimum XOOPS version @@ -57,7 +58,7 @@ function xoops_module_pre_install_publisher(\XoopsModule $module) */ function xoops_module_install_publisher(\XoopsModule $module) { - require dirname(__DIR__) . '/preloads/autoloader.php'; + require \dirname(__DIR__) . '/preloads/autoloader.php'; $helper = Helper::getInstance(); $utility = new Utility(); @@ -77,7 +78,7 @@ function xoops_module_install_publisher(\XoopsModule $module) // --- COPY blank.png FILES --------------- if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $file = dirname(__DIR__) . '/assets/images/blank.png'; + $file = \dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); @@ -86,7 +87,7 @@ function xoops_module_install_publisher(\XoopsModule $module) // --- COPY test folder files --------------- if ($configurator->copyTestFolders && is_array($configurator->copyTestFolders)) { - // $file = dirname(__DIR__) . '/testdata/images/'; + // $file = \dirname(__DIR__) . '/testdata/images/'; foreach (array_keys($configurator->copyTestFolders) as $i) { $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; diff --git a/include/onupdate.php b/include/onupdate.php index 603f2b4b..97df8cba 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -53,7 +53,7 @@ function xoops_module_pre_update_publisher(\XoopsModule $module) function xoops_module_update_publisher(\XoopsModule $module, $previousVersion = null) { global $xoopsDB; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); // $moduleDirNameUpper = mb_strtoupper($moduleDirName); /** @var Helper $helper */ @@ -132,7 +132,7 @@ function xoops_module_update_publisher(\XoopsModule $module, $previousVersion = // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = dirname(__DIR__) . '/assets/images/blank.png'; + $file = \dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); diff --git a/include/search.inc.php b/include/search.inc.php index ace503fb..9f442727 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -44,12 +44,18 @@ function publisher_search($queryArray, $andor, $limit, $offset, $userid, $catego { $helper = Helper::getInstance(); $ret = $item = []; - if (is_array($queryArray) && 0 === count($queryArray)) { - $hightlightKey = ''; - } else { - $keywords = implode('+', $queryArray); - $hightlightKey = '&keywords=' . $keywords; + $hightlightKey = ''; + + if (is_array($queryArray)) { + if (0 === count($queryArray)) { + $hightlightKey = ''; + } else { + $keywords = implode('+', $queryArray); + $hightlightKey = '&keywords=' . $keywords; + } } + + $itemHandler = $helper->getHandler('Item'); $itemsObjs = $itemHandler->getItemsFromSearch($queryArray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra); $withCategoryPath = $helper->getConfig('search_cat_path'); diff --git a/language/english/common.php b/language/english/common.php index 5bd53b2e..d9e97f0f 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -116,7 +116,7 @@ //2017-11-22 -$moduleDirName = basename(dirname(__DIR__, 2)); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); @@ -135,8 +135,8 @@ define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); -\define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -\define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); +define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); +define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); @@ -167,20 +167,23 @@ define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); //Sample Data -define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date imported successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_ERROR', 'ERROR: Export of Tables to YAML failed'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); -define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); -define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS', 'Sample Date imported successfully'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA', 'Clear Sample Data'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK', 'The Sample Data has been cleared'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_CONFIRM', 'Are you sure to Clear Sample Data? (It will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); +\define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); +\define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); //letter choice define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); diff --git a/language/english/feedback.php b/language/english/feedback.php index db3e23bf..4fb55548 100644 --- a/language/english/feedback.php +++ b/language/english/feedback.php @@ -20,7 +20,7 @@ * @min_xoops 2.5.9 * @author XOOPS - Website: */ -$moduleDirName = basename(dirname(__DIR__, 2)); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); diff --git a/notification_update.php b/notification_update.php index 0a7fd91c..e69a1ca3 100644 --- a/notification_update.php +++ b/notification_update.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require_once dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/notification_update.php'); diff --git a/preloads/autoloader.php b/preloads/autoloader.php index 57165284..819b8052 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -11,7 +11,7 @@ static function ($class) { $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); // base directory for the namespace prefix - $baseDir = dirname(__DIR__) . '/class/'; + $baseDir = \dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? $len = mb_strlen($prefix); diff --git a/sql/mysql.sql b/sql/mysql.sql index 31661e26..39bbdb7d 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -73,6 +73,7 @@ CREATE TABLE `publisher_items` ( `short_url` VARCHAR(255) NULL, `item_tag` TEXT NULL, `votetype` TINYINT(1) NOT NULL DEFAULT '0', + `votevalue` TEXT NULL, PRIMARY KEY (`itemid`), KEY categoryid (categoryid), KEY status (status) diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl index 990b4022..d76b6ec2 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl @@ -82,7 +82,11 @@
<{$item.subtitle}>
<{/if}> + + + <{$item.maintext}> +
diff --git a/testdata/index.php b/testdata/index.php index 5f529d64..4ec2fdb9 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -17,21 +17,22 @@ */ use Xmf\Database\TableLoad; -use \Xmf\Request; +use Xmf\Request; +use Xmf\Yaml; use XoopsModules\Publisher\{Helper, - Common, + Common\Configurator, Utility }; -use Xmf\Yaml; - /** @var Helper $helper */ +/** @var Utility $utility */ +/** @var Configurator $configurator */ -require_once dirname(__DIR__, 3) . '/include/cp_header.php'; -require dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__, 3) . '/include/cp_header.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; $op = Request::getCmd('op', ''); -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); @@ -47,13 +48,16 @@ loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); xoops_cp_footer(); } break; case 'save': saveSampleData(); break; + case 'clear': + clearSampleData(); + break; } // XMF TableLoad for SAMPLE data @@ -61,12 +65,11 @@ function loadSampleData() { global $xoopsConfig; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $utility = new Utility(); - $configurator = new Common\Configurator(); - $helper = Helper::getInstance(); + $configurator = new Configurator(); $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); @@ -85,30 +88,28 @@ function loadSampleData() // load permissions $table = 'group_permission'; $tabledata = Yaml::readWrapped($language . $table . '.yml'); - $moduleId = $helper->getModule()->getVar('mid'); - loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $moduleId); + $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); + loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); // --- COPY test folder files --------------- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { - // $file = dirname(__DIR__) . '/testdata/images/'; + // $file = \dirname(__DIR__) . '/testdata/images/'; foreach (array_keys($configurator->copyTestFolders) as $i) { $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; $utility::rcopy($src, $dest); } } - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); } function saveSampleData() { global $xoopsConfig; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); - $moduleId = $helper->getModule()->getVar('mid'); - - $tables = $helper->getModule()->getInfo('tables'); + $tables = $helper->getModule()->getInfo('tables'); $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; if (!file_exists($languageFolder . '/')) { @@ -124,7 +125,7 @@ function saveSampleData() // save permissions $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('gperm_modid', $moduleId)); + $criteria->add(new \Criteria('gperm_modid', $helper->getModule()->getVar('mid'))); $skipColumns[] = 'gperm_id'; TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); unset($criteria); @@ -134,7 +135,7 @@ function saveSampleData() function exportSchema() { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); try { @@ -202,3 +203,17 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) return $count; } + +function clearSampleData(){ + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $helper = Helper::getInstance(); + // Load language files + $helper->loadLanguage('common'); + $tables = $helper->getModule()->getInfo('tables'); + // truncate module tables + foreach ($tables as $table) { + \Xmf\Database\TableLoad::truncateTable($table); + } + redirect_header($helper->url('admin/index.php'), 1, constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK')); +} diff --git a/xoops_version.php b/xoops_version.php index e7d1290f..43176c08 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -36,8 +36,8 @@ $modversion = [ 'version' => '1.08', - 'module_status' => 'Alpha 4', - 'release_date' => '2021/01/12', + 'module_status' => 'Alpha 5', + 'release_date' => '2021/02/14', 'name' => _MI_PUBLISHER_MD_NAME, 'description' => _MI_PUBLISHER_MD_DESC, 'author' => 'Trabis (www.Xuups.com)', @@ -62,7 +62,7 @@ 'onInstall' => 'include/oninstall.php', 'onUpdate' => 'include/onupdate.php', // ------------------- Min Requirements ------------------- - 'min_php' => '7.2', + 'min_php' => '7.3', 'min_xoops' => '2.5.10', 'min_admin' => '1.2', 'min_db' => ['mysql' => '5.5'], From 2b3f9f1017074a03e55acc5227ceff55f1bfb513 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 8 Aug 2021 14:28:34 -0400 Subject: [PATCH 14/26] delete blocksadmin.php --- language/english/blocksadmin.php | 43 -------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 language/english/blocksadmin.php diff --git a/language/english/blocksadmin.php b/language/english/blocksadmin.php deleted file mode 100644 index 309cb87a..00000000 --- a/language/english/blocksadmin.php +++ /dev/null @@ -1,43 +0,0 @@ - Date: Sun, 8 Aug 2021 14:33:19 -0400 Subject: [PATCH 15/26] changelog.txt --- docs/changelog.txt | 8 +++++++- xoops_version.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 95d3f0c2..a1d29264 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,9 +1,15 @@ -
1.08 Alpha 5 [2021-02-14]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 +
1.08 Alpha 5 [NOT RELEASED]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1
- updated articles testdata with voting (mamba) - set $icons in ItemForm (mamba) - added votetype to Vote/Ratings classes (mamba) - fix for integer in archive #162 (liomj/mamba) +- Smarty defaults (goffy) +- replace index.html with index.php (mamba) +- add renameColumns, moduleStats to Configurator (mamba) +- logoXoopsPhp8 (mamba) +- Yoda, cosmetics, Unqualified function/constant reference, type hints (mamba) +- delete blocksadmin.php (mamba)
1.08 Alpha 4 [2021-01-12]
Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 diff --git a/xoops_version.php b/xoops_version.php index 43176c08..6ef5d797 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -37,7 +37,7 @@ $modversion = [ 'version' => '1.08', 'module_status' => 'Alpha 5', - 'release_date' => '2021/02/14', + 'release_date' => '2021/08/08', 'name' => _MI_PUBLISHER_MD_NAME, 'description' => _MI_PUBLISHER_MD_DESC, 'author' => 'Trabis (www.Xuups.com)', From 3c3753128819a2c9790fe0883acd81727e8e6141 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Sun, 8 Aug 2021 14:35:16 -0400 Subject: [PATCH 16/26] Delete class/versioncontrol0 directory --- class/versioncontrol0/index.php | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 class/versioncontrol0/index.php diff --git a/class/versioncontrol0/index.php b/class/versioncontrol0/index.php deleted file mode 100644 index 4ae18fd0..00000000 --- a/class/versioncontrol0/index.php +++ /dev/null @@ -1,2 +0,0 @@ - Date: Sun, 8 Aug 2021 14:35:25 -0400 Subject: [PATCH 17/26] Delete class/Versioncontrol directory --- class/Versioncontrol/index.php | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 class/Versioncontrol/index.php diff --git a/class/Versioncontrol/index.php b/class/Versioncontrol/index.php deleted file mode 100644 index 4ae18fd0..00000000 --- a/class/Versioncontrol/index.php +++ /dev/null @@ -1,2 +0,0 @@ - Date: Sun, 8 Aug 2021 14:35:33 -0400 Subject: [PATCH 18/26] Delete class/versioncontrol - Copy2006 directory --- class/versioncontrol - Copy2006/index.php | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 class/versioncontrol - Copy2006/index.php diff --git a/class/versioncontrol - Copy2006/index.php b/class/versioncontrol - Copy2006/index.php deleted file mode 100644 index 4ae18fd0..00000000 --- a/class/versioncontrol - Copy2006/index.php +++ /dev/null @@ -1,2 +0,0 @@ - Date: Sun, 8 Aug 2021 23:40:14 -0400 Subject: [PATCH 19/26] cosmetics --- class/ThemeTabForm.php | 2 +- include/plugin.tag.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/ThemeTabForm.php b/class/ThemeTabForm.php index ad9a2e2c..af3c78e1 100644 --- a/class/ThemeTabForm.php +++ b/class/ThemeTabForm.php @@ -144,7 +144,7 @@ public function assign(\XoopsTpl $tpl) $elements[$n]['name'] = $eleName; $elements[$n]['caption'] = $ele->getCaption(); $elements[$n]['body'] = $ele->render(); - $elements[$n]['hidden'] = $ele->isHidden() ? true : false; + $elements[$n]['hidden'] = (bool)$ele->isHidden(); $elements[$n]['required'] = $ele->isRequired(); if ('' != $eleDescription) { $elements[$n]['description'] = $eleDescription; diff --git a/include/plugin.tag.php b/include/plugin.tag.php index 8ae0e634..241ead8c 100644 --- a/include/plugin.tag.php +++ b/include/plugin.tag.php @@ -115,5 +115,5 @@ function publisher_tag_synchronization($mid) . ' )'; $result = $linkHandler->db->queryF($sql); - return $result ? true : false; + return (bool)$result; } From 223e412ddd5dd555a0e17dce91e7b22b06836a62 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 16 Aug 2021 01:06:05 -0400 Subject: [PATCH 20/26] fix for blocks, change $icons to arrays --- admin/blocksadmin.php | 12 +++++------- admin/item.php | 22 +++++++++++----------- admin/main.php | 26 +++++++++++++------------- blocks/latest_news.php | 10 +++++----- class/Common/ServerStats.php | 2 +- class/Form/ItemForm.php | 4 ++-- class/Item.php | 10 +++++----- class/MimetypesUtility.php | 16 ++++++++-------- class/Utility.php | 12 ++++++------ config/icons.php | 2 +- 10 files changed, 57 insertions(+), 59 deletions(-) diff --git a/admin/blocksadmin.php b/admin/blocksadmin.php index 1e6b21f1..5d5d27b4 100644 --- a/admin/blocksadmin.php +++ b/admin/blocksadmin.php @@ -23,9 +23,7 @@ }; require __DIR__ . '/admin_header.php'; -//include_once $GLOBALS['xoops']->path('class/xoopsblock.php'); - require_once XOOPS_ROOT_PATH . '/kernel/block.php'; - +include_once $GLOBALS['xoops']->path('class/xoopsblock.php'); $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); @@ -34,7 +32,7 @@ exit(constant('CO_' . $moduleDirNameUpper . '_' . 'ERROR403')); } if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { -// require_once XOOPS_ROOT_PATH . '/kernel/block.php'; + require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; $op = 'list'; if (isset($_POST)) { foreach ($_POST as $k => $v) { @@ -60,7 +58,7 @@ function listBlocks() global $xoopsModule, $pathIcon16; // require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; xoops_load('xoopslist'); - //require_once XOOPS_ROOT_PATH . '/kernel/block.php'; + //require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); /** @var \XoopsMySQLDatabase $db */ @@ -264,10 +262,10 @@ function listBlocks() // Actions - echo "" . $icons->edit . " " . _CLONE . " + echo "" . $icons['edit'] . " " . _CLONE . " "; if (!in_array($i->getVar('block_type'), ['S', 'M'])) { - echo " getVar('bid') . "'>" . $icons->delete . ''; + echo " getVar('bid') . "'>" . $icons['delete'] . ''; } echo " diff --git a/admin/item.php b/admin/item.php index 88be24f9..89207e0f 100644 --- a/admin/item.php +++ b/admin/item.php @@ -193,9 +193,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $approve = "" . $icons->moderate . ' '; + $approve = "" . $icons['moderate'] . ' '; $clone = ''; - $delete = "" . $icons->delete . ''; + $delete = "" . $icons['delete'] . ''; $modify = ''; echo ''; @@ -247,9 +247,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; - $clone = "" . $icons->clone . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; + $clone = "" . $icons['clone'] . ''; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; @@ -301,9 +301,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; - $clone = "" . $icons->clone . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; + $clone = "" . $icons['clone'] . ''; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; @@ -354,9 +354,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; - $clone = "" . $icons->clone . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; + $clone = "" . $icons['clone'] . ''; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; diff --git a/admin/main.php b/admin/main.php index cd1183e9..2b8bb5c0 100644 --- a/admin/main.php +++ b/admin/main.php @@ -245,40 +245,40 @@ switch ($itemsObj[$i]->status()) { case Constants::PUBLISHER_STATUS_SUBMITTED: $statustxt = _CO_PUBLISHER_SUBMITTED; - $approve = "" . $icons->moderate . ' '; + $approve = "" . $icons['moderate'] . ' '; $clone = ''; - $delete = "" . $icons->delete . ''; + $delete = "" . $icons['delete'] . ''; $modify = ''; break; case Constants::PUBLISHER_STATUS_PUBLISHED: $statustxt = _CO_PUBLISHER_PUBLISHED; $approve = ''; - $modify = "" . $icons->edit . ' '; - $delete = "" . $icons->delete . ' '; - $clone = "" . $icons->clone . ' '; + $modify = "" . $icons['edit'] . ' '; + $delete = "" . $icons['delete'] . ' '; + $clone = "" . $icons['clone'] . ' '; break; case Constants::PUBLISHER_STATUS_OFFLINE: $statustxt = _CO_PUBLISHER_OFFLINE; $approve = ''; - $modify = "" . $icons->edit . ' '; - $delete = "" . $icons->delete . ' '; + $modify = "" . $icons['edit'] . ' '; + $delete = "" . $icons['delete'] . ' '; $clone = /** @lang text */ - "" . $icons->clone . ' '; + "" . $icons['clone'] . ' '; break; case Constants::PUBLISHER_STATUS_REJECTED: $statustxt = _CO_PUBLISHER_REJECTED; $approve = ''; - $modify = "" . $icons->rejectededit . ' '; - $delete = "" . $icons->delete . ' '; - $clone = "" . $icons->clone . ' '; + $modify = "" . $icons['rejectededit'] . ' '; + $delete = "" . $icons['delete'] . ' '; + $clone = "" . $icons['clone'] . ' '; break; case 'default': default: $statustxt = _AM_PUBLISHER_STATUS0; $approve = ''; $clone = ''; - $modify = "" . $icons->rejectededit . ' '; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['rejectededit'] . ' '; + $delete = "" . $icons['delete'] . ''; break; } diff --git a/blocks/latest_news.php b/blocks/latest_news.php index 92a10b1e..a5f8f19a 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -158,8 +158,8 @@ function publisher_latest_news_show($options) } if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin(-1)) { - $item['admin'] = "edit . ' '; - $item['admin'] .= "itemid() . "'>" . $icons->delete . ''; + $item['admin'] = " '; + $item['admin'] .= "itemid() . "'>" . $icons['delete'] . ''; } else { $item['admin'] = ''; } @@ -223,19 +223,19 @@ function publisher_latest_news_show($options) $item['print'] = ''; if (1 == $options[24]) { - $item['print'] = '" . $icons->print . " '; + $item['print'] = '" . $icons['print'] . " '; } $item['pdf'] = ''; if (1 == $options[25]) { - $item['pdf'] = "" . $icons->pdf . ' '; + $item['pdf'] = "" . $icons['pdf'] . ' '; } $item['email'] = ''; if (1 == $options[26]) { $maillink = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl(); - $item['email'] = '' . $icons->mail . ' '; + $item['email'] = '' . $icons['mail'] . ' '; } $block['morelink'] = ''; diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 27069e2d..2b79cc26 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -54,7 +54,7 @@ public static function getServerStats() $gdlib = \function_exists('gd_info') ? '' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (\function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { + if (true == ($gdlib = gd_info())) { $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index 05fdf6ce..2ac0bf3e 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -618,8 +618,8 @@ public function createElements($obj) $table .= ''; foreach ($filesObj as $fileObj) { - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; $not_visible = ''; if (0 == $fileObj->status()) { $not_visible = ""; diff --git a/class/Item.php b/class/Item.php index 9155860a..94ac5454 100644 --- a/class/Item.php +++ b/class/Item.php @@ -473,18 +473,18 @@ public function getAdminLinks($icons) if (Utility::userIsAdmin() || Utility::userIsAuthor($this) || Utility::userIsModerator($this)) { if ($this->helper->getConfig('perm_edit') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Edit button - $adminLinks .= "" . $icons->edit . ''; + $adminLinks .= "" . $icons['edit'] . ''; $adminLinks .= ' '; } if ($this->helper->getConfig('perm_delete') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Delete button - $adminLinks .= "itemid() . "'>" . $icons->delete . ''; + $adminLinks .= "itemid() . "'>" . $icons['delete'] . ''; $adminLinks .= ' '; } } if ($this->helper->getConfig('perm_clone') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Duplicate button - $adminLinks .= "itemid() . "'>" . $icons->clone . ''; + $adminLinks .= "itemid() . "'>" . $icons['clone'] . ''; $adminLinks .= ' '; } } @@ -501,7 +501,7 @@ public function getPdfButton($icons) $pdfButton = ''; // PDF button if (\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { - $pdfButton .= "" . $icons->pdf . ' '; + $pdfButton .= "" . $icons['pdf'] . ' '; $pdfButton .= ' '; } else { // if (is_object($GLOBALS['xoopsUser']) && Utility::userIsAdmin()) { @@ -527,7 +527,7 @@ public function getPrintLinks($icons) { $printLinks = ''; // Print button - $printLinks .= "itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . $icons->print . ' '; + $printLinks .= "itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . $icons['print'] . ' '; $printLinks .= ' '; return $printLinks; diff --git a/class/MimetypesUtility.php b/class/MimetypesUtility.php index ea9f1dcb..5eb8733a 100644 --- a/class/MimetypesUtility.php +++ b/class/MimetypesUtility.php @@ -459,15 +459,15 @@ public static function manage($icons) " . $mime->getVar('mime_ext') . " getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_admin') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_admin') ? $icons['online'] : $icons['offline']) . " getVar('mime_id') . '&mime_user=' . $mime->getVar('mime_user') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_user') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_user') ? $icons['online'] : $icons['offline']) . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->edit . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->delete . ' + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['edit'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['delete'] . ' '; } @@ -613,15 +613,15 @@ public static function search($icons) " . $mime->getVar('mime_ext') . " getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_admin') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_admin') ? $icons['online'] : $icons['offline']) . " getVar('mime_id') . '&mime_user=' . $mime->getVar('mime_user') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_user') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_user') ? $icons['online'] : $icons['offline']) . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->edit . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->delete . ' + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['edit'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['delete'] . ' '; } diff --git a/class/Utility.php b/class/Utility.php index 1ab011c2..1c601a89 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -182,8 +182,8 @@ public static function displayCategory(Category $categoryObj, $level = 0) $description = \mb_substr($description, 0, 100 - 1) . '...'; } } - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; $spaces = \str_repeat(' ', ($level * 3)); /* $spaces = ''; @@ -326,8 +326,8 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa echo ''; if ($totalsubs > 0) { foreach ($subcatsObj as $subcat) { - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; echo ''; echo "" . $subcat->categoryid() . ''; echo "getModule()->dirname() . '/category.php?categoryid=' . $subcat->categoryid() . '&parentid=' . $subcat->parentid() . "'>" . $subcat->name() . ''; @@ -363,8 +363,8 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa if ($totalitems > 0) { foreach ($itemsObj as $iValue) { $categoryObj = $allcats[$iValue->categoryid()]; - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; echo ''; echo "" . $iValue->itemid() . ''; echo "" . $categoryObj->name() . ''; diff --git a/config/icons.php b/config/icons.php index 7ac6de6b..7c7b0a17 100644 --- a/config/icons.php +++ b/config/icons.php @@ -21,7 +21,7 @@ $print = constant('_CO_' . $moduleDirNameUpper . '_' . 'PRINT'); $pdf = constant('_CO_' . $moduleDirNameUpper . '_' . 'PDF'); -return (object)[ +return [ 'edit' => Utility::iconSourceTag($pathIcon16, 'edit.png', _EDIT), 'delete' => Utility::iconSourceTag($pathIcon16, 'delete.png', _DELETE), 'clone' => Utility::iconSourceTag($pathIcon16, 'editcopy.png', _CLONE), From 6270ae1c1dc19222bfd1f17087151a4549c01a0d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 28 Aug 2021 20:25:20 -0400 Subject: [PATCH 21/26] PHP8 Smarty defaults --- templates/publisher_footer.tpl | 2 +- templates/publisher_header.tpl | 2 +- templates/publisher_rss.tpl | 2 +- templates/publisher_submit.tpl | 2 +- .../bootstrap3/publisher/publisher_header.tpl | 2 +- .../publisher/publisher_item(title_bottom).tpl | 2 +- .../bootstrap3/publisher/publisher_item.tpl | 2 +- .../bootstrap4/publisher/publisher_footer.tpl | 10 +++++++--- .../bootstrap4/publisher/publisher_header.tpl | 2 +- .../bootstrap4/publisher/publisher_item.tpl | 2 +- 10 files changed, 16 insertions(+), 12 deletions(-) diff --git a/templates/publisher_footer.tpl b/templates/publisher_footer.tpl index 6c4c3ef7..fa91e3e1 100644 --- a/templates/publisher_footer.tpl +++ b/templates/publisher_footer.tpl @@ -27,7 +27,7 @@ <{/if}> -<{if $rssfeed_link|default:false != ""}> +<{if $rssfeed_link|default:'' != ''}>
    <{$rssfeed_link|default:false}>
    <{/if}> diff --git a/templates/publisher_header.tpl b/templates/publisher_header.tpl index b97d02c5..caeeb3e0 100644 --- a/templates/publisher_header.tpl +++ b/templates/publisher_header.tpl @@ -53,6 +53,6 @@ <{/if}> <{/if}> -<{if $title_and_welcome|default:false && $lang_mainintro != ""}> +<{if $title_and_welcome|default:false && $lang_mainintro|default:'' != ''}> <{$lang_mainintro}> <{/if}> diff --git a/templates/publisher_rss.tpl b/templates/publisher_rss.tpl index 8a0f4aa0..0b168908 100644 --- a/templates/publisher_rss.tpl +++ b/templates/publisher_rss.tpl @@ -11,7 +11,7 @@ <{$channel_editor}> <{$channel_webmaster}> <{$channel_language}> - <{if $image_url != ""}> + <{if $image_url|default:'' != ''}> <{$channel_title}> <{$image_url}> diff --git a/templates/publisher_submit.tpl b/templates/publisher_submit.tpl index 90f48dea..2d104eb9 100644 --- a/templates/publisher_submit.tpl +++ b/templates/publisher_submit.tpl @@ -25,7 +25,7 @@ <{if !$element.hidden|default:false}> - <{if $element.caption|default:false != ''}> + <{if $element.caption|default:false|default:'' != ''}>
    <{$element.caption}> <{if $element.required}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_header.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_header.tpl index 34f5dc8a..2c20f878 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_header.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_header.tpl @@ -10,7 +10,7 @@ <{/if}> <{/if}> -<{if $title_and_welcome && $lang_mainintro != ""}> +<{if $title_and_welcome && $lang_mainintro|default:'' != ''}>
    <{$lang_mainintro}>
    diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl index 5f83a6ec..d5626e94 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl @@ -150,7 +150,7 @@ alt="<{$smarty.const._CO_PUBLISHER_DELETEFILE}>"> <{/if}> - <{$smarty.const._MD_PUBLISHER_DOWNLOAD_FILE}> <{$file.name}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl index f03c7e70..5ee5e778 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl @@ -147,7 +147,7 @@ alt="<{$smarty.const._CO_PUBLISHER_DELETEFILE}>"> <{/if}> - <{$smarty.const._MD_PUBLISHER_DOWNLOAD_FILE}> <{$file.name}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_footer.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_footer.tpl index e8b2d1a4..f425478c 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_footer.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_footer.tpl @@ -7,14 +7,18 @@
    <{$commentsnav}> <{$lang_notice}>
    - <{if $comment_mode == "flat"}> <{include file="db:system_comments_flat.tpl"}> <{elseif $comment_mode == "thread"}> <{include file="db:system_comments_thread.tpl"}> <{elseif $comment_mode == "nest"}> <{include file="db:system_comments_nest.tpl"}> <{/if}> + <{if $comment_mode|default:'' == "flat"}> + <{include file="db:system_comments_flat.tpl"}> + <{elseif $comment_mode|default:'' == "thread"}> + <{include file="db:system_comments_thread.tpl"}> + <{elseif $comment_mode|default:'' == "nest"}><{include file="db:system_comments_nest.tpl"}> <{/if}>
    <{/if}> -<{if $rssfeed_link|default:false != ""}> -
    <{$rssfeed_link|default:false}>
    <{/if}> +<{if $rssfeed_link|default:'' != ''}> +
    <{$rssfeed_link|default:''}>
    <{/if}> <{include file='db:system_notification_select.tpl'}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl index 848e3b9b..7601d1ee 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl @@ -15,7 +15,7 @@ <{/if}> <{/if}> -<{if $title_and_welcome|default:false && $lang_mainintro != ""}> +<{if $title_and_welcome|default:false && $lang_mainintro|default:'' != ''}>
    <{$lang_mainintro}>
    diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl index 5b2a68c1..d1f8d0b1 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl @@ -139,7 +139,7 @@ alt="<{$smarty.const._CO_PUBLISHER_DELETEFILE}>"> <{/if}> - <{$smarty.const._MD_PUBLISHER_DOWNLOAD_FILE}> <{$file.name}> From c1019b7ad1c12a9ba4d3a24604be3e02aebba163 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 28 Aug 2021 20:25:57 -0400 Subject: [PATCH 22/26] icons size --- admin/admin_footer.php | 2 +- admin/admin_header.php | 4 ++-- config/icons.php | 2 +- include/common.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/admin/admin_footer.php b/admin/admin_footer.php index b060a982..acd28a70 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -20,7 +20,7 @@ use Xmf\Module\Admin; -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon32 = Admin::iconUrl('', '32'); echo "
    \n" . "
    \n" . " XOOPS\n" . "
    \n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '
    '; diff --git a/admin/admin_header.php b/admin/admin_header.php index e00eb7f4..7ab6b6b0 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -36,8 +36,8 @@ /** @var Admin $adminObject */ $adminObject = Admin::getInstance(); -$pathIcon16 = Admin::iconUrl('', 16); -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); $pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); diff --git a/config/icons.php b/config/icons.php index 7c7b0a17..d45b6122 100644 --- a/config/icons.php +++ b/config/icons.php @@ -10,7 +10,7 @@ Utility }; -$pathIcon16 = Admin::iconUrl('', 16); +$pathIcon16 = Admin::iconUrl('', '16'); $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); diff --git a/include/common.php b/include/common.php index cd474b30..0ce08d53 100644 --- a/include/common.php +++ b/include/common.php @@ -108,8 +108,8 @@ $publisherCurrentPage = Utility::getCurrentPage(); } -$pathIcon16 = Admin::iconUrl('', 16); -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); //$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); //$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); From fea27b069bee11524d7f3fd73ee12047b8351e99 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 28 Aug 2021 20:27:41 -0400 Subject: [PATCH 23/26] revert for blocks in 2.5.10 --- admin/blocksadmin.php | 61 +++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/admin/blocksadmin.php b/admin/blocksadmin.php index 5d5d27b4..a0b25266 100644 --- a/admin/blocksadmin.php +++ b/admin/blocksadmin.php @@ -72,7 +72,7 @@ function listBlocks() xoops_loadLanguage('admin/groups', 'system'); $configurator = new Configurator(); - $icons = $configurator->icons; + $icons = $configurator->icons; /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); @@ -120,16 +120,16 @@ function listBlocks() $blockCount = count($blockArray); $class = 'even'; $cachetimes = [ - 0 => _NOCACHE, - 30 => sprintf(_SECONDS, 30), - 60 => _MINUTE, - 300 => sprintf(_MINUTES, 5), - 1800 => sprintf(_MINUTES, 30), - 3600 => _HOUR, - 18000 => sprintf(_HOURS, 5), - 86400 => _DAY, - 259200 => sprintf(_DAYS, 3), - 604800 => _WEEK, + 0 => _NOCACHE, + 30 => sprintf(_SECONDS, 30), + 60 => _MINUTE, + 300 => sprintf(_MINUTES, 5), + 1800 => sprintf(_MINUTES, 30), + 3600 => _HOUR, + 18000 => sprintf(_HOURS, 5), + 86400 => _DAY, + 259200 => sprintf(_DAYS, 3), + 604800 => _WEEK, 2592000 => _MONTH, ]; foreach ($blockArray as $i) { @@ -293,7 +293,6 @@ function listBlocks() */ function cloneBlock($bid) { - xoops_cp_header(); $adminObject = Admin::getInstance(); @@ -313,7 +312,7 @@ function cloneBlock($bid) while (false !== ($row = $db->fetchArray($result))) { $modules[] = (int)$row['module_id']; } - $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); + $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); $block = [ 'title' => $myblock->getVar('title') . ' Clone', 'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'), @@ -358,8 +357,8 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $block = new \XoopsBlock($bid); - $clone = $block->xoopsClone(); + $block = new \XoopsBlock($bid); + $clone = $block->xoopsClone(); if (empty($bmodule)) { xoops_cp_header(); xoops_error(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'NOTSELNG'), constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'))); @@ -430,10 +429,10 @@ function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule $myblock->setVar('visible', $visible); $myblock->setVar('side', $side); $myblock->setVar('bcachetime', $bcachetime); - // $myblock->store(); - /** @var \XoopsBlockHandler $blockHandler */ - $blockHandler = xoops_getHandler('block'); - return $blockHandler->insert($myblock); + $myblock->store(); + // /** @var \XoopsBlockHandler $blockHandler */ + // $blockHandler = xoops_getHandler('block'); + // return $blockHandler->insert($myblock); } /** @@ -460,7 +459,7 @@ function editBlock($bid) while (false !== ($row = $db->fetchArray($result))) { $modules[] = (int)$row['module_id']; } - $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); + $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); $block = [ 'title' => $myblock->getVar('title'), 'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK'), @@ -514,19 +513,19 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b $helper->loadLanguage('common'); //update block options if (is_array($options) && count($options) > 0) { - //Convert array values to comma-separated - foreach ($options as $i => $iValue) { - if (is_array($iValue)) { - $options[$i] = implode(',', $iValue); - } + //Convert array values to comma-separated + foreach ($options as $i => $iValue) { + if (is_array($iValue)) { + $options[$i] = implode(',', $iValue); } - $options = implode('|', $options); - $myblock->setVar('options', $options); } - // $myblock->store(); - /** @var \XoopsBlockHandler $blockHandler */ - $blockHandler = xoops_getHandler('block'); - $blockHandler->insert($myblock); + $options = implode('|', $options); + $myblock->setVar('options', $options); + } + $myblock->store(); + // /** @var \XoopsBlockHandler $blockHandler */ + // $blockHandler = xoops_getHandler('block'); + // $blockHandler->insert($myblock); global $xoopsDB; From de3f4c63276d21310b80dbc63421b24ba021b06c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 28 Aug 2021 21:21:47 -0400 Subject: [PATCH 24/26] Scrutinizer --- admin/blockform.php | 2 ++ admin/category.php | 16 ++++----- admin/import/fmcontent.php | 28 +++++++-------- admin/migrate.php | 2 +- backend.php | 10 +++--- blocks/items_columns.php | 6 ++-- blocks/items_menu.php | 8 ++--- blocks/items_new.php | 4 +-- blocks/latest_news.php | 11 ++++-- category.php | 16 ++++----- class/Category.php | 7 ++-- class/Common/ModuleStats.php | 3 +- class/Common/SysUtility.php | 2 +- class/Common/VersionChecks.php | 16 ++------- class/Item.php | 6 ++-- class/ItemHandler.php | 62 ++++++++++++++++---------------- class/PermissionHandler.php | 3 -- class/Utility.php | 24 ++++++------- item.php | 3 +- language/english/blocksadmin.php | 43 ++++++++++++++++++++++ 20 files changed, 154 insertions(+), 118 deletions(-) create mode 100644 language/english/blocksadmin.php diff --git a/admin/blockform.php b/admin/blockform.php index deb67043..2f3fdfc9 100644 --- a/admin/blockform.php +++ b/admin/blockform.php @@ -28,6 +28,8 @@ $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); +$helper->loadLanguage('blocksadmin'); + $form = new \XoopsThemeForm($block['form_title'], 'blockform', 'blocksadmin.php', 'post', true); if (isset($block['name'])) { $form->addElement(new \XoopsFormLabel(_AM_SYSTEM_BLOCKS_NAME, $block['name'])); diff --git a/admin/category.php b/admin/category.php index fcb4e24b..2a4229b3 100644 --- a/admin/category.php +++ b/admin/category.php @@ -35,11 +35,11 @@ // Where do we start ? $startcategory = Request::getInt('startcategory', 0, 'GET'); -$categoryId = Request::getInt('categoryid', null); +$categoryid = Request::getInt('categoryid', null); switch ($op) { case 'del': - $categoryObj = $helper->getHandler('Category')->get($categoryId); + $categoryObj = $helper->getHandler('Category')->get($categoryid); $confirm = Request::getString('confirm', '', 'POST'); $name = Request::getString('name', '', 'POST'); if ($confirm) { @@ -60,14 +60,14 @@ //end of fx2024 code Utility::cpHeader(); - Utility::editCategory(true, $categoryId, $numberSubcats); + Utility::editCategory(true, $categoryid, $numberSubcats); break; case 'addcategory': global $modify; $parentid = Request::getInt('parentid'); - if (0 != $categoryId) { - $categoryObj = $helper->getHandler('Category')->get($categoryId); + if (0 != $categoryid) { + $categoryObj = $helper->getHandler('Category')->get($categoryid); } else { $categoryObj = $helper->getHandler('Category')->create(); } @@ -164,7 +164,7 @@ //Added by fx2024 case 'addsubcats': - $categoryId = 0; + $categoryid = 0; $numberSubcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST'); $categoryObj = $helper->getHandler('Category')->create(); @@ -176,7 +176,7 @@ } Utility::cpHeader(); - Utility::editCategory(true, $categoryId, $numberSubcats, $categoryObj); + Utility::editCategory(true, $categoryid, $numberSubcats, $categoryObj); exit(); //end of fx2024 code @@ -216,7 +216,7 @@ echo ''; echo "" . _AM_PUBLISHER_NOCAT . ''; echo ''; - $categoryId = '0'; + $categoryid = '0'; } echo "\n"; require_once $GLOBALS['xoops']->path('class/pagenav.php'); diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index 3b5ba9ec..237e5ddd 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -32,8 +32,8 @@ const DIRNAME = 'fmcontent'; -/** @var \XoopsPersistableObjectHandler $fmContentHdlr */ -/** @var \XoopsPersistableObjectHandler $fmTopicHdlr */ +/** @var \XoopsPersistableObjectHandler $fmContentHandler */ +/** @var \XoopsPersistableObjectHandler $fmTopicHandler */ require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -52,15 +52,15 @@ Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); $moduleId = $helper->getModule()->getVar('mid'); - $fmTopicHdlr = xoops_getModuleHandler('topic', 'fmcontent'); - $fmTopicCount = $fmTopicHdlr->getCount(new \Criteria('topic_modid', $moduleId)); + $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); + $fmTopicCount = $fmTopicHandler->getCount(new \Criteria('topic_modid', $moduleId)); if (empty($fmTopicCount)) { echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { require_once $GLOBALS['xoops']->path('www/class/xoopstree.php'); - $fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent'); - $fmContentCount = $fmContentHdlr->getCount(new \Criteria('content_modid', $moduleId)); + $fmContentHandler = xoops_getModuleHandler('page', 'fmcontent'); + $fmContentCount = $fmContentHandler->getCount(new \Criteria('content_modid', $moduleId)); if (empty($fmContentCount)) { echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $fmContentCount) . ''; @@ -87,7 +87,7 @@ $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('content_modid', $moduleId)); $criteria->add(new \Criteria('content_topic', 0)); - $cnt_tla_contents = $fmContentHdlr->getCount($criteria); + $cnt_tla_contents = $fmContentHandler->getCount($criteria); if ($cnt_tla_contents) { $catCboxOptions[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})"; } @@ -102,8 +102,8 @@ // Publisher parent category xoops_load('tree'); - $categoryHdlr = $helper->getHandler('Category'); - $catObjs = $categoryHdlr->getAll(); + $categoryHandler = $helper->getHandler('Category'); + $catObjs = $categoryHandler->getAll(); $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); $moduleDirName = \basename(\dirname(__DIR__)); $module = \XoopsModule::getByDirname($moduleDirName); @@ -150,12 +150,12 @@ $parentId = Request::getInt('parent_category', 0, 'POST'); // get all FmContent Content items without a category (content_topic=0) - $fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent'); + $fmContentHandler = xoops_getModuleHandler('page', 'fmcontent'); $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('content_modid', $moduleId)); $criteria->add(new \Criteria('content_topic', 0)); - $fmContentObjs = $fmContentHdlr->getAll($criteria); + $fmContentObjs = $fmContentHandler->getAll($criteria); if ($fmContentObjs && is_array($fmContentObjs)) { ++$cnt_imported_cat; //count category if there was content to import @@ -178,7 +178,7 @@ ); $categoryObj->store(); - $fmTopicHdlr = xoops_getModuleHandler('topic', 'fmcontent'); + $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); // insert articles for this category foreach ($fmContentObjs as $thisFmContentObj) { @@ -240,7 +240,7 @@ $newArticleArray = []; $oldToNew = []; - $fmTopicObjs = $fmTopicHdlr->getAll(new \Criteria('topic_modid', $moduleId)); + $fmTopicObjs = $fmTopicHandler->getAll(new \Criteria('topic_modid', $moduleId)); // first create FmContent Topics as Publisher Categories foreach ($fmTopicObjs as $thisFmTopicObj) { @@ -280,7 +280,7 @@ $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('content_modid', $moduleId)); //only for this instance of fmcontent $criteria->add(new \Criteria('content_topic', $thisFmTopicObj->getVar('topic_id'))); //for this category - $fmContentObjs = $fmContentHdlr->getAll($criteria); + $fmContentObjs = $fmContentHandler->getAll($criteria); // insert articles for this category /** @var Item $itemObj */ diff --git a/admin/migrate.php b/admin/migrate.php index 793f86e7..14a76543 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -67,7 +67,7 @@ $configurator = new Configurator(); -$migrator = new Migrate($configurator); +$migrator = new Migrate(); $op = Request::getCmd('op', 'show'); $opShow = Request::getCmd('show', null, 'POST'); diff --git a/backend.php b/backend.php index 896783be..dade62c1 100644 --- a/backend.php +++ b/backend.php @@ -33,10 +33,10 @@ mb_http_output('pass'); } -$categoryId = Request::getInt('categoryid', -1, 'GET'); +$categoryid = Request::getInt('categoryid', -1, 'GET'); -if (-1 != $categoryId) { - $categoryObj = $helper->getHandler('Category')->get($categoryId); +if (-1 != $categoryid) { + $categoryObj = $helper->getHandler('Category')->get($categoryid); } header('Content-Type:text/xml; charset=' . _CHARSET); @@ -63,7 +63,7 @@ $tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )'); $tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )'); - if (-1 != $categoryId) { + if (-1 != $categoryid) { $channelCategory .= ' > ' . $categoryObj->name(); } @@ -83,7 +83,7 @@ $height = round($height, 0, PHP_ROUND_HALF_UP); $tpl->assign('image_width', $width); $tpl->assign('image_height', $height); - $sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryId); + $sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryid); if (!empty($sarray) && is_array($sarray)) { $count = $sarray; foreach ($sarray as $item) { diff --git a/blocks/items_columns.php b/blocks/items_columns.php index b89753ac..42be5cd1 100644 --- a/blocks/items_columns.php +++ b/blocks/items_columns.php @@ -84,8 +84,8 @@ function publisher_items_columns_show($options) $k = 0; $columns = $mainItem = $subItem = []; - foreach ($selCategoriesObj as $categoryId => $mainItemCatObj) { - $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId); + foreach ($selCategoriesObj as $categoryid => $mainItemCatObj) { + $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryid); $scount = count($categoryItemsObj); if ($scount > 0 && is_array($categoryItemsObj)) { reset($categoryItemsObj); @@ -140,7 +140,7 @@ function publisher_items_columns_show($options) } } } - unset($categoryId); + unset($categoryid); $block['template'] = $options[4]; $block['columns'] = $columns; diff --git a/blocks/items_menu.php b/blocks/items_menu.php index 5b42fad0..1fe8815e 100644 --- a/blocks/items_menu.php +++ b/blocks/items_menu.php @@ -54,13 +54,13 @@ function publisher_items_menu_show($options) $catLinkClass = 'menuMain'; - $categoryId = 0; + $categoryid = 0; if ($block['inModule']) { // Are we in a category and if yes, in which one ? - $categoryId = Request::getInt('categoryid', 0, 'GET'); + $categoryid = Request::getInt('categoryid', 0, 'GET'); - if (0 != $categoryId) { + if (0 != $categoryid) { // if we are in a category, then the $categoryObj is already defined in publisher/category.php global $categoryObj; $block['currentcat'] = $categoryObj->getCategoryLink('menuTop'); @@ -69,7 +69,7 @@ function publisher_items_menu_show($options) } foreach ($blockCategoriesObj as $catId => $blockCategoryObj) { - if ($catId != $categoryId) { + if ($catId != $categoryid) { $block['categories'][$catId]['categoryLink'] = $blockCategoryObj->getCategoryLink($catLinkClass); } } diff --git a/blocks/items_new.php b/blocks/items_new.php index 4e083c79..8de54b64 100644 --- a/blocks/items_new.php +++ b/blocks/items_new.php @@ -71,8 +71,8 @@ function publisher_items_new_show($options) } // $optCatItems = (int)$options[2]; - // $categoryId = -1; - // $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId); + // $categoryid = -1; + // $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryid); $itemsObj = $itemHandler->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none'); diff --git a/blocks/latest_news.php b/blocks/latest_news.php index a5f8f19a..e3d09057 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -20,7 +20,9 @@ * @author Mowaffak */ -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Common\Configurator, + Constants, Helper, ItemHandler, Seo, @@ -38,6 +40,9 @@ function publisher_latest_news_show($options) { $block = []; + $configurator = new Configurator(); + $icons = $configurator->icons; + $helper = Helper::getInstance(); $helper->loadLanguage('main'); /** @var ItemHandler $itemHandler */ @@ -223,7 +228,7 @@ function publisher_latest_news_show($options) $item['print'] = ''; if (1 == $options[24]) { - $item['print'] = '" . $icons['print'] . " '; + $item['print'] = '' . $icons['print'] . ' '; } $item['pdf'] = ''; @@ -244,7 +249,7 @@ function publisher_latest_news_show($options) } $item['more'] = ''; - if (1 == $options[28] && '' != $itemObj->body() || $itemObj->comments() > 0) { + if ((1 == $options[28] && '' != $itemObj->body()) || $itemObj->comments() > 0) { $item['more'] = '' . _MB_PUBLISHER_READMORE . ''; } diff --git a/category.php b/category.php index eddeab74..62d4ae19 100644 --- a/category.php +++ b/category.php @@ -31,11 +31,11 @@ require_once __DIR__ . '/header.php'; -$categoryId = Request::getInt('categoryid', 0, 'GET'); +$categoryid = Request::getInt('categoryid', 0, 'GET'); // Creating the category object for the selected category /** @var Helper $helper */ -$categoryObj = $helper->getHandler('Category')->get($categoryId); +$categoryObj = $helper->getHandler('Category')->get($categoryid); // if the selected category was not found, exit if (!is_object($categoryObj) || $categoryObj->notLoaded()) { @@ -56,7 +56,7 @@ // if there is no Item under this categories or the sub-categories, exit // why? -if (!isset($totalItems[$categoryId]) || 0 == $totalItems[$categoryId]) { +if (!isset($totalItems[$categoryid]) || 0 == $totalItems[$categoryid]) { //redirect_header("index.php", 1, _MD_PUBLISHER_MAINNOFAQS); } @@ -104,7 +104,7 @@ break; } -$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryId, $sort, $order); +$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryid, $sort, $order); $totalItemOnPage = 0; if ($itemsObj) { @@ -128,7 +128,7 @@ $lastitemsize = (int)$helper->getConfig('idxcat_last_item_size'); // Creating the sub-categories objects that belong to the selected category -$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryId); +$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryid); $totalSubcats = count($subcatsObj); $total_items = 0; @@ -180,7 +180,7 @@ $category['subcats'] = $subcategories; $category['subcatscount'] = count($subcategories); -$thiscategory_itemcount = $totalItems[$categoryId] ?? 0; +$thiscategory_itemcount = $totalItems[$categoryid] ?? 0; $category['total'] = $thiscategory_itemcount; if (count($itemsObj) > 0) { @@ -226,7 +226,7 @@ $xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name())); $xoopsTpl->assign('module_home', Utility::moduleHome($helper->getConfig('format_linked_path'))); $xoopsTpl->assign('categoryPath', '
  • ' . $category['categoryPath'] . '
  • '); -$xoopsTpl->assign('selected_category', $categoryId); +$xoopsTpl->assign('selected_category', $categoryid); // The Navigation Bar require_once $GLOBALS['xoops']->path('class/pagenav.php'); @@ -246,7 +246,7 @@ // RSS Link if (1 == $helper->getConfig('idxcat_show_rss_link')) { - $link = sprintf("%s", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryId, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED); + $link = sprintf("%s", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryid, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED); $xoopsTpl->assign('rssfeed_link', $link); } diff --git a/class/Category.php b/class/Category.php index 08ac7bd1..8cb1422f 100644 --- a/class/Category.php +++ b/class/Category.php @@ -22,9 +22,8 @@ * @author The SmartFactory */ -use XoopsModules\Publisher\{Form, - Helper, - Utility +use XoopsModules\Publisher\{ + Form }; /** @var Helper $this->helper */ @@ -44,7 +43,7 @@ class Category extends \XoopsObject * @var array */ public $categoryPath = false; - public $categoryId; + public $categoryid; public $parentid; public $name; public $description; diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index 6234fe98..af6db659 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -14,11 +14,10 @@ trait ModuleStats { /** * @param \XoopsModules\Publisher\Common\Configurator $configurator - * @param array $moduleStats * @return array */ - public static function getModuleStats($configurator, $moduleStats) + public static function getModuleStats($configurator) { if (\count($configurator->moduleStats) > 0) { foreach (\array_keys($configurator->moduleStats) as $i) { diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 4c5e6935..3bb5c676 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -206,7 +206,7 @@ public static function fieldExists($fieldname, $table) */ public static function cloneRecord($tableName, $id_field, $id) { - $new_id = false; +// $new_id = false; $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone $sql = "SELECT * FROM $table WHERE $id_field='$id' "; diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 64f0f2c3..cdc31c65 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -115,16 +115,6 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm */ - - - - - - - - - - $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; @@ -137,7 +127,7 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm \curl_setopt($curlHandle, \CURLOPT_URL, $infoReleasesUrl); \curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true); \curl_setopt($curlHandle, \CURLOPT_FOLLOWLOCATION, true); -// \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true); //TODO: how to avoid an error when 'Peer's Certificate issuer is not recognized' + // \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true); //TODO: how to avoid an error when 'Peer's Certificate issuer is not recognized' \curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { @@ -160,8 +150,8 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm } $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); //"PHP-standardized" version -// $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); - $moduleVersion = '1.0'; //for testing only + // $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); +// $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'aktuelles'; //for testing only if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { $ret = []; diff --git a/class/Item.php b/class/Item.php index 94ac5454..08cd359a 100644 --- a/class/Item.php +++ b/class/Item.php @@ -437,7 +437,7 @@ public function getCategoryLink() /** * @param bool $withAllLink * - * @return string|bool + * @return array|bool|string */ public function getCategoryPath($withAllLink = true) { @@ -1061,8 +1061,8 @@ public function accessGranted() public function setVarsFromRequest() { //Required fields - // if (!empty($categoryId = Request::getInt('categoryid', 0, 'POST'))) { - // $this->setVar('categoryid', $categoryId);} + // if (!empty($categoryid = Request::getInt('categoryid', 0, 'POST'))) { + // $this->setVar('categoryid', $categoryid);} if (\is_object($GLOBALS['xoopsUser'])) { $userTimeoffset = $GLOBALS['xoopsUser']->getVar('timezone_offset'); } else { diff --git a/class/ItemHandler.php b/class/ItemHandler.php index 1ce511ec..dfb75bfd 100644 --- a/class/ItemHandler.php +++ b/class/ItemHandler.php @@ -256,13 +256,13 @@ public function getCount(\CriteriaElement $criteria = null, $notNullFields = nul } /** - * @param int $categoryId + * @param int $categoryid * @param string|array $status * @param string|null $notNullFields * @param null|\CriteriaCompo $criteriaPermissions * @return \CriteriaCompo */ - private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields = null, $criteriaPermissions = null) + private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = null, $criteriaPermissions = null) { // $notNullFields = (null !== $notNullFields) ?: ''; // global $publisherIsAdmin; @@ -280,8 +280,8 @@ private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields // } $criteriaCategory = null; - if (isset($categoryId) && -1 !== $categoryId) { - $criteriaCategory = new \Criteria('categoryid', $categoryId); + if (isset($categoryid) && -1 !== $categoryid) { + $criteriaCategory = new \Criteria('categoryid', $categoryid); } $criteriaStatus = new \CriteriaCompo(); @@ -310,13 +310,13 @@ private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields } /** - * @param $categoryId + * @param $categoryid * @param string $status * @param string|null $notNullFields * * @return int */ - public function getItemsCount($categoryId = -1, $status = '', $notNullFields = null) + public function getItemsCount($categoryid = -1, $status = '', $notNullFields = null) { // $notNullFields = $notNullFields ?? null; $criteriaPermissions = null; @@ -332,7 +332,7 @@ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = n } } // $ret = []; - $criteria = $this->getItemsCriteria($categoryId, $status, $notNullFields, $criteriaPermissions); + $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions); $ret = $this->getCount($criteria, $notNullFields); @@ -342,7 +342,7 @@ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = n /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -352,7 +352,7 @@ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = n * * @return array */ - public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true) + public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true) { $notNullFields = (null !== $notNullFields) ?: ''; $otherCriteria = new \CriteriaCompo(); @@ -368,13 +368,13 @@ public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort $otherCriteria->add($criteriaExpire); } - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], $categoryId, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], $categoryid, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); } /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -383,14 +383,14 @@ public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort * * @return array */ - public function getAllExpired($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') + public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') { $notNullFields = (null !== $notNullFields) ?: ''; $otherCriteria = new \CriteriaCompo(); $otherCriteria->add(new \Criteria('dateexpire', \time(), '<=')); $otherCriteria->add(new \Criteria('dateexpire', 0, '>')); - return $this->getItems($limit, $start, -1, $categoryId, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); + return $this->getItems($limit, $start, -1, $categoryid, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); } /** @@ -433,7 +433,7 @@ public function getNextPublished($obj) /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -442,16 +442,16 @@ public function getNextPublished($obj) * * @return array */ - public function getAllSubmitted($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') + public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') { $notNullFields = (null !== $notNullFields) ?: ''; - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); } /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string $notNullFields @@ -460,15 +460,15 @@ public function getAllSubmitted($limit = 0, $start = 0, $categoryId = -1, $sort * * @return array */ - public function getAllOffline($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') + public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') { - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); } /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string $notNullFields @@ -477,16 +477,16 @@ public function getAllOffline($limit = 0, $start = 0, $categoryId = -1, $sort = * * @return array */ - public function getAllRejected($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') + public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') { - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); } /** * @param int $limit * @param int $start * @param array|string $status - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -496,7 +496,7 @@ public function getAllRejected($limit = 0, $start = 0, $categoryId = -1, $sort = * @return array * @internal param bool $asObject */ - public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none') + public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none') { $notNullFields = (null !== $notNullFields) ?: ''; $criteriaPermissions = null; @@ -512,10 +512,10 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, } } - $criteria = $this->getItemsCriteria($categoryId, $status, $notNullFields, $criteriaPermissions); + $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions); /* - if (isset($categoryId) && $categoryId != -1) { - $criteriaCategory = new \Criteria('categoryid', $categoryId); + if (isset($categoryid) && $categoryid != -1) { + $criteriaCategory = new \Criteria('categoryid', $categoryid); } $criteriaStatus = new \CriteriaCompo(); if (!empty($status) && is_array($status)) { @@ -553,23 +553,23 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, /** * @param string $field * @param string $status - * @param int $categoryId + * @param int $categoryid * * @return bool * @throws \Exception */ - public function getRandomItem($field = '', $status = '', $categoryId = -1) + public function getRandomItem($field = '', $status = '', $categoryid = -1) { $ret = false; $notNullFields = $field; // Getting the number of published Items - $totalItems = $this->getItemsCount($categoryId, $status, $notNullFields); + $totalItems = $this->getItemsCount($categoryid, $status, $notNullFields); if ($totalItems > 0) { --$totalItems; $entryNumber = \random_int(0, $totalItems); // $entryNumber2 = random_int(0, $totalItems); - $item = $this->getItems(1, $entryNumber, $status, $categoryId, $sort = 'datesub', $order = 'DESC', $notNullFields); + $item = $this->getItems(1, $entryNumber, $status, $categoryid, $sort = 'datesub', $order = 'DESC', $notNullFields); if ($item) { $ret = $item[0]; } diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 971a62fd..97abe001 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -24,9 +24,6 @@ * @author The SmartFactory */ -use XoopsModules\Publisher\{Helper -}; - /** @var Helper $this->helper */ //require_once \dirname(__DIR__) . '/include/common.php'; diff --git a/class/Utility.php b/class/Utility.php index 1c601a89..f65d7ead 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -270,19 +270,19 @@ public static function editFile($showmenu = false, $fileid = 0, $itemId = 0) /** * @param bool $showmenu - * @param int $categoryId + * @param int $categoryid * @param int $nbSubCats * @param Category|null $categoryObj */ - public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCats = 4, $categoryObj = null) + public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null) { $helper = Helper::getInstance(); // if there is a parameter, and the id exists, retrieve data: we're editing a category /** @var Category $categoryObj */ - if (0 != $categoryId) { + if (0 != $categoryid) { // Creating the category object for the selected category - $categoryObj = $helper->getHandler('Category')->get($categoryId); + $categoryObj = $helper->getHandler('Category')->get($categoryid); if ($categoryObj->notLoaded()) { \redirect_header('category.php', 1, \_AM_PUBLISHER_NOCOLTOEDIT); } @@ -290,7 +290,7 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa $categoryObj = $helper->getHandler('Category')->create(); } - if (0 != $categoryId) { + if (0 != $categoryid) { echo "
    \n"; static::openCollapsableBar('edittable', 'edittableicon', \_AM_PUBLISHER_EDITCOL, \_AM_PUBLISHER_CATEGORY_EDIT_INFO); } else { @@ -300,15 +300,15 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa $sform = $categoryObj->getForm($nbSubCats); $sform->display(); - if ($categoryId) { + if ($categoryid) { static::closeCollapsableBar('edittable', 'edittableicon'); } else { static::closeCollapsableBar('createtable', 'createtableicon'); } //Added by fx2024 - if ($categoryId) { - $selCat = $categoryId; + if ($categoryid) { + $selCat = $categoryid; static::openCollapsableBar('subcatstable', 'subcatsicon', \_AM_PUBLISHER_SUBCAT_CAT, \_AM_PUBLISHER_SUBCAT_CAT_DSC); // Get the total number of sub-categories @@ -784,11 +784,11 @@ public static function userIsModerator($itemObj) * Saves permissions for the selected category * * @param null|array $groups : group with granted permission - * @param int $categoryId : categoryid on which we are setting permissions + * @param int $categoryid : categoryid on which we are setting permissions * @param string $permName : name of the permission * @return bool : TRUE if the no errors occured */ - public static function saveCategoryPermissions($groups, $categoryId, $permName) + public static function saveCategoryPermissions($groups, $categoryid, $permName) { $helper = Helper::getInstance(); @@ -798,12 +798,12 @@ public static function saveCategoryPermissions($groups, $categoryId, $permName) /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); // First, if the permissions are already there, delete them - $grouppermHandler->deleteByModule($moduleId, $permName, $categoryId); + $grouppermHandler->deleteByModule($moduleId, $permName, $categoryid); // Save the new permissions if (\count($groups) > 0) { foreach ($groups as $groupId) { - $grouppermHandler->addRight($permName, $categoryId, $groupId, $moduleId); + $grouppermHandler->addRight($permName, $categoryid, $groupId, $moduleId); } } diff --git a/item.php b/item.php index b66d3a05..2e5e1259 100644 --- a/item.php +++ b/item.php @@ -20,7 +20,8 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, Constants, Helper, Item, diff --git a/language/english/blocksadmin.php b/language/english/blocksadmin.php new file mode 100644 index 00000000..5e9d0090 --- /dev/null +++ b/language/english/blocksadmin.php @@ -0,0 +1,43 @@ + Date: Sat, 28 Aug 2021 21:31:43 -0400 Subject: [PATCH 25/26] Scrutinizer --- admin/index.php | 2 +- docs/changelog.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/index.php b/admin/index.php index 1569c31c..e28d2572 100644 --- a/admin/index.php +++ b/admin/index.php @@ -62,7 +62,7 @@ } $modStats = []; -$moduleStats = $utility::getModuleStats($configurator, $modStats); +$moduleStats = $utility::getModuleStats($configurator); $adminObject->addInfoBox(constant('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY')); if ($moduleStats && is_array($moduleStats)) { diff --git a/docs/changelog.txt b/docs/changelog.txt index a3f21341..a326dd39 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,4 @@ -
    1.08 Alpha 5 [NOT RELEASED]
    Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 +
    1.08 Alpha 5 [2021-08-28]
    Dev: XOOPS 2.5.11, PHP 7.4.22, PHP 8.0.9
    - updated articles testdata with voting (mamba) - set $icons in ItemForm (mamba) @@ -12,7 +12,9 @@ - add renameColumns, moduleStats to Configurator (mamba) - logoXoopsPhp8 (mamba) - Yoda, cosmetics, Unqualified function/constant reference, type hints (mamba) -- delete blocksadmin.php (mamba) +- PHP8 Smarty defaults +- revert for blocks in 2.5.10 (ihackcode/mamba) +- various fixes from Scrutinizer (mamba)
    1.08 Alpha 4 [2021-01-12]
    Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 From d0f50fa0698ae5a8d1fc0f5279a9b7e6e9d1c082 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 28 Aug 2021 21:57:48 -0400 Subject: [PATCH 26/26] Scrutinizer code formatting --- admin/import/ams.php | 6 +- admin/import/cjaycontent.php | 6 +- admin/import/fmcontent.php | 164 ++++++++++++++++------------------ admin/import/index.php | 3 +- admin/import/news.php | 6 +- admin/import/smartsection.php | 12 +-- admin/import/wfsection.php | 14 +-- admin/import/xfsection.php | 12 +-- admin/import/xnews.php | 8 +- admin/index.php | 2 +- class/Common/ModuleStats.php | 1 + 11 files changed, 121 insertions(+), 113 deletions(-) diff --git a/admin/import/ams.php b/admin/import/ams.php index e46b9459..baae8929 100644 --- a/admin/import/ams.php +++ b/admin/import/ams.php @@ -21,12 +21,14 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, Constants, Helper, File, Utility }; + /** @var Helper $helper */ const DIRNAME = 'ams'; @@ -171,7 +173,7 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php index 112596c5..e73cf897 100644 --- a/admin/import/cjaycontent.php +++ b/admin/import/cjaycontent.php @@ -21,10 +21,12 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Item, Utility }; + /** @var Helper $helper */ const DIRNAME = 'cjaycontent'; @@ -95,7 +97,7 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index 237e5ddd..f0b43330 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -22,12 +22,14 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, Constants, Helper, Item, Utility }; + /** @var Helper $helper */ const DIRNAME = 'fmcontent'; @@ -50,17 +52,17 @@ Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); - $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); - $fmTopicCount = $fmTopicHandler->getCount(new \Criteria('topic_modid', $moduleId)); + $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); + $fmTopicCount = $fmTopicHandler->getCount(new \Criteria('topic_modid', $moduleId)); if (empty($fmTopicCount)) { echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { require_once $GLOBALS['xoops']->path('www/class/xoopstree.php'); - $fmContentHandler = xoops_getModuleHandler('page', 'fmcontent'); - $fmContentCount = $fmContentHandler->getCount(new \Criteria('content_modid', $moduleId)); + $fmContentHandler = xoops_getModuleHandler('page', 'fmcontent'); + $fmContentCount = $fmContentHandler->getCount(new \Criteria('content_modid', $moduleId)); if (empty($fmContentCount)) { echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $fmContentCount) . ''; @@ -102,12 +104,12 @@ // Publisher parent category xoops_load('tree'); - $categoryHandler = $helper->getHandler('Category'); - $catObjs = $categoryHandler->getAll(); - $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); - $moduleDirName = \basename(\dirname(__DIR__)); - $module = \XoopsModule::getByDirname($moduleDirName); - $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); + $categoryHandler = $helper->getHandler('Category'); + $catObjs = $categoryHandler->getAll(); + $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); + $moduleDirName = \basename(\dirname(__DIR__)); + $module = \XoopsModule::getByDirname($moduleDirName); + $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); //$form->addElement($catSelBox); $parent_cat_sel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, $catSelBox); @@ -140,7 +142,7 @@ Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); Utility::openCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); @@ -163,19 +165,17 @@ // create Publsher category to hold FmContent Content items with no Topic (content_topic=0) /** @var Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); - $categoryObj->setVars( - [ - 'parentid' => $parentId, - 'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME, - 'description' => _AM_PUBLISHER_IMPORT_FMCONTENT_TLT, - 'image' => '', - 'total' => 0, - 'weight' => 1, - 'created' => time(), - 'moderator', - $GLOBALS['xoopsUser']->getVar('uid'), - ] - ); + $categoryObj->setVars([ + 'parentid' => $parentId, + 'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME, + 'description' => _AM_PUBLISHER_IMPORT_FMCONTENT_TLT, + 'image' => '', + 'total' => 0, + 'weight' => 1, + 'created' => time(), + 'moderator', + $GLOBALS['xoopsUser']->getVar('uid'), + ]); $categoryObj->store(); $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); @@ -183,37 +183,33 @@ // insert articles for this category foreach ($fmContentObjs as $thisFmContentObj) { $itemObj = $helper->getHandler('Item')->create(); - $itemObj->setVars( - [ - 'categoryid' => $categoryObj->categoryid(), - 'title' => $thisFmContentObj->getVar('content_title'), - 'uid' => $thisFmContentObj->getVar('content_uid'), - 'summary' => $thisFmContentObj->getVar('content_short'), - 'body' => $thisFmContentObj->getVar('content_text'), - 'datesub' => $thisFmContentObj->getVar('content_create'), - 'dohtml' => $thisFmContentObj->getVar('dohtml'), - 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), - 'doxcode' => $thisFmContentObj->getVar('doxcode'), - 'doimage' => $thisFmContentObj->getVar('doimage'), - 'dobr' => $thisFmContentObj->getVar('dobr'), - 'weight' => $thisFmContentObj->getVar('content_order'), - 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, - 'counter' => $thisFmContentObj->getVar('content_hits'), - 'rating' => 0, - 'votes' => 0, - 'comments' => $thisFmContentObj->getVar('content_comments'), - 'meta_keywords' => $thisFmContentObj->getVar('content_words'), - 'meta_description' => $thisFmContentObj->getVar('content_desc'), - ] - ); + $itemObj->setVars([ + 'categoryid' => $categoryObj->categoryid(), + 'title' => $thisFmContentObj->getVar('content_title'), + 'uid' => $thisFmContentObj->getVar('content_uid'), + 'summary' => $thisFmContentObj->getVar('content_short'), + 'body' => $thisFmContentObj->getVar('content_text'), + 'datesub' => $thisFmContentObj->getVar('content_create'), + 'dohtml' => $thisFmContentObj->getVar('dohtml'), + 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), + 'doxcode' => $thisFmContentObj->getVar('doxcode'), + 'doimage' => $thisFmContentObj->getVar('doimage'), + 'dobr' => $thisFmContentObj->getVar('dobr'), + 'weight' => $thisFmContentObj->getVar('content_order'), + 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, + 'counter' => $thisFmContentObj->getVar('content_hits'), + 'rating' => 0, + 'votes' => 0, + 'comments' => $thisFmContentObj->getVar('content_comments'), + 'meta_keywords' => $thisFmContentObj->getVar('content_words'), + 'meta_description' => $thisFmContentObj->getVar('content_desc'), + ]); $contentImg = $thisFmContentObj->getVar('content_img'); if (!empty($contentImg)) { - $itemObj->setVars( - [ - 'images' => 1, - 'image' => $thisFmContentObj->getVar('content_img'), - ] - ); + $itemObj->setVars([ + 'images' => 1, + 'image' => $thisFmContentObj->getVar('content_img'), + ]); } if (!$itemObj->store()) { @@ -251,14 +247,12 @@ $categoryObj = $helper->getHandler('Category')->create(); - $categoryObj->setVars( - [ - 'parentid' => $thisFmTopicObj->getVar('topic_pid'), - 'weight' => $thisFmTopicObj->getVar('topic_weight'), - 'name' => $thisFmTopicObj->getVar('topic_title'), - 'description' => $thisFmTopicObj->getVar('topic_desc'), - ] - ); + $categoryObj->setVars([ + 'parentid' => $thisFmTopicObj->getVar('topic_pid'), + 'weight' => $thisFmTopicObj->getVar('topic_weight'), + 'name' => $thisFmTopicObj->getVar('topic_title'), + 'description' => $thisFmTopicObj->getVar('topic_desc'), + ]); // Category image if (!in_array($thisFmTopicObj->getVar('topic_img'), ['blank.gif', ''])) { @@ -286,29 +280,27 @@ /** @var Item $itemObj */ foreach ($fmContentObjs as $thisFmContentObj) { $itemObj = $helper->getHandler('Item')->create(); - $itemObj->setVars( - [ - 'categoryid' => $catIds['newid'], - 'title' => $thisFmContentObj->getVar('content_title'), - 'uid' => $thisFmContentObj->getVar('content_uid'), - 'summary' => $thisFmContentObj->getVar('content_short'), - 'body' => $thisFmContentObj->getVar('content_text'), - 'counter' => $thisFmContentObj->getVar('content_hits'), - 'datesub' => $thisFmContentObj->getVar('content_create'), - 'dohtml' => $thisFmContentObj->getVar('dohtml'), - 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), - 'doxcode' => $thisFmContentObj->getVar('doxcode'), - 'doimage' => $thisFmContentObj->getVar('doimage'), - 'dobr' => $thisFmContentObj->getVar('dobr'), - 'weight' => $thisFmContentObj->getVar('content_order'), - 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, - 'rating' => 0, - 'votes' => 0, - 'comments' => $thisFmContentObj->getVar('content_comments'), - 'meta_keywords' => $thisFmContentObj->getVar('content_words'), - 'meta_description' => $thisFmContentObj->getVar('content_desc'), - ] - ); + $itemObj->setVars([ + 'categoryid' => $catIds['newid'], + 'title' => $thisFmContentObj->getVar('content_title'), + 'uid' => $thisFmContentObj->getVar('content_uid'), + 'summary' => $thisFmContentObj->getVar('content_short'), + 'body' => $thisFmContentObj->getVar('content_text'), + 'counter' => $thisFmContentObj->getVar('content_hits'), + 'datesub' => $thisFmContentObj->getVar('content_create'), + 'dohtml' => $thisFmContentObj->getVar('dohtml'), + 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), + 'doxcode' => $thisFmContentObj->getVar('doxcode'), + 'doimage' => $thisFmContentObj->getVar('doimage'), + 'dobr' => $thisFmContentObj->getVar('dobr'), + 'weight' => $thisFmContentObj->getVar('content_order'), + 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, + 'rating' => 0, + 'votes' => 0, + 'comments' => $thisFmContentObj->getVar('content_comments'), + 'meta_keywords' => $thisFmContentObj->getVar('content_words'), + 'meta_description' => $thisFmContentObj->getVar('content_desc'), + ]); $contentImg = $thisFmContentObj->getVar('content_img'); if (!empty($contentImg)) { $itemObj->setVar('images', 1); diff --git a/admin/import/index.php b/admin/import/index.php index 4ae18fd0..2ea9b7d9 100644 --- a/admin/import/index.php +++ b/admin/import/index.php @@ -1,2 +1,3 @@ getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php index f882b2f2..eb14be43 100644 --- a/admin/import/smartsection.php +++ b/admin/import/smartsection.php @@ -21,17 +21,19 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, File, Item, Helper, Utility }; + /** @var Helper $helper */ const CATEGORY = 'smartsection_categories'; -const ITEMID = 'itemid'; -const DIRNAME = 'smartsection'; +const ITEMID = 'itemid'; +const DIRNAME = 'smartsection'; require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -109,8 +111,8 @@ Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php index 1d002434..6dff2e27 100644 --- a/admin/import/wfsection.php +++ b/admin/import/wfsection.php @@ -21,19 +21,21 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Category, File, Helper, Item, Utility }; + /** @var Helper $helper */ -const CATEGORY = 'wfs_category'; -const ITEMID = 'itemid'; +const CATEGORY = 'wfs_category'; +const ITEMID = 'itemid'; const ARTICLEID = 'articleid'; -const DIRNAME = 'wfsection'; +const DIRNAME = 'wfsection'; require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -254,8 +256,8 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . '
    '; - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + $publisher_module_id = $helper->getModule()->mid(); /** @var \XoopsCommentHandler $commentHandler */ $commentHandler = xoops_getHandler('comment'); diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php index db763296..d0da2a30 100644 --- a/admin/import/xfsection.php +++ b/admin/import/xfsection.php @@ -21,18 +21,20 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Category, File, Helper, Item, Utility }; + /** @var Helper $helper */ const CATEGORY = 'xfs_category'; -const ITEMID = 'articleid'; -const DIRNAME = 'xfsection'; +const ITEMID = 'articleid'; +const DIRNAME = 'xfsection'; require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); @@ -252,8 +254,8 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . '
    '; - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + $publisher_module_id = $helper->getModule()->mid(); /** @var \XoopsCommentHandler $commentHandler */ $commentHandler = xoops_getHandler('comment'); diff --git a/admin/import/xnews.php b/admin/import/xnews.php index c0cdae0e..f15eb1fd 100644 --- a/admin/import/xnews.php +++ b/admin/import/xnews.php @@ -21,13 +21,15 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Category, File, Helper, Item, Utility }; + /** @var Helper $helper */ const DIRNAME = 'xnews'; @@ -173,8 +175,8 @@ //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/index.php b/admin/index.php index e28d2572..02ad087b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -65,7 +65,7 @@ $moduleStats = $utility::getModuleStats($configurator); $adminObject->addInfoBox(constant('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY')); -if ($moduleStats && is_array($moduleStats)) { +if (is_array($moduleStats) && count($moduleStats) > 0) { foreach ($moduleStats as $key => $value) { switch ($key) { case 'totalcategories': diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index af6db659..1d5b438a 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -19,6 +19,7 @@ trait ModuleStats public static function getModuleStats($configurator) { + $moduleStats = []; if (\count($configurator->moduleStats) > 0) { foreach (\array_keys($configurator->moduleStats) as $i) { $moduleStats[$i] = $configurator->moduleStats[$i];