Beispiel #1
0
 /**
  * @shortdesc This calls the constructor of main-class for extracting the config array and generating all needed params. Additionally it control the garbage-collector.
  * @public
  * @type void
  * @return nothing
  *
  **/
 function __construct($config, $secure = TRUE)
 {
     // Call Constructor of main-class
     parent::__construct($config, $secure);
     // specify counter-filename
     if ($this->counter_filename == '') {
         $this->counter_filename = $this->tempfolder . $this->counter_fn_default_basename;
     }
     if ($this->debug) {
         echo "\n<br>-Captcha-Debug: The counterfilename is (" . $this->counter_filename . ")";
     }
     // retrieve last counter-value
     $test = $this->txt_counter($this->counter_filename);
     // set and retrieve current counter-value
     $counter = $this->txt_counter($this->counter_filename, TRUE);
     // check if counter works correct
     if ($counter !== FALSE && $counter - $test == 1) {
         // Counter works perfect, =:)
         if ($this->debug) {
             echo "\n<br>-Captcha-Debug: Current counter-value is ({$counter}). Garbage-collector should start at (" . $this->collect_garbage_after . ")";
         }
         // check if garbage-collector should run
         if ($counter >= $this->collect_garbage_after) {
             // Reset counter
             if ($this->debug) {
                 echo "\n<br>-Captcha-Debug: Reset the counter-value. (0)";
             }
             $this->txt_counter($this->counter_filename, TRUE, 0);
             // start garbage-collector
             $this->garbage_collector_error = $this->collect_garbage() ? FALSE : TRUE;
             if ($this->debug && $this->garbage_collector_error) {
                 echo "\n<br>-Captcha-Debug: ERROR! SOME TRASHFILES COULD NOT BE DELETED! (Set the garbage_collector_error to TRUE)";
             }
         }
     } else {
         // Counter-ERROR!
         if ($this->debug) {
             echo "\n<br>-Captcha-Debug: ERROR! NO COUNTER-VALUE AVAILABLE! (Set the garbage_collector_error to TRUE)";
         }
         $this->garbage_collector_error = TRUE;
     }
 }