Exemple #1
0
 /**
  * Output HTML form
  */
 function html()
 {
     global $INPUT;
     if (!$INPUT->has('data')) {
         echo $this->locale_xhtml('intro');
         //If there was an error the last time we tried to autosubmit, warn the user
         if ($this->helper->isAutoSubmitEnabled()) {
             if (file_exists($this->helper->autosubmitErrorFile)) {
                 echo $this->getLang('autosubmitError');
                 echo io_readFile($this->helper->autosubmitErrorFile);
             }
         }
         flush();
         echo $this->buildForm('server');
         //Print the last time the data was sent
         $lastSent = $this->helper->lastSentTime();
         if ($lastSent !== 0) {
             echo $this->getLang('lastSent') . ' ' . datetime_h($lastSent);
         }
     } else {
         //If we just submitted the form
         if ($this->sentStatus === '') {
             //If we successfully sent the data
             echo $this->locale_xhtml('submitted');
         } else {
             //If we failed to submit the data, try directly with the browser
             echo $this->getLang('submissionFailed') . $this->sentStatus . '<br />';
             echo $this->getLang('submitDirectly');
             echo $this->buildForm('browser', $INPUT->str('data'));
         }
     }
 }
Exemple #2
0
 /**
  * Check if it's time to send autosubmit data
  * (we should have check if autosubmit is enabled first)
  */
 function _isTooEarlyToSubmit()
 {
     $lastSubmit = $this->helper->lastSentTime();
     return $lastSubmit + 24 * 60 * 60 * 30 > time();
 }