if (!empty($fields['audio_file']) and $fields['audio_file'] != "NULL") {
     echo "<h3>audio (by " . $tempauth . ")</h3>\n";
     //do we have a local file? then show detailled information!
     if ($fields['filelocal'] == 1) {
         //showing and linking to audiofile. local or not?
         $link = $settings['url'] . "/audio/" . $fields['audio_file'];
         //can...only...play...mp3...with...flash...player
         if ($fields['audio_type'] == 1) {
             echo "<object class=\"topspace2\" type=\"application/x-shockwave-flash\"\n";
             echo "data=\"backend/emff_rec2.swf?src=" . $link . "\"";
             echo " width=\"295\" height=\"9\">\n";
             echo "<param name=\"movie\" \n          value=\"backend/emff_rec2.swf?src=" . $link . "\" />";
             echo "</object>\n";
         }
         //preparing data
         $id3 = getid3data($GLOBALS['audiopath'] . $fields['audio_file'], "back");
         //showing data for that mp3 file
         echo "<table id=\"audiodata\">\n";
         echo "<tr><td>Filename</td><td><a href=\"" . $link . "\">";
         echo $fields['audio_file'] . "</a></td></tr>\n";
         echo "<tr><td>Size/Duration</td><td>" . getmegabyte($id3['size']) . "MB / " . $id3['duration'] . "sec</td></tr>\n";
         echo "<tr><td>Quality</td><td>";
         echo $id3['audio']['bitrate'] / 1000 . "kb/s (";
         echo strtoupper($id3['audio']['bitrate_mode']) . ") / ";
         echo $id3['audio']['sample_rate'] / 1000 . "kHz / ";
         echo $id3['audio']['channelmode'];
         echo "</td></tr>\n";
         echo "<tr><td>ID3 Title/Track</td><td>" . $id3['title'];
         echo " (" . $id3['track'] . ")</td></tr>\n";
         echo "</table>\n";
         //button for manipulating id3-tags
Beispiel #2
0
function saveid3($update_id)
{
    global $settings;
    global $fields;
    //getting the filename from the id
    $dosql = "SELECT title, id, filelocal, audio_file FROM " . $GLOBALS['prefix'] . "lb_postings \n          WHERE id='" . $update_id . "';";
    $result = $GLOBALS['lbdata']->GetArray($dosql);
    $fields = $result[0];
    //Warning if remote file is to be changed :-)
    if ($fields['filelocal'] != "1") {
        echo "<p>" . bla("msg_changeremoteid3") . "</p>";
    } else {
        //get old values
        $olddata = getid3data($GLOBALS['audiopath'] . $fields['audio_file'], "back");
        //change posted ID3-data
        $filename = $GLOBALS['audiopath'] . $fields['audio_file'];
        // Initialize getID3 engine
        require_once 'inc/id3/getid3.php';
        $getID3 = new getID3();
        $getID3->encoding = 'UTF-8';
        require_once 'inc/id3/write.php';
        $tagwriter = new getid3_writetags();
        $tagwriter->filename = $filename;
        $tagwriter->tagformats = array('id3v2.3');
        $tagwriter->overwrite_tags = true;
        $tagwriter->remove_other_tags = true;
        $tagwriter->tag_encoding = 'UTF-8';
        //prepare image
        if (isset($_FILES['image']) && $_FILES['image']['size'] != "0") {
            $image = $_FILES['image']['tmp_name'];
            $mime = $_FILES['image']['type'];
            $fd = @fopen($image, 'rb');
            $APICdata = @fread($fd, filesize($image));
            @fclose($fd);
        } else {
            $APICdata = $olddata['image'];
            $mime = "image/jpeg";
            switch ($olddata['imgtype']) {
                case ".gif":
                    $mime = "image/gif";
                case ".png":
                    $mime = "image/png";
            }
        }
        //populate data array
        $TagData['title'][] = $_POST['id3title'];
        $TagData['artist'][] = $_POST['id3artist'];
        $TagData['album'][] = $_POST['id3album'];
        $TagData['track'][] = $_POST['id3track'];
        $TagData['genre'][] = $_POST['id3genre'];
        $TagData['year'][] = $_POST['id3year'];
        $TagData['comment'][] = $_POST['id3comment'];
        $TagData['attached_picture'][0]['data'] = $APICdata;
        $TagData['attached_picture'][0]['picturetypeid'] = '3';
        $TagData['attached_picture'][0]['description'] = $settings['sitename'];
        $TagData['attached_picture'][0]['mime'] = $mime;
        $tagwriter->tag_data = $TagData;
        // write tags
        if ($tagwriter->WriteTags()) {
            return " &mdash; " . bla("id3_success");
        } else {
            return " &mdash; " . bla("id3_failure");
            if (!empty($tagwriter->warnings)) {
                echo bla("msg_somewarnings") . '<br />' . implode('<br><br>', $tagwriter->warnings);
            }
        }
    }
}
Beispiel #3
0
function player()
{
    //puts the 1 Pixel Out flash player OR quicktime player on screen (works within postings-loop)
    global $postings;
    global $currentid;
    global $settings;
    $audioexamine = "";
    $return = "";
    //decide: flash or quicktime
    $thetype = $postings[$currentid]['audio_type'];
    //redirect or direct link? Only Flash can be redirected for counting
    if ($thetype == "1" and $settings['countfla'] == "1") {
        $before = "get.php?fla=";
    } else {
        if ($postings[$currentid]['filelocal'] == "1") {
            $before = "audio/";
            $audioexamine = $GLOBALS['audiopath'] . $postings[$currentid]['audio_file'];
        } else {
            $before = "";
        }
    }
    if (!veryempty($postings[$currentid]['audio_file'])) {
        //possible attributes and default-values
        if (isset($att['width'])) {
            $width = $att['width'];
        } else {
            $width = 200;
        }
        if (isset($att['height'])) {
            $height = $att['height'];
        } else {
            $height = 62;
        }
        if ($postings[$currentid]['filelocal'] == 1) {
            $audio = $before . $postings[$currentid]['audio_file'];
        } else {
            $audio = $postings[$currentid]['audio_file'];
            if ($settings['countfla'] == "1") {
                $audio = $before . $audio;
            }
        }
        //if mp3
        if ($thetype == "1") {
            $pre = "0x";
            //....................this is the bit where you can change the colours.............
            //..............alter the hexadecimal colour values only (eg FFFFFF)...............
            //..............note that the hexadecimal values do not have a # at the front .....
            //...take care not to alter anything else (eg the inverted commas or the semicolons)
            $bg = $pre . "FFFFFF";
            //background
            $leftbg = $pre . "e4e5d4";
            //left background
            $lefticon = $pre . "809ab1";
            //left icon
            $rightbg = $pre . "49647d";
            //right background
            $rightbghover = $pre . "191970";
            //right background (hover)
            $righticon = $pre . "e4e5d4";
            //right icon
            $righticonhover = $pre . "809ab1";
            //right icon (hover)
            $text = $pre . "666666";
            //text
            $slider = $pre . "191970";
            //slider
            $track = $pre . "6495ED";
            //progress track
            $border = $pre . "666666";
            //progress track border
            $loader = $pre . "e4e5d4";
            //loader bar
            $bgcolor = "#" . "FFFFFF";
            //page background
            //....................don't change anything below this line............
            //where can we find the audio file and the player
            $soundFile = $settings['url'] . "/" . $audio;
            $playerlocation = $settings['url'] . "/loudblog/custom/templates/" . $settings['template'] . "/player.swf";
            //build the string containing the parameters to be passed to the audio player
            $paramstring = "playerID=1&bg=" . $bg . "&leftbg=" . $leftbg . "&lefticon=" . $lefticon . "&rightbg=" . $rightbg . "&rightbghover=" . $rightbghover . "&righticon=" . $righticon . "&righticonhover=" . $righticonhover . "&text=" . $text . "&slider=" . $slider . "&track=" . $track . "&border=" . $border . "&loader=" . $loader . "&soundFile=" . $soundFile;
            //and convert special characters to html entities
            $flashvalue = htmlspecialchars($paramstring);
            //build up the code for displaying the player line by line
            $firstline = "<object type=\"application/x-shockwave-flash\" data=\"" . $playerlocation . "\" width=\"290\" height=\"24\" id=\"audioplayer1\">";
            $secondline = "<param name=\"movie\" value=\"" . $playerlocation . "\" />";
            $thirdline = "<param name=\"FlashVars\" value=\"" . $flashvalue . "\" />";
            $fourthline = "<param name=\"quality\" value=\"high\" />";
            $fifthline = "<param name=\"menu\" value=\"false\" />";
            $sixthline = "<param name=\"wmode\" value=\"transparent\" /></object>";
            //and stick them together
            $return = $firstline . $secondline . $thirdline . $fourthline . $fifthline . $sixthline;
        }
        //if quicktime audio
        if ($thetype == "2" or $thetype == "5" or $thetype == "6" or $thetype == "9" or $thetype == "12" or $thetype == "14") {
            //making an absolute link
            if ($postings[$currentid]['filelocal'] == "1") {
                $audio = $settings['url'] . "/" . $audio;
            }
            //Make width and height for showing Enhanced Podcast!
            if ($thetype == "14") {
                $fileinfo = getid3data($audioexamine, "front");
                if ($fileinfo['width'] != "") {
                    $width = $fileinfo['width'];
                    $height = $fileinfo['height'] + 16;
                    $href = "loudblog/backend/clicktoplayvideo.mov";
                } else {
                    $height = "16";
                    $href = "loudblog/backend/clicktoplayaudio.mov";
                }
            } else {
                $height = "16";
                $href = "loudblog/backend/clicktoplayaudio.mov";
            }
            //build html-code for quicktime plugin (audio)
            $return .= showquicktime($href, $audio, $width, $height, "myself", "false");
        }
        //if quicktime video
        if ($thetype == "7" or $thetype == "10" or $thetype == "13") {
            //making an absolute link
            if ($postings[$currentid]['filelocal'] == "1") {
                $audio = $settings['url'] . "/" . $audio;
                $target = "myself";
            } else {
                $target = "quicktimeplayer";
            }
            //getting width and height from getid3()
            $fileinfo = getid3data($audioexamine, "front");
            //build html-code for quicktime plugin (video)
            $return .= showquicktime("loudblog/backend/clicktoplayvideo.mov", $audio, $fileinfo['width'], $fileinfo['height'] + 16, $target, "false");
        }
        return $return;
    } else {
        return "";
    }
}
function loop_comments($content)
{
    //show a loop of all comments of a certain posting
    global $currentid;
    global $currentcomment;
    global $comments;
    global $tempfilename;
    global $allcomm;
    $att = getattributes($content);
    if (isset($att['global'])) {
        $allcomm = $att['global'];
    } else {
        $allcomm = "false";
    }
    if (isset($att['number'])) {
        $number = $att['number'];
    } else {
        $number = 5;
    }
    $content = trim(stripcontainer($content));
    $return = "";
    //do we get the comments of the current posting?
    if ($allcomm == "false") {
        //getting some data from comments-table
        $dosql = "SELECT * FROM " . $GLOBALS['prefix'] . "lb_comments \n          WHERE posting_id='" . $currentid . "' ORDER BY posted ASC;";
        $result = mysql_query($dosql) or die(mysql_error());
        $i = 0;
        $comments = "";
        while ($temp = mysql_fetch_assoc($result)) {
            $i += 1;
            $comments[$i] = $temp;
        }
        //only here for previewing?
        if (isset($_POST['commentpreview'])) {
            if ($tempfilename != "") {
                $id3 = getid3data($GLOBALS['audiopath'] . $tempfilename, "front");
                $tempfilesize = $id3['size'];
                $tempfilelength = getseconds($id3['duration']);
            } else {
                $tempfilesize = "0";
                $tempfilelength = "0";
            }
            $i += 1;
            $comments[$i]['id'] = 0;
            $comments[$i]['posting_id'] = $currentid;
            $comments[$i]['posted'] = date('Y-m-d H:i:s');
            if ($_POST['commentname'] == "") {
                $comments[$i]['name'] = "Anonymus";
            } else {
                $comments[$i]['name'] = htmlentities($_POST['commentname'], ENT_QUOTES, "UTF-8");
            }
            $comments[$i]['name'] = $comments[$i]['name'];
            $comments[$i]['mail'] = strip_tags($_POST['commentmail']);
            $comments[$i]['web'] = strip_tags($_POST['commentweb']);
            $comments[$i]['ip'] = $_SERVER['REMOTE_ADDR'];
            $comments[$i]['message_input'] = htmlentities(strip_tags($_POST['commentmessage']), ENT_QUOTES, "UTF-8");
            $comments[$i]['message_html'] = "<p>[PREVIEW]</p> " . makehtml(strip_tags($_POST['commentmessage']));
            $comments[$i]['audio_file'] = $tempfilename;
            $comments[$i]['audio_size'] = $tempfilesize;
            $comments[$i]['audio_length'] = $tempfilelength;
            $comments[$i]['audio_type'] = type_suffix($tempfilename);
        }
        //okay, we show a list af ALL recent comments
    } else {
        $dosql = "SELECT * FROM " . $GLOBALS['prefix'] . "lb_comments \n          ORDER BY posted DESC LIMIT 0," . $number . ";";
        $result = mysql_query($dosql) or die(mysql_error());
        $i = 0;
        $comments = "";
        while ($temp = mysql_fetch_assoc($result)) {
            $i += 1;
            $comments[$i] = $temp;
        }
    }
    //is there one or more comments?
    if ($i > 0) {
        $i = 1;
        //show every comment, one by one
        foreach ($comments as $thiscomment) {
            $currentcomment = $i;
            if ($allcomm == "false") {
                $return .= "<span id=\"com" . $comments[$i]['id'] . "\"></span>";
            }
            $return .= fullparse($content);
            $i += 1;
        }
    }
    return $return;
}
Beispiel #5
0
function loop_comments($content)
{
    //show a loop of all comments of a certain posting
    global $currentid;
    global $currentcomment;
    global $comments;
    global $tempfilename;
    global $allcomm;
    $att = getattributes($content);
    if (isset($att['global'])) {
        $allcomm = $att['global'];
    } else {
        $allcomm = "false";
    }
    if (isset($att['number'])) {
        $number = $att['number'];
    } else {
        $number = 5;
    }
    $content = trim(stripcontainer($content));
    $return = "";
    //do we get the comments of the current posting?
    if ($allcomm == "false") {
        //getting some data from comments-table
        $dosql = "SELECT * FROM " . $GLOBALS['prefix'] . "lb_comments\n              WHERE posting_id = " . $currentid . " ORDER BY posted ASC;";
        $result = $GLOBALS['lbdata']->Execute($dosql);
        $comments = $result->GetArray();
        if ($comments == false) {
            $numbcom = 0;
        } else {
            $numbcom = count($comments);
        }
        //only here for previewing?
        if (isset($_POST['commentpreview'])) {
            if ($tempfilename != "") {
                $id3 = getid3data($GLOBALS['audiopath'] . $tempfilename, "front");
                $tempfilesize = $id3['size'];
                $tempfilelength = getseconds($id3['duration']);
            } else {
                $tempfilesize = "0";
                $tempfilelength = "0";
            }
            $comments[$numbcom]['id'] = 0;
            $comments[$numbcom]['posting_id'] = $currentid;
            $comments[$numbcom]['posted'] = date('Y-m-d H:i:s');
            if ($_POST['commentname'] == "") {
                $comments[$numbcom]['name'] = "Anonymus";
            } else {
                $comments[$numbcom]['name'] = htmlentities(strip_tags($_POST['commentname']), ENT_QUOTES, "UTF-8");
            }
            $comments[$numbcom]['mail'] = strip_tags($_POST['commentmail']);
            $comments[$numbcom]['web'] = strip_tags($_POST['commentweb']);
            $comments[$numbcom]['ip'] = $_SERVER['REMOTE_ADDR'];
            $comments[$numbcom]['message_input'] = $_POST['commentmessage'];
            $comments[$numbcom]['message_html'] = "<p>[PREVIEW]</p> " . strip_tags(no_amp(makehtml(htmlentities($_POST['commentmessage'], ENT_QUOTES, "UTF-8"))));
            $comments[$numbcom]['audio_file'] = $tempfilename;
            $comments[$numbcom]['audio_size'] = $tempfilesize;
            $comments[$numbcom]['audio_length'] = $tempfilelength;
            $comments[$numbcom]['audio_type'] = type_suffix($tempfilename);
        }
        //okay, we show a list af ALL recent comments
    } else {
        $dosql = "SELECT * FROM " . $GLOBALS['prefix'] . "lb_comments ORDER BY posted DESC";
        $result = $GLOBALS['lbdata']->SelectLimit($dosql, $number, 0);
        $comments = $result->GetArray();
        if ($comments == false) {
            $comments = array();
        }
    }
    //show every comment, one by one
    $i = 0;
    foreach ($comments as $thiscomment) {
        $currentcomment = $i;
        if ($allcomm == "false") {
            $return .= "<span id=\"com" . $thiscomment['id'] . "\"></span>";
        }
        $return .= fullparse($content);
        $i += 1;
    }
    return $return;
}
Beispiel #6
0
/**
 * gets the Loudblog-Code from a filename
 *
 * @param unknown_type $request
 * @return unknown
 */
function type_suffix($request)
{
    //we have an absolute path? okay, the file is the request
    if (substr_count($request, "/") > 0) {
        $file = $request;
        //relative path? use the audio path!
    } else {
        $file = $GLOBALS['audiopath'] . $request;
    }
    $type = strtoupper(strrchr($request, "."));
    switch ($type) {
        case ".MP3":
            return "1";
            break;
        case ".AAC":
            return "2";
            break;
        case ".MP4":
            return "10";
            break;
        case ".M4V":
            return "10";
            break;
        case ".3GP":
            return "10";
            break;
        case ".OGG":
            return "3";
            break;
        case ".WMA":
            return "4";
            break;
        case ".WMV":
            return "11";
            break;
        case ".WMF":
            return "11";
            break;
        case ".WAV":
            return "5";
            break;
        case ".AIF":
            return "6";
            break;
        case ".AIFF":
            return "6";
            break;
        case ".MOV":
            return "7";
            break;
        case ".AVI":
            return "8";
            break;
        case ".MID":
            return "12";
            break;
        case ".MPG":
            return "13";
            break;
            //do we have a width/length in the files? These are Enhanced Podcasts!
        //do we have a width/length in the files? These are Enhanced Podcasts!
        case ".M4A":
            if (substr_count($request, "://") > 0) {
                return "14";
            } else {
                $id3 = getid3data($file, "back");
                if (!veryempty($id3['height'])) {
                    return "14";
                } else {
                    return "2";
                }
            }
            break;
        case ".M4B":
            if (substr_count($request, "://") > 0) {
                return "9";
            } else {
                $id3 = getid3data($file, "back");
                if (!veryempty($id3['height'])) {
                    return "14";
                } else {
                    return "9";
                }
            }
            break;
        default:
            return "0";
            break;
    }
}
function remote_fileatts($url)
{
    //two methods: first try to temporarily copy, then try to get remote data
    $return['size'] = 0;
    $return['length'] = 0;
    //are we able to copy things via http?
    if (ini_get('allow_url_fopen')) {
        $temppath = $GLOBALS['audiopath'] . "temporary." . strrchr($url, ".");
        //copy the file from url to temp
        $sourcefile = fopen($url, "rb") or die("<p class=\"msg\">Did not find url!</p>");
        $destfile = fopen($temppath, "wb");
        $eof = false;
        $filesize = 0;
        //copies the file in fragments of 256 bytes
        do {
            $file = fread($sourcefile, 256) or $eof = true;
            $filesize = $filesize + 256;
            fwrite($destfile, $file) or fclose($destfile);
        } while ($eof == false);
        fclose($sourcefile);
        $return['size'] = $filesize;
        //change the chmod
        chmod($temppath, 0777);
        //analyze file
        if ($info = getid3data($temppath, "back")) {
            $return['size'] = $info['size'];
            $return['length'] = getseconds($info['duration']);
        }
        //delete file
        unlink($temppath);
    }
    // Attempts to determine the size of the file given in
    // the supplied URL using HTTP/1.1.
    // Returns: the file size in bytes, null otherwise.
    // This script was written by Ektoras. Thank you very much!!!
    $parsedURL = parse_url($url);
    $host = $parsedURL['host'];
    $port = isset($parsedURL['port']) ? $parsedURL['port'] : 80;
    $resource = $parsedURL['path'];
    // Connect to the remote web server.
    $fp = @fsockopen($host, $port);
    if ($fp != false) {
        // We are connected. Let's talk.
        $headString = sprintf("HEAD %s HTTP/1.1\r\n", $resource);
        $hostString = sprintf("HOST: %s\r\n", $host);
        $connectionString = sprintf("Connection: close\r\n\r\n");
        fputs($fp, $headString);
        fputs($fp, $hostString);
        fputs($fp, $connectionString);
        $response = '';
        while (!feof($fp)) {
            $response .= fgets($fp);
        }
        fclose($fp);
        // Examine the HTTP response header to determine the size of the resource.
        if (preg_match('/Content-Length:\\s*(\\d+)/i', $response, $matches)) {
            $return['size'] = $matches[1];
        }
    }
    return $return;
}