function cs_threads_comments($threads_id) { settype($threads_id, 'integer'); $condition = "comments_mod = 'board' AND comments_fid = '" . $threads_id . "'"; $comments = cs_sql_count(__FILE__, 'comments', $condition); $cells = array('threads_comments'); $content = array($comments); cs_sql_update(__FILE__, 'threads', $cells, $content, $threads_id, 0, 0); return $comments; }
function cs_trashmail($email) { $parts = explode('@', $email, 2); if (empty($parts[1])) { return false; } else { $where = "trashmail_entry = '" . strtolower(cs_sql_escape($parts[1])) . "'"; $check = cs_sql_count(__FILE__, 'trashmail', $where); return empty($check) ? false : true; } }
function cs_admin_menu() { global $cs_main, $account; $cs_lang = cs_translate('clansphere'); $data = array(); $recent_mod = $cs_main['mod']; $recent_action = $cs_main['action']; $link_count = 0; if (file_exists('mods/' . $recent_mod . '/manage.php') && $account['access_' . $recent_mod] >= 3) { include $cs_main['def_path'] . '/mods/' . $recent_mod . '/info.php'; # look for sql table named like mod, else use first sql table given $mod_tables = is_array($mod_info['tables']) ? $mod_info['tables'] : array(); if (in_array($recent_mod, $mod_tables)) { $sql_table = $recent_mod; } elseif (isset($mod_tables[0])) { $sql_table = $mod_tables[0]; } else { $sql_table = false; } $sql_count = empty($sql_table) ? '' : ' (' . cs_sql_count(__FILE__, $sql_table) . ')'; $link_count++; $data['menu']['manage'] = $recent_action == 'manage' ? $cs_lang['manage'] : cs_link($cs_lang['manage'], $recent_mod, 'manage') . $sql_count; $data['if']['manage'] = true; } else { $data['menu']['manage'] = ''; $data['if']['manage'] = false; } if (file_exists('mods/' . $recent_mod . '/create.php') && $account['access_' . $recent_mod] >= 3 && $recent_mod != 'shoutbox') { $link_count++; $data['menu']['create'] = $recent_action == 'create' ? $cs_lang['create'] : cs_link($cs_lang['create'], $recent_mod, 'create'); $data['if']['create'] = true; } else { $data['menu']['create'] = ''; $data['if']['create'] = false; } if (file_exists('mods/' . $recent_mod . '/options.php') && $account['access_' . $recent_mod] >= 5) { $link_count++; $data['menu']['options'] = $recent_action == 'options' ? $cs_lang['options'] : cs_link($cs_lang['options'], $recent_mod, 'options'); $data['if']['options'] = true; } else { $data['menu']['options'] = ''; $data['if']['options'] = false; } if ($link_count > 1) { $data['links']['count'] = $link_count; return cs_subtemplate(__FILE__, $data, 'clansphere', 'admin_menu'); } }
function cs_addons($modul, $action, $id, $modul_now) { global $account, $cs_main; $show = $modul . '/' . $action; $addons = cs_checkdirs('mods', $show); $count = count($addons); $var = ''; if (!empty($count)) { foreach ($addons as $mod) { $acc_dir = 'access_' . $mod['dir']; if (array_key_exists($acc_dir, $account) and $account[$acc_dir] >= $mod['show'][$show]) { $mod['action'] = $modul == $mod['dir'] ? $action : $modul; $out = $modul_now == $mod['dir'] ? $mod['name'] : cs_link($mod['name'], $mod['dir'], $mod['action'], 'id=' . $id); if ($mod['dir'] == $modul) { if ($modul == 'users') { $cs_user = cs_sql_select(__FILE__, 'users', 'users_nick, users_active, users_delete', 'users_id = ' . $id); $user = cs_user($id, $cs_user['users_nick'], $cs_user['users_active'], $cs_user['users_delete']); $var = $mod['name'] . ' - ' . $user . cs_html_hr('100%') . $var; } else { $cs_refer = cs_sql_select(__FILE__, $modul, $modul . '_name', $modul . '_id = ' . $id); $name = cs_secure($cs_refer[$modul . '_name']); $var = $mod['name'] . ' - ' . cs_link($name, $modul, $action, 'id=' . $id) . cs_html_hr('100%') . $var; } } else { if (!empty($mod['references'][$modul])) { /* * @TODO ACCESS rights (usersgallery) for count columns */ $column = empty($mod['references'][$modul . '_column']) ? $modul . '_id' : $mod['references'][$modul . '_column']; $more = empty($mod['references'][$modul . '_where']) ? '' : ' AND (' . $mod['references'][$modul . '_where'] . ')'; $count = cs_sql_count(__FILE__, $mod['references'][$modul], $column . ' = ' . $id . $more); $var .= $out . " (" . $count . ")\r\n - "; } else { $var .= $out . "\r\n - "; } } } } } $var = substr($var, 0, -3); return $var; }
$cs_sort[1] = 'gbk.gbook_time DESC'; $cs_sort[2] = 'gbk.gbook_time ASC'; $cs_sort[3] = 'usr.users_email DESC'; $cs_sort[4] = 'usr.users_email ASC'; $order = $cs_sort[$sort]; $user_gb = empty($_POST['user_gb']) ? 0 : $_POST['user_gb']; if (empty($user_gb)) { $user_gb = empty($_GET['user_gb']) ? 0 : $_GET['user_gb']; } if (!empty($user_gb)) { $where = "users_nick = '" . cs_sql_escape($user_gb) . "'"; $cs_user = cs_sql_select(__FILE__, 'users', 'users_id', $where); $id = $cs_user['users_id']; } $where = "gbook_users_id ='" . $id . "'"; $gbook_count = cs_sql_count(__FILE__, 'gbook', $where); $data['head']['count'] = $gbook_count; $data['head']['pages'] = cs_pages('gbook', 'manage', $gbook_count, $start, $id, $sort); $data['head']['user_gb'] = empty($user_gb) ? '' : $user_gb; $data['head']['getmsg'] = cs_getmsg(); $data['sort']['email'] = cs_sort('gbook', 'manage', $start, $id, 3, $sort); $data['sort']['time'] = cs_sort('gbook', 'manage', $start, $id, 1, $sort); $from = 'gbook gbk LEFT JOIN {pre}_users usr ON gbk.users_id = usr.users_id'; $select = 'gbk.gbook_id AS gbook_id, gbk.users_id AS users_id, gbk.gbook_time AS gbook_time, gbk.gbook_nick AS gbook_nick, '; $select .= 'gbk.gbook_email AS gbook_email, gbk.gbook_lock AS gbook_lock, gbk.gbook_ip AS gbook_ip, '; $select .= 'usr.users_nick AS users_nick, usr.users_email AS users_email'; $cs_gbook = cs_sql_select(__FILE__, $from, $select, $where, $order, $start, $account['users_limit']); $gbook_loop = count($cs_gbook); for ($run = 0; $run < $gbook_loop; $run++) { if ($cs_gbook[$run]['users_id'] > 0) { $gbook[$run]['nick'] = cs_secure($cs_gbook[$run]['users_nick']);
$cs_get = cs_get('id'); $data = array(); $users_id = empty($cs_get['id']) ? 0 : $cs_get['id']; $nick_temp = cs_sql_select(__FILE__, 'users', 'users_nick', 'users_id = ' . $users_id); if (isset($_GET['agree'])) { $nick = $nick_temp['users_nick']; $chars = 'abcdefghijklmnopqrstuvwxyz0123456789'; $chars_count = strlen($chars) - 1; $mail = ''; $given = 1; while (!empty($given)) { for ($i = 0; $i < 40; $i++) { $rand = rand(0, $chars_count); $mail .= $chars[$rand]; } $given = cs_sql_count(__FILE__, 'users', "users_email = '" . $mail . "'"); } $array_data = array('access_id' => 0, 'users_nick' => $nick, 'users_pwd' => '', 'users_name' => '', 'users_surname' => '', 'users_sex' => '', 'users_age' => '', 'users_height' => 0, 'users_lang' => '', 'users_country' => "fam", 'users_postalcode' => '', 'users_place' => '', 'users_adress' => '', 'users_icq' => 0, 'users_jabber' => '', 'users_skype' => '', 'users_email' => $mail, 'users_url' => '', 'users_phone' => '', 'users_mobile' => '', 'users_laston' => 0, 'users_picture' => '', 'users_avatar' => '', 'users_signature' => '', 'users_info' => '', 'users_regkey' => '', 'users_register' => 0, 'users_delete' => 1); $array_keys = array_keys($array_data); $array_values = array_values($array_data); cs_sql_update(__FILE__, 'users', $array_keys, $array_values, $users_id); cs_sql_delete(__FILE__, 'members', $users_id, 'users_id'); cs_cache_clear(); cs_redirect($cs_lang['del_true'], 'users'); } if (isset($_GET['cancel'])) { cs_redirect($cs_lang['del_false'], 'users'); } else { $data['head']['body'] = sprintf($cs_lang['rly_rmv_user'], $nick_temp['users_nick']); $data['url']['agree'] = cs_url('users', 'remove', 'id=' . $users_id . '&agree'); $data['url']['cancel'] = cs_url('users', 'remove', 'id=' . $users_id . '&cancel');
} if (isset($_POST['submit_1'])) { $post_count = count($_POST); $post_count = $post_count - '1'; $cs_gallery_pic['folders_id'] = empty($_POST['folders_name']) ? $_POST['folders_id'] : make_folders_create('gallery', $_POST['folders_name']); $cs_gallery_option = cs_sql_option(__FILE__, 'gallery'); $img_max['thumbs'] = $cs_gallery_option['thumbs']; for ($run = 0; $run < $post_count; $run++) { if (!empty($_POST['status_' . $run])) { $name = $_POST['name_' . $run]; if (!extension_loaded('gd')) { die(cs_error_internal(0, 'GD extension not installed.')); } if (cs_resample('uploads/gallery/pics/' . $name, 'uploads/gallery/thumbs/' . 'Thumb_' . $name, $img_max['thumbs'], $img_max['thumbs'])) { $where = "gallery_name = '" . cs_sql_escape($name) . "'"; $search = cs_sql_count(__FILE__, 'gallery', $where); if (empty($search)) { $cs_gallery_pic['users_id'] = $account['users_id']; $cs_gallery_pic['gallery_name'] = $name; $cs_gallery_pic['gallery_status'] = isset($_POST['gallery_status']) ? $_POST['gallery_status'] : 0; $cs_gallery_pic['gallery_access'] = isset($_POST['gallery_access']) ? $_POST['gallery_access'] : 0; $cs_gallery_pic['gallery_watermark'] = $_POST['gallery_watermark']; if (!empty($_POST['gallery_watermark'])) { $watermark_pos = $_POST['watermark_pos']; $watermark_trans = $_POST['gallery_watermark_trans']; $cs_gallery_pic['gallery_watermark_pos'] = $watermark_pos . '|--@--|' . $watermark_trans; } $extension = strlen(strrchr($name, ".")); $file = strlen($name); $filename = substr($name, 0, $file - $extension); $cs_gallery_pic['gallery_titel'] = $filename;
// ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('wars'); $squads_id = empty($_REQUEST['where']) ? 0 : (int) $_REQUEST['where']; $where_count = empty($squads_id) ? 0 : "squads_id = '" . $squads_id . "'"; $where = empty($squads_id) ? 0 : "war.squads_id = '" . $squads_id . "'"; $start = empty($_REQUEST['start']) ? 0 : (int) $_REQUEST['start']; $cs_sort[1] = 'war.wars_date DESC'; $cs_sort[2] = 'war.wars_date ASC'; $cs_sort[3] = 'cln.clans_name DESC'; $cs_sort[4] = 'cln.clans_name ASC'; $cs_sort[5] = 'cat.categories_name DESC'; $cs_sort[6] = 'cat.categories_name ASC'; $sort = empty($_REQUEST['sort']) ? 1 : (int) $_REQUEST['sort']; $order = $cs_sort[$sort]; $wars_count = cs_sql_count(__FILE__, 'wars', $where_count); $data = array(); $data['info']['warcount'] = sprintf($cs_lang['count'], $wars_count); $data['pages']['choice'] = cs_pages('wars', 'list', $wars_count, $start, $squads_id, $sort); $data['url']['form'] = cs_url('wars', 'list'); $cid = "squads_fightus = '0'"; $data['squads'] = cs_sql_select(__FILE__, 'squads', 'squads_name, squads_id', $cid, 'squads_name', 0, 0); $count_squads = count($data['squads']); for ($run = 0; $run < $count_squads; $run++) { $data['squads'][$run]['name'] = cs_secure($data['squads'][$run]['squads_name']); } $data['sort']['date'] = cs_sort('wars', 'list', $start, $squads_id, 1, $sort); $data['sort']['enemy'] = cs_sort('wars', 'list', $start, $squads_id, 3, $sort); $data['sort']['category'] = cs_sort('wars', 'list', $start, $squads_id, 5, $sort); $select = 'war.games_id AS games_id, war.wars_date AS wars_date, war.wars_status AS status, war.clans_id AS clans_id, cln.clans_short AS clans_short, cat.categories_name AS categories_name, war.categories_id AS categories_id, war.wars_score1 AS wars_score1, war.wars_score2 AS wars_score2, war.wars_id AS wars_id'; $from = 'wars war INNER JOIN {pre}_categories cat ON war.categories_id = cat.categories_id ';
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('board'); $cs_usertime = cs_sql_select(__FILE__, 'users', 'users_readtime', "users_id = '" . $account["users_id"] . "'"); $cs_readtime = cs_time() - $cs_usertime['users_readtime']; $from = 'threads thr INNER JOIN {pre}_board frm ON frm.board_id = thr.board_id'; $conditions = "frm.board_access <= '" . $account['access_board'] . "' AND frm.board_pwd = ''"; $cs_count = cs_sql_count(__FILE__, $from, $conditions); $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; $data['lang']['count'] = $cs_count; $data['pages']['list'] = cs_pages('board', 'active', $cs_count, $start); $from = "threads thr INNER JOIN {pre}_board frm ON frm.board_id = thr.board_id INNER JOIN {pre}_categories cat ON cat.categories_id = frm.categories_id INNER JOIN {pre}_users usr ON thr.threads_last_user = usr.users_id LEFT JOIN {pre}_read red ON thr.threads_id = red.threads_id AND red.users_id = '" . $account['users_id'] . "'"; $select = 'thr.threads_id AS threads_id, thr.threads_headline AS threads_headline, thr.threads_view AS threads_view, thr.threads_comments AS threads_comments, thr.threads_important AS threads_important, thr.threads_close AS threads_close, thr.threads_last_time AS threads_last_time, usr.users_id AS users_id, usr.users_nick AS users_nick, usr.users_active AS users_active, red.read_since AS read_since'; $order = 'thr.threads_view DESC, thr.threads_last_time DESC'; $cs_threads = cs_sql_select(__FILE__, $from, $select, $conditions, $order, $start, $account['users_limit']); if (empty($cs_threads)) { $data['if']['not_active'] = true; $data['if']['active'] = false; } else { $data['if']['not_active'] = false; $data['if']['active'] = true; $run = 0; foreach ($cs_threads as $thread) { if (empty($thread['threads_comments'])) { include_once 'mods/board/repair.php'; $thread['threads_comments'] = cs_threads_comments($thread['threads_id']); } $icon = 'post_'; $tid = $thread['threads_id'];
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $tday = cs_datereal('d'); $tmonth = cs_datereal('n'); $tyear = cs_datereal('Y'); $daystart = mktime(0, 0, 0, $tmonth, $tday, $tyear); $daystart = cs_timediff($daystart, 1); $where = 'count_time > \'' . $daystart . '\''; echo number_format(cs_sql_count(__FILE__, 'count', $where), 0, ',', '.');
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('quotes'); $categories_id = empty($_REQUEST['where']) ? 0 : $_REQUEST['where']; settype($categories_id, 'integer'); $where = empty($categories_id) ? 0 : "categories_id = '" . $categories_id . "'"; $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start']; $cs_sort[1] = 'quotes_headline DESC'; $cs_sort[2] = 'quotes_headline ASC'; $cs_sort[3] = 'quotes_time DESC'; $cs_sort[4] = 'quotes_time ASC'; $sort = empty($_REQUEST['sort']) ? 3 : $_REQUEST['sort']; $order = $cs_sort[$sort]; $quotes_count = cs_sql_count(__FILE__, 'quotes', $where); $data = array(); $data['url']['form'] = cs_url('quotes', 'manage'); $data['lang']['all'] = $cs_lang['total'] . ': '; $data['head']['count'] = $quotes_count; $data['head']['pages'] = cs_pages('quotes', 'manage', $quotes_count, $start, $categories_id, $sort); $data['head']['message'] = cs_getmsg(); $quotesmod = "categories_mod = 'quotes'"; $categories_data = cs_sql_select(__FILE__, 'categories', '*', $quotesmod, 'categories_name', 0, 0); $data['head']['dropdown'] = cs_dropdown('where', 'categories_name', $categories_data, $categories_id, 'categories_id'); $from = 'quotes qts LEFT JOIN {pre}_users usr ON qts.users_id = usr.users_id'; $select = 'qts.quotes_headline AS quotes_headline, qts.users_id AS users_id, usr.users_nick AS users_nick, usr.users_active AS users_active, usr.users_delete AS users_delete, qts.quotes_time AS quotes_time, qts.quotes_id AS quotes_id'; $cs_quotes = cs_sql_select(__FILE__, $from, $select, $where, $order, $start, $account['users_limit']); $quotes_loop = count($cs_quotes); $data['sort']['quotes_headline'] = cs_sort('quotes', 'manage', $start, $categories_id, 1, $sort); $data['sort']['quotes_time'] = cs_sort('quotes', 'manage', $start, $categories_id, 3, $sort);
} settype($board_id, 'integer'); include 'mods/board/functions.php'; $from = 'board frm INNER JOIN {pre}_categories cat ON frm.categories_id = cat.categories_id'; #$from .= " INNER JOIN {pre}_members mem ON frm.squads_id = mem.squads_id AND mem.users_id = '" . $account['users_id'] . "'"; $select = 'frm.board_pwd AS board_pwd, frm.board_name AS board_name, cat.categories_name AS categories_name, '; $select .= 'frm.board_id AS board_id, cat.categories_id AS categories_id, frm.board_access AS board_access, frm.squads_id AS squads_id'; $where = "frm.board_id = " . (int) $board_id; $cs_thread = cs_sql_select(__FILE__, $from, $select, $where, 0, 0, 1); if (!empty($cs_thread['board_pwd'])) { $where = "users_id = " . (int) $account['users_id'] . " AND board_id = " . (int) $cs_thread['board_id']; $check_pw = cs_sql_count(__FILE__, 'boardpws', $where); } if (!empty($cs_thread['squads_id'])) { $where = "squads_id = " . (int) $cs_thread['squads_id'] . " AND users_id = " . (int) $account['users_id']; $check_sq = cs_sql_count(__FILE__, 'members', $where); } //Sicherheitsabfrage Beginn $errorpage = 0; if (empty($board_id) || count($cs_thread) == 0) { $errorpage++; } if ($account['access_board'] < $cs_thread['board_access'] or empty($check_pw)) { $errorpage = empty($check_sq) ? 1 : 0; } if (!empty($errorpage)) { return errorPage('thread_add', $cs_lang); } //Sicherheitsabfrage Ende #check mod $acc_mod = 0;
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('board'); require_once 'mods/board/functions.php'; $data = array(); $data['stats']['topics'] = cs_sql_count(__FILE__, 'threads'); $data['stats']['posts'] = cs_sql_count(__FILE__, 'comments', 'comments_mod = \'board\''); $data['stats']['users'] = cs_sql_count(__FILE__, 'users', 'users_active = 1 AND users_delete = 0'); $data['stats']['categories'] = cs_sql_count(__FILE__, 'categories', 'categories_mod = \'board\''); $data['stats']['boards'] = cs_sql_count(__FILE__, 'board'); $data['stats']['users_active'] = cs_sql_count(__FILE__, 'comments', 'comments_mod = \'board\'', 'users_id'); $user = toplist_comments(0, 3); $data['stats']['toplist'] = ''; if (!empty($user)) { foreach ($user as $users_data) { $data['stats']['toplist'] .= empty($users_data['users_nick']) ? '- (' . $users_data['num_comments'] . ' ' . $cs_lang['posts'] . '), ' : cs_user($users_data['users_id'], $users_data['users_nick'], $users_data['users_active'], $users_data['users_delete']) . ' (' . $users_data['num_comments'] . ' ' . $cs_lang['posts'] . '), '; } $data['stats']['toplist'] = substr($data['stats']['toplist'], 0, -2); } $tables = 'threads t INNER JOIN {pre}_board b ON t.board_id = b.board_id ' . 'AND b.board_access <= \'' . $account['access_board'] . '\' AND b.board_pwd = \'\' ' . 'INNER JOIN {pre}_comments cms ON cms.comments_mod = \'board\' ' . 'AND cms.comments_fid = t.threads_id GROUP BY t.threads_id, t.threads_comments, t.threads_headline'; $cells = 't.threads_id AS threads_id, t.threads_comments AS threads_comments, '; $cells .= 't.threads_headline AS threads_headline, COUNT(cms.comments_id) AS comments'; $select = cs_sql_select(__FILE__, $tables, $cells, 0, 'comments DESC'); $data['stats']['longest_thread'] = $select['threads_headline']; $data['stats']['longest_thread_posts'] = $select['comments']; $data['link']['longest_thread'] = cs_url('board', 'thread', 'where=' . $select['threads_id']); $data['stats']['average_posts'] = !empty($data['stats']['topics']) ? round($data['stats']['posts'] / $data['stats']['topics'], 2) : 0; echo cs_subtemplate(__FILE__, $data, 'board', 'stats');
cs_unlink('squads', $cs_squads['squads_picture']); } $cs_squads['squads_picture'] = $filename; } else { $error .= $cs_lang['up_error']; } } if (empty($cs_squads['clans_id'])) { $error .= $cs_lang['no_clan'] . cs_html_br(1); } if (empty($cs_squads['squads_name'])) { $error .= $cs_lang['no_name'] . cs_html_br(1); } $where = "squads_name = '" . cs_sql_escape($cs_squads['squads_name']) . "'"; $where .= " AND squads_id != '" . $squads_id . "'"; $search = cs_sql_count(__FILE__, 'squads', $where); if (!empty($search)) { $error .= $cs_lang['squad_exists'] . cs_html_br(1); } } if (!isset($_POST['submit'])) { $data['head']['body'] = $cs_lang['errors_here']; } elseif (!empty($error)) { $data['head']['body'] = $error; } if (!empty($error) or !isset($_POST['submit'])) { foreach ($cs_squads as $key => $value) { $data['squads'][$key] = cs_secure($value); } $data['head']['mod'] = $cs_lang[$op_squads['label'] . 's']; $data['squads']['abcode'] = cs_abcode_features('squads_text');
// $Id$ $cs_lang = cs_translate('wars'); $cs_post = cs_post('id'); $cs_get = cs_get('id'); $data = array(); $wars_id = empty($cs_get['id']) ? 0 : $cs_get['id']; if (!empty($cs_post['id'])) { $wars_id = $cs_post['id']; } $cs_rounds['wars_id'] = $wars_id; $cs_rounds['maps_id'] = 0; $new_map = ''; $cs_rounds['rounds_score1'] = ''; $cs_rounds['rounds_score2'] = ''; $cs_rounds['rounds_description'] = ''; $cs_rounds['rounds_order'] = cs_sql_count(__FILE__, 'rounds', 'wars_id = \'' . $cs_rounds['wars_id'] . '\'') + 1; $error = ''; if (!empty($_GET['up']) || !empty($_GET['down'])) { $roundid = !empty($_GET['up']) ? (int) $_GET['up'] : $_GET['down']; $round = cs_sql_select(__FILE__, 'rounds', 'rounds_order', "rounds_id = '" . $roundid . "'"); $new_order = !empty($_GET['up']) ? $round['rounds_order'] - 1 : $round['rounds_order'] + 1; $where = "wars_id = '" . $wars_id . "' AND rounds_order = '" . $new_order . "'"; $round_old = cs_sql_select(__FILE__, 'rounds', 'rounds_id', $where); $cells = array('rounds_order'); if (empty($round_old)) { $rounds = cs_sql_select(__FILE__, 'rounds', 'rounds_id', "wars_id = '" . $wars_id . "'", 'rounds_id ASC', 0, 0); $count_rounds = count($rounds); for ($run = 0; $run < $count_rounds; $run++) { $values = array($run + 1); cs_sql_update(__FILE__, 'rounds', $cells, $values, $rounds[$run]['rounds_id']); }
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('games'); $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start']; $cs_sort[1] = 'games_name DESC'; $cs_sort[2] = 'games_name ASC'; $cs_sort[3] = 'games_usk DESC'; $cs_sort[4] = 'games_usk ASC'; $sort = empty($_REQUEST['sort']) ? 2 : $_REQUEST['sort']; $order = $cs_sort[$sort]; $games_count = cs_sql_count(__FILE__, 'games'); $data['lang']['body'] = sprintf($cs_lang['all'], $games_count); $data['pages']['list'] = cs_pages('games', 'list', $games_count, $start, 0, $sort); $cs_games = cs_sql_select(__FILE__, 'games', '*', 0, $order, $start, $account['users_limit']); $games_loop = count($cs_games); $data['sort']['name'] = cs_sort('games', 'list', $start, 0, 1, $sort); $data['sort']['usk'] = cs_sort('games', 'list', $start, 0, 3, $sort); if (empty($games_loop)) { $data['games'] = ''; } for ($run = 0; $run < $games_loop; $run++) { $data['games'][$run]['name'] = cs_link($cs_games[$run]['games_name'], 'games', 'view', 'id=' . $cs_games[$run]['games_id']); $games_genre = cs_sql_select(__FILE__, 'categories', '*', "categories_id = '" . $cs_games[$run]['categories_id'] . "'"); $data['games'][$run]['genre'] = cs_secure($games_genre['categories_name']); $data['games'][$run]['usk'] = cs_secure($cs_games[$run]['games_usk']); $data['games'][$run]['release'] = empty($cs_games[$run]['games_released']) ? $since2 = '-' : ($since2 = cs_date('date', $cs_games[$run]['games_released'])); } echo cs_subtemplate(__FILE__, $data, 'games', 'list');
} else { $errormsg .= $cs_lang['up_error']; $error++; } } if (empty($cs_clans['clans_name'])) { $error++; $errormsg .= $cs_lang['no_name'] . cs_html_br(1); } if (empty($cs_clans['clans_short'])) { $error++; $errormsg .= $cs_lang['no_short'] . cs_html_br(1); } $where = "clans_name = '" . cs_sql_escape($cs_clans['clans_name']) . "'"; $where .= " AND clans_id != " . (int) $clans_id; $search = cs_sql_count(__FILE__, 'clans', $where); if (!empty($search)) { $error++; $errormsg .= $cs_lang['name_exists'] . cs_html_br(1); } } else { $cells = 'clans_name, clans_short, clans_tag, clans_tagpos, clans_country, clans_url, clans_since, clans_pwd, clans_picture, users_id'; $cs_clans = cs_sql_select(__FILE__, 'clans', $cells, "clans_id = " . (int) $clans_id); $cs_users = cs_sql_select(__FILE__, 'users', 'users_nick', 'users_id = ' . (int) $cs_clans['users_id']); $users_nick = $cs_users['users_nick']; } if (!isset($_POST['submit'])) { $data['lang']['body'] = $cs_lang['errors_here']; } if (!empty($error)) { $data['lang']['body'] = $errormsg;
$data['if']['squad_to_leave'] = FALSE; $start = empty($cs_get['start']) ? 0 : $cs_get['start']; if (!empty($cs_post['start'])) { $start = $cs_post['start']; } $sort = empty($cs_get['sort']) ? 2 : $cs_get['sort']; if (!empty($cs_post['sort'])) { $sort = $cs_post['sort']; } $cs_sort[1] = 'sqd.squads_name DESC'; $cs_sort[2] = 'sqd.squads_name ASC'; $cs_sort[3] = 'mem.members_task DESC'; $cs_sort[4] = 'mem.members_task ASC'; $order = $cs_sort[$sort]; $own = "users_id = '" . $account['users_id'] . "'"; $squads_count = cs_sql_count(__FILE__, 'members', $own); $data['head']['mod'] = $cs_lang[$op_squads['label'] . 's']; $data['lang']['new_label'] = $cs_lang['new_' . $op_squads['label']]; $data['head']['count'] = $squads_count; $data['head']['pages'] = cs_pages('squads', 'center', $squads_count, $start, 0, $sort); $data['head']['getmsg'] = cs_getmsg(); $data['lang']['join_label'] = $cs_lang['join_' . $op_squads['label']]; if (!empty($squads_count)) { $data['if']['squad_to_leave'] = TRUE; $data['lang']['leave_label'] = $cs_lang['leave_' . $op_squads['label']]; } $data['sort']['squad_name'] = cs_sort('squads', 'center', $start, 0, 1, $sort); $data['lang']['label'] = $cs_lang[$op_squads['label']]; $data['sort']['members_task'] = cs_sort('squads', 'center', $start, 0, 3, $sort); $select = 'sqd.squads_name AS squads_name, sqd.squads_id AS squads_id, mem.members_task AS members_task, mem.members_admin AS members_admin'; $from = 'members mem INNER JOIN {pre}_squads sqd ON mem.squads_id = sqd.squads_id';
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('count'); $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start']; $cs_sort[1] = 'count_time DESC'; $cs_sort[2] = 'count_time ASC'; $cs_sort[3] = 'count_id DESC'; $cs_sort[4] = 'count_id ASC'; $sort = empty($_REQUEST['sort']) ? 1 : $_REQUEST['sort']; $order = $cs_sort[$sort]; $counter_count = cs_sql_count(__FILE__, 'count'); $data = array(); $data['head']['counter_count'] = $counter_count; $data['head']['counter_pages'] = cs_pages('count', 'manage', $counter_count, $start); $data['head']['message'] = cs_getmsg(); $data['sort']['count_time'] = cs_sort('count', 'manage', $start, 0, 1, $sort); $data['sort']['count_id'] = cs_sort('count', 'manage', $start, 0, 3, $sort); $cs_counter = cs_sql_select(__FILE__, 'count', '*', 0, $order, $start, $account['users_limit']); $count_loop = count($cs_counter); $data['count'] = array(); for ($run = 0; $run < $count_loop; $run++) { $data['count'][$run]['count_id'] = $cs_counter[$run]['count_id']; $data['count'][$run]['count_ip'] = $cs_counter[$run]['count_ip']; $data['count'][$run]['count_locate'] = $cs_counter[$run]['count_location']; $data['count'][$run]['count_time'] = cs_date('unix', $cs_counter[$run]['count_time'], 1); } echo cs_subtemplate(__FILE__, $data, 'count', 'manage');
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('links'); $data = array(); $links_count = cs_sql_count(__FILE__, 'links', 'links_sponsor = 1'); $data['head']['body'] = sprintf($cs_lang['all1'], $links_count); $select = 'links_name, links_url, links_banner, links_info'; $data['links'] = cs_sql_select(__FILE__, 'links', $select, 'links_sponsor = 1', 0, 0, 0); $links_loop = count($data['links']); for ($run = 0; $run < $links_loop; $run++) { $data['links'][$run]['name'] = cs_secure($data['links'][$run]['links_name']); $target = 'http://' . $data['links'][$run]['links_url']; $data['links'][$run]['url_img'] = cs_html_link($target, $data['links'][$run]['links_url']); if (!empty($data['links'][$run]['links_banner'])) { $place = 'uploads/links/' . $data['links'][$run]['links_banner']; $img = cs_html_img($place, 0, 0, 0, $data['links'][$run]['links_name']); $data['links'][$run]['url_img'] = cs_html_link($target, $img); } $data['links'][$run]['info'] = cs_secure($data['links'][$run]['links_info'], 1, 1, 1, 1); } echo cs_subtemplate(__FILE__, $data, 'links', 'sponsors');
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('gbook'); $start = empty($_GET['start']) ? 0 : $_GET['start']; if (!empty($_GET['unhide'])) { cs_sql_update(__FILE__, 'gbook', array('gbook_lock'), array('1'), (int) $_GET['unhide']); cs_redirect($cs_lang['unhide_done'], 'gbook', 'center'); } if (!empty($_GET['hide'])) { cs_sql_update(__FILE__, 'gbook', array('gbook_lock'), array('0'), (int) $_GET['hide']); cs_redirect($cs_lang['hide_done'], 'gbook', 'center'); } $gbook_count = cs_sql_count(__FILE__, 'gbook', "gbook_users_id = '" . $account['users_id'] . "'"); $data['head']['new_entry'] = cs_link($cs_lang['submit'], 'gbook', 'entry', 'id=' . $account['users_id'] . '&from=center'); $data['head']['count'] = $gbook_count; $data['head']['pages'] = cs_pages('gbook', 'center', $gbook_count, $start); $data['head']['getmsg'] = cs_getmsg(); $from = 'gbook gbk LEFT JOIN {pre}_users usr ON gbk.users_id = usr.users_id'; $select = 'gbk.gbook_id AS gbook_id, gbk.users_id AS users_id, gbk.gbook_time AS gbook_time, gbk.gbook_users_id AS gbook_users_id, '; $select .= 'gbk.gbook_nick AS gbook_nick, gbk.gbook_email AS gbook_email, gbk.gbook_icq AS gbook_icq, '; $select .= 'gbk.gbook_jabber AS gbook_jabber, gbk.gbook_skype AS gbook_skype, gbk.gbook_url AS gbook_url, '; $select .= 'gbk.gbook_town AS gbook_town, gbk.gbook_text AS gbook_text, gbk.gbook_lock AS gbook_lock, '; $select .= 'usr.users_nick AS users_nick, usr.users_place AS users_place, usr.users_icq AS users_icq, '; $select .= 'usr.users_jabber AS users_jabber, usr.users_skype AS users_skype, usr.users_email AS users_email, '; $select .= 'usr.users_url AS users_url, usr.users_hidden AS users_hidden, usr.users_active AS users_active, usr.users_delete AS users_delete'; $where = "gbook_users_id = '" . $account['users_id'] . "'"; $order = 'gbk.gbook_id DESC'; $cs_gbook = cs_sql_select(__FILE__, $from, $select, $where, $order, $start, $account['users_limit']); $gbook_loop = count($cs_gbook);
$wars['status']['players_id'] = $select['players_id']; $wars['status']['wars_id'] = $wars_id; $wars['lang']['submit'] = empty($in_list) ? $cs_lang['confirm'] : $cs_lang['edit']; } else { $players_id = (int) $_POST['players_id']; $wars_id = (int) $_POST['wars_id']; $status = $_POST['players_status']; $time = cs_time(); if (empty($in_list)) { $cells = array('wars_id', 'users_id', 'players_status', 'players_time'); $values = array($wars_id, $account['users_id'], $status, $time); cs_sql_insert(__FILE__, 'players', $cells, $values); } else { $cells = array('players_status', 'players_time'); $values = array($status, $time); cs_sql_update(__FILE__, 'players', $cells, $values, $players_id); } cs_redirect($cs_lang['success'], 'wars', 'view', 'id=' . $wars_id); } } } } echo cs_subtemplate(__FILE__, $wars, 'wars', 'view'); $where_com = "comments_mod = 'wars' AND comments_fid = '" . $wars_id . "'"; $count_com = cs_sql_count(__FILE__, 'comments', $where_com); include_once 'mods/comments/functions.php'; if (!empty($count_com)) { echo cs_html_br(1); echo cs_comments_view($wars_id, 'wars', 'view', $count_com); } echo cs_comments_add($wars_id, 'wars', $cs_wars['wars_close']);
$cs_get = cs_get('start,sort'); $data = array(); $start = empty($cs_get['start']) ? 0 : $cs_get['start']; if (!empty($cs_post['start'])) { $start = $cs_post['start']; } $sort = empty($cs_get['sort']) ? 2 : $cs_get['sort']; if (!empty($cs_post['sort'])) { $sort = $cs_post['sort']; } $cs_sort[1] = 'linkus_name DESC'; $cs_sort[2] = 'linkus_name ASC'; $cs_sort[3] = 'linkus_banner DESC'; $cs_sort[4] = 'linkus_banner ASC'; $order = $cs_sort[$sort]; $linkus_count = cs_sql_count(__FILE__, 'linkus'); $data['head']['count'] = $linkus_count; $data['head']['pages'] = cs_pages('linkus', 'manage', $linkus_count, $start, 0, $sort); $data['head']['getmsg'] = cs_getmsg(); $data['sort']['name'] = cs_sort('linkus', 'manage', $start, 0, 1, $sort); $data['sort']['banner'] = cs_sort('linkus', 'manage', $start, 0, 3, $sort); $select = 'linkus_id, linkus_name, linkus_banner'; $data['linkus'] = cs_sql_select(__FILE__, 'linkus', $select, 0, $order, $start, $account['users_limit']); $linkus_loop = count($data['linkus']); for ($run = 0; $run < $linkus_loop; $run++) { $data['linkus'][$run]['name'] = cs_secure($data['linkus'][$run]['linkus_name']); $data['linkus'][$run]['banner'] = cs_secure($data['linkus'][$run]['linkus_banner']); $place = 'uploads/linkus/' . $data['linkus'][$run]['linkus_banner']; $mass = getimagesize($place); $data['linkus'][$run]['mass'] = cs_secure($mass[0] . ' x ' . $mass[1]); $data['linkus'][$run]['id'] = $data['linkus'][$run]['linkus_id'];
$tables .= 'INNER JOIN {pre}_users usr2 ON cm.squad2_id = usr2.users_id '; $cells = 'cm.squad1_id AS squad1_id, usr1.users_nick AS user1_nick, '; $cells .= 'cm.squad2_id AS squad2_id, usr2.users_nick AS user2_nick, '; } $cells .= 'cm.cupmatches_accepted1 AS cupmatches_accepted1, cm.cupmatches_accepted2 AS cupmatches_accepted2'; $cs_match = cs_sql_select(__FILE__, $tables, $cells, 'cm.cupmatches_id = \'' . $cupmatches_id . '\''); /* determine player */ $team = 0; $player = FALSE; if ($system['cups_system'] == CS_CUPS_TYPE_TEAMS) { /* check if he is part of team1 or team2 and he is a member admin */ $cond = 'users_id = \'' . $account['users_id'] . '\' AND members_admin = 1 AND squads_id = \'' . $cs_match['squad1_id'] . '\''; $sql = cs_sql_count(__FILE__, 'members', $cond); if (empty($sql)) { $cond = 'users_id = \'' . $account['users_id'] . '\' AND members_admin = 1 AND squads_id = \'' . $cs_match['squad2_id'] . '\''; $sql = cs_sql_count(__FILE__, 'members', $cond); if (!empty($sql)) { $player = TRUE; $team = 2; } } else { $player = TRUE; $team = 1; } } else { /* check if the user id's match */ if ($account['users_id'] == $cs_match['squad1_id']) { $player = TRUE; $team = 1; } else { if ($account['users_id'] == $cs_match['squad2_id']) {
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('board'); $count_abo = cs_sql_count(__FILE__, 'abonements', 'users_id=' . $account['users_id']); $count_att = cs_sql_count(__FILE__, 'boardfiles', 'users_id=' . $account['users_id']); $data = array(); $data['head']['getmsg'] = cs_getmsg(); $data['count']['abos'] = $count_abo; $data['count']['attachments'] = $count_att; $data['link']['abos'] = cs_url('board', 'center'); $data['link']['attachments'] = cs_url('board', 'attachments'); $data['link']['avatar'] = cs_url('board', 'avatar'); $data['action']['form'] = cs_url('board', 'signature'); $data['signature']['smileys'] = cs_abcode_smileys('signature'); $data['signature']['abcode'] = cs_abcode_features('signature'); $signature_sql = cs_sql_select($file, 'users', 'users_signature', "users_id = '" . $account['users_id'] . "'"); $signature = $signature_sql['users_signature']; $signature = isset($_POST['signature']) ? $_POST['signature'] : $signature; $signature = preg_replace_callback("=\\[img\\](.*?)\\[/img\\]=si", "cs_abcode_resize", $signature); $signature = preg_replace_callback("=\\[img width\\=(.*?) height\\=(.*?)\\](.*?)\\[/img\\]=si", "cs_abcode_resize", $signature); $data['signature']['text'] = $signature; $data['signature']['preview'] = cs_secure($signature, 1, 1); $data['if']['preview'] = (isset($_POST['preview']) and !empty($signature)) ? 1 : 0; if (isset($_POST['submit'])) { $signature_cells = array('users_signature'); $signature_save = array($signature); cs_sql_update(__FILE__, 'users', $signature_cells, $signature_save, $account['users_id']); cs_redirect($cs_lang['create_done'], 'board', 'signature'); }
// ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('board'); $data = array(); $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start']; $cs_sort[1] = 'boardreport_time DESC'; $cs_sort[2] = 'boardreport_time ASC'; $cs_sort[3] = 'boardreport_done DESC, boardreport_time DESC'; $cs_sort[4] = 'boardreport_done ASC, boardreport_time DESC'; $cs_sort[5] = 'threads_headline DESC'; $cs_sort[6] = 'boardreport_time ASC'; $sort = empty($_REQUEST['sort']) ? 1 : $_REQUEST['sort']; $order = $cs_sort[$sort]; $data['lang']['getmsg'] = cs_getmsg(); $data['head']['boardreport_count'] = cs_sql_count(__FILE__, 'boardreport'); $data['head']['pages'] = cs_pages('board', 'reportlist', $data['head']['boardreport_count'], $start, 0, $sort); $data['sort']['boardreport_time'] = cs_sort('board', 'reportlist', $start, 0, 1, $sort); $data['sort']['boardreport_done'] = cs_sort('board', 'reportlist', $start, 0, 3, $sort); $data['sort']['threads_headline'] = cs_sort('board', 'reportlist', $start, 0, 5, $sort); $from = 'boardreport bdr INNER JOIN {pre}_threads thr ON bdr.threads_id = thr.threads_id'; $select = 'bdr.boardreport_time AS boardreport_time, bdr.boardreport_done AS boardreport_done, bdr.threads_id AS threads_id, thr.threads_headline AS threads_headline, bdr.comments_id AS comments_id'; $cs_report = cs_sql_select(__FILE__, $from, $select, 0, $order, $start, $account['users_limit']); $report_loop = count($cs_report); $data['boardreport'] = array(); for ($run = 0; $run < $report_loop; $run++) { $data['boardreport'][$run]['boardreport_time'] = cs_date('date', $cs_report[$run]['boardreport_time'], 1); $data['boardreport'][$run]['boardreport_done'] = empty($cs_report[$run]['boardreport_done']) ? $cs_lang['no'] : $cs_lang['yes']; $headline = cs_secure($cs_report[$run]['threads_headline']); // $comments_count = empty($cs_report[$run]['comments_id']) ? 0 : cs_sql_count(__FILE__,'comments',"comments_mod = 'board' AND comments_fid = '" . $cs_report[$run]['threads_id'] . "'"); // $goto = floor($comments_count / $account['users_limit']) * $account['users_limit'] . '#com' . $comments_count;
$age--; } if (cs_datereal('d') >= $birth[2] and cs_datereal('m') == $birth[1]) { $age++; } $content .= ' (' . $age . ')'; $data['clans']['since'] = $content; } else { $data['clans']['since'] = '-'; } $select = 'squads_name, games_id, squads_id'; $where = "clans_id = '" . $cs_clans_id . "'"; $cs_squads = cs_sql_select(__FILE__, 'squads', $select, $where, 'squads_order, squads_name', 0, 0); $squads_loop = count($cs_squads); $data['lang']['game'] = $cs_lang['game']; $data['lang']['squads'] = $cs_lang[$op_squads['label']]; $data['lang']['members'] = $cs_lang[$op_members['label']]; if (empty($squads_loop)) { $data['squads'] = ''; } for ($run = 0; $run < $squads_loop; $run++) { if (!empty($cs_squads[$run]['games_id'])) { $data['squads'][$run]['game'] = cs_html_img('uploads/games/' . $cs_squads[$run]['games_id'] . '.gif'); } else { $data['squads'][$run]['game'] = ''; } $data['squads'][$run]['squads'] = cs_link(cs_secure($cs_squads[$run]['squads_name']), 'squads', 'view', 'id=' . $cs_squads[$run]['squads_id']); $where = "squads_id='" . $cs_squads[$run]['squads_id'] . "'"; $data['squads'][$run]['members'] = cs_sql_count(__FILE__, 'members', $where); } echo cs_subtemplate(__FILE__, $data, 'clans', 'view');
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('banners'); $start = empty($_REQUEST['start']) ? 0 : $_REQUEST['start']; $cs_sort[1] = 'banners_name DESC'; $cs_sort[2] = 'banners_name ASC'; $cs_sort[3] = 'banners_order DESC'; $cs_sort[4] = 'banners_order ASC'; $sort = empty($_REQUEST['sort']) ? 2 : $_REQUEST['sort']; $order = $cs_sort[$sort]; $banners_count = cs_sql_count(__FILE__, 'banners'); $data['count']['all'] = $banners_count; $data['pages']['list'] = cs_pages('banners', 'manage', $banners_count, $start, 0, $sort); $data['lang']['getmsg'] = cs_getmsg(); $select = 'banners_id, banners_name, banners_order'; $cs_banners = cs_sql_select(__FILE__, 'banners', $select, 0, $order, $start, $account['users_limit']); $banners_loop = count($cs_banners); $data['sort']['name'] = cs_sort('banners', 'manage', $start, 0, 1, $sort); $data['sort']['order'] = cs_sort('banners', 'manage', $start, 0, 3, $sort); if (empty($banners_loop)) { $data['banners'] = ''; } for ($run = 0; $run < $banners_loop; $run++) { $data['banners'][$run]['name'] = cs_secure($cs_banners[$run]['banners_name']); $data['banners'][$run]['order'] = cs_secure($cs_banners[$run]['banners_order']); $data['banners'][$run]['edit'] = cs_url('banners', 'edit', 'id=' . $cs_banners[$run]['banners_id']); $data['banners'][$run]['remove'] = cs_url('banners', 'remove', 'id=' . $cs_banners[$run]['banners_id']); } echo cs_subtemplate(__FILE__, $data, 'banners', 'manage');
foreach ($cs_country as $short => $full) { $data['country'][$run]['short'] = $short; $data['country'][$run]['selection'] = $short == $cs_user['users_country'] ? ' selected="selected"' : ''; $data['country'][$run]['full'] = $full; $run++; } echo cs_subtemplate(__FILE__, $data, 'users', 'profile'); } else { settype($cs_user['users_height'], 'integer'); settype($cs_user['users_icq'], 'integer'); $cs_user['users_hidden'] = implode(',', $hidden); if ($cs_user['users_nick'] != $account['users_nick']) { change_nick($account['users_id'], $account['users_nick']); } $users_cells = array_keys($cs_user); $users_save = array_values($cs_user); cs_sql_update(__FILE__, 'users', $users_cells, $users_save, $account['users_id']); cs_cache_delete('navbirth'); cs_cache_delete('nextbirth'); $data['link']['continue'] = cs_url('users', 'home'); $data['lang']['head'] = $cs_lang['profile']; echo cs_subtemplate(__FILE__, $data, 'users', 'done'); if ($account['access_wizard'] == 5) { $wizard = cs_sql_count(__FILE__, 'options', "options_name = 'done_prfl' AND options_value = '1'"); if (empty($wizard)) { $data['wizard']['show'] = cs_link($cs_lang['show'], 'wizard', 'roots'); $data['wizard']['task_done'] = cs_link($cs_lang['task_done'], 'wizard', 'roots', 'handler=prfl&done=1'); echo cs_subtemplate(__FILE__, $data, 'users', 'wizard'); } } }
$medalsuser_id = cs_sql_escape($_GET['delete']); cs_sql_delete(__FILE__, 'medalsuser', $medalsuser_id); cs_redirect($cs_lang['del_true'], 'medals', 'user', 'where=' . $medals_id); } $start = empty($_GET['start']) ? 0 : $_GET['start']; $cs_sort[1] = 'md.medalsuser_date DESC'; $cs_sort[2] = 'md.medalsuser_date ASC'; $cs_sort[3] = 'usr.users_nick DESC'; $cs_sort[4] = 'usr.users_nick ASC'; $sort = empty($_GET['sort']) ? 1 : $_GET['sort']; $order = $cs_sort[$sort]; $tables = 'medalsuser md LEFT JOIN {pre}_users usr ON usr.users_id = md.users_id'; $cells = 'usr.users_nick AS users_nick, md.users_id AS users_id, usr.users_active AS users_active, usr.users_delete AS users_delete, '; $cells .= 'md.medals_id AS medals_id, md.medalsuser_date AS medalsuser_date, md.medalsuser_id AS medalsuser_id'; $where = 'medals_id = ' . $medals_id . ''; $data['medals_user'] = array(); $data['medals_user'] = cs_sql_select(__FILE__, $tables, $cells, $where, $order, $start, $account['users_limit']); $data['count']['medals_user'] = count($data['medals_user']); $data['count']['all_medals_user'] = cs_sql_count(__FILE__, 'medalsuser', $where); $data['sort']['date'] = cs_sort('medals', 'user', $start, $medals_id, 1, $sort); $data['sort']['users_nick'] = cs_sort('medals', 'user', $start, $medals_id, 3, $sort); $data['pages']['list'] = cs_pages('medals', 'user', $data['count']['all_medals_user'], $start, $medals_id, $sort); for ($i = 0; $i < $data['count']['medals_user']; $i++) { $data['medals_user'][$i]['user'] = cs_user($data['medals_user'][$i]['users_id'], $data['medals_user'][$i]['users_nick'], $data['medals_user'][$i]['users_active'], $data['medals_user'][$i]['users_delete']); $data['medals_user'][$i]['remove_url'] = cs_url('medals', 'user', 'where=' . $data['medals_user'][$i]['medals_id'] . '&delete=' . $data['medals_user'][$i]['medalsuser_id']); $data['medals_user'][$i]['medals_date'] = cs_date('unix', $data['medals_user'][$i]['medalsuser_date'], 1); } $data['medals']['id'] = $medals_id; $data['message']['medals'] = cs_getmsg(); $data['form']['dirname'] = $cs_main['php_self']['dirname']; echo cs_subtemplate(__FILE__, $data, 'medals', 'user');