From 50bfd419e2153597fed9a5fa39bf8530cf2c4e79 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 8 Jun 2012 20:31:31 +0300 Subject: [PATCH] delete more change of songeriux (i prefer that users can register in any language), improve forum and BBcode (not 100%, but fix some bugs) --- GameEngine/Account.php | 8 +- GameEngine/BBCode.php | 184 +------------------------- GameEngine/Database/db_MYSQL.php | 7 + Templates/Alliance/Forum/forum_10.tpl | 2 +- Templates/Alliance/Forum/forum_4.tpl | 6 +- Templates/Alliance/Forum/forum_6.tpl | 2 +- Templates/Alliance/Forum/forum_7.tpl | 2 +- Templates/Alliance/Forum/forum_9.tpl | 2 +- Templates/Alliance/forum.tpl | 11 +- allianz.php | 35 ++++- spieler.php | 7 + 11 files changed, 61 insertions(+), 205 deletions(-) diff --git a/GameEngine/Account.php b/GameEngine/Account.php index 76b4e7c8..399c418b 100644 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -57,9 +57,7 @@ class Account { } else if($database->checkExist_activate($_POST['name'],0)) { $form->addError("name",USRNM_TAKEN); - } elseif(preg_replace("/[a-zA-Z0-9_-]/","",$_POST['name'])){ - $form->addError("name","Unusable simbols. Allowed text format: a-z, A-Z, 0-9 and _ -"); - } + } } if(!isset($_POST['pw']) || $_POST['pw'] == "") { @@ -72,9 +70,7 @@ class Account { else if($_POST['pw'] == $_POST['name']) { $form->addError("pw",PW_INSECURE); - } elseif(preg_replace("/[a-zA-Z0-9]/","",$_POST['pw'])){ - $form->addError("name","Unusable simbols. Allowed text format: a-z, A-Z, 0-9"); - } + } } if(!isset($_POST['email'])) { $form->addError("email",EMAIL_EMPTY); diff --git a/GameEngine/BBCode.php b/GameEngine/BBCode.php index 15334b59..67e87266 100644 --- a/GameEngine/BBCode.php +++ b/GameEngine/BBCode.php @@ -1,183 +1 @@ -$1"; -$replace[1] = "$1"; -$replace[2] = "$1"; -$replace[3] = "Legionnaire"; -$replace[4] = "Praetorian"; -$replace[5] = "Imperian"; -$replace[6] = "Equites Legati"; -$replace[7] = "Equites Imperatoris"; -$replace[8] = "Equites Caesaris"; -$replace[9] = "Battering Ram"; -$replace[10] = "Fire Catapult"; -$replace[11] = "Senator"; -$replace[12] = "Settler"; -$replace[13] = "Clubswinger"; -$replace[14] = "Spearman"; -$replace[15] = "Axeman"; -$replace[16] = "Scout"; -$replace[17] = "Paladin"; -$replace[18] = "Teutonic Knight"; -$replace[19] = "Ram"; -$replace[20] = "Catapult"; -$replace[21] = "Chief"; -$replace[22] = "Settler"; -$replace[23] = "Phalanx"; -$replace[24] = "Swordsman"; -$replace[25] = "Pathfinder"; -$replace[26] = "Theutates Thunder"; -$replace[27] = "Druidrider"; -$replace[28] = "Haeduan"; -$replace[29] = "Ram"; -$replace[30] = "Trebuchet"; -$replace[31] = "Chieftain"; -$replace[32] = "Settler"; -$replace[33] = "Rat"; -$replace[34] = "Spider"; -$replace[35] = "Snake"; -$replace[36] = "Bat"; -$replace[37] = "Wild Boar"; -$replace[38] = "Wolf"; -$replace[39] = "Bear"; -$replace[40] = "Crocodile"; -$replace[41] = "Tiger"; -$replace[42] = "Elephant"; -$replace[43] = "Pikeman"; -$replace[44] = "Thorned Warrior"; -$replace[45] = "Guardsman"; -$replace[46] = "Birds Of Prey"; -$replace[47] = "Axerider"; -$replace[48] = "Natarian Knight"; -$replace[49] = "War Elephant"; -$replace[50] = "Ballista"; -$replace[51] = "Natarian Emperor"; -$replace[52] = "Settler"; -$replace[53] = "Hero"; -$replace[54] = "Lumber"; -$replace[55] = "Clay"; -$replace[56] = "Iron"; -$replace[57] = "Crop"; -$replace[58] = "*aha*"; -$replace[59] = "*angry*"; -$replace[60] = "*cool*"; -$replace[61] = "*cry*"; -$replace[62] = "*cute*"; -$replace[63] = "*depressed*"; -$replace[64] = "*eek*"; -$replace[65] = "*ehem*"; -$replace[66] = "*emotional*"; -$replace[67] = ":D"; -$replace[68] = ":)"; -$replace[69] = "*hit*"; -$replace[70] = "*hmm*"; -$replace[71] = "*hmpf*"; -$replace[72] = "*hrhr*"; -$replace[73] = "*huh*"; -$replace[74] = "*lazy*"; -$replace[75] = "*love*"; -$replace[76] = "*nocomment*"; -$replace[77] = "*noemotion*"; -$replace[78] = "*notamused*"; -$replace[79] = "*pout*"; -$replace[80] = "*redface*"; -$replace[81] = "*rolleyes*"; -$replace[82] = ":("; -$replace[83] = "*shy*"; -$replace[84] = "*smile*"; -$replace[85] = "*tongue*"; -$replace[86] = "*veryangry*"; -$replace[87] = "*veryhappy*"; -$replace[88] = ";)"; -$bbcoded = preg_replace($pattern, $replace, $input); -?> \ No newline at end of file +$1"; $replace[1] = "$1"; $replace[2] = "$1"; $replace[3] = "Legionnaire"; $replace[4] = "Praetorian"; $replace[5] = "Imperian"; $replace[6] = "Equites Legati"; $replace[7] = "Equites Imperatoris"; $replace[8] = "Equites Caesaris"; $replace[9] = "Battering Ram"; $replace[10] = "Fire Catapult"; $replace[11] = "Senator"; $replace[12] = "Settler"; $replace[13] = "Clubswinger"; $replace[14] = "Spearman"; $replace[15] = "Axeman"; $replace[16] = "Scout"; $replace[17] = "Paladin"; $replace[18] = "Teutonic Knight"; $replace[19] = "Ram"; $replace[20] = "Catapult"; $replace[21] = "Chief"; $replace[22] = "Settler"; $replace[23] = "Phalanx"; $replace[24] = "Swordsman"; $replace[25] = "Pathfinder"; $replace[26] = "Theutates Thunder"; $replace[27] = "Druidrider"; $replace[28] = "Haeduan"; $replace[29] = "Ram"; $replace[30] = "Trebuchet"; $replace[31] = "Chieftain"; $replace[32] = "Settler"; $replace[33] = "Rat"; $replace[34] = "Spider"; $replace[35] = "Snake"; $replace[36] = "Bat"; $replace[37] = "Wild Boar"; $replace[38] = "Wolf"; $replace[39] = "Bear"; $replace[40] = "Crocodile"; $replace[41] = "Tiger"; $replace[42] = "Elephant"; $replace[43] = "Pikeman"; $replace[44] = "Thorned Warrior"; $replace[45] = "Guardsman"; $replace[46] = "Birds Of Prey"; $replace[47] = "Axerider"; $replace[48] = "Natarian Knight"; $replace[49] = "War Elephant"; $replace[50] = "Ballista"; $replace[51] = "Natarian Emperor"; $replace[52] = "Settler"; $replace[53] = "Hero"; $replace[54] = "Lumber"; $replace[55] = "Clay"; $replace[56] = "Iron"; $replace[57] = "Crop"; $replace[58] = "*aha*"; $replace[59] = "*angry*"; $replace[60] = "*cool*"; $replace[61] = "*cry*"; $replace[62] = "*cute*"; $replace[63] = "*depressed*"; $replace[64] = "*eek*"; $replace[65] = "*ehem*"; $replace[66] = "*emotional*"; $replace[67] = ":D"; $replace[68] = ":)"; $replace[69] = "*hit*"; $replace[70] = "*hmm*"; $replace[71] = "*hmpf*"; $replace[72] = "*hrhr*"; $replace[73] = "*huh*"; $replace[74] = "*lazy*"; $replace[75] = "*love*"; $replace[76] = "*nocomment*"; $replace[77] = "*noemotion*"; $replace[78] = "*notamused*"; $replace[79] = "*pout*"; $replace[80] = "*redface*"; $replace[81] = "*rolleyes*"; $replace[82] = ":("; $replace[83] = "*shy*"; $replace[84] = "*smile*"; $replace[85] = "*tongue*"; $replace[86] = "*veryangry*"; $replace[87] = "*veryhappy*"; $replace[88] = ";)"; $replace[89] = "$1"; $replace[90] = "$1"; $bbcoded = preg_replace($pattern, $replace, $input); ?> \ No newline at end of file diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index cab861bf..37ac4268 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -863,6 +863,13 @@ $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } + + function ForumCatAlliance($id) { + $q = "SELECT alliance from " . TB_PREFIX . "forum_cat where id = $id"; + $result = mysql_query($q, $this->connection); + $dbarray = mysql_fetch_array($result); + return $dbarray['alliance']; + } function ForumCatName($id) { $q = "SELECT forum_name from " . TB_PREFIX . "forum_cat where id = $id"; diff --git a/Templates/Alliance/Forum/forum_10.tpl b/Templates/Alliance/Forum/forum_10.tpl index 825553fc..a3027783 100644 --- a/Templates/Alliance/Forum/forum_10.tpl +++ b/Templates/Alliance/Forum/forum_10.tpl @@ -12,7 +12,7 @@ foreach($posts as $pos) { $poss = $pos['post']; } ?> -
+ diff --git a/Templates/Alliance/Forum/forum_4.tpl b/Templates/Alliance/Forum/forum_4.tpl index b66467f6..20e3cb3d 100644 --- a/Templates/Alliance/Forum/forum_4.tpl +++ b/Templates/Alliance/Forum/forum_4.tpl @@ -46,9 +46,9 @@ if($ChckTopic){ echo 'Important Thread without new posts'; } echo ' - '.$arrs['title'].'
+ '.$arrs['title'].'
'.$CountPosts.' - '.$post_dates.'
'.$owner_topics['username'].' Show last post + '.$post_dates.'
'.$owner_topics['username'].' Show last post '; } @@ -80,7 +80,7 @@ if($ChckTopic){ echo 'Thread without new posts'; } echo ' - '.$arr['title'].'
+ '.$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 73abc8bc..19e6ae74 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -96,7 +96,7 @@ echo '
'.$bbcode_post.'
Replies'; + echo 'Replies'; } if($opt[opt5] == 1){ echo 'Toggle Admin mode'; diff --git a/Templates/Alliance/Forum/forum_7.tpl b/Templates/Alliance/Forum/forum_7.tpl index 3bdf0bce..1b26294d 100644 --- a/Templates/Alliance/Forum/forum_7.tpl +++ b/Templates/Alliance/Forum/forum_7.tpl @@ -7,7 +7,7 @@ foreach($topics as $arr) { $title = $arr['title']; } ?> - + diff --git a/Templates/Alliance/Forum/forum_9.tpl b/Templates/Alliance/Forum/forum_9.tpl index 4b846c34..df07a7e1 100644 --- a/Templates/Alliance/Forum/forum_9.tpl +++ b/Templates/Alliance/Forum/forum_9.tpl @@ -8,7 +8,7 @@ foreach($topics as $top) { $ans = $top['post']; } ?> - + diff --git a/Templates/Alliance/forum.tpl b/Templates/Alliance/forum.tpl index f1665f3c..0bd0ff1c 100644 --- a/Templates/Alliance/forum.tpl +++ b/Templates/Alliance/forum.tpl @@ -2,10 +2,14 @@ //////////////// made by TTMTT //////////////// if(isset($aid)) { $aid = $aid; -} -else { +}else if($_GET['fid']){ +$aid = $database->ForumCatAlliance($_GET['fid']); +}else if($_GET['fid2']){ +$aid = $database->ForumCatAlliance($_GET['fid2']); +}else{ $aid = $session->alliance; } + $allianceinfo = $database->getAlliance($aid); $opt = $database->getAlliPermissions($session->uid, $aid); echo "

".$allianceinfo['tag']." - ".$allianceinfo['name']."

"; @@ -55,9 +59,10 @@ if(isset($_POST['newpost'])){ $post = htmlspecialchars($post); $tids = $_POST['tid']; $owner = $session->uid; - + if($post != ""){ $database->UpdatePostDate($tids); $database->CreatPost($post,$tids,$owner); + } } if(isset($_POST['editans'])){ $post = $_POST['text']; diff --git a/allianz.php b/allianz.php index ae1607b7..4ad46616 100644 --- a/allianz.php +++ b/allianz.php @@ -33,14 +33,19 @@ if(isset($_GET['newdid'])) { if(isset($_GET['s'])){ $automation->isWinner(); } +if(isset($_GET['aname'])){ +$aname = $database->getAllianceID($_GET['aname']); +$_GET['aid'] = $aname; +header("Location: ".$_SERVER['PHP_SELF']."?aid=".$aname); +} if(isset($_GET['fid'])){ $fid = $_GET['fid']; $forum = mysql_query("SELECT * FROM " . TB_PREFIX . "forum_cat WHERE id = ".$fid.""); $forum_type = mysql_fetch_array($forum); -if($forum_type['forum_name'] != ""){ +if($forum_type['forum_name'] != "" && $forum_type['forum_area'] != 1){ if($forum_type['forum_area'] == 0){ if($forum_type['alliance'] != $session->alliance){ - header("Location: allianz.php"); + header("Location: ".$_SERVER['PHP_SELF']); } }else if($forum_type['forum_area'] == 2){ if($forum_type['alliance'] != $session->alliance){ @@ -49,11 +54,30 @@ if($forum_type['alliance'] != $session->alliance){ } }else{ - header("Location: allianz.php"); + header("Location: ".$_SERVER['PHP_SELF']); +} +} +}else if(isset($_GET['fid2'])){ +$fid = $_GET['fid2']; +$forum = mysql_query("SELECT * FROM " . TB_PREFIX . "forum_cat WHERE id = ".$fid.""); +$forum_type = mysql_fetch_array($forum); +if($forum_type['forum_name'] != "" && $forum_type['forum_area'] != 1){ +if($forum_type['forum_area'] == 0){ +if($forum_type['alliance'] != $session->alliance){ + header("Location: ".$_SERVER['PHP_SELF']); +} +}else if($forum_type['forum_area'] == 2){ +if($forum_type['alliance'] != $session->alliance){ +}else if($forum_type['forum_area'] == 3){ + +} + +}else{ + header("Location: ".$_SERVER['PHP_SELF']); } } } -if($_GET['aid'] or $session->alliance!=0){ +if($_GET['aid'] or $_GET['fid'] or $_GET['fid2'] or $session->alliance!=0){ ?> @@ -192,7 +216,7 @@ if($_GET['aid'] or $session->alliance!=0){ } // Options }else{ - header("Location: allianz.php"); + header("Location: ".$_SERVER['PHP_SELF']); }} elseif(isset($_POST['o'])) { switch($_POST['o']) { case 1: @@ -345,5 +369,4 @@ if($_GET['aid'] or $session->alliance!=0){ uid); } \ No newline at end of file diff --git a/spieler.php b/spieler.php index 3696668b..813d3e33 100644 --- a/spieler.php +++ b/spieler.php @@ -30,6 +30,13 @@ else { if(isset($_GET['s'])){ $automation->isWinner(); } +if(isset($_GET['uname'])){ +$uname = $database->getUserField($_GET['uname'], "id", 1); +if($uname == ""){ +$uname = $session->uid; +} +header("Location: ".$_SERVER['PHP_SELF']."?uid=".$uname); +} ?>