Файл: 2/3020.ru/modules/news/plugins/edit.php
Строк: 184
<?php
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=news'>".LG('Новости')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($news['NAME'])."";
ECHO "</div>";
IF (POST('ok')){
$err_data = 0;
$name = ADSL(POST('name'));
$message = ADSL(POST('message'));
$private_comments = INTVAL(POST('private_comments'));
$mt = INTVAL(POST('main_time'));
IF ($mt == 0){
$main_time = NULL;
}ELSE{
$main_time = TIME() + $mt;
}
IF (STR($name) < 1){
ERROR('Имя не может быть меньше 1 символа', 'session');
$err_data = 1;
}
IF (STR($name) > 200){
ERROR('Имя не может быть больше 200 символов', 'session');
$err_data = 1;
}
IF (STR($message) < 1){
ERROR('Содержимое не может быть меньше 1 символа', 'session');
$err_data = 1;
}
IF (STR($message) > 10000){
ERROR('Содержимое не может быть больше 10000 символов', 'session');
$err_data = 1;
}
IF ($err_data == 1){
REDIRECT('/modules/?path=news§ion=show&id='.$news['ID'].'&get=edit');
}
DB::GET_SET("UPDATE `NEWS` SET `MAIN_TIME` = '".$main_time."', `PRIVATE_COMMENTS` = '".$private_comments."', `NAME` = '".$name."', `MESSAGE` = '".$message."' WHERE `ID` = '".$news['ID']."' LIMIT 1");
IF (ACCESS('news', NULL, 1) || MANAGEMENT == 1){
LOGS('Новости - редактирование новости '.$account['LOGIN'].'', $user['ID']);
}
DB::GET_SET("UPDATE `ATTACHMENTS` SET `ID_POST` = '".$news['ID']."', `ACT` = '1' WHERE `ACT` = '0' AND `NEWS` = '1'");
SUCCESS('Изменения успешно приняты', 'session');
REDIRECT('/modules/?path=news§ion=show&id='.$news['ID']);
}
ECHO "<div class='list'>";
ECHO "<form method='post' class='form' action='/modules/?path=news§ion=show&id=".$news['ID']."&get=edit'>";
ECHO "<b>".LG('Введите название')."</b> (".LG('от 1 до 200 символов')."):<br />";
HTML::INPUT('name', 'Имя', NULL, NULL, TEXT_ABSOLUTE($news['NAME']));
ECHO "<b>".LG('Введите содержание')."</b> (".LG('от 1 до 10000 символов')."):<br />";
HTML::TEXTAREA(TEXT_ABSOLUTE($news['MESSAGE']), 'message', 'Описание');
IF ($news['USER_ID'] == $user['ID']){
ECHO "<br /><b>".LG('Добавить').":</b>";
//Прикрепление файлов
REQUIRE (ROOT.'/modules/news/plugins/files_edit.php');
}
ECHO "<br />";
ECHO "<b>".LG('Комментирование')."</b>:<br />";
ECHO "<select name='private_comments' class='form-control-select'>";
ECHO "<option value='0' ".($news['PRIVATE_COMMENTS'] == 0 ?" selected='selected'":NULL)."> ".LG('Всем')."</option>";
ECHO "<option value='1' ".($news['PRIVATE_COMMENTS'] == 1 ?" selected='selected'":NULL)."> ".LG('Только членам администрации')."</option>";
ECHO "<option value='2' ".($news['PRIVATE_COMMENTS'] == 2 ?" selected='selected'":NULL)."> ".LG('Только мне')."</option>";
ECHO "</select><br /><br />";
ECHO "<b>".LG('Сколько дней показывать на главной')."</b>:<br />";
ECHO "<select name='main_time' class='form-control-select'>";
ECHO "<option value='0' ".($news['MAIN_TIME'] == 0 ?" selected='selected'":NULL)."> ".LG('Не показывать')."</option>";
ECHO "<option value='86400' ".($news['MAIN_TIME'] == 86400 ?" selected='selected'":NULL).">1 ".LG('день')."</option>";
ECHO "<option value='172800' ".($news['MAIN_TIME'] == 172800 ?" selected='selected'":NULL).">2 ".LG('дня')."</option>";
ECHO "<option value='259200' ".($news['MAIN_TIME'] == 259200 ?" selected='selected'":NULL).">3 ".LG('дня')."</option>";
ECHO "<option value='345600' ".($news['MAIN_TIME'] == 345600 ?" selected='selected'":NULL).">4 ".LG('дня')."</option>";
ECHO "<option value='432000' ".($news['MAIN_TIME'] == 432000 ?" selected='selected'":NULL).">5 ".LG('дней')."</option>";
ECHO "<option value='518400' ".($news['MAIN_TIME'] == 518400 ?" selected='selected'":NULL).">6 ".LG('дней')."</option>";
ECHO "<option value='604800' ".($news['MAIN_TIME'] == 604800 ?" selected='selected'":NULL).">7 ".LG('дней')."</option>";
ECHO "<option value='691200' ".($news['MAIN_TIME'] == 691200 ?" selected='selected'":NULL).">8 ".LG('дней')."</option>";
ECHO "<option value='777600' ".($news['MAIN_TIME'] == 777600 ?" selected='selected'":NULL).">9 ".LG('дней')."</option>";
ECHO "<option value='864000' ".($news['MAIN_TIME'] == 864000 ?" selected='selected'":NULL).">10 ".LG('дней')."</option>";
ECHO "<option value='950400' ".($news['MAIN_TIME'] == 950400 ?" selected='selected'":NULL).">11 ".LG('дней')."</option>";
ECHO "<option value='1036800' ".($news['MAIN_TIME'] == 1036800 ?" selected='selected'":NULL).">12 ".LG('дней')."</option>";
ECHO "<option value='1123200' ".($news['MAIN_TIME'] == 1123200 ?" selected='selected'":NULL).">13 ".LG('дней')."</option>";
ECHO "<option value='1209600' ".($news['MAIN_TIME'] == 1209600 ?" selected='selected'":NULL).">14 ".LG('дней')."</option>";
ECHO "<option value='1296000' ".($news['MAIN_TIME'] == 1296000 ?" selected='selected'":NULL).">15 ".LG('дней')."</option>";
ECHO "<option value='1382400' ".($news['MAIN_TIME'] == 1382400 ?" selected='selected'":NULL).">16 ".LG('дней')."</option>";
ECHO "<option value='1468800' ".($news['MAIN_TIME'] == 1468800 ?" selected='selected'":NULL).">17 ".LG('дней')."</option>";
ECHO "<option value='1555200' ".($news['MAIN_TIME'] == 1555200 ?" selected='selected'":NULL).">18 ".LG('дней')."</option>";
ECHO "<option value='1641600' ".($news['MAIN_TIME'] == 1641600 ?" selected='selected'":NULL).">19 ".LG('дней')."</option>";
ECHO "<option value='1728000' ".($news['MAIN_TIME'] == 1728000 ?" selected='selected'":NULL).">20 ".LG('дней')."</option>";
ECHO "<option value='1814400' ".($news['MAIN_TIME'] == 1814400 ?" selected='selected'":NULL).">21 ".LG('день')."</option>";
ECHO "<option value='1900800' ".($news['MAIN_TIME'] == 1900800 ?" selected='selected'":NULL).">22 ".LG('дня')."</option>";
ECHO "<option value='1987200' ".($news['MAIN_TIME'] == 1987200 ?" selected='selected'":NULL).">23 ".LG('дня')."</option>";
ECHO "<option value='2073600' ".($news['MAIN_TIME'] == 2073600 ?" selected='selected'":NULL).">24 ".LG('дня')."</option>";
ECHO "<option value='2160000' ".($news['MAIN_TIME'] == 2160000 ?" selected='selected'":NULL).">25 ".LG('дней')."</option>";
ECHO "<option value='2246400' ".($news['MAIN_TIME'] == 2246400 ?" selected='selected'":NULL).">26 ".LG('дней')."</option>";
ECHO "<option value='2332800' ".($news['MAIN_TIME'] == 2332800 ?" selected='selected'":NULL).">27 ".LG('дней')."</option>";
ECHO "<option value='2419200' ".($news['MAIN_TIME'] == 2419200 ?" selected='selected'":NULL).">28 ".LG('дней')."</option>";
ECHO "<option value='2505600' ".($news['MAIN_TIME'] == 2505600 ?" selected='selected'":NULL).">29 ".LG('дней')."</option>";
ECHO "<option value='2592000' ".($news['MAIN_TIME'] == 2592000 ?" selected='selected'":NULL).">30 ".LG('дней')."</option>";
ECHO "<option value='5184000' ".($news['MAIN_TIME'] == 5184000 ?" selected='selected'":NULL).">2 ".LG('месяца')."</option>";
ECHO "<option value='7776000' ".($news['MAIN_TIME'] == 7776000 ?" selected='selected'":NULL).">3 ".LG('месяца')."</option>";
ECHO "<option value='10368000' ".($news['MAIN_TIME'] == 10368000 ?" selected='selected'":NULL).">4 ".LG('месяца')."</option>";
ECHO "<option value='12960000' ".($news['MAIN_TIME'] == 12960000 ?" selected='selected'":NULL).">5 ".LG('месяцев')."</option>";
ECHO "<option value='15552000' ".($news['MAIN_TIME'] == 15552000 ?" selected='selected'":NULL).">6 ".LG('месяцев')."</option>";
ECHO "<option value='31536000' ".($news['MAIN_TIME'] == 31536000 ?" selected='selected'":NULL).">1 ".LG('год')."</option>";
ECHO "</select><br /><br />";
HTML::BUTTON('btn-big ajax-button', 'ok', 'save', 'Сохранить изменения');
ECHO "</form>";
ECHO "</div>";
ECHO "<div class='list'>";
ECHO "<a href='/modules/?path=news§ion=show&id=".$news['ID']."'>".ICONS('arrow-left', 15, 'fa-fw')." ".LG('Назад')."</a>";
ECHO "</div>";
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=news'>".LG('Новости')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($news['NAME'])."";
ECHO "</div>";
REQUIRE (ROOT.'/system/connections/footer.php');
EXIT;
?>