tangra logo
   
[ class tree: tangra_lib ] [ index: tangra_lib ] [ all elements ]
 

Class: Form_Guard

Source Location: /form/form_guard.class.php

Class Form_Guard

Class Overview

Form_Guard is used to prevent "form pumping"

Form_Guard is used to prevent "form pumping" or "submit pumping" which happens when impatient site visitor clicks more than once on submit button. This class is not intended to be directly used by the users.

Located in /form/form_guard.class.php [line 33]

Tangra_Class
   |
   --Form_Guard

Properties

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From Tangra_Class

Tangra_Class::get_class_name()
Alias of get_class(). Exist because of historical reasons.
Tangra_Class::__set()
Overides PHP built-in method and just throws exception if called. Purpose - to "forbid" autosetting of nonexisting class properties.

[ Top ]
Property Summary
Form   $form   Form object
Vars_manager   $form_guarded_pairs_vm   Vars manager for guarded pairs

[ Top ]
Method Summary
Form_Guard   __construct()   Constructor
unknown   check_guard_pair()   Checks if the value received by the last submit is valid
integer   generate_new_random()   Generates random number
string   get_new_form_id()   Generates new form_id
boolean   is_fresh_submit()   Checks if it is first time submit, i.e. not second transmitions of same data caused by pumping on submit button
string   new_guard_pair()   Generates new guard pair
void   set_form_id_value()   Sets form_id value
void   set_guard_value()   Sets guard value

[ Top ]
Properties
Form   $form [line 40]

Form object

API Tags:
Internal:  
Access:  private


[ Top ]
Vars_manager   $form_guarded_pairs_vm [line 50]

Vars manager for guarded pairs

Must be "permanent vars storage as Session_Vars_Manager ot Trhread_Vars_Manager

API Tags:
Internal:  
Access:  private


[ Top ]
Methods
Constructor __construct  [line 59]

  Form_Guard __construct( Guardable_Form &$form, Vars_Manager &$form_guarded_pairs_vm, Guardable_Form $form, Vars_Manager $form_guarded_pairs_vm  )

Constructor

Parameters:
Guardable_Form   $form: 
Vars_Manager   $form_guarded_pairs_vm: 
Guardable_Form   &$form: 
Vars_Manager   &$form_guarded_pairs_vm: 


[ Top ]
check_guard_pair  [line 88]

  unknown check_guard_pair( unknown_type $form_id  )

Checks if the value received by the last submit is valid

Parameters:
unknown_type   $form_id: 

API Tags:
Access:  public


[ Top ]
generate_new_random  [line 138]

  integer generate_new_random( )

Generates random number


API Tags:
Internal:  
Access:  private


[ Top ]
get_new_form_id  [line 123]

  string get_new_form_id( )

Generates new form_id


API Tags:
Internal:  
Access:  private


[ Top ]
is_fresh_submit  [line 112]

  boolean is_fresh_submit( string $form_id  )

Checks if it is first time submit, i.e. not second transmitions of same data caused by pumping on submit button

Parameters:
string   $form_id: 

API Tags:
Access:  public


[ Top ]
new_guard_pair  [line 70]

  string new_guard_pair( )

Generates new guard pair


API Tags:
Access:  public


[ Top ]
set_form_id_value  [line 149]

  void set_form_id_value( string $value  )

Sets form_id value

Parameters:
string   $value: 

API Tags:
Internal:  
Access:  private


[ Top ]
set_guard_value  [line 160]

  void set_guard_value( unknown_type $value  )

Sets guard value

Parameters:
unknown_type   $value: 

API Tags:
Internal:  
Access:  private


[ Top ]