<?php
if(file_exists('handler/stay.php') == TRUE) {
require('handler/stay.php');
}else{
echo '<p class="red_span" align="center">Error - Fehler</p>';
exit;
}
?>
<?php define('INCLUDE_CHECK',1); define('MYSQL_CHECK',1); ?>
<?php require('../framework/config.php'); ?>
<?php require('../framework/mysql.php'); ?>
<?php require('../framework/constants.php'); ?>
<?php require('../framework/class/cache_class.php'); no_cache(); ?>
<?php require('../framework/security.php'); ?>
<?php require('handler/language.php'); ?>
<?php require('structure/header.inc.php'); ?>
<div class="menu">
<div class="menu_left">
<ul id="admin_navi">
<li><a href="index.php"><?php echo $lang['blank_admin_area']; ?></a></li>
<li><a href="members.php"><?php echo $lang['admin_members']; ?></a></li>
<li><a href="discussions.php"><?php echo $lang['discussions']; ?></a></li>
<li><a href="topics.php"><?php echo $lang['blank_topics']; ?></a></li>
<li><a href="news.php"><?php echo $lang['news']; ?></a></li>
<li class="active"><a href="events.php"><?php echo $lang['events']; ?></a></li>
<li><a href="newsletter.php"><?php echo $lang['newsletter']; ?></a></li>
<li><a href="statistic.php"><?php echo $lang['statistic']; ?></a></li>
</ul>
</div>
<div class="menu_right">
<?php
if(isset($_SESSION['admin']) && $_SESSION['admin'] == TRUE) {
echo '<div class="admin_settings">
<a class="admin_account"><span>' . $lang['blank_navigation'] . '</span></a>
<div class="admin_submenu" style="display: none;">
<ul class="root">
<li><a href="' . $url . '" target="_blank">' . $lang['goto_network'] . '</a></li>
<li><a href="signout.php">' . $lang['signout'] . '</a></li>
</ul>
</div>
</div>';
}
?>
</div>
</div>
</div>
<div class="clear"></div>
<div id="content_wrapper">
<div class="content">
<?php
echo '<h1 class="p_space">' . $lang['events'] . '</h1>';
if($_SERVER['REQUEST_METHOD'] != 'POST') {
echo '<form method="post" name="create" action="">
<p><input type="text" name="title" id="title" class="textfields" required size="40" maxlength="40"> ' . $lang['title'] . '</p>
<textarea cols="45" rows="8" name="content" id="content" class="textareas"></textarea>
<p><input type="submit" name="submit" value="' . $lang['admin_create_event'] . '" alt="' . $lang['admin_create_event'] . '" class="buttons"></p>
<input type="hidden" name="submitted" value="TRUE">
</form>';
echo '<div id="pr_line"></div>';
echo '<h1 class="p_space">' . $lang['admin_events_added'] . '</h1>';
$sql = "SELECT * FROM events ORDER BY id DESC";
$result = mysql_query($sql) OR die(mysql_error());
if(!$result) {
echo '<p class="false">' . $lang['admin_no_events_avai'] . '</p>' . mysql_error();
}else{
if(intval(mysql_num_rows($result)) == 0) {
echo '<p class="false">' . $lang['admin_no_events_avai'] . '</p>';
}else{
echo '<table width="100%" class="tables">
<tr>
<td width="5%" align="left"><strong>ID</strong></td>
<td width="25%" align="left"><strong>' . $lang['title'] . '</strong></td>
<td width="45%" align="left"><strong>' . $lang['events'] . '</strong></td>
<td width="15%" align="left"><strong>' . $lang['date'] . '</strong></td>
<td width="10%" align="center"><strong>' . $lang['admin_delete'] . '</strong></td>
</tr>';
include_once('../framework/filter.php');
include_once('handler/grafics.php');
while($row = mysql_fetch_assoc($result)) {
$content = mysql_filter(filter_html(smileys(stripslashes(nl2br($row['content'])))));
$text = ((strlen($content) < 6) ? $content : substr($content, 0, 250).'...');
echo '<tr>
<td width="5%">' . (int)$row['id'] . '</td>
<td width="25%">' . htmlentities($row['title'], ENT_QUOTES) . '</td>
<td width="45%">' . $text . '</td>
<td width="15%">' . date('d.m.Y', strtotime($row['date'])) . '</td>
<td width="10%" align="center"><a href="cancel.php?id=' . (int)$row['id'] . '"><img src="../style/icons/delete.png" alt="' . $lang['admin_delete'] . '" title="' . $lang['admin_delete'] . '" border="0"></a></td>
</tr>';
}
echo '</table>';
}
}
}else{
$errors = array();
if(isset($_POST['title'])) {
if(trim($_POST['title']) == "") {
$errors[] = $lang['enter_a_title'];
}
}else{
$errors[] = $lang['enter_a_title'];
}
if(isset($_POST['content'])) {
if(trim($_POST['content']) == "") {
$errors[] = $lang['enter_a_text'];
}
}else{
$errors[] = $lang['enter_a_text'];
}
if(!empty($errors)) {
echo '<p>' . $lang['not_filled_in_all_fields'] . ' - <a href="javascript:history.back();">' . $lang['back'] . '</a></p>';
echo '<ul>';
foreach($errors as $key => $value) {
echo '<li>• ' . $value . '</li>';
}
echo '</ul>';
}else{
$sql = "INSERT INTO
events(title, content, date)
VALUES ('" . mysql_real_escape_string($_POST["title"]) . "',
'" . mysql_real_escape_string($_POST["content"]) . "',
NOW()
)";
$result = mysql_query($sql) OR die(mysql_error());
if(!$result) {
echo '<p class="false">' . $lang['admin_event_not'] . '</p>';
}else{
$autoforward = 3;
echo '<p class="success">' . $lang['admin_event_created'] . '!</p>
<meta http-equiv="refresh" content="' . $autoforward . '; URL=events.php">';
}
}
}
?>
<?php require('structure/footer.inc.php'); ?>