generateId() public static method

Generates a connection id and returns it.
public static generateId ( string $seed = '' ) : string
$seed string A unique ID to be included in the token.
return string The generated id string.
Beispiel #1
0
 /**
  * Get a token for protecting a form.
  *
  * @since Horde 3.2
  */
 function getRequestToken($slug)
 {
     require_once 'Horde/Token.php';
     $token = Horde_Token::generateId($slug);
     $_SESSION['horde_form_secrets'][$token] = true;
     return $token;
 }
Beispiel #2
0
 function preserve($vars)
 {
     if ($this->_useFormToken) {
         $token = Horde_Token::generateId($this->_name);
         $GLOBALS['session']->set('horde', 'form_secrets/' . $token, true);
         $this->_preserveVarByPost($this->_name . '_formToken', $token);
     }
     $variables = $this->getVariables();
     foreach ($variables as $var) {
         $varname = $var->getVarName();
         /* Save value of individual components. */
         switch ($var->getTypeName()) {
             case 'passwordconfirm':
             case 'emailconfirm':
                 $this->preserveVarByPost($vars, $varname . '[original]');
                 $this->preserveVarByPost($vars, $varname . '[confirm]');
                 break;
             case 'monthyear':
                 $this->preserveVarByPost($vars, $varname . '[month]');
                 $this->preserveVarByPost($vars, $varname . '[year]');
                 break;
             case 'monthdayyear':
                 $this->preserveVarByPost($vars, $varname . '[month]');
                 $this->preserveVarByPost($vars, $varname . '[day]');
                 $this->preserveVarByPost($vars, $varname . '[year]');
                 break;
         }
         $this->preserveVarByPost($vars, $varname);
     }
     foreach ($this->_hiddenVariables as $var) {
         $this->preserveVarByPost($vars, $var->getVarName());
     }
 }
Beispiel #3
0
    public function renderActive($form, $action, $method = 'get', $enctype = null, $focus = true)
    {
        $this->_name = $form->getName();
        echo "<form class=\"horde-form\" action=\"{$action}\" method=\"{$method}\"" . (empty($this->_name) ? '' : ' id="' . $this->_name . '"') . (is_null($this->_enctype) ? '' : ' enctype="' . $this->_enctype . '"') . ">\n";
        echo Horde_Util::formInput();
        $this->listFormVars($form);
        if (!empty($this->_name)) {
            $this->_preserveVarByPost('formname', $this->_name);
        }
        if ($form->useToken()) {
            $this->_preserveVarByPost($this->_name . '_formToken', Horde_Token::generateId($this->_name));
        }
        if (count($form->getSections())) {
            $this->_preserveVarByPost('__formOpenSection', $form->getOpenSection());
        }
        $vars = $form->getVars();
        $variables = $form->getVariables();
        foreach ($variables as $var) {
            if ($var->getOption('trackchange')) {
                $varname = $var->getVarName();
                $this->preserveVarByPost($vars, $varname, '__old_' . $varname);
            }
        }
        foreach ($form->getHiddenVariables() as $var) {
            $this->preserveVarByPost($vars, $var->getVarName());
        }
        $this->_renderBeginActive($form->getTitle());
        $this->_renderForm($form, true);
        $this->submit($this->_submit, $this->_reset);
        echo "\n</fieldset>\n</form>\n";
        if ($focus && !empty($this->_firstField)) {
            echo '<script type="text/javascript">
try {
    document.getElementById("' . $this->_firstField . '").focus();
} catch (e) {}
</script>
';
        }
    }