コード例 #1
0
ファイル: controller.user.php プロジェクト: arno06/Achilles
 public function avatar()
 {
     $mime = File::getMimeType(self::DEFAULT_AVATAR);
     Header::content_type($mime);
     echo file_get_contents(self::DEFAULT_AVATAR);
     Core::endApplication();
 }
コード例 #2
0
ファイル: class.SimpleXML.php プロジェクト: arno06/Achilles
 /**
  * Méthode de chargement de décodage d'un fichier XML
  * @param String $pFile
  * @return Array
  * @throws Exception
  */
 public static function import($pFile)
 {
     try {
         $content = File::read($pFile);
     } catch (Exception $e) {
         throw new Exception("Impossible de lire le fichier source <b>" . $pFile . "</b>");
     }
     return self::decode($content);
 }
コード例 #3
0
ファイル: class.Logs.php プロジェクト: arno06/Achilles
 /**
  * Méthode permettant d'enregistrer des données textuelles dans un fichier de Logs
  * Définit le nom du dossier ainsi que celui du fichier en fonction de la date
  * @param String $pMessage					Message &agrave; enregistrer dans le fichier
  * @param String $pLevel					Niveau d'importance de l'information
  * @return void
  */
 public static final function write($pMessage, $pLevel = self::NOTICE)
 {
     $ip = $_SERVER["REMOTE_ADDR"];
     $folder = Autoload::$folder . "/includes/logs/" . date("m-y") . "/";
     $file = date("d-m-y") . ".txt";
     $message = "[ " . date("H\\hi\\ms\\s") . " ] [" . $ip . "] [ " . Core::$application . " ] [ " . $pLevel . " ]\t\t" . $pMessage . "\r\n";
     Folder::create($folder);
     File::create($folder . $file);
     chmod($folder . $file, 0666);
     File::append($folder . $file, $message);
 }
コード例 #4
0
 /**
  * @param string $pUrl
  * @param string $pTitle
  * @param string $pDescription
  * @param null $pFirst
  */
 private function log($pUrl, $pTitle, $pDescription, $pFirst = null)
 {
     if (!$this->logFile) {
         return;
     }
     if (!$pFirst) {
         $pFirst = gmdate("D, d M Y H:i:s", time());
     }
     $pTitle = str_replace('"', '""', $pTitle);
     $pTitle = Encoding::fromHTMLEntities($pTitle);
     $pDescription = str_replace('"', '""', $pDescription);
     $pDescription = Encoding::fromHTMLEntities($pDescription);
     File::append($this->logFile, '"' . $pFirst . '";"' . $pUrl . '";"' . $pTitle . '";"' . $pDescription . '"' . PHP_EOL);
 }
コード例 #5
0
ファイル: class.Upload.php プロジェクト: arno06/Achilles
 /**
  * @param  $pNewName
  * @return void
  */
 public function renameFolder($pNewName)
 {
     File::rename($this->pathFile, $pNewName . $this->fileName . "." . $this->fileType);
     $this->folder = $pNewName;
     $this->pathFile = $this->folder . $this->fileName . "." . $this->fileType;
     $this->model_upload->updateById($this->id_upload, array("path_upload" => $this->pathFile));
 }
コード例 #6
0
ファイル: class.SimpleCSV.php プロジェクト: arno06/Achilles
 /**
  * Méthode d'import de données &agrave; partir d'un fichier CSV
  * @param String $pFileName				Nom du fichier
  * @return Array
  */
 public static function import($pFileName)
 {
     try {
         $dataString = File::read($pFileName);
     } catch (Exception $e) {
         return null;
     }
     return self::decode($dataString);
 }
コード例 #7
0
ファイル: model.ModelUpload.php プロジェクト: arno06/Achilles
 public function deleteById($pId)
 {
     File::delete($this->getValueById("path_upload", $pId));
     parent::deleteById($pId);
 }
コード例 #8
0
 /**
  * @throws \Exception
  */
 public function retrieve()
 {
     /**
      * Check get vars
      */
     $need = Core::checkRequiredGetVars("need") ? explode(self::NEED_SEPARATOR, $_GET["need"]) : array();
     if (empty($need)) {
         $this->output($this->log("No lib to load", "warn"));
     }
     $needs = array();
     $this->calculateNeeds($need, $needs);
     $needs = array_unique($needs);
     /**
      * Get lib contents
      */
     foreach ($needs as $lib) {
         if (isset($this->manifest[$lib])) {
             if (!isset($this->manifest[$lib][$this->type]) || !is_array($this->manifest[$lib][$this->type])) {
                 $this->output .= $this->log($lib . " is not available", "warn");
                 continue;
             }
             $files = $this->manifest[$lib][$this->type];
             for ($i = 0, $max = count($files); $i < $max; $i++) {
                 $absolute_link = preg_match('/^http\\:\\/\\//', $files[$i], $matches);
                 if (!$absolute_link) {
                     $files[$i] = dirname(self::MANIFEST) . "/" . $this->configuration["relative"] . $files[$i];
                     $content = File::read($files[$i]);
                     self::$current_folder = dirname($files[$i]);
                     if ($this->type == self::TYPE_CSS) {
                         $content = preg_replace_callback('/(url\\(\\")([^\\"]+)/', 'core\\tools\\Dependencies::correctUrls', $content);
                     }
                     $this->output .= $content . "\r\n";
                 } else {
                     $this->output .= Request::load($files[$i]);
                 }
             }
         } else {
             $this->output .= $this->log($lib . " is not available", "warn");
         }
     }
     /**
      * Minified / Uglyflied / gzip
      */
     $accept_gzip = preg_match('/gzip/', $_SERVER['HTTP_ACCEPT_ENCODING'], $matches) && !Core::checkRequiredGetVars("output");
     if ($accept_gzip) {
         Header::content_encoding("gzip");
         $this->output = gzencode($this->output);
     }
     $this->output($this->output);
 }