コード例 #1
0
ファイル: Controller.php プロジェクト: hguru/224Civi
 function key($name, $addSequence = FALSE, $ignoreKey = FALSE)
 {
     $config = CRM_Core_Config::singleton();
     if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
         return NULL;
     }
     $key = CRM_Utils_Array::value('qfKey', $_REQUEST, NULL);
     if (!$key && $_SERVER['REQUEST_METHOD'] === 'GET') {
         $key = CRM_Core_Key::get($name, $addSequence);
     } else {
         $key = CRM_Core_Key::validate($key, $name, $addSequence);
     }
     if (!$key) {
         $this->invalidKey();
     }
     $this->_key = $key;
     return $key;
 }
コード例 #2
0
ファイル: Controller.php プロジェクト: ksecor/civicrm
 function key($name, $addSequence = false, $ignoreKey = false)
 {
     $config =& CRM_Core_Config::singleton();
     if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
         return null;
     }
     require_once 'CRM/Core/Key.php';
     $key = CRM_Utils_Array::value('qfKey', $_REQUEST, null);
     if (!$key) {
         $key = CRM_Core_Key::get($name, $addSequence);
     } else {
         $key = CRM_Core_Key::validate($key, $name, $addSequence);
     }
     if (!$key) {
         CRM_Core_Error::fatal('Could not find valid Key');
     }
     $this->_key = $key;
     return $key;
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: bhirsch/voipdev
 function key($name, $addSequence = false, $ignoreKey = false)
 {
     $config =& CRM_Core_Config::singleton();
     if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
         return null;
     }
     require_once 'CRM/Core/Key.php';
     $key = CRM_Utils_Array::value('qfKey', $_REQUEST, null);
     if (!$key) {
         $key = CRM_Core_Key::get($name, $addSequence);
     } else {
         $key = CRM_Core_Key::validate($key, $name, $addSequence);
     }
     if (!$key) {
         $msg = ts('We can\'t load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.') . '<br /><br />' . ts('Error type: Could not find a valid key.');
         CRM_Core_Error::fatal($msg);
     }
     $this->_key = $key;
     return $key;
 }
コード例 #4
0
 static function checkMenuItem(&$item)
 {
     if (!array_key_exists('access_callback', $item)) {
         CRM_Core_Error::backtrace();
         CRM_Core_Error::fatal();
     }
     // if component_id is present, ensure it is enabled
     if (isset($item['component_id']) && $item['component_id']) {
         $config = CRM_Core_Config::singleton();
         if (is_array($config->enableComponentIDs) && in_array($item['component_id'], $config->enableComponentIDs)) {
             // continue with process
         } else {
             return FALSE;
         }
     }
     // the following is imitating drupal 6 code in includes/menu.inc
     if (empty($item['access_callback']) || is_numeric($item['access_callback'])) {
         return (bool) $item['access_callback'];
     }
     // check whether the following Ajax requests submitted the right key
     // FIXME: this should be integrated into ACLs proper
     if (CRM_Utils_Array::value('page_type', $item) == 3) {
         if (!CRM_Core_Key::validate($_REQUEST['key'], $item['path'])) {
             return FALSE;
         }
     }
     // check if callback is for checkMenu, if so optimize it
     if (is_array($item['access_callback']) && $item['access_callback'][0] == 'CRM_Core_Permission' && $item['access_callback'][1] == 'checkMenu') {
         $op = CRM_Utils_Array::value(1, $item['access_arguments'], 'and');
         return self::checkMenu($item['access_arguments'][0], $op);
     } else {
         return call_user_func_array($item['access_callback'], $item['access_arguments']);
     }
 }
コード例 #5
0
 function key($name, $addSequence = false, $ignoreKey = false)
 {
     $config = CRM_Core_Config::singleton();
     if ($ignoreKey || isset($config->keyDisable) && $config->keyDisable) {
         return null;
     }
     require_once 'CRM/Core/Key.php';
     $key = CRM_Utils_Array::value('qfKey', $_REQUEST, null);
     if (!$key) {
         $key = CRM_Core_Key::get($name, $addSequence);
     } else {
         $key = CRM_Core_Key::validate($key, $name, $addSequence);
     }
     if (!$key) {
         $msg = ts('We can\'t load the requested web page. This page requires cookies to be enabled in your browser settings. Please check this setting and enable cookies (if they are not enabled). Then try again. If this error persists, contact the site adminstrator for assistance.') . '<br /><br />' . ts('Site Administrators: This error may indicate that users are accessing this page using a domain or URL other than the configured Base URL. EXAMPLE: Base URL is http://example.org, but some users are accessing the page via http://www.example.org or a domain alias like http://myotherexample.org.') . '<br /><br />' . ts('Error type: Could not find a valid session key.');
         CRM_Core_Error::fatal($msg);
     }
     $this->_key = $key;
     return $key;
 }