From fc8dfae658eab81c72498449bd66a4abe2ae8232 Mon Sep 17 00:00:00 2001 From: hecht Date: Mon, 7 Nov 2011 21:18:36 +0000 Subject: [PATCH] changes on cronjobs are implemented to be as small as possible! --- cronjob/gross_Turnier2.php | 3 ++- cronjob/kampf/chat.php | 2 +- cronjob/kampf/clan_kampf.php | 42 +++++++++++++++++----------------- cronjob/kampf/fight_vorbei.php | 6 ++--- cronjob/path.inc.php | 24 +++++++++++++++++++ cronjob/training.php | 3 ++- 6 files changed, 53 insertions(+), 27 deletions(-) create mode 100644 cronjob/path.inc.php diff --git a/cronjob/gross_Turnier2.php b/cronjob/gross_Turnier2.php index 895ebee..a5156b2 100644 --- a/cronjob/gross_Turnier2.php +++ b/cronjob/gross_Turnier2.php @@ -6,11 +6,12 @@ * */ include "db.php"; +include_once('path.inc.php'); // get the path ;) include_once ('inclu/messagefunctions.inc.php'); include_once ('inclu/halloffame.inc.php'); include_once ('inclu/fruitdistribution.inc.php'); include_once ('inclu/exp.inc.php'); -include_once ('include/usergroup.inc.php'); +include_once (ROOT_PATH.'/include/usergroup.inc.php'); include_once ('inclu/turnier.inc.php'); include_once ('inclu/char.inc.php'); diff --git a/cronjob/kampf/chat.php b/cronjob/kampf/chat.php index 209eeef..c1d5faa 100644 --- a/cronjob/kampf/chat.php +++ b/cronjob/kampf/chat.php @@ -5,7 +5,7 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ -include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/config.inc.php'); +include_once(ROOT_PATH.'/include/config.inc.php'); $user1 = mysql_Fetch_array(mysql_query("SELECT id, nickname FROM user WHERE nickname='$name' LIMIT 1")); diff --git a/cronjob/kampf/clan_kampf.php b/cronjob/kampf/clan_kampf.php index 7594b6f..73fb602 100644 --- a/cronjob/kampf/clan_kampf.php +++ b/cronjob/kampf/clan_kampf.php @@ -77,7 +77,7 @@ $technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$te ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... +include(ROOT_PATH.'/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... $technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); @@ -106,30 +106,30 @@ $speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); $aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG ##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/majin.php'); +include(ROOT_PATH.'/include/kampf/majin.php'); if(!$aussetzten_runde) { -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/tausch2.php'); //////////////////Muss ganz oben sein wegen technik Tauschen -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/gift.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/frucht.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/mp.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/hp.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/hp2.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/SSJ.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kaioken.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kaioken2.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/copy.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/lose.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/lose2.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/ausdauer.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/mpv.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/tausch.php'); -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/hpmp.php'); +include(ROOT_PATH.'/include/kampf/tausch2.php'); //////////////////Muss ganz oben sein wegen technik Tauschen +include(ROOT_PATH.'/include/kampf/gift.php'); +include(ROOT_PATH.'/include/kampf/frucht.php'); +include(ROOT_PATH.'/include/kampf/mp.php'); +include(ROOT_PATH.'/include/kampf/hp.php'); +include(ROOT_PATH.'/include/kampf/hp2.php'); +include(ROOT_PATH.'/include/kampf/SSJ.php'); +include(ROOT_PATH.'/include/kampf/kaioken.php'); +include(ROOT_PATH.'/include/kampf/kaioken2.php'); +include(ROOT_PATH.'/include/kampf/copy.php'); +include(ROOT_PATH.'/include/kampf/lose.php'); +include(ROOT_PATH.'/include/kampf/lose2.php'); +include(ROOT_PATH.'/include/kampf/ausdauer.php'); +include(ROOT_PATH.'/include/kampf/mpv.php'); +include(ROOT_PATH.'/include/kampf/tausch.php'); +include(ROOT_PATH.'/include/kampf/hpmp.php'); } -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/atk_wert.php'); +include(ROOT_PATH.'/include/kampf/atk_wert.php'); #####################################KAMPF SYSTEM -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kampf_rechnung.php'); +include(ROOT_PATH.'/include/kampf/kampf_rechnung.php'); @@ -199,7 +199,7 @@ $EXP_new1 = ($exp_rows2[siege]+1) * 10; $EXP_new2 = ($exp_rows1[siege]+1) * 5; include "clan_exp.php"; -include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kampf_rechnung.php'); +include(ROOT_PATH.'/include/kampf/kampf_rechnung.php'); mysql_query("UPDATE clan SET geld=geld+'5000', siege=siege+1, min_exp=min_exp+'$EXP1_new1' WHERE id='$clan1[$iws]'"); mysql_query("UPDATE clan SET geld=geld+'2000', niederlagen=niederlagen+1, min_exp=min_exp+'$EXP1_new2' WHERE id='$clan2[$iws]'"); diff --git a/cronjob/kampf/fight_vorbei.php b/cronjob/kampf/fight_vorbei.php index d5e2442..398c7de 100644 --- a/cronjob/kampf/fight_vorbei.php +++ b/cronjob/kampf/fight_vorbei.php @@ -6,8 +6,8 @@ * */ -include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/designfunctions.inc.php'); -include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/fehlerausgabe.inc.php'); +include_once(ROOT_PATH.'/include/designfunctions.inc.php'); +include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php'); $daten_ende = mysql_Fetch_array(mysql_query("SELECT * FROM kampf_new WHERE char1='$char_id' OR char2='$char_id' LIMIT 1")); @@ -51,7 +51,7 @@ $new_exp1 = round(((($chara_1x[starke] + $chara_1x[verteidigung] + $chara_1x[spe $new_geld1 = ((($chara_1x[starke] + $chara_1x[verteidigung] + $chara_1x[speed] + $chara_1x[ausdauer] + $chara_1x[glueck] + $chara_2x[starke] + $chara_2x[verteidigung] + $chara_2x[speed] + $chara_2x[ausdauer] + $chara_2x[glueck]) / 2) ); $new_geld1 = round($new_geld1); } -include($_SERVER['DOCUMENT_ROOT'].'ag/include/arena.php'); +include(ROOT_PATH.'/include/arena.php'); //######################EXP ENDE diff --git a/cronjob/path.inc.php b/cronjob/path.inc.php new file mode 100644 index 0000000..60843ce --- /dev/null +++ b/cronjob/path.inc.php @@ -0,0 +1,24 @@ +'; + + // okay this is the script that has included us :) -> lets search for the include/config/ directory + while(strlen($actual_path) > 0) { + $actual_path = substr($actual_path,0,strrpos($actual_path,'/')); + if(is_dir($actual_path . '/include/config')) { + define('ROOT_PATH', $actual_path); + define('ROOT_URL', '/ag'); // --> currently no support :( + } + } +} + +echo ROOT_PATH . '
'; +echo ROOT_URL . '
'; + +?> + diff --git a/cronjob/training.php b/cronjob/training.php index 64e7f6f..69abfe5 100644 --- a/cronjob/training.php +++ b/cronjob/training.php @@ -7,9 +7,10 @@ */ $test = date("H"); +include_once('path.inc.php'); // get the path ;) include "db.php"; include_once ('inclu/messagefunctions.inc.php'); -include_once ('include/usergroup.inc.php'); +include_once (ROOT_PATH.'/include/usergroup.inc.php'); include_once ('clanfights.inc.php'); if ($test == "02") {