Version 0.9.9

- Code cleaning
This commit is contained in:
football
2021-04-06 23:39:05 +02:00
parent 80e99f7a11
commit 75c02e1eb8
42 changed files with 165 additions and 164 deletions

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }
@@ -71,5 +71,3 @@ $template->assign_vars(array(
'S_DATA_DELIVERY' => $data_delivery, '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'); $this->user->add_lang_ext('football/football', 'info_acp_bank');
// Check Prediction League authorisation // Check Prediction League authorisation

View File

@@ -7,6 +7,11 @@
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
$this->user->add_lang_ext('football/football', 'info_acp_bank'); $this->user->add_lang_ext('football/football', 'info_acp_bank');
// Check Prediction League authorisation // Check Prediction League authorisation
@@ -96,4 +101,3 @@ else
exit_handler(); exit_handler();
} }
} }
?>

View File

@@ -7,6 +7,11 @@
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
// Check Prediction League authorisation // Check Prediction League authorisation
if ( !$this->auth->acl_get('u_use_football') ) if ( !$this->auth->acl_get('u_use_football') )
{ {

View File

@@ -7,6 +7,11 @@
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
$vert = 9; $vert = 9;
$start = 22; $start = 22;
$end = 28; $end = 28;
@@ -1342,4 +1347,3 @@ $template->set_filenames(array(
); );
page_footer(); page_footer();
?>

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }
@@ -146,5 +146,3 @@ $template->assign_vars(array(
'S_USER_IS_MEMBER' => $user_is_member, '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_DISPLAY_LAST_USERS' => $display_last_users,
'S_LAST_USERS' => true, 'S_LAST_USERS' => true,
)); ));
?>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }
@@ -91,4 +91,3 @@ if ($league <> 0)
) )
); );
} }
?>

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }

View File

@@ -7,7 +7,7 @@
* *
*/ */
if (!defined('IN_PHPBB') OR !defined('IN_FOOTBALL')) if (!defined('IN_PHPBB'))
{ {
exit; exit;
} }

View File

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

View File

@@ -7,6 +7,11 @@
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
// Can this user view Prediction Leagues pages? // Can this user view Prediction Leagues pages?
if (!$config['football_guest_view']) if (!$config['football_guest_view'])
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -5,7 +5,7 @@
"homepage" : "http://football.bplaced.net", "homepage" : "http://football.bplaced.net",
"version" : "0.9.9", "version" : "0.9.9",
"time" : "2021-04-04", "time" : "2021-04-04",
"license" : "GPL-2.0", "license" : "GPL-2.0-only",
"authors" : [{ "authors" : [{
"name" : "J. Helmke", "name" : "J. Helmke",
"email" : "phpBB3.football@gmx.de", "email" : "phpBB3.football@gmx.de",

View File

@@ -122,7 +122,6 @@ class download
{ {
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED'; $message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message); trigger_error($message);
exit;
} }
// Can this user view Prediction Leagues pages? // Can this user view Prediction Leagues pages?

View File

@@ -137,7 +137,6 @@ class main
{ {
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED'; $message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message); trigger_error($message);
exit;
} }
// Can this user view Prediction Leagues pages? // Can this user view Prediction Leagues pages?

View File

@@ -128,7 +128,6 @@ class popup
{ {
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED'; $message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message); trigger_error($message);
exit;
} }
// Can this user view Prediction Leagues pages? // Can this user view Prediction Leagues pages?

View File

@@ -105,7 +105,6 @@ class xmlplan
{ {
$message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED'; $message = (!empty($config['football_disable_msg'])) ? $config['football_disable_msg'] : 'FOOTBALL_DISABLED';
trigger_error($message); trigger_error($message);
exit;
} }

View File

@@ -333,4 +333,3 @@ class football_remember extends \phpbb\cron\task\base
} }
} }
} }
?>

View File

@@ -9,6 +9,11 @@
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
$values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0; $values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
$graphvalues1 = explode(",",$values1); $graphvalues1 = explode(",",$values1);
$matchdays = sizeof($graphvalues1); $matchdays = sizeof($graphvalues1);
@@ -63,4 +68,3 @@ for ($i = 0; $i < $count_values; $i++)
// Output graph and clear image from memory // Output graph and clear image from memory
imagepng($image); imagepng($image);
imagedestroy($image); imagedestroy($image);
?>

View File

@@ -8,6 +8,11 @@
* @license http://opensource.org/licenses/gpl-license.php GNU Public License * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
$matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0; $matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0;
$values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0; $values1 = ( isset($_GET['v1']) ) ? $_GET['v1'] : 0;
@@ -123,4 +128,3 @@ for ($i = 1; $i < $count_values; $i++)
// Output graph and clear image from memory // Output graph and clear image from memory
imagepng($image); imagepng($image);
imagedestroy($image); imagedestroy($image);
?>

View File

@@ -8,6 +8,11 @@
* @license http://opensource.org/licenses/gpl-license.php GNU Public License * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* *
*/ */
if (!defined('IN_PHPBB'))
{
exit;
}
$numb_users = ( isset($_GET['t']) ) ? intval($_GET['t']) : 0; $numb_users = ( isset($_GET['t']) ) ? intval($_GET['t']) : 0;
$matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0; $matchdays = ( isset($_GET['m']) ) ? intval($_GET['m']) : 0;
@@ -94,4 +99,3 @@ for ($i = 1; $i < $count_values; $i++)
// Output graph and clear image from memory // Output graph and clear image from memory
imagepng($image); imagepng($image);
imagedestroy($image); imagedestroy($image);
?>

