Merge remote-tracking branch 'football/master'

# Conflicts:
#	acp/matches_module.php
#	adm/style/acp_football_leagues.html
#	adm/style/acp_football_matches.html
#	block/all_bets.php
#	block/rank_matchday.php
#	block/ranks_total.php
#	config/services.yml
#	controller/main.php
#	event/main_listener.php
#	includes/constants.php
#	includes/functions.php
#	language/de/football.php
#	language/de/info_acp_leagues.php
#	language/de/info_acp_matches.php
#	styles/prosilver/template/all_bets.html
#	styles/prosilver/template/results.html
#	styles/prosilver/template/table.html
#	styles/prosilver/theme/football.css
This commit is contained in:
2023-06-07 20:40:33 +02:00
167 changed files with 12199 additions and 12181 deletions

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -118,7 +118,7 @@ $sql_limit = $config['football_users_per_page'] * $count_matches;
// If we've got a hightlight set pass it on to pagination.
// handle pagination.
$base_url = $this->helper->route('football_main_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday));
$base_url = $this->helper->route('football_football_controller', array('side' => 'all_bets', 's' => $season, 'l' => $league, 'm' => $matchday));
$pagination = $phpbb_container->get('pagination');
if ($user->data['football_mobile'])
{
@@ -152,8 +152,8 @@ if ($count_matches > 0)
LEFT JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
LEFT JOIN ' . FOOTB_MATCHES . ' AS m2 ON (m2.season = m.season AND m2.league = m.league + 50 AND m2.matchday = m.matchday AND m2.team_id_home = b.user_id + 2000)
LEFT JOIN ' . FOOTB_MATCHES . " AS m3 ON (m3.season = m.season AND m3.league = m.league + 50 AND m3.matchday = m.matchday AND m3.team_id_guest = b.user_id + 2000)
WHERE m.season = $season
AND m.league = $league
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
ORDER BY IFNULL(m2.match_no,m3.match_no) ASC, m3.match_no ASC, LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
}
@@ -172,8 +172,8 @@ if ($count_matches > 0)
LEFT JOIN ' . USERS_TABLE . ' AS u ON (u.user_id = b.user_id)
LEFT JOIN ' . FOOTB_MATCHES . ' AS m2 ON (m2.season = m.season AND m2.league = m.league + 50 AND m2.matchday = m.matchday AND m2.team_id_home = b.user_id + 2000)
LEFT JOIN ' . FOOTB_MATCHES . " AS m3 ON (m3.season = m.season AND m3.league = m.league + 50 AND m3.matchday = m.matchday AND m3.team_id_guest = b.user_id + 2000)
WHERE m.season = $season
AND m.league = $league
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
AND (m3.match_no IS NOT NULL OR m2.match_no IS NOT NULL)
ORDER BY IFNULL(m2.match_no,m3.match_no) ASC, m3.match_no ASC, LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
@@ -375,7 +375,7 @@ if ($count_matches > 0)
)
);
$total = 0;
}
}
$bet_index++;
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
if ($user_bet['status'] < 3)
@@ -393,7 +393,7 @@ if ($count_matches > 0)
$bet_home = $user_bet['bet_home'];
$bet_guest = $user_bet['bet_guest'];
}
$colorstyle_bet = color_style($user_bet['status']);
$template->assign_block_vars('match_panel.user_row.bet', array(
'BET' => $bet_home. ':'. $bet_guest,
@@ -565,4 +565,3 @@ $template->assign_vars(array(
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
)
);
?>

View File

@@ -7,6 +7,11 @@
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
@@ -225,5 +230,3 @@ $template->assign_vars(array(
'POINTS' => $config['football_win_name'],
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -509,8 +509,8 @@ $template->assign_vars(array(
'S_SIDENAME' => $sidename,
'BET_EXPLAIN' => $bet_explain,
'JOIN_LEAGUE' => ($link_rules == '') ? '' : sprintf($user->lang['JOIN_LEAGUE'], $link_rules),
'S_FORM_ACTION_BET' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'bet')),
'S_FORM_ACTION_JOIN' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'join')),
'S_FORM_ACTION_BET' => $this->helper->route('football_football_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'bet')),
'S_FORM_ACTION_JOIN' => $this->helper->route('football_football_controller', array('side' => 'bet', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'join')),
'S_USER_IS_MEMBER' => $user_is_member,
'S_DATA_BET' => $data_bet && $user_is_allowed_to_bet,
'S_DATA_GROUP' => $data_group,
@@ -527,5 +527,3 @@ $template->assign_vars(array(
'S_DISPLAY_RATING' => $display_rating,
)
);
?>

View File

@@ -7,6 +7,11 @@
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
// Can this user view Prediction Leagues pages?
if (!$config['football_guest_view'])
{
@@ -389,4 +394,3 @@ $template->set_filenames(array(
);
page_footer();
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -43,8 +43,8 @@ $sql = "SELECT
LEFT JOIN " . FOOTB_EXTRA . " AS e ON (e.season = m.season AND e.league = m.league AND e.matchday = m.matchday AND e.extra_status = 0)
LEFT JOIN " . FOOTB_EXTRA_BETS . " AS eb ON (eb.season = m.season AND eb.league = m.league AND eb.extra_no = e.extra_no AND eb.user_id = $user_id)
WHERE m.status <= 0
GROUP BY delivery, m.league
ORDER BY delivery, m.league";
GROUP BY m.season, m.league, m.matchday, l.league_name_short, matchday_name, delivery
ORDER BY delivery, m.season, m.league";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result) AND $index < 11)
@@ -55,7 +55,7 @@ while($row = $db->sql_fetchrow($result) AND $index < 11)
$template->assign_block_vars('delivery', array(
'ROW_CLASS' => $row_class,
'U_BET_LINK' => $this->helper->route('football_main_controller', array('side' => 'bet', 's' => $row['season'], 'l' => $row['league'], 'm' => $row['matchday'])),
'U_BET_LINK' => $this->helper->route('football_football_controller', array('side' => 'bet', 's' => $row['season'], 'l' => $row['league'], 'm' => $row['matchday'])),
'LEAGUE_SHORT' => $row['league_name_short'],
'MATCHDAY_NAME' => $row['matchday_name'],
'COLOR' => ($row['bets_count'] == $row['matches_count'] && $row['extra_bets_count'] == $row['extra_count']) ? 'green' : 'red',
@@ -71,5 +71,3 @@ $template->assign_vars(array(
'S_DATA_DELIVERY' => $data_delivery,
)
);
?>

View File

@@ -7,6 +7,11 @@
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
$this->user->add_lang_ext('football/football', 'info_acp_bank');
// Check Prediction League authorisation
@@ -16,11 +21,11 @@ if ( !$this->auth->acl_get('u_use_football') )
}
$action='';
$phpbb_root_path = './../../';
$phpbb_root_path = './../../';
if (!$season OR !$league)
{
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season, 'l' => $league)));
redirect($this->helper->route('football_football_controller', array('side' => 'bank', 's' => $season, 'l' => $league)));
}
else
{
@@ -90,14 +95,10 @@ else
}
$user_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$export_file = $league_short . '_' . $season . '_bank.csv';
$newline = "\r\n";
header('Pragma: no-cache');
header("Content-Type: text/csv; name=\"$export_file\"");
header("Content-disposition: attachment; filename=$export_file");
$export= '';
$export .= $league_name . ' ' . sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
$export .= sprintf($user->lang['NAME']) . ';' . $config['football_win_name'] . ';' . sprintf($user->lang['BET_POINTS']) . ';' .
$csv_data= '';
$csv_data .= $league_name . ' ' . sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
$csv_data .= sprintf($user->lang['NAME']) . ';' . $config['football_win_name'] . ';' . sprintf($user->lang['BET_POINTS']) . ';' .
sprintf($user->lang['DEPOSITED']) . ';' . sprintf($user->lang['DEPOSIT']) . ';' . sprintf($user->lang['WINS']) . ';' .
sprintf($user->lang['PAID']) . ';' . sprintf($user->lang['PAYOUT']) . ';' . $newline;
@@ -118,7 +119,7 @@ else
$no_cash_wins = '';
$no_cash_paid = '';
}
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
$csv_data .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
str_replace('.', ',', $user_row['user_points']) . ';' .
str_replace('.', ',', $user_row['bet_points']) . $no_cash_bet_points . ';' .
str_replace('.', ',', $user_row['deposit']) . $no_cash_deposit . ';' .
@@ -127,9 +128,24 @@ else
str_replace('.', ',', $user_row['paid']) . $no_cash_paid . ';' .
str_replace('.', ',', $user_row['new_pay']) . ';' . $newline;
}
echo utf8_decode($export);
exit;
// Output the csv file
$filename = $league_short . '_' . $season . '_bank.csv';
$fp = fopen('php://output', 'w');
header('Content-Type: application/octet-stream');
header("Content-disposition: attachment; filename=\"" . basename($filename) . "\"");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Pragma: public');
header('Content-Transfer-Encoding: binary');
fwrite($fp, "\xEF\xBB\xBF"); // UTF-8 BOM
fwrite($fp, utf8_decode($csv_data));
fclose($fp);
exit_handler();
}
}
}
?>

View File

@@ -7,6 +7,11 @@
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
$this->user->add_lang_ext('football/football', 'info_acp_bank');
// Check Prediction League authorisation
@@ -19,7 +24,7 @@ $action='';
if (!$season)
{
redirect($this->helper->route('football_main_controller', array('side' => 'bank', 's' => $season)));
redirect($this->helper->route('football_football_controller', array('side' => 'bank', 's' => $season)));
}
else
{
@@ -50,14 +55,10 @@ else
}
$user_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$export_file = $season. '_bank.csv';
$newline = "\r\n";
header('Pragma: no-cache');
header("Content-Type: text/csv; name=\"$export_file\"");
header("Content-disposition: attachment; filename=$export_file");
$export= '';
$export .= sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
$export .= sprintf($user->lang['NAME']) . ';' . sprintf($user->lang['SEASON']) . ';' . sprintf($user->lang['LEAGUE']) . ';Saldo;' . $newline;
$csv_data= '';
$csv_data .= sprintf($user->lang['SEASON']) . ' ' . $season. $newline;
$csv_data .= sprintf($user->lang['NAME']) . ';' . sprintf($user->lang['SEASON']) . ';' . sprintf($user->lang['LEAGUE']) . ';Saldo;' . $newline;
$last_username = '';
$sum_saldo = 0.0;
@@ -65,11 +66,11 @@ else
{
if ($last_username != '' AND $last_username != $user_row['username'])
{
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
$csv_data .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
str_replace('.', ',', $sum_saldo) . ';' . $newline;
$sum_saldo = 0.0;
}
$export .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
$csv_data .= str_replace("\"", "\"\"", $user_row['username']) . ';' .
$user_row['season'] . ';' .
$user_row['league'] . ';' .
str_replace('.', ',', $user_row['saldo']) . ';' . $newline;
@@ -78,11 +79,25 @@ else
}
if ($last_username != '')
{
$export .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
$csv_data .= str_replace("\"", "\"\"", $last_username) . ';Summe;;' .
str_replace('.', ',', $sum_saldo) . ';' . $newline;
}
echo utf8_decode($export);
exit;
// Output the csv file
$filename = $season. '_bank.csv';
$fp = fopen('php://output', 'w');
header('Content-Type: application/octet-stream');
header("Content-disposition: attachment; filename=\"" . basename($filename) . "\"");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Pragma: public');
header('Content-Transfer-Encoding: binary');
fwrite($fp, "\xEF\xBB\xBF"); // UTF-8 BOM
fwrite($fp, utf8_decode($csv_data));
fclose($fp);
exit_handler();
}
}
?>

