File size: 1.76Kb
<?php
/**********************************
* @package: PerfCMS *
* @year: 2012 *
* @author: Artas *
* @link: http://perfcms.org.ua *
**********************************/
$locate = 'in_downloads';
$dir_id = abs(intval($_GET['id']));
if(!isset($dir_id) && $db->query("SELECT * FROM `downloads` WHERE `id` = '$dir_id'")->rowCount() == 0 || $user['level'] < 4)
{
header('location: /downloads/');
exit;
}
$diri = $db->query("SELECT * FROM `downloads` WHERE `id` = '". $dir_id ."'")->fetch();
if(isset($_GET['act']) && $_GET['act'] == 'save')
{
$name = mb_substr(input($_POST['dir_name']), 0, 100);
$desc = input($_POST['dir_desc']);
if(!empty($name))
{
$db->query("UPDATE `downloads` SET `name` = '$name', `description` = '$desc' WHERE `id` = '$dir_id'");
// print_r($db->errorInfo());
header('location: /downloads/dir/'.$dir_id);
exit;
}
}
$title = $lang->word('dl_edit_dir').' | '.$lang->word('downloads');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('dl_edit_dir'));
echo '<div class="menu">
<form action="/downloads/edit_dir/'.$dir_id.'?act=save" method="post">
'.$lang->word('dl_dir_name').':<br/>
<input type="text" value="'.$diri['name'].'" name="dir_name" /><br/>
'.$lang->word('dl_dir_desc').':<br/>
<textarea name="dir_desc" rows="5" cols="25">'.$diri['description'].'</textarea><br/>
<input type="submit" value="'. $lang->word('save') .'" />
</form>
</div>';
$tpl->div('block', img('nav.png') . ' <a href="/downloads/dir/'.$dir_id.'">'. $lang->word('back') .'</a><br/>'
. img('download.png') . ' <a href="/downloads/">'. $lang->word('downloads') .'</a><br/>'
. HICO .' <a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
?>