function copy_ftp($update_id)
{
    global $settings;
    deleteupdatedfile($update_id);
    //no file in upload-folder? error!
    if ($_POST['filename'] == "") {
        die("<p class=\"msg\">No file defined!</p>");
    }
    $oldfilename = $_POST['filename'];
    //rename or not??
    if ($settings['rename'] == 1) {
        $newfilename = freshaudioname();
    } else {
        $newfilename = tunefilename(urldecode($oldfilename));
    }
    //copy the file and delete the old one
    $oldpath = $GLOBALS['uploadpath'] . urldecode($oldfilename);
    $newfilepath = $GLOBALS['audiopath'] . $newfilename;
    copy($oldpath, $newfilepath);
    unlink($oldpath);
    $filesize = filesize($newfilepath);
    //make a valid temp-title
    $temptitle = stripsuffix(htmlspecialchars(urldecode($oldfilename), ENT_QUOTES));
    //big question: are we just updating or creating a new file?
    if (!$update_id) {
        //insert a new row to the database and fill it with some nice data
        $dosql = "INSERT INTO {$GLOBALS['prefix']}lb_postings\n         (author_id, title, posted, \n         filelocal, audio_file, audio_type, audio_size, status)\n         VALUES\n         ('{$_SESSION['authorid']}', '{$temptitle}', '" . date('Y-m-d H:i:s') . "',\n        '1', '{$newfilename}', '" . type_suffix($newfilename) . "', \n        '{$filesize}', '1');";
        $result = mysql_query($dosql) or die(mysql_error());
        //if the parser gets until here, all should be good
        echo "<p class=\"msg\">{$newfilename} - Copying was successful.</p>";
    } else {
        //update an existing row in the database
        $dosql = "UPDATE {$GLOBALS['prefix']}lb_postings SET\n\n         author_id = '{$_SESSION['authorid']}',\n         posted   = '" . date('Y-m-d H:i:s') . "',\n         filelocal = '1',  \n         audio_file= '{$newfilename}',\n         audio_type= '" . type_suffix($newfilename) . "',\n         audio_length= '',\n         audio_size= '{$filesize}'  \n         WHERE id = '{$update_id}';";
        $result = mysql_query($dosql) or die(mysql_error());
    }
    //get id for editing data after finishing this function
    $dosql = "SELECT id FROM {$GLOBALS['prefix']}lb_postings \n          WHERE audio_file='{$newfilename}';";
    $result = mysql_query($dosql) or die(mysql_error());
    $row = mysql_fetch_assoc($result);
    return $row['id'];
}
            //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";
            echo "<tr><td><a href=\"" . $link . "\">";
            echo wordwrap($fields['audio_file'], 50, "<br />", 1) . "</a></td></tr>\n";
            echo "</table>\n";
            echo "<input type=\"hidden\" name=\"audio_type\" value=\"" . type_suffix($fields['audio_file']) . "\" />";
            ?>

<hr />


<!--                                      size  -->
<div class="rec2size">
<h3>Size</h3>

<?php 
            if ($fields['filelocal'] == 1) {
                echo "<input " . readonly($edit_id) . "type=\"text\" readonly=\"readonly\" ";
                echo "value=\"" . getmegabyte($fields['audio_size']) . " MB\" />";
                echo "<input type=\"hidden\" name=\"audio_size\" ";
                echo "value=\"" . getmegabyte($fields['audio_size']) . "\" />";
Exemplo n.º 3
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;
}
Exemplo n.º 5
0
function copy_ftp($update_id)
{
    global $settings;
    deleteupdatedfile($update_id);
    //no file in upload-folder? error!
    if ($_POST['filename'] == "") {
        die("<p class=\"msg\">" . bla("msg_noaudio") . "</p>");
    }
    $oldfilename = $_POST['filename'];
    //do we rename the audio file?
    if ($settings['rename'] == 1) {
        //generate filename from posting date, if we update the file
        if ($update_id) {
            $dosql = "SELECT posted FROM " . $GLOBALS['prefix'] . "lb_postings WHERE id = '" . $update_id . "'";
            $result = $GLOBALS['lbdata']->GetArray($dosql);
            $newfilename = buildaudioname(strrchr($_POST['filename'], "."), $settings['filename'], $result[0]['posted']);
            //get a fresh filename if we have a new posting
        } else {
            $newfilename = freshaudioname(strrchr($_POST['filename'], "."), $settings['filename']);
        }
        //if we don't rename, we will at least tune the filename
    } else {
        $newfilename = tunefilename(urldecode($oldfilename));
    }
    //copy the file and delete the old one
    $oldpath = $GLOBALS['uploadpath'] . urldecode($oldfilename);
    $newfilepath = $GLOBALS['audiopath'] . $newfilename;
    copy($oldpath, $newfilepath);
    unlink($oldpath);
    //change the chmod
    chmod($newfilepath, 0777);
    $filesize = filesize($newfilepath);
    //make a valid temp-title
    $temptitle = stripsuffix(htmlspecialchars(urldecode($oldfilename), ENT_QUOTES));
    //big question: are we just updating or creating a new file?
    if (!$update_id) {
        //insert a new row to the database and fill it with some nice data
        $dosql = "INSERT INTO {$GLOBALS['prefix']}lb_postings\n         (author_id, title, posted, \n         filelocal, audio_file, audio_type, audio_size, status, \n         countweb, countfla, countpod, countall)\n         VALUES\n         ('{$_SESSION['authorid']}', '{$temptitle}', '" . date('Y-m-d H:i:s') . "',\n        '1', '{$newfilename}', '" . type_suffix($newfilename) . "', \n        '{$filesize}', '1','0','0','0','0')";
        $GLOBALS['lbdata']->Execute($dosql);
        //add default id3 tags, if needed
        defaultid3tags($GLOBALS['audiopath'] . $newfilename, $temptitle);
        //if the parser gets until here, all should be good
        echo "<p class=\"msg\">" . $newfilename . " - " . bla("msg_copysuccess") . "</p>";
    } else {
        //update an existing row in the database
        $dosql = "UPDATE {$GLOBALS['prefix']}lb_postings SET\n\n         author_id = '{$_SESSION['authorid']}',\n         filelocal = '1',  \n         audio_file= '{$newfilename}',\n         audio_type= '" . type_suffix($newfilename) . "',\n         audio_length= '',\n         audio_size= '{$filesize}'  \n         WHERE id = '{$update_id}'";
        $GLOBALS['lbdata']->Execute($dosql);
        //add default id3 tags, if needed
        defaultid3tags($GLOBALS['audiopath'] . $newfilename, gettitlefromid($update_id));
    }
    //get id for editing data after finishing this function
    $dosql = "SELECT id FROM {$GLOBALS['prefix']}lb_postings \n          WHERE audio_file='{$newfilename}'";
    $result = $GLOBALS['lbdata']->GetArray($dosql);
    return $result[0]['id'];
}