';
return $links;
}
#============================ Function Altered In .9 Thanks To alphalogic ====
function CheckGameImages($game_name, $proper_name)
{
global $lang, $board_config, $db, $userdata, $table_prefix;
$sub_link = "./". $board_config['ina_default_g_path'] . "/" . $game_name . "/" . $game_name . ".gif";
$no_sub_link = "./" . $board_config['ina_default_g_path'] . "/" . $game_name . ".gif";
if ( (file_exists($sub_link) == 0) && (file_exists($no_sub_link) == 0) )
$game_link = $lang['game_link_play'] .'' . $proper_name . '.';
if (file_exists($sub_link))
$game_link = '';
if (file_exists($no_sub_link))
$game_link = '';
return $game_link;
}
function TrophyKingRankCheck()
{
global $lang, $board_config, $db;
#==== If switched on, do some checks
if ($board_config['ina_use_trophy'])
{
$q = "SELECT *
FROM ". USERS_TABLE ."
ORDER BY user_trophies DESC
LIMIT 1";
$r = $db->sql_query($q);
$row = $db->sql_fetchrow($r);
$king = $row['user_id'];
#==== If the current holder is not the one the config table shows, change it accordingly
if ($king != $board_config['ina_trophy_king'])
{
if ($king != ANONYMOUS)
{
$q = "UPDATE ". CONFIG_TABLE ."
SET config_value = '". $king ."'
WHERE config_name = 'ina_trophy_king'";
$db->sql_query($q);
}
}
}
#==== If it was switched off, do some checks
if (!$board_config['ina_use_trophy'])
{
#==== If off & the current trophy king still has the trophy rank, reset it
if ($board_config['ina_trophy_king'])
{
$q = "UPDATE ". CONFIG_TABLE ."
SET config_value = '0'
WHERE config_name = 'ina_trophy_king'";
$db->sql_query($q);
}
}
}
function Gamble($score, $id)
{
global $table_prefix, $db, $userdata;
$q = "SELECT *
FROM ". INA_GAMBLE_GAMES ."
WHERE game_id = '". $id ."' AND
sender_id = '". $userdata['user_id'] ."' AND
sender_playing = '1'";
$r = $db->sql_query($q);
$row = $db->sql_fetchrow($r);
$exists = $row['sender_score'];
if ($exists < '1')
{
$q = "UPDATE ". INA_GAMBLE_GAMES ."
SET sender_score = '". $score ."'
WHERE game_id = '". $id ."' AND
sender_id = '". $userdata['user_id'] ."' AND
sender_playing = '1'";
$db->sql_query($q);
}
$q = "SELECT *
FROM ". INA_GAMBLE_GAMES ."
WHERE game_id = '$id' AND
reciever_id = '". $userdata['user_id'] ."' AND
reciever_playing = '1'";
$r = $db->sql_query($q);
$row = $db->sql_fetchrow($r);
$exists = $row['reciever_score'];
if ($exists < '1')
{
$q = "UPDATE ". INA_GAMBLE_GAMES ."
SET reciever_score = '". $score ."'
WHERE game_id = '". $id ."' AND
reciever_id = '". $userdata['user_id'] ."' AND
reciever_playing = '1'";
$db->sql_query($q);
}
return;
}
Function UpdateUsersPage($user, $page)
{
global $db, $userdata;
if ($userdata['ina_last_visit_page'] != $page)
{
$q = "UPDATE ". USERS_TABLE ."
SET ina_last_visit_page = '". $page ."'
WHERE user_id = '". $user ."'";
$db->sql_query($q);
}
return;
}
function CheckGamesPerDayMax($user, $username)
{
global $board_config, $db, $lang, $table_prefix;
if (!$board_config['ina_use_max_games_per_day'])
{
$q = "UPDATE ". CONFIG_TABLE ."
SET config_value = '". date("Y-m-d") ."'
WHERE config_name = 'ina_max_games_per_day_date'";
$db->sql_query($q);
}
if ($board_config['ina_use_max_games_per_day'])
{
$q = "SELECT ina_games_today
FROM ". USERS_TABLE ."
WHERE user_id = '". $user ."'";
$r = $db->sql_query($q);
$row = $db->sql_fetchrow($r);
if ($row['ina_games_today'] > $board_config['ina_max_games_per_day'])
message_die(GENERAL_ERROR, str_replace("%U%", $username, $lang['max_games_played_error']), $lang['error_message']);
if ($row['ina_games_today'] < $board_config['ina_max_games_per_day'])
{
$q = "UPDATE ". USERS_TABLE ."
SET ina_games_today = ina_games_today + 1
WHERE user_id = '". $user ."'";
$db->sql_query($q);
}
}
if ($board_config['ina_use_max_games_per_day'] <> date("Y-m-d"))
{
$q = "UPDATE ". USERS_TABLE ."
SET ina_games_today = '0'
WHERE user_id > '0'";
$db->sql_query($q);
$q = "UPDATE ". CONFIG_TABLE ."
SET config_value = '". date("Y-m-d") ."'
WHERE config_name = 'ina_max_games_per_day_date'";
$db->sql_query($q);
}
return;
}
function InsertPlayingGame($user, $game_id)
{
global $db;
$q = "UPDATE ". USERS_TABLE ."
SET ina_game_playing = '". $game_id ."'
WHERE user_id = '". $user ."'";
$db->sql_query($q);
return;
}
function RemovePlayingGame($user)
{
global $db;
$q = "UPDATE ". USERS_TABLE ."
SET ina_game_playing = '0'
WHERE user_id = '". $user ."'";
$r = $db->sql_query($q);
return;
}
function CleanInaSessions($expired)
{
global $table_prefix, $db;
$q = "DELETE FROM ". INA_SESSIONS ."
WHERE playing_time < '". $expired ."'";
$db->sql_query($q);
return;
}
function FormatScores($score)
{
$score_check = explode(".", $score);
$score_check_1 = number_format($score_check[0]);
$score_check_2 = round($score_check[1], 5);
if ($score_check_2 == '00')
$new_score = $score_check_1;
else
$new_score = $score_check_1 .'.'. $score_check_2;
return $new_score;
}
function PopupImages($game_name)
{
global $lang, $board_config, $db, $userdata, $table_prefix;
$q = "SELECT proper_name
FROM ". iNA_GAMES ."
WHERE game_name = '". $game_name ."'";
$r = $db->sql_query($q);
$row = $db->sql_fetchrow($r);
$sub_link = "./". $board_config['ina_default_g_path'] ."/". $game_name ."/". $game_name .".gif";
$no_sub_link = "./". $board_config['ina_default_g_path'] ."/". $game_name .".gif";
if ( (file_exists($sub_link) == 0) && (file_exists($no_sub_link) == 0) )
$game_link = '' . $row['proper_name'] .".";
if (file_exists($sub_link))
$game_link = '';
if (file_exists($no_sub_link))
$game_link = '';
return $game_link;
}
function VersionCheck()
{
global $board_config, $userdata, $phpEx;
$version = '1.1.0';
$ver_check = $board_config['ina_version'];
if(!$ver_check) $this_version = "Unknown";
if($ver_check) $this_version = "v". $ver_check;
$error_msg = "
Sorry, the games are currently offline until the admin upgrades/installs the current version. The
current version is ". $version .". Your version is ". $this_version .".";
if($userdata['user_level'] == ADMIN)
{
$msg_switch = 'Since you are an admin, please goto your admin panel, you can get there by clicking here. After you do that, please look on the left for Amod+ Admin and under it you will see a link, Db Adjustments. If this is a fresh install for you, please click Install Activity Mod Plus. If you are upgrading from a previous version, please look in the second section, and in the drop down menu and select what you are upgrading from. You are upgrading to ' . $version . '. After doing that, this error will go away and you will be allowed to play games.';
}
else
{
$msg_switch = "Since you are not an admin, and can not fix this, please link this page to an admin so they can get it fixed.";
}
$error_div = "
Instructions
";
if ($board_config['ina_version'] != $version)
message_die(CRITICAL_ERROR, $error_msg . $error_div . $msg_switch);
}
function UpdateUsersGames($user)
{
global $db, $userdata;
$q = "UPDATE ". USERS_TABLE ."
SET ina_games_played = ina_games_played + '1'
WHERE user_id = '". $user ."'";
$r = $db->sql_query($q);
return;
}
function DeletedAMPUser($user_id, $username)
{
global $db;
#====== Comments Table
$q = "DELETE FROM ". INA_TROPHY_COMMENTS ."
WHERE player = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Trophy Table, Gonna Be A Mess!
#===== Get All Games They Have A Trophy For
$q = "SELECT *
FROM ". INA_TROPHY ."
WHERE player = '". $user_id ."'";
$r = $db->sql_query($q);
$trophy_data = $db->sql_fetchrowset($r);
$trophy_count = $db->sql_numrows($r);
#===== Get All Games In The Database
$q = "SELECT *
FROM ". iNA_GAMES ."";
$r = $db->sql_query($q);
$game_data = $db->sql_fetchrowset($r);
$game_count = $db->sql_numrows($r);
#===== Get All Max Scores & Min In The Database
$q = "SELECT MAX(score) AS highest, MIN(score) AS lowest, game_name, player, date
FROM ". iNA_SCORES ."
GROUP BY game_id";
$r = $db->sql_query($q);
$score_data = $db->sql_fetchrowset($r);
$score_count = $db->sql_numrows($r);
for($a = 0; $a <= $trophy_count; $a++)
{
for($b = 0; $b <= $game_count; $b++)
{
if($trophy_data[$a]['game_name'] == $game_data[$b]['game_name'])
{
for($c = 0; $c <= $score_count; $c++)
{
if(!$game_data[$b]['reverse_list'])
{
#===== Normal Ordered Scores
$q = "UPDATE ". INA_TROPHY ."
SET player = '". $score_data[$c]['player'] ."', score = '". $score_data[$c]['highest'] ."', date = '". $score_data[$c]['date'] ."'
WHERE game_name = '". $game_data[$b]['game_name'] ."'";
$r = $db->sql_query($q);
}
else
{
#===== Reverse Ordered Scores
$q = "UPDATE ". INA_TROPHY ."
SET player = '". $score_data[$c]['player'] ."', score = '". $score_data[$c]['lowest'] ."', date = '". $score_data[$c]['date'] ."'
WHERE game_name = '". $game_data[$b]['game_name'] ."'";
$r = $db->sql_query($q);
}
}
}
}
}
#====== Scores Table
$q = "DELETE FROM ". iNA_SCORES ."
WHERE player = '". $username ."'";
$r = $db->sql_query($q);
#====== Rating Table
$q = "DELETE FROM ". INA_RATINGS ."
WHERE player = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Challenge Tracker Table
$q = "DELETE FROM ". INA_CHALLENGE ."
WHERE user = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Challenge Data Table
$q = "DELETE FROM ". INA_CHALLENGE_USERS ."
WHERE user_from = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Last Game Played Table
$q = "DELETE FROM ". INA_LAST_GAME ."
WHERE user_id = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Sessions Table
$q = "DELETE FROM ". INA_SESSIONS ."
WHERE playing_id = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Favorites Table
$q = "DELETE FROM ". INA_FAVORITES ."
WHERE user = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Ban Table
$q = "DELETE FROM ". INA_BAN ."
WHERE id = '". $user_id ."'";
$r = $db->sql_query($q);
$q = "DELETE FROM ". INA_BAN ."
WHERE username = '". $username ."'";
$r = $db->sql_query($q);
#====== Gamble In Progress Table
$q = "DELETE FROM ". INA_GAMBLE_GAMES ."
WHERE player = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Gamble Table
$q = "DELETE FROM ". INA_GAMBLE ."
WHERE player = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Trophy Comments Table
$q = "DELETE FROM ". INA_TROPHY_COMMENTS ."
WHERE player = '". $user_id ."'";
$r = $db->sql_query($q);
#====== Cheat Fix Table
$q = "DELETE FROM ". INA_CHEAT ."
WHERE user = '". $user_id ."'";
$r = $db->sql_query($q);
}
function HallOfFamePass($user, $score, $game, $order)
{
global $db, $table_prefix;
$q = "SELECT *
FROM ". INA_HOF ."
WHERE game_id = '". $game ."'";
$r = $db->sql_query($q);
$data = $db->sql_fetchrow($r);
$cur_s = $data['current_score'];
$cur_d = $data['current_date'];
$cur_u = $data['current_user_id'];
$q = "UPDATE ". INA_HOF ."
SET current_user_id = '". $user ."', current_score = '". $score ."', `current_date` = '". time() ."', old_user_id = '". $cur_u ."', old_score = '". $cur_s ."', `old_date` = '". $cur_d ."'
WHERE game_id = '". $game ."'";
if ( ($score > $cur_s) && (!$order) )
$db->sql_query($q);
if ( ($score < $cur_s) && ($order == '1') )
$db->sql_query($q);
if (!$data['current_score'] && !$data['current_date'] && !$data['current_user_id'])
{
$q = "INSERT INTO ". INA_HOF ."
(current_user_id, current_score, `current_date`, game_id)
VALUES
('". $user ."', '". $score ."', '". time() ."', '". $game ."')";
if (!$db->sql_query($q))
message_die(GENERAL_ERROR, 'Error inserting HOF score', "", __LINE__, __FILE__, $q);
}
}
function AddJackpot($game_id, $game_cost)
{
global $db;
if ($game_cost > '0')
{
$q = "UPDATE ". iNA_GAMES ."
SET jackpot = jackpot + ". $game_cost ."
WHERE game_id = '". $game_id ."'";
$db->sql_query($q);
}
}
function ResetJackpot($game_id)
{
global $db, $board_config;
$q = "UPDATE ". iNA_GAMES ."
SET jackpot = '". $board_config['ina_jackpot_pool'] ."'
WHERE game_id = '". $game_id ."'";
$db->sql_query($q);
}
function GameArrayLink($id, $parent, $popup, $win_width, $win_height, $type, $links)
{
global $lang, $userdata, $phpEx;
$link = '';
$switch = '';
$switch = $type;
if (eregi('%SEP%', $switch))
$switch = explode('%SEP%', $switch);
if ( ($parent) && ($switch == '1') )
$link .= ' '. $lang['same_window'] .' ';
if ( ($popup) && ($switch == '1') )
$link .= ' '. $lang['new_window'] .'';
if ( ($parent) && ($switch == '2') )
$link = '';
if ( ($popup) && ($switch == '2') )
$link = '';
if ( ($popup) && ($parent) && ($switch == '2') )
$link = '';
if ( ($parent) && ($switch[0] == 3) )
$link = ''. $switch[1] .'';
if ( ($popup) && ($switch[0] == 3) )
$link = ''. $switch[1] .'';
if ( ($popup) && ($parent) && ($switch[0] == 3) )
$link = ''. $switch[1] .'';
$any_links = explode(';', $links);
for ($x = 0; $x < count($any_links); $x++)
{
if ($any_links[$x])
{
$split_link = explode(',', $any_links[$x]);
$link .= ' '. trim(rtrim($split_link[1])) .'';
}
}
return $link;
}
function GameSingleLink($id, $parent, $popup, $win_width, $win_height, $page, $one, $two, $three, $links)
{
global $userdata, $phpEx;
$link = '';
if ( ($parent) && ($popup) )
$link = str_replace($one, '' . $two . '', $three);
elseif (($parent) && (!$popup))
$link = str_replace($one, '' . $two . '', $three);
else
$link = str_replace($one, ''. $two .'', $three);
$any_links = explode(';', $links);
for ($x = 0; $x < count($any_links); $x++)
{
if ($any_links[$x])
{
$split_link = explode(',', $any_links[$x]);
$link .= ' ·'. trim(rtrim($split_link[1])) .'';
}
}
return $link;
}
function GamesPassLength($page)
{
global $userdata, $board_config, $lang, $phpEx, $db;
#==== Drop the users pass 1 day, every day they play.
if (!$page)
{
if ( ($userdata['ina_games_pass_day'] != date('Y-m-d')) && ($userdata['ina_games_pass'] > 0) )
{
$q = "UPDATE ". USERS_TABLE ."
SET ina_games_pass = ina_games_pass - 1, ina_games_pass_day = '". date('Y-m-d') ."'
WHERE user_id = '". $userdata['user_id'] ."'";
$db->sql_query($q);
}
}
#==== The display on activity.php
if ($page == 1)
{
#==== Is it active? Is points on?
if ( ($board_config['ina_game_pass_cost']) && ($board_config['ina_game_pass_length']) && ($board_config['use_rewards_mod']) )
{
$user_pass = $userdata['ina_game_pass'];
if ($board_config['use_point_system'])
$points_cost = $board_config['ina_game_pass_cost'] .' '. $board_config['points_name'];
if ($board_config['use_cash_system'])
$points_cost = $board_config['ina_game_pass_cost'] .' '. $board_config['ina_cash_name'];
if ($user_pass < 1)
$msg = str_replace('%C%', $points_cost, ''. $lang['game_pass_buy'] .'');
if ($user_pass == 1)
$msg = $lang['game_pass_left_one'];
if ($user_pass > 1)
$msg = str_replace('%T%', $user_pass, $lang['game_pass_left_multi']);
return $msg;
} #==== Is active
} #==== Page = 1
#==== Buy a pass
if ($page == 2)
{
}
}
function UpdateGamePlayTime($time, $info)
{
global $db, $userdata;
$info = explode(';;', $info);
$time_started = $info[0];
$time_spent = $info[1];
$time_elapsed = (time() - $time_started);
$new_time_spent = ($time_spent + $time_elapsed);
$final_entry = $time .';;'. $new_time_spent;
$q = "UPDATE ". USERS_TABLE ."
SET ina_time_playing = '". $final_entry ."'
WHERE user_id = '". $userdata['user_id'] ."'";
$db->sql_query($q);
}
function DisplayPlayingTime($page, $time)
{
global $userdata, $lang;
$time_spent = explode(';;', $time);
$math_start = $time_spent[1];
$hours = floor ($math_start / 3600);
$math_start = ($math_start - ($hours * 3600));
$minutes = floor ($math_start / 60);
$seconds = ($math_start - ($minutes * 60));
$time_spent_pass_one = str_replace('%H%', $hours, (($page == 1) ? $lang['info_box_time_spent'] : $lang['info_box_time_spent_two']));
$time_spent_pass_two = str_replace('%M%', $minutes, $time_spent_pass_one);
$time_spent_pass_three = str_replace('%S%', $seconds, $time_spent_pass_two);
$time_spent_pass_four = str_replace('%LH%', (($hours == 1) ? $lang['info_box_time_spent_hour'] : $lang['info_box_time_spent_hours']), $time_spent_pass_three);
$time_spent_pass_five = str_replace('%LM%', (($minutes == 1) ? $lang['info_box_time_spent_min'] : $lang['info_box_time_spent_mins']), $time_spent_pass_four);
$time_spent = str_replace('%LS%', (($seconds == 1) ? $lang['info_box_time_spent_sec'] : $lang['info_box_time_spent_secs']), $time_spent_pass_five);
return $time_spent;
}
function Amod_Grab_Cat($cat_id, $cat_info)
{
global $lang, $phpEx;
if (!is_array($cat_info))
return;
for ($c = 0; $c < count($cat_info); $c++)
{
if ($cat_info[$c]['cat_id'] == $cat_id)
{
return sprintf($lang['game_rows_category_yes'], ''. $cat_info[$c]['cat_name'] .'');
break;
}
if (!$cat_info[$c]['cat_id'])
break;
}
}
function Amod_Build_Topics($hof_data, $user_id, $user_trophies, $user_name, $user_char)
{
global $board_config, $phpbb_root_path, $phpEx, $lang, $userdata;
unset($hof, $amod_stats, $char, $hof_link, $trophy_count, $trophy_holder, $trophy, $trophies, $show_trophies, $trophy_image);
#==== Output The Hall Of Fame Link
for ($hof = 0; $hof < count($hof_data); $hof++)
{
if (!$hof_data[$hof])
break;
if ($hof_data[$hof]['current_user_id'] == $user_id)
{
$hof_link = ''. $lang['hof_topic_profile'] .'';
break;
}
}
#==== Output Trophies
if ( ($board_config['ina_show_view_topic']) && ($user_trophies > 0) && ($user_id != ANONYMOUS) )
$trophies = "". $lang['Trohpy'] .": ". $user_trophies;
#==== Output Character Link
if ( ($board_config['ina_char_show_viewtopic']) && ($user_char) && ($user_id != ANONYMOUS) )
$char = ''. $lang['amp_char_topic_link'] .'';
if ($trophies)
$amod_stats .= $trophies .' ';
if ($hof_link)
$amod_stats .= $hof_link .' ';
if ($char)
$amod_stats .= $char .' ';
return (''. $amod_stats .'');
}
function Amod_Trophy_King_Image($user_id)
{
global $board_config, $phpbb_root_path, $lang;
unset($trophy_king, $trophy_image);
$trophy_image = '';
if ( ($board_config['ina_use_trophy']) && ($user_id == $board_config['ina_trophy_king']) )
$trophy_king = ' '. $trophy_image;
return $trophy_king;
}
function Amod_Individual_Game_Time($plays, $time)
{
global $lang;
$i_hours = floor ($time / 3600);
$i_math = ($time - ($i_hours * 3600));
$i_minutes = floor ($i_math / 60);
$i_seconds = ($i_math - ($i_minutes * 60));
$played = $plays;
$hours = ($i_hours == 1) ? $lang['game_info_hour'] : $lang['game_info_hours'];
$mins = ($i_minutes == 1) ? $lang['game_info_min'] : $lang['game_info_mins'];
$secs = ($i_seconds == 1) ? $lang['game_info_sec'] : $lang['game_info_secs'];
$plays = ($plays == 1) ? $lang['game_info_time'] : $lang['game_info_times'];
$display = sprintf($lang['game_info_display'], number_format($played) .' '. $plays, ($i_hours < 1) ? '' : (number_format($i_hours) .' '. $hours), ($i_minutes < 1) ? '' : (number_format($i_minutes) .' '. $mins), (number_format($i_seconds) .' '. $secs) );
return ' '. $display;
}
?>
Ausstellung posten :: 23.09.2007 - BORIS MIKHAILOV - Sandwich