###
$PG_mainbody .= '<h3>' . _("Add a category") . '</h3>';
//include ("$absoluteurl"."components/xmlparser/loadparser.php");
//include ("$absoluteurl"."core/admin/readXMLcategories.php");
// define variables
$arrdesc = NULL;
$arrid = NULL;
$isduplicated = NULL;
$n = 0;
// counter
$add = $_POST['addcategory'];
// variable
// Depurate input
$add = stripslashes($add);
$add = htmlspecialchars($add);
$add = depurateContent($add);
if ($add != NULL and $add != "all") {
    /// 000
    // create unique and depurated id from the description (using the function renamefilestrict)
    $id = avoidXSS(renamefilestrict($add));
    //deletes also accents
    $id = ampersandRemove($id);
    //ampersand create issues
    if (strlen($id) < 3) {
        $suffix = random_str(5);
        $id = $id . $suffix;
    }
    $parser = simplexml_load_file($absoluteurl . "categories.xml", 'SimpleXMLElement', LIBXML_NOCDATA);
    //parse
    //	if (isset($parser->document->category)) {
    foreach ($parser->category as $singlecategory) {
Exemplo n.º 2
0
function writeEpisodeXMLDB($thisEpisodeData, $absoluteurl, $episodeFileAbsPath, $episodeXMLDBAbsPath, $episodeFileNameWithoutExtension, $readID3)
{
    include $absoluteurl . "core/includes.php";
    //NB. $thisEpisodeData array contains [0] $title, [1] $description, [2] $long_description, [3] $image_new_name, [4] $category (array), [5] $keywords, [6] $explicit, [7] $auth_name, [8] $auth_email
    $xmlfiletocreate = '<?xml version="1.0" encoding="' . $feed_encoding . '"?>
	<PodcastGenerator>
		<episode>
		<titlePG><![CDATA[' . $thisEpisodeData[0] . ']]></titlePG>
		<shortdescPG><![CDATA[' . $thisEpisodeData[1] . ']]></shortdescPG>
		<longdescPG><![CDATA[' . $thisEpisodeData[2] . ']]></longdescPG>
		<imgPG>' . $thisEpisodeData[3] . '</imgPG>
		<categoriesPG>
		<category1PG>';
    if (isset($thisEpisodeData[4][0]) and $thisEpisodeData[4][0] != NULL) {
        $xmlfiletocreate .= depurateContent($thisEpisodeData[4][0]);
    }
    $xmlfiletocreate .= '</category1PG>
		<category2PG>';
    if (isset($thisEpisodeData[4][1]) and $thisEpisodeData[4][1] != NULL) {
        $xmlfiletocreate .= depurateContent($thisEpisodeData[4][1]);
    }
    $xmlfiletocreate .= '</category2PG>
		<category3PG>';
    if (isset($thisEpisodeData[4][2]) and $thisEpisodeData[4][2] != NULL) {
        $xmlfiletocreate .= depurateContent($thisEpisodeData[4][2]);
    }
    $xmlfiletocreate .= '</category3PG>
		</categoriesPG>
		<keywordsPG><![CDATA[' . $thisEpisodeData[5] . ']]></keywordsPG>
		<explicitPG>' . $thisEpisodeData[6] . '</explicitPG>
		<authorPG>
		<namePG>' . depurateContent($thisEpisodeData[7]) . '</namePG>
		<emailPG>' . $thisEpisodeData[8] . '</emailPG>
		</authorPG>';
    $episodeID3 = array();
    //Declaration
    if ($readID3 == TRUE) {
        //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($episodeFileAbsPath, $absoluteurl, $episodeFileNameWithoutExtension, $img_dir);
        $xmlfiletocreate .= '
			<fileInfoPG>';
        if (isset($episodeID3[0]) and $episodeID3[0] != NULL) {
            $xmlfiletocreate .= '
			<size>' . $episodeID3[0] . '</size>';
        }
        if (isset($episodeID3[1]) and $episodeID3[1] != NULL) {
            $xmlfiletocreate .= '
			<duration>' . $episodeID3[1] . '</duration>';
        }
        //NB variable bitrate is rounded to int
        if (isset($episodeID3[2]) and $episodeID3[2] != NULL) {
            $xmlfiletocreate .= '
			<bitrate>' . round($episodeID3[2]) . '</bitrate>';
        }
        if (isset($episodeID3[3]) and $episodeID3[3] != NULL) {
            $xmlfiletocreate .= '
			<frequency>' . $episodeID3[3] . '</frequency>';
        }
    }
    $xmlfiletocreate .= '
			</fileInfoPG>
		</episode>
	</PodcastGenerator>';
    //// Write the XMK file
    $fp = fopen($episodeXMLDBAbsPath, 'w');
    fwrite($fp, $xmlfiletocreate);
    fclose($fp);
}
Exemplo n.º 3
0
        if ($thisPodcastEpisode[0] == TRUE) {
            ////Parse XML data related to the episode
            // NB. Function parseXMLepisodeData returns: [0] episode title, [1] short description, [2] long description, [3] image associated, [4] iTunes keywords, [5] Explicit language,[6] Author's name,[7] Author's email,[8] PG category 1, [9] PG category 2, [10] PG category 3, [11] file_info_size, [12] file_info_duration, [13] file_info_bitrate, [14] file_info_frequency
            $thisPodcastEpisodeData = parseXMLepisodeData($thisPodcastEpisode[2]);
            //// content definition and depuration (solves problem with quotes etc...)
            $text_title = depurateContent($thisPodcastEpisodeData[0]);
            //title
            $thisPodcastEpisodeData[1] = depurateContent($thisPodcastEpisodeData[1]);
            //short desc
            $text_shortdesc = depurateContent($thisPodcastEpisodeData[1]);
            //short desc
            $text_longdesc = depurateContent($thisPodcastEpisodeData[2]);
            //long desc
            $text_keywordspg = depurateContent($thisPodcastEpisodeData[4]);
            //Keywords
            $text_authornamepg = depurateContent($thisPodcastEpisodeData[6]);
            //author's name
            $text_authoremailpg = $thisPodcastEpisodeData[7];
            $text_explicitpg = $thisPodcastEpisodeData[5];
            $episodedate = filemtime($thisPodcastEpisode[1]);
            $text_category1 = $thisPodcastEpisodeData[8];
            $text_category2 = $thisPodcastEpisodeData[9];
            $text_category3 = $thisPodcastEpisodeData[10];
            #########
            $PG_mainbody .= '<div class="col-md-12">';
            $PG_mainbody .= '<h3 class="sectionTitle">' . _("Edit or Delete Episode") . '</h3>';
            $PG_mainbody .= '
		
		 <div class="span5 col-md-5 importantSection">
		<form action="?p=admin&amp;do=edit&amp;c=ok" method="POST" enctype="multipart/form-data" name="uploadform" id="uploadform" onsubmit="return submitForm();">
Exemplo n.º 4
0
 ## the itunes:summary field can be up to 4000 characters, while the other fields up to 255
 $longdescmax = 4000;
 #set max characters variable. iTunes specifications by Apple say "max 4000 characters" for long description field
 if (strlen($long_description) < $longdescmax) {
     // 002 (if long description IS NOT too long, go on executing...
     ####
     #### INPUT DEPURATION
     $title = depurateContent($title);
     //title
     $description = depurateContent($description);
     //short desc
     $long_description = depurateContent($long_description);
     //long desc
     $keywords = depurateContent($keywords);
     //Keywords
     $auth_name = depurateContent($auth_name);
     //author's name
     ##############
     ### processing Long Description
     #$PG_mainbody .= "QUI: $long_description<br>lunghezza:".strlen($long_description)."<br>"; //debug
     if ($long_description == NULL or $long_description == " ") {
         //if user didn't input long description the long description is equal to short description
         $PG_mainbody .= "<p>" . _("Long description not present; I'll use short description...") . "</p>";
         $long_description = $description;
     } else {
         $PG_mainbody .= "<p>" . _("Long Description present") . "</p>";
         $long_description = str_replace("&nbsp;", " ", $long_description);
     }
     ##############
     ### processing iTunes KEYWORDS
     ## iTunes supports a maximum of 12 keywords for searching: don't know how many keywords u can add in a feed. Anyway it's better to add a few keyword, so we display a warning if user submits more than 12 keywords
Exemplo n.º 5
0
    //create categories file
    fwrite($createtxtbox, $texttowrite);
    //write content into the file
    fclose($createtxtbox);
}
######################## END - FREEBOX FILE CREATION
######################## CATEGORY FILE CREATION
if (file_exists("../categories.xml")) {
    //if categories already exist stop the script
    echo "<span style=\"color:red;\">" . _("Categories file already exists...") . "</span><br />";
} else {
    // else create "categories.xml" file in the root dir
    // take the localized _("Uncategorized") variable in setup_LANGUAGE, depurate it and generate a unique id to use in the categories.xml file generated
    $idcat = stripslashes(_("Uncategorized"));
    $idcat = htmlspecialchars($idcat);
    $idcat = depurateContent($idcat);
    // category name (external)
    $id = avoidXSS(renamefilestrict($idcat));
    // category id generated (internal)
    $categoriesfiletocreate = '<?xml version="1.0" encoding="utf-8"?>
<PodcastGenerator>
	<category>
	<id>' . $id . '</id>
	<description>' . $idcat . '</description>
	</category>
	</PodcastGenerator>';
    $createcatf = fopen("{$absoluteurl}" . "categories.xml", 'w');
    //create categories file
    fwrite($createcatf, $categoriesfiletocreate);
    //write content into the file
    fclose($createcatf);
 $authorname = $_POST['authorname'];
 if ($authorname != "") {
     $authorname = stripslashes($authorname);
     $authorname = strip_tags($authorname);
     $authorname = htmlspecialchars($authorname);
     $authorname = depurateContent($authorname);
     $author_name = $authorname;
 } else {
     $PG_mainbody .= '<p>' . _("Author's name") . ' ' . _("is empty... (it will be ignored)") . '</p>';
 }
 // author's email
 $authoremail = $_POST['authoremail'];
 $authoremail = stripslashes($authoremail);
 $authoremail = strip_tags($authoremail);
 $authoremail = htmlspecialchars($authoremail);
 $authoremail = depurateContent($authoremail);
 if (validate_email($authoremail)) {
     //if email is valid
     $author_email = $authoremail;
 } else {
     // if email not valid
     $PG_mainbody .= '<p>' . _("Author's email address not present or not valid") . ' ' . _("(it will be ignored)") . '</p>';
 }
 //feed language
 $feedlanguage = $_POST['feedlanguage'];
 $feed_language = $feedlanguage;
 //explicit
 $explicit = $_POST['explicit'];
 $explicit_podcast = $explicit;
 include "{$absoluteurl}" . "core/admin/createconfig.php";
 //regenerate config.php