function forum_path($info, $inpath = false) { global $set, $db, $apx; if (!$info['forumid']) { return array(); } $parents = dash_unserialize($info['parents']); if ($inpath) { $parents[] = $info['forumid']; } //Forum in der Liste zeigen if (!count($parents)) { return array(); } $data = $db->fetch("SELECT forumid,title FROM " . PRE . "_forums WHERE forumid IN (" . implode(',', $parents) . ") ORDER BY parents ASC"); if (!count($data)) { return array(); } $pathdata = array(); foreach ($data as $res) { ++$i; $link = mkrellink('forum.php?id=' . $res['forumid'], 'forum,' . $res['forumid'] . ',1' . urlformat($res['title']) . '.html'); $pathdata[$i]['TITLE'] = replace($res['title']); $pathdata[$i]['LINK'] = $link; } return $pathdata; }
$apx->tmpl->assign('FORUM', $forumdata); $apx->tmpl->assign('POST', $postdata); $apx->tmpl->assign('SELPOST', $seldata); $apx->tmpl->assign('TITLE', compatible_hsc($_POST['title'])); $apx->tmpl->assign('ICON', $_POST['icon']); $apx->tmpl->assign('ICONLIST', $icondata); $apx->tmpl->assign('STICKY_TYPE', compatible_hsc($_POST['sticky_type'])); $apx->tmpl->assign('STICKY_TEXT', compatible_hsc($_POST['sticky_text'])); $apx->tmpl->assign('ANNOUNCE', forum_access_announce($foruminfo)); $apx->tmpl->assign('ID', $threadinfo['threadid']); $apx->tmpl->assign('P', $_REQUEST['p']); $apx->tmpl->assign('PREVIOUS', iif($_REQUEST['p'] > 1, 1, 0)); $apx->tmpl->assign('NEXT', iif($_REQUEST['p'] < $pages, 1, 0)); $apx->tmpl->parse('split'); //////////////////////////////////////////// $threadpath = array(array('TITLE' => replace($threadinfo['title']), 'LINK' => mkrellink('thread.php?id=' . $threadinfo['threadid'], 'thread,' . $threadinfo['threadid'] . ',1' . urlformat($threadinfo['title']) . '.html'))); $apx->tmpl->assign('PATH', array_merge(forum_path($foruminfo, 1), $threadpath)); $apx->tmpl->assign('PATHEND', $apx->lang->get('SPLITTHREAD')); titlebar($apx->lang->get('SPLITTHREAD')); } elseif ($_REQUEST['action'] == 'ipstats') { $apx->lang->drop('ipstats'); $_REQUEST['id'] = (int) $_REQUEST['id']; if (!$_REQUEST['id']) { die('missing post-ID!'); } $postinfo = post_info($_REQUEST['id']); if (!$postinfo['postid'] || $postinfo['del']) { message($apx->lang->get('MSG_POSTNOTEXIST')); } $threadinfo = thread_info($postinfo['threadid']); if (!$threadinfo['threadid'] || $threadinfo['del']) {
function createForumVars($res, $readoutMods = true) { global $apx, $db, $set, $user; global $collapse, $readthreads, $foruminfo; //Link $link = mkrellink('forum.php?id=' . $res['forumid'], 'forum,' . $res['forumid'] . ',1' . urlformat($res['title']) . '.html'); //Moderatoren $moddata = array(); if ($readoutMods) { //$mods=dash_unserialize($res['moderator']); $mods = $res['moderator']; if (count($mods)) { $userdata = $db->fetch("SELECT userid,username FROM " . PRE . "_user WHERE userid IN (" . implode(',', $mods) . ") ORDER BY username ASC"); if (count($userdata)) { foreach ($userdata as $modres) { ++$mi; $moddata[$mi]['USERID'] = $modres['userid']; $moddata[$mi]['USERNAME'] = replace($modres['username']); } } } } $forumdata['ID'] = $res['forumid']; $forumdata['ISCAT'] = $res['iscat']; $forumdata['LEVEL'] = $res['level']; $forumdata['TITLE'] = $res['title']; $forumdata['DESCRIPTION'] = $res['description']; $forumdata['LINKTO'] = $res['link']; $forumdata['LINK'] = $link; $forumdata['THREADS'] = '-'; $forumdata['POSTS'] = '-'; $forumdata['CLOSED'] = iif($res['open'], 0, 1); $forumdata['MODERATOR'] = $moddata; $forumdata['COLLAPSE'] = in_array($res['forumid'], $collapse); //Neues Thema erstellen, wenn Schreibrechte if (forum_access_open($res)) { $forumdata['LINK_NEWTHREAD'] = 'newthread.php?id=' . $res['forumid']; } //Nur anzeigen, wenn Leserechte if (forum_access_read($res) && correct_forum_password($res)) { $thread = false; //Lastvisit bestimmen $lastview = max(array($user->info['forum_lastonline'], forum_readtime($res['forumid']))); $forumdata['NEWPOSTS'] = iif($res['lastposttime'] && $res['lastposttime'] > $lastview, 1, 0); $forumdata['THREADS'] = number_format($res['threads'], 0, '', '.'); $forumdata['POSTS'] = number_format($res['posts'], 0, '', '.'); //Letzter Beitrag //if ( $res['lastposttime'] && $thread==false ) $thread=$db->first("SELECT threadid,title,icon FROM ".PRE."_forum_threads WHERE ( del=0 AND moved=0 AND forumid='".$res['forumid']."' ) ORDER BY lastposttime DESC LIMIT 1"); if ($res['lastthread_icon'] != -1 && isset($set['forum']['icons'][$res['lastthread_icon']])) { $icon = $set['forum']['icons'][$res['lastthread_icon']]['file']; } else { $icon = ''; } $forumdata['LASTPOST_THREADID'] = $res['lastthread']; $forumdata['LASTPOST_THREADTITLE'] = replace($res['lastthread_title']); $forumdata['LASTPOST_THREADPREFIX'] = forum_get_prefix($res['lastthread_prefix']); $forumdata['LASTPOST_USERNAME'] = replace($res['lastposter']); $forumdata['LASTPOST_USERID'] = $res['lastposter_userid']; $forumdata['LASTPOST_TIME'] = $res['lastposttime']; $forumdata['LASTPOST_LINK'] = 'thread.php?id=' . $res['lastthread'] . '&goto=lastpost'; $forumdata['LASTPOST_ICON'] = $icon; } return $forumdata; }
//Die letzten 10 Beiträge $data = $db->fetch("SELECT postid,userid,username,text,time,allowcodes,allowsmilies FROM " . PRE . "_forum_posts WHERE ( del=0 AND threadid='" . $threadinfo['threadid'] . "' ) ORDER BY time DESC LIMIT 10"); if (count($data)) { foreach ($data as $res) { ++$i; //Text $text = forum_replace($res['text'], $res['allowcodes'], $res['allowsmilies']); $postdata[$i]['ID'] = $res['postid']; $postdata[$i]['USERID'] = $res['userid']; $postdata[$i]['USERNAME'] = replace($res['username']); $postdata[$i]['TEXT'] = $text; $postdata[$i]['TIME'] = $res['time']; } } $apx->tmpl->assign('POST', $postdata); $apx->tmpl->assign('ATTACH', forum_access_addattachment($foruminfo)); $apx->tmpl->assign('ID', $threadinfo['threadid']); $apx->tmpl->assign('HASH', $_POST['hash']); $apx->tmpl->parse('newpost'); //////////////////////////////////////////////////////////////////////////////////////////////////////// $threadpath = array(array('TITLE' => trim(compatible_hsc(strip_tags(forum_get_prefix($threadinfo['prefix']) . ' ') . $threadinfo['title'])), 'LINK' => mkrellink('thread.php?id=' . $threadinfo['threadid'], 'thread,' . $threadinfo['threadid'] . ',1' . urlformat($threadinfo['title']) . '.html'))); $apx->tmpl->assign_static('STYLESHEET', compatible_hsc($foruminfo['stylesheet'])); $apx->tmpl->assign('PATH', array_merge(forum_path($foruminfo, 1), $threadpath)); $apx->tmpl->assign('PATHEND', $apx->lang->get('HEADLINE_NEWPOST')); titlebar($apx->lang->get('HEADLINE_NEWPOST')); //////////////////////////////////////////////////////////////////////////////////////////////////////// require 'lib/_end.php'; /////////////////////////////////////////////////////////////////////////// require '../lib/_end.php'; //////////////////////////////////////////////////////// SCRIPT BEENDEN /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
//Index aktualisieren if ($foruminfo['searchable']) { update_index($_POST['text'], $tid, $pid); update_index($_POST['title'], $tid, $pid, true); } //Abonnements if ($user->info['userid']) { if (in_array($_POST['subscription'], array('none', 'instant', 'daily', 'weekly'))) { $notify = $_POST['subscription']; $db->query("INSERT INTO " . PRE . "_forum_subscriptions (userid,type,source,notification) VALUES ('" . $user->info['userid'] . "','thread','" . $tid . "','" . $notify . "')"); } } //Thema als gelesen markieren thread_isread($tid); //Weiterleiten zum Thema $forwarder = mkrellink('thread.php?id=' . $tid . '#p' . $pid, 'thread,' . $tid . ',1' . urlformat($_POST['title']) . '.html#p' . $pid); message($apx->lang->get('MSG_THREAD_ADD_OK'), $forwarder); require 'lib/_end.php'; require '../lib/_end.php'; } } else { $_POST['icon'] = 'none'; $_POST['sticky_type'] = 'no'; $_POST['allowcodes'] = 1; $_POST['allowsmilies'] = 1; $_POST['allowsig'] = 1; $_POST['transform_links'] = 1; $_POST['username'] = $_COOKIE[$set['main']['cookie_pre'] . '_forum_username']; $_POST['hash'] = md5(microtime()); if ($user->info['forum_autosubscribe'] && !$_POST['subscription']) { $_POST['subscription'] = 'instant';
$apx->tmpl->assign('LINK_SENDPM', mklink('user.php?action=newpm&touser='******'userid'], 'user,newpm,' . $res['userid'] . '.html')); } $apx->tmpl->assign('CONTACT_ICQ', replace($userdat['icq'])); $apx->tmpl->assign('CONTACT_MSN', replace($userdat['msn'])); $apx->tmpl->assign('CONTACT_AIM', replace($userdat['aim'])); $apx->tmpl->assign('CONTACT_YIM', replace($userdat['yim'])); $apx->tmpl->assign('CONTACT_SKYPE', replace($userdat['skype'])); //Optionen if ($res['userid']) { $apx->tmpl->assign('LINK_USERPOSTS', HTTPDIR . $set['forum']['directory'] . '/search.php?send=1&author=' . urlencode($res['username'])); if (!$user->is_buddy($res['userid'])) { $apx->tmpl->assign('LINK_ADDBUDDY', mklink('user.php?action=addbuddy&id=' . $res['userid'], 'user,addbuddy,' . $res['userid'] . '.html')); } } $threadlink = mkrellink('thread.php?id=' . $threadinfo['threadid'], 'thread,' . $threadinfo['threadid'] . ',1' . urlformat($threadinfo['title']) . '.html'); $forumlink = mkrellink('forum.php?id=' . $foruminfo['forumid'], 'forum,' . $foruminfo['forumid'] . ',1' . urlformat($foruminfo['title']) . '.html'); $apx->tmpl->assign('THREADID', $threadinfo['threadid']); $apx->tmpl->assign('THREAD_TITLE', replace($threadinfo['title'])); $apx->tmpl->assign('THREAD_PREFIX', forum_get_prefix($threadinfo['prefix'])); $apx->tmpl->assign('THREAD_LINK', $threadlink); $apx->tmpl->assign('THREAD_DELETED', $threadinfo['del']); $apx->tmpl->assign('FORUMID', $foruminfo['forumid']); $apx->tmpl->assign('FORUM_TITLE', replace($foruminfo['title'])); $apx->tmpl->assign('FORUM_LINK', $forumlink); $apx->tmpl->assign('POSTID', $postinfo['postid']); $apx->tmpl->assign('RIGHT_POST', forum_access_post($foruminfo, $threadinfo)); $apx->tmpl->parse('post'); //////////////////////////////////////////////////////////////////////////////////////////////////////// $apx->tmpl->assign_static('STYLESHEET', compatible_hsc($foruminfo['stylesheet'])); $apx->tmpl->assign('PATH', forum_path($foruminfo, 1)); $apx->tmpl->assign('PATHEND', replace(iif($threadinfo['sticky'], $threadinfo['sticky_text'] . ': ') . $threadinfo['title']));
if ($_REQUEST['allread']) { if ($user->info['userid']) { $db->query("UPDATE " . PRE . "_user SET forum_lastonline=forum_lastactive,forum_lastactive='" . time() . "' WHERE userid='" . $user->info['userid'] . "' LIMIT 1"); } else { setcookie($set['main']['cookie_pre'] . '_forum_lastonline', $user->info['forum_lastactive'], time() + 14 * 24 * 3600); setcookie($set['main']['cookie_pre'] . '_forum_lastactive', $now, time() + 14 * 24 * 3600); } $user->info['forum_lastonline'] = $user->info['forum_lastactive']; $user->info['forum_lastactive'] = time(); } ////////////////////////////////////////////////////////////////////////////////////////////////// FOREN //Forum anzeigen $data = forum_readout(); require 'lib/forum_assign.php'; $apx->tmpl->assign('LINK_NEWPOSTS', mkrellink('search.php?newposts=1', 'search.html?newposts=1')); $apx->tmpl->assign('LINK_ALLREAD', mkrellink('index.php?allread=1', 'index.html?allread=1')); //////////////////////////////////////////////////////////////////////////////////////////// ONLINELISTE list($count['users']) = $db->first("SELECT count(*) FROM " . PRE . "_user WHERE lastactive>=" . (time() - $set['user']['timeout'] * 60)); list($count['inv']) = $db->first("SELECT count(*) FROM " . PRE . "_user WHERE lastactive>=" . (time() - $set['user']['timeout'] * 60) . " AND pub_invisible=1"); if ($set['user']['onlinelist']) { list($count['guests']) = $db->first("SELECT count(*) FROM " . PRE . "_user_online WHERE userid=0"); } else { $count['guests'] = 0; } $count['total'] = $count['users'] + $count['guests']; $apx->tmpl->assign('ONLINE_TOTAL', $count['total']); $apx->tmpl->assign('ONLINE_USERS', $count['users']); $apx->tmpl->assign('ONLINE_GUESTS', $count['guests']); $apx->tmpl->assign('ONLINE_INVISIBLE', $count['inv']); $userdata = array(); $mods = get_modlist();
//Auflistung THEMEN if (count($subscr_threads)) { $data = $db->fetch("SELECT * FROM " . PRE . "_forum_threads WHERE threadid IN (" . implode(',', $subscr_threads) . ") ORDER BY lastposttime DESC"); if (count($data)) { //Fehlerhafte Abonnements löschen foreach ($data as $key => $res) { $foruminfo = get_forum_info($res['forumid']); if (!$foruminfo || !forum_access_read($foruminfo)) { unset($data[$key]); $db->query("DELETE FROM " . PRE . "_forum_subscriptions WHERE ( type='thread' AND source='" . $res['threadid'] . "' AND userid='" . $user->info['userid'] . "' )"); } } foreach ($data as $res) { ++$i; //Link $link = HTTPDIR . $set['forum']['directory'] . '/' . mkrellink('thread.php?id=' . $res['threadid'], 'thread,' . $res['threadid'] . ',1' . urlformat($res['title']) . '.html'); //Icon if ($res['icon'] != -1 && isset($set['forum']['icons'][(int) $res['icon']])) { $icon = $set['forum']['icons'][(int) $res['icon']]['file']; } else { $icon = ''; } $notify = ''; $notification = $subsrcinfo_threads[$res['threadid']]['notification']; if ($notification == 'none') { $notify = $apx->lang->get('SUBSCRIPTION_NONE'); } elseif ($notification == 'instant') { $notify = $apx->lang->get('SUBSCRIPTION_INSTANT'); } elseif ($notification == 'daily') { $notify = $apx->lang->get('SUBSCRIPTION_DAILY'); } elseif ($notification == 'weekly') {
function forum_threads_print($data, $template, $dateheadfield) { global $set; $tmpl = new tengine(); //Ausgabe if (count($data)) { foreach ($data as $res) { ++$i; //Verschoben if ($res['moved']) { $res['threadid'] = $res['moved']; } //Link $forumdir = $set['forum']['directory'] . '/'; $link = mkrellink(HTTPDIR . $forumdir . 'thread.php?id=' . $res['threadid'], HTTPDIR . $forumdir . 'thread,' . $res['threadid'] . ',1' . urlformat($res['title']) . '.html'); $tabledata[$i]['ID'] = $res['threadid']; $tabledata[$i]['PREFIX'] = forum_get_prefix($res['prefix']); $tabledata[$i]['TITLE'] = replace($res['title']); $tabledata[$i]['LINK'] = $link; $tabledata[$i]['OPENER_USERID'] = $res['opener_userid']; $tabledata[$i]['OPENER_USERNAME'] = replace($res['opener']); $tabledata[$i]['OPENTIME'] = $res['opentime']; $tabledata[$i]['LASTPOST_USERID'] = $res['lastposter_userid']; $tabledata[$i]['LASTPOST_USERNAME'] = replace($res['lastposter']); $tabledata[$i]['LASTPOST_TIME'] = $res['lastposttime']; $tabledata[$i]['POSTS'] = number_format($res['posts'], 0, '', '.'); $tabledata[$i]['VIEWS'] = number_format($res['views'], 0, '', '.'); //Datehead if ($laststamp != date('Y/m/d', $res[$dateheadfield] - TIMEDIFF)) { $tabledata[$i]['DATEHEAD'] = $res[$dateheadfield]; } $laststamp = date('Y/m/d', $res[$dateheadfield] - TIMEDIFF); } } $tmpl->assign('THREAD', $tabledata); $tmpl->parse('functions/' . $template, 'forum'); }
//Keine Treffer if (!count($result)) { message($apx->lang->get('MSG_EMPTYSEARCH'), 'javascript:history.back();'); } else { list($usec, $sec) = explode(' ', microtime()); $b2 = (double) $usec + (double) $sec; list($usec, $sec) = explode(' ', $searchstart); $b1 = (double) $usec + (double) $sec; $searchtime = round($b2 - $b1, 5); $highlightme = ''; $resultstring = dash_serialize($result); $hash = md5(uniqid(time())); $ign = serialize(array()); $db->query("INSERT INTO " . PRE . "_forum_search (userid,result,display,highlight,ignored,order_field,order_dir,time,hash) VALUES ('" . $user->info['userid'] . "','" . addslashes($resultstring) . "','" . addslashes($display) . "','" . addslashes($highlightme) . "','" . addslashes($ign) . "','" . addslashes($_POST['sortby']) . "','" . addslashes($_POST['sortby_dir']) . "','" . $searchtime . "','" . addslashes($hash) . "')"); $searchid = $db->insert_id(); $link = mkrellink('search.php?search=' . $searchid . '&hash=' . $hash, 'search.php?search=' . $searchid . '&hash=' . $hash); header("HTTP/1.1 301 Moved Permanently"); header('location: ' . $link); exit; } require 'lib/_end.php'; require '../lib/_end.php'; } //////////////////////////////////////////////////////////////////////////////////////// SUCHE AUSFÜHREN $apx->lang->drop('search'); if ($_REQUEST['send']) { //Direkte Forensuche if ($_POST['keywords_req'] && !$_POST['keywords_one'] && !$_POST['keywords_not']) { $_POST['searchtitle'] = 1; $_POST['searchtext'] = 1; }