From 001a426dac7327e43189424be5f5ad621668d007 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 14 Aug 2019 04:14:40 +0200 Subject: [PATCH] Updated with JCB v2.10.0 --- README.md | 16 +- admin/README.txt | 16 +- admin/assets/css/admin.css | 1 + admin/assets/css/member.css | 1 + admin/assets/css/members.css | 1 + admin/assets/css/type.css | 1 + admin/assets/css/types.css | 1 + admin/assets/js/admin.js | 3 +- admin/controller.php | 1 + admin/controllers/ajax.json.php | 3 +- admin/controllers/import.php | 1 + admin/controllers/member.php | 94 ++++- admin/controllers/members.php | 1 + admin/controllers/type.php | 1 + admin/controllers/types.php | 1 + admin/helpers/headercheck.php | 1 + admin/helpers/html/batch_.php | 1 + admin/helpers/membersmanager.php | 91 +++-- .../en-GB/en-GB.com_membersmanager.ini | 37 +- .../en-GB/en-GB.com_membersmanager.sys.ini | 22 +- admin/layouts/batchselection.php | 1 + admin/layouts/member/membership_above.php | 16 +- admin/layouts/member/membership_left.php | 16 +- admin/layouts/member/membership_right.php | 16 +- admin/layouts/member/publishing.php | 16 +- admin/layouts/member/publlshing.php | 16 +- admin/layouts/type/advance_left.php | 16 +- admin/layouts/type/advance_right.php | 16 +- admin/layouts/type/details_above.php | 16 +- admin/layouts/type/details_fullwidth.php | 16 +- admin/layouts/type/details_left.php | 16 +- admin/layouts/type/details_right.php | 16 +- admin/layouts/type/publishing.php | 16 +- admin/layouts/type/publlshing.php | 16 +- admin/membersmanager.php | 1 + admin/models/ajax.php | 3 +- admin/models/fields/mainmembers.php | 52 ++- admin/models/fields/memberuser.php | 1 + admin/models/fields/onetomanycomponents.php | 1 + admin/models/fields/onetoonecomponents.php | 1 + admin/models/fields/targettypes.php | 1 + admin/models/fields/types.php | 52 ++- admin/models/fields/typesonmember.php | 52 ++- admin/models/forms/member.js | 1 + admin/models/forms/type.js | 1 + admin/models/import.php | 1 + admin/models/member.php | 82 ++++- admin/models/members.php | 1 + admin/models/rules/memberloginname.php | 1 + admin/models/rules/memberuseremail.php | 1 + admin/models/rules/uniquefield.php | 1 + admin/models/type.php | 40 ++- admin/models/types.php | 1 + admin/tables/member.php | 1 + admin/tables/type.php | 1 + admin/views/import/tmpl/default.php | 1 + admin/views/import/view.html.php | 1 + admin/views/member/submitbutton.js | 1 + admin/views/member/tmpl/edit.php | 1 + admin/views/member/view.html.php | 23 +- admin/views/members/tmpl/default.php | 1 + .../views/members/tmpl/default_batch_body.php | 1 + .../members/tmpl/default_batch_footer.php | 1 + admin/views/members/tmpl/default_body.php | 1 + admin/views/members/tmpl/default_foot.php | 1 + admin/views/members/tmpl/default_head.php | 1 + admin/views/members/tmpl/default_toolbar.php | 1 + admin/views/members/view.html.php | 1 + admin/views/type/submitbutton.js | 1 + admin/views/type/tmpl/edit.php | 1 + admin/views/type/view.html.php | 1 + admin/views/types/tmpl/default.php | 1 + admin/views/types/tmpl/default_batch_body.php | 1 + .../views/types/tmpl/default_batch_footer.php | 1 + admin/views/types/tmpl/default_body.php | 1 + admin/views/types/tmpl/default_foot.php | 1 + admin/views/types/tmpl/default_head.php | 1 + admin/views/types/tmpl/default_toolbar.php | 1 + admin/views/types/view.html.php | 1 + media/css/A4.print.css | 3 +- membersmanager.xml | 11 +- script.php | 72 ++-- site/assets/css/cpanel.css | 1 + site/assets/css/member.css | 1 + site/assets/css/members.css | 1 + site/assets/css/profile.css | 1 + site/assets/css/site.css | 1 + site/assets/js/cpanel.js | 3 +- site/assets/js/profile.js | 3 +- site/assets/js/site.js | 3 +- site/controller.php | 1 + site/controllers/ajax.json.php | 3 +- site/controllers/member.php | 94 ++++- site/helpers/category.php | 3 +- site/helpers/headercheck.php | 1 + site/helpers/membersmanager.php | 91 +++-- site/helpers/route.php | 1 + .../en-GB/en-GB.com_membersmanager.ini | 7 +- site/layouts/cpanel_search_form.php | 1 + site/layouts/cpanel_uikit_three_buttons.php | 1 + site/layouts/cpanel_uikit_two_buttons.php | 1 + site/layouts/list_name_value.php | 1 + site/layouts/many_list_name_value.php | 1 + site/layouts/member/membership_above.php | 16 +- site/layouts/member/membership_left.php | 16 +- site/layouts/member/membership_right.php | 16 +- site/layouts/member/publishing.php | 16 +- site/layouts/member/publlshing.php | 16 +- site/layouts/panelbox.php | 1 + site/layouts/profile_uikit_three.php | 1 + site/layouts/profile_uikit_two.php | 1 + .../layouts/profileassessment_uikit_three.php | 1 + site/layouts/profileassessment_uikit_two.php | 1 + ...profileassessmentselection_uikit_three.php | 1 + .../profileassessmentselection_uikit_two.php | 1 + site/layouts/profilebuttons_uikit_three.php | 1 + site/layouts/profilebuttons_uikit_two.php | 1 + site/layouts/profiledetails_uikit_three.php | 1 + site/layouts/profiledetails_uikit_two.php | 1 + site/layouts/profileextra_uikit_three.php | 1 + site/layouts/profileextra_uikit_two.php | 1 + site/layouts/profileheader_uikit_three.php | 1 + site/layouts/profileheader_uikit_two.php | 1 + site/layouts/profilereports_uikit_three.php | 1 + site/layouts/profilereports_uikit_two.php | 1 + site/layouts/relation_list_name_value.php | 1 + site/membersmanager.php | 1 + site/models/ajax.php | 338 +++++++++++++++--- site/models/cpanel.php | 1 + site/models/forms/member.js | 1 + site/models/member.php | 82 ++++- site/models/members.php | 1 + site/models/profile.php | 1 + site/router.php | 3 + site/views/cpanel/tmpl/default.php | 64 ++-- .../tmpl/default_cpanel_uikit_three.php | 1 + .../cpanel/tmpl/default_cpanel_uikit_two.php | 1 + .../views/cpanel/tmpl/default_loginmodule.php | 1 + site/views/cpanel/view.html.php | 51 +-- site/views/member/submitbutton.js | 1 + site/views/member/tmpl/edit.php | 1 + site/views/member/view.html.php | 23 +- site/views/members/tmpl/default.php | 2 +- .../members/tmpl/default_member_list.php | 1 + .../members/tmpl/default_member_panels.php | 1 + .../members/tmpl/default_member_table.php | 1 + site/views/members/view.html.php | 1 + site/views/profile/tmpl/default.php | 35 +- .../profile/tmpl/default_loginmodule.php | 1 + site/views/profile/tmpl/default_profiles.php | 25 +- site/views/profile/view.html.php | 32 +- 151 files changed, 1481 insertions(+), 438 deletions(-) diff --git a/README.md b/README.md index c930a00..43f8083 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 July, 2018 -+ *Last Build*: 12th June, 2019 ++ *Last Build*: 14th August, 2019 + *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 -**116 Hours** or **15 Eight Hour Days** (actual time the author saved - +**119 Hours** or **15 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*: **41627** ++ *Line count*: **42672** + *File count*: **237** + *Folder count*: **61** -**77 Hours** or **9 Eight Hour Days** (the actual time the author spent) +**78 Hours** or **10 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @29hours** = codingtime / 4; +> **debugging @30hours** = codingtime / 4; > **planning @17hours** = codingtime / 7; > **mapping @12hours** = codingtime / 10; -> **office @19hours** = codingtime / 6;) +> **office @20hours** = codingtime / 6;) -**193 Hours** or **24 Eight Hour Days** +**197 Hours** or **25 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.8 weeks** or **1 months** +Project duration: **5 weeks** or **1 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 c930a00..43f8083 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 July, 2018 -+ *Last Build*: 12th June, 2019 ++ *Last Build*: 14th August, 2019 + *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 -**116 Hours** or **15 Eight Hour Days** (actual time the author saved - +**119 Hours** or **15 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*: **41627** ++ *Line count*: **42672** + *File count*: **237** + *Folder count*: **61** -**77 Hours** or **9 Eight Hour Days** (the actual time the author spent) +**78 Hours** or **10 Eight Hour Days** (the actual time the author spent) > (with the following break down: -> **debugging @29hours** = codingtime / 4; +> **debugging @30hours** = codingtime / 4; > **planning @17hours** = codingtime / 7; > **mapping @12hours** = codingtime / 10; -> **office @19hours** = codingtime / 6;) +> **office @20hours** = codingtime / 6;) -**193 Hours** or **24 Eight Hour Days** +**197 Hours** or **25 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.8 weeks** or **1 months** +Project duration: **5 weeks** or **1 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/assets/css/admin.css b/admin/assets/css/admin.css index a2632f7..0b8e5cb 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -8,6 +8,7 @@ * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */ + /* CSS Document */ .no-click { pointer-events: none; diff --git a/admin/assets/css/member.css b/admin/assets/css/member.css index 6a21998..af0d037 100644 --- a/admin/assets/css/member.css +++ b/admin/assets/css/member.css @@ -8,6 +8,7 @@ * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */ + /* CSS Document */ diff --git a/admin/assets/css/members.css b/admin/assets/css/members.css index 3a84864..43d6362 100644 --- a/admin/assets/css/members.css +++ b/admin/assets/css/members.css @@ -8,6 +8,7 @@ * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */ + /* CSS Document */ diff --git a/admin/assets/css/type.css b/admin/assets/css/type.css index 3a84864..43d6362 100644 --- a/admin/assets/css/type.css +++ b/admin/assets/css/type.css @@ -8,6 +8,7 @@ * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */ + /* CSS Document */ diff --git a/admin/assets/css/types.css b/admin/assets/css/types.css index 3a84864..43d6362 100644 --- a/admin/assets/css/types.css +++ b/admin/assets/css/types.css @@ -8,6 +8,7 @@ * @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */ + /* CSS Document */ diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 16c13ac..eecda77 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -6,6 +6,7 @@ * @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 - */ + */ + /* JS Document */ diff --git a/admin/controller.php b/admin/controller.php index 2932c95..fe9080a 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -9,6 +9,7 @@ * @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'); diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 1c4ec74..c739dc3 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -9,6 +9,7 @@ * @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'); @@ -41,7 +42,7 @@ class MembersmanagerControllerAjax extends JControllerLegacy // Check Token! $token = JSession::getFormToken(); $call_token = $jinput->get('token', 0, 'ALNUM'); - if($token == $call_token) + if($jinput->get($token, 0, 'ALNUM') || $token === $call_token) { $task = $this->getTask(); switch($task) diff --git a/admin/controllers/import.php b/admin/controllers/import.php index d971fdf..1a51624 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -9,6 +9,7 @@ * @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'); diff --git a/admin/controllers/member.php b/admin/controllers/member.php index 75aad2f..e588272 100644 --- a/admin/controllers/member.php +++ b/admin/controllers/member.php @@ -9,6 +9,7 @@ * @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'); @@ -37,8 +38,95 @@ class MembersmanagerControllerMember extends JControllerForm { $this->view_list = 'Members'; // safeguard for setting the return view listing to the main view. parent::__construct($config); + } + + /** + * Method to save a record and redirect to the profile + * + * @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. + */ + public function saveprofile($key = null, $urlVar = null) + { + // Check id from post + $id = $this->input->get('id', 0, 'INT'); + // to make sure the item is checkedin on redirect + if ($id > 0) + { + $this->task = 'save'; + } + // since this is a new record, we just create and remain in it + else + { + $this->task = 'apply'; + } + // safe the item + $saved = parent::save($key, $urlVar); + if (class_exists('MembersmanagerHelperRoute')) + { + if ($id > 0) + { + // get post + $post = $this->input->post->get('jform', array(), 'array'); + // get the slug + $slug = (isset($post['token'])) ? $id . ':' . $post['token'] : $id; + // Redirect to the profile + $this->setRedirect(JRoute::_(MembersmanagerHelperRoute::getProfileRoute($slug), true)); + } + } + else + { + // 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'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + // 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 = 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( + 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 + ) + ); + } + } + + return $saved; } + /** * Method override to check if you can add a new record. * @@ -79,7 +167,11 @@ class MembersmanagerControllerMember extends JControllerForm $user = JFactory::getUser(); // get record id. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; - + // make sure user can access member (it is always true for self) + if (!MembersmanagerHelper::canAccessMember($recordId, null, $user)) + { + return false; + } // Access check. $access = ($user->authorise('member.access', 'com_membersmanager.member.' . (int) $recordId) && $user->authorise('member.access', 'com_membersmanager')); diff --git a/admin/controllers/members.php b/admin/controllers/members.php index 9a146e9..b2cdd8a 100644 --- a/admin/controllers/members.php +++ b/admin/controllers/members.php @@ -9,6 +9,7 @@ * @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'); diff --git a/admin/controllers/type.php b/admin/controllers/type.php index 35cd345..4c6eef2 100644 --- a/admin/controllers/type.php +++ b/admin/controllers/type.php @@ -9,6 +9,7 @@ * @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'); diff --git a/admin/controllers/types.php b/admin/controllers/types.php index 53fe5dd..7b95113 100644 --- a/admin/controllers/types.php +++ b/admin/controllers/types.php @@ -9,6 +9,7 @@ * @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'); diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index b380a0d..c01b0f6 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -9,6 +9,7 @@ * @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'); diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index 4da9653..f7ab136 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -9,6 +9,7 @@ * @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; diff --git a/admin/helpers/membersmanager.php b/admin/helpers/membersmanager.php index b98e1b4..a4de6a8 100644 --- a/admin/helpers/membersmanager.php +++ b/admin/helpers/membersmanager.php @@ -9,6 +9,7 @@ * @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'); @@ -210,7 +211,7 @@ abstract class MembersmanagerHelper **/ protected static function setMemberEditURL($item) { - if (($url = self::getEditURL($item, 'member', 'members', '&return=' . self::$return_here)) !== false) + if (self::canAccessMember($item->get('id', 0)) && ($url = self::getEditURL($item, 'member', 'members', '&return=' . self::$return_here)) !== false) { return $url; } @@ -227,8 +228,8 @@ abstract class MembersmanagerHelper { self::$params = JComponentHelper::getParams('com_membersmanager'); } - // only load link if open to public or is logged in - if (2 == self::$params->get('login_required', 1) || JFactory::getUser()->id > 0) + // only load link if open to public or has access + if (2 == self::$params->get('login_required', 1) || self::canAccessMember($object->get('id', 0))) { return JRoute::_('index.php?option=com_membersmanager&view=profile&id='. $object->get('id') . ':' . $object->get('token') . '&return=' . self::$return_here); } @@ -726,13 +727,6 @@ abstract class MembersmanagerHelper } - /** - * The Access Memory - * - * @var array - */ - protected static $accessMemory = array(); - /** * The Key to Access Memory * @@ -765,13 +759,12 @@ abstract class MembersmanagerHelper } } // check memory first - self::$acK3y = md5($user->get('id', 'not_set') . '_' . $type); - if (isset(self::$accessMemory[self::$acK3y])) + self::$acK3y = 'membersmanager_user_access_' . $user->get('id', 'not_set') . '_' . $type; + // check if we have it globally stored + if (($access = self::get(self::$acK3y, false)) !== false) { - return self::$accessMemory[self::$acK3y]; + return $access; } - // fallback to false - self::$accessMemory[self::$acK3y] = false; // get DB if (!$db) { @@ -780,14 +773,14 @@ abstract class MembersmanagerHelper // get user Access groups if (2 == $type) { - self::$accessMemory[self::$acK3y] = self::getAccessGroups($user, $db); + self::set(self::$acK3y, self::getAccessGroups($user, $db)); } elseif (1 == $type) { // return access types - self::$accessMemory[self::$acK3y] = self::getAccessTypes($user, $db); + self::set(self::$acK3y, self::getAccessTypes($user, $db)); } - return self::$accessMemory[self::$acK3y]; + return self::get(self::$acK3y, false); } /** @@ -820,7 +813,10 @@ abstract class MembersmanagerHelper if (self::checkArray($types) && ($userID = $user->get('id', false)) !== false && $userID > 0 && ($member_type = self::getVar('member', $userID, 'user', 'type')) !== false) { // get the groups this member belong to - $member_access = self::getMemberGroupsByType($member_type); + if (($member_access = self::getMemberGroupsByType($member_type)) == false) + { + return false; + } // function to setup the group array $setGroups = function ($groups) { // convert to array @@ -841,7 +837,7 @@ abstract class MembersmanagerHelper foreach ($types as $groups) { $groups_access = $setGroups($groups['groups_access']); - if (self::checkArray($groups_target) && $intersect($groups_access, $member_access)) + if (self::checkArray($groups_access) && $intersect($groups_access, $member_access)) { $groups_target = $setGroups($groups['groups_target']); foreach ($groups_target as $group_target) @@ -897,7 +893,10 @@ abstract class MembersmanagerHelper if (self::checkArray($types) && ($userID = $user->get('id', false)) !== false && $userID > 0 && ($member_type = self::getVar('member', $userID, 'user', 'type')) !== false) { // get the access groups - $groups_access = self::getMemberGroupsByType($member_type); + if (($groups_access = self::getMemberGroupsByType($member_type)) === false) + { + return false; + } // function to setup the group array $setGroups = function ($groups) { // convert to array @@ -5276,12 +5275,12 @@ abstract class MembersmanagerHelper $app->enqueueMessage(JText::_('COM_MEMBERSMANAGER_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_MEMBER_RELATIONSHIPS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR'), 'warning'); return; } + // get database object + $db = JFactory::getDbo(); // check if there is relationships and members in those relationships if (self::checkArray($data) && isset($data['id']) && is_numeric($data['id']) && $data['id'] > 0 && isset($data['type']) && ($relation_types = self::getRelationshipsByTypes($data['type'], $db, true)) !== false) { - // get database object - $db = JFactory::getDbo(); // get the post object $post = JFactory::getApplication()->input->post; // Create a new query object. @@ -5587,6 +5586,24 @@ abstract class MembersmanagerHelper { return 'membersmanager'; } + /** + * Can a member access another member's data + * + * @param mix $member The the member being accessed + * To do a dynamic get of member ID use the following array + * array( table, where, whereString, what) + * @param array $types The type of member being accessed + * @param mix $user The active user + * @param object $db The database object + * + * @return bool true of can access + * + */ + public static function canAccessMember($member = null, $types = null, $user = null, $db = null) + { + // here you can do your own custom validation + return true; + } /** * Load the Component xml manifest. **/ @@ -6497,38 +6514,42 @@ abstract class MembersmanagerHelper /** * Get any component's model **/ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $component = 'Membersmanager', $config = array()) + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Membersmanager', $config = array()) { // fix the name $name = self::safeString($name); - // full path - $fullPath = $path . '/models'; - // set prefix - $prefix = $component.'Model'; + // full path to models + $fullPathModels = $path . '/models'; // load the model file - JModelLegacy::addIncludePath($fullPath, $prefix); + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } // get instance - $model = JModelLegacy::getInstance($name, $prefix, $config); + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); // if model not found (strange) if ($model == false) { jimport('joomla.filesystem.file'); // get file path - $filePath = $path.'/'.$name.'.php'; - $fullPath = $fullPath.'/'.$name.'.php'; + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; // check if it exists if (JFile::exists($filePath)) { // get the file require_once $filePath; } - elseif (JFile::exists($fullPath)) + elseif (JFile::exists($fullPathModel)) { // get the file - require_once $fullPath; + require_once $fullPathModel; } // build class names - $modelClass = $prefix.$name; + $modelClass = $Component . 'Model' . $name; if (class_exists($modelClass)) { // initialize the model diff --git a/admin/language/en-GB/en-GB.com_membersmanager.ini b/admin/language/en-GB/en-GB.com_membersmanager.ini index 03b4124..d773df9 100644 --- a/admin/language/en-GB/en-GB.com_membersmanager.ini +++ b/admin/language/en-GB/en-GB.com_membersmanager.ini @@ -126,8 +126,7 @@ 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_CORE_MEMBER_PLACEHOLDERS_DESCRIPTION=" -
Loading placeholders.
+COM_MEMBERSMANAGER_CONFIG_NOTE_CORE_MEMBER_PLACEHOLDERS_DESCRIPTION="
Loading placeholders.
+ + +
+

