2097000 ) { # 2 mb (2 097 152)
return ('Die Datei darf NICHT grösser als 2 MBytes sein.');
}
if (
($fende != 'rar' AND $fende != 'zip' AND $fende != 'tar')
OR (
$rtype != 'application/x-rar' AND
$rtype != 'application/x-zip' AND
$rtype != 'application/x-tar')
) {
return ('Die Datei darf nur die Endungen: .zip, .tar oder .rar haben.');
}
$fname = str_replace ('.'.$fende, '', $fname);
$fname = preg_replace("/[^a-zA-Z0-9]/", "", $fname);
$fname = $fname.'.'.$fende;
if (file_exists( 'include/downs/forumloads/'.$fname ) ) {
return ('Die Datei existiert bereits und kann nicht überschrieben werden.');
}
if ( move_uploaded_file($_FILES['file']['tmp_name'], 'include/downs/forumloads/'.$fname) ) {
$url = 'include/downs/forumloads/'.$fname;
@chmod($url, 0777);
} else {
return ('Die Datei konnte nicht erfolgreich hochgeladen werden!');
}
}
if (empty($url)) {
return (false);
} else {
return (true);
}
}
if ( $forum_rights['start'] == FALSE ) {
$forum_failure[] = $lang['nopermission'];
check_forum_failure($forum_failure);
}
$title = $allgAr['title'].' :: Forum :: '.aktForumCats($aktForumRow['kat'],'title').' :: '.$aktForumRow['name'].' :: neues Thema';
$hmenu = $extented_forum_menu.'Forum » '.aktForumCats($aktForumRow['kat']).' » '.$aktForumRow['name'].''.$extented_forum_menu_sufix;
$dppk_time = time();
$time = time();
if (!isset($_SESSION['klicktime'])) { $_SESSION['klicktime'] = 0; }
$topic = '';
$txt = '';
$xnn = '';
if (isset($_POST['topic'])) {
$topic = trim(escape($_POST['topic'], 'string'));
}
if (isset($_POST['txt'])) {
$txt = trim(escape($_POST['txt'], 'textarea'));
}
if (isset($_POST['Gname'])) {
$xnn = trim(escape_nickname($_POST['Gname']));
}
if (($_SESSION['klicktime'] + 15) > $dppk_time OR empty($topic) OR empty($txt) OR !empty($_POST['priview']) OR (empty($_POST['Gname']) AND !loggedin())) {
$design = new design ( $title , $hmenu, 1);
$design->header();
$tpl = new tpl ( 'forum/newtopic' );
$name = '';
if ( !loggedin() ) {
$name = '
| '.$lang['name'].' | ';
$name .= ' |
';
}
if (isset($_POST['priview'])) {
$tpl->set_out('txt', bbcode(unescape($txt)), 0);
}
$ar = array (
'name' => $name,
'txt' => escape_for_fields(unescape($txt)),
'topic' => escape_for_fields(unescape($topic)),
'fid' => $fid,
'SMILIES' => getsmilies()
);
$tpl->set_ar_out($ar,1);
} else {
# save toipc
$_SESSION['klicktime'] = $dppk_time;
$design = new design ( $title , $hmenu, 0);
$design->header();
if ( loggedin()) {
$uid = $_SESSION['authid'];
$erst = escape($_SESSION['authname'],'string');
db_query("UPDATE `prefix_user` set posts = posts+1 WHERE id = ".$uid);
} else {
$erst = $xnn;
$uid = 0;
}
db_query("INSERT INTO `prefix_topics` (fid, name, erst, stat) VALUES ( ".$fid.", '".$topic."', '".$erst."', 1 )");
$tid = db_last_id();
# topic alert
if (!empty($_POST['topic_alert']) AND $_POST['topic_alert'] == 'yes' AND loggedin()) {
if (0 == db_result(db_query("SELECT COUNT(*) FROM prefix_topic_alerts WHERE uid = ".$_SESSION['authid']." AND tid = ".$tid),0)) {
db_query("INSERT INTO prefix_topic_alerts (tid,uid) VALUES (".$tid.", ".$_SESSION['authid'].")");
}
}
if ( loggedin() AND is_writeable ( 'include/downs/forumloads' ) ) {
$dat = '';
$re = icUpload($dat);
if ($re === true) {
db_query ("INSERT INTO `prefix_posts` (tid,fid,erst,erstid,time,txt,url) VALUES ( ".$tid.", ".$fid.", '".$erst."', ".$uid.", ".$time.", '".$txt."', '".$dat."')");
$pid = db_last_id();
db_query("UPDATE `prefix_topics` SET last_post_id = ".$pid." WHERE id = ".$tid);
db_query("UPDATE `prefix_forums` SET posts = posts + 1, last_post_id = ".$pid.", topics = topics + 1 WHERE id = ".$fid);
# toipc als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
wd('index.php?forum-showposts-'.$tid,$lang['createtopicsuccessful']);
} elseif ($re === false) {
db_query ("INSERT INTO `prefix_posts` (tid,fid,erst,erstid,time,txt) VALUES ( ".$tid.", ".$fid.", '".$erst."', ".$uid.", ".$time.", '".$txt."')");
$pid = db_last_id();
db_query("UPDATE `prefix_topics` SET last_post_id = ".$pid." WHERE id = ".$tid);
db_query("UPDATE `prefix_forums` SET posts = posts + 1, last_post_id = ".$pid.", topics = topics + 1 WHERE id = ".$fid);
# toipc als gelesen markieren
$_SESSION['forumSEE'][$fid][$tid] = time();
wd('index.php?forum-showposts-'.$tid,$lang['createtopicsuccessful']);
} else {
wd('index.php?forum-newtopic-'.$fid,'Fehler:
'.$re,5);
}
}
}
$design->footer();
?>