| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
static $_sessionID = NULL;
/**
- * Generate a private key per session and store in session
+ * Generate a private key per session and store in session.
*
- * @return string private key for this session
- * @static
+ * @return string
+ * private key for this session
*/
public static function privateKey() {
if (!self::$_key) {
* and a private key. Modelled after drupal's form API
*
* @param string $name
- * @param bool $addSequence should we add a unique sequence number to the end of the key
+ * @param bool $addSequence
+ * Should we add a unique sequence number to the end of the key.
*
- * @return string valid formID
- * @static
+ * @return string
+ * valid formID
*/
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
}
/**
- * Validate a form key based on the form name
+ * Validate a form key based on the form name.
*
* @param string $key
* @param string $name
* @param bool $addSequence
*
- * @return string $formKey if valid, else null
- * @static
+ * @return string
+ * if valid, else null
*/
public static function validate($key, $name, $addSequence = FALSE) {
if (!is_string($key)) {
// ensure that hash is a 32 digit hex number
return preg_match('#[0-9a-f]{32}#i', $hash) ? TRUE : FALSE;
}
+
}