Example #1
0
<?php

$pathAjax = "../../";
include $pathAjax . "init_pages/" . "ajax.php";
if (!isset($__GET['folder'])) {
    exit;
}
if (!isset($__GET['file'])) {
    exit;
}
$fic = $__GET['folder'] . $__GET['file'];
$nom_fic = get_nom_fichier($fic);
$fic = str_replace(" ", "%20", $fic);
$fic = str_replace("http", "", $fic);
$fic = str_replace("ftp", "", $fic);
$fic = "../../../" . $fic;
if (file_exists($fic)) {
    $extension_nom_fic = get_extension($nom_fic);
    $extension = get_extension($fic);
    if (!in_array($extension_nom_fic, $myAdmin->extentionsOk)) {
        exit;
    }
    if (!in_array($extension, $myAdmin->extentionsOk)) {
        exit;
    }
    header('Content-Description: File Transfer');
    header("Pragma:  public");
    header("Expires: 0");
    header('Cache-Control: must-revalidate');
    header("Content-Type: application/octet-stream\n");
    header("Content-Length: " . filesize($fic) . "\n");
Example #2
0
 public function get()
 {
     global $thisSite;
     $mySelectM = new mySelect(__FILE__);
     $mySelectM->tables = $thisSite->PREFIXE_TBL_GEN . "medias";
     $mySelectM->fields = "*";
     $mySelectM->orderby = "chrono ASC";
     $mySelectM->where = "lg=:lg AND actif=1 AND field_media='" . $this->field . "'";
     if ($this->idParent > 0) {
         $mySelectM->where .= " AND id_parent=:idParent";
         $mySelectM->whereValue["idParent"] = array($this->idParent, PDO::PARAM_INT);
     }
     if ($this->idMedia > 0) {
         $mySelectM->where .= " AND id=:idMedia";
         $mySelectM->whereValue["idMedia"] = array($this->idMedia, PDO::PARAM_INT);
     }
     if ($this->onlySelection > 0) {
         $mySelectM->where .= " AND image_principale=1";
     }
     $mySelectM->whereValue["lg"] = array($thisSite->current_lang, PDO::PARAM_STR);
     $resultM = $mySelectM->query();
     $allMedias = array();
     $x = 1;
     foreach ($resultM as $rowM) {
         $temp = array();
         if ($rowM["fichier_media"] == "" && $rowM["lien_destination"] == "") {
             continue;
         }
         $temp["id"] = $rowM["id"];
         if ($rowM["type"] == "image") {
             $temp["image"] = $rowM["fichier_media"];
             for ($indiceVignette = 0; $indiceVignette < 5; $indiceVignette++) {
                 $temp["vig" . $indiceVignette] = get_vignette($rowM["fichier_media"], $indiceVignette);
             }
             $temp["legende"] = $rowM["titre_media"];
             $temp["fichier_destination"] = $rowM["fichier_destination"];
             $temp["lien_destination"] = $rowM["lien_destination"];
             $temp["cible_destination"] = $rowM["cible_destination"];
             $temp["image_principale"] = $rowM["image_principale"];
         }
         if ($rowM["type"] == "file") {
             $temp["fichier"] = $rowM["fichier_media"];
             $temp["legende"] = $rowM["titre_media"];
             if ($temp["legende"] == "") {
                 $temp["legende"] = get_nom_fichier($rowM["fichier_media"]);
             }
         }
         if (strpos($rowM["type"], "video") === 0) {
             $temp["lien_video"] = $rowM["fichier_media"];
             $temp["type_video"] = $rowM["type"];
             $temp["legende"] = $rowM["titre_media"];
             $temp["image_principale"] = $rowM["image_principale"];
             $temp["thumb"] = $this->imageVideo($rowM["type"], $rowM["fichier_media"], $this->sizeThumbVideo);
             $temp["player"] = $this->embedVideo($rowM["type"], $rowM["fichier_media"]);
         }
         if ($rowM["type"] == "link") {
             $temp["lien"] = $rowM["lien_destination"];
             $temp["cible"] = $rowM["cible_destination"];
             $temp["legende"] = $rowM["titre_media"];
             if ($temp["legende"] == "") {
                 $temp["legende"] = get_nom_fichier($rowM["lien_destination"]);
             }
         }
         /*if($rowM["image_principale"]==1) {
               $allMedias[0]=$temp;
           } else {
               $allMedias[$x]=$temp;
               $x++;
           }*/
         $allMedias[$x] = $temp;
         $x++;
     }
     return $allMedias;
 }