View file modules/share/edit_dir.php

File size: 1.54Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.org.ua	  *
**********************************/
$locate = 'in_share';
if($user['level'] < '6' || !isset($_GET['rid'])) { go('/'); }
if($db->query("SELECT * FROM `share` WHERE `id` = '". abs(intval($_GET['rid'])) ."'")->rowCount() == 0) {
go('/share/');
}
$edit_cat = $db->query("SELECT * FROM `share` WHERE `id` = '". abs(intval($_GET['rid'])) ."'")->fetch();
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$name = substr(input($_POST['name']), 0, 45);
$desc = substr(input($_POST['desc']), 0, 160);
$db->query("UPDATE `share` SET `name` = '". $name ."', `desc` = '$desc' WHERE `id` = '". abs(intval($_GET['rid'])) ."'");
go('/share/');
// print_r($db->errorInfo());
}
$title = $lang->word('edit');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit'));
echo '<form action="/share/edit_dir/'. abs(intval($_GET['rid'])) .'/?act=edit" method="post">
		<div class="menu">
			<b>'. $lang->word('name') .'</b>:<br/>
			<input type="text" name="name" value="'. $edit_cat['name'] .'" /><br/>
			<b>'. $lang->word('desc') .'</b>:<br/>
			<input typr="text" name="desc" value="'. $edit_cat['desc'] .'" /><br/>
			<input name="edit" type="submit" value="'. $lang->word('edit') .'" /><br/>
		</div>
		</form>';
		
$tpl->div('block', NAV .'<a href="/share/">'. $lang->word('share') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
?>