Ejemplo n.º 1
0
 /**
  * Get the final, usable URL string (after interpolating any variables)
  *
  * @return FALSE|string
  */
 public function gettingStartedUrl()
 {
     // Note: We use "*default*" as the default (rather than self::GETTING_STARTED_URL) so that future
     // developers can change GETTING_STARTED_URL without needing to update {civicrm_setting}.
     $url = Civi::settings()->get('gettingStartedUrl');
     if ($url === '*default*') {
         $url = self::GETTING_STARTED_URL;
     }
     return CRM_Utils_System::evalUrl($url);
 }
Ejemplo n.º 2
0
Archivo: Blog.php Proyecto: kidaa30/yes
 /**
  * Get the final, usable URL string (after interpolating any variables)
  *
  * @return FALSE|string
  */
 public function getBlogUrl()
 {
     // Note: We use "*default*" as the default (rather than self::BLOG_URL) so that future
     // developers can change BLOG_URL without needing to update {civicrm_setting}.
     $url = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'blogUrl', NULL, '*default*');
     if ($url === '*default*') {
         $url = self::BLOG_URL;
     }
     return CRM_Utils_System::evalUrl($url);
 }
Ejemplo n.º 3
0
 /**
  * Get the final, usable URL string (after interpolating any variables)
  *
  * @return FALSE|string
  */
 public function getRenderedUrl()
 {
     return CRM_Utils_System::evalUrl($this->messagesUrl);
 }
Ejemplo n.º 4
0
 /**
  * Get Menu name.
  *
  * @param $value
  * @param array $skipMenuItems
  *
  * @return bool|string
  */
 public static function getMenuName(&$value, &$skipMenuItems)
 {
     // we need to localise the menu labels (CRM-5456) and don’t
     // want to use ts() as it would throw the ts-extractor off
     $i18n = CRM_Core_I18n::singleton();
     $name = $i18n->crm_translate($value['attributes']['label'], array('context' => 'menu'));
     $url = CRM_Utils_Array::value('url', $value['attributes']);
     $permission = CRM_Utils_Array::value('permission', $value['attributes']);
     $operator = CRM_Utils_Array::value('operator', $value['attributes']);
     $parentID = CRM_Utils_Array::value('parentID', $value['attributes']);
     $navID = CRM_Utils_Array::value('navID', $value['attributes']);
     $active = CRM_Utils_Array::value('active', $value['attributes']);
     $menuName = CRM_Utils_Array::value('name', $value['attributes']);
     $target = CRM_Utils_Array::value('target', $value['attributes']);
     if (in_array($parentID, $skipMenuItems) || !$active) {
         $skipMenuItems[] = $navID;
         return FALSE;
     }
     //we need to check core view/edit or supported acls.
     if (in_array($menuName, array('Search...', 'Contacts'))) {
         if (!CRM_Core_Permission::giveMeAllACLs()) {
             $skipMenuItems[] = $navID;
             return FALSE;
         }
     }
     $config = CRM_Core_Config::singleton();
     $makeLink = FALSE;
     if (isset($url) && $url) {
         if (substr($url, 0, 4) !== 'http') {
             //CRM-7656 --make sure to separate out url path from url params,
             //as we'r going to validate url path across cross-site scripting.
             $urlParam = explode('?', $url);
             if (empty($urlParam[1])) {
                 $urlParam[1] = NULL;
             }
             $url = CRM_Utils_System::url($urlParam[0], $urlParam[1], FALSE, NULL, TRUE);
         } elseif (strpos($url, '&') === FALSE) {
             $url = htmlspecialchars($url);
         }
         $makeLink = TRUE;
     }
     static $allComponents;
     if (!$allComponents) {
         $allComponents = CRM_Core_Component::getNames();
     }
     if (isset($permission) && $permission) {
         $permissions = explode(',', $permission);
         $hasPermission = FALSE;
         foreach ($permissions as $key) {
             $key = trim($key);
             $showItem = TRUE;
             //get the component name from permission.
             $componentName = CRM_Core_Permission::getComponentName($key);
             if ($componentName) {
                 if (!in_array($componentName, $config->enableComponents) || !CRM_Core_Permission::check($key)) {
                     $showItem = FALSE;
                     if ($operator == 'AND') {
                         $skipMenuItems[] = $navID;
                         return $showItem;
                     }
                 } else {
                     $hasPermission = TRUE;
                 }
             } elseif (!CRM_Core_Permission::check($key)) {
                 $showItem = FALSE;
                 if ($operator == 'AND') {
                     $skipMenuItems[] = $navID;
                     return $showItem;
                 }
             } else {
                 $hasPermission = TRUE;
             }
         }
         if (!$showItem && !$hasPermission) {
             $skipMenuItems[] = $navID;
             return FALSE;
         }
     }
     if ($makeLink) {
         $url = CRM_Utils_System::evalUrl($url);
         if ($target) {
             $name = "<a href=\"{$url}\" target=\"{$target}\">{$name}</a>";
         } else {
             $name = "<a href=\"{$url}\">{$name}</a>";
         }
     }
     return $name;
 }
Ejemplo n.º 5
0
 /**
  * Determine the URL which provides a feed of available extensions.
  *
  * @return string|FALSE
  */
 public function getRepositoryUrl()
 {
     if (empty($this->_repoUrl) && $this->_repoUrl !== FALSE) {
         $url = Civi::settings()->get('ext_repo_url');
         // boolean false means don't try to check extensions
         // CRM-10575
         if ($url === FALSE) {
             $this->_repoUrl = FALSE;
         } else {
             $this->_repoUrl = CRM_Utils_System::evalUrl($url);
         }
     }
     return $this->_repoUrl;
 }
Ejemplo n.º 6
0
 /**
  * Determine the URL which provides a feed of available extensions.
  *
  * @return string|FALSE
  */
 public function getRepositoryUrl()
 {
     if (empty($this->_repoUrl) && $this->_repoUrl !== FALSE) {
         $config = CRM_Core_Config::singleton();
         $url = CRM_Core_BAO_Setting::getItem('Extension Preferences', 'ext_repo_url', NULL, CRM_Extension_Browser::DEFAULT_EXTENSIONS_REPOSITORY);
         // boolean false means don't try to check extensions
         // http://issues.civicrm.org/jira/browse/CRM-10575
         if ($url === FALSE) {
             $this->_repoUrl = FALSE;
         } else {
             $this->_repoUrl = CRM_Utils_System::evalUrl($url);
         }
     }
     return $this->_repoUrl;
 }
Ejemplo n.º 7
0
 public function testEvalUrl()
 {
     $this->assertEquals(FALSE, CRM_Utils_System::evalUrl(FALSE));
     $this->assertEquals('http://example.com/', CRM_Utils_System::evalUrl('http://example.com/'));
     $this->assertEquals('http://example.com/?cms=UnitTests', CRM_Utils_System::evalUrl('http://example.com/?cms={uf}'));
 }