0, 'chat_write' => 1, 'chat_show' => 2, 'smilie' => 3); var $keyoptions = array('fold' => 0, 'sound' => 1, 'chatsound' => 2); var $perm; var $room = array(); function url($params = false, $page = 'poker', $sid = false) { global $phpbb_root_path, $phpEx, $relativ_root_path; $phpbb_root_path = (!isset($relativ_root_path)) ? $phpbb_root_path : $relativ_root_path; if ($params) { if ((strpos($params, 'img=') !== false) || (strpos($params, 'swf=') !== false)) { return "{$phpbb_root_path}{$page}.{$phpEx}?{$params}"; } } return append_sid($phpbb_root_path . $page . '.' . $phpEx, $params, true, $sid); } function get_img($image, $type = '', $lang = false) { global $phpbb_root_path, $user; global $poker_config, $relativ_root_path; $phpbb_root_path = (!isset($relativ_root_path)) ? $phpbb_root_path : $relativ_root_path; if ($poker_config['protect']) { $sn = ($type == 'style') ? $this->room['style_name'] : false; $image_path = $this->url(($type != '' ? "p={$type}&" : '') . ($sn ? "s={$sn}&" : '') . ($lang ? "l={$user->data['user_lang']}&" : '') . "img={$image}"); } else { switch ($type) { case 'card': $path = 'cards/' . ($lang ? $user->data['user_lang'] . '/' : ''); break; case 'style': $path = 'styles/' . $this->room['style_name'] . '/' . ($lang ? $user->data['user_lang'] . '/' : ''); break; default: $path = ''; break; } $image_path = $phpbb_root_path . 'poker/images/' . $path . $image; } return $image_path; } function time_format($secs, $wait = false) { if($secs <= 0) { return 0; } if ($wait === true) { $mins = ($secs > 59) ? intval($secs / 60) : 0; if ($secs > 59) { $mins = ($mins < 10) ? '0'.$mins : $mins; $secs = $secs - ($mins * 60); $secs = ($secs < 10) ? ':0'.$secs : ':'.$secs; $output = $mins.$secs; } else { $output = ($secs < 10) ? '00:0'.$secs : '00:'.$secs; } return $output; } else { global $user; $output = ''; $time_array = array( 'year' => 60 * 60 * 24 * 365, 'month' => 60 * 60 * 24 * 30, 'week' => 60 * 60 * 24 * 7, 'day' => 60 * 60 * 24, 'hour' => 60 * 60, 'minute' => 60, 'second' => 0 ); foreach ($time_array as $key => $value) { $item = ($value) ? intval(intval($secs) / $value) : intval($secs); if ($item > 0) { $secs = $secs - ($item * $value); $output .= ' ' . $item . ' ' . (($item > 1) ? $user->lang['POKER_TIME_' . strtoupper($key) . 'S'] : $user->lang['POKER_TIME_' . strtoupper($key)]); } } return $output; } } function lang_path() { global $user, $config, $phpbb_root_path; $lang_path = $user->data['user_lang']; if (!file_exists($phpbb_root_path . 'poker/images/cards/' . $lang_path . '/fd.png')) { $lang_path = $config['default_lang']; if (!file_exists($phpbb_root_path . 'poker/images/cards/' . $lang_path . '/fd.png')) { trigger_error('POKER_NO_LANG_PATH', E_USER_ERROR); } } return $lang_path; } function number_format($num, $bet = false) { $num = round($num, 2); $decimals = explode('.', $num); if (isset($decimals[1])) { $decimals = strlen(rtrim($decimals[1], '0')); } else { $decimals = 0; } return number_format($num, $decimals, '.', ((!$bet) ? ',' : '')); } function optionget($mode, $key, $c = 0) { if ($mode == 'room') { $var = $this->room['p'.(($c) ? $c : $this->own_chair).'options']; } else { global $user; $var = $user->data['U_options']; } return ($var & 1 << $this->keyoptions[$key]) ? true : false; } function optionset($mode, $key, $value, $c = 0) { if ($mode == 'room') { $var = $this->room['p'.(($c) ? $c : $this->own_chair).'options']; } else { global $user; $var = (!isset($user->data['U_options'])) ? 0 : $user->data['U_options']; } if ($value && !($var & 1 << $this->keyoptions[$key])) { $var += 1 << $this->keyoptions[$key]; } else if (!$value && ($var & 1 << $this->keyoptions[$key])) { $var -= 1 << $this->keyoptions[$key]; } else { return; } if ($mode == 'room') { $this->room['p'.(($c) ? $c : $this->own_chair).'options'] = $var; } else { $user->data['U_options'] = $var; } } function get_username_string($mode, $user_id, $username, $user_colour) { global $poker_config; if ($poker_config['stats_enable']) { $username = get_username_string($mode, $user_id, $username, $user_colour, false, $this->url('mode=stats')); } else { $username = get_username_string($mode, $user_id, $username, $user_colour); } return $username; } function user_link($user_id, $value, $add_title = false) { global $user, $poker_config; if ($poker_config['stats_enable']) { $user_url = $this->url("mode=stats&u={$user_id}"); $title = 'POKER_USER_STATISTICS'; } else { global $phpbb_root_path, $phpEx, $relativ_root_path; $phpbb_root_path = (!isset($relativ_root_path)) ? $phpbb_root_path : $relativ_root_path; $user_url = append_sid("{$phpbb_root_path}memberlist.{$phpEx}" , 'mode=viewprofile&u='. $user_id); $title = 'VIEWING_MEMBER_PROFILE'; } return ($value == 'url') ? $user_url : (($value != '') ? '' . $value . '' : false); } function load_userdata(&$data, $user_id = 0, $select = '') { global $db, $user; $user_id = (int) (($user_id) ? $user_id : $user->data['user_id']); if (!$user_id || $user_id == ANONYMOUS) { return; } $sql = 'SELECT ' . (($select != '') ? $select : '*') . ' FROM ' . POKER_USERS_TABLE . ' WHERE U_user_id = ' . $user_id; $result = $db->sql_query($sql); $userdata = $db->sql_fetchrow($result); $db->sql_freeresult($result); if (!$db->sql_affectedrows()) { // default = 7 $userdata = array( 'U_user_id' => $user_id, 'U_token' => 0, 'U_start_time' => 0, 'U_lastime' => 0, 'U_options' => 7, 'N_sit' => 0, 'N_play' => 0, 'N_win' => 0, 'N_time' => 0, 'N_call' => 0, 'N_check' => 0, 'N_allin' => 0, 'N_fold' => 0, 'N_raise' => 0, 'V_sit' => 0, 'V_play' => 0, 'V_win' => 0, 'V_time' => 0, 'V_call' => 0, 'V_check' => 0, 'V_allin' => 0, 'V_fold' => 0, 'V_raise' => 0 ); $db->sql_query('INSERT INTO ' . POKER_USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $userdata)); } $data = array_merge($data, $userdata); } function id($mode, $id = 0) { if ($mode == 'r' && !$id) { $id = (int) $this->room['room_id']; } else if (in_array($mode, array('u', 's')) && !$id) { global $user; $id = ($mode == 's') ? $user->session_id : (int) $user->data['user_id']; } else { $id = (int) $id; } return $id; } function blind_token($tr = false) { $blind = array(); $value = (float) $this->room['room_limit'] / 100; switch ($this->room['room_type']) { case POKER_ROOM_TOURNAMENT: if ($tr) { // majd a folyamatos emelest meg be kell epiteni !!! $blind['small'] = ((50 * $value) / 10); $blind['big'] = ((75 * $value) / 10); } else { $blind['small'] = ((50 * $value) / 10) . '-' . (((50 * $value) / 10) * 5); $blind['big'] = ((75 * $value) / 10) . '-' . (((75 * $value) / 10) * 5); } break; case POKER_ROOM_PRACTICE: $blind['small'] = $value; $blind['big'] = ($value * 2); break; default: $blind['small'] = ((25 * $value) / 10); $blind['big'] = ((50 * $value) / 10); break; } return $blind; } function auth() { global $db, $user; $sql = 'SELECT auth FROM ' . POKER_AUTH_TABLE . ' WHERE user_id = ' . (int) $user->data['user_id']; $result = $db->sql_query($sql); if (!($user_auth = $db->sql_fetchrow($result))) { // default = 14 $user_auth = array( 'user_id' => (int) $user->data['user_id'], 'auth' => 14, ); $db->sql_query('INSERT INTO ' . POKER_AUTH_TABLE . ' ' . $db->sql_build_array('INSERT', $user_auth)); } $db->sql_freeresult($result); $this->perm = $user_auth['auth']; } function generate_token($token, $color = false) { $tn = ($color) ? '$' . $this->number_format($token) . '' : '$' . $this->number_format($token); return $tn; } function acl_get($key) { $var = $this->perm; return ($var & 1 << $this->authoptions[$key]) ? true : false; } } ?>assign_vars(array( 'S_IN_POKER' => (defined('IN_PHPBB_POKER')) ? true : false, 'T_POKER_JS_PATH' => "{$phpbb_root_path}poker/js" )); } function index() { global $db, $user, $template, $phpbb_root_path, $phpEx; global $poker_config, $poker_cache; // jatek-vilag.com navlinks disabled if (defined('IN_JATEK_VILAG')) { $template->assign_block_vars('navlinks', array( 'FORUM_NAME' => $user->lang['POKER_INDEX'], 'U_VIEW_FORUM' => $this->url() )); } $this->load_userdata($user->data); $top_users = $poker_cache->obtain_poker_top_users(); if (!function_exists('get_user_avatar') || !function_exists('get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } if ($top_users) { $stats_full = $poker_cache->obtain_poker_stats(); $ossz = 0; $x = 1; $leaders_img = array( 1 => $this->get_img('1st.gif'), 2 => $this->get_img('2nd.gif'), 3 => $this->get_img('3rd.gif') ); foreach ($top_users as $row) { $wins_rate = $this->number_format(($row['N_win'] / $row['N_play']) * 100); if ($wins_rate == $ossz) { $x--; } $template->assign_block_vars('top', array( 'POK_USERNAME' => $this->get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'POK_WINS' => $wins_rate . '%', 'POK_C_GIF' => ($x <= 3) ? $leaders_img[$x] : $this->get_img('trophy.gif'), 'POK_AVATAR' => ($user->optionget('viewavatars')) ? $this->user_link($row['user_id'], str_replace('/>', 'style="vertical-align: middle;" />', get_user_avatar($row['user_avatar'], $row['user_avatar_type'], '30', '30', (($poker_config['stats_enable']) ? 'POKER_USER_STATISTICS' : 'VIEWING_MEMBER_PROFILE')))) : false, 'POK_GIF_IMAGE_ALT' => sprintf($user->lang['POKER_PLACE'], $x), 'ROWS' => $x )); $x++; $ossz = $wins_rate; } $total_stats = sprintf($user->lang['POKER_TOTAL_CHAMP'], $stats_full['total_users'], $stats_full['total_plays'], $this->time_format($stats_full['total_times']), $this->generate_token($stats_full['token'])); } $avatar = ($user->optionget('viewavatars')) ? get_user_avatar($user->data['user_avatar'], $user->data['user_avatar_type'], $user->data['user_avatar_width'], $user->data['user_avatar_height']) : false; $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($user->data['user_rank'], $user->data['user_posts'], $rank_title, $rank_img, $rank_img_src); $template->assign_vars(array( 'U_POKER' => $this->url(), 'POKER_USERNAME' => $this->get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'POKER_AVATAR' => $avatar, 'POKER_USER_RANK' => $rank_title, 'POKER_RANK_IMAGE' => $rank_img, 'POKER_RANK_IMAGE_SRC' => $rank_img_src, 'POKER_TOTAL_PLAYED' => ($top_users) ? $total_stats : false )); if (!empty($user->data['is_registered'])) { $n_plays = (int) $user->data['N_play']; $n_wins = (int) $user->data['N_win']; $v_plays = (int) $user->data['V_play']; $v_wins = (int) $user->data['V_win']; $n_times = (int) $user->data['N_time']; $v_times = (int) $user->data['V_time']; $template->assign_vars(array( 'POKER_NPLAY' => sprintf($user->lang['POKER_PLAYED_NORM'] , $n_plays), 'POKER_NWINS' => sprintf($user->lang['POKER_NWINS'] , $n_wins), 'POKER_NLOSE' => sprintf($user->lang['POKER_NLOSE'] , ($n_plays - $n_wins)), 'POKER_VPLAY' => sprintf($user->lang['POKER_PLAYED_COMP'] , $v_plays), 'POKER_VWINS' => sprintf($user->lang['POKER_VWINS'] , $v_wins), 'POKER_VLOSE' => sprintf($user->lang['POKER_VLOSE'] , ($v_plays - $v_wins)), 'POKER_NTIME' => sprintf($user->lang['POKER_PLAY_NTIME'] , ($n_times) ? $this->time_format($n_times) : 0), 'POKER_VTIME' => sprintf($user->lang['POKER_PLAY_VTIME'] , ($v_times) ? $this->time_format($v_times) : 0), 'POKER_NWINS_RATE' => ($n_plays) ? $this->number_format((($n_wins / $n_plays) * 100)).'%' : '0%', 'POKER_VWINS_RATE' => ($v_plays) ? $this->number_format((($v_wins / $v_plays) * 100)).'%' : '0%', 'POKER_USER_TOKEN' => sprintf($user->lang['POKER_BALANCE'] , $this->generate_token($user->data['U_token'])), )); } $sql = "SELECT room_id, room_jackpot, nolimit, movetimer, p1id, p2id, p3id, p4id, p5id, p6id, p7id, p8id, p9id, p10id, p1tt, p2tt, p3tt, p4tt, p5tt, p6tt, p7tt, p8tt, p9tt, p10tt, room_name, room_limit , room_type, hand, room_low FROM ".POKER_ROOM_TABLE." WHERE room_active = 1 ORDER BY room_type ASC, room_low ASC, room_limit ASC, room_name DESC"; $result = $db->sql_query($sql); $room_type = ''; $poker_room_load = false; $act_time = (time() - $poker_config['disconnect']); while($this->room = $db->sql_fetchrow($result)) { $all_user = 0; for ($x = 1; $x <= 10; $x++) { if ((int) $this->room['p'.$x.'id'] === (int) $user->data['user_id']) { $poker_room_load = true; $room_id = (int) $this->room['room_id']; } if ($this->room['p'.$x.'id'] && $act_time < $this->room['p'.$x.'tt']) { $all_user++; } } $blind = $this->blind_token(); $room_name = (!empty($user->lang[$this->room['room_name']])) ? $user->lang[$this->room['room_name']] : $this->room['room_name']; $template->assign_block_vars('rooms', array( 'S_LOBBY' => ($this->room['room_type'] != $room_type) ? true : false, 'S_ROOM_LAST' => ($room_type && $this->room['room_type'] != $room_type) ? true : false, 'ROOM_TYPE' => $user->lang[(($this->room['room_type'] == POKER_ROOM_TOURNAMENT) ? 'POKER_TOURNAMENT_ROOMS' : (($this->room['room_type'] == POKER_ROOM_PRACTICE) ? 'POKER_PRACTICE_ROOMS' : 'POKER_NORMAL_ROOMS'))], 'ROOM_NAME' => (!empty($user->data['is_registered'])) ? '' . $room_name . '' : $room_name, 'ROOM_USERS' => $all_user.'/10', 'ROOM_TRATE' => (($this->room['room_type'] == POKER_ROOM_TOURNAMENT) ? $this->generate_token($this->room['room_limit']) : $this->generate_token($this->room['room_low']) . '/' . $this->generate_token($this->room['room_limit'])), 'ROOM_LIMIT' => $user->lang['POKER_ROOM_LIMIT_' . (($this->room['nolimit']) ? 'NO' : 'YES')], 'ROOM_SMALL' => $this->generate_token($blind['small']), 'ROOM_BIG' => $this->generate_token($blind['big']), 'ROOM_TIME' => $this->room['movetimer'], 'ROOM_JACKPOT' => ($this->room['room_type'] == POKER_ROOM_STANDARD) ? $this->generate_token($this->room['room_jackpot']) : '-', 'ROOM_STATUS' => $user->lang[(($this->room['hand'] && $all_user)? 'POKER_PLAYED' : 'POKER_NO_PLAYED')] )); $room_type = $this->room['room_type']; } $db->sql_freeresult($result); if ($poker_config['auto_load'] && $poker_room_load === true) { $template->assign_var('AUTO_ROOM_ID', $room_id); return; } if ($poker_config['online_enable']) { $this->online_users(); } } function online_users() { global $poker_config; if (!$poker_config['enable']) { return; } global $db, $user, $template, $phpbb_root_path; $act_time = (time() - $poker_config['disconnect']); $sql = 'SELECT r.room_id, r.room_name, r.room_type, r.room_low, u.user_id, u.username, u.username_clean, u.user_colour, u.user_avatar, u.user_avatar_type FROM ' . POKER_ROOM_TABLE . ' r, ' . USERS_TABLE . ' u WHERE r.room_active = 1 AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') AND ((r.p1id = u.user_id AND r.p1tt > ' . $act_time . ') OR (r.p2id = u.user_id AND r.p2tt > ' . $act_time . ') OR (r.p3id = u.user_id AND r.p3tt > ' . $act_time . ') OR (r.p4id = u.user_id AND r.p4tt > ' . $act_time . ') OR (r.p5id = u.user_id AND r.p5tt > ' . $act_time . ') OR (r.p6id = u.user_id AND r.p6tt > ' . $act_time . ') OR (r.p7id = u.user_id AND r.p7tt > ' . $act_time . ') OR (r.p8id = u.user_id AND r.p8tt > ' . $act_time . ') OR (r.p9id = u.user_id AND r.p9tt > ' . $act_time . ') OR (r.p10id = u.user_id AND r.p10tt > ' . $act_time . ')) ORDER BY r.room_type, r.room_low, u.username_clean ASC'; $rooms = array(); $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { $username = $this->get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); $title = ($poker_config['stats_enable']) ? 'POKER_USER_STATISTICS' : 'VIEWING_MEMBER_PROFILE'; $user_avatar = ($user->optionget('viewavatars')) ? $this->user_link($row['user_id'], str_replace('/>', 'style="vertical-align: middle;" />', get_user_avatar($row['user_avatar'], $row['user_avatar_type'], '20', '20', $title))) : false; $user_avatar = (!$user_avatar && $user->optionget('viewavatars')) ? $this->user_link($row['user_id'], str_replace('/>', 'style="vertical-align: middle;" />', '' . $title . '')) : $user_avatar; if (!isset($rooms[$row['room_id']])) { $room_name = (!empty($user->lang[$row['room_name']])) ? $user->lang[$row['room_name']] : $row['room_name']; $user_name[$row['room_id']] = (($user_avatar) ? $user_avatar . '-' : '') . $username; $rooms[$row['room_id']] = (!empty($user->data['is_registered'])) ? '' . $room_name . '' : $room_name; } else { $user_name[$row['room_id']] .= ", " . (($user_avatar) ? $user_avatar . '-' : '') . $username; } } $db->sql_freeresult($result); foreach ($rooms as $id => $name) { $template->assign_block_vars('poker_online', array( 'P_ROOMNAME' => $name, 'P_USERNAME' => $user_name[$id] )); } } } ?>
Fatal error: Class 'poker_index' not found in /public_html/forum/poker/includes/common.php on line 53