Event Cart: honor the allow_same_participant_emails setting
[civicrm-core.git] / CRM / Core / Menu.php
index 66a4cf593bf92981ca34b1e9d2c3e6a360dd6fb9..796491120402e5ddfba89dcc2c04d6b1a7f031aa 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017                                |
+ | Copyright CiviCRM LLC (c) 2004-2019                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -29,7 +29,7 @@
  * This file contains the various menus of the CiviCRM module
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2019
  */
 
 require_once 'CRM/Core/I18n.php';
@@ -44,16 +44,16 @@ class CRM_Core_Menu {
    *
    * @var array
    */
-  static $_items = NULL;
+  public static $_items = NULL;
 
   /**
    * The list of permissioned menu items.
    *
    * @var array
    */
-  static $_permissionedItems = NULL;
+  public static $_permissionedItems = NULL;
 
-  static $_serializedElements = array(
+  public static $_serializedElements = array(
     'access_arguments',
     'access_callback',
     'page_arguments',
@@ -61,7 +61,7 @@ class CRM_Core_Menu {
     'breadcrumb',
   );
 
-  static $_menuCache = NULL;
+  public static $_menuCache = NULL;
   const MENU_ITEM = 1;
 
   /**
@@ -307,7 +307,6 @@ class CRM_Core_Menu {
 
     self::build($menuArray);
 
-    $config = CRM_Core_Config::singleton();
     $daoFields = CRM_Core_DAO_Menu::fields();
 
     foreach ($menuArray as $path => $item) {
@@ -318,7 +317,7 @@ class CRM_Core_Menu {
       $menu->find(TRUE);
 
       if (!CRM_Core_Config::isUpgradeMode() ||
-        CRM_Core_DAO::checkFieldExists('civicrm_menu', 'module_data', FALSE)
+        CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_menu', 'module_data', FALSE)
       ) {
         // Move unrecognized fields to $module_data.
         $module_data = array();
@@ -368,13 +367,12 @@ class CRM_Core_Menu {
         'title' => $item['title'],
         'desc' => CRM_Utils_Array::value('desc', $item),
         'id' => strtr($item['title'], array(
-            '(' => '_',
-            ')' => '',
-            ' ' => '',
-            ',' => '_',
-            '/' => '_',
-          )
-        ),
+          '(' => '_',
+          ')' => '',
+          ' ' => '',
+          ',' => '_',
+          '/' => '_',
+        )),
         'url' => CRM_Utils_System::url($path, $query,
           FALSE,
           NULL,
@@ -571,11 +569,16 @@ class CRM_Core_Menu {
           'title' => $menu[$currentPath]['title'],
           'url' => CRM_Utils_System::url($currentPath,
             'reset=1' . $urlVar,
-            FALSE, // absolute
-            NULL, // fragment
-            TRUE, // htmlize
-            FALSE, // frontend
-            TRUE // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
+            // absolute
+            FALSE,
+            // fragment
+            NULL,
+            // htmlize
+            TRUE,
+            // frontend
+            FALSE,
+            // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend
+            TRUE
           ),
         );
       }
@@ -673,8 +676,6 @@ class CRM_Core_Menu {
     // return null if menu rebuild
     $config = CRM_Core_Config::singleton();
 
-    $params = array();
-
     $args = explode('/', $path);
 
     $elements = array();
@@ -687,22 +688,13 @@ class CRM_Core_Menu {
 
     $queryString = implode(', ', $elements);
     $domainID = CRM_Core_Config::domainID();
-    $domainWhereClause = " AND domain_id = $domainID ";
-    if ($config->isUpgradeMode() &&
-      !CRM_Core_DAO::checkFieldExists('civicrm_menu', 'domain_id')
-    ) {
-      //domain_id wouldn't be available for earlier version of
-      //3.0 and therefore can't be used as part of query for
-      //upgrade case
-      $domainWhereClause = "";
-    }
 
     $query = "
 (
   SELECT *
   FROM     civicrm_menu
   WHERE    path in ( $queryString )
-           $domainWhereClause
+           AND domain_id = $domainID
   ORDER BY length(path) DESC
   LIMIT    1
 )
@@ -714,7 +706,7 @@ UNION (
   SELECT *
   FROM   civicrm_menu
   WHERE  path IN ( 'navigation' )
-         $domainWhereClause
+         AND domain_id = $domainID
 )
 ";
     }
@@ -752,12 +744,6 @@ UNION (
       }
     }
 
-    // *FIXME* : hack for 2.1 -> 2.2 upgrades.
-    if ($path == 'civicrm/upgrade') {
-      $menuPath['page_callback'] = 'CRM_Upgrade_Page_Upgrade';
-      $menuPath['access_arguments'][0][] = 'administer CiviCRM';
-      $menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
-    }
     // *FIXME* : hack for 4.1 -> 4.2 upgrades.
     if (preg_match('/^civicrm\/(upgrade\/)?queue\//', $path)) {
       CRM_Queue_Menu::alter($path, $menuPath);