Exemplo n.º 1
0
function validateSingleEpisode($episodeFile)
{
    //include functions and variables in config.php
    include "core/includes.php";
    $episodeFile_parts = divideFilenameFromExtension($episodeFile);
    // PHP >= 5.2.0 needed
    $episodeFilenameWithoutExtension = $episodeFile_parts[0];
    $EpisodeFileExtension = strtolower($episodeFile_parts[1]);
    //lowercase extension
    $checkEpisodeFileFormat = checkFileType($EpisodeFileExtension, $absoluteurl);
    $episodeFileType = $checkEpisodeFileFormat[0];
    $episodeFileMimeType = $checkEpisodeFileFormat[1];
    $episodeFileFullPath = $absoluteurl . $upload_dir . $episodeFile;
    $episodeFileXMLDB = $absoluteurl . $upload_dir . $episodeFilenameWithoutExtension . '.xml';
    //database file
    //If media file is ok and XML file is associated to it
    if (isset($episodeFileType) and $EpisodeFileExtension == $episodeFileType and file_exists($episodeFileXMLDB)) {
        //NB. $GoForIt = TRUE means that the episode file format is supported, it has a corresponding XML data file
        $GoForIt = TRUE;
        $OkButNoXMLDBpresent = FALSE;
    } else {
        if (isset($episodeFileType) and $EpisodeFileExtension == $episodeFileType and !file_exists($episodeFileXMLDB)) {
            $GoForIt = FALSE;
            $OkButNoXMLDBpresent = TRUE;
        } else {
            $GoForIt = FALSE;
            $OkButNoXMLDBpresent = FALSE;
        }
    }
    return array($GoForIt, $episodeFileFullPath, $episodeFileXMLDB, $episodeFileType, $episodeFileMimeType, $episodeFilenameWithoutExtension, $OkButNoXMLDBpresent);
}
Exemplo n.º 2
0
     //if a different author is specified
     $PG_mainbody .= "<p>" . _("Author specified for this episode...") . "</p>";
     if (!validate_email($auth_email)) {
         //if author doesn't have a valid email address, just ignore it and use default author
         $PG_mainbody .= "<p>" . _("Author's email address not present or not valid.") . " " . _("Author will be IGNORED") . "</p>";
         $auth_name = NULL;
         //ignore author
         $auth_email = NULL;
         //ignore email
     }
 } else {
     //if author's name doesn't exist unset also email field
     $auth_email = NULL;
     //ignore email
 }
 $file_ext = divideFilenameFromExtension($file);
 //supports more full stops . in the file name. PHP >= 5.2.0 needed
 ############################################
 # START CHANGE DATE
 //print_r($_POST);
 if (isset($_POST['Day']) and isset($_POST['Month']) and isset($_POST['Year']) and isset($_POST['Hour']) and isset($_POST['Minute'])) {
     $filefullpath = $absoluteurl . $upload_dir . $file;
     $oradelfile = filemtime($filefullpath);
     $oracambiata = mktime($_POST['Hour'], $_POST['Minute'], 0, $_POST['Month'], $_POST['Day'], $_POST['Year']);
     //seconds are simply 0, no need to handle them
     if ($oradelfile != $oracambiata and checkdate($_POST['Month'], $_POST['Day'], $_POST['Year']) == TRUE) {
         //is date posted is different from file date and if php function CHECKDATE == TRUE
         touch($filefullpath, $oracambiata);
         $PG_mainbody .= "<p>" . _("Date and time of the episode have been modified (this might change the order of your episodes in the podcast feed).") . "</p>";
     }
 }
Exemplo n.º 3
0
}
########### End
//// FORCE DOWNLOAD OF SUPPORTED FILES (e.g. files don't play in the browser, even when a plugin is installed)
//NB. does not work with some mobile browsers
include "config.php";
include $absoluteurl . "core/functions.php";
$filename = $_GET['filename'];
//Clean variable, avoid downloading of file outside podcast generator root directory.
$filename = str_replace("/", "", $filename);
// Replace / in the filename
$filename = str_replace("\\", "", $filename);
// Replace \ in the filename
$filename_path = $absoluteurl . $upload_dir . $filename;
// absolute path of the filename to download
if (file_exists($filename_path)) {
    $file_media = divideFilenameFromExtension($filename);
    $fileData = checkFileType($file_media[1], $absoluteurl);
    $podcast_filetype = $fileData[0];
    $filemimetype = $fileData[1];
    $isFileSupported = $fileData[2];
    // SECURITY OPTION: if extension is supported (file to download must have a known episode extension)
    if ($isFileSupported == TRUE and $file_media[1] == $podcast_filetype and !publishInFuture($filename_path)) {
        //// Headers
        ### required by internet explorer
        if (ini_get('zlib.output_compression')) {
            ini_set('zlib.output_compression', 'Off');
        }
        ###
        header("Pragma: public");
        // required
        header("Expires: 0");
Exemplo n.º 4
0
         //ignore author
         $auth_email = NULL;
         //ignore email
     }
 } else {
     //if author's name doesn't exist unset also email field
     $auth_email = NULL;
     //ignore email
 }
 #show submitted data (debug purposes)
 //$PG_mainbody .= "Dati inseriti:</b><br><br>Titolo: <i>$title</i> <br>Descrizione breve: <i>$description</i> <br>Descrizione lunga: <i>$long_description</i>";
 ###
 ## start processing podcast
 $PG_mainbody .= "<p><b>" . _("Processing episode...") . "</b></p>";
 $PG_mainbody .= "<p>" . _("Original filename:") . " <i>{$file}</i></p>";
 $file_parts = divideFilenameFromExtension($file);
 $filenameWithoutExtension = $file_parts[0];
 $fileExtension = $file_parts[1];
 // $PG_mainbody .= "<p>"._("File")."_ext <i>$fileExtension</i></p>"; //display file extension
 ##############
 ### processing file extension
 $fileData = checkFileType(strtolower($fileExtension), $absoluteurl);
 //lowercase extension to compare with the accepted extensions array
 if (isset($fileData[0])) {
     //avoids php notice if array [0] doesn't exist
     $podcast_filetype = $fileData[0];
 } else {
     $podcast_filetype = NULL;
 }
 if ($fileExtension == strtoupper($podcast_filetype)) {
     $podcast_filetype = strtoupper($podcast_filetype);