Exemplo n.º 1
0
 /**
  * Makes debug output
  * Prints $var in bold between two vertical lines
  * If not $var the word 'debug' is printed
  * If $var is an array, the array is printed by t3lib_div::print_array()
  *
  * @param	mixed		Variable to print
  * @param	mixed		If the parameter is a string it will be used as header. Otherwise number of break tags to apply after (positive integer) or before (negative integer) the output.
  * @return	void
  */
 public static function debug($var = '', $brOrHeader = 0)
 {
     // buffer the output of debug if no buffering started before
     if (ob_get_level() == 0) {
         ob_start();
     }
     if ($brOrHeader && !div::testInt($brOrHeader)) {
         echo '<table class="debug" border="0" cellpadding="0" cellspacing="0" bgcolor="white" style="border:0px; margin-top:3px; margin-bottom:3px;"><tr><td style="background-color:#bbbbbb; font-family: verdana,arial; font-weight: bold; font-size: 10px;">' . htmlspecialchars((string) $brOrHeader) . '</td></tr><tr><td>';
     } elseif ($brOrHeader < 0) {
         for ($a = 0; $a < abs(intval($brOrHeader)); $a++) {
             echo '<br />';
         }
     }
     if (is_array($var)) {
         div::print_array($var);
     } elseif (is_object($var)) {
         echo '<b>|Object:<pre>';
         print_r($var);
         echo '</pre>|</b>';
     } elseif ((string) $var != '') {
         echo '<b>|' . htmlspecialchars((string) $var) . '|</b>';
     } else {
         echo '<b>| debug |</b>';
     }
     if ($brOrHeader && !div::testInt($brOrHeader)) {
         echo '</td></tr></table>';
     } elseif ($brOrHeader > 0) {
         for ($a = 0; $a < intval($brOrHeader); $a++) {
             echo '<br />';
         }
     }
 }
 /**
  * 
  * 
  * @param 
  * @access public
  * @return void 
  */
 function checkForm()
 {
     $reservation = $this->getReservation($this->vars['depart'], $this->vars['arrivee'], $this->vars['horaire']);
     if (!count($reservation)) {
         return $this->getContentReservation('La réservation que vous avez sélectionné n\'éxiste plus');
     }
     $message = '';
     if (!isset($this->vars['nb_personnes']) || !$this->vars['nb_personnes'] || !div::testInt($this->vars['nb_personnes'])) {
         $message = 'Vous devez rentrer un nombre de personnes';
     } elseif ($this->vars['nb_personnes'] == $reservation['nb_personnes']) {
         $message = 'Le nombre de personnes doit être différent de l\'ancienne valeur';
     }
     return $message;
 }
Exemplo n.º 3
0
 /**
  * 
  * 
  * @param 
  * @access public
  * @return void 
  */
 private function checkForm()
 {
     $no_error = true;
     if (!isset($this->vars['nombre']) || intval($this->vars['nombre']) > 4 || intval($this->vars['nombre']) <= 0) {
         div::debug(intval($this->vars['nombre']), 'erreur nombre');
         $no_error = false;
     }
     $issetLigne = isset($this->Treelignes[intval($this->vars['ligne'])]);
     if (!isset($this->vars['ligne']) || !$issetLigne) {
         div::debug($this->vars['ligne'], 'erreur ligne');
         $no_error = false;
     }
     if (!isset($this->vars['depart']) || !$this->issetArret($this->vars['depart'], intval($this->vars['ligne']))) {
         div::debug($this->vars['depart'], 'erreur depart');
         $no_error = false;
     }
     if (!isset($this->vars['arrive']) || !$this->issetArret($this->vars['arrive'], intval($this->vars['ligne']))) {
         div::debug($this->vars['arrive'], 'erreur arrive');
         $no_error = false;
     }
     if (!isset($this->vars['date']) || !div::valideDate($this->vars['date'])) {
         div::debug($this->vars['date'], 'erreur date');
         $no_error = false;
     }
     if (!isset($this->vars['heure']) || !div::testInt(intval($this->vars['heure'])) || intval($this->vars['heure']) < 0 || intval($this->vars['heure']) > 23) {
         div::debug(intval($this->vars['heure']), 'erreur heure');
         $no_error = false;
     }
     if (isset($this->vars['depart']) && isset($this->vars['arrive']) && $this->vars['depart'] == $this->vars['arrive']) {
         div::debug('erreur', 'erreur meme arrive et depart');
         $no_error = false;
     }
     if (!isset($this->vars['min']) || !div::testInt(intval($this->vars['min'])) || intval($this->vars['min']) < 0 || intval($this->vars['min']) > 59) {
         div::debug(intval($this->vars['min']), 'erreur min');
         $no_error = false;
     }
     return $no_error;
 }
Exemplo n.º 4
0
 /**
  * 
  * 
  * @param 
  * @access public
  * @return void 
  */
 function processDateSubpart_callback($match)
 {
     /* Declare */
     $dateFormat = $match[1];
     $format = false;
     $date = trim($match[2]);
     $res = '';
     /* Begin */
     if (div::testInt($date)) {
         $date = intval($date);
     } else {
         $date = strtotime($date);
     }
     if (strpos($dateFormat, ':')) {
         list($dateFormat, $format) = explode(':', $dateFormat, 2);
     }
     switch ($dateFormat) {
         case 'strftime':
             $res = strftime($format, $date);
             break;
         case 'date':
             $res = date($format, $date);
             break;
     }
     return $res;
 }