Ejemplo n.º 1
0
            //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>";
            }
        }
        # END CHANGE DATE
        ############################################
        $PG_mainbody .= "<p><b>" . _("Processing changes...") . "</b></p>";
        //// RE-CREATING XML FILE ASSOCIATED TO EPISODE
        $thisEpisodeData = array($title, $description, $long_description, $image_new_name, $category, $keywords, $explicit, $auth_name, $auth_email);
        $episodeXMLDBAbsPath = $absoluteurl . $upload_dir . $file_ext[0] . '.xml';
        // extension = XML
        //// Creating xml file associated to episode
        writeEpisodeXMLDB($thisEpisodeData, $absoluteurl, $filefullpath, $episodeXMLDBAbsPath, $file_ext[0], TRUE);
        #	$PG_mainbody .= "<p><b><font color=\"green\">"._("File")."sent</font></b></p>"; // If upload is successful.
        ########## REGENERATE FEED
        //include ("$absoluteurl"."core/admin/feedgenerate.php"); //(re)generate XML feed
        $episodesCounter = generatePodcastFeed(TRUE, NULL, FALSE);
        //Output in file
        ##########
        $PG_mainbody .= "<p><a href=\"{$url}\">" . _("Go to the homepage") . "</a> - <a href=\"?p=archive&amp;cat=all\">" . _("Edit other episodes") . "</a></p>";
    } else {
        //if long description is more than max characters allowed
        $PG_mainbody .= "<b>" . _("Long Description") . "toolong</b><p>" . _("Long Description") . "maxchar {$longdescmax} " . _("characters") . " - " . _("Actual Length") . " <font color=red>" . strlen($long_description) . "</font> " . _("characters") . ".</p>\n\t\t\t\t\t\t\t\t\t<form>\n\t\t\t\t\t\t\t\t\t<INPUT TYPE=\"button\" VALUE=\"" . _("Back") . "\" onClick=\"history.back()\">\n\t\t\t\t\t\t\t\t\t</form>";
    }
    #### end of long desc lenght checking
} else {
    //if file, description or title not present...
    $PG_mainbody .= '<p>' . _("Error: No file, description or title present") . '
Ejemplo n.º 2
0
function autoIndexingEpisodes()
{
    include "core/includes.php";
    // Open podcast directory and read all the files contained
    $fileNamesList = readMediaDir($absoluteurl, $upload_dir);
    if (!empty($fileNamesList)) {
        // If media directory contains files
        $episodesCounter = 0;
        //set counter to zero
        // Loop through each file in the media directory
        foreach ($fileNamesList as $singleFileName) {
            ////Validate the current episode
            //NB. validateSingleEpisode returns [0] episode is supported (bool), [1] Episode Absolute path, [2] Episode XML DB absolute path,[3] File Extension (Type), [4] File MimeType, [5] File name without extension, [6] episode file supported but to XML present
            $thisPodcastEpisode = validateSingleEpisode($singleFileName);
            ////If episode is supported and does NOT have a related xml db
            if ($thisPodcastEpisode[6] == TRUE) {
                // From config.php
                if ($strictfilenamepolicy == "yes") {
                    $episodeNewFileName = date('Y-m-d') . "_" . renamefilestrict($thisPodcastEpisode[5]);
                } else {
                    $episodeNewFileName = renamefile($thisPodcastEpisode[5]);
                }
                //lowercase extension
                $episodeNewFileExtension = strtolower($thisPodcastEpisode[3]);
                // New file full path
                $episodeNewNameAbsPath = $absoluteurl . $upload_dir . $episodeNewFileName . '.' . $episodeNewFileExtension;
                //if file already exists add an incremental suffix
                $filesuffix = NULL;
                while (file_exists($episodeNewNameAbsPath)) {
                    $filesuffix++;
                    $episodeNewNameAbsPath = $absoluteurl . $upload_dir . $episodeNewFileName . $filesuffix . '.' . $episodeNewFileExtension;
                }
                if (file_exists($thisPodcastEpisode[1])) {
                    //rename episode
                    rename($thisPodcastEpisode[1], $episodeNewNameAbsPath);
                    // Change file date to now
                    touch($episodeNewNameAbsPath, time());
                } else {
                    exit;
                }
                //Episode size and data from GETID3 from retrieveMediaFileDetails function
                //NB retrieveMediaFileDetails returns: [0] $ThisFileSizeInMB, [1] $file_duration, [2] $file_bitrate, [3] $file_freq, [4] $thisFileTitleID3, [5] $thisFileArtistID3
                $episodeID3 = retrieveMediaFileDetails($episodeNewNameAbsPath, $absoluteurl, $thisPodcastEpisode[5], $img_dir);
                //// Assign title and short description (from ID3 title and artist, respectively. Or default)
                if ($episodeID3[4] != "") {
                    $thisEpisodeTitle = $episodeID3[4];
                } else {
                    $thisEpisodeTitle = $thisPodcastEpisode[5];
                }
                if ($episodeID3[5] != "") {
                    $thisEpisodeShortDesc = $episodeID3[5];
                } else {
                    $thisEpisodeShortDesc = _("Podcast Episode");
                }
                // Use GETID3 Title and Artist to fill title and description automatically
                $thisEpisodeData = array($thisEpisodeTitle, $thisEpisodeShortDesc, NULL, NULL, NULL, NULL, $explicit_podcast, NULL, NULL);
                $episodeXMLDBAbsPath = $absoluteurl . $upload_dir . $episodeNewFileName . $filesuffix . '.xml';
                //// Creating xml file associated to episode
                writeEpisodeXMLDB($thisEpisodeData, $absoluteurl, $episodeNewNameAbsPath, $episodeXMLDBAbsPath, $episodeNewFileName . $filesuffix, TRUE);
                $episodesCounter++;
            }
            // END - If episode is supported
        }
        // END - Loop through each file
    }
    // END - If media directory contains files
    return $episodesCounter;
}
Ejemplo n.º 3
0
         //$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
         //	echo $oracambiata;
         if ($oracambiata > time() and checkdate($_POST['Month'], $_POST['Day'], $_POST['Year']) == TRUE) {
             touch($filefullpath, $oracambiata);
             $PG_mainbody .= "<p>" . _("The episode date has been set to future. This episode won't show up till then.") . "</p>";
         }
     }
     # END CHANGE DATE
     ############################################
     $thisEpisodeData = array($title, $description, $long_description, $image_new_name, $category, $keywords, $explicit, $auth_name, $auth_email);
     $episodeXMLDBAbsPath = $absoluteurl . $upload_dir . $filenamechanged . $filesuffix . '.xml';
     // extension = XML
     //// Creating xml file associated to episode
     writeEpisodeXMLDB($thisEpisodeData, $absoluteurl, $filefullpath, $episodeXMLDBAbsPath, $filenamechanged . $filesuffix, TRUE);
     $PG_mainbody .= "<p><b><font color=\"green\">" . _("File sent") . "</font></b></p>";
     // If upload is successful.
     ########## REGENERATE FEED
     //include ("$absoluteurl"."core/admin/feedgenerate.php"); //(re)generate XML feed
     $episodesCounter = generatePodcastFeed(TRUE, NULL, FALSE);
     //Output in file
     ##########
     $PG_mainbody .= "<p><a href=\"{$url}\">" . _("Go to the homepage") . "</a> - <a href=\"?p=admin&do=upload\">" . _("Upload another episode") . "</a></p>";
 } else {
     $PG_mainbody .= "<p><b><font color=\"red\">" . _("FILE ERROR") . " " . _("Upload Failed") . "</font></b></p>";
     $PG_mainbody .= "<p><b>" . _("FILE ERROR") . "1</b></p>";
     $PG_mainbody .= "<p> - " . _("You didn't assign writing permission to the media folder and the uploaded file can't be saved on the server.") . "</p>";
     $PG_mainbody .= "<p> - " . _("Your file is bigger than upload max filesize on your server.") . "</p>";
     $PG_mainbody .= "<p><b>" . _("Useful information for debugging:") . "</b> <a href=\"?p=admin&amp;do=serverinfo\">" . _("Your server configuration") . "</a></p>";
     $PG_mainbody .= "<p>" . _("FILE ERROR") . " <a href=\"http://podcastgen.sourceforge.net/\" target=\"_blank\">" . _("Podcast Generator web page") . "</a></p>";