Файл: public_html/modules/library/edit_note.php
Строк: 33
<?php
/**********************************
*    @package: PerfCMS              *
*    @year: 2012                      *
*    @author: Artas                  *
*    @link: http://perfcms.net     *
* ------------------------------- *
*    @package: PerfCMS Ultra          *
*    @year: 2013                      *
*   @author: wanya26ua & Tesla    *
*   @link: http://perfclub.ru     *
**********************************/
$locate = 'in_library';
if($user['level'] < '5') { go('/'); }
if(isset($_GET['id'])) {
$id = cget($_GET['id']);
if(isset($_POST['edit']) && $_GET['act'] == 'edit') {
$title = substr(input($_POST['title']), 0, 1000);
$text = substr(input($_POST['text']), 0, 300000);
$db->query("UPDATE `library` SET `title` = '".$title."', `text` = '". $text ."' WHERE `id` =  '".$id."'");
// print_r($db->errorInfo());
go('/library/article/'.$id.'/');
}
$title = $lang->word('edit_note');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit_note'));
$note_sql = $db->query("SELECT * FROM `library` WHERE `id` =  '".$id."'")->fetch();
echo '<form action="/library/edit_note/?act=edit&id='.$id.'" method="post">
        <div class="menu">
            <b>'. $lang->word('name') .'</b>:<br/>
            <input name="title" type="text" value="'. $note_sql['title'] .'" /><br/>
            <b>'. $lang->word('message') .'</b>:<br/>
            <textarea name="text" rows="5" cols="26">'. $note_sql['text'] .'</textarea><br/>
            <input name="edit" type="submit" value="'. $lang->word('save') .'" /><br/>
        </div>
        </form>';
        
$tpl->div('block', NAV .'<a href="/library/">'. $lang->word('library') .'</a><br/>' . HICO .'<a href="/">'. $lang->word('home').'</a>');
require_once(SYS.'/view/footer.php');
} else { go('/library/'); }
?>