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); } }
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); } }
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); }
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')); } }
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>'); } }
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); } else { table(INFO, NO_ENTRIES); } } } else { echo table(ACCESS_DENIED, NO_ACCESS_RIGHTS); }
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); }
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); } }
function forum_thread($bid, $id, $order = 'ASC', $quote = false) { global $db, $installed, $countries; $thread = $db->fetch_assoc('SELECT `threadID`, `bID`, `threadname`, `vonID`, ' . DB_PRE . 'ecp_forum_threads.posts, `sticky`, ' . DB_PRE . 'ecp_forum_threads.closed, `fsurveyID`, `rating`, `ratingvotes`, a.boardparentID, a.name, a.isforum, a.closed as forumclosed, a.rightsread, a.postcom, a.editcom, a.votesurvey, a.downloadattch, a.threadclose, a.threaddel, a.threadmove, a.threadpin, a.editmocom, a.delcom, b.rightsread as parentRead, b.name as boardparentName FROM ' . DB_PRE . 'ecp_forum_threads LEFT JOIN ' . DB_PRE . 'ecp_forum_boards AS a ON (bID = a.boardID) LEFT JOIN ' . DB_PRE . 'ecp_forum_boards AS b ON (b.boardID = a.boardparentID) WHERE threadID = ' . $id . ' AND bID = ' . $bid); if (isset($thread['threadID']) and find_access($thread['rightsread']) and find_access($thread['parentRead']) and $thread['isforum']) { $comments = array(); $db->query('UPDATE ' . DB_PRE . 'ecp_forum_threads SET views = views + 1 WHERE threadID = ' . $id); $limits = get_sql_limit($thread['posts'] + 1, LIMIT_FORUM_COMMENTS); $result = $db->query('SELECT `comID`, ' . DB_PRE . 'ecp_forum_comments.userID, `postname`, a.rID, rankname, iconname, `adatum`, `comment`, `edits`, `editdatum`, `edituserID`, ' . DB_PRE . 'ecp_forum_comments.IP, `attachs`, a.username, a.sex, a.signatur, a.country, comments, d.money, a.avatar, b.username as editfrom, lastklick as online FROM `' . DB_PRE . 'ecp_forum_comments` LEFT JOIN ' . DB_PRE . 'ecp_user as a ON (' . DB_PRE . 'ecp_forum_comments.userID = a.ID) LEFT JOIN ' . DB_PRE . 'ecp_user as b ON (' . DB_PRE . 'ecp_forum_comments.edituserID = b.ID) LEFT JOIN ' . DB_PRE . 'ecp_user_stats as d ON (' . DB_PRE . 'ecp_forum_comments.userID = d.userID) LEFT JOIN ' . DB_PRE . 'ecp_ranks ON (a.rID = rankID) LEFT JOIN ' . DB_PRE . 'ecp_online ON (uID = ' . DB_PRE . 'ecp_forum_comments.userID AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ') WHERE boardID = ' . $bid . ' AND tID = ' . $id . ' GROUP BY comID ORDER BY adatum ' . $order . ' LIMIT ' . $limits[1] . ', ' . LIMIT_FORUM_COMMENTS); while ($row = mysql_fetch_assoc($result)) { if (isset($_SESSION['userID'])) { if (isset($_SESSION['lastforum'][$id]) and $_SESSION['lastforum'][$id] < $row['adatum']) { $row['new'] = true; } elseif (!isset($_SESSION['lastforum'][$id]) and $_SESSION['lastforum']['time'] < $row['adatum']) { $row['new'] = true; } } $row['adatum'] = forum_make_date($row['adatum']); $row['nr'] = ++$limits[1]; $row['comments'] = format_nr($row['comments']); $row['countryname'] = @$countries[$row['country']]; $row['quote'] = $row['comment']; $row['comment'] = bb_code($row['comment']); $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` = ' . $bid . ' AND `tID` = ' . $id . ' AND `mID` = ' . $row['comID']); while ($sub = $db->fetch_assoc()) { $sub['size'] = goodsize($sub['size']); $anhaenge[] = $sub; } $row['attchs'] = $anhaenge; } $comments[] = $row; } if (isset($_SESSION['userID'])) { if (!isset($_SESSION['lastforum'][$id])) { @$_SESSION['lastforum']['boards'][$bid]['new']--; } $_SESSION['lastforum']['boards'][$bid]['time'] = time(); $_SESSION['lastforum'][$id] = time(); } $tage = (time() - $installed) / 86400; $db->query('SELECT uID, username FROM ' . DB_PRE . 'ecp_online LEFT JOIN ' . DB_PRE . 'ecp_user ON (ID=uID) WHERE forum = 1 AND fboardID = ' . $bid . ' AND fthreadID = ' . $id . ' AND lastklick > ' . (time() - SHOW_USER_ONLINE) . ' ORDER BY username ASC'); $members = 0; $guests = 0; $member = ''; while ($row = $db->fetch_assoc()) { if ($row['uID']) { $members++; $member .= ', <a href="?section=user&id=' . $row['uID'] . '">' . $row['username'] . '</a>'; } else { $guests++; } } $tpl = new smarty(); $tpl->assign('bewertung', $thread['ratingvotes'] != 0 ? str_replace(array('{anzahl}', '{avg}'), array(format_nr($thread['ratingvotes']), format_nr($thread['rating'], 2)), FORUM_RATING_VAL) : FORUM_NO_RATINGS); if (!@$_SESSION['userID'] or $db->result(DB_PRE . 'ecp_forum_ratings', 'COUNT(rateID)', 'userID = ' . $_SESSION['userID'] . ' AND tID = ' . $id)) { $tpl->assign('rating', get_forum_rating($thread['rating'])); } if ($limits[0] > 1) { $seiten = makepagelink_ajax('?section=forum&action=thread&boardID=' . $bid . '&threadID=' . $id, 'return load_forum_com_page(' . $id . ', ' . $bid . ', {nr}, \'' . $order . '\');', @$_GET['page'], $limits[0]); $tpl->assign('seiten', $seiten); } $tpl->assign('order', $order); $tpl->assign('vonID', $thread['vonID']); $tpl->assign('sticky', $thread['sticky']); $tpl->assign('forenlinks', forum_get_fast_links()); $tpl->assign('postcom', find_access($thread['postcom'])); $tpl->assign('editcom', find_access($thread['editcom'])); $tpl->assign('threadclose', find_access($thread['threadclose'])); $tpl->assign('threaddel', find_access($thread['threaddel'])); $tpl->assign('threadmove', find_access($thread['threadmove'])); $tpl->assign('threadpin', find_access($thread['threadpin'])); $tpl->assign('editmocom', find_access($thread['editmocom'])); $tpl->assign('delcom', find_access($thread['delcom'])); $tpl->assign('closed', $thread['closed']); $tpl->assign('bclosed', $thread['forumclosed']); $tpl->assign('comments', @$comments); $tpl->assign('name', $thread['threadname']); $tpl->assign('abo', $db->result(DB_PRE . 'ecp_forum_abo', 'COUNT(aboID)', 'userID = ' . (int) @$_SESSION['userID'] . ' AND thID = ' . $id)); $tpl->assign('path', '<a href="?section=forum">' . FORUM . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' . ($thread['boardparentID'] ? '<a href="?section=forum&action=subboard&boardID=' . $thread['boardparentID'] . '">' . $thread['boardparentName'] . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> ' : '') . '<a href="?section=forum&action=board&boardID=' . $bid . '">' . $thread['name'] . '</a> <img src="templates/' . DESIGN . '/images/pfeil_o.gif" alt="" /> <img src="templates/' . DESIGN . '/images/forum_thread_pin.png" id="pin_icon" alt="' . FORUM_STICKY . '" title="' . FORUM_STICKY . '"' . ($thread['sticky'] ? '' : ' style="display: none;"') . ' /> <img src="templates/' . DESIGN . '/images/forum_icon_thread_closed.png" id="closed_icon" alt="' . FORUM_THREAD_CLOSED . '" title="' . FORUM_THREAD_CLOSED . '"' . ($thread['closed'] ? '' : ' style="display: none;"') . ' /> ' . $thread['threadname']); $tpl->assign('members', substr($member, 2)); $tpl->assign('thread', 1); $tpl->assign('quote', $quote); $tpl->assign('online', str_replace(array('{members}', '{guests}'), array(format_nr($members), format_nr($guests)), FORUM_ONLINE_THREAD)); ob_start(); if ($thread['fsurveyID']) { $tpl->assign('umfrage', 1); if (isset($_SESSION['userID'])) { $umfrage = $db->fetch_assoc('SELECT `ende`, `frage`, `antworten`, COUNT(voteID) AS anzahl FROM `' . DB_PRE . 'ecp_forum_survey` LEFT JOIN ' . DB_PRE . 'ecp_forum_survey_votes ON (fsurID = ' . $thread['fsurveyID'] . ' AND userID = ' . (int) @$_SESSION['userID'] . ') WHERE fsurveyID = ' . $thread['fsurveyID'] . ' AND boardID = ' . $bid . ' AND threadID = ' . $id . ' GROUP BY fsurveyID'); } else { $umfrage = $db->fetch_assoc('SELECT `ende`, `frage`, `antworten`, COUNT(voteID) AS anzahl FROM `' . DB_PRE . 'ecp_forum_survey` LEFT JOIN ' . DB_PRE . 'ecp_forum_survey_votes ON (fsurID = ' . $thread['fsurveyID'] . ' AND IP = \'' . $_SERVER['REMOTE_ADDR'] . '\') WHERE fsurveyID = ' . $thread['fsurveyID'] . ' AND boardID = ' . $bid . ' AND threadID = ' . $id . ' GROUP BY fsurveyID'); } $tpl->assign('antworten', $umfrage['antworten']); $tpl->assign('frage', $umfrage['frage']); if ($umfrage['ende']) { $tpl->assign('ende', date(LONG_DATE, $umfrage['ende'])); } $db->query('SELECT `answerID`, `answer`, `votes` FROM ' . DB_PRE . 'ecp_forum_survey_answers WHERE fsID = ' . $thread['fsurveyID'] . ' ORDER BY answerID ASC'); $gesamt = 0; $antworten = array(); while ($row = $db->fetch_assoc()) { $gesamt += $row['votes']; $antworten[] = $row; } 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, '', '.'); } $tpl->assign('answers', $antworten); $tpl->assign('fsurveyID', $thread['fsurveyID']); $tpl->assign('id', $id); $tpl->assign('bid', $bid); $tpl->assign('gesamt', number_format($gesamt, 0, '', '.')); if ($umfrage['anzahl'] or isset($_COOKIE['forum']['survey_' . $thread['fsurveyID']]) or !find_access($thread['votesurvey']) or $thread['closed'] or $umfrage['ende'] != 0 and $umfrage['ende'] < time()) { $tpl->assign('abstimmen', false); } else { $tpl->assign('abstimmen', true); } } $tpl->display(DESIGN . '/tpl/forum/board_head.html'); $tpl->display(DESIGN . '/tpl/forum/thread_comments.html'); $tpl->display(DESIGN . '/tpl/forum/board_footer.html'); $content = ob_get_contents(); ob_end_clean(); main_content(FORUM, $content, '', 1); } else { table(ERROR, ACCESS_DENIED); } }
if (@$_SESSION['rights']['admin']['clanwars']['screens'] or @$_SESSION['rights']['superadmin']) { $filename = $db->result(DB_PRE . 'ecp_wars_screens', 'filename', 'screenID = ' . (int) $_GET['id']); if (unlink('images/screens/' . $filename) and $db->query('DELETE FROM ' . DB_PRE . 'ecp_wars_screens WHERE screenID = ' . (int) $_GET['id'])) { echo 'ok'; } } else { echo html_ajax_convert(NO_ADMIN_RIGHTS); } break; case 'get_wars': if (@$_SESSION['rights']['admin']['clanwars'] or @$_SESSION['rights']['superadmin']) { $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;
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; }
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); }
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); }