+

+
+ loadTemplate('loginmodule'); ?> diff --git a/site/views/profile/tmpl/default_loginmodule.php b/site/views/profile/tmpl/default_loginmodule.php index ed61417..b4ddb27 100644 --- a/site/views/profile/tmpl/default_loginmodule.php +++ b/site/views/profile/tmpl/default_loginmodule.php @@ -9,6 +9,7 @@ * @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'); diff --git a/site/views/profile/tmpl/default_profiles.php b/site/views/profile/tmpl/default_profiles.php index 9ef1e89..dbe5611 100644 --- a/site/views/profile/tmpl/default_profiles.php +++ b/site/views/profile/tmpl/default_profiles.php @@ -9,6 +9,7 @@ * @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'); @@ -32,17 +33,19 @@ defined('_JEXEC') or die('Restricted access'); user->id > 0 && isset($this->item->idMain_memberMemberB) && MembersmanagerHelper::checkArray($this->item->idMain_memberMemberB)): ?> diff --git a/site/views/profile/view.html.php b/site/views/profile/view.html.php index fe6c33d..14c8272 100644 --- a/site/views/profile/view.html.php +++ b/site/views/profile/view.html.php @@ -9,6 +9,7 @@ * @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'); jimport('joomla.application.module.helper'); @@ -44,20 +45,23 @@ class MembersmanagerViewProfile extends JViewLegacy throw new Exception(implode("\n", $errors), 500); } // Process the content plugins. - JPluginHelper::importPlugin('content'); - // Setup Event Object. - $this->item->event = new stdClass; - // Check if item has params, or pass global params - $params = (isset($this->item->params) && MembersmanagerHelper::checkJson($this->item->params)) ? json_decode($this->item->params) : $this->params; - // onContentAfterTitle Event Trigger. - $results = $dispatcher->trigger('onContentAfterTitle', array('com_membersmanager.member', &$this->item, &$params, 0)); - $this->item->event->onContentAfterTitle = trim(implode("\n", $results)); - // onContentBeforeDisplay Event Trigger. - $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_membersmanager.member', &$this->item, &$params, 0)); - $this->item->event->onContentBeforeDisplay = trim(implode("\n", $results)); - // onContentAfterDisplay Event Trigger. - $results = $dispatcher->trigger('onContentAfterDisplay', array('com_membersmanager.member', &$this->item, &$params, 0)); - $this->item->event->onContentAfterDisplay = trim(implode("\n", $results)); + if (MembersmanagerHelper::checkObject($this->item)) + { + JPluginHelper::importPlugin('content'); + // Setup Event Object. + $this->item->event = new stdClass; + // Check if item has params, or pass global params + $params = (isset($this->item->params) && MembersmanagerHelper::checkJson($this->item->params)) ? json_decode($this->item->params) : $this->params; + // onContentAfterTitle Event Trigger. + $results = $dispatcher->trigger('onContentAfterTitle', array('com_membersmanager.member', &$this->item, &$params, 0)); + $this->item->event->onContentAfterTitle = trim(implode("\n", $results)); + // onContentBeforeDisplay Event Trigger. + $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_membersmanager.member', &$this->item, &$params, 0)); + $this->item->event->onContentBeforeDisplay = trim(implode("\n", $results)); + // onContentAfterDisplay Event Trigger. + $results = $dispatcher->trigger('onContentAfterDisplay', array('com_membersmanager.member', &$this->item, &$params, 0)); + $this->item->event->onContentAfterDisplay = trim(implode("\n", $results)); + } parent::display($tpl); }