View file modules/share/edit_folder.php

File size: 1.89Kb
<?php
/**********************************
*	@package: PerfCMS			  *
*	@year: 2012					  *
*	@author: Artas				  *
*	@link: http://perfcms.ru	  *
**********************************/
$locate = 'in_share';
if($user['level'] < '6' || !isset($_GET['cat_id'])) { go('/'); }
if($db->query("SELECT * FROM `share_c` WHERE `id` = '". abs(intval($_GET['cat_id'])) ."'")->rowCount() == 0) {
go('/share/');
}
$edit_folder = $db->query("SELECT * FROM `share_c` WHERE `id` = '". abs(intval($_GET['cat_id'])) ."'")->fetch();
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$name = substr(input($_POST['name']), 0, 55);
$who_upload = substr(abs(intval($_POST['who_upload'])), 0, 1);
$db->query("UPDATE `share_c` SET `name` = '". $name ."', `who_upload` = '$who_upload' WHERE `id` = '". abs(intval($_GET['cat_id'])) ."'");
go('/share/folder/'. abs(intval($_GET['cat_id'])) .'/');
// 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_folder/'. abs(intval($_GET['cat_id'])) .'/?act=edit" method="post">
		<div class="menu">
			<b>'. $lang->word('name') .'</b>:<br/>
			<input typr="text" name="name" value="'. $edit_folder['name'] .'" /><br/>
			<b>'.$lang->word('who_upload').'</b>:<br/>
			<select name="who_upload">
			<option value="1" '.($edit_folder['who_upload'] == 1 ? 'selected="selected"' : NULL).'>'.$lang->word('administration').'</option>
			<option value="2" '.($edit_folder['who_upload'] == 2 ? 'selected="selected"' : NULL).'>'.$lang->word('alls').' '.$lang->word('regs').'</option>
			</select><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');
?>