コード例 #1
0
ファイル: XhamLogs.php プロジェクト: jeromecc/tuv2
 function addLog($type, $description, $idcible = '')
 {
     if ($description != "Configuration|cron" and $description != "Importation") {
         $date = new clDate();
         $data['idapplication'] = IDAPPLICATION;
         if (isset($session)) {
             $data['iduser'] = $this->xham->user->getLogin();
         } elseif (is_object($this->xham) && is_object($this->xham->user)) {
             $data['iduser'] = $this->xham->user->getLogin();
         } else {
             $data['iduser'] = $_SESSION['informations']['iduser'] ? $_SESSION['informations']['iduser'] : "******";
         }
         $data['idcible'] = $idcible;
         // print $this->logSup ;
         $data['type'] = $type;
         $data['ip'] = $_SERVER['REMOTE_ADDR'];
         $data['date'] = $date->getDatetime();
         $data['description'] = $description;
         $finTemps = XhamTools::temps();
         $tpPage = $finTemps - $this->xham->debTemps;
         $data['tempsPage'] = $tpPage;
         $data['tempsSQL'] = $this->xham->tpRequetes;
         $data['nombreSQL'] = $this->xham->nbRequetes + 1;
         // Appel de la classe Requete.
         $req = new XhamRequete(BASEXHAM, TABLELOGS, $data);
         // Exécution de la requete.
         $res = $req->addRecord();
         // print affTab ( $res ) ;
         // Limitation du nombre de lignes dans la table logs... Désactivé, mais fonctionne parfaitement.
         //$mini = $res['cur_id'] - 150 ;
         //$res = $requete->delRecord ( "idlog<=$mini" ) ;
     }
 }
コード例 #2
0
ファイル: Xham.php プロジェクト: jeromecc/tuv2
 function initCounts()
 {
     if (!defined("DEFAULT_TIMEZONE")) {
         define("DEFAULT_TIMEZONE", "CET");
     }
     if (function_exists("date_default_timezone_set")) {
         date_default_timezone_set(DEFAULT_TIMEZONE);
     }
     $this->debTemps = XhamTools::temps();
     $this->nbRequetes = 0;
     $this->tpRequetes = 0;
 }