116 lines
3.4 KiB
PHP
116 lines
3.4 KiB
PHP
<?php
|
|
|
|
if( ! defined( 'DATALIFEENGINE' ) ) {
|
|
die( "Hacking attempt!" );
|
|
}
|
|
|
|
require_once ROOT_DIR.'/language/'.$config['langs'].'/img.lng';
|
|
|
|
#### IMG
|
|
|
|
$ms = '';
|
|
|
|
echo <<<HTML
|
|
<tr>
|
|
<tr><td height="29" style="padding-left:5px;">Çàãðóæåííûå êàðòèíêè</td>
|
|
<td><table width="100%"><tr><td>
|
|
HTML;
|
|
|
|
$newsimg_query = $db->query("SELECT * FROM ".PREFIX."_covers WHERE newsid='".$_GET['id']."' ORDER BY id DESC");
|
|
while ($newsimg = $db->get_row($newsimg_query)) {
|
|
echo <<<HTML
|
|
<tr>
|
|
<td height="29" style="width:150px;padding:5px;text-align:left;"><img src="/uploads{$newsimg['thumb']}" width="100px" /></td>
|
|
<td><a href="/control.php?mod=editnews&action=editnews&id={$_GET['id']}&img={$newsimg['id']}">Óäàëèòü êàðòèíêó</a></td>
|
|
</tr>
|
|
HTML;
|
|
}
|
|
|
|
echo '</td></tr></table></td></tr>';
|
|
|
|
if ($_GET['img']){
|
|
$db->query("SELECT link, thumb FROM " . PREFIX . "_covers WHERE id = '".$_GET['img']."'");
|
|
|
|
while($row_covers = $db->get_row()){
|
|
|
|
@unlink(ROOT_DIR."/uploads".$row_covers['link']);
|
|
@unlink(ROOT_DIR."/uploads".$row_covers['thumb']);
|
|
|
|
}
|
|
$db->query("DELETE FROM ".PREFIX."_covers WHERE id='".$_GET['img']."'");
|
|
$ms = "Óäàëåíî";
|
|
header("Location: /control.php?mod=editnews&action=editnews&id={$_GET['id']}");
|
|
}
|
|
|
|
|
|
echo "<script language=\"javascript\" type=\"text/javascript\">
|
|
function ShowOrHideEx(id, show) {
|
|
var item = null;
|
|
if (document.getElementById) {
|
|
item = document.getElementById(id);
|
|
} else if (document.all) {
|
|
item = document.all[id];
|
|
} else if (document.layers){
|
|
item = document.layers[id];
|
|
}
|
|
if (item && item.style) {
|
|
item.style.display = show ? \"\" : \"none\";
|
|
}
|
|
}
|
|
|
|
var total_allow_rows = {$config['max_file_count']};
|
|
|
|
function AddImages() {
|
|
var tbl = document.getElementById('tblSample');
|
|
var lastRow = tbl.rows.length;
|
|
|
|
if (total_allow_rows && lastRow == total_allow_rows ) return;
|
|
|
|
// if there's no header row in the table, then iteration = lastRow + 1
|
|
var iteration = lastRow+1;
|
|
var row = tbl.insertRow(lastRow);
|
|
|
|
var cellRight = row.insertCell(0);
|
|
var el = document.createElement('input');
|
|
el.setAttribute('type', 'file');
|
|
el.setAttribute('name', 'addimg_' + iteration);
|
|
el.setAttribute('size', '41');
|
|
el.setAttribute('value', iteration);
|
|
cellRight.appendChild(el);
|
|
|
|
document.getElementById('images_number').value = iteration;
|
|
}
|
|
|
|
function RemoveImages() {
|
|
var tbl = document.getElementById('tblSample');
|
|
var lastRow = tbl.rows.length;
|
|
if (lastRow > 1){
|
|
tbl.deleteRow(lastRow - 1);
|
|
document.getElementById('images_number').value = document.getElementById('images_number').value - 1;
|
|
}
|
|
}
|
|
</script>";
|
|
echo <<<HTML
|
|
<tr><td height="29" style="padding-left:5px;" colspan="2"><div class="hr_line"></div></td></tr>
|
|
<tr><td height="29" style="padding-left:5px;">{$lang['images_uphard']}</td>
|
|
<td>
|
|
<input type="hidden" name="images_number" id="images_number" value="1">
|
|
<div id="dle_tabView1">
|
|
<table id="tblSample" class="upload">
|
|
<tr id="row">
|
|
<td><input type="file" size="41" name="addimg_1"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div>
|
|
<input type=button class=buttons value=' - ' style="width:30px;" title='{$lang['images_rem_tl']}' onClick="RemoveImages();return false;">
|
|
<input type=button class=buttons value=' + ' style="width:30px;" title='{$lang['images_add_tl']}' onClick="AddImages();return false;">
|
|
</div>
|
|
|
|
</td></tr>
|
|
HTML;
|
|
|
|
#### IMG
|
|
|
|
|
|
?>
|