View File

@@ -1,52 +1,55 @@
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
trigger_error('NO_AUTH_VIEW');
}
$action='';
if (!$season OR !$league)
{
redirect($this->helper->route('football_main_controller', array('side' => 'bet')));
}
else
{
if (user_is_member($user->data['user_id'], $season, $league))
{
$season_info = season_info($season);
if (!sizeof($season_info))
{
$error_message = sprintf($user->lang['NO_SEASON']);
trigger_error($error_message);
}
else
{
$league_info = league_info($season, $league);
if (!sizeof($league_info))
{
$error_message = sprintf($user->lang['NO_LEAGUE']);
trigger_error($error_message);
}
else
{
include($this->football_includes_path . 'export.' . $this->php_ext);
}
}
}
else
{
redirect($this->helper->route('football_main_controller', array('side' => 'bet')));
}
}
?>
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
trigger_error('NO_AUTH_VIEW');
}
$action='';
if (!$season OR !$league)
{
redirect($this->helper->route('football_football_controller', array('side' => 'bet')));
}
else
{
if (user_is_member($user->data['user_id'], $season, $league))
{
$season_info = season_info($season);
if (!sizeof($season_info))
{
$error_message = sprintf($user->lang['NO_SEASON']);
trigger_error($error_message);
}
else
{
$league_info = league_info($season, $league);
if (!sizeof($league_info))
{
$error_message = sprintf($user->lang['NO_LEAGUE']);
trigger_error($error_message);
}
else
{
include($this->football_includes_path . 'export.' . $this->php_ext);
}
}
}
else
{
redirect($this->helper->route('football_football_controller', array('side' => 'bet')));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,150 +1,148 @@
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
{
exit;
}
$user_is_member = user_is_member($user->data['user_id'], $season, $league);
$edit_mode = false;
$display_group = false;
$display_ko = false;
$data_lastresults = false;
$curr_year = date("Y");
$matchnumber = 0;
$match_date = "";
$local_board_time = time() + ($config['football_time_shift'] * 3600);
$sql = 'SELECT * FROM ' . FOOTB_MATCHDAYS . " WHERE status = 0 AND delivery_date < FROM_UNIXTIME('$local_board_time')";
// Calculate matches AND results of matchday
$sql = "SELECT
m.season,
m.league,
m.matchday,
m.status,
m.match_datetime,
LEFT(m.match_datetime, 10) AS match_date,
l.league_name,
t1.team_symbol AS home_symbol,
t2.team_symbol AS guest_symbol,
t1.team_name AS home_name,
t2.team_name AS guest_name,
t1.team_name_short AS home_short,
t2.team_name_short AS guest_short,
m.goals_home,
m.goals_guest,
m.ko_match AS ko_match,
m.goals_overtime_home AS kogoals_home,
m.goals_overtime_guest AS kogoals_guest,
CONCAT(
CASE DATE_FORMAT(m.match_datetime,'%w')
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
ELSE 'Error' END,
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
) AS match_time
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = m.season AND l.league = m.league)
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
WHERE m.match_datetime < FROM_UNIXTIME('$local_board_time')
ORDER BY m.match_datetime DESC, m.league ASC
LIMIT 100";
$result = $db->sql_query($sql);
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
while($row = $db->sql_fetchrow($result))
{
$data_lastresults = true;
$matchnumber++ ;
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($match_date <> $row['match_date'])
{
$match_date = ($match_date == "") ? $row['match_date'] : $match_date;
if ($matchnumber > $config['football_display_last_results'] )
{
break;
}
}
$homelogo = $row['home_symbol'];
$homename = $row['home_name'];
$homeshort = $row['home_short'];
$guestlogo = $row['guest_symbol'];
$guestname = $row['guest_name'];
$guestshort = $row['guest_short'];
if ($homelogo <> '')
{
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"20\" height=\"20\"/>" ;
}
else
{
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
}
if ($guestlogo <> '')
{
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"20\" height=\"20\"/>" ;
}
else
{
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
}
$goals_home = ($row['goals_home'] == '') ? '- ' : $row['goals_home'];
$goals_guest = ($row['goals_guest'] == '') ? ' -' : $row['goals_guest'];
$kogoals_home = ($row['kogoals_home'] == '') ? '- ' : $row['kogoals_home'];
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' -' : $row['kogoals_guest'];
$colorstyle = color_style($row['status']);
$template->assign_block_vars('last_results', array(
'ROW_CLASS' => $row_class,
'U_RESULTS_LINK'=> $this->helper->route('football_main_controller', array('side' => 'results', 's' => $row['season'], 'l' => $row['league'], 'm' => $row['matchday'])),
'MATCH_DATE' => $row['match_date'],
'MATCH_TIME' => $row['match_time'],
'LEAGUE_NAME' => $row['league_name'],
'LOGO_HOME' => $logoH,
'LOGO_GUEST' => $logoG,
'HOME_NAME' => $homename,
'GUEST_NAME' => $guestname,
'HOME_SHORT' => $homeshort,
'GUEST_SHORT' => $guestshort,
'GOALS_HOME' => $goals_home,
'GOALS_GUEST' => $goals_guest,
'COLOR_STYLE' => color_style($row['status']),
'KOGOALS_HOME' => $kogoals_home,
'KOGOALS_GUEST' => $kogoals_guest,
'COLOR_STYLE' => $colorstyle,
)
);
}
$db->sql_freeresult($result);
$sidename = sprintf($user->lang['LAST_RESULTS']);
$template->assign_vars(array(
'S_DISPLAY_LAST_RESULTS' => true,
'S_SIDENAME' => $sidename,
'S_DATA_LAST_RESULTS' => $data_lastresults,
'S_USER_IS_MEMBER' => $user_is_member,
)
);
?>
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
$user_is_member = user_is_member($user->data['user_id'], $season, $league);
$edit_mode = false;
$display_group = false;
$display_ko = false;
$data_lastresults = false;
$curr_year = date("Y");
$matchnumber = 0;
$match_date = "";
$local_board_time = time() + ($config['football_time_shift'] * 3600);
$sql = 'SELECT * FROM ' . FOOTB_MATCHDAYS . " WHERE status = 0 AND delivery_date < FROM_UNIXTIME('$local_board_time')";
// Calculate matches AND results of matchday
$sql = "SELECT
m.season,
m.league,
m.matchday,
m.status,
m.match_datetime,
LEFT(m.match_datetime, 10) AS match_date,
l.league_name,
t1.team_symbol AS home_symbol,
t2.team_symbol AS guest_symbol,
t1.team_name AS home_name,
t2.team_name AS guest_name,
t1.team_name_short AS home_short,
t2.team_name_short AS guest_short,
m.goals_home,
m.goals_guest,
m.ko_match AS ko_match,
m.goals_overtime_home AS kogoals_home,
m.goals_overtime_guest AS kogoals_guest,
CONCAT(
CASE DATE_FORMAT(m.match_datetime,'%w')
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
ELSE 'Error' END,
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
) AS match_time
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_LEAGUES . ' AS l ON (l.season = m.season AND l.league = m.league)
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
WHERE m.match_datetime < FROM_UNIXTIME('$local_board_time')
ORDER BY m.match_datetime DESC, m.league ASC
LIMIT 100";
$result = $db->sql_query($sql);
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
while($row = $db->sql_fetchrow($result))
{
$data_lastresults = true;
$matchnumber++ ;
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($match_date <> $row['match_date'])
{
$match_date = ($match_date == "") ? $row['match_date'] : $match_date;
if ($matchnumber > $config['football_display_last_results'] )
{
break;
}
}
$homelogo = $row['home_symbol'];
$homename = $row['home_name'];
$homeshort = $row['home_short'];
$guestlogo = $row['guest_symbol'];
$guestname = $row['guest_name'];
$guestshort = $row['guest_short'];
if ($homelogo <> '')
{
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"20\" height=\"20\"/>" ;
}
else
{
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
}
if ($guestlogo <> '')
{
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"20\" height=\"20\"/>" ;
}
else
{
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"20\" height=\"20\"/>" ;
}
$goals_home = ($row['goals_home'] == '') ? '- ' : $row['goals_home'];
$goals_guest = ($row['goals_guest'] == '') ? ' -' : $row['goals_guest'];
$kogoals_home = ($row['kogoals_home'] == '') ? '- ' : $row['kogoals_home'];
$kogoals_guest = ($row['kogoals_guest'] == '') ? ' -' : $row['kogoals_guest'];
$colorstyle = color_style($row['status']);
$template->assign_block_vars('last_results', array(
'ROW_CLASS' => $row_class,
'U_RESULTS_LINK'=> $this->helper->route('football_football_controller', array('side' => 'results', 's' => $row['season'], 'l' => $row['league'], 'm' => $row['matchday'])),
'MATCH_DATE' => $row['match_date'],
'MATCH_TIME' => $row['match_time'],
'LEAGUE_NAME' => $row['league_name'],
'LOGO_HOME' => $logoH,
'LOGO_GUEST' => $logoG,
'HOME_NAME' => $homename,
'GUEST_NAME' => $guestname,
'HOME_SHORT' => $homeshort,
'GUEST_SHORT' => $guestshort,
'GOALS_HOME' => $goals_home,
'GOALS_GUEST' => $goals_guest,
'COLOR_STYLE' => color_style($row['status']),
'KOGOALS_HOME' => $kogoals_home,
'KOGOALS_GUEST' => $kogoals_guest,
'COLOR_STYLE' => $colorstyle,
)
);
}
$db->sql_freeresult($result);
$sidename = sprintf($user->lang['LAST_RESULTS']);
$template->assign_vars(array(
'S_DISPLAY_LAST_RESULTS' => true,
'S_SIDENAME' => $sidename,
'S_DATA_LAST_RESULTS' => $data_lastresults,
'S_USER_IS_MEMBER' => $user_is_member,
)
);

View File

@@ -62,5 +62,3 @@ $template->assign_vars(array(
'S_DISPLAY_LAST_USERS' => $display_last_users,
'S_LAST_USERS' => true,
));
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -320,5 +320,3 @@ $template->assign_vars(array(
'USERNAME' => $username,
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -331,4 +331,3 @@ $template->assign_vars(array(
'USERNAME4' => $username4,
)
);
?>

View File

@@ -1,386 +1,384 @@
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
{
exit;
}
$start = $this->request->variable('start', 0);
$matches_on_matchday = false;
if (!$user_sel)
{
if (user_is_member($user->data['user_id'], $season, $league))
{
$user_sel = $user->data['user_id'];
}
}
$username = '';
$data = false;
// Select user
$total_users = 0;
$sql = 'SELECT DISTINCT
u.user_id,
u.username
FROM ' . FOOTB_BETS . ' AS b
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
WHERE season = $season
AND league = $league
ORDER BY LOWER(u.username) ASC";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$total_users++;
if ($user_sel == $row['user_id'] OR !$user_sel)
{
$selectid = ' selected="selected"';
$username = $row['username'];
$user_sel = $row['user_id'];
}
else
{
$selectid = '';
}
$template->assign_block_vars('form_user', array(
'S_USER' => $row['user_id'],
'S_USERNAME' => $row['username'],
'S_SELECTEDID' => $selectid,
)
);
}
$db->sql_freeresult($result);
// Select matches with results and tendencies
$sql = "SELECT
m.match_no,
m.status,
m.formula_home,
m.formula_guest,
t1.team_name_short AS home_name,
t2.team_name_short AS guest_name,
t1.team_id AS home_id,
t2.team_id AS guest_id,
m.goals_home,
m.goals_guest,
SUM(IF(b.goals_home + 0 > b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS home,
SUM(IF(b.goals_home = b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS draw,
SUM(IF(b.goals_home + 0 < b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS guest
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season=m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . ' AS t2 ON (t2.season=m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
LEFT JOIN ' . FOOTB_BETS . " AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
GROUP BY m.match_no
ORDER BY m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query($sql);
$matches = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$count_matches = sizeof($matches);
if ($count_matches > 11)
{
$split_after = 8;
$splits = floor($count_matches / 8);
}
else
{
$split_after = $count_matches;
$splits = 1;
}
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start >= $total_users)
{
$start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
}
else
{
$start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
}
$sql_start = $start * $count_matches;
$sql_limit = $config['football_users_per_page'] * $count_matches;
// handle pagination.
$base_url = $this->helper->route('football_main_controller', array('side' => 'my_koeff', 's' => $season, 'l' => $league, 'm' => $matchday, 'u' => "$user_sel"));
$pagination = $phpbb_container->get('pagination');
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
$bet_line = array();
if ($count_matches > 0)
{
$matches_on_matchday = true;
// Select user bets and points on user results
$sql = "SELECT
u.user_id,
u.username,
m.status,
b.goals_home AS bet_home,
b.goals_guest AS bet_guest,
" . select_points("bu") . "
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_BETS . ' AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
LEFT JOIN ' . FOOTB_BETS . " AS bu ON(bu.season = m.season AND bu.league = m.league AND bu.match_no = m.match_no AND bu.user_id = $user_sel)
LEFT JOIN " . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
$user_bets = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$bet_index = 0;
$split_index = 0;
foreach ($user_bets AS $user_bet)
{
$data = true;
if ($bet_index == $count_matches)
{
$bet_index = 0;
$split_index = 0;
}
if (!($bet_index % $split_after))
{
$split_index++;
}
$sum_total[$user_bet['username']] = 0;
$bet_line[$split_index][] = $user_bet;
$bet_index++;
}
}
$match_index = 0;
$split_index = 0;
$matchday_sum_total = 0;
$colorstyle_total = ' color_finally';
foreach ($matches AS $match)
{
if (!($match_index % $split_after))
{
if ($match_index > 0)
{
$total = 0;
$count_user = 0;
$bet_index = 0;
foreach ($bet_line[$split_index] AS $user_bet)
{
if ($bet_index == 0)
{
$count_user++;
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($user_bet['user_id'] == $user->data['user_id'])
{
$row_class = 'bg3 row_user';
}
$template->assign_block_vars('match_panel.user_row', array(
'ROW_CLASS' => $row_class,
'USER_NAME' => $user_bet['username'],
)
);
$total = 0;
}
$bet_index++;
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
if ($user_bet['status'] < 1 && !$config['football_view_bets'])
{
// hide bets
$bet_home = ($user_bet['bet_home'] == '') ? '&nbsp;' : '?';
$bet_guest = ($user_bet['bet_guest'] == '') ? '&nbsp;' : '?';
}
else
{
$bet_home = $user_bet['bet_home'];
$bet_guest = $user_bet['bet_guest'];
}
$colorstyle_bet = color_style($user_bet['status']);
$template->assign_block_vars('match_panel.user_row.bet', array(
'BET' => $bet_home. ':'. $bet_guest,
'COLOR_STYLE' => $colorstyle_bet,
'POINTS' => ($user_bet['points'] == '') ? '&nbsp;' : $user_bet['points'],
)
);
if ($bet_index == $split_after)
{
$sum_total[$user_bet['username']] += $total;
$matchday_sum_total += $total;
$bet_index = 0;
}
}
$template->assign_block_vars('match_panel.tendency_footer', array(
'S_TOTAL' => false,
)
);
foreach ($matches_tendency AS $match_tendency)
{
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
'TENDENCY' => $match_tendency,
)
);
}
}
$matches_tendency = array();
$split_index++;
if ($split_index == $splits)
{
$display_total = true;
}
else
{
$display_total = false;
}
$template->assign_block_vars('match_panel', array(
'S_TOTAL' => $display_total,
)
);
}
if (0 == $match['home_id'])
{
$home_info = get_team($season, $league, $match['match_no'], 'team_id_home', $match['formula_home']);
$home_in_array = explode("#",$home_info);
$homename = $home_in_array[3];
}
else
{
$homename = $match['home_name'];
}
if (0 == $match['guest_id'])
{
$guest_info = get_team($season, $league, $match['match_no'], 'team_id_guest', $match['formula_guest']);
$guest_in_array = explode("#",$guest_info);
$guestname = $guest_in_array[3];
}
else
{
$guestname = $match['guest_name'];
}
$colorstyle_match = color_style($match['status']);
$template->assign_block_vars('match_panel.match_entry', array(
'HOME_NAME' => $homename,
'GUEST_NAME' => $guestname,
'RESULT' => $match['goals_home'] . ':' . $match['goals_guest'],
'COLOR_STYLE' => $colorstyle_match,
)
);
if ($match['status'] < 1 && !$config['football_view_tendencies'])
{
// hide tendencies
$matches_tendency[] = '?-?-?';
}
else
{
$matches_tendency[] = $match['home'] . '-' . $match['draw'] . '-' . $match['guest'];
}
$match_index++;
}
if ($count_matches > 0)
{
$total = 0;
$count_user = 0;
$bet_index = 0;
foreach ($bet_line[$split_index] AS $user_bet)
{
if ($bet_index == 0)
{
$count_user++;
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($user_bet['user_id'] == $user->data['user_id'])
{
$row_class = 'bg3 row_user';
}
$template->assign_block_vars('match_panel.user_row', array(
'ROW_CLASS' => $row_class,
'USER_NAME' => $user_bet['username'],
)
);
$total = 0;
}
$bet_index++;
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
if ($user_bet['status'] < 1)
{
if ($user_bet['bet_home'] == '')
{
$bet_home = '';
}
else
{
$bet_home = '?';
}
if ($user_bet['bet_guest'] == '')
{
$bet_guest = '';
}
else
{
$bet_guest = '?';
}
}
else
{
$bet_home = $user_bet['bet_home'];
$bet_guest = $user_bet['bet_guest'];
}
$colorstyle_bet = color_style($user_bet['status']);
$template->assign_block_vars('match_panel.user_row.bet', array(
'BET' => $bet_home. ':'. $bet_guest,
'COLOR_STYLE' => $colorstyle_bet,
'POINTS' => ($user_bet['points'] == '') ? '&nbsp;' : $user_bet['points'],
)
);
if ($bet_index == $split_after)
{
$sum_total[$user_bet['username']] += $total;
$matchday_sum_total += $total;
$template->assign_block_vars('match_panel.user_row.points', array(
'COLOR_STYLE' => $colorstyle_total,
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
)
);
$bet_index = 0;
}
}
$template->assign_block_vars('match_panel.tendency_footer', array(
'S_TOTAL' => true,
'COLOR_STYLE' => $colorstyle_total, //currently ignored
'SUMTOTAL' => $matchday_sum_total,
)
);
foreach ($matches_tendency AS $match_tendency)
{
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
'TENDENCY' => $match_tendency,
)
);
}
}
$sidename = sprintf($user->lang['MY_KOEFF']);
$template->assign_vars(array(
'S_DISPLAY_MY_KOEFF' => true,
'S_SIDENAME' => $sidename,
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
'S_SPALTEN' => ($count_matches * 2) + 2,
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
'USERNAME' => $username,
)
);
?>
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
$start = $this->request->variable('start', 0);
$matches_on_matchday = false;
if (!$user_sel)
{
if (user_is_member($user->data['user_id'], $season, $league))
{
$user_sel = $user->data['user_id'];
}
}
$username = '';
$data = false;
// Select user
$total_users = 0;
$sql = 'SELECT DISTINCT
u.user_id,
u.username
FROM ' . FOOTB_BETS . ' AS b
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
WHERE season = $season
AND league = $league
ORDER BY LOWER(u.username) ASC";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
{
$total_users++;
if ($user_sel == $row['user_id'] OR !$user_sel)
{
$selectid = ' selected="selected"';
$username = $row['username'];
$user_sel = $row['user_id'];
}
else
{
$selectid = '';
}
$template->assign_block_vars('form_user', array(
'S_USER' => $row['user_id'],
'S_USERNAME' => $row['username'],
'S_SELECTEDID' => $selectid,
)
);
}
$db->sql_freeresult($result);
// Select matches with results and tendencies
$sql = "SELECT
m.match_no,
m.status,
m.formula_home,
m.formula_guest,
t1.team_name_short AS home_name,
t2.team_name_short AS guest_name,
t1.team_id AS home_id,
t2.team_id AS guest_id,
m.goals_home,
m.goals_guest,
SUM(IF(b.goals_home + 0 > b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS home,
SUM(IF(b.goals_home = b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS draw,
SUM(IF(b.goals_home + 0 < b.goals_guest AND b.goals_home <> '' AND b.goals_guest <> '', 1, 0)) AS guest
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season=m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . ' AS t2 ON (t2.season=m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
LEFT JOIN ' . FOOTB_BETS . " AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
GROUP BY m.match_no
ORDER BY m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query($sql);
$matches = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$count_matches = sizeof($matches);
if ($count_matches > 11)
{
$split_after = 8;
$splits = floor($count_matches / 8);
}
else
{
$split_after = $count_matches;
$splits = 1;
}
// Make sure $start is set to the last page if it exceeds the amount
if ($start < 0 || $start >= $total_users)
{
$start = ($start < 0) ? 0 : floor(($total_users - 1) / $config['football_users_per_page']) * $config['football_users_per_page'];
}
else
{
$start = floor($start / $config['football_users_per_page']) * $config['football_users_per_page'];
}
$sql_start = $start * $count_matches;
$sql_limit = $config['football_users_per_page'] * $count_matches;
// handle pagination.
$base_url = $this->helper->route('football_football_controller', array('side' => 'my_koeff', 's' => $season, 'l' => $league, 'm' => $matchday, 'u' => "$user_sel"));
$pagination = $phpbb_container->get('pagination');
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
$bet_line = array();
if ($count_matches > 0)
{
$matches_on_matchday = true;
// Select user bets and points on user results
$sql = "SELECT
u.user_id,
u.username,
m.status,
b.goals_home AS bet_home,
b.goals_guest AS bet_guest,
" . select_points("bu") . "
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_BETS . ' AS b ON(b.season = m.season AND b.league = m.league AND b.match_no = m.match_no)
LEFT JOIN ' . FOOTB_BETS . " AS bu ON(bu.season = m.season AND bu.league = m.league AND bu.match_no = m.match_no AND bu.user_id = $user_sel)
LEFT JOIN " . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
ORDER BY LOWER(u.username) ASC, m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
$user_bets = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
$bet_index = 0;
$split_index = 0;
foreach ($user_bets AS $user_bet)
{
$data = true;
if ($bet_index == $count_matches)
{
$bet_index = 0;
$split_index = 0;
}
if (!($bet_index % $split_after))
{
$split_index++;
}
$sum_total[$user_bet['username']] = 0;
$bet_line[$split_index][] = $user_bet;
$bet_index++;
}
}
$match_index = 0;
$split_index = 0;
$matchday_sum_total = 0;
$colorstyle_total = ' color_finally';
foreach ($matches AS $match)
{
if (!($match_index % $split_after))
{
if ($match_index > 0)
{
$total = 0;
$count_user = 0;
$bet_index = 0;
foreach ($bet_line[$split_index] AS $user_bet)
{
if ($bet_index == 0)
{
$count_user++;
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($user_bet['user_id'] == $user->data['user_id'])
{
$row_class = 'bg3 row_user';
}
$template->assign_block_vars('match_panel.user_row', array(
'ROW_CLASS' => $row_class,
'USER_NAME' => $user_bet['username'],
)
);
$total = 0;
}
$bet_index++;
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
if ($user_bet['status'] < 1 && !$config['football_view_bets'])
{
// hide bets
$bet_home = ($user_bet['bet_home'] == '') ? '&nbsp;' : '?';
$bet_guest = ($user_bet['bet_guest'] == '') ? '&nbsp;' : '?';
}
else
{
$bet_home = $user_bet['bet_home'];
$bet_guest = $user_bet['bet_guest'];
}
$colorstyle_bet = color_style($user_bet['status']);
$template->assign_block_vars('match_panel.user_row.bet', array(
'BET' => $bet_home. ':'. $bet_guest,
'COLOR_STYLE' => $colorstyle_bet,
'POINTS' => ($user_bet['points'] == '') ? '&nbsp;' : $user_bet['points'],
)
);
if ($bet_index == $split_after)
{
$sum_total[$user_bet['username']] += $total;
$matchday_sum_total += $total;
$bet_index = 0;
}
}
$template->assign_block_vars('match_panel.tendency_footer', array(
'S_TOTAL' => false,
)
);
foreach ($matches_tendency AS $match_tendency)
{
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
'TENDENCY' => $match_tendency,
)
);
}
}
$matches_tendency = array();
$split_index++;
if ($split_index == $splits)
{
$display_total = true;
}
else
{
$display_total = false;
}
$template->assign_block_vars('match_panel', array(
'S_TOTAL' => $display_total,
)
);
}
if (0 == $match['home_id'])
{
$home_info = get_team($season, $league, $match['match_no'], 'team_id_home', $match['formula_home']);
$home_in_array = explode("#",$home_info);
$homename = $home_in_array[3];
}
else
{
$homename = $match['home_name'];
}
if (0 == $match['guest_id'])
{
$guest_info = get_team($season, $league, $match['match_no'], 'team_id_guest', $match['formula_guest']);
$guest_in_array = explode("#",$guest_info);
$guestname = $guest_in_array[3];
}
else
{
$guestname = $match['guest_name'];
}
$colorstyle_match = color_style($match['status']);
$template->assign_block_vars('match_panel.match_entry', array(
'HOME_NAME' => $homename,
'GUEST_NAME' => $guestname,
'RESULT' => $match['goals_home'] . ':' . $match['goals_guest'],
'COLOR_STYLE' => $colorstyle_match,
)
);
if ($match['status'] < 1 && !$config['football_view_tendencies'])
{
// hide tendencies
$matches_tendency[] = '?-?-?';
}
else
{
$matches_tendency[] = $match['home'] . '-' . $match['draw'] . '-' . $match['guest'];
}
$match_index++;
}
if ($count_matches > 0)
{
$total = 0;
$count_user = 0;
$bet_index = 0;
foreach ($bet_line[$split_index] AS $user_bet)
{
if ($bet_index == 0)
{
$count_user++;
$row_class = (!($count_user % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($user_bet['user_id'] == $user->data['user_id'])
{
$row_class = 'bg3 row_user';
}
$template->assign_block_vars('match_panel.user_row', array(
'ROW_CLASS' => $row_class,
'USER_NAME' => $user_bet['username'],
)
);
$total = 0;
}
$bet_index++;
$total += ($user_bet['points'] == '') ? 0 : $user_bet['points'];
if ($user_bet['status'] < 1)
{
if ($user_bet['bet_home'] == '')
{
$bet_home = '';
}
else
{
$bet_home = '?';
}
if ($user_bet['bet_guest'] == '')
{
$bet_guest = '';
}
else
{
$bet_guest = '?';
}
}
else
{
$bet_home = $user_bet['bet_home'];
$bet_guest = $user_bet['bet_guest'];
}
$colorstyle_bet = color_style($user_bet['status']);
$template->assign_block_vars('match_panel.user_row.bet', array(
'BET' => $bet_home. ':'. $bet_guest,
'COLOR_STYLE' => $colorstyle_bet,
'POINTS' => ($user_bet['points'] == '') ? '&nbsp;' : $user_bet['points'],
)
);
if ($bet_index == $split_after)
{
$sum_total[$user_bet['username']] += $total;
$matchday_sum_total += $total;
$template->assign_block_vars('match_panel.user_row.points', array(
'COLOR_STYLE' => $colorstyle_total,
'POINTS_TOTAL' => $sum_total[$user_bet['username']],
)
);
$bet_index = 0;
}
}
$template->assign_block_vars('match_panel.tendency_footer', array(
'S_TOTAL' => true,
'COLOR_STYLE' => $colorstyle_total, //currently ignored
'SUMTOTAL' => $matchday_sum_total,
)
);
foreach ($matches_tendency AS $match_tendency)
{
$template->assign_block_vars('match_panel.tendency_footer.tendency', array(
'TENDENCY' => $match_tendency,
)
);
}
}
$sidename = sprintf($user->lang['MY_KOEFF']);
$template->assign_vars(array(
'S_DISPLAY_MY_KOEFF' => true,
'S_SIDENAME' => $sidename,
'S_MATCHES_ON_MATCHDAY' => $matches_on_matchday,
'S_SPALTEN' => ($count_matches * 2) + 2,
'PAGE_NUMBER' => $pagination->on_page($total_users, $this->config['football_users_per_page'], $start),
'TOTAL_USERS' => ($total_users == 1) ? $user->lang['VIEW_BET_USER'] : sprintf($user->lang['VIEW_BET_USERS'], $total_users),
'USERNAME' => $username,
)
);

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -195,4 +195,3 @@ $template->assign_vars(array(
'USERNAME' => $username,
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -169,5 +169,3 @@ $template->assign_vars(array(
'USERNAME' => $username,
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -426,5 +426,3 @@ $template->assign_vars(array(
'USERNAME' => $username,
)
);
?>

View File

@@ -7,12 +7,14 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
$data_odds = false;
$userid = $user->data['user_id'];
$user_is_member = user_is_member($userid, $season, $league);
$matchnumber = 0;
$lang_dates = $user->lang['datetime'];
@@ -37,6 +39,8 @@ $sql = "SELECT
t2.team_name_short AS guest_name,
t1.team_id AS home_id,
t2.team_id AS guest_id,
b.goals_home AS bet_home,
b.goals_guest AS bet_guest,
m.goals_home,
m.goals_guest,
m.goals_overtime_home AS kogoals_home,
@@ -48,13 +52,15 @@ $sql = "SELECT
m.odd_1,
m.odd_x,
m.odd_2,
m.trend FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
ORDER BY m.match_datetime ASC, m.match_no ASC";
m.trend
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_BETS . " AS b ON (b.season = m.season AND b.league = m.league AND b.match_no = m.match_no AND b.user_id = $userid)
LEFT JOIN " . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id = m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id = m.team_id_guest)
WHERE m.season = $season
AND m.league = $league
AND m.matchday = $matchday
ORDER BY m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrowset($result);
@@ -137,6 +143,8 @@ foreach ($rows as $row)
$goals_guest = ($row['goals_guest'] == '') ? '&nbsp;' : $row['goals_guest'];
$kogoals_home = ($row['kogoals_home'] == '') ? '&nbsp;' : $row['kogoals_home'];
$kogoals_guest = ($row['kogoals_guest'] == '') ? '&nbsp;' : $row['kogoals_guest'];
$bet_home = ($row['bet_home'] == '') ? '&nbsp;' : $row['bet_home'];
$bet_guest = ($row['bet_guest'] == '') ? '&nbsp;' : $row['bet_guest'];
$template->assign_block_vars('odds', array(
'ROW_CLASS' => $row_class,
@@ -154,12 +162,15 @@ foreach ($rows as $row)
'tid' => $homeid, 'mode' => 'all')),
'U_PLAN_GUEST' => $this->helper->route('football_football_popup', array('popside' => 'viewplan_popup', 's' => $season, 'l' => $league,
'tid' => $guestid, 'mode' => 'all')),
'BET_HOME' => $bet_home,
'BET_GUEST' => $bet_guest,
'GOALS_HOME' => $goals_home,
'GOALS_GUEST' => $goals_guest,
'COLOR_STYLE' => '',
'KOGOALS_HOME' => $kogoals_home,
'KOGOALS_GUEST' => $kogoals_guest,
'S_KO_MATCH' => $ko_match,
'S_USER_IS_MEMBER' => $user_is_member,
'TREND' => $row['trend'],
'U_MATCH_STATS' => $this->helper->route('football_football_popup', array('popside' => 'hist_popup', 's' => $season, 'l' => $league,
'hid' => $homeid, 'gid' => $guestid, 'm' => $matchday,
@@ -201,5 +212,3 @@ $template->assign_vars(array(
'S_DATA_ODDS' => $data_odds,
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -35,10 +35,10 @@ if ($league <> 0)
FROM " . FOOTB_RANKS . ' AS r
LEFT Join ' . USERS_TABLE . " AS u ON (r.user_id = u.user_id)
WHERE r.season = $season
AND r.league = $league_corr
AND r.league = $league_corr
AND r.matchday = $matchday
AND r.status IN (2,3)
ORDER BY rank ASC, LOWER(u.username) ASC";
ORDER BY r.rank ASC, LOWER(u.username) ASC";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result))
@@ -78,4 +78,3 @@ if ($league <> 0)
'WIN_NAME' => $config['football_win_name'],
));
}
?>

View File

@@ -1,94 +1,93 @@
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
{
exit;
}
if ($league <> 0)
{
$sql = 'SELECT
r.matchday AS last_matchday
FROM '. FOOTB_RANKS . " AS r
WHERE r.season = $season
AND r.league = $league
AND r.status IN (2,3)
ORDER BY r.matchday DESC";
$result = $db->sql_query_limit($sql, 1);
if($row = $db->sql_fetchrow($result))
{
$last_matchday = $row['last_matchday'];
$db->sql_freeresult($result);
$rank_matchday = ($last_matchday < $matchday) ? $last_matchday : $matchday;
$sql = 'SELECT
r.rank_total AS rank,
r.user_id,
u.username,
u.user_colour,
r.status AS status,
r.points_total AS points,
r.win_total AS win
FROM '. FOOTB_RANKS . ' AS r
LEFT JOIN '. USERS_TABLE . " AS u ON (r.user_id = u.user_id)
WHERE r.season = $season
AND r.league = $league
AND r.matchday = $rank_matchday
AND r.status IN (2,3)
ORDER BY points DESC, LOWER(u.username) ASC";
$result = $db->sql_query($sql);
$index = 0;
while($row = $db->sql_fetchrow($result))
{
$index++;
$data_rank_total = true;
if (($index <= $config['football_display_ranks']) OR ($row['user_id'] == $user->data['user_id']))
{
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($row['user_id'] == $user->data['user_id'])
{
$row_class = 'bg3 row_user';
}
$colorstyle = color_style($row['status']);
$template->assign_block_vars("ranktotal", array(
'RANK' => $row['rank'],
'ROW_CLASS' => $row_class,
'USERID' => $row['user_id'],
'USERNAME' => $row['username'],
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
'URL' => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $row['user_id'],
'POINTS' => $row['points'],
'COLOR_STYLE' => $colorstyle,
'WIN' => $row['win'] ,
)
);
}
}
$db->sql_freeresult($result);
}
else
{
$data_rank_total = false;
}
$league_info = league_info($season, $league);
$template->assign_vars(array(
'S_DISPLAY_RANK_TOTAL' => true,
'S_DATA_RANK_TOTAL' => $data_rank_total,
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : true,
'WIN_NAME' => $config['football_win_name'],
)
);
}
?>
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if ($league <> 0)
{
$sql = 'SELECT
r.matchday AS last_matchday
FROM '. FOOTB_RANKS . " AS r
WHERE r.season = $season
AND r.league = $league
AND r.status IN (2,3)
ORDER BY r.matchday DESC";
$result = $db->sql_query_limit($sql, 1);
if($row = $db->sql_fetchrow($result))
{
$last_matchday = $row['last_matchday'];
$db->sql_freeresult($result);
$rank_matchday = ($last_matchday < $matchday) ? $last_matchday : $matchday;
$sql = 'SELECT
r.rank_total AS rank,
r.user_id,
u.username,
u.user_colour,
r.status AS status,
r.points_total AS points,
r.win_total AS win
FROM '. FOOTB_RANKS . ' AS r
LEFT JOIN '. USERS_TABLE . " AS u ON (r.user_id = u.user_id)
WHERE r.season = $season
AND r.league = $league
AND r.matchday = $rank_matchday
AND r.status IN (2,3)
ORDER BY points DESC, LOWER(u.username) ASC";
$result = $db->sql_query($sql);
$index = 0;
while($row = $db->sql_fetchrow($result))
{
$index++;
$data_rank_total = true;
if (($index <= $config['football_display_ranks']) OR ($row['user_id'] == $user->data['user_id']))
{
$row_class = (!($index % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
if ($row['user_id'] == $user->data['user_id'])
{
$row_class = 'bg3 row_user';
}
$colorstyle = color_style($row['status']);
$template->assign_block_vars("ranktotal", array(
'RANK' => $row['rank'],
'ROW_CLASS' => $row_class,
'USERID' => $row['user_id'],
'USERNAME' => $row['username'],
'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']),
'URL' => $phpbb_root_path . "profile.php?mode=viewprofile&u=" . $row['user_id'],
'POINTS' => $row['points'],
'COLOR_STYLE' => $colorstyle,
'WIN' => $row['win'] ,
)
);
}
}
$db->sql_freeresult($result);
}
else
{
$data_rank_total = false;
}
$league_info = league_info($season, $league);
$template->assign_vars(array(
'S_DISPLAY_RANK_TOTAL' => true,
'S_DATA_RANK_TOTAL' => $data_rank_total,
'S_WIN' => ($league_info['win_matchday'] == '0' and $league_info['win_season'] == '0') ? false : true,
'WIN_NAME' => $config['football_win_name'],
)
);
}

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -53,7 +53,7 @@ $sql = "SELECT
AND b.league = $league
AND m.status IN (2,3)
AND m.matchday = $matchday
GROUP BY user_id";
GROUP BY b.user_id";
$result = $db->sql_query($sql);
$usersstats = $db->sql_fetchrowset($result);
@@ -126,7 +126,7 @@ else
$sql_limit = $config['football_users_per_page'];
// handle pagination.
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday));
$base_url = $this->helper->route('football_football_controller', array('side' => 'ranks_matchday', 's' => $season, 'l' => $league, 'm' => $matchday));
$pagination = $phpbb_container->get('pagination');
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
$data_ranks = false;
@@ -224,8 +224,8 @@ while($row = $db->sql_fetchrow($result))
'ROW_CLASS' => $row_class,
'RANK' => $rankof[$row['user_id']],
'NO_CHANGES' => ($change_sign == '=') ? true : false,
'WORSENED' => ($change_sign == '-') ? true : false,
'IMPROVED' => ($change_sign == '+') ? true : false,
'WORSENED' => ($change_sign == '+') ? true : false,
'IMPROVED' => ($change_sign == '-') ? true : false,
'CHANGE_SIGN' => $change_sign,
'CHANGE_DIFFER' => $change_differ,
'USERID' => $row['user_id'],
@@ -257,5 +257,3 @@ $template->assign_vars(array(
'WIN_NAME' => $config['football_win_name'],
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -39,7 +39,7 @@ switch ($mode)
WHERE b.league = $league
AND ((b.season < $season) OR (b.season = $season AND m.matchday <= $matchday))
AND m.status IN (2,3)
GROUP BY user_id";
GROUP BY b.user_id";
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrowset($result);
@@ -61,7 +61,7 @@ switch ($mode)
WHERE r.league = $league
AND ((r.season < $season AND r.matchday = l.matchdays) OR (r.season = $season AND r.matchday = $matchday))
AND r.status IN (2,3)
GROUP BY user_id
GROUP BY r.user_id
ORDER BY r.user_id ASC";
$result = $db->sql_query($sql);
@@ -89,7 +89,7 @@ switch ($mode)
WHERE r.league = $league
AND ((r.season < $season) OR (r.season = $season AND r.matchday <= $matchday))
AND r.status IN (2,3)
GROUP BY user_id
GROUP BY r.user_id
ORDER BY points_total DESC, LOWER(u.username) ASC";
$result = $db->sql_query($sql);
@@ -114,7 +114,7 @@ switch ($mode)
$index_end = $index_start + $config['football_users_per_page'] - 1;
// handle pagination.
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime'));
$base_url = $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime'));
$pagination = $phpbb_container->get('pagination');
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
@@ -171,9 +171,9 @@ switch ($mode)
'WIN_NAME' => $config['football_win_name'],
'S_SHOW_OTHER_LINKS' => true,
'S_HEADER' => sprintf($user->lang['RANKING_ALL_TIME']),
'S_LINK_RANKING' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
'S_LINK_RANKING' => $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
'S_LINK_ALL_TIME' => '',
'S_LINK_COMPARE' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare')),
'S_LINK_COMPARE' => $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare')),
)
);
break;
@@ -227,8 +227,8 @@ switch ($mode)
AND r.league = $league
AND r.matchday = $matchday
AND r.status IN (2,3)
GROUP BY season, user_id
ORDER BY r.user_id ASC, season ASC";
GROUP BY r.season, r.user_id
ORDER BY r.user_id ASC, r.season ASC";
$result = $db->sql_query($sql);
@@ -275,7 +275,7 @@ switch ($mode)
$index_end = $index_start + $config['football_users_per_page'] - 1;
// handle pagination.
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare'));
$base_url = $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare'));
$pagination = $phpbb_container->get('pagination');
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_users, $this->config['football_users_per_page'], $start);
@@ -334,8 +334,8 @@ switch ($mode)
'WIN_NAME' => $config['football_win_name'],
'S_SHOW_OTHER_LINKS' => true,
'S_HEADER' => sprintf($user->lang['RANKING_COMPARE']),
'S_LINK_RANKING' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
'S_LINK_ALL_TIME' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime')),
'S_LINK_RANKING' => $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday)),
'S_LINK_ALL_TIME' => $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime')),
'S_LINK_COMPARE' => '',
)
);
@@ -369,7 +369,7 @@ switch ($mode)
AND b.league = $league
AND m.status IN (2,3)
AND m.matchday <= $matchday
GROUP BY user_id";
GROUP BY b.user_id";
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrowset($result);
@@ -423,7 +423,7 @@ switch ($mode)
AND r.league = $league
AND r.matchday = $matchday
AND r.status IN (2,3)
GROUP BY user_id
GROUP BY r.user_id
ORDER BY r.points_total DESC, LOWER(u.username) ASC";
$result = $db->sql_query($sql);
@@ -447,7 +447,7 @@ switch ($mode)
$index_end = $index_start + $config['football_users_per_page'] - 1;
// handle pagination.
$base_url = $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday));
$base_url = $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday));
$pagination = $phpbb_container->get('pagination');
if ($user->data['football_mobile'])
{
@@ -482,13 +482,13 @@ switch ($mode)
{
if ($rank > $prev_rank_of[$curr_rank['user_id']])
{
$change_sign = '-';
$differ = $prev_rank_of[$curr_rank['user_id']] - $rank;
$change_sign = '+';
$differ = $rank - $prev_rank_of[$curr_rank['user_id']];
$change_differ = ' (' . $differ . ')';
}
else
{
$change_sign = '+';
$change_sign = '-';
$differ = $prev_rank_of[$curr_rank['user_id']] - $rank;
$change_differ = ' (' . $differ . ')';
}
@@ -520,8 +520,8 @@ switch ($mode)
'ROW_CLASS' => $row_class,
'RANK' => $rank,
'NO_CHANGES' => ($change_sign == '=') ? true : false,
'WORSENED' => ($change_sign == '-') ? true : false,
'IMPROVED' => ($change_sign == '+') ? true : false,
'WORSENED' => ($change_sign == '+') ? true : false,
'IMPROVED' => ($change_sign == '-') ? true : false,
'CHANGE_SIGN' => $change_sign,
'CHANGE_DIFFER' => $change_differ,
'USERID' => $curr_rank['user_id'],
@@ -554,8 +554,8 @@ switch ($mode)
'WIN_NAME' => $config['football_win_name'],
'S_SHOW_OTHER_LINKS' => true,
'S_LINK_RANKING' => '',
'S_LINK_ALL_TIME' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime')),
'S_LINK_COMPARE' => $this->helper->route('football_main_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare')),
'S_LINK_ALL_TIME' => $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'alltime')),
'S_LINK_COMPARE' => $this->helper->route('football_football_controller', array('side' => 'ranks_total', 's' => $season, 'l' => $league, 'm' => $matchday, 'mode' => 'compare')),
)
);
break;

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -408,15 +408,16 @@ switch ($league_info['bet_ko_type'])
$label_finalresult = sprintf($user->lang['EXTRATIME_SHORT']) . '/' . sprintf($user->lang['PENALTY_SHORT']);
break;
}
// set correct display for usage in menu template
if($side == 'results')
{
$display_results = true;
$display_results_tl = false;
$sidename = sprintf($user->lang['RESULTS']);
}
if($side == 'results_tl')
{
$display_results = false;
$display_results_tl = true;
$sidename = sprintf($user->lang['RESULTS']);
}
@@ -428,7 +429,7 @@ $template->assign_vars(array(
'S_SIDENAME' => $sidename,
'RESULT_EXPLAIN' => $result_explain,
'LABEL_FINALRESULT' => $label_finalresult,
'S_FORM_ACTION_RESULT' => $this->helper->route('football_main_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'result')),
'S_FORM_ACTION_RESULT' => $this->helper->route('football_football_controller', array('side' => 'results', 's' => $season, 'l' => $league, 'm' => $matchday, 'action' => 'result')),
'S_DATA_RESULTS' => $data_results,
'S_USER_IS_MEMBER' => $user_is_member,
'S_DISPLAY_GROUP' => $display_group,
@@ -436,5 +437,3 @@ $template->assign_vars(array(
'S_EDIT_MODE' => $edit_mode,
)
);
?>

View File

@@ -1,227 +1,233 @@
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
// Can this user view Prediction Leagues pages?
if (!$config['football_guest_view'])
{
if ($user->data['user_id'] == ANONYMOUS)
{
trigger_error('NO_GUEST_VIEW');
}
}
if (!$config['football_user_view'])
{
// Only Prediction League member should see this page
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
trigger_error('NO_AUTH_VIEW');
}
}
// Football disabled?
if ($config['football_disable'])
{
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message);
}
$season = $this->request->variable('s', 0);
$league = $this->request->variable('l', 0);
// Check parms
$error_message = '';
if (!$season OR !$league)
{
$data_rules = false;
if (!$season)
{
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
}
if (!$league)
{
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
}
}
else
{
$season_info = season_info($season);
if (sizeof($season_info))
{
$season_name = $season_info['season_name'];
$league_info = league_info($season, $league);
if (sizeof($league_info))
{
$data_rules = true;
$matchdays = $league_info['matchdays'];
$league_name = $league_info['league_name'];
if ($user->data['is_registered'] and !$user->data['is_bot'])
{
$win_hits = '';
$win_hits02 = '';
$win_matchday = explode(';', "0;" . $league_info['win_matchday']);
$win_season = explode(';',"0;" . $league_info['win_season']);
$win_hits = $league_info['win_result'];
$win_hits02 = $league_info['win_result_02'];
if($win_hits != '' AND $win_hits != 0)
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WIN_HITS']),
)
);
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => 'bg1 row_light',
'RANK' => '1. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_hits,
)
);
}
if($win_hits02 != '' AND $win_hits02 != 0 AND $config['football_win_hits02'])
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WIN_HITS02']),
)
);
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => 'bg1 row_light',
'RANK' => '1. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_hits02,
)
);
}
if($win_matchday[1] != '' AND $win_matchday[1] != 0)
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WINS_MATCHDAY']),
)
);
$rank = 1;
while ($win_matchday[$rank] != '')
{
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank . '. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_matchday[$rank],
)
);
$rank++ ;
if ($rank > sizeof($win_matchday)-1)
{
break;
}
}
}
if($win_season[1] != '' AND $win_season[1] != 0)
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WINS_SEASON']),
)
);
$rank = 1;
while ($win_season[$rank] != '')
{
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank. '. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_season[$rank],
)
);
$rank++ ;
if ($rank > sizeof($win_season)-1)
{
break;
}
}
}
}
}
else
{
$data_rules = false;
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
$league_name = '';
}
}
else
{
$data_rules = false;
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
$season_name = '';
}
}
$sidename = sprintf($user->lang['FOOTBALL_RULES']);
if ($data_rules)
{
$link_rules = append_sid($phpbb_root_path . "viewtopic.$phpEx?p=" . $league_info["rules_post_id"]);
$points_tendency = ($league_info['points_mode'] < 3) ? sprintf($user->lang['POINTS_TENDENCY' . $league_info['points_mode']], $league_info['points_tendency']) : sprintf($user->lang['POINTS_TENDENCY'], $league_info['points_tendency']);
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_RULES' => $data_rules,
'S_BET_IN_TIME' => $league_info['bet_in_time'],
'S_RULES_POST_ID' => $league_info['rules_post_id'],
'S_ERROR_MESSAGE' => $error_message,
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'WIN_NAME' => $config['football_win_name'],
'JOIN_MODE' => ($league_info['join_by_user']) ? (($league_info['join_in_season']) ? sprintf($user->lang['JOIN_IN_SEASON']) : sprintf($user->lang['JOIN_BY_USER'])) : sprintf($user->lang['JOIN_BY_ADMIN']),
'POINTS_HIT' => sprintf($user->lang['POINTS_HIT'], $league_info['points_result']) . '<br/>',
'POINTS_TENDENCY' => $points_tendency . '<br/>',
'POINTS_DIFF' => ($league_info['points_mode'] == 4) ? sprintf($user->lang['POINTS_DIFFERENCE'], $league_info['points_diff']) . '<br/>' :
(($league_info['points_mode'] == 5) ? sprintf($user->lang['POINTS_DIFFERENCE_DRAW'], $league_info['points_diff']) . '<br/>' : ''),
'POINTS_LAST' => ($league_info['points_last']) ? sprintf($user->lang['POINTS_NO_BET']) . '<br/>' : '',
'LINK_RULES' => sprintf($user->lang['LINK_RULES'], $link_rules),
'SEASONNAME' => $season_info['season_name'],
'LEAGUENAME' => $league_name,
)
);
// output page
page_header(sprintf($user->lang['FOOTBALL_RULES' ]) . ' ' . $league_info['league_name'] . ' ' . $season_info['season_name']);
}
else
{
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_RULES' => $data_rules,
'S_BET_IN_TIME' => false,
'S_RULES_POST_ID' => 0,
'S_ERROR_MESSAGE' => $error_message,
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'WIN_NAME' => $config['football_win_name'],
'JOIN_MODE' => '',
'POINTS_HIT' => '',
'POINTS_TENDENCY' => '',
'POINTS_DIFF' => '',
'POINTS_LAST' => '',
'LINK_RULES' => '',
'SEASONNAME' => '',
'LEAGUENAME' => '',
)
);
// output page
page_header(sprintf($user->lang['FOOTBALL_RULES' ]));
}
$template->set_filenames(array(
'body' => 'rules_popup.html'
)
);
// $template->display('popup');
page_footer();
?>
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
// Can this user view Prediction Leagues pages?
if (!$config['football_guest_view'])
{
if ($user->data['user_id'] == ANONYMOUS)
{
trigger_error('NO_GUEST_VIEW');
}
}
if (!$config['football_user_view'])
{
// Only Prediction League member should see this page
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
trigger_error('NO_AUTH_VIEW');
}
}
// Football disabled?
if ($config['football_disable'])
{
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message);
}
$season = $this->request->variable('s', 0);
$league = $this->request->variable('l', 0);
// Check parms
$error_message = '';
if (!$season OR !$league)
{
$data_rules = false;
if (!$season)
{
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
}
if (!$league)
{
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
}
}
else
{
$season_info = season_info($season);
if (sizeof($season_info))
{
$season_name = $season_info['season_name'];
$league_info = league_info($season, $league);
if (sizeof($league_info))
{
$data_rules = true;
$matchdays = $league_info['matchdays'];
$league_name = $league_info['league_name'];
if ($user->data['is_registered'] and !$user->data['is_bot'])
{
$win_hits = '';
$win_hits02 = '';
$win_matchday = explode(';', "0;" . $league_info['win_matchday']);
$win_season = explode(';',"0;" . $league_info['win_season']);
$win_hits = $league_info['win_result'];
$win_hits02 = $league_info['win_result_02'];
if($win_hits != '' AND $win_hits != 0)
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WIN_HITS']),
)
);
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => 'bg1 row_light',
'RANK' => '1. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_hits,
)
);
}
if($win_hits02 != '' AND $win_hits02 != 0 AND $config['football_win_hits02'])
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WIN_HITS02']),
)
);
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => 'bg1 row_light',
'RANK' => '1. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_hits02,
)
);
}
if($win_matchday[1] != '' AND $win_matchday[1] != 0)
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WINS_MATCHDAY']),
)
);
$rank = 1;
while ($win_matchday[$rank] != '')
{
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank . '. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_matchday[$rank],
)
);
$rank++ ;
if ($rank > sizeof($win_matchday)-1)
{
break;
}
}
}
if($win_season[1] != '' AND $win_season[1] != 0)
{
$template->assign_block_vars('wintable', array(
'WIN_DESC' => sprintf($user->lang['WINS_SEASON']),
)
);
$rank = 1;
while ($win_season[$rank] != '')
{
$row_class = (!($rank % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
$template->assign_block_vars('wintable.entry', array(
'ROW_CLASS' => $row_class,
'RANK' => $rank. '. ' . sprintf($user->lang['PLACE']),
'WIN' => $win_season[$rank],
)
);
$rank++ ;
if ($rank > sizeof($win_season)-1)
{
break;
}
}
}
}
}
else
{
$data_rules = false;
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
$league_name = '';
}
}
else
{
$data_rules = false;
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
$season_name = '';
}
}
$sidename = sprintf($user->lang['FOOTBALL_RULES']);
if ($data_rules)
{
$link_rules = append_sid($phpbb_root_path . "viewtopic.$phpEx?p=" . $league_info["rules_post_id"]);
$points_tendency = ($league_info['points_mode'] < 3) ? sprintf($user->lang['POINTS_TENDENCY' . $league_info['points_mode']], $league_info['points_tendency']) : sprintf($user->lang['POINTS_TENDENCY'], $league_info['points_tendency']);
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_RULES' => $data_rules,
'S_BET_IN_TIME' => $league_info['bet_in_time'],
'S_BET_POINTS' => true,
'S_RULES_POST_ID' => $league_info['rules_post_id'],
'S_ERROR_MESSAGE' => $error_message,
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'WIN_NAME' => $config['football_win_name'],
'JOIN_MODE' => ($league_info['join_by_user']) ? (($league_info['join_in_season']) ? sprintf($user->lang['JOIN_IN_SEASON']) : sprintf($user->lang['JOIN_BY_USER'])) : sprintf($user->lang['JOIN_BY_ADMIN']),
'POINTS_HIT' => sprintf($user->lang['POINTS_HIT'], $league_info['points_result']) . '<br/>',
'POINTS_TENDENCY' => $points_tendency . '<br/>',
'POINTS_DIFF' => ($league_info['points_mode'] == 4) ? sprintf($user->lang['POINTS_DIFFERENCE'], $league_info['points_diff']) . '<br/>' :
(($league_info['points_mode'] == 5) ? sprintf($user->lang['POINTS_DIFFERENCE_DRAW'], $league_info['points_diff']) . '<br/>' : ''),
'POINTS_LAST' => ($league_info['points_last']) ? sprintf($user->lang['POINTS_NO_BET']) . '<br/>' : '',
'LINK_RULES' => sprintf($user->lang['LINK_RULES'], $link_rules),
'SEASONNAME' => $season_info['season_name'],
'LEAGUENAME' => $league_name,
'BET_POINTS' => $league_info['bet_points'],
)
);
// output page
page_header(sprintf($user->lang['FOOTBALL_RULES' ]) . ' ' . $league_info['league_name'] . ' ' . $season_info['season_name']);
}
else
{
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_RULES' => $data_rules,
'S_BET_IN_TIME' => false,
'S_BET_POINTS' => false,
'S_RULES_POST_ID' => 0,
'S_ERROR_MESSAGE' => $error_message,
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'WIN_NAME' => $config['football_win_name'],
'JOIN_MODE' => '',
'POINTS_HIT' => '',
'POINTS_TENDENCY' => '',
'POINTS_DIFF' => '',
'POINTS_LAST' => '',
'LINK_RULES' => '',
'SEASONNAME' => '',
'LEAGUENAME' => '',
)
);
// output page
page_header(sprintf($user->lang['FOOTBALL_RULES' ]));
}
$template->set_filenames(array(
'body' => 'rules_popup.html'
)
);
// $template->display('popup');
page_footer();

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -142,4 +142,3 @@ else
)
);
}
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -160,5 +160,3 @@ $template->assign_vars(array(
'LEAGUE' => $league,
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -136,5 +136,3 @@ $template->assign_vars(array(
'LEAGUE' => $league,
)
);
?>

View File

@@ -7,7 +7,7 @@
*
*/
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL'))
if (!defined('IN_PHPBB'))
{
exit;
}
@@ -159,7 +159,7 @@ foreach($points_ary as $group_id => $points)
)
);
}
}
}
}
$db->sql_freeresult($result);
@@ -458,9 +458,13 @@ if($league > 50)
{
// Activate bonus coloumn only for tippers.
$data_bns = true;
} else {
$data_bns = false;
}
if($side == 'table') {
$display_table_menu = true;
} else {
$display_table_menu = false;
}
$db->sql_freeresult($result);
$sidename = sprintf($user->lang['TABLE']);
@@ -476,5 +480,3 @@ $template->assign_vars(array(
'S_DATA_BNS' => $data_bns,
)
);
?>

