Файл: modules/albums/edit_photo.php
Строк: 45
<?php
/**
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) 2013, Taras Chornyi, Sergiy Mazurenko, Ivan Kotliar
* @link http://perf-engine.net
* @package PerfEngine
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$locate = 'in_photo_albums';
$phot_id = abs(intval($_GET['id']));
$phot = $db->query("SELECT * FROM `albums_photo` WHERE `id` = '". $phot_id ."'")->fetch();
if(!isset($phot_id) || $db->query("SELECT * FROM `albums_photo` WHERE `id` = '$phot_id'")->rowCount() == 0 || (User::Id() != $phot['user_id'] && User::level() != 2 && User::level() < 6))
{
header('location: /albums/');
exit;
}
if(isset($_GET['act']) && $_GET['act'] == 'save')
{
$desc = input($_POST['desc']);
$db->query("UPDATE `albums_photo` SET `description` = '$desc' WHERE `id` = '$phot_id'");
// print_r($db->errorInfo());
header('location: /albums/photo/'.$phot_id);
exit;
}
$title = _t('dl_edit_dir').' | '._t('albums');
include_header($title);
$tpl->div('title', _t('edit'));
echo '<div class="post">
<form action="/albums/edit_photo/'.$phot_id.'?act=save" method="post">
<img src="/cache/albums/thumbs/'.$phot['server_name'].'.jpg" alt="" /><br />
'._t('desc_photo').':<br/>
<textarea name="desc" rows="5" cols="25">'.$phot['description'].'</textarea><br/>
<input type="submit" value="'. _t('save') .'" />
</form>
</div>';
$tpl->div('block', img('nav.png') . ' <a href="/albums/photo/'.$phot_id.'">'. _t('back') .'</a><br/>'
. img('nav.png') . ' <a href="/albums/">'. _t('photo_albums') .'</a><br/>'
. HICO .' <a href="/">'. _t('home') .'</a>');
include_footer();
?>