Version 0.9.5
This commit is contained in:
66
includes/chart_hist.php
Normal file
66
includes/chart_hist.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: chart_hist.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
|
||||
*
|
||||
*/
|
||||
|
||||
$values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
|
||||
$graphvalues1 = explode(",",$values1);
|
||||
$matchdays = sizeof($graphvalues1);
|
||||
|
||||
// Define .PNG image
|
||||
header("Content-type: image/png");
|
||||
$horz = 15;
|
||||
$vert = 9;
|
||||
$start = 25;
|
||||
$imgWidth= $matchdays * $vert + 20;
|
||||
$imgHeight=90;
|
||||
|
||||
// Create image and define colors
|
||||
$image = imagecreate($imgWidth, $imgHeight);
|
||||
$colorBackground = imagecolorallocate($image, 236, 240, 246);
|
||||
$colorWhite = imagecolorallocate($image, 255, 255, 255);
|
||||
$colorBlack = imagecolorallocate($image, 0, 0, 0);
|
||||
$colorGrey = imagecolorallocate($image, 106, 106, 106);
|
||||
$colorBlue = imagecolorallocate($image, 0, 0, 255);
|
||||
$colorRed = imagecolorallocate($image, 176, 0, 0);
|
||||
$colorGreen = imagecolorallocate($image, 0, 176, 0);
|
||||
|
||||
imagefill($image, 0, 0, $colorBackground);
|
||||
|
||||
imageline($image, 0, 45, $imgWidth, 45, $colorGrey);
|
||||
imagestring($image,4, 5, 15, 'H', $colorBlack);
|
||||
imagestring($image,4, 5, 60, 'A', $colorBlack);
|
||||
|
||||
imagesetthickness($image, 5);
|
||||
|
||||
$count_values=count($graphvalues1);
|
||||
// Create line graph
|
||||
for ($i = 0; $i < $count_values; $i++)
|
||||
{
|
||||
if (substr($graphvalues1[$i],0,1) == '-')
|
||||
{
|
||||
imageline($image, $start + ($i * $vert), 45, $start + ($i * $vert), substr($graphvalues1[$i], 1, strlen($graphvalues1[$i]) - 1), $colorRed);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($graphvalues1[$i],0,1) == ' ')
|
||||
{
|
||||
imageline($image, $start + ($i * $vert), 45, $start + ($i * $vert), substr($graphvalues1[$i], 1, strlen($graphvalues1[$i]) - 1), $colorGreen);
|
||||
}
|
||||
else
|
||||
{
|
||||
imageline($image, $start + ($i * $vert), 45, $start + ($i * $vert), substr($graphvalues1[$i], 0, strlen($graphvalues1[$i])), $colorGrey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output graph and clear image from memory
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
126
includes/chart_points.php
Normal file
126
includes/chart_points.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: chart_points.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
|
||||
*
|
||||
*/
|
||||
|
||||
$matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0;
|
||||
$values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
|
||||
$values2 = ( isset($_GET['v2']) ) ? $_GET['v2'] : 0;
|
||||
$values3 = ( isset($_GET['v3']) ) ? $_GET['v3'] : 0;
|
||||
$values4 = ( isset($_GET['v4']) ) ? $_GET['v4'] : 0;
|
||||
$valuesmin = ( isset($_GET['min']) ) ? $_GET['min'] : 0;
|
||||
$valuesmax = ( isset($_GET['max']) ) ? $_GET['max'] : 0;
|
||||
$caption = ( isset($_GET['c']) ) ? $_GET['c'] : '';
|
||||
|
||||
$graphvalues1 = explode(",", $values1);
|
||||
$graphvalues2 = explode(",", $values2);
|
||||
$graphvalues3 = explode(",", $values3);
|
||||
$graphvalues4 = explode(",", $values4);
|
||||
$graphvaluesmin = explode(",", $valuesmin);
|
||||
$graphvaluesmax = explode(",", $valuesmax);
|
||||
$caption_lang = explode(",", $caption);
|
||||
|
||||
// Define .PNG image
|
||||
header("Content-type: image/png");
|
||||
$horz = 20;
|
||||
$vert = 24;
|
||||
$horzp = 4;
|
||||
$maximum = max($graphvaluesmax);
|
||||
$rows = (int) ($maximum / 5) + 2;
|
||||
$maximum = ($rows - 1) * 5;
|
||||
$imgWidth = $matchdays * $vert + 10;
|
||||
$imgHeight = $rows * $horz + 50;
|
||||
|
||||
if ($imgWidth < 106)
|
||||
$imgWidth = 106;
|
||||
|
||||
// Create image and define colors
|
||||
$image=imagecreate($imgWidth, $imgHeight);
|
||||
$colorWhite=imagecolorallocate($image, 255, 255, 255);
|
||||
$colorBlack=imagecolorallocate($image, 0, 0, 0);
|
||||
$colorGrey=imagecolorallocate($image, 192, 192, 192);
|
||||
$colorBlue=imagecolorallocate($image, 0, 0, 255);
|
||||
$colorRed=imagecolorallocate($image, 255, 0, 0);
|
||||
$colorGreen=imagecolorallocate($image, 0, 255, 0);
|
||||
$colorAzur=imagecolorallocate($image, 0, 255, 255);
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $rows; $i++)
|
||||
{
|
||||
imageline($image, $vert, $i * $horz, $imgWidth - 10, $i * $horz, $colorGrey);
|
||||
if ($i > ($rows - 2))
|
||||
imagestring($image, 3, 10, $i * $horz - 6, $maximum - (($i - 1) * 5), $colorBlack);
|
||||
else
|
||||
imagestring($image, 3, 3,$i * $horz - 6, $maximum - (($i - 1) * 5), $colorBlack);
|
||||
}
|
||||
imagestring($image, 1, 0, 0, $caption_lang[0] , $colorBlack);
|
||||
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $matchdays; $i++)
|
||||
{
|
||||
$label = $i + 1;
|
||||
imageline($image, $i * $vert, $horz, $i * $vert, $imgHeight - 50, $colorGrey);
|
||||
if ($i < 10)
|
||||
imagestring($image,3,$i * $vert - 3, $imgHeight - 40, $i, $colorBlack);
|
||||
else
|
||||
imagestring($image, 3, $i * $vert - 6, $imgHeight - 40, $i, $colorBlack);
|
||||
}
|
||||
|
||||
imageline($image, 3, $imgHeight - $horz + 6, 15, $imgHeight - $horz + 6, $colorBlack);
|
||||
imagestring($image, 3, 20, $imgHeight - $horz, $caption_lang[1] , $colorBlack);
|
||||
|
||||
imagesetthickness($image, 2);
|
||||
|
||||
$count_values=count($graphvalues1);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues1[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues1[$i]) * $horzp + $horz), $colorBlue);
|
||||
}
|
||||
|
||||
$count_values=count($graphvalues2);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues2[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues2[$i]) * $horzp + $horz), $colorGreen);
|
||||
}
|
||||
|
||||
$count_values=count($graphvalues3);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues3[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues3[$i]) * $horzp + $horz), $colorAzur);
|
||||
}
|
||||
|
||||
$count_values=count($graphvalues4);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvalues4[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvalues4[$i]) * $horzp + $horz), $colorRed);
|
||||
}
|
||||
|
||||
$count_values=count($graphvaluesmin);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvaluesmin[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvaluesmin[$i]) * $horzp + $horz), $colorBlack);
|
||||
}
|
||||
|
||||
$count_values=count($graphvaluesmax);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, (($maximum - $graphvaluesmax[$i - 1]) * $horzp + $horz), ($i + 1) * $vert, (($maximum - $graphvaluesmax[$i]) * $horzp + $horz), $colorBlack);
|
||||
}
|
||||
|
||||
// Output graph and clear image from memory
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
97
includes/chart_rank.php
Normal file
97
includes/chart_rank.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Football
|
||||
* @version $Id: chart_rank.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
|
||||
*
|
||||
*/
|
||||
|
||||
$numb_users = ( isset($_GET['t']) ) ? intval($_GET['t']) : 0;
|
||||
$matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0;
|
||||
$Values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
|
||||
$Values2 = ( isset($_GET['v2']) ) ? $_GET['v2'] : 0;
|
||||
$Values3 = ( isset($_GET['v3']) ) ? $_GET['v3'] : 0;
|
||||
$Values4 = ( isset($_GET['v4']) ) ? $_GET['v4'] : 0;
|
||||
$caption = ( isset($_GET['c']) ) ? $_GET['c'] : '';
|
||||
|
||||
$graphValues1 = explode(",",$Values1);
|
||||
$graphValues2 = explode(",",$Values2);
|
||||
$graphValues3 = explode(",",$Values3);
|
||||
$graphValues4 = explode(",",$Values4);
|
||||
|
||||
// Define .PNG image
|
||||
header("Content-type: image/png");
|
||||
$horz = 15;
|
||||
$vert = 24;
|
||||
$imgWidth=$matchdays * $vert + 10;
|
||||
$imgHeight=$numb_users * $horz + 20;
|
||||
|
||||
// Create image and define colors
|
||||
$image=imagecreate($imgWidth, $imgHeight);
|
||||
$colorWhite=imagecolorallocate($image, 255, 255, 255);
|
||||
$colorBlack=imagecolorallocate($image, 0, 0, 0);
|
||||
$colorGrey=imagecolorallocate($image, 192, 192, 192);
|
||||
$colorBlue=imagecolorallocate($image, 0, 0, 255);
|
||||
$colorRed=imagecolorallocate($image, 255, 0, 0);
|
||||
$colorGreen=imagecolorallocate($image, 0, 255, 0);
|
||||
$colorAzur=imagecolorallocate($image, 0, 255, 255);
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $numb_users; $i++)
|
||||
{
|
||||
imageline($image, $vert, $i * $horz, $imgWidth - 10, $i * $horz, $colorGrey);
|
||||
if ($i < 10)
|
||||
imagestring($image,3,10,$i * $horz - 6,$i,$colorBlack);
|
||||
else
|
||||
imagestring($image,3,3,$i * $horz - 6,$i,$colorBlack);
|
||||
}
|
||||
imagestring($image, 1, 0, 0, $caption, $colorBlack);
|
||||
|
||||
// Create grid
|
||||
for ($i = 1; $i <= $matchdays; $i++)
|
||||
{
|
||||
$label = $i + 1;
|
||||
imageline($image, $i * $vert, $horz, $i * $vert, $imgHeight - 20, $colorGrey);
|
||||
if ($i < 10)
|
||||
imagestring($image, 3,$i * $vert - 3,$imgHeight - $horz, $i, $colorBlack);
|
||||
else
|
||||
imagestring($image, 3,$i * $vert - 6,$imgHeight - $horz, $i, $colorBlack);
|
||||
}
|
||||
|
||||
imagesetthickness($image, 2);
|
||||
|
||||
$count_values=count($graphValues1);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues1[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues1[$i] * $horz), $colorBlue);
|
||||
}
|
||||
|
||||
$count_values=count($graphValues2);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues2[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues2[$i] * $horz), $colorGreen);
|
||||
}
|
||||
|
||||
$count_values=count($graphValues3);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues3[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues3[$i] * $horz), $colorAzur);
|
||||
}
|
||||
|
||||
$count_values=count($graphValues4);
|
||||
// Create line graph
|
||||
for ($i = 1; $i < $count_values; $i++)
|
||||
{
|
||||
imageline($image, $i * $vert, ($graphValues4[$i - 1] * $horz), ($i + 1) * $vert, ($graphValues4[$i] * $horz), $colorRed);
|
||||
}
|
||||
|
||||
// Output graph and clear image from memory
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
?>
|
||||
45
includes/constants.php
Normal file
45
includes/constants.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
global $table_prefix;
|
||||
|
||||
// Config constants
|
||||
define('FOOTB_BETS', $table_prefix . 'footb_bets');
|
||||
define('FOOTB_EXTRA_BETS', $table_prefix . 'footb_extra_bets');
|
||||
define('FOOTB_EXTRA', $table_prefix . 'footb_extra');
|
||||
define('FOOTB_LEAGUES', $table_prefix . 'footb_leagues');
|
||||
define('FOOTB_MATCHDAYS', $table_prefix . 'footb_matchdays');
|
||||
define('FOOTB_MATCHES', $table_prefix . 'footb_matches');
|
||||
define('FOOTB_MATCHES_HIST', $table_prefix . 'footb_matches_hist');
|
||||
define('FOOTB_POINTS', $table_prefix . 'footb_points');
|
||||
define('FOOTB_RANKS', $table_prefix . 'footb_rank_matchdays');
|
||||
define('FOOTB_SEASONS', $table_prefix . 'footb_seasons');
|
||||
define('FOOTB_TEAMS', $table_prefix . 'footb_teams');
|
||||
define('FOOTB_TEAMS_HIST', $table_prefix . 'footb_teams_hist');
|
||||
define('BET_KO_90', 1);
|
||||
define('BET_KO_EXTRATIME', 2);
|
||||
define('BET_KO_PENALTY', 3);
|
||||
define('POINTS_BET', 1);
|
||||
define('POINTS_DEPOSITED', 2);
|
||||
define('POINTS_MATCHDAY', 3);
|
||||
define('POINTS_SEASON', 4);
|
||||
define('POINTS_MOST_HITS', 5);
|
||||
define('POINTS_MOST_HITS_AWAY', 6);
|
||||
define('POINTS_PAID', 7);
|
||||
define('UP_NONE', 0);
|
||||
define('UP_WINS', 1);
|
||||
define('UP_POINTS', 2);
|
||||
define('LEAGUE_CHAMP', 1);
|
||||
define('LEAGUE_KO', 2);
|
||||
?>
|
||||
271
includes/export.php
Normal file
271
includes/export.php
Normal file
@@ -0,0 +1,271 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
$sql = 'SELECT *
|
||||
FROM ' . FOOTB_LEAGUES . "
|
||||
WHERE season = $season
|
||||
AND league = $league";
|
||||
if( !$result = $db->sql_query($sql) )
|
||||
{
|
||||
trigger_error('NO_LEAGUE');
|
||||
}
|
||||
$league_short = $db->sql_fetchfield('league_name_short');
|
||||
$db->sql_freeresult($result);
|
||||
$export_file = $league_short . '_'. $season. '_Tipps.csv';
|
||||
$path_attachment = './../../files/' . $export_file;
|
||||
$newline = "\r\n";
|
||||
|
||||
if (!isset($_POST['send']))
|
||||
{
|
||||
header('Pragma: no-cache');
|
||||
header("Content-Type: text/csv; name=\"$export_file\"");
|
||||
header("Content-disposition: attachment; filename=$export_file");
|
||||
|
||||
// header('Content-Type: text/x-csv');
|
||||
// header('Expires: ' . gmdate('D, d M Y H:i:m') . ' GMT');
|
||||
// header('Content-Disposition: attachment; filename='. $export_file);
|
||||
$phpbb_root_path = './../';
|
||||
}
|
||||
else
|
||||
{
|
||||
$phpbb_root_path = './../../';
|
||||
}
|
||||
|
||||
$sql_users = 'SELECT DISTINCT
|
||||
b.user_id,
|
||||
u.username
|
||||
FROM ' . FOOTB_BETS . ' AS b
|
||||
LEFT JOIN ' . USERS_TABLE . " AS u ON (u.user_id = b.user_id)
|
||||
WHERE b.season = $season AND b.league = $league
|
||||
ORDER BY b.user_id ASC";
|
||||
|
||||
$sql_results = "SELECT
|
||||
m.match_no,
|
||||
DATE_FORMAT(m.match_datetime,'%d.%m.%Y') AS match_time,
|
||||
m.matchday,
|
||||
m.formula_home,
|
||||
m.formula_guest,
|
||||
t1.team_id AS hid,
|
||||
t2.team_id AS gid,
|
||||
t1.team_name_short AS team_home,
|
||||
t2.team_name_short AS team_guest,
|
||||
m.status,
|
||||
m.goals_home,
|
||||
m.goals_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)
|
||||
WHERE m.season = $season AND m.league = $league
|
||||
ORDER BY m.match_no ASC";
|
||||
|
||||
$sql_bets = "SELECT
|
||||
m.matchday,
|
||||
m.match_no,
|
||||
b.user_id,
|
||||
IF(m.status > 0, b.goals_home, '') AS bet_home,
|
||||
IF(m.status > 0, b.goals_guest, '') AS bet_guest
|
||||
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)
|
||||
WHERE m.season = $season AND m.league = $league
|
||||
ORDER BY matchday ASC, match_no ASC, user_id ASC";
|
||||
|
||||
if(!$result_users = $db->sql_query($sql_users))
|
||||
{
|
||||
trigger_error('NO_USER');
|
||||
}
|
||||
$rows_users = $db->sql_fetchrowset($result_users);
|
||||
$count_user = sizeof($rows_users);
|
||||
$db->sql_freeresult($result_users);
|
||||
$j = 0;
|
||||
$column = array();
|
||||
foreach ($rows_users as $row_user)
|
||||
{
|
||||
$column[(8 + (3 * ($j)))] = str_replace("\"", "\"\"", $row_user['username']);
|
||||
$lastcolumn = 8 + (3 * ($j));
|
||||
$bet_column[$row_user['user_id']] = $lastcolumn;
|
||||
$j++;
|
||||
}
|
||||
$export_row_users = "\"\";\"\";\"\";\"\";\"\";\"\";";
|
||||
for($j = 8; $j <= $lastcolumn; $j = $j + 3)
|
||||
{
|
||||
$export_row_users .= "\"\";\"\";\"" . $column[$j] . "\"";
|
||||
if($j != $lastcolumn)
|
||||
{
|
||||
$export_row_users .= ';';
|
||||
}
|
||||
}
|
||||
$export_row_users .= $newline;
|
||||
|
||||
if( !$result_results = $db->sql_query($sql_results) )
|
||||
{
|
||||
trigger_error('NO_RESULTS');
|
||||
}
|
||||
$rows_results = $db->sql_fetchrowset($result_results);
|
||||
$count_results = sizeof($rows_results);
|
||||
$db->sql_freeresult($result_results);
|
||||
|
||||
if( !$result_bets = $db->sql_query($sql_bets) )
|
||||
{
|
||||
trigger_error('NO_BETS');
|
||||
}
|
||||
$rows_bets = $db->sql_fetchrowset($result_bets);
|
||||
$count_bets = sizeof($rows_bets);
|
||||
$db->sql_freeresult($result_results);
|
||||
$column = array();
|
||||
$lastcolumn = 0;
|
||||
$last_match_num = 0;
|
||||
foreach ($rows_bets as $row_bet)
|
||||
{
|
||||
if ($row_bet['match_no'] == $last_match_num)
|
||||
{
|
||||
$column[$bet_column[$row_bet['user_id']]] = str_replace("\"", "\"\"", $row_bet['bet_home']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 1] = str_replace("\"", "\"\"", $row_bet['bet_guest']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 2] = '';
|
||||
$lastcolumn = $bet_column[$row_bet['user_id']] + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($lastcolumn > 0)
|
||||
{
|
||||
$export_bets[$last_match_num] = '';
|
||||
for($j=8; $j<=$lastcolumn; $j++)
|
||||
{
|
||||
$export_bets[$last_match_num] .= "\"" . $column[$j] . "\"";
|
||||
if($j!=$lastcolumn)
|
||||
{
|
||||
$export_bets[$last_match_num] .= ';';
|
||||
}
|
||||
}
|
||||
$export_bets[$last_match_num] .= $newline;
|
||||
}
|
||||
$column = array();
|
||||
$last_match_num = $row_bet['match_no'];
|
||||
$column[$bet_column[$row_bet['user_id']]] = str_replace("\"", "\"\"", $row_bet['bet_home']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 1] = str_replace("\"", "\"\"", $row_bet['bet_guest']);
|
||||
$column[$bet_column[$row_bet['user_id']] + 2] = '';
|
||||
$lastcolumn = $bet_column[$row_bet['user_id']] + 2;
|
||||
}
|
||||
}
|
||||
$export_bets[$last_match_num] = '';
|
||||
for($j = 8; $j <= $lastcolumn; $j++)
|
||||
{
|
||||
$export_bets[$last_match_num] .= "\"" . $column[$j] . "\"";
|
||||
if($j != $lastcolumn)
|
||||
{
|
||||
$export_bets[$last_match_num] .= ';';
|
||||
}
|
||||
}
|
||||
$export_bets[$last_match_num] .= $newline;
|
||||
|
||||
$last_matchday = 0;
|
||||
|
||||
$export= '';
|
||||
$export .= 'CSV;'. $league. ';'. $season. $newline;
|
||||
|
||||
$i = 0;
|
||||
foreach ($rows_results as $row_result)
|
||||
{
|
||||
if ($last_matchday != $row_result['matchday'])
|
||||
{
|
||||
if ($last_matchday != 0)
|
||||
{
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= ";;". str_replace("\"", "\"\"", $row_result['match_time']). $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
}
|
||||
else
|
||||
{
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= ";;". str_replace("\"", "\"\"", $row_result['match_time']). $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
$export .= $newline;
|
||||
}
|
||||
$export .= $export_row_users;
|
||||
$column = array();
|
||||
$last_matchday = $row_result['matchday'];
|
||||
}
|
||||
if (0 == $row_result['hid'])
|
||||
{
|
||||
$home_info = get_team($season, $league, $row_result['match_no'], 'team_id_home', $row_result['formula_home']);
|
||||
$home_in_array = explode("#",$home_info);
|
||||
$homename = $home_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$homename = $row_result['team_home'];
|
||||
}
|
||||
if (0 == $row_result['gid'])
|
||||
{
|
||||
$guest_info = get_team($season, $league, $row_result['match_no'], 'team_id_guest', $row_result['formula_guest']);
|
||||
$guest_in_array = explode("#",$guest_info);
|
||||
$guestname = $guest_in_array[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
$guestname = $row_result['team_guest'];
|
||||
}
|
||||
$column[0] = str_replace("\"", "\"\"", $homename);
|
||||
$column[1] = str_replace("\"", "\"\"", $guestname);
|
||||
|
||||
if ($row_result['status'] == 3)
|
||||
{
|
||||
$column[2] = str_replace("\"", "\"\"", $row_result['goals_home']);
|
||||
$column[4] = str_replace("\"", "\"\"", $row_result['goals_guest']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$column[2] = '';
|
||||
$column[4] = '';
|
||||
}
|
||||
$export .= "\"" . $column[0] . "\";\"" . $column[1] . "\";\"" . $column[2] . "\";\"\";\"" . $column[4] . "\";\"\";\"\";\"\";";
|
||||
if ($export_bets[$row_result['match_no']] == '')
|
||||
{
|
||||
$export .= $newline;
|
||||
}
|
||||
else
|
||||
{
|
||||
$export .= $export_bets[$row_result['match_no']];
|
||||
}
|
||||
$column = array();
|
||||
$i++;
|
||||
}
|
||||
|
||||
if (isset($_POST['send']))
|
||||
{
|
||||
$fp = fopen($path_attachment , "b");
|
||||
ftruncate ($fp, 0);
|
||||
rewind($fp);
|
||||
fwrite ($fp, $export);
|
||||
fclose($fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo utf8_decode($export);
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
2310
includes/functions.php
Normal file
2310
includes/functions.php
Normal file
File diff suppressed because it is too large
Load Diff
115
includes/version_check.php
Normal file
115
includes/version_check.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?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
|
||||
*
|
||||
*/
|
||||
|
||||
namespace football\football\includes;
|
||||
|
||||
class version_check
|
||||
{
|
||||
/**
|
||||
* @var array version_data
|
||||
*/
|
||||
protected $version_data;
|
||||
|
||||
/**
|
||||
* @var \phpbb\config\config
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* @var \phpbb\version_helper $version_helper phpBB version helper
|
||||
*/
|
||||
protected $version_helper;
|
||||
|
||||
/**
|
||||
* @var \phpbb\template\twig\twig
|
||||
*/
|
||||
protected $template;
|
||||
|
||||
/**
|
||||
* @var \phpbb\user
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
/**
|
||||
* @var string Current version
|
||||
*/
|
||||
protected $current_version;
|
||||
|
||||
/**
|
||||
* Construct a version_check object
|
||||
*
|
||||
* @param array $version_data Version data
|
||||
* @param \phpbb\config\config $config phpBB config
|
||||
* @param \phpbb\version_helper $version_helper phpBB version helper
|
||||
* @param \phpbb\template\twig\twig $template phpBB template object
|
||||
* @param \phpbb\user $user phpBB user object
|
||||
*/
|
||||
public function __construct($version_data, $config, $version_helper, $template, $user)
|
||||
{
|
||||
$this->version_data = $version_data;
|
||||
$this->config = $config;
|
||||
$this->version_helper = $version_helper;
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->current_version = $this->config[str_replace(' ', '', $this->version_data['version'])];
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Extension version and assign template variables for version info if not
|
||||
* returning current version
|
||||
*
|
||||
* @param bool $return_version Yes if current version should be returned
|
||||
* @return string Current version if $return_version is set to true
|
||||
*/
|
||||
public function check($return_version = false)
|
||||
{
|
||||
$allow_url_fopen = (int) @ini_get('allow_url_fopen');
|
||||
if ($allow_url_fopen)
|
||||
{
|
||||
|
||||
// Set file location
|
||||
$this->version_helper->set_file_location($this->version_data['file'][0], $this->version_data['file'][1], $this->version_data['file'][2]);
|
||||
// Set current version
|
||||
$this->version_helper->set_current_version($this->current_version);
|
||||
|
||||
$this->version_helper->force_stability(($this->config['extension_force_unstable'] || !$this->version_helper->is_stable($this->current_version)) ? 'unstable' : null);
|
||||
|
||||
$updates = $this->version_helper->get_suggested_updates(true);
|
||||
|
||||
// Return version if $return_version is set to true
|
||||
if ($return_version)
|
||||
{
|
||||
return $this->current_version;
|
||||
}
|
||||
|
||||
$version_up_to_date = empty($updates);
|
||||
|
||||
$template_data = array(
|
||||
'AUTHOR' => $this->version_data['author'],
|
||||
'CURRENT_VERSION' => $this->current_version,
|
||||
'UP_TO_DATE' => sprintf((!$version_up_to_date) ? $this->user->lang['NOT_UP_TO_DATE'] : $this->user->lang['UP_TO_DATE'], $this->version_data['title']),
|
||||
'S_UP_TO_DATE' => $version_up_to_date,
|
||||
'U_AUTHOR' => 'http://www.phpbb.com/community/memberlist.php?mode=viewprofile&un=' . $this->version_data['author'],
|
||||
'TITLE' => (string) $this->version_data['title'],
|
||||
'LATEST_VERSION' => $this->current_version,
|
||||
);
|
||||
|
||||
if (!$version_up_to_date)
|
||||
{
|
||||
$updates = array_shift($updates);
|
||||
$template_data = array_merge($template_data, array(
|
||||
'ANNOUNCEMENT' => (string) $updates['announcement'],
|
||||
'DOWNLOAD' => (string) $updates['download'],
|
||||
'LATEST_VERSION' => $updates['current'],
|
||||
));
|
||||
}
|
||||
$this->template->assign_block_vars('mods', $template_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user