X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FPage%2FView.php;h=65619f6bb2cd21b38f00b071f2c8cd704cd7bdd1;hb=ba9eb348014a1316a8874e26033c1cbb54b62b67;hp=1e66182cd39adbe6f9f25a9ce8c1b0d515d543f3;hpb=68d6b897b10ec82e276280d07d9614c79561639d;p=civicrm-core.git diff --git a/CRM/Contact/Page/View.php b/CRM/Contact/Page/View.php index 1e66182cd3..65619f6bb2 100644 --- a/CRM/Contact/Page/View.php +++ b/CRM/Contact/Page/View.php @@ -40,7 +40,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { /** - * the id of the object being viewed (note/relationship etc) + * The id of the object being viewed (note/relationship etc) * * @int * @access protected @@ -48,7 +48,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { protected $_id; /** - * the contact id of the contact being viewed + * The contact id of the contact being viewed * * @int * @access protected @@ -167,7 +167,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { $image_URL = str_replace('http://', 'https://', $image_URL); } - list($imageWidth, $imageHeight) = getimagesize($image_URL); + list($imageWidth, $imageHeight) = getimagesize(CRM_Utils_String::unstupifyUrl($image_URL)); list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight); $this->assign("imageWidth", $imageWidth); $this->assign("imageHeight", $imageHeight); @@ -259,6 +259,8 @@ class CRM_Contact_Page_View extends CRM_Core_Page { /** * Get meta details of the contact. * + * @param int $contactId + * * @return array contact fields in fixed order * @access public */ @@ -274,6 +276,10 @@ class CRM_Contact_Page_View extends CRM_Core_Page { ); } + /** + * @param $page + * @param int $contactID + */ static function checkUserPermission($page, $contactID = NULL) { // check for permissions $page->_permission = NULL; @@ -309,6 +315,12 @@ class CRM_Contact_Page_View extends CRM_Core_Page { } } + /** + * @param int $contactId + * @param bool $isDeleted + * + * @return string + */ static function setTitle($contactId, $isDeleted = FALSE) { static $contactDetails; $displayName = $contactImage = NULL; @@ -338,47 +350,19 @@ class CRM_Contact_Page_View extends CRM_Core_Page { /** * Add urls for display in the actions menu + * @param CRM_Core_Page $obj + * @param integer $cid */ static function addUrls(&$obj, $cid) { - // TODO rewrite without so many hard-coded CMS bits; use abstractions like CRM_Core_Permission::check('cms:...') and CRM_Utils_System + $uid = CRM_Core_BAO_UFMatch::getUFId($cid); - $config = CRM_Core_Config::singleton(); - $session = CRM_Core_Session::singleton(); - $uid = CRM_Core_BAO_UFMatch::getUFId($cid); - $userRecordUrl = NULL; if ($uid) { - if ($config->userSystem->is_drupal == '1' && - ($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users', 'cms:view user account'))) - ) { - $userRecordUrl = CRM_Utils_System::url('user/' . $uid); - } - elseif ($config->userFramework == 'Joomla') { - $userRecordUrl = NULL; - // if logged in user is super user, then he can view other users joomla profile - if (JFactory::getUser()->authorise('core.admin')) { - $userRecordUrl = $config->userFrameworkBaseURL . "index.php?option=com_users&view=user&task=user.edit&id=" . $uid; - } - elseif ($session->get('userID') == $cid) { - $userRecordUrl = $config->userFrameworkBaseURL . "index.php?option=com_admin&view=profile&layout=edit&id=" . $uid; - } - } - // For WordPress, provide link to user profile is contact belongs to logged in user OR user has administrator role - elseif ($config->userFramework == 'WordPress' && - ($session->get('userID') == $cid || CRM_Core_Permission::checkAnyPerm(array('cms:administer users'))) - ) { - $userRecordUrl = $config->userFrameworkBaseURL . "wp-admin/user-edit.php?user_id=" . $uid; - } + $userRecordUrl = CRM_Core_Config::singleton()->userSystem->getUserRecordUrl($cid); $obj->assign('userRecordUrl', $userRecordUrl); $obj->assign('userRecordId', $uid); } - elseif (($config->userSystem->is_drupal == '1' && CRM_Core_Permission::check('administer users')) || - ($config->userFramework == 'Joomla' && - JFactory::getUser()->authorise('core.create', 'com_users') - ) - ) { - $userAddUrl = CRM_Utils_System::url('civicrm/contact/view/useradd', - 'reset=1&action=add&cid=' . $cid - ); + elseif (CRM_Core_Config::singleton()->userSystem->checkPermissionAddUser()) { + $userAddUrl = CRM_Utils_System::url('civicrm/contact/view/useradd', 'reset=1&action=add&cid=' . $cid); $obj->assign('userAddUrl', $userAddUrl); }