View file modules/share/edit_dir.php

File size: 1.37Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.pp.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);

$db->query("UPDATE `share` SET `name` = '". $name ."' 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="'. escape($edit_cat['name']) .'" /><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');
?>