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); } } }
echo htmlentities(ACCESS_DENIED); } break; case 'thread_vote': $thread = $db->fetch_assoc('SELECT `threadID`, `bID`, a.isforum, a.closed as forumclosed, a.rightsread, b.rightsread as parentRead 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 = ' . (int) $_GET['id']); if (find_access($thread['rightsread']) and find_access($thread['parentRead']) and $thread['isforum'] and isset($_SESSION['userID'])) { if ($db->result(DB_PRE . 'ecp_forum_ratings', 'COUNT(rateID)', 'userID = ' . $_SESSION['userID'] . ' AND tID = ' . (int) $_GET['id'])) { echo html_ajax_convert(FORUM_RATING_ALLREADY); } else { if ((int) $_GET['wert'] < 1 or (int) $_GET['wert'] > 5) { echo html_ajax_convert(FORUM_RATING_WRONG); } else { if ($db->query('INSERT INTO ' . DB_PRE . 'ecp_forum_ratings (`userID`, `tID`, `bID`, `wert`) VALUES (' . $_SESSION['userID'] . ', ' . (int) $_GET['id'] . ', ' . $thread['bID'] . ', ' . (int) $_GET['wert'] . ')')) { $array = $db->fetch_assoc('SELECT COUNT(rateID) as anzahl, AVG(wert) as mittel FROM ' . DB_PRE . 'ecp_forum_ratings WHERE tID = ' . (int) $_GET['id']); echo get_forum_rating($array['mittel']); $db->query('UPDATE ' . DB_PRE . 'ecp_forum_threads SET rating = ' . $array['mittel'] . ', ratingvotes = ' . $array['anzahl'] . ' WHERE threadID = ' . (int) $_GET['id']); } } } } else { echo html_ajax_convert(NO_ACCESS_RIGHTS); } break; case 'get_webstats': switch ($_GET['mode']) { case 'browser_hits': $db->query('SELECT `variable`, `hits` FROM ' . DB_PRE . 'ecp_stats_browser WHERE type="browser" ORDER BY hits DESC'); echo '<?xml version="1.0" encoding="UTF-8"?> <pie> ';