View File

@@ -1,23 +1,21 @@
<?php
/**
*
* @package Football
* @version $Id: under_construction.php 1 2010-05-17 22:09:43Z football $
* @copyright (c) 2010 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if ( !defined('IN_PHPBB') OR !defined('IN_FOOTBALL') )
{
exit;
}
$sidename = sprintf($user->lang['UNDER_CONSTRUCTION']);
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DISPLAY_UNDER_CONSTRUCTION' => true,
)
);
?>
<?php
/**
*
* @package Football
* @version $Id: under_construction.php 1 2010-05-17 22:09:43Z football $
* @copyright (c) 2010 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
$sidename = sprintf($user->lang['UNDER_CONSTRUCTION']);
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DISPLAY_UNDER_CONSTRUCTION' => true,
)
);

View File

@@ -1,297 +1,300 @@
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
// Can this user view Prediction Leagues pages?
if (!$config['football_guest_view'])
{
if ($user->data['user_id'] == ANONYMOUS)
{
trigger_error('NO_GUEST_VIEW');
}
}
if (!$config['football_user_view'])
{
// Only Prediction League member should see this page
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
trigger_error('NO_AUTH_VIEW');
}
}
// Football disabled?
if ($config['football_disable'])
{
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message);
}
$mode = $this->request->variable('mode', '');
$season = $this->request->variable('s', 0);
$league = $this->request->variable('l', 0);
$team_id = $this->request->variable('tid', 0);
switch($mode)
{
case 'played':
$mode_desc = sprintf($user->lang['PLAYED_MATCHES']);
$where = ' AND m.status IN (3,6) ';
$data_results = true;
break;
case 'rest':
$mode_desc = sprintf($user->lang['REST_MATCHES']);
$where = ' AND m.status IN (0,1,2,4,5) ';
$data_results = false;
break;
case 'home':
$mode_desc = sprintf($user->lang['HOME_MATCHES']);
$where = " AND m.team_id_home = $team_id AND m.status IN (3,6) ";
$data_results = true;
break;
case 'away':
$mode_desc = sprintf($user->lang['AWAY_MATCHES']);
$where = " AND m.team_id_guest = $team_id AND m.status IN (3,6) ";
$data_results = true;
break;
// ALL is Default
default:
$mode_desc = sprintf($user->lang['ALL_MATCHES']);
$where = '';
$data_results = true;
break;
}
// Check parms
$error_message = '';
if (!$season OR !$league OR !$team_id)
{
$data_plan = false;
if (!$season)
{
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
}
if (!$league)
{
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
}
if (!$team_id)
{
$error_message .= sprintf($user->lang['NO_TEAM_ID']) . '<br />';
}
}
else
{
$data_group = false;
$lang_dates = $user->lang['datetime'];
// Calculate matches and bets of matchday
$sql = "SELECT
IF(m.team_id_home = $team_id, 'H', 'A') AS match_place,
IF(((m.status=3) OR (m.status=6)),
IF(m.team_id_home = $team_id,
IF(m.goals_home + 0 > m.goals_guest, 'match_win', IF(m.goals_home = m.goals_guest, 'match_draw', 'match_lost')),
IF(m.goals_home + 0 < m.goals_guest, 'match_win', IF(m.goals_home = m.goals_guest, 'match_draw', 'match_lost'))),
'') AS match_style,
m.match_no,
m.matchday,
m.status,
m.group_id,
t1.team_symbol AS home_symbol,
t2.team_symbol AS guest_symbol,
t1.team_id AS home_id,
t2.team_id AS guest_id,
t1.team_name AS home_name,
t2.team_name AS guest_name,
t1.team_name_short AS home_short,
t2.team_name_short AS guest_short,
m.goals_home,
m.goals_guest,
CONCAT(
CASE DATE_FORMAT(m.match_datetime,'%w')
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
ELSE 'Error' END,
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
) AS match_time
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id=m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id=m.team_id_guest)
WHERE m.season = $season
AND m.league = $league
AND (m.team_id_home = $team_id OR m.team_id_guest = $team_id)
$where
GROUP BY m.match_no
ORDER BY m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$data_plan = true;
$matchnumber = 0;
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
do
{
$matchnumber++ ;
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
$display_link = true;
$homelogo = $row['home_symbol'];
$guestlogo = $row['guest_symbol'];
if ($homelogo <> '')
{
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
}
else
{
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
}
if ($guestlogo <> '')
{
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
}
else
{
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
}
if ($row['group_id'] == '')
{
$group_id = '&nbsp;';
}
else
{
$data_group = true;
$group_id = $row['group_id'];
}
if ($row['match_place'] == 'H')
{
$color_home = $row['match_style'];
$color_guest = '';
}
else
{
$color_home = '';
$color_guest = $row['match_style'];
}
$color_goals = $row['match_style'];
$template->assign_block_vars('match', array(
'ROW_CLASS' => $row_class,
'MATCH_TIME' => $row['match_time'],
'GROUP' => $group_id,
'LOGO_HOME' => $logoH,
'LOGO_GUEST' => $logoG,
'HOME_NAME' => $row['home_short'],
'GUEST_NAME' => $row['guest_short'],
'GOALS_HOME' => ($row['goals_home'] == '') ? '&nbsp;' : $row['goals_home'],
'GOALS_GUEST' => ($row['goals_guest'] == '') ? '&nbsp;' : $row['goals_guest'],
'COLOR_HOME' => $color_home,
'COLOR_GUEST' => $color_guest,
'COLOR_GOALS' => $color_goals,
)
);
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
}
else
{
$data_plan = false;
}
$season_info = season_info($season);
if (sizeof($season_info) == 0)
{
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
$season_name = '';
}
else
{
$season_name = $season_info["season_name"];
$league_info = league_info($season, $league);
if (sizeof($league_info) == 0)
{
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
$league_name = '';
}
else
{
$league_name = $league_info["league_name"];
$team_info = team_info($season, $league, $team_id);
if (sizeof($team_info) == 0)
{
$error_message .= sprintf($user->lang['NO_TEAM_ID']) . '<br />';
$team_name = '';
$logo = '';
}
else
{
$team_name = $team_info["team_name"];
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $team_info["team_symbol"] . "\" alt=\"" . $team_info["team_symbol"] . "\" width=\"28\" height=\"28\"/>" ;
}
}
}
}
$sidename = sprintf($user->lang['PLAN']);
if ($data_plan)
{
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_PLAN' => $data_plan,
'S_DATA_GROUP' => $data_group,
'S_ERROR_MESSAGE' => $error_message,
'MODE_DESC' => $mode_desc,
'LOGO' => $logo,
'TEAM' => $team_name,
'SEASON' => $season_name,
'LEAGUE' => $league_name,
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'S_DATA_RESULTS' => $data_results,
)
);
// output page
page_header($mode_desc . ' ' . $team_name);
}
else
{
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_PLAN' => $data_plan,
'S_DATA_GROUP' => false,
'S_ERROR_MESSAGE' => $error_message,
'MODE_DESC' => $mode_desc,
'LOGO' => '',
'TEAM' => '',
'SEASON' => '',
'LEAGUE' => '',
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'S_DATA_RESULTS' => false,
)
);
// output page
page_header($mode_desc);
}
$template->set_filenames(array(
'body' => 'viewplan_popup.html')
);
page_footer();
?>
<?php
/**
*
* @package phpBB Extension - Football Football
* @copyright (c) 2016 football (http://football.bplaced.net)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
if (!defined('IN_PHPBB'))
{
exit;
}
// Can this user view Prediction Leagues pages?
if (!$config['football_guest_view'])
{
if ($user->data['user_id'] == ANONYMOUS)
{
trigger_error('NO_GUEST_VIEW');
}
}
if (!$config['football_user_view'])
{
// Only Prediction League member should see this page
// Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') )
{
trigger_error('NO_AUTH_VIEW');
}
}
// Football disabled?
if ($config['football_disable'])
{
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message);
}
$mode = $this->request->variable('mode', '');
$season = $this->request->variable('s', 0);
$league = $this->request->variable('l', 0);
$team_id = $this->request->variable('tid', 0);
switch($mode)
{
case 'played':
$mode_desc = sprintf($user->lang['PLAYED_MATCHES']);
$where = ' AND m.status IN (3,6) ';
$data_results = true;
break;
case 'rest':
$mode_desc = sprintf($user->lang['REST_MATCHES']);
$where = ' AND m.status IN (0,1,2,4,5) ';
$data_results = false;
break;
case 'home':
$mode_desc = sprintf($user->lang['HOME_MATCHES']);
$where = " AND m.team_id_home = $team_id AND m.status IN (3,6) ";
$data_results = true;
break;
case 'away':
$mode_desc = sprintf($user->lang['AWAY_MATCHES']);
$where = " AND m.team_id_guest = $team_id AND m.status IN (3,6) ";
$data_results = true;
break;
// ALL is Default
default:
$mode_desc = sprintf($user->lang['ALL_MATCHES']);
$where = '';
$data_results = true;
break;
}
// Check parms
$error_message = '';
if (!$season OR !$league OR !$team_id)
{
$data_plan = false;
if (!$season)
{
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
}
if (!$league)
{
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
}
if (!$team_id)
{
$error_message .= sprintf($user->lang['NO_TEAM_ID']) . '<br />';
}
}
else
{
$data_group = false;
$lang_dates = $user->lang['datetime'];
// Calculate matches and bets of matchday
$sql = "SELECT
IF(m.team_id_home = $team_id, 'H', 'A') AS match_place,
IF(((m.status=3) OR (m.status=6)),
IF(m.team_id_home = $team_id,
IF(m.goals_home + 0 > m.goals_guest, 'match_win', IF(m.goals_home = m.goals_guest, 'match_draw', 'match_lost')),
IF(m.goals_home + 0 < m.goals_guest, 'match_win', IF(m.goals_home = m.goals_guest, 'match_draw', 'match_lost'))),
'') AS match_style,
m.match_no,
m.matchday,
m.status,
m.group_id,
t1.team_symbol AS home_symbol,
t2.team_symbol AS guest_symbol,
t1.team_id AS home_id,
t2.team_id AS guest_id,
t1.team_name AS home_name,
t2.team_name AS guest_name,
t1.team_name_short AS home_short,
t2.team_name_short AS guest_short,
m.goals_home,
m.goals_guest,
CONCAT(
CASE DATE_FORMAT(m.match_datetime,'%w')
WHEN 0 THEN '" . $lang_dates['Sun'] . "'
WHEN 1 THEN '" . $lang_dates['Mon'] . "'
WHEN 2 THEN '" . $lang_dates['Tue'] . "'
WHEN 3 THEN '" . $lang_dates['Wed'] . "'
WHEN 4 THEN '" . $lang_dates['Thu'] . "'
WHEN 5 THEN '" . $lang_dates['Fri'] . "'
WHEN 6 THEN '" . $lang_dates['Sat'] . "'
ELSE 'Error' END,
DATE_FORMAT(m.match_datetime,' %d.%m. %H:%i')
) AS match_time
FROM " . FOOTB_MATCHES . ' AS m
LEFT JOIN ' . FOOTB_TEAMS . ' AS t1 ON (t1.season = m.season AND t1.league = m.league AND t1.team_id=m.team_id_home)
LEFT JOIN ' . FOOTB_TEAMS . " AS t2 ON (t2.season = m.season AND t2.league = m.league AND t2.team_id=m.team_id_guest)
WHERE m.season = $season
AND m.league = $league
AND (m.team_id_home = $team_id OR m.team_id_guest = $team_id)
$where
GROUP BY m.match_no
ORDER BY m.match_datetime ASC, m.match_no ASC";
$result = $db->sql_query($sql);
if ($row = $db->sql_fetchrow($result))
{
$data_plan = true;
$matchnumber = 0;
$ext_path = $this->phpbb_path_helper->update_web_root_path($this->phpbb_extension_manager->get_extension_path('football/football', true));
do
{
$matchnumber++ ;
$row_class = (!($matchnumber % 2)) ? 'bg1 row_light' : 'bg2 row_dark';
$display_link = true;
$homelogo = $row['home_symbol'];
$guestlogo = $row['guest_symbol'];
if ($homelogo <> '')
{
$logoH = "<img src=\"" . $ext_path . 'images/flags/' . $homelogo . "\" alt=\"" . $homelogo . "\" width=\"28\" height=\"28\"/>" ;
}
else
{
$logoH = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
}
if ($guestlogo <> '')
{
$logoG = "<img src=\"" . $ext_path . 'images/flags/' . $guestlogo . "\" alt=\"" . $guestlogo . "\" width=\"28\" height=\"28\"/>" ;
}
else
{
$logoG = "<img src=\"" . $ext_path . "images/flags/blank.gif\" alt=\"\" width=\"28\" height=\"28\"/>" ;
}
if ($row['group_id'] == '')
{
$group_id = '&nbsp;';
}
else
{
$data_group = true;
$group_id = $row['group_id'];
}
if ($row['match_place'] == 'H')
{
$color_home = $row['match_style'];
$color_guest = '';
}
else
{
$color_home = '';
$color_guest = $row['match_style'];
}
$color_goals = $row['match_style'];
$template->assign_block_vars('match', array(
'ROW_CLASS' => $row_class,
'MATCH_TIME' => $row['match_time'],
'GROUP' => $group_id,
'LOGO_HOME' => $logoH,
'LOGO_GUEST' => $logoG,
'HOME_NAME' => $row['home_short'],
'GUEST_NAME' => $row['guest_short'],
'GOALS_HOME' => ($row['goals_home'] == '') ? '&nbsp;' : $row['goals_home'],
'GOALS_GUEST' => ($row['goals_guest'] == '') ? '&nbsp;' : $row['goals_guest'],
'COLOR_HOME' => $color_home,
'COLOR_GUEST' => $color_guest,
'COLOR_GOALS' => $color_goals,
)
);
}
while ($row = $db->sql_fetchrow($result));
$db->sql_freeresult($result);
}
else
{
$data_plan = false;
}
$season_info = season_info($season);
if (sizeof($season_info) == 0)
{
$error_message .= sprintf($user->lang['NO_SEASON']) . '<br />';
$season_name = '';
}
else
{
$season_name = $season_info["season_name"];
$league_info = league_info($season, $league);
if (sizeof($league_info) == 0)
{
$error_message .= sprintf($user->lang['NO_LEAGUE']) . '<br />';
$league_name = '';
}
else
{
$league_name = $league_info["league_name"];
$team_info = team_info($season, $league, $team_id);
if (sizeof($team_info) == 0)
{
$error_message .= sprintf($user->lang['NO_TEAM_ID']) . '<br />';
$team_name = '';
$logo = '';
}
else
{
$team_name = $team_info["team_name"];
$logo = "<img src=\"" . $ext_path . 'images/flags/' . $team_info["team_symbol"] . "\" alt=\"" . $team_info["team_symbol"] . "\" width=\"28\" height=\"28\"/>" ;
}
}
}
}
$sidename = sprintf($user->lang['PLAN']);
if ($data_plan)
{
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_PLAN' => $data_plan,
'S_DATA_GROUP' => $data_group,
'S_ERROR_MESSAGE' => $error_message,
'MODE_DESC' => $mode_desc,
'LOGO' => $logo,
'TEAM' => $team_name,
'SEASON' => $season_name,
'LEAGUE' => $league_name,
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'S_DATA_RESULTS' => $data_results,
)
);
// output page
page_header($mode_desc . ' ' . $team_name);
}
else
{
$template->assign_vars(array(
'S_SIDENAME' => $sidename,
'S_DATA_PLAN' => $data_plan,
'S_DATA_GROUP' => false,
'S_ERROR_MESSAGE' => $error_message,
'MODE_DESC' => $mode_desc,
'LOGO' => '',
'TEAM' => '',
'SEASON' => '',
'LEAGUE' => '',
'S_FOOTBALL_COPY' => sprintf($user->lang['FOOTBALL_COPY'], $config['football_version'], $phpbb_root_path . 'football/'),
'S_DATA_RESULTS' => false,
)
);
// output page
page_header($mode_desc);
}
$template->set_filenames(array(
'body' => 'viewplan_popup.html')
);
page_footer();