From fd815357721c578eec34f88c0f7b6cb385ff03a6 Mon Sep 17 00:00:00 2001 From: mafiadek Date: Sat, 30 Mar 2013 16:15:06 +0700 Subject: [PATCH 01/21] Update Ranking.php FIX: Warning: Illegal string offset 'userid' in --- GameEngine/Ranking.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index 21d42b05..fab86065 100644 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -24,7 +24,7 @@ $users2 = mysql_num_rows(mysql_query($users)); $users3 = $users2+1; if(count($ranking) > 0) { - for($i=0;$i<($users3);$i++) { + for($i=1;$i<($users3);$i++) { if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") { $myrank = $i; } @@ -166,7 +166,7 @@ public function searchRank($name, $field) { while(1) { - $key = key($this->rankarray); + $key = key($this->rankarray)+1; if($this->rankarray[$key][$field] == $name) { return $key; break; @@ -538,4 +538,4 @@ $ranking = new Ranking; -?> \ No newline at end of file +?> From a8892d50fff3200c3269040485c86adc14d951d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Apr 2013 12:27:32 +0300 Subject: [PATCH 02/21] fix beginner protection when register before server start time --- GameEngine/Database/db_MYSQL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 0a7c4c07..03f7273b 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -20,7 +20,7 @@ class MYSQL_DB { function register($username, $password, $email, $tribe, $act) { $time = time(); - $timep = (time() + PROTECTION); + $timep = (strtotime(START_TIME) + PROTECTION); $q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,act,protect,lastupdate,regtime) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, '$act', $timep, $time, $time)"; if(mysql_query($q, $this->connection)) { return mysql_insert_id($this->connection); From 85b438c7422f6ab6a47313cc890418953a488f6c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 2 Apr 2013 04:12:23 +0300 Subject: [PATCH 03/21] fix ally def points average --- GameEngine/Ranking.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index fab86065..c667b0a7 100644 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -24,7 +24,7 @@ $users2 = mysql_num_rows(mysql_query($users)); $users3 = $users2+1; if(count($ranking) > 0) { - for($i=1;$i<($users3);$i++) { + for($i=0;$i<($users3);$i++) { if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") { $myrank = $i; } @@ -166,7 +166,7 @@ public function searchRank($name, $field) { while(1) { - $key = key($this->rankarray)+1; + $key = key($this->rankarray); if($this->rankarray[$key][$field] == $name) { return $key; break; @@ -519,7 +519,7 @@ $value['players'] = count($memberlist); $value['totaldp'] = $totaldp; if($value['avg'] > 0) { - $value['avg'] = round($totalap / count($memberlist)); + $value['avg'] = round($totaldp / count($memberlist)); } else { $value['avg'] = 0; } @@ -538,4 +538,4 @@ $ranking = new Ranking; -?> +?> \ No newline at end of file From c5fef395762d868e6caa5ff868836035f15ff7b6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 2 Apr 2013 16:19:52 +0300 Subject: [PATCH 04/21] fix ally attack and defence statistics --- GameEngine/Ranking.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index c667b0a7..87ce2983 100644 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -484,10 +484,7 @@ $holder = array(); foreach($array as $value) { $memberlist = $database->getAllMember($value['id']); - $totalap = 0; - foreach($memberlist as $member) { - $totalap += $member['ap']; - } + $totalap = $value['Aap']; $value['players'] = count($memberlist); $value['totalap'] = $totalap; if($value['avg'] > 0) { @@ -512,10 +509,7 @@ $holder = array(); foreach($array as $value) { $memberlist = $database->getAllMember($value['id']); - $totaldp = 0; - foreach($memberlist as $member) { - $totaldp += $member['dp']; - } + $totaldp = $value['Adp']; $value['players'] = count($memberlist); $value['totaldp'] = $totaldp; if($value['avg'] > 0) { From e048309a6b017f4b271de44faa0ae7e80b3f28f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 3 Apr 2013 21:01:03 +0300 Subject: [PATCH 05/21] fix getARanking --- GameEngine/Database/db_MYSQL.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 03f7273b..66a8dee6 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -2151,7 +2151,7 @@ class MYSQL_DB { } function getARanking() { - $q = "SELECT id,name,tag,oldrank FROM " . TB_PREFIX . "alidata where id != '' ORDER BY id DESC"; + $q = "SELECT id,name,tag,oldrank,Aap,Adp FROM " . TB_PREFIX . "alidata where id != '' ORDER BY id DESC"; $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } From 55d74290d02735e049bddaf4af7b8949587a4811 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Apr 2013 01:16:22 +0300 Subject: [PATCH 06/21] some fix for ally forum --- Templates/Alliance/Forum/forum_10.tpl | 4 ++-- Templates/Alliance/Forum/forum_2.tpl | 8 ++++---- Templates/Alliance/Forum/forum_3.tpl | 6 +++--- Templates/Alliance/Forum/forum_4.tpl | 6 +++--- Templates/Alliance/Forum/forum_6.tpl | 8 ++++---- Templates/Alliance/Forum/forum_7.tpl | 2 +- Templates/Alliance/Forum/forum_8.tpl | 4 ++-- Templates/Alliance/Forum/forum_9.tpl | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Templates/Alliance/Forum/forum_10.tpl b/Templates/Alliance/Forum/forum_10.tpl index bb6c2659..c015ff56 100644 --- a/Templates/Alliance/Forum/forum_10.tpl +++ b/Templates/Alliance/Forum/forum_10.tpl @@ -6,10 +6,10 @@ $post_id = $_GET['pod']; $topics = $database->ShowTopic($topic_id); $posts = $database->ShowPostEdit($post_id); foreach($topics as $top) { - $title = $top['title']; + $title = stripslashes($top['title']); } foreach($posts as $pos) { - $poss = $pos['post']; + $poss = stripslashes($pos['post']); } ?>
diff --git a/Templates/Alliance/Forum/forum_2.tpl b/Templates/Alliance/Forum/forum_2.tpl index cffc62c3..baaf2656 100644 --- a/Templates/Alliance/Forum/forum_2.tpl +++ b/Templates/Alliance/Forum/forum_2.tpl @@ -54,7 +54,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'
'.$owner['username'].' Show last post '; @@ -105,7 +105,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'

'.$owner['username'].' Show last post '; @@ -156,7 +156,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'

'.$owner['username'].' Show last post '; @@ -207,7 +207,7 @@ if($database->CheckEditRes($aid)=="1"){ }else{ echo 'Thread without new posts'; } -echo ''.$arr['forum_name'].'
'.$arr['forum_des'].' +echo ''.stripslashes($arr['forum_name']).'
'.stripslashes($arr['forum_des']).' '.$countop.' '.$lpost.'

'.$owner['username'].' Show last post '; diff --git a/Templates/Alliance/Forum/forum_3.tpl b/Templates/Alliance/Forum/forum_3.tpl index fa1232ce..cb28dad8 100644 --- a/Templates/Alliance/Forum/forum_3.tpl +++ b/Templates/Alliance/Forum/forum_3.tpl @@ -4,7 +4,7 @@ if($session->access!=BANNED){ $topic_id = $_GET['idt']; $show_topic = $database->ShowTopic($topic_id); foreach($show_topic as $topi) { - $title = $topi['title']; + $title = stripslashes($topi['title']); } ?> @@ -29,9 +29,9 @@ foreach($show_topic as $topi) { $show_cat = $database->ForumCat($session->alliance); foreach($show_cat as $cats) { if($cats['id'] == $_GET['idf']){ - echo ''; + echo ''; }else{ - echo ''; + echo ''; } } ?> diff --git a/Templates/Alliance/Forum/forum_4.tpl b/Templates/Alliance/Forum/forum_4.tpl index 20e3cb3d..e8d3af1f 100644 --- a/Templates/Alliance/Forum/forum_4.tpl +++ b/Templates/Alliance/Forum/forum_4.tpl @@ -2,7 +2,7 @@ //////////////// made by TTMTT //////////////// if($session->access!=BANNED){ $cat_id = $_GET['fid']; -$CatName = $database->ForumCatName($cat_id); +$CatName = stripslashes($database->ForumCatName($cat_id)); $ChckTopic = $database->CheckCatTopic($cat_id); $Topics = $database->ForumCatTopic($cat_id); $TopicsStick = $database->ForumCatTopicStick($cat_id); @@ -46,7 +46,7 @@ if($ChckTopic){ echo 'Important Thread without new posts'; } echo ' - '.$arrs['title'].'
+ '.stripslashes($arrs['title']).'
'.$CountPosts.' '.$post_dates.'
'.$owner_topics['username'].' Show last post '; @@ -80,7 +80,7 @@ if($ChckTopic){ echo 'Thread without new posts'; } echo ' - '.$arr['title'].'
+ '.stripslashes($arr['title']).'
'.$CountPost.' '.$post_date.'
'.$owner_topic['username'].' Show last post '; diff --git a/Templates/Alliance/Forum/forum_6.tpl b/Templates/Alliance/Forum/forum_6.tpl index 19e6ae74..8b12916a 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -8,7 +8,7 @@ $posts = $database->ShowPost($tid); foreach($topics as $arr) { $cat_id = $arr['cat']; $owner = $database->getUserArray($arr['owner'],1); - $CatName = $database->ForumCatName($cat_id); + $CatName = stripslashes($database->ForumCatName($cat_id)); $allianceinfo = $database->getAlliance($owner['alliance']); } $date = date('m/d/y H:i a',$arr['date']); @@ -29,11 +29,11 @@ if($displayarray['tribe'] == 1) { $input = $arr['post']; $bbcoded = $input; include("GameEngine/BBCode.php"); -$bbcode_topic = nl2br($bbcoded); +$bbcode_topic = stripslashes(nl2br($bbcoded)); ?>

Alliance ->

- + @@ -76,7 +76,7 @@ foreach($posts as $po) { $allianceinfo = $database->getAlliance($owner['alliance']); $input = $po['post']; include("GameEngine/BBCode.php"); - $bbcode_post = nl2br($bbcoded); + $bbcode_post = stripslashes(nl2br($bbcoded)); echo '
Author
'.$owner['username'].'
'.$allianceinfo['tag'].'
Posts: '.$countAu.'
diff --git a/Templates/Alliance/Forum/forum_7.tpl b/Templates/Alliance/Forum/forum_7.tpl index 8a0f7c6b..8328c765 100644 --- a/Templates/Alliance/Forum/forum_7.tpl +++ b/Templates/Alliance/Forum/forum_7.tpl @@ -4,7 +4,7 @@ if($session->access!=BANNED){ $tid = $_GET['tid']; $topics = $database->ShowTopic($tid); foreach($topics as $arr) { - $title = $arr['title']; + $title = stripslashes($arr['title']); } ?> diff --git a/Templates/Alliance/Forum/forum_8.tpl b/Templates/Alliance/Forum/forum_8.tpl index eab35769..5d21c911 100644 --- a/Templates/Alliance/Forum/forum_8.tpl +++ b/Templates/Alliance/Forum/forum_8.tpl @@ -3,8 +3,8 @@ if($session->access!=BANNED){ $forum_data = $database->ForumCatEdit($_GET['idf']); foreach($forum_data as $cats) { - $cat_name = $cats['forum_name']; - $cat_des = $cats['forum_des']; + $cat_name = stripslashes($cats['forum_name']); + $cat_des = stripslashes($cats['forum_des']); } ?>