echo "<tr><td>ID3 Title/Track</td><td>" . $id3['title'];
     echo " (" . $id3['track'] . ")</td></tr>\n";
     echo "</table>\n";
     //button for manipulating id3-tags
     if (allowed(1, $edit_id)) {
         echo "<input href=\"index.php?page=id3&amp;id={$fields['id']}\" ";
         echo "class=\"audiobutton\" value=\"edit ID3 tags\" type=\"button\" ";
         echo "onclick=\"link_popup(this,780,390); return false\" />";
     }
     //button for changing the audio file
     if (allowed(1, $edit_id)) {
         echo "<input class=\"audiobutton right\" value=\"change audio file\" type=\"button\"";
         echo " onClick=\"self.location.href='index.php?page=record1&amp;do=update&amp;id={$fields['id']}'\" />";
     }
     //sending size/length/type information for database
     echo "<input type=\"hidden\" name=\"audio_length\" value=\"" . getseconds($id3['duration']) . "\" />";
     echo "<input type=\"hidden\" name=\"audio_size\" value=\"" . getmegabyte($id3['size']) . "\" />";
     echo "<input type=\"hidden\" name=\"audio_type\" value=\"" . type_suffix($fields['audio_file']) . "\" />";
 } else {
     //we have only a link to a remote file? show other data!
     $link = $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";
     }
     //showing plain link
     echo "<table id=\"audiodata\">\n";
示例#2
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;
}
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;
}
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;
}