Файл: modules/padmin/edit_link.php
Строк: 126
<?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['level'] < 6 || !isset($user)) { header('Location: /'); exit;}
$locate = 'in_padmin';
if(isset($_GET['link_id'])) {
if(isset($_GET['act']) && $_GET['act'] == 'edit') {
$link_url = input($_POST['link_url']);
$link_name = input($_POST['link_name']);
$link_image = input($_POST['link_image']);
$link_type = abs(intval($_POST['link_type']));
if(isset($_POST['link_redirect'])) {
$link_redirect = 1;
}
else
{
$link_redirect = 2;
}
$db->query("UPDATE `ads` SET `link` = '$link_url', `name` = '$link_name', `image` = '$link_image', `type` = '$link_type', `redirect` = '$link_redirect' WHERE `id` = '". abs(intval($_GET['link_id'])) ."'");
header('location: /padmin/ads/');
// echo $link_type;
exit;
}
$linke = $db->query("SELECT * FROM `ads` WHERE `id` = '". abs(intval($_GET['link_id'])) ."'")->fetch();
$title = _t('edit_link');
include_header($title);
$tpl->div('title', _t('edit_link'));
if(isset($_GET['act']) && $_GET['act'] == 'error') {
$tpl->div('error', 'Unsupported input data');
}
echo '<div class="menu">
<form action="/padmin/edit_link?act=edit&link_id='.abs(intval($_GET['link_id'])).'" method="post">
'. _t('link_url') .':<br/>
<input type="text" name="link_url" value="'. $linke['link'] .'"/><br/>
'. _t('link_name') .':<br/>
<input type="text" name="link_name" value="'. $linke['name'] .'"/><br/>
'. _t('link_image') .':<br/>
<input type="text" name="link_image" value="'. $linke['image'] .'"/><br/>
'. _t('link_type') .':<br/>
<select name="link_type">
<option value="1" '.($linke['type'] == 1 ? 'selected="selected"' : NULL).'>'. _t('header_link') .'</option>
<option value="2" '.($linke['type'] == 2 ? 'selected="selected"' : NULL).'>'. _t('footer_link') .'</option>
<option value="3" '.($linke['type'] == 3 ? 'selected="selected"' : NULL).'>'. _t('banner_link') .'</option>
</select><br/>
'. _t('link_redirect') .': <input type="checkbox" name="link_redirect" '.($linke['redirect'] == 1 ? 'checked' : NULL).'/><br/>
<input type="submit" value="'. _t('save') .'" />
</form>
</div>';
$tpl->div('block', img('ads.png') .'<a href="/padmin/ads/">'. _t('padmin_ads') .'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. _t('padmin') .'</a><br/>'. HICO .'<a href="/">'. _t('home') .'</a>');
include_footer();
} else { header('location: /index.php'); exit;}
?>