Example #1
0
function gallery_gallery($id)
{
    global $db;
    $gallery = $db->fetch_assoc('SELECT katename, b.access, name, images, cID, folder, userID, datum, username FROM ' . DB_PRE . 'ecp_gallery as a LEFT JOIN ' . DB_PRE . 'ecp_user ON ID=userID LEFT JOIN ' . DB_PRE . 'ecp_gallery_kate as b ON (cID = kateID) WHERE (a.access = "" OR ' . str_replace('access', 'a.access', $_SESSION['access_search']) . ') AND galleryID = ' . $id);
    if (isset($gallery['name']) and find_access($gallery['access'])) {
        $limits = get_sql_limit($gallery['images'], LIMIT_GALLERY_PICS);
        $pics = array();
        $result = $db->query('SELECT imageID, filename, klicks, COUNT(comID) as comments FROM ' . DB_PRE . 'ecp_gallery_images as A LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID=imageID AND bereich="gallery") WHERE gID = ' . $id . ' GROUP BY imageID ORDER BY imageID ASC LIMIT ' . $limits[1] . ',' . LIMIT_GALLERY_PICS);
        while ($row = mysql_fetch_assoc($result)) {
            $row['klicks'] = format_nr($row['klicks'], 0);
            $pics[] = $row;
        }
        $tpl = new smarty();
        if ($limits[0] > 1) {
            $tpl->assign('seiten', makepagelink_ajax('?section=gallery&action=gallery&id=' . $id, 'return load_gallery_page(' . $id . ', {nr});', @$_GET['page'], $limits[0]));
        }
        $tpl->assign('pics', $pics);
        $tpl->assign('datum', date(LONG_DATE, $gallery['datum']));
        $tpl->assign('username', $gallery['username']);
        $tpl->assign('userID', $gallery['userID']);
        $tpl->assign('pfad', '<a href="?section=gallery">' . GALLERY . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> <a href="?section=gallery&action=kate&id=' . $gallery['cID'] . '">' . $gallery['katename'] . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> <a href="?section=gallery&action=gallery&id=' . $id . '">' . $gallery['name'] . '</a>');
        $tpl->assign('folder', $gallery['folder']);
        ob_start();
        $tpl->display(DESIGN . '/tpl/gallery/pictures.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(GALLERY, $content, '', 1);
    } else {
        table(ERROR, NO_ENTRIES_ID);
    }
}
Example #2
0
function shoutbox()
{
    global $db, $countries;
    $tpl = new smarty();
    $anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich="shoutbox"');
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_SHOUTBOX);
        $shouts = array();
        $db->query('SELECT comID, country, username, userID, author, datum, beitrag FROM ' . DB_PRE . 'ecp_comments LEFT JOIN ' . DB_PRE . 'ecp_user ON userID = ID WHERE bereich="shoutbox" ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_SHOUTBOX);
        $anzahl -= $limits[1];
        while ($row = $db->fetch_assoc()) {
            $row['nr'] = format_nr($anzahl--, 0);
            $row['countryname'] = @$countries[$row['country']];
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $shouts[] = $row;
        }
        $tpl->assign('shoutbox', $shouts);
        if ($limits[0] > 1) {
            $tpl->assign('seiten', makepagelink_ajax('?section=shoutbox', 'return load_shout_page({nr});', @$_GET['page'], $limits[0]));
        }
        ob_start();
        $tpl->display(DESIGN . '/tpl/shoutbox/shoutbox.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(SHOUTBOX, '<div id="shout_overview">' . $content . '</div>', '', 1);
    } else {
        table(INFO, NO_ENTRIES);
    }
}
Example #3
0
function news_archiv($topicID = 0)
{
    global $db;
    $topics = array();
    $db->query('SELECT tID, topicname FROM ' . DB_PRE . 'ecp_topics ORDER BY topicname ASC');
    while ($row = $db->fetch_assoc()) {
        $topics[] = $row;
    }
    if ($topicID) {
        $anzahl = $db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '(lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND topicID = ' . $topicID . ' AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ')');
        $seiten = get_sql_limit($anzahl, 30);
        $sql = 'SELECT `newsID`, `' . DB_PRE . 'ecp_news`.`userID`, `topicID`, `' . DB_PRE . 'ecp_news`.`datum`, `headline`, `bodytext`, `extendtext`, `links`, `hits`,
							  `username`, `topicname`, `topicbild`, `beschreibung`, COUNT(comID) AS comments 
						FROM ' . DB_PRE . 'ecp_news 
						LEFT JOIN ' . DB_PRE . 'ecp_user ON (' . DB_PRE . 'ecp_news.userID = ID)  
						LEFT JOIN ' . DB_PRE . 'ecp_topics ON (topicID = tID) 
						LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = newsID AND bereich = "news")
						WHERE (lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND topicID = ' . $topicID . ' AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') GROUP BY newsID ORDER BY sticky DESC, datum DESC';
    } else {
        $anzahl = $db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', '(lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ')');
        $seiten = get_sql_limit($anzahl, 30);
        $sql = 'SELECT `newsID`, `' . DB_PRE . 'ecp_news`.`userID`, `topicID`, `' . DB_PRE . 'ecp_news`.`datum`, `headline`, `bodytext`, `extendtext`, `links`, `hits`,
							  `username`, `topicname`, `topicbild`, `beschreibung`, COUNT(comID) AS comments 
						FROM ' . DB_PRE . 'ecp_news 
						LEFT JOIN ' . DB_PRE . 'ecp_user ON (' . DB_PRE . 'ecp_news.userID = ID)  
						LEFT JOIN ' . DB_PRE . 'ecp_topics ON (topicID = tID) 
						LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = newsID AND bereich = "news")
						WHERE (lang = "" OR lang LIKE ",%' . LANGUAGE . '%,") AND ' . DB_PRE . 'ecp_news.datum < ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') GROUP BY newsID ORDER BY sticky DESC, datum DESC';
    }
    if ($anzahl) {
        if (!isset($_GET['page'])) {
            $_GET['page'] = 1;
        }
        $db->query($sql . ' LIMIT ' . $seiten[1] . ', 30');
        $news = array();
        while ($row = $db->fetch_assoc()) {
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $row['comments'] = format_nr($row['comments']);
            $row['hits'] = format_nr($row['hits']);
            $news[] = $row;
        }
        $tpl = new smarty();
        $tpl->assign('topics', $topics);
        $tpl->assign('news', $news);
        ob_start();
        $tpl->display(DESIGN . '/tpl/news/news_archiv.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(NEWS_ARCHIV, $content, '', 1);
        if ($seiten[0] > 1) {
            table(PAGES, '<div style="text-align:center">' . NEWS . ': ' . $anzahl . ' | ' . PAGES . ': ' . makepagelink('?section=news&action=archiv&tid=' . $topicID, $_GET['page'], $seiten[0]) . '</div>');
        }
    } else {
        table(INFO, NO_ENTRIES);
    }
}
Example #4
0
function admin_clanwars()
{
    global $db;
    $tpl = new smarty();
    $anzahl = $db->result(DB_PRE . 'ecp_wars', 'COUNT(warID)', 'status = 1');
    $limit = get_sql_limit($anzahl, ADMIN_ENTRIES);
    if ($limit[0] > 1) {
        $tpl->assign('seiten', makepagelink_ajax('#', 'return load_cws({nr});', @$_GET['page'], $limit[0]));
    }
    $tpl->assign('anzahl', $anzahl);
    $db->query('SELECT `warID` , ' . DB_PRE . 'ecp_wars.`tID` , `gID` , `datum` , `xonx` , `oID` , oppname, tname, gamename, icon
				FROM `' . DB_PRE . 'ecp_wars` 
				LEFT JOIN `' . DB_PRE . 'ecp_wars_games` ON ( gameID = gID ) 
				LEFT JOIN `' . DB_PRE . 'ecp_teams` ON ( ' . DB_PRE . 'ecp_teams.tID = ' . DB_PRE . 'ecp_wars.tID ) 
				LEFT JOIN `' . DB_PRE . 'ecp_wars_opp` ON ( oppID = oID ) 
				WHERE status = 1
				GROUP BY warID
				ORDER BY datum DESC 
				LIMIT ' . $limit[1] . ' ,' . ADMIN_ENTRIES);
    $wars = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(SHORT_DATE, $row['datum']);
        $wars[] = $row;
    }
    $tpl->assign('clanwars', $wars);
    $nextwars = array();
    $db->query('SELECT `warID` , ' . DB_PRE . 'ecp_wars.`tID` , `gID` , `datum` , `xonx` , `oID` , oppname, tname, gamename, icon
				FROM `' . DB_PRE . 'ecp_wars` 
				LEFT JOIN `' . DB_PRE . 'ecp_wars_games` ON ( gameID = gID ) 
				LEFT JOIN `' . DB_PRE . 'ecp_teams` ON ( ' . DB_PRE . 'ecp_teams.tID = ' . DB_PRE . 'ecp_wars.tID ) 
				LEFT JOIN `' . DB_PRE . 'ecp_wars_opp` ON ( oppID = oID ) 
				WHERE status = 0
				GROUP BY warID
				ORDER BY datum DESC 
				LIMIT ' . $limit[1] . ' ,' . ADMIN_ENTRIES);
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(SHORT_DATE, $row['datum']);
        $nextwars[] = $row;
    }
    $tpl->assign('nextwars', $nextwars);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/clanwars.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(CLANWARS, $content, '', 1);
}
Example #5
0
function admin_survey()
{
    global $db, $groups;
    $anzahl = $db->result(DB_PRE . 'ecp_survey', 'COUNT(surveyID)', '1');
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_SURVEY);
        $db->query('SELECT `surveyID`, `start`, `ende`, `frage` FROM `' . DB_PRE . 'ecp_survey` ORDER BY ende DESC LIMIT ' . $limits[1] . ', ' . LIMIT_SURVEY);
        $umfrage = array();
        while ($row = $db->fetch_assoc()) {
            if ($row['start'] > time()) {
                $row['status'] = PLANNED;
                $row['closed'] = 1;
            } elseif ($row['ende'] < time()) {
                $row['status'] = CLOSED;
                $row['closed'] = 1;
            } else {
                $row['status'] = RUN;
            }
            $row['start'] = date(LONG_DATE, $row['start']);
            $row['ende'] = date(LONG_DATE, $row['ende']);
            $umfrage[] = $row;
        }
    }
    $tpl = new smarty();
    $db->query('SELECT groupID, name FROM ' . DB_PRE . 'ecp_groups ORDER by name ASC');
    $rights = '<option value="all" selected="selected">' . ALL . '</option>';
    while ($row = $db->fetch_assoc()) {
        if (isset($groups[$row['name']])) {
            $row['name'] = $groups[$row['name']];
        }
        $rights .= '<option value="' . $row['groupID'] . '">' . $row['name'] . '</option>';
    }
    $tpl->assign('rights', $rights);
    $tpl->assign('anzahl', $anzahl);
    $tpl->assign('umfrage', @$umfrage);
    $tpl->assign('pages', @$limits[0]);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/survey.html');
    $tpl->display(DESIGN . '/tpl/admin/survey_overview.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(SURVEY, $content, '', 1);
}
Example #6
0
function clankasse()
{
    global $db;
    $tpl = new smarty();
    $konto = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_clankasse');
    $konto['kontostand'] = number_format($konto['kontostand'], 2, ',', '');
    foreach ($konto as $key => $value) {
        $tpl->assign($key, $value);
    }
    ob_start();
    $anzahl = $db->result(DB_PRE . 'ecp_clankasse_transaktion', 'COUNT(ID)', '1');
    $limits = get_sql_limit($anzahl, LIMIT_CLANKASSE_TRANS);
    $db->query('SELECT a.*, b.username, c.username as buchusername FROM ' . DB_PRE . 'ecp_clankasse_transaktion as a LEFT JOIN ' . DB_PRE . 'ecp_user as b ON b.ID = vonuser LEFT JOIN ' . DB_PRE . 'ecp_user as c ON c.ID = userID ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_CLANKASSE_TRANS);
    $buchung = array();
    while ($row = $db->fetch_assoc()) {
        $row['datum'] = date(LONG_DATE, $row['datum']);
        if ($row['vonuser']) {
            $row['verwendung'] .= ' ' . FROM . ' ' . $row['username'];
        }
        $row['geld'] = number_format($row['geld'], 2, ',', '.');
        $buchung[] = $row;
    }
    if ($limits[0] > 1) {
        $tpl->assign('seiten', makepagelink_ajax('?section=clankasse', 'return load_clankasse_page({nr});', @$_GET['page'], $limits[0]));
    }
    $tpl->assign('buchung', $buchung);
    $tpl->display(DESIGN . '/tpl/clankasse/kontodaten.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(FINANCES, $content, '', 1);
    if (date('m') > 3) {
        clankasse_buchungen(date('m') - 2, date('Y'));
    } elseif (date('m') == 2) {
        clankasse_buchungen(12, date('Y') - 1);
    } elseif (date('m') == 1) {
        clankasse_buchungen(11, date('Y') - 1);
    } else {
        clankasse_buchungen(1, date('Y'));
    }
}
Example #7
0
function get_maps()
{
    global $db;
    $anzahl = $db->result(DB_PRE . 'ecp_wars_locations', 'COUNT(locationID)', '1');
    $limit = get_sql_limit($anzahl, 20);
    $db->query('SELECT locationname, locationID, gamename, icon FROM ' . DB_PRE . 'ecp_wars_locations LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gID = gameID ORDER BY gamename, locationname LIMIT ' . $limit[1] . ', 20');
    $maps = array();
    while ($row = $db->fetch_assoc()) {
        $maps[] = $row;
    }
    $tpl = new smarty();
    $tpl->assign('anzahl', $anzahl);
    $tpl->assign('maps', $maps);
    if ($limit[0] > 1) {
        $tpl->assign('seiten', makepagelink_ajax('#', 'return load_content(\'maps\', \'ajax_checks.php?func=admin&site=get_maps&page={nr}\');', @$_GET['page'], $limit[0]));
    }
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/games_maps.html');
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
Example #8
0
function guestbook()
{
    global $db, $countries;
    $anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich = \'guestbook\'');
    if ($anzahl) {
        $seiten = get_sql_limit($anzahl, LIMIT_GUESTBOOK);
        $db->query('SELECT
	                    a.author, a.homepage, a.email, a.comID, a.beitrag, a.datum, COUNT(b.comID) as comments
	                 FROM
	                     ' . DB_PRE . 'ecp_comments as a
	                 LEFT JOIN ' . DB_PRE . 'ecp_comments as b ON (b.subID = a.comID AND b.bereich = "gb_com")
	                 WHERE
	                    a.bereich = "guestbook"
	                 GROUP BY a.comID
	                 ORDER BY
	                     a.datum DESC
	                 LIMIT ' . $seiten[1] . ',' . LIMIT_GUESTBOOK);
        $comments = array();
        while ($row = $db->fetch_assoc()) {
            $row['nr'] = $anzahl--;
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $comments[] = $row;
        }
        $tpl = new smarty();
        if ($seiten[0] > 1) {
            $tpl->assign('seiten', makepagelink_ajax('?section=guestbook', '', @$_GET['page'], $seiten[0]));
        }
        $tpl->assign('comments', $comments);
        ob_start();
        $tpl->display(DESIGN . '/tpl/guestbook/guestbook.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(GUESTBOOK, $content, '', 1);
    } else {
        table(GUESTBOOK, NO_ENTRIES . '<br /> <a href="?section=guestbook&action=add">' . GUESTBOOK_ADD . '</a>');
    }
}
Example #9
0
function admin_news()
{
    global $db;
    $tpl = new smarty();
    if (@$_GET['func'] == 'pin') {
        ob_end_clean();
        if ($db->result(DB_PRE . 'ecp_news', 'sticky', 'newsID = ' . (int) $_GET['id']) == 0) {
            $db->query('UPDATE ' . DB_PRE . 'ecp_news SET sticky = 1 WHERE newsID = ' . (int) $_GET['id']);
        } else {
            $db->query('UPDATE ' . DB_PRE . 'ecp_news SET sticky = 0 WHERE newsID = ' . (int) $_GET['id']);
        }
        $tpl->assign('ajax', 1);
    }
    $anzahl = $db->result(DB_PRE . 'ecp_news', 'COUNT(newsID)', 'datum > 0', 0);
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, ADMIN_ENTRIES);
        $news = array();
        $db->query('SELECT `newsID`, `topicID`, `datum`, `headline`, `topicname`, sticky FROM `' . DB_PRE . 'ecp_news` LEFT JOIN `' . DB_PRE . 'ecp_topics` ON (`topicID` = `tID`) ORDER BY sticky DESC, `datum` DESC LIMIT ' . $limits[1] . ', ' . ADMIN_ENTRIES);
        while ($row = $db->fetch_assoc()) {
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $news[] = $row;
        }
    }
    $tpl->assign('seiten', makepagelink('?section=admin&site=news', isset($_GET['page']) ? $_GET['page'] : 1, $limits[0]));
    $tpl->assign('news', @$news);
    ob_start();
    $tpl->display(DESIGN . '/tpl/admin/news.html');
    $content = ob_get_contents();
    ob_end_clean();
    if (@$_GET['func'] == 'pin') {
        echo html_ajax_convert($content);
        die;
    } else {
        main_content(ADMIN_NEWS, $content, '', 1);
    }
}
Example #10
0
function comments_get($bereich, $id, $conditions, $ajax = 0, $border = 1, $session = '')
{
    global $db, $countries;
    $id = (int) $id;
    $bereich = strsave($bereich);
    if (@$_SESSION['rights']['public'][$session ? $session : $bereich]['com_view'] or @$_SESSION['rights']['superadmin']) {
        $anzahl = $db->result(DB_PRE . 'ecp_comments', 'COUNT(comID)', 'bereich = \'' . $bereich . '\' AND subID = ' . $id);
        if ($anzahl) {
            $seiten = get_sql_limit($anzahl, $conditions['LIMIT']);
            $db->query('SELECT
		                     a.username, a.registerdate, a.rID, rankname, iconname, author, c.homepage, c.email, comID, c.userID, a.country, a.sex, beitrag, datum, editdatum, editby, edits, lastklick, a.avatar, a.signatur, comments, b.username as editfrom, uID as online
		                 FROM
		                     ' . DB_PRE . 'ecp_comments as c
						LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (c.userID = a.ID)
						LEFT JOIN ' . DB_PRE . 'ecp_user as b ON (c.editby = b.ID)
						LEFT JOIN ' . DB_PRE . 'ecp_user_stats ON (c.userID = ' . DB_PRE . 'ecp_user_stats.userID)
						LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (a.rID = rankID)
						LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = c.userID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ')
		                 WHERE
		                     subID = ' . $id . ' AND bereich = "' . $bereich . '"
		                 GROUP BY comID
		                 ORDER BY
		                     datum ' . $conditions['ORDER'] . '
		                 LIMIT ' . $seiten[1] . ',' . $conditions['LIMIT']);
            $comments = array();
            while ($row = $db->fetch_assoc()) {
                $row['nr'] = ++$seiten[1];
                $row['comments'] = format_nr($row['comments']);
                $row['countryname'] = @$countries[$row['country']];
                $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE);
                if ($row['edits']) {
                    $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['editby'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT);
                }
                $row['datum'] = date(LONG_DATE, $row['datum']);
                $row['quote'] = $row['beitrag'];
                $row['beitrag'] = bb_code($row['beitrag']);
                $comments[] = $row;
            }
            $tpl = new smarty();
            $tpl->assign('id', $id);
            $tpl->assign('link', $conditions['link']);
            $tpl->assign('section', $conditions['section']);
            if ($seiten[0] > 1) {
                $tpl->assign('seiten', makepagelink_ajax($conditions['link'], 'return load_com_page(\'' . $bereich . '\', ' . $id . ', {nr});', @$_GET['page'], $seiten[0]));
            }
            $tpl->assign('comments', $comments);
            $tpl->assign('bereich', $bereich);
            $tpl->assign('bereich2', $session ? $session : $bereich);
            $tpl->assign('ajax', $ajax);
            if ($ajax) {
                ob_start();
                $tpl->display(DESIGN . '/tpl/comments.html');
                $db->close();
                $content = ob_get_contents();
                ob_end_clean();
                echo html_ajax_convert($content);
                die;
            }
            if ($border) {
                ob_start();
                $tpl->display(DESIGN . '/tpl/comments.html');
                $content = ob_get_contents();
                ob_end_clean();
                main_content(COMMENTS, $content, '', 1);
            } else {
                $tpl->display(DESIGN . '/tpl/comments.html');
            }
        } else {
            if (!$ajax) {
                table(COMMENTS, '<div id="comments_bereich">' . NO_ENTRIES . '</div>');
            } else {
                echo html_ajax_convert(NO_ENTRIES);
            }
        }
        if ((@$_SESSION['rights']['public'][$session ? $session : $bereich]['com_add'] or @$_SESSION['rights']['superadmin']) and !$ajax) {
            $tplc = new smarty();
            $tplc->assign('section', $conditions['section'] ? $conditions['section'] : $bereich);
            $tplc->assign('action', $conditions['action']);
            $tplc->assign('id', $id);
            if ($border) {
                ob_start();
                $tplc->display(DESIGN . '/tpl/comment_add_edit.html');
                $content = ob_get_contents();
                ob_end_clean();
                main_content(ADD_COMMENT, $content, '', 1);
            } else {
                $tplc->display(DESIGN . '/tpl/comment_add_edit.html');
            }
        } elseif (!$ajax) {
            table(ACCESS_DENIED, NO_RIGHTS_ADD_COMMENT);
        }
    } else {
        table(ACCESS_DENIED, NO_RIGHTS_READ_COMMENT);
    }
}
Example #11
0
function survey_view($id)
{
    global $db;
    $anzahl = $db->result(DB_PRE . 'ecp_survey', 'COUNT(surveyID)', 'start <= ' . time() . ' AND (access = "" OR ' . $_SESSION['access_search'] . ') AND surveyID = ' . $id);
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_SURVEY);
        $result = $db->query('SELECT `surveyID`, `start`, `ende`, `frage`, sperre, antworten as maxvotes, COUNT(comID) as comments FROM `' . DB_PRE . 'ecp_survey` LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = surveyID AND bereich="survey") WHERE surveyID = ' . $id . ' GROUP BY surveyID ORDER BY ende DESC LIMIT ' . $limits[1] . ', ' . LIMIT_SURVEY);
        $umfrage = array();
        while ($row = mysql_fetch_assoc($result)) {
            $antworten = array();
            if (isset($_COOKIE['surveys'][$row['surveyID']]) and $_COOKIE['surveys'][$row['surveyID']]) {
                if ($_COOKIE['surveys'][$row['surveyID']] + $row['sperre'] > time()) {
                    $row['abstimmen'] = false;
                } else {
                    $row['abstimmen'] = true;
                }
            } elseif (isset($_SESSION['userID'])) {
                $zeit = @$db->result(DB_PRE . 'ecp_survey_votes', 'votedatum', 'userID = ' . $_SESSION['userID'] . ' AND surID = ' . $row['surveyID'] . ' ORDER BY votedatum DESC');
                if ((int) $zeit + $row['sperre'] > time()) {
                    $row['abstimmen'] = false;
                } else {
                    $row['abstimmen'] = true;
                }
            } else {
                $zeit = $db->result(DB_PRE . 'ecp_survey_votes', 'votedatum', 'IP = \'' . $_SERVER['REMOTE_ADDR'] . '\' ORDER BY votedatum DESC');
                if ((int) $zeit + $row['sperre'] > time()) {
                    $row['abstimmen'] = false;
                } else {
                    $row['abstimmen'] = true;
                }
            }
            $db->query('SELECT `answerID`, `answer`, `votes` FROM `' . DB_PRE . 'ecp_survey_answers` WHERE sID = ' . $row['surveyID'] . ' ORDER BY answerID ASC');
            $gesamt = 0;
            while ($sub = $db->fetch_assoc()) {
                $gesamt += $sub['votes'];
                $antworten[] = $sub;
            }
            foreach ($antworten as $key => $value) {
                if ($gesamt) {
                    $antworten[$key]['prozent'] = round($value['votes'] / $gesamt * 100, 1);
                } else {
                    $antworten[$key]['prozent'] = 0;
                }
                $antworten[$key]['votes'] = number_format($value['votes'], 0, '', '.');
            }
            $row['gesamt'] = number_format($gesamt, 0, '', '.');
            $row['antworten'] = $antworten;
            if ($row['start'] > time() or $row['ende'] < time()) {
                $row['abstimmen'] = false;
            }
            $row['start'] = date(LONG_DATE, $row['start']);
            $row['ende'] = date(LONG_DATE, $row['ende']);
            $umfrage[] = $row;
        }
        $tpl = new Smarty();
        $tpl->assign('survey', $umfrage);
        ob_start();
        $tpl->display(DESIGN . '/tpl/survey/overview.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(SURVEY, $content, '', 1);
    } else {
        table(INFO, NO_ENTRIES_ID);
    }
}
Example #12
0
function admin_gallery_view($id)
{
    global $db;
    $gallery = $db->fetch_assoc('SELECT name, folder, images FROM ' . DB_PRE . 'ecp_gallery WHERE galleryID = ' . $id);
    if (isset($gallery['name'])) {
        if ($gallery['images']) {
            $limits = get_sql_limit($gallery['images'], LIMIT_GALLERY_PICS);
            $db->query('SELECT * FROM ' . DB_PRE . 'ecp_gallery_images WHERE gID = ' . $id . ' ORDER BY imageID ASC LIMIT ' . $limits[1] . ',' . LIMIT_GALLERY_PICS);
            $pics = array();
            while ($row = $db->fetch_assoc()) {
                $row['uploaded'] = date(SHORT_DATE, $row['uploaded']);
                $pics[] = $row;
            }
            $tpl = new smarty();
            $tpl->assign('pics', $pics);
            $tpl->assign('seiten', makepagelink('?section=admin&site=gallery&func=viewgallery&id=' . $id, isset($_GET['page']) ? $_GET['page'] : 1, $limits[0]));
            $tpl->assign('folder', $gallery['folder']);
            ob_start();
            $tpl->display(DESIGN . '/tpl/admin/gallery_view_overview.html');
            $content = ob_get_contents();
            ob_end_clean();
        }
        $tpl = new smarty();
        $tpl->assign('sid', session_name() . '=' . session_id());
        $tpl->assign('pics', @$content);
        ob_start();
        $tpl->display(DESIGN . '/tpl/admin/gallery_view' . (UPLOAD_METHOD == 'old' ? '_old' : '') . '.html');
        $content = ob_get_contents();
        ob_end_clean();
        main_content(GALLERY, $content, '', 1);
    } else {
        table(ERROR, NO_ENTRIES_ID);
    }
}
Example #13
0
function clanwars()
{
    global $db, $countries;
    ob_start();
    $tpl = new smarty();
    $tpl->assign('win', 0);
    $tpl->assign('draw', 0);
    $tpl->assign('loss', 0);
    $tpl->assign('games', get_games_form((int) @$_GET['gameID']));
    $tpl->assign('teams', get_teams_form((int) @$_GET['teamID']));
    $tpl->assign('matchtypes', get_matchtype_form((int) @$_GET['matchtypeID']));
    $tpl->assign('xonx', get_xonx_form(@$_GET['xonx']));
    if (@$_GET['gameID']) {
        $where = ' AND gID = ' . (int) $_GET['gameID'];
    } else {
        $_GET['gameID'] = 0;
    }
    if (@$_GET['teamID']) {
        @($where .= ' AND ' . DB_PRE . 'ecp_wars.tID = ' . (int) $_GET['teamID']);
    } else {
        $_GET['teamID'] = 0;
    }
    if (@$_GET['matchtypeID']) {
        @($where .= ' AND mID = ' . (int) $_GET['matchtypeID']);
    } else {
        $_GET['matchtypeID'] = 0;
    }
    if (@$_GET['xonx']) {
        @($where .= ' AND xonx = \'' . strsave($_GET['xonx']) . '\'');
    }
    switch (@$_GET['sortby']) {
        case 'opp':
            $orderby = ' oppname ';
            break;
        case 'matchtype':
            $orderby = ' matchtypename ';
            break;
        case 'team':
            $orderby = ' tname ';
            break;
        default:
            $orderby = DB_PRE . 'ecp_wars.datum ';
    }
    switch (@$_GET['art']) {
        case 'asc':
            $orderby .= 'ASC ';
            break;
        default:
            $orderby .= 'DESC ';
    }
    $db->query('SELECT COUNT(result) as val, result FROM ' . DB_PRE . 'ecp_wars WHERE status = 1 ' . @$where . ' GROUP BY result');
    while ($row = $db->fetch_assoc()) {
        $tpl->assign($row['result'], $row['val']);
        @($gesamt += $row['val']);
    }
    $tpl->assign('anzahl', (int) @$gesamt);
    if ((int) @$gesamt) {
        ob_start();
        $limit = get_sql_limit($gesamt, LIMIT_CLANWARS);
        $db->query('SELECT `warID`, ' . DB_PRE . 'ecp_wars.datum, `result`, `resultscore`, `tname`, `oppname`, `country`, ' . DB_PRE . 'ecp_wars_opp.homepage, `icon`, `gamename`, `matchtypename`, COUNT(comID) as comments 
					FROM ' . DB_PRE . 'ecp_wars 
					LEFT JOIN ' . DB_PRE . 'ecp_teams ON ' . DB_PRE . 'ecp_teams.tID = ' . DB_PRE . 'ecp_wars.tID 
					LEFT JOIN ' . DB_PRE . 'ecp_wars_games ON gID = gameID 
					LEFT JOIN ' . DB_PRE . 'ecp_wars_opp ON oID = oppID 
					LEFT JOIN ' . DB_PRE . 'ecp_wars_matchtype ON mID = matchtypeID 
					LEFT JOIN ' . DB_PRE . 'ecp_comments ON (subID = warID AND bereich = "clanwars") 
					WHERE status = 1 ' . @$where . ' 
					GROUP BY warID
					ORDER BY ' . $orderby . '
					LIMIT ' . $limit[1] . ',' . LIMIT_CLANWARS);
        $clanwars = array();
        while ($row = $db->fetch_assoc()) {
            $row['datum'] = date('d.m.y', $row['datum']);
            $row['countryname'] = $countries[$row['country']];
            $clanwars[] = $row;
        }
        $tplcw = new smarty();
        if ($limit[0] > 1) {
            $tplcw->assign('seiten', makepagelink_ajax('?section=clanwars&gameID=' . $_GET['gameID'] . '&teamID=' . $_GET['teamID'] . '&matchtypeID=' . $_GET['matchtypeID'] . '&xonx=' . $_GET['xonx'] . '&sortby=' . $_GET['sortby'] . '&art=' . $_GET['art'] . '', 'return load_wars(' . $_GET['gameID'] . ', ' . $_GET['teamID'] . ', ' . $_GET['matchtypeID'] . ', \'' . $_GET['xonx'] . '\', \'' . $_GET['sortby'] . '\', \'' . $_GET['art'] . '\', {nr});', @$_GET['page'], $limit[0]));
        }
        $tplcw->assign('clanwars', $clanwars);
        $tplcw->display(DESIGN . '/tpl/clanwars/overview.html');
        $content = ob_get_contents();
        ob_end_clean();
        $tpl->assign('clanwars', @$content);
    }
    $tpl->display(DESIGN . '/tpl/clanwars/head.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(CLANWARS, $content, '', 1);
}
Example #14
0
function user_liste()
{
    global $db, $countries;
    $tpl = new smarty();
    $anzahl = $db->result(DB_PRE . 'ecp_user', 'COUNT(ID)', '1');
    $limits = get_sql_limit($anzahl, LIMIT_MEMBERS);
    $erlaubt = array('username', 'registerdate', 'lastlogin', 'geburtstag', 'online', 'sex', 'rangname');
    if (isset($_GET['orderby'])) {
        if (!in_array($_GET['orderby'], $erlaubt)) {
            $_GET['orderby'] = 'username';
        }
        $_GET['order'] == 'DESC' ? '' : ($_GET['order'] = 'ASC');
        if ($_GET['orderby'] == 'geburtstag') {
            $_GET['order'] == 'DESC' ? $_GET['order'] = 'ASC' : ($_GET['order'] = 'DESC');
        }
        if ($_GET['orderby'] == 'rangname') {
            $_GET['order'] == 'ASC' ? $_GET['orderby'] = 'fest ASC, abposts ASC' : ($_GET['orderby'] = 'fest DESC, abposts DESC');
            $_GET['order'] = '';
        }
    } else {
        $_GET['orderby'] = 'username';
        $_GET['order'] = 'ASC';
    }
    $db->query('SELECT geburtstag, xfire, icq, sex, registerdate, clanname, homepage, lastlogin, wohnort, user_pic, `ID`, username, country, uID as online, rankname, iconname FROM ' . DB_PRE . 'ecp_user LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (rID = rankID) LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = ID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') GROUP BY ID ORDER BY ' . strsave($_GET['orderby']) . ' ' . strsave($_GET['order']) . ' LIMIT ' . $limits[1] . ',' . LIMIT_MEMBERS);
    $user = array();
    while ($row = $db->fetch_assoc()) {
        $row['lastlogin'] ? $row['lastlogin'] = date(LONG_DATE, $row['lastlogin']) : ($row['lastlogin'] = NEVER_LOGGED_IN);
        $row['registerdate2'] = date('d.m.Y', $row['registerdate']);
        $row['registerdate'] = date(LONG_DATE, $row['registerdate']);
        if ($row['geburtstag'] == '0000-00-00') {
            $row['geburtstag'] = '';
        }
        if ($row['geburtstag']) {
            $birthday = explode('-', $row['geburtstag']);
            $row['geburtstag'] = $birthday[2] . '.' . $birthday[1] . '.' . $birthday[0];
            $alter = alter($birthday[2], $birthday[1], $birthday[0]);
            if (date('m') == $birthday[1] and date('d') < $birthday[2]) {
                $alter -= 1;
            }
            $next = @mktime(0, 0, 0, $birthday[1], $birthday[2], $birthday[0] + $alter + 1) - time();
            $row['alter'] = $alter;
        }
        $row['countryname'] = $countries[$row['country']];
        $row['icqtrim'] = str_replace('-', '', $row['icq']);
        $user[] = $row;
    }
    $tpl->assign('anzahl', $anzahl);
    if ($limits[0] > 1) {
        $tpl->assign('seiten', makepagelink_ajax('?section=user&action=list&orderby=' . $_GET['orderby'] . '&order=' . $_GET['order'], 'return load_user(\'orderby=' . $_GET['orderby'] . '&order=' . $_GET['order'] . '&page={nr}\');', @$_GET['page'], $limits[0]));
    }
    $tpl->assign('user', $user);
    ob_start();
    $tpl->display(DESIGN . '/tpl/user/user_list.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(USER_LIST, $content, '', 1);
}
Example #15
0
function account_msgbox()
{
    global $db;
    $tpl = new Smarty();
    $anzahl = $db->result(DB_PRE . 'ecp_messages', 'COUNT(msgID)', 'touser = '******'userID'] . ' AND del = 0');
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_MESSAGES);
        $db->query('SELECT `msgID`, `fromuser`, `title`, `datum`, `readed`, username, country FROM ' . DB_PRE . 'ecp_messages LEFT JOIN ' . DB_PRE . 'ecp_user ON (ID = fromuser) WHERE del = 0 AND touser = '******'userID'] . '  ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_MESSAGES);
        $msgin = array();
        while ($row = $db->fetch_assoc()) {
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $msgin[] = $row;
        }
        $tpl->assign('messages', $msgin);
        if ($limits[0] > 1) {
            $tpl->assign('seiten', makepagelink_ajax('#', 'return load_msges({nr}, \'in\');', @$_GET['page'], $limits[0]));
        }
    }
    $anzahl = $db->result(DB_PRE . 'ecp_messages', 'COUNT(msgID)', 'fromuser = '******'userID'] . ' AND fromdel = 0');
    if ($anzahl) {
        $limits = get_sql_limit($anzahl, LIMIT_MESSAGES);
        $db->query('SELECT `msgID`, `touser`, `title`, `datum`, `readed`, username, country FROM ' . DB_PRE . 'ecp_messages LEFT JOIN ' . DB_PRE . 'ecp_user ON (ID = touser) WHERE fromdel = 0 AND fromuser = '******'userID'] . '  ORDER BY datum DESC LIMIT ' . $limits[1] . ',' . LIMIT_MESSAGES);
        $msgout = array();
        while ($row = $db->fetch_assoc()) {
            $row['datum'] = date(LONG_DATE, $row['datum']);
            $msgout[] = $row;
        }
        $tpl->assign('messagesout', $msgout);
        if ($limits[0] > 1) {
            $tpl->assign('seitenout', makepagelink_ajax('#', 'return load_msges({nr}, \'out\');', @$_GET['page'], $limits[0]));
        }
    }
    ob_start();
    $tpl->display(DESIGN . '/tpl/account/messages.html');
    $content = ob_get_contents();
    ob_end_clean();
    main_content(MESSAGES, $content, '', 1);
}
Example #16
0
function get_sql_order_limit()
{
    $sort = getparam("sort") ? get_sql_field(getparam("sort")) : 1;
    $dir = getparam("dir") ? getparam("dir") : 'DESC';
    return get_filter() . " ORDER BY " . $sort . " " . $dir . get_sql_limit(getparam("start"), getparam("size"));
}
Example #17
0
     }
     break;
 case 'joinus_finish':
     if (@$_SESSION['rights']['admin']['joinus']['close'] or @$_SESSION['rights']['superadmin']) {
         if ($db->query('UPDATE ' . DB_PRE . 'ecp_joinus SET closedby = ' . $_SESSION['userID'] . ', closed = 1 WHERE joinID = ' . (int) $_GET['id'])) {
             echo html_ajax_convert('<a href="?section=user&id=' . $_SESSION['userID'] . '">' . $_SESSION['username'] . '</a>');
         }
     } else {
         echo html_ajax_convert(NO_ADMIN_RIGHTS);
     }
     break;
 case 'getsurveys':
     if (@$_SESSION['rights']['admin']['survey'] or @$_SESSION['rights']['superadmin']) {
         $anzahl = $db->result(DB_PRE . 'ecp_survey', 'COUNT(surveyID)', '1');
         if ($anzahl) {
             $limits = get_sql_limit($anzahl, LIMIT_SURVEY);
             $db->query('SELECT `surveyID`, `start`, `ende`, `frage` FROM `' . DB_PRE . 'ecp_survey` ORDER BY ende DESC LIMIT ' . $limits[1] . ', ' . LIMIT_SURVEY);
             $umfrage = array();
             while ($row = $db->fetch_assoc()) {
                 if ($row['start'] > time()) {
                     $row['status'] = PLANNED;
                     $row['closed'] = 1;
                 } elseif ($row['ende'] < time()) {
                     $row['status'] = CLOSED;
                     $row['closed'] = 1;
                 } else {
                     $row['status'] = RUN;
                 }
                 $row['start'] = date(LONG_DATE, $row['start']);
                 $row['ende'] = date(LONG_DATE, $row['ende']);
                 $umfrage[] = $row;
Example #18
0
 if (isset($_GET['goto'])) {
     $link = $db->result(DB_PRE . 'ecp_links', 'url', 'linkID= ' . (int) $_GET['goto']);
     if ($link) {
         if (!isset($_SESSION['links'][(int) $_GET['id']])) {
             $_SESSION['links'][(int) $_GET['id']] = true;
             $db->query('UPDATE ' . DB_PRE . 'ecp_links SET hits = hits + 1 WHERE linkID = ' . (int) $_GET['goto']);
         }
         header('Location: ' . $link);
     } else {
         table(ERROR, NO_ENTRIES_ID);
     }
 } else {
     $tpl = new smarty();
     $anzahl = $db->result(DB_PRE . 'ecp_links', 'COUNT(linkID)', '1');
     if ($anzahl) {
         $limits = get_sql_limit($anzahl, LIMIT_LINKS);
         $links = array();
         $db->query('SELECT * FROM ' . DB_PRE . 'ecp_links ORDER BY name ASC LIMIT ' . $limits[1] . ',' . LIMIT_LINKS);
         while ($row = $db->fetch_assoc()) {
             $row['hits'] = format_nr($row['hits'], 0);
             $links[] = $row;
         }
         $tpl->assign('links', $links);
         if ($limits[0] > 1) {
             $tpl->assign('seiten', makepagelink_ajax('?section=links', 'return load_links({nr});', @$_GET['page'], $limits[0]));
         }
         ob_start();
         $tpl->display(DESIGN . '/tpl/links/links.html');
         $content = ob_get_contents();
         ob_end_clean();
         main_content(LINKS, '<div id="weblinks">' . $content . '</div>', '', 1);
Example #19
0
function forum_search_results($id)
{
    global $db;
    if ($id) {
        $search = $db->fetch_assoc('SELECT * FROM ' . DB_PRE . 'ecp_forum_search WHERE (SID = \'' . session_id() . '\' OR userID = ' . (int) @$_SESSION['userID'] . ') AND searchID = ' . $id);
        if (isset($search['searchID'])) {
            if ($search['stichwort'] != '') {
                if ($search['viewas'] == 'comments') {
                    $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_FORUM_COMMENTS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS);
                    $comments = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['adatum'] = forum_make_date($row['adatum']);
                        $row['nr'] = ++$limits[1];
                        $row['countryname'] = @$countries[$row['country']];
                        $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE);
                        if ($row['edits']) {
                            $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['edituserID'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT);
                        }
                        if ($row['attachs']) {
                            $anhaenge = array();
                            $db->query('SELECT `attachID`, `name`, `size`, `downloads` FROM `' . DB_PRE . 'ecp_forum_attachments` WHERE `bID` = ' . $row['bID'] . ' AND `tID` = ' . $row['tID'] . ' AND `mID` = ' . $row['comID']);
                            while ($sub = $db->fetch_assoc()) {
                                $sub['size'] = goodsize($sub['size']);
                                $anhaenge[] = $sub;
                            }
                            $row['attchs'] = $anhaenge;
                        }
                        $comments[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('comments', $comments);
                    $tpl->assign('words', str_replace(array('AND', 'OR'), array('<strong>AND</strong>', '<strong>OR</strong>'), $search['stichwort']));
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_comments.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                } else {
                    if ($search['sortart'] == 'adatum') {
                        $search['sortart'] = 'lastreplay';
                    }
                    $db->query($search['sqlquery']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_THREADS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_THREADS);
                    $threads = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['lastreplay'] = forum_make_date($row['lastreplay']);
                        $row['datum'] = forum_make_date($row['datum']);
                        $row['bewertung'] = $row['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($row['ratingvotes']), format_nr($row['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS;
                        $row['bewertungbild'] = 'rating_' . str_replace('.', '_', get_forum_rating($row['rating']));
                        $threads[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('threads', $threads);
                    $tpl->assign('words', str_replace(array('AND', 'OR'), array('<strong>AND</strong>', '<strong>OR</strong>'), $search['stichwort']));
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_boards.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                }
            } else {
                if ($search['usersuchart'] == 1) {
                    if ($search['sortart'] == 'adatum') {
                        $search['sortart'] == 'datum';
                    }
                    $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_FORUM_COMMENTS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS);
                    $comments = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['adatum'] = forum_make_date($row['adatum']);
                        $row['nr'] = ++$limits[1];
                        $row['countryname'] = @$countries[$row['country']];
                        $row['sex'] == 'male' ? $row['sextext'] = MALE : ($row['sextext'] = FEMALE);
                        if ($row['edits']) {
                            $row['edit'] = str_replace(array('{anzahl}', '{von}', '{last}'), array($row['edits'], '<a href="?section=user&id=' . $row['edituserID'] . '">' . $row['editfrom'] . '</a>', date(LONG_DATE, $row['editdatum'])), COMMENT_EDIT_TXT);
                        }
                        if ($row['attachs']) {
                            $anhaenge = array();
                            $db->query('SELECT `attachID`, `name`, `size`, `downloads` FROM `' . DB_PRE . 'ecp_forum_attachments` WHERE `bID` = ' . $row['bID'] . ' AND `tID` = ' . $row['tID'] . ' AND `mID` = ' . $row['comID']);
                            while ($sub = $db->fetch_assoc()) {
                                $sub['size'] = goodsize($sub['size']);
                                $anhaenge[] = $sub;
                            }
                            $row['attchs'] = $anhaenge;
                        }
                        $comments[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('search', 'username');
                    $tpl->assign('username', $search['fromusername']);
                    $tpl->assign('comments', $comments);
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_comments.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                } else {
                    if ($search['sortart'] == 'adatum') {
                        $search['sortart'] = 'lastreplay';
                    }
                    $db->query($search['sqlquery']);
                    $anzahl = $db->num_rows();
                    $limits = get_sql_limit($anzahl, LIMIT_THREADS);
                    $result = $db->query($search['sqlquery'] . ' ORDER BY ' . $search['sortart'] . ' ' . $search['sortorder'] . ' LIMIT ' . $limits[1] . ', ' . LIMIT_THREADS);
                    $threads = array();
                    while ($row = mysql_fetch_assoc($result)) {
                        $row['lastreplay'] = forum_make_date($row['lastreplay']);
                        $row['datum'] = forum_make_date($row['datum']);
                        $row['bewertung'] = $row['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($row['ratingvotes']), format_nr($row['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS;
                        $row['bewertungbild'] = 'rating_' . str_replace('.', '_', get_forum_rating($row['rating']));
                        $threads[] = $row;
                    }
                    $tpl = new smarty();
                    $tpl->assign('search', 'username');
                    $tpl->assign('username', $search['fromusername']);
                    $tpl->assign('threads', $threads);
                    if ($limits[0] != 1) {
                        $tpl->assign('seiten', '<span class="klammer">[</span> ' . PAGES . ': ' . $anzahl . ' <span class="klammer">|</span> ' . makepagelink('?section=forum&action=searchresults&id=' . $id, (int) @$_GET['page'] == 0 ? 1 : (int) @$_GET['page'], $limits[0]) . ' <span class="klammer">]</span>');
                    }
                    $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . SEARCH);
                    ob_start();
                    $tpl->display(DESIGN . '/tpl/forum/board_head.html');
                    $tpl->display(DESIGN . '/tpl/forum/search_results_boards.html');
                    echo '</div>';
                    $content = ob_get_contents();
                    ob_end_clean();
                    main_content(FORUM_SEARCH_RESULTS, $content, '', 1);
                }
            }
        } else {
            table(ERROR, FORUM_SEARCH_NOT_YOURS);
        }
    }
}