Exemplo n.º 1
0
         echo '<script type="text/javascript">active_popup("index.php?page=ping","ping", 170,35);</script>';
     }
     //create fresh version of the static xml feeds
     if ($settings['staticfeed'] == "1") {
         include 'inc/staticfeeds.php';
     }
 }
 //gets all the data from the posting-id we want to edit
 $dosql = "SELECT * FROM " . $GLOBALS['prefix'] . "lb_postings\n          WHERE id = '" . $edit_id . "'";
 $result = $GLOBALS['lbdata']->GetArray($dosql);
 $fields = $result[0];
 //if posting date has changed, try to rename audio file, too
 $newdate = $fields['posted'];
 if (isset($olddate) and $newdate != $olddate and $fields['filelocal'] == "1" and $settings['rename'] == "1") {
     $suffix = strrchr($fields['audio_file'], ".");
     $newname = buildaudioname($suffix, $settings['filename'], $newdate);
     //rename the file
     $oldpath = $GLOBALS['audiopath'] . $fields['audio_file'];
     $newpath = $GLOBALS['audiopath'] . $newname;
     if (rename($oldpath, $newpath)) {
         $fields['audio_file'] = $newname;
         $dosql = "UPDATE " . $GLOBALS['prefix'] . "lb_postings SET\n        posted =     '" . $newdate . "',\n        audio_file = '" . $newname . "'\n        WHERE id = '" . $edit_id . "'";
         $GLOBALS['lbdata']->Execute($dosql);
     }
 }
 // --------------------------------------------------------------------------
 $settings = getsettings();
 include "changepost.php";
 //show us the (pre-filled) forms to change the details!!!
 echo "<form action=\"index.php?page=record2&amp;do=save&amp;id=" . $edit_id;
 echo "\" method=\"post\" enctype=\"multipart/form-data\">";
Exemplo n.º 2
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'];
}