Merge pull request #2173 from webpartners/master
[civicrm-core.git] / CRM / Core / Invoke.php
index 05a726f43fa808badb1490215509afa566ab2881..b3bc1a52674b7a8b8f9bde4f5f24247ff47ac51f 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -414,10 +414,6 @@ class CRM_Core_Invoke {
     }
 
     if ($secondArg == 'edit' || $secondArg == 'create') {
-      // set the userContext stack
-      $session = CRM_Core_Session::singleton();
-      $session->pushUserContext(CRM_Utils_System::url('civicrm/profile', 'reset=1'));
-
       $buttonType = CRM_Utils_Array::value('_qf_Edit_cancel', $_POST);
       // CRM-5849: we should actually check the button *type*, but we get the *value*, potentially translated;
       // we should keep both English and translated checks just to make sure we also handle untranslated Cancels
@@ -456,8 +452,13 @@ class CRM_Core_Invoke {
       }
     }
 
-    $page = new CRM_Profile_Page_Listings();
-    return $page->run();
+    if ($secondArg == 'view' || empty($secondArg)) {
+      $page = new CRM_Profile_Page_Listings();
+      return $page->run();
+    }
+
+    CRM_Utils_System::permissionDenied();
+    return;
   }
 
   /**
@@ -489,6 +490,9 @@ class CRM_Core_Invoke {
     // also cleanup module permissions
     $config->cleanupPermissions();
 
+    // also rebuild word replacement cache
+    CRM_Core_BAO_WordReplacement::rebuild();
+
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     CRM_Core_Resources::singleton()->resetCacheCode();