refactor: OOP code movements started :)

This commit is contained in:
Martin Ambrus
2017-10-25 13:38:38 +02:00
parent ab461e5945
commit 30d3b9c4fa
20 changed files with 484 additions and 76 deletions
+4 -1
View File
@@ -8,6 +8,9 @@
## Copyright: TravianZ (c) 2014. All rights reserved. ##
#########################################################
include_once("../../../src/Entity/User.php");
use App\Entity\User;
include_once("../../config.php");
include_once("../../Session.php");
include_once("../../Automation.php");
@@ -78,7 +81,7 @@ else
$act = "";
// Check username not already registered
if($database->checkExist($userName,0))
if(User::exists($database, $userName))
{
// Name already used, do nothing except update $skipped
$skipped ++;
+3 -3
View File
@@ -38,7 +38,7 @@ class adm_DB {
var $connection;
function __construct(){
global $database;
$database = new MYSQLi_DB;
$database = new MYSQLi_DB(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB);
$this->connection = $database->return_link();
}
@@ -763,8 +763,8 @@ class adm_DB {
for($i=0;$i<=count($cropholder)-1;$i++) { $basecrop+= $bid4[$fdata[$cropholder[$i]]]['prod']; }
$crop = $basecrop + $basecrop * 0.25 * $ocounter[3];
$jcrop=0;
if($grainmill >= 1) $jcrop=$bid8[$grainmill]['attri'];
if($bakery >= 1) $jcrop+=$bid9[$bakery]['attri'];
if($grainmill >= 1) $jcrop=(isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0);
if($bakery >= 1) $jcrop+=(isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0);
$crop += $basecrop /100 * $jcrop;
if($b4 > time()) {
$crop *= 1.25;
+4 -4
View File
@@ -20,7 +20,7 @@
class funct {
function CheckLogin(){
if($_SESSION['access'] >= MULTIHUNTER and $_SESSION['id']){
if(isset($_SESSION['access']) && $_SESSION['access'] >= MULTIHUNTER and $_SESSION['id']){
return true;
}else{
return false;
@@ -212,14 +212,14 @@ class funct {
$funct = new funct;
if($funct->CheckLogin()){
if($_GET['action']){
if(isset($_GET['action']) && $_GET['action']){
$funct->Act($_GET);
}
if($_POST['action']){
if(isset($_POST['action']) && $_POST['action']){
$funct->Act2($_POST);
}
}
if($_POST['action']=='login'){
if(isset($_POST['action']) && $_POST['action']=='login'){
$funct->LogIN($_POST['name'],$_POST['pw']);
}
?>