function cs_cache_clear() { apc_clear_cache('user'); $unicode = extension_loaded('unicode') ? 1 : 0; $where = "options_mod = 'clansphere' AND options_name = 'cache_unicode'"; cs_sql_update(__FILE__, 'options', array('options_value'), array($unicode), 0, $where); }
function cs_pictures_upload($file, $mod, $fid, $ajaxclean = 1) { if (!empty($_POST['del_picture'])) { cs_pictures_delete($_POST['del_picture']); } if (empty($file['tmp_name'])) { return true; } settype($fid, 'integer'); $types_allowed = array('image/jpeg', 'image/png', 'image/pjpeg', 'image/x-png'); if (!in_array($file['type'], $types_allowed)) { return false; } $exts = array('image/jpeg' => 'jpg', 'image/png' => 'png', 'image/pjpeg' => 'jpg', 'image/x-png' => 'png'); $ext = $exts[$file['type']]; $where = "pictures_fid = '" . $fid . "' AND pictures_mod = '" . $mod . "'"; $already = cs_sql_select(__FILE__, 'pictures', 'pictures_id', $where); $pictures_id = $already['pictures_id']; if (empty($already)) { $vars = array(); $vars['pictures_mod'] = $mod; $vars['pictures_fid'] = $fid; cs_sql_insert(__FILE__, 'pictures', array_keys($vars), array_values($vars)); $pictures_id = cs_sql_insertid(__FILE__); } if (!cs_upload('pictures', 'picture-' . $pictures_id . '.' . $ext, $file['tmp_name'], $ajaxclean)) { cs_sql_delete(__FILE__, 'pictures', $pictures_id); return false; } $cells = array('pictures_file'); $content = array('picture-' . $pictures_id . '.' . $ext); cs_sql_update(__FILE__, 'pictures', $cells, $content, $pictures_id); return true; }
function cs_login_cookies($userid = 0, $use_old_hash = 0) { global $account, $cs_main; $lifetime = empty($userid) ? 1 : $cs_main['cookie']['lifetime']; $thistime = empty($userid) ? '' : cs_time(); $thishash = empty($use_old_hash) ? '' : $use_old_hash; if (!empty($userid) and empty($use_old_hash)) { $pattern = '1234567890abcdefghijklmnpqrstuvwxyz'; for ($i = 0; $i < 34; $i++) { $thishash .= $pattern[rand(0, 34)]; } $cells = array('users_cookietime', 'users_cookiehash'); $content = array($thistime, $thishash); cs_sql_update(__FILE__, 'users', $cells, $content, $userid, 0, 0); } elseif (!empty($userid) and $use_old_hash == true) { $thistime = $account['users_cookietime']; $thishash = $account['users_cookiehash']; if (empty($thistime) or empty($thishash)) { cs_login_cookies($userid); return true; } } setcookie('cs_userid', $userid, $lifetime, $cs_main['cookie']['path'], $cs_main['cookie']['domain']); setcookie('cs_cookietime', $thistime, $lifetime, $cs_main['cookie']['path'], $cs_main['cookie']['domain']); setcookie('cs_cookiehash', $thishash, $lifetime, $cs_main['cookie']['path'], $cs_main['cookie']['domain']); }
function cs_articles_views($id, $views) { settype($id, 'integer'); settype($views, 'integer'); $_SESSION['articles'] = isset($_SESSION['articles']) ? $_SESSION['articles'] : array(); if (empty($_SESSION['articles'][$id])) { $_SESSION['articles'][$id] = true; cs_sql_update(__FILE__, 'articles', array('articles_views'), array(1 + $views), $id, 0, 0); } }
function cs_optionsave($mod, $save) { $condition = "options_mod = '" . $mod . "' AND options_name = "; $cells = array('options_value'); foreach ($save as $options_name => $options_value) { $values = array($options_value); cs_sql_update(__FILE__, 'options', $cells, $values, 0, $condition . "'" . $options_name . "'"); } cs_cache_delete('op_' . $mod); }
function cs_cache_clear() { $cache_count = xcache_count(XC_TYPE_VAR); for ($i = 0; $i < $cache_count; $i++) { xcache_clear_cache(XC_TYPE_VAR, $i); } $unicode = extension_loaded('unicode') ? 1 : 0; $where = "options_mod = 'clansphere' AND options_name = 'cache_unicode'"; cs_sql_update(__FILE__, 'options', array('options_value'), array($unicode), 0, $where); }
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_cache_clear() { $content = cs_paths('uploads/cache'); unset($content['index.html'], $content['.htaccess'], $content['web.config']); foreach ($content as $file => $name) { unlink('uploads/cache/' . $file); } $unicode = extension_loaded('unicode') ? 1 : 0; $where = "options_mod = 'clansphere' AND options_name = 'cache_unicode'"; cs_sql_update(__FILE__, 'options', array('options_value'), array($unicode), 0, $where); }
$ext = 'gif'; break; case 2: $ext = 'jpg'; break; case 3: $ext = 'png'; break; } $target = $cs_files_id . '-' . $file_next . '.' . $ext; $picture_name = 'picture-' . $target; $thumb_name = 'thumb-' . $target; if (cs_resample($files_gl['picture']['tmp_name'], 'uploads/files/' . $thumb_name, 80, 200) and cs_upload('files', $picture_name, $files_gl['picture']['tmp_name'])) { $cells = array('files_previews'); $content = empty($file_string) ? array($target) : array($file_string . "\n" . $target); cs_sql_update(__FILE__, 'files', $cells, $content, $cs_files_id); cs_redirect($cs_lang['success'], 'files', 'picture', 'id=' . $cs_files_id); } else { $message .= $cs_lang['up_error']; $error++; } } } if (!empty($message)) { $data['head']['text'] = $message; } elseif (empty($_GET['delete'])) { $data['head']['text'] = $cs_lang['body_picture']; } else { $data['head']['text'] = $cs_lang['remove_done']; } $data['head']['message'] = cs_getmsg();
$error .= $cs_lang['too_wide'] . cs_html_br(1); } if ($img_size[1] > $op_users['max_height']) { $error .= $cs_lang['too_high'] . cs_html_br(1); } if ($files['picture']['size'] > $op_users['max_size']) { $error .= $cs_lang['too_big'] . cs_html_br(1); } if (empty($error) and cs_upload('users', $filename, $files['picture']['tmp_name']) or !empty($error) and extension_loaded('gd') and cs_resample($files['picture']['tmp_name'], 'uploads/users/' . $filename, $op_users['max_width'], $op_users['max_height'])) { $error = ''; if ($userpic != $filename and !empty($userpic)) { cs_unlink('users', $userpic); } $cells = array('users_picture'); $content = array($filename); cs_sql_update(__FILE__, 'users', $cells, $content, $users_id); cs_redirect('', 'users', 'manage'); } else { $error .= $cs_lang['up_error']; } } } if (empty($error)) { $data['head']['body'] = $cs_lang['picture_manage']; } else { $data['head']['body'] = $error; } if (!empty($error) or empty($files['picture']['tmp_name']) and empty($del)) { if (empty($userpic)) { $data['users']['current_pic'] = $cs_lang['nopic']; } else {
$errormsg = ''; if (empty($cs_bm['categories_id'])) { $error++; $errormsg .= $cs_lang['no_cat'] . cs_html_br(1); } } else { $boardmods_id = $_GET['id']; $tables = 'boardmods brd INNER JOIN {pre}_users usr ON usr.users_id = brd.users_id'; $cells = 'brd.boardmods_id AS boardmods_id, brd.categories_id AS categories_id, brd.users_id AS users_id, usr.users_nick AS users_nick, '; $cells .= 'brd.boardmods_modpanel AS boardmods_modpanel, brd.boardmods_edit AS boardmods_edit, brd.boardmods_del AS boardmods_del'; $cs_bm = cs_sql_select(__FILE__, $tables, $cells, "boardmods_id = '" . $boardmods_id . "'", 0, 0); } if (!isset($_POST['submit']) and empty($error)) { $data['head']['body'] = $cs_lang['body']; } elseif (!empty($error)) { $data['head']['body'] = $errormsg; } if (!empty($error) or !isset($_POST['submit'])) { $data['bm']['id'] = empty($_POST['id']) ? $_GET['id'] : $_POST['id']; $data['bm']['user'] = cs_secure($cs_bm['users_nick']); $data['bm']['cat_dropdown'] = cs_categories_dropdown('boardmods', $cs_bm['categories_id']); $data['bm']['boardmods_modpanel'] = $cs_bm['boardmods_modpanel'] == 1 ? 'checked="checked"' : ''; $data['bm']['boardmods_edit'] = $cs_bm['boardmods_edit'] == 1 ? 'checked="checked"' : ''; $data['bm']['boardmods_del'] = $cs_bm['boardmods_del'] == 1 ? 'checked="checked"' : ''; } else { $boardmods_cells = array_keys($cs_bm); $boardmods_save = array_values($cs_bm); cs_sql_update(__FILE__, 'boardmods', $boardmods_cells, $boardmods_save, $_POST['id']); cs_redirect($cs_lang['changes_done'], 'boardmods'); } echo cs_subtemplate(__FILE__, $data, 'boardmods', 'edit');
$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'); echo cs_subtemplate(__FILE__, $data, 'users', 'remove'); }
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'); } } }
// 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'); } $data['signature']['text'] = cs_secure($data['signature']['text']); echo cs_subtemplate(__FILE__, $data, 'board', 'signature');
$data['folders']['select'] = make_folders_select('folders_id', $edit['folders_id'], $account['users_id'], 'usersgallery'); $data['access']['options'] = ''; $levels = 0; while ($levels < 6) { $edit['usersgallery_access'] == $levels ? $sel = 1 : ($sel = 0); $data['access']['options'] .= cs_html_option($levels . ' - ' . $cs_lang['lev_' . $levels], $levels, $sel); $levels++; } $data['status']['options'] = ''; $levels = 0; while ($levels < 2) { $edit['usersgallery_status'] == $levels ? $sel = 1 : ($sel = 0); $data['status']['options'] .= cs_html_option($cs_lang['show_' . $levels], $levels, $sel); $levels++; } $data['abcode']['smileys'] = cs_abcode_smileys('gallery_description'); $data['abcode']['features'] = cs_abcode_features('gallery_description'); $checked = 'checked="checked"'; $data['check']['newtime'] = empty($new_time) ? '' : $checked; $data['check']['count'] = empty($gallery_count_reset) ? '' : $checked; $data['hidden']['id'] = $gallery_id; $data['data']['usersgallery_name'] = cs_secure($data['data']['usersgallery_name']); $data['data']['usersgallery_titel'] = cs_secure($data['data']['usersgallery_titel']); $data['data']['usersgallery_description'] = cs_secure($data['data']['usersgallery_description']); echo cs_subtemplate(__FILE__, $data, 'usersgallery', 'users_edit'); } else { $cells = array_keys($edit); $save = array_values($edit); cs_sql_update(__FILE__, 'usersgallery', $cells, $save, $gallery_id); cs_redirect($cs_lang['changes_done'], 'usersgallery', 'center'); }
$cs_match['cupmatches_score2'] = (int) $_POST['cupmatches_score2']; if ($_POST['cupmatches_score1'] > $_POST['cupmatches_score2']) { $cs_match['cupmatches_winner'] = $cup_match['squad1_id']; } else { if ($_POST['cupmatches_score2'] > $_POST['cupmatches_score1']) { $cs_match['cupmatches_winner'] = $cup_match['squad2_id']; } else { $error = cs_html_br(1) . $cs_lang['no_winner']; cs_redirect($cs_lang['error_occured'] . $error, 'cups', 'match', 'id=' . $cupmatches_id); } } $cs_match['cupmatches_accepted1'] = empty($_POST['cupmatches_accepted1']) ? 0 : 1; $cs_match['cupmatches_accepted2'] = empty($_POST['cupmatches_accepted2']) ? 0 : 1; $cells = array_keys($cs_match); $values = array_values($cs_match); cs_sql_update(__FILE__, 'cupmatches', $cells, $values, $cupmatches_id); // Check for new round if (!empty($cs_match['cupmatches_accepted1']) && !empty($cs_match['cupmatches_accepted2'])) { $cs_match = cs_sql_select(__FILE__, 'cupmatches', '*', 'cupmatches_id = ' . $cupmatches_id, 0, 0, 1); $loser = $cs_match['cupmatches_winner'] == $cup_match['squad1_id'] ? $cup_match['squad2_id'] : $cup_match['squad1_id']; if ($cs_match['cupmatches_nextmatch'] != CS_CUPS_NO_NEXTMATCH) { /* add winner team to next match */ cs_cups_addteam2match($cs_match['cups_id'], $cs_match['cupmatches_winner'], $cs_match['cupmatches_match'], $cs_match['cupmatches_round'], $cs_match['cupmatches_loserbracket'], $cs_match['cupmatches_nextmatch'], true); $msg = $cs_lang['new_match']; } if ($cs_match['cupmatches_nextmatchlb'] != CS_CUPS_NO_NEXTMATCH) { /* add loser team to next match in LB */ cs_cups_addteam2match($cs_match['cups_id'], $loser, $cs_match['cupmatches_match'], $cs_match['cupmatches_round'], $cs_match['cupmatches_loserbracket'], $cs_match['cupmatches_nextmatchlb'], true); $msg = $cs_lang['new_match']; } /* close all defwin matches */
$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']);
$data['banners']['or_img_url'] = $cs_banners['banners_picture']; $data['banners']['alt'] = $cs_banners['banners_alt']; $data['banners']['order'] = $cs_banners['banners_order']; $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_banners['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_banners['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_banners['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['banners']['clip'] = cs_abcode_clip($matches); echo cs_subtemplate(__FILE__, $data, 'banners', 'create'); } else { settype($cs_banners['banners_order'], 'integer'); $banners_cells = array_keys($cs_banners); $banners_save = array_values($cs_banners); cs_sql_insert(__FILE__, 'banners', $banners_cells, $banners_save); if (!empty($files['picture']['tmp_name'])) { $where = "banners_name = '" . cs_sql_escape($cs_banners['banners_name']) . "'"; $getid = cs_sql_select(__FILE__, 'banners', 'banners_id', $where); $filename = 'picture-' . $getid['banners_id'] . '.' . $extension; cs_upload('banners', $filename, $files['picture']['tmp_name']); $cs_banners2['banners_picture'] = 'uploads/banners/' . $filename; $banners2_cells = array_keys($cs_banners2); $banners2_save = array_values($cs_banners2); cs_sql_update(__FILE__, 'banners', $banners2_cells, $banners2_save, $getid['banners_id']); } cs_redirect($cs_lang['create_done'], 'banners'); }
$cs_buddys = cs_sql_select(__FILE__, 'buddys', $cells, "buddys_id = '" . $buddys_id . "'"); } if (isset($_POST['preview'])) { $data['if']['preview'] = TRUE; $data['if']['form'] = TRUE; $data['if']['done'] = FALSE; $data['edit']['buddys_notice'] = cs_secure($cs_buddys['buddys_notice'], 1, 1); $data['edit']['id'] = $buddys_id; } if (isset($_POST['preview']) or !isset($_POST['submit'])) { if (!isset($_POST['preview'])) { $data['if']['preview'] = FALSE; $data['if']['form'] = TRUE; $data['if']['done'] = FALSE; } $data['edit']['abcode_smileys'] = cs_abcode_smileys('buddys_notice'); $data['edit']['abcode_features'] = cs_abcode_features('buddys_notice'); $data['edit']['buddys_notice'] = cs_secure($cs_buddys['buddys_notice']); $data['edit']['id'] = $buddys_id; } else { $buddys_id = $_POST['id']; settype($buddys_id, 'integer'); $data['if']['preview'] = FALSE; $data['if']['form'] = FALSE; $data['if']['done'] = TRUE; $buddys_cells = array_keys($cs_buddys); $buddys_save = array_values($cs_buddys); cs_sql_update(__FILE__, 'buddys', $buddys_cells, $buddys_save, $buddys_id); cs_redirect($cs_lang['changes_done'], 'buddys', 'center'); } echo cs_subtemplate(__FILE__, $data, 'buddys', 'edit');
foreach ($server_array as $type => $key) { $data['classes'][$run]['name'] = $key['name']; $data['classes'][$run]['class'] = $type; if (isset($key['prot'])) { $data['classes'][$run]['class'] .= ";" . $key['prot']; } $select = $data['classes'][$run]['class'] == $data['create']['servers_class'] ? $select = 'selected="selected"' : ($select = ''); $data['classes'][$run]['select'] = $select; $data['classes'][$run]['port'] = $key['port']; $run++; } $servers_type = array(array('gtype' => $cs_lang['clanserver'], 'type' => '1', 'selected' => ''), array('gtype' => $cs_lang['pubserver'], 'type' => '2', 'selected' => ''), array('gtype' => $cs_lang['voiceserver'], 'type' => '3', 'selected' => '')); $run = 0; foreach ($servers_type as $type) { $selected = $type['type'] == $data['create']['servers_type'] ? 'selected="selected"' : ''; $data['typ'][$run]['name'] = $type['gtype']; $data['typ'][$run]['type'] = $type['type']; $data['typ'][$run]['selected'] = $selected; $run++; } } else { settype($data['create']['servers_slots'], 'integer'); settype($data['create']['servers_order'], 'integer'); // Update SQL Data $servers_cells = array_keys($data['create']); $servers_save = array_values($data['create']); cs_sql_update(__FILE__, 'servers', $servers_cells, $servers_save, $data['servers']['id']); // Create Finish cs_redirect($cs_lang['create_done'], 'servers'); } echo cs_subtemplate(__FILE__, $data, 'servers', 'edit');
} $data['clans']['country'] .= cs_html_select(0) . ' ' . cs_html_img('symbols/countries/' . $cs_clans['clans_country'] . '.png', 11, 16, 'id="' . $el_id . '"'); $data['clans']['url'] = cs_secure($cs_clans['clans_url']); $data['clans']['since'] = cs_dateselect('since', 'date', $cs_clans['clans_since']); $data['clans']['password'] = cs_secure($cs_clans['clans_pwd']); $data['users']['nick'] = $users_nick; if (empty($cs_clans['clans_picture'])) { $data['clans']['pic'] = $cs_lang['nopic']; } else { $place = 'uploads/clans/' . $cs_clans['clans_picture']; $size = getimagesize($cs_main['def_path'] . '/' . $place); $data['clans']['pic'] = cs_html_img($place, $size[1], $size[0]); } $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_clans['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_clans['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_clans['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['clans']['clip'] = cs_abcode_clip($matches); $data['data']['id'] = $clans_id; echo cs_subtemplate(__FILE__, $data, 'clans', 'edit'); } else { $clans_cells = array_keys($cs_clans); $clans_save = array_values($cs_clans); cs_sql_update(__FILE__, 'clans', $clans_cells, $clans_save, $clans_id); cs_redirect($cs_lang['changes_done'], 'clans'); }
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']); } $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); } $values = array($round['rounds_order']); cs_sql_update(__FILE__, 'rounds', $cells, $values, $round_old['rounds_id']); $values = array($new_order); cs_sql_update(__FILE__, 'rounds', $cells, $values, $roundid); } if (isset($_POST['submit'])) { $cs_rounds['maps_id'] = (int) $_POST['maps_id']; $new_map = $_POST['new_map']; $cs_rounds['rounds_score1'] = (int) $_POST['rounds_score1']; $cs_rounds['rounds_score2'] = (int) $_POST['rounds_score2']; $cs_rounds['rounds_description'] = $_POST['rounds_description']; if (empty($_POST['maps_id']) and empty($_POST['new_map'])) { $error .= $cs_lang['no_map'] . cs_html_br(1); } } if (!isset($_POST['submit'])) { $data['head']['body'] = $cs_lang['rounds_management']; } elseif (!empty($error)) { $data['head']['body'] = $error;
} $data['checked']['closed'] = empty($thread_edit['threads_close']) ? '' : 'checked="checked" '; $data['checked']['notclosed'] = !empty($thread_edit['threads_close']) ? '' : 'checked="checked" '; } //rename if (!empty($_POST['rename'])) { $data['if']['rename'] = TRUE; $data['val']['thread_headline'] = $thread_headline; } echo cs_subtemplate(__FILE__, $data, 'board', 'modpanel_q'); } else { cs_redirect($cs_lang['mark_all'], 'board', 'thread', 'where=' . $thread_id); } //Daten verarbeiten und in SQL Eintragen if (!empty($thread_cells) and !empty($thread_save)) { cs_sql_update(__FILE__, 'threads', $thread_cells, $thread_save, $thread_id); if (!empty($update_board)) { include_once 'mods/board/repair.php'; cs_board_last($board_id); } if (isset($board_new_id)) { //Update board entry to get correct threads and comments count include_once 'mods/board/repair.php'; cs_board_threads($board_id); cs_board_comments($board_id); cs_board_threads($board_new_id); cs_board_comments($board_new_id); cs_board_last($board_id); } cs_redirect($action_lang, 'board', 'thread', 'where=' . $thread_id); }
$matches[2] = $cs_lang['stage_1'] . $cs_lang['stage_1_text'] . cs_html_br(1); $matches[2] .= $cs_lang['stage_2'] . $cs_lang['stage_2_text'] . cs_html_br(1); $matches[2] .= $cs_lang['stage_3'] . $cs_lang['stage_3_text'] . cs_html_br(1); $matches[2] .= $cs_lang['stage_4'] . $cs_lang['stage_4_text']; $data['squads']['secure_clip'] = cs_abcode_clip($matches); $matches[1] = $cs_lang['pic_infos']; $return_types = ''; foreach ($img_filetypes as $add) { $return_types .= empty($return_types) ? $add : ', ' . $add; } $matches[2] = $cs_lang['max_width'] . $op_squads['max_width'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_height'] . $op_squads['max_height'] . ' px' . cs_html_br(1); $matches[2] .= $cs_lang['max_size'] . cs_filesize($op_squads['max_size']) . cs_html_br(1); $matches[2] .= $cs_lang['filetypes'] . $return_types; $data['squads']['picup_clip'] = cs_abcode_clip($matches); if (empty($cs_squads['squads_picture'])) { $data['squads']['current_pic'] = $cs_lang['nopic']; } else { $place = 'uploads/squads/' . $cs_squads['squads_picture']; $size = getimagesize($cs_main['def_path'] . '/' . $place); $data['squads']['current_pic'] = cs_html_img($place, $size[1], $size[0]); $data['if']['advanced'] = TRUE; } $data['squads']['id'] = $squads_id; echo cs_subtemplate(__FILE__, $data, 'squads', 'edit'); } else { $squads_cells = array_keys($cs_squads); $squads_save = array_values($cs_squads); cs_sql_update(__FILE__, 'squads', $squads_cells, $squads_save, $squads_id); cs_redirect($cs_lang['changes_done'], 'squads'); }
function cs_cups_addteam2match($cups_id, $teamid, $prevmatchid, $prevmatchround, $prevmatchlb, $matchid, $is_admin) { $return = true; $match = cs_sql_select(__FILE__, 'cupmatches', '*', 'cups_id = ' . $cups_id . ' AND cupmatches_match = ' . $matchid, 0, 0, 1); if (empty($match['cupmatches_id'])) { cs_error(__FILE__, 'ERROR: unknown match #' . $matchid . ' for cup #' . $cups_id, 1); return false; } /* get the other match which is referencing to this match */ $othermatch = cs_sql_select(__FILE__, 'cupmatches', '*', 'cups_id = ' . $cups_id . ' AND (cupmatches_nextmatch = ' . $matchid . ' OR cupmatches_nextmatchlb = ' . $matchid . ') AND cupmatches_match <> ' . $prevmatchid, 0, 0, 1); if (empty($match['cupmatches_id'])) { cs_error(__FILE__, 'ERROR: unknown other match for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); return false; } /* determine on which position this team has to be put */ if ($match['cupmatches_loserbracket'] == 0) { if ($match['cupmatches_match'] != 0) { /* this match is in the winner bracket, so both previous matches should be from the same round */ if ($prevmatchround != $othermatch['cupmatches_round']) { cs_error(__FILE__, 'ERROR: other match for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid . ' not in the same round', 1); $return = false; } /* place the team according to match number */ if ($prevmatchid < $othermatch['cupmatches_match']) { /* place on position 1 */ if ($match['squad1_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING WB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR WB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad1_id'); } else { /* place on position 2 */ if ($match['squad2_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING WB: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR WB: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad2_id'); } } else { /* grand final or 3rd place match */ if ($prevmatchlb == 1 || $othermatch['cupmatches_loserbracket'] == 1) { /* grand final, since one of them comes from a loserbracket */ if ($prevmatchlb == 0) { /* team coming from wb */ /* place on position 1 */ if ($match['squad1_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING WB GF: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR WB GF: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad1_id'); } else { /* team coming from lb */ /* place on position 2 */ if ($match['squad2_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING WB GF: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR WB GF: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad2_id'); } } else { /* 3rd place match */ /* place the team according to match number */ if ($prevmatchid < $othermatch['cupmatches_match']) { /* place on position 1 */ if ($match['squad1_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING WB 3RD: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR WB 3RD: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad1_id'); } else { /* place on position 2 */ if ($match['squad2_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING WB 3RD: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR WB 3RD: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad2_id'); } } } } else { if ($prevmatchlb == 0 || $othermatch['cupmatches_loserbracket'] == 0) { /* one of them comes from the winner bracket, so it's a half round match */ if ($prevmatchlb == 0) { /* team comes from wb */ if ($othermatch['cupmatches_loserbracket'] == 0) { /* both come from wb (first round LB) */ if ($prevmatchid < $othermatch['cupmatches_match']) { /* place on position 1 */ if ($match['squad1_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING LB 1RD: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR LB 1RD: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad1_id'); } else { /* place on position 2 */ if ($match['squad2_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING LB 1RD: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR LB 1RD: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad2_id'); } } else { /* this team comes from wb, place on position 1 */ if ($match['squad1_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING LB FWB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR LB FWB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad1_id'); } } else { /* team comes from lb */ /* place on position 2 */ if ($match['squad2_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING LB FWB: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR LB FWB: position2 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad2_id'); } } else { /* both of them coming from LB */ /* place the team according to match number */ if ($prevmatchid < $othermatch['cupmatches_match']) { /* place on position 1 */ if ($match['squad1_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNIGN LB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR LB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad1_id'); } else { /* place on position 2 */ if ($match['squad2_id'] != CS_CUPS_TEAM_UNKNOWN) { if ($is_admin) { cs_error(__FILE__, 'WARNING LB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } else { cs_error(__FILE__, 'ERROR LB: position1 in use other for match #' . $matchid . ' for cup #' . $cups_id . ' and prevmatch #' . $prevmatchid, 1); } $return = false; } $cells = array('squad2_id'); } } } /* we have determined the position */ $values = array($teamid); cs_sql_update(__FILE__, 'cupmatches', $cells, $values, $match['cupmatches_id']); if (function_exists('cs_datacache_load')) { cs_datacache_clear('cups'); } /* if there were any admin matchedits, fix tree recursively */ cs_cups_autofix($cups_id); return $return; }
$cs_lang = cs_translate('board'); if (!empty($_GET['delall'])) { cs_sql_update(__FILE__, 'board', array('board_order'), array(0), 0, 'board_order != 0'); cs_sql_update(__FILE__, 'categories', array('categories_order'), array(0), 0, "categories_mod = 'board'"); cs_redirect(NULL, 'board', 'sort'); } if (!empty($_GET['board'])) { $board_cells = array('board_order'); $board_save = empty($_GET['order']) ? array(0) : array(cs_sql_escape($_GET['order'])); cs_sql_update(__FILE__, 'board', $board_cells, $board_save, cs_sql_escape($_GET['board'])); cs_redirect(NULL, 'board', 'sort'); } if (!empty($_GET['cat'])) { $board_cells = array('categories_order'); $board_save = empty($_GET['order']) ? array(0) : array(cs_sql_escape($_GET['order'])); cs_sql_update(__FILE__, 'categories', $board_cells, $board_save, cs_sql_escape($_GET['cat'])); cs_redirect(NULL, 'board', 'sort'); } $data['link']['back'] = cs_url('board', 'manage'); $data['link']['delall'] = cs_url('board', 'sort', 'delall=1'); $where = "categories_mod = 'board'"; $select = 'categories_name, categories_id, categories_order'; $cs_categories = cs_sql_select(__FILE__, 'categories', $select, $where, 'categories_order ASC, categories_name ASC', 0, 0); $loop_categories = count($cs_categories); if (!empty($cs_categories)) { for ($run = 0; $run < $loop_categories; $run++) { $data['cat'][$run]['categories_name'] = cs_secure($cs_categories[$run]['categories_name']); $data['cat'][$run]['categories_order'] = cs_secure($cs_categories[$run]['categories_order']); if ($run > 0 and $cs_categories[$run]['categories_order'] - 1 >= $cs_categories[$run - 1]['categories_order']) { $data['cat'][$run]['categories_up'] = cs_html_img('symbols/clansphere/up_arrow_active.png') . ' ' . cs_link($cs_lang['up'], 'board', 'sort', 'cat=' . $cs_categories[$run]['categories_id'] . '&order=' . $cs_categories[$run - 1]['categories_order']); } else {
<?php // ClanSphere 2010 - www.clansphere.net // $Id$ $cs_lang = cs_translate('gbook'); $cs_post = cs_post('where,start,sort'); $cs_get = cs_get('where,start,sort'); $data = array(); if (!empty($_GET['active'])) { cs_sql_update(__FILE__, 'gbook', array('gbook_lock'), array('1'), (int) $_GET['active']); cs_redirectmsg($cs_lang['active_done']); } if (!empty($_GET['deactive'])) { cs_sql_update(__FILE__, 'gbook', array('gbook_lock'), array('0'), (int) $_GET['deactive']); cs_redirectmsg($cs_lang['deactive_done']); } $id = empty($cs_get['where']) ? 0 : $cs_get['where']; if (!empty($cs_post['where'])) { $id = $cs_post['where']; } $start = empty($cs_get['start']) ? 0 : $cs_get['start']; if (!empty($cs_post['start'])) { $start = $cs_post['start']; } $sort = empty($cs_get['sort']) ? 1 : $cs_get['sort']; if (!empty($cs_post['sort'])) { $sort = $cs_post['sort']; } $cs_sort[1] = 'gbk.gbook_time DESC'; $cs_sort[2] = 'gbk.gbook_time ASC'; $cs_sort[3] = 'usr.users_email DESC';
settype($files_id, 'integer'); $mirror_id = isset($_REQUEST['target']) ? $_REQUEST['target'] : 0; settype($mirror_id, 'integer'); $from = 'files'; $select = 'files_count, files_name, files_mirror'; $where = "files_id = '" . $files_id . "'"; $cs_files = cs_sql_select(__FILE__, $from, $select, $where, 0, 0, 1); $files_loop = count($cs_files); if (!empty($files_loop)) { $files_count = $cs_files['files_count']; $files_mirror = $cs_files['files_mirror']; $temp_mirror1 = explode("-----", $files_mirror); $mirror = explode("\n", $temp_mirror1[$mirror_id]); $files_count = $files_count + 1; $files_cells = array('files_count'); $files_save = array($files_count); cs_sql_update(__FILE__, 'files', $files_cells, $files_save, $files_id); if (empty($advanced) and isset($mirror[1])) { header('Location: ' . $mirror[1]); } elseif (!empty($advanced)) { $data['file']['wait'] = cs_html_img('symbols/files/wait.gif', 0, 0, 0); /*print("<meta http-equiv=refresh content='3; URL=$downloadfile'>"); header("Content-disposition: attachment; filename = $downloadfile"); header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Pragma: no-cache"); header("Expires: 0");*/ } } else { include_once 'mods/errors/404.php'; }
} else { $cs_maps['games_id'] = (int) $_POST['games_id']; $cs_maps['maps_name'] = $_POST['maps_name']; $cs_maps['server_name'] = $_POST['server_name']; $cs_maps['maps_text'] = $_POST['maps_text']; $maps_id = (int) $_POST['maps_id']; if (empty($_POST['pic_del']) and empty($files_gl['picture']['tmp_name'])) { $cells = array_keys($cs_maps); $values = array_values($cs_maps); cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id); } elseif (isset($_POST['pic_del']) and empty($files_gl['picture']['tmp_name'])) { $select = cs_sql_select(__FILE__, 'maps', 'maps_picture', 'maps_id = \'' . $maps_id . '\''); cs_unlink('maps', $select['maps_picture']); $cs_maps['maps_picture'] = ''; $cells = array_keys($cs_maps); $values = array_values($cs_maps); cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id); } else { $select = cs_sql_select(__FILE__, 'maps', 'maps_picture', 'maps_id = \'' . $maps_id . '\''); $url = 'uploads/maps/' . $select['maps_picture']; cs_unlink('maps', $select['maps_picture']); $filename = 'picture-' . $maps_id . '.' . $extension; cs_upload('maps', $filename, $files_gl['picture']['tmp_name']); $cs_maps['maps_picture'] = $filename; $cells = array_keys($cs_maps); $values = array_values($cs_maps); cs_sql_update(__FILE__, 'maps', $cells, $values, $maps_id); } cs_redirect($cs_lang['changes_done'], 'maps'); } }
$extension = strlen(strrchr($file, ".")); $name = strlen($file); $ext = substr($file, $name - $extension + 1, $name); echo 'uploads/board/files/' . $files_id[$run2]['boardfiles_id'] . '.' . $ext . cs_html_br(1); cs_unlink('board', $files_id[$run2]['boardfiles_id'] . '.' . $ext, 'files'); } // $query = 'DELETE FROM {pre}_boardfiles WHERE threads_id= ' . $thread_id; // cs_sql_query(__FILE__,$query); cs_sql_delete(__FILE__, 'boardfiles', $thread_id, 'threads_id'); } } else { $cs_board_id = $cs_board['board_id']; // $query = "UPDATE {pre}_threads SET board_id='$cs_board_id' "; // $query .= "WHERE board_id = '$board_id'"; // cs_sql_query(__FILE__,$query); cs_sql_update(__FILE__, 'threads', array('board_id'), array($cs_board_id), 0, 'board_id = ' . $board_id); # Update board entry to get correct threads and comments count include_once 'mods/board/repair.php'; cs_board_threads($cs_board_id); cs_board_last($cs_board_id); cs_board_comments($cs_board_id); } cs_redirect($cs_lang['del_true'], 'board'); } if (isset($_POST['cancel'])) { $board_form = 0; cs_redirect($cs_lang['del_false'], 'board'); } if (!empty($board_form)) { $data['action']['form'] = cs_url('board', 'remove'); $data['lang']['body'] = sprintf($cs_lang['del_rly'], $board_id);