Файл: modules/albums/add.php
Строк: 66
<?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
*/
if(!User::logged())
{
go('/');
}
$locate = 'in_photo_albums';
if(isset($_GET['act']) && $_GET['act']) {
$name = input($_POST['name']);
$desc = input($_POST['desc']);
$album_type = abs(input($_POST['album_type']));
$pass = input($_POST['pass']);
$t = array('0', '1', '2', '3');
if (empty($pass) && $album_type == 3) $err = _t('no_pass').'<br />';
if(!empty($name) && in_array($album_type, $t) && !isset($err))
{
$db->query("INSERT INTO `albums` SET `name` = '$name', `description` = '$desc', `type` = '$album_type', `password` = '$pass', `user_id` = '".User::Id()."'");
mkdir(ROOT.'/files/albums/'.$db->lastInsertId());
mkdir(ROOT.'/cache/albums/thumbs/'.$db->lastInsertId());
header('location: /albums/album/'.$db->lastInsertId());
exit;
}
}
$title = _t('add_album');
include_header($title);
Template::div('title', $title);
if (isset($err)) echo '<div class="error">'. $err .'</div>';
echo '<div class="post">
<form action="/albums/add/?act=add" method="post">
'._t('name_album').':<br/>
<input type="text" name="name" /><br/>
'._t('desc_album').':<br/>
<textarea name="desc" rows="5" cols="25"></textarea><br/><br/>
'._t('album_type').':<br/>
<select name="album_type" size="1"><option value="0" >'._t('album_open').'</option><option value="1" >'._t('album_close').'</option><option value="2" >'._t('album_friends').'</option><option value="3" >'._t('album_pass').'</option></select><br />
'._t('password').' ('._t('album_pass2').'):<br/>
<input type="text" name="pass" maxlength="15" /><br/>
<input type="submit" value="'. _t('add') .'" />
</form>
</div>';
Template::div('block', NAV . ' <a href="/albums/user/'. User::Id() .'">'. _t('back') .'</a><br/>
'. img('albums.png') . ' <a href="/albums/">'. _t('photo_albums') .'</a><br/>'
. HICO .' <a href="/">'. _t('home') .'</a>');
include_footer();
?>