From 56d005ed3f3a84d194f13eaaba5398bbc3e7ebae Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 19 Sep 2018 14:29:53 +0200 Subject: [PATCH] Improvment to the integration, to be less obvious. Setup of beter front-end relations with external linked components. --- README.md | 26 +- admin/README.txt | 26 +- admin/access.xml | 185 +- admin/assets/css/country.css | 13 - admin/assets/css/currencies.css | 13 - admin/assets/css/currency.css | 13 - admin/assets/css/member.css | 5 +- admin/assets/css/region.css | 13 - admin/assets/css/regions.css | 13 - admin/config.xml | 242 +- admin/controller.php | 8 +- admin/controllers/ajax.json.php | 213 +- admin/controllers/countries.php | 97 - admin/controllers/country.php | 312 -- admin/controllers/currencies.php | 97 - admin/controllers/currency.php | 312 -- admin/controllers/member.php | 152 +- admin/controllers/members.php | 31 +- admin/controllers/region.php | 312 -- admin/controllers/regions.php | 97 - admin/controllers/type.php | 149 +- admin/controllers/types.php | 31 +- admin/helpers/membersmanager.php | 3246 +++++++++++++++-- .../en-GB/en-GB.com_membersmanager.ini | 649 ++-- .../en-GB/en-GB.com_membersmanager.sys.ini | 179 +- admin/layouts/batchselection.php | 4 +- admin/layouts/country/publishing.php | 44 - admin/layouts/country/publlshing.php | 46 - admin/layouts/country/regions_fullwidth.php | 106 - admin/layouts/currency/details_above.php | 28 - admin/layouts/currency/details_right.php | 43 - admin/layouts/currency/publishing.php | 44 - admin/layouts/currency/publlshing.php | 46 - admin/layouts/member/details_right.php | 48 - admin/layouts/member/image_fullwidth.php | 34 - .../layouts/member/membership_above.php | 1 - .../{details_left.php => membership_left.php} | 7 +- .../membership_right.php} | 4 +- admin/layouts/member/publishing.php | 2 +- admin/layouts/member/publlshing.php | 1 - admin/layouts/region/details_above.php | 28 - admin/layouts/region/index.html | 1 - admin/layouts/region/publishing.php | 44 - admin/layouts/region/publlshing.php | 46 - admin/layouts/type/details_above.php | 1 - admin/layouts/type/details_fullwidth.php | 1 - .../details_left.php} | 4 +- .../{region => type}/details_right.php | 3 +- admin/layouts/type/publishing.php | 1 - admin/layouts/type/publlshing.php | 1 - admin/membersmanager.php | 15 +- admin/models/ajax.php | 466 +-- admin/models/countries.php | 386 -- admin/models/country.php | 991 ----- admin/models/currencies.php | 367 -- admin/models/currency.php | 907 ----- admin/models/fields/countries.php | 58 - admin/models/fields/currency.php | 56 - admin/models/fields/mainmembers.php | 109 +- admin/models/fields/memberuser.php | 140 +- admin/models/fields/regions.php | 161 - admin/models/fields/types.php | 74 +- admin/models/forms/country.js | 11 - admin/models/forms/country.xml | 188 - admin/models/forms/currency.js | 11 - admin/models/forms/currency.xml | 246 -- admin/models/forms/member.js | 277 +- admin/models/forms/member.xml | 280 +- admin/models/forms/region.js | 11 - admin/models/forms/region.xml | 147 - admin/models/forms/type.xml | 18 + admin/models/member.php | 1109 +++--- admin/models/members.php | 122 +- admin/models/region.php | 960 ----- admin/models/regions.php | 366 -- admin/models/rules/memberloginname.php | 65 + admin/models/rules/memberuseremail.php | 128 + admin/models/type.php | 93 +- admin/models/types.php | 51 +- admin/sql/install.mysql.utf8.sql | 556 +-- admin/sql/uninstall.mysql.utf8.sql | 3 - admin/sql/updates/mysql/1.0.11.sql | 5 + admin/sql/updates/mysql/1.0.12.sql | 1 + admin/sql/updates/mysql/1.0.13.sql | 1 + admin/sql/updates/mysql/1.0.3.sql | 4 +- admin/sql/updates/mysql/1.0.4.sql | 2 +- admin/sql/updates/mysql/1.0.5.sql | 1 - admin/sql/updates/mysql/1.0.6.sql | 2 +- admin/sql/updates/mysql/1.0.7.sql | 3 + admin/tables/country.php | 334 -- admin/tables/currency.php | 334 -- admin/tables/member.php | 5 +- admin/tables/region.php | 334 -- admin/tables/type.php | 5 +- admin/views/countries/index.html | 1 - admin/views/countries/tmpl/default.php | 85 - .../countries/tmpl/default_batch_body.php | 18 - .../countries/tmpl/default_batch_footer.php | 23 - admin/views/countries/tmpl/default_body.php | 112 - admin/views/countries/tmpl/default_foot.php | 18 - admin/views/countries/tmpl/default_head.php | 59 - .../views/countries/tmpl/default_toolbar.php | 45 - admin/views/countries/tmpl/index.html | 1 - admin/views/countries/view.html.php | 318 -- admin/views/country/submitbutton.js | 35 - admin/views/country/tmpl/edit.php | 116 - admin/views/country/tmpl/index.html | 1 - admin/views/country/view.html.php | 196 - admin/views/currencies/index.html | 1 - admin/views/currencies/tmpl/default.php | 85 - .../currencies/tmpl/default_batch_body.php | 18 - .../currencies/tmpl/default_batch_footer.php | 23 - admin/views/currencies/tmpl/default_body.php | 106 - admin/views/currencies/tmpl/default_foot.php | 18 - admin/views/currencies/tmpl/default_head.php | 59 - .../views/currencies/tmpl/default_toolbar.php | 45 - admin/views/currencies/tmpl/index.html | 1 - admin/views/currencies/view.html.php | 241 -- admin/views/currency/submitbutton.js | 35 - admin/views/currency/tmpl/edit.php | 104 - admin/views/currency/tmpl/index.html | 1 - admin/views/currency/view.html.php | 183 - admin/views/import/view.html.php | 3 - admin/views/member/tmpl/edit.php | 249 +- admin/views/member/view.html.php | 92 +- admin/views/members/tmpl/default_body.php | 91 +- admin/views/members/tmpl/default_foot.php | 4 +- admin/views/members/tmpl/default_head.php | 9 +- admin/views/members/view.html.php | 151 +- admin/views/region/submitbutton.js | 35 - admin/views/region/tmpl/edit.php | 101 - admin/views/region/tmpl/index.html | 1 - admin/views/region/view.html.php | 183 - admin/views/regions/index.html | 1 - admin/views/regions/tmpl/default.php | 85 - .../regions/tmpl/default_batch_footer.php | 23 - admin/views/regions/tmpl/default_body.php | 103 - admin/views/regions/tmpl/default_head.php | 50 - admin/views/regions/tmpl/default_toolbar.php | 45 - admin/views/regions/tmpl/index.html | 1 - admin/views/regions/view.html.php | 261 -- admin/views/type/tmpl/edit.php | 14 +- admin/views/type/view.html.php | 29 +- admin/views/types/tmpl/default_body.php | 6 + admin/views/types/tmpl/default_foot.php | 4 +- admin/views/types/tmpl/default_head.php | 8 +- admin/views/types/view.html.php | 9 +- media/js/jquery.json.min.js | 2 + media/js/jstorage.js | 996 +++++ media/js/jstorage.min.js | 16 + membersmanager.xml | 6 +- membersmanager_server.xml | 93 +- script.php | 46 +- .../assets/css/cpanel.css | 0 site/assets/css/member.css | 5 +- site/assets/css/site.css | 4 +- site/assets/js/cpanel.js | 27 + site/assets/js/profile.js | 61 + site/controller.php | 7 +- site/controllers/ajax.json.php | 291 +- site/controllers/member.php | 156 +- site/helpers/membersmanager.php | 3230 ++++++++++++++-- site/helpers/route.php | 45 +- .../en-GB/en-GB.com_membersmanager.ini | 159 +- site/layouts/list_name_value.php | 56 + .../layouts/many_list_name_value.php | 10 +- site/layouts/member/details_right.php | 48 - site/layouts/member/image_fullwidth.php | 34 - .../layouts/member/membership_above.php | 1 - .../{details_left.php => membership_left.php} | 7 +- .../layouts/member/membership_right.php | 6 +- site/layouts/member/publishing.php | 2 +- site/layouts/member/publlshing.php | 1 - site/layouts/panelbox.php | 1 - site/layouts/profile.php | 190 - site/layouts/profile_uikit_three.php | 32 + site/layouts/profile_uikit_two.php | 34 + .../layouts/profileassessment_uikit_three.php | 110 + site/layouts/profileassessment_uikit_two.php | 110 + site/layouts/profiledetails_uikit_three.php | 52 + site/layouts/profiledetails_uikit_two.php | 46 + .../layouts/profileextra_uikit_three.php | 12 +- .../layouts/profileextra_uikit_two.php | 20 +- site/layouts/profileheader_uikit_three.php | 91 + site/layouts/profileheader_uikit_two.php | 90 + site/layouts/profilereports_uikit_three.php | 79 + site/layouts/profilereports_uikit_two.php | 79 + site/membersmanager.php | 11 +- site/models/ajax.php | 564 +-- site/models/cpanel.php | 209 ++ site/models/forms/member.js | 277 +- site/models/forms/member.xml | 280 +- site/models/member.php | 1109 +++--- site/models/profile.php | 84 +- site/router.php | 26 +- .../country => site/views/cpanel}/index.html | 0 site/views/cpanel/tmpl/default.php | 44 + site/views/cpanel/tmpl/default.xml | 8 + .../views/cpanel/tmpl/default_loginmodule.php | 28 + .../views/cpanel/tmpl}/index.html | 0 site/views/cpanel/view.html.php | 223 ++ site/views/member/tmpl/edit.php | 249 +- site/views/member/view.html.php | 108 +- site/views/profile/tmpl/default.php | 60 +- .../profile/tmpl/default_loginmodule.php | 2 +- site/views/profile/tmpl/default_profiles.php | 24 +- site/views/profile/view.html.php | 68 +- 207 files changed, 12914 insertions(+), 16646 deletions(-) delete mode 100644 admin/assets/css/country.css delete mode 100644 admin/assets/css/currencies.css delete mode 100644 admin/assets/css/currency.css delete mode 100644 admin/assets/css/region.css delete mode 100644 admin/assets/css/regions.css delete mode 100644 admin/controllers/countries.php delete mode 100644 admin/controllers/country.php delete mode 100644 admin/controllers/currencies.php delete mode 100644 admin/controllers/currency.php delete mode 100644 admin/controllers/region.php delete mode 100644 admin/controllers/regions.php delete mode 100644 admin/layouts/country/publishing.php delete mode 100644 admin/layouts/country/publlshing.php delete mode 100644 admin/layouts/country/regions_fullwidth.php delete mode 100644 admin/layouts/currency/details_above.php delete mode 100644 admin/layouts/currency/details_right.php delete mode 100644 admin/layouts/currency/publishing.php delete mode 100644 admin/layouts/currency/publlshing.php delete mode 100644 admin/layouts/member/details_right.php delete mode 100644 admin/layouts/member/image_fullwidth.php rename site/layouts/member/details_above.php => admin/layouts/member/membership_above.php (96%) rename admin/layouts/member/{details_left.php => membership_left.php} (90%) rename admin/layouts/{country/settings_right.php => member/membership_right.php} (93%) delete mode 100644 admin/layouts/region/details_above.php delete mode 100644 admin/layouts/region/index.html delete mode 100644 admin/layouts/region/publishing.php delete mode 100644 admin/layouts/region/publlshing.php rename admin/layouts/{country/settings_left.php => type/details_left.php} (93%) rename admin/layouts/{region => type}/details_right.php (94%) delete mode 100644 admin/models/countries.php delete mode 100644 admin/models/country.php delete mode 100644 admin/models/currencies.php delete mode 100644 admin/models/currency.php delete mode 100644 admin/models/fields/countries.php delete mode 100644 admin/models/fields/currency.php delete mode 100644 admin/models/fields/regions.php delete mode 100644 admin/models/forms/country.js delete mode 100644 admin/models/forms/country.xml delete mode 100644 admin/models/forms/currency.js delete mode 100644 admin/models/forms/currency.xml delete mode 100644 admin/models/forms/region.js delete mode 100644 admin/models/forms/region.xml delete mode 100644 admin/models/region.php delete mode 100644 admin/models/regions.php create mode 100644 admin/models/rules/memberloginname.php create mode 100644 admin/models/rules/memberuseremail.php create mode 100644 admin/sql/updates/mysql/1.0.11.sql create mode 100644 admin/sql/updates/mysql/1.0.12.sql create mode 100644 admin/sql/updates/mysql/1.0.13.sql delete mode 100644 admin/sql/updates/mysql/1.0.5.sql create mode 100644 admin/sql/updates/mysql/1.0.7.sql delete mode 100644 admin/tables/country.php delete mode 100644 admin/tables/currency.php delete mode 100644 admin/tables/region.php delete mode 100644 admin/views/countries/index.html delete mode 100644 admin/views/countries/tmpl/default.php delete mode 100644 admin/views/countries/tmpl/default_batch_body.php delete mode 100644 admin/views/countries/tmpl/default_batch_footer.php delete mode 100644 admin/views/countries/tmpl/default_body.php delete mode 100644 admin/views/countries/tmpl/default_foot.php delete mode 100644 admin/views/countries/tmpl/default_head.php delete mode 100644 admin/views/countries/tmpl/default_toolbar.php delete mode 100644 admin/views/countries/tmpl/index.html delete mode 100644 admin/views/countries/view.html.php delete mode 100644 admin/views/country/submitbutton.js delete mode 100644 admin/views/country/tmpl/edit.php delete mode 100644 admin/views/country/tmpl/index.html delete mode 100644 admin/views/country/view.html.php delete mode 100644 admin/views/currencies/index.html delete mode 100644 admin/views/currencies/tmpl/default.php delete mode 100644 admin/views/currencies/tmpl/default_batch_body.php delete mode 100644 admin/views/currencies/tmpl/default_batch_footer.php delete mode 100644 admin/views/currencies/tmpl/default_body.php delete mode 100644 admin/views/currencies/tmpl/default_foot.php delete mode 100644 admin/views/currencies/tmpl/default_head.php delete mode 100644 admin/views/currencies/tmpl/default_toolbar.php delete mode 100644 admin/views/currencies/tmpl/index.html delete mode 100644 admin/views/currencies/view.html.php delete mode 100644 admin/views/currency/submitbutton.js delete mode 100644 admin/views/currency/tmpl/edit.php delete mode 100644 admin/views/currency/tmpl/index.html delete mode 100644 admin/views/currency/view.html.php delete mode 100644 admin/views/region/submitbutton.js delete mode 100644 admin/views/region/tmpl/edit.php delete mode 100644 admin/views/region/tmpl/index.html delete mode 100644 admin/views/region/view.html.php delete mode 100644 admin/views/regions/index.html delete mode 100644 admin/views/regions/tmpl/default.php delete mode 100644 admin/views/regions/tmpl/default_batch_footer.php delete mode 100644 admin/views/regions/tmpl/default_body.php delete mode 100644 admin/views/regions/tmpl/default_head.php delete mode 100644 admin/views/regions/tmpl/default_toolbar.php delete mode 100644 admin/views/regions/tmpl/index.html delete mode 100644 admin/views/regions/view.html.php create mode 100644 media/js/jquery.json.min.js create mode 100644 media/js/jstorage.js create mode 100644 media/js/jstorage.min.js rename admin/assets/css/countries.css => site/assets/css/cpanel.css (100%) create mode 100644 site/assets/js/cpanel.js create mode 100644 site/assets/js/profile.js create mode 100644 site/layouts/list_name_value.php rename admin/views/regions/tmpl/default_foot.php => site/layouts/many_list_name_value.php (75%) delete mode 100644 site/layouts/member/details_right.php delete mode 100644 site/layouts/member/image_fullwidth.php rename admin/layouts/member/details_above.php => site/layouts/member/membership_above.php (96%) rename site/layouts/member/{details_left.php => membership_left.php} (90%) rename admin/layouts/currency/details_left.php => site/layouts/member/membership_right.php (90%) delete mode 100644 site/layouts/profile.php create mode 100644 site/layouts/profile_uikit_three.php create mode 100644 site/layouts/profile_uikit_two.php create mode 100644 site/layouts/profileassessment_uikit_three.php create mode 100644 site/layouts/profileassessment_uikit_two.php create mode 100644 site/layouts/profiledetails_uikit_three.php create mode 100644 site/layouts/profiledetails_uikit_two.php rename admin/views/regions/tmpl/default_batch_body.php => site/layouts/profileextra_uikit_three.php (64%) rename admin/layouts/country/settings_above.php => site/layouts/profileextra_uikit_two.php (62%) create mode 100644 site/layouts/profileheader_uikit_three.php create mode 100644 site/layouts/profileheader_uikit_two.php create mode 100644 site/layouts/profilereports_uikit_three.php create mode 100644 site/layouts/profilereports_uikit_two.php create mode 100644 site/models/cpanel.php rename {admin/layouts/country => site/views/cpanel}/index.html (100%) create mode 100644 site/views/cpanel/tmpl/default.php create mode 100644 site/views/cpanel/tmpl/default.xml create mode 100644 site/views/cpanel/tmpl/default_loginmodule.php rename {admin/layouts/currency => site/views/cpanel/tmpl}/index.html (100%) create mode 100644 site/views/cpanel/view.html.php diff --git a/README.md b/README.md index ba2f015..1e80a44 100644 --- a/README.md +++ b/README.md @@ -13,38 +13,38 @@ Watch this [tutorial](https://youtu.be/lkE0ZiSWufg) to see how. + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Members Manager](https://www.joomlacomponentbuilder.com/) + *First Build*: 6th September, 2015 -+ *Last Build*: 25th July, 2018 -+ *Version*: 1.0.x ++ *Last Build*: 19th September, 2018 ++ *Version*: 2.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**103 Hours** or **13 Eight Hour Days** (actual time the author saved - +**90 Hours** or **11 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **36982** -+ *File count*: **264** -+ *Folder count*: **69** ++ *Line count*: **32177** ++ *File count*: **205** ++ *Folder count*: **59** -**68 Hours** or **8 Eight Hour Days** (the actual time the author spent) +**59 Hours** or **8 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @26hours** = codingtime / 4; -> **planning @15hours** = codingtime / 7; -> **mapping @10hours** = codingtime / 10; -> **office @17hours** = codingtime / 6;) +> **debugging @22hours** = codingtime / 4; +> **planning @13hours** = codingtime / 7; +> **mapping @9hours** = codingtime / 10; +> **office @15hours** = codingtime / 6;) -**171 Hours** or **21 Eight Hour Days** +**149 Hours** or **19 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **4.2 weeks** or **0.9 months** +Project duration: **3.8 weeks** or **0.8 months** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index ba2f015..1e80a44 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -13,38 +13,38 @@ Watch this [tutorial](https://youtu.be/lkE0ZiSWufg) to see how. + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Members Manager](https://www.joomlacomponentbuilder.com/) + *First Build*: 6th September, 2015 -+ *Last Build*: 25th July, 2018 -+ *Version*: 1.0.x ++ *Last Build*: 19th September, 2018 ++ *Version*: 2.0.x + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html ## Build Time -**103 Hours** or **13 Eight Hour Days** (actual time the author saved - +**90 Hours** or **11 Eight Hour Days** (actual time the author saved - due to [Automated Component Builder](http://joomlacomponentbuilder.com)) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **36982** -+ *File count*: **264** -+ *Folder count*: **69** ++ *Line count*: **32177** ++ *File count*: **205** ++ *Folder count*: **59** -**68 Hours** or **8 Eight Hour Days** (the actual time the author spent) +**59 Hours** or **8 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @26hours** = codingtime / 4; -> **planning @15hours** = codingtime / 7; -> **mapping @10hours** = codingtime / 10; -> **office @17hours** = codingtime / 6;) +> **debugging @22hours** = codingtime / 4; +> **planning @13hours** = codingtime / 7; +> **mapping @9hours** = codingtime / 10; +> **office @15hours** = codingtime / 6;) -**171 Hours** or **21 Eight Hour Days** +**149 Hours** or **19 Eight Hour Days** (a total of the realistic time frame for this project) > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > with the normal everyday realities at the office, that includes the component planning, mapping & debugging.) -Project duration: **4.2 weeks** or **0.9 months** +Project duration: **3.8 weeks** or **0.8 months** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/access.xml b/admin/access.xml index 972a27d..9dafbcc 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -15,102 +15,52 @@ - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - + + + + + - - - - - - - + + + - + + + - - - - - - - - - - + + + + - - - - - - - - - - - - - - - + + @@ -119,6 +69,8 @@ + + @@ -135,54 +87,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + + + + + + + + + + + + + + + +
@@ -196,35 +132,8 @@ + + -
-
- - - - - - - - - - - -
-
- - - - - - -
-
- - - - - -
\ No newline at end of file diff --git a/admin/assets/css/country.css b/admin/assets/css/country.css deleted file mode 100644 index 026520f..0000000 --- a/admin/assets/css/country.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -/* CSS Document */ - - diff --git a/admin/assets/css/currencies.css b/admin/assets/css/currencies.css deleted file mode 100644 index 026520f..0000000 --- a/admin/assets/css/currencies.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -/* CSS Document */ - - diff --git a/admin/assets/css/currency.css b/admin/assets/css/currency.css deleted file mode 100644 index 026520f..0000000 --- a/admin/assets/css/currency.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -/* CSS Document */ - - diff --git a/admin/assets/css/member.css b/admin/assets/css/member.css index 026520f..58d7189 100644 --- a/admin/assets/css/member.css +++ b/admin/assets/css/member.css @@ -10,4 +10,7 @@ /* CSS Document */ - + +#jform_main_member_chzn { + width: 100% !important; +} diff --git a/admin/assets/css/region.css b/admin/assets/css/region.css deleted file mode 100644 index 026520f..0000000 --- a/admin/assets/css/region.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -/* CSS Document */ - - diff --git a/admin/assets/css/regions.css b/admin/assets/css/regions.css deleted file mode 100644 index 026520f..0000000 --- a/admin/assets/css/regions.css +++ /dev/null @@ -1,13 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -/* CSS Document */ - - diff --git a/admin/config.xml b/admin/config.xml index 7cb105b..40fff9a 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -69,17 +69,6 @@ class="readonly" /> -
- -
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'members', - 'type' => 'types', - 'region' => 'regions', - 'country' => 'countries', - 'currency' => 'currencies' + 'type' => 'types' ); // check if this is a list view if (in_array($view, $views)) diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 88290cd..5836290 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controller'); - /** * Membersmanager Ajax Controller */ @@ -29,13 +26,10 @@ class MembersmanagerControllerAjax extends JControllerLegacy JResponse::setHeader("Access-Control-Allow-Origin", "*"); // load the tasks $this->registerTask('checkUnique', 'ajax'); - $this->registerTask('getRegion', 'ajax'); - $this->registerTask('getUser', 'ajax'); - $this->registerTask('setUser', 'ajax'); - $this->registerTask('getCreateUserFields', 'ajax'); - $this->registerTask('createUser', 'ajax'); + $this->registerTask('getPlaceHolders', 'ajax'); $this->registerTask('uploadfile', 'ajax'); - $this->registerTask('removeFile', 'ajax'); + $this->registerTask('removeFile', 'ajax'); + $this->registerTask('getUserDetails', 'ajax'); } public function ajax() @@ -89,169 +83,14 @@ class MembersmanagerControllerAjax extends JControllerLegacy } } break; - case 'getRegion': + case 'getPlaceHolders': try { $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $countryValue = $jinput->get('country', NULL, 'INT'); - if($countryValue && $user->id != 0) + $getTypeValue = $jinput->get('getType', NULL, 'WORD'); + if($getTypeValue && $user->id != 0) { - $result = $this->getModel('ajax')->getRegion($countryValue); - } - else - { - $result = false; - } - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback . "(".json_encode($result).");"; - } - elseif($returnRaw) - { - echo json_encode($result); - } - else - { - echo "(".json_encode($result).");"; - } - } - catch(Exception $e) - { - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback."(".json_encode($e).");"; - } - else - { - echo "(".json_encode($e).");"; - } - } - break; - case 'getUser': - try - { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $idValue = $jinput->get('id', NULL, 'INT'); - $shownameValue = $jinput->get('showname', NULL, 'INT'); - if($idValue && $shownameValue && $user->id != 0) - { - $result = $this->getModel('ajax')->getUser($idValue, $shownameValue); - } - else - { - $result = false; - } - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback . "(".json_encode($result).");"; - } - elseif($returnRaw) - { - echo json_encode($result); - } - else - { - echo "(".json_encode($result).");"; - } - } - catch(Exception $e) - { - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback."(".json_encode($e).");"; - } - else - { - echo "(".json_encode($e).");"; - } - } - break; - case 'setUser': - try - { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $idValue = $jinput->get('id', NULL, 'INT'); - $dataValue = $jinput->get('data', NULL, 'STRING'); - if($idValue && $dataValue && $user->id != 0) - { - $result = $this->getModel('ajax')->setUser($idValue, $dataValue); - } - else - { - $result = false; - } - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback . "(".json_encode($result).");"; - } - elseif($returnRaw) - { - echo json_encode($result); - } - else - { - echo "(".json_encode($result).");"; - } - } - catch(Exception $e) - { - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback."(".json_encode($e).");"; - } - else - { - echo "(".json_encode($e).");"; - } - } - break; - case 'getCreateUserFields': - try - { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $idValue = $jinput->get('id', NULL, 'INT'); - if($idValue && $user->id != 0) - { - $result = $this->getModel('ajax')->getCreateUserFields($idValue); - } - else - { - $result = false; - } - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback . "(".json_encode($result).");"; - } - elseif($returnRaw) - { - echo json_encode($result); - } - else - { - echo "(".json_encode($result).");"; - } - } - catch(Exception $e) - { - if($callback = $jinput->get('callback', null, 'CMD')) - { - echo $callback."(".json_encode($e).");"; - } - else - { - echo "(".json_encode($e).");"; - } - } - break; - case 'createUser': - try - { - $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); - $dataValue = $jinput->get('data', NULL, 'STRING'); - $keyValue = $jinput->get('key', NULL, 'INT'); - if($dataValue && $keyValue && $user->id != 0) - { - $result = $this->getModel('ajax')->createUser($dataValue, $keyValue); + $result = $this->getModel('ajax')->getPlaceHolders($getTypeValue); } else { @@ -361,6 +200,44 @@ class MembersmanagerControllerAjax extends JControllerLegacy echo "(".json_encode($e).");"; } } + break; + case 'getUserDetails': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $userValue = $jinput->get('user', NULL, 'INT'); + if($userValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getUserDetails($userValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } break; } } diff --git a/admin/controllers/countries.php b/admin/controllers/countries.php deleted file mode 100644 index fdcd840..0000000 --- a/admin/controllers/countries.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - -/** - * Countries Controller - */ -class MembersmanagerControllerCountries extends JControllerAdmin -{ - protected $text_prefix = 'COM_MEMBERSMANAGER_COUNTRIES'; - /** - * Proxy for getModel. - * @since 2.5 - */ - public function getModel($name = 'Country', $prefix = 'MembersmanagerModel', $config = array()) - { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; - } - - public function exportData() - { - // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // check if export is allowed for this user. - $user = JFactory::getUser(); - if ($user->authorise('country.export', 'com_membersmanager') && $user->authorise('core.export', 'com_membersmanager')) - { - // Get the input - $input = JFactory::getApplication()->input; - $pks = $input->post->get('cid', array(), 'array'); - // Sanitize the input - JArrayHelper::toInteger($pks); - // Get the model - $model = $this->getModel('Countries'); - // get the data to export - $data = $model->getExportData($pks); - if (MembersmanagerHelper::checkArray($data)) - { - // now set the data to the spreadsheet - $date = JFactory::getDate(); - MembersmanagerHelper::xls($data,'Countries_'.$date->format('jS_F_Y'),'Countries exported ('.$date->format('jS F, Y').')','countries'); - } - } - // Redirect to the list screen with error. - $message = JText::_('COM_MEMBERSMANAGER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=countries', false), $message, 'error'); - return; - } - - - public function importData() - { - // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // check if import is allowed for this user. - $user = JFactory::getUser(); - if ($user->authorise('country.import', 'com_membersmanager') && $user->authorise('core.import', 'com_membersmanager')) - { - // Get the import model - $model = $this->getModel('Countries'); - // get the headers to import - $headers = $model->getExImPortHeaders(); - if (MembersmanagerHelper::checkObject($headers)) - { - // Load headers to session. - $session = JFactory::getSession(); - $headers = json_encode($headers); - $session->set('country_VDM_IMPORTHEADERS', $headers); - $session->set('backto_VDM_IMPORT', 'countries'); - $session->set('dataType_VDM_IMPORTINTO', 'country'); - // Redirect to import view. - $message = JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_COUNTRIES'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=import', false), $message); - return; - } - } - // Redirect to the list screen with error. - $message = JText::_('COM_MEMBERSMANAGER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=countries', false), $message, 'error'); - return; - } -} diff --git a/admin/controllers/country.php b/admin/controllers/country.php deleted file mode 100644 index 330e24b..0000000 --- a/admin/controllers/country.php +++ /dev/null @@ -1,312 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - -/** - * Country Controller - */ -class MembersmanagerControllerCountry extends JControllerForm -{ - /** - * Current or most recently performed task. - * - * @var string - * @since 12.2 - * @note Replaces _task. - */ - protected $task; - - public function __construct($config = array()) - { - $this->view_list = 'Countries'; // safeguard for setting the return view listing to the main view. - parent::__construct($config); - } - - /** - * Method override to check if you can add a new record. - * - * @param array $data An array of input data. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowAdd($data = array()) - { - // Access check. - $access = JFactory::getUser()->authorise('country.access', 'com_membersmanager'); - if (!$access) - { - return false; - } - // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('country.create', $this->option); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowEdit($data = array(), $key = 'id') - { - // get user object. - $user = JFactory::getUser(); - // get record id. - $recordId = (int) isset($data[$key]) ? $data[$key] : 0; - - - // Access check. - $access = ($user->authorise('country.access', 'com_membersmanager.country.' . (int) $recordId) && $user->authorise('country.access', 'com_membersmanager')); - if (!$access) - { - return false; - } - - if ($recordId) - { - // The record has been set. Check the record permissions. - $permission = $user->authorise('country.edit', 'com_membersmanager.country.' . (int) $recordId); - if (!$permission) - { - if ($user->authorise('country.edit.own', 'com_membersmanager.country.' . $recordId)) - { - // Now test the owner is the user. - $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; - if (empty($ownerId)) - { - // Need to do a lookup from the model. - $record = $this->getModel()->getItem($recordId); - - if (empty($record)) - { - return false; - } - $ownerId = $record->created_by; - } - - // If the owner matches 'me' then allow. - if ($ownerId == $user->id) - { - if ($user->authorise('country.edit.own', 'com_membersmanager')) - { - return true; - } - } - } - return false; - } - } - // Since there is no permission, revert to the component permissions. - return $user->authorise('country.edit', $this->option); - } - - /** - * Gets the URL arguments to append to an item redirect. - * - * @param integer $recordId The primary key id for the item. - * @param string $urlVar The name of the URL variable for the id. - * - * @return string The arguments to append to the redirect URL. - * - * @since 12.2 - */ - protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') - { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); - - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); - - // Setup redirect info. - - $append = ''; - - if ($refid) - { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; - } - elseif ($ref) - { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; - } - - return $append; - } - - /** - * Method to run batch operations. - * - * @param object $model The model. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 2.5 - */ - public function batch($model = null) - { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Set the model - $model = $this->getModel('Country', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=countries' . $this->getRedirectToListAppend(), false)); - - return parent::batch($model); - } - - /** - * Method to cancel an edit. - * - * @param string $key The name of the primary key of the URL variable. - * - * @return boolean True if access level checks pass, false otherwise. - * - * @since 12.2 - */ - public function cancel($key = null) - { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - $cancel = parent::cancel($key); - - if ($cancel) - { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false - ) - ); - } - return $cancel; - } - - /** - * Method to save a record. - * - * @param string $key The name of the primary key of the URL variable. - * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). - * - * @return boolean True if successful, false otherwise. - * - * @since 12.2 - */ - public function save($key = null, $urlVar = null) - { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } - - $saved = parent::save($key, $urlVar); - - if ($this->refid && $saved) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref && $saved) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - return $saved; - } - - /** - * Function that allows child controller access to model data - * after the data has been saved. - * - * @param JModel &$model The data model object. - * @param array $validData The validated data. - * - * @return void - * - * @since 11.1 - */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) - { - return; - } - -} diff --git a/admin/controllers/currencies.php b/admin/controllers/currencies.php deleted file mode 100644 index a827213..0000000 --- a/admin/controllers/currencies.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - -/** - * Currencies Controller - */ -class MembersmanagerControllerCurrencies extends JControllerAdmin -{ - protected $text_prefix = 'COM_MEMBERSMANAGER_CURRENCIES'; - /** - * Proxy for getModel. - * @since 2.5 - */ - public function getModel($name = 'Currency', $prefix = 'MembersmanagerModel', $config = array()) - { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; - } - - public function exportData() - { - // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // check if export is allowed for this user. - $user = JFactory::getUser(); - if ($user->authorise('currency.export', 'com_membersmanager') && $user->authorise('core.export', 'com_membersmanager')) - { - // Get the input - $input = JFactory::getApplication()->input; - $pks = $input->post->get('cid', array(), 'array'); - // Sanitize the input - JArrayHelper::toInteger($pks); - // Get the model - $model = $this->getModel('Currencies'); - // get the data to export - $data = $model->getExportData($pks); - if (MembersmanagerHelper::checkArray($data)) - { - // now set the data to the spreadsheet - $date = JFactory::getDate(); - MembersmanagerHelper::xls($data,'Currencies_'.$date->format('jS_F_Y'),'Currencies exported ('.$date->format('jS F, Y').')','currencies'); - } - } - // Redirect to the list screen with error. - $message = JText::_('COM_MEMBERSMANAGER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=currencies', false), $message, 'error'); - return; - } - - - public function importData() - { - // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // check if import is allowed for this user. - $user = JFactory::getUser(); - if ($user->authorise('currency.import', 'com_membersmanager') && $user->authorise('core.import', 'com_membersmanager')) - { - // Get the import model - $model = $this->getModel('Currencies'); - // get the headers to import - $headers = $model->getExImPortHeaders(); - if (MembersmanagerHelper::checkObject($headers)) - { - // Load headers to session. - $session = JFactory::getSession(); - $headers = json_encode($headers); - $session->set('currency_VDM_IMPORTHEADERS', $headers); - $session->set('backto_VDM_IMPORT', 'currencies'); - $session->set('dataType_VDM_IMPORTINTO', 'currency'); - // Redirect to import view. - $message = JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_CURRENCIES'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=import', false), $message); - return; - } - } - // Redirect to the list screen with error. - $message = JText::_('COM_MEMBERSMANAGER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=currencies', false), $message, 'error'); - return; - } -} diff --git a/admin/controllers/currency.php b/admin/controllers/currency.php deleted file mode 100644 index 9760765..0000000 --- a/admin/controllers/currency.php +++ /dev/null @@ -1,312 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - -/** - * Currency Controller - */ -class MembersmanagerControllerCurrency extends JControllerForm -{ - /** - * Current or most recently performed task. - * - * @var string - * @since 12.2 - * @note Replaces _task. - */ - protected $task; - - public function __construct($config = array()) - { - $this->view_list = 'Currencies'; // safeguard for setting the return view listing to the main view. - parent::__construct($config); - } - - /** - * Method override to check if you can add a new record. - * - * @param array $data An array of input data. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowAdd($data = array()) - { - // Access check. - $access = JFactory::getUser()->authorise('currency.access', 'com_membersmanager'); - if (!$access) - { - return false; - } - // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('currency.create', $this->option); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowEdit($data = array(), $key = 'id') - { - // get user object. - $user = JFactory::getUser(); - // get record id. - $recordId = (int) isset($data[$key]) ? $data[$key] : 0; - - - // Access check. - $access = ($user->authorise('currency.access', 'com_membersmanager.currency.' . (int) $recordId) && $user->authorise('currency.access', 'com_membersmanager')); - if (!$access) - { - return false; - } - - if ($recordId) - { - // The record has been set. Check the record permissions. - $permission = $user->authorise('currency.edit', 'com_membersmanager.currency.' . (int) $recordId); - if (!$permission) - { - if ($user->authorise('currency.edit.own', 'com_membersmanager.currency.' . $recordId)) - { - // Now test the owner is the user. - $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; - if (empty($ownerId)) - { - // Need to do a lookup from the model. - $record = $this->getModel()->getItem($recordId); - - if (empty($record)) - { - return false; - } - $ownerId = $record->created_by; - } - - // If the owner matches 'me' then allow. - if ($ownerId == $user->id) - { - if ($user->authorise('currency.edit.own', 'com_membersmanager')) - { - return true; - } - } - } - return false; - } - } - // Since there is no permission, revert to the component permissions. - return $user->authorise('currency.edit', $this->option); - } - - /** - * Gets the URL arguments to append to an item redirect. - * - * @param integer $recordId The primary key id for the item. - * @param string $urlVar The name of the URL variable for the id. - * - * @return string The arguments to append to the redirect URL. - * - * @since 12.2 - */ - protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') - { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); - - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); - - // Setup redirect info. - - $append = ''; - - if ($refid) - { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; - } - elseif ($ref) - { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; - } - - return $append; - } - - /** - * Method to run batch operations. - * - * @param object $model The model. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 2.5 - */ - public function batch($model = null) - { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Set the model - $model = $this->getModel('Currency', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=currencies' . $this->getRedirectToListAppend(), false)); - - return parent::batch($model); - } - - /** - * Method to cancel an edit. - * - * @param string $key The name of the primary key of the URL variable. - * - * @return boolean True if access level checks pass, false otherwise. - * - * @since 12.2 - */ - public function cancel($key = null) - { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - $cancel = parent::cancel($key); - - if ($cancel) - { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false - ) - ); - } - return $cancel; - } - - /** - * Method to save a record. - * - * @param string $key The name of the primary key of the URL variable. - * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). - * - * @return boolean True if successful, false otherwise. - * - * @since 12.2 - */ - public function save($key = null, $urlVar = null) - { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } - - $saved = parent::save($key, $urlVar); - - if ($this->refid && $saved) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref && $saved) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - return $saved; - } - - /** - * Function that allows child controller access to model data - * after the data has been saved. - * - * @param JModel &$model The data model object. - * @param array $validData The validated data. - * - * @return void - * - * @since 11.1 - */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) - { - return; - } - -} diff --git a/admin/controllers/member.php b/admin/controllers/member.php index 196d5ce..5db7464 100644 --- a/admin/controllers/member.php +++ b/admin/controllers/member.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - /** * Member Controller */ @@ -29,6 +26,13 @@ class MembersmanagerControllerMember extends JControllerForm */ protected $task; + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ public function __construct($config = array()) { $this->view_list = 'Members'; // safeguard for setting the return view listing to the main view. @@ -46,14 +50,17 @@ class MembersmanagerControllerMember extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('member.access', 'com_membersmanager'); + $access = $user->authorise('member.access', 'com_membersmanager'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('member.create', $this->option); + return $user->authorise('member.create', $this->option); } /** @@ -127,42 +134,25 @@ class MembersmanagerControllerMember extends JControllerForm * * @return string The arguments to append to the redirect URL. * - * @since 12.2 + * @since 1.6 */ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); - // Setup redirect info. - - $append = ''; - - if ($refid) + // set the referral options + if ($refid && $ref) { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; } elseif ($ref) { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; + $append = '&ref='. (string)$ref . $append; } return $append; @@ -201,43 +191,45 @@ class MembersmanagerControllerMember extends JControllerForm */ public function cancel($key = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -256,11 +248,15 @@ class MembersmanagerControllerMember extends JControllerForm */ public function save($key = null, $urlVar = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) { // to make sure the item is checkedin on redirect $this->task = 'save'; @@ -268,9 +264,22 @@ class MembersmanagerControllerMember extends JControllerForm $saved = parent::save($key, $urlVar); - if ($this->refid && $saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; // Redirect to the item screen. $this->setRedirect( @@ -279,9 +288,9 @@ class MembersmanagerControllerMember extends JControllerForm ) ); } - elseif ($this->ref && $saved) + elseif ($this->ref) { - $redirect = '&view='.(string)$this->ref; + $redirect = '&view=' . (string)$this->ref; // Redirect to the list screen. $this->setRedirect( @@ -306,6 +315,9 @@ class MembersmanagerControllerMember extends JControllerForm */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { + // safe all dynamic values (that has been posted) + MembersmanagerHelper::saveDynamicValues($validData, 'member'); + return; } diff --git a/admin/controllers/members.php b/admin/controllers/members.php index ff204d7..ab39867 100644 --- a/admin/controllers/members.php +++ b/admin/controllers/members.php @@ -12,24 +12,33 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - /** * Members Controller */ class MembersmanagerControllerMembers extends JControllerAdmin { - protected $text_prefix = 'COM_MEMBERSMANAGER_MEMBERS'; /** - * Proxy for getModel. - * @since 2.5 + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 */ - public function getModel($name = 'Member', $prefix = 'MembersmanagerModel', $config = array()) + protected $text_prefix = 'COM_MEMBERSMANAGER_MEMBERS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Member', $prefix = 'MembersmanagerModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -93,5 +102,5 @@ class MembersmanagerControllerMembers extends JControllerAdmin $message = JText::_('COM_MEMBERSMANAGER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=members', false), $message, 'error'); return; - } + } } diff --git a/admin/controllers/region.php b/admin/controllers/region.php deleted file mode 100644 index c52d562..0000000 --- a/admin/controllers/region.php +++ /dev/null @@ -1,312 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - -/** - * Region Controller - */ -class MembersmanagerControllerRegion extends JControllerForm -{ - /** - * Current or most recently performed task. - * - * @var string - * @since 12.2 - * @note Replaces _task. - */ - protected $task; - - public function __construct($config = array()) - { - $this->view_list = 'Regions'; // safeguard for setting the return view listing to the main view. - parent::__construct($config); - } - - /** - * Method override to check if you can add a new record. - * - * @param array $data An array of input data. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowAdd($data = array()) - { - // Access check. - $access = JFactory::getUser()->authorise('region.access', 'com_membersmanager'); - if (!$access) - { - return false; - } - // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('region.create', $this->option); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowEdit($data = array(), $key = 'id') - { - // get user object. - $user = JFactory::getUser(); - // get record id. - $recordId = (int) isset($data[$key]) ? $data[$key] : 0; - - - // Access check. - $access = ($user->authorise('region.access', 'com_membersmanager.region.' . (int) $recordId) && $user->authorise('region.access', 'com_membersmanager')); - if (!$access) - { - return false; - } - - if ($recordId) - { - // The record has been set. Check the record permissions. - $permission = $user->authorise('region.edit', 'com_membersmanager.region.' . (int) $recordId); - if (!$permission) - { - if ($user->authorise('region.edit.own', 'com_membersmanager.region.' . $recordId)) - { - // Now test the owner is the user. - $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; - if (empty($ownerId)) - { - // Need to do a lookup from the model. - $record = $this->getModel()->getItem($recordId); - - if (empty($record)) - { - return false; - } - $ownerId = $record->created_by; - } - - // If the owner matches 'me' then allow. - if ($ownerId == $user->id) - { - if ($user->authorise('region.edit.own', 'com_membersmanager')) - { - return true; - } - } - } - return false; - } - } - // Since there is no permission, revert to the component permissions. - return $user->authorise('region.edit', $this->option); - } - - /** - * Gets the URL arguments to append to an item redirect. - * - * @param integer $recordId The primary key id for the item. - * @param string $urlVar The name of the URL variable for the id. - * - * @return string The arguments to append to the redirect URL. - * - * @since 12.2 - */ - protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') - { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); - - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); - - // Setup redirect info. - - $append = ''; - - if ($refid) - { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; - } - elseif ($ref) - { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; - } - - return $append; - } - - /** - * Method to run batch operations. - * - * @param object $model The model. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 2.5 - */ - public function batch($model = null) - { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Set the model - $model = $this->getModel('Region', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=regions' . $this->getRedirectToListAppend(), false)); - - return parent::batch($model); - } - - /** - * Method to cancel an edit. - * - * @param string $key The name of the primary key of the URL variable. - * - * @return boolean True if access level checks pass, false otherwise. - * - * @since 12.2 - */ - public function cancel($key = null) - { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - $cancel = parent::cancel($key); - - if ($cancel) - { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false - ) - ); - } - return $cancel; - } - - /** - * Method to save a record. - * - * @param string $key The name of the primary key of the URL variable. - * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). - * - * @return boolean True if successful, false otherwise. - * - * @since 12.2 - */ - public function save($key = null, $urlVar = null) - { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - if ($this->ref || $this->refid) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } - - $saved = parent::save($key, $urlVar); - - if ($this->refid && $saved) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref && $saved) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - return $saved; - } - - /** - * Function that allows child controller access to model data - * after the data has been saved. - * - * @param JModel &$model The data model object. - * @param array $validData The validated data. - * - * @return void - * - * @since 11.1 - */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) - { - return; - } - -} diff --git a/admin/controllers/regions.php b/admin/controllers/regions.php deleted file mode 100644 index a28a251..0000000 --- a/admin/controllers/regions.php +++ /dev/null @@ -1,97 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - -/** - * Regions Controller - */ -class MembersmanagerControllerRegions extends JControllerAdmin -{ - protected $text_prefix = 'COM_MEMBERSMANAGER_REGIONS'; - /** - * Proxy for getModel. - * @since 2.5 - */ - public function getModel($name = 'Region', $prefix = 'MembersmanagerModel', $config = array()) - { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; - } - - public function exportData() - { - // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // check if export is allowed for this user. - $user = JFactory::getUser(); - if ($user->authorise('region.export', 'com_membersmanager') && $user->authorise('core.export', 'com_membersmanager')) - { - // Get the input - $input = JFactory::getApplication()->input; - $pks = $input->post->get('cid', array(), 'array'); - // Sanitize the input - JArrayHelper::toInteger($pks); - // Get the model - $model = $this->getModel('Regions'); - // get the data to export - $data = $model->getExportData($pks); - if (MembersmanagerHelper::checkArray($data)) - { - // now set the data to the spreadsheet - $date = JFactory::getDate(); - MembersmanagerHelper::xls($data,'Regions_'.$date->format('jS_F_Y'),'Regions exported ('.$date->format('jS F, Y').')','regions'); - } - } - // Redirect to the list screen with error. - $message = JText::_('COM_MEMBERSMANAGER_EXPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=regions', false), $message, 'error'); - return; - } - - - public function importData() - { - // Check for request forgeries - JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); - // check if import is allowed for this user. - $user = JFactory::getUser(); - if ($user->authorise('region.import', 'com_membersmanager') && $user->authorise('core.import', 'com_membersmanager')) - { - // Get the import model - $model = $this->getModel('Regions'); - // get the headers to import - $headers = $model->getExImPortHeaders(); - if (MembersmanagerHelper::checkObject($headers)) - { - // Load headers to session. - $session = JFactory::getSession(); - $headers = json_encode($headers); - $session->set('region_VDM_IMPORTHEADERS', $headers); - $session->set('backto_VDM_IMPORT', 'regions'); - $session->set('dataType_VDM_IMPORTINTO', 'region'); - // Redirect to import view. - $message = JText::_('COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_REGIONS'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=import', false), $message); - return; - } - } - // Redirect to the list screen with error. - $message = JText::_('COM_MEMBERSMANAGER_IMPORT_FAILED'); - $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=regions', false), $message, 'error'); - return; - } -} diff --git a/admin/controllers/type.php b/admin/controllers/type.php index 6149e03..5e47941 100644 --- a/admin/controllers/type.php +++ b/admin/controllers/type.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controllerform library -jimport('joomla.application.component.controllerform'); - /** * Type Controller */ @@ -29,6 +26,13 @@ class MembersmanagerControllerType extends JControllerForm */ protected $task; + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ public function __construct($config = array()) { $this->view_list = 'Types'; // safeguard for setting the return view listing to the main view. @@ -46,14 +50,17 @@ class MembersmanagerControllerType extends JControllerForm */ protected function allowAdd($data = array()) { + // Get user object. + $user = JFactory::getUser(); // Access check. - $access = JFactory::getUser()->authorise('type.access', 'com_membersmanager'); + $access = $user->authorise('type.access', 'com_membersmanager'); if (!$access) { return false; } + // In the absense of better information, revert to the component permissions. - return JFactory::getUser()->authorise('type.create', $this->option); + return $user->authorise('type.create', $this->option); } /** @@ -127,42 +134,25 @@ class MembersmanagerControllerType extends JControllerForm * * @return string The arguments to append to the redirect URL. * - * @since 12.2 + * @since 1.6 */ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { - $tmpl = $this->input->get('tmpl'); - $layout = $this->input->get('layout', 'edit', 'string'); + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); - // Setup redirect info. - - $append = ''; - - if ($refid) + // set the referral options + if ($refid && $ref) { - $append .= '&ref='.(string)$ref.'&refid='.(int)$refid; + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; } elseif ($ref) { - $append .= '&ref='.(string)$ref; - } - - if ($tmpl) - { - $append .= '&tmpl=' . $tmpl; - } - - if ($layout) - { - $append .= '&layout=' . $layout; - } - - if ($recordId) - { - $append .= '&' . $urlVar . '=' . $recordId; + $append = '&ref='. (string)$ref . $append; } return $append; @@ -201,43 +191,45 @@ class MembersmanagerControllerType extends JControllerForm */ public function cancel($key = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); $cancel = parent::cancel($key); - if ($cancel) + if (!is_null($return) && JUri::isInternal(base64_decode($return))) { - if ($this->refid) - { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - } - else - { - // Redirect to the items screen. + // Redirect to the return value. $this->setRedirect( JRoute::_( - 'index.php?option=' . $this->option . '&view=' . $this->view_list, false + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false ) ); } @@ -256,11 +248,15 @@ class MembersmanagerControllerType extends JControllerForm */ public function save($key = null, $urlVar = null) { - // get the referal details - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); - if ($this->ref || $this->refid) + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) { // to make sure the item is checkedin on redirect $this->task = 'save'; @@ -268,9 +264,22 @@ class MembersmanagerControllerType extends JControllerForm $saved = parent::save($key, $urlVar); - if ($this->refid && $saved) + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) { - $redirect = '&view='.(string)$this->ref.'&layout=edit&id='.(int)$this->refid; + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; // Redirect to the item screen. $this->setRedirect( @@ -279,9 +288,9 @@ class MembersmanagerControllerType extends JControllerForm ) ); } - elseif ($this->ref && $saved) + elseif ($this->ref) { - $redirect = '&view='.(string)$this->ref; + $redirect = '&view=' . (string)$this->ref; // Redirect to the list screen. $this->setRedirect( diff --git a/admin/controllers/types.php b/admin/controllers/types.php index 1412760..7a2f7f6 100644 --- a/admin/controllers/types.php +++ b/admin/controllers/types.php @@ -12,24 +12,33 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla controlleradmin library -jimport('joomla.application.component.controlleradmin'); - /** * Types Controller */ class MembersmanagerControllerTypes extends JControllerAdmin { - protected $text_prefix = 'COM_MEMBERSMANAGER_TYPES'; /** - * Proxy for getModel. - * @since 2.5 + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 */ - public function getModel($name = 'Type', $prefix = 'MembersmanagerModel', $config = array()) + protected $text_prefix = 'COM_MEMBERSMANAGER_TYPES'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Type', $prefix = 'MembersmanagerModel', $config = array('ignore_request' => true)) { - $model = parent::getModel($name, $prefix, array('ignore_request' => true)); - - return $model; + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -93,5 +102,5 @@ class MembersmanagerControllerTypes extends JControllerAdmin $message = JText::_('COM_MEMBERSMANAGER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_membersmanager&view=types', false), $message, 'error'); return; - } + } } diff --git a/admin/helpers/membersmanager.php b/admin/helpers/membersmanager.php index a96dd2b..dfd64ff 100644 --- a/admin/helpers/membersmanager.php +++ b/admin/helpers/membersmanager.php @@ -25,13 +25,273 @@ abstract class MembersmanagerHelper { // the Session keeps track of all data related to the current session of this user self::loadSession(); - } + } /** * the params **/ protected static $params; + /** + * Get placeholders + * + * @param string $type The type of placeholders to return + * + * @return array + * + */ + public static function getPlaceHolders($type) + { + if ('document' === $type) + { + // get company placeholders + if (($company = self::getCompanyDetails('placeholder')) !== false && self::checkArray($company)) + { + // just remove the footer and header placeholders + unset($company['[company_doc_header]']); + unset($company['[company_doc_footer]']); + $placeholders = array_keys($company); + return $placeholders; + } + } + return false; + } + + /** + * Add Join Tables based on filter + * + * @param object $query The database query object + * @param string $filter The target area that made the request + * + * @return array + * + */ + protected static function joinMemberDetails(&$query, $filter = 'none', $db = null) + { + // check if we have the DB object + if (!self::checkObject($db)) + { + // get the database object + $db = JFactory::getDBO(); + } + if ('none' === $filter) + { + // From the users table. + $query->join('LEFT', $db->quoteName('#__users', 'u') . ' ON (' . $db->quoteName('a.user') . ' = ' . $db->quoteName('u.id') . ')'); + // From the membersmanager_member table. + $query->join('LEFT', $db->quoteName('#__membersmanager_member', 'm') . ' ON (' . $db->quoteName('a.main_member') . ' = ' . $db->quoteName('m.id') . ')'); + // From the membersmanager_type table. + $query->join('LEFT', $db->quoteName('#__membersmanager_type', 't') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('t.id') . ')'); + } + } + + /** + * Get selection based on type + * + * @param string $table The main table to select + * @param string $method The type of values to return + * @param string $filter The kind of filter (to return only values required) + * @param object $db The database object + * + * @return array + * + */ + protected static function getSelection($table = 'member', $method = 'placeholder', $filter = 'none', $db = null) + { + // prep for placeholders + $f = ''; + $b = ''; + if ('placeholder' === $method) + { + $f = '[member_'; + $b = ']'; + } + // only get what we need + if ('none' === $filter) + { + // check if we have the DB object + if (!self::checkObject($db)) + { + // get the database object + $db = JFactory::getDBO(); + } + // get the database columns of this table + $columns = $db->getTableColumns("#__membersmanager_" . $table, false); + // always remove these + $remove = array('asset_id', 'checked_out', 'checked_out_time'); + // remove + foreach ($remove as $key) + { + unset($columns[$key]); + } + // prep the columns + $columns = array_keys($columns); + } + // convert the columns for query selection + $selection = array(); + foreach ($columns as $column) + { + $selection['a.' . $column] = $f . $column . $b; + } + // add joined values if needed (based on filter) + if ('member' === $table && 'none' === $filter) + { + $selection['u.name'] = $f . 'user_name' . $b; + $selection['u.email'] = $f . 'user_email' . $b; + $selection['t.name'] = $f . 'type_name' . $b; + $selection['m.user'] = $f . 'main_user' . $b; + $selection['m.name'] = $f . 'main_name' . $b; + $selection['m.email'] = $f . 'main_email' . $b; + } + return $selection; + } + + /** + * Get a user Access Types + * + * @param mix $id The the user ID/object + * @param int $type The type of access to return (1 = type, 2 = groups) + * @param object $db The database object + * + * @return mix array + * + */ + public static function getAccess($user = null, $type = 1, $db = null) + { + // get DB + if (!$db) + { + $db = JFactory::getDBO(); + } + // get user + if (!self::checkObject($user)) + { + if (is_numeric($user) && $user > 0) + { + $user = JFactory::getUser($user); + } + else + { + $user = JFactory::getUser(); + } + } + // function to setup the group array + $getGroups = function ($groups) { + // convert to array + if (self::checkJson($groups)) + { + return (array) json_decode($groups, true); + } + elseif (is_numeric($groups)) + { + return array($groups); + } + return false; + }; + // merge groups + $mergeGroups = function ($types) use($getGroups){ + $bucket = array(); + foreach ($types as $id => $groups) + { + $groups = $getGroups($groups); + if (self::checkArray($groups)) + { + foreach ($groups as $group) + { + $bucket[$group] = $group; + } + } + } + return $bucket; + }; + // check if access it needed + if (!$user->authorise('core.admin')) + { + // get all types + $query = $db->getQuery(true); + $query->select(array('a.id', 'a.groups_access')); + $query->from('#__membersmanager_type AS a'); + $db->setQuery($query); + $db->execute(); + // get all types + $types = $db->loadAssocList('id', 'groups_access'); + if (self::checkArray($types)) + { + $bucket = array(); + foreach ($types as $id => $groups_access) + { + $groups_access = $getGroups($groups_access); + if (self::checkArray($groups_access) && array_intersect($groups_access, $user->groups)) + { + $bucket[$id] = $id; + } + } + // return types that this member can access + if (1 == $type && self::checkArray($bucket)) + { + return $bucket; + } + elseif (self::checkArray($bucket)) + { + // get the targeted groups + $query = $db->getQuery(true); + $query->select(array('a.id', 'a.groups_target')); + $query->from('#__membersmanager_type AS a'); + $query->where('a.id IN ('. implode(',', $bucket) . ')'); + $db->setQuery($query); + $db->execute(); + // get all types + $targettypes = $db->loadAssocList('id', 'groups_target'); + if (self::checkArray($targettypes)) + { + $targetbucket = $mergeGroups($targettypes); + // return types that this member can access + if (self::checkArray($targetbucket)) + { + return $targetbucket; + } + } + } + } + return false; + } + // return all types/groups + $query = $db->getQuery(true); + if (1 == $type) + { + $query->select(array('a.id')); + } + else + { + $query->select(array('a.id', 'a.groups_target')); + } + $query->from('#__membersmanager_type AS a'); + $db->setQuery($query); + $db->execute(); + if (1 == $type) + { + return $db->loadColumn(); + } + // get all types with group target + $types = $db->loadAssocList('id', 'groups_target'); + if (self::checkArray($types)) + { + $bucket = $mergeGroups($types); + // return types that this member can access + if (self::checkArray($bucket)) + { + return $bucket; + } + } + // return all groups + $query = $db->getQuery(true); + $query->select(array('a.id')); + $query->from('#__usergroups AS a'); + $db->setQuery($query); + $db->execute(); + return $db->loadColumn(); + } + /** * set the session defaults if not set **/ @@ -41,6 +301,65 @@ abstract class MembersmanagerHelper return true; } + /** + * Change to nice fancy date + */ + public static function fancyDate($date) + { + if (!self::isValidTimeStamp($date)) + { + $date = strtotime($date); + } + return date('jS \o\f F Y',$date); + } + + /** + * Change to nice fancy day time and date + */ + public static function fancyDayTimeDate($time) + { + if (!self::isValidTimeStamp($time)) + { + $time = strtotime($time); + } + return date('D ga jS \o\f F Y',$time); + } + + /** + * Change to nice fancy time and date + */ + public static function fancyDateTime($time) + { + if (!self::isValidTimeStamp($time)) + { + $time = strtotime($time); + } + return date('(G:i) jS \o\f F Y',$time); + } + + /** + * Change to nice hour:minutes time + */ + public static function fancyTime($time) + { + if (!self::isValidTimeStamp($time)) + { + $time = strtotime($time); + } + return date('G:i',$time); + } + + /** + * Check if string is a valid time stamp + */ + public static function isValidTimeStamp($timestamp) + { + return ((int) $timestamp === $timestamp) + && ($timestamp <= PHP_INT_MAX) + && ($timestamp >= ~PHP_INT_MAX); + } + + /** * the Butler **/ @@ -91,18 +410,564 @@ abstract class MembersmanagerHelper /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found + * prepare base64 string for url + **/ + public static function base64_urlencode($string, $encode = false) + { + if ($encode) + { + $string = base64_encode($string); + } + return str_replace(array('+', '/'), array('-', '_'), $string); + } + + /** + * prepare base64 string form url + **/ + public static function base64_urldecode($string, $decode = false) + { + $string = str_replace(array('-', '_'), array('+', '/'), $string); + if ($decode) + { + $string = base64_decode($string); + } + return $string; + } + + + /** + * the locker * - * @return string On success the path or url is returned based on the type requested + * @var array + **/ + protected static $locker = array(); + + /** + * the dynamic replacement salt + * + * @var array + **/ + protected static $globalSalt = array(); + + /** + * the timer + * + * @var object + **/ + protected static $keytimer; + + /** + * To Lock string + * + * @param string $string The string/array to lock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url encoding + * + * @return string Encrypted String + * + **/ + public static function lock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + { + // get the global settings + if (!$key || !self::checkString($key)) + { + // set temp timer + $timer = 2; + // if we have a timer use it + if ($salt > 0) + { + $timer = $salt; + } + // set the default key + $key = self::salt($timer, $dynamic); + // try getting the system key + if (method_exists(get_called_class(), "getCryptKey")) + { + // try getting the medium key first the fall back to basic, and then default + $key = self::getCryptKey('medium', self::getCryptKey('basic', $key)); + } + } + // check if we have a salt timer + if ($salt > 0) + { + $key .= self::salt($salt, $dynamic); + } + // get the locker settings + if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + { + self::$locker[$key] = new FOFEncryptAes($key, 128); + } + // convert array or object to string + if (self::checkArray($string) || self::checkObject($string)) + { + $string = serialize($string); + } + // prep for url + if ($urlencode && method_exists(get_called_class(), "base64_urlencode")) + { + return self::base64_urlencode(self::$locker[$key]->encryptString($string)); + } + return self::$locker[$key]->encryptString($string); + } + + /** + * To un-Lock string + * + * @param string $string The string to unlock + * @param string $key The custom key to use + * @param int $salt The switch to add salt and type of salt + * @param int $dynamic The dynamic replacement array of salt build string + * @param int $urlencode The switch to control url decoding + * + * @return string Decrypted String + * + **/ + public static function unlock($string, $key = null, $salt = 2, $dynamic = null, $urlencode = true) + { + // get the global settings + if (!$key || !self::checkString($key)) + { + // set temp timer + $timer = 2; + // if we have a timer use it + if ($salt > 0) + { + $timer = $salt; + } + // set the default key + $key = self::salt($timer, $dynamic); + // try getting the system key + if (method_exists(get_called_class(), "getCryptKey")) + { + // try getting the medium key first the fall back to basic, and then default + $key = self::getCryptKey('medium', self::getCryptKey('basic', $key)); + } + } + // check if we have a salt timer + if ($salt > 0) + { + $key .= self::salt($salt, $dynamic); + } + // get the locker settings + if (!isset(self::$locker[$key]) || !self::checkObject(self::$locker[$key])) + { + self::$locker[$key] = new FOFEncryptAes($key, 128); + } + // make sure we have real base64 + if ($urlencode && method_exists(get_called_class(), "base64_urldecode")) + { + $string = self::base64_urldecode($string); + } + // basic decrypt string. + if (!empty($string) && !is_numeric($string) && $string === base64_encode(base64_decode($string, true))) + { + $string = rtrim(self::$locker[$key]->decryptString($string), "\0"); + // convert serial string to array + if (self::is_serial($string)) + { + $string = unserialize($string); + } + } + return $string; + } + + /** + * The Salt + * + * @param int $type The type of length the salt should be valid + * @param int $dynamic The dynamic replacement array of salt build string + * + * @return string + * + **/ + public static function salt($type = 1, $dynamic = null) + { + // get dynamic replacement salt + $dynamic = self::getDynamicSalt($dynamic); + // get the key timer + if (!self::checkObject(self::$keytimer)) + { + // load the date time object + self::$keytimer = new DateTime; + // set the correct time stamp + $vdmLocalTime = new DateTimeZone('Africa/Windhoek'); + self::$keytimer->setTimezone($vdmLocalTime); + } + // set type + if ($type == 2) + { + // hour + $format = 'Y-m-d \o\n ' . self::periodFix(self::$keytimer->format('H')); + } + elseif ($type == 3) + { + // day + $format = 'Y-m-' . self::periodFix(self::$keytimer->format('d')); + } + elseif ($type == 4) + { + // month + $format = 'Y-' . self::periodFix(self::$keytimer->format('m')); + } + else + { + // minute + $format = 'Y-m-d \o\n H:' . self::periodFix(self::$keytimer->format('i')); + } + // get key + if (self::checkArray($dynamic)) + { + return md5(str_replace(array_keys($dynamic), array_values($dynamic), self::$keytimer->format($format) . ' @ VDM.I0')); + } + return md5(self::$keytimer->format($format) . ' @ VDM.I0'); + } + + /** + * The function to insure the salt is valid within the given period (third try) + * + * @param int $main The main number + */ + protected static function periodFix($main) + { + return round($main / 3) * 3; + } + + /** + * Check if a string is serialized + * + * @param string $string + * + * @return Boolean + * + */ + public static function is_serial($string) + { + return (@unserialize($string) !== false); + } + + /** + * Get dynamic replacement salt + */ + public static function getDynamicSalt($dynamic = null) + { + // load global if not manually set + if (!self::checkArray($dynamic)) + { + return self::getGlobalSalt(); + } + // return manual values if set + else + { + return $dynamic; + } + } + + /** + * The random or dynamic secret salt + */ + public static function getSecretSalt($string = null, $size = 9) + { + // set the string + if (!$string) + { + // get random string + $string = self::randomkey($size); + } + // convert string to array + $string = self::safeString($string); + // convert string to array + $array = str_split($string); + // insure only unique values are used + $array = array_unique($array); + // set the size + $size = ($size <= count($array)) ? $size : count($array); + // down size the + return array_slice($array, 0, $size); + } + + /** + * Get global replacement salt + */ + public static function getGlobalSalt() + { + // load from memory if found + if (!self::checkArray(self::$globalSalt)) + { + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_membersmanager'); + } + // check if we have a global dynamic replacement array available (format --> ' 1->!,3->E,4->A') + $tmp = self::$params->get('dynamic_salt', null); + if (self::checkString($tmp) && strpos($tmp, ',') !== false && strpos($tmp, '->') !== false) + { + $salt = array_map('trim', (array) explode(',', $tmp)); + if (self::checkArray($salt )) + { + foreach($salt as $replace) + { + $dynamic = array_map('trim', (array) explode('->', $replace)); + if (isset($dynamic[0]) && isset($dynamic[1])) + { + self::$globalSalt[$dynamic[0]] = $dynamic[1]; + } + } + } + } + } + // return global if found + if (self::checkArray(self::$globalSalt)) + { + return self::$globalSalt; + } + // return default as fail safe + return array('1' => '!', '3' => 'E', '4' => 'A'); + } + + /** + * Close public protocol + */ + public static function closePublicProtocol($id, $public) + { + // get secret salt + $secretSalt = self::getSecretSalt(self::salt(1,array('4' => 'R','1' => 'E','2' => 'G','7' => 'J','8' => 'A'))); + // get the key + $key = self::salt(1, $secretSalt); + // get secret salt + $secret = self::getSecretSalt(); + // set the secret + $close['SECRET'] = self::lock($secret, $key, 1, array('1' => 's', '3' => 'R', '4' => 'D')); + // get the key + $key = self::salt(1, $secret); + // get the public key + $close['PUBLIC'] = self::lock($public, $key, 1, array('1' => '!', '3' => 'E', '4' => 'A')); + // get secret salt + $secretSalt = self::getSecretSalt($public); + // get the key + $key = self::salt(1, $secretSalt); + // get the ID + $close['ID'] = self::unlock($id, $key, 1, array('1' => 'i', '3' => 'e', '4' => 'B')); + // return closed values + return $close; + } + + /** + * Open public protocol + */ + public static function openPublicProtocol($SECRET, $ID, $PUBLIC) + { + // get secret salt + $secretSalt = self::getSecretSalt(self::salt(1,array('4' => 'R','1' => 'E','2' => 'G','7' => 'J','8' => 'A'))); + // get the key + $key = self::salt(1, $secretSalt); + // get the $SECRET + $SECRET = self::unlock($SECRET, $key, 1, array('1' => 's', '3' => 'R', '4' => 'D')); + // get the key + $key = self::salt(1, $SECRET); + // get the public key + $open['public'] = self::unlock($PUBLIC, $key, 1, array('1' => '!', '3' => 'E', '4' => 'A')); + // get secret salt + $secretSalt = self::getSecretSalt($open['public']); + // get the key + $key = self::salt(1, $secretSalt); + // get the ID + $open['id'] = self::unlock($ID, $key, 1, array('1' => 'i', '3' => 'e', '4' => 'B')); + // return opened values + return $open; + } + + protected static $dynamicData = array(); + + public static function setDynamicData($data, $placeholders) + { + $keyMD5 = md5($data.json_encode($placeholders)); + if (!isset(self::$dynamicData[$keyMD5])) + { + if (self::checkArray($placeholders)) + { + self::setTheIF($data, $placeholders); + self::$dynamicData[$keyMD5] = str_replace(array_keys($placeholders), array_values($placeholders), $data); + } + else + { + self::$dynamicData[$keyMD5] = $data; + } + } + return self::$dynamicData[$keyMD5]; + } + + protected static function setTheIF(&$string, $placeholders) + { + // only normal if endif + $condition = '[a-z0-9\_\-]+'; + $inner = '((?:(?!\[\/?IF)(?!\[\/?ELSE)(?!\[\/?ELSEIF).)*?)'; + $if = '\[IF\s?('.$condition.')\]'; + $elseif = '\[ELSEIF\s?('.$condition.')\]'; + $else = '\[ELSE\]'; + $endif = '\[ENDIF\]'; + // set the patterns + $patterns = array(); + // normal if endif + $patterns[] = '#'.$if.$inner.$endif.'#is'; + // normal if else endif + $patterns[] = '#'.$if.$inner.$else.$inner.$endif.'#is'; + // dynamic if elseif's endif + $patterns[] = '#'.$if.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$endif.'#is'; + // dynamic if elseif's else endif + $patterns[] = '#'.$if.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + $patterns[] = '#'.$if.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$elseif.$inner.$else.$inner.$endif.'#is'; + // run the patterns to setup the string + foreach ($patterns as $pattern) + { + while (preg_match($pattern, $string, $match)) + { + $keep = self::remainderIF($match, $placeholders); + $string = preg_replace($pattern, $keep, $string, 1); + } + } + } + + protected static function remainderIF(&$match, &$placeholders) + { + // default we keep nothing + $keep = ''; + $found = false; + // get match lenght + $length = count($match); + // ranges to check + $ii = range(2,30,2); // even numbers (content) + $iii = range(1, 25, 2); // odd numbers (placeholder) + // if empty value remove whole line else show line but remove all [CODE] + foreach ($iii as $content => $placeholder) + { + if (isset($match[$placeholder]) && empty($placeholders['['.$match[$placeholder].']'])) + { + // keep nothing or next option + $keep = ''; + } + elseif (isset($match[$ii[$content]])) + { + $keep = addcslashes($match[$ii[$content]], '$'); + $found = true; + break; + } + } + // if not found load else if set + if (!$found && in_array($length, $ii)) + { + $keep = addcslashes($match[$length - 1], '$'); + } + return $keep; + } + + + /** + * The Global Templates Field + **/ + protected static $templates = array(); + + /** + * Get The Template + **/ + public static function getTemplate($type, $default = null, $target = 'global') + { + // set global key + $key = md5(json_encode($type).$default.$target); + // check if we already have the template set + if (!isset(self::$templates[$key])) + { + // get the template from the global settings + if ('global' === $target && self::checkString($type)) + { + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_membersmanager'); + } + self::$templates[$key] = self::$params->get($type, $default); + } + // get the template from template view + elseif (self::checkArray($type) && isset($type['value']) && isset($type['target']) && isset($type['get'])) + { + if (self::$templates[$key] = self::getVar($target, $type['value'], $type['target'], $type['get'])) + { + // check if we should decode + if (isset($type['decode'])) + { + if ('json_array' === $type['decode']) + { + self::$templates[$key] = json_decode(self::$templates[$key], true); + } + elseif ('json' === $type['decode']) + { + self::$templates[$key] = json_decode(self::$templates[$key]); + } + elseif ('base64' === $type['decode']) + { + self::$templates[$key] = base64_decode(self::$templates[$key]); + } + } + } + else + { + // set the default + self::$templates[$key] = $default; + } + } + } + // check if we still have array or object + if (isset(self::$templates[$key]) && (self::checkArray(self::$templates[$key]) || self::checkObject(self::$templates[$key]))) + { + self::$templates[$key] = implode("\n", (array) self::$templates[$key]); + } + // return the template if found + if (isset(self::$templates[$key]) && self::checkString(self::$templates[$key])) + { + return self::$templates[$key]; + } + // convert to string if array + if (self::checkArray($type)) + { + $type = implode(', ', $type); + } + return JText::sprintf('COM_MEMBERSMANAGER_NO_TEMPLATE_FOR_BSB_WERE_FOUND', self::safeString($type, 'w')); + } + + + /** + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested * */ - public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true) + public static function getFolderPath($type = 'path', $target = 'folderpath', $default = '', $createIfNotSet = true) { + // make sure to always have a string/path + if(!self::checkString($default)) + { + $default = JPATH_SITE . '/images/'; + } // get the global settings if (!self::checkObject(self::$params)) { @@ -368,78 +1233,1996 @@ abstract class MembersmanagerHelper } /** - * Get the edit button + * Get an edit button * - * @param int $item The item to edit - * @param string $view The type of item to edit - * @param string $views The list view controller name - * @param string $ref The return path + * @param int $item The item to edit + * @param string $view The type of item to edit + * @param string $views The list view controller name + * @param string $ref The return path + * @param string $component The component these views belong to * @param string $headsup The message to show on click of button * * @return string On success the full html edit button * */ - public static function getEditButton(&$item, $view, $views, $ref = '', $headsup = 'COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE') + public static function getEditButton(&$item, $view, $views, $ref = '', $component = 'com_membersmanager', $headsup = 'COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE') { - // check that we have the ID - if (self::checkObject($item) && isset($item->id)) + // get URL + $url = self::getEditURL($item, $view, $views, $ref, $component); + // check if we found any + if (self::checkString($url)) { - $id = (int) $item->id; - // check if the checked_out is available - if (isset($item->checked_out)) + // get the global settings + if (!self::checkObject(self::$params)) { - $checked_out = (int) $item->checked_out; + self::$params = JComponentHelper::getParams('com_membersmanager'); } - } - elseif (self::checkArray($item) && isset($item['id'])) - { - $id = (int) $item['id']; - // check if the checked_out is available - if (isset($item['checked_out'])) + // get UIKIT version + $uikit = self::$params->get('uikit_version', 2); + // check that we have the ID + if (self::checkObject($item) && isset($item->id)) { - $checked_out = (int) $item['checked_out']; - } - } - elseif (is_numeric($item)) - { - $id = (int) $item; - } - // check ID - if (isset($id) && $id > 0) - { - // can edit - if (JFactory::getUser()->authorise($view.'.edit', 'com_membersmanager.'.$view.'.' . (int) $id)) - { - // set the edit link - $edit = "index.php?option=com_membersmanager&view=".$views."&task=".$view.".edit&id=".$id.$ref; - // set the link title - $title = self::safeString(JText::_('COM_MEMBERSMANAGER_EDIT').' '.$view, 'W'); - // check that there is a check message - if (self::checkString($headsup)) + // check if the checked_out is available + if (isset($item->checked_out)) { - $href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $edit . '\' })" href="javascript:void(0)"'; + $checked_out = (int) $item->checked_out; + } + } + elseif (self::checkArray($item) && isset($item['id'])) + { + // check if the checked_out is available + if (isset($item['checked_out'])) + { + $checked_out = (int) $item['checked_out']; + } + } + // set the link title + $title = self::safeString(JText::_('COM_MEMBERSMANAGER_EDIT') . ' ' . $view, 'W'); + // check that there is a check message + if (self::checkString($headsup)) + { + if (3 == $uikit) + { + $href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"'; } else { - $href = 'href="' . $edit . '"'; + $href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"'; } + } + else + { + $href = 'href="' . $url . '"'; + } + // return UIKIT version 3 + if (3 == $uikit) + { // check if it is checked out if (isset($checked_out) && $checked_out > 0) { // is this user the one who checked it out if ($checked_out == JFactory::getUser()->id) { - return ' '; + return ' '; } - return ' '; + return ' '; } // return normal edit link - return ' '; + return ' '; + } + // check if it is checked out (return UIKIT version 2) + if (isset($checked_out) && $checked_out > 0) + { + // is this user the one who checked it out + if ($checked_out == JFactory::getUser()->id) + { + return ' '; + } + return ' '; + } + // return normal edit link + return ' '; + } + return ''; + } + + /** + * Get the edit URL + * + * @param int $item The item to edit + * @param string $view The type of item to edit + * @param string $views The list view controller name + * @param string $ref The return path + * @param string $component The component these views belong to + * @param bool $jRoute The switch to add use JRoute or not + * + * @return string On success the edit url + * + */ + public static function getEditURL(&$item, $view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true) + { + // build record + $record = new stdClass(); + // check that we have the ID + if (self::checkObject($item) && isset($item->id)) + { + $record->id = (int) $item->id; + // check if created_by is available + if (isset($item->created_by) && $item->created_by > 0) + { + $record->created_by = (int) $item->created_by; + } + } + elseif (self::checkArray($item) && isset($item['id'])) + { + $record->id = (int) $item['id']; + // check if created_by is available + if (isset($item['created_by']) && $item['created_by'] > 0) + { + $record->created_by = (int) $item['created_by']; + } + } + elseif (is_numeric($item)) + { + $record->id = (int) $item; + } + // check ID + if (isset($record->id) && $record->id > 0) + { + // get user action permission to edit + $action = self::getActions($view, $record, $views, 'edit', str_replace('com_', '', $component)); + // can edit + if ($action->get($view . '.edit')) + { + // set the edit link + if ($jRoute) + { + return JRoute::_("index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $record->id . $ref); + } + return "index.php?option=" . $component . "&view=" . $views . "&task=" . $view . ".edit&id=" . $record->id . $ref; + } + } + return false; + } + + + /** + * Get a create button + * + * @param string $view The type of item to edit + * @param string $views The list view controller name + * @param string $ref The return path + * @param string $component The component these views belong to + * @param string $headsup The message to show on click of button + * + * @return string On success the full html create button + * + */ + public static function getCreateButton($view, $views, $ref = '', $component = 'com_membersmanager', $headsup = 'COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE') + { + // get URL + $url = self::getCreateURL($view, $views, $ref, $component); + // check if we found any + if (self::checkString($url)) + { + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_membersmanager'); + } + // get UIKIT version + $uikit = self::$params->get('uikit_version', 2); + // set the link title + $title = self::safeString(JText::_('COM_MEMBERSMANAGER_ADD') . ' ' . $view, 'W'); + // check that there is a check message + if (self::checkString($headsup)) + { + if (3 == $uikit) + { + $href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"'; + } + else + { + $href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"'; + } + } + else + { + $href = 'href="' . $url . '"'; + } + // return normal create new link + return ' ' . JText::_('COM_MEMBERSMANAGER_NEW') . ''; + } + return ''; + } + + /** + * Get the create URL + * + * @param string $view The type of item to edit + * @param string $views The list view controller name + * @param string $ref The return path + * @param string $component The component these views belong to + * @param bool $jRoute The switch to add use JRoute or not + * + * @return string On success the create url + * + */ + public static function getCreateURL($view, $views, $ref = '', $component = 'com_membersmanager', $jRoute = true) + { + // can create + if (JFactory::getUser()->authorise($view . '.create', $component)) + { + // set create task + $create = "&task=" . $view . ".edit"; + // check if this button must work with task or layout + if ($views === $view) + { + // set layout edit + $create = "&layout=edit"; + } + // set the edit link + if ($jRoute) + { + return JRoute::_("index.php?option=" . $component . "&view=" . $views . $create . $ref); + } + return "index.php?option=" . $component . "&view=" . $views . $create . $ref; + } + return false; + } + + + /** + * Check if a field is unique + * + * @param int $currentID The current item ID + * @param string $field The field name + * @param array $value The the value + * @param array $table The table + * + * @return bool + * + */ + public static function checkUnique($currentID, $field, $value, $table) + { + // make sure we have a table + if (self::checkString($table)) + { + // Get the database object and a new query object. + $db = \JFactory::getDbo(); + $query = $db->getQuery(true); + // Build the query. + $query->select('COUNT(*)') + ->from('#__membersmanager_' . (string) $table) + ->where($db->quoteName($field) . ' = ' . $db->quote($value)); + // remove this item from the list + if ($currentID > 0) + { + $query->where($db->quoteName('id') . ' <> ' . (int) $currentID); + } + // Set and query the database. + $db->setQuery($query); + $duplicate = (bool) $db->loadResult(); + if (!$duplicate) + { + return true; + } + } + return false; + } + + + /** + * The memory of the company details + * + * @var array + */ + protected static $companyDetails = array(); + + /** + * Get company details + * + * @param string $method The type of values to return + * @param string $filter The kind of filter (to return only values required) + * + * @return array/object based on $method + * + */ + public static function getCompanyDetails($method = 'array', $filter = null) + { + if (!isset(self::$companyDetails[$method])) + { + $f = ''; + $b = ''; + if ('placeholder' == $method) + { + $f = '['; + $b = ']'; + } + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_membersmanager'); + } + // get the logo + $logo = self::$params->get('companylogo', self::$params->get('logo', null)); + // start loading the company details + self::$companyDetails[$method] = array(); + self::$companyDetails[$method][$f.'company_name'.$b] = self::$params->get('companyname', self::$params->get('name', '')); + // only lod logo if found + if ($logo) + { + self::$companyDetails[$method][$f.'company_logo'.$b] = ''.self::$companyDetails[$method][$f.'company_name'.$b].''; + self::$companyDetails[$method][$f.'company_logo_link'.$b] = JURI::root().$logo; + } + else + { + self::$companyDetails[$method][$f.'company_logo'.$b] = ''; + self::$companyDetails[$method][$f.'company_logo_link'.$b] = ''; + } + self::$companyDetails[$method][$f.'company_email'.$b] = self::$params->get('email', ''); + self::$companyDetails[$method][$f.'company_phone'.$b] = self::$params->get('phone', ''); + self::$companyDetails[$method][$f.'company_mobile'.$b] = self::$params->get('mobile_phone', ''); + self::$companyDetails[$method][$f.'company_street'.$b] = self::$params->get('street', ''); + self::$companyDetails[$method][$f.'company_postal'.$b] = self::$params->get('postal', ''); + self::$companyDetails[$method][$f.'company_postalcode'.$b] = self::$params->get('postalcode', ''); + self::$companyDetails[$method][$f.'company_city'.$b] = self::$params->get('city', ''); + self::$companyDetails[$method][$f.'company_website'.$b] = self::$params->get('website', ''); + // set the region + $region = self::$params->get('region', ''); + if ($region && !is_numeric($region) && self::checkString($region)) + { + // set the region name + self::$companyDetails[$method][$f.'company_region_name'.$b] = $region; + // just set this incase + self::$companyDetails[$method][$f.'company_region'.$b] = $region; + } + elseif (is_numeric($region) && $region > 0) + { + // set the region name + self::$companyDetails[$method][$f.'company_region_name'.$b] = self::getVar('region', $region, 'id', 'name'); + // just set this incase + self::$companyDetails[$method][$f.'company_region'.$b] = ''; + } + else + { + // set the region name to blank + self::$companyDetails[$method][$f.'company_region_name'.$b] = ''; + // just set this incase + self::$companyDetails[$method][$f.'company_region'.$b] = ''; + } + // set the country + $country = self::$params->get('country', ''); + if ($country && !is_numeric($country) && self::checkString($country)) + { + // set the country name + self::$companyDetails[$method][$f.'company_country_name'.$b] = $country; + // just set this incase + self::$companyDetails[$method][$f.'company_country'.$b] = $country; + } + elseif (is_numeric($country) && $country > 0) + { + // set the country name + self::$companyDetails[$method][$f.'company_country_name'.$b] = self::getVar('country', $country, 'id', 'name'); + // just set this incase + self::$companyDetails[$method][$f.'company_country'.$b] = ''; + } + else + { + // set the country name to blank + self::$companyDetails[$method][$f.'company_country_name'.$b] = ''; + // just set this incase + self::$companyDetails[$method][$f.'company_country'.$b] = ''; + } + // add and update the header footer and header if setDynamicData is found on placeholder request + if (method_exists(__CLASS__, 'setDynamicData') && 'placeholder' == $method) + { + // add document header and footer + self::$companyDetails[$method][$f.'company_doc_header'.$b] = self::setDynamicData(self::$params->get('doc_header', ''), self::$companyDetails[$method]); + self::$companyDetails[$method][$f.'company_doc_footer'.$b] = self::setDynamicData(self::$params->get('doc_footer', ''), self::$companyDetails[$method]); + } + // if object is called for + if ('object' == $method) + { + self::$companyDetails[$method] = (object) self::$companyDetails[$method]; + } + } + // return the values + if (!isset(self::$companyDetails[$method])) + { + self::$companyDetails[$method] = false; + } + return self::$companyDetails[$method]; + } + + /** + * get a report + * + * @param int $id The item ID + * @param string $component The component being targeted + * + * @return string + * + */ + public static function getReport($id, $_component = 'com_membersmanager') + { + // check if user are allowed to view this report + if ($id > 0 && JFactory::getUser()->authorise('form.report.viewtab', $_component)) + { + // get template + if (($template = self::getAnyTemplate($_component, 'profile_report_template')) === false || !self::checkString($template)) + { + return false; + } + // start loading the placeholders + $placeholders = array(); + // get form placeholders + if (($form = self::getAnyFormDetails($id, 'id', $_component, 'placeholder', 'report', 'id')) !== false && self::checkArray($form)) + { + $placeholders[] = $form; + } + // get company placeholders + if (($company = self::getAnyCompanyDetails('com_membersmanager', 'placeholder')) !== false && self::checkArray($company)) + { + $placeholders[] = $company; + } + // check that we have placeholders + if (self::checkArray($placeholders)) + { + // set placeholders + $placeholders = self::mergeArrays($placeholders); + // get the ID + $divID = self::randomkey(10); + // return html + return '
' . + self::setDynamicData($template, $placeholders) . + '
'; + } + } + return false; + } + + + /** + * Get Any template details + * + * @param string $_component The component element name + * @param string $type The type of template + * @param string $default The default if not found + * @param string $target The target + * + * @return string + * + */ + public static function getAnyTemplate($_component = 'com_membersmanager', $type, $default = null, $target = 'global') + { + // check if we are in the correct class + if ('com_membersmanager' !== $_component) + { + // get component name + $component = str_replace('com_', '', $_component); + // build component helper name + $componentHelper = self::safeString($component, 'F') . 'Helper'; + // check if it is already set + if (!class_exists($componentHelper, FALSE)) + { + // set the correct path focus + $focus = JPATH_ADMINISTRATOR; + if (JFactory::getApplication()->isSite()) + { + // set admin path + $adminPath = $focus . '/components/' . $_component . '/helpers/' . $component . '.php'; + // change the focus + $focus = JPATH_ROOT; + } + // set path based on focus + $path = $focus . '/components/' . $_component . '/helpers/' . $component . '.php'; + // check if file exist, if not try admin again. + if (file_exists($path)) + { + // make sure to load the helper + JLoader::register($componentHelper, $path); + } + elseif (isset($adminPath) && file_exists($adminPath)) // fallback option + { + // make sure to load the helper + JLoader::register($componentHelper, $adminPath); + } + } + // check if the class and method exist + if (class_exists($componentHelper) && method_exists($componentHelper, 'getTemplate')) + { + return $componentHelper::getTemplate($type, $default, $target); + } + return false; + } + // check if the class and method exist + elseif (method_exists(__CLASS__, 'getTemplate')) + { + return self::getTemplate($type, $default, $target); + } + return false; + } + + + /** + * Get Any form details + * + * @param int $memberID The item ID + * @param string $type The type of ID + * @param string $_component The component element name + * @param string $method The type of values to return + * @param string $filter The kind of filter (to return only values required) + * @param string $masterkey The master key + * + * @return array/object based on $method + * + */ + public static function getAnyFormDetails($memberID, $type = 'member', $_component = 'com_membersmanager', $method = 'array', $filter = 'none', $masterkey = 'member') + { + // check if we are in the correct class + if ('com_membersmanager' !== $_component) + { + // get component name + $component = str_replace('com_', '', $_component); + // build component helper name + $componentHelper = self::safeString($component, 'F') . 'Helper'; + // check if it is already set + if (!class_exists($componentHelper, FALSE)) + { + // set the correct path focus + $focus = JPATH_ADMINISTRATOR; + if (JFactory::getApplication()->isSite()) + { + // set admin path + $adminPath = $focus . '/components/' . $_component . '/helpers/' . $component . '.php'; + // change the focus + $focus = JPATH_ROOT; + } + // set path based on focus + $path = $focus . '/components/' . $_component . '/helpers/' . $component . '.php'; + // check if file exist, if not try admin again. + if (file_exists($path)) + { + // make sure to load the helper + JLoader::register($componentHelper, $path); + } + elseif (isset($adminPath) && file_exists($adminPath)) + { + // make sure to load the helper + JLoader::register($componentHelper, $adminPath); + } + } + // check if the class and method exist + if (class_exists($componentHelper) && method_exists($componentHelper, 'getFormDetails')) + { + return $componentHelper::getFormDetails($memberID, $type, 'form', $method, $filter, $masterkey); + } + return false; + } + // check if the class and method exist + elseif (method_exists(__CLASS__, 'getFormDetails')) + { + return self::getFormDetails($memberID, $type, 'form', $method, $filter, $masterkey); + } + return false; + } + + + /** + * Get company details from any other component + * + * @param string $_component The component name + * @param string $method The type of values to return + * @param string $filter The kind of filter (to return only values required) + * + * @return array/object based on $method + * + */ + public static function getAnyCompanyDetails($_component = 'com_membersmanager', $method = 'array', $filter = null) + { + // check if we are in the correct class + if ('com_membersmanager' !== $_component) + { + // get component name + $component = str_replace('com_', '', $_component); + // build component helper name + $componentHelper = self::safeString($component, 'F') . 'Helper'; + // check if it is already set + if (!class_exists($componentHelper, FALSE)) + { + // set the correct path focus + $focus = JPATH_ADMINISTRATOR; + if (JFactory::getApplication()->isSite()) + { + // set admin path + $adminPath = $focus . '/components/' . $_component . '/helpers/' . $component . '.php'; + // change the focus + $focus = JPATH_ROOT; + } + // set path based on focus + $path = $focus . '/components/' . $_component . '/helpers/' . $component . '.php'; + // check if file exist, if not try admin again. + if (file_exists($path)) + { + // make sure to load the helper + JLoader::register($componentHelper, $path); + } + elseif (isset($adminPath) && file_exists($adminPath)) // fallback option + { + // make sure to load the helper + JLoader::register($componentHelper, $adminPath); + } + } + // check if the class and method exist + if (class_exists($componentHelper) && method_exists($componentHelper, 'getCompanyDetails')) + { + return $componentHelper::getCompanyDetails($method, $filter); + } + return false; + } + // check if the class and method exist + elseif (method_exists(__CLASS__, 'getCompanyDetails')) + { + return self::getCompanyDetails($method, $filter); + } + return false; + } + + + /** + * Get Member forms + * + * @param int $id The item ID. + * @param string $_component The component element name + * @param string $method The type of values to return + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return array/object + * + */ + public static function getMemberForms($id = 0, $_component = 'com_membersmanager', $_model = 'form', $data = array(), $loadData = true) + { + $form = false; + // get APP + $app = JFactory::getApplication(); + // get component name + $component = str_replace('com_', '', $_component); + // build component name + $Component = self::safeString($component, 'F'); + // get old ID + $old_id = $app->input->get('a_id', 0, 'INT'); + // set the ID + $app->input->set('a_id', $id); + // get Model + $model = self::getModel($_model, JPATH_ADMINISTRATOR . '/components/' . $_component, $Component); + // do we have the model + if ($model) + { + // force other component path (TODO) will be an issue if forms and fields are the same + \JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . $_component . '/models/forms'); + \JForm::addFieldPath(JPATH_ADMINISTRATOR . '/components/' . $_component . '/models/fields'); + // we must load the data + if (!self::checkArray($data) && $id > 0) + { + $data = $model->getItem($id); + } + else + { + $loadData = false; + } + // set the form data + if ($loadData) + { + $app->setUserState($_component . '.edit.' . $_model . '.data', $data); + } + // get the form (handles all default permissions) + $form = $model->getForm($data, $loadData, array('control' => $component)); + } + // set the old ID again + $app->input->set('a_id', $old_id); + // now return form + return $form; + } + + /** + * The memory of the member details + * + * @var array + */ + protected static $memberDetails = array(); + + /** + * The global details key (set per/query) + * + * @var string + */ + protected static $k3y; + + /** + * Get member details + * + * @param int $id The the form ID + * @param string $type The type of ID + * @param string $table The table of ID + * @param string $method The type of values to return + * @param string $filter The kind of filter (to return only values required) + * @param string $masterkey The master key for many values in the member table + * + * @return array/object based on $method + * + */ + public static function getMemberDetails($id, $type = 'id', $table = 'member', $method = 'array', $filter = 'none', $masterkey = 'member') + { + // always make sure that we have a member column + if ($table !== 'member' && $type !== $masterkey) + { + // convert to master key + if (($id = self::getVar((string) $table, (int) $id, $type, $masterkey)) === false) + { + return false; + } + $type = $masterkey; + $table = 'member'; + } + // get database object + $db = JFactory::getDbo(); + // if not id validate column + if ($type !== 'id' && $type !== $masterkey) + { + // get the database columns of this table + $columns = $db->getTableColumns("#__membersmanager_member", false); + // check if the type is found + if (!isset($columns[$type])) + { + return false; + } + } + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_membersmanager'); + } + // get the relations (1 = one to one || 2 = one to many) + $relations = self::$params->get('membersmanager_relation_type', 1); + // always make sure that we have a masterkey ID + if ($relations == 2 && $type !== $masterkey) + { + // convert to masterkey ID + if (($id = self::getVar('member', (int) $id, $type, $masterkey)) === false) + { + return false; + } + // set master key as type of id + $type = $masterkey; + } + // set the global key + self::$k3y = $id.$method.$filter; + // check if we have the member details in memory + if (is_numeric($id) && $id > 0 && !isset(self::$memberDetails[self::$k3y])) + { + // get the member details an place it in memory + $query = $db->getQuery(true); + // check if we can getSelection + if (method_exists(__CLASS__, "getSelection")) + { + // Select some fields + if (($selection = self::getSelection('member', $method, $filter, $db)) !== false) + { + // strip selection values not direct SQL (does not have point) + $selection = array_filter( + $selection, + function ($key) { + return strpos($key, '.'); + }, + ARRAY_FILTER_USE_KEY + ); + } + } + // check if we have a selection + if (isset($selection) && self::checkArray($selection)) + { + // set the selection + $query->select($db->quoteName(array_keys($selection), array_values($selection))); + // From the membersmanager_member table + $query->from($db->quoteName('#__membersmanager_member', 'a')); + // check if we have more join tables for the member details + if (method_exists(__CLASS__, "joinMemberDetails")) + { + self::joinMemberDetails($query, $filter, $db); + } + // check if we have more get where details + if (method_exists(__CLASS__, "whereMemberDetails")) + { + self::whereMemberDetails($query, $filter, $db); + } + // get by type ID + $query->where('a.' . $type . ' = ' . (int) $id); + $db->setQuery($query); + $db->execute(); + $numberRows = $db->getNumRows(); + if ($numberRows) + { + if ('object' == $method) + { + // if one to one + if ($relations == 1 || $numberRows == 1) + { + self::$memberDetails[self::$k3y] = $db->loadObject(); + } + // if one to many (so we must return many) + else + { + self::$memberDetails[self::$k3y] = $db->loadObjectList(); + } + } + else + { + // if one to one + if ($relations == 1 || $numberRows == 1) + { + self::$memberDetails[self::$k3y] = $db->loadAssoc(); + } + // if one to many (so we must return many) + else + { + self::$memberDetails[self::$k3y] = $db->loadAssocList(); + } + } + } + // check if we have been able to get the member details + if (!isset(self::$memberDetails[self::$k3y])) + { + self::$memberDetails[self::$k3y] = false; + } + // check if we must model the details + elseif (method_exists(__CLASS__, "modelMemberDetails")) + { + self::modelMemberDetails($id, $method, $filter, $numberRows, $db); + // check if we must remove some details after modeling + if (method_exists(__CLASS__, "removeMemberDetails")) + { + self::removeMemberDetails($id, $method, $filter, $numberRows, $db); + } + } + } + else + { + self::$memberDetails[self::$k3y] = false; + } + } + return self::$memberDetails[self::$k3y]; + } + + + /** + * Model the member details/values + * + * @param object $id The the member ID + * @param string $method The type of values to return + * @param string $filter The kind of filter (to return only values required) + * @param int $numberRows The number of rows + * @param object $db The database object + * + * @return void + * + */ + protected static function modelMemberDetails($id, $method, $filter, $numberRows, $db = null) + { + // check that we have values + if (method_exists(__CLASS__, 'getSelection') && isset(self::$memberDetails[self::$k3y]) && self::$memberDetails[self::$k3y]) + { + // get language object + $lang = JFactory::getLanguage(); + // try to load the translation + $lang->load('com_membersmanager', JPATH_ADMINISTRATOR, null, false, true); + // Select some fields + $_builder = self::getSelection('member', $method, $filter, $db); + // check if we have params to model + if (method_exists(__CLASS__, "paramsModelMemberDetails")) + { + self::paramsModelMemberDetails($_builder, $method, $numberRows); + } + // get values that must be set (not SQL values) + $builder = array_filter( + $_builder, + function ($key) { + return strpos($key, ':'); + }, + ARRAY_FILTER_USE_KEY + ); + // start the builder + if (self::checkArray($builder)) + { + // prep for placeholders + $f = ''; + $b = ''; + if ('placeholder' === $method) + { + // get the placeholder prefix + $prefix = self::$params->get('placeholder_prefix', 'membersmanager'); + $f = '[' . $prefix . '_'; + $b = ']'; + } + // loop builder + foreach ($builder as $build => $set) + { + // get function and key + $_build = explode(':', $build); + // check the number of values must be two + if (count((array)$_build) == 2) + { + // check if more then one value must be passed + if (strpos($_build[1], '|') !== false) + { + // get all value names + $valueKeys = explode('|', $_build[1]); + // continue only if we have values + if (self::checkArray($valueKeys)) + { + // start the modeling + if ($numberRows == 1) + { + $object = new JObject; + foreach ($valueKeys as $valueKey) + { + // work with object + if ('object' === $method && isset(self::$memberDetails[self::$k3y]->{$valueKey})) + { + // load the properties + $object->set($valueKey, self::$memberDetails[self::$k3y]->{$valueKey}); + } + // work with array + elseif (self::checkArray(self::$memberDetails[self::$k3y]) && isset(self::$memberDetails[self::$k3y][$f.$valueKey.$b])) + { + // load the properties + $object->set($valueKey, self::$memberDetails[self::$k3y][$f.$valueKey.$b]); + } + } + // now set the new value + if ('object' === $method) + { + $result = self::{$_build[0]}($object); + if (self::checkArray($result) || self::checkObject($result)) + { + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y]->{$set . '_' . $_key} = $_val; + } + } + else + { + self::$memberDetails[self::$k3y]->{$set} = $result; + } + } + // work with array + else + { + $result = self::{$_build[0]}($object); + if (self::checkArray($result) || self::checkObject($result)) + { + $set = str_replace(array($f, $b), '', $set); + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y][$f . $set . '_' . $_key . $b] = $_val; + } + } + else + { + self::$memberDetails[self::$k3y][$set] = $result; + } + } + } + elseif (self::checkArray(self::$memberDetails[self::$k3y])) + { + foreach (self::$memberDetails[self::$k3y] as $_nr => $details) + { + $object = new JObject; + foreach ($valueKeys as $valueKey) + { + // work with object + if ('object' === $method && isset($details->{$valueKey})) + { + // load the properties + $object->set($valueKey, $details->{$valueKey}); + } + // work with array + elseif (self::checkArray($details) && isset($details[$f.$valueKey.$b])) + { + // load the properties + $object->set($valueKey, $details[$f.$valueKey.$b]); + } + } + // now set the new value + if ('object' === $method) + { + $result = self::{$_build[0]}($object); + if (self::checkArray($result) || self::checkObject($result)) + { + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y][$_nr]->{$set . '_' . $_key} = $_val; + } + } + else + { + self::$memberDetails[self::$k3y][$_nr]->{$set} = $result; + } + } + // work with array + else + { + $result = self::{$_build[0]}($object); + if (self::checkArray($result) || self::checkObject($result)) + { + $set = str_replace(array($f, $b), '', $set); + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y][$_nr][$f . $set . '_' . $_key . $b] = $_val; + } + } + else + { + self::$memberDetails[self::$k3y][$_nr][$set] = $result; + } + } + } + } + } + } + else + { + if ($numberRows == 1) + { + // work with object + if ('object' === $method && isset(self::$memberDetails[self::$k3y]->{$_build[1]})) + { + $result = self::{$_build[0]}(self::$memberDetails[self::$k3y]->{$_build[1]}); + if (self::checkArray($result) || self::checkObject($result)) + { + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y]->{$set . '_' . $_key} = $_val; + } + } + else + { + self::$memberDetails[self::$k3y]->{$set} = $result; + } + } + // work with array + elseif (self::checkArray(self::$memberDetails[self::$k3y]) && isset(self::$memberDetails[self::$k3y][$f.$_build[1].$b])) + { + $result = self::{$_build[0]}(self::$memberDetails[self::$k3y][$f.$_build[1].$b]); + if (self::checkArray($result) || self::checkObject($result)) + { + $set = str_replace(array($f, $b), '', $set); + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y][$f . $set . '_' . $_key . $b] = $_val; + } + } + else + { + self::$memberDetails[self::$k3y][$set] = $result; + } + } + } + elseif (self::checkArray(self::$memberDetails[self::$k3y])) + { + foreach (self::$memberDetails[self::$k3y] as $_nr => $details) + { + // work with object + if ('object' === $method && isset(self::$memberDetails[self::$k3y][$_nr]->{$_build[1]})) + { + $result = self::{$_build[0]}(self::$memberDetails[self::$k3y][$_nr]->{$_build[1]}); + if (self::checkArray($result) || self::checkObject($result)) + { + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y][$_nr]->{$set . '_' . $_key} = $_val; + } + } + else + { + self::$memberDetails[self::$k3y][$_nr]->{$set} = $result; + } + } + // work with array + elseif (self::checkArray(self::$memberDetails[self::$k3y][$_nr]) && isset(self::$memberDetails[self::$k3y][$_nr][$f.$_build[1].$b])) + { + $result = self::{$_build[0]}(self::$memberDetails[self::$k3y][$_nr][$f.$_build[1].$b]); + if (self::checkArray($result) || self::checkObject($result)) + { + $set = str_replace(array($f, $b), '', $set); + foreach ($result as $_key => $_val) + { + self::$memberDetails[self::$k3y][$_nr][$f . $set . '_' . $_key . $b] = $_val; + } + } + else + { + self::$memberDetails[self::$k3y][$_nr][$set] = $result; + } + } + } + } + } + } + } + } + // check if we have labels to model + if (method_exists(__CLASS__, "labelModelMemberDetails") && property_exists(__CLASS__, 'memberParams')) + { + self::labelModelMemberDetails($_builder, $method, $numberRows); + } + // check if we have templates to model + if (method_exists(__CLASS__, "templateModelMemberDetails") && property_exists(__CLASS__, 'memberParams')) + { + self::templateModelMemberDetails($_builder, $method, $numberRows); + } + } + } + + + /** + * Get the members name + * + * @param int $id The member ID + * @param int $user The user ID + * @param string $name The name + * @param string $surname The surname + * + * @return string the members name + * + */ + public static function getMemberName($id, $user = null, $name = null, $surname = null) + { + // always get surname + if (!self::checkString($surname)) + { + if(($surname = self::getVar('member', $id, 'id', 'surname', '=', 'membersmanager')) === false || !self::checkString($surname)) + { + $surname = ''; + } + } + // check name given + if (self::checkstring($name)) + { + return $name . ' ' . $surname; + } + // check user given + elseif ((is_numeric($user) && $user > 0) || (is_numeric($id) && $id > 0 && ($user = self::getVar('member', $id, 'id', 'user', '=', 'membersmanager')) !== false && $user > 0)) + { + return JFactory::getUser($user)->name . ' ' . $surname; + } + // get the name + elseif (is_numeric($id) && $id > 0 && ($name = self::getVar('member', $id, 'id', 'name', '=', 'membersmanager')) !== false && self::checkstring($name)) + { + return $name . ' ' . $surname; + } + return JText::_('COM_MEMBERSMANAGER_NO_NAME'); + } + + + /** + * the info components + **/ + protected static $infoComponents = array(); + + /** + * Get available infos based on type + */ + public static function getInfoAvaillable($type, $account, $multiDimensionalAllowed = true) + { + $infos = self::getInfoComponents($type, $account); + // check if we found components + if (self::checkArray($infos)) + { + // sort into types of info + $bucketInfos = array(); + foreach ($infos as $component) + { + if (isset($component->params->info_type_name) && self::checkString($component->params->info_type_name)) + { + $infoTypeName = $component->params->info_type_name; + } + else + { + $infoTypeName = $component->name; + } + // package based on relations (one to one or one to many) + if (isset($component->params->membersmanager_relation_type) && $component->params->membersmanager_relation_type == 1 || !$multiDimensionalAllowed) + { + // set data (one to one) + $bucketInfos[$infoTypeName] = $component; + } + else + { + // start array if not already set + if (!isset($bucketInfos[$infoTypeName])) + { + $bucketInfos[$infoTypeName] = array(); + } + // set data (one to many) + $bucketInfos[$infoTypeName][] = $component; + } + } + // return the info bucket + return $bucketInfos; + } + return false; + } + + /** + * Get type info names + */ + public static function getTypeInfosNames($type, $account, $as = 'string') + { + $infos = self::getInfoAvaillable($type, $account); + $names = array(); + if (self::checkArray($infos)) + { + foreach ($infos as $name => $info) + { + $names[] = $name; + } + } + if (self::checkArray($names)) + { + // return as + if ('string' === $as) + { + return implode(', ', $names); + } + return $names; + } + // still return string + if ('string' === $as) + { + return 'Infos'; + } + return false; + } + + /** + * Get info components + */ + public static function getInfoComponents($type = null, $account = null) + { + if (!self::checkArray(self::$infoComponents)) + { + // get list of Extensions + self::$infoComponents = self::setInfoComponents(); + } + // filter by type & account + if ($type && $account && self::checkArray(self::$infoComponents)) + { + // filter out the components we need + return array_filter( + self::$infoComponents, + function ($component) use ($type, $account) { + // check if the component is available to this type of member + return ((isset($component->params->membersmanager_target_type) && in_array($type, (array) $component->params->membersmanager_target_type)) && + (isset($component->params->membersmanager_target_account) && in_array($account, (array) $component->params->membersmanager_target_account))); + } + ); + } + return self::$infoComponents; + } + + /** + * set info components + */ + protected static function setInfoComponents() + { + $db = JFactory::getDBO(); + // get components + $query = $db->getQuery(true); + $query->select('a.*'); + $query->from('#__extensions AS a'); + $query->where('a.type = ' . $db->quote('component')); + $query->where('a.protected = 0')->where('a.enabled = 1'); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // get all components + $listComponents = $db->loadObjectList(); + // filter out the components we need + $listComponents = array_filter( + $listComponents, + function ($component) { + if (strpos($component->params, 'activate_membersmanager_info') !== false) + { + // check if this component is active + return json_decode($component->params)->activate_membersmanager_info; + } + return false; + } + ); + // check if we found components + if (self::checkArray($listComponents)) + { + // get language object + $lang = JFactory::getLanguage(); + foreach ($listComponents as $listComponent) + { + // lets do a quick params setup (to objects) + $listComponent->params = json_decode($listComponent->params); + // try to load the translation + $lang->load($listComponent->element, JPATH_ADMINISTRATOR, null, false, true); + // translate the extension name if possible + $listComponent->name = JText::_($listComponent->name); + // translate the info type name + if (isset($listComponent->params->info_type_name)) + { + $listComponent->params->info_type_name = JText::_(strtoupper($listComponent->element) . '_CONFIG_' . $listComponent->params->info_type_name); + } + } + return $listComponents; + } + } + return false; + } + + + /** + * the assessment components + **/ + protected static $assessmentComponents = array(); + + /** + * Get available assessments based on type + */ + public static function getAssessmentAvaillable($type, $account, $multiDimensionalAllowed = true) + { + $assessments = self::getAssessmentComponents($type, $account); + // check if we found components + if (self::checkArray($assessments)) + { + // sort into types of assessment + $bucketAssessments = array(); + foreach ($assessments as $component) + { + if (isset($component->params->assessment_type_name) && self::checkString($component->params->assessment_type_name)) + { + $assessmentTypeName = $component->params->assessment_type_name; + } + else + { + $assessmentTypeName = $component->name; + } + // package based on relations (one to one or one to many) + if (isset($component->params->membersmanager_relation_type) && $component->params->membersmanager_relation_type == 1 || !$multiDimensionalAllowed) + { + // set data (one to one) + $bucketAssessments[$assessmentTypeName] = $component; + } + else + { + // start array if not already set + if (!isset($bucketAssessments[$assessmentTypeName])) + { + $bucketAssessments[$assessmentTypeName] = array(); + } + // set data (one to many) + $bucketAssessments[$assessmentTypeName][] = $component; + } + } + // return the assessment bucket + return $bucketAssessments; + } + return false; + } + + /** + * Get type assessment names + */ + public static function getTypeAssessmentsNames($type, $account, $as = 'string') + { + $assessments = self::getAssessmentAvaillable($type, $account); + $names = array(); + if (self::checkArray($assessments)) + { + foreach ($assessments as $name => $assessment) + { + $names[] = $name; + } + } + if (self::checkArray($names)) + { + // return as + if ('string' === $as) + { + return implode(', ', $names); + } + return $names; + } + // still return string + if ('string' === $as) + { + return 'Assessments'; + } + return false; + } + + /** + * Get assessment components + */ + public static function getAssessmentComponents($type = null, $account = null) + { + if (!self::checkArray(self::$assessmentComponents)) + { + // get list of Extensions + self::$assessmentComponents = self::setAssessmentComponents(); + } + // filter by type & account + if ($type && $account && self::checkArray(self::$assessmentComponents)) + { + // filter out the components we need + return array_filter( + self::$assessmentComponents, + function ($component) use ($type, $account) { + // check if the component is available to this type of member + return ((isset($component->params->membersmanager_target_type) && in_array($type, (array) $component->params->membersmanager_target_type)) && + (isset($component->params->membersmanager_target_account) && in_array($account, (array) $component->params->membersmanager_target_account))); + } + ); + } + return self::$assessmentComponents; + } + + /** + * set assessment components + */ + protected static function setAssessmentComponents() + { + $db = JFactory::getDBO(); + // get components + $query = $db->getQuery(true); + $query->select('a.*'); + $query->from('#__extensions AS a'); + $query->where('a.type = ' . $db->quote('component')); + $query->where('a.protected = 0')->where('a.enabled = 1'); + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + // get all components + $listComponents = $db->loadObjectList(); + // filter out the components we need + $listComponents = array_filter( + $listComponents, + function ($component) { + if (strpos($component->params, 'activate_membersmanager_assessment') !== false) + { + // check if this component is active + return json_decode($component->params)->activate_membersmanager_assessment; + } + return false; + } + ); + // check if we found components + if (self::checkArray($listComponents)) + { + // get language object + $lang = JFactory::getLanguage(); + foreach ($listComponents as $listComponent) + { + // lets do a quick params setup (to objects) + $listComponent->params = json_decode($listComponent->params); + // try to load the translation + $lang->load($listComponent->element, JPATH_ADMINISTRATOR, null, false, true); + // translate the extension name if possible + $listComponent->name = JText::_($listComponent->name); + // translate the assessment type name + if (isset($listComponent->params->assessment_type_name)) + { + $listComponent->params->assessment_type_name = JText::_(strtoupper($listComponent->element) . '_CONFIG_' . $listComponent->params->assessment_type_name); + } + } + return $listComponents; + } + } + return false; + } + + + /** + * Load the tabs + * + * @param object $item Data for the form + * @param string $view The view name + * @param string $return The return value if found + * + * @return string + * + */ + public static function loadDynamicTabs(&$item, $view = 'member', $return = '') + { + // only loads if type and account is set + if (is_numeric($item->type) && $item->type > 0 && is_numeric($item->account) && $item->account > 0) + { + // get all the available component calling metods + $class = new ReflectionClass('MembersmanagerHelper'); + $methods = array_filter($class->getMethods(ReflectionMethod::IS_PUBLIC), + function ($method) { + if (strpos($method->name, 'get') !== false && strpos($method->name, 'Availlable') !== false ) // The spelling mistake (Availlable) is to unique identify those classes. + { + return true; + } + return false; + } + ); + // set the tabs + $tabs = array(); + $layout = array(); + if (self::checkArray($methods)) + { + foreach ($methods as $method) + { + // get components + $components = self::{$method->name}($item->type, $item->account); + // check if we found components + if (self::checkArray($components)) + { + // get assessment details + foreach ($components as $_name => $component) + { + if (self::checkArray($component)) + { + $tables = array(); + foreach ($component as $_nr => $comp) + { + if (($ids = self::getVars('form', $item->id, $view, 'id', 'IN', str_replace('com_', '', $comp->element))) !== false && self::checkArray($ids)) + { + $tables[] = self::getTabLinksTable($ids, $item, $comp, $view, $return); + } + } + // load the tables to the layout + if (self::checkArray($tables)) + { + foreach ($tables as $table) + { + if (self::checkString($table)) + { + if (!isset($layout[$_name])) + { + $layout[$_name] = $table; + } + else + { + $layout[$_name] .= $table; + } + } + } + } + // add layout to tabs + if (self::checkArray($layout) && count((array) $layout) == 2) + { + $tabs[] = self::setTab($layout, $view); + $layout = array(); + } + } + elseif (self::checkObject($component) && isset($component->element)) + { + if (($id = self::getVar('form', $item->id, $view, 'id', '=', str_replace('com_', '', $component->element))) === false) // get item ID + { + // if no item was found set to zero + $id = 0; + } + // check if user are allowed to edit form values or create form values + if (($id > 0 && JFactory::getUser()->authorise('form.edit', $component->element . '.form.' . (int) $id)) || ($id == 0 && JFactory::getUser()->authorise('form.create', $component->element))) + { + $fields = self::getTabFields($id, $component); + // load the fields to the layout + if (self::checkString($fields)) + { + $layout[$_name] = $fields; + } + // add layout to tabs + if (self::checkArray($layout) && count((array) $layout) == 2) + { + $tabs[] = self::setTab($layout, $view); + $layout = array(); + } + } + } + } + } + } + } + // add layout to tabs + if (self::checkArray($layout)) + { + $tabs[] = self::setTab($layout, $view); + } + // check if we have tabs + if (self::checkArray($tabs)) + { + return implode("\n", $tabs); } } return ''; } + /** + * get the tabe fields + * + * @param int $id The item id + * @param object $component The target component details + * + * @return string + * + */ + protected static function getTabFields($id, &$component) + { + // build the rows + $rows = ''; + // get the form + if (method_exists(__CLASS__, "getMemberForms") && ($form = self::getMemberForms($id, $component->element)) !== false && self::checkObject($form)) + { + // get the fields for this form + if (($fields = JComponentHelper::getParams($component->element)->get('edit_fields', false)) !== false && self::checkObject($fields)) + { + // add the id field if the id was found (but hidden) + if ($id > 0) + { + $form->setFieldAttribute('id', 'type', 'hidden'); + $rows = $form->renderField('id'); + } + // add the rest of the fields + foreach ($fields as $row) + { + if ($form->getField($row->field)) + { + $rows .= PHP_EOL . $form->renderField($row->field); + } + } + } + } + return $rows; + } + + /** + * get the tab table of links + * + * @param array $ids The target ids + * @param object $item The target item details + * @param object $component The target component details + * @param string $view The view name + * @param string $return The return value if found + * + * @return string + * + */ + protected static function getTabLinksTable($ids, &$item, &$comp, &$view, &$return) + { + // set some defaults + $_return = '&ref=' . $view . '&refid=' . $item->id . '&return=' . urlencode(base64_encode('index.php?option=com_membersmanager&view=' . $view . '&layout=edit&id=' . $item->id . $return)); + $rows = array(); + // add a row to create a new item + if (($create_button = self::getCreateButton('form', 'forms', $_return, $comp->element)) !== false && self::checkString($create_button)) + { + $rows[] = '' . $create_button . ''; + } + // build the links + foreach ($ids as $id) + { + $created = self::getVar('form', $id, 'id', 'created', '=', str_replace('com_', '', $comp->element)); + $rows[] = '' . self::fancyDayTimeDate($created) . self::getEditButton($id, 'form', 'forms', $_return, $comp->element) . ''; + } + // set the header + $head = array($comp->name); + // return the table + return self::setSubformTable($head, $rows, $view . '_' . $comp->name); + } + + + /** + * get the form fields + * + * @param string $layout The layout array + * @param string $code The tab/view code name + * @param string $name The tab name + * @param int $span The span trigger + * @param bool $alert Show the alert + * + * @return string + * + */ + protected static function setTab(&$layout, $code, $name = null, $span = 6, $alert = true) + { + // build the tab name + if (!$name || !self::checkString($name)) + { + $name = implode(' & ', array_keys($layout)); + } +$tmp = JHtml::_('bootstrap.addTab', $code . 'Tab', self::randomkey(10), $name); + $tmp .= PHP_EOL . '
'; + if (count((array) $layout) == 1) + { + if ($span == 6) + { + $tmp .= PHP_EOL . '
'; + if ($alert) + { + $tmp .= PHP_EOL . '
' . array_keys($layout)[0] . '
'; + } + $tmp .= PHP_EOL . array_values($layout)[0]; + $tmp .= PHP_EOL . '
'; + $tmp .= PHP_EOL . '
'; + $tmp .= PHP_EOL . '
'; + } + else + { + $tmp .= PHP_EOL . '
'; + if ($alert) + { + $tmp .= PHP_EOL . '
' . array_keys($layout)[0] . '
'; + } + $tmp .= PHP_EOL . array_values($layout)[0]; + $tmp .= PHP_EOL . '
'; + } + } + else + { + foreach ($layout as $name => $value) + { + $tmp .= PHP_EOL . '
'; + if ($alert) + { + $tmp .= PHP_EOL . '
' . $name . '
'; + } + $tmp .= PHP_EOL . $value; + $tmp .= PHP_EOL . '
'; + } + } + $tmp .= PHP_EOL . '
'; + $tmp .= JHtml::_('bootstrap.endTab'); + return $tmp; + } + + + /** + * set subform type table + * + * @param array $head The header names + * @param array $rows The row values + * @param string $idName The prefix to the table id + * + * @return string + * + */ + public static function setSubformTable($head, $rows, $idName) + { + $table[] = "
"; + $table[] = "\t
"; + $table[] = "\t\t
"; + $table[] = "\t\t\t"; + $table[] = "\t\t\t\t"; + $table[] = "\t\t\t\t\t"; + $table[] = "\t\t\t\t\t\t"; + $table[] = "\t\t\t\t\t"; + $table[] = "\t\t\t\t"; + $table[] = "\t\t\t\t"; + foreach ($rows as $row) + { + $table[] = "\t\t\t\t\t"; + $table[] = "\t\t\t\t\t\t" . $row; + $table[] = "\t\t\t\t\t"; + } + $table[] = "\t\t\t\t"; + $table[] = "\t\t\t
" . implode("", $head) . "
"; + $table[] = "\t\t
"; + $table[] = "\t
"; + $table[] = "
"; + // return the table + return implode("\n", $table); + } + + + /** + * save the dynamic values + * + * @param object $date The main Data + * @param string $view The view name + * + * @return string + * + */ + public static function saveDynamicValues(&$data, $view = 'member') + { + // get all the available component calling metods + $class = new ReflectionClass('MembersmanagerHelper'); + $methods = array_filter($class->getMethods(ReflectionMethod::IS_PUBLIC), + function ($method) { + if (strpos($method->name, 'get') !== false && strpos($method->name, 'Availlable') !== false ) + { + return true; + } + return false; + } + ); + // check if we have methods + if (self::checkArray($methods)) + { + // get the app object + $app = JFactory::getApplication(); + // get the post object + $post = JFactory::getApplication()->input->post; + // get the user object + $user = JFactory::getUser(); + // get the database object + $db = JFactory::getDBO(); + // start looping the metods + foreach ($methods as $method) + { + // get components + $components = self::{$method->name}($data['type'], $data['account']); + // check if we found components + if (self::checkArray($components)) + { + // get assessment details + foreach ($components as $_name => $comp) + { + // only save one to one components + if (self::checkObject($comp) && isset($comp->element)) + { + $_component = $comp->element; + $component = str_replace('com_', '', $_component); + $Component = self::safeString($component, 'F'); + $COMponent = self::safeString($component, 'W'); + // get the posted date if there were any + $_data = $post->get($component, array(), 'array'); + // check if user are allowed to edit form values or create form values + if (self::checkArray($_data)) + { + // make sure the ID is set + if (!isset($_data['id']) || !is_numeric($_data['id'])) + { + $_data['id'] = 0; + } + // check if user may edit + if ($_data['id'] > 0 && !$user->authorise('form.edit', $_component . '.form.' . (int) $_data['id'])) + { + // check edit own + if (($created_by = self::getVar('form', $_data['id'], 'id', 'created_by', '=', $component)) === false || $created_by != $user->id || !$user->authorise('form.edit.own', $_component)) + { + $app->enqueueMessage(JText::sprintf('COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR', $COMponent, $_data['id']), 'warning'); + continue; + } + } + // check if user may create + if ($_data['id'] == 0 && !$user->authorise('form.create', $_component)) + { + $app->enqueueMessage(JText::sprintf('COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_ADD_DATA_TO_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR', $COMponent), 'warning'); + continue; + } + // make sure the member ID is set if view is member + if ('member' === $view && !isset($_data[$view]) || !is_numeric($_data[$view]) || $_data[$view] == 0) + { + if ($_data['id'] > 0 && $data['id'] > 0) + { + // get the member ID + if (($member = self::getVar('form', $_data['id'], 'id', $view, '=', $component)) === false || $member != $data['id']) + { + $app->enqueueMessage(JText::sprintf('COM_MEMBERSMANAGER_MEMBER_ID_MISMATCH_SS_COULD_NOT_BE_SAVED', $COMponent, $_data['id']), 'error'); + continue; + } + } + elseif ($_data['id'] > 0) + { + // get the member ID + if (($member = self::getVar('form', $_data['id'], 'id', $view, '=', $component)) === false || $member == 0) + { + $app->enqueueMessage(JText::sprintf('COM_MEMBERSMANAGER_MEMBER_ID_MISMATCH_SS_COULD_NOT_BE_SAVED', $COMponent, $_data['id']), 'error'); + continue; + } + } + elseif ($data['id'] > 0) + { + // get the member ID + $member = $data['id']; + } + else + { + $app->enqueueMessage(JText::sprintf('COM_MEMBERSMANAGER_S_COULD_NOT_BE_SAVED_PLEASE_TRY_AGAIN_THIS_COULD_BE_DUE_TO_THE_FACT_THIS_THE_MEMBER_ID_WAS_NOT_READY', $COMponent), 'error'); + continue; + } + // set the member ID + $_data[$view] = $member; + } + // get the model + $model = self::getModel('form', JPATH_ADMINISTRATOR . '/components/' . $_component, $Component); + // do we have the model + if ($model) + { + // force other component path (TODO) will be an issue if forms and fields are the same + \JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . $_component . '/models/forms'); + \JForm::addFieldPath(JPATH_ADMINISTRATOR . '/components/' . $_component . '/models/fields'); + // Validate the posted data. + // Sometimes the form needs some posted data, such as for plugins and modules. + $form = $model->getForm($_data, false); + if (!$form) + { + $app->enqueueMessage($model->getError(), 'error'); + continue; + } + // remove all fields not part of the allowed edit fields + if (($fields = JComponentHelper::getParams($_component)->get('edit_fields', false)) !== false && self::checkObject($fields)) + { + // build a fields array bucket + $fieldActive = array(); + foreach ($fields as $row) + { + $fieldActive[$row->field] = $row->field; + } + // set the keep values + $fieldActive['id'] = 'id'; + $fieldActive['member'] = 'member'; + $fieldActive['asset_id'] = 'asset_id'; + $fieldActive['created'] = 'created'; + $fieldActive['created_by'] = 'created_by'; + $fieldActive['modified'] = 'modified'; + $fieldActive['modified_by'] = 'modified_by'; + $fieldActive['version'] = 'version'; + $fieldActive['rules'] = 'rules'; + // get the database columns of this table + $columns = $db->getTableColumns("#__" . $component . "_form", false); + // no make sure the fields that are not editable are removed (so can't be updated via this form) + foreach(array_keys($columns) as $field) + { + if (!isset($fieldActive[$field])) + { + $form->removeField($field); + } + } + } + // Send an object which can be modified through the plugin event + $objData = (object) $_data; + $app->triggerEvent( + 'onContentNormaliseRequestData', + array($_component . '.form', $objData, $form) + ); + $_data = (array) $objData; + // Test whether the data is valid. + $validData = $model->validate($form, $_data); + // Check for validation errors. + if ($validData === false) + { + // Get the validation messages. + $errors = $model->getErrors(); + // Push up to three validation messages out to the user. + for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) + { + if ($errors[$i] instanceof \Exception) + { + $app->enqueueMessage($errors[$i]->getMessage(), 'warning'); + } + else + { + $app->enqueueMessage($errors[$i], 'warning'); + } + } + continue; + } + // Attempt to save the data. + if (!$model->save($validData)) + { + $app->enqueueMessage(JText::sprintf('COM_MEMBERSMANAGER_S_DATA_COULD_NOT_BE_SAVED', $COMponent), 'error'); + } + } + } + } + } + } + } + } + } + /** * Load the Component xml manifest. **/ @@ -521,19 +3304,7 @@ abstract class MembersmanagerHelper // load user for access menus $user = JFactory::getUser(); // load the submenus to sidebar - - if ($user->authorise('member.access', 'com_membersmanager') && $user->authorise('member.submenu', 'com_membersmanager')) - { - JHtmlSidebar::addEntry(JText::_('COM_MEMBERSMANAGER_SUBMENU_MEMBERS'), 'index.php?option=com_membersmanager&view=members', $submenu === 'members'); - } - if ($user->authorise('country.access', 'com_membersmanager') && $user->authorise('country.submenu', 'com_membersmanager')) - { - JHtmlSidebar::addEntry(JText::_('COM_MEMBERSMANAGER_SUBMENU_COUNTRIES'), 'index.php?option=com_membersmanager&view=countries', $submenu === 'countries'); - } - if ($user->authorise('currency.access', 'com_membersmanager') && $user->authorise('currency.submenu', 'com_membersmanager')) - { - JHtmlSidebar::addEntry(JText::_('COM_MEMBERSMANAGER_SUBMENU_CURRENCIES'), 'index.php?option=com_membersmanager&view=currencies', $submenu === 'currencies'); - } + } /** @@ -669,7 +3440,7 @@ abstract class MembersmanagerHelper return $new['id']; } return $model->getError(); - } + } /** * UIKIT Component Classes @@ -771,7 +3542,7 @@ abstract class MembersmanagerHelper return $classes; } return false; - } + } /** * Prepares the xml document @@ -1154,183 +3925,149 @@ abstract class MembersmanagerHelper } /** - * Get the actions permissions + * Get the action permissions + * + * @param string $view The related view name + * @param int $record The item to act upon + * @param string $views The related list view name + * @param mixed $target Only get this permission (like edit, create, delete) + * @param string $component The target component + * + * @return object The JObject of permission/authorised actions + * **/ - public static function getActions($view,&$record = null,$views = null) + public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'membersmanager') { - jimport('joomla.access.access'); - - $user = JFactory::getUser(); - $result = new JObject; - $view = self::safeString($view); + // get the user object + $user = JFactory::getUser(); + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); if (self::checkString($views)) { $views = self::safeString($views); } // get all actions from component - $actions = JAccess::getActions('com_membersmanager', 'component'); - // set acctions only set in component settiongs - $componentActions = array('core.admin','core.manage','core.options','core.export'); + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } // loop the actions and set the permissions foreach ($actions as $action) { - // set to use component default - $fallback= true; - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name,$componentActions)) + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; // The record has been set. Check the record permissions. - $permission = $user->authorise($action->name, 'com_membersmanager.'.$view.'.' . (int) $record->id); - if (!$permission) // TODO removed && !is_null($permission) + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) { - if ($action->name == 'core.edit' || $action->name == $view.'.edit') + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) { - if ($user->authorise('core.edit.own', 'com_membersmanager.'.$view.'.' . (int) $record->id)) + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; } - elseif ($user->authorise($view.'edit.own', 'com_membersmanager.'.$view.'.' . (int) $record->id)) + else { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise('core.edit.own', 'com_membersmanager')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise($view.'edit.own', 'com_membersmanager')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // do not allow edit + $result->set($action->name, false); + $fallback = false; } } } elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; // make sure we use the core. action check for the categories - if (strpos($action->name,$view) !== false && strpos($action->name,'core.') === false ) { - $coreCheck = explode('.',$action->name); - $coreCheck[0] = 'core'; - $categoryCheck = implode('.',$coreCheck); + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); } else { $categoryCheck = $action->name; } // The record has a category. Check the category permissions. - $catpermission = $user->authorise($categoryCheck, 'com_membersmanager.'.$views.'.category.' . (int) $record->catid); + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); if (!$catpermission && !is_null($catpermission)) { - if ($action->name == 'core.edit' || $action->name == $view.'.edit') + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) { - if ($user->authorise('core.edit.own', 'com_membersmanager.'.$views.'.category.' . (int) $record->catid)) + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; } - elseif ($user->authorise($view.'edit.own', 'com_membersmanager.'.$views.'.category.' . (int) $record->catid)) + else { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise('core.edit.own', 'com_membersmanager')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } - } - elseif ($user->authorise($view.'edit.own', 'com_membersmanager')) - { - // If the owner matches 'me' then allow. - if (isset($record->created_by) && $record->created_by > 0 && ($record->created_by == $user->id)) - { - $result->set($action->name, true); - // set not to use component default - $fallback= false; - } - else - { - $result->set($action->name, false); - // set not to use component default - $fallback= false; - } + // do not allow edit + $result->set($action->name, false); + $fallback = false; } } } @@ -1339,12 +4076,47 @@ abstract class MembersmanagerHelper // if allowed then fallback on component global settings if ($fallback) { - $result->set($action->name, $user->authorise($action->name, 'com_membersmanager')); + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } } } return $result; } + /** + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + **/ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + /** * Get any component's model **/ @@ -1594,6 +4366,46 @@ abstract class MembersmanagerHelper } } + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'],true); + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + /** * Render Bool Button * @@ -1612,8 +4424,6 @@ abstract class MembersmanagerHelper $args = func_get_args(); // check if there is additional button class $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time - // start the xml - $buttonXML = new SimpleXMLElement(''); // button attributes $buttonAttributes = array( 'type' => 'radio', @@ -1622,22 +4432,12 @@ abstract class MembersmanagerHelper 'class' => 'btn-group', 'filter' => 'INT', 'default' => isset($args[2]) ? (int) $args[2] : 0); - // load the haskey attributes - self::xmlAddAttributes($buttonXML, $buttonAttributes); // set the button options $buttonOptions = array( '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); - // load the button options - self::xmlAddOptions($buttonXML, $buttonOptions); - - // get the radio element - $button = JFormHelper::loadFieldType('radio'); - - // run - $button->setup($buttonXML, $buttonAttributes['default']); - - return $button->input; + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; } /** diff --git a/admin/language/en-GB/en-GB.com_membersmanager.ini b/admin/language/en-GB/en-GB.com_membersmanager.ini index cd5782f..2ff4844 100644 --- a/admin/language/en-GB/en-GB.com_membersmanager.ini +++ b/admin/language/en-GB/en-GB.com_membersmanager.ini @@ -1,14 +1,12 @@ COM_MEMBERSMANAGER="Members Manager" -COM_MEMBERSMANAGER_ADD_NAME="Add Name" +COM_MEMBERSMANAGER_ADD="Add" COM_MEMBERSMANAGER_ADD_ONE_OF_THESE_PLACEHOLDERS_IN_TEXT_FOR_CUSTOM_DOWNLOAD_PLACEMENT="Add one of these placeholders in text for custom download placement" -COM_MEMBERSMANAGER_ADD_USERNAME="Add username" COM_MEMBERSMANAGER_ALLOWED_IMAGE_FORMATS_ARE_NOT_SET_IN_THE_GLOBAL_SETTINGS_PLEASE_NOTIFY_YOUR_SYSTEM_ADMINISTRATOR="Allowed image formats are not set in the global settings, please notify your system administrator." COM_MEMBERSMANAGER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?" COM_MEMBERSMANAGER_ARCHIVED="Archived" COM_MEMBERSMANAGER_AUTHOR="Author" COM_MEMBERSMANAGER_BACK="Back" COM_MEMBERSMANAGER_BSB_IS_ALREADY_IN_USE_PLEASE_TRY_ANOTHER="%s is already in use, please try another!" -COM_MEMBERSMANAGER_CLOSE="Close" COM_MEMBERSMANAGER_CLOSE_NEW="Close & New" COM_MEMBERSMANAGER_CONFIG_ALMOST_FLAT_LOAD="Almost Flat" COM_MEMBERSMANAGER_CONFIG_AUTHOR="Author Info" @@ -25,19 +23,52 @@ COM_MEMBERSMANAGER_CONFIG_CHECK_TIMER_OPTION_ONE="Every five hours" COM_MEMBERSMANAGER_CONFIG_CHECK_TIMER_OPTION_SIX="Never" COM_MEMBERSMANAGER_CONFIG_CHECK_TIMER_OPTION_THREE="Once a day" COM_MEMBERSMANAGER_CONFIG_CHECK_TIMER_OPTION_TWO="Every twelve hours" +COM_MEMBERSMANAGER_CONFIG_CITY_DESCRIPTION="Please add your city name here" +COM_MEMBERSMANAGER_CONFIG_CITY_HINT="City Name" +COM_MEMBERSMANAGER_CONFIG_CITY_LABEL="City" +COM_MEMBERSMANAGER_CONFIG_CITY_MESSAGE="Error! Please add city here." +COM_MEMBERSMANAGER_CONFIG_COMPANYLOGO_DESCRIPTION="select a company logo from the image folder" +COM_MEMBERSMANAGER_CONFIG_COMPANYLOGO_LABEL="Company Logo" +COM_MEMBERSMANAGER_CONFIG_COMPANYNAME_DESCRIPTION="Enter Company Name Here" +COM_MEMBERSMANAGER_CONFIG_COMPANYNAME_HINT="Company Name Here" +COM_MEMBERSMANAGER_CONFIG_COMPANYNAME_LABEL="Company Name" +COM_MEMBERSMANAGER_CONFIG_COMPANYNAME_MESSAGE="Error! Please add company name here." +COM_MEMBERSMANAGER_CONFIG_COMPANY_DETAILS="Company Details" +COM_MEMBERSMANAGER_CONFIG_COUNTRY_DESCRIPTION="Country Name" +COM_MEMBERSMANAGER_CONFIG_COUNTRY_HINT="Namibia" +COM_MEMBERSMANAGER_CONFIG_COUNTRY_LABEL="Country" +COM_MEMBERSMANAGER_CONFIG_COUNTRY_MESSAGE="Error! Please add country name here." COM_MEMBERSMANAGER_CONFIG_CROP_PROFILE_DESCRIPTION="Set if all profile images that are added should be cropped." COM_MEMBERSMANAGER_CONFIG_CROP_PROFILE_LABEL="Crop Profile Images" +COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_DESCRIPTION="Enter Document Footer Here" +COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_HINT="Footer Here" +COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_LABEL="Document Footer
html allowed" +COM_MEMBERSMANAGER_CONFIG_DOC_FOOTER_MESSAGE="Error! Please add footer here." +COM_MEMBERSMANAGER_CONFIG_DOC_HEADER_DESCRIPTION="Enter Document Header Here" +COM_MEMBERSMANAGER_CONFIG_DOC_HEADER_HINT="Header Here" +COM_MEMBERSMANAGER_CONFIG_DOC_HEADER_LABEL="Document Header
html allowed" +COM_MEMBERSMANAGER_CONFIG_DOC_HEADER_MESSAGE="Error! Please add header here." COM_MEMBERSMANAGER_CONFIG_DONT_LOAD="Not" +COM_MEMBERSMANAGER_CONFIG_DYNAMIC_SALT_DESCRIPTION="The global dynamic replacement array
(format: '1->!,3->E,4->A')" +COM_MEMBERSMANAGER_CONFIG_DYNAMIC_SALT_HINT="1->!,3->E,4->A" +COM_MEMBERSMANAGER_CONFIG_DYNAMIC_SALT_LABEL="Dynamic Salt" +COM_MEMBERSMANAGER_CONFIG_DYNAMIC_SALT_MESSAGE="Error! Please add some text here." +COM_MEMBERSMANAGER_CONFIG_EMAIL_DESCRIPTION="Enter Email" +COM_MEMBERSMANAGER_CONFIG_EMAIL_HINT="demo@example.com" +COM_MEMBERSMANAGER_CONFIG_EMAIL_LABEL="Email" +COM_MEMBERSMANAGER_CONFIG_EMAIL_MESSAGE="Error! Please add email address here." COM_MEMBERSMANAGER_CONFIG_ENCRYPTION_DESC="The encryption key for the field encryption is set here." COM_MEMBERSMANAGER_CONFIG_ENCRYPTION_LABEL="Encryption Settings" +COM_MEMBERSMANAGER_CONFIG_FAX_DESCRIPTION="The fax number of the contact person." +COM_MEMBERSMANAGER_CONFIG_FAX_HINT="Fax Number Here!" +COM_MEMBERSMANAGER_CONFIG_FAX_LABEL="Fax Number" +COM_MEMBERSMANAGER_CONFIG_FAX_MESSAGE="Error! Please add fax number here." COM_MEMBERSMANAGER_CONFIG_FLAT_LOAD="Flat" COM_MEMBERSMANAGER_CONFIG_FORCE_LOAD="Force" COM_MEMBERSMANAGER_CONFIG_GIF=".gif" COM_MEMBERSMANAGER_CONFIG_GLOBAL_DESC="The Global Parameters" COM_MEMBERSMANAGER_CONFIG_GLOBAL_LABEL="Global" COM_MEMBERSMANAGER_CONFIG_GRADIANT_LOAD="Gradient" -COM_MEMBERSMANAGER_CONFIG_GROUPS_DESC="The Parameters for the targeted groups are set here." -COM_MEMBERSMANAGER_CONFIG_GROUPS_LABEL="Target Groups" COM_MEMBERSMANAGER_CONFIG_IMAGE_FORMATS_DESCRIPTION="Select all the image formats allowed" COM_MEMBERSMANAGER_CONFIG_IMAGE_FORMATS_LABEL="Allowed Images Formats" COM_MEMBERSMANAGER_CONFIG_JPEG=".jpeg" @@ -47,15 +78,90 @@ COM_MEMBERSMANAGER_CONFIG_MEDIUM_KEY_LABEL="Medium Key (Path)" COM_MEMBERSMANAGER_CONFIG_MEDIUM_KEY_NOTE_DESC="When using the medium encryption option, the system generates its own key and stores it in a file at the folder/path you set here.
Never change this key once it is set, or remove the key file! DATA WILL GET CORRUPTED IF YOU DO! Also make sure the full path to where the the key file should be stored, is behind the root folder of your website/system, so that it is not public accessible. Making a backup of this key file over a secure connection is recommended!" COM_MEMBERSMANAGER_CONFIG_MEDIUM_KEY_NOTE_LABEL="Medium Encryption" COM_MEMBERSMANAGER_CONFIG_MEDIUM_KEY_PATH_ERROR="Medium key path (for encryption of various fields) does not exist, or is not writable. Please check the path and update it in the global option of this component." +COM_MEMBERSMANAGER_CONFIG_MOBILE_PHONE_DESCRIPTION="Enter Mobile Phone Number" +COM_MEMBERSMANAGER_CONFIG_MOBILE_PHONE_HINT="Mobile Phone Here" +COM_MEMBERSMANAGER_CONFIG_MOBILE_PHONE_LABEL="Mobile Phone" +COM_MEMBERSMANAGER_CONFIG_MOBILE_PHONE_MESSAGE="Error! Please add mobile phone number here." COM_MEMBERSMANAGER_CONFIG_NO="No" +COM_MEMBERSMANAGER_CONFIG_NOTE_DOCUMENT_PLACEHOLDERS_DESCRIPTION="
Loading placeholders.
+" +COM_MEMBERSMANAGER_CONFIG_NOTE_DOCUMENT_PLACEHOLDERS_LABEL="Document Placeholders" COM_MEMBERSMANAGER_CONFIG_ONLY_EXTRA="Only Extra" +COM_MEMBERSMANAGER_CONFIG_PHONE_DESCRIPTION="The phone number of the contact person." +COM_MEMBERSMANAGER_CONFIG_PHONE_HINT="Phone Number Here!" +COM_MEMBERSMANAGER_CONFIG_PHONE_LABEL="Phone Number" +COM_MEMBERSMANAGER_CONFIG_PHONE_MESSAGE="Error! Please add phone number here." COM_MEMBERSMANAGER_CONFIG_PNG=".png" +COM_MEMBERSMANAGER_CONFIG_POSTALCODE_DESCRIPTION="Please add your postal code here" +COM_MEMBERSMANAGER_CONFIG_POSTALCODE_HINT="9000" +COM_MEMBERSMANAGER_CONFIG_POSTALCODE_LABEL="Postal Code" +COM_MEMBERSMANAGER_CONFIG_POSTALCODE_MESSAGE="Error! Please add postal code here." +COM_MEMBERSMANAGER_CONFIG_POSTAL_DESCRIPTION="Please add your postal address here" +COM_MEMBERSMANAGER_CONFIG_POSTAL_HINT="P.O.Box 0000" +COM_MEMBERSMANAGER_CONFIG_POSTAL_LABEL="Postal" +COM_MEMBERSMANAGER_CONFIG_POSTAL_MESSAGE="Error! Please add postal address here." COM_MEMBERSMANAGER_CONFIG_PROFILE="Profile" COM_MEMBERSMANAGER_CONFIG_PROFILE_HEIGHT_HINT="Only Numbers" COM_MEMBERSMANAGER_CONFIG_PROFILE_HEIGHT_LABEL="Profile Height (in pixels)" COM_MEMBERSMANAGER_CONFIG_PROFILE_WIDTH_HINT="Only Numbers" COM_MEMBERSMANAGER_CONFIG_PROFILE_WIDTH_LABEL="Profile Width (in pixels)" -COM_MEMBERSMANAGER_CONFIG_TARGET_GROUP_DESC="Set the group/s being targeted by this user type." +COM_MEMBERSMANAGER_CONFIG_PUBLIC_DETAILS_NOTE_DESCRIPTION="Your Public Contact Details" +COM_MEMBERSMANAGER_CONFIG_REGION_DESCRIPTION="Please add your region or state name here" +COM_MEMBERSMANAGER_CONFIG_REGION_HINT="Region Name" +COM_MEMBERSMANAGER_CONFIG_REGION_LABEL="Region/State" +COM_MEMBERSMANAGER_CONFIG_REGION_MESSAGE="Error! Please add region or state name here." +COM_MEMBERSMANAGER_CONFIG_STREET_DESCRIPTION="Please add your street address here" +COM_MEMBERSMANAGER_CONFIG_STREET_HINT="16 Street Name" +COM_MEMBERSMANAGER_CONFIG_STREET_LABEL="Street Address" +COM_MEMBERSMANAGER_CONFIG_STREET_MESSAGE="Error! Please add street here." COM_MEMBERSMANAGER_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
Uikit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. For more info visit version 2 or version 3" COM_MEMBERSMANAGER_CONFIG_UIKIT_LABEL="Uikit2 and Uikit3 Settings" @@ -69,209 +175,18 @@ COM_MEMBERSMANAGER_CONFIG_UIKIT_V2="Version 2" COM_MEMBERSMANAGER_CONFIG_UIKIT_V3="Version 3" COM_MEMBERSMANAGER_CONFIG_UIKIT_VERSION_DESC="Select what version you would like to use" COM_MEMBERSMANAGER_CONFIG_UIKIT_VERSION_LABEL="Uikit Versions" +COM_MEMBERSMANAGER_CONFIG_WEBSITE_DESCRIPTION="Enter website address" +COM_MEMBERSMANAGER_CONFIG_WEBSITE_HINT="http://www.example.com" +COM_MEMBERSMANAGER_CONFIG_WEBSITE_LABEL="Website" +COM_MEMBERSMANAGER_CONFIG_WEBSITE_MESSAGE="Error! Please add website here." COM_MEMBERSMANAGER_CONFIG_YES="Yes" COM_MEMBERSMANAGER_CONTRIBUTOR="Contributor" COM_MEMBERSMANAGER_CONTRIBUTORS="Contributors" COM_MEMBERSMANAGER_COULD_NOT_UPLOAD_THE_FILE="Could not upload the file!" -COM_MEMBERSMANAGER_COUNTRIES="Countries" -COM_MEMBERSMANAGER_COUNTRIES_ACCESS="Countries Access" -COM_MEMBERSMANAGER_COUNTRIES_ACCESS_DESC="Allows the users in this group to access access countries" -COM_MEMBERSMANAGER_COUNTRIES_BATCH_OPTIONS="Batch process the selected Countries" -COM_MEMBERSMANAGER_COUNTRIES_BATCH_TIP="All changes will be applied to all selected Countries" -COM_MEMBERSMANAGER_COUNTRIES_BATCH_USE="Countries Batch Use" -COM_MEMBERSMANAGER_COUNTRIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch countries" -COM_MEMBERSMANAGER_COUNTRIES_CREATE="Countries Create" -COM_MEMBERSMANAGER_COUNTRIES_CREATE_DESC="Allows the users in this group to create create countries" -COM_MEMBERSMANAGER_COUNTRIES_DELETE="Countries Delete" -COM_MEMBERSMANAGER_COUNTRIES_DELETE_DESC="Allows the users in this group to delete delete countries" -COM_MEMBERSMANAGER_COUNTRIES_EDIT="Countries Edit" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_DESC="Allows the users in this group to edit the country" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_OWN="Countries Edit Own" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own countries created by them" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_STATE="Countries Edit State" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the country" -COM_MEMBERSMANAGER_COUNTRIES_EXPORT="Countries Export" -COM_MEMBERSMANAGER_COUNTRIES_EXPORT_DESC="Allows the users in this group to export export countries" -COM_MEMBERSMANAGER_COUNTRIES_IMPORT="Countries Import" -COM_MEMBERSMANAGER_COUNTRIES_IMPORT_DESC="Allows the users in this group to import import countries" -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_ARCHIVED="%s Countries archived." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_ARCHIVED_1="%s Country archived." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_CHECKED_IN_0="No Country successfully checked in." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_CHECKED_IN_1="%d Country successfully checked in." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_CHECKED_IN_MORE="%d Countries successfully checked in." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_DELETED="%s Countries deleted." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_DELETED_1="%s Country deleted." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_FEATURED="%s Countries featured." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_FEATURED_1="%s Country featured." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_PUBLISHED="%s Countries published." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_PUBLISHED_1="%s Country published." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_TRASHED="%s Countries trashed." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_TRASHED_1="%s Country trashed." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_UNFEATURED="%s Countries unfeatured." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_UNFEATURED_1="%s Country unfeatured." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_UNPUBLISHED="%s Countries unpublished." -COM_MEMBERSMANAGER_COUNTRIES_N_ITEMS_UNPUBLISHED_1="%s Country unpublished." -COM_MEMBERSMANAGER_COUNTRIES_SUBMENU="Countries Submenu" -COM_MEMBERSMANAGER_COUNTRIES_SUBMENU_DESC="Allows the users in this group to submenu of country" -COM_MEMBERSMANAGER_COUNTRY="Country" -COM_MEMBERSMANAGER_COUNTRY_ALIAS="Alias" -COM_MEMBERSMANAGER_COUNTRY_ALIAS_HINT="Auto-generated from name" -COM_MEMBERSMANAGER_COUNTRY_ALIAS_LABEL="Alias" -COM_MEMBERSMANAGER_COUNTRY_CODETHREE="Codethree" -COM_MEMBERSMANAGER_COUNTRY_CODETHREE_DESCRIPTION="ISO 3166-1 alpha-3 codes are three-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest." -COM_MEMBERSMANAGER_COUNTRY_CODETHREE_HINT="NAM" -COM_MEMBERSMANAGER_COUNTRY_CODETHREE_LABEL="Code Three" -COM_MEMBERSMANAGER_COUNTRY_CODETHREE_MESSAGE="Error! Please add three-letter country code here." -COM_MEMBERSMANAGER_COUNTRY_CODETWO="Codetwo" -COM_MEMBERSMANAGER_COUNTRY_CODETWO_DESCRIPTION="ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest." -COM_MEMBERSMANAGER_COUNTRY_CODETWO_HINT="NA" -COM_MEMBERSMANAGER_COUNTRY_CODETWO_LABEL="Code Two" -COM_MEMBERSMANAGER_COUNTRY_CODETWO_MESSAGE="Error! Please add two-letter country code here." -COM_MEMBERSMANAGER_COUNTRY_CREATED_BY_DESC="The user that created this Country." -COM_MEMBERSMANAGER_COUNTRY_CREATED_BY_LABEL="Created By" -COM_MEMBERSMANAGER_COUNTRY_CREATED_DATE_DESC="The date this Country was created." -COM_MEMBERSMANAGER_COUNTRY_CREATED_DATE_LABEL="Created Date" -COM_MEMBERSMANAGER_COUNTRY_CURRENCY="Currency" -COM_MEMBERSMANAGER_COUNTRY_CURRENCY_DESCRIPTION="List of available currencies" -COM_MEMBERSMANAGER_COUNTRY_CURRENCY_LABEL="Currency" -COM_MEMBERSMANAGER_COUNTRY_EDIT="Editing the Country" -COM_MEMBERSMANAGER_COUNTRY_ERROR_UNIQUE_ALIAS="Another Country has the same alias." -COM_MEMBERSMANAGER_COUNTRY_ID="Id" -COM_MEMBERSMANAGER_COUNTRY_MODIFIED_BY_DESC="The last user that modified this Country." -COM_MEMBERSMANAGER_COUNTRY_MODIFIED_BY_LABEL="Modified By" -COM_MEMBERSMANAGER_COUNTRY_MODIFIED_DATE_DESC="The date this Country was modified." -COM_MEMBERSMANAGER_COUNTRY_MODIFIED_DATE_LABEL="Modified Date" -COM_MEMBERSMANAGER_COUNTRY_NAME="Name" -COM_MEMBERSMANAGER_COUNTRY_NAME_DESCRIPTION="Enter Name Here" -COM_MEMBERSMANAGER_COUNTRY_NAME_HINT="Name Here" -COM_MEMBERSMANAGER_COUNTRY_NAME_LABEL="Name" -COM_MEMBERSMANAGER_COUNTRY_NAME_MESSAGE="Error! Please add name here." -COM_MEMBERSMANAGER_COUNTRY_NEW="A New Country" -COM_MEMBERSMANAGER_COUNTRY_ORDERING_LABEL="Ordering" -COM_MEMBERSMANAGER_COUNTRY_PERMISSION="Permissions" -COM_MEMBERSMANAGER_COUNTRY_PUBLISHING="Publishing" -COM_MEMBERSMANAGER_COUNTRY_REGIONS="Regions" -COM_MEMBERSMANAGER_COUNTRY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Country to customise the alias." -COM_MEMBERSMANAGER_COUNTRY_SETTINGS="Settings" -COM_MEMBERSMANAGER_COUNTRY_STATUS="Status" -COM_MEMBERSMANAGER_COUNTRY_VERSION_DESC="A count of the number of times this Country has been revised." -COM_MEMBERSMANAGER_COUNTRY_VERSION_LABEL="Revision" -COM_MEMBERSMANAGER_COUNTRY_WORLDZONE="Worldzone" -COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_DESCRIPTION="The zone this country belongs to" -COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_HINT="only number" -COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_LABEL="Worldzone" -COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_MESSAGE="Error! Please add zone code here." +COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE="cPanel (Site) Access" +COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE_DESC=" Allows the users in this group to access site cpanel." COM_MEMBERSMANAGER_CREATE_A_REGION="create a region" COM_MEMBERSMANAGER_CREATE_NEW_S="Create New %s" -COM_MEMBERSMANAGER_CREATE_USER="Create User" -COM_MEMBERSMANAGER_CURRENCIES="Currencies" -COM_MEMBERSMANAGER_CURRENCIES_ACCESS="Currencies Access" -COM_MEMBERSMANAGER_CURRENCIES_ACCESS_DESC="Allows the users in this group to access access currencies" -COM_MEMBERSMANAGER_CURRENCIES_BATCH_OPTIONS="Batch process the selected Currencies" -COM_MEMBERSMANAGER_CURRENCIES_BATCH_TIP="All changes will be applied to all selected Currencies" -COM_MEMBERSMANAGER_CURRENCIES_BATCH_USE="Currencies Batch Use" -COM_MEMBERSMANAGER_CURRENCIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch currencies" -COM_MEMBERSMANAGER_CURRENCIES_CREATE="Currencies Create" -COM_MEMBERSMANAGER_CURRENCIES_CREATE_DESC="Allows the users in this group to create create currencies" -COM_MEMBERSMANAGER_CURRENCIES_DELETE="Currencies Delete" -COM_MEMBERSMANAGER_CURRENCIES_DELETE_DESC="Allows the users in this group to delete delete currencies" -COM_MEMBERSMANAGER_CURRENCIES_EDIT="Currencies Edit" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_DESC="Allows the users in this group to edit the currency" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_OWN="Currencies Edit Own" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own currencies created by them" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_STATE="Currencies Edit State" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the currency" -COM_MEMBERSMANAGER_CURRENCIES_EXPORT="Currencies Export" -COM_MEMBERSMANAGER_CURRENCIES_EXPORT_DESC="Allows the users in this group to export export currencies" -COM_MEMBERSMANAGER_CURRENCIES_IMPORT="Currencies Import" -COM_MEMBERSMANAGER_CURRENCIES_IMPORT_DESC="Allows the users in this group to import import currencies" -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_ARCHIVED="%s Currencies archived." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_ARCHIVED_1="%s Currency archived." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_CHECKED_IN_0="No Currency successfully checked in." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_CHECKED_IN_1="%d Currency successfully checked in." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_CHECKED_IN_MORE="%d Currencies successfully checked in." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_DELETED="%s Currencies deleted." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_DELETED_1="%s Currency deleted." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_FEATURED="%s Currencies featured." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_FEATURED_1="%s Currency featured." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_PUBLISHED="%s Currencies published." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_PUBLISHED_1="%s Currency published." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_TRASHED="%s Currencies trashed." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_TRASHED_1="%s Currency trashed." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_UNFEATURED="%s Currencies unfeatured." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_UNFEATURED_1="%s Currency unfeatured." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_UNPUBLISHED="%s Currencies unpublished." -COM_MEMBERSMANAGER_CURRENCIES_N_ITEMS_UNPUBLISHED_1="%s Currency unpublished." -COM_MEMBERSMANAGER_CURRENCIES_SUBMENU="Currencies Submenu" -COM_MEMBERSMANAGER_CURRENCIES_SUBMENU_DESC="Allows the users in this group to submenu of currency" -COM_MEMBERSMANAGER_CURRENCY="Currency" -COM_MEMBERSMANAGER_CURRENCY_ALIAS="Alias" -COM_MEMBERSMANAGER_CURRENCY_ALIAS_HINT="Auto-generated from name" -COM_MEMBERSMANAGER_CURRENCY_ALIAS_LABEL="Alias" -COM_MEMBERSMANAGER_CURRENCY_CODETHREE="Codethree" -COM_MEMBERSMANAGER_CURRENCY_CODETHREE_DESCRIPTION="The following is a list of active codes of official ISO 4217 currency names." -COM_MEMBERSMANAGER_CURRENCY_CODETHREE_HINT="NAD" -COM_MEMBERSMANAGER_CURRENCY_CODETHREE_LABEL="Code Three" -COM_MEMBERSMANAGER_CURRENCY_CODETHREE_MESSAGE="Error! Please add three-letter currency code here." -COM_MEMBERSMANAGER_CURRENCY_CREATED_BY_DESC="The user that created this Currency." -COM_MEMBERSMANAGER_CURRENCY_CREATED_BY_LABEL="Created By" -COM_MEMBERSMANAGER_CURRENCY_CREATED_DATE_DESC="The date this Currency was created." -COM_MEMBERSMANAGER_CURRENCY_CREATED_DATE_LABEL="Created Date" -COM_MEMBERSMANAGER_CURRENCY_DECIMALPLACE="Decimalplace" -COM_MEMBERSMANAGER_CURRENCY_DECIMALPLACE_DESCRIPTION=" The position of a digit to the right of a decimal point, usually identified by successive ascending ordinal numbers with the digit immediately to the right of the decimal point being first: a figure accurate to the third decimal place." -COM_MEMBERSMANAGER_CURRENCY_DECIMALPLACE_HINT="2" -COM_MEMBERSMANAGER_CURRENCY_DECIMALPLACE_LABEL="Decimal place" -COM_MEMBERSMANAGER_CURRENCY_DECIMALPLACE_MESSAGE="Error! Please add currency decimal place here." -COM_MEMBERSMANAGER_CURRENCY_DECIMALSYMBOL="Decimalsymbol" -COM_MEMBERSMANAGER_CURRENCY_DECIMALSYMBOL_DESCRIPTION=" The symbol used to separate the integer part of a decimal number from its fractional part is called the decimal point." -COM_MEMBERSMANAGER_CURRENCY_DECIMALSYMBOL_HINT="." -COM_MEMBERSMANAGER_CURRENCY_DECIMALSYMBOL_LABEL="Decimal symbol" -COM_MEMBERSMANAGER_CURRENCY_DECIMALSYMBOL_MESSAGE="Error! Please add currency decimal symbol here." -COM_MEMBERSMANAGER_CURRENCY_DETAILS="Details" -COM_MEMBERSMANAGER_CURRENCY_EDIT="Editing the Currency" -COM_MEMBERSMANAGER_CURRENCY_ERROR_UNIQUE_ALIAS="Another Currency has the same alias." -COM_MEMBERSMANAGER_CURRENCY_ID="Id" -COM_MEMBERSMANAGER_CURRENCY_MODIFIED_BY_DESC="The last user that modified this Currency." -COM_MEMBERSMANAGER_CURRENCY_MODIFIED_BY_LABEL="Modified By" -COM_MEMBERSMANAGER_CURRENCY_MODIFIED_DATE_DESC="The date this Currency was modified." -COM_MEMBERSMANAGER_CURRENCY_MODIFIED_DATE_LABEL="Modified Date" -COM_MEMBERSMANAGER_CURRENCY_NAME="Name" -COM_MEMBERSMANAGER_CURRENCY_NAME_DESCRIPTION="Enter Name Here" -COM_MEMBERSMANAGER_CURRENCY_NAME_HINT="Name Here" -COM_MEMBERSMANAGER_CURRENCY_NAME_LABEL="Name" -COM_MEMBERSMANAGER_CURRENCY_NAME_MESSAGE="Error! Please add name here." -COM_MEMBERSMANAGER_CURRENCY_NEGATIVESTYLE="Negativestyle" -COM_MEMBERSMANAGER_CURRENCY_NEGATIVESTYLE_DESCRIPTION="Please use the following placeholders {sign}{number} {symbol} to build the currency negative style." -COM_MEMBERSMANAGER_CURRENCY_NEGATIVESTYLE_HINT="{sign}{number} {symbol}" -COM_MEMBERSMANAGER_CURRENCY_NEGATIVESTYLE_LABEL="Negative style" -COM_MEMBERSMANAGER_CURRENCY_NEGATIVESTYLE_MESSAGE="Error! Please add currency negative style here." -COM_MEMBERSMANAGER_CURRENCY_NEW="A New Currency" -COM_MEMBERSMANAGER_CURRENCY_NUMERICCODE="Numericcode" -COM_MEMBERSMANAGER_CURRENCY_NUMERICCODE_DESCRIPTION="There is also a three-digit code number assigned to each currency, in the same manner as there is also a three-digit code number assigned to each country as part of ISO 3166. This numeric code is usually the same as the ISO 3166-1 numeric code. For example, USD (United States dollar) has code 840 which is also the numeric code for the US (United States)." -COM_MEMBERSMANAGER_CURRENCY_NUMERICCODE_HINT="516" -COM_MEMBERSMANAGER_CURRENCY_NUMERICCODE_LABEL="Numeric Code" -COM_MEMBERSMANAGER_CURRENCY_NUMERICCODE_MESSAGE="Error! Please add numeric code here." -COM_MEMBERSMANAGER_CURRENCY_ORDERING_LABEL="Ordering" -COM_MEMBERSMANAGER_CURRENCY_PERMISSION="Permissions" -COM_MEMBERSMANAGER_CURRENCY_POSITIVESTYLE="Positivestyle" -COM_MEMBERSMANAGER_CURRENCY_POSITIVESTYLE_DESCRIPTION="Please use the following placeholders {number} {symbol} to build the currency positive style." -COM_MEMBERSMANAGER_CURRENCY_POSITIVESTYLE_HINT="{number} {symbol}" -COM_MEMBERSMANAGER_CURRENCY_POSITIVESTYLE_LABEL="Positive style" -COM_MEMBERSMANAGER_CURRENCY_POSITIVESTYLE_MESSAGE="Error! Please add currency positive style here." -COM_MEMBERSMANAGER_CURRENCY_PUBLISHING="Publishing" -COM_MEMBERSMANAGER_CURRENCY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Currency to customise the alias." -COM_MEMBERSMANAGER_CURRENCY_STATUS="Status" -COM_MEMBERSMANAGER_CURRENCY_SYMBOL="Symbol" -COM_MEMBERSMANAGER_CURRENCY_SYMBOL_DESCRIPTION="A currency symbol is a graphic symbol used as a shorthand for a currency's name, especially in reference to amounts of money." -COM_MEMBERSMANAGER_CURRENCY_SYMBOL_HINT="N$" -COM_MEMBERSMANAGER_CURRENCY_SYMBOL_LABEL="Symbol" -COM_MEMBERSMANAGER_CURRENCY_SYMBOL_MESSAGE="Error! Please add currency symbol here." -COM_MEMBERSMANAGER_CURRENCY_THOUSANDS="Thousands" -COM_MEMBERSMANAGER_CURRENCY_THOUSANDS_HINT=" " -COM_MEMBERSMANAGER_CURRENCY_THOUSANDS_LABEL="Thousands separator" -COM_MEMBERSMANAGER_CURRENCY_THOUSANDS_MESSAGE="Error! Please add currency thousands separator here." -COM_MEMBERSMANAGER_CURRENCY_VERSION_DESC="A count of the number of times this Currency has been revised." -COM_MEMBERSMANAGER_CURRENCY_VERSION_LABEL="Revision" COM_MEMBERSMANAGER_DASH="Dashboard" COM_MEMBERSMANAGER_DASHBOARD="Members Manager Dashboard" COM_MEMBERSMANAGER_DATE="Date" @@ -285,9 +200,6 @@ COM_MEMBERSMANAGER_EDIT_CREATED_DATE_DESC=" Allows users in this group to edit c COM_MEMBERSMANAGER_EDIT_S="Edit %s" COM_MEMBERSMANAGER_EDIT_VERSIONS="Edit Version" COM_MEMBERSMANAGER_EDIT_VERSIONS_DESC=" Allows users in this group to edit versions." -COM_MEMBERSMANAGER_EMAIL="Email" -COM_MEMBERSMANAGER_ERROR_USER_NOT_CREATED="Error - User Not Created" -COM_MEMBERSMANAGER_ERROR_USER_NOT_UPDATED="Error - User Not Updated" COM_MEMBERSMANAGER_EXPORT_DATA="Export Data" COM_MEMBERSMANAGER_EXPORT_DATA_DESC=" Allows users in this group to export data." COM_MEMBERSMANAGER_EXPORT_FAILED="Export Failed" @@ -321,10 +233,7 @@ COM_MEMBERSMANAGER_IMPORT_NO_IMPORT_TYPE_FOUND="Import type not found." COM_MEMBERSMANAGER_IMPORT_PLEASE_SELECT_COLUMN="-- Please Select Column --" COM_MEMBERSMANAGER_IMPORT_SELECT_FILE="Select File" COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_DIRECTORY="Set the path to file" -COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_COUNTRIES="Select the file to import data to countries." -COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_CURRENCIES="Select the file to import data to currencies." COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_MEMBERS="Select the file to import data to members." -COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_REGIONS="Select the file to import data to regions." COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_FOR_TYPES="Select the file to import data to types." COM_MEMBERSMANAGER_IMPORT_SELECT_FILE_URL="Enter file URL" COM_MEMBERSMANAGER_IMPORT_SUCCESS="Great! Import successful." @@ -337,45 +246,24 @@ COM_MEMBERSMANAGER_INACTIVE="Inactive" COM_MEMBERSMANAGER_KEEP_ORIGINAL_ACCESS="- Keep Original Access -" COM_MEMBERSMANAGER_KEEP_ORIGINAL_CATEGORY="- Keep Original Category -" COM_MEMBERSMANAGER_KEEP_ORIGINAL_STATE="- Keep Original State -" -COM_MEMBERSMANAGER_LAST_VISIT_DATE="Last Visit Date" COM_MEMBERSMANAGER_LICENSE="License" COM_MEMBERSMANAGER_MAIN_MEMBER="Main Member" COM_MEMBERSMANAGER_MEMBER="Member" COM_MEMBERSMANAGER_MEMBERS="Members" COM_MEMBERSMANAGER_MEMBERS_ACCESS="Members Access" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_ACCOUNT="Members Access Account" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_ACCOUNT_DESC="Allows the users in this group to access account of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_CITY="Members Access City" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_CITY_DESC="Allows the users in this group to access city of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_COUNTRY="Members Access Country" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_COUNTRY_DESC="Allows the users in this group to access country of member" COM_MEMBERSMANAGER_MEMBERS_ACCESS_DESC="Allows the users in this group to access access members" COM_MEMBERSMANAGER_MEMBERS_ACCESS_EMAIL="Members Access Email" COM_MEMBERSMANAGER_MEMBERS_ACCESS_EMAIL_DESC="Allows the users in this group to access email of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_LANDLINE_PHONE="Members Access Landline Phone" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_LANDLINE_PHONE_DESC="Allows the users in this group to access landline phone of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MAIN_MEMBER="Members Access Main Member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MAIN_MEMBER_DESC="Allows the users in this group to access main member of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MOBILE_PHONE="Members Access Mobile Phone" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MOBILE_PHONE_DESC="Allows the users in this group to access mobile phone of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_NAME="Members Access Name" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_NAME_DESC="Allows the users in this group to access name of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTAL="Members Access Postal" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTALCODE="Members Access Postalcode" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTALCODE_DESC="Allows the users in this group to access postalcode of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTAL_DESC="Allows the users in this group to access postal of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_REGION="Members Access Region" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_REGION_DESC="Allows the users in this group to access region of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_STREET="Members Access Street" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_STREET_DESC="Allows the users in this group to access street of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TOKEN="Members Access Token" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TOKEN_DESC="Allows the users in this group to access token of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TYPE="Members Access Type" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TYPE_DESC="Allows the users in this group to access type of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_USER="Members Access User" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_USER_DESC="Allows the users in this group to access user of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_WEBSITE="Members Access Website" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_WEBSITE_DESC="Allows the users in this group to access website of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD="Members Access Password" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD_CHECK="Members Access Password Check" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD_CHECK_DESC="Allows the users in this group to access password check of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD_DESC="Allows the users in this group to access password of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PROFILE_IMAGE="Members Access Profile Image" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PROFILE_IMAGE_DESC="Allows the users in this group to access profile image of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USEREMAIL="Members Access Useremail" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USEREMAIL_DESC="Allows the users in this group to access useremail of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USERNAME="Members Access Username" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USERNAME_DESC="Allows the users in this group to access username of member" COM_MEMBERSMANAGER_MEMBERS_BATCH_OPTIONS="Batch process the selected Members" COM_MEMBERSMANAGER_MEMBERS_BATCH_TIP="All changes will be applied to all selected Members" COM_MEMBERSMANAGER_MEMBERS_BATCH_USE="Members Batch Use" @@ -384,13 +272,10 @@ COM_MEMBERSMANAGER_MEMBERS_CREATE="Members Create" COM_MEMBERSMANAGER_MEMBERS_CREATE_DESC="Allows the users in this group to create create members" COM_MEMBERSMANAGER_MEMBERS_DELETE="Members Delete" COM_MEMBERSMANAGER_MEMBERS_DELETE_DESC="Allows the users in this group to delete delete members" +COM_MEMBERSMANAGER_MEMBERS_DETAILS="Details" COM_MEMBERSMANAGER_MEMBERS_EDIT="Members Edit" COM_MEMBERSMANAGER_MEMBERS_EDIT_ACCOUNT="Members Edit Account" COM_MEMBERSMANAGER_MEMBERS_EDIT_ACCOUNT_DESC="Allows the users in this group to edit account of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_CITY="Members Edit City" -COM_MEMBERSMANAGER_MEMBERS_EDIT_CITY_DESC="Allows the users in this group to edit city of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_COUNTRY="Members Edit Country" -COM_MEMBERSMANAGER_MEMBERS_EDIT_COUNTRY_DESC="Allows the users in this group to edit country of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_BY="Members Edit Created By" COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by members" COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_DATE="Members Edit Created Date" @@ -398,36 +283,34 @@ COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_DATE_DESC="Allows the users in this grou COM_MEMBERSMANAGER_MEMBERS_EDIT_DESC="Allows the users in this group to edit the member" COM_MEMBERSMANAGER_MEMBERS_EDIT_EMAIL="Members Edit Email" COM_MEMBERSMANAGER_MEMBERS_EDIT_EMAIL_DESC="Allows the users in this group to edit email of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_LANDLINE_PHONE="Members Edit Landline Phone" -COM_MEMBERSMANAGER_MEMBERS_EDIT_LANDLINE_PHONE_DESC="Allows the users in this group to edit landline phone of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_MAIN_MEMBER="Members Edit Main Member" COM_MEMBERSMANAGER_MEMBERS_EDIT_MAIN_MEMBER_DESC="Allows the users in this group to edit main member of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_MOBILE_PHONE="Members Edit Mobile Phone" -COM_MEMBERSMANAGER_MEMBERS_EDIT_MOBILE_PHONE_DESC="Allows the users in this group to edit mobile phone of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_NAME="Members Edit Name" COM_MEMBERSMANAGER_MEMBERS_EDIT_NAME_DESC="Allows the users in this group to edit name of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_OWN="Members Edit Own" COM_MEMBERSMANAGER_MEMBERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own members created by them" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTAL="Members Edit Postal" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTALCODE="Members Edit Postalcode" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTALCODE_DESC="Allows the users in this group to edit postalcode of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTAL_DESC="Allows the users in this group to edit postal of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_REGION="Members Edit Region" -COM_MEMBERSMANAGER_MEMBERS_EDIT_REGION_DESC="Allows the users in this group to edit region of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD="Members Edit Password" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD_CHECK="Members Edit Password Check" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD_CHECK_DESC="Allows the users in this group to edit password check of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD_DESC="Allows the users in this group to edit password of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PROFILE_IMAGE="Members Edit Profile Image" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PROFILE_IMAGE_DESC="Allows the users in this group to edit profile image of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_STATE="Members Edit State" COM_MEMBERSMANAGER_MEMBERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_STREET="Members Edit Street" -COM_MEMBERSMANAGER_MEMBERS_EDIT_STREET_DESC="Allows the users in this group to edit street of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_SURNAME="Members Edit Surname" +COM_MEMBERSMANAGER_MEMBERS_EDIT_SURNAME_DESC="Allows the users in this group to edit surname of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_TOKEN="Members Edit Token" COM_MEMBERSMANAGER_MEMBERS_EDIT_TOKEN_DESC="Allows the users in this group to edit token of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_TYPE="Members Edit Type" COM_MEMBERSMANAGER_MEMBERS_EDIT_TYPE_DESC="Allows the users in this group to edit type of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_USER="Members Edit User" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USEREMAIL="Members Edit Useremail" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USEREMAIL_DESC="Allows the users in this group to edit useremail of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USERNAME="Members Edit Username" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USERNAME_DESC="Allows the users in this group to edit username of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_USER_DESC="Allows the users in this group to edit user of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_VERSION="Members Edit Version" COM_MEMBERSMANAGER_MEMBERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version members" -COM_MEMBERSMANAGER_MEMBERS_EDIT_WEBSITE="Members Edit Website" -COM_MEMBERSMANAGER_MEMBERS_EDIT_WEBSITE_DESC="Allows the users in this group to edit website of member" COM_MEMBERSMANAGER_MEMBERS_EXPORT="Members Export" COM_MEMBERSMANAGER_MEMBERS_EXPORT_DESC="Allows the users in this group to export export members" COM_MEMBERSMANAGER_MEMBERS_IMPORT="Members Import" @@ -449,56 +332,40 @@ COM_MEMBERSMANAGER_MEMBERS_N_ITEMS_UNFEATURED="%s Members unfeatured." COM_MEMBERSMANAGER_MEMBERS_N_ITEMS_UNFEATURED_1="%s Member unfeatured." COM_MEMBERSMANAGER_MEMBERS_N_ITEMS_UNPUBLISHED="%s Members unpublished." COM_MEMBERSMANAGER_MEMBERS_N_ITEMS_UNPUBLISHED_1="%s Member unpublished." -COM_MEMBERSMANAGER_MEMBERS_SUBMENU="Members Submenu" -COM_MEMBERSMANAGER_MEMBERS_SUBMENU_DESC="Allows the users in this group to submenu of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_ACCOUNT="Members View Account" COM_MEMBERSMANAGER_MEMBERS_VIEW_ACCOUNT_DESC="Allows the users in this group to view account of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_CITY="Members View City" -COM_MEMBERSMANAGER_MEMBERS_VIEW_CITY_DESC="Allows the users in this group to view city of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_COUNTRY="Members View Country" -COM_MEMBERSMANAGER_MEMBERS_VIEW_COUNTRY_DESC="Allows the users in this group to view country of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_EMAIL="Members View Email" COM_MEMBERSMANAGER_MEMBERS_VIEW_EMAIL_DESC="Allows the users in this group to view email of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_LANDLINE_PHONE="Members View Landline Phone" -COM_MEMBERSMANAGER_MEMBERS_VIEW_LANDLINE_PHONE_DESC="Allows the users in this group to view landline phone of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_MAIN_MEMBER="Members View Main Member" COM_MEMBERSMANAGER_MEMBERS_VIEW_MAIN_MEMBER_DESC="Allows the users in this group to view main member of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_MOBILE_PHONE="Members View Mobile Phone" -COM_MEMBERSMANAGER_MEMBERS_VIEW_MOBILE_PHONE_DESC="Allows the users in this group to view mobile phone of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_NAME="Members View Name" COM_MEMBERSMANAGER_MEMBERS_VIEW_NAME_DESC="Allows the users in this group to view name of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTAL="Members View Postal" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTALCODE="Members View Postalcode" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTALCODE_DESC="Allows the users in this group to view postalcode of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTAL_DESC="Allows the users in this group to view postal of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_REGION="Members View Region" -COM_MEMBERSMANAGER_MEMBERS_VIEW_REGION_DESC="Allows the users in this group to view region of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_STREET="Members View Street" -COM_MEMBERSMANAGER_MEMBERS_VIEW_STREET_DESC="Allows the users in this group to view street of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD="Members View Password" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD_CHECK="Members View Password Check" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD_CHECK_DESC="Allows the users in this group to view password check of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD_DESC="Allows the users in this group to view password of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PROFILE_IMAGE="Members View Profile Image" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PROFILE_IMAGE_DESC="Allows the users in this group to view profile image of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_SURNAME="Members View Surname" +COM_MEMBERSMANAGER_MEMBERS_VIEW_SURNAME_DESC="Allows the users in this group to view surname of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_TOKEN="Members View Token" COM_MEMBERSMANAGER_MEMBERS_VIEW_TOKEN_DESC="Allows the users in this group to view token of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_TYPE="Members View Type" COM_MEMBERSMANAGER_MEMBERS_VIEW_TYPE_DESC="Allows the users in this group to view type of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_USER="Members View User" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL="Members View Useremail" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL_DESC="Allows the users in this group to view useremail of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME="Members View Username" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME_DESC="Allows the users in this group to view username of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_USER_DESC="Allows the users in this group to view user of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_WEBSITE="Members View Website" -COM_MEMBERSMANAGER_MEMBERS_VIEW_WEBSITE_DESC="Allows the users in this group to view website of member" COM_MEMBERSMANAGER_MEMBER_ACCOUNT="Account" COM_MEMBERSMANAGER_MEMBER_ACCOUNT_DESCRIPTION="What Type of Account is this." COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL="Account" -COM_MEMBERSMANAGER_MEMBER_CITY="City" -COM_MEMBERSMANAGER_MEMBER_CITY_DESCRIPTION="Please add your city name here" -COM_MEMBERSMANAGER_MEMBER_CITY_HINT="City Name" -COM_MEMBERSMANAGER_MEMBER_CITY_LABEL="City" -COM_MEMBERSMANAGER_MEMBER_CITY_MESSAGE="Error! Please add city here." -COM_MEMBERSMANAGER_MEMBER_COUNTRY="Country" -COM_MEMBERSMANAGER_MEMBER_COUNTRY_DESCRIPTION="Select the country." -COM_MEMBERSMANAGER_MEMBER_COUNTRY_LABEL="Country" COM_MEMBERSMANAGER_MEMBER_CREATED_BY_DESC="The user that created this Member." COM_MEMBERSMANAGER_MEMBER_CREATED_BY_LABEL="Created By" COM_MEMBERSMANAGER_MEMBER_CREATED_DATE_DESC="The date this Member was created." COM_MEMBERSMANAGER_MEMBER_CREATED_DATE_LABEL="Created Date" -COM_MEMBERSMANAGER_MEMBER_DETAILS="Details" +COM_MEMBERSMANAGER_MEMBER_DYNAMIC_TABS="Dynamic Tabs" COM_MEMBERSMANAGER_MEMBER_EDIT="Editing the Member" COM_MEMBERSMANAGER_MEMBER_EMAIL="Email" COM_MEMBERSMANAGER_MEMBER_EMAIL_DESCRIPTION="Enter Email" @@ -507,22 +374,14 @@ COM_MEMBERSMANAGER_MEMBER_EMAIL_LABEL="Email" COM_MEMBERSMANAGER_MEMBER_EMAIL_MESSAGE="Error! Please add email address here." COM_MEMBERSMANAGER_MEMBER_ERROR_UNIQUE_ALIAS="Another Member has the same alias." COM_MEMBERSMANAGER_MEMBER_ID="Id" -COM_MEMBERSMANAGER_MEMBER_IMAGE="Image" -COM_MEMBERSMANAGER_MEMBER_LANDLINE_PHONE="Landline Phone" -COM_MEMBERSMANAGER_MEMBER_LANDLINE_PHONE_DESCRIPTION="The landline phone number." -COM_MEMBERSMANAGER_MEMBER_LANDLINE_PHONE_HINT="Landline Phone Here" -COM_MEMBERSMANAGER_MEMBER_LANDLINE_PHONE_LABEL="Landline Phone" -COM_MEMBERSMANAGER_MEMBER_LANDLINE_PHONE_MESSAGE="Error! Please add landline phone number here." +COM_MEMBERSMANAGER_MEMBER_ID_MISMATCH_SS_COULD_NOT_BE_SAVED="Member ID mismatch, %s-%s could not be saved." +COM_MEMBERSMANAGER_MEMBER_IS_ALREADY_LINKED_TO_AN_USER_THIS_CAN_NOT_BE_CHANGED_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_IF_YOU_NEED_MORE_HELP="Member is already linked to an USER, this can not be changed. Contact your system administrator if you need more help." COM_MEMBERSMANAGER_MEMBER_MAIN="Main" COM_MEMBERSMANAGER_MEMBER_MAIN_LOGIN="Main & Login" COM_MEMBERSMANAGER_MEMBER_MAIN_MEMBER="Main Member" COM_MEMBERSMANAGER_MEMBER_MAIN_MEMBER_DESCRIPTION="Select the main member this sub-member belongs to." COM_MEMBERSMANAGER_MEMBER_MAIN_MEMBER_LABEL="Main Member" -COM_MEMBERSMANAGER_MEMBER_MOBILE_PHONE="Mobile Phone" -COM_MEMBERSMANAGER_MEMBER_MOBILE_PHONE_DESCRIPTION="Enter Mobile Phone Number" -COM_MEMBERSMANAGER_MEMBER_MOBILE_PHONE_HINT="Mobile Phone Here" -COM_MEMBERSMANAGER_MEMBER_MOBILE_PHONE_LABEL="Mobile Phone" -COM_MEMBERSMANAGER_MEMBER_MOBILE_PHONE_MESSAGE="Error! Please add mobile phone number here." +COM_MEMBERSMANAGER_MEMBER_MEMBERSHIP="Membership" COM_MEMBERSMANAGER_MEMBER_MODIFIED_BY_DESC="The last user that modified this Member." COM_MEMBERSMANAGER_MEMBER_MODIFIED_BY_LABEL="Modified By" COM_MEMBERSMANAGER_MEMBER_MODIFIED_DATE_DESC="The date this Member was modified." @@ -535,35 +394,50 @@ COM_MEMBERSMANAGER_MEMBER_NAME_MESSAGE="Error! Please add name here." COM_MEMBERSMANAGER_MEMBER_NEW="A New Member" COM_MEMBERSMANAGER_MEMBER_NOT_REQUIRED="Not Required" COM_MEMBERSMANAGER_MEMBER_ORDERING_LABEL="Ordering" +COM_MEMBERSMANAGER_MEMBER_PASSWORD="Password" +COM_MEMBERSMANAGER_MEMBER_PASSWORD_CHECK="Password Check" +COM_MEMBERSMANAGER_MEMBER_PASSWORD_CHECK_DESCRIPTION="Confirm the member's password." +COM_MEMBERSMANAGER_MEMBER_PASSWORD_CHECK_LABEL="Confirm Password" +COM_MEMBERSMANAGER_MEMBER_PASSWORD_DESCRIPTION="Enter the password for the member." +COM_MEMBERSMANAGER_MEMBER_PASSWORD_LABEL="Password" COM_MEMBERSMANAGER_MEMBER_PERMISSION="Permissions" -COM_MEMBERSMANAGER_MEMBER_POSTAL="Postal" -COM_MEMBERSMANAGER_MEMBER_POSTALCODE="Postalcode" -COM_MEMBERSMANAGER_MEMBER_POSTALCODE_DESCRIPTION="Please add your postal code here" -COM_MEMBERSMANAGER_MEMBER_POSTALCODE_HINT="9000" -COM_MEMBERSMANAGER_MEMBER_POSTALCODE_LABEL="Postal Code" -COM_MEMBERSMANAGER_MEMBER_POSTALCODE_MESSAGE="Error! Please add postal code here." -COM_MEMBERSMANAGER_MEMBER_POSTAL_DESCRIPTION="Please add your postal address here" -COM_MEMBERSMANAGER_MEMBER_POSTAL_HINT="P.O.Box 0000" -COM_MEMBERSMANAGER_MEMBER_POSTAL_LABEL="Postal" -COM_MEMBERSMANAGER_MEMBER_POSTAL_MESSAGE="Error! Please add postal address here." COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE="Member Profile (Site) Access" COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE_DESC=" Allows the users in this group to access site member profile." COM_MEMBERSMANAGER_MEMBER_PROFILE_IMAGE="Profile Image" -COM_MEMBERSMANAGER_MEMBER_PROFILE_IMAGE_UPLOADER_DESCRIPTION="


Upload Your profile image by dropping the file here or selecting the file from your computer


...
" +COM_MEMBERSMANAGER_MEMBER_PROFILE_IMAGE_UPLOADER_DESCRIPTION=" + + +
" COM_MEMBERSMANAGER_MEMBER_PROFILE_IMAGE_UPLOADER_LABEL="Profile Image" COM_MEMBERSMANAGER_MEMBER_PUBLISHING="Publishing" -COM_MEMBERSMANAGER_MEMBER_REGION="Region" -COM_MEMBERSMANAGER_MEMBER_REGION_DESCRIPTION="Please select the region this member belongs to." -COM_MEMBERSMANAGER_MEMBER_REGION_LABEL="Region" COM_MEMBERSMANAGER_MEMBER_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Member to customise the alias." COM_MEMBERSMANAGER_MEMBER_STATUS="Status" -COM_MEMBERSMANAGER_MEMBER_STREET="Street" -COM_MEMBERSMANAGER_MEMBER_STREET_DESCRIPTION="Please add your street address here" -COM_MEMBERSMANAGER_MEMBER_STREET_HINT="16 Street Name" -COM_MEMBERSMANAGER_MEMBER_STREET_LABEL="Street Address" -COM_MEMBERSMANAGER_MEMBER_STREET_MESSAGE="Error! Please add street here." COM_MEMBERSMANAGER_MEMBER_SUB="Sub" COM_MEMBERSMANAGER_MEMBER_SUB_LOGIN="Sub & Login" +COM_MEMBERSMANAGER_MEMBER_SURNAME="Surname" +COM_MEMBERSMANAGER_MEMBER_SURNAME_DESCRIPTION="Enter Surname Here" +COM_MEMBERSMANAGER_MEMBER_SURNAME_HINT="Surname Here" +COM_MEMBERSMANAGER_MEMBER_SURNAME_LABEL="Surname" +COM_MEMBERSMANAGER_MEMBER_SURNAME_MESSAGE="Error! Please add your surname here." COM_MEMBERSMANAGER_MEMBER_TOKEN="Token" COM_MEMBERSMANAGER_MEMBER_TOKEN_DESCRIPTION="Will be auto generated if left empty" COM_MEMBERSMANAGER_MEMBER_TOKEN_HINT="uniqueValue" @@ -573,119 +447,36 @@ COM_MEMBERSMANAGER_MEMBER_TYPE="Type" COM_MEMBERSMANAGER_MEMBER_TYPE_DESCRIPTION="Select the type" COM_MEMBERSMANAGER_MEMBER_TYPE_LABEL="Type" COM_MEMBERSMANAGER_MEMBER_USER="User" -COM_MEMBERSMANAGER_MEMBER_USER_HINT="select a user" -COM_MEMBERSMANAGER_MEMBER_USER_LABEL="User" +COM_MEMBERSMANAGER_MEMBER_USEREMAIL="Useremail" +COM_MEMBERSMANAGER_MEMBER_USEREMAIL_DESCRIPTION="Enter and email address" +COM_MEMBERSMANAGER_MEMBER_USEREMAIL_HINT="your@email.com" +COM_MEMBERSMANAGER_MEMBER_USEREMAIL_LABEL="Email" +COM_MEMBERSMANAGER_MEMBER_USEREMAIL_MESSAGE="Error! This email address is already registered." +COM_MEMBERSMANAGER_MEMBER_USERNAME="Username" +COM_MEMBERSMANAGER_MEMBER_USERNAME_DESCRIPTION="Enter the login name (Username) for the member." +COM_MEMBERSMANAGER_MEMBER_USERNAME_LABEL="Login Name" +COM_MEMBERSMANAGER_MEMBER_USERNAME_MESSAGE="Error! Login Name in use, try another." +COM_MEMBERSMANAGER_MEMBER_USER_LABEL="Linked User" COM_MEMBERSMANAGER_MEMBER_VERSION_DESC="A count of the number of times this Member has been revised." COM_MEMBERSMANAGER_MEMBER_VERSION_LABEL="Revision" -COM_MEMBERSMANAGER_MEMBER_WEBSITE="Website" -COM_MEMBERSMANAGER_MEMBER_WEBSITE_DESCRIPTION="Enter website address" -COM_MEMBERSMANAGER_MEMBER_WEBSITE_HINT="http://www.example.com" -COM_MEMBERSMANAGER_MEMBER_WEBSITE_LABEL="Website" -COM_MEMBERSMANAGER_MEMBER_WEBSITE_MESSAGE="Error! Please add website here." -COM_MEMBERSMANAGER_MOBILE="Mobile" -COM_MEMBERSMANAGER_NAME="Name" +COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER="Member was created successfully, and the login details was emailed to the member." +COM_MEMBERSMANAGER_MEMBER_WAS_NOT_ADDED_TO_ANY_GROUPS_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="Member was not added to any groups. Please inform your system administrator." COM_MEMBERSMANAGER_NEW="New" COM_MEMBERSMANAGER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!" COM_MEMBERSMANAGER_NO_ACCESS_GRANTED="No Access Granted!" COM_MEMBERSMANAGER_NO_IMPORT_FILE_SELECTED="No import file selected." +COM_MEMBERSMANAGER_NO_NAME="No Name" +COM_MEMBERSMANAGER_NO_PLACEHOLDERS_WERE_FOUND_PLEASE_TRY_AGAIN_LATER="No placeholders were found, please try again later." +COM_MEMBERSMANAGER_NO_TEMPLATE_FOR_BSB_WERE_FOUND="No template for %s were found" COM_MEMBERSMANAGER_OR="or" -COM_MEMBERSMANAGER_PASSWORD="Password" COM_MEMBERSMANAGER_PROPORTIONALLY="proportionally" COM_MEMBERSMANAGER_PUBLISHED="Published" -COM_MEMBERSMANAGER_READY_TO_SELECT="Ready to Select" -COM_MEMBERSMANAGER_REGION="Region" -COM_MEMBERSMANAGER_REGIONS="Regions" -COM_MEMBERSMANAGER_REGIONS_ACCESS="Regions Access" -COM_MEMBERSMANAGER_REGIONS_ACCESS_DESC="Allows the users in this group to access access regions" -COM_MEMBERSMANAGER_REGIONS_BATCH_OPTIONS="Batch process the selected Regions" -COM_MEMBERSMANAGER_REGIONS_BATCH_TIP="All changes will be applied to all selected Regions" -COM_MEMBERSMANAGER_REGIONS_BATCH_USE="Regions Batch Use" -COM_MEMBERSMANAGER_REGIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch regions" -COM_MEMBERSMANAGER_REGIONS_CREATE="Regions Create" -COM_MEMBERSMANAGER_REGIONS_CREATE_DESC="Allows the users in this group to create create regions" -COM_MEMBERSMANAGER_REGIONS_DELETE="Regions Delete" -COM_MEMBERSMANAGER_REGIONS_DELETE_DESC="Allows the users in this group to delete delete regions" -COM_MEMBERSMANAGER_REGIONS_EDIT="Regions Edit" -COM_MEMBERSMANAGER_REGIONS_EDIT_ALIAS="Regions Edit Alias" -COM_MEMBERSMANAGER_REGIONS_EDIT_ALIAS_DESC="Allows the users in this group to edit alias of region" -COM_MEMBERSMANAGER_REGIONS_EDIT_COUNTRY="Regions Edit Country" -COM_MEMBERSMANAGER_REGIONS_EDIT_COUNTRY_DESC="Allows the users in this group to edit country of region" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_BY="Regions Edit Created By" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by regions" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_DATE="Regions Edit Created Date" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created regions" -COM_MEMBERSMANAGER_REGIONS_EDIT_DESC="Allows the users in this group to edit the region" -COM_MEMBERSMANAGER_REGIONS_EDIT_NAME="Regions Edit Name" -COM_MEMBERSMANAGER_REGIONS_EDIT_NAME_DESC="Allows the users in this group to edit name of region" -COM_MEMBERSMANAGER_REGIONS_EDIT_OWN="Regions Edit Own" -COM_MEMBERSMANAGER_REGIONS_EDIT_OWN_DESC="Allows the users in this group to edit edit own regions created by them" -COM_MEMBERSMANAGER_REGIONS_EDIT_STATE="Regions Edit State" -COM_MEMBERSMANAGER_REGIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the region" -COM_MEMBERSMANAGER_REGIONS_EXPORT="Regions Export" -COM_MEMBERSMANAGER_REGIONS_EXPORT_DESC="Allows the users in this group to export export regions" -COM_MEMBERSMANAGER_REGIONS_IMPORT="Regions Import" -COM_MEMBERSMANAGER_REGIONS_IMPORT_DESC="Allows the users in this group to import import regions" -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_ARCHIVED="%s Regions archived." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_ARCHIVED_1="%s Region archived." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_CHECKED_IN_0="No Region successfully checked in." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_CHECKED_IN_1="%d Region successfully checked in." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_CHECKED_IN_MORE="%d Regions successfully checked in." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_DELETED="%s Regions deleted." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_DELETED_1="%s Region deleted." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_FEATURED="%s Regions featured." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_FEATURED_1="%s Region featured." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_PUBLISHED="%s Regions published." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_PUBLISHED_1="%s Region published." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_TRASHED="%s Regions trashed." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_TRASHED_1="%s Region trashed." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_UNFEATURED="%s Regions unfeatured." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_UNFEATURED_1="%s Region unfeatured." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_UNPUBLISHED="%s Regions unpublished." -COM_MEMBERSMANAGER_REGIONS_N_ITEMS_UNPUBLISHED_1="%s Region unpublished." -COM_MEMBERSMANAGER_REGION_ALIAS="Alias" -COM_MEMBERSMANAGER_REGION_ALIAS_HINT="Auto-generated from name" -COM_MEMBERSMANAGER_REGION_ALIAS_LABEL="Alias" -COM_MEMBERSMANAGER_REGION_COUNTRY="Country" -COM_MEMBERSMANAGER_REGION_COUNTRY_DESCRIPTION="Select the country." -COM_MEMBERSMANAGER_REGION_COUNTRY_LABEL="Country" -COM_MEMBERSMANAGER_REGION_CREATED_BY_DESC="The user that created this Region." -COM_MEMBERSMANAGER_REGION_CREATED_BY_LABEL="Created By" -COM_MEMBERSMANAGER_REGION_CREATED_DATE_DESC="The date this Region was created." -COM_MEMBERSMANAGER_REGION_CREATED_DATE_LABEL="Created Date" -COM_MEMBERSMANAGER_REGION_DETAILS="Details" -COM_MEMBERSMANAGER_REGION_EDIT="Editing the Region" -COM_MEMBERSMANAGER_REGION_ERROR_UNIQUE_ALIAS="Another Region has the same alias." -COM_MEMBERSMANAGER_REGION_ID="Id" -COM_MEMBERSMANAGER_REGION_MODIFIED_BY_DESC="The last user that modified this Region." -COM_MEMBERSMANAGER_REGION_MODIFIED_BY_LABEL="Modified By" -COM_MEMBERSMANAGER_REGION_MODIFIED_DATE_DESC="The date this Region was modified." -COM_MEMBERSMANAGER_REGION_MODIFIED_DATE_LABEL="Modified Date" -COM_MEMBERSMANAGER_REGION_NAME="Name" -COM_MEMBERSMANAGER_REGION_NAME_DESCRIPTION="Enter Name Here" -COM_MEMBERSMANAGER_REGION_NAME_HINT="Name Here" -COM_MEMBERSMANAGER_REGION_NAME_LABEL="Name" -COM_MEMBERSMANAGER_REGION_NAME_MESSAGE="Error! Please add name here." -COM_MEMBERSMANAGER_REGION_NEW="A New Region" -COM_MEMBERSMANAGER_REGION_ORDERING_LABEL="Ordering" -COM_MEMBERSMANAGER_REGION_PERMISSION="Permissions" -COM_MEMBERSMANAGER_REGION_PUBLISHING="Publishing" -COM_MEMBERSMANAGER_REGION_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Region to customise the alias." -COM_MEMBERSMANAGER_REGION_STATUS="Status" -COM_MEMBERSMANAGER_REGION_VERSION_DESC="A count of the number of times this Region has been revised." -COM_MEMBERSMANAGER_REGION_VERSION_LABEL="Revision" -COM_MEMBERSMANAGER_REGISTRATION_DATE="Registration Date" COM_MEMBERSMANAGER_REMOVE="Remove" COM_MEMBERSMANAGER_SAVE_SUCCESS="Great! Item successfully saved." -COM_MEMBERSMANAGER_SAVE_USER_DETAILS="Save User Details" COM_MEMBERSMANAGER_SAVE_WARNING="The value already existed so please select another." -COM_MEMBERSMANAGER_SELECT_AN_OPTION="Select an option" COM_MEMBERSMANAGER_SELECT_A_REGION="select a region" -COM_MEMBERSMANAGER_SOME_REQUIRED_VALUES_ARE_MISSING="Some required values are missing" -COM_MEMBERSMANAGER_SUBMENU_COUNTRIES="Countries" -COM_MEMBERSMANAGER_SUBMENU_CURRENCIES="Currencies" -COM_MEMBERSMANAGER_SUBMENU_MEMBERS="Members" -COM_MEMBERSMANAGER_SUCCESS="Success" -COM_MEMBERSMANAGER_TEL="Tel" +COM_MEMBERSMANAGER_S_COULD_NOT_BE_SAVED_PLEASE_TRY_AGAIN_THIS_COULD_BE_DUE_TO_THE_FACT_THIS_THE_MEMBER_ID_WAS_NOT_READY="%s could not be saved, please try again. This could be due to the fact this the member ID was not ready." +COM_MEMBERSMANAGER_S_DATA_COULD_NOT_BE_SAVED="%s data could not be saved" COM_MEMBERSMANAGER_THERE_HAS_BEEN_AN_ERROR="There has been an error." COM_MEMBERSMANAGER_THE_PROFILE_WILL_BE_CROPPED_TO_THIS_SIZE="The profile will be cropped to this size" COM_MEMBERSMANAGER_TRASHED="Trashed" @@ -709,6 +500,10 @@ COM_MEMBERSMANAGER_TYPES_EDIT_CREATED_DATE_DESC="Allows the users in this group COM_MEMBERSMANAGER_TYPES_EDIT_DESC="Allows the users in this group to edit the type" COM_MEMBERSMANAGER_TYPES_EDIT_DESCRIPTION="Types Edit Description" COM_MEMBERSMANAGER_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of type" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_ACCESS="Types Edit Groups Access" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_ACCESS_DESC="Allows the users in this group to edit groups access of type" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_TARGET="Types Edit Groups Target" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_TARGET_DESC="Allows the users in this group to edit groups target of type" COM_MEMBERSMANAGER_TYPES_EDIT_NAME="Types Edit Name" COM_MEMBERSMANAGER_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of type" COM_MEMBERSMANAGER_TYPES_EDIT_OWN="Types Edit Own" @@ -752,6 +547,12 @@ COM_MEMBERSMANAGER_TYPE_DESCRIPTION_LABEL="Description" COM_MEMBERSMANAGER_TYPE_DETAILS="Details" COM_MEMBERSMANAGER_TYPE_EDIT="Editing the Type" COM_MEMBERSMANAGER_TYPE_ERROR_UNIQUE_ALIAS="Another Type has the same alias." +COM_MEMBERSMANAGER_TYPE_GROUPS_ACCESS="Groups Access" +COM_MEMBERSMANAGER_TYPE_GROUPS_ACCESS_DESCRIPTION="Select access group/s" +COM_MEMBERSMANAGER_TYPE_GROUPS_ACCESS_LABEL="Access Group/s" +COM_MEMBERSMANAGER_TYPE_GROUPS_TARGET="Groups Target" +COM_MEMBERSMANAGER_TYPE_GROUPS_TARGET_DESCRIPTION="Select target group/s" +COM_MEMBERSMANAGER_TYPE_GROUPS_TARGET_LABEL="Target Group/s" COM_MEMBERSMANAGER_TYPE_ID="Id" COM_MEMBERSMANAGER_TYPE_MODIFIED_BY_DESC="The last user that modified this Type." COM_MEMBERSMANAGER_TYPE_MODIFIED_BY_LABEL="Modified By" @@ -770,12 +571,6 @@ COM_MEMBERSMANAGER_TYPE_SAVE_WARNING="Alias already existed so a number was adde COM_MEMBERSMANAGER_TYPE_STATUS="Status" COM_MEMBERSMANAGER_TYPE_VERSION_DESC="A count of the number of times this Type has been revised." COM_MEMBERSMANAGER_TYPE_VERSION_LABEL="Revision" -COM_MEMBERSMANAGER_USERDOMAINCOM="user@domain.com" -COM_MEMBERSMANAGER_USERNAME="Username" -COM_MEMBERSMANAGER_USER_DETAILS_WILL_BE_EMAILED_DURING_CREATION_OF_THE_USER_ACCOUNT="User details will be emailed during creation of the user account." -COM_MEMBERSMANAGER_USER_GROUP="User Group" -COM_MEMBERSMANAGER_USER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_USER="User was created successfully, and the login details was emailed to the user." -COM_MEMBERSMANAGER_USER_WAS_UPDATED_SUCCESSFULLY="User was updated successfully" COM_MEMBERSMANAGER_USE_BATCH="Use Batch" COM_MEMBERSMANAGER_USE_BATCH_DESC=" Allows users in this group to use batch copy/update method." COM_MEMBERSMANAGER_VALUE_ALREADY_TAKEN_PLEASE_TRY_AGAIN="Value already taken, please try again." @@ -783,10 +578,8 @@ COM_MEMBERSMANAGER_VERSION="Version" COM_MEMBERSMANAGER_WARNING_IMPORT_FILE_ERROR="Warning, import file error." COM_MEMBERSMANAGER_WARNING_IMPORT_UPLOAD_ERROR="Warning, import upload error." COM_MEMBERSMANAGER_WEBSITE="Website" -COM_MEMBERSMANAGER_YOU_CAN_NOW_SELECT_BSB_THAT_YOU_JUST_CREATED_FROM_THE_USERS_LIST_IN_THE_ABOVE_FIELD_SIMPLY_CLICK_ON_THE_BLUE_USER_ICON="You can now select %s that you just created from the users list in the above field. Simply click on the blue user icon." +COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_ADD_DATA_TO_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to add data to %s, please contact your system administrator." +COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_S_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="You do not have permission to edit %s, please contact your system administrator." COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_REMOVE_THIS_FILE="You do not have permission to remove this file." COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_UPLOAD_AN="You do not have permission to upload an" -COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S="% has been checked out by %s" -MEMBERS_DETAILS="Details" -MEMBERS_MEMBER="Member" -MEMBERS_PHONE="Phone" \ No newline at end of file +COM_MEMBERSMANAGER__HAS_BEEN_CHECKED_OUT_BY_S="% has been checked out by %s" \ No newline at end of file diff --git a/admin/language/en-GB/en-GB.com_membersmanager.sys.ini b/admin/language/en-GB/en-GB.com_membersmanager.sys.ini index 96cdb17..f301f6a 100644 --- a/admin/language/en-GB/en-GB.com_membersmanager.sys.ini +++ b/admin/language/en-GB/en-GB.com_membersmanager.sys.ini @@ -1,45 +1,7 @@ COM_MEMBERSMANAGER="Members Manager" COM_MEMBERSMANAGER_CONFIGURATION="Members Manager Configuration" -COM_MEMBERSMANAGER_COUNTRIES_ACCESS="Countries Access" -COM_MEMBERSMANAGER_COUNTRIES_ACCESS_DESC="Allows the users in this group to access access countries" -COM_MEMBERSMANAGER_COUNTRIES_BATCH_USE="Countries Batch Use" -COM_MEMBERSMANAGER_COUNTRIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch countries" -COM_MEMBERSMANAGER_COUNTRIES_CREATE="Countries Create" -COM_MEMBERSMANAGER_COUNTRIES_CREATE_DESC="Allows the users in this group to create create countries" -COM_MEMBERSMANAGER_COUNTRIES_DELETE="Countries Delete" -COM_MEMBERSMANAGER_COUNTRIES_DELETE_DESC="Allows the users in this group to delete delete countries" -COM_MEMBERSMANAGER_COUNTRIES_EDIT="Countries Edit" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_DESC="Allows the users in this group to edit the country" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_OWN="Countries Edit Own" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own countries created by them" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_STATE="Countries Edit State" -COM_MEMBERSMANAGER_COUNTRIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the country" -COM_MEMBERSMANAGER_COUNTRIES_EXPORT="Countries Export" -COM_MEMBERSMANAGER_COUNTRIES_EXPORT_DESC="Allows the users in this group to export export countries" -COM_MEMBERSMANAGER_COUNTRIES_IMPORT="Countries Import" -COM_MEMBERSMANAGER_COUNTRIES_IMPORT_DESC="Allows the users in this group to import import countries" -COM_MEMBERSMANAGER_COUNTRIES_SUBMENU="Countries Submenu" -COM_MEMBERSMANAGER_COUNTRIES_SUBMENU_DESC="Allows the users in this group to submenu of country" -COM_MEMBERSMANAGER_CURRENCIES_ACCESS="Currencies Access" -COM_MEMBERSMANAGER_CURRENCIES_ACCESS_DESC="Allows the users in this group to access access currencies" -COM_MEMBERSMANAGER_CURRENCIES_BATCH_USE="Currencies Batch Use" -COM_MEMBERSMANAGER_CURRENCIES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch currencies" -COM_MEMBERSMANAGER_CURRENCIES_CREATE="Currencies Create" -COM_MEMBERSMANAGER_CURRENCIES_CREATE_DESC="Allows the users in this group to create create currencies" -COM_MEMBERSMANAGER_CURRENCIES_DELETE="Currencies Delete" -COM_MEMBERSMANAGER_CURRENCIES_DELETE_DESC="Allows the users in this group to delete delete currencies" -COM_MEMBERSMANAGER_CURRENCIES_EDIT="Currencies Edit" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_DESC="Allows the users in this group to edit the currency" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_OWN="Currencies Edit Own" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_OWN_DESC="Allows the users in this group to edit edit own currencies created by them" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_STATE="Currencies Edit State" -COM_MEMBERSMANAGER_CURRENCIES_EDIT_STATE_DESC="Allows the users in this group to update the state of the currency" -COM_MEMBERSMANAGER_CURRENCIES_EXPORT="Currencies Export" -COM_MEMBERSMANAGER_CURRENCIES_EXPORT_DESC="Allows the users in this group to export export currencies" -COM_MEMBERSMANAGER_CURRENCIES_IMPORT="Currencies Import" -COM_MEMBERSMANAGER_CURRENCIES_IMPORT_DESC="Allows the users in this group to import import currencies" -COM_MEMBERSMANAGER_CURRENCIES_SUBMENU="Currencies Submenu" -COM_MEMBERSMANAGER_CURRENCIES_SUBMENU_DESC="Allows the users in this group to submenu of currency" +COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE="cPanel (Site) Access" +COM_MEMBERSMANAGER_CPANEL_ACCESS_SITE_DESC=" Allows the users in this group to access site cpanel." COM_MEMBERSMANAGER_EDIT_CREATED_BY="Edit Created By" COM_MEMBERSMANAGER_EDIT_CREATED_BY_DESC=" Allows users in this group to edit created by." COM_MEMBERSMANAGER_EDIT_CREATED_DATE="Edit Created Date" @@ -51,39 +13,19 @@ COM_MEMBERSMANAGER_EXPORT_DATA_DESC=" Allows users in this group to export data. COM_MEMBERSMANAGER_IMPORT_DATA="Import Data" COM_MEMBERSMANAGER_IMPORT_DATA_DESC=" Allows users in this group to import data." COM_MEMBERSMANAGER_MEMBERS_ACCESS="Members Access" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_ACCOUNT="Members Access Account" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_ACCOUNT_DESC="Allows the users in this group to access account of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_CITY="Members Access City" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_CITY_DESC="Allows the users in this group to access city of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_COUNTRY="Members Access Country" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_COUNTRY_DESC="Allows the users in this group to access country of member" COM_MEMBERSMANAGER_MEMBERS_ACCESS_DESC="Allows the users in this group to access access members" COM_MEMBERSMANAGER_MEMBERS_ACCESS_EMAIL="Members Access Email" COM_MEMBERSMANAGER_MEMBERS_ACCESS_EMAIL_DESC="Allows the users in this group to access email of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_LANDLINE_PHONE="Members Access Landline Phone" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_LANDLINE_PHONE_DESC="Allows the users in this group to access landline phone of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MAIN_MEMBER="Members Access Main Member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MAIN_MEMBER_DESC="Allows the users in this group to access main member of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MOBILE_PHONE="Members Access Mobile Phone" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_MOBILE_PHONE_DESC="Allows the users in this group to access mobile phone of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_NAME="Members Access Name" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_NAME_DESC="Allows the users in this group to access name of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTAL="Members Access Postal" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTALCODE="Members Access Postalcode" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTALCODE_DESC="Allows the users in this group to access postalcode of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_POSTAL_DESC="Allows the users in this group to access postal of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_REGION="Members Access Region" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_REGION_DESC="Allows the users in this group to access region of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_STREET="Members Access Street" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_STREET_DESC="Allows the users in this group to access street of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TOKEN="Members Access Token" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TOKEN_DESC="Allows the users in this group to access token of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TYPE="Members Access Type" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_TYPE_DESC="Allows the users in this group to access type of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_USER="Members Access User" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_USER_DESC="Allows the users in this group to access user of member" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_WEBSITE="Members Access Website" -COM_MEMBERSMANAGER_MEMBERS_ACCESS_WEBSITE_DESC="Allows the users in this group to access website of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD="Members Access Password" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD_CHECK="Members Access Password Check" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD_CHECK_DESC="Allows the users in this group to access password check of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PASSWORD_DESC="Allows the users in this group to access password of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PROFILE_IMAGE="Members Access Profile Image" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_PROFILE_IMAGE_DESC="Allows the users in this group to access profile image of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USEREMAIL="Members Access Useremail" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USEREMAIL_DESC="Allows the users in this group to access useremail of member" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USERNAME="Members Access Username" +COM_MEMBERSMANAGER_MEMBERS_ACCESS_USERNAME_DESC="Allows the users in this group to access username of member" COM_MEMBERSMANAGER_MEMBERS_BATCH_USE="Members Batch Use" COM_MEMBERSMANAGER_MEMBERS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch members" COM_MEMBERSMANAGER_MEMBERS_CREATE="Members Create" @@ -93,10 +35,6 @@ COM_MEMBERSMANAGER_MEMBERS_DELETE_DESC="Allows the users in this group to delete COM_MEMBERSMANAGER_MEMBERS_EDIT="Members Edit" COM_MEMBERSMANAGER_MEMBERS_EDIT_ACCOUNT="Members Edit Account" COM_MEMBERSMANAGER_MEMBERS_EDIT_ACCOUNT_DESC="Allows the users in this group to edit account of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_CITY="Members Edit City" -COM_MEMBERSMANAGER_MEMBERS_EDIT_CITY_DESC="Allows the users in this group to edit city of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_COUNTRY="Members Edit Country" -COM_MEMBERSMANAGER_MEMBERS_EDIT_COUNTRY_DESC="Allows the users in this group to edit country of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_BY="Members Edit Created By" COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by members" COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_DATE="Members Edit Created Date" @@ -104,105 +42,70 @@ COM_MEMBERSMANAGER_MEMBERS_EDIT_CREATED_DATE_DESC="Allows the users in this grou COM_MEMBERSMANAGER_MEMBERS_EDIT_DESC="Allows the users in this group to edit the member" COM_MEMBERSMANAGER_MEMBERS_EDIT_EMAIL="Members Edit Email" COM_MEMBERSMANAGER_MEMBERS_EDIT_EMAIL_DESC="Allows the users in this group to edit email of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_LANDLINE_PHONE="Members Edit Landline Phone" -COM_MEMBERSMANAGER_MEMBERS_EDIT_LANDLINE_PHONE_DESC="Allows the users in this group to edit landline phone of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_MAIN_MEMBER="Members Edit Main Member" COM_MEMBERSMANAGER_MEMBERS_EDIT_MAIN_MEMBER_DESC="Allows the users in this group to edit main member of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_MOBILE_PHONE="Members Edit Mobile Phone" -COM_MEMBERSMANAGER_MEMBERS_EDIT_MOBILE_PHONE_DESC="Allows the users in this group to edit mobile phone of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_NAME="Members Edit Name" COM_MEMBERSMANAGER_MEMBERS_EDIT_NAME_DESC="Allows the users in this group to edit name of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_OWN="Members Edit Own" COM_MEMBERSMANAGER_MEMBERS_EDIT_OWN_DESC="Allows the users in this group to edit edit own members created by them" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTAL="Members Edit Postal" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTALCODE="Members Edit Postalcode" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTALCODE_DESC="Allows the users in this group to edit postalcode of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_POSTAL_DESC="Allows the users in this group to edit postal of member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_REGION="Members Edit Region" -COM_MEMBERSMANAGER_MEMBERS_EDIT_REGION_DESC="Allows the users in this group to edit region of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD="Members Edit Password" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD_CHECK="Members Edit Password Check" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD_CHECK_DESC="Allows the users in this group to edit password check of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PASSWORD_DESC="Allows the users in this group to edit password of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PROFILE_IMAGE="Members Edit Profile Image" +COM_MEMBERSMANAGER_MEMBERS_EDIT_PROFILE_IMAGE_DESC="Allows the users in this group to edit profile image of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_STATE="Members Edit State" COM_MEMBERSMANAGER_MEMBERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the member" -COM_MEMBERSMANAGER_MEMBERS_EDIT_STREET="Members Edit Street" -COM_MEMBERSMANAGER_MEMBERS_EDIT_STREET_DESC="Allows the users in this group to edit street of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_SURNAME="Members Edit Surname" +COM_MEMBERSMANAGER_MEMBERS_EDIT_SURNAME_DESC="Allows the users in this group to edit surname of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_TOKEN="Members Edit Token" COM_MEMBERSMANAGER_MEMBERS_EDIT_TOKEN_DESC="Allows the users in this group to edit token of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_TYPE="Members Edit Type" COM_MEMBERSMANAGER_MEMBERS_EDIT_TYPE_DESC="Allows the users in this group to edit type of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_USER="Members Edit User" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USEREMAIL="Members Edit Useremail" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USEREMAIL_DESC="Allows the users in this group to edit useremail of member" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USERNAME="Members Edit Username" +COM_MEMBERSMANAGER_MEMBERS_EDIT_USERNAME_DESC="Allows the users in this group to edit username of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_USER_DESC="Allows the users in this group to edit user of member" COM_MEMBERSMANAGER_MEMBERS_EDIT_VERSION="Members Edit Version" COM_MEMBERSMANAGER_MEMBERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version members" -COM_MEMBERSMANAGER_MEMBERS_EDIT_WEBSITE="Members Edit Website" -COM_MEMBERSMANAGER_MEMBERS_EDIT_WEBSITE_DESC="Allows the users in this group to edit website of member" COM_MEMBERSMANAGER_MEMBERS_EXPORT="Members Export" COM_MEMBERSMANAGER_MEMBERS_EXPORT_DESC="Allows the users in this group to export export members" COM_MEMBERSMANAGER_MEMBERS_IMPORT="Members Import" COM_MEMBERSMANAGER_MEMBERS_IMPORT_DESC="Allows the users in this group to import import members" -COM_MEMBERSMANAGER_MEMBERS_SUBMENU="Members Submenu" -COM_MEMBERSMANAGER_MEMBERS_SUBMENU_DESC="Allows the users in this group to submenu of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_ACCOUNT="Members View Account" COM_MEMBERSMANAGER_MEMBERS_VIEW_ACCOUNT_DESC="Allows the users in this group to view account of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_CITY="Members View City" -COM_MEMBERSMANAGER_MEMBERS_VIEW_CITY_DESC="Allows the users in this group to view city of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_COUNTRY="Members View Country" -COM_MEMBERSMANAGER_MEMBERS_VIEW_COUNTRY_DESC="Allows the users in this group to view country of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_EMAIL="Members View Email" COM_MEMBERSMANAGER_MEMBERS_VIEW_EMAIL_DESC="Allows the users in this group to view email of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_LANDLINE_PHONE="Members View Landline Phone" -COM_MEMBERSMANAGER_MEMBERS_VIEW_LANDLINE_PHONE_DESC="Allows the users in this group to view landline phone of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_MAIN_MEMBER="Members View Main Member" COM_MEMBERSMANAGER_MEMBERS_VIEW_MAIN_MEMBER_DESC="Allows the users in this group to view main member of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_MOBILE_PHONE="Members View Mobile Phone" -COM_MEMBERSMANAGER_MEMBERS_VIEW_MOBILE_PHONE_DESC="Allows the users in this group to view mobile phone of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_NAME="Members View Name" COM_MEMBERSMANAGER_MEMBERS_VIEW_NAME_DESC="Allows the users in this group to view name of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTAL="Members View Postal" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTALCODE="Members View Postalcode" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTALCODE_DESC="Allows the users in this group to view postalcode of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_POSTAL_DESC="Allows the users in this group to view postal of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_REGION="Members View Region" -COM_MEMBERSMANAGER_MEMBERS_VIEW_REGION_DESC="Allows the users in this group to view region of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_STREET="Members View Street" -COM_MEMBERSMANAGER_MEMBERS_VIEW_STREET_DESC="Allows the users in this group to view street of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD="Members View Password" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD_CHECK="Members View Password Check" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD_CHECK_DESC="Allows the users in this group to view password check of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PASSWORD_DESC="Allows the users in this group to view password of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PROFILE_IMAGE="Members View Profile Image" +COM_MEMBERSMANAGER_MEMBERS_VIEW_PROFILE_IMAGE_DESC="Allows the users in this group to view profile image of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_SURNAME="Members View Surname" +COM_MEMBERSMANAGER_MEMBERS_VIEW_SURNAME_DESC="Allows the users in this group to view surname of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_TOKEN="Members View Token" COM_MEMBERSMANAGER_MEMBERS_VIEW_TOKEN_DESC="Allows the users in this group to view token of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_TYPE="Members View Type" COM_MEMBERSMANAGER_MEMBERS_VIEW_TYPE_DESC="Allows the users in this group to view type of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_USER="Members View User" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL="Members View Useremail" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USEREMAIL_DESC="Allows the users in this group to view useremail of member" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME="Members View Username" +COM_MEMBERSMANAGER_MEMBERS_VIEW_USERNAME_DESC="Allows the users in this group to view username of member" COM_MEMBERSMANAGER_MEMBERS_VIEW_USER_DESC="Allows the users in this group to view user of member" -COM_MEMBERSMANAGER_MEMBERS_VIEW_WEBSITE="Members View Website" -COM_MEMBERSMANAGER_MEMBERS_VIEW_WEBSITE_DESC="Allows the users in this group to view website of member" COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE="Member Profile (Site) Access" COM_MEMBERSMANAGER_MEMBER_PROFILE_ACCESS_SITE_DESC=" Allows the users in this group to access site member profile." COM_MEMBERSMANAGER_MENU="» Members Manager" -COM_MEMBERSMANAGER_REGIONS_ACCESS="Regions Access" -COM_MEMBERSMANAGER_REGIONS_ACCESS_DESC="Allows the users in this group to access access regions" -COM_MEMBERSMANAGER_REGIONS_BATCH_USE="Regions Batch Use" -COM_MEMBERSMANAGER_REGIONS_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch regions" -COM_MEMBERSMANAGER_REGIONS_CREATE="Regions Create" -COM_MEMBERSMANAGER_REGIONS_CREATE_DESC="Allows the users in this group to create create regions" -COM_MEMBERSMANAGER_REGIONS_DELETE="Regions Delete" -COM_MEMBERSMANAGER_REGIONS_DELETE_DESC="Allows the users in this group to delete delete regions" -COM_MEMBERSMANAGER_REGIONS_EDIT="Regions Edit" -COM_MEMBERSMANAGER_REGIONS_EDIT_ALIAS="Regions Edit Alias" -COM_MEMBERSMANAGER_REGIONS_EDIT_ALIAS_DESC="Allows the users in this group to edit alias of region" -COM_MEMBERSMANAGER_REGIONS_EDIT_COUNTRY="Regions Edit Country" -COM_MEMBERSMANAGER_REGIONS_EDIT_COUNTRY_DESC="Allows the users in this group to edit country of region" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_BY="Regions Edit Created By" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by regions" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_DATE="Regions Edit Created Date" -COM_MEMBERSMANAGER_REGIONS_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created regions" -COM_MEMBERSMANAGER_REGIONS_EDIT_DESC="Allows the users in this group to edit the region" -COM_MEMBERSMANAGER_REGIONS_EDIT_NAME="Regions Edit Name" -COM_MEMBERSMANAGER_REGIONS_EDIT_NAME_DESC="Allows the users in this group to edit name of region" -COM_MEMBERSMANAGER_REGIONS_EDIT_OWN="Regions Edit Own" -COM_MEMBERSMANAGER_REGIONS_EDIT_OWN_DESC="Allows the users in this group to edit edit own regions created by them" -COM_MEMBERSMANAGER_REGIONS_EDIT_STATE="Regions Edit State" -COM_MEMBERSMANAGER_REGIONS_EDIT_STATE_DESC="Allows the users in this group to update the state of the region" -COM_MEMBERSMANAGER_REGIONS_EXPORT="Regions Export" -COM_MEMBERSMANAGER_REGIONS_EXPORT_DESC="Allows the users in this group to export export regions" -COM_MEMBERSMANAGER_REGIONS_IMPORT="Regions Import" -COM_MEMBERSMANAGER_REGIONS_IMPORT_DESC="Allows the users in this group to import import regions" +COM_MEMBERSMANAGER_MENU_CPANEL_DESC="Control Panel for Members" +COM_MEMBERSMANAGER_MENU_CPANEL_OPTION="cPanel" +COM_MEMBERSMANAGER_MENU_CPANEL_TITLE="cPanel" COM_MEMBERSMANAGER_TYPES_ACCESS="Types Access" COM_MEMBERSMANAGER_TYPES_ACCESS_DESC="Allows the users in this group to access access types" COM_MEMBERSMANAGER_TYPES_BATCH_USE="Types Batch Use" @@ -219,6 +122,10 @@ COM_MEMBERSMANAGER_TYPES_EDIT_CREATED_DATE_DESC="Allows the users in this group COM_MEMBERSMANAGER_TYPES_EDIT_DESC="Allows the users in this group to edit the type" COM_MEMBERSMANAGER_TYPES_EDIT_DESCRIPTION="Types Edit Description" COM_MEMBERSMANAGER_TYPES_EDIT_DESCRIPTION_DESC="Allows the users in this group to edit description of type" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_ACCESS="Types Edit Groups Access" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_ACCESS_DESC="Allows the users in this group to edit groups access of type" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_TARGET="Types Edit Groups Target" +COM_MEMBERSMANAGER_TYPES_EDIT_GROUPS_TARGET_DESC="Allows the users in this group to edit groups target of type" COM_MEMBERSMANAGER_TYPES_EDIT_NAME="Types Edit Name" COM_MEMBERSMANAGER_TYPES_EDIT_NAME_DESC="Allows the users in this group to edit name of type" COM_MEMBERSMANAGER_TYPES_EDIT_OWN="Types Edit Own" diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 449555b..5a29d28 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -13,8 +13,8 @@ defined('JPATH_BASE') or die; JHtmlBehavior::core(); -$divWrapper = range(1,120,2); -$counter = 0; +$divWrapper = range(1,120,2); +$counter = 0; ?> ListSelection) : ?>
diff --git a/admin/layouts/country/publishing.php b/admin/layouts/country/publishing.php deleted file mode 100644 index 7f6d92e..0000000 --- a/admin/layouts/country/publishing.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$app = JFactory::getApplication(); -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'created', - 'created_by', - 'modified', - 'modified_by' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/country/publlshing.php b/admin/layouts/country/publlshing.php deleted file mode 100644 index 3eeddc2..0000000 --- a/admin/layouts/country/publlshing.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$app = JFactory::getApplication(); -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'published', - 'ordering', - 'access', - 'version', - 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/country/regions_fullwidth.php b/admin/layouts/country/regions_fullwidth.php deleted file mode 100644 index 7db70ed..0000000 --- a/admin/layouts/country/regions_fullwidth.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -// set the defaults -$items = $displayData->vvzregions; -$user = JFactory::getUser(); -$id = $displayData->item->id; -$edit = "index.php?option=com_membersmanager&view=regions&task=region.edit"; -$ref = ($id) ? "&ref=country&refid=".$id : ""; -$new = "index.php?option=com_membersmanager&view=region&layout=edit".$ref; -$can = MembersmanagerHelper::getActions('region'); - -?> -
-get('region.create')): ?> -

- - - - - - - - - - - - - $item): ?> - authorise('core.manage', 'com_checkin') || $item->checked_out == $user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); - $canDo = MembersmanagerHelper::getActions('region',$item,'regions'); - ?> - - - - published == 1):?> - - published == 0):?> - - published == 2):?> - - published == -2):?> - - - - - - -
- - - - - - - -
- get('region.edit')): ?> - escape($item->name); ?> - checked_out): ?> - name, $item->checked_out_time, 'regions.', $canCheckin); ?> - - - escape($item->name); ?> - - - escape($item->country_name); ?> - - - - - - - - - - - - - - - - - - id; ?> -
- -
- -
- -
diff --git a/admin/layouts/currency/details_above.php b/admin/layouts/currency/details_above.php deleted file mode 100644 index 86e83d3..0000000 --- a/admin/layouts/currency/details_above.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$form = $displayData->getForm(); - -$fields = array( - 'name', - 'alias' -); - -?> -
- renderField($field); - } ?> -
diff --git a/admin/layouts/currency/details_right.php b/admin/layouts/currency/details_right.php deleted file mode 100644 index ca9e13c..0000000 --- a/admin/layouts/currency/details_right.php +++ /dev/null @@ -1,43 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'decimalplace', - 'decimalsymbol', - 'positivestyle', - 'negativestyle' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/currency/publishing.php b/admin/layouts/currency/publishing.php deleted file mode 100644 index 7f6d92e..0000000 --- a/admin/layouts/currency/publishing.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$app = JFactory::getApplication(); -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'created', - 'created_by', - 'modified', - 'modified_by' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/currency/publlshing.php b/admin/layouts/currency/publlshing.php deleted file mode 100644 index 3eeddc2..0000000 --- a/admin/layouts/currency/publlshing.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$app = JFactory::getApplication(); -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'published', - 'ordering', - 'access', - 'version', - 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/member/details_right.php b/admin/layouts/member/details_right.php deleted file mode 100644 index 5568407..0000000 --- a/admin/layouts/member/details_right.php +++ /dev/null @@ -1,48 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'website', - 'mobile_phone', - 'landline_phone', - 'street', - 'postal', - 'city', - 'region', - 'country', - 'postalcode' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/member/image_fullwidth.php b/admin/layouts/member/image_fullwidth.php deleted file mode 100644 index 0f49f4f..0000000 --- a/admin/layouts/member/image_fullwidth.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'profile_image_uploader' -); - -?> -
- -
-
- getLabel($field); ?> -
-
- getInput($field); ?> -
-
- -
diff --git a/site/layouts/member/details_above.php b/admin/layouts/member/membership_above.php similarity index 96% rename from site/layouts/member/details_above.php rename to admin/layouts/member/membership_above.php index a8497aa..2c4cf6f 100644 --- a/site/layouts/member/details_above.php +++ b/admin/layouts/member/membership_above.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/member/details_left.php b/admin/layouts/member/membership_left.php similarity index 90% rename from admin/layouts/member/details_left.php rename to admin/layouts/member/membership_left.php index eab7dbf..343768d 100644 --- a/admin/layouts/member/details_left.php +++ b/admin/layouts/member/membership_left.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); @@ -18,9 +17,13 @@ $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( 'type', 'name', + 'surname', + 'username', 'email', + 'useremail', + 'password', + 'password_check', 'main_member', - 'user', 'not_required', 'profile_image' ); diff --git a/admin/layouts/country/settings_right.php b/admin/layouts/member/membership_right.php similarity index 93% rename from admin/layouts/country/settings_right.php rename to admin/layouts/member/membership_right.php index d58b520..d3e9d37 100644 --- a/admin/layouts/country/settings_right.php +++ b/admin/layouts/member/membership_right.php @@ -10,14 +10,12 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'codethree', - 'codetwo' + 'profile_image_uploader' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/member/publishing.php b/admin/layouts/member/publishing.php index 7f6d92e..aeaea28 100644 --- a/admin/layouts/member/publishing.php +++ b/admin/layouts/member/publishing.php @@ -10,13 +10,13 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( + 'user', 'created', 'created_by', 'modified', diff --git a/admin/layouts/member/publlshing.php b/admin/layouts/member/publlshing.php index 3eeddc2..666edf5 100644 --- a/admin/layouts/member/publlshing.php +++ b/admin/layouts/member/publlshing.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); diff --git a/admin/layouts/region/details_above.php b/admin/layouts/region/details_above.php deleted file mode 100644 index 86e83d3..0000000 --- a/admin/layouts/region/details_above.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$form = $displayData->getForm(); - -$fields = array( - 'name', - 'alias' -); - -?> -
- renderField($field); - } ?> -
diff --git a/admin/layouts/region/index.html b/admin/layouts/region/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/layouts/region/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/layouts/region/publishing.php b/admin/layouts/region/publishing.php deleted file mode 100644 index 7f6d92e..0000000 --- a/admin/layouts/region/publishing.php +++ /dev/null @@ -1,44 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$app = JFactory::getApplication(); -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'created', - 'created_by', - 'modified', - 'modified_by' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/region/publlshing.php b/admin/layouts/region/publlshing.php deleted file mode 100644 index 3eeddc2..0000000 --- a/admin/layouts/region/publlshing.php +++ /dev/null @@ -1,46 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file - -defined('_JEXEC') or die('Restricted access'); - -$app = JFactory::getApplication(); -$form = $displayData->getForm(); - -$fields = $displayData->get('fields') ?: array( - 'published', - 'ordering', - 'access', - 'version', - 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -foreach ($fields as $field) -{ - $field = is_array($field) ? $field : array($field); - foreach ($field as $f) - { - if ($form->getField($f)) - { - if (in_array($f, $hiddenFields)) - { - $form->setFieldAttribute($f, 'type', 'hidden'); - } - - echo $form->renderField($f); - break; - } - } -} diff --git a/admin/layouts/type/details_above.php b/admin/layouts/type/details_above.php index 86e83d3..5c862d9 100644 --- a/admin/layouts/type/details_above.php +++ b/admin/layouts/type/details_above.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/type/details_fullwidth.php b/admin/layouts/type/details_fullwidth.php index bc39ac8..d10fcdf 100644 --- a/admin/layouts/type/details_fullwidth.php +++ b/admin/layouts/type/details_fullwidth.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); diff --git a/admin/layouts/country/settings_left.php b/admin/layouts/type/details_left.php similarity index 93% rename from admin/layouts/country/settings_left.php rename to admin/layouts/type/details_left.php index bfbe962..e574e0a 100644 --- a/admin/layouts/country/settings_left.php +++ b/admin/layouts/type/details_left.php @@ -10,14 +10,12 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'currency', - 'worldzone' + 'groups_target' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/region/details_right.php b/admin/layouts/type/details_right.php similarity index 94% rename from admin/layouts/region/details_right.php rename to admin/layouts/type/details_right.php index c7e1bff..e19aaaf 100644 --- a/admin/layouts/region/details_right.php +++ b/admin/layouts/type/details_right.php @@ -10,13 +10,12 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( - 'country' + 'groups_access' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/type/publishing.php b/admin/layouts/type/publishing.php index 7f6d92e..8555159 100644 --- a/admin/layouts/type/publishing.php +++ b/admin/layouts/type/publishing.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); diff --git a/admin/layouts/type/publlshing.php b/admin/layouts/type/publlshing.php index 3eeddc2..666edf5 100644 --- a/admin/layouts/type/publlshing.php +++ b/admin/layouts/type/publlshing.php @@ -10,7 +10,6 @@ */ // No direct access to this file - defined('_JEXEC') or die('Restricted access'); $app = JFactory::getApplication(); diff --git a/admin/membersmanager.php b/admin/membersmanager.php index 8b64941..2473e4e 100644 --- a/admin/membersmanager.php +++ b/admin/membersmanager.php @@ -11,33 +11,26 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); +JHtml::_('behavior.tabstate'); // Access check. if (!JFactory::getUser()->authorise('core.manage', 'com_membersmanager')) { - return JError::raiseWaring(404, JText::_('JERROR_ALERTNOAUTHOR')); + throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); }; -// Load cms libraries -JLoader::registerPrefix('J', JPATH_PLATFORM . '/cms'); -// Load joomla libraries without overwrite -JLoader::registerPrefix('J', JPATH_PLATFORM . '/joomla',false); - // Add CSS file for all pages $document = JFactory::getDocument(); $document->addStyleSheet('components/com_membersmanager/assets/css/admin.css'); $document->addScript('components/com_membersmanager/assets/js/admin.js'); // require helper files -JLoader::register('MembersmanagerHelper', dirname(__FILE__) . '/helpers/membersmanager.php'); -JLoader::register('JHtmlBatch_', dirname(__FILE__) . '/helpers/html/batch_.php'); +JLoader::register('MembersmanagerHelper', __DIR__ . '/helpers/membersmanager.php'); +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); // Triger the Global Admin Event MembersmanagerHelper::globalEvent($document); -// import joomla controller library -jimport('joomla.application.component.controller'); - // Get an instance of the controller prefixed by Membersmanager $controller = JControllerLegacy::getInstance('Membersmanager'); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index d5c861c..bd9af21 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -12,8 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -jimport('joomla.application.component.helper'); - /** * Membersmanager Ajax Model */ @@ -38,6 +36,28 @@ class MembersmanagerModelAjax extends JModelList // allowed types protected $types = array('image' => 'image'); + + public function getUserDetails($user) + { + //first we check if this is an allowed query + $view = $this->getViewID(); + if (isset($view['a_view']) && in_array($view['a_view'], $this->allowedViews)) + { + // since the connected member user can not be changed, check if this member has a user value set + if (isset($view['a_id']) && $view['a_id'] > 0 && ($alreadyUser = MembersmanagerHelper::getVar($view['a_view'], $view['a_id'], 'id', 'user')) !== false && is_numeric($alreadyUser) && $alreadyUser > 0 && $user != $alreadyUser) + { + return false; + } + // return user details + $user = JFactory::getUser($user); + return array( + 'name' => $user->name, + 'username' => $user->username, + 'useremail' => $user->email + ); + } + return false; + } // set some buckets protected $target; @@ -532,6 +552,7 @@ class MembersmanagerModelAjax extends JModelList $vdm = $jinput->get('vdm', null, 'WORD'); if ($vdm) { + // set view and id if ($view = MembersmanagerHelper::get($vdm)) { $current = (array) explode('__', $view); @@ -544,6 +565,14 @@ class MembersmanagerModelAjax extends JModelList ); } } + // set return if found + if ($return = MembersmanagerHelper::get($vdm . '__return')) + { + if (MembersmanagerHelper::checkString($return)) + { + $this->viewid[$call]['a_return'] = $return; + } + } } } if (isset($this->viewid[$call])) @@ -556,440 +585,33 @@ class MembersmanagerModelAjax extends JModelList public function checkUnique($field, $value) { - // Get the database object and a new query object. - $db = \JFactory::getDbo(); - $query = $db->getQuery(true); - - // convert to camel case naming - $valueArray = (array) $this->splitAtUpperCase(trim($value)); + // split at upper case + $valueArray = (array) preg_split('/(?=[A-Z])/', trim($value), -1, PREG_SPLIT_NO_EMPTY); + // make string safe $value = MembersmanagerHelper::safeString(trim(implode(' ', $valueArray), '-'), 'L', '-', false, false); - + // get table and current ID $view = $this->getViewID(); - if (isset($view['a_id']) && MembersmanagerHelper::checkString($view['a_view'])) + // check if it is unique + if (MembersmanagerHelper::checkUnique($view['a_id'], $field, $value, $view['a_view'])) { - // Build the query. - $query->select('COUNT(*)') - ->from('#__membersmanager_' . (string) $view['a_view']) - ->where($db->quoteName($field) . ' = ' . $db->quote($value)); - - // remove this item from the list - if ($view['a_id'] > 0) - { - $query->where($db->quoteName('id') . ' <> ' . (int) $view['a_id']); - } - - // Set and query the database. - $db->setQuery($query); - $duplicate = (bool) $db->loadResult(); - - if ($duplicate) - { - return array ( - 'message' => JText::sprintf('COM_MEMBERSMANAGER_BSB_IS_ALREADY_IN_USE_PLEASE_TRY_ANOTHER', $value), - 'status' => 'danger'); - } return array ( 'value' => $value, 'message' => JText::sprintf('COM_MEMBERSMANAGER_GREAT_SS_IS_AVAILABLE', $field, $value), 'status' => 'success'); } - return false; - } - - protected function splitAtUpperCase($string) - { - return preg_split('/(?=[A-Z])/', $string, -1, PREG_SPLIT_NO_EMPTY); + return array ( + 'message' => JText::sprintf('COM_MEMBERSMANAGER_BSB_IS_ALREADY_IN_USE_PLEASE_TRY_ANOTHER', $value), + 'status' => 'danger'); } - public function getRegion($country) + public function getPlaceHolders($getType) { - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName( array('a.id') )); - $query->from($db->quoteName('#__membersmanager_region', 'a')); - $query->where($db->quoteName('a.published') . ' = 1'); - // check for country and region - $query->where($db->quoteName('a.country') . ' = '. (int) $country); - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) + if ($placeholders = MembersmanagerHelper::getPlaceHolders($getType)) { - return $db->loadColumn(); + return ''. implode(' ', $placeholders).''; } - return false; - } - - public function getCreateUserFields($id) - { - $view = $this->getKey(); - $access = array(1 => 'member.access', 2 => 'other.access'); - if (1 == $id && isset($access[$view]) && JFactory::getUser()->authorise($access[$view], 'com_membersmanager')) - { - $fields = array(); - // start the block - $fields[] = '
'; - - // setup modal - $name = "createUser"; - // load button - $fields[] = '
'; - $fields[] = '
'; - $fields[] = ''; - $fields[] = '
'; - - $params = array(); - $params['title'] = JText::_("COM_MEMBERSMANAGER_CREATE_USER"); - $params['height'] = "500px"; - $params['width'] = "100%"; - - // load modal - $fields[] = JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params, $this->getCreateFields()); - - // close the block - $fields[] = '
'; - - return implode("\n",$fields); - } - return false; - } - - protected function getCreateFields() - { - // add dive to give padding - $fields[] = '
'; - // load name - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - // load username - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - // load email - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - // load password field - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - $fields[] = '
'.JText::_('COM_MEMBERSMANAGER_USER_DETAILS_WILL_BE_EMAILED_DURING_CREATION_OF_THE_USER_ACCOUNT').'
'; - // close the div - $fields[] = '
'; - - $fields[] = ''; - - return implode("\n",$fields); - } - - public function createUser($data) - { - $view = $this->getKey(); - $access = array(1 => 'member.edit.user', 2 => 'other.edit.user'); - if (isset($access[$view]) && JFactory::getUser()->authorise($access[$view], 'com_membersmanager')) - { - $data = json_decode($data, true); - if (MembersmanagerHelper::checkArray($data)) - { - $groups = array(1 => 'memberuser', 2 => 'otheruser'); - $keys = array('var' => 'name', 'uvar' => 'username', 'evar' => 'email', 'dvar' => 'password'); - $bucket = array(); - foreach($data as $key => $value) - { - if (isset($keys[$key]) && MembersmanagerHelper::checkString($value)) - { - $bucket[$keys[$key]] = (string) $value; - if ($keys[$key] == 'password') - { - $bucket['password2'] = (string) $value; - } - } - } - if (MembersmanagerHelper::checkArray($bucket) && count($bucket) == 5) - { - // now update user - $returned = MembersmanagerHelper::createUser($bucket); - if (is_numeric($returned)) - { - if ((int) $returned > 0 && isset($groups[$view])) - { - $groups = $this->app_params->get($groups[$view], null); - if ($groups) - { - // update the user groups - JUserHelper::setUserGroups((int)$returned ,(array)$groups); - } - } - $message = array(); - $message[] = ''; - $message[] = '
'; - $message[] = '

'.JText::_('COM_MEMBERSMANAGER_SUCCESS').'

'; - $message[] = '
'.JText::_('COM_MEMBERSMANAGER_USER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_USER').'
'; - $message[] = '
'; - - $notice = array(); - $notice[] = '
'; - $notice[] = '
'; - $notice[] = '

'.JText::_('COM_MEMBERSMANAGER_READY_TO_SELECT').'

'; - $notice[] = '
'.JText::sprintf('COM_MEMBERSMANAGER_YOU_CAN_NOW_SELECT_BSB_THAT_YOU_JUST_CREATED_FROM_THE_USERS_LIST_IN_THE_ABOVE_FIELD_SIMPLY_CLICK_ON_THE_BLUE_USER_ICON', $bucket['name']).'
'; - $notice[] = '
'; - return array( 'html' => implode("\n",$notice), 'success' => implode("\n",$message)); - } - else - { - $message = array(); - $message[] = ''; - $message[] = '
'; - $message[] = '

'.JText::_('COM_MEMBERSMANAGER_ERROR_USER_NOT_CREATED').'

'; - $message[] = '
'.$returned.'
'; - $message[] = '
'; - return array('error' => implode("\n",$message)); - } - } - else - { - $message = array(); - $message[] = ''; - $message[] = '
'; - $message[] = '

'.JText::_('COM_MEMBERSMANAGER_ERROR_USER_NOT_UPDATED').'

'; - $message[] = '
'.JText::_('COM_MEMBERSMANAGER_SOME_REQUIRED_VALUES_ARE_MISSING').'.
'; - $message[] = '
'; - return array('error' => implode("\n",$message)); - } - } - } - return false; - } - - public function getUser($id, $showname = 0) - { - $user = JFactory::getUser($id); - if ($user->id) - { - $fields = array(); - // start the block - $fields[] = '
'; - - $fields[] = $this->getUserFields($user, false, (2 === (int) $showname)); - - $view = $this->getKey(); - $access = array(1 => 'member.access', 2 => 'other.access'); - if (isset($access[$view]) && JFactory::getUser()->authorise($access[$view], 'com_membersmanager')) - { - // setup modal - $name = "editUser"; - // load button - $fields[] = '
'; - $fields[] = '
'; - $fields[] = ''; - $fields[] = '
'; - - $params = array(); - $params['title'] = "Edit User"; - $params['height'] = "500px"; - $params['width'] = "100%"; - - // load modal - $fields[] = JHtml::_('bootstrap.renderModal', 'modal-' . $name, $params, $this->getUserFields($user, true)); - } - - // close the block - $fields[] = '
'; - - return implode("\n",$fields); - } - return false; - } - - protected function getUserFields(&$user, $permission = false, $showname = false) - { - // set read only - $readOnly = ' readonly="" class="readonly"'; - - if($permission) - { - // add dive to give padding - $fields[] = '
'; - - $readOnly = ' id="vdm_name"'; - } - - if($permission || $showname) - { - // load name - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - } - - if($permission) - { - $readOnly = ' id="vdm_username"'; - } - - // load username - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - if($permission) - { - $readOnly = ' id="vdm_email"'; - } - - // load email - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - if($permission) - { - $readOnly = ' id="vdm_password"'; - $password = $user->password; - } - else - { - $password = 'XXXXXXXXXXXXXXXXXX'; - } - - // load password field - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - if($permission) - { - // close padding div - $fields[] = '
'; - $fields[] = ''; - } - - if(!$permission) - { - // Registration Date - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - - // Last Visit Date - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - $fields[] = '
'; - } - return implode("\n",$fields); - } - - public function setUser($id, $data) - { - $view = $this->getKey(); - $access = array(1 => 'member.edit.own', 2 => 'other.edit.own'); - $my = JFactory::getUser(); - if (isset($access[$view]) && $my->authorise($access[$view], 'com_membersmanager')) - { - $data = json_decode($data, true); - if (MembersmanagerHelper::checkArray($data)) - { - $keys = array('var' => 'name', 'uvar' => 'username', 'evar' => 'email', 'dvar' => 'password'); - $bucket = array(); - $bucket['id'] = $id; - foreach($data as $key => $value) - { - if (isset($keys[$key]) && MembersmanagerHelper::checkString($value)) - { - $bucket[$keys[$key]] = (string) $value; - if ($keys[$key] == 'password') - { - $bucket['password2'] = (string) $value; - } - } - } - if (MembersmanagerHelper::checkArray($bucket) && count($bucket) == 6) - { - // check if current user is a supper admin - $iAmSuperAdmin = $my->authorise('core.admin'); - if ($iAmSuperAdmin) - { - // add the user current groups - $bucket['groups'] = JAccess::getGroupsByUser($id); - } - // now update user - $done = MembersmanagerHelper::updateUser($bucket); - if ($done == $id) - { - $message = array(); - $message[] = ''; - $message[] = '
'; - $message[] = '

'.JText::_('COM_MEMBERSMANAGER_SUCCESS').'

'; - $message[] = '
'.JText::_('COM_MEMBERSMANAGER_USER_WAS_UPDATED_SUCCESSFULLY').'.
'; - $message[] = '
'; - return array( 'html' => $this->getUser($id), 'success' => implode("\n",$message)); - } - else - { - $message = array(); - $message[] = ''; - $message[] = '
'; - $message[] = '

'.JText::_('COM_MEMBERSMANAGER_ERROR_USER_NOT_UPDATED').'

'; - $message[] = '
'.$done.'
'; - $message[] = '
'; - return array('error' => implode("\n",$message)); - } - } - else - { - $message = array(); - $message[] = ''; - $message[] = '
'; - $message[] = '

'.JText::_('COM_MEMBERSMANAGER_ERROR_USER_NOT_UPDATED').'

'; - $message[] = '
'.JText::_('COM_MEMBERSMANAGER_SOME_REQUIRED_VALUES_ARE_MISSING').'.
'; - $message[] = '
'; - return array('error' => implode("\n",$message)); - } - } - } - return false; - } - - protected function getKey() - { - $viewData = $this->getViewID(); - $view = 0; - if (isset($viewData['a_view'])) - { - switch($viewData['a_view']) - { - case 'member': - return 1; - break; - case 'other' : - return 2; - break; - } - } - return 0; + return JText::_('COM_MEMBERSMANAGER_NO_PLACEHOLDERS_WERE_FOUND_PLEASE_TRY_AGAIN_LATER'); } } diff --git a/admin/models/countries.php b/admin/models/countries.php deleted file mode 100644 index 8e53c86..0000000 --- a/admin/models/countries.php +++ /dev/null @@ -1,386 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the Joomla modellist library -jimport('joomla.application.component.modellist'); - -/** - * Countries Model - */ -class MembersmanagerModelCountries extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( - 'a.id','id', - 'a.published','published', - 'a.ordering','ordering', - 'a.created_by','created_by', - 'a.modified_by','modified_by', - 'a.name','name', - 'a.currency','currency', - 'a.worldzone','worldzone', - 'a.codethree','codethree', - 'a.codetwo','codetwo' - ); - } - - parent::__construct($config); - } - - /** - * Method to auto-populate the model state. - * - * @return void - */ - protected function populateState($ordering = null, $direction = null) - { - $app = JFactory::getApplication(); - - // Adjust the context to support modal layouts. - if ($layout = $app->input->get('layout')) - { - $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); - - $currency = $this->getUserStateFromRequest($this->context . '.filter.currency', 'filter_currency'); - $this->setState('filter.currency', $currency); - - $worldzone = $this->getUserStateFromRequest($this->context . '.filter.worldzone', 'filter_worldzone'); - $this->setState('filter.worldzone', $worldzone); - - $codethree = $this->getUserStateFromRequest($this->context . '.filter.codethree', 'filter_codethree'); - $this->setState('filter.codethree', $codethree); - - $codetwo = $this->getUserStateFromRequest($this->context . '.filter.codetwo', 'filter_codetwo'); - $this->setState('filter.codetwo', $codetwo); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - - // List state information. - parent::populateState($ordering, $direction); - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { - // check in items - $this->checkInNow(); - - // load parent items - $items = parent::getItems(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('country.access', 'com_membersmanager.country.' . (int) $item->id) && JFactory::getUser()->authorise('country.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_item table - $query->from($db->quoteName('#__membersmanager_country', 'a')); - - // From the membersmanager_currency table. - $query->select($db->quoteName('g.name','currency_name')); - $query->join('LEFT', $db->quoteName('#__membersmanager_currency', 'g') . ' ON (' . $db->quoteName('a.currency') . ' = ' . $db->quoteName('g.codethree') . ')'); - - // Filter by published state - $published = $this->getState('filter.published'); - if (is_numeric($published)) - { - $query->where('a.published = ' . (int) $published); - } - elseif ($published === '') - { - $query->where('(a.published = 0 OR a.published = 1)'); - } - - // Join over the asset groups. - $query->select('ag.title AS access_level'); - $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // Filter by access level. - if ($access = $this->getState('filter.access')) - { - $query->where('a.access = ' . (int) $access); - } - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - // Filter by search. - $search = $this->getState('filter.search'); - if (!empty($search)) - { - if (stripos($search, 'id:') === 0) - { - $query->where('a.id = ' . (int) substr($search, 3)); - } - else - { - $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.' OR a.currency LIKE '.$search.' OR g.name LIKE '.$search.' OR a.codethree LIKE '.$search.' OR a.codetwo LIKE '.$search.' OR a.alias LIKE '.$search.')'); - } - } - - // Filter by currency. - if ($currency = $this->getState('filter.currency')) - { - $query->where('a.currency = ' . $db->quote($db->escape($currency))); - } - // Filter by Worldzone. - if ($worldzone = $this->getState('filter.worldzone')) - { - $query->where('a.worldzone = ' . $db->quote($db->escape($worldzone))); - } - - // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); - if ($orderCol != '') - { - $query->order($db->escape($orderCol . ' ' . $orderDirn)); - } - - return $query; - } - - /** - * Method to get list export data. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExportData($pks) - { - // setup the query - if (MembersmanagerHelper::checkArray($pks)) - { - // Set a value to know this is exporting method. - $_export = true; - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_country table - $query->from($db->quoteName('#__membersmanager_country', 'a')); - $query->where('a.id IN (' . implode(',',$pks) . ')'); - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - - // Order the results by ordering - $query->order('a.ordering ASC'); - - // Load the items - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - $items = $db->loadObjectList(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('country.access', 'com_membersmanager.country.' . (int) $item->id) && JFactory::getUser()->authorise('country.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - // unset the values we don't want exported. - unset($item->asset_id); - unset($item->checked_out); - unset($item->checked_out_time); - } - } - // Add headers to items array. - $headers = $this->getExImPortHeaders(); - if (MembersmanagerHelper::checkObject($headers)) - { - array_unshift($items,$headers); - } - return $items; - } - } - return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__membersmanager_country"); - if (MembersmanagerHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { - // Compile the store id. - $id .= ':' . $this->getState('filter.id'); - $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.published'); - $id .= ':' . $this->getState('filter.ordering'); - $id .= ':' . $this->getState('filter.created_by'); - $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.currency'); - $id .= ':' . $this->getState('filter.worldzone'); - $id .= ':' . $this->getState('filter.codethree'); - $id .= ':' . $this->getState('filter.codetwo'); - - return parent::getStoreId($id); - } - - /** - * Build an SQL query to checkin all items left checked out longer then a set time. - * - * @return a bool - * - */ - protected function checkInNow() - { - // Get set check in time - $time = JComponentHelper::getParams('com_membersmanager')->get('check_in'); - - if ($time) - { - - // Get a db connection. - $db = JFactory::getDbo(); - // reset query - $query = $db->getQuery(true); - $query->select('*'); - $query->from($db->quoteName('#__membersmanager_country')); - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - // Get Yesterdays date - $date = JFactory::getDate()->modify($time)->toSql(); - // reset query - $query = $db->getQuery(true); - - // Fields to update. - $fields = array( - $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', - $db->quoteName('checked_out') . '=0' - ); - - // Conditions for which records should be updated. - $conditions = array( - $db->quoteName('checked_out') . '!=0', - $db->quoteName('checked_out_time') . '<\''.$date.'\'' - ); - - // Check table - $query->update($db->quoteName('#__membersmanager_country'))->set($fields)->where($conditions); - - $db->setQuery($query); - - $db->execute(); - } - } - - return false; - } -} diff --git a/admin/models/country.php b/admin/models/country.php deleted file mode 100644 index 2a37e5c..0000000 --- a/admin/models/country.php +++ /dev/null @@ -1,991 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; - -// import Joomla modelform library -jimport('joomla.application.component.modeladmin'); - -/** - * Membersmanager Country Model - */ -class MembersmanagerModelCountry extends JModelAdmin -{ - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_MEMBERSMANAGER'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_membersmanager.country'; - - /** - * Returns a Table object, always creating it - * - * @param type $type The table type to instantiate - * @param string $prefix A prefix for the table class name. Optional. - * @param array $config Configuration array for model. Optional. - * - * @return JTable A database object - * - * @since 1.6 - */ - public function getTable($type = 'country', $prefix = 'MembersmanagerTable', $config = array()) - { - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Method to get a single record. - * - * @param integer $pk The id of the primary key. - * - * @return mixed Object on success, false on failure. - * - * @since 1.6 - */ - public function getItem($pk = null) - { - if ($item = parent::getItem($pk)) - { - if (!empty($item->params) && !is_array($item->params)) - { - // Convert the params field to an array. - $registry = new Registry; - $registry->loadString($item->params); - $item->params = $registry->toArray(); - } - - if (!empty($item->metadata)) - { - // Convert the metadata field to an array. - $registry = new Registry; - $registry->loadString($item->metadata); - $item->metadata = $registry->toArray(); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_membersmanager.country'); - } - } - $this->countryvvvv = $item->id; - - return $item; - } - - /** - * Method to get list data. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getVvzregions() - { - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_region table - $query->from($db->quoteName('#__membersmanager_region', 'a')); - - // From the membersmanager_country table. - $query->select($db->quoteName('g.name','country_name')); - $query->join('LEFT', $db->quoteName('#__membersmanager_country', 'g') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('g.id') . ')'); - - // Filter by countryvvvv global. - $countryvvvv = $this->countryvvvv; - if (is_numeric($countryvvvv )) - { - $query->where('a.country = ' . (int) $countryvvvv ); - } - elseif (is_string($countryvvvv)) - { - $query->where('a.country = ' . $db->quote($countryvvvv)); - } - else - { - $query->where('a.country = -5'); - } - - // Join over the asset groups. - $query->select('ag.title AS access_level'); - $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // Filter by access level. - if ($access = $this->getState('filter.access')) - { - $query->where('a.access = ' . (int) $access); - } - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - - // Order the results by ordering - $query->order('a.published ASC'); - $query->order('a.ordering ASC'); - - // Load the items - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - $items = $db->loadObjectList(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('region.access', 'com_membersmanager.region.' . (int) $item->id) && JFactory::getUser()->authorise('region.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - } - } - return $items; - } - return false; - } - - /** - * Method to get the record form. - * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return mixed A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - // Get the form. - $form = $this->loadForm('com_membersmanager.country', 'country', array('control' => 'jform', 'load_data' => $loadData)); - - if (empty($form)) - { - return false; - } - - $jinput = JFactory::getApplication()->input; - - // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. - if ($jinput->get('a_id')) - { - $id = $jinput->get('a_id', 0, 'INT'); - } - // The back end uses id so we use that the rest of the time and set it to 0 by default. - else - { - $id = $jinput->get('id', 0, 'INT'); - } - - $user = JFactory::getUser(); - - // Check for existing item. - // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('country.edit.state', 'com_membersmanager.country.' . (int) $id)) - || ($id == 0 && !$user->authorise('country.edit.state', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('ordering', 'disabled', 'true'); - $form->setFieldAttribute('published', 'disabled', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('ordering', 'filter', 'unset'); - $form->setFieldAttribute('published', 'filter', 'unset'); - } - // If this is a new item insure the greated by is set. - if (0 == $id) - { - // Set the created_by to this user - $form->setValue('created_by', null, $user->id); - } - // Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_membersmanager')) - { - // Disable fields for display. - $form->setFieldAttribute('created_by', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('created_by', 'readonly', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('created_by', 'filter', 'unset'); - } - // Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_membersmanager')) - { - // Disable fields for display. - $form->setFieldAttribute('created', 'disabled', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('created', 'filter', 'unset'); - } - // Only load these values if no id is found - if (0 == $id) - { - // Set redirected field name - $redirectedField = $jinput->get('ref', null, 'STRING'); - // Set redirected field value - $redirectedValue = $jinput->get('refid', 0, 'INT'); - if (0 != $redirectedValue && $redirectedField) - { - // Now set the local-redirected field default value - $form->setValue($redirectedField, null, $redirectedValue); - } - } - return $form; - } - - /** - * Method to get the script that have to be included on the form - * - * @return string script files - */ - public function getScript() - { - return 'administrator/components/com_membersmanager/models/forms/country.js'; - } - - /** - * Method to test whether a record can be deleted. - * - * @param object $record A record object. - * - * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. - * - * @since 1.6 - */ - protected function canDelete($record) - { - if (!empty($record->id)) - { - if ($record->published != -2) - { - return; - } - - $user = JFactory::getUser(); - // The record has been set. Check the record permissions. - return $user->authorise('country.delete', 'com_membersmanager.country.' . (int) $record->id); - } - return false; - } - - /** - * Method to test whether a record can have its state edited. - * - * @param object $record A record object. - * - * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. - * - * @since 1.6 - */ - protected function canEditState($record) - { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; - - if ($recordId) - { - // The record has been set. Check the record permissions. - $permission = $user->authorise('country.edit.state', 'com_membersmanager.country.' . (int) $recordId); - if (!$permission && !is_null($permission)) - { - return false; - } - } - // In the absense of better information, revert to the component permissions. - return $user->authorise('country.edit.state', 'com_membersmanager'); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * @since 2.5 - */ - protected function allowEdit($data = array(), $key = 'id') - { - // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); - - return $user->authorise('country.edit', 'com_membersmanager.country.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('country.edit', 'com_membersmanager'); - } - - /** - * Prepare and sanitise the table data prior to saving. - * - * @param JTable $table A JTable object. - * - * @return void - * - * @since 1.6 - */ - protected function prepareTable($table) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if (isset($table->name)) - { - $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); - } - - if (isset($table->alias) && empty($table->alias)) - { - $table->generateAlias(); - } - - if (empty($table->id)) - { - $table->created = $date->toSql(); - // set the user - if ($table->created_by == 0 || empty($table->created_by)) - { - $table->created_by = $user->id; - } - // Set ordering to the last item if not set - if (empty($table->ordering)) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('MAX(ordering)') - ->from($db->quoteName('#__membersmanager_country')); - $db->setQuery($query); - $max = $db->loadResult(); - - $table->ordering = $max + 1; - } - } - else - { - $table->modified = $date->toSql(); - $table->modified_by = $user->id; - } - - if (!empty($table->id)) - { - // Increment the items version number. - $table->version++; - } - } - - /** - * Method to get the data that should be injected in the form. - * - * @return mixed The data for the form. - * - * @since 1.6 - */ - protected function loadFormData() - { - // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_membersmanager.edit.country.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - } - - return $data; - } - - /** - * Method to get the unique fields of this table. - * - * @return mixed An array of field names, boolean false if none is set. - * - * @since 3.0 - */ - protected function getUniqeFields() - { - return false; - } - - /** - * Method to delete one or more records. - * - * @param array &$pks An array of record primary keys. - * - * @return boolean True if successful, false if an error occurs. - * - * @since 12.2 - */ - public function delete(&$pks) - { - if (!parent::delete($pks)) - { - return false; - } - - return true; - } - - /** - * Method to change the published state of one or more records. - * - * @param array &$pks A list of the primary keys to change. - * @param integer $value The value of the published state. - * - * @return boolean True on success. - * - * @since 12.2 - */ - public function publish(&$pks, $value = 1) - { - if (!parent::publish($pks, $value)) - { - return false; - } - - return true; - } - - /** - * Method to perform batch operations on an item or a set of items. - * - * @param array $commands An array of commands to perform. - * @param array $pks An array of item ids. - * @param array $contexts An array of item contexts. - * - * @return boolean Returns true on success, false on failure. - * - * @since 12.2 - */ - public function batch($commands, $pks, $contexts) - { - // Sanitize ids. - $pks = array_unique($pks); - JArrayHelper::toInteger($pks); - - // Remove any values of zero. - if (array_search(0, $pks, true)) - { - unset($pks[array_search(0, $pks, true)]); - } - - if (empty($pks)) - { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); - return false; - } - - $done = false; - - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = MembersmanagerHelper::getActions('country'); - $this->batchSet = true; - - if (!$this->canDo->get('core.batch')) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - return false; - } - - if ($this->type == false) - { - $type = new JUcmType; - $this->type = $type->getTypeByAlias($this->typeAlias); - } - - $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); - - if (!empty($commands['move_copy'])) - { - $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); - - if ($cmd == 'c') - { - $result = $this->batchCopy($commands, $pks, $contexts); - - if (is_array($result)) - { - foreach ($result as $old => $new) - { - $contexts[$new] = $contexts[$old]; - } - $pks = array_values($result); - } - else - { - return false; - } - } - elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) - { - return false; - } - - $done = true; - } - - if (!$done) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - - return false; - } - - // Clear the cache - $this->cleanCache(); - - return true; - } - - /** - * Batch copy items to a new category or current. - * - * @param integer $values The new values. - * @param array $pks An array of row IDs. - * @param array $contexts An array of item contexts. - * - * @return mixed An array of new IDs on success, boolean false on failure. - * - * @since 12.2 - */ - protected function batchCopy($values, $pks, $contexts) - { - if (empty($this->batchSet)) - { - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->canDo = MembersmanagerHelper::getActions('country'); - } - - if (!$this->canDo->get('country.create') && !$this->canDo->get('country.batch')) - { - return false; - } - - // get list of uniqe fields - $uniqeFields = $this->getUniqeFields(); - // remove move_copy from array - unset($values['move_copy']); - - // make sure published is set - if (!isset($values['published'])) - { - $values['published'] = 0; - } - elseif (isset($values['published']) && !$this->canDo->get('country.edit.state')) - { - $values['published'] = 0; - } - - $newIds = array(); - // Parent exists so let's proceed - while (!empty($pks)) - { - // Pop the first ID off the stack - $pk = array_shift($pks); - - $this->table->reset(); - - // only allow copy if user may edit this item. - if (!$this->user->authorise('country.edit', $contexts[$pk])) - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - - // Check that the row actually exists - if (!$this->table->load($pk)) - { - if ($error = $this->table->getError()) - { - // Fatal error - $this->setError($error); - return false; - } - else - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - } - list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); - - // insert all set values - if (MembersmanagerHelper::checkArray($values)) - { - foreach ($values as $key => $value) - { - if (strlen($value) > 0 && isset($this->table->$key)) - { - $this->table->$key = $value; - } - } - } - - // update all uniqe fields - if (MembersmanagerHelper::checkArray($uniqeFields)) - { - foreach ($uniqeFields as $uniqeField) - { - $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); - } - } - - // Reset the ID because we are making a copy - $this->table->id = 0; - - // TODO: Deal with ordering? - // $this->table->ordering = 1; - - // Check the row. - if (!$this->table->check()) - { - $this->setError($this->table->getError()); - - return false; - } - - if (!empty($this->type)) - { - $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); - } - - // Store the row. - if (!$this->table->store()) - { - $this->setError($this->table->getError()); - - return false; - } - - // Get the new item ID - $newId = $this->table->get('id'); - - // Add the new ID to the array - $newIds[$pk] = $newId; - } - - // Clean the cache - $this->cleanCache(); - - return $newIds; - } - - /** - * Batch move items to a new category - * - * @param integer $value The new category ID. - * @param array $pks An array of row IDs. - * @param array $contexts An array of item contexts. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 12.2 - */ - protected function batchMove($values, $pks, $contexts) - { - if (empty($this->batchSet)) - { - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->canDo = MembersmanagerHelper::getActions('country'); - } - - if (!$this->canDo->get('country.edit') && !$this->canDo->get('country.batch')) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); - return false; - } - - // make sure published only updates if user has the permission. - if (isset($values['published']) && !$this->canDo->get('country.edit.state')) - { - unset($values['published']); - } - // remove move_copy from array - unset($values['move_copy']); - - // Parent exists so we proceed - foreach ($pks as $pk) - { - if (!$this->user->authorise('country.edit', $contexts[$pk])) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); - return false; - } - - // Check that the row actually exists - if (!$this->table->load($pk)) - { - if ($error = $this->table->getError()) - { - // Fatal error - $this->setError($error); - return false; - } - else - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - } - - // insert all set values. - if (MembersmanagerHelper::checkArray($values)) - { - foreach ($values as $key => $value) - { - // Do special action for access. - if ('access' === $key && strlen($value) > 0) - { - $this->table->$key = $value; - } - elseif (strlen($value) > 0 && isset($this->table->$key)) - { - $this->table->$key = $value; - } - } - } - - - // Check the row. - if (!$this->table->check()) - { - $this->setError($this->table->getError()); - - return false; - } - - if (!empty($this->type)) - { - $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); - } - - // Store the row. - if (!$this->table->store()) - { - $this->setError($this->table->getError()); - - return false; - } - } - - // Clean the cache - $this->cleanCache(); - - return true; - } - - /** - * Method to save the form data. - * - * @param array $data The form data. - * - * @return boolean True on success. - * - * @since 1.6 - */ - public function save($data) - { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - - // set the metadata to the Item Data - if (isset($data['metadata']) && isset($data['metadata']['author'])) - { - $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; - $metadata->loadArray($data['metadata']); - $data['metadata'] = (string) $metadata; - } - - // Set the Params Items to data - if (isset($data['params']) && is_array($data['params'])) - { - $params = new JRegistry; - $params->loadArray($data['params']); - $data['params'] = (string) $params; - } - - // Alter the name for save as copy - if ($input->get('task') === 'save2copy') - { - $origTable = clone $this->getTable(); - $origTable->load($input->getInt('id')); - - if ($data['name'] == $origTable->name) - { - list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); - $data['name'] = $name; - $data['alias'] = $alias; - } - else - { - if ($data['alias'] == $origTable->alias) - { - $data['alias'] = ''; - } - } - - $data['published'] = 0; - } - - // Automatic handling of alias for empty fields - if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) - { - if ($data['alias'] == null || empty($data['alias'])) - { - if (JFactory::getConfig()->get('unicodeslugs') == 1) - { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); - } - else - { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); - } - - $table = JTable::getInstance('country', 'membersmanagerTable'); - - if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) - { - $msg = JText::_('COM_MEMBERSMANAGER_COUNTRY_SAVE_WARNING'); - } - - $data['alias'] = $this->_generateNewTitle($data['alias']); - - if (isset($msg)) - { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); - } - } - } - - // Alter the uniqe field for save as copy - if ($input->get('task') === 'save2copy') - { - // Automatic handling of other uniqe fields - $uniqeFields = $this->getUniqeFields(); - if (MembersmanagerHelper::checkArray($uniqeFields)) - { - foreach ($uniqeFields as $uniqeField) - { - $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); - } - } - } - - if (parent::save($data)) - { - return true; - } - return false; - } - - /** - * Method to generate a uniqe value. - * - * @param string $field name. - * @param string $value data. - * - * @return string New value. - * - * @since 3.0 - */ - protected function generateUniqe($field,$value) - { - - // set field value uniqe - $table = $this->getTable(); - - while ($table->load(array($field => $value))) - { - $value = JString::increment($value); - } - - return $value; - } - - /** - * Method to change the title/s & alias. - * - * @param string $alias The alias. - * @param string/array $title The title. - * - * @return array/string Contains the modified title/s and/or alias. - * - */ - protected function _generateNewTitle($alias, $title = null) - { - - // Alter the title/s & alias - $table = $this->getTable(); - - while ($table->load(array('alias' => $alias))) - { - // Check if this is an array of titles - if (MembersmanagerHelper::checkArray($title)) - { - foreach($title as $nr => &$_title) - { - $_title = JString::increment($_title); - } - } - // Make sure we have a title - elseif ($title) - { - $title = JString::increment($title); - } - $alias = JString::increment($alias, 'dash'); - } - // Check if this is an array of titles - if (MembersmanagerHelper::checkArray($title)) - { - $title[] = $alias; - return $title; - } - // Make sure we have a title - elseif ($title) - { - return array($title, $alias); - } - // We only had an alias - return $alias; - } -} diff --git a/admin/models/currencies.php b/admin/models/currencies.php deleted file mode 100644 index f8f86d0..0000000 --- a/admin/models/currencies.php +++ /dev/null @@ -1,367 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the Joomla modellist library -jimport('joomla.application.component.modellist'); - -/** - * Currencies Model - */ -class MembersmanagerModelCurrencies extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( - 'a.id','id', - 'a.published','published', - 'a.ordering','ordering', - 'a.created_by','created_by', - 'a.modified_by','modified_by', - 'a.name','name', - 'a.codethree','codethree', - 'a.numericcode','numericcode', - 'a.decimalplace','decimalplace' - ); - } - - parent::__construct($config); - } - - /** - * Method to auto-populate the model state. - * - * @return void - */ - protected function populateState($ordering = null, $direction = null) - { - $app = JFactory::getApplication(); - - // Adjust the context to support modal layouts. - if ($layout = $app->input->get('layout')) - { - $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); - - $codethree = $this->getUserStateFromRequest($this->context . '.filter.codethree', 'filter_codethree'); - $this->setState('filter.codethree', $codethree); - - $numericcode = $this->getUserStateFromRequest($this->context . '.filter.numericcode', 'filter_numericcode'); - $this->setState('filter.numericcode', $numericcode); - - $decimalplace = $this->getUserStateFromRequest($this->context . '.filter.decimalplace', 'filter_decimalplace'); - $this->setState('filter.decimalplace', $decimalplace); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - - // List state information. - parent::populateState($ordering, $direction); - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { - // check in items - $this->checkInNow(); - - // load parent items - $items = parent::getItems(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('currency.access', 'com_membersmanager.currency.' . (int) $item->id) && JFactory::getUser()->authorise('currency.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_item table - $query->from($db->quoteName('#__membersmanager_currency', 'a')); - - // Filter by published state - $published = $this->getState('filter.published'); - if (is_numeric($published)) - { - $query->where('a.published = ' . (int) $published); - } - elseif ($published === '') - { - $query->where('(a.published = 0 OR a.published = 1)'); - } - - // Join over the asset groups. - $query->select('ag.title AS access_level'); - $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // Filter by access level. - if ($access = $this->getState('filter.access')) - { - $query->where('a.access = ' . (int) $access); - } - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - // Filter by search. - $search = $this->getState('filter.search'); - if (!empty($search)) - { - if (stripos($search, 'id:') === 0) - { - $query->where('a.id = ' . (int) substr($search, 3)); - } - else - { - $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.' OR a.codethree LIKE '.$search.' OR a.numericcode LIKE '.$search.' OR a.alias LIKE '.$search.')'); - } - } - - - // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); - if ($orderCol != '') - { - $query->order($db->escape($orderCol . ' ' . $orderDirn)); - } - - return $query; - } - - /** - * Method to get list export data. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExportData($pks) - { - // setup the query - if (MembersmanagerHelper::checkArray($pks)) - { - // Set a value to know this is exporting method. - $_export = true; - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_currency table - $query->from($db->quoteName('#__membersmanager_currency', 'a')); - $query->where('a.id IN (' . implode(',',$pks) . ')'); - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - - // Order the results by ordering - $query->order('a.ordering ASC'); - - // Load the items - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - $items = $db->loadObjectList(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('currency.access', 'com_membersmanager.currency.' . (int) $item->id) && JFactory::getUser()->authorise('currency.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - // unset the values we don't want exported. - unset($item->asset_id); - unset($item->checked_out); - unset($item->checked_out_time); - } - } - // Add headers to items array. - $headers = $this->getExImPortHeaders(); - if (MembersmanagerHelper::checkObject($headers)) - { - array_unshift($items,$headers); - } - return $items; - } - } - return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__membersmanager_currency"); - if (MembersmanagerHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { - // Compile the store id. - $id .= ':' . $this->getState('filter.id'); - $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.published'); - $id .= ':' . $this->getState('filter.ordering'); - $id .= ':' . $this->getState('filter.created_by'); - $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.codethree'); - $id .= ':' . $this->getState('filter.numericcode'); - $id .= ':' . $this->getState('filter.decimalplace'); - - return parent::getStoreId($id); - } - - /** - * Build an SQL query to checkin all items left checked out longer then a set time. - * - * @return a bool - * - */ - protected function checkInNow() - { - // Get set check in time - $time = JComponentHelper::getParams('com_membersmanager')->get('check_in'); - - if ($time) - { - - // Get a db connection. - $db = JFactory::getDbo(); - // reset query - $query = $db->getQuery(true); - $query->select('*'); - $query->from($db->quoteName('#__membersmanager_currency')); - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - // Get Yesterdays date - $date = JFactory::getDate()->modify($time)->toSql(); - // reset query - $query = $db->getQuery(true); - - // Fields to update. - $fields = array( - $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', - $db->quoteName('checked_out') . '=0' - ); - - // Conditions for which records should be updated. - $conditions = array( - $db->quoteName('checked_out') . '!=0', - $db->quoteName('checked_out_time') . '<\''.$date.'\'' - ); - - // Check table - $query->update($db->quoteName('#__membersmanager_currency'))->set($fields)->where($conditions); - - $db->setQuery($query); - - $db->execute(); - } - } - - return false; - } -} diff --git a/admin/models/currency.php b/admin/models/currency.php deleted file mode 100644 index 27fa567..0000000 --- a/admin/models/currency.php +++ /dev/null @@ -1,907 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; - -// import Joomla modelform library -jimport('joomla.application.component.modeladmin'); - -/** - * Membersmanager Currency Model - */ -class MembersmanagerModelCurrency extends JModelAdmin -{ - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_MEMBERSMANAGER'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_membersmanager.currency'; - - /** - * Returns a Table object, always creating it - * - * @param type $type The table type to instantiate - * @param string $prefix A prefix for the table class name. Optional. - * @param array $config Configuration array for model. Optional. - * - * @return JTable A database object - * - * @since 1.6 - */ - public function getTable($type = 'currency', $prefix = 'MembersmanagerTable', $config = array()) - { - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Method to get a single record. - * - * @param integer $pk The id of the primary key. - * - * @return mixed Object on success, false on failure. - * - * @since 1.6 - */ - public function getItem($pk = null) - { - if ($item = parent::getItem($pk)) - { - if (!empty($item->params) && !is_array($item->params)) - { - // Convert the params field to an array. - $registry = new Registry; - $registry->loadString($item->params); - $item->params = $registry->toArray(); - } - - if (!empty($item->metadata)) - { - // Convert the metadata field to an array. - $registry = new Registry; - $registry->loadString($item->metadata); - $item->metadata = $registry->toArray(); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_membersmanager.currency'); - } - } - - return $item; - } - - /** - * Method to get the record form. - * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return mixed A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - // Get the form. - $form = $this->loadForm('com_membersmanager.currency', 'currency', array('control' => 'jform', 'load_data' => $loadData)); - - if (empty($form)) - { - return false; - } - - $jinput = JFactory::getApplication()->input; - - // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. - if ($jinput->get('a_id')) - { - $id = $jinput->get('a_id', 0, 'INT'); - } - // The back end uses id so we use that the rest of the time and set it to 0 by default. - else - { - $id = $jinput->get('id', 0, 'INT'); - } - - $user = JFactory::getUser(); - - // Check for existing item. - // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('currency.edit.state', 'com_membersmanager.currency.' . (int) $id)) - || ($id == 0 && !$user->authorise('currency.edit.state', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('ordering', 'disabled', 'true'); - $form->setFieldAttribute('published', 'disabled', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('ordering', 'filter', 'unset'); - $form->setFieldAttribute('published', 'filter', 'unset'); - } - // If this is a new item insure the greated by is set. - if (0 == $id) - { - // Set the created_by to this user - $form->setValue('created_by', null, $user->id); - } - // Modify the form based on Edit Creaded By access controls. - if (!$user->authorise('core.edit.created_by', 'com_membersmanager')) - { - // Disable fields for display. - $form->setFieldAttribute('created_by', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('created_by', 'readonly', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('created_by', 'filter', 'unset'); - } - // Modify the form based on Edit Creaded Date access controls. - if (!$user->authorise('core.edit.created', 'com_membersmanager')) - { - // Disable fields for display. - $form->setFieldAttribute('created', 'disabled', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('created', 'filter', 'unset'); - } - // Only load these values if no id is found - if (0 == $id) - { - // Set redirected field name - $redirectedField = $jinput->get('ref', null, 'STRING'); - // Set redirected field value - $redirectedValue = $jinput->get('refid', 0, 'INT'); - if (0 != $redirectedValue && $redirectedField) - { - // Now set the local-redirected field default value - $form->setValue($redirectedField, null, $redirectedValue); - } - } - return $form; - } - - /** - * Method to get the script that have to be included on the form - * - * @return string script files - */ - public function getScript() - { - return 'administrator/components/com_membersmanager/models/forms/currency.js'; - } - - /** - * Method to test whether a record can be deleted. - * - * @param object $record A record object. - * - * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. - * - * @since 1.6 - */ - protected function canDelete($record) - { - if (!empty($record->id)) - { - if ($record->published != -2) - { - return; - } - - $user = JFactory::getUser(); - // The record has been set. Check the record permissions. - return $user->authorise('currency.delete', 'com_membersmanager.currency.' . (int) $record->id); - } - return false; - } - - /** - * Method to test whether a record can have its state edited. - * - * @param object $record A record object. - * - * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. - * - * @since 1.6 - */ - protected function canEditState($record) - { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; - - if ($recordId) - { - // The record has been set. Check the record permissions. - $permission = $user->authorise('currency.edit.state', 'com_membersmanager.currency.' . (int) $recordId); - if (!$permission && !is_null($permission)) - { - return false; - } - } - // In the absense of better information, revert to the component permissions. - return $user->authorise('currency.edit.state', 'com_membersmanager'); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * @since 2.5 - */ - protected function allowEdit($data = array(), $key = 'id') - { - // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); - - return $user->authorise('currency.edit', 'com_membersmanager.currency.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('currency.edit', 'com_membersmanager'); - } - - /** - * Prepare and sanitise the table data prior to saving. - * - * @param JTable $table A JTable object. - * - * @return void - * - * @since 1.6 - */ - protected function prepareTable($table) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if (isset($table->name)) - { - $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); - } - - if (isset($table->alias) && empty($table->alias)) - { - $table->generateAlias(); - } - - if (empty($table->id)) - { - $table->created = $date->toSql(); - // set the user - if ($table->created_by == 0 || empty($table->created_by)) - { - $table->created_by = $user->id; - } - // Set ordering to the last item if not set - if (empty($table->ordering)) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('MAX(ordering)') - ->from($db->quoteName('#__membersmanager_currency')); - $db->setQuery($query); - $max = $db->loadResult(); - - $table->ordering = $max + 1; - } - } - else - { - $table->modified = $date->toSql(); - $table->modified_by = $user->id; - } - - if (!empty($table->id)) - { - // Increment the items version number. - $table->version++; - } - } - - /** - * Method to get the data that should be injected in the form. - * - * @return mixed The data for the form. - * - * @since 1.6 - */ - protected function loadFormData() - { - // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_membersmanager.edit.currency.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - } - - return $data; - } - - /** - * Method to get the unique fields of this table. - * - * @return mixed An array of field names, boolean false if none is set. - * - * @since 3.0 - */ - protected function getUniqeFields() - { - return array('codethree'); - } - - /** - * Method to delete one or more records. - * - * @param array &$pks An array of record primary keys. - * - * @return boolean True if successful, false if an error occurs. - * - * @since 12.2 - */ - public function delete(&$pks) - { - if (!parent::delete($pks)) - { - return false; - } - - return true; - } - - /** - * Method to change the published state of one or more records. - * - * @param array &$pks A list of the primary keys to change. - * @param integer $value The value of the published state. - * - * @return boolean True on success. - * - * @since 12.2 - */ - public function publish(&$pks, $value = 1) - { - if (!parent::publish($pks, $value)) - { - return false; - } - - return true; - } - - /** - * Method to perform batch operations on an item or a set of items. - * - * @param array $commands An array of commands to perform. - * @param array $pks An array of item ids. - * @param array $contexts An array of item contexts. - * - * @return boolean Returns true on success, false on failure. - * - * @since 12.2 - */ - public function batch($commands, $pks, $contexts) - { - // Sanitize ids. - $pks = array_unique($pks); - JArrayHelper::toInteger($pks); - - // Remove any values of zero. - if (array_search(0, $pks, true)) - { - unset($pks[array_search(0, $pks, true)]); - } - - if (empty($pks)) - { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); - return false; - } - - $done = false; - - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = MembersmanagerHelper::getActions('currency'); - $this->batchSet = true; - - if (!$this->canDo->get('core.batch')) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - return false; - } - - if ($this->type == false) - { - $type = new JUcmType; - $this->type = $type->getTypeByAlias($this->typeAlias); - } - - $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); - - if (!empty($commands['move_copy'])) - { - $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); - - if ($cmd == 'c') - { - $result = $this->batchCopy($commands, $pks, $contexts); - - if (is_array($result)) - { - foreach ($result as $old => $new) - { - $contexts[$new] = $contexts[$old]; - } - $pks = array_values($result); - } - else - { - return false; - } - } - elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) - { - return false; - } - - $done = true; - } - - if (!$done) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - - return false; - } - - // Clear the cache - $this->cleanCache(); - - return true; - } - - /** - * Batch copy items to a new category or current. - * - * @param integer $values The new values. - * @param array $pks An array of row IDs. - * @param array $contexts An array of item contexts. - * - * @return mixed An array of new IDs on success, boolean false on failure. - * - * @since 12.2 - */ - protected function batchCopy($values, $pks, $contexts) - { - if (empty($this->batchSet)) - { - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->canDo = MembersmanagerHelper::getActions('currency'); - } - - if (!$this->canDo->get('currency.create') && !$this->canDo->get('currency.batch')) - { - return false; - } - - // get list of uniqe fields - $uniqeFields = $this->getUniqeFields(); - // remove move_copy from array - unset($values['move_copy']); - - // make sure published is set - if (!isset($values['published'])) - { - $values['published'] = 0; - } - elseif (isset($values['published']) && !$this->canDo->get('currency.edit.state')) - { - $values['published'] = 0; - } - - $newIds = array(); - // Parent exists so let's proceed - while (!empty($pks)) - { - // Pop the first ID off the stack - $pk = array_shift($pks); - - $this->table->reset(); - - // only allow copy if user may edit this item. - if (!$this->user->authorise('currency.edit', $contexts[$pk])) - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - - // Check that the row actually exists - if (!$this->table->load($pk)) - { - if ($error = $this->table->getError()) - { - // Fatal error - $this->setError($error); - return false; - } - else - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - } - list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); - - // insert all set values - if (MembersmanagerHelper::checkArray($values)) - { - foreach ($values as $key => $value) - { - if (strlen($value) > 0 && isset($this->table->$key)) - { - $this->table->$key = $value; - } - } - } - - // update all uniqe fields - if (MembersmanagerHelper::checkArray($uniqeFields)) - { - foreach ($uniqeFields as $uniqeField) - { - $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); - } - } - - // Reset the ID because we are making a copy - $this->table->id = 0; - - // TODO: Deal with ordering? - // $this->table->ordering = 1; - - // Check the row. - if (!$this->table->check()) - { - $this->setError($this->table->getError()); - - return false; - } - - if (!empty($this->type)) - { - $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); - } - - // Store the row. - if (!$this->table->store()) - { - $this->setError($this->table->getError()); - - return false; - } - - // Get the new item ID - $newId = $this->table->get('id'); - - // Add the new ID to the array - $newIds[$pk] = $newId; - } - - // Clean the cache - $this->cleanCache(); - - return $newIds; - } - - /** - * Batch move items to a new category - * - * @param integer $value The new category ID. - * @param array $pks An array of row IDs. - * @param array $contexts An array of item contexts. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 12.2 - */ - protected function batchMove($values, $pks, $contexts) - { - if (empty($this->batchSet)) - { - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->canDo = MembersmanagerHelper::getActions('currency'); - } - - if (!$this->canDo->get('currency.edit') && !$this->canDo->get('currency.batch')) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); - return false; - } - - // make sure published only updates if user has the permission. - if (isset($values['published']) && !$this->canDo->get('currency.edit.state')) - { - unset($values['published']); - } - // remove move_copy from array - unset($values['move_copy']); - - // Parent exists so we proceed - foreach ($pks as $pk) - { - if (!$this->user->authorise('currency.edit', $contexts[$pk])) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); - return false; - } - - // Check that the row actually exists - if (!$this->table->load($pk)) - { - if ($error = $this->table->getError()) - { - // Fatal error - $this->setError($error); - return false; - } - else - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - } - - // insert all set values. - if (MembersmanagerHelper::checkArray($values)) - { - foreach ($values as $key => $value) - { - // Do special action for access. - if ('access' === $key && strlen($value) > 0) - { - $this->table->$key = $value; - } - elseif (strlen($value) > 0 && isset($this->table->$key)) - { - $this->table->$key = $value; - } - } - } - - - // Check the row. - if (!$this->table->check()) - { - $this->setError($this->table->getError()); - - return false; - } - - if (!empty($this->type)) - { - $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); - } - - // Store the row. - if (!$this->table->store()) - { - $this->setError($this->table->getError()); - - return false; - } - } - - // Clean the cache - $this->cleanCache(); - - return true; - } - - /** - * Method to save the form data. - * - * @param array $data The form data. - * - * @return boolean True on success. - * - * @since 1.6 - */ - public function save($data) - { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - - // set the metadata to the Item Data - if (isset($data['metadata']) && isset($data['metadata']['author'])) - { - $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; - $metadata->loadArray($data['metadata']); - $data['metadata'] = (string) $metadata; - } - - // Set the Params Items to data - if (isset($data['params']) && is_array($data['params'])) - { - $params = new JRegistry; - $params->loadArray($data['params']); - $data['params'] = (string) $params; - } - - // Alter the name for save as copy - if ($input->get('task') === 'save2copy') - { - $origTable = clone $this->getTable(); - $origTable->load($input->getInt('id')); - - if ($data['name'] == $origTable->name) - { - list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); - $data['name'] = $name; - $data['alias'] = $alias; - } - else - { - if ($data['alias'] == $origTable->alias) - { - $data['alias'] = ''; - } - } - - $data['published'] = 0; - } - - // Automatic handling of alias for empty fields - if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) - { - if ($data['alias'] == null || empty($data['alias'])) - { - if (JFactory::getConfig()->get('unicodeslugs') == 1) - { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); - } - else - { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); - } - - $table = JTable::getInstance('currency', 'membersmanagerTable'); - - if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) - { - $msg = JText::_('COM_MEMBERSMANAGER_CURRENCY_SAVE_WARNING'); - } - - $data['alias'] = $this->_generateNewTitle($data['alias']); - - if (isset($msg)) - { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); - } - } - } - - // Alter the uniqe field for save as copy - if ($input->get('task') === 'save2copy') - { - // Automatic handling of other uniqe fields - $uniqeFields = $this->getUniqeFields(); - if (MembersmanagerHelper::checkArray($uniqeFields)) - { - foreach ($uniqeFields as $uniqeField) - { - $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); - } - } - } - - if (parent::save($data)) - { - return true; - } - return false; - } - - /** - * Method to generate a uniqe value. - * - * @param string $field name. - * @param string $value data. - * - * @return string New value. - * - * @since 3.0 - */ - protected function generateUniqe($field,$value) - { - - // set field value uniqe - $table = $this->getTable(); - - while ($table->load(array($field => $value))) - { - $value = JString::increment($value); - } - - return $value; - } - - /** - * Method to change the title/s & alias. - * - * @param string $alias The alias. - * @param string/array $title The title. - * - * @return array/string Contains the modified title/s and/or alias. - * - */ - protected function _generateNewTitle($alias, $title = null) - { - - // Alter the title/s & alias - $table = $this->getTable(); - - while ($table->load(array('alias' => $alias))) - { - // Check if this is an array of titles - if (MembersmanagerHelper::checkArray($title)) - { - foreach($title as $nr => &$_title) - { - $_title = JString::increment($_title); - } - } - // Make sure we have a title - elseif ($title) - { - $title = JString::increment($title); - } - $alias = JString::increment($alias, 'dash'); - } - // Check if this is an array of titles - if (MembersmanagerHelper::checkArray($title)) - { - $title[] = $alias; - return $title; - } - // Make sure we have a title - elseif ($title) - { - return array($title, $alias); - } - // We only had an alias - return $alias; - } -} diff --git a/admin/models/fields/countries.php b/admin/models/fields/countries.php deleted file mode 100644 index 0c03843..0000000 --- a/admin/models/fields/countries.php +++ /dev/null @@ -1,58 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Countries Form Field class for the Membersmanager component - */ -class JFormFieldCountries extends JFormFieldList -{ - /** - * The countries field type. - * - * @var string - */ - public $type = 'countries'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - public function getOptions() - { - $db = JFactory::getDBO(); -$query = $db->getQuery(true); -$query->select($db->quoteName(array('a.id','a.name'),array('id','country_name'))); -$query->from($db->quoteName('#__membersmanager_country', 'a')); -$query->where($db->quoteName('a.published') . ' = 1'); -$query->order('a.name ASC'); -$db->setQuery((string)$query); -$items = $db->loadObjectList(); -$options = array(); -if ($items) -{ - $options[] = JHtml::_('select.option', '', 'Select a country'); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->country_name); - } -} - -return $options; - } -} diff --git a/admin/models/fields/currency.php b/admin/models/fields/currency.php deleted file mode 100644 index da1fa0e..0000000 --- a/admin/models/fields/currency.php +++ /dev/null @@ -1,56 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Currency Form Field class for the Membersmanager component - */ -class JFormFieldCurrency extends JFormFieldList -{ - /** - * The currency field type. - * - * @var string - */ - public $type = 'currency'; - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - public function getOptions() - { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.codethree','a.name'),array('codethree','currency_name'))); - $query->from($db->quoteName('#__membersmanager_currency', 'a')); - $query->where($db->quoteName('a.published') . ' = 1'); - $query->order('a.name ASC'); - $db->setQuery((string)$query); - $items = $db->loadObjectList(); - $options = array(); - if ($items) - { - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->codethree, $item->currency_name); - } - } - return $options; - } -} diff --git a/admin/models/fields/mainmembers.php b/admin/models/fields/mainmembers.php index b559c07..c6c913b 100644 --- a/admin/models/fields/mainmembers.php +++ b/admin/models/fields/mainmembers.php @@ -60,9 +60,15 @@ class JFormFieldMainmembers extends JFormFieldList $refJ = ''; if (!is_null($values['id']) && strlen($values['view'])) { - // only load referal if not new item. + // only load referral if not new item. $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; } $user = JFactory::getUser(); // only add if user allowed to create member @@ -136,31 +142,90 @@ class JFormFieldMainmembers extends JFormFieldList */ public function getOptions() { + // load the db opbject $db = JFactory::getDBO(); -$query = $db->getQuery(true); -$query->select($db->quoteName(array('a.id','a.user','a.account','a.name','a.email'),array('id','main_member_user','account','name','email'))); -$query->from($db->quoteName('#__membersmanager_member', 'a')); -$query->where($db->quoteName('a.published') . ' >= 1'); -$query->where($db->quoteName('a.account') . ' = 1 OR ' . $db->quoteName('a.account') . ' = 2'); -$query->order('a.user ASC'); -$db->setQuery((string)$query); -$items = $db->loadObjectList(); -$options = array(); -if ($items) -{ - $options[] = JHtml::_('select.option', '', JText::_('COM_MEMBERSMANAGER_SELECT_AN_OPTION')); - foreach($items as $item) - { - if ($item->account == 1) + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the id + $id = $jinput->getInt('id', 0); + if ($id > 0) { - $options[] = JHtml::_('select.option', $item->id, JFactory::getUser((int) $item->main_member_user)->name . ' ' . JFactory::getUser((int) $item->main_member_user)->email); + $main_member = MembersmanagerHelper::getVar('member', $id, 'id', 'main_member'); } - else + // get the user + $my = JFactory::getUser(); + // start the query + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.user','a.account','a.name','a.email','a.token'),array('id','main_member_user','account','name','email','token'))); + $query->from($db->quoteName('#__membersmanager_member', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->where($db->quoteName('a.account') . ' = 1 OR ' . $db->quoteName('a.account') . ' = 2'); + // check if current user is a supper admin + if (!$my->authorise('core.admin')) { - $options[] = JHtml::_('select.option', $item->id, $item->name . ' ' . $item->email); + // get user access groups + $user_access_types = MembersmanagerHelper::getAccess($my); + // user must have access + if (isset($user_access_types) && MembersmanagerHelper::checkArray($user_access_types)) + { + // only get members of the type this user has access to + $query->where('a.type IN (' . implode(',', $user_access_types) . ')'); + // get current member type + if (($type= MembersmanagerHelper::getVar('member', $id, 'id', 'type')) !== false) + { + // check if this member is in the user access types + if (in_array($type, $user_access_types)) + { + // no need to load this member + $main_member = 0; + } + } + } + elseif (isset($main_member) && $main_member > 0) + { + // load this main member only + $query->where($db->quoteName('a.id') . ' = ' . (int) $main_member); + } + else + { + return false; + } } - } -} -return $options; + $query->order('a.user ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + // only add if more then one value found + if (count( (array) $items) > 1) + { + $options[] = JHtml::_('select.option', '', 'Select a main member'); + } + foreach($items as $item) + { + // check if we current member + if (isset($main_member) && $main_member == $item->id) + { + // remove ID + $main_member = 0; + } + if ($item->account == 1) + { + $options[] = JHtml::_('select.option', $item->id, JFactory::getUser((int) $item->main_member_user)->name . ' ' . JFactory::getUser((int) $item->main_member_user)->email . ' ( ' . $item->token . ' )'); + } + else + { + $options[] = JHtml::_('select.option', $item->id, $item->name . ' ' . $item->email . ' ( ' . $item->token . ' )'); + } + } + } + // add the current user (TODO this is not suppose to happen) + if (isset($main_member) && $main_member > 0) + { + // load the current member manual + $options[] = JHtml::_('select.option', (int) $main_member, MembersmanagerHelper::getMemberName($main_member)); + } + return $options; } } diff --git a/admin/models/fields/memberuser.php b/admin/models/fields/memberuser.php index 896e566..4d98f26 100644 --- a/admin/models/fields/memberuser.php +++ b/admin/models/fields/memberuser.php @@ -14,12 +14,12 @@ defined('_JEXEC') or die('Restricted access'); // import the list field type jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('user'); +JFormHelper::loadFieldClass('list'); /** * Memberuser Form Field class for the Membersmanager component */ -class JFormFieldMemberuser extends JFormFieldUser +class JFormFieldMemberuser extends JFormFieldList { /** * The memberuser field type. @@ -29,44 +29,108 @@ class JFormFieldMemberuser extends JFormFieldUser public $type = 'memberuser'; /** - * Method to get the filtering groups (null means no filtering) + * Method to get a list of options for a list input. * - * @return mixed array of filtering groups or null. - * - * @since 1.6 + * @return array An array of JHtml options. */ - protected function getGroups() + public function getOptions() { - // set the groups array -$groups = JComponentHelper::getParams('com_membersmanager')->get('memberuser'); -return $groups; - } - - /** - * Method to get the users to exclude from the list of users - * - * @return mixed Array of users to exclude or null to to not exclude them - * - * @since 1.6 - */ - protected function getExcluded() - { - // To ensure that there is only one record per user -// Get a db connection. -$db = JFactory::getDbo(); -// Create a new query object. -$query = $db->getQuery(true); -// Select all records from the #__membersmanager_member table from user column'. -$query->select($db->quoteName('user')); -$query->from($db->quoteName('#__membersmanager_member')); -$db->setQuery($query); -$db->execute(); -$found = $db->getNumRows(); -if ($found) -{ - // return all users already used - return array_unique($db->loadColumn()); -} -return null; + // load the db object + $db = JFactory::getDBO(); + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the id + $id = $jinput->getInt('id', 0); + if ($id > 0) + { + $user = MembersmanagerHelper::getVar('member', $id, 'id', 'user'); + } + // get all ready used users IDs + $users = MembersmanagerHelper::getVars('member', array('1','4'), 'account', 'user'); + if (isset($user) && $user > 0 && MembersmanagerHelper::checkArray($users)) + { + // remove from users array + if (($key = array_search($user, $users)) !== false) + { + unset($users[$key]); + } + } + // function to setup the group array + $getGroups = function ($groups) { + // convert to array + if (MembersmanagerHelper::checkJson($groups)) + { + return (array) json_decode($groups, true); + } + elseif (is_numeric($groups)) + { + return array($groups); + } + return false; + }; + // get the user + $my = JFactory::getUser(); + // start query + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','user_name'))); + $query->from($db->quoteName('#__users', 'a')); + $query->where($db->quoteName('a.block') . ' = 0'); + // only load user not already used + if (isset($users) && MembersmanagerHelper::checkArray($users)) + { + $query->where($db->quoteName('a.id') . ' NOT IN (' . implode(', ', $users) . ')'); + } + // check if current user is a supper admin + if (!$my->authorise('core.admin')) + { + // get user access groups + $user_access_groups = MembersmanagerHelper::getAccess($my, 2); + // user must have access + if (isset($user_access_groups) && MembersmanagerHelper::checkArray($user_access_groups)) + { + // filter my user access groups + $query->join('LEFT', '#__user_usergroup_map AS map ON map.user_id = a.id'); + $query->where('map.group_id IN (' . implode(',', $user_access_groups) . ')'); + } + elseif ($id > 0) + { + // load this member only + $query->where($db->quoteName('a.id') . ' = ' . (int) $id); + } + else + { + return false; + } + } + $query->order('a.name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + // only add if more then one value found + if (count( (array) $items) > 1) + { + $options[] = JHtml::_('select.option', '', 'Select a user'); + } + // build the options + foreach($items as $item) + { + // check if we current member + if (isset($user) && $user == $item->id) + { + // remove ID + $user = 0; + } + $options[] = JHtml::_('select.option', $item->id, $item->user_name); + } + } + // add the current user (TODO this is not suppose to happen) + if (isset($user) && $user > 0) + { + // load the current member manual + $options[] = JHtml::_('select.option', (int) $user, JFactory::getUser($user)->name); + } + return $options; } } diff --git a/admin/models/fields/regions.php b/admin/models/fields/regions.php deleted file mode 100644 index 48da475..0000000 --- a/admin/models/fields/regions.php +++ /dev/null @@ -1,161 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the list field type -jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - -/** - * Regions Form Field class for the Membersmanager component - */ -class JFormFieldRegions extends JFormFieldList -{ - /** - * The regions field type. - * - * @var string - */ - public $type = 'regions'; - - /** - * Override to add new button - * - * @return string The field input markup. - * - * @since 3.2 - */ - protected function getInput() - { - // see if we should add buttons - $setButton = $this->getAttribute('button'); - // get html - $html = parent::getInput(); - // if true set button - if ($setButton === 'true') - { - $button = array(); - $script = array(); - $buttonName = $this->getAttribute('name'); - // get the input from url - $app = JFactory::getApplication(); - $jinput = $app->input; - // get the view name & id - $values = $jinput->getArray(array( - 'id' => 'int', - 'view' => 'word' - )); - // check if new item - $ref = ''; - $refJ = ''; - if (!is_null($values['id']) && strlen($values['view'])) - { - // only load referal if not new item. - $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; - $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; - } - $user = JFactory::getUser(); - // only add if user allowed to create region - if ($user->authorise('region.create', 'com_membersmanager') && $app->isAdmin()) // TODO for now only in admin area. - { - // build Create button - $buttonNamee = trim($buttonName); - $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); - $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); - $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); - $buttonNamee = ucfirst(strtolower($buttonNamee)); - $button[] = ' - '; - } - // only add if user allowed to edit region - if (($buttonName === 'region' || $buttonName === 'regions') && $user->authorise('region.edit', 'com_membersmanager') && $app->isAdmin()) // TODO for now only in admin area. - { - // build edit button - $buttonNamee = trim($buttonName); - $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee); - $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee); - $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee); - $buttonNamee = ucfirst(strtolower($buttonNamee)); - $button[] = ''; - // build script - $script[] = " - jQuery(document).ready(function() { - jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) { - e.preventDefault(); - var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); - ".$buttonName."Button(".$buttonName."Value); - }); - var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val(); - ".$buttonName."Button(".$buttonName."Value); - }); - function ".$buttonName."Button(value) { - if (value > 0) { - // hide the create button - jQuery('#".$buttonName."Create').hide(); - // show edit button - jQuery('#".$buttonName."Edit').show(); - var url = 'index.php?option=com_membersmanager&view=regions&task=region.edit&id='+value+'".$refJ."'; - jQuery('#".$buttonName."Edit').attr('href', url); - } else { - // show the create button - jQuery('#".$buttonName."Create').show(); - // hide edit button - jQuery('#".$buttonName."Edit').hide(); - } - }"; - } - // check if button was created for region field. - if (is_array($button) && count($button) > 0) - { - // Load the needed script. - $document = JFactory::getDocument(); - $document->addScriptDeclaration(implode(' ',$script)); - // return the button attached to input field. - return '
' .$html . implode('',$button).'
'; - } - } - return $html; - } - - /** - * Method to get a list of options for a list input. - * - * @return array An array of JHtml options. - */ - public function getOptions() - { - $db = JFactory::getDBO(); -$query = $db->getQuery(true); -$query->select($db->quoteName(array('a.id','a.name','b.codetwo'),array('id','region_name','country'))); -$query->from($db->quoteName('#__membersmanager_region', 'a')); - $query->join('LEFT', '#__membersmanager_country AS b ON b.id = a.country'); -$query->where($db->quoteName('a.published') . ' = 1'); -$query->order('b.codetwo ASC'); - $query->order('a.name ASC'); -$db->setQuery((string)$query); -$items = $db->loadObjectList(); -$options = array(); -if ($items) -{ - $options[] = JHtml::_('select.option', '', 'Select a region'); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->region_name.' ('.$item->country.')'); - } -} - -return $options; - } -} diff --git a/admin/models/fields/types.php b/admin/models/fields/types.php index 93a3b76..ef41d12 100644 --- a/admin/models/fields/types.php +++ b/admin/models/fields/types.php @@ -60,9 +60,15 @@ class JFormFieldTypes extends JFormFieldList $refJ = ''; if (!is_null($values['id']) && strlen($values['view'])) { - // only load referal if not new item. + // only load referral if not new item. $ref = '&ref=' . $values['view'] . '&refid=' . $values['id']; $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id']; + // get the return value. + $_uri = (string) JUri::getInstance(); + $_return = urlencode(base64_encode($_uri)); + // load return value. + $ref .= '&return=' . $_return; + $refJ .= '&return=' . $_return; } $user = JFactory::getUser(); // only add if user allowed to create type @@ -136,24 +142,54 @@ class JFormFieldTypes extends JFormFieldList */ public function getOptions() { + // load the db opbject $db = JFactory::getDBO(); -$query = $db->getQuery(true); -$query->select($db->quoteName(array('a.id','a.name'),array('id','type_name'))); -$query->from($db->quoteName('#__membersmanager_type', 'a')); -$query->where($db->quoteName('a.published') . ' >= 1'); -$query->order('a.name ASC'); -$db->setQuery((string)$query); -$items = $db->loadObjectList(); -$options = array(); -if ($items) -{ - $options[] = JHtml::_('select.option', '', JText::_('COM_MEMBERSMANAGER_SELECT_AN_OPTION')); - foreach($items as $item) - { - $options[] = JHtml::_('select.option', $item->id, $item->type_name); - } -} - -return $options; + // get the user + $user = JFactory::getUser(); + // access types + $accessTypes = MembersmanagerHelper::getAccess($user); + // start query + $query = $db->getQuery(true); + $query->select($db->quoteName(array('a.id','a.name'),array('id','type_name'))); + $query->from($db->quoteName('#__membersmanager_type', 'a')); + $query->where($db->quoteName('a.published') . ' >= 1'); + // check if current user is a supper admin + if (!$user->authorise('core.admin')) + { + // get the input from url + $jinput = JFactory::getApplication()->input; + // get the id + $id = $jinput->getInt('id', 0); + if ($id > 0) + { + $type = MembersmanagerHelper::getVar('member', $id, 'id', 'type'); + // check if part of user access + if (!MembersmanagerHelper::checkArray($accessTypes) || !in_array($type, $accessTypes)) + { + $accessTypes[] = $type; + } + } + // filter by access type + if (MembersmanagerHelper::checkArray($accessTypes)) + { + $query->where($db->quoteName('a.id') . ' in (' . implode(',', $accessTypes) . ')'); + } + else + { + return false; + } + } + $query->order('a.name ASC'); + $db->setQuery((string)$query); + $items = $db->loadObjectList(); + $options = array(); + if ($items) + { + foreach($items as $item) + { + $options[] = JHtml::_('select.option', $item->id, $item->type_name); + } + } + return $options; } } diff --git a/admin/models/forms/country.js b/admin/models/forms/country.js deleted file mode 100644 index f783fe7..0000000 --- a/admin/models/forms/country.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - - diff --git a/admin/models/forms/country.xml b/admin/models/forms/country.xml deleted file mode 100644 index 3d30960..0000000 --- a/admin/models/forms/country.xml +++ /dev/null @@ -1,188 +0,0 @@ - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - - -
-
\ No newline at end of file diff --git a/admin/models/forms/currency.js b/admin/models/forms/currency.js deleted file mode 100644 index f783fe7..0000000 --- a/admin/models/forms/currency.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - - diff --git a/admin/models/forms/currency.xml b/admin/models/forms/currency.xml deleted file mode 100644 index 1e2f96e..0000000 --- a/admin/models/forms/currency.xml +++ /dev/null @@ -1,246 +0,0 @@ - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - - -
-
\ No newline at end of file diff --git a/admin/models/forms/member.js b/admin/models/forms/member.js index c3cf4ea..2caf5fb 100644 --- a/admin/models/forms/member.js +++ b/admin/models/forms/member.js @@ -46,26 +46,27 @@ function vvvvvvv(account_vvvvvvv) // set this function logic if (account) { - jQuery('#jform_user').closest('.control-group').show(); + jQuery('#jform_main_member').closest('.control-group').show(); + // add required attribute to main_member field if (jform_vvvvvvvvvv_required) { - updateFieldRequired('user',0); - jQuery('#jform_user').prop('required','required'); - jQuery('#jform_user').attr('aria-required',true); - jQuery('#jform_user').addClass('required'); + updateFieldRequired('main_member',0); + jQuery('#jform_main_member').prop('required','required'); + jQuery('#jform_main_member').attr('aria-required',true); + jQuery('#jform_main_member').addClass('required'); jform_vvvvvvvvvv_required = false; } - } else { - jQuery('#jform_user').closest('.control-group').hide(); + jQuery('#jform_main_member').closest('.control-group').hide(); + // remove required attribute from main_member field if (!jform_vvvvvvvvvv_required) { - updateFieldRequired('user',1); - jQuery('#jform_user').removeAttr('required'); - jQuery('#jform_user').removeAttr('aria-required'); - jQuery('#jform_user').removeClass('required'); + updateFieldRequired('main_member',1); + jQuery('#jform_main_member').removeAttr('required'); + jQuery('#jform_main_member').removeAttr('aria-required'); + jQuery('#jform_main_member').removeClass('required'); jform_vvvvvvvvvv_required = true; } } @@ -75,7 +76,7 @@ function vvvvvvv(account_vvvvvvv) function account_vvvvvvv_SomeFunc(account_vvvvvvv) { // set the function logic - if (account_vvvvvvv == 1 || account_vvvvvvv == 4) + if (account_vvvvvvv == 3 || account_vvvvvvv == 4) { return true; } @@ -101,47 +102,55 @@ function vvvvvvw(account_vvvvvvw) // set this function logic if (account) { - jQuery('#jform_email').closest('.control-group').show(); + jQuery('#jform_password_check').closest('.control-group').show(); + jQuery('#jform_useremail').closest('.control-group').show(); + // add required attribute to useremail field if (jform_vvvvvvwvvw_required) { - updateFieldRequired('email',0); - jQuery('#jform_email').prop('required','required'); - jQuery('#jform_email').attr('aria-required',true); - jQuery('#jform_email').addClass('required'); + updateFieldRequired('useremail',0); + jQuery('#jform_useremail').prop('required','required'); + jQuery('#jform_useremail').attr('aria-required',true); + jQuery('#jform_useremail').addClass('required'); jform_vvvvvvwvvw_required = false; } - - jQuery('#jform_name').closest('.control-group').show(); + jQuery('#jform_username').closest('.control-group').show(); + // add required attribute to username field if (jform_vvvvvvwvvx_required) { - updateFieldRequired('name',0); - jQuery('#jform_name').prop('required','required'); - jQuery('#jform_name').attr('aria-required',true); - jQuery('#jform_name').addClass('required'); + updateFieldRequired('username',0); + jQuery('#jform_username').prop('required','required'); + jQuery('#jform_username').attr('aria-required',true); + jQuery('#jform_username').addClass('required'); jform_vvvvvvwvvx_required = false; } - + jQuery('#jform_password').closest('.control-group').show(); + jQuery('#jform_user').closest('.control-group').show(); } else { - jQuery('#jform_email').closest('.control-group').hide(); + jQuery('#jform_password_check').closest('.control-group').hide(); + jQuery('#jform_useremail').closest('.control-group').hide(); + // remove required attribute from useremail field if (!jform_vvvvvvwvvw_required) { - updateFieldRequired('email',1); - jQuery('#jform_email').removeAttr('required'); - jQuery('#jform_email').removeAttr('aria-required'); - jQuery('#jform_email').removeClass('required'); + updateFieldRequired('useremail',1); + jQuery('#jform_useremail').removeAttr('required'); + jQuery('#jform_useremail').removeAttr('aria-required'); + jQuery('#jform_useremail').removeClass('required'); jform_vvvvvvwvvw_required = true; } - jQuery('#jform_name').closest('.control-group').hide(); + jQuery('#jform_username').closest('.control-group').hide(); + // remove required attribute from username field if (!jform_vvvvvvwvvx_required) { - updateFieldRequired('name',1); - jQuery('#jform_name').removeAttr('required'); - jQuery('#jform_name').removeAttr('aria-required'); - jQuery('#jform_name').removeClass('required'); + updateFieldRequired('username',1); + jQuery('#jform_username').removeAttr('required'); + jQuery('#jform_username').removeAttr('aria-required'); + jQuery('#jform_username').removeClass('required'); jform_vvvvvvwvvx_required = true; } + jQuery('#jform_password').closest('.control-group').hide(); + jQuery('#jform_user').closest('.control-group').hide(); } } @@ -149,7 +158,7 @@ function vvvvvvw(account_vvvvvvw) function account_vvvvvvw_SomeFunc(account_vvvvvvw) { // set the function logic - if (account_vvvvvvw == 2 || account_vvvvvvw == 3) + if (account_vvvvvvw == 1 || account_vvvvvvw == 4) { return true; } @@ -175,26 +184,27 @@ function vvvvvvx(account_vvvvvvx) // set this function logic if (account) { - jQuery('#jform_main_member').closest('.control-group').show(); + jQuery('#jform_email').closest('.control-group').show(); + // add required attribute to email field if (jform_vvvvvvxvvy_required) { - updateFieldRequired('main_member',0); - jQuery('#jform_main_member').prop('required','required'); - jQuery('#jform_main_member').attr('aria-required',true); - jQuery('#jform_main_member').addClass('required'); + updateFieldRequired('email',0); + jQuery('#jform_email').prop('required','required'); + jQuery('#jform_email').attr('aria-required',true); + jQuery('#jform_email').addClass('required'); jform_vvvvvvxvvy_required = false; } - } else { - jQuery('#jform_main_member').closest('.control-group').hide(); + jQuery('#jform_email').closest('.control-group').hide(); + // remove required attribute from email field if (!jform_vvvvvvxvvy_required) { - updateFieldRequired('main_member',1); - jQuery('#jform_main_member').removeAttr('required'); - jQuery('#jform_main_member').removeAttr('aria-required'); - jQuery('#jform_main_member').removeClass('required'); + updateFieldRequired('email',1); + jQuery('#jform_email').removeAttr('required'); + jQuery('#jform_email').removeAttr('aria-required'); + jQuery('#jform_email').removeClass('required'); jform_vvvvvvxvvy_required = true; } } @@ -204,7 +214,7 @@ function vvvvvvx(account_vvvvvvx) function account_vvvvvvx_SomeFunc(account_vvvvvvx) { // set the function logic - if (account_vvvvvvx == 3 || account_vvvvvvx == 4) + if (account_vvvvvvx == 2 || account_vvvvvvx == 3) { return true; } @@ -260,6 +270,35 @@ jQuery(document).ready(function($) setFile(profile, false, 'profile', 'image') } }); +function getUserDetails(user){ + getUserDetails_server(user).done(function(result) { + if (result) { + setUserDetails(result); + } + }); +} +function getUserDetails_server(user){ + var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.getUserDetails&format=json&vdm="+vastDevMod); + if(token.length > 0 && user > 0){ + var request = 'token='+token+'&user='+user; + } + return jQuery.ajax({ + type: 'GET', + url: getUrl, + dataType: 'jsonp', + data: request, + jsonp: 'callback' + }); +} +function setUserDetails(result){ + if (result.name) { + for (var key in result) { + if (result.hasOwnProperty(key)) { + jQuery('#jform_' + key).val(result[key]); + } + } + } +} function setFilekey(filename, fileFormat, target, type){ var currentFileName = jQuery("#jform_"+target+"_"+type).val(); @@ -318,8 +357,12 @@ function setFile(filename, fileFormat, target, type){ return true; } -function removeFileCheck(clearServer, target, type){ - UIkit.modal.confirm('Are you sure you want to delete this '+target+'?', function(){ removeFile(clearServer, target, 1, type); }); +function removeFileCheck(clearServer, target, type, uiVer){ + if (3 == uiVer) { + UIkit.modal.confirm('Are you sure you want to delete this '+target+'?').then(function(){ removeFile(clearServer, target, 1, type); }); + } else { + UIkit2.modal.confirm('Are you sure you want to delete this '+target+'?', function(){ removeFile(clearServer, target, 1, type); }); + } } function removeFile(clearServer, target, flush, type){ @@ -493,140 +536,4 @@ function setRegion(array){ jQuery('#jform_region').append(''); } jQuery('#jform_region').trigger('liszt:updated'); -} - -jQuery(document).ready(function($) -{ - var user_id = $("#jform_user_id").val(); - var showname = 1; - // check if the user id was found - if (!isSet(user_id)) { - var user_id =$("#jform_user").val(); - var showname = 2; - } - getUser(user_id, showname); -}); -function getUser_server(id, showname){ - var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.getUser&format=json&vdm="+vastDevMod); - if(token.length > 0 && id > 0 && showname > 0){ - var request = 'token='+token+'&id='+id+'&showname='+showname; - } - return jQuery.ajax({ - type: 'GET', - url: getUrl, - dataType: 'jsonp', - data: request, - jsonp: 'callback' - }); -} -function getUser(id, showname){ - getUser_server(id, showname).done(function(result) { - jQuery('#user_info').remove(); - if(result) { - loadUser(result); - } else { - getCreateUserFields(1); - } - }) -} -function getCreateUserFields_server(id){ - var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.getCreateUserFields&format=json&vdm="+vastDevMod); - if(token.length > 0 && id > 0){ - var request = 'token='+token+'&id='+id; - } - return jQuery.ajax({ - type: 'GET', - url: getUrl, - dataType: 'jsonp', - data: request, - jsonp: 'callback' - }); -} -function getCreateUserFields(id) { - getCreateUserFields_server(id).done(function(result) { - jQuery('#user_info').remove(); - if(result) { - loadUser(result); - } - }); -} -// user values -var userArray = {}; -function setUser_server(id){ - var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.setUser&format=json&vdm="+vastDevMod); - if (token.length > 0 && id > 0) { - var request = 'token='+token+'&id='+id+'&data='+JSON.stringify(userArray); - } - return jQuery.ajax({ - type: 'GET', - url: getUrl, - dataType: 'jsonp', - data: request, - jsonp: 'callback' - }); -} -function setUser(){ - // get the id - var id = jQuery("#jform_user_id").val(); - // check if the user id was found - if (!isSet(id)) { - var id = jQuery("#jform_user").val(); - } - // get the values - userArray['var'] = encodeURIComponent(jQuery("#vdm_name").val()); - userArray['uvar'] = encodeURIComponent(jQuery("#vdm_username").val()); - userArray['evar'] = encodeURIComponent(jQuery("#vdm_email").val()); - userArray['dvar'] = encodeURIComponent(jQuery("#vdm_password").val()); - // set the values - setUser_server(id).done(function(result) { - if(result.html) { - jQuery('#user_info').remove(); - loadUser(result.html); - jQuery('#system-message-container').html(result.success); - } else if (result.error) { - jQuery('#system-message-container').html(result.error); - } - }); -} -// user values -var userCArray = {}; -function createUser_server(){ - var getUrl = JRouter("index.php?option=com_membersmanager&task=ajax.createUser&format=json&vdm="+vastDevMod); - if (token.length > 0) { - var request = 'token='+token+'&key=1&data='+JSON.stringify(userCArray); - } - return jQuery.ajax({ - type: 'GET', - url: getUrl, - dataType: 'jsonp', - data: request, - jsonp: 'callback' - }); -} -function createUser() { - // get the values - userCArray['var'] = encodeURIComponent(jQuery("#vdm_c_name").val()); - userCArray['uvar'] = encodeURIComponent(jQuery("#vdm_c_username").val()); - userCArray['evar'] = encodeURIComponent(jQuery("#vdm_c_email").val()); - userCArray['dvar'] = encodeURIComponent(jQuery("#vdm_c_password").val()); - // this takes long so show spinner - jQuery("#loading").show(); - // set the values - createUser_server().done(function(result) { - if (result.html) { - jQuery('#user_info').remove(); - loadUser(result.html); - jQuery('#system-message-container').html(result.success); - } else if (result.error) { - jQuery('#system-message-container').html(result.error); - } - jQuery("#loading").hide(); - }); -} -function loadUser(result){ - // first check the system type - var account = jQuery("#jform_account").val(); - if (1 == account || 4 == account) { - jQuery('#jform_user').closest('.span6').append(result); - } } diff --git a/admin/models/forms/member.xml b/admin/models/forms/member.xml index 56cf7df..fcf0980 100644 --- a/admin/models/forms/member.xml +++ b/admin/models/forms/member.xml @@ -85,39 +85,36 @@ filter="unset" /> - + - - - + COM_MEMBERSMANAGER_MEMBER_SUB_LOGIN - - + + - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + +
diff --git a/admin/models/forms/region.js b/admin/models/forms/region.js deleted file mode 100644 index f783fe7..0000000 --- a/admin/models/forms/region.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - - diff --git a/admin/models/forms/region.xml b/admin/models/forms/region.xml deleted file mode 100644 index f76d65c..0000000 --- a/admin/models/forms/region.xml +++ /dev/null @@ -1,147 +0,0 @@ - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - - -
-
\ No newline at end of file diff --git a/admin/models/forms/type.xml b/admin/models/forms/type.xml index 2ac2c6c..d33fc83 100644 --- a/admin/models/forms/type.xml +++ b/admin/models/forms/type.xml @@ -113,6 +113,24 @@ filter="HTML" hint="COM_MEMBERSMANAGER_TYPE_DESCRIPTION_HINT" /> + + + + addTablePath(JPATH_ADMINISTRATOR . '/components/com_membersmanager/tables'); + // get instance of the table return JTable::getInstance($type, $prefix, $config); } @@ -113,9 +113,26 @@ class MembersmanagerModelMember extends JModelAdmin } else { + // set the vast development method key $this->vastDevMod = MembersmanagerHelper::randomkey(50); MembersmanagerHelper::set($this->vastDevMod, 'member__'.$id); MembersmanagerHelper::set('member__'.$id, $this->vastDevMod); + // set a return value if found + $jinput = JFactory::getApplication()->input; + $return = $jinput->get('return', null, 'base64'); + MembersmanagerHelper::set($this->vastDevMod . '__return', $return); + } + // load values from user table + if (isset($item->user) && $item->user > 0 && isset($item->account) && (1 == $item->account || 4 == $item->account)) + { + // load values from user table + $member = JFactory::getUser($item->user); + // set the name + $item->name = $member->name; + // set the useremail + $item->useremail = $member->email; + // set the username + $item->username = $member->username; } if (!empty($item->id)) @@ -126,22 +143,25 @@ class MembersmanagerModelMember extends JModelAdmin } return $item; - } + } /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_membersmanager.member', 'member', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_membersmanager.member', 'member', $options); if (empty($form)) { @@ -201,474 +221,6 @@ class MembersmanagerModelMember extends JModelAdmin // Disable fields while saving. $form->setFieldAttribute('created', 'filter', 'unset'); } - // Modify the form based on Edit User access controls. - if ($id != 0 && (!$user->authorise('member.edit.user', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.user', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('user', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('user', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('user')) - { - // Disable fields while saving. - $form->setFieldAttribute('user', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('user', 'required', 'false'); - } - } - // Modify the from the form based on User access controls. - if ($id != 0 && (!$user->authorise('member.access.user', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.user', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('user'); - } - // Modify the form based on View User access controls. - if ($id != 0 && (!$user->authorise('member.view.user', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.user', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('user', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('user')) - { - // Disable fields while saving. - $form->setFieldAttribute('user', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('user', 'required', 'false'); - } - } - // Modify the form based on Edit Landline Phone access controls. - if ($id != 0 && (!$user->authorise('member.edit.landline_phone', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.landline_phone', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('landline_phone', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('landline_phone', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('landline_phone')) - { - // Disable fields while saving. - $form->setFieldAttribute('landline_phone', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('landline_phone', 'required', 'false'); - } - } - // Modify the from the form based on Landline Phone access controls. - if ($id != 0 && (!$user->authorise('member.access.landline_phone', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.landline_phone', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('landline_phone'); - } - // Modify the form based on View Landline Phone access controls. - if ($id != 0 && (!$user->authorise('member.view.landline_phone', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.landline_phone', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('landline_phone', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('landline_phone')) - { - // Disable fields while saving. - $form->setFieldAttribute('landline_phone', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('landline_phone', 'required', 'false'); - } - } - // Modify the form based on Edit Type access controls. - if ($id != 0 && (!$user->authorise('member.edit.type', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.type', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('type', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('type', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('type')) - { - // Disable fields while saving. - $form->setFieldAttribute('type', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('type', 'required', 'false'); - } - } - // Modify the from the form based on Type access controls. - if ($id != 0 && (!$user->authorise('member.access.type', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.type', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('type'); - } - // Modify the form based on View Type access controls. - if ($id != 0 && (!$user->authorise('member.view.type', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.type', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('type', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('type')) - { - // Disable fields while saving. - $form->setFieldAttribute('type', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('type', 'required', 'false'); - } - } - // Modify the form based on Edit Account access controls. - if ($id != 0 && (!$user->authorise('member.edit.account', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.account', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('account', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('account', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('account')) - { - // Disable fields while saving. - $form->setFieldAttribute('account', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('account', 'required', 'false'); - } - } - // Modify the from the form based on Account access controls. - if ($id != 0 && (!$user->authorise('member.access.account', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.account', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('account'); - } - // Modify the form based on View Account access controls. - if ($id != 0 && (!$user->authorise('member.view.account', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.account', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('account', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('account')) - { - // Disable fields while saving. - $form->setFieldAttribute('account', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('account', 'required', 'false'); - } - } - // Modify the form based on Edit Token access controls. - if ($id != 0 && (!$user->authorise('member.edit.token', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.token', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('token', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('token', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('token')) - { - // Disable fields while saving. - $form->setFieldAttribute('token', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('token', 'required', 'false'); - } - } - // Modify the from the form based on Token access controls. - if ($id != 0 && (!$user->authorise('member.access.token', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.token', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('token'); - } - // Modify the form based on View Token access controls. - if ($id != 0 && (!$user->authorise('member.view.token', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.token', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('token', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('token')) - { - // Disable fields while saving. - $form->setFieldAttribute('token', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('token', 'required', 'false'); - } - } - // Modify the form based on Edit Country access controls. - if ($id != 0 && (!$user->authorise('member.edit.country', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.country', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('country', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('country', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('country')) - { - // Disable fields while saving. - $form->setFieldAttribute('country', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('country', 'required', 'false'); - } - } - // Modify the from the form based on Country access controls. - if ($id != 0 && (!$user->authorise('member.access.country', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.country', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('country'); - } - // Modify the form based on View Country access controls. - if ($id != 0 && (!$user->authorise('member.view.country', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.country', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('country', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('country')) - { - // Disable fields while saving. - $form->setFieldAttribute('country', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('country', 'required', 'false'); - } - } - // Modify the form based on Edit Postalcode access controls. - if ($id != 0 && (!$user->authorise('member.edit.postalcode', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.postalcode', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('postalcode', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('postalcode', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('postalcode')) - { - // Disable fields while saving. - $form->setFieldAttribute('postalcode', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('postalcode', 'required', 'false'); - } - } - // Modify the from the form based on Postalcode access controls. - if ($id != 0 && (!$user->authorise('member.access.postalcode', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.postalcode', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('postalcode'); - } - // Modify the form based on View Postalcode access controls. - if ($id != 0 && (!$user->authorise('member.view.postalcode', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.postalcode', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('postalcode', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('postalcode')) - { - // Disable fields while saving. - $form->setFieldAttribute('postalcode', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('postalcode', 'required', 'false'); - } - } - // Modify the form based on Edit City access controls. - if ($id != 0 && (!$user->authorise('member.edit.city', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.city', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('city', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('city', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('city')) - { - // Disable fields while saving. - $form->setFieldAttribute('city', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('city', 'required', 'false'); - } - } - // Modify the from the form based on City access controls. - if ($id != 0 && (!$user->authorise('member.access.city', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.city', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('city'); - } - // Modify the form based on View City access controls. - if ($id != 0 && (!$user->authorise('member.view.city', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.city', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('city', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('city')) - { - // Disable fields while saving. - $form->setFieldAttribute('city', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('city', 'required', 'false'); - } - } - // Modify the form based on Edit Region access controls. - if ($id != 0 && (!$user->authorise('member.edit.region', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.region', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('region', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('region', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('region')) - { - // Disable fields while saving. - $form->setFieldAttribute('region', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('region', 'required', 'false'); - } - } - // Modify the from the form based on Region access controls. - if ($id != 0 && (!$user->authorise('member.access.region', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.region', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('region'); - } - // Modify the form based on View Region access controls. - if ($id != 0 && (!$user->authorise('member.view.region', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.region', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('region', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('region')) - { - // Disable fields while saving. - $form->setFieldAttribute('region', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('region', 'required', 'false'); - } - } - // Modify the form based on Edit Street access controls. - if ($id != 0 && (!$user->authorise('member.edit.street', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.street', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('street', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('street', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('street')) - { - // Disable fields while saving. - $form->setFieldAttribute('street', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('street', 'required', 'false'); - } - } - // Modify the from the form based on Street access controls. - if ($id != 0 && (!$user->authorise('member.access.street', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.street', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('street'); - } - // Modify the form based on View Street access controls. - if ($id != 0 && (!$user->authorise('member.view.street', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.street', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('street', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('street')) - { - // Disable fields while saving. - $form->setFieldAttribute('street', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('street', 'required', 'false'); - } - } - // Modify the form based on Edit Postal access controls. - if ($id != 0 && (!$user->authorise('member.edit.postal', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.postal', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('postal', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('postal', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('postal')) - { - // Disable fields while saving. - $form->setFieldAttribute('postal', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('postal', 'required', 'false'); - } - } - // Modify the from the form based on Postal access controls. - if ($id != 0 && (!$user->authorise('member.access.postal', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.postal', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('postal'); - } - // Modify the form based on View Postal access controls. - if ($id != 0 && (!$user->authorise('member.view.postal', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.postal', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('postal', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('postal')) - { - // Disable fields while saving. - $form->setFieldAttribute('postal', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('postal', 'required', 'false'); - } - } - // Modify the form based on Edit Mobile Phone access controls. - if ($id != 0 && (!$user->authorise('member.edit.mobile_phone', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.mobile_phone', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('mobile_phone', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('mobile_phone', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('mobile_phone')) - { - // Disable fields while saving. - $form->setFieldAttribute('mobile_phone', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('mobile_phone', 'required', 'false'); - } - } - // Modify the from the form based on Mobile Phone access controls. - if ($id != 0 && (!$user->authorise('member.access.mobile_phone', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.mobile_phone', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('mobile_phone'); - } - // Modify the form based on View Mobile Phone access controls. - if ($id != 0 && (!$user->authorise('member.view.mobile_phone', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.mobile_phone', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('mobile_phone', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('mobile_phone')) - { - // Disable fields while saving. - $form->setFieldAttribute('mobile_phone', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('mobile_phone', 'required', 'false'); - } - } // Modify the form based on Edit Name access controls. if ($id != 0 && (!$user->authorise('member.edit.name', 'com_membersmanager.member.' . (int) $id)) || ($id == 0 && !$user->authorise('member.edit.name', 'com_membersmanager'))) @@ -686,13 +238,6 @@ class MembersmanagerModelMember extends JModelAdmin $form->setFieldAttribute('name', 'required', 'false'); } } - // Modify the from the form based on Name access controls. - if ($id != 0 && (!$user->authorise('member.access.name', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.name', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('name'); - } // Modify the form based on View Name access controls. if ($id != 0 && (!$user->authorise('member.view.name', 'com_membersmanager.member.' . (int) $id)) || ($id == 0 && !$user->authorise('member.view.name', 'com_membersmanager'))) @@ -708,45 +253,6 @@ class MembersmanagerModelMember extends JModelAdmin $form->setFieldAttribute('name', 'required', 'false'); } } - // Modify the form based on Edit Website access controls. - if ($id != 0 && (!$user->authorise('member.edit.website', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.edit.website', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('website', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('website', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('website')) - { - // Disable fields while saving. - $form->setFieldAttribute('website', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('website', 'required', 'false'); - } - } - // Modify the from the form based on Website access controls. - if ($id != 0 && (!$user->authorise('member.access.website', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.website', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('website'); - } - // Modify the form based on View Website access controls. - if ($id != 0 && (!$user->authorise('member.view.website', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.view.website', 'com_membersmanager'))) - { - // Make the field hidded. - $form->setFieldAttribute('website', 'type', 'hidden'); - // If there is no value continue. - if (!$form->getValue('website')) - { - // Disable fields while saving. - $form->setFieldAttribute('website', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('website', 'required', 'false'); - } - } // Modify the form based on Edit Email access controls. if ($id != 0 && (!$user->authorise('member.edit.email', 'com_membersmanager.member.' . (int) $id)) || ($id == 0 && !$user->authorise('member.edit.email', 'com_membersmanager'))) @@ -786,6 +292,141 @@ class MembersmanagerModelMember extends JModelAdmin $form->setFieldAttribute('email', 'required', 'false'); } } + // Modify the form based on Edit Account access controls. + if ($id != 0 && (!$user->authorise('member.edit.account', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.account', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('account', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('account', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('account')) + { + // Disable fields while saving. + $form->setFieldAttribute('account', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('account', 'required', 'false'); + } + } + // Modify the form based on View Account access controls. + if ($id != 0 && (!$user->authorise('member.view.account', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.account', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('account', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('account')) + { + // Disable fields while saving. + $form->setFieldAttribute('account', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('account', 'required', 'false'); + } + } + // Modify the form based on Edit User access controls. + if ($id != 0 && (!$user->authorise('member.edit.user', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.user', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('user', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('user', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('user')) + { + // Disable fields while saving. + $form->setFieldAttribute('user', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('user', 'required', 'false'); + } + } + // Modify the form based on View User access controls. + if ($id != 0 && (!$user->authorise('member.view.user', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.user', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('user', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('user')) + { + // Disable fields while saving. + $form->setFieldAttribute('user', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('user', 'required', 'false'); + } + } + // Modify the form based on Edit Token access controls. + if ($id != 0 && (!$user->authorise('member.edit.token', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.token', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('token', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('token', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('token')) + { + // Disable fields while saving. + $form->setFieldAttribute('token', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('token', 'required', 'false'); + } + } + // Modify the form based on View Token access controls. + if ($id != 0 && (!$user->authorise('member.view.token', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.token', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('token', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('token')) + { + // Disable fields while saving. + $form->setFieldAttribute('token', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('token', 'required', 'false'); + } + } + // Modify the form based on Edit Profile Image access controls. + if ($id != 0 && (!$user->authorise('member.edit.profile_image', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.profile_image', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('profile_image', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('profile_image', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('profile_image')) + { + // Disable fields while saving. + $form->setFieldAttribute('profile_image', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('profile_image', 'required', 'false'); + } + } + // Modify the from the form based on Profile Image access controls. + if ($id != 0 && (!$user->authorise('member.access.profile_image', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.access.profile_image', 'com_membersmanager'))) + { + // Remove the field + $form->removeField('profile_image'); + } + // Modify the form based on View Profile Image access controls. + if ($id != 0 && (!$user->authorise('member.view.profile_image', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.profile_image', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('profile_image', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('profile_image')) + { + // Disable fields while saving. + $form->setFieldAttribute('profile_image', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('profile_image', 'required', 'false'); + } + } // Modify the form based on Edit Main Member access controls. if ($id != 0 && (!$user->authorise('member.edit.main_member', 'com_membersmanager.member.' . (int) $id)) || ($id == 0 && !$user->authorise('member.edit.main_member', 'com_membersmanager'))) @@ -803,13 +444,6 @@ class MembersmanagerModelMember extends JModelAdmin $form->setFieldAttribute('main_member', 'required', 'false'); } } - // Modify the from the form based on Main Member access controls. - if ($id != 0 && (!$user->authorise('member.access.main_member', 'com_membersmanager.member.' . (int) $id)) - || ($id == 0 && !$user->authorise('member.access.main_member', 'com_membersmanager'))) - { - // Remove the field - $form->removeField('main_member'); - } // Modify the form based on View Main Member access controls. if ($id != 0 && (!$user->authorise('member.view.main_member', 'com_membersmanager.member.' . (int) $id)) || ($id == 0 && !$user->authorise('member.view.main_member', 'com_membersmanager'))) @@ -825,19 +459,254 @@ class MembersmanagerModelMember extends JModelAdmin $form->setFieldAttribute('main_member', 'required', 'false'); } } + // Modify the form based on Edit Password Check access controls. + if ($id != 0 && (!$user->authorise('member.edit.password_check', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.password_check', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('password_check', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('password_check', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('password_check')) + { + // Disable fields while saving. + $form->setFieldAttribute('password_check', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('password_check', 'required', 'false'); + } + } + // Modify the from the form based on Password Check access controls. + if ($id != 0 && (!$user->authorise('member.access.password_check', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.access.password_check', 'com_membersmanager'))) + { + // Remove the field + $form->removeField('password_check'); + } + // Modify the form based on View Password Check access controls. + if ($id != 0 && (!$user->authorise('member.view.password_check', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.password_check', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('password_check', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('password_check')) + { + // Disable fields while saving. + $form->setFieldAttribute('password_check', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('password_check', 'required', 'false'); + } + } + // Modify the form based on Edit Password access controls. + if ($id != 0 && (!$user->authorise('member.edit.password', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.password', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('password', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('password', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('password')) + { + // Disable fields while saving. + $form->setFieldAttribute('password', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('password', 'required', 'false'); + } + } + // Modify the from the form based on Password access controls. + if ($id != 0 && (!$user->authorise('member.access.password', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.access.password', 'com_membersmanager'))) + { + // Remove the field + $form->removeField('password'); + } + // Modify the form based on View Password access controls. + if ($id != 0 && (!$user->authorise('member.view.password', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.password', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('password', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('password')) + { + // Disable fields while saving. + $form->setFieldAttribute('password', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('password', 'required', 'false'); + } + } + // Modify the form based on Edit Useremail access controls. + if ($id != 0 && (!$user->authorise('member.edit.useremail', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.useremail', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('useremail', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('useremail', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('useremail')) + { + // Disable fields while saving. + $form->setFieldAttribute('useremail', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('useremail', 'required', 'false'); + } + } + // Modify the from the form based on Useremail access controls. + if ($id != 0 && (!$user->authorise('member.access.useremail', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.access.useremail', 'com_membersmanager'))) + { + // Remove the field + $form->removeField('useremail'); + } + // Modify the form based on View Useremail access controls. + if ($id != 0 && (!$user->authorise('member.view.useremail', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.useremail', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('useremail', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('useremail')) + { + // Disable fields while saving. + $form->setFieldAttribute('useremail', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('useremail', 'required', 'false'); + } + } + // Modify the form based on Edit Username access controls. + if ($id != 0 && (!$user->authorise('member.edit.username', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.username', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('username', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('username', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('username')) + { + // Disable fields while saving. + $form->setFieldAttribute('username', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('username', 'required', 'false'); + } + } + // Modify the from the form based on Username access controls. + if ($id != 0 && (!$user->authorise('member.access.username', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.access.username', 'com_membersmanager'))) + { + // Remove the field + $form->removeField('username'); + } + // Modify the form based on View Username access controls. + if ($id != 0 && (!$user->authorise('member.view.username', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.username', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('username', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('username')) + { + // Disable fields while saving. + $form->setFieldAttribute('username', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('username', 'required', 'false'); + } + } + // Modify the form based on Edit Surname access controls. + if ($id != 0 && (!$user->authorise('member.edit.surname', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.surname', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('surname', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('surname', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('surname')) + { + // Disable fields while saving. + $form->setFieldAttribute('surname', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('surname', 'required', 'false'); + } + } + // Modify the form based on View Surname access controls. + if ($id != 0 && (!$user->authorise('member.view.surname', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.surname', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('surname', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('surname')) + { + // Disable fields while saving. + $form->setFieldAttribute('surname', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('surname', 'required', 'false'); + } + } + // Modify the form based on Edit Type access controls. + if ($id != 0 && (!$user->authorise('member.edit.type', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.edit.type', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('type', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('type', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('type')) + { + // Disable fields while saving. + $form->setFieldAttribute('type', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('type', 'required', 'false'); + } + } + // Modify the form based on View Type access controls. + if ($id != 0 && (!$user->authorise('member.view.type', 'com_membersmanager.member.' . (int) $id)) + || ($id == 0 && !$user->authorise('member.view.type', 'com_membersmanager'))) + { + // Make the field hidded. + $form->setFieldAttribute('type', 'type', 'hidden'); + // If there is no value continue. + if (!$form->getValue('type')) + { + // Disable fields while saving. + $form->setFieldAttribute('type', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('type', 'required', 'false'); + } + } // Only load these values if no id is found if (0 == $id) { - // Set redirected field name - $redirectedField = $jinput->get('ref', null, 'STRING'); - // Set redirected field value - $redirectedValue = $jinput->get('refid', 0, 'INT'); + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); if (0 != $redirectedValue && $redirectedField) { // Now set the local-redirected field default value $form->setValue($redirectedField, null, $redirectedValue); } } + // if this is a site area hide the user field + if (JFactory::getApplication()->isSite() || $form->getValue('user')) + { + // Disable fields for being edited directly + $form->setFieldAttribute('user', 'readonly', 'true'); + // only make hidden if site area + if (JFactory::getApplication()->isSite()) + { + $form->setFieldAttribute('user', 'type', 'hidden'); + } + } return $form; } @@ -1032,7 +901,7 @@ class MembersmanagerModelMember extends JModelAdmin } } return parent::validate($form, $data, $group); - } + } /** * Method to get the unique fields of this table. @@ -1257,6 +1126,12 @@ class MembersmanagerModelMember extends JModelAdmin } } + // Only for strings + if (MembersmanagerHelper::checkString($this->table->name) && !is_numeric($this->table->name)) + { + $this->table->name = $this->generateUniqe('name',$this->table->name); + } + // insert all set values if (MembersmanagerHelper::checkArray($values)) { @@ -1316,7 +1191,7 @@ class MembersmanagerModelMember extends JModelAdmin $this->cleanCache(); return $newIds; - } + } /** * Batch move items to a new category @@ -1448,7 +1323,171 @@ class MembersmanagerModelMember extends JModelAdmin $metadata = new JRegistry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; - } + } + + // check if this is a linked user (MUST STILL DO PERMISSIONS) + if (isset($data['account']) && (1 == $data['account'] || 4 == $data['account'])) + { + // get the application object + $app = JFactory::getApplication(); + // check if member already exist + if (isset($data['id']) && $data['id'] > 0 && isset($data['user']) && $data['user'] > 0) + { + // do not allow user link to be changed (should have done this in the controller) + if (($alreadyUser = MembersmanagerHelper::getVar('member', $data['id'], 'id', 'user')) !== false && is_numeric($alreadyUser) && $alreadyUser > 0 && $alreadyUser != $data['user']) + { + $app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_IS_ALREADY_LINKED_TO_AN_USER_THIS_CAN_NOT_BE_CHANGED_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_IF_YOU_NEED_MORE_HELP'), 'Error'); + return false; + } + } + // set bucket to update/create user + $bucket = array(); + // set name + $bucket['name'] = $data['name']; + // set username + $bucket['username'] = $data['username']; + // set useremail + $bucket['email'] = $data['useremail']; + // start message bucket + $message = array(); + // check if user already linked + if (isset($data['user']) && $data['user'] > 0) + { + // set user ID + $bucket['id'] = $data['user']; + // get user exciting groups + $memberUser = JFactory::getUser($bucket['id']); + $excitingGroups = $memberUser->get('groups'); + $typeGroups = array(); + // set the groups + if (isset($data['type']) && $data['type'] > 0) + { + // get the target groups + $typeGroups = MembersmanagerHelper::getVar('type', $data['type'], 'id', 'groups_target'); + // convert to array + if (MembersmanagerHelper::checkJson($typeGroups)) + { + $typeGroups = (array) json_decode($typeGroups, true); + } + elseif (is_numeric($typeGroups)) + { + $typeGroups = array((int) $typeGroups); + } + } + // load the user groups (TODO) + $bucket['groups'] = MembersmanagerHelper::mergeArrays(array($excitingGroups, $typeGroups)); + // set password + if (empty($data['password']) || empty($data['password_check'])) + { + $bucket['password'] = JFactory::getUser($data['user'])->password; + $bucket['password2'] = $bucket['password']; + } + else + { + $bucket['password'] = $data['password']; + $bucket['password2'] = $data['password_check']; + } + // update exiting user + $done = MembersmanagerHelper::updateUser($bucket); + if (!is_numeric($done) || $done != $data['user']) + { + $app->enqueueMessage($done, 'Error'); + // we still check if user was created.... (TODO) + if ($didCreate = JUserHelper::getUserId($bucket['username'])) + { + $data['user'] = $didCreate; + } + } + } + else + { + // set password + if (isset($data['password']) && isset($data['password_check'])) + { + $bucket['password'] = $data['password']; + $bucket['password2'] = $data['password_check']; + } + // create new user + $done = MembersmanagerHelper::createUser($bucket); + if (is_numeric($done)) + { + // make sure to set the user value + $data['user'] = $done; + if (isset($data['type']) && $data['type'] > 0) + { + // get the target groups + $_groups = MembersmanagerHelper::getVar('type', $data['type'], 'id', 'groups_target'); + // convert to array + if (MembersmanagerHelper::checkJson($_groups)) + { + $groups = (array) json_decode($_groups, true); + } + elseif (is_numeric($_groups)) + { + $groups = array((int) $_groups); + } + } + // check if we have groups + if (isset($groups) && $groups) + { + // update the user groups + JUserHelper::setUserGroups((int) $done ,(array) $groups); + } + else + { + // notice that the group was not set for this user + $app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_NOT_ADDED_TO_ANY_GROUPS_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR'), 'Error'); + } + $app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_MEMBER_WAS_CREATED_SUCCESSFULLY_AND_THE_LOGIN_DETAILS_WAS_EMAILED_TO_THE_MEMBER'), 'Success'); + } + else + { + $app->enqueueMessage($done, 'Error'); + } + // we still check if user was created.... (TODO) + if (!is_numeric($done) && ($didCreate = JUserHelper::getUserId($bucket['username']))) + { + $data['user'] = $didCreate; + } + } + } + // always clear out password!! + unset($data['password']); + unset($data['password_check']); + // clear out user if error found + if (empty($data['user']) || $data['user'] == 0 || empty($data['account']) || (1 != $data['account'] && 4 != $data['account'])) + { + // if not a linked account, then no user can be set + $data['user'] = ''; + $data['username'] = ''; + $data['useremail'] = ''; + } + // check if token is set + if (empty($data['token'])) + { + // get a token + $token = call_user_func(function($data) { + // get the name of this member + if ((1 == $data['account'] || 4 == $data['account']) && isset($data['user']) && $data['user'] > 0) + { + return JFactory::getUser($data['user'])->name; + } + elseif (isset($data['name']) && MembersmanagerHelper::checkString($data['name'])) + { + return $data['name']; + } + return MembersmanagerHelper::randomkey(8); + }, $data); + // split at upper case + $tokenArray = (array) preg_split('/(?=[A-Z])/', trim($token), -1, PREG_SPLIT_NO_EMPTY); + // make string safe + $data['token'] = MembersmanagerHelper::safeString(trim(implode(' ', $tokenArray), '-'), 'L', '-', false, false); + // get unique token + while (!MembersmanagerHelper::checkUnique($data['id'], 'token', $data['token'], 'member')) + { + $data['token'] = JString::increment($data['token'], 'dash'); + } + } // Get the medium encryption key. $mediumkey = MembersmanagerHelper::getCryptKey('medium'); diff --git a/admin/models/members.php b/admin/models/members.php index 850d73b..da104a1 100644 --- a/admin/models/members.php +++ b/admin/models/members.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import the Joomla modellist library -jimport('joomla.application.component.modellist'); - /** * Members Model */ @@ -30,13 +27,9 @@ class MembersmanagerModelMembers extends JModelList 'a.ordering','ordering', 'a.created_by','created_by', 'a.modified_by','modified_by', - 'a.user','user', - 'a.type','type', 'a.account','account', - 'a.country','country', - 'a.city','city', - 'a.region','region', - 'a.main_member','main_member' + 'a.main_member','main_member', + 'a.type','type' ); } @@ -57,26 +50,14 @@ class MembersmanagerModelMembers extends JModelList { $this->context .= '.' . $layout; } - $user = $this->getUserStateFromRequest($this->context . '.filter.user', 'filter_user'); - $this->setState('filter.user', $user); - - $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); - $this->setState('filter.type', $type); - $account = $this->getUserStateFromRequest($this->context . '.filter.account', 'filter_account'); $this->setState('filter.account', $account); - $country = $this->getUserStateFromRequest($this->context . '.filter.country', 'filter_country'); - $this->setState('filter.country', $country); - - $city = $this->getUserStateFromRequest($this->context . '.filter.city', 'filter_city'); - $this->setState('filter.city', $city); - - $region = $this->getUserStateFromRequest($this->context . '.filter.region', 'filter_region'); - $this->setState('filter.region', $region); - $main_member = $this->getUserStateFromRequest($this->context . '.filter.main_member', 'filter_main_member'); - $this->setState('filter.main_member', $main_member); + $this->setState('filter.main_member', $main_member); + + $type = $this->getUserStateFromRequest($this->context . '.filter.type', 'filter_type'); + $this->setState('filter.type', $type); $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); $this->setState('filter.sorting', $sorting); @@ -106,7 +87,7 @@ class MembersmanagerModelMembers extends JModelList * @return mixed An array of data items on success, false on failure. */ public function getItems() - { + { // check in items $this->checkInNow(); @@ -125,15 +106,17 @@ class MembersmanagerModelMembers extends JModelList continue; } - // Mobile Phone (not-required) - if ($item->mobile_phone) + // if linked to user get active name + if ($item->user > 0 && isset($item->user_name)) { - $item->mobile_phone = JText::_('COM_MEMBERSMANAGER_MOBILE') . ': ' . $item->mobile_phone; + $item->name = $item->user_name; } - // Landline Phone - if ($item->landline_phone) + // always add surname + $item->name = $item->name . ' ' . $item->surname; + // if linked to user get active name + if ($item->user > 0) { - $item->landline_phone = JText::_('COM_MEMBERSMANAGER_TEL') . ': ' . $item->landline_phone; + $item->email = JFactory::getUser($item->user)->email; } } } @@ -146,7 +129,7 @@ class MembersmanagerModelMembers extends JModelList // keep account type value $item->account_id = $item->account; } - } + } // set selection value to a translatable value if (MembersmanagerHelper::checkArray($items)) @@ -157,7 +140,7 @@ class MembersmanagerModelMembers extends JModelList $item->account = $this->selectionTranslation($item->account, 'account'); } } - + // return items return $items; @@ -211,21 +194,13 @@ class MembersmanagerModelMembers extends JModelList $query->select($db->quoteName('g.name','user_name')); $query->join('LEFT', $db->quoteName('#__users', 'g') . ' ON (' . $db->quoteName('a.user') . ' = ' . $db->quoteName('g.id') . ')'); - // From the membersmanager_type table. - $query->select($db->quoteName('h.name','type_name')); - $query->join('LEFT', $db->quoteName('#__membersmanager_type', 'h') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('h.id') . ')'); - - // From the membersmanager_country table. - $query->select($db->quoteName('i.name','country_name')); - $query->join('LEFT', $db->quoteName('#__membersmanager_country', 'i') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('i.id') . ')'); - - // From the membersmanager_region table. - $query->select($db->quoteName('j.name','region_name')); - $query->join('LEFT', $db->quoteName('#__membersmanager_region', 'j') . ' ON (' . $db->quoteName('a.region') . ' = ' . $db->quoteName('j.id') . ')'); - // From the membersmanager_member table. - $query->select($db->quoteName('k.user','main_member_user')); - $query->join('LEFT', $db->quoteName('#__membersmanager_member', 'k') . ' ON (' . $db->quoteName('a.main_member') . ' = ' . $db->quoteName('k.id') . ')'); + $query->select($db->quoteName('h.user','main_member_user')); + $query->join('LEFT', $db->quoteName('#__membersmanager_member', 'h') . ' ON (' . $db->quoteName('a.main_member') . ' = ' . $db->quoteName('h.id') . ')'); + + // From the membersmanager_type table. + $query->select($db->quoteName('i.name','type_name')); + $query->join('LEFT', $db->quoteName('#__membersmanager_type', 'i') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('i.id') . ')'); // Filter by published state $published = $this->getState('filter.published'); @@ -263,40 +238,25 @@ class MembersmanagerModelMembers extends JModelList else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.user LIKE '.$search.' OR g.name LIKE '.$search.' OR a.landline_phone LIKE '.$search.' OR a.type LIKE '.$search.' OR h.name LIKE '.$search.' OR a.account LIKE '.$search.' OR a.token LIKE '.$search.' OR a.country LIKE '.$search.' OR a.postalcode LIKE '.$search.' OR a.city LIKE '.$search.' OR a.region LIKE '.$search.' OR a.street LIKE '.$search.' OR a.postal LIKE '.$search.' OR a.mobile_phone LIKE '.$search.' OR a.name LIKE '.$search.' OR a.website LIKE '.$search.' OR a.email LIKE '.$search.' OR a.main_member LIKE '.$search.')'); + $query->where('(a.name LIKE '.$search.' OR a.email LIKE '.$search.' OR a.account LIKE '.$search.' OR a.user LIKE '.$search.' OR a.token LIKE '.$search.' OR a.main_member LIKE '.$search.' OR a.useremail LIKE '.$search.' OR a.username LIKE '.$search.' OR a.surname LIKE '.$search.' OR a.type LIKE '.$search.')'); } } - // Filter by type. - if ($type = $this->getState('filter.type')) - { - $query->where('a.type = ' . $db->quote($db->escape($type))); - } // Filter by Account. if ($account = $this->getState('filter.account')) { $query->where('a.account = ' . $db->quote($db->escape($account))); } - // Filter by country. - if ($country = $this->getState('filter.country')) - { - $query->where('a.country = ' . $db->quote($db->escape($country))); - } - // Filter by City. - if ($city = $this->getState('filter.city')) - { - $query->where('a.city = ' . $db->quote($db->escape($city))); - } - // Filter by region. - if ($region = $this->getState('filter.region')) - { - $query->where('a.region = ' . $db->quote($db->escape($region))); - } // Filter by main_member. if ($main_member = $this->getState('filter.main_member')) { $query->where('a.main_member = ' . $db->quote($db->escape($main_member))); } + // Filter by type. + if ($type = $this->getState('filter.type')) + { + $query->where('a.type = ' . $db->quote($db->escape($type))); + } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'a.id'); @@ -367,15 +327,17 @@ class MembersmanagerModelMembers extends JModelList continue; } - // Mobile Phone (not-required) - if ($item->mobile_phone) + // if linked to user get active name + if ($item->user > 0 && isset($item->user_name)) { - $item->mobile_phone = JText::_('COM_MEMBERSMANAGER_MOBILE') . ': ' . $item->mobile_phone; + $item->name = $item->user_name; } - // Landline Phone - if ($item->landline_phone) + // always add surname + $item->name = $item->name . ' ' . $item->surname; + // if linked to user get active name + if ($item->user > 0) { - $item->landline_phone = JText::_('COM_MEMBERSMANAGER_TEL') . ': ' . $item->landline_phone; + $item->email = JFactory::getUser($item->user)->email; } if ($mediumkey && !is_numeric($item->profile_image) && $item->profile_image === base64_encode(base64_decode($item->profile_image, true))) { @@ -435,7 +397,7 @@ class MembersmanagerModelMembers extends JModelList return $headers; } return false; - } + } /** * Method to get a store id based on model configuration state. @@ -452,13 +414,9 @@ class MembersmanagerModelMembers extends JModelList $id .= ':' . $this->getState('filter.ordering'); $id .= ':' . $this->getState('filter.created_by'); $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.user'); - $id .= ':' . $this->getState('filter.type'); $id .= ':' . $this->getState('filter.account'); - $id .= ':' . $this->getState('filter.country'); - $id .= ':' . $this->getState('filter.city'); - $id .= ':' . $this->getState('filter.region'); - $id .= ':' . $this->getState('filter.main_member'); + $id .= ':' . $this->getState('filter.main_member'); + $id .= ':' . $this->getState('filter.type'); return parent::getStoreId($id); } diff --git a/admin/models/region.php b/admin/models/region.php deleted file mode 100644 index 5ace49b..0000000 --- a/admin/models/region.php +++ /dev/null @@ -1,960 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; - -// import Joomla modelform library -jimport('joomla.application.component.modeladmin'); - -/** - * Membersmanager Region Model - */ -class MembersmanagerModelRegion extends JModelAdmin -{ - /** - * @var string The prefix to use with controller messages. - * @since 1.6 - */ - protected $text_prefix = 'COM_MEMBERSMANAGER'; - - /** - * The type alias for this content type. - * - * @var string - * @since 3.2 - */ - public $typeAlias = 'com_membersmanager.region'; - - /** - * Returns a Table object, always creating it - * - * @param type $type The table type to instantiate - * @param string $prefix A prefix for the table class name. Optional. - * @param array $config Configuration array for model. Optional. - * - * @return JTable A database object - * - * @since 1.6 - */ - public function getTable($type = 'region', $prefix = 'MembersmanagerTable', $config = array()) - { - return JTable::getInstance($type, $prefix, $config); - } - - /** - * Method to get a single record. - * - * @param integer $pk The id of the primary key. - * - * @return mixed Object on success, false on failure. - * - * @since 1.6 - */ - public function getItem($pk = null) - { - if ($item = parent::getItem($pk)) - { - if (!empty($item->params) && !is_array($item->params)) - { - // Convert the params field to an array. - $registry = new Registry; - $registry->loadString($item->params); - $item->params = $registry->toArray(); - } - - if (!empty($item->metadata)) - { - // Convert the metadata field to an array. - $registry = new Registry; - $registry->loadString($item->metadata); - $item->metadata = $registry->toArray(); - } - - if (!empty($item->id)) - { - $item->tags = new JHelperTags; - $item->tags->getTagIds($item->id, 'com_membersmanager.region'); - } - } - - return $item; - } - - /** - * Method to get the record form. - * - * @param array $data Data for the form. - * @param boolean $loadData True if the form is to load its own data (default case), false if not. - * - * @return mixed A JForm object on success, false on failure - * - * @since 1.6 - */ - public function getForm($data = array(), $loadData = true) - { - // Get the form. - $form = $this->loadForm('com_membersmanager.region', 'region', array('control' => 'jform', 'load_data' => $loadData)); - - if (empty($form)) - { - return false; - } - - $jinput = JFactory::getApplication()->input; - - // The front end calls this model and uses a_id to avoid id clashes so we need to check for that first. - if ($jinput->get('a_id')) - { - $id = $jinput->get('a_id', 0, 'INT'); - } - // The back end uses id so we use that the rest of the time and set it to 0 by default. - else - { - $id = $jinput->get('id', 0, 'INT'); - } - - $user = JFactory::getUser(); - - // Check for existing item. - // Modify the form based on Edit State access controls. - if ($id != 0 && (!$user->authorise('region.edit.state', 'com_membersmanager.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('region.edit.state', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('ordering', 'disabled', 'true'); - $form->setFieldAttribute('published', 'disabled', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('ordering', 'filter', 'unset'); - $form->setFieldAttribute('published', 'filter', 'unset'); - } - // If this is a new item insure the greated by is set. - if (0 == $id) - { - // Set the created_by to this user - $form->setValue('created_by', null, $user->id); - } - // Modify the form based on Edit Creaded By access controls. - if ($id != 0 && (!$user->authorise('region.edit.created_by', 'com_membersmanager.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('region.edit.created_by', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('created_by', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('created_by', 'readonly', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('created_by', 'filter', 'unset'); - } - // Modify the form based on Edit Creaded Date access controls. - if ($id != 0 && (!$user->authorise('region.edit.created', 'com_membersmanager.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('region.edit.created', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('created', 'disabled', 'true'); - // Disable fields while saving. - $form->setFieldAttribute('created', 'filter', 'unset'); - } - // Modify the form based on Edit Name access controls. - if ($id != 0 && (!$user->authorise('region.edit.name', 'com_membersmanager.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('region.edit.name', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('name', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('name', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('name')) - { - // Disable fields while saving. - $form->setFieldAttribute('name', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('name', 'required', 'false'); - } - } - // Modify the form based on Edit Country access controls. - if ($id != 0 && (!$user->authorise('region.edit.country', 'com_membersmanager.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('region.edit.country', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('country', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('country', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('country')) - { - // Disable fields while saving. - $form->setFieldAttribute('country', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('country', 'required', 'false'); - } - } - // Modify the form based on Edit Alias access controls. - if ($id != 0 && (!$user->authorise('region.edit.alias', 'com_membersmanager.region.' . (int) $id)) - || ($id == 0 && !$user->authorise('region.edit.alias', 'com_membersmanager'))) - { - // Disable fields for display. - $form->setFieldAttribute('alias', 'disabled', 'true'); - // Disable fields for display. - $form->setFieldAttribute('alias', 'readonly', 'true'); - // If there is no value continue. - if (!$form->getValue('alias')) - { - // Disable fields while saving. - $form->setFieldAttribute('alias', 'filter', 'unset'); - // Disable fields while saving. - $form->setFieldAttribute('alias', 'required', 'false'); - } - } - // Only load these values if no id is found - if (0 == $id) - { - // Set redirected field name - $redirectedField = $jinput->get('ref', null, 'STRING'); - // Set redirected field value - $redirectedValue = $jinput->get('refid', 0, 'INT'); - if (0 != $redirectedValue && $redirectedField) - { - // Now set the local-redirected field default value - $form->setValue($redirectedField, null, $redirectedValue); - } - } - return $form; - } - - /** - * Method to get the script that have to be included on the form - * - * @return string script files - */ - public function getScript() - { - return 'administrator/components/com_membersmanager/models/forms/region.js'; - } - - /** - * Method to test whether a record can be deleted. - * - * @param object $record A record object. - * - * @return boolean True if allowed to delete the record. Defaults to the permission set in the component. - * - * @since 1.6 - */ - protected function canDelete($record) - { - if (!empty($record->id)) - { - if ($record->published != -2) - { - return; - } - - $user = JFactory::getUser(); - // The record has been set. Check the record permissions. - return $user->authorise('region.delete', 'com_membersmanager.region.' . (int) $record->id); - } - return false; - } - - /** - * Method to test whether a record can have its state edited. - * - * @param object $record A record object. - * - * @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component. - * - * @since 1.6 - */ - protected function canEditState($record) - { - $user = JFactory::getUser(); - $recordId = (!empty($record->id)) ? $record->id : 0; - - if ($recordId) - { - // The record has been set. Check the record permissions. - $permission = $user->authorise('region.edit.state', 'com_membersmanager.region.' . (int) $recordId); - if (!$permission && !is_null($permission)) - { - return false; - } - } - // In the absense of better information, revert to the component permissions. - return $user->authorise('region.edit.state', 'com_membersmanager'); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * @since 2.5 - */ - protected function allowEdit($data = array(), $key = 'id') - { - // Check specific edit permission then general edit permission. - $user = JFactory::getUser(); - - return $user->authorise('region.edit', 'com_membersmanager.region.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('region.edit', 'com_membersmanager'); - } - - /** - * Prepare and sanitise the table data prior to saving. - * - * @param JTable $table A JTable object. - * - * @return void - * - * @since 1.6 - */ - protected function prepareTable($table) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if (isset($table->name)) - { - $table->name = htmlspecialchars_decode($table->name, ENT_QUOTES); - } - - if (isset($table->alias) && empty($table->alias)) - { - $table->generateAlias(); - } - - if (empty($table->id)) - { - $table->created = $date->toSql(); - // set the user - if ($table->created_by == 0 || empty($table->created_by)) - { - $table->created_by = $user->id; - } - // Set ordering to the last item if not set - if (empty($table->ordering)) - { - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select('MAX(ordering)') - ->from($db->quoteName('#__membersmanager_region')); - $db->setQuery($query); - $max = $db->loadResult(); - - $table->ordering = $max + 1; - } - } - else - { - $table->modified = $date->toSql(); - $table->modified_by = $user->id; - } - - if (!empty($table->id)) - { - // Increment the items version number. - $table->version++; - } - } - - /** - * Method to get the data that should be injected in the form. - * - * @return mixed The data for the form. - * - * @since 1.6 - */ - protected function loadFormData() - { - // Check the session for previously entered form data. - $data = JFactory::getApplication()->getUserState('com_membersmanager.edit.region.data', array()); - - if (empty($data)) - { - $data = $this->getItem(); - } - - return $data; - } - - /** - * Method to get the unique fields of this table. - * - * @return mixed An array of field names, boolean false if none is set. - * - * @since 3.0 - */ - protected function getUniqeFields() - { - return false; - } - - /** - * Method to delete one or more records. - * - * @param array &$pks An array of record primary keys. - * - * @return boolean True if successful, false if an error occurs. - * - * @since 12.2 - */ - public function delete(&$pks) - { - if (!parent::delete($pks)) - { - return false; - } - - return true; - } - - /** - * Method to change the published state of one or more records. - * - * @param array &$pks A list of the primary keys to change. - * @param integer $value The value of the published state. - * - * @return boolean True on success. - * - * @since 12.2 - */ - public function publish(&$pks, $value = 1) - { - if (!parent::publish($pks, $value)) - { - return false; - } - - return true; - } - - /** - * Method to perform batch operations on an item or a set of items. - * - * @param array $commands An array of commands to perform. - * @param array $pks An array of item ids. - * @param array $contexts An array of item contexts. - * - * @return boolean Returns true on success, false on failure. - * - * @since 12.2 - */ - public function batch($commands, $pks, $contexts) - { - // Sanitize ids. - $pks = array_unique($pks); - JArrayHelper::toInteger($pks); - - // Remove any values of zero. - if (array_search(0, $pks, true)) - { - unset($pks[array_search(0, $pks, true)]); - } - - if (empty($pks)) - { - $this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED')); - return false; - } - - $done = false; - - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->contentType = new JUcmType; - $this->type = $this->contentType->getTypeByTable($this->tableClassName); - $this->canDo = MembersmanagerHelper::getActions('region'); - $this->batchSet = true; - - if (!$this->canDo->get('core.batch')) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - return false; - } - - if ($this->type == false) - { - $type = new JUcmType; - $this->type = $type->getTypeByAlias($this->typeAlias); - } - - $this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags'); - - if (!empty($commands['move_copy'])) - { - $cmd = JArrayHelper::getValue($commands, 'move_copy', 'c'); - - if ($cmd == 'c') - { - $result = $this->batchCopy($commands, $pks, $contexts); - - if (is_array($result)) - { - foreach ($result as $old => $new) - { - $contexts[$new] = $contexts[$old]; - } - $pks = array_values($result); - } - else - { - return false; - } - } - elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts)) - { - return false; - } - - $done = true; - } - - if (!$done) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION')); - - return false; - } - - // Clear the cache - $this->cleanCache(); - - return true; - } - - /** - * Batch copy items to a new category or current. - * - * @param integer $values The new values. - * @param array $pks An array of row IDs. - * @param array $contexts An array of item contexts. - * - * @return mixed An array of new IDs on success, boolean false on failure. - * - * @since 12.2 - */ - protected function batchCopy($values, $pks, $contexts) - { - if (empty($this->batchSet)) - { - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->canDo = MembersmanagerHelper::getActions('region'); - } - - if (!$this->canDo->get('region.create') && !$this->canDo->get('region.batch')) - { - return false; - } - - // get list of uniqe fields - $uniqeFields = $this->getUniqeFields(); - // remove move_copy from array - unset($values['move_copy']); - - // make sure published is set - if (!isset($values['published'])) - { - $values['published'] = 0; - } - elseif (isset($values['published']) && !$this->canDo->get('region.edit.state')) - { - $values['published'] = 0; - } - - $newIds = array(); - // Parent exists so let's proceed - while (!empty($pks)) - { - // Pop the first ID off the stack - $pk = array_shift($pks); - - $this->table->reset(); - - // only allow copy if user may edit this item. - if (!$this->user->authorise('region.edit', $contexts[$pk])) - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - - // Check that the row actually exists - if (!$this->table->load($pk)) - { - if ($error = $this->table->getError()) - { - // Fatal error - $this->setError($error); - return false; - } - else - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - } - list($this->table->name, $this->table->alias) = $this->_generateNewTitle($this->table->alias, $this->table->name); - - // insert all set values - if (MembersmanagerHelper::checkArray($values)) - { - foreach ($values as $key => $value) - { - if (strlen($value) > 0 && isset($this->table->$key)) - { - $this->table->$key = $value; - } - } - } - - // update all uniqe fields - if (MembersmanagerHelper::checkArray($uniqeFields)) - { - foreach ($uniqeFields as $uniqeField) - { - $this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField); - } - } - - // Reset the ID because we are making a copy - $this->table->id = 0; - - // TODO: Deal with ordering? - // $this->table->ordering = 1; - - // Check the row. - if (!$this->table->check()) - { - $this->setError($this->table->getError()); - - return false; - } - - if (!empty($this->type)) - { - $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); - } - - // Store the row. - if (!$this->table->store()) - { - $this->setError($this->table->getError()); - - return false; - } - - // Get the new item ID - $newId = $this->table->get('id'); - - // Add the new ID to the array - $newIds[$pk] = $newId; - } - - // Clean the cache - $this->cleanCache(); - - return $newIds; - } - - /** - * Batch move items to a new category - * - * @param integer $value The new category ID. - * @param array $pks An array of row IDs. - * @param array $contexts An array of item contexts. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 12.2 - */ - protected function batchMove($values, $pks, $contexts) - { - if (empty($this->batchSet)) - { - // Set some needed variables. - $this->user = JFactory::getUser(); - $this->table = $this->getTable(); - $this->tableClassName = get_class($this->table); - $this->canDo = MembersmanagerHelper::getActions('region'); - } - - if (!$this->canDo->get('region.edit') && !$this->canDo->get('region.batch')) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); - return false; - } - - // make sure published only updates if user has the permission. - if (isset($values['published']) && !$this->canDo->get('region.edit.state')) - { - unset($values['published']); - } - // remove move_copy from array - unset($values['move_copy']); - - // Parent exists so we proceed - foreach ($pks as $pk) - { - if (!$this->user->authorise('region.edit', $contexts[$pk])) - { - $this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT')); - return false; - } - - // Check that the row actually exists - if (!$this->table->load($pk)) - { - if ($error = $this->table->getError()) - { - // Fatal error - $this->setError($error); - return false; - } - else - { - // Not fatal error - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk)); - continue; - } - } - - // insert all set values. - if (MembersmanagerHelper::checkArray($values)) - { - foreach ($values as $key => $value) - { - // Do special action for access. - if ('access' === $key && strlen($value) > 0) - { - $this->table->$key = $value; - } - elseif (strlen($value) > 0 && isset($this->table->$key)) - { - $this->table->$key = $value; - } - } - } - - - // Check the row. - if (!$this->table->check()) - { - $this->setError($this->table->getError()); - - return false; - } - - if (!empty($this->type)) - { - $this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table); - } - - // Store the row. - if (!$this->table->store()) - { - $this->setError($this->table->getError()); - - return false; - } - } - - // Clean the cache - $this->cleanCache(); - - return true; - } - - /** - * Method to save the form data. - * - * @param array $data The form data. - * - * @return boolean True on success. - * - * @since 1.6 - */ - public function save($data) - { - $input = JFactory::getApplication()->input; - $filter = JFilterInput::getInstance(); - - // set the metadata to the Item Data - if (isset($data['metadata']) && isset($data['metadata']['author'])) - { - $data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM'); - - $metadata = new JRegistry; - $metadata->loadArray($data['metadata']); - $data['metadata'] = (string) $metadata; - } - - // Set the Params Items to data - if (isset($data['params']) && is_array($data['params'])) - { - $params = new JRegistry; - $params->loadArray($data['params']); - $data['params'] = (string) $params; - } - - // Alter the name for save as copy - if ($input->get('task') === 'save2copy') - { - $origTable = clone $this->getTable(); - $origTable->load($input->getInt('id')); - - if ($data['name'] == $origTable->name) - { - list($name, $alias) = $this->_generateNewTitle($data['alias'], $data['name']); - $data['name'] = $name; - $data['alias'] = $alias; - } - else - { - if ($data['alias'] == $origTable->alias) - { - $data['alias'] = ''; - } - } - - $data['published'] = 0; - } - - // Automatic handling of alias for empty fields - if (in_array($input->get('task'), array('apply', 'save', 'save2new')) && (int) $input->get('id') == 0) - { - if ($data['alias'] == null || empty($data['alias'])) - { - if (JFactory::getConfig()->get('unicodeslugs') == 1) - { - $data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['name']); - } - else - { - $data['alias'] = JFilterOutput::stringURLSafe($data['name']); - } - - $table = JTable::getInstance('region', 'membersmanagerTable'); - - if ($table->load(array('alias' => $data['alias'])) && ($table->id != $data['id'] || $data['id'] == 0)) - { - $msg = JText::_('COM_MEMBERSMANAGER_REGION_SAVE_WARNING'); - } - - $data['alias'] = $this->_generateNewTitle($data['alias']); - - if (isset($msg)) - { - JFactory::getApplication()->enqueueMessage($msg, 'warning'); - } - } - } - - // Alter the uniqe field for save as copy - if ($input->get('task') === 'save2copy') - { - // Automatic handling of other uniqe fields - $uniqeFields = $this->getUniqeFields(); - if (MembersmanagerHelper::checkArray($uniqeFields)) - { - foreach ($uniqeFields as $uniqeField) - { - $data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]); - } - } - } - - if (parent::save($data)) - { - return true; - } - return false; - } - - /** - * Method to generate a uniqe value. - * - * @param string $field name. - * @param string $value data. - * - * @return string New value. - * - * @since 3.0 - */ - protected function generateUniqe($field,$value) - { - - // set field value uniqe - $table = $this->getTable(); - - while ($table->load(array($field => $value))) - { - $value = JString::increment($value); - } - - return $value; - } - - /** - * Method to change the title/s & alias. - * - * @param string $alias The alias. - * @param string/array $title The title. - * - * @return array/string Contains the modified title/s and/or alias. - * - */ - protected function _generateNewTitle($alias, $title = null) - { - - // Alter the title/s & alias - $table = $this->getTable(); - - while ($table->load(array('alias' => $alias))) - { - // Check if this is an array of titles - if (MembersmanagerHelper::checkArray($title)) - { - foreach($title as $nr => &$_title) - { - $_title = JString::increment($_title); - } - } - // Make sure we have a title - elseif ($title) - { - $title = JString::increment($title); - } - $alias = JString::increment($alias, 'dash'); - } - // Check if this is an array of titles - if (MembersmanagerHelper::checkArray($title)) - { - $title[] = $alias; - return $title; - } - // Make sure we have a title - elseif ($title) - { - return array($title, $alias); - } - // We only had an alias - return $alias; - } -} diff --git a/admin/models/regions.php b/admin/models/regions.php deleted file mode 100644 index 95f53f7..0000000 --- a/admin/models/regions.php +++ /dev/null @@ -1,366 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import the Joomla modellist library -jimport('joomla.application.component.modellist'); - -/** - * Regions Model - */ -class MembersmanagerModelRegions extends JModelList -{ - public function __construct($config = array()) - { - if (empty($config['filter_fields'])) - { - $config['filter_fields'] = array( - 'a.id','id', - 'a.published','published', - 'a.ordering','ordering', - 'a.created_by','created_by', - 'a.modified_by','modified_by', - 'a.name','name', - 'a.country','country' - ); - } - - parent::__construct($config); - } - - /** - * Method to auto-populate the model state. - * - * @return void - */ - protected function populateState($ordering = null, $direction = null) - { - $app = JFactory::getApplication(); - - // Adjust the context to support modal layouts. - if ($layout = $app->input->get('layout')) - { - $this->context .= '.' . $layout; - } - $name = $this->getUserStateFromRequest($this->context . '.filter.name', 'filter_name'); - $this->setState('filter.name', $name); - - $country = $this->getUserStateFromRequest($this->context . '.filter.country', 'filter_country'); - $this->setState('filter.country', $country); - - $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); - $this->setState('filter.sorting', $sorting); - - $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); - $this->setState('filter.access', $access); - - $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); - $this->setState('filter.search', $search); - - $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); - $this->setState('filter.published', $published); - - $created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', ''); - $this->setState('filter.created_by', $created_by); - - $created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created'); - $this->setState('filter.created', $created); - - // List state information. - parent::populateState($ordering, $direction); - } - - /** - * Method to get an array of data items. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getItems() - { - // check in items - $this->checkInNow(); - - // load parent items - $items = parent::getItems(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('region.access', 'com_membersmanager.region.' . (int) $item->id) && JFactory::getUser()->authorise('region.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - } - } - - // return items - return $items; - } - - /** - * Method to build an SQL query to load the list data. - * - * @return string An SQL query - */ - protected function getListQuery() - { - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_item table - $query->from($db->quoteName('#__membersmanager_region', 'a')); - - // From the membersmanager_country table. - $query->select($db->quoteName('g.name','country_name')); - $query->join('LEFT', $db->quoteName('#__membersmanager_country', 'g') . ' ON (' . $db->quoteName('a.country') . ' = ' . $db->quoteName('g.id') . ')'); - - // Filter by published state - $published = $this->getState('filter.published'); - if (is_numeric($published)) - { - $query->where('a.published = ' . (int) $published); - } - elseif ($published === '') - { - $query->where('(a.published = 0 OR a.published = 1)'); - } - - // Join over the asset groups. - $query->select('ag.title AS access_level'); - $query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); - // Filter by access level. - if ($access = $this->getState('filter.access')) - { - $query->where('a.access = ' . (int) $access); - } - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - // Filter by search. - $search = $this->getState('filter.search'); - if (!empty($search)) - { - if (stripos($search, 'id:') === 0) - { - $query->where('a.id = ' . (int) substr($search, 3)); - } - else - { - $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.' OR a.country LIKE '.$search.' OR g.name LIKE '.$search.')'); - } - } - - // Filter by country. - if ($country = $this->getState('filter.country')) - { - $query->where('a.country = ' . $db->quote($db->escape($country))); - } - - // Add the list ordering clause. - $orderCol = $this->state->get('list.ordering', 'a.id'); - $orderDirn = $this->state->get('list.direction', 'asc'); - if ($orderCol != '') - { - $query->order($db->escape($orderCol . ' ' . $orderDirn)); - } - - return $query; - } - - /** - * Method to get list export data. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExportData($pks) - { - // setup the query - if (MembersmanagerHelper::checkArray($pks)) - { - // Set a value to know this is exporting method. - $_export = true; - // Get the user object. - $user = JFactory::getUser(); - // Create a new query object. - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - - // Select some fields - $query->select('a.*'); - - // From the membersmanager_region table - $query->from($db->quoteName('#__membersmanager_region', 'a')); - $query->where('a.id IN (' . implode(',',$pks) . ')'); - // Implement View Level Access - if (!$user->authorise('core.options', 'com_membersmanager')) - { - $groups = implode(',', $user->getAuthorisedViewLevels()); - $query->where('a.access IN (' . $groups . ')'); - } - - // Order the results by ordering - $query->order('a.ordering ASC'); - - // Load the items - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - $items = $db->loadObjectList(); - - // set values to display correctly. - if (MembersmanagerHelper::checkArray($items)) - { - foreach ($items as $nr => &$item) - { - $access = (JFactory::getUser()->authorise('region.access', 'com_membersmanager.region.' . (int) $item->id) && JFactory::getUser()->authorise('region.access', 'com_membersmanager')); - if (!$access) - { - unset($items[$nr]); - continue; - } - - // unset the values we don't want exported. - unset($item->asset_id); - unset($item->checked_out); - unset($item->checked_out_time); - } - } - // Add headers to items array. - $headers = $this->getExImPortHeaders(); - if (MembersmanagerHelper::checkObject($headers)) - { - array_unshift($items,$headers); - } - return $items; - } - } - return false; - } - - /** - * Method to get header. - * - * @return mixed An array of data items on success, false on failure. - */ - public function getExImPortHeaders() - { - // Get a db connection. - $db = JFactory::getDbo(); - // get the columns - $columns = $db->getTableColumns("#__membersmanager_region"); - if (MembersmanagerHelper::checkArray($columns)) - { - // remove the headers you don't import/export. - unset($columns['asset_id']); - unset($columns['checked_out']); - unset($columns['checked_out_time']); - $headers = new stdClass(); - foreach ($columns as $column => $type) - { - $headers->{$column} = $column; - } - return $headers; - } - return false; - } - - /** - * Method to get a store id based on model configuration state. - * - * @return string A store id. - * - */ - protected function getStoreId($id = '') - { - // Compile the store id. - $id .= ':' . $this->getState('filter.id'); - $id .= ':' . $this->getState('filter.search'); - $id .= ':' . $this->getState('filter.published'); - $id .= ':' . $this->getState('filter.ordering'); - $id .= ':' . $this->getState('filter.created_by'); - $id .= ':' . $this->getState('filter.modified_by'); - $id .= ':' . $this->getState('filter.name'); - $id .= ':' . $this->getState('filter.country'); - - return parent::getStoreId($id); - } - - /** - * Build an SQL query to checkin all items left checked out longer then a set time. - * - * @return a bool - * - */ - protected function checkInNow() - { - // Get set check in time - $time = JComponentHelper::getParams('com_membersmanager')->get('check_in'); - - if ($time) - { - - // Get a db connection. - $db = JFactory::getDbo(); - // reset query - $query = $db->getQuery(true); - $query->select('*'); - $query->from($db->quoteName('#__membersmanager_region')); - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - // Get Yesterdays date - $date = JFactory::getDate()->modify($time)->toSql(); - // reset query - $query = $db->getQuery(true); - - // Fields to update. - $fields = array( - $db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'', - $db->quoteName('checked_out') . '=0' - ); - - // Conditions for which records should be updated. - $conditions = array( - $db->quoteName('checked_out') . '!=0', - $db->quoteName('checked_out_time') . '<\''.$date.'\'' - ); - - // Check table - $query->update($db->quoteName('#__membersmanager_region'))->set($fields)->where($conditions); - - $db->setQuery($query); - - $db->execute(); - } - } - - return false; - } -} diff --git a/admin/models/rules/memberloginname.php b/admin/models/rules/memberloginname.php new file mode 100644 index 0000000..a74e327 --- /dev/null +++ b/admin/models/rules/memberloginname.php @@ -0,0 +1,65 @@ + + * @github Joomla Members Manager + * @copyright Copyright (C) 2015. All Rights Reserved + * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + */ + +// No direct access to this file +defined('JPATH_PLATFORM') or die; + +use Joomla\CMS\Form\Form; +use Joomla\CMS\Form\FormRule; +use Joomla\Registry\Registry; + +/** + * Form Rule (Memberloginname) class for the Joomla Platform. + */ +class JFormRuleMemberloginname extends FormRule +{ + /** + * Method to test the username for uniqueness. + * + * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * @param Registry $input An optional Registry object with the entire data set to validate against the entire form. + * @param Form $form The form object for which the field is being tested. + * + * @return boolean True if the value is valid, false otherwise. + * + * @since 11.1 + */ + public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null) + { + // Get the database object and a new query object. + $db = \JFactory::getDbo(); + $query = $db->getQuery(true); + + // Build the query. + $query->select('COUNT(*)') + ->from('#__users') + ->where('username = ' . $db->quote($value)); + + // Get the user ID if set. + $userId = ($form instanceof Form && ($userId = $form->getValue('user'))) ? $userId : (($input instanceof Registry && ($userId = $input->get('user'))) ? $userId : ''); + $query->where($db->quoteName('id') . ' <> ' . (int) $userId); + + // Set and query the database. + $db->setQuery($query); + $duplicate = (bool) $db->loadResult(); + + if ($duplicate) + { + return false; + } + + return true; + } +} diff --git a/admin/models/rules/memberuseremail.php b/admin/models/rules/memberuseremail.php new file mode 100644 index 0000000..f0f51cd --- /dev/null +++ b/admin/models/rules/memberuseremail.php @@ -0,0 +1,128 @@ + + * @github Joomla Members Manager + * @copyright Copyright (C) 2015. All Rights Reserved + * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + */ + +// No direct access to this file +defined('JPATH_PLATFORM') or die; + +use Joomla\CMS\Form\Form; +use Joomla\CMS\Form\FormRule; +use Joomla\Registry\Registry; + +/** + * Form Rule (Memberuseremail) class for the Joomla Platform. + */ +class JFormRuleMemberuseremail extends FormRule +{ + /** + * The regular expression to use in testing a form field value. + * + * @var string + * @since 11.1 + * @link http://www.w3.org/TR/html-markup/input.email.html + */ + protected $regex = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$"; + + /** + * Method to test the email address and optionally check for uniqueness. + * + * @param \SimpleXMLElement $element The SimpleXMLElement object representing the `` tag for the form field object. + * @param mixed $value The form field value to validate. + * @param string $group The field name group control value. This acts as an array container for the field. + * For example if the field has name="foo" and the group value is set to "bar" then the + * full field name would end up being "bar[foo]". + * @param Registry $input An optional Registry object with the entire data set to validate against the entire form. + * @param Form $form The form object for which the field is being tested. + * + * @return boolean True if the value is valid, false otherwise. + * + * @since 11.1 + */ + public function test(\SimpleXMLElement $element, $value, $group = null, Registry $input = null, Form $form = null) + { + // If the field is empty and not required, the field is valid. + $required = ((string) $element['required'] == 'true' || (string) $element['required'] == 'required'); + + if (!$required && empty($value)) + { + return true; + } + + // If the tld attribute is present, change the regular expression to require at least 2 characters for it. + $tld = ((string) $element['tld'] == 'tld' || (string) $element['tld'] == 'required'); + + if ($tld) + { + $this->regex = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])" + . '?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$'; + } + + // Determine if the multiple attribute is present + $multiple = ((string) $element['multiple'] == 'true' || (string) $element['multiple'] == 'multiple'); + + if (!$multiple) + { + // Handle idn email addresses by converting to punycode. + $value = \JStringPunycode::emailToPunycode($value); + + // Test the value against the regular expression. + if (!parent::test($element, $value, $group, $input, $form)) + { + return false; + } + } + else + { + $values = explode(',', $value); + + foreach ($values as $value) + { + // Handle idn email addresses by converting to punycode. + $value = \JStringPunycode::emailToPunycode($value); + + // Test the value against the regular expression. + if (!parent::test($element, $value, $group, $input, $form)) + { + return false; + } + } + } + + // Check if we should test for uniqueness. This only can be used if multiple is not true + $unique = ((string) $element['unique'] == 'true' || (string) $element['unique'] == 'unique'); + + if ($unique && !$multiple) + { + // Get the database object and a new query object. + $db = \JFactory::getDbo(); + $query = $db->getQuery(true); + + // Build the query. + $query->select('COUNT(*)') + ->from('#__users') + ->where('email = ' . $db->quote($value)); + + // Get the extra field check attribute. + $userId = ($form instanceof Form && ($userId = $form->getValue('user'))) ? $userId : (($input instanceof Registry && ($userId = $input->get('user'))) ? $userId : ''); + $query->where($db->quoteName('id') . ' <> ' . (int) $userId); + + // Set and query the database. + $db->setQuery($query); + $duplicate = (bool) $db->loadResult(); + + if ($duplicate) + { + return false; + } + } + + return true; + } +} diff --git a/admin/models/type.php b/admin/models/type.php index f6cec62..a38ddb4 100644 --- a/admin/models/type.php +++ b/admin/models/type.php @@ -14,9 +14,6 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\Registry\Registry; -// import Joomla modelform library -jimport('joomla.application.component.modeladmin'); - /** * Membersmanager Type Model */ @@ -49,6 +46,9 @@ class MembersmanagerModelType extends JModelAdmin */ public function getTable($type = 'type', $prefix = 'MembersmanagerTable', $config = array()) { + // add table path for when model gets used from other component + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_membersmanager/tables'); + // get instance of the table return JTable::getInstance($type, $prefix, $config); } @@ -79,6 +79,18 @@ class MembersmanagerModelType extends JModelAdmin $registry = new Registry; $registry->loadString($item->metadata); $item->metadata = $registry->toArray(); + } + + if (!empty($item->groups_target)) + { + // JSON Decode groups_target. + $item->groups_target = json_decode($item->groups_target,true); + } + + if (!empty($item->groups_access)) + { + // JSON Decode groups_access. + $item->groups_access = json_decode($item->groups_access,true); } if (!empty($item->id)) @@ -89,22 +101,25 @@ class MembersmanagerModelType extends JModelAdmin } return $item; - } + } /** * Method to get the record form. * * @param array $data Data for the form. * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * @param array $options Optional array of options for the form creation. * * @return mixed A JForm object on success, false on failure * * @since 1.6 */ - public function getForm($data = array(), $loadData = true) - { + public function getForm($data = array(), $loadData = true, $options = array('control' => 'jform')) + { + // set load data option + $options['load_data'] = $loadData; // Get the form. - $form = $this->loadForm('com_membersmanager.type', 'type', array('control' => 'jform', 'load_data' => $loadData)); + $form = $this->loadForm('com_membersmanager.type', 'type', $options); if (empty($form)) { @@ -198,13 +213,51 @@ class MembersmanagerModelType extends JModelAdmin $form->setFieldAttribute('description', 'required', 'false'); } } + // Modify the form based on Edit Groups Target access controls. + if ($id != 0 && (!$user->authorise('type.edit.groups_target', 'com_membersmanager.type.' . (int) $id)) + || ($id == 0 && !$user->authorise('type.edit.groups_target', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('groups_target', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('groups_target', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('groups_target')) + { + // Disable fields while saving. + $form->setFieldAttribute('groups_target', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('groups_target', 'required', 'false'); + } + } + // Modify the form based on Edit Groups Access access controls. + if ($id != 0 && (!$user->authorise('type.edit.groups_access', 'com_membersmanager.type.' . (int) $id)) + || ($id == 0 && !$user->authorise('type.edit.groups_access', 'com_membersmanager'))) + { + // Disable fields for display. + $form->setFieldAttribute('groups_access', 'disabled', 'true'); + // Disable fields for display. + $form->setFieldAttribute('groups_access', 'readonly', 'true'); + // If there is no value continue. + if (!$form->getValue('groups_access')) + { + // Disable fields while saving. + $form->setFieldAttribute('groups_access', 'filter', 'unset'); + // Disable fields while saving. + $form->setFieldAttribute('groups_access', 'required', 'false'); + } + } // Only load these values if no id is found if (0 == $id) { - // Set redirected field name - $redirectedField = $jinput->get('ref', null, 'STRING'); - // Set redirected field value - $redirectedValue = $jinput->get('refid', 0, 'INT'); + // Set redirected view name + $redirectedView = $jinput->get('ref', null, 'STRING'); + // Set field name (or fall back to view name) + $redirectedField = $jinput->get('field', $redirectedView, 'STRING'); + // Set redirected view id + $redirectedId = $jinput->get('refid', 0, 'INT'); + // Set field id (or fall back to redirected view id) + $redirectedValue = $jinput->get('field_id', $redirectedId, 'INT'); if (0 != $redirectedValue && $redirectedField) { // Now set the local-redirected field default value @@ -369,7 +422,7 @@ class MembersmanagerModelType extends JModelAdmin } return $data; - } + } /** * Method to get the unique fields of this table. @@ -654,7 +707,7 @@ class MembersmanagerModelType extends JModelAdmin $this->cleanCache(); return $newIds; - } + } /** * Batch move items to a new category @@ -786,7 +839,19 @@ class MembersmanagerModelType extends JModelAdmin $metadata = new JRegistry; $metadata->loadArray($data['metadata']); $data['metadata'] = (string) $metadata; - } + } + + // Set the groups_target string to JSON string. + if (isset($data['groups_target'])) + { + $data['groups_target'] = (string) json_encode($data['groups_target']); + } + + // Set the groups_access string to JSON string. + if (isset($data['groups_access'])) + { + $data['groups_access'] = (string) json_encode($data['groups_access']); + } // Set the Params Items to data if (isset($data['params']) && is_array($data['params'])) diff --git a/admin/models/types.php b/admin/models/types.php index dcf9481..d19d1f4 100644 --- a/admin/models/types.php +++ b/admin/models/types.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import the Joomla modellist library -jimport('joomla.application.component.modellist'); - /** * Types Model */ @@ -82,7 +79,7 @@ class MembersmanagerModelTypes extends JModelList * @return mixed An array of data items on success, false on failure. */ public function getItems() - { + { // check in items $this->checkInNow(); @@ -101,8 +98,48 @@ class MembersmanagerModelTypes extends JModelList continue; } + // decode groups_target + $groups_targetArray = json_decode($item->groups_target, true); + if (MembersmanagerHelper::checkArray($groups_targetArray)) + { + $groups_targetNames = ''; + $counter = 0; + foreach ($groups_targetArray as $groups_target) + { + if ($counter == 0) + { + $groups_targetNames .= MembersmanagerHelper::getGroupName($groups_target); + } + else + { + $groups_targetNames .= ', '.MembersmanagerHelper::getGroupName($groups_target); + } + $counter++; + } + $item->groups_target = $groups_targetNames; + } + // decode groups_access + $groups_accessArray = json_decode($item->groups_access, true); + if (MembersmanagerHelper::checkArray($groups_accessArray)) + { + $groups_accessNames = ''; + $counter = 0; + foreach ($groups_accessArray as $groups_access) + { + if ($counter == 0) + { + $groups_accessNames .= MembersmanagerHelper::getGroupName($groups_access); + } + else + { + $groups_accessNames .= ', '.MembersmanagerHelper::getGroupName($groups_access); + } + $counter++; + } + $item->groups_access = $groups_accessNames; + } } - } + } // return items return $items; @@ -163,7 +200,7 @@ class MembersmanagerModelTypes extends JModelList else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.')'); + $query->where('(a.name LIKE '.$search.' OR a.groups_target LIKE '.$search.' OR a.groups_access LIKE '.$search.')'); } } @@ -275,7 +312,7 @@ class MembersmanagerModelTypes extends JModelList return $headers; } return false; - } + } /** * Method to get a store id based on model configuration state. diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 11f1651..013933d 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -2,22 +2,18 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_member` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `account` TINYINT(1) NOT NULL DEFAULT 0, - `city` VARCHAR(255) NOT NULL DEFAULT '', - `country` INT(11) NOT NULL DEFAULT 0, `email` VARCHAR(255) NOT NULL DEFAULT '', - `landline_phone` VARCHAR(64) NOT NULL DEFAULT '', `main_member` INT(11) NOT NULL DEFAULT 0, - `mobile_phone` VARCHAR(64) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', - `postal` VARCHAR(255) NOT NULL DEFAULT '', - `postalcode` VARCHAR(255) NOT NULL DEFAULT '', + `password` VARCHAR(255) NOT NULL DEFAULT '', + `password_check` VARCHAR(255) NOT NULL DEFAULT '', `profile_image` TEXT NOT NULL, - `region` INT(11) NOT NULL DEFAULT 0, - `street` VARCHAR(255) NOT NULL DEFAULT '', + `surname` CHAR(255) NOT NULL DEFAULT '', `token` VARCHAR(255) NOT NULL DEFAULT '', `type` INT(11) NOT NULL DEFAULT 0, `user` INT(11) NOT NULL DEFAULT 0, - `website` VARCHAR(255) NOT NULL DEFAULT '', + `useremail` VARCHAR(255) NOT NULL DEFAULT '', + `username` VARCHAR(255) NOT NULL DEFAULT '', `params` text NOT NULL DEFAULT '', `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, @@ -36,12 +32,10 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_member` ( KEY `idx_createdby` (`created_by`), KEY `idx_modifiedby` (`modified_by`), KEY `idx_state` (`published`), - KEY `idx_user` (`user`), + KEY `idx_name` (`name`), KEY `idx_account` (`account`), - KEY `idx_token` (`token`), - KEY `idx_country` (`country`), - KEY `idx_region` (`region`), - KEY `idx_name` (`name`) + KEY `idx_user` (`user`), + KEY `idx_token` (`token`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `#__membersmanager_type` ( @@ -49,6 +43,8 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_type` ( `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', `alias` CHAR(64) NOT NULL DEFAULT '', `description` TEXT NOT NULL, + `groups_access` TEXT NOT NULL, + `groups_target` TEXT NOT NULL, `name` VARCHAR(255) NOT NULL DEFAULT '', `params` text NOT NULL DEFAULT '', `published` TINYINT(3) NOT NULL DEFAULT 1, @@ -72,538 +68,6 @@ CREATE TABLE IF NOT EXISTS `#__membersmanager_type` ( KEY `idx_alias` (`alias`) ) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; -CREATE TABLE IF NOT EXISTS `#__membersmanager_region` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `alias` CHAR(64) NOT NULL DEFAULT '', - `country` INT(11) NOT NULL DEFAULT 0, - `name` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NOT NULL DEFAULT '', - `published` TINYINT(3) NOT NULL DEFAULT 1, - `created_by` INT(10) unsigned NOT NULL DEFAULT 0, - `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, - `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `checked_out` int(11) unsigned NOT NULL DEFAULT 0, - `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `version` INT(10) unsigned NOT NULL DEFAULT 1, - `hits` INT(10) unsigned NOT NULL DEFAULT 0, - `access` INT(10) unsigned NOT NULL DEFAULT 0, - `ordering` INT(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`), - KEY `idx_access` (`access`), - KEY `idx_checkout` (`checked_out`), - KEY `idx_createdby` (`created_by`), - KEY `idx_modifiedby` (`modified_by`), - KEY `idx_state` (`published`), - KEY `idx_name` (`name`), - KEY `idx_country` (`country`), - KEY `idx_alias` (`alias`) -) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `#__membersmanager_country` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `alias` CHAR(64) NOT NULL DEFAULT '', - `codethree` CHAR(7) NOT NULL DEFAULT '', - `codetwo` CHAR(7) NOT NULL DEFAULT '', - `currency` CHAR(7) NOT NULL DEFAULT '', - `name` VARCHAR(255) NOT NULL DEFAULT '', - `worldzone` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NOT NULL DEFAULT '', - `published` TINYINT(3) NOT NULL DEFAULT 1, - `created_by` INT(10) unsigned NOT NULL DEFAULT 0, - `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, - `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `checked_out` int(11) unsigned NOT NULL DEFAULT 0, - `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `version` INT(10) unsigned NOT NULL DEFAULT 1, - `hits` INT(10) unsigned NOT NULL DEFAULT 0, - `access` INT(10) unsigned NOT NULL DEFAULT 0, - `ordering` INT(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`), - KEY `idx_access` (`access`), - KEY `idx_checkout` (`checked_out`), - KEY `idx_createdby` (`created_by`), - KEY `idx_modifiedby` (`modified_by`), - KEY `idx_state` (`published`), - KEY `idx_name` (`name`), - KEY `idx_currency` (`currency`), - KEY `idx_worldzone` (`worldzone`), - KEY `idx_codethree` (`codethree`), - KEY `idx_codetwo` (`codetwo`), - KEY `idx_alias` (`alias`) -) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; - -CREATE TABLE IF NOT EXISTS `#__membersmanager_currency` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `alias` CHAR(64) NOT NULL DEFAULT '', - `codethree` CHAR(7) NOT NULL DEFAULT '', - `decimalplace` INT(7) NOT NULL DEFAULT 0, - `decimalsymbol` CHAR(7) NOT NULL DEFAULT '', - `name` VARCHAR(255) NOT NULL DEFAULT '', - `negativestyle` VARCHAR(255) NOT NULL DEFAULT '', - `numericcode` INT(10) NOT NULL DEFAULT 0, - `positivestyle` VARCHAR(255) NOT NULL DEFAULT '', - `symbol` CHAR(11) NOT NULL DEFAULT '', - `thousands` CHAR(7) NOT NULL DEFAULT '', - `params` text NOT NULL DEFAULT '', - `published` TINYINT(3) NOT NULL DEFAULT 1, - `created_by` INT(10) unsigned NOT NULL DEFAULT 0, - `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, - `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `checked_out` int(11) unsigned NOT NULL DEFAULT 0, - `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', - `version` INT(10) unsigned NOT NULL DEFAULT 1, - `hits` INT(10) unsigned NOT NULL DEFAULT 0, - `access` INT(10) unsigned NOT NULL DEFAULT 0, - `ordering` INT(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`id`), - UNIQUE KEY `idx_codethree` (`codethree`), - KEY `idx_access` (`access`), - KEY `idx_checkout` (`checked_out`), - KEY `idx_createdby` (`created_by`), - KEY `idx_modifiedby` (`modified_by`), - KEY `idx_state` (`published`), - KEY `idx_name` (`name`), - KEY `idx_numericcode` (`numericcode`), - KEY `idx_alias` (`alias`) -) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8; - --- --- Dumping data for table `#__membersmanager_region` --- - -INSERT INTO `#__membersmanager_region` (`id`, `asset_id`, `alias`, `country`, `name`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `access`, `ordering`) VALUES -(1, 26816, 'khomas', 146, 'Khomas', '', 1, 450, '', '2016-05-17 05:01:46', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', 1, 1), -(2, 26817, 'karas', 146, 'Karas', '', 1, 450, '', '2016-05-17 05:01:57', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', 1, 2), -(3, 33181, 'region', 13, 'Region', '', 1, 450, '', '2016-11-15 04:52:45', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', 1, 3); - --- --- Dumping data for table `#__membersmanager_country` --- - -INSERT INTO `#__membersmanager_country` (`id`, `asset_id`, `alias`, `codethree`, `codetwo`, `currency`, `name`, `worldzone`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `ordering`) VALUES -(1, '', '', 'AFG', 'AF', 'AFN', 'Afghanistan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(2, '', '', 'ALB', 'AL', 'ALL', 'Albania', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(3, '', '', 'DZA', 'DZ', 'DZD', 'Algeria', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(4, '', '', 'ASM', 'AS', 'USD', 'American Samoa', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(5, '', '', 'AND', 'AD', 'EUR', 'Andorra', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(6, '', '', 'AGO', 'AO', 'GBP', 'Angola', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 2, '', ''), -(7, '', '', 'AIA', 'AI', 'XCD', 'Anguilla', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(8, '', '', 'ATA', 'AQ', 'USD', 'Antarctica', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(9, '', '', 'ATG', 'AG', 'XCD', 'Antigua and Barbuda', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(10, '', '', 'ARG', 'AR', 'ARS', 'Argentina', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(11, '', '', 'ARM', 'AM', 'AMD', 'Armenia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(12, '', '', 'ABW', 'AW', 'AWG', 'Aruba', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(13, '', '', 'AUS', 'AU', 'AUD', 'Australia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(14, '', '', 'AUT', 'AT', 'EUR', 'Austria', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(15, '', '', 'AZE', 'AZ', 'AZN', 'Azerbaijan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(16, '', '', 'BHS', 'BS', 'BSD', 'Bahamas', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(17, '', '', 'BHR', 'BH', 'BHD', 'Bahrain', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(18, '', '', 'BGD', 'BD', 'BDT', 'Bangladesh', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(19, '', '', 'BRB', 'BB', 'BBD', 'Barbados', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(20, '', '', 'BLR', 'BY', 'BYR', 'Belarus', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(21, '', '', 'BEL', 'BE', 'EUR', 'Belgium', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(22, '', '', 'BLZ', 'BZ', 'BZD', 'Belize', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(23, '', '', 'BEN', 'BJ', 'XOF', 'Benin', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(24, '', '', 'BMU', 'BM', 'BMD', 'Bermuda', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(25, '', '', 'BTN', 'BT', 'INR', 'Bhutan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(26, '', '', 'BOL', 'BO', 'BOB', 'Bolivia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(27, '', '', 'BIH', 'BA', 'BAM', 'Bosnia and Herzegowina', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(28, '', '', 'BWA', 'BW', 'BWP', 'Botswana', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(29, '', '', 'BVT', 'BV', 'NOK', 'Bouvet Island', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(30, '', '', 'BRA', 'BR', 'BRL', 'Brazil', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(31, '', '', 'IOT', 'IO', 'USD', 'British Indian Ocean Territory', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(32, '', '', 'BRN', 'BN', 'BND', 'Brunei Darussalam', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(33, '', '', 'BGR', 'BG', 'BGN', 'Bulgaria', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(34, '', '', 'BFA', 'BF', 'XOF', 'Burkina Faso', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(35, '', '', 'BDI', 'BI', 'BIF', 'Burundi', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(36, '', '', 'KHM', 'KH', 'KHR', 'Cambodia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(37, '', '', 'CMR', 'CM', 'XAF', 'Cameroon', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(38, '', '', 'CAN', 'CA', 'CAD', 'Canada', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(39, '', '', 'CPV', 'CV', 'CVE', 'Cape Verde', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(40, '', '', 'CYM', 'KY', 'KYD', 'Cayman Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(41, '', '', 'CAF', 'CF', 'XAF', 'Central African Republic', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(42, '', '', 'TCD', 'TD', 'XAF', 'Chad', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(43, '', '', 'CHL', 'CL', 'CLP', 'Chile', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(44, '', '', 'CHN', 'CN', 'CNY', 'China', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(45, '', '', 'CXR', 'CX', 'AUD', 'Christmas Island', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(46, '', '', 'CCK', 'CC', 'AUD', 'Cocos (Keeling) Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(47, '', '', 'COL', 'CO', 'COP', 'Colombia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(48, '', '', 'COM', 'KM', 'KMF', 'Comoros', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(49, '', '', 'COG', 'CG', 'XAF', 'Congo', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(50, '', '', 'COK', 'CK', 'NZD', 'Cook Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(51, '', '', 'CRI', 'CR', 'CRC', 'Costa Rica', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(52, '', '', 'CIV', 'CI', 'XOF', 'Cote D\'Ivoire', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(53, '', '', 'HRV', 'HR', 'HRK', 'Croatia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(54, '', '', 'CUB', 'CU', 'CUP', 'Cuba', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(55, '', '', 'CYP', 'CY', 'EUR', 'Cyprus', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(56, '', '', 'CZE', 'CZ', 'CZK', 'Czech Republic', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(57, '', '', 'DNK', 'DK', 'DKK', 'Denmark', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(58, '', '', 'DJI', 'DJ', 'DJF', 'Djibouti', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(59, '', '', 'DMA', 'DM', 'XCD', 'Dominica', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(60, '', '', 'DOM', 'DO', 'DOP', 'Dominican Republic', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(61, '', '', 'TMP', 'TP', 'USD', 'East Timor', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(62, '', '', 'ECU', 'EC', 'USD', 'Ecuador', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(63, '', '', 'EGY', 'EG', 'EGP', 'Egypt', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(64, '', '', 'SLV', 'SV', 'USD', 'El Salvador', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(65, '', '', 'GNQ', 'GQ', 'XAF', 'Equatorial Guinea', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(66, '', '', 'ERI', 'ER', 'ERN', 'Eritrea', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(67, '', '', 'EST', 'EE', 'EUR', 'Estonia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(68, '', '', 'ETH', 'ET', 'ETB', 'Ethiopia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(69, '', '', 'FLK', 'FK', 'FKP', 'Falkland Islands (Malvinas)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(70, '', '', 'FRO', 'FO', 'DKK', 'Faroe Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(71, '', '', 'FJI', 'FJ', 'FJD', 'Fiji', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(72, '', '', 'FIN', 'FI', 'EUR', 'Finland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(73, '', '', 'FRA', 'FR', 'EUR', 'France', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(74, '', '', 'GUF', 'GF', 'EUR', 'French Guiana', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(75, '', '', 'PYF', 'PF', 'XPF', 'French Polynesia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(76, '', '', 'ATF', 'TF', 'EUR', 'French Southern Territories', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(77, '', '', 'GAB', 'GA', 'XAF', 'Gabon', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(78, '', '', 'GMB', 'GM', 'GMD', 'Gambia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(79, '', '', 'GEO', 'GE', 'GEL', 'Georgia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(80, '', '', 'DEU', 'DE', 'EUR', 'Germany', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(81, '', '', 'GHA', 'GH', 'GHS', 'Ghana', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(82, '', '', 'GIB', 'GI', 'GIP', 'Gibraltar', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(83, '', '', 'GRC', 'GR', 'EUR', 'Greece', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(84, '', '', 'GRL', 'GL', 'DKK', 'Greenland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(85, '', '', 'GRD', 'GD', 'XCD', 'Grenada', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(86, '', '', 'GLP', 'GP', 'EUR', 'Guadeloupe', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(87, '', '', 'GUM', 'GU', 'USD', 'Guam', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(88, '', '', 'GTM', 'GT', 'GTQ', 'Guatemala', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(89, '', '', 'GIN', 'GN', 'GNF', 'Guinea', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(90, '', '', 'GNB', 'GW', 'XOF', 'Guinea-bissau', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(91, '', '', 'GUY', 'GY', 'GYD', 'Guyana', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(92, '', '', 'HTI', 'HT', 'USD', 'Haiti', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(93, '', '', 'HMD', 'HM', 'AUD', 'Heard and Mc Donald Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(94, '', '', 'HND', 'HN', 'HNL', 'Honduras', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(95, '', '', 'HKG', 'HK', 'HKD', 'Hong Kong', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(96, '', '', 'HUN', 'HU', 'HUF', 'Hungary', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(97, '', '', 'ISL', 'IS', 'ISK', 'Iceland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(98, '', '', 'IND', 'IN', 'INR', 'India', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(99, '', '', 'IDN', 'ID', 'IDR', 'Indonesia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(100, '', '', 'IRN', 'IR', 'IRR', 'Iran (Islamic Republic of)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(101, '', '', 'IRQ', 'IQ', 'IQD', 'Iraq', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(102, '', '', 'IRL', 'IE', 'EUR', 'Ireland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(103, '', '', 'ISR', 'IL', 'ILS', 'Israel', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(104, '', '', 'ITA', 'IT', 'EUR', 'Italy', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(105, '', '', 'JAM', 'JM', 'JMD', 'Jamaica', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(106, '', '', 'JPN', 'JP', 'JPY', 'Japan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(107, '', '', 'JOR', 'JO', 'JOD', 'Jordan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(108, '', '', 'KAZ', 'KZ', 'KZT', 'Kazakhstan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(109, '', '', 'KEN', 'KE', 'KES', 'Kenya', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(110, '', '', 'KIR', 'KI', 'AUD', 'Kiribati', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(111, '', '', 'PRK', 'KP', 'KPW', 'Korea, Democratic People\'s Republic of', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(112, '', '', 'KOR', 'KR', 'KRW', 'Korea, Republic of', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(113, '', '', 'KWT', 'KW', 'KWD', 'Kuwait', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(114, '', '', 'KGZ', 'KG', 'KGS', 'Kyrgyzstan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(115, '', '', 'LAO', 'LA', 'LAK', 'Lao People\'s Democratic Republic', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(116, '', '', 'LVA', 'LV', 'LVL', 'Latvia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(117, '', '', 'LBN', 'LB', 'LBP', 'Lebanon', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(118, '', '', 'LSO', 'LS', 'ZAR', 'Lesotho', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(119, '', '', 'LBR', 'LR', 'LRD', 'Liberia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(120, '', '', 'LBY', 'LY', 'LYD', 'Libya', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(121, '', '', 'LIE', 'LI', 'CHF', 'Liechtenstein', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(122, '', '', 'LTU', 'LT', 'LTL', 'Lithuania', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(123, '', '', 'LUX', 'LU', 'EUR', 'Luxembourg', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(124, '', '', 'MAC', 'MO', 'MOP', 'Macau', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(125, '', '', 'MKD', 'MK', 'MKD', 'Macedonia, The Former Yugoslav Republic of', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(126, '', '', 'MDG', 'MG', 'MGA', 'Madagascar', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(127, '', '', 'MWI', 'MW', 'MWK', 'Malawi', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(128, '', '', 'MYS', 'MY', 'MYR', 'Malaysia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(129, '', '', 'MDV', 'MV', 'MVR', 'Maldives', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(130, '', '', 'MLI', 'ML', 'XOF', 'Mali', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(131, '', '', 'MLT', 'MT', 'EUR', 'Malta', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(132, '', '', 'MHL', 'MH', 'USD', 'Marshall Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(133, '', '', 'MTQ', 'MQ', 'EUR', 'Martinique', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(134, '', '', 'MRT', 'MR', 'MRO', 'Mauritania', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(135, '', '', 'MUS', 'MU', 'MUR', 'Mauritius', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(136, '', '', 'MYT', 'YT', 'EUR', 'Mayotte', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(137, '', '', 'MEX', 'MX', 'MXN', 'Mexico', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(138, '', '', 'FSM', 'FM', 'USD', 'Micronesia, Federated States of', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(139, '', '', 'MDA', 'MD', 'MDL', 'Moldova, Republic of', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(140, '', '', 'MCO', 'MC', 'EUR', 'Monaco', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(141, '', '', 'MNG', 'MN', 'MNT', 'Mongolia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(142, '', '', 'MSR', 'MS', 'XCD', 'Montserrat', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(143, '', '', 'MAR', 'MA', 'MAD', 'Morocco', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(144, '', '', 'MOZ', 'MZ', 'MZN', 'Mozambique', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(145, '', '', 'MMR', 'MM', 'MMK', 'Myanmar', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(146, '', '', 'NAM', 'NA', 'NAD', 'Namibia', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(147, '', '', 'NRU', 'NR', 'AUD', 'Nauru', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(148, '', '', 'NPL', 'NP', 'NPR', 'Nepal', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(149, '', '', 'NLD', 'NL', 'EUR', 'Netherlands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(150, '', '', 'ANT', 'AN', 'ANG', 'Netherlands Antilles', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(151, '', '', 'NCL', 'NC', 'XPF', 'New Caledonia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(152, '', '', 'NZL', 'NZ', 'NZD', 'New Zealand', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(153, '', '', 'NIC', 'NI', 'NIO', 'Nicaragua', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(154, '', '', 'NER', 'NE', 'XOF', 'Niger', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(155, '', '', 'NGA', 'NG', 'NGN', 'Nigeria', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(156, '', '', 'NIU', 'NU', 'NZD', 'Niue', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(157, '', '', 'NFK', 'NF', 'AUD', 'Norfolk Island', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(158, '', '', 'MNP', 'MP', 'USD', 'Northern Mariana Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(159, '', '', 'NOR', 'NO', 'NOK', 'Norway', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(160, '', '', 'OMN', 'OM', 'OMR', 'Oman', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(161, '', '', 'PAK', 'PK', 'PKR', 'Pakistan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(162, '', '', 'PLW', 'PW', 'USD', 'Palau', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(163, '', '', 'PAN', 'PA', 'USD', 'Panama', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(164, '', '', 'PNG', 'PG', 'PGK', 'Papua New Guinea', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(165, '', '', 'PRY', 'PY', 'PYG', 'Paraguay', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(166, '', '', 'PER', 'PE', 'PEN', 'Peru', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(167, '', '', 'PHL', 'PH', 'PHP', 'Philippines', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(168, '', '', 'PCN', 'PN', 'NZD', 'Pitcairn', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(169, '', '', 'POL', 'PL', 'PLN', 'Poland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(170, '', '', 'PRT', 'PT', 'EUR', 'Portugal', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(171, '', '', 'PRI', 'PR', 'USD', 'Puerto Rico', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(172, '', '', 'QAT', 'QA', 'QAR', 'Qatar', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(173, '', '', 'REU', 'RE', 'EUR', 'Reunion', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(174, '', '', 'ROM', 'RO', 'RON', 'Romania', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(175, '', '', 'RUS', 'RU', 'RUB', 'Russian Federation', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(176, '', '', 'RWA', 'RW', 'RWF', 'Rwanda', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(177, '', '', 'KNA', 'KN', 'XCD', 'Saint Kitts and Nevis', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(178, '', '', 'LCA', 'LC', 'XCD', 'Saint Lucia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(179, '', '', 'VCT', 'VC', 'XCD', 'Saint Vincent and the Grenadines', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(180, '', '', 'WSM', 'WS', 'WST', 'Samoa', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(181, '', '', 'SMR', 'SM', 'EUR', 'San Marino', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(182, '', '', 'STP', 'ST', 'STD', 'Sao Tome and Principe', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(183, '', '', 'SAU', 'SA', 'SAR', 'Saudi Arabia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(184, '', '', 'SEN', 'SN', 'XOF', 'Senegal', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(185, '', '', 'SYC', 'SC', 'SCR', 'Seychelles', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(186, '', '', 'SLE', 'SL', 'SLL', 'Sierra Leone', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(187, '', '', 'SGP', 'SG', 'SGD', 'Singapore', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(188, '', '', 'SVK', 'SK', 'EUR', 'Slovakia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(189, '', '', 'SVN', 'SI', 'EUR', 'Slovenia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(190, '', '', 'SLB', 'SB', 'SBD', 'Solomon Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(191, '', '', 'SOM', 'SO', 'SOS', 'Somalia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(192, '', '', 'ZAF', 'ZA', 'ZAR', 'South Africa', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(193, '', '', 'SGS', 'GS', 'GBP', 'South Georgia and the South Sandwich Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(194, '', '', 'ESP', 'ES', 'EUR', 'Spain', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(195, '', '', 'LKA', 'LK', 'LKR', 'Sri Lanka', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(196, '', '', 'SHN', 'SH', 'SHP', 'St. Helena', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(197, '', '', 'SPM', 'PM', 'EUR', 'St. Pierre and Miquelon', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(198, '', '', 'SDN', 'SD', 'SDG', 'Sudan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(199, '', '', 'SUR', 'SR', 'SRD', 'Suriname', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(200, '', '', 'SJM', 'SJ', 'NOK', 'Svalbard and Jan Mayen Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(201, '', '', 'SWZ', 'SZ', 'SZL', 'Swaziland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(202, '', '', 'SWE', 'SE', 'SEK', 'Sweden', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(203, '', '', 'CHE', 'CH', 'CHF', 'Switzerland', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(204, '', '', 'SYR', 'SY', 'SYP', 'Syrian Arab Republic', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(205, '', '', 'TWN', 'TW', 'TWD', 'Taiwan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(206, '', '', 'TJK', 'TJ', 'TJS', 'Tajikistan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(207, '', '', 'TZA', 'TZ', 'TZS', 'Tanzania, United Republic of', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(208, '', '', 'THA', 'TH', 'THB', 'Thailand', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(209, '', '', 'TGO', 'TG', 'XOF', 'Togo', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(210, '', '', 'TKL', 'TK', 'NZD', 'Tokelau', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(211, '', '', 'TON', 'TO', 'TOP', 'Tonga', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(212, '', '', 'TTO', 'TT', 'TTD', 'Trinidad and Tobago', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(213, '', '', 'TUN', 'TN', 'TND', 'Tunisia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(214, '', '', 'TUR', 'TR', 'TRY', 'Turkey', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(215, '', '', 'TKM', 'TM', 'TMT', 'Turkmenistan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(216, '', '', 'TCA', 'TC', 'USD', 'Turks and Caicos Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(217, '', '', 'TUV', 'TV', 'AUD', 'Tuvalu', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(218, '', '', 'UGA', 'UG', 'UGX', 'Uganda', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(219, '', '', 'UKR', 'UA', 'UAH', 'Ukraine', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(220, '', '', 'ARE', 'AE', 'AED', 'United Arab Emirates', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(221, '', '', 'GBR', 'GB', 'GBP', 'United Kingdom', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(222, '', '', 'USA', 'US', 'USD', 'United States', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(223, '', '', 'UMI', 'UM', 'USD', 'United States Minor Outlying Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(224, '', '', 'URY', 'UY', 'UYU', 'Uruguay', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(225, '', '', 'UZB', 'UZ', 'UZS', 'Uzbekistan', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(226, '', '', 'VUT', 'VU', 'VUV', 'Vanuatu', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(227, '', '', 'VAT', 'VA', 'EUR', 'Vatican City State (Holy See)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(228, '', '', 'VEN', 'VE', 'VEF', 'Venezuela', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(229, '', '', 'VNM', 'VN', 'VND', 'Viet Nam', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(230, '', '', 'VGB', 'VG', 'USD', 'Virgin Islands (British)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(231, '', '', 'VIR', 'VI', 'USD', 'Virgin Islands (U.S.)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(232, '', '', 'WLF', 'WF', 'XPF', 'Wallis and Futuna Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(233, '', '', 'ESH', 'EH', 'MAD', 'Western Sahara', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(234, '', '', 'YEM', 'YE', 'YER', 'Yemen', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(235, '', '', 'DRC', 'DC', 'CDF', 'The Democratic Republic of Congo', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(236, '', '', 'ZMB', 'ZM', 'USD', 'Zambia', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(237, '', '', 'ZWE', 'ZW', 'USD', 'Zimbabwe', '', '', 1, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(238, '', '', 'XET', 'XE', 'USD', 'East Timor', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(239, '', '', 'JEY', 'JE', 'GBP', 'Jersey', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(240, '', '', 'XSB', 'XB', 'EUR', 'St. Barthelemy', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(241, '', '', 'XSE', 'XU', 'USD', 'St. Eustatius', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(242, '', '', 'XCA', 'XC', 'EUR', 'Canary Islands', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(243, '', '', 'SRB', 'RS', 'SRB', 'Serbia', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(244, '', '', 'MAF', 'MF', 'EUR', 'Sint Maarten (French Antilles)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(245, '', '', 'SXM', 'SX', 'ANG', 'Sint Maarten (Netherlands Antilles)', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''), -(246, '', '', 'ZZZ', 'ZZ', 'ZZZ', 'Reserved', '', '', 2, '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', 1, '', ''); - --- --- Dumping data for table `#__membersmanager_currency` --- - -INSERT INTO `#__membersmanager_currency` (`id`, `asset_id`, `alias`, `codethree`, `decimalplace`, `decimalsymbol`, `name`, `negativestyle`, `numericcode`, `positivestyle`, `symbol`, `thousands`, `params`, `published`, `created_by`, `modified_by`, `created`, `modified`, `checked_out`, `checked_out_time`, `version`, `hits`, `access`, `ordering`) VALUES -(1, 0, '', 'AED', 2, ',', 'United Arab Emirates dirham', '{sign}{number} {symbol}', 784, '{number} {symbol}', 'د.إ', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 23), -(2, 0, '', 'AFN', 2, ',', 'Afghan afghani', '{sign}{number} {symbol}', 971, '{number} {symbol}', '؋', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 24), -(3, 0, '', 'ALL', 2, ',', 'Albanian lek', '{sign}{number} {symbol}', 8, '{number} {symbol}', 'Lek', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 25), -(4, 0, '', 'AMD', 2, ',', 'Armenian dram', '{sign}{number} {symbol}', 51, '{number} {symbol}', 'դր.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 26), -(5, 0, '', 'ANG', 2, ',', 'Netherlands Antillean gulden', '{sign}{number} {symbol}', 532, '{number} {symbol}', 'ƒ', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 27), -(6, 0, '', 'AOA', 2, ',', 'Angolan kwanza', '{sign}{number} {symbol}', 973, '{number} {symbol}', 'Kz', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 28), -(7, 0, '', 'ARS', 2, ',', 'Argentine peso', '{sign}{number} {symbol}', 32, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 29), -(8, 0, '', 'AUD', 2, '.', 'Australian dollar', '{sign}{symbol} {number}', 36, '{symbol} {number}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 5), -(9, 0, '', 'AWG', 2, ',', 'Aruban florin', '{sign}{number} {symbol}', 533, '{number} {symbol}', 'ƒ', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 30), -(10, 0, '', 'AZN', 2, ',', 'Azerbaijani manat', '{sign}{number} {symbol}', 934, '{number} {symbol}', 'ман', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 31), -(11, 0, '', 'BAM', 2, ',', 'Bosnia and Herzegovina convert', '{sign}{number} {symbol}', 977, '{number} {symbol}', 'KM', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 32), -(12, 0, '', 'BBD', 2, ',', 'Barbadian dollar', '{sign}{number} {symbol}', 52, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 33), -(13, 0, '', 'BDT', 2, ',', 'Bangladeshi taka', '{sign}{number} {symbol}', 50, '{number} {symbol}', '৳', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 34), -(14, 0, '', 'BGN', 2, ',', 'Bulgarian lev', '{sign}{number} {symbol}', 975, '{number} {symbol}', 'лв', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 35), -(15, 0, '', 'BHD', 2, ',', 'Bahraini dinar', '{sign}{number} {symbol}', 48, '{number} {symbol}', 'ب.د', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 36), -(16, 0, '', 'BIF', 0, '', 'Burundian franc', '{sign}{number} {symbol}', 108, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 37), -(17, 0, '', 'BMD', 2, ',', 'Bermudian dollar', '{sign}{number} {symbol}', 60, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 38), -(18, 0, '', 'BND', 2, ',', 'Brunei dollar', '{sign}{number} {symbol}', 96, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 39), -(19, 0, '', 'BOB', 2, ',', 'Bolivian boliviano', '{sign}{number} {symbol}', 68, '{number} {symbol}', '$b', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 40), -(20, 0, '', 'BOV', 2, ',', 'Mvdol', '{sign}{number} {symbol}', 984, '{number} {symbol}', 'BOV', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 41), -(21, 0, '', 'BRL', 2, '.', 'Brazilian real', '{symbol} {sign}{number}', 986, '{symbol} {number}', 'R$', ',', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 17), -(22, 0, '', 'BSD', 2, ',', 'Bahamian dollar', '{sign}{number} {symbol}', 44, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 42), -(23, 0, '', 'BTN', 2, ',', 'Bhutanese ngultrum', '{sign}{number} {symbol}', 64, '{number} {symbol}', 'BTN', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 43), -(24, 0, '', 'BWP', 2, ',', 'Botswana pula', '{sign}{number} {symbol}', 72, '{number} {symbol}', 'P', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 44), -(25, 0, '', 'BYR', 0, '', 'Belarusian ruble', '{sign}{number} {symbol}', 974, '{number} {symbol}', 'p.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 45), -(26, 0, '', 'BZD', 2, ',', 'Belize dollar', '{sign}{number} {symbol}', 84, '{number} {symbol}', 'BZ$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 46), -(27, 0, '', 'CAD', 2, '.', 'Canadian dollar', '{symbol}{sign}{number}', 124, '{symbol}{number}', '$', ',', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 7), -(28, 0, '', 'CDF', 2, ',', 'Congolese franc', '{sign}{number} {symbol}', 976, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 47), -(29, 0, '', 'CHE', 2, ',', 'WIR Euro', '{sign}{number} {symbol}', 947, '{number} {symbol}', '€', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 48), -(30, 0, '', 'CHF', 2, ',', 'Swiss franc', '{sign}{number} {symbol}', 756, '{number} {symbol}', 'CHF', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 6), -(31, 0, '', 'CHW', 2, ',', 'WIR Franc', '{sign}{number} {symbol}', 948, '{number} {symbol}', 'CHW', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 49), -(32, 0, '', 'CLF', 0, ',', 'Unidad de Fomento', '{sign}{number} {symbol}', 990, '{number} {symbol}', 'CLF', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 50), -(33, 0, '', 'CLP', 2, ',', 'Chilean peso', '{sign}{number} {symbol}', 152, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 51), -(34, 0, '', 'CNY', 2, ',', 'Chinese renminbi yuan', '{sign}{number} {symbol}', 156, '{number} {symbol}', '元', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 9), -(35, 0, '', 'COP', 2, ',', 'Colombian peso', '{sign}{number} {symbol}', 170, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 52), -(36, 0, '', 'COU', 2, ',', 'Unidad de Valor Real', '{sign}{number} {symbol}', 970, '{number} {symbol}', 'COU', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 53), -(37, 0, '', 'CRC', 2, ',', 'Costa Rican colón', '{sign}{number} {symbol}', 188, '{number} {symbol}', '₡', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 54), -(38, 0, '', 'CZK', 2, ',', 'Czech koruna', '{sign}{number} {symbol}', 203, '{number} {symbol}', 'Kč', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 57), -(39, 0, '', 'CUP', 2, ',', 'Cuban peso', '{sign}{number} {symbol}', 192, '{number} {symbol}', '₱', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 55), -(40, 0, '', 'CVE', 0, '', 'Cape Verdean escudo', '{sign}{number} {symbol}', 132, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 56), -(41, 0, '', 'DJF', 0, '', 'Djiboutian franc', '{sign}{number} {symbol}', 262, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 58), -(42, 0, '', 'DKK', 2, '.', 'Danish krone', '{symbol}{sign}{number}', 208, '{symbol}{number}', 'kr', ',', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 19), -(43, 0, '', 'DOP', 2, ',', 'Dominican peso', '{sign}{number} {symbol}', 214, '{number} {symbol}', 'RD$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 59), -(44, 0, '', 'DZD', 2, ',', 'Algerian dinar', '{sign}{number} {symbol}', 12, '{number} {symbol}', 'د.ج', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 60), -(45, 0, '', 'EGP', 2, ',', 'Egyptian pound', '{sign}{number} {symbol}', 818, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 61), -(46, 0, '', 'ERN', 2, ',', 'Eritrean nakfa', '{sign}{number} {symbol}', 232, '{number} {symbol}', 'Nfk', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 62), -(47, 0, '', 'ETB', 2, ',', 'Ethiopian birr', '{sign}{number} {symbol}', 230, '{number} {symbol}', 'ETB', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 63), -(48, 0, '', 'EUR', 2, ',', 'Euro', '{sign}{number} {symbol}', 978, '{number} {symbol}', '€', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 2), -(49, 0, '', 'FJD', 2, ',', 'Fijian dollar', '{sign}{number} {symbol}', 242, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 64), -(50, 0, '', 'FKP', 2, ',', 'Falkland pound', '{sign}{number} {symbol}', 238, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 65), -(51, 0, '', 'GBP', 2, '.', 'British pound', '{symbol}{sign}{number}', 826, '{symbol}{number}', '£', ',', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 4), -(52, 0, '', 'GEL', 2, ',', 'Georgian lari', '{sign}{number} {symbol}', 981, '{number} {symbol}', 'ლ', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 66), -(53, 0, '', 'GHS', 2, ',', 'Ghanaian cedi', '{sign}{number} {symbol}', 936, '{number} {symbol}', '₵', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 67), -(54, 0, '', 'GIP', 2, ',', 'Gibraltar pound', '{sign}{number} {symbol}', 292, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 68), -(55, 0, '', 'GMD', 2, ',', 'Gambian dalasi', '{sign}{number} {symbol}', 270, '{number} {symbol}', 'D', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 69), -(56, 0, '', 'GNF', 0, '', 'Guinean franc', '{sign}{number} {symbol}', 324, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 70), -(57, 0, '', 'GTQ', 2, ',', 'Guatemalan quetzal', '{sign}{number} {symbol}', 320, '{number} {symbol}', 'Q', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 71), -(58, 0, '', 'GYD', 2, ',', 'Guyanese dollar', '{sign}{number} {symbol}', 328, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 72), -(59, 0, '', 'HKD', 2, ',', 'Hong Kong dollar', '{sign}{number} {symbol}', 344, '{number} {symbol}', '元', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 13), -(60, 0, '', 'HNL', 2, ',', 'Honduran lempira', '{sign}{number} {symbol}', 340, '{number} {symbol}', 'L', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 73), -(61, 0, '', 'HRK', 2, ',', 'Croatian kuna', '{sign}{number} {symbol}', 191, '{number} {symbol}', 'kn', '.', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 74), -(62, 0, '', 'HTG', 2, ',', 'Haitian gourde', '{sign}{number} {symbol}', 332, '{number} {symbol}', 'G', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 75), -(63, 0, '', 'HUF', 2, ',', 'Hungarian forint', '{sign}{number} {symbol}', 348, '{number} {symbol}', 'Ft', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 76), -(64, 0, '', 'IDR', 0, '', 'Indonesian rupiah', '{symbol}{sign}{number}', 360, '{symbol}{number}', 'Rp', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 77), -(65, 0, '', 'ILS', 2, ',', 'Israeli new sheqel', '{sign}{number} {symbol}', 376, '{number} {symbol}', '₪', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 20), -(66, 0, '', 'INR', 2, ',', 'Indian rupee', '{sign}{number} {symbol}', 356, '{number} {symbol}', '₨', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 16), -(67, 0, '', 'IQD', 0, '', 'Iraqi dinar', '{sign}{number} {symbol}', 368, '{number} {symbol}', 'ع.د', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 78), -(68, 0, '', 'IRR', 2, ',', 'Iranian rial', '{sign}{number}{symb0l}', 364, '{number} {symbol}', '﷼', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 79), -(69, 0, '', 'ISK', 2, ',', 'Icelandic króna', '{sign}{number} {symbol}', 352, '{number} {symbol}', 'kr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 80), -(70, 0, '', 'JMD', 2, ',', 'Jamaican dollar', '{sign}{number} {symbol}', 388, '{number} {symbol}', 'J$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 81), -(71, 0, '', 'JOD', 2, ',', 'Jordanian dinar', '{sign}{number} {symbol}', 400, '{number} {symbol}', 'د.ا', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 82), -(72, 0, '', 'JPY', 2, ',', 'Japanese yen', '{sign}{number} {symbol}', 392, '{number} {symbol}', '¥', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 3), -(73, 0, '', 'KES', 2, ',', 'Kenyan shilling', '{sign}{number} {symbol}', 404, '{number} {symbol}', 'Sh', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 83), -(74, 0, '', 'KGS', 2, ',', 'Kyrgyzstani som', '{sign}{number} {symbol}', 417, '{number} {symbol}', 'лв', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 84), -(75, 0, '', 'KHR', 2, ',', 'Cambodian riel', '{sign}{number} {symbol}', 116, '{number} {symbol}', '៛', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 85), -(76, 0, '', 'KMF', 0, '', 'Comorian franc', '{sign}{number} {symbol}', 174, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 86), -(77, 0, '', 'KPW', 0, '', 'North Korean won', '{sign}{number} {symbol}', 408, '{number} {symbol}', '₩', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 87), -(78, 0, '', 'KRW', 0, '', 'South Korean won', '{sign}{number} {symbol}', 410, '{number} {symbol}', '₩', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 21), -(79, 0, '', 'KWD', 2, ',', 'Kuwaiti dinar', '{sign}{number} {symbol}', 414, '{number} {symbol}', 'د.ك', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 88), -(80, 0, '', 'KYD', 2, ',', 'Cayman Islands dollar', '{sign}{number} {symbol}', 136, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 89), -(81, 0, '', 'KZT', 2, ',', 'Kazakhstani tenge', '{sign}{number} {symbol}', 398, '{number} {symbol}', 'лв', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 90), -(82, 0, '', 'LAK', 0, '', 'Lao kip', '{sign}{number} {symbol}', 418, '{number} {symbol}', '₭', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 91), -(83, 0, '', 'LBP', 0, '', 'Lebanese pound', '{sign}{number} {symbol}', 422, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 92), -(84, 0, '', 'LKR', 2, ',', 'Sri Lankan rupee', '{sign}{number} {symbol}', 144, '{number} {symbol}', '₨', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 93), -(85, 0, '', 'LRD', 2, ',', 'Liberian dollar', '{sign}{number} {symbol}', 430, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 94), -(86, 0, '', 'LSL', 2, ',', 'Lesotho loti', '{sign}{number} {symbol}', 426, '{number} {symbol}', 'L', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 95), -(87, 0, '', 'LTL', 2, ',', 'Lithuanian litas', '{sign}{number} {symbol}', 440, '{number} {symbol}', 'Lt', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 96), -(88, 0, '', 'LVL', 2, ',', 'Latvian lats', '{sign}{number} {symbol}', 428, '{number} {symbol}', 'Ls', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 97), -(89, 0, '', 'LYD', 3, ',', 'Libyan dinar', '{sign}{number} {symbol}', 434, '{number} {symbol}', 'ل.د', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 98), -(90, 0, '', 'MAD', 2, ',', 'Moroccan dirham', '{sign}{number} {symbol}', 504, '{number} {symbol}', 'د.م.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 99), -(91, 0, '', 'MDL', 2, ',', 'Moldovan leu', '{sign}{number} {symbol}', 498, '{number} {symbol}', 'L', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 100), -(92, 0, '', 'MGA', 2, ',', 'Malagasy ariary', '{sign}{number} {symbol}', 969, '{number} {symbol}', 'MGA', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 101), -(93, 0, '', 'MKD', 2, ',', 'Macedonian denar', '{sign}{number} {symbol}', 807, '{number} {symbol}', 'ден', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 102), -(94, 0, '', 'MMK', 2, ',', 'Myanmar kyat', '{symbol} {sign}{number}', 104, '{number} {symbol}', 'K', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 103), -(95, 0, '', 'MNT', 2, ',', 'Mongolian tögrög', '{sign}{number} {symbol}', 496, '{number} {symbol}', '₮', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 104), -(96, 0, '', 'MOP', 1, ',', 'Macanese pataca', '{symbol}{sign}{number}', 446, '{symbol}{number}', 'P', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 105), -(97, 0, '', 'MRO', 2, ',', 'Mauritanian ouguiya', '{sign}{number} {symbol}', 478, '{number} {symbol}', 'UM', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 106), -(98, 0, '', 'MUR', 2, ',', 'Mauritian rupee', '{sign}{number} {symbol}', 480, '{number} {symbol}', '₨', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 107), -(99, 0, '', 'MVR', 2, ',', 'Maldivian rufiyaa', '{sign}{number} {symbol}', 462, '{number} {symbol}', 'ރ.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 108), -(100, 0, '', 'MWK', 2, ',', 'Malawian kwacha', '{sign}{number} {symbol}', 454, '{number} {symbol}', 'MK', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 109), -(101, 0, '', 'MXN', 2, ',', 'Mexican peso', '{sign}{number} {symbol}', 484, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 8), -(102, 0, '', 'MXV', 2, ',', 'Mexican Unid', '{sign}{number} {symbol}', 979, '{number} {symbol}', 'MXV', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 110), -(103, 0, '', 'MYR', 2, ',', 'Malaysian ringgit', '{sign}{number} {symbol}', 458, '{number} {symbol}', 'RM', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 111), -(104, 0, '', 'MZN', 2, ',', 'Mozambican metical', '{sign}{number} {symbol}', 943, '{number} {symbol}', 'MT', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 112), -(105, 0, '', 'NAD', 2, ',', 'Namibian dollar', '{symbol} {sign}{number}', 516, '{symbol} {number}', 'N$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 113), -(106, 0, '', 'NGN', 2, ',', 'Nigerian naira', '{sign}{number} {symbol}', 566, '{number} {symbol}', '₦', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 114), -(107, 0, '', 'NIO', 2, ',', 'Nicaraguan córdoba', '{sign}{number} {symbol}', 558, '{number} {symbol}', 'C$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 115), -(108, 0, '', 'NOK', 2, ',', 'Norwegian krone', '{symbol}{sign}{number}', 578, '{symbol}{number}', 'kr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 18), -(109, 0, '', 'NPR', 2, ',', 'Nepalese rupee', '{sign}{number} {symbol}', 524, '{number} {symbol}', '₨', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 116), -(110, 0, '', 'NZD', 2, ',', 'New Zealand dollar', '{symbol}{sign}{number}', 554, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 10), -(111, 0, '', 'OMR', 3, '.', 'Omani rial', '{sign}{number} {symbol}', 512, '{number} {symbol}', '﷼', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 117), -(112, 0, '', 'PAB', 2, ',', 'Panamanian balboa', '{sign}{number} {symbol}', 590, '{number} {symbol}', 'B/.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 118), -(113, 0, '', 'PEN', 2, ',', 'Peruvian nuevo sol', '{sign}{number} {symbol}', 604, '{number} {symbol}', 'S/.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 119), -(114, 0, '', 'PGK', 2, ',', 'Papua New Guinean kina', '{sign}{number} {symbol}', 598, '{number} {symbol}', 'K', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 120), -(115, 0, '', 'PHP', 2, ',', 'Philippine peso', '{sign}{number} {symbol}', 608, '{number} {symbol}', '₱', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 121), -(116, 0, '', 'PKR', 2, ',', 'Pakistani rupee', '{sign}{number} {symbol}', 586, '{number} {symbol}', '₨', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 122), -(117, 0, '', 'PLN', 2, ',', 'Polish Złoty', '{sign}{number} {symbol}', 985, '{number} {symbol}', 'zł', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 123), -(118, 0, '', 'PYG', 0, '', 'Paraguayan guaraní', '{symbol} {sign}{number}', 600, '{symbol} {number}', '₲', '.', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 124), -(119, 0, '', 'QAR', 2, ',', 'Qatari riyal', '{sign}{number} {symbol}', 634, '{number} {symbol}', '﷼', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 125), -(120, 0, '', 'RON', 2, ',', 'Romanian leu', '{sign}{number} {symbol}', 946, '{number} {symbol}', 'lei', '.', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 126), -(121, 0, '', 'RWF', 2, ',', 'Rwandan franc', '{sign}{number} {symbol}', 646, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 128), -(122, 0, '', 'SAR', 2, ',', 'Saudi riyal', '{sign}{number} {symbol}', 682, '{number} {symbol}', '﷼', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 129), -(123, 0, '', 'SBD', 2, ',', 'Solomon Islands dollar', '{sign}{number} {symbol}', 90, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 130), -(124, 0, '', 'SCR', 2, ',', 'Seychellois rupee', '{sign}{number} {symbol}', 690, '{number} {symbol}', '₨', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 131), -(125, 0, '', 'SDG', 2, ',', 'Sudanese pound', '{sign}{number} {symbol}', 938, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 132), -(126, 0, '', 'SEK', 2, ',', 'Swedish krona', '{sign}{number} {symbol}', 752, '{number} {symbol}', 'kr', '.', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 11), -(127, 0, '', 'SGD', 2, ',', 'Singapore dollar', '{sign}{number} {symbol}', 702, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 14), -(128, 0, '', 'SHP', 2, ',', 'Saint Helenian pound', '{sign}{number} {symbol}', 654, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 133), -(129, 0, '', 'SLL', 2, ',', 'Sierra Leonean leone', '{sign}{number} {symbol}', 694, '{number} {symbol}', 'Le', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 134), -(130, 0, '', 'SOS', 2, ',', 'Somali shilling', '{sign}{number} {symbol}', 706, '{number} {symbol}', 'S', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 135), -(131, 0, '', 'SRD', 2, ',', 'Surinamese dollar', '{sign}{number} {symbol}', 968, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 136), -(132, 0, '', 'STD', 0, '', 'São Tomé and Príncipe dobra', '{sign}{number} {symbol}', 678, '{number} {symbol}', 'Db', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 137), -(133, 0, '', 'RUB', 2, ',', 'Russian ruble', '{sign}{number} {symbol}', 643, '{number} {symbol}', 'руб', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 12), -(134, 0, '', 'SVC', 2, ',', 'Salvadoran colón', '{sign}{number} {symbol}', 222, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 138), -(135, 0, '', 'SYP', 2, ',', 'Syrian pound', '{sign}{number} {symbol}', 760, '{number} {symbol}', '£', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 139), -(136, 0, '', 'SZL', 2, ',', 'Swazi lilangeni', '{sign}{number} {symbol}', 748, '{number} {symbol}', 'L', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 140), -(137, 0, '', 'THB', 2, ',', 'Thai baht', '{sign}{number} {symbol}', 764, '{number} {symbol}', '฿', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 141), -(138, 0, '', 'TJS', 2, ',', 'Tajikistani somoni', '{sign}{number} {symbol}', 972, '{number} {symbol}', 'ЅМ', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 142), -(139, 0, '', 'TND', 3, ',', 'Tunisian dinar', '{sign}{number} {symbol}', 788, '{number} {symbol}', 'د.ت', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 143), -(140, 0, '', 'TOP', 2, ',', 'Tongan paʻanga', '{sign}{number} {symbol}', 776, '{number} {symbol}', 'T$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 144), -(141, 0, '', 'TRY', 2, ',', 'Turkish new lira', '{sign}{number} {symbol}', 949, '{number} {symbol}', 'YTL', '.', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 15), -(142, 0, '', 'TTD', 2, ',', 'Trinidad and Tobago dollar', '{sign}{number} {symbol}', 780, '{number} {symbol}', 'TT$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 145), -(143, 0, '', 'TWD', 2, ',', 'New Taiwan dollar', '{sign}{number} {symbol}', 901, '{number} {symbol}', 'NT$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 146), -(144, 0, '', 'TZS', 2, ',', 'Tanzanian shilling', '{sign}{number} {symbol}', 834, '{number} {symbol}', 'Sh', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 147), -(145, 0, '', 'UAH', 2, ',', 'Ukrainian hryvnia', '{sign}{number} {symbol}', 980, '{number} {symbol}', '₴', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 148), -(146, 0, '', 'UGX', 2, ',', 'Ugandan shilling', '{sign}{number} {symbol}', 800, '{number} {symbol}', 'Sh', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 149), -(147, 0, '', 'USD', 2, '.', 'United States dollar', '{symbol}{sign}{number}', 840, '{symbol}{number}', '$', ',', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 1), -(148, 0, '', 'UYI', 2, ',', 'Uruguay Peso', '{sign}{number} {symbol}', 940, '{number} {symbol}', 'UYI', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 150), -(149, 0, '', 'UYU', 0, '', 'Uruguayan peso', '{symbol}{sign}{number}', 858, '{symbol} {number}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 151), -(150, 0, '', 'UZS', 2, ',', 'Uzbekistani som', '{sign}{number} {symbol}', 860, '{number} {symbol}', 'лв', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 152), -(151, 0, '', 'VEF', 2, ',', 'Venezuelan bolívar', '{sign}{number} {symbol}', 937, '{number} {symbol}', 'Bs', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 153), -(152, 0, '', 'VND', 0, '', 'Vietnamese Dong', '{sign}{number} {symbol}', 704, '{number} {symbol}', '₫', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 154), -(153, 0, '', 'VUV', 2, ',', 'Vanuatu vatu', '{sign}{number} {symbol}', 548, '{number} {symbol}', 'Vt', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 155), -(154, 0, '', 'WST', 2, ',', 'Samoan tala', '{sign}{number} {symbol}', 882, '{number} {symbol}', 'T', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 156), -(155, 0, '', 'XAF', 0, '', 'Central African CFA franc', '{sign}{number} {symbol}', 950, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 157), -(156, 0, '', 'XCD', 2, ',', 'East Caribbean dollar', '{sign}{number} {symbol}', 951, '{number} {symbol}', '$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 158), -(157, 0, '', 'XOF', 2, ',', 'West African CFA franc', '{sign}{number} {symbol}', 952, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 159), -(158, 0, '', 'XPF', 2, ',', 'CFP franc', '{sign}{number} {symbol}', 953, '{number} {symbol}', 'Fr', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 160), -(159, 0, '', 'YER', 2, ',', 'Yemeni rial', '{sign}{number} {symbol}', 886, '{number} {symbol}', '﷼', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 161), -(160, 0, '', 'RSD', 2, ',', 'Serbian dinar', '{sign}{number} {symbol}', 941, '{number} {symbol}', 'Дин.', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 127), -(161, 3022, 'south-african-rand', 'ZAR', 2, ',', 'South African rand', '{symbol} {sign}{number}', 710, '{symbol} {number}', 'R', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 2, 0, 5, 22), -(162, 0, '', 'ZMK', 2, ',', 'Zambian kwacha', '{sign}{number} {symbol}', 894, '{number} {symbol}', 'ZK', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 162), -(163, 0, '', 'ZWD', 2, ',', 'Zimbabwean dollar', '{sign}{number} {symbol}', 932, '{number} {symbol}', 'Z$', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 163), -(164, 0, '', 'ZZZ', 2, ',', 'Reserved', '', 0, '', 'O', '', '', 1, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0, '0000-00-00 00:00:00', 1, 0, 0, 164); - -- diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index bc7f569..4bd0949 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -1,5 +1,2 @@ DROP TABLE IF EXISTS `#__membersmanager_member`; DROP TABLE IF EXISTS `#__membersmanager_type`; -DROP TABLE IF EXISTS `#__membersmanager_region`; -DROP TABLE IF EXISTS `#__membersmanager_country`; -DROP TABLE IF EXISTS `#__membersmanager_currency`; diff --git a/admin/sql/updates/mysql/1.0.11.sql b/admin/sql/updates/mysql/1.0.11.sql new file mode 100644 index 0000000..9b70576 --- /dev/null +++ b/admin/sql/updates/mysql/1.0.11.sql @@ -0,0 +1,5 @@ +ALTER TABLE `#__membersmanager_member` ADD `password` VARCHAR(255) NOT NULL DEFAULT '' AFTER `name`; + +ALTER TABLE `#__membersmanager_member` ADD `password_check` VARCHAR(255) NOT NULL DEFAULT '' AFTER `password`; + +ALTER TABLE `#__membersmanager_member` ADD `surname` CHAR(255) NOT NULL DEFAULT '' AFTER `profile_image`; diff --git a/admin/sql/updates/mysql/1.0.12.sql b/admin/sql/updates/mysql/1.0.12.sql new file mode 100644 index 0000000..1c514c7 --- /dev/null +++ b/admin/sql/updates/mysql/1.0.12.sql @@ -0,0 +1 @@ +ALTER TABLE `#__membersmanager_member` ADD `username` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`; diff --git a/admin/sql/updates/mysql/1.0.13.sql b/admin/sql/updates/mysql/1.0.13.sql new file mode 100644 index 0000000..139ddba --- /dev/null +++ b/admin/sql/updates/mysql/1.0.13.sql @@ -0,0 +1 @@ +ALTER TABLE `#__membersmanager_member` ADD `useremail` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`; diff --git a/admin/sql/updates/mysql/1.0.3.sql b/admin/sql/updates/mysql/1.0.3.sql index db444ec..33e8f0f 100644 --- a/admin/sql/updates/mysql/1.0.3.sql +++ b/admin/sql/updates/mysql/1.0.3.sql @@ -1,5 +1,5 @@ -ALTER TABLE `#__membersmanager_member` ADD `email` VARCHAR(255) NOT NULL DEFAULT '' AFTER `country`; +ALTER TABLE `#__membersmanager_member` ADD `email` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`; ALTER TABLE `#__membersmanager_member` ADD `main_member` INT(11) NOT NULL DEFAULT 0 AFTER `email`; -ALTER TABLE `#__membersmanager_member` ADD `name` VARCHAR(255) NOT NULL DEFAULT '' AFTER `mobile_phone`; +ALTER TABLE `#__membersmanager_member` ADD `name` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`; diff --git a/admin/sql/updates/mysql/1.0.4.sql b/admin/sql/updates/mysql/1.0.4.sql index 66ce8d3..aae3708 100644 --- a/admin/sql/updates/mysql/1.0.4.sql +++ b/admin/sql/updates/mysql/1.0.4.sql @@ -1 +1 @@ -ALTER TABLE `#__membersmanager_member` ADD `profile_image` TEXT NOT NULL AFTER `postalcode`; +ALTER TABLE `#__membersmanager_member` ADD `profile_image` TEXT NOT NULL AFTER `user`; diff --git a/admin/sql/updates/mysql/1.0.5.sql b/admin/sql/updates/mysql/1.0.5.sql deleted file mode 100644 index 6b2eda7..0000000 --- a/admin/sql/updates/mysql/1.0.5.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE `#__membersmanager_member` ADD `landline_phone` VARCHAR(64) NOT NULL DEFAULT '' AFTER `email`; diff --git a/admin/sql/updates/mysql/1.0.6.sql b/admin/sql/updates/mysql/1.0.6.sql index eff75cf..7ddda8d 100644 --- a/admin/sql/updates/mysql/1.0.6.sql +++ b/admin/sql/updates/mysql/1.0.6.sql @@ -1 +1 @@ -ALTER TABLE `#__membersmanager_member` ADD `token` VARCHAR(255) NOT NULL DEFAULT '' AFTER `street`; +ALTER TABLE `#__membersmanager_member` ADD `token` VARCHAR(255) NOT NULL DEFAULT '' AFTER `user`; diff --git a/admin/sql/updates/mysql/1.0.7.sql b/admin/sql/updates/mysql/1.0.7.sql new file mode 100644 index 0000000..6b5b400 --- /dev/null +++ b/admin/sql/updates/mysql/1.0.7.sql @@ -0,0 +1,3 @@ +ALTER TABLE `#__membersmanager_type` ADD `groups_access` TEXT NOT NULL AFTER `description`; + +ALTER TABLE `#__membersmanager_type` ADD `groups_target` TEXT NOT NULL AFTER `groups_access`; diff --git a/admin/tables/country.php b/admin/tables/country.php deleted file mode 100644 index 089e60e..0000000 --- a/admin/tables/country.php +++ /dev/null @@ -1,334 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; - -// import Joomla table library -jimport('joomla.database.table'); - -/** - * Countries Table class - */ -class MembersmanagerTableCountry extends JTable -{ - /** - * Ensure the params and metadata in json encoded in the bind method - * - * @var array - * @since 3.3 - */ - protected $_jsonEncode = array('params', 'metadata'); - - /** - * Constructor - * - * @param object Database connector object - */ - function __construct(&$db) - { - parent::__construct('#__membersmanager_country', 'id', $db); - } - - public function bind($array, $ignore = '') - { - - if (isset($array['params']) && is_array($array['params'])) - { - $registry = new JRegistry; - $registry->loadArray($array['params']); - $array['params'] = (string) $registry; - } - - if (isset($array['metadata']) && is_array($array['metadata'])) - { - $registry = new JRegistry; - $registry->loadArray($array['metadata']); - $array['metadata'] = (string) $registry; - } - - // Bind the rules. - if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); - } - return parent::bind($array, $ignore); - } - - /** - * Overload the store method for the Country table. - * - * @param boolean Toggle whether null values should be updated. - * @return boolean True on success, false on failure. - * @since 1.6 - */ - public function store($updateNulls = false) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if ($this->id) - { - // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); - } - else - { - // New country. A country created and created_by field can be set by the user, - // so we don't touch either of these if they are set. - if (!(int) $this->created) - { - $this->created = $date->toSql(); - } - if (empty($this->created_by)) - { - $this->created_by = $user->get('id'); - } - } - - if (isset($this->alias)) - { - // Verify that the alias is unique - $table = JTable::getInstance('country', 'MembersmanagerTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_MEMBERSMANAGER_COUNTRY_ERROR_UNIQUE_ALIAS')); - return false; - } - } - - if (isset($this->url)) - { - // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); - } - if (isset($this->website)) - { - // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); - } - - return parent::store($updateNulls); - } - - /** - * Overloaded check method to ensure data integrity. - * - * @return boolean True on success. - */ - public function check() - { - if (isset($this->alias)) - { - // Generate a valid alias - $this->generateAlias(); - - $table = JTable::getInstance('country', 'membersmanagerTable'); - - while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->alias = JString::increment($this->alias, 'dash'); - } - } - - /* - * Clean up keywords -- eliminate extra spaces between phrases - * and cr (\r) and lf (\n) characters from string. - * Only process if not empty. - */ - if (!empty($this->metakey)) - { - // Array of characters to remove. - $bad_characters = array("\n", "\r", "\"", "<", ">"); - - // Remove bad characters. - $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); - - // Create array using commas as delimiter. - $keys = explode(',', $after_clean); - $clean_keys = array(); - - foreach ($keys as $key) - { - // Ignore blank keywords. - if (trim($key)) - { - $clean_keys[] = trim($key); - } - } - - // Put array back together delimited by ", " - $this->metakey = implode(", ", $clean_keys); - } - - // Clean up description -- eliminate quotes and <> brackets - if (!empty($this->metadesc)) - { - // Only process if not empty - $bad_characters = array("\"", "<", ">"); - $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); - } - - // If we don't have any access rules set at this point just use an empty JAccessRules class - if (!$this->getRules()) - { - $rules = $this->getDefaultAssetValues('com_membersmanager.country.'.$this->id); - $this->setRules($rules); - } - - // Set ordering - if ($this->published < 0) - { - // Set ordering to 0 if state is archived or trashed - $this->ordering = 0; - } - - return true; - } - - /** - * Gets the default asset values for a component. - * - * @param $string $component The component asset name to search for - * - * @return JAccessRules The JAccessRules object for the asset - */ - protected function getDefaultAssetValues($component, $try = true) - { - // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('id')) - ->from($db->quoteName('#__assets')) - ->where($db->quoteName('name') . ' = ' . $db->quote($component)); - $db->setQuery($query); - $db->execute(); - if ($db->loadRowList()) - { - // asset alread set so use saved rules - $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); - } - // try again - elseif ($try) - { - $try = explode('.',$component); - $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) - { - if (isset($try[1])) - { - $_result = (string) $result; - $_result = json_decode($_result); - foreach ($_result as $name => &$rule) - { - $v = explode('.', $name); - if ($try[1] !== $v[0]) - { - // remove since it is not part of this view - unset($_result->$name); - } - else - { - // clear the value since we inherit - $rule = array(); - } - } - // check if there are any view values remaining - if (count( (array) $_result)) - { - $_result = json_encode($_result); - $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; - $rules->mergeCollection($_result); - - return $rules; - } - } - return $result; - } - } - return JAccess::getAssetRules(0); - } - - /** - * Method to compute the default name of the asset. - * The default name is in the form 'table_name.id' - * where id is the value of the primary key of the table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetName() - { - $k = $this->_tbl_key; - return 'com_membersmanager.country.'.(int) $this->$k; - } - - /** - * Method to return the title to use for the asset table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetTitle() - { - if (isset($this->title)) - { - return $this->title; - } - return ''; - } - - /** - * Get the parent asset id for the record - * - * @return int - * @since 2.5 - */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) - { - $asset = JTable::getInstance('Asset'); - $asset->loadByName('com_membersmanager'); - - return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); - } - - return $this->alias; - } - -} diff --git a/admin/tables/currency.php b/admin/tables/currency.php deleted file mode 100644 index 1b7dac9..0000000 --- a/admin/tables/currency.php +++ /dev/null @@ -1,334 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; - -// import Joomla table library -jimport('joomla.database.table'); - -/** - * Currencies Table class - */ -class MembersmanagerTableCurrency extends JTable -{ - /** - * Ensure the params and metadata in json encoded in the bind method - * - * @var array - * @since 3.3 - */ - protected $_jsonEncode = array('params', 'metadata'); - - /** - * Constructor - * - * @param object Database connector object - */ - function __construct(&$db) - { - parent::__construct('#__membersmanager_currency', 'id', $db); - } - - public function bind($array, $ignore = '') - { - - if (isset($array['params']) && is_array($array['params'])) - { - $registry = new JRegistry; - $registry->loadArray($array['params']); - $array['params'] = (string) $registry; - } - - if (isset($array['metadata']) && is_array($array['metadata'])) - { - $registry = new JRegistry; - $registry->loadArray($array['metadata']); - $array['metadata'] = (string) $registry; - } - - // Bind the rules. - if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); - } - return parent::bind($array, $ignore); - } - - /** - * Overload the store method for the Currency table. - * - * @param boolean Toggle whether null values should be updated. - * @return boolean True on success, false on failure. - * @since 1.6 - */ - public function store($updateNulls = false) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if ($this->id) - { - // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); - } - else - { - // New currency. A currency created and created_by field can be set by the user, - // so we don't touch either of these if they are set. - if (!(int) $this->created) - { - $this->created = $date->toSql(); - } - if (empty($this->created_by)) - { - $this->created_by = $user->get('id'); - } - } - - if (isset($this->alias)) - { - // Verify that the alias is unique - $table = JTable::getInstance('currency', 'MembersmanagerTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_MEMBERSMANAGER_CURRENCY_ERROR_UNIQUE_ALIAS')); - return false; - } - } - - if (isset($this->url)) - { - // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); - } - if (isset($this->website)) - { - // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); - } - - return parent::store($updateNulls); - } - - /** - * Overloaded check method to ensure data integrity. - * - * @return boolean True on success. - */ - public function check() - { - if (isset($this->alias)) - { - // Generate a valid alias - $this->generateAlias(); - - $table = JTable::getInstance('currency', 'membersmanagerTable'); - - while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->alias = JString::increment($this->alias, 'dash'); - } - } - - /* - * Clean up keywords -- eliminate extra spaces between phrases - * and cr (\r) and lf (\n) characters from string. - * Only process if not empty. - */ - if (!empty($this->metakey)) - { - // Array of characters to remove. - $bad_characters = array("\n", "\r", "\"", "<", ">"); - - // Remove bad characters. - $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); - - // Create array using commas as delimiter. - $keys = explode(',', $after_clean); - $clean_keys = array(); - - foreach ($keys as $key) - { - // Ignore blank keywords. - if (trim($key)) - { - $clean_keys[] = trim($key); - } - } - - // Put array back together delimited by ", " - $this->metakey = implode(", ", $clean_keys); - } - - // Clean up description -- eliminate quotes and <> brackets - if (!empty($this->metadesc)) - { - // Only process if not empty - $bad_characters = array("\"", "<", ">"); - $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); - } - - // If we don't have any access rules set at this point just use an empty JAccessRules class - if (!$this->getRules()) - { - $rules = $this->getDefaultAssetValues('com_membersmanager.currency.'.$this->id); - $this->setRules($rules); - } - - // Set ordering - if ($this->published < 0) - { - // Set ordering to 0 if state is archived or trashed - $this->ordering = 0; - } - - return true; - } - - /** - * Gets the default asset values for a component. - * - * @param $string $component The component asset name to search for - * - * @return JAccessRules The JAccessRules object for the asset - */ - protected function getDefaultAssetValues($component, $try = true) - { - // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('id')) - ->from($db->quoteName('#__assets')) - ->where($db->quoteName('name') . ' = ' . $db->quote($component)); - $db->setQuery($query); - $db->execute(); - if ($db->loadRowList()) - { - // asset alread set so use saved rules - $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); - } - // try again - elseif ($try) - { - $try = explode('.',$component); - $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) - { - if (isset($try[1])) - { - $_result = (string) $result; - $_result = json_decode($_result); - foreach ($_result as $name => &$rule) - { - $v = explode('.', $name); - if ($try[1] !== $v[0]) - { - // remove since it is not part of this view - unset($_result->$name); - } - else - { - // clear the value since we inherit - $rule = array(); - } - } - // check if there are any view values remaining - if (count( (array) $_result)) - { - $_result = json_encode($_result); - $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; - $rules->mergeCollection($_result); - - return $rules; - } - } - return $result; - } - } - return JAccess::getAssetRules(0); - } - - /** - * Method to compute the default name of the asset. - * The default name is in the form 'table_name.id' - * where id is the value of the primary key of the table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetName() - { - $k = $this->_tbl_key; - return 'com_membersmanager.currency.'.(int) $this->$k; - } - - /** - * Method to return the title to use for the asset table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetTitle() - { - if (isset($this->title)) - { - return $this->title; - } - return ''; - } - - /** - * Get the parent asset id for the record - * - * @return int - * @since 2.5 - */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) - { - $asset = JTable::getInstance('Asset'); - $asset->loadByName('com_membersmanager'); - - return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); - } - - return $this->alias; - } - -} diff --git a/admin/tables/member.php b/admin/tables/member.php index 0efe9e3..a14986e 100644 --- a/admin/tables/member.php +++ b/admin/tables/member.php @@ -14,9 +14,6 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\Registry\Registry; -// import Joomla table library -jimport('joomla.database.table'); - /** * Members Table class */ @@ -40,7 +37,7 @@ class MembersmanagerTableMember extends JTable parent::__construct('#__membersmanager_member', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.member')); + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.member')); } public function bind($array, $ignore = '') diff --git a/admin/tables/region.php b/admin/tables/region.php deleted file mode 100644 index 0172acb..0000000 --- a/admin/tables/region.php +++ /dev/null @@ -1,334 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -use Joomla\Registry\Registry; - -// import Joomla table library -jimport('joomla.database.table'); - -/** - * Regions Table class - */ -class MembersmanagerTableRegion extends JTable -{ - /** - * Ensure the params and metadata in json encoded in the bind method - * - * @var array - * @since 3.3 - */ - protected $_jsonEncode = array('params', 'metadata'); - - /** - * Constructor - * - * @param object Database connector object - */ - function __construct(&$db) - { - parent::__construct('#__membersmanager_region', 'id', $db); - } - - public function bind($array, $ignore = '') - { - - if (isset($array['params']) && is_array($array['params'])) - { - $registry = new JRegistry; - $registry->loadArray($array['params']); - $array['params'] = (string) $registry; - } - - if (isset($array['metadata']) && is_array($array['metadata'])) - { - $registry = new JRegistry; - $registry->loadArray($array['metadata']); - $array['metadata'] = (string) $registry; - } - - // Bind the rules. - if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); - } - return parent::bind($array, $ignore); - } - - /** - * Overload the store method for the Region table. - * - * @param boolean Toggle whether null values should be updated. - * @return boolean True on success, false on failure. - * @since 1.6 - */ - public function store($updateNulls = false) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if ($this->id) - { - // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); - } - else - { - // New region. A region created and created_by field can be set by the user, - // so we don't touch either of these if they are set. - if (!(int) $this->created) - { - $this->created = $date->toSql(); - } - if (empty($this->created_by)) - { - $this->created_by = $user->get('id'); - } - } - - if (isset($this->alias)) - { - // Verify that the alias is unique - $table = JTable::getInstance('region', 'MembersmanagerTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_MEMBERSMANAGER_REGION_ERROR_UNIQUE_ALIAS')); - return false; - } - } - - if (isset($this->url)) - { - // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); - } - if (isset($this->website)) - { - // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); - } - - return parent::store($updateNulls); - } - - /** - * Overloaded check method to ensure data integrity. - * - * @return boolean True on success. - */ - public function check() - { - if (isset($this->alias)) - { - // Generate a valid alias - $this->generateAlias(); - - $table = JTable::getInstance('region', 'membersmanagerTable'); - - while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->alias = JString::increment($this->alias, 'dash'); - } - } - - /* - * Clean up keywords -- eliminate extra spaces between phrases - * and cr (\r) and lf (\n) characters from string. - * Only process if not empty. - */ - if (!empty($this->metakey)) - { - // Array of characters to remove. - $bad_characters = array("\n", "\r", "\"", "<", ">"); - - // Remove bad characters. - $after_clean = JString::str_ireplace($bad_characters, "", $this->metakey); - - // Create array using commas as delimiter. - $keys = explode(',', $after_clean); - $clean_keys = array(); - - foreach ($keys as $key) - { - // Ignore blank keywords. - if (trim($key)) - { - $clean_keys[] = trim($key); - } - } - - // Put array back together delimited by ", " - $this->metakey = implode(", ", $clean_keys); - } - - // Clean up description -- eliminate quotes and <> brackets - if (!empty($this->metadesc)) - { - // Only process if not empty - $bad_characters = array("\"", "<", ">"); - $this->metadesc = JString::str_ireplace($bad_characters, "", $this->metadesc); - } - - // If we don't have any access rules set at this point just use an empty JAccessRules class - if (!$this->getRules()) - { - $rules = $this->getDefaultAssetValues('com_membersmanager.region.'.$this->id); - $this->setRules($rules); - } - - // Set ordering - if ($this->published < 0) - { - // Set ordering to 0 if state is archived or trashed - $this->ordering = 0; - } - - return true; - } - - /** - * Gets the default asset values for a component. - * - * @param $string $component The component asset name to search for - * - * @return JAccessRules The JAccessRules object for the asset - */ - protected function getDefaultAssetValues($component, $try = true) - { - // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('id')) - ->from($db->quoteName('#__assets')) - ->where($db->quoteName('name') . ' = ' . $db->quote($component)); - $db->setQuery($query); - $db->execute(); - if ($db->loadRowList()) - { - // asset alread set so use saved rules - $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); - } - // try again - elseif ($try) - { - $try = explode('.',$component); - $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) - { - if (isset($try[1])) - { - $_result = (string) $result; - $_result = json_decode($_result); - foreach ($_result as $name => &$rule) - { - $v = explode('.', $name); - if ($try[1] !== $v[0]) - { - // remove since it is not part of this view - unset($_result->$name); - } - else - { - // clear the value since we inherit - $rule = array(); - } - } - // check if there are any view values remaining - if (count( (array) $_result)) - { - $_result = json_encode($_result); - $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; - $rules->mergeCollection($_result); - - return $rules; - } - } - return $result; - } - } - return JAccess::getAssetRules(0); - } - - /** - * Method to compute the default name of the asset. - * The default name is in the form 'table_name.id' - * where id is the value of the primary key of the table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetName() - { - $k = $this->_tbl_key; - return 'com_membersmanager.region.'.(int) $this->$k; - } - - /** - * Method to return the title to use for the asset table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetTitle() - { - if (isset($this->title)) - { - return $this->title; - } - return ''; - } - - /** - * Get the parent asset id for the record - * - * @return int - * @since 2.5 - */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) - { - $asset = JTable::getInstance('Asset'); - $asset->loadByName('com_membersmanager'); - - return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); - } - - return $this->alias; - } - -} diff --git a/admin/tables/type.php b/admin/tables/type.php index fc403d9..e7c2c1e 100644 --- a/admin/tables/type.php +++ b/admin/tables/type.php @@ -14,9 +14,6 @@ defined('_JEXEC') or die('Restricted access'); use Joomla\Registry\Registry; -// import Joomla table library -jimport('joomla.database.table'); - /** * Types Table class */ @@ -40,7 +37,7 @@ class MembersmanagerTableType extends JTable parent::__construct('#__membersmanager_type', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.type')); + JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_membersmanager.type')); } public function bind($array, $ignore = '') diff --git a/admin/views/countries/index.html b/admin/views/countries/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/countries/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/countries/tmpl/default.php b/admin/views/countries/tmpl/default.php deleted file mode 100644 index e34f282..0000000 --- a/admin/views/countries/tmpl/default.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); - -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_membersmanager&task=countries.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'countryList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} - -?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_MEMBERSMANAGER_COUNTRIES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file diff --git a/admin/views/countries/tmpl/default_batch_body.php b/admin/views/countries/tmpl/default_batch_body.php deleted file mode 100644 index 5465e60..0000000 --- a/admin/views/countries/tmpl/default_batch_body.php +++ /dev/null @@ -1,18 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - -

-batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/countries/tmpl/default_batch_footer.php b/admin/views/countries/tmpl/default_batch_footer.php deleted file mode 100644 index 7ce48a8..0000000 --- a/admin/views/countries/tmpl/default_batch_footer.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - - - \ No newline at end of file diff --git a/admin/views/countries/tmpl/default_body.php b/admin/views/countries/tmpl/default_body.php deleted file mode 100644 index 5bfd7f0..0000000 --- a/admin/views/countries/tmpl/default_body.php +++ /dev/null @@ -1,112 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -$edit = "index.php?option=com_membersmanager&view=countries&task=country.edit"; - -?> -items as $i => $item): ?> - user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); - $canDo = MembersmanagerHelper::getActions('country',$item,'countries'); - ?> - - - get('country.edit.state')): ?> - saveOrder) - { - $iconClass = ' inactive'; - } - else - { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); - } - ?> - - - - saveOrder) : ?> - - - - ⋮ - - - - get('country.edit')): ?> - checked_out) : ?> - - id); ?> - - □ - - - id); ?> - - - □ - - - -
- get('country.edit')): ?> - escape($item->name); ?> - checked_out): ?> - name, $item->checked_out_time, 'countries.', $canCheckin); ?> - - - escape($item->name); ?> - -
- - -
- user->authorise('currency.edit', 'com_membersmanager.currency.' . (int)$item->currency)): ?> - escape($item->currency_name); ?> - - escape($item->currency_name); ?> - -
- - - escape($item->worldzone); ?> - - - escape($item->codethree); ?> - - - escape($item->codetwo); ?> - - - get('country.edit.state')) : ?> - checked_out) : ?> - - published, $i, 'countries.', true, 'cb'); ?> - - published, $i, 'countries.', false, 'cb'); ?> - - - published, $i, 'countries.', true, 'cb'); ?> - - - published, $i, 'countries.', false, 'cb'); ?> - - - - id; ?> - - - \ No newline at end of file diff --git a/admin/views/countries/tmpl/default_foot.php b/admin/views/countries/tmpl/default_foot.php deleted file mode 100644 index a39ea71..0000000 --- a/admin/views/countries/tmpl/default_foot.php +++ /dev/null @@ -1,18 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - pagination->getListFooter(); ?> - \ No newline at end of file diff --git a/admin/views/countries/tmpl/default_head.php b/admin/views/countries/tmpl/default_head.php deleted file mode 100644 index 5c88474..0000000 --- a/admin/views/countries/tmpl/default_head.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - canEdit&& $this->canState): ?> - - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> - - - - - - - ▾ - - - ■ - - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - canState): ?> - - listDirn, $this->listOrder); ?> - - - - - - - - listDirn, $this->listOrder); ?> - - \ No newline at end of file diff --git a/admin/views/countries/tmpl/default_toolbar.php b/admin/views/countries/tmpl/default_toolbar.php deleted file mode 100644 index 8a5130e..0000000 --- a/admin/views/countries/tmpl/default_toolbar.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> -
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
-
\ No newline at end of file diff --git a/admin/views/countries/tmpl/index.html b/admin/views/countries/tmpl/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/countries/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/countries/view.html.php b/admin/views/countries/view.html.php deleted file mode 100644 index cc1d73c..0000000 --- a/admin/views/countries/view.html.php +++ /dev/null @@ -1,318 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla view library -jimport('joomla.application.component.view'); - -/** - * Membersmanager View class for the Countries - */ -class MembersmanagerViewCountries extends JViewLegacy -{ - /** - * Countries view display method - * @return void - */ - function display($tpl = null) - { - if ($this->getLayout() !== 'modal') - { - // Include helper submenu - MembersmanagerHelper::addSubmenu('countries'); - } - - // Assign data to the view - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); - $this->user = JFactory::getUser(); - $this->listOrder = $this->escape($this->state->get('list.ordering')); - $this->listDirn = $this->escape($this->state->get('list.direction')); - $this->saveOrder = $this->listOrder == 'ordering'; - // get global action permissions - $this->canDo = MembersmanagerHelper::getActions('country'); - $this->canEdit = $this->canDo->get('country.edit'); - $this->canState = $this->canDo->get('country.edit.state'); - $this->canCreate = $this->canDo->get('country.create'); - $this->canDelete = $this->canDo->get('country.delete'); - $this->canBatch = $this->canDo->get('core.batch'); - - // We don't need toolbar in the modal window. - if ($this->getLayout() !== 'modal') - { - $this->addToolbar(); - $this->sidebar = JHtmlSidebar::render(); - // load the batch html - if ($this->canCreate && $this->canEdit && $this->canState) - { - $this->batchDisplay = JHtmlBatch_::render(); - } - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_COUNTRIES'), 'flag'); - JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=countries'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); - - if ($this->canCreate) - { - JToolBarHelper::addNew('country.add'); - } - - // Only load if there are items - if (MembersmanagerHelper::checkArray($this->items)) - { - if ($this->canEdit) - { - JToolBarHelper::editList('country.edit'); - } - - if ($this->canState) - { - JToolBarHelper::publishList('countries.publish'); - JToolBarHelper::unpublishList('countries.unpublish'); - JToolBarHelper::archiveList('countries.archive'); - - if ($this->canDo->get('core.admin')) - { - JToolBarHelper::checkin('countries.checkin'); - } - } - - // Add a batch button - if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) - { - // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); - // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); - // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); - // add the button to the page - $dhtml = $layout->render(array('title' => $title)); - $bar->appendButton('Custom', $dhtml, 'batch'); - } - - if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) - { - JToolbarHelper::deleteList('', 'countries.delete', 'JTOOLBAR_EMPTY_TRASH'); - } - elseif ($this->canState && $this->canDelete) - { - JToolbarHelper::trash('countries.trash'); - } - - if ($this->canDo->get('core.export') && $this->canDo->get('country.export')) - { - JToolBarHelper::custom('countries.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true); - } - } - - if ($this->canDo->get('core.import') && $this->canDo->get('country.import')) - { - JToolBarHelper::custom('countries.importData', 'upload', '', 'COM_MEMBERSMANAGER_IMPORT_DATA', false); - } - - // set help url for this view if found - $help_url = MembersmanagerHelper::getHelpUrl('countries'); - if (MembersmanagerHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url); - } - - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_membersmanager'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_MEMBERSMANAGER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_MEMBERSMANAGER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); - } - - // Set Currency Name Selection - $this->currencyNameOptions = JFormHelper::loadFieldType('Currency')->getOptions(); - if ($this->currencyNameOptions) - { - // Currency Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_COUNTRY_CURRENCY_LABEL').' -', - 'filter_currency', - JHtml::_('select.options', $this->currencyNameOptions, 'value', 'text', $this->state->get('filter.currency')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Currency Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_COUNTRY_CURRENCY_LABEL').' -', - 'batch[currency]', - JHtml::_('select.options', $this->currencyNameOptions, 'value', 'text') - ); - } - } - - // Set Worldzone Selection - $this->worldzoneOptions = $this->getTheWorldzoneSelections(); - if ($this->worldzoneOptions) - { - // Worldzone Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_LABEL').' -', - 'filter_worldzone', - JHtml::_('select.options', $this->worldzoneOptions, 'value', 'text', $this->state->get('filter.worldzone')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Worldzone Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_LABEL').' -', - 'batch[worldzone]', - JHtml::_('select.options', $this->worldzoneOptions, 'value', 'text') - ); - } - } - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_('COM_MEMBERSMANAGER_COUNTRIES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/countries.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 50) - { - // use the helper htmlEscape method instead and shorten the string - return MembersmanagerHelper::htmlEscape($var, $this->_charset, true); - } - // use the helper htmlEscape method instead. - return MembersmanagerHelper::htmlEscape($var, $this->_charset); - } - - /** - * Returns an array of fields the table can be sorted by - * - * @return array Array containing the field name to sort by as the key and display text as value - */ - protected function getSortFields() - { - return array( - 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_MEMBERSMANAGER_COUNTRY_NAME_LABEL'), - 'g.name' => JText::_('COM_MEMBERSMANAGER_COUNTRY_CURRENCY_LABEL'), - 'a.worldzone' => JText::_('COM_MEMBERSMANAGER_COUNTRY_WORLDZONE_LABEL'), - 'a.codethree' => JText::_('COM_MEMBERSMANAGER_COUNTRY_CODETHREE_LABEL'), - 'a.codetwo' => JText::_('COM_MEMBERSMANAGER_COUNTRY_CODETWO_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') - ); - } - - protected function getTheWorldzoneSelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('worldzone')); - $query->from($db->quoteName('#__membersmanager_country')); - $query->order($db->quoteName('worldzone') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - $results = array_unique($results); - $_filter = array(); - foreach ($results as $worldzone) - { - // Now add the worldzone and its text to the options array - $_filter[] = JHtml::_('select.option', $worldzone, $worldzone); - } - return $_filter; - } - return false; - } -} diff --git a/admin/views/country/submitbutton.js b/admin/views/country/submitbutton.js deleted file mode 100644 index 9c2ab4d..0000000 --- a/admin/views/country/submitbutton.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -Joomla.submitbutton = function(task) -{ - if (task == ''){ - return false; - } else { - var isValid=true; - var action = task.split('.'); - if (action[1] != 'cancel' && action[1] != 'close'){ - var forms = $$('form.form-validate'); - for (var i=0;i - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = JComponentHelper::getParams('com_membersmanager'); -?> - - - -
diff --git a/admin/views/country/tmpl/index.html b/admin/views/country/tmpl/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/country/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/country/view.html.php b/admin/views/country/view.html.php deleted file mode 100644 index df7bd4d..0000000 --- a/admin/views/country/view.html.php +++ /dev/null @@ -1,196 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla view library -jimport('joomla.application.component.view'); - -/** - * Country View class - */ -class MembersmanagerViewCountry extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // Assign the variables - $this->form = $this->get('Form'); - $this->item = $this->get('Item'); - $this->script = $this->get('Script'); - $this->state = $this->get('State'); - // get action permissions - $this->canDo = MembersmanagerHelper::getActions('country',$this->item); - // get input - $jinput = JFactory::getApplication()->input; - $this->ref = $jinput->get('ref', 0, 'word'); - $this->refid = $jinput->get('refid', 0, 'int'); - $this->referral = ''; - if ($this->refid) - { - // return to the item that refered to this item - $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; - } - elseif($this->ref) - { - // return to the list view that refered to this item - $this->referral = '&ref='.(string)$this->ref; - } - - // Get Linked view data - $this->vvzregions = $this->get('Vvzregions'); - - // Set the toolbar - $this->addToolBar(); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); - $userId = $user->id; - $isNew = $this->item->id == 0; - - JToolbarHelper::title( JText::_($isNew ? 'COM_MEMBERSMANAGER_COUNTRY_NEW' : 'COM_MEMBERSMANAGER_COUNTRY_EDIT'), 'pencil-2 article-add'); - // Built the actions for new and existing records. - if ($this->refid || $this->ref) - { - if ($this->canDo->get('country.create') && $isNew) - { - // We can create the record. - JToolBarHelper::save('country.save', 'JTOOLBAR_SAVE'); - } - elseif ($this->canDo->get('country.edit')) - { - // We can save the record. - JToolBarHelper::save('country.save', 'JTOOLBAR_SAVE'); - } - if ($isNew) - { - // Do not creat but cancel. - JToolBarHelper::cancel('country.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - // We can close it. - JToolBarHelper::cancel('country.cancel', 'JTOOLBAR_CLOSE'); - } - } - else - { - if ($isNew) - { - // For new records, check the create permission. - if ($this->canDo->get('country.create')) - { - JToolBarHelper::apply('country.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('country.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('country.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); - }; - JToolBarHelper::cancel('country.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - if ($this->canDo->get('country.edit')) - { - // We can save the new record - JToolBarHelper::apply('country.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('country.save', 'JTOOLBAR_SAVE'); - // We can save this record, but check the create permission to see - // if we can return to make a new one. - if ($this->canDo->get('country.create')) - { - JToolBarHelper::custom('country.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); - } - } - if ($this->canDo->get('country.create')) - { - JToolBarHelper::custom('country.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); - } - JToolBarHelper::cancel('country.cancel', 'JTOOLBAR_CLOSE'); - } - } - JToolbarHelper::divider(); - // set help url for this view if found - $help_url = MembersmanagerHelper::getHelpUrl('country'); - if (MembersmanagerHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url); - } - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 30) - { - // use the helper htmlEscape method instead and shorten the string - return MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return MembersmanagerHelper::htmlEscape($var, $this->_charset); - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_COUNTRY_NEW' : 'COM_MEMBERSMANAGER_COUNTRY_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/country.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - - // Add the CSS for Footable - $this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'); - $this->document->addStyleSheet(JURI::root() .'media/com_membersmanager/footable-v3/css/footable.standalone.min.css', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - // Add the JavaScript for Footable (adding all funtions) - $this->document->addScript(JURI::root() .'media/com_membersmanager/footable-v3/js/footable.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - - $footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('.footable').footable();});});"; - $this->document->addScriptDeclaration($footable); - - $this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_membersmanager/views/country/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} diff --git a/admin/views/currencies/index.html b/admin/views/currencies/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/currencies/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default.php b/admin/views/currencies/tmpl/default.php deleted file mode 100644 index 5543216..0000000 --- a/admin/views/currencies/tmpl/default.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); - -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_membersmanager&task=currencies.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'currencyList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} - -?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_MEMBERSMANAGER_CURRENCIES_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default_batch_body.php b/admin/views/currencies/tmpl/default_batch_body.php deleted file mode 100644 index bb39d9a..0000000 --- a/admin/views/currencies/tmpl/default_batch_body.php +++ /dev/null @@ -1,18 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - -

-batchDisplay; ?> \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default_batch_footer.php b/admin/views/currencies/tmpl/default_batch_footer.php deleted file mode 100644 index 81d72ab..0000000 --- a/admin/views/currencies/tmpl/default_batch_footer.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - - - \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default_body.php b/admin/views/currencies/tmpl/default_body.php deleted file mode 100644 index 006e1a6..0000000 --- a/admin/views/currencies/tmpl/default_body.php +++ /dev/null @@ -1,106 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -$edit = "index.php?option=com_membersmanager&view=currencies&task=currency.edit"; - -?> -items as $i => $item): ?> - user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); - $canDo = MembersmanagerHelper::getActions('currency',$item,'currencies'); - ?> - - - get('currency.edit.state')): ?> - saveOrder) - { - $iconClass = ' inactive'; - } - else - { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); - } - ?> - - - - saveOrder) : ?> - - - - ⋮ - - - - get('currency.edit')): ?> - checked_out) : ?> - - id); ?> - - □ - - - id); ?> - - - □ - - - -
- get('currency.edit')): ?> - escape($item->name); ?> - checked_out): ?> - name, $item->checked_out_time, 'currencies.', $canCheckin); ?> - - - escape($item->name); ?> - -
- - - escape($item->codethree); ?> - - - escape($item->numericcode); ?> - - - escape($item->symbol); ?> - - - escape($item->decimalplace); ?> - - - get('currency.edit.state')) : ?> - checked_out) : ?> - - published, $i, 'currencies.', true, 'cb'); ?> - - published, $i, 'currencies.', false, 'cb'); ?> - - - published, $i, 'currencies.', true, 'cb'); ?> - - - published, $i, 'currencies.', false, 'cb'); ?> - - - - id; ?> - - - \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default_foot.php b/admin/views/currencies/tmpl/default_foot.php deleted file mode 100644 index a39ea71..0000000 --- a/admin/views/currencies/tmpl/default_foot.php +++ /dev/null @@ -1,18 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - pagination->getListFooter(); ?> - \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default_head.php b/admin/views/currencies/tmpl/default_head.php deleted file mode 100644 index 4a40561..0000000 --- a/admin/views/currencies/tmpl/default_head.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - canEdit&& $this->canState): ?> - - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> - - - - - - - ▾ - - - ■ - - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - - - - - listDirn, $this->listOrder); ?> - - canState): ?> - - listDirn, $this->listOrder); ?> - - - - - - - - listDirn, $this->listOrder); ?> - - \ No newline at end of file diff --git a/admin/views/currencies/tmpl/default_toolbar.php b/admin/views/currencies/tmpl/default_toolbar.php deleted file mode 100644 index 40352f1..0000000 --- a/admin/views/currencies/tmpl/default_toolbar.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> -
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
-
\ No newline at end of file diff --git a/admin/views/currencies/tmpl/index.html b/admin/views/currencies/tmpl/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/currencies/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/currencies/view.html.php b/admin/views/currencies/view.html.php deleted file mode 100644 index 2b550f5..0000000 --- a/admin/views/currencies/view.html.php +++ /dev/null @@ -1,241 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla view library -jimport('joomla.application.component.view'); - -/** - * Membersmanager View class for the Currencies - */ -class MembersmanagerViewCurrencies extends JViewLegacy -{ - /** - * Currencies view display method - * @return void - */ - function display($tpl = null) - { - if ($this->getLayout() !== 'modal') - { - // Include helper submenu - MembersmanagerHelper::addSubmenu('currencies'); - } - - // Assign data to the view - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); - $this->user = JFactory::getUser(); - $this->listOrder = $this->escape($this->state->get('list.ordering')); - $this->listDirn = $this->escape($this->state->get('list.direction')); - $this->saveOrder = $this->listOrder == 'ordering'; - // get global action permissions - $this->canDo = MembersmanagerHelper::getActions('currency'); - $this->canEdit = $this->canDo->get('currency.edit'); - $this->canState = $this->canDo->get('currency.edit.state'); - $this->canCreate = $this->canDo->get('currency.create'); - $this->canDelete = $this->canDo->get('currency.delete'); - $this->canBatch = $this->canDo->get('core.batch'); - - // We don't need toolbar in the modal window. - if ($this->getLayout() !== 'modal') - { - $this->addToolbar(); - $this->sidebar = JHtmlSidebar::render(); - // load the batch html - if ($this->canCreate && $this->canEdit && $this->canState) - { - $this->batchDisplay = JHtmlBatch_::render(); - } - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_CURRENCIES'), 'credit'); - JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=currencies'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); - - if ($this->canCreate) - { - JToolBarHelper::addNew('currency.add'); - } - - // Only load if there are items - if (MembersmanagerHelper::checkArray($this->items)) - { - if ($this->canEdit) - { - JToolBarHelper::editList('currency.edit'); - } - - if ($this->canState) - { - JToolBarHelper::publishList('currencies.publish'); - JToolBarHelper::unpublishList('currencies.unpublish'); - JToolBarHelper::archiveList('currencies.archive'); - - if ($this->canDo->get('core.admin')) - { - JToolBarHelper::checkin('currencies.checkin'); - } - } - - // Add a batch button - if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) - { - // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); - // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); - // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); - // add the button to the page - $dhtml = $layout->render(array('title' => $title)); - $bar->appendButton('Custom', $dhtml, 'batch'); - } - - if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) - { - JToolbarHelper::deleteList('', 'currencies.delete', 'JTOOLBAR_EMPTY_TRASH'); - } - elseif ($this->canState && $this->canDelete) - { - JToolbarHelper::trash('currencies.trash'); - } - - if ($this->canDo->get('core.export') && $this->canDo->get('currency.export')) - { - JToolBarHelper::custom('currencies.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true); - } - } - - if ($this->canDo->get('core.import') && $this->canDo->get('currency.import')) - { - JToolBarHelper::custom('currencies.importData', 'upload', '', 'COM_MEMBERSMANAGER_IMPORT_DATA', false); - } - - // set help url for this view if found - $help_url = MembersmanagerHelper::getHelpUrl('currencies'); - if (MembersmanagerHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url); - } - - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_membersmanager'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_MEMBERSMANAGER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_MEMBERSMANAGER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); - } - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_('COM_MEMBERSMANAGER_CURRENCIES')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/currencies.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 50) - { - // use the helper htmlEscape method instead and shorten the string - return MembersmanagerHelper::htmlEscape($var, $this->_charset, true); - } - // use the helper htmlEscape method instead. - return MembersmanagerHelper::htmlEscape($var, $this->_charset); - } - - /** - * Returns an array of fields the table can be sorted by - * - * @return array Array containing the field name to sort by as the key and display text as value - */ - protected function getSortFields() - { - return array( - 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_MEMBERSMANAGER_CURRENCY_NAME_LABEL'), - 'a.codethree' => JText::_('COM_MEMBERSMANAGER_CURRENCY_CODETHREE_LABEL'), - 'a.numericcode' => JText::_('COM_MEMBERSMANAGER_CURRENCY_NUMERICCODE_LABEL'), - 'a.decimalplace' => JText::_('COM_MEMBERSMANAGER_CURRENCY_DECIMALPLACE_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') - ); - } -} diff --git a/admin/views/currency/submitbutton.js b/admin/views/currency/submitbutton.js deleted file mode 100644 index 019b66a..0000000 --- a/admin/views/currency/submitbutton.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -Joomla.submitbutton = function(task) -{ - if (task == ''){ - return false; - } else { - var isValid=true; - var action = task.split('.'); - if (action[1] != 'cancel' && action[1] != 'close'){ - var forms = $$('form.form-validate'); - for (var i=0;i - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = JComponentHelper::getParams('com_membersmanager'); -?> - - - -
diff --git a/admin/views/currency/tmpl/index.html b/admin/views/currency/tmpl/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/currency/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/currency/view.html.php b/admin/views/currency/view.html.php deleted file mode 100644 index 7c336e6..0000000 --- a/admin/views/currency/view.html.php +++ /dev/null @@ -1,183 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla view library -jimport('joomla.application.component.view'); - -/** - * Currency View class - */ -class MembersmanagerViewCurrency extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // Assign the variables - $this->form = $this->get('Form'); - $this->item = $this->get('Item'); - $this->script = $this->get('Script'); - $this->state = $this->get('State'); - // get action permissions - $this->canDo = MembersmanagerHelper::getActions('currency',$this->item); - // get input - $jinput = JFactory::getApplication()->input; - $this->ref = $jinput->get('ref', 0, 'word'); - $this->refid = $jinput->get('refid', 0, 'int'); - $this->referral = ''; - if ($this->refid) - { - // return to the item that refered to this item - $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; - } - elseif($this->ref) - { - // return to the list view that refered to this item - $this->referral = '&ref='.(string)$this->ref; - } - - // Set the toolbar - $this->addToolBar(); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); - $userId = $user->id; - $isNew = $this->item->id == 0; - - JToolbarHelper::title( JText::_($isNew ? 'COM_MEMBERSMANAGER_CURRENCY_NEW' : 'COM_MEMBERSMANAGER_CURRENCY_EDIT'), 'pencil-2 article-add'); - // Built the actions for new and existing records. - if ($this->refid || $this->ref) - { - if ($this->canDo->get('currency.create') && $isNew) - { - // We can create the record. - JToolBarHelper::save('currency.save', 'JTOOLBAR_SAVE'); - } - elseif ($this->canDo->get('currency.edit')) - { - // We can save the record. - JToolBarHelper::save('currency.save', 'JTOOLBAR_SAVE'); - } - if ($isNew) - { - // Do not creat but cancel. - JToolBarHelper::cancel('currency.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - // We can close it. - JToolBarHelper::cancel('currency.cancel', 'JTOOLBAR_CLOSE'); - } - } - else - { - if ($isNew) - { - // For new records, check the create permission. - if ($this->canDo->get('currency.create')) - { - JToolBarHelper::apply('currency.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('currency.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('currency.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); - }; - JToolBarHelper::cancel('currency.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - if ($this->canDo->get('currency.edit')) - { - // We can save the new record - JToolBarHelper::apply('currency.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('currency.save', 'JTOOLBAR_SAVE'); - // We can save this record, but check the create permission to see - // if we can return to make a new one. - if ($this->canDo->get('currency.create')) - { - JToolBarHelper::custom('currency.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); - } - } - if ($this->canDo->get('currency.create')) - { - JToolBarHelper::custom('currency.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); - } - JToolBarHelper::cancel('currency.cancel', 'JTOOLBAR_CLOSE'); - } - } - JToolbarHelper::divider(); - // set help url for this view if found - $help_url = MembersmanagerHelper::getHelpUrl('currency'); - if (MembersmanagerHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url); - } - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 30) - { - // use the helper htmlEscape method instead and shorten the string - return MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return MembersmanagerHelper::htmlEscape($var, $this->_charset); - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_CURRENCY_NEW' : 'COM_MEMBERSMANAGER_CURRENCY_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/currency.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_membersmanager/views/currency/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index a1db6fb..4a1f1d8 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla view library -jimport('joomla.application.component.view'); - /** * Membersmanager Import View */ diff --git a/admin/views/member/tmpl/edit.php b/admin/views/member/tmpl/edit.php index e6ce58e..4e12e32 100644 --- a/admin/views/member/tmpl/edit.php +++ b/admin/views/member/tmpl/edit.php @@ -17,7 +17,7 @@ JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -$componentParams = JComponentHelper::getParams('com_membersmanager'); +$componentParams = $this->params; // will be removed just use $this->params instead ?> '; return ''+target+' Image

'+thedelete; } else if (type === 'images') { var imageNum = filename.length; @@ -310,7 +379,7 @@ function getFile(filename, fileFormat, target, type){ imagesBox += '
'; var fileFormat = item.split('_')[2]; var thePath = link+item+'.'+fileFormat; - var thedelete = ''; + var thedelete = ''; imagesBox += ''+target+' Image

'+thedelete; if (perRow == counter) { counter = 0; @@ -351,7 +420,7 @@ function getFile(filename, fileFormat, target, type){ if (documentsLinks.hasOwnProperty(item)) { thedownload = ' '+fileName+''; } - var thedelete = ''; + var thedelete = ''; fileBox += theplaceholder+thedownload+thedelete; if (perRow == counter) { counter = 0; @@ -377,7 +446,7 @@ function getFile(filename, fileFormat, target, type){ if (documentsLinks.hasOwnProperty(filename)) { thedownload = ' '+fileName+''; } - var thedelete = ''; + var thedelete = ''; return theplaceholder+thedownload+thedelete + '
'; } } diff --git a/admin/views/member/view.html.php b/admin/views/member/view.html.php index 726f7a2..d12eb37 100644 --- a/admin/views/member/view.html.php +++ b/admin/views/member/view.html.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla view library -jimport('joomla.application.component.view'); - /** * Member View class */ @@ -26,27 +23,37 @@ class MembersmanagerViewMember extends JViewLegacy */ public function display($tpl = null) { + // set params + $this->params = JComponentHelper::getParams('com_membersmanager'); // Assign the variables $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->script = $this->get('Script'); $this->state = $this->get('State'); // get action permissions - $this->canDo = MembersmanagerHelper::getActions('member',$this->item); + $this->canDo = MembersmanagerHelper::getActions('member', $this->item); // get input $jinput = JFactory::getApplication()->input; $this->ref = $jinput->get('ref', 0, 'word'); $this->refid = $jinput->get('refid', 0, 'int'); + $return = $jinput->get('return', null, 'base64'); + // set the referral string $this->referral = ''; - if ($this->refid) + if ($this->refid && $this->ref) { - // return to the item that refered to this item - $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; + // return to the item that referred to this item + $this->referral = '&ref=' . (string)$this->ref . '&refid=' . (int)$this->refid; } elseif($this->ref) { - // return to the list view that refered to this item - $this->referral = '&ref='.(string)$this->ref; + // return to the list view that referred to this item + $this->referral = '&ref=' . (string)$this->ref; + } + // check return value + if (!is_null($return)) + { + // add the return value + $this->referral .= '&return=' . (string)$return; } // Set the toolbar @@ -78,7 +85,7 @@ class MembersmanagerViewMember extends JViewLegacy JToolbarHelper::title( JText::_($isNew ? 'COM_MEMBERSMANAGER_MEMBER_NEW' : 'COM_MEMBERSMANAGER_MEMBER_EDIT'), 'pencil-2 article-add'); // Built the actions for new and existing records. - if ($this->refid || $this->ref) + if (MembersmanagerHelper::checkString($this->referral)) { if ($this->canDo->get('member.create') && $isNew) { @@ -182,26 +189,57 @@ class MembersmanagerViewMember extends JViewLegacy $this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_MEMBER_NEW' : 'COM_MEMBERSMANAGER_MEMBER_EDIT')); $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/member.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); // Add Ajax Token - $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); $this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . "administrator/components/com_membersmanager/views/member/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - // add the style sheets - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/uikit.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/accordion.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/tooltip.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/notify.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/form-file.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/progress.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/placeholder.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2//css/components/upload.gradient.min.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - // add JavaScripts - $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/uikit.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/accordion.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/tooltip.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/lightbox.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/notify.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/upload.min.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // get Uikit Version + $this->uikitVersion = $this->params->get('uikit_version', 2); + // Load uikit options. + $uikit = $this->params->get('uikit_load'); + $isAdmin = JFactory::getApplication()->isClient('administrator'); + // Set script size. + $size = $this->params->get('uikit_min'); + // Use Uikit Version 2 + if (2 == $this->uikitVersion && ($isAdmin || $uikit != 2)) + { + // Set css style. + $style = $this->params->get('uikit_style'); + // only load if needed + if ($isAdmin || $uikit != 3) + { + // add the style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/uikit' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + // add the style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/accordion' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/tooltip' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/notify' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/form-file' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/progress' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2/css/components/placeholder' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v2//css/components/upload' . $style . $size . '.css' , (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // only load if needed + if ($isAdmin || $uikit != 3) + { + // add JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/uikit' . $size . '.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + // add JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/accordion' . $size . '.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/tooltip' . $size . '.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/lightbox' . $size . '.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/notify' . $size . '.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v2/js/components/upload' . $size . '.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + // Use Uikit Version 3 + elseif (3 == $this->uikitVersion && ($isAdmin || $uikit != 2)) + { + // add the style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_membersmanager/uikit-v3/css/uikit'.$size.'.css', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + // add JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_membersmanager/uikit-v3/js/uikit'.$size.'.js', (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + } // add var key $this->document->addScriptDeclaration("var vastDevMod = '".$this->get('VDM')."';"); // need to add some language strings diff --git a/admin/views/members/tmpl/default_body.php b/admin/views/members/tmpl/default_body.php index c849e45..a30dfd7 100644 --- a/admin/views/members/tmpl/default_body.php +++ b/admin/views/members/tmpl/default_body.php @@ -61,16 +61,7 @@ $edit = "index.php?option=com_membersmanager&view=members&task=member.edit"; -
account_id || 4 == $item->account_id): ?> - get('member.edit')): ?> - user)->name; ?> - checked_out): ?> - name, $item->checked_out_time, 'members.', $canCheckin); ?> - - - user)->name; ?> - - +
get('member.edit')): ?> escape($item->name); ?> checked_out): ?> @@ -79,82 +70,32 @@ $edit = "index.php?option=com_membersmanager&view=members&task=member.edit"; escape($item->name); ?> - account_id || 4 == $item->account_id): ?> -
: - main_member_user > 0): ?> - user->authorise('member.edit', 'com_membersmanager.member.' . (int)$item->main_member)): ?> - main_member_user)->name; ?> - - main_member_user)->name; ?> - - - get('member.edit')): ?> - main_member, 'id', 'name'); ?> - checked_out): ?> - name, $item->checked_out_time, 'members.', $canCheckin); ?> - - - main_member, 'id', 'name'); ?> - - - - - street)): ?> -
- escape($item->street); ?> - - city)): ?> -
- escape($item->city); ?> - - region > 0): ?> -
- user->authorise('region.edit', 'com_membersmanager.region.' . (int)$item->region)): ?> - escape($item->region_name); ?> - - escape($item->region_name); ?> - - - country > 0): ?> -
- user->authorise('country.edit', 'com_membersmanager.country.' . (int)$item->country)): ?> - escape($item->country_name); ?> - - escape($item->country_name); ?> - - - website)): ?> -
- escape($item->website); ?> +
: + user->authorise('member.edit', 'com_membersmanager.member.' . (int)$item->main_member)): ?> + + main_member, $item->main_member_user); ?> + + + main_member, $item->main_member_user); ?> + +
-
landline_phone)): ?> - escape($item->landline_phone); ?> - - mobile_phone)): ?> - landline_phone)): ?>
- - escape($item->mobile_phone); ?> - -
+ escape($item->email); ?> - -
: + +
user->authorise('type.edit', 'com_membersmanager.type.' . (int)$item->type)): ?> escape($item->type_name); ?> escape($item->type_name); ?> - -
- - -
: + : account); ?>
-: - escape($item->token); ?> + + escape($item->token); ?>
diff --git a/admin/views/members/tmpl/default_foot.php b/admin/views/members/tmpl/default_foot.php index 807b9e3..0a533c0 100644 --- a/admin/views/members/tmpl/default_foot.php +++ b/admin/views/members/tmpl/default_foot.php @@ -10,9 +10,9 @@ */ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); ?> - pagination->getListFooter(); ?> + pagination->getListFooter(); ?> \ No newline at end of file diff --git a/admin/views/members/tmpl/default_head.php b/admin/views/members/tmpl/default_head.php index cee7c5d..824acd9 100644 --- a/admin/views/members/tmpl/default_head.php +++ b/admin/views/members/tmpl/default_head.php @@ -10,7 +10,7 @@ */ // No direct access to this file -defined('_JEXEC') or die('Restricted access'); +defined('_JEXEC') or die('Restricted access'); ?> @@ -30,13 +30,10 @@ defined('_JEXEC') or die('Restricted access'); - listDirn, $this->listOrder); ?> + - - - - listDirn, $this->listOrder); ?> + listDirn, $this->listOrder); ?> diff --git a/admin/views/members/view.html.php b/admin/views/members/view.html.php index 690af42..c5c3225 100644 --- a/admin/views/members/view.html.php +++ b/admin/views/members/view.html.php @@ -12,9 +12,6 @@ // No direct access to this file defined('_JEXEC') or die('Restricted access'); -// import Joomla view library -jimport('joomla.application.component.view'); - /** * Membersmanager View class for the Members */ @@ -119,7 +116,7 @@ class MembersmanagerViewMembers extends JViewLegacy // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); - } + } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { @@ -134,7 +131,7 @@ class MembersmanagerViewMembers extends JViewLegacy { JToolBarHelper::custom('members.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true); } - } + } if ($this->canDo->get('core.import') && $this->canDo->get('member.import')) { @@ -185,28 +182,6 @@ class MembersmanagerViewMembers extends JViewLegacy 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); - } - - // Set Type Name Selection - $this->typeNameOptions = JFormHelper::loadFieldType('Types')->getOptions(); - if ($this->typeNameOptions) - { - // Type Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_TYPE_LABEL').' -', - 'filter_type', - JHtml::_('select.options', $this->typeNameOptions, 'value', 'text', $this->state->get('filter.type')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Type Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_TYPE_LABEL').' -', - 'batch[type]', - JHtml::_('select.options', $this->typeNameOptions, 'value', 'text') - ); - } } // Set Account Selection @@ -231,72 +206,6 @@ class MembersmanagerViewMembers extends JViewLegacy } } - // Set Country Name Selection - $this->countryNameOptions = JFormHelper::loadFieldType('Countries')->getOptions(); - if ($this->countryNameOptions) - { - // Country Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_COUNTRY_LABEL').' -', - 'filter_country', - JHtml::_('select.options', $this->countryNameOptions, 'value', 'text', $this->state->get('filter.country')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Country Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_COUNTRY_LABEL').' -', - 'batch[country]', - JHtml::_('select.options', $this->countryNameOptions, 'value', 'text') - ); - } - } - - // Set City Selection - $this->cityOptions = $this->getTheCitySelections(); - if ($this->cityOptions) - { - // City Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_CITY_LABEL').' -', - 'filter_city', - JHtml::_('select.options', $this->cityOptions, 'value', 'text', $this->state->get('filter.city')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // City Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_CITY_LABEL').' -', - 'batch[city]', - JHtml::_('select.options', $this->cityOptions, 'value', 'text') - ); - } - } - - // Set Region Name Selection - $this->regionNameOptions = JFormHelper::loadFieldType('Regions')->getOptions(); - if ($this->regionNameOptions) - { - // Region Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_REGION_LABEL').' -', - 'filter_region', - JHtml::_('select.options', $this->regionNameOptions, 'value', 'text', $this->state->get('filter.region')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Region Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_REGION_LABEL').' -', - 'batch[region]', - JHtml::_('select.options', $this->regionNameOptions, 'value', 'text') - ); - } - } - // Set Main Member User Selection $this->main_memberUserOptions = JFormHelper::loadFieldType('Mainmembers')->getOptions(); if ($this->main_memberUserOptions) @@ -317,6 +226,28 @@ class MembersmanagerViewMembers extends JViewLegacy JHtml::_('select.options', $this->main_memberUserOptions, 'value', 'text') ); } + } + + // Set Type Name Selection + $this->typeNameOptions = JFormHelper::loadFieldType('Types')->getOptions(); + if ($this->typeNameOptions) + { + // Type Name Filter + JHtmlSidebar::addFilter( + '- Select '.JText::_('COM_MEMBERSMANAGER_MEMBER_TYPE_LABEL').' -', + 'filter_type', + JHtml::_('select.options', $this->typeNameOptions, 'value', 'text', $this->state->get('filter.type')) + ); + + if ($this->canBatch && $this->canCreate && $this->canEdit) + { + // Type Name Batch Selection + JHtmlBatch_::addListSelection( + '- Keep Original '.JText::_('COM_MEMBERSMANAGER_MEMBER_TYPE_LABEL').' -', + 'batch[type]', + JHtml::_('select.options', $this->typeNameOptions, 'value', 'text') + ); + } } } @@ -363,8 +294,6 @@ class MembersmanagerViewMembers extends JViewLegacy return array( 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), - 'g.name' => JText::_('COM_MEMBERSMANAGER_MEMBER_USER_LABEL'), - 'h.name' => JText::_('COM_MEMBERSMANAGER_MEMBER_TYPE_LABEL'), 'a.account' => JText::_('COM_MEMBERSMANAGER_MEMBER_ACCOUNT_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); @@ -404,37 +333,5 @@ class MembersmanagerViewMembers extends JViewLegacy return $_filter; } return false; - } - - protected function getTheCitySelections() - { - // Get a db connection. - $db = JFactory::getDbo(); - - // Create a new query object. - $query = $db->getQuery(true); - - // Select the text. - $query->select($db->quoteName('city')); - $query->from($db->quoteName('#__membersmanager_member')); - $query->order($db->quoteName('city') . ' ASC'); - - // Reset the query using our newly populated query object. - $db->setQuery($query); - - $results = $db->loadColumn(); - - if ($results) - { - $results = array_unique($results); - $_filter = array(); - foreach ($results as $city) - { - // Now add the city and its text to the options array - $_filter[] = JHtml::_('select.option', $city, $city); - } - return $_filter; - } - return false; } } diff --git a/admin/views/region/submitbutton.js b/admin/views/region/submitbutton.js deleted file mode 100644 index 0eab72e..0000000 --- a/admin/views/region/submitbutton.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @package Joomla.Members.Manager - * - * @created 6th September, 2015 - * @author Llewellyn van der Merwe - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -Joomla.submitbutton = function(task) -{ - if (task == ''){ - return false; - } else { - var isValid=true; - var action = task.split('.'); - if (action[1] != 'cancel' && action[1] != 'close'){ - var forms = $$('form.form-validate'); - for (var i=0;i - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); -JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = JComponentHelper::getParams('com_membersmanager'); -?> - - - -
diff --git a/admin/views/region/tmpl/index.html b/admin/views/region/tmpl/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/region/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/region/view.html.php b/admin/views/region/view.html.php deleted file mode 100644 index 8c81f31..0000000 --- a/admin/views/region/view.html.php +++ /dev/null @@ -1,183 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla view library -jimport('joomla.application.component.view'); - -/** - * Region View class - */ -class MembersmanagerViewRegion extends JViewLegacy -{ - /** - * display method of View - * @return void - */ - public function display($tpl = null) - { - // Assign the variables - $this->form = $this->get('Form'); - $this->item = $this->get('Item'); - $this->script = $this->get('Script'); - $this->state = $this->get('State'); - // get action permissions - $this->canDo = MembersmanagerHelper::getActions('region',$this->item); - // get input - $jinput = JFactory::getApplication()->input; - $this->ref = $jinput->get('ref', 0, 'word'); - $this->refid = $jinput->get('refid', 0, 'int'); - $this->referral = ''; - if ($this->refid) - { - // return to the item that refered to this item - $this->referral = '&ref='.(string)$this->ref.'&refid='.(int)$this->refid; - } - elseif($this->ref) - { - // return to the list view that refered to this item - $this->referral = '&ref='.(string)$this->ref; - } - - // Set the toolbar - $this->addToolBar(); - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JFactory::getApplication()->input->set('hidemainmenu', true); - $user = JFactory::getUser(); - $userId = $user->id; - $isNew = $this->item->id == 0; - - JToolbarHelper::title( JText::_($isNew ? 'COM_MEMBERSMANAGER_REGION_NEW' : 'COM_MEMBERSMANAGER_REGION_EDIT'), 'pencil-2 article-add'); - // Built the actions for new and existing records. - if ($this->refid || $this->ref) - { - if ($this->canDo->get('region.create') && $isNew) - { - // We can create the record. - JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); - } - elseif ($this->canDo->get('region.edit')) - { - // We can save the record. - JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); - } - if ($isNew) - { - // Do not creat but cancel. - JToolBarHelper::cancel('region.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - // We can close it. - JToolBarHelper::cancel('region.cancel', 'JTOOLBAR_CLOSE'); - } - } - else - { - if ($isNew) - { - // For new records, check the create permission. - if ($this->canDo->get('region.create')) - { - JToolBarHelper::apply('region.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); - JToolBarHelper::custom('region.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); - }; - JToolBarHelper::cancel('region.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - if ($this->canDo->get('region.edit')) - { - // We can save the new record - JToolBarHelper::apply('region.apply', 'JTOOLBAR_APPLY'); - JToolBarHelper::save('region.save', 'JTOOLBAR_SAVE'); - // We can save this record, but check the create permission to see - // if we can return to make a new one. - if ($this->canDo->get('region.create')) - { - JToolBarHelper::custom('region.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); - } - } - if ($this->canDo->get('region.create')) - { - JToolBarHelper::custom('region.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); - } - JToolBarHelper::cancel('region.cancel', 'JTOOLBAR_CLOSE'); - } - } - JToolbarHelper::divider(); - // set help url for this view if found - $help_url = MembersmanagerHelper::getHelpUrl('region'); - if (MembersmanagerHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url); - } - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 30) - { - // use the helper htmlEscape method instead and shorten the string - return MembersmanagerHelper::htmlEscape($var, $this->_charset, true, 30); - } - // use the helper htmlEscape method instead. - return MembersmanagerHelper::htmlEscape($var, $this->_charset); - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - $isNew = ($this->item->id < 1); - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_($isNew ? 'COM_MEMBERSMANAGER_REGION_NEW' : 'COM_MEMBERSMANAGER_REGION_EDIT')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/region.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - $this->document->addScript(JURI::root() . $this->script, (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - $this->document->addScript(JURI::root() . "administrator/components/com_membersmanager/views/region/submitbutton.js", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); - JText::script('view not acceptable. Error'); - } -} diff --git a/admin/views/regions/index.html b/admin/views/regions/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/regions/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/regions/tmpl/default.php b/admin/views/regions/tmpl/default.php deleted file mode 100644 index d138f3e..0000000 --- a/admin/views/regions/tmpl/default.php +++ /dev/null @@ -1,85 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// load tooltip behavior -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.multiselect'); -JHtml::_('dropdown.init'); -JHtml::_('formbehavior.chosen', 'select'); - -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_membersmanager&task=regions.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'regionList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} - -?> - -
-sidebar)): ?> -
- sidebar; ?> -
-
- -
- -items)): ?> - loadTemplate('toolbar');?> -
- -
- - loadTemplate('toolbar');?> - - loadTemplate('head');?> - loadTemplate('foot');?> - loadTemplate('body');?> -
- - canCreate && $this->canEdit) : ?> - JText::_('COM_MEMBERSMANAGER_REGIONS_BATCH_OPTIONS'), - 'footer' => $this->loadTemplate('batch_footer') - ), - $this->loadTemplate('batch_body') - ); ?> - - - - -
- - - - \ No newline at end of file diff --git a/admin/views/regions/tmpl/default_batch_footer.php b/admin/views/regions/tmpl/default_batch_footer.php deleted file mode 100644 index 5efb934..0000000 --- a/admin/views/regions/tmpl/default_batch_footer.php +++ /dev/null @@ -1,23 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - - - \ No newline at end of file diff --git a/admin/views/regions/tmpl/default_body.php b/admin/views/regions/tmpl/default_body.php deleted file mode 100644 index ff61bf6..0000000 --- a/admin/views/regions/tmpl/default_body.php +++ /dev/null @@ -1,103 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -$edit = "index.php?option=com_membersmanager&view=regions&task=region.edit"; - -?> -items as $i => $item): ?> - user->authorise('core.manage', 'com_checkin') || $item->checked_out == $this->user->id || $item->checked_out == 0; - $userChkOut = JFactory::getUser($item->checked_out); - $canDo = MembersmanagerHelper::getActions('region',$item,'regions'); - ?> - - - get('region.edit.state')): ?> - saveOrder) - { - $iconClass = ' inactive'; - } - else - { - $iconClass = ' inactive tip-top" hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); - } - ?> - - - - saveOrder) : ?> - - - - ⋮ - - - - get('region.edit')): ?> - checked_out) : ?> - - id); ?> - - □ - - - id); ?> - - - □ - - - -
- get('region.edit')): ?> - escape($item->name); ?> - checked_out): ?> - name, $item->checked_out_time, 'regions.', $canCheckin); ?> - - - escape($item->name); ?> - -
- - -
- user->authorise('country.edit', 'com_membersmanager.country.' . (int)$item->country)): ?> - escape($item->country_name); ?> - - escape($item->country_name); ?> - -
- - - get('region.edit.state')) : ?> - checked_out) : ?> - - published, $i, 'regions.', true, 'cb'); ?> - - published, $i, 'regions.', false, 'cb'); ?> - - - published, $i, 'regions.', true, 'cb'); ?> - - - published, $i, 'regions.', false, 'cb'); ?> - - - - id; ?> - - - \ No newline at end of file diff --git a/admin/views/regions/tmpl/default_head.php b/admin/views/regions/tmpl/default_head.php deleted file mode 100644 index f76602d..0000000 --- a/admin/views/regions/tmpl/default_head.php +++ /dev/null @@ -1,50 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> - - canEdit&& $this->canState): ?> - - ', 'ordering', $this->listDirn, $this->listOrder, null, 'asc', 'JGRID_HEADING_ORDERING'); ?> - - - - - - - ▾ - - - ■ - - - - listDirn, $this->listOrder); ?> - - - listDirn, $this->listOrder); ?> - - canState): ?> - - listDirn, $this->listOrder); ?> - - - - - - - - listDirn, $this->listOrder); ?> - - \ No newline at end of file diff --git a/admin/views/regions/tmpl/default_toolbar.php b/admin/views/regions/tmpl/default_toolbar.php deleted file mode 100644 index db8ade2..0000000 --- a/admin/views/regions/tmpl/default_toolbar.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -?> -
- -
- - -
-
- - pagination->getLimitBox(); ?> -
-
- - -
-
- - -
-
-
\ No newline at end of file diff --git a/admin/views/regions/tmpl/index.html b/admin/views/regions/tmpl/index.html deleted file mode 100644 index fa6d84e..0000000 --- a/admin/views/regions/tmpl/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/views/regions/view.html.php b/admin/views/regions/view.html.php deleted file mode 100644 index f0842dc..0000000 --- a/admin/views/regions/view.html.php +++ /dev/null @@ -1,261 +0,0 @@ - - * @github Joomla Members Manager - * @copyright Copyright (C) 2015. All Rights Reserved - * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - */ - -// No direct access to this file -defined('_JEXEC') or die('Restricted access'); - -// import Joomla view library -jimport('joomla.application.component.view'); - -/** - * Membersmanager View class for the Regions - */ -class MembersmanagerViewRegions extends JViewLegacy -{ - /** - * Regions view display method - * @return void - */ - function display($tpl = null) - { - if ($this->getLayout() !== 'modal') - { - // Include helper submenu - MembersmanagerHelper::addSubmenu('regions'); - } - - // Assign data to the view - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); - $this->user = JFactory::getUser(); - $this->listOrder = $this->escape($this->state->get('list.ordering')); - $this->listDirn = $this->escape($this->state->get('list.direction')); - $this->saveOrder = $this->listOrder == 'ordering'; - // get global action permissions - $this->canDo = MembersmanagerHelper::getActions('region'); - $this->canEdit = $this->canDo->get('region.edit'); - $this->canState = $this->canDo->get('region.edit.state'); - $this->canCreate = $this->canDo->get('region.create'); - $this->canDelete = $this->canDo->get('region.delete'); - $this->canBatch = $this->canDo->get('core.batch'); - - // We don't need toolbar in the modal window. - if ($this->getLayout() !== 'modal') - { - $this->addToolbar(); - $this->sidebar = JHtmlSidebar::render(); - // load the batch html - if ($this->canCreate && $this->canEdit && $this->canState) - { - $this->batchDisplay = JHtmlBatch_::render(); - } - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JToolBarHelper::title(JText::_('COM_MEMBERSMANAGER_REGIONS'), 'location'); - JHtmlSidebar::setAction('index.php?option=com_membersmanager&view=regions'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); - - if ($this->canCreate) - { - JToolBarHelper::addNew('region.add'); - } - - // Only load if there are items - if (MembersmanagerHelper::checkArray($this->items)) - { - if ($this->canEdit) - { - JToolBarHelper::editList('region.edit'); - } - - if ($this->canState) - { - JToolBarHelper::publishList('regions.publish'); - JToolBarHelper::unpublishList('regions.unpublish'); - JToolBarHelper::archiveList('regions.archive'); - - if ($this->canDo->get('core.admin')) - { - JToolBarHelper::checkin('regions.checkin'); - } - } - - // Add a batch button - if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) - { - // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); - // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); - // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); - // add the button to the page - $dhtml = $layout->render(array('title' => $title)); - $bar->appendButton('Custom', $dhtml, 'batch'); - } - - if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) - { - JToolbarHelper::deleteList('', 'regions.delete', 'JTOOLBAR_EMPTY_TRASH'); - } - elseif ($this->canState && $this->canDelete) - { - JToolbarHelper::trash('regions.trash'); - } - - if ($this->canDo->get('core.export') && $this->canDo->get('region.export')) - { - JToolBarHelper::custom('regions.exportData', 'download', '', 'COM_MEMBERSMANAGER_EXPORT_DATA', true); - } - } - - if ($this->canDo->get('core.import') && $this->canDo->get('region.import')) - { - JToolBarHelper::custom('regions.importData', 'upload', '', 'COM_MEMBERSMANAGER_IMPORT_DATA', false); - } - - // set help url for this view if found - $help_url = MembersmanagerHelper::getHelpUrl('regions'); - if (MembersmanagerHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_MEMBERSMANAGER_HELP_MANAGER', false, $help_url); - } - - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_membersmanager'); - } - - if ($this->canState) - { - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_PUBLISHED'), - 'filter_published', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true) - ); - // only load if batch allowed - if ($this->canBatch) - { - JHtmlBatch_::addListSelection( - JText::_('COM_MEMBERSMANAGER_KEEP_ORIGINAL_STATE'), - 'batch[published]', - JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true) - ); - } - } - - JHtmlSidebar::addFilter( - JText::_('JOPTION_SELECT_ACCESS'), - 'filter_access', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - JHtmlBatch_::addListSelection( - JText::_('COM_MEMBERSMANAGER_KEEP_ORIGINAL_ACCESS'), - 'batch[access]', - JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') - ); - } - - // Set Country Name Selection - $this->countryNameOptions = JFormHelper::loadFieldType('Countries')->getOptions(); - if ($this->countryNameOptions) - { - // Country Name Filter - JHtmlSidebar::addFilter( - '- Select '.JText::_('COM_MEMBERSMANAGER_REGION_COUNTRY_LABEL').' -', - 'filter_country', - JHtml::_('select.options', $this->countryNameOptions, 'value', 'text', $this->state->get('filter.country')) - ); - - if ($this->canBatch && $this->canCreate && $this->canEdit) - { - // Country Name Batch Selection - JHtmlBatch_::addListSelection( - '- Keep Original '.JText::_('COM_MEMBERSMANAGER_REGION_COUNTRY_LABEL').' -', - 'batch[country]', - JHtml::_('select.options', $this->countryNameOptions, 'value', 'text') - ); - } - } - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_('COM_MEMBERSMANAGER_REGIONS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_membersmanager/assets/css/regions.css", (MembersmanagerHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 50) - { - // use the helper htmlEscape method instead and shorten the string - return MembersmanagerHelper::htmlEscape($var, $this->_charset, true); - } - // use the helper htmlEscape method instead. - return MembersmanagerHelper::htmlEscape($var, $this->_charset); - } - - /** - * Returns an array of fields the table can be sorted by - * - * @return array Array containing the field name to sort by as the key and display text as value - */ - protected function getSortFields() - { - return array( - 'a.sorting' => JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => JText::_('JSTATUS'), - 'a.name' => JText::_('COM_MEMBERSMANAGER_REGION_NAME_LABEL'), - 'g.name' => JText::_('COM_MEMBERSMANAGER_REGION_COUNTRY_LABEL'), - 'a.id' => JText::_('JGRID_HEADING_ID') - ); - } -} diff --git a/admin/views/type/tmpl/edit.php b/admin/views/type/tmpl/edit.php index 299651f..4578833 100644 --- a/admin/views/type/tmpl/edit.php +++ b/admin/views/type/tmpl/edit.php @@ -17,7 +17,7 @@ JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -$componentParams = JComponentHelper::getParams('com_membersmanager'); +$componentParams = $this->params; // will be removed just use $this->params instead ?>