View File

@@ -42,4 +42,3 @@ define('UP_WINS', 1);
define('UP_POINTS', 2); define('UP_POINTS', 2);
define('LEAGUE_CHAMP', 1); define('LEAGUE_CHAMP', 1);
define('LEAGUE_KO', 2); define('LEAGUE_KO', 2);
?>

View File

@@ -11,66 +11,63 @@
* Automatically write the league as XML-file * Automatically write the league as XML-file
*/ */
if (!defined('IN_PHPBB')) // Stuff required to work with phpBB3
{ define('IN_PHPBB', true);
// Stuff required to work with phpBB3 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../../../../';
define('IN_PHPBB', true); $phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../../../../'; include($phpbb_root_path . 'common.' . $phpEx);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management // Start session management
$user->session_begin(); $user->session_begin();
$auth->acl($user->data); $auth->acl($user->data);
$user->setup(); $user->setup();
$user->add_lang_ext('football/football', 'info_acp_update'); $user->add_lang_ext('football/football', 'info_acp_update');
include('../includes/constants.' . $phpEx); include('../includes/constants.' . $phpEx);
if ($config['board_disable']) if ($config['board_disable'])
{ {
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
trigger_error($message); trigger_error($message);
} }
$season = $request->variable('season', 0);
$league = $request->variable('league', 0);
if (!$season or !$league)
{
exit;
}
$download = $request->variable('d', false);
$xml_string = xml_data($season, $league);
if ( $xml_string == '')
{
trigger_error('Fehler! Die XML-Datei konnte nicht erzeugt werden.');
}
if ($download) $season = $request->variable('season', 0);
{ $league = $request->variable('league', 0);
// Download XML-File if (!$season or !$league)
$filename = 'league_' . $season . '_' . $league . '.xml'; {
$fp = fopen('php://output', 'w'); trigger_error('Keine gültige Saison oder Liga gewählt.');
}
header('Pragma: no-cache');
header("Content-Type: application/xml name=\"" . basename($filename) . "\""); $download = $request->variable('d', false);
header("Content-disposition: attachment; filename=\"" . basename($filename) . "\""); $xml_string = xml_data($season, $league);
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); if ( $xml_string == '')
header('Cache-Control: private', false); {
header('Pragma: public'); trigger_error('Fehler! Die XML-Datei konnte nicht erzeugt werden.');
}
fwrite($fp, $xml_string);
fclose($fp); if ($download)
exit_handler(); {
} // Download XML-File
else $filename = 'league_' . $season . '_' . $league . '.xml';
{ $fp = fopen('php://output', 'w');
// XML header
header ("content-type: text/xml"); header('Pragma: no-cache');
echo $xml_string; header("Content-Type: application/xml name=\"" . basename($filename) . "\"");
} 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');
fwrite($fp, $xml_string);
fclose($fp);
exit_handler();
}
else
{
// XML header
header ("content-type: text/xml");
echo $xml_string;
} }
function xml_data($season, $league) function xml_data($season, $league)

View File

@@ -11,46 +11,43 @@
* Automatically write the seasons and leagues as XML-file * Automatically write the seasons and leagues as XML-file
*/ */
if (!defined('IN_PHPBB')) // Stuff required to work with phpBB3
{ define('IN_PHPBB', true);
// Stuff required to work with phpBB3 $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../../../../';
define('IN_PHPBB', true); $phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../../../../'; include($phpbb_root_path . 'common.' . $phpEx);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management // Start session management
$user->session_begin(); $user->session_begin();
$auth->acl($user->data); $auth->acl($user->data);
$user->setup(); $user->setup();
$user->add_lang_ext('football/football', 'info_acp_update'); $user->add_lang_ext('football/football', 'info_acp_update');
include('../includes/constants.' . $phpEx); include('../includes/constants.' . $phpEx);
if ($config['board_disable']) if ($config['board_disable'])
{ {
$message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE';
trigger_error($message); trigger_error($message);
}
//Check Access Code
global $code;
$code = $request->variable('code', '');
if (strcmp($code, trim($config['football_update_code'])) <> 0)
{
trigger_error('ERROR_XML_CODE');
}
$string = xml_seasons();
if ( $string == '')
{
trigger_error('ERROR_XML_CREATE');
}
header ("content-type: text/xml");
echo $string;
} }
//Check Access Code
global $code;
$code = $request->variable('code', '');
if (strcmp($code, trim($config['football_update_code'])) <> 0)
{
trigger_error('ERROR_XML_CODE');
}
$string = xml_seasons();
if ( $string == '')
{
trigger_error('ERROR_XML_CREATE');
}
header ("content-type: text/xml");
echo $string;
function xml_seasons() function xml_seasons()
{ {
global $db, $phpbb_root_path, $phpEx, $table_prefix, $code, $ext_path; global $db, $phpbb_root_path, $phpEx, $table_prefix, $code, $ext_path;