Merge commit '665d71440c9798465a1b9885728f9beb798ccc01'
Conflicts: .gitignore
This commit is contained in:
commit
704fe07774
|
@ -1,3 +1,8 @@
|
|||
<<<<<<< HEAD
|
||||
/cache/savegame.zip
|
||||
cache/AutoDriveSort.exe - Shortcut.lnk
|
||||
nppBackup/farm.php
|
||||
=======
|
||||
/cache/
|
||||
nppBackup/
|
||||
>>>>>>> 665d71440c9798465a1b9885728f9beb798ccc01
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
<creationDate>2022-02-11</creationDate>
|
||||
<mapId>MapUS</mapId>
|
||||
<mapTitle>Elmcreek</mapTitle>
|
||||
<saveDateFormatted>2022-02-20</saveDateFormatted>
|
||||
<saveDate>2022-02-20</saveDate>
|
||||
<saveDateFormatted>2022-02-24</saveDateFormatted>
|
||||
<saveDate>2022-02-24</saveDate>
|
||||
<resetVehicles>false</resetVehicles>
|
||||
<trafficEnabled>true</trafficEnabled>
|
||||
<stopAndGoBraking>true</stopAndGoBraking>
|
||||
<trailerFillLimit>false</trailerFillLimit>
|
||||
<automaticMotorStartEnabled>false</automaticMotorStartEnabled>
|
||||
<growthMode>2</growthMode>
|
||||
<plannedDaysPerPeriod>1</plannedDaysPerPeriod>
|
||||
<growthMode>1</growthMode>
|
||||
<plannedDaysPerPeriod>3</plannedDaysPerPeriod>
|
||||
<fruitDestruction>true</fruitDestruction>
|
||||
<plowingRequiredEnabled>true</plowingRequiredEnabled>
|
||||
<stonesEnabled>true</stonesEnabled>
|
||||
|
@ -46,25 +46,23 @@
|
|||
<timeScale>5.000000</timeScale>
|
||||
<autoSaveInterval>30.000000</autoSaveInterval>
|
||||
</settings>
|
||||
<guidedTour active="false" currentStepIndex="0"/>
|
||||
<guidedTour active="false" currentStepIndex="0" state=""/>
|
||||
<map>
|
||||
<foundHelpIcons>00000000000000000000</foundHelpIcons>
|
||||
</map>
|
||||
<statistics>
|
||||
<money>130509</money>
|
||||
<playTime>3381.344971</playTime>
|
||||
<money>222437</money>
|
||||
<playTime>5271.405273</playTime>
|
||||
</statistics>
|
||||
<slotSystem slotUsage="462"/>
|
||||
<slotSystem slotUsage="1464"/>
|
||||
<mapsSplitShapeFileIds count="1">
|
||||
<id id="0"/>
|
||||
</mapsSplitShapeFileIds>
|
||||
<mod modName="FS22_kvernelandIXterB18" title="Kverneland iXter B18" version="1.0.0.0" required="false" fileHash="6e7de4e76b062af81c7b177bd49f809c"/>
|
||||
<mod modName="FS22_viconPS" title="Vicon PS 1004/1654" version="1.0.0.0" required="false" fileHash="7a8636712be3661756a6c9062cd69999"/>
|
||||
<mod modName="FS22_manualAttach" title="Manual Attach" version="2.0.0.0" required="false" fileHash="954e7e07c51051f34af74944745a5c36"/>
|
||||
<mod modName="FS22_guidanceSteering" title="Guidance Steering" version="2.1.1.0" required="false" fileHash="c770b1919f3c997f74e6c24eeb7f358f"/>
|
||||
<mod modName="FS22_viconFastBale" title="Vicon FastBale" version="1.0.0.0" required="false" fileHash="e9485bdf073f10dd34b234370576596d"/>
|
||||
<mod modName="FS22_CaseIHPuma" title="Case Puma" version="1.0.0.0" required="false" fileHash="4d10a0815371f4ba004fd8c6e057a236"/>
|
||||
<mod modName="FS22_Profihopper" title="Amazone Profihopper" version="1.0.0.0" required="false" fileHash="e1d9d0c0ba910379353900f34ffb5025"/>
|
||||
<mod modName="FS22_kvernelandIXterB18" title="Kverneland iXter B18" version="1.0.0.0" required="false" fileHash="6e7de4e76b062af81c7b177bd49f809c"/>
|
||||
<mod modName="FS22_KuhnAxis402" title="Kuhn Axis 402" version="1.0.0.0" required="false" fileHash="bca2c3b7dd8c9f7ef9e428db71149dba"/>
|
||||
<mod modName="FS22_guidanceSteering" title="Guidance Steering" version="2.1.6.0" required="false" fileHash="15adafce7038589ebfdd9d004d49b728"/>
|
||||
<mod modName="FS22_manualAttach" title="Manual Attach" version="2.0.0.0" required="false" fileHash="954e7e07c51051f34af74944745a5c36"/>
|
||||
<mod modName="FS22_viconExtraPack" title="Vicon EXTRA Pack" version="1.0.0.0" required="false" fileHash="862e361679de4519c9cf54f975265546"/>
|
||||
<mod modName="FS22_PlayerPositionSaver" title="Player Position Saver" version="1.0.0.0" required="false" fileHash="b57c492560aeb0d5e17afad7fb3271ff"/>
|
||||
<mod modName="FS22_CaseIHPuma" title="Case Puma" version="1.0.0.0" required="false" fileHash="4d10a0815371f4ba004fd8c6e057a236"/>
|
||||
</careerSavegame>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,42 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<environment>
|
||||
<dayTime>503.147644</dayTime>
|
||||
<currentDay>22</currentDay>
|
||||
<currentMonotonicDay>22</currentMonotonicDay>
|
||||
<realHourTimer>1777801</realHourTimer>
|
||||
<daysPerPeriod>1</daysPerPeriod>
|
||||
<weather timeSinceLastRain="204">
|
||||
<dayTime>352.470581</dayTime>
|
||||
<currentDay>92</currentDay>
|
||||
<currentMonotonicDay>32</currentMonotonicDay>
|
||||
<realHourTimer>26858</realHourTimer>
|
||||
<daysPerPeriod>3</daysPerPeriod>
|
||||
<weather timeSinceLastRain="172">
|
||||
<forecast>
|
||||
<instance durationLeft="6.564206" typeName="SUN" variationIndex="3" duration="10.000000" season="3"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="12.000000" season="3"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="7.000000" season="3"/>
|
||||
<instance typeName="SUN" variationIndex="3" duration="9.000000" season="3"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="5.000000" season="3"/>
|
||||
<instance typeName="CLOUDY" variationIndex="3" duration="5.000000" season="3"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="8.000000" season="3"/>
|
||||
<instance typeName="CLOUDY" variationIndex="3" duration="10.000000" season="3"/>
|
||||
<instance typeName="SNOW" variationIndex="2" duration="4.000000" season="3"/>
|
||||
<instance typeName="RAIN" variationIndex="2" duration="2.000000" season="0"/>
|
||||
<instance typeName="CLOUDY" variationIndex="3" duration="6.000000" season="0"/>
|
||||
<instance typeName="CLOUDY" variationIndex="3" duration="5.000000" season="0"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="11.000000" season="0"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="10.000000" season="0"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="11.000000" season="0"/>
|
||||
<instance typeName="RAIN" variationIndex="4" duration="3.000000" season="0"/>
|
||||
<instance typeName="CLOUDY" variationIndex="4" duration="7.000000" season="0"/>
|
||||
<instance typeName="CLOUDY" variationIndex="1" duration="5.000000" season="0"/>
|
||||
<instance typeName="RAIN" variationIndex="2" duration="1.000000" season="0"/>
|
||||
<instance typeName="SUN" variationIndex="3" duration="8.033334" season="0"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="12.000000" season="1"/>
|
||||
<instance typeName="RAIN" variationIndex="1" duration="3.000000" season="1"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="10.000000" season="1"/>
|
||||
<instance typeName="RAIN" variationIndex="1" duration="1.000000" season="1"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="9.000000" season="1"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="11.000000" season="1"/>
|
||||
<instance typeName="SUN" variationIndex="3" duration="8.000000" season="1"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="8.000000" season="1"/>
|
||||
<instance durationLeft="4.125491" typeName="CLOUDY" variationIndex="1" duration="7.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="3" duration="7.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="10.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="8.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="6.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="3" duration="10.000000" season="2"/>
|
||||
<instance typeName="RAIN" variationIndex="3" duration="1.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="10.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="4" duration="7.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="4" duration="8.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="8.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="4" duration="7.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="4" duration="9.000000" season="2"/>
|
||||
<instance typeName="RAIN" variationIndex="1" duration="3.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="5.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="4" duration="5.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="2" duration="9.000000" season="2"/>
|
||||
<instance typeName="RAIN" variationIndex="1" duration="2.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="1" duration="9.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="4" duration="12.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="6.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="1" duration="10.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="12.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="2" duration="6.000000" season="2"/>
|
||||
<instance typeName="RAIN" variationIndex="4" duration="1.000000" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="4" duration="7.000000" season="2"/>
|
||||
<instance typeName="SUN" variationIndex="4" duration="4.066667" season="2"/>
|
||||
<instance typeName="CLOUDY" variationIndex="1" duration="8.000000" season="3"/>
|
||||
</forecast>
|
||||
<fog currentMieScale="9.602009" lastMieScale="10.500000" targetMieScale="1.000000" alpha="0.094525" duration="14400000.000000" nightFactor="0.000000" dayFactor="1.000000"/>
|
||||
<fog currentMieScale="25.628260" lastMieScale="30.000000" targetMieScale="20.000000" alpha="0.437174" duration="7200000.000000" nightFactor="1.000000" dayFactor="1.000000"/>
|
||||
<snow height="0.000000"/>
|
||||
</weather>
|
||||
<snow physicalHeight="0.000000" height="0.000000"/>
|
||||
|
|
|
@ -130,7 +130,22 @@ class Savegame {
|
|||
}
|
||||
break;
|
||||
}
|
||||
$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$mDisplay = $mMonth;
|
||||
if ($mPeriodDays != 1) {
|
||||
$mDisplay .= ($mNumDay == 0)? " $mPeriodDays" : " $mNumDay";
|
||||
$mDisplay .= ' [' . $mPeriodDays . ']';
|
||||
}
|
||||
$this->currentDay = $mDisplay;
|
||||
//$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay " . '[' . $mPeriodDays . ']';
|
||||
//$this->currentDay = 'Sep 2 [3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
|
|
|
@ -0,0 +1,212 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,213 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$this->currentDay = 5;
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,216 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay";
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay ($mPeriodDays)";
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay /$mPeriodDays";
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay/$mPeriodDays";
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay[$mPeriodDays]";
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay$mPeriodDays";
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2[3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep day 2 of 3';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep Day 2 of 3';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2 of 3';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2 / 3';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2 [3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2 `3`';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2 :3';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2-3';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
// $this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
$this->currentDay = 'Sep 2 [3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay[". $mPeriodDays."]";
|
||||
//$this->currentDay = 'Sep 2 [3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay '['$mPeriodDays']'";
|
||||
//$this->currentDay = 'Sep 2 [3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,221 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the "FS19 Web Stats" package.
|
||||
* Copyright (C) 2017-2019 John Hawk <john.hawk@gmx.net>
|
||||
*
|
||||
* "FS19 Web Stats" is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* "FS19 Web Stats" is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
if (! defined ( 'IN_FS19WS' )) {
|
||||
exit ();
|
||||
}
|
||||
class Savegame {
|
||||
const CONFIG_CHANGE_PRICE = 1000;
|
||||
const COST_MULTIPLIER = array (
|
||||
1 => 0.4,
|
||||
2 => 0.7,
|
||||
3 => 1
|
||||
);
|
||||
const MAX_DAILYUPKEEP_MULTIPLIER = 4;
|
||||
const MAX_GREAT_DEMANDS = 3;
|
||||
const PRICE_DROP_MIN_PERCENT = 0.6;
|
||||
const PRICE_MULTIPLIER = array (
|
||||
1 => 3,
|
||||
2 => 1.8,
|
||||
3 => 1
|
||||
);
|
||||
public $serverOnline = 0; // 0 = offline; 1 = online; 2 = offline but cache
|
||||
public $currentDay;
|
||||
public $dayTime;
|
||||
public $difficulty;
|
||||
public $economicDifficulty;
|
||||
public static $xml = array ();
|
||||
protected $xmlFiles = array (
|
||||
'environment.xml',
|
||||
'economy.xml',
|
||||
'farms.xml',
|
||||
'farmland.xml',
|
||||
'items.xml',
|
||||
'missions.xml',
|
||||
'vehicles.xml',
|
||||
'careerSavegame.xml'
|
||||
);
|
||||
private $ftp = array ();
|
||||
private $cache = './cache/';
|
||||
public function __construct($webStatsConfig, $farmId = 1) {
|
||||
$this->test = new stdClass ();
|
||||
if (! file_exists ( $this->cache )) {
|
||||
mkdir ( $this->cache );
|
||||
}
|
||||
$this->farmId = $farmId;
|
||||
switch ($webStatsConfig->savegame_type) {
|
||||
case 'local' :
|
||||
$this->serverOnline = 1;
|
||||
$this->cache = $webStatsConfig->fs19path . $webStatsConfig->savegame_slot . DIRECTORY_SEPARATOR;
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
case 'server' :
|
||||
$zipFile = $this->cache . 'savegame.zip';
|
||||
$cacheTimeout = $webStatsConfig->cacheTimeout;
|
||||
if (file_exists ( $zipFile ) && filemtime ( $zipFile ) > (time () - ($cacheTimeout) + rand ( 0, 10 ))) {
|
||||
$this->serverOnline = 1;
|
||||
} else {
|
||||
$ch = curl_init ();
|
||||
$postData = array (
|
||||
'username' => $webStatsConfig->webinterface_username,
|
||||
'password' => $webStatsConfig->webinterface_password,
|
||||
'login' => 'Anmelden'
|
||||
);
|
||||
// Login in the web interface
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . 'index.html',
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => $postData,
|
||||
CURLOPT_COOKIEJAR => $this->cache . 'cookie.txt',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 10
|
||||
) );
|
||||
$response = curl_exec ( $ch );
|
||||
if (curl_getinfo ( $ch, CURLINFO_HTTP_CODE ) != 200 || strpos ( $response, 'Username or password incorrect' ) !== false) {
|
||||
// Server offline or username / password changed
|
||||
} else {
|
||||
// Download savegame
|
||||
curl_setopt_array ( $ch, array (
|
||||
CURLOPT_URL => $webStatsConfig->webinterface_url . $webStatsConfig->savegame_slot,
|
||||
CURLOPT_POST => false
|
||||
) );
|
||||
$savegame = curl_exec ( $ch );
|
||||
file_put_contents ( $zipFile, $savegame );
|
||||
// Logoff in the web interface
|
||||
curl_setopt ( $ch, CURLOPT_URL, $webStatsConfig->webinterface_url . 'index.html?logout=true' );
|
||||
$store = curl_exec ( $ch );
|
||||
curl_close ( $ch );
|
||||
if (strlen ( $savegame ) > 100 && class_exists ( 'ZipArchive' )) {
|
||||
$this->serverOnline = 1;
|
||||
$zip = new ZipArchive ();
|
||||
$extractPath = "./cache";
|
||||
if ($zip->open ( $zipFile ) != "true") {
|
||||
echo "Error :- Unable to open the Zip File";
|
||||
}
|
||||
$zip->extractTo ( $extractPath );
|
||||
$zip->close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->serverOnline == 0 && file_exists ( $zipFile )) {
|
||||
$this->serverOnline = 2;
|
||||
}
|
||||
for($s1 = 0; $s1 < sizeof ( $this->xmlFiles ); $s1 ++) {
|
||||
$basename = basename ( $this->xmlFiles [$s1], '.xml' );
|
||||
self::$xml [$basename] = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
$this->$basename = new stdClass ();
|
||||
$this->$basename = simplexml_load_file ( $this->cache . $this->xmlFiles [$s1] );
|
||||
}
|
||||
break;
|
||||
}
|
||||
//$this->currentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mCurrentDay = intval ( self::$xml ['environment']->currentDay );
|
||||
$mPeriodDays = intval ( self::$xml ['environment']->daysPerPeriod );
|
||||
|
||||
$mNumMonth = (ceil($mCurrentDay / $mPeriodDays) + 2) % 12;
|
||||
$mNumDay = $mCurrentDay % $mPeriodDays;
|
||||
$mMonth = date('M', strtotime("2000-$mNumMonth-01"));
|
||||
$this->currentDay = ( $mNumDay == 0 ) ? $mMonth : $mMonth . " $mNumDay $mPeriodDays";
|
||||
//$this->currentDay = 'Sep 2 [3]';
|
||||
|
||||
$this->dayTime = gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
$this->difficulty = intval ( self::$xml ['careerSavegame']->settings->difficulty );
|
||||
$this->economicDifficulty = intval ( self::$xml ['careerSavegame']->settings->economicDifficulty );
|
||||
}
|
||||
public function getCurrentDay() {
|
||||
return intval ( self::$xml ['environment']->currentDay );
|
||||
}
|
||||
public function getCareerMode() {
|
||||
return intval ( $this->difficulty );
|
||||
}
|
||||
public function getPriceMultiplier() {
|
||||
return self::PRICE_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getCostMultiplier() {
|
||||
return self::COST_MULTIPLIER [$this->economicDifficulty];
|
||||
}
|
||||
public function getDayTime() {
|
||||
return gmdate ( "H:i", floatval ( self::$xml ['environment']->dayTime ) * 60 );
|
||||
}
|
||||
public function getFarmMoney($farmId) {
|
||||
foreach ( self::$xml ['farms'] as $farmInXML ) {
|
||||
if (intval ( $farmInXML ['farmId'] ) == $farmId) {
|
||||
return floatval ( $farmInXML ['money'] );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static function getXML($xml) {
|
||||
return self::$xml [$xml];
|
||||
}
|
||||
private function getFileByFTP($file) {
|
||||
if ($this->ftp ['isgportal']) {
|
||||
$URL = "ftp://" . $this->ftp ['user'] . ":" . $this->ftp ['pass'] . "@" . $this->ftp ['server'] . ":" . $this->ftp ['port'] . $this->ftp ['path'];
|
||||
$fp = fopen ( $this->cache . $file . '.temp', "w" );
|
||||
$url = $URL . $file;
|
||||
$curl = curl_init ();
|
||||
curl_setopt ( $curl, CURLOPT_URL, $url );
|
||||
curl_setopt ( $curl, CURLOPT_RETURNTRANSFER, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_UPLOAD, 0 );
|
||||
curl_setopt ( $curl, CURLOPT_FILE, $fp );
|
||||
$result = curl_exec ( $curl );
|
||||
curl_close ( $curl );
|
||||
fclose ( $fp );
|
||||
} else {
|
||||
$local_file = $this->cache . $file . '.temp';
|
||||
$server_file = $this->ftp ['path'] . $file;
|
||||
if ($this->ftp ['ssl']) {
|
||||
$ftp_conn = ftp_ssl_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
} else {
|
||||
$ftp_conn = ftp_connect ( $this->ftp ['server'], $this->ftp ['port'], 10 );
|
||||
}
|
||||
if (! $ftp_conn) {
|
||||
echo ("Verbindung fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_login ( $ftp_conn, $this->ftp ['user'], $this->ftp ['pass'] )) {
|
||||
echo ("Login fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_pasv ( $ftp_conn, true )) {
|
||||
echo ("Umschalten in passiven Modus fehlgeschlagen<br>\r\n");
|
||||
} else {
|
||||
if (! ftp_get ( $ftp_conn, $local_file, $server_file, FTP_ASCII )) {
|
||||
echo ("Download von '$server_file' fehlgeschlagen<br>\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ftp_close ( $ftp_conn );
|
||||
}
|
||||
}
|
||||
libxml_use_internal_errors ( true );
|
||||
$stat = simplexml_load_file ( $this->cache . $file . '.temp' );
|
||||
if ($stat !== false) {
|
||||
rename ( $this->cache . $file . '.temp', $this->cache . $file );
|
||||
} else {
|
||||
// The XML file propably could not be loaded correctly.
|
||||
echo ("Fehler beim Laden der Datei: $file<br>");
|
||||
}
|
||||
libxml_use_internal_errors ( false );
|
||||
}
|
||||
}
|
|
@ -289,9 +289,9 @@ SOLDWOOD=Sold Wood
|
|||
SOLDBALES=Sold Bales
|
||||
SOLDWOOL=Sold Wool
|
||||
SOLDMILK=Sold Milk
|
||||
PURCHASEFUEL=Costs Furterlise
|
||||
PURCHASESEEDS=Costs Seed
|
||||
PURCHASEFERTILIZER=Costs Manure
|
||||
PURCHASEFUEL=Fertilizer Costs
|
||||
PURCHASESEEDS=Seed Costs
|
||||
PURCHASEFERTILIZER=Vehicle Expenses
|
||||
PURCHASESAPLINGS=Costs Saplings
|
||||
PURCHASEWATER=Costs Water
|
||||
HARVESTINCOME=Revenue harvest
|
||||
|
|
|
@ -0,0 +1,492 @@
|
|||
CLOSE=Close
|
||||
SAVE=Save
|
||||
SUBMIT=Submit
|
||||
RESET=Reset
|
||||
SAVETIME=Savegame time
|
||||
DAY=Day
|
||||
COMMODITY=Commodity
|
||||
COMMODITIES=Commodities
|
||||
PLANT=Production plant
|
||||
PLANTS=Production plants
|
||||
SETTINGS=Settings
|
||||
STOCK=Stock
|
||||
STOCKS=Stocks
|
||||
PRICES=Selling prices
|
||||
MONDAY=MONDAY
|
||||
TUESDAY=TUESDAY
|
||||
WEDNESDAY=WEDNESDAY
|
||||
THURSDAY=THURSDAY
|
||||
FRIDAY=FRIDAY
|
||||
SATURDAY=SATURDAY
|
||||
SUNDAY=SUNDAY
|
||||
ON=ON
|
||||
OFF=OFF
|
||||
ONMAP=Landscape
|
||||
OUTOFMAP=Out of map
|
||||
|
||||
//install.tpl
|
||||
CHANGE_BUTTON=Change
|
||||
CHOOSE_LANGUAGE_LABEL=Select language
|
||||
CHOOSE_LANGUAGE=Change
|
||||
CONFIG_SAVED=Configuration saved successfully.
|
||||
CONTINUE=Go to overview
|
||||
DESCRIPTON=Farming Simulator 17 game statistics can be used to view players, vehicles, inventory and production facilities. Missing factory inputs as well as full product warehouses are identified.
|
||||
START_INSTALL=Start install
|
||||
HEAD_API=Giants Web API
|
||||
DESCR_API=For the webapi, but giants still need to release theire.
|
||||
HEAD_WEB=Web Interface
|
||||
DESCR_WEB=The retrieval of the score is via the web interface of the server. To log in to the web interface and retrieve the game, an extra user should be created, which only receives download rights. The web server must support 'curl' and 'ZipArchive'.
|
||||
HEAD_FTP=FTP Server
|
||||
DESCR_FTP=With FTP server you are able to load all the nesercarry files in order to be able to see your stats on the website.
|
||||
HEAD_LOCAL=Local Play status
|
||||
DESCR_LOCAL=With FTP-Server is it also possible to get the local files.
|
||||
INSTALL_TITLE=Installation
|
||||
DEDICATED=Dedicated Server
|
||||
LOCAL=local statistics
|
||||
DS_LABEL1=Server IP Address
|
||||
DS_PLACEHOLDE1=IP Address
|
||||
DS_HELP_BLOCK1=Farming Simulator 17 Dedicated Server IP Address
|
||||
DS_LABEL2=Server Port
|
||||
DS_PLACEHOLDE2=Port
|
||||
DS_HELP_BLOCK2=Web API port (not the game client port)
|
||||
DS_LABEL3=Server Code
|
||||
DS_PLACEHOLDE3=Code
|
||||
DS_HELP_BLOCK3=Web API Access Code
|
||||
DS_LABEL4=Mod Map
|
||||
DS_HELP_BLOCK4=Select map installed on the server
|
||||
DS_LABEL5=WebStats Password
|
||||
DS_PLACEHOLDE5=Password
|
||||
DS_PLACEHOLDE6=Confirm Password
|
||||
DS_HELP_BLOCK5=The password can be used to change the server settings and change the map.
|
||||
DS_HELP_GPORTAL=Only tick if the Dedicated Server is hosted on G-Portal.
|
||||
DS_HELP_BLOCK5=The password can later be used to change the server settings and to change the card.
|
||||
WEB_URL=Address of the web interface
|
||||
WEB_URL_HELP_BLOCK=Full address including <code>index.html?lang=xx</code>
|
||||
WEB_USER=Web users
|
||||
WEB_USER_HELP_BLOCK=In the server's web interface, please create an additional user with read-only access to the server.
|
||||
WEB_PASS=Password of the web user
|
||||
WEB_PASS_HELP_BLOCK=Password of the user for the web interface.
|
||||
WEB_SLOT=Web slot game
|
||||
HELP=Help
|
||||
FTPPATH=FTP Path
|
||||
FTPADRESS=Server adress or IP
|
||||
FTPPORT=Port
|
||||
FTPOPTIONS=Option
|
||||
FTPSSLCON=SSL Connection
|
||||
FTPUSER=FTP User
|
||||
FTPPASSWORD=FTP Password
|
||||
ERROR_FTPPATH=The Path can't be found
|
||||
ERROR_FTPUSERPASS=The username or password is incorrect
|
||||
ERROR_FTPSERVER=Error connecting to the server.
|
||||
NO_INSTALL_1=Unfortunately, WebStats cannot be used with a Farming Simulator 19 Dedicated Server on this web server because the fsockopen()</ code> function is not supported. NO_INSTALL_2=Please consult your web hosting provider in order to determine if the function can be activated within the php.ini configuration.
|
||||
INTRO_LOCAL=Please note, the current score can only be displayed if the score is saved regularly within Farming Simulator 19. It's best to enable the game to save automatically every 5 minutes.
|
||||
INTRO1=Please note that statistics are not saved automatically within Farming Simulator 19. In order for correct statistics to be displayed here, the game must first be saved. Alternatively, install the
|
||||
INTRO2=Autosave mod to automatically save the game every 5 minutes.
|
||||
LINK_TEXT=Map Autosave
|
||||
LS_LABEL1=Statistics Path
|
||||
LS_PLACEHOLDE1=Path
|
||||
LS_HELP_BLOCK1=By default, Farming Simulator 17 saves saved games under: %USERPROFILE%\Documents\My Games\FarmingSimulator2017\savegame[n]
|
||||
LS_LABEL2=Mod Map
|
||||
LS_HELP_BLOCK2=Select the map for the statistics
|
||||
SAVE_CONFIG=Save configuration
|
||||
ERROR_CODE=The code is invalid.
|
||||
ERROR_PORT=The port is invalid.
|
||||
ERROR_IP=The IP address is invalid.
|
||||
ERROR_MAP=The map is invalid.
|
||||
ERROR_OFFLINE=The server is either offline or the IP address is incorrect.
|
||||
ERROR_SAVEGAME=No game statistics found at the specified path.
|
||||
PASSWORD_MATCH=The passwords do not match.
|
||||
PASSWORD_SHORT=The password must be at least 6 characters long.
|
||||
ERROR=Error!
|
||||
|
||||
//index.tpl
|
||||
TPL_ERROR_1=Error during page load
|
||||
TPL_ERROR_2=The file
|
||||
TPL_ERROR_3=does not exist.
|
||||
CON_ERROR_1=Connection Error
|
||||
CON_ERROR_2=No data could be retrieved from the dedicated server. Please check the server address or internet connection. The fsockopen() function must be enabled on the web server.
|
||||
USER_ONLINE=Visitor online
|
||||
INFO_1=Web page to display the server status and monitor the production facilities and stock levels.
|
||||
INFO_2=Tips, help and suggestions for improvement
|
||||
INFO_3=Programming
|
||||
INFO_4=MapConfiguration
|
||||
LICENSE=Licensing information
|
||||
|
||||
//navbar.tpl
|
||||
|
||||
TOGGLE=Toggle navigation
|
||||
OVERVIEW=Overview
|
||||
SERVER=Server
|
||||
STORAGE=Storage
|
||||
PRODUCTION=Production
|
||||
FACTORY=Factory
|
||||
INFO=Info
|
||||
FARMS=Farms
|
||||
VEHICLES=Vehicle
|
||||
BESTPRICES=Best Sell Price
|
||||
ALLPRICES=All Sell Prices
|
||||
BALANCESHEET=Ballance Sheet
|
||||
RATIOS=Ratios
|
||||
BUILDINGS=Building
|
||||
|
||||
//info.tpl
|
||||
VERSION=Version
|
||||
COPYRIGHT=Copyright
|
||||
3RDPARTY=Software von Drittanbietern
|
||||
|
||||
//overview.tpl
|
||||
VERSION=Version
|
||||
PLAYER=Player
|
||||
UPTIME=Uptime
|
||||
ISADMIN=Is admin
|
||||
POSITION=Position
|
||||
INVEHICLE=In Vehicle
|
||||
NOPLAYER=At the moment is no player online.
|
||||
WEATHER=Weather
|
||||
NEWS=News
|
||||
GREAT_DEMAND=Great Demand
|
||||
PAYS_ACTUAL=Payments
|
||||
FOR=for
|
||||
SALES=Special Offers
|
||||
ACTUAL=Actual
|
||||
STARTING=Starting
|
||||
DISCOUNT=Discount
|
||||
WHOLE_BRAND=All other vehicles and equipments
|
||||
FINANCES5DAYS=Finance(Last 5 Days)
|
||||
OPERATING_RESULT=Operation Results
|
||||
LIFESTOCK_NSU=Animal Production
|
||||
HARVEST=Crop Reults
|
||||
WAGE_PAYMENT=Payments
|
||||
VEHICLES_NCS=New/Sold Vehicles
|
||||
PROPERTY_CSP=New/Sold Buildings
|
||||
VEHICLES_U=Running Cost Vehicles
|
||||
PROPERTY_MI=Running Cost Buildings
|
||||
BALANCE=Account Ballance
|
||||
|
||||
//commodity.tpl
|
||||
DETAILVIEW=detailed view
|
||||
CHOOSE_COMMODITY=Select goods
|
||||
PLACE=storage location
|
||||
AMOUNT=amount
|
||||
NO_STOCK=no stocks
|
||||
WHOLE_AMOUNT=total warehouse stock
|
||||
SELLTRIGGERS=Sellpoints
|
||||
SELLTRIGGER=Sellpoint
|
||||
CURRENT_PRICE=Current Price
|
||||
PRICE_INFO=ATTENTION: Sell Prices are not actual!!
|
||||
DEMAND=demand
|
||||
WHOLE_DEMAND=Total demand
|
||||
ITEM_POSITIONS=Pallet/Bale positions
|
||||
NOT_FOUND=Object not found :-/
|
||||
|
||||
//factories.tpl
|
||||
CHOOSE_PLANT=Select production plant
|
||||
REQUIRED=Required inputs
|
||||
CAPACITY=capacity
|
||||
REQUIRE_HOUR=Demand per hour
|
||||
REQUIRE_DAY=Demand per day
|
||||
PRODUCED_GOODS=Products
|
||||
PRODUCT_HOUR=Production per hour
|
||||
PRODUCT_DAY=Production per day
|
||||
|
||||
//production.tpl
|
||||
PRODUCTION_OVERVIEW=production overview
|
||||
RAW_MATERIALS=inputs
|
||||
PRODUCTS=products
|
||||
MORE_DETAILS=more details
|
||||
|
||||
//storage.tpl
|
||||
CAUTION=Caution
|
||||
DETAILS=Details
|
||||
QUANTITY=Quantity
|
||||
PALLET=Pallet
|
||||
PALETTES=Pallets
|
||||
BALE=Bale
|
||||
BALES=Bales
|
||||
INCORRECT_POSITIONS_TITLE=Invalid positions of pallets and bales
|
||||
INCORRECT_POSITIONS_TEXT=The positions of the following bales/pallets in the vehicle.xml are invalid:
|
||||
INCORRECT_POSITION=invalid position
|
||||
UGGESTION_POSITION=Suggested Position
|
||||
|
||||
//options.tpl
|
||||
GENERAL=General
|
||||
CHOOSE_STYLE=Select style
|
||||
AUTO_RELOAD=automatic Reload
|
||||
HIDE_FOOTER=Hide footer
|
||||
AUTO_RELOAD_HELP=The Website will update every 60 seconds.
|
||||
SORT_ORDER=sorting
|
||||
ALPHABETICALLY=alphabetically
|
||||
FILL_LEVEL=according to fill level
|
||||
SHOW=display
|
||||
HIDE=hide
|
||||
VEHICLE_LOAD=Vehicle load
|
||||
VEHICLE_LOAD_HELP=The load of the vehicle can also be shown.
|
||||
ONLY_PALETTS=Only display pallets
|
||||
TOOLTIP=Show tooltip with stock
|
||||
TOOLTIP_HELP=The tooltip displays the total stock from all warehouses and production sites.
|
||||
YES=yes
|
||||
NO=no
|
||||
SHOW_ZERO_STOCK=Displaying Zero Stock
|
||||
SHOWZERO_HELP=Goods without item, can be filteret out.
|
||||
HIDE_ANIMALS=Hide Animals
|
||||
HIDE_ANIMALS_HELP=You can hide animals.
|
||||
FULL_PRODUCT_STORAGE=Full product storage
|
||||
SORT_FULL_PRODUCTS=take into account when sorting
|
||||
IGNORE_FULL_PRODUCTS=ignore during sorting
|
||||
SHOW_HIDDEN_PLANTS=Show production plants
|
||||
HIDE_NOT_USED=Automatic hide
|
||||
HIDE_NOT_USED_HELP=Production plants, without inputs or products in stocks, are automatically hidden.
|
||||
MOD_MAP=Mod Map
|
||||
LAYOUT=Layout
|
||||
3COLUMN=3 Columns
|
||||
4COLUMN=4 Columns
|
||||
SERVER_SETTINGS=Delete server settings
|
||||
ADMIN_AREA=Server management
|
||||
ADMIN_DESCRIPTION=Warning! After entering the password, the settings for the Dedicated Server or Savegame are deleted. FS17 WebStats can then be reinitialized.
|
||||
ENTER_PASSWORD=Enter Password
|
||||
PASSWORD_ERROR=Incorrect Password.
|
||||
|
||||
//animals.tpl
|
||||
ANIMALS=Animals
|
||||
NOSTABLES=No Stables avalible.
|
||||
FITNESS=Fitness
|
||||
HEALTH=Health
|
||||
STABLE_INFO=Stable Information
|
||||
STABLE_STATE=State
|
||||
CLEANLINESS=Cleanliness
|
||||
PRODUCTIVITY=Productivity
|
||||
REPRO_RATE=Reproduction rate
|
||||
NEXT_ANIMAL=Next Animal
|
||||
FOOD=Neutrician
|
||||
MANURE_HELP=Manure.
|
||||
|
||||
//prices.tpl
|
||||
PRICES1000=Prices / 1000 L
|
||||
MIN_PRICE=Lowest Selling Price
|
||||
MAX_PRICE=Maximum Selling Price
|
||||
BEST_PRICE=Best Selling Price
|
||||
PROCEEDS=Avalible Selling Price
|
||||
PERCENT=%
|
||||
|
||||
//finances.tpl
|
||||
FINANCES=Finances
|
||||
INCOME_EXPENDITURE=Income/Output
|
||||
TODAY=Today
|
||||
NEWVEHICLESCOST=New Vehicles
|
||||
SOLDVEHICLES=Sold Vehicles
|
||||
NEWANIMALSCOST=New Animals
|
||||
SOLDANIMALS=Sold Animals
|
||||
CONSTRUCTIONCOST=Build Cost
|
||||
SOLDBUILDINGS=Sold Buildings
|
||||
FIELDPURCHASE=Purchased Fields
|
||||
FIELDSELLING=Sold Fields
|
||||
VEHICLERUNNINGCOST=Running Cost Vehicles
|
||||
VEHICLELEASINGCOST=Leasing Cost Vehicles
|
||||
ANIMALUPKEEP=Animal Cost
|
||||
PROPERTYMAINTENANCE=Running Cost Buildings
|
||||
PROPERTYINCOME=Revenue Buildings
|
||||
SOLDWOOD=Sold Wood
|
||||
SOLDBALES=Sold Bales
|
||||
SOLDWOOL=Sold Wool
|
||||
SOLDMILK=Sold Milk
|
||||
PURCHASEFUEL=Costs Furterlise
|
||||
PURCHASESEEDS=Costs Seed
|
||||
PURCHASEFERTILIZER=Costs Manure
|
||||
PURCHASESAPLINGS=Costs Saplings
|
||||
PURCHASEWATER=Costs Water
|
||||
HARVESTINCOME=Revenue harvest
|
||||
INCOMEBGA=Revenue BGA
|
||||
MISSIONINCOME=Revenue Fieldmissions
|
||||
WAGEPAYMENT=Employment Payments
|
||||
OTHER=miscellaneous
|
||||
LOANINTEREST=Interest
|
||||
TOTAL=Total
|
||||
BALANCE1=Conto Balance
|
||||
LOAN=Credit
|
||||
BALANCE2=Balance
|
||||
BS_HEAD_MAIN=Total balance for farm
|
||||
BS_HEAD_LEFT=Assets
|
||||
BS_HEAD_RIGHT=Liabilities
|
||||
BS_FIXED=A. Fixed Assets
|
||||
BS_SUM_FIXED=Total Fixed Assets
|
||||
BS_ANIMAL=B. Animal Wealth
|
||||
BS_SUM_ANIMAL=Total Animal Wealth
|
||||
BS_CURRENT=C. Current Assets
|
||||
BS_SUM_CURRENT=Total Current Assets
|
||||
BS_LAND=Land
|
||||
BS_BUILDINGS=Buildings
|
||||
BS_VEHICLES=Vehicles
|
||||
BS_HORSES=Horses
|
||||
BS_COWS=Cows
|
||||
BS_PIGS=Pigs
|
||||
BS_SHEEPS=Sheeps
|
||||
BS_CHICKEN=Chickens
|
||||
BS_INVENTORY=I. Stocks
|
||||
BS_SUPPLIES=Raw Materials and Supplies
|
||||
BS_STORAGE=Finished Goods
|
||||
BS_ACCRECEIV=II. Requirements
|
||||
BS_CASH=III. Bank Deposits
|
||||
BS_SHAREHOLDERS_EQUITY=A. Equity
|
||||
BS_SUM_SHAREHOLDERS_EQUITY=Total Equity
|
||||
BS_INITIAL=Initial Capital
|
||||
BS_PROFIT=Profit
|
||||
BS_LIABILITIES=B. Liabilities
|
||||
BS_SUM_LIABILITIES=Total Liabilities
|
||||
BS_BANKDEBT=Benkdebt
|
||||
BS_BANKOPCREDIT=Bank Credit
|
||||
BS_TOTAL_LEFT=Total Assets
|
||||
BS_TOTAL_RIGHT=Total Assets
|
||||
BUSINESS_RATIOS=Business Ratios
|
||||
BWL_ADG=Assets Ratio
|
||||
BWL_EK=Equity
|
||||
BWL_AV=Fixed Assets
|
||||
BWL_GK=Total Assets
|
||||
BWL_G=Profit
|
||||
BWL_FK=Borrowed
|
||||
BWL_AAV=Depreciable Investment Property
|
||||
BWL_TV=Animal Wealth
|
||||
BWL_UV=Current Assets
|
||||
BWL_KZ=Lending Rates
|
||||
BWL_ADG_P1=The asset coverage ratio sets the equity in relation to the fixed assets of a farm. Fixed assets are machines, buildings and land.
|
||||
BWL_ADG_P2=A high degree of asset coverage means that large parts of the assets are financed by equity and not by credit "on the spot".
|
||||
BWL_EKQ=Equity Ratio
|
||||
BWL_EKQ_P1=The equity ratio indicates the share of equity in total capital.
|
||||
BWL_EKQ_P2=A high equity ratio is considered positive: the farm is financed primarily by its own resources and does not have to resort to borrowing.
|
||||
BWL_EKR=Return on Equity
|
||||
BWL_EKR_P1=Farms often face the decision to invest or invest capital. Return on equity indicates whether an investment was profitable.
|
||||
BWL_EKR_P2=If the return on equity is above the current interest rate, the investment in the own yard was worthwhile.
|
||||
BWL_FKQ=Debt Ratio
|
||||
BWL_FKQ_P1=The debt capital ratio is set in relation to the total capital:
|
||||
BWL_FKQ_P2=The lower the share of debt in total capital, the more financially independent the court is. It then finances itself primarily from its own capital reserves (equity capital).
|
||||
BWL_FKD=Debt Coverage
|
||||
BWL_FKD_P1=
|
||||
BWL_FKD_P2=High leverage means that large parts or all of the debt can be repatriated through rapidly disposable assets.
|
||||
BWL_L=Liquidity
|
||||
BWL_L_P1=Liquidity describes the Court's ability to settle debts with available funds.
|
||||
BWL_L_P2=The higher the liquidity, the better the solvency of a farm. Liquidity is therefore also considered as a measure of impending insolvency.
|
||||
BWL_GKR=Total capital profitability
|
||||
BWL_GKR_P1=To calculate the total return (return on total capital), profit and interest on debt capital are set in relation to equity.
|
||||
BWL_GKR_P2=The return on total capital provides information on how high the income from invested total capital will be.
|
||||
BWL_COPYRIGHT=Formulas and descriptions of
|
||||
|
||||
//missions.tpl
|
||||
MISSIONS=Contracts
|
||||
TYPE=Assignments
|
||||
REWARD=Reward
|
||||
FIELD=Field
|
||||
ACTIVE=Active
|
||||
STATUS=Status
|
||||
FARM=Farm
|
||||
FIELDSIZE=Fieldsize
|
||||
VEHICLEUSECOST=Vehiclecost
|
||||
MIS_HARVEST=Harvest
|
||||
MIS_FERTILIZE=Fertilize
|
||||
MIS_TRANSPORT=Transport
|
||||
MIS_SOW=Sow
|
||||
MIS_WEED=Weed
|
||||
MIS_PLOW=Plow
|
||||
MIS_MOW_BALE=Bale
|
||||
MIS_CULTIVATE=Cultivate
|
||||
MIS_SPRAY=Spray
|
||||
|
||||
//farm.tpl
|
||||
FARMMANAGER=Farm-Manager
|
||||
CONTRACTS=Contracts
|
||||
WORKSFOR=Works for
|
||||
HASWORKSFOR=Employed
|
||||
JOIN_FARM=Join Farm
|
||||
LEAVE_FARM=Leave Farm
|
||||
|
||||
//vehicles.tpl
|
||||
VEH_VEHICLES=Vehicles
|
||||
VEH_BRAND=Brand
|
||||
VEH_NAME=Vehicle Name
|
||||
VEH_CATEGORY=Category
|
||||
VEH_AGE=Age
|
||||
VEH_OTIME=Operating-Hours
|
||||
VEH_PRICE=Price
|
||||
VEH_WEAR=Wear
|
||||
VEH_LPDAY=Leasing/Day
|
||||
VEH_LPHOUR=Leasing/Hour
|
||||
VEH_LCOST=Leasing Total
|
||||
VEH_RESALE=Resale
|
||||
VEH_BUILDINGS=Buildings Total
|
||||
VEH_BNAME=Building
|
||||
|
||||
//statistics.tpl
|
||||
STATISTICS=Statistics
|
||||
LITRES=Litres
|
||||
HA=ha
|
||||
FUELUSAGE=Fuel Usage
|
||||
SEEDUSAGE=Seed Usage
|
||||
TRAVELEDDISTANCE=Travel Distance
|
||||
SPRAYUSAGE=Spray Usage
|
||||
WORKEDHECTARES=Worked Hectares
|
||||
PLOWEDHECTARES=Plowed Hectares
|
||||
SOWNHECTARES=Sown Hectares
|
||||
FERTILIZEDHECTARES=Fertilized Hectares
|
||||
CULTIVATEDHECTARES=Cultivated Hectares
|
||||
THRESHEDHECTARES=Harvested Hectares
|
||||
WORKEDTIME=Time Worked
|
||||
CULTIVATEDTIME=Time Cultivated
|
||||
SOWNTIME=Time Sown
|
||||
FERTILIZEDTIME=Time Fertalized
|
||||
THRESHEDTIME=Time Harvested
|
||||
PLOWEDTIME=Time Plowed
|
||||
BALECOUNT=Pressed Bales
|
||||
PLANTEDTREECOUNT=Trees Planted
|
||||
CUTTREECOUNT=Trees Cut
|
||||
FIELDJOBMISSIONCOUNT=Missions Done
|
||||
PLAYTIME=Playtime
|
||||
TRANSPORTMISSIONCOUNT=Transportmissions Fullfillt
|
||||
BREEDCOWSCOUNT=Cows Bred
|
||||
BREEDSHEEPCOUNT=Sheeps Bred
|
||||
BREEDPIGSCOUNT=Pigs Bred
|
||||
BREEDCHICKENCOUNT=Chickens Bred
|
||||
BREEDHORSESCOUNT=Horses Bred
|
||||
|
||||
//Webpanel Missing Information
|
||||
DEDICATED_DESCRIPTON=A dedicated hosting service, dedicated server, or managed hosting service is a type of Internet hosting in which the client leases an entire server not shared with anyone else. ... Server administration can usually be provided by the hosting company as an add-on service.
|
||||
LOCAL_SAVEGAME_DESCRIPTON=A Local save game server.
|
||||
LOCAL_SAVEGAME=Local Server
|
||||
WEBSTATS_DESCRIPTON=WebStats is a powerful and feature-full tool that processes your website log files and generates a collection of attractive tables and graphs that show you: When visitors have viewed your website, displayed as a complete monthly history as well as broken out by days of the month, days of the week and hours.
|
||||
NEXT=Next...
|
||||
LINK_XML=Link XML
|
||||
LINK_XML_PLACEHOLDER=Link to the XML from the server.
|
||||
LINK_XML_HELP=Click the help button
|
||||
WEBINTERFACE_URL=Webinterface URL
|
||||
WEBINTERFACE_URL_PLACEHOLDER=Link to reach the dedicated server site.
|
||||
WEBINTERFACE_URL_HELP=Click the help button
|
||||
WEBINTERFACE_USERNAME=Webinterface Username
|
||||
WEBINTERFACE_USERNAME_PLACEHOLDER=Your username to sign into the dedicated server site.
|
||||
WEBINTERFACE_USERNAME_HELP=Click the help button
|
||||
WEBINTERFACE_PASSWORD=Webinterface Password
|
||||
WEBINTERFACE_PASSWORD_PLACEHOLDER=Your password for the dedicated server site.
|
||||
WEBINTERFACE_PASSWORD_HELP=Your password for the dedicated server site.
|
||||
SAVEGAME=Save Game Info
|
||||
SAVEGAME_PLACEHOLDER=Save Game File
|
||||
SAVEGAME_HELP=Save Game File
|
||||
MAP=Map Name
|
||||
MAP_PLACEHOLDER=Name of the Map
|
||||
MAP_HELP=Name of the Map
|
||||
WEBSTATS_PASSWORD=WebStats Password
|
||||
WEBSTATS_PASSWORD_PLACEHOLDER=Password for this panel.
|
||||
WEBSTATS_PASSWORD_HELP=Password for this panel.
|
||||
WEBSTATS_PASSWORD_REPEAT_PLACEHOLDER=Retype the same password.
|
||||
SPRAYEDHECTARES=Sprayed Hectares [ha]
|
||||
HARVESTEDGRAPES=Grapes Harvested
|
||||
HARVESTEDOLIVES=Olives Harvested
|
||||
SPRAYEDTIME=Time Sprayed
|
||||
PETDOGCOUNT=Dog Petting Count
|
||||
REPAIRVEHICLECOUNT=Vehicle Repairs
|
||||
REPAINTVEHICLECOUNT=Vehicle Repaints
|
||||
HORSEJUMPCOUNT=Horse Jumps
|
||||
SOLDCOTTONBALES=Cotton Bales Sold
|
||||
WRAPPEDBALES=Bales Wrapped
|
||||
TRACTORDISTANCE=Distance in Tractor
|
||||
CARDISTANCE=Distance in Car/Pickup
|
||||
TRUCKDISTANCE=Distance in Truck
|
||||
HORSEDISTANCE=Travel on Horseback
|
||||
LANGUAGE_FILE_CREATOR=Language File Creator
|
||||
MAP_CONFIG_CREATOR=Map Config Creator
|
||||
ABGESCHLOSSEN=Completed
|
226
missions.php
226
missions.php
|
@ -1,129 +1,99 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
echo "```ini<br>";
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
|
||||
echo "```ini<br>";
|
||||
echo 'Current Date: '. $savegame->currentDay . '<br>';
|
||||
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
|
||||
<?php endforeach;echo "```";?>
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
$currentDay = 10;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 1;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
$currentDay = 10;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date("m",strtotime($month));
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date("m",$month);
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date("M",$month);
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
//$month = date("M",$month);
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
//$month = date('M',$month);
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date('M',strtotime("2000-$month-01"));
|
||||
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
$currentDay = 91;
|
||||
$monoticDay = 16;
|
||||
$periodDays = 3;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date('M',strtotime("2000-$month-01"));
|
||||
$currentDate = ( $day == 0 ) ? $month : $month . " $day";
|
||||
echo $currentDate . '<br>';
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 30;
|
||||
$periodDays = 1;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date('M',strtotime("2000-$month-01"));
|
||||
$currentDate = ( $day == 0 ) ? $month : $month . " $day";
|
||||
echo $currentDate . '<br>';
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
$currentDay = 30;
|
||||
$periodDays = 5;
|
||||
|
||||
/* month = (round_ceiling(currentDay / daysPerPeriod) + 2) % 12;
|
||||
day = currentDay % daysPerPeriod; */
|
||||
|
||||
$month = (ceil($currentDay / $periodDays) + 2) % 12;
|
||||
$day = $currentDay % $periodDays;
|
||||
$month = date('M',strtotime("2000-$month-01"));
|
||||
$currentDate = ( $day == 0 ) ? $month : $month . " $day";
|
||||
echo $currentDate . '<br>';
|
||||
echo 'Month: '. $month . '<br>Day: '. $day;
|
||||
|
||||
|
||||
?>
|
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
echo "```ini<br>";
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
echo "```ini<br>
|
||||
$currentDay
|
||||
";
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
echo "```ini<br>
|
||||
$currentDay<br>
|
||||
";
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
echo "```ini<br>
|
||||
$Savegame->$currentDay<br>
|
||||
";
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,131 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
echo "```ini<br>
|
||||
$savegame->$currentDay<br>
|
||||
";
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
|
||||
//echo "```ini<br>";
|
||||
echo $currentDay;
|
||||
exit;
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
|
||||
//echo "```ini<br>";
|
||||
echo $savegame->currentDay;
|
||||
exit;
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
|
||||
echo "```ini<br>";
|
||||
echo "Current Date: " $savegame->currentDay;
|
||||
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
// echo "Available Contracts are:";
|
||||
/*echo "|Field ID|Job Type|Reward|Cost|Status|<br>
|
||||
|--------|--------|------|----|------|<br>";*/
|
||||
|
||||
echo "```ini<br>";
|
||||
echo 'Current Date: '. $savegame->currentDay . '<br>';
|
||||
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
//$sow = $mission['sow'];
|
||||
|
||||
|
||||
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
//$status = status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
|
||||
|
||||
/* $text = "
|
||||
<br>
|
||||
**Field $field** has an assignment of **$type**, the contract is worth **$$reward**, borrowing the equipment for this contract will cost you **$$cost**.<br> This contract status is $status.<br>
|
||||
<!--Contract Revenue with equipment is **$$equipment**.<br>-->
|
||||
"; */
|
||||
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
<!-- <tr>
|
||||
<td><?=$field?></td>
|
||||
<td><?=$type?></td>
|
||||
<td>$<?=$reward?></td>
|
||||
<td>$<?=$cost?></td>
|
||||
<td><?=$status?></td>
|
||||
</tr>-->
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
|
||||
echo "```ini<br>";
|
||||
echo 'Current Date: '. $savegame->currentDay . '<br>';
|
||||
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
|
||||
<?php endforeach;echo "```";?>
|
||||
<!--</tbody>
|
||||
</table>-->
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
file_get_contents('server.php');
|
||||
require_once 'include/missions_func.php';
|
||||
|
||||
|
||||
$dir = 'styles/fs19webstats/css/';
|
||||
$files = scandir($dir);
|
||||
foreach($files as $file){
|
||||
if($file === '.' || $file === '..')continue;
|
||||
$file = $dir.$file;
|
||||
echo '<link rel="stylesheet" type="text/css" href="'.$file.'">';
|
||||
}
|
||||
$defaultStyle = 'fs19webstats';
|
||||
ini_set('display_errors',1);
|
||||
error_reporting(E_ALL);
|
||||
session_start ();
|
||||
$_SESSION ['language'] = 'en';
|
||||
define ( 'IN_FS19WS', true );
|
||||
require ('./include/smarty/Smarty.class.php');
|
||||
require ('./include/language.php');
|
||||
require_once ('./include/functions.php');
|
||||
require ('./include/NavItems.class.php');
|
||||
include ('./include/coockie.php');
|
||||
$style = $options ['general'] ['style'];
|
||||
$smarty = new Smarty ();
|
||||
$smarty->debugging = false;
|
||||
$smarty->caching = false;
|
||||
|
||||
include ('./include/loadConfig.php');
|
||||
$smarty->assign ( 'onlineUser', sizeof ( $onlineUser ) );
|
||||
$smarty->assign ( 'hideFooter', $options ['general'] ['hideFooter'] );
|
||||
|
||||
include ('./include/savegame/Savegame.class.php');
|
||||
$savegame = new Savegame ( $webStatsConfig, $_SESSION ['farmId'] );
|
||||
$smarty->assign ( 'currentDay', $savegame->currentDay );
|
||||
$smarty->assign ( 'dayTime', $savegame->dayTime );
|
||||
$smarty->assign ( 'money', $savegame->getFarmMoney ( $_SESSION ['farmId'] ) );
|
||||
include ('./include/savegame/Missions.class.php');
|
||||
Mission::extractXML ( $savegame->getXML ( 'missions' ) );
|
||||
$missions = Mission::getAllMissions ();
|
||||
|
||||
|
||||
include ('./include/savegame/Farm.class.php');
|
||||
Farm::extractXML ( $savegame::$xml );
|
||||
$farms = Farm::getAllFarms ();
|
||||
|
||||
$smarty->assign ( 'missions', $missions );
|
||||
$smarty->assign ( 'farms', $farms );
|
||||
|
||||
$jsonFarmNames = 'farmNames.json';
|
||||
$json = json_encode($farms);
|
||||
$json = file_put_contents($jsonFarmNames,$json);
|
||||
|
||||
?>
|
||||
<div class="container">
|
||||
|
||||
<!-- <table class="table table-bordered">
|
||||
<thead>
|
||||
<td>Field ID</td>
|
||||
<td>Assignment</td>
|
||||
<td>Reward</td>
|
||||
<td>Vehicle Cost</td>
|
||||
<td>Status</td>
|
||||
</thead>
|
||||
<tbody>-->
|
||||
<?php
|
||||
$jsonFileName = 'missions.json';
|
||||
//$jsonMissionFile = [$field,$type,$reward,$cost,$status];
|
||||
$json = json_encode($missions);
|
||||
$json = file_put_contents($jsonFileName,$json);
|
||||
|
||||
$i = 0;
|
||||
|
||||
echo "```ini<br>";
|
||||
echo 'Current Date: '. $savegame->currentDay . '<br>';
|
||||
|
||||
foreach($missions as $name => $val):
|
||||
|
||||
$mission = $missions[$name];
|
||||
|
||||
$field = $mission['field'];
|
||||
$type = $mission['type'];
|
||||
$fruit = $mission['fruitTypeName'];
|
||||
|
||||
$type = translateAssignment($type);
|
||||
|
||||
$type = missionType($type,$fruit);
|
||||
|
||||
|
||||
$reward = number_format($mission['reward'],0);
|
||||
$status = $mission['status'];
|
||||
$status = $status > 0 ? status($status) . ' by ['. getFarmName($mission['farmId'], $jsonFarmNames) . ']' : status($status);
|
||||
|
||||
$cost = number_format($mission['vehicleUseCost'],0);
|
||||
$equipment = number_format($mission['reward'] - $mission['vehicleUseCost'],0);
|
||||
$text = "[F$field] $type - $$reward ($$cost)$status<br>";
|
||||
echo $text;
|
||||
?>
|
||||
|
||||
<?php endforeach;echo "```";?>
|
||||
</div>
|
||||
<?php
|
||||
/* echo '<pre>';
|
||||
print_r($farmNames);
|
||||
echo '</pre>';
|
||||
endforeach; */
|
||||
?>
|
|
@ -9,8 +9,8 @@
|
|||
<strong>{$stable.name}</strong><span class="badge badge-secondary badge-pill">{$stable.numberOfAnimals}</span>
|
||||
</button>
|
||||
<div id="collapse{$stableI3dName}" class="collapse {if $currentStable == $stableI3dName}show{/if}" data-parent="#accordion">
|
||||
{foreach $stable.animals as $animalI3dName => $animal} <a href="index.php?page={$page}&stable={$stableI3dName}&animal={$animalI3dName}" class="list-group-item list-group-item-action"> {$animal.name}{if $animal.isHorse}<br> <small>Tägliches Reiten<span class="float-right">{$animal.ridingTimer|number_format:0:",":"."}
|
||||
%</span></small>{else}<span class="float-right">{$animal.count}</span><br> <small>##PRODUCTIVITY##<span class="float-right">{$stable.productivity|number_format:0:",":"."} %</span></small>{/if}
|
||||
{foreach $stable.animals as $animalI3dName => $animal} <a href="index.php?page={$page}&stable={$stableI3dName}&animal={$animalI3dName}" class="list-group-item list-group-item-action"> {$animal.name}{if $animal.isHorse}<br> <small>Tägliches Reiten<span class="float-right">{$animal.ridingTimer|number_format:0:".":","}
|
||||
%</span></small>{else}<span class="float-right">{$animal.count}</span><br> <small>##PRODUCTIVITY##<span class="float-right">{$stable.productivity|number_format:0:".":","} %</span></small>{/if}
|
||||
</a> {foreachelse} <a href="#" class="list-group-item list-group-item-action"> ##NO_ANIMALS_IN_STABLE##<br>
|
||||
</a>{/foreach}
|
||||
</div>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<div class="col-lg-6">
|
||||
<h4>
|
||||
{$stables.$currentStable.animals.$currentAnimal.name}<span class="float-right">{if $stables.$currentStable.animals.$currentAnimal.isHorse}€
|
||||
{$stables.$currentStable.animals.$currentAnimal.value|number_format:0:",":"."}{else}{$stables.$currentStable.animals.$currentAnimal.count|number_format:0:",":"."}{/if}</span>
|
||||
{$stables.$currentStable.animals.$currentAnimal.value|number_format:0:".":","}{else}{$stables.$currentStable.animals.$currentAnimal.count|number_format:0:".":","}{/if}</span>
|
||||
</h4>
|
||||
<img src="{#IMAGES#}/animals/{$stables.$currentStable.animals.$currentAnimal.image}.png" class="img-fluid h-50 mx-auto d-block"> {if $stables.$currentStable.forHorses}
|
||||
<div class="row">
|
||||
|
@ -62,7 +62,7 @@
|
|||
<div class="col-6">
|
||||
<h5>##PRODUCTIVITY##</h5>
|
||||
</div>
|
||||
<div class="col-3 text-right">{$stables.$currentStable.productivity|number_format:0:",":"."} %</div>
|
||||
<div class="col-3 text-right">{$stables.$currentStable.productivity|number_format:0:".":","} %</div>
|
||||
<div class="col-3">
|
||||
<div class="progress">
|
||||
{$style='style="width: '|cat:$stables.$currentStable.productivity|cat:'%"'}
|
||||
|
@ -81,7 +81,7 @@
|
|||
{foreach $stables.$currentStable.product as $productName => $product}
|
||||
<div class="row mt-1">
|
||||
<div class="col-6">{$product.name}</div>
|
||||
<div class="col-6 text-right">{$product.value|number_format:0:",":"."} {$product.unit}</div>
|
||||
<div class="col-6 text-right">{$product.value|number_format:0:".":","} {$product.unit}</div>
|
||||
</div>
|
||||
{/foreach} {/if}
|
||||
</div>
|
||||
|
@ -91,7 +91,7 @@
|
|||
{foreach $stables.$currentStable.state as $stateName => $state}
|
||||
<div class="row mt-1">
|
||||
<div class="col-6">{$state.name}</div>
|
||||
<div class="col-3 text-right">{$state.value|number_format:0:",":"."} {$state.unit}</div>
|
||||
<div class="col-3 text-right">{$state.value|number_format:0:".":","} {$state.unit}</div>
|
||||
<div class="col-3">
|
||||
<div class="progress">
|
||||
{$style='style="width: '|cat:$state.factor|cat:'%"'}
|
||||
|
@ -104,7 +104,7 @@
|
|||
{foreach $stables.$currentStable.trough as $foodName => $food}
|
||||
<div class="row mt-1">
|
||||
<div class="col-6">{$food.name}</div>
|
||||
<div class="col-3 text-right">{$food.value|number_format:0:",":"."} {$food.unit}</div>
|
||||
<div class="col-3 text-right">{$food.value|number_format:0:".":","} {$food.unit}</div>
|
||||
<div class="col-3">
|
||||
<div class="progress">
|
||||
{$style='style="width: '|cat:$food.factor|cat:'%"'}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<tbody>
|
||||
<tr class="d-flex">
|
||||
{foreach $farms as $farmId => $farm}
|
||||
<td class="col-3"><strong>##FINANCES##: <span class="float-right">{$farm.money|number_format:0:",":"."}</span></strong></td> {/foreach}
|
||||
<td class="col-3"><strong>##FINANCES##: <span class="float-right">{$farm.money|number_format:0:".":","}</span></strong></td> {/foreach}
|
||||
</tr>
|
||||
<tr class="d-flex">
|
||||
{foreach $farms as $farmId => $farm}
|
||||
|
|
|
@ -40,25 +40,25 @@
|
|||
<div class="col-3">
|
||||
<ul class="list-unstyled">
|
||||
<li><span class="h5"> </span></li>
|
||||
<li class="text-right pr-3">{$assets.A1|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.A2|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.A3|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3 border-top">{$assets.A1+$assets.A2+$assets.A3|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.A1|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.A2|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.A3|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3 border-top">{$assets.A1+$assets.A2+$assets.A3|number_format:0:".":","}</li>
|
||||
<li><span class="h5"> </span></li>
|
||||
<li class="text-right pr-3">{$assets.B1|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.B2|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.B3|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.B4|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.B5|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3 border-top">{$assets.B1+$assets.B2+$assets.B3+$assets.B4+$assets.B5|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.B1|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.B2|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.B3|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.B4|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.B5|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3 border-top">{$assets.B1+$assets.B2+$assets.B3+$assets.B4+$assets.B5|number_format:0:".":","}</li>
|
||||
<li><span class="h5"> </span></li>
|
||||
<li> </li>
|
||||
<li class="text-right pr-3">{$assets.CI1|number_format:0:",":"."}</li>
|
||||
<!-- <li class="text-right pr-3">{if isset($assets.CI2)}{$assets.CI2|number_format:0:",":"."}{/if}</li> -->
|
||||
<li class="text-right pr-3">{$assets.CI3|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.CII|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.CIII|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3 border-top">{$assets.CI1+$assets.CI3+$assets.CII+$assets.CIII|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$assets.CI1|number_format:0:".":","}</li>
|
||||
<!-- <li class="text-right pr-3">{if isset($assets.CI2)}{$assets.CI2|number_format:0:".":","}{/if}</li> -->
|
||||
<li class="text-right pr-3">{$assets.CI3|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.CII|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$assets.CIII|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3 border-top">{$assets.CI1+$assets.CI3+$assets.CII+$assets.CIII|number_format:0:".":","}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -85,13 +85,13 @@
|
|||
<div class="col-3">
|
||||
<ul class="list-unstyled">
|
||||
<li><span class="h5"> </span></li>
|
||||
<li class="text-right pr-3">{$liabilities.A1|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$liabilities.A2|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3 border-top">{$liabilities.A1+$liabilities.A2|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$liabilities.A1|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$liabilities.A2|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3 border-top">{$liabilities.A1+$liabilities.A2|number_format:0:".":","}</li>
|
||||
<li><span class="h5"> </span></li>
|
||||
<li class="text-right pr-3">{$liabilities.B1|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$liabilities.B2|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3 border-top">{$liabilities.B1+$liabilities.B2|number_format:0:",":"."}</li>
|
||||
<li class="text-right pr-3">{$liabilities.B1|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3">{$liabilities.B2|number_format:0:".":","}</li>
|
||||
<li class="text-right pr-3 border-top">{$liabilities.B1+$liabilities.B2|number_format:0:".":","}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -103,7 +103,7 @@
|
|||
<p class="h5 pt-1">##BS_TOTAL_LEFT##</p>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<p class="h5 text-right pr-3 pt-1">{$balanceSheetSum|number_format:0:",":"."}</p>
|
||||
<p class="h5 text-right pr-3 pt-1">{$balanceSheetSum|number_format:0:".":","}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -113,7 +113,7 @@
|
|||
<p class="h5 pt-1">##BS_TOTAL_RIGHT##</p>
|
||||
</div>
|
||||
<div class="col-3">
|
||||
<p class="h5 text-right pr-3 pt-1">{$balanceSheetSum|number_format:0:",":"."}</p>
|
||||
<p class="h5 text-right pr-3 pt-1">{$balanceSheetSum|number_format:0:".":","}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -125,7 +125,7 @@
|
|||
<h5>
|
||||
##BWL_ADG##
|
||||
<a href="#BWLADG" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.adg|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.adg|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLADG">
|
||||
<p class="text-justify">##BWL_ADG_P1##</p>
|
||||
|
@ -143,7 +143,7 @@
|
|||
<h5>
|
||||
##BWL_EKQ##
|
||||
<a href="#BWLEKQ" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.ekq|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.ekq|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLEKQ">
|
||||
<p class="text-justify">##BWL_EKQ_P1##</p>
|
||||
|
@ -161,7 +161,7 @@
|
|||
<h5>
|
||||
##BWL_EKR##
|
||||
<a href="#BWLEKR" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.ekr|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.ekr|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLEKR">
|
||||
<p class="text-justify">##BWL_EKR_P1##</p>
|
||||
|
@ -179,7 +179,7 @@
|
|||
<h5>
|
||||
##BWL_FKQ##
|
||||
<a href="#BWLFKQ" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.fkq|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.fkq|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLFKQ">
|
||||
<p class="text-justify">##BWL_FKQ_P1##</p>
|
||||
|
@ -197,7 +197,7 @@
|
|||
<h5>
|
||||
##BWL_FKD##
|
||||
<a href="#BWLFK" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.fkd|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.fkd|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLFK">
|
||||
<p class="text-justify">##BWL_FKD_P1##</p>
|
||||
|
@ -219,7 +219,7 @@
|
|||
<h5>
|
||||
##BWL_L##
|
||||
<a href="#BWLL" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.l3g|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.l3g|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLl">
|
||||
<p class="text-justify">##BWL_L_P1##</p>
|
||||
|
@ -237,7 +237,7 @@
|
|||
<h5>
|
||||
##BWL_GKR##
|
||||
<a href="#BWLGKR" data-toggle="collapse" class="small">Details</a>
|
||||
<span class="float-right">{$ratios.gkr|number_format:0:",":"."} %</span>
|
||||
<span class="float-right">{$ratios.gkr|number_format:0:".":","} %</span>
|
||||
</h5>
|
||||
<div class="collapse" id="BWLGKR">
|
||||
<p class="text-justify">##BWL_GKR_P1##</p>
|
||||
|
@ -280,7 +280,7 @@
|
|||
{foreach $financeElements as $element => $category}
|
||||
<tr>
|
||||
<td>##{$element|strtoupper}##</td> {for $day = 4 to 0 step -1}
|
||||
<td class="text-right" style="width: 13%">{if isset($financeHistory.$day)}{$financeHistory.$day.$element|number_format:0:",":"."}{/if}</td>
|
||||
<td class="text-right" style="width: 13%">{if isset($financeHistory.$day)}{$financeHistory.$day.$element|number_format:0:".":","}{/if}</td>
|
||||
{/for}
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
@ -288,16 +288,16 @@
|
|||
<tfoot>
|
||||
<tr>
|
||||
<th>##TOTAL##</th> {for $day = 4 to 0 step -1}
|
||||
<th class="text-right" style="width: 13%">{if isset($financeHistory.$day)}{$financeHistory.$day.total|number_format:0:",":"."}{/if}</th> {/for}
|
||||
<th class="text-right" style="width: 13%">{if isset($financeHistory.$day)}{$financeHistory.$day.total|number_format:0:".":","}{/if}</th> {/for}
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><strong>##BALANCE1##</strong></td>
|
||||
<td class="text-right" colspan="2"><strong>{$money|number_format:0:",":"."}</strong></td>
|
||||
<td class="text-right" colspan="2"><strong>{$money|number_format:0:".":","}</strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4"><strong>##BALANCE2##</strong></td>
|
||||
<td class="text-right {if $money-$loan < 0}text-danger{else}text-success{/if}" colspan="2"><strong>(##LOAN##: {{$loan|number_format:0:",":"."}})
|
||||
{($money-$loan)|number_format:0:",":"."}</strong></td>
|
||||
<td class="text-right {if $money-$loan < 0}text-danger{else}text-success{/if}" colspan="2"><strong>(##LOAN##: {{$loan|number_format:0:".":","}})
|
||||
{($money-$loan)|number_format:0:".":","}</strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
@ -317,8 +317,8 @@
|
|||
"pageLength": rows,
|
||||
"dom": "<'row'<'col-sm-6'><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/{$smarty.session.language}/dataTables.lang"
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
{foreach $missions as $mission}
|
||||
<tr>
|
||||
<td class="text-right pr-3">{if isset($mission.field)}{$mission.field}{/if}</td>
|
||||
<td class="text-right pr-3">{if isset($mission.field)}{$mission.fieldSize|number_format:2:",":"."}{/if}</td>
|
||||
<td class="text-right pr-3">{if isset($mission.field)}{$mission.fieldSize|number_format:2:".":","}{/if}</td>
|
||||
<td>{$mission.type}{if $mission.type=='##MIS_HARVEST##' || $mission.type=='##MIS_MOW_BALE##'} ({$mission.fruitTypeName}){/if}</td>
|
||||
<td class="text-right pr-3">{$mission.reward|number_format:0:",":"."}</td>
|
||||
<td class="text-right pr-3">{if isset($mission.field)}{$mission.vehicleUseCost|number_format:0:",":"."}{/if}</td>
|
||||
<td class="text-right pr-3">{$mission.reward|number_format:0:".":","}</td>
|
||||
<td class="text-right pr-3">{if isset($mission.field)}{$mission.vehicleUseCost|number_format:0:".":","}{/if}</td>
|
||||
<td class="col-2">{if isset($mission.farmId)}{$farms[$mission.farmId].name}{/if}</td>
|
||||
<td>{if $mission.success}##ABGESCHLOSSEN##{elseif $mission.status}##ACTIVE##{/if}</td>
|
||||
</tr>
|
||||
|
@ -42,11 +42,11 @@
|
|||
paging: false,
|
||||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>><'row mt-3'<'col-sm-6'><'col-sm-6'f>>", // cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"url": "./language/{$smarty.session.language}/dataTables.lang"
|
||||
}
|
||||
"./language/{$smarty.session.language}/dataTables.lang"
|
||||
}"language": {
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url":
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
|
|
|
@ -31,6 +31,6 @@
|
|||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
<span class="navbar-text bg-secondary text-white px-3 text-right font-weight-bold text-nowrap">##DAY## {$currentDay}, {$dayTime}{if $money !== false} | {$money|number_format:0:",":"."}{/if}</span>
|
||||
<span class="navbar-text bg-secondary text-white px-3 text-right font-weight-bold text-nowrap">{$currentDay}, {$dayTime}{if $money !== false} | {$money|number_format:0:".":","}{/if}</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark justify-content-lg-center py-0">
|
||||
<a class="navbar-brand d-lg-none d-xl-block" href="index.php">{$map.Short} {$map.Version} Web Stats</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-lg-between align-items-lg-center" id="navbarNav">
|
||||
<ul class="navbar-nav mx-lg-auto mr-md-auto text-lg-center">
|
||||
{foreach $navItems as $link => $navItem}
|
||||
{if $navItem.showInNav}
|
||||
{if $navItem.active}
|
||||
{$class="nav-item active"}
|
||||
{else}
|
||||
{$class="nav-item"}
|
||||
{/if}
|
||||
{if $navItem.hasSubmenu}
|
||||
<li class="{$class|cat:' dropdown'}">
|
||||
<a class="nav-link dropdown-toggle py-0" href="index.php?page={$link}" id="navbarDropdown" data-toggle="dropdown"><img src="{#IMAGES#}/icons/{$link}.png" class="img-fluid d-none d-lg-block"><span class="d-lg-none d-md-block">{$navItem.text}</span></a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
{foreach $navItem.submenu as $subLink => $subItem}
|
||||
{if $subItem.showInNav}
|
||||
<a class="dropdown-item" href="index.php?page={$link}&subPage={$subLink}">{$subItem.text}</a>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</li>
|
||||
{else}
|
||||
<li class="{$class}">
|
||||
<a class="nav-link py-0" href="index.php?page={$link}"><img src="{#IMAGES#}/icons/{$link}.png" class="img-fluid d-none d-lg-block"><span class="d-lg-none d-md-block">{$navItem.text}</span></a>
|
||||
</li>
|
||||
{/if}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
<span class="navbar-text bg-secondary text-white px-3 text-right font-weight-bold text-nowrap">##DAY## {$currentDay}, {$dayTime}{if $money !== false} | {$money|number_format:0:".":","}{/if}</span>
|
||||
</div>
|
||||
</nav>
|
|
@ -36,7 +36,7 @@
|
|||
{else}
|
||||
{$trend='<i class="fas fa-caret-down" style="visibility: hidden"></i>'}
|
||||
{/if}
|
||||
{$value=$fillTypeData.locations.$location.price|floor|number_format:0:",":"."}
|
||||
{$value=$fillTypeData.locations.$location.price|floor|number_format:0:".":","}
|
||||
|
||||
{else}
|
||||
{$dataorder=""}{$class=""}{$value=""}{$trend=""}
|
||||
|
@ -49,7 +49,7 @@
|
|||
<tfoot>
|
||||
<tr>
|
||||
<th>##STOCKS##</th> {foreach $prices as $fillType => $fillTypeData}
|
||||
<th class="text-right pr-2">{if isset($commodities.$fillType)}{$commodities.$fillType.overall|number_format:0:",":"."}{/if}</th> {/foreach}
|
||||
<th class="text-right pr-2">{if isset($commodities.$fillType)}{$commodities.$fillType.overall|number_format:0:".":","}{/if}</th> {/foreach}
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
@ -107,14 +107,14 @@
|
|||
<tr>
|
||||
<td>{$fillType}</td>
|
||||
<td>{$fillTypeData.bestLocation}</td>
|
||||
<td class="text-right col-1 pr-3">{$fillTypeData.minPrice|number_format:0:",":"."}</td>
|
||||
<td class="text-right col-1 pr-3">{$fillTypeData.maxPrice|number_format:0:",":"."}</td>
|
||||
<td class="text-right col-1 pr-3 {if $fillTypeData.greatDemand}text-info{elseif $percent>=60}text-success{elseif $percent<=40}text-danger{/if}">{$fillTypeData.bestPrice|floor|number_format:0:",":"."} {if $fillTypeData.priceTrend == 1} <i class="fas fa-caret-up text-success"></i> {elseif
|
||||
<td class="text-right col-1 pr-3">{$fillTypeData.minPrice|number_format:0:".":","}</td>
|
||||
<td class="text-right col-1 pr-3">{$fillTypeData.maxPrice|number_format:0:".":","}</td>
|
||||
<td class="text-right col-1 pr-3 {if $fillTypeData.greatDemand}text-info{elseif $percent>=60}text-success{elseif $percent<=40}text-danger{/if}">{$fillTypeData.bestPrice|floor|number_format:0:".":","} {if $fillTypeData.priceTrend == 1} <i class="fas fa-caret-up text-success"></i> {elseif
|
||||
$fillTypeData.priceTrend == -1} <i class="fas fa-caret-down text-danger"></i> {else} <i class="fas fa-caret-down" style="visibility: hidden"></i> {/if}
|
||||
</td>
|
||||
<td class="text-center text-nowrap">{$percent|number_format:0:",":"."} %</td> {if $options['farmId']>0}{if isset($commodities.$fillType) && $commodities.$fillType.overall > 0}
|
||||
<td class="text-right col-1 pr-3">{$commodities.$fillType.overall|number_format:0:",":"."}</td> {math equation="overall * bestPrice / 1000" overall=$commodities.$fillType.overall bestPrice=$fillTypeData.bestPrice assign="proceeds"}
|
||||
<td class="text-right col-1 pr-3">{$proceeds|number_format:0:",":"."}</td> {else}
|
||||
<td class="text-center text-nowrap">{$percent|number_format:0:".":","} %</td> {if $options['farmId']>0}{if isset($commodities.$fillType) && $commodities.$fillType.overall > 0}
|
||||
<td class="text-right col-1 pr-3">{$commodities.$fillType.overall|number_format:0:".":","}</td> {math equation="overall * bestPrice / 1000" overall=$commodities.$fillType.overall bestPrice=$fillTypeData.bestPrice assign="proceeds"}
|
||||
<td class="text-right col-1 pr-3">{$proceeds|number_format:0:".":","}</td> {else}
|
||||
<td></td>
|
||||
<td></td> {/if}{/if}
|
||||
</tr>
|
||||
|
@ -140,8 +140,8 @@
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/{$smarty.session.language}/dataTables.lang"
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
{foreach $farm.statistics as $statistic => $value}
|
||||
<tr>
|
||||
<th>{$value.item}{if $value.category == 'litres'} [##LITRES##]{elseif $value.category == 'hectares'} [##HA##]{/if}</th> {foreach $farms as $sFrmId => $sFarm}
|
||||
<td class="text-right pr-3">{if $sFarm.statistics.$statistic.category == 'count'} {$sFarm.statistics.$statistic.value|number_format:0:",":"."} {elseif $sFarm.statistics.$statistic.category == 'litres'} {$sFarm.statistics.$statistic.value|number_format:2:",":"."} {elseif
|
||||
$sFarm.statistics.$statistic.category == 'hectares'} {$sFarm.statistics.$statistic.value|number_format:2:",":"."} {elseif $sFarm.statistics.$statistic.category == 'time'} {$sFarm.statistics.$statistic.value} {/if}</td>{/foreach}
|
||||
<td class="text-right pr-3">{if $sFarm.statistics.$statistic.category == 'count'} {$sFarm.statistics.$statistic.value|number_format:0:".":","} {elseif $sFarm.statistics.$statistic.category == 'litres'} {$sFarm.statistics.$statistic.value|number_format:2:".":","} {elseif
|
||||
$sFarm.statistics.$statistic.category == 'hectares'} {$sFarm.statistics.$statistic.value|number_format:2:".":","} {elseif $sFarm.statistics.$statistic.category == 'time'} {$sFarm.statistics.$statistic.value} {/if}</td>{/foreach}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
{foreach $commodities as $fillType => $commodity} {if $commodity@iteration > $colmax[$i] && $commodity@iteration <= $colmax[$i+1] }
|
||||
<tr data-toggle="collapse" href="#collapse{$commodity.i3dName}" {if isset($commodity.outOfMap)}class="danger"{/if}>
|
||||
<td>{$fillType}</td>
|
||||
<td class="text-right">{$commodity.overall|number_format:0:",":"."}</td>
|
||||
<td class="text-right">{$commodity.overall|number_format:0:".":","}</td>
|
||||
</tr>
|
||||
{if $commodity.overall>-1}
|
||||
<tr class="collapse" id="collapse{$commodity.i3dName}">
|
||||
|
@ -32,7 +32,7 @@
|
|||
<tr>
|
||||
<td>{if isset($plants.$locationName)}<a href="index.php?page=factories&object={$plants.$locationName.i3dName}">{$locationName}</a>{else}{$locationName}{/if}{if $addInfo} ({$addInfo}){/if}
|
||||
</td>
|
||||
<td class="text-right">{$location.fillLevel|number_format:0:",":"."}</td>
|
||||
<td class="text-right">{$location.fillLevel|number_format:0:".":","}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
|
|
@ -26,10 +26,10 @@
|
|||
<td class="text-right pr-3">{$vehicle.age}</td>
|
||||
<td class="text-right pr-3">{$vehicle.wear|number_format:0} %</td>
|
||||
<td data-order="{$vehicle.operatingTime|number_format:0:" ,":"."}" class="text-right pr-3">{$vehicle.operatingTimeString}</td>
|
||||
<td data-order="{if $vehicle.propertyState==1}{$vehicle.resale}{else}0{/if}" class="text-right pr-3">{if $vehicle.propertyState==1}{$vehicle.resale|number_format:0:",":"."}{elseif $vehicle.propertyState==3}Mission{/if}</td>
|
||||
<td class="text-right pr-3">{if $vehicle.propertyState==2}{$vehicle.dayLeasingCost|number_format:0:",":"."}{/if}</td>
|
||||
<td class="text-right pr-3">{if $vehicle.propertyState==2}{$vehicle.leasingCostPerHour|number_format:0:",":"."}{/if}</td>
|
||||
<td class="text-right pr-3">{if $vehicle.propertyState==2}{$vehicle.leasingCost|number_format:0:",":"."}{/if}</td>
|
||||
<td data-order="{if $vehicle.propertyState==1}{$vehicle.resale}{else}0{/if}" class="text-right pr-3">{if $vehicle.propertyState==1}{$vehicle.resale|number_format:0:".":","}{elseif $vehicle.propertyState==3}Mission{/if}</td>
|
||||
<td class="text-right pr-3">{if $vehicle.propertyState==2}{$vehicle.dayLeasingCost|number_format:0:".":","}{/if}</td>
|
||||
<td class="text-right pr-3">{if $vehicle.propertyState==2}{$vehicle.leasingCostPerHour|number_format:0:".":","}{/if}</td>
|
||||
<td class="text-right pr-3">{if $vehicle.propertyState==2}{$vehicle.leasingCost|number_format:0:".":","}{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
@ -49,8 +49,8 @@
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/{$smarty.session.language}/dataTables.lang"
|
||||
}
|
||||
} );
|
||||
|
@ -77,7 +77,7 @@
|
|||
<td>{$building.name}</td>
|
||||
<td class="text-right pr-3">{$building.age}</td>
|
||||
<td class="text-right pr-3">{$building.price}</td>
|
||||
<td data-order="{$building.resale}" class="text-right pr-3">{$building.resale|number_format:0:",":"."}</td>
|
||||
<td data-order="{$building.resale}" class="text-right pr-3">{$building.resale|number_format:0:".":","}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
|
@ -96,8 +96,8 @@
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/{$smarty.session.language}/dataTables.lang"
|
||||
}
|
||||
} );
|
||||
|
|
|
@ -410,8 +410,8 @@ echo $_prefixVariable1;?>
|
|||
"pageLength": rows,
|
||||
"dom": "<'row'<'col-sm-6'><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -247,8 +247,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -247,8 +247,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -410,8 +410,8 @@ echo $_prefixVariable1;?>
|
|||
"pageLength": rows,
|
||||
"dom": "<'row'<'col-sm-6'><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
@ -160,8 +160,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>", // cut from beginn: <'row'<'col-sm-6'><'col-sm-6'f>> cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -410,8 +410,8 @@ echo $_prefixVariable1;?>
|
|||
"pageLength": rows,
|
||||
"dom": "<'row'<'col-sm-6'><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>><'row mt-3'<'col-sm-6'><'col-sm-6'f>>", // cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>><'row mt-3'<'col-sm-6'><'col-sm-6'f>>", // cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>><'row mt-3'<'col-sm-6'><'col-sm-6'f>>", // cut from end: <'row'<'col-sm-5'i><'col-sm-7'p>>
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
|
@ -247,8 +247,8 @@ $_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>
|
|||
stateSave: true,
|
||||
"dom": "<'row'<'col-sm-12'tr>>",
|
||||
"language": {
|
||||
"decimal": ",",
|
||||
"thousands": ".",
|
||||
"decimal": ".",
|
||||
"thousands": ",",
|
||||
"url": "./language/<?php echo $_SESSION['language'];?>
|
||||
/dataTables.lang"
|
||||
}
|
||||
|
|
Reference in New Issue