- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
<?php
if (!$action){
echoheader('addnews', $echo['header']);
?>
<form method="post" name="addnews" action="<?=$PHP_SELF; ?>" onsubmit="return process_form(this)">
<!-- короткая -->
<fieldset id="short"><legend><?=$echo['short']; ?></legend>
<?
echo run_filters('new-advanced-options', 'short');
?>
<textarea name="short_story" tabindex="4"></textarea>
</fieldset>
<!-- кнопки -->
<fieldset id="actions"><legend><?=$echo['actions']; ?></legend>
<input type="submit" value="<?=$echo['add']; ?>" accesskey="s">
</fieldset>
<?
}
?>
<fieldset id="date"><legend><?=$echo['date']; ?></legend>
<input type="text" name="day" size="10" maxlength="2" value="<?=date('d'); ?>" title="<?=$echo['calendar']['day']; ?>" readonly>
<input type="text" name="month" size="10" maxlength="10" value="<?=date('M'); ?>" readonly>
<input type="text" name="year" maxlength="4" value="<?=date('y'); ?>" title="<?=$echo['calendar']['year']; ?>" readonly> <input type="text" name="hour" maxlength="2" value="<?=date('H', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['hour']; ?>" readonly>:<input type="text" name="minute" maxlength="2" value="<?=date('i', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['minute']; ?>" readonly>:<input type="text" name="second" maxlength="2" value="<?=date('s', (time() + $config_date_adjust * 60)); ?>" title="<?=$echo['calendar']['second']; ?>" readonly>
</fieldset>
</div></fieldset>
<input type="hidden" name="mod" value="addnews">
<input type="hidden" name="action" value="doaddnews">
</form>
<?
echofooter();
// ********************************************************************************
// Do add News to DB
// ********************************************************************************
if ($action == 'doaddnews'){
if (($added_time = strtotime($day.' '.$month.' '.$year.' '.$hour.':'.$minute.':'.$second)) == -1){
$added_time = (time() + $config_date_adjust * 60);
}
if (!$title){
$title = substr($short_story, 0, 10).'...';
}
$id = $sql->last_insert_id('news', '', 'id') + 1;
run_actions('new-save-entry');
$sql->insert(array(
'table' => 'news',
'values' => array(
'date' => $added_time,
'author' => $member['username'],
'title' => replace_news('add', $title),
'short' => strlen(replace_news('add', $short_story)),
'full' => strlen(replace_news('add', $full_story)),
'avatar' => $avatar,
'category' => $category,
'url' => ($url ? my_namespace($url) : my_namespace(totranslit($title))),
'hidden' => (($config_approve_news == 'yes' and $member['level'] > 2) ? true : false)
)
));
$sql->insert(array(
'table' => 'story',
'values' => array(
'post_id' => $id,
'short' => replace_news('add', $short_story),
'full' => replace_news('add', $full_story)
)
));
run_actions('new-save-entry');