X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FKey.php;h=88b60d02d25a922edc5ba62133a88fd1b56a74d9;hb=4846df9154866b0a33ee8ec7a1f48c65c77b670b;hp=351743480eff0298ae1e0f833893dd1e9c2826d3;hpb=a5d44edbee5498fa4195c5f3571db6b820185fa8;p=civicrm-core.git diff --git a/CRM/Core/Key.php b/CRM/Core/Key.php index 351743480e..88b60d02d2 100644 --- a/CRM/Core/Key.php +++ b/CRM/Core/Key.php @@ -1,7 +1,7 @@ get('qfPrivateKey'); @@ -59,7 +58,7 @@ class CRM_Core_Key { /** * @return mixed|null|string */ - static function sessionID() { + public static function sessionID() { if (!self::$_sessionID) { $session = CRM_Core_Session::singleton(); self::$_sessionID = $session->get('qfSessionID'); @@ -75,20 +74,17 @@ class CRM_Core_Key { * Generate a form key based on form name, the current user session * and a private key. Modelled after drupal's form API * - * @param $name + * @param string $name * @param bool $addSequence + * Should we add a unique sequence number to the end of the key. * - * @internal param string $value name of the form - * @paeam boolean $addSequence should we add a unique sequence number to the end of the key - * - * @return string valid formID - * @static - * @acess public + * @return string + * valid formID */ - static function get($name, $addSequence = FALSE) { + public static function get($name, $addSequence = FALSE) { $privateKey = self::privateKey(); - $sessionID = self::sessionID(); - $key = md5($sessionID . $name . $privateKey); + $sessionID = self::sessionID(); + $key = md5($sessionID . $name . $privateKey); if ($addSequence) { // now generate a random number between 1 and 100K and add it to the key @@ -99,19 +95,16 @@ class CRM_Core_Key { } /** - * Validate a form key based on the form name + * Validate a form key based on the form name. * - * @param $key + * @param string $key * @param string $name - * * @param bool $addSequence * - * @internal param string $formKey - * @return string $formKey if valid, else null - * @static - * @acess public + * @return string + * if valid, else null */ - static function validate($key, $name, $addSequence = FALSE) { + public static function validate($key, $name, $addSequence = FALSE) { if (!is_string($key)) { return NULL; } @@ -139,7 +132,7 @@ class CRM_Core_Key { * * @return bool */ - static function valid($key) { + public static function valid($key) { // a valid key is a 32 digit hex number // followed by an optional _ and a number between 1 and 10000 if (strpos('_', $key) !== FALSE) { @@ -160,5 +153,5 @@ class CRM_Core_Key { // ensure that hash is a 32 digit hex number return preg_match('#[0-9a-f]{32}#i', $hash) ? TRUE : FALSE; } -} +}