<?php
require_once "maincore.php";
require_once BASEDIR."subheader.php";
require_once BASEDIR."side_left.php";
if (file_exists(INFUSIONS."pateikti_daina/locale/".$settings['locale'].".php")) {
include INFUSIONS."pateikti_daina/locale/".$settings['locale'].".php";
} else {
include INFUSIONS."pateikti_daina/locale/Lithuanian.php";
}
if (isset($_POST['submit_download']) && $action == "submit") {
$download_title = stripinput($_POST['download_title']);
$download_url = stripinput($_POST['download_url']);
$download_cat = stripinput($_POST['download_cat']);
$download_license = stripinput($_POST['download_license']);
$download_filesize = stripinput($_POST['download_filesize']);
if(strlen($download_title) > 50){
$dwtit = $download_title.'...';
} else {
$dwtit = $download_title;
}
$result = dbquery("INSERT INTO ".$db_prefix."downloads_submissions (download_title,download_title_small, download_url, download_cat, download_license, download_filesize, download_datestamp, download_count, download_submitted) VALUES ('$download_title','$dwtit', '$download_url', '$download_cat', '$download_license', '$download_filesize', '".time()."', '0', '".$userdata['user_id']."')");
opentable($locale['dls123']);
echo "<center><br>\n".$locale['dls124']."<br><br>
<a href='pateikti_daina.php'>".$locale['dls125']."</a><br><br>
<a href='index.php'>".$locale['dls126']."</a><br><br>\n</center>\n";
closetable();
}
if ($action == "") {
opentable($locale['dls102']);
$result = dbquery("SELECT * FROM ".$db_prefix."download_cats ORDER BY download_cat_name");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
$editlist .= "<option value='".$data['download_cat_id']."'>".$data['download_cat_name']."</option>\n";
}
echo "<form name='submit_download_form' method='post' action='".FUSION_SELF."?action=submit' onSubmit='return validateDownload(this);'>
<table align='center' cellpadding='0' cellspacing='0' width='400'>
<tr>
<td width='80' class='tbl'>".$locale['dls103']."</td>
<td class='tbl'><input type='text' name='download_title' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td width='50' class='tbl'>".$locale['dls105']."</td>
<td class='tbl'><input type='text' name='download_url' class='textbox' style='width:300px;'></td>
</tr>
<tr>
<td width='50' class='tbl'>".$locale['dls106']."</td>
<td class='tbl'><select name='download_cat' class='textbox'>$editlist</select></td>
</tr>
<tr>
<td width='50' class='tbl'>".$locale['dls107']."</td>
<td class='tbl'><input type='text' name='download_license' class='textbox' style='width:125px;' value='".$userdata['user_name']."'></td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'><input type='submit' name='submit_download' value='".$locale['dls111']."' class='button'></td>
</tr>
</table>
</form>\n";
} else {
echo "<center><br>\n".$locale['dls128']."<br><br>\n</center>\n";
}
closetable();
}
echo "<script type='text/javascript'>
function validateDownload(frm) {
if (frm.download_title.value==\"\" || frm.download_url.value==\"\" || frm.download_license.value==\"\") {
alert(\"".$locale['dls127']."\"); return false;
}
}
</script>\n";
require_once BASEDIR."side_right.php";
require_once BASEDIR."footer.php";
?>