Changeset 113 for db/post_read.php
- Timestamp:
- Oct 27, 2007, 10:23:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
db/post_read.php
r109 r113 2 2 if($vlozeni_souboru == "OK"){ 3 3 4 if( !empty($q) AND !empty($id) ){ 5 if( $id == "questy" ){ 6 if( !empty($lvl_d) AND !empty($lvl_h) ){ $where = "(`MinLevel`>='$lvl_d' AND `MinLevel`<='$lvl_h') AND "; }; 7 $sql_select = SQLselect_Strankovani("SELECT * FROM `quest_template` WHERE ( $where`Title` LIKE '%$q%' ) ORDER BY `entry` ASC", $limit, 20, "?id=questy&q=".$q."&lvl_d=".$lvl_d."&lvl_h=".$lvl_h, $SID); 8 if( @mysql_num_rows($sql_select[1]) > 0 ){ $i = 0; 9 $sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; 10 $sql_select['result'] .= "<thead><tr><td>Název úkolu</td><td>Min level</td><td>Úkol zadává</td><td>Úkol</td></tr></thead>\n<col width=\"180px\"><col width=\"70px\">"; 4 class BasicWiewer{ 5 var $q; // dotaz na vyhledávání 6 var $id; // současná stránka 7 var $limit; // současná stránka 8 var $nastranu = 20; // počet výsledků hledání které budou vypsány 9 var $sql_select; // proměnná obsahující všechny výsledky pro výpis 10 var $SID; // proměnná obsahující imformaci o přihlášení pro předání na konec každého odkazu 11 12 // konkrétní proměnné podle toho s čím pracujme 13 var $quest; // GUID Questu 14 var $lvl_d; // min. lvl u Questu 15 var $lvl_h; // max. lvl u Questu 16 var $bug; // GUID Bugu 17 var $creature; // GUID Creepa 18 var $item; // GUID Itemu 19 20 // nastavuje vstupní hodnoty 21 public function setPage($id,$SID){ 22 $this->id = $id; 23 $this->sid = $SID; 24 } 25 26 public function searchQuest($q,$lvl_d,$lvl_h,$limit,$nastranu){ 27 $this->q = $q; 28 $this->lvl_d = $lvl_d; 29 $this->lvl_h = $lvl_h; 30 $this->limit = $limit; 31 $this->nastranu = $nastranu; 32 $this->searchQuests(); // vykonáme hledání 33 return $this->sql_select; 34 } 35 36 public function searchCreep($q,$limit,$nastranu){ 37 $this->q = $q; 38 $this->limit = $limit; 39 $this->nastranu = $nastranu; 40 $this->searchCreeps(); // vykonáme hledání 41 return $this->sql_select; 42 } 43 44 public function quest($quest){ 45 $this->quest = $quest; 46 $this->showQuest(); // získání dat o Questu 47 return $this->sql_select; 48 } 49 50 public function bugs($bug,$limit,$nastranu){ 51 $this->bug = $bug; 52 $this->limit = $limit; 53 $this->nastranu = $nastranu; 54 $this->showBugs(); // vrací všechny chyby i s navigací pro listování 55 return $this->sql_select; 56 } 57 public function bug($bug){ 58 $this->bug = $bug; 59 $this->showBug(); // získání dat o konkrétním bugu 60 return $this->sql_select; 61 } 62 public function bugSend(){ 63 $this->sendBug(); 64 return $this->sql_select; 65 } 66 67 public function creature($creature){ 68 $this->creature = $creature; 69 $this->showCreature(); // získání dat o Creepovy 70 return $this->sql_select; 71 } 72 73 public function item($item){ 74 $this->item = $item; 75 # need to complete !!! 76 return $this->sql_select; 77 } 78 79 public function myAcc(){ 80 $this->showMyAcc(); // získání dat o užvatelově účtu 81 return $this->sql_select; 82 } 83 84 /* ================================================== 85 * searchQuests() 86 * 87 * Tato funkce vyhledává 88 * v databázi questy 89 * 90 ================================================== */ 91 92 function searchQuests(){ 93 94 if( !empty($this->q) AND $this->id == "questy" ){ 95 96 if( !empty($this->lvl_d) AND !empty($this->lvl_h) ){ 97 $where = "(`MinLevel`>='".$this->lvl_d."' AND `MinLevel`<='".$this->lvl_h."') AND "; 98 }; 99 100 $this->sql_select = SQLselect_Strankovani("SELECT * FROM `quest_template` WHERE ( $where`Title` LIKE '%$q%' ) ORDER BY `entry` ASC", $this->limit, $this->nastranu, "?id=questy&q=".$this->q."&lvl_d=".$this->lvl_d."&lvl_h=".$this->lvl_h, $this->sid); 101 if( @mysql_num_rows($this->sql_select[1]) > 0 ){ 102 $this->sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" cellspacing=\"0\" cellpadding=\"0\">\n"; 103 $this->sql_select['result'] .= "<thead><tr><td>Název úkolu</td><td>Min level</td><td>Úkol zadává</td><td>Úkol</td></tr></thead>\n<col width=\"180px\"><col width=\"70px\">"; 104 105 while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){ 106 $this->sql_select['result'] .= " <tr valign='top'>"; 107 $this->sql_select['result'] .= "<td><a href=\"index.php?quest=".$result['entry']."\">".$result['Title']."</a></td>"; 108 $this->sql_select['result'] .= "<td>".$result['MinLevel']."</td>"; 109 $this->sql_select['result'] .= "<td>"; 110 111 $startovni_creature_dotaz = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$result['entry']." "); 112 while( $start_creature = @MySQL_Fetch_Array($startovni_creature_dotaz) ){ 113 $this->sql_select['result'] .= "<a href=\"index.php?creature=".$start_creature['entry']."\">".$start_creature['name']."</a><br>"; 114 }; 115 $startovni_gameobject_dotaz = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$result['entry']." "); 116 while( $start_gameobject = @MySQL_Fetch_Array($startovni_gameobject_dotaz) ){ 117 $this->sql_select['result'] .= "<a href=\"index.php?gameobject=".$start_gameobject['entry']."\">".$start_gameobject['name']."</a><br>"; 118 }; 119 120 $this->sql_select['result'] .= "</td>"; 121 $this->sql_select['result'] .= "<td>".$result['Objectives']."</td>"; 122 $this->sql_select['result'] .= "</tr>\n"; 123 }; 124 125 $this->sql_select['result'] .= "</table>\n"; 126 } 127 else{ 128 $this->sql_select['error'] = "<p>Nebyly nalezeny žádné questy.</p>"; 129 }; 130 return true; 131 }; 132 133 return false; 134 } 135 136 /* ================================================== 137 * searchCreeps() 138 * 139 * Tato funkce vyhledává 140 * v databázi creepy 141 * 142 ================================================== */ 143 144 function searchCreeps(){ 145 146 if( !empty($this->q) AND $this->id == "creeps" ){ 147 148 $this->sql_select = SQLselect_Strankovani("SELECT * FROM `creature_template` WHERE ( `name` LIKE '%".$this->q."%' OR `subname` LIKE '%".$this->q."%' ) ORDER BY `entry` ASC", $this->limit, $this->nastranu, "?id=creeps&q=".$this->q, $this->sid); 149 if( @mysql_num_rows($this->sql_select[1]) > 0 ){ 150 $this->sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" cellspacing=\"0\" cellpadding=\"0\">\n"; 151 $this->sql_select['result'] .= "<thead><tr><td>Název creepa</td><td>Level</td></tr></thead>\n<col><col width=\"70px\">"; 152 153 while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){ 154 $this->sql_select['result'] .= " <tr valign='top'>"; 155 $this->sql_select['result'] .= "<td><a href=\"index.php?creature=".$result['entry']."\">".$result['name']."</a></td>"; 156 if( $result['rank'] != 3 ){ 157 $this->sql_select['result'] .= "<td align='center'>".$result['minlevel']." - ".$result['maxlevel']."</td>"; 158 } 159 else{ 160 $this->sql_select['result'] .= "<td align='center'>Boss</td>"; 161 }; 162 $this->sql_select['result'] .= "</tr>\n"; 163 }; 164 165 $this->sql_select['result'] .= "</table>\n"; 166 } else{ $this->sql_select['error'] = "<p>Nebyly nalezeny žádní creepové.</p>"; }; 167 return true; 168 }; 169 170 return false; 171 } 172 173 /* ================================================== 174 * showQuest() 175 * 176 * Tato funkce vrací konkrétní Quest 177 * + provádí pár dalších operací s jeho daty 178 * 179 ================================================== */ 180 181 function showQuest(){ 182 183 if( is_numeric($this->quest) AND empty($this->id) ){ 184 185 $sql_select['sql'] = mysql_query("SELECT * FROM quest_template WHERE `entry`='".$this->quest."' LIMIT 1"); 186 if( @mysql_num_rows($sql_select['sql']) > 0 ){ 187 $this->sql_select['quest'] = MySQL_Fetch_Array($sql_select['sql']); 188 189 // Zjištění creatur a gameobjectů kde se Quest dá vzít 190 $startovni_NPC_dotaz_creature = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$this->sql_select['quest']['entry']." "); 191 if( @mysql_num_rows($startovni_NPC_dotaz_creature) > 0 ){ 192 while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_creature)){ 193 $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?creature=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n"; 194 }; }; 195 $startovni_NPC_dotaz_gameobject = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$this->sql_select['quest']['entry']." "); 196 if( @mysql_num_rows($startovni_NPC_dotaz_gameobject) > 0 ){ 197 while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_gameobject)){ 198 $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?gameobject=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n"; 199 }; }; 200 $startovni_dotaz_item = mysql_query("SELECT * FROM item_template WHERE startquest='".$this->sql_select['quest']['entry']."' "); 201 if( @mysql_num_rows($startovni_dotaz_item) > 0 ){ 202 while($start_NPC = @MySQL_Fetch_Array($startovni_dotaz_item)){ 203 switch($start_NPC['Quality']){ 204 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 205 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 206 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 207 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 208 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 209 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 210 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 211 }; 212 $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?item=".$start_NPC['entry']."\"".$sql_select['other']['item_color'].">".$start_NPC['name']."</a><br>\n"; 213 }; }; 214 if( empty($this->sql_select['other']['StartNPC']) ){ 215 $this->sql_select['other']['EndNPC'] = "<b>Úkol není kde začít!</b>"; }; 216 217 $ukoncovaci_NPC_dotaz_creature = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_involvedrelation ON creature_involvedrelation.id = creature_template.entry WHERE creature_involvedrelation.quest =".$this->sql_select['quest']['entry']." "); 218 if( @mysql_num_rows($ukoncovaci_NPC_dotaz_creature) > 0 ){ 219 while($end_NPC = @MySQL_Fetch_Array($ukoncovaci_NPC_dotaz_creature)){ 220 $this->sql_select['other']['EndNPC'] .= "<a href=\"index.php?creature=".$end_NPC['entry']."\">".$end_NPC['name']."</a><br>\n"; 221 }; }; 222 $ukoncovaci_NPC_dotaz_gameobject = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_involvedrelation ON gameobject_involvedrelation.id = gameobject_template.entry WHERE gameobject_involvedrelation.quest =".$this->sql_select['quest']['entry']." "); 223 if( @mysql_num_rows($ukoncovaci_NPC_dotaz_gameobject) > 0 ){ 224 while($end_NPC = @MySQL_Fetch_Array($ukoncovaci_NPC_dotaz_gameobject)){ 225 $this->sql_select['other']['EndNPC'] .= "<a href=\"index.php?gameobject=".$end_NPC['entry']."\">".$end_NPC['name']."</a><br>\n"; 226 }; }; 227 if( empty($this->sql_select['other']['EndNPC']) ){ 228 $this->sql_select['other']['EndNPC'] = "<b>Úkol není kde skončit!</b>"; }; 229 230 // Zjištění Oblasti 231 if( AbsCheck($this->sql_select['quest']['ZoneOrSort']) ){ } 232 else{ }; 233 234 // Důležitá věc 235 $SrcItemId_dotaz = mysql_query("SELECT * FROM item_template WHERE entry =".$this->sql_select['quest']['SrcItemId']." LIMIT 1;"); 236 if( @mysql_num_rows($SrcItemId_dotaz) > 0 ){ 237 $SrcItemId = @MySQL_Fetch_Array($SrcItemId_dotaz); 238 $this->sql_select['other']['SrcItemId'] .= "<a href=\"index.php?item=".$SrcItemId['entry']."\">".$SrcItemId['name']."</a><br>\n"; 239 }; 240 241 $this->sql_select['quest']['PrevQuestId']; 242 $this->sql_select['quest']['NextQuestId']; 243 244 $this->sql_select['other']['ReqItems']; // ReqItemId1-4.ReqItemCount1-4 245 246 $this->sql_select['other']['ReqSource']; // ?? 247 /* ReqSourceId1-4 248 These fields are used in core quest-drop logic. They allow players to get quest drops which are not quest delivery items (ReqItem stand for this), but needed to create quest delivery by player or needed to cast ReqSpellCasts. ReqSourceId1 is the item_template id of a source item for creation of ReqItemX or casting of ReqSpellCastX. X is the value of ReqSourceRef1. Only items which have a quest drop chance (having QuestChance > 0 in *_loot_template) should be used as sources here. 249 The same for ReqSourceId2-4 250 You may define 1, 2, 3 or even all 4 sources for the same ReqItem/ReqSpellCast or use 4 sources for 4 ReqItems/ReqSpellCasts. 251 ReqSourceCount1-4 252 Amount of ReqSourceId items the player may gather per unfinished ReqItemId or ReqSpellCast. 253 So ReqSourceId1 items will drop up to a total amount of (ReqItemCount(ReqSourceRef1) - already owned ReqItemId(ReqSourceRef1)) * ReqSourceCount1. Same for ReqSpellCast objectives. 254 ReqSourceRef1-4 255 Should be 0 or 1..4. See ReqSourceId description. */ 256 257 $this->sql_select['other']['ReqCreatureOrGOId']; // need to kill/cast 258 /* Value > 0: 1.-4. required creature_template ID the player needs to kill/cast on in order to complete the quest. 259 Value < 0: 1.-4. required gameobject_template ID the player needs to cast on in order to complete the quest. 260 If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */ 261 262 $this->sql_select['other']['ReqSpellCast']; 263 /* Spell ID of Spell that needs to be cast in order to fulfill a quest objective. 264 If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */ 265 266 $this->sql_select['other']['ReqSpellCast']; 267 /* Spell ID of Spell that needs to be cast in order to fulfill a quest objective. 268 If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */ 269 270 $this->sql_select['other']['RewChoiceItemId']; // !!! RewChoiceItemCount 271 /* Id of the 1.-6. Item available for reward choice. */ 272 273 $this->sql_select['other']['RewItemId']; // !!! RewItemCount 274 /* 1.-4. item Id given for reward (no choice). */ 275 11 276 12 while( $result = MySQL_Fetch_Array($sql_select[1]) ){ 13 $sql_select['result'] .= " <tr valign='top'>"; 14 $sql_select['result'] .= "<td><a href=\"index.php?quest=".$result['entry']."\">".$result['Title']."</a></td>"; 15 $sql_select['result'] .= "<td>".$result['MinLevel']."</td>"; 16 $sql_select['result'] .= "<td>"; 277 } 278 else{ 279 $this->sql_select['error'] = "<p>Quest nebyl nalezen.</p>"; 280 }; 281 return true; 282 }; 283 284 return false; 285 } 286 287 /* ================================================== 288 * showCreature() 289 * 290 * Tato funkce vrací konkrétního Creepa 291 * + provádí pár dalších operací s jeho daty 292 * 293 ================================================== */ 294 295 function showCreature(){ 296 297 if( is_numeric($this->creature) AND empty($this->id) ){ 298 $this->sql_select['sql'] = mysql_query("SELECT * FROM creature_template WHERE `entry`='".$this->creature."' LIMIT 1"); 299 if( @mysql_num_rows($this->sql_select['sql']) > 0 ){ 300 $this->sql_select['creature'] = MySQL_Fetch_Array($this->sql_select['sql']); 17 301 18 $startovni_creature_dotaz = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$result['entry']." "); 19 while( $start_creature = @MySQL_Fetch_Array($startovni_creature_dotaz) ){ 20 $sql_select['result'] .= "<a href=\"index.php?creature=".$start_creature['entry']."\">".$start_creature['name']."</a><br>"; 302 switch($sql_select['creature']['rank']){ 303 case 0: $sql_select['other']['creature_type'] = "Normal"; break; 304 case 1: $sql_select['other']['creature_type'] = "Elite"; break; 305 case 2: $sql_select['other']['creature_type'] = "Rare Elite"; break; 306 case 3: $sql_select['other']['creature_type'] = "World Boss"; break; 307 case 4: $sql_select['other']['creature_type'] = "Rare"; break; 21 308 }; 22 $startovni_gameobject_dotaz = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$result['entry']." "); 23 while( $start_gameobject = @MySQL_Fetch_Array($startovni_gameobject_dotaz) ){ 24 $sql_select['result'] .= "<a href=\"index.php?gameobject=".$start_gameobject['entry']."\">".$start_gameobject['name']."</a><br>"; 309 310 $questy_dotaz_creature = mysql_query("SELECT * FROM `creature_questrelation` LEFT JOIN `quest_template` ON `creature_questrelation`.`quest` = `quest_template`.`entry` WHERE (`creature_questrelation`.`id` =".$this->sql_select['creature']['entry']." AND `quest_template`.`PrevQuestId`=0 ) "); 311 if( @mysql_num_rows($questy_dotaz_creature) > 0 ){ 312 while($quest_NPC = @MySQL_Fetch_Array($questy_dotaz_creature)){ 313 $this->sql_select['other']['creature_quests'] .= "<a href=\"index.php?quest=".$quest_NPC['entry']."\">".$quest_NPC['Title']."</a><br>\n"; 314 }; }; 315 316 $drop_creature = mysql_query("SELECT * FROM `creature_loot_template` LEFT JOIN `item_template` ON `creature_loot_template`.`item` = `item_template`.`entry` WHERE `creature_loot_template`.`entry`='".$this->sql_select['creature']['lootid']."' ORDER BY `Quality` DESC, `ChanceOrRef` DESC "); 317 if( @mysql_num_rows($drop_creature) > 0 ){ 318 while($drop_NPC = @MySQL_Fetch_Array($drop_creature)){ 319 switch($drop_NPC['Quality']){ 320 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 321 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 322 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 323 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 324 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 325 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 326 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 327 }; 328 $this->sql_select['other']['creature_drop'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry']."\" ".$sql_select['other']['item_color'].">".$drop_NPC['name']."</a></td>"; 329 $this->sql_select['other']['creature_drop'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n"; 330 }; } else{ $this->sql_select['other']['creature_drop'] = "<tr><td colspan='2'>Tento creep nemá žádný drop !</td></tr>"; }; 331 332 $pickpocket_creature = mysql_query("SELECT * FROM `pickpocketing_loot_template` LEFT JOIN `item_template` ON `pickpocketing_loot_template`.`item` = `item_template`.`entry` WHERE `pickpocketing_loot_template`.`entry`='".$this->sql_select['creature']['pickpocketloot']."' ORDER BY `Quality` DESC, `ChanceOrRef` DESC "); 333 if( @mysql_num_rows($pickpocket_creature) > 0 ){ 334 while($drop_NPC = @MySQL_Fetch_Array($pickpocket_creature)){ 335 switch($drop_NPC['Quality']){ 336 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 337 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 338 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 339 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 340 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 341 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 342 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 343 }; 344 $this->sql_select['other']['creature_pickpocket'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry']."\" ".$sql_select['other']['item_color'].">".$drop_NPC['name']."</a></td>"; 345 $this->sql_select['other']['creature_pickpocket'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n"; 346 }; } else{ $this->sql_select['other']['creature_pickpocket'] = "<tr><td colspan='2'>Tento creep nemá žádný Pickpocket !</td></tr>"; }; 347 348 $skin_creature = mysql_query("SELECT * FROM `skinning_loot_template` LEFT JOIN `item_template` ON `skinning_loot_template`.`item` = `item_template`.`entry` WHERE `skinning_loot_template`.`entry`='".$sql_select['creature']['skinloot']."' ORDER BY `Quality` DESC, `ChanceOrRef` DESC "); 349 if( @mysql_num_rows($skin_creature) > 0 ){ 350 while($drop_NPC = @MySQL_Fetch_Array($skin_creature)){ 351 switch($drop_NPC['Quality']){ 352 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 353 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 354 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 355 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 356 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 357 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 358 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 359 }; 360 $this->sql_select['other']['creature_skin'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry']."\" ".$sql_select['other']['item_color'].">".$drop_NPC['name']."</a></td>"; 361 $this->sql_select['other']['creature_skin'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n"; 362 }; } else{ $this->sql_select['other']['creature_skin'] = "<tr><td colspan='2'>Tento creep nemá žádný Skin !</td></tr>"; }; 363 364 } 365 else{ 366 $this->sql_select['error'] = "<p>Creep nebyl nalezen.</p>"; 25 367 }; 26 27 $sql_select['result'] .= "</td>"; 28 $sql_select['result'] .= "<td>".$result['Objectives']."</td>"; 29 $sql_select['result'] .= "</tr>\n"; 30 }; 31 32 $sql_select['result'] .= "</table>\n"; 33 } else{ $sql_select['error'] = "<p>Nebyly nalezeny žádné questy.</p>"; }; 34 35 } 36 elseif( $id == "creeps" ){ 37 $sql_select = SQLselect_Strankovani("SELECT * FROM `creature_template` WHERE ( `name` LIKE '%$q%' OR `subname` LIKE '%$q%' ) ORDER BY `entry` ASC", $limit, 20, "?id=creeps&q=".$q, $SID); 38 if( @mysql_num_rows($sql_select[1]) > 0 ){ $i = 0; 39 $sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; 40 $sql_select['result'] .= "<thead><tr><td>Název creepa</td><td>Level</td></tr></thead>\n<col><col width=\"70px\">"; 41 42 while( $result = MySQL_Fetch_Array($sql_select[1]) ){ 43 $sql_select['result'] .= " <tr valign='top'>"; 44 $sql_select['result'] .= "<td><a href=\"index.php?creature=".$result['entry']."\">".$result['name']."</a></td>"; 45 if( $result['rank'] != 3 ){ 46 $sql_select['result'] .= "<td align='center'>".$result['minlevel']." - ".$result['maxlevel']."</td>"; 47 } 48 else{ 49 $sql_select['result'] .= "<td align='center'>Boss</td>"; 50 }; 51 $sql_select['result'] .= "</tr>\n"; 52 }; 53 54 $sql_select['result'] .= "</table>\n"; 55 } else{ $sql_select['error'] = "<p>Nebyly nalezeny žádní creepové.</p>"; }; 56 57 }; 58 } 59 elseif( !empty($quest) AND empty($id) ){ 60 $sql_select['sql'] = mysql_query("SELECT * FROM quest_template WHERE `entry`='$quest' LIMIT 1;"); 61 if( @mysql_num_rows($sql_select['sql']) > 0 ){ $i = 0; 62 $result = MySQL_Fetch_Array($sql_select['sql']); 63 $sql_select['quest'] = $result; 64 65 // Zjištění creatur a gameobjectů kde se Quest dá vzít 66 $startovni_NPC_dotaz_creature = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$sql_select['quest']['entry']." "); 67 if( @mysql_num_rows($startovni_NPC_dotaz_creature) > 0 ){ 68 while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_creature)){ 69 $sql_select['other']['StartNPC'] .= "<a href=\"index.php?creature=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n"; 70 }; }; 71 $startovni_NPC_dotaz_gameobject = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$sql_select['quest']['entry']." "); 72 if( @mysql_num_rows($startovni_NPC_dotaz_gameobject) > 0 ){ 73 while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_gameobject)){ 74 $sql_select['other']['StartNPC'] .= "<a href=\"index.php?gameobject=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n"; 75 }; }; 76 if( empty($sql_select['other']['StartNPC']) ){ 77 $sql_select['other']['StartNPC'] = "<b>Úkol není kde začít!</b>"; } 78 79 // Zjištění Oblasti 80 if( AbsCheck($sql_select['quest']['ZoneOrSort']) ){ } 81 else{ }; 82 83 // Důležitá věc 84 $SrcItemId_dotaz = mysql_query("SELECT * FROM item_template WHERE entry =".$sql_select['quest']['SrcItemId']." LIMIT 1;"); 85 if( @mysql_num_rows($SrcItemId_dotaz) > 0 ){ 86 $SrcItemId = @MySQL_Fetch_Array($SrcItemId_dotaz); 87 $sql_select['other']['SrcItemId'] .= "<a href=\"index.php?item=".$SrcItemId['entry']."\">".$SrcItemId['name']."</a><br>\n"; 88 }; 89 90 $sql_select['quest']['PrevQuestId']; 91 $sql_select['quest']['NextQuestId']; 92 93 $sql_select['other']['ReqItems']; // ReqItemId1-4.ReqItemCount1-4 94 95 $sql_select['other']['ReqSource']; // ?? 96 /* ReqSourceId1-4 97 These fields are used in core quest-drop logic. They allow players to get quest drops which are not quest delivery items (ReqItem stand for this), but needed to create quest delivery by player or needed to cast ReqSpellCasts. ReqSourceId1 is the item_template id of a source item for creation of ReqItemX or casting of ReqSpellCastX. X is the value of ReqSourceRef1. Only items which have a quest drop chance (having QuestChance > 0 in *_loot_template) should be used as sources here. 98 The same for ReqSourceId2-4 99 You may define 1, 2, 3 or even all 4 sources for the same ReqItem/ReqSpellCast or use 4 sources for 4 ReqItems/ReqSpellCasts. 100 ReqSourceCount1-4 101 Amount of ReqSourceId items the player may gather per unfinished ReqItemId or ReqSpellCast. 102 So ReqSourceId1 items will drop up to a total amount of (ReqItemCount(ReqSourceRef1) - already owned ReqItemId(ReqSourceRef1)) * ReqSourceCount1. Same for ReqSpellCast objectives. 103 ReqSourceRef1-4 104 Should be 0 or 1..4. See ReqSourceId description. */ 105 106 $sql_select['other']['ReqCreatureOrGOId']; // need to kill/cast 107 /* Value > 0: 1.-4. required creature_template ID the player needs to kill/cast on in order to complete the quest. 108 Value < 0: 1.-4. required gameobject_template ID the player needs to cast on in order to complete the quest. 109 If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */ 110 111 $sql_select['other']['ReqSpellCast']; 112 /* Spell ID of Spell that needs to be cast in order to fulfill a quest objective. 113 If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */ 114 115 $sql_select['other']['ReqSpellCast']; 116 /* Spell ID of Spell that needs to be cast in order to fulfill a quest objective. 117 If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */ 118 119 $sql_select['other']['RewChoiceItemId']; // !!! RewChoiceItemCount 120 /* Id of the 1.-6. Item available for reward choice. */ 121 122 $sql_select['other']['RewItemId']; // !!! RewItemCount 123 /* 1.-4. item Id given for reward (no choice). */ 124 125 126 } else{ $sql_select['error'] = "<p>Quest nebyl nalezen.</p>"; }; 127 128 } 129 elseif( !empty($creature) AND empty($id) ){ 130 $sql_select['sql'] = mysql_query("SELECT * FROM creature_template WHERE `entry`='$creature' LIMIT 1;"); 131 if( @mysql_num_rows($sql_select['sql']) > 0 ){ $i = 0; 132 $result = MySQL_Fetch_Array($sql_select['sql']); 133 $sql_select['creature'] = $result; 134 135 switch($sql_select['creature']['rank']){ 136 case 0: $sql_select['other']['creature_type'] = "Normal"; break; 137 case 1: $sql_select['other']['creature_type'] = "Elite"; break; 138 case 2: $sql_select['other']['creature_type'] = "Rare Elite"; break; 139 case 3: $sql_select['other']['creature_type'] = "World Boss"; break; 140 case 4: $sql_select['other']['creature_type'] = "Rare"; break; 141 }; 142 143 $questy_dotaz_creature = mysql_query("SELECT * FROM `creature_questrelation` LEFT JOIN `quest_template` ON `creature_questrelation`.`quest` = `quest_template`.`entry` WHERE (`creature_questrelation`.`id` =".$sql_select['creature']['entry']." AND `quest_template`.`PrevQuestId`=0 ) "); 144 if( @mysql_num_rows($questy_dotaz_creature) > 0 ){ 145 while($quest_NPC = @MySQL_Fetch_Array($questy_dotaz_creature)){ 146 $sql_select['other']['creature_quests'] .= "<a href=\"index.php?quest=".$quest_NPC['entry']."\">".$quest_NPC['Title']."</a><br>\n"; 147 }; }; 148 149 $drop_creature = mysql_query("SELECT * FROM `creature_loot_template` LEFT JOIN `item_template` ON `creature_loot_template`.`item` = `item_template`.`entry` WHERE `creature_loot_template`.`entry`='".$sql_select['creature']['lootid']."' ORDER BY `Quality` DESC, `ChanceOrRef` DESC "); 150 if( @mysql_num_rows($drop_creature) > 0 ){ 151 while($drop_NPC = @MySQL_Fetch_Array($drop_creature)){ 152 switch($drop_NPC['Quality']){ 153 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 154 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 155 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 156 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 157 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 158 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 159 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 160 }; 161 $sql_select['other']['creature_drop'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry']."\" ".$sql_select['other']['item_color'].">".$drop_NPC['name']."</a></td>"; 162 $sql_select['other']['creature_drop'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n"; 163 }; } else{ $sql_select['other']['creature_drop'] = "<tr><td colspan='2'>Tento creep nemá žádný drop !</td></tr>"; }; 164 165 $pickpocket_creature = mysql_query("SELECT * FROM `pickpocketing_loot_template` LEFT JOIN `item_template` ON `pickpocketing_loot_template`.`item` = `item_template`.`entry` WHERE `pickpocketing_loot_template`.`entry`='".$sql_select['creature']['pickpocketloot']."' ORDER BY `Quality` DESC, `ChanceOrRef` DESC "); 166 if( @mysql_num_rows($pickpocket_creature) > 0 ){ 167 while($drop_NPC = @MySQL_Fetch_Array($pickpocket_creature)){ 168 switch($drop_NPC['Quality']){ 169 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 170 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 171 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 172 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 173 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 174 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 175 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 176 }; 177 $sql_select['other']['creature_pickpocket'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry']."\" ".$sql_select['other']['item_color'].">".$drop_NPC['name']."</a></td>"; 178 $sql_select['other']['creature_pickpocket'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n"; 179 }; } else{ $sql_select['other']['creature_pickpocket'] = "<tr><td colspan='2'>Tento creep nemá žádný Pickpocket !</td></tr>"; }; 180 181 $skin_creature = mysql_query("SELECT * FROM `skinning_loot_template` LEFT JOIN `item_template` ON `skinning_loot_template`.`item` = `item_template`.`entry` WHERE `skinning_loot_template`.`entry`='".$sql_select['creature']['skinloot']."' ORDER BY `Quality` DESC, `ChanceOrRef` DESC "); 182 if( @mysql_num_rows($skin_creature) > 0 ){ 183 while($drop_NPC = @MySQL_Fetch_Array($skin_creature)){ 184 switch($drop_NPC['Quality']){ 185 case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break; 186 case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break; 187 case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break; 188 case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break; 189 case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break; 190 case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break; 191 case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break; 192 }; 193 $sql_select['other']['creature_skin'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry']."\" ".$sql_select['other']['item_color'].">".$drop_NPC['name']."</a></td>"; 194 $sql_select['other']['creature_skin'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n"; 195 }; } else{ $sql_select['other']['creature_skin'] = "<tr><td colspan='2'>Tento creep nemá žádný Skin !</td></tr>"; }; 196 197 } else{ $sql_select['error'] = "<p>Creep nebyl nalezen.</p>"; }; 198 199 } 200 elseif( $id == "bugreport" AND empty($bug) ){ 201 mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 202 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 203 @mysql_query("SET CHARACTER SET utf8"); 204 205 $sql_select = SQLselect_Strankovani("SELECT * FROM `bug_report` ORDER BY `opraveno` ASC, `vlozeno` DESC", $limit, 20, "?id=bugreport", $SID); 206 if( @mysql_num_rows($sql_select[1]) > 0 ){ $i = 0; 207 $sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; 208 $sql_select['result'] .= "<thead><tr><td>Vloženo</td><td>Chyba</td><td align='right'>Status</td></tr></thead>\n<col width=\"120px\"><col><col width=\"60px\">"; 209 210 while( $result = MySQL_Fetch_Array($sql_select[1]) ){ 211 $sql_select['result'] .= "<tr><td valign='top'>"; 212 $sql_select['result'] .= "<a href=\"./index.php?id=bugreport&bug=".$result['id']."\">".@date("d.m.Y H:i", $result['vlozeno'])."</a>"; 213 $sql_select['result'] .= "</td><td valign='top'>"; 214 $sql_select['result'] .= nl2br(preg_replace(array("(\<)","(\>)"), array("<",">"), $result['popis'])); 215 $sql_select['result'] .= "</td><td valign='top' align='right'>"; 216 if( $result['opraveno'] == 0 ){ 217 $sql_select['result'] .= "<img src=\"img/aff_cross.gif\" alt=\"ne\" height=\"16\" width=\"16\">"; } 218 elseif( $result['opraveno'] == 1 ){ 219 $sql_select['result'] .= "<img src=\"img/aff_tick.gif\" alt=\"ne\" height=\"16\" width=\"16\">"; } 220 $sql_select['result'] .= "</td></tr>\n"; 221 }; 222 223 $sql_select['result'] .= "</table>\n"; 224 225 } else{ $sql_select['error'] .= "<p>V databázi nejsou záznamy o chybách.</p>"; }; 226 227 } 228 elseif( $id == "bugreport" AND !empty($bug) ){ 229 mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 230 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 231 @mysql_query("SET CHARACTER SET utf8"); 232 233 $sql_select['sql'] = mysql_query("SELECT * FROM `bug_report` WHERE id=$bug LIMIT 1"); 234 if( @mysql_num_rows($sql_select['sql']) > 0 ){ 235 $result = MySQL_Fetch_Array($sql_select['sql']); 236 $sql_select['bug'] = $result; 237 if( empty($sql_select['bug']['opravil_nick']) ){ 238 $sql_select['bug']['opravil_nick'] = "Zatím nikdo"; }; 239 if( $sql_select['bug']['opraveno'] == 0 ){ 240 $sql_select['bug']['opraveno'] = "<img src=\"img/aff_cross.gif\" alt=\"ne\" height=\"16\" width=\"16\"> Čeká na vyřízení"; } 241 elseif( $sql_select['bug']['opraveno'] == 1 ){ 242 $sql_select['bug']['opraveno'] = "<img src=\"img/aff_tick.gif\" alt=\"ne\" height=\"16\" width=\"16\"> Opraveno"; } 243 } else{ $sql_select['error'] = "<p>V databázi není záznam s touto chybou.</p>"; }; 244 245 } 246 elseif( $id == "sendbug" AND isset($_POST['send']) ){ 247 mysql_select_db($Config['DB_read']['DB_read']['Database_web']) 248 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_web']."!</p>"); 249 @mysql_query("SET CHARACTER SET utf8"); 250 251 $sql_insert['sql'] = "INSERT INTO `bug_report` (`nick`,`typ`,`vlozeno`,`popis`) VALUES('".$_POST['game_nick']."','".$_POST['err_type']."','".time()."','".$_POST['popis']."')"; 252 if( mysql_query($sql_insert['sql']) ){ 253 $sql_insert['result'] = "<p>Bug byl uložen do databáze.</p>"; 254 } 255 else{ $sql_insert['result'] = "<p>Bug se nepodařilo uložit do databáze.<br>Zkuste to později znovu prosím.</p>"; }; 256 257 } 258 elseif( $id == "myacc" ){ 259 mysql_select_db($Config['DB_read']['DB_read']['Database_realmd']) 260 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_realmd']."!</p>"); 261 @mysql_query("SET CHARACTER SET utf8"); 262 263 $sql_select['sql'] = mysql_query("SELECT * FROM `account` WHERE `username`='".$user['nick']."' LIMIT 1"); 264 $sql_select['result']['acc'] = @mysql_fetch_array($sql_select['sql']); 265 266 mysql_select_db($Config['DB_read']['DB_read']['Database_mangos']) 267 OR DIE("<p>Nepodařilo se nastavit pracovní databázi ".$Config['DB_read']['DB_read']['Database_mangos']."!</p>"); 268 @mysql_query("SET CHARACTER SET utf8"); 269 270 $sql_select['sql'] = mysql_query("SELECT * FROM `character` WHERE `account`='".$sql_select['result']['acc']['id']."' "); 271 $sql_select['result']['char_count'] = @mysql_num_rows($sql_select['sql']); 272 for($i=0;$sql_select['result']['char'][$i] = @mysql_fetch_array($sql_select['sql']) ;$i++){ 273 $sql_select['result']['char'][$i]['data'] = explode(" ", $sql_select['result']['char'][$i]['data']); 274 }; 275 276 switch($sql_select['result']['acc']['gmlevel']){ 277 case 0: $sql_select['result']['other']['opravneni'] = "Player"; break; 278 case 1: $sql_select['result']['other']['opravneni'] = "Moderator"; break; 279 case 2: $sql_select['result']['other']['opravneni'] = "GameMaster"; break; 280 case 3: $sql_select['result']['other']['opravneni'] = "Administrator"; break; 281 default: $sql_select['result']['other']['opravneni'] = "unknown"; 282 }; 283 284 switch($sql_select['result']['acc']['tbc']){ 285 case 0: $sql_select['result']['other']['version'] = "Normal"; break; 286 case 1: $sql_select['result']['other']['version'] = "Burning Crusade"; break; 287 }; 288 289 $sql_select['result']['other']['chars'] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n"; 290 for($i=0; $i < $sql_select['result']['char_count'] ;$i++){ 291 $sql_select['result']['other']['chars'] .= "<tr><td>".$sql_select['result']['char'][$i]['name']."</td>"; 292 $sql_select['result']['other']['chars'] .= "<td title=\"Level\">".$sql_select['result']['char'][$i]['data'][34]."</td>"; 293 $sql_select['result']['other']['chars'] .= "<td title=\"Rasa\">".$Database['race'][$sql_select['result']['char'][$i]['race']]."</td>"; 294 $sql_select['result']['other']['chars'] .= "<td title=\"Povolání\">".$Database['class'][$sql_select['result']['char'][$i]['class']]."</td>\n"; 295 $sql_select['result']['other']['chars'] .= "<td> - <a href=\"./character.php?char=".$sql_select['result']['char'][$i]['guid']."\">Exportovat</a></td></tr>\n"; 296 }; $sql_select['result']['other']['chars'] .= "</table>"; 297 298 299 }; 300 301 302 368 return true; 369 }; 370 371 return false; 372 } 373 374 /* ================================================== 375 * showBugs() 376 * showBug() 377 * sendBug() 378 * 379 * Tyto funkce jsou určeny pro práci s Bugreporterem 380 * showBugs() - vypisuje všechny bugy 381 * showBug() - vrátí konkrétní bug 382 * sendBug() - odesílá nový bug do databáze 383 * 384 ================================================== */ 385 386 function showBugs(){ 387 388 if( $this->id == "bugreport" AND empty($this->bug) ){ 389 SwitchDB(3); // nastavení databáze na web 390 391 $this->sql_select = SQLselect_Strankovani("SELECT * FROM `bug_report` ORDER BY `opraveno` ASC, `vlozeno` DESC", $this->limit, $this->nastranu, "?id=bugreport", $this->sid); 392 if( @mysql_num_rows($this->sql_select[1]) > 0 ){ 393 $this->sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; 394 $this->sql_select['result'] .= "<thead><tr><td>Vloženo</td><td>Chyba</td><td align='right'>Status</td></tr></thead>\n<col width=\"120px\"><col><col width=\"60px\">\n"; 395 396 while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){ 397 $this->sql_select['result'] .= "<tr><td valign='top'>"; 398 $this->sql_select['result'] .= "<a href=\"./index.php?id=bugreport&bug=".$result['id']."\">".@date("d.m.Y H:i", $result['vlozeno'])."</a>"; 399 $this->sql_select['result'] .= "</td><td valign='top'>"; 400 $this->sql_select['result'] .= nl2br(preg_replace(array("(\<)","(\>)"), array("<",">"), $result['popis'])); 401 $this->sql_select['result'] .= "</td><td valign='top' align='right'>"; 402 if( $result['opraveno'] == 0 ){ 403 $this->sql_select['result'] .= "<img src=\"img/aff_cross.gif\" alt=\"ne\" height=\"16\" width=\"16\">"; } 404 elseif( $result['opraveno'] == 1 ){ 405 $this->sql_select['result'] .= "<img src=\"img/aff_tick.gif\" alt=\"ne\" height=\"16\" width=\"16\">"; } 406 $this->sql_select['result'] .= "</td></tr>\n"; 407 }; 408 409 $this->sql_select['result'] .= "</table>\n"; 410 411 } 412 else{ 413 $this->sql_select['error'] .= "<p>V databázi nejsou záznamy o chybách.</p>"; 414 }; 415 return true; 416 }; 417 418 return false; 419 } 420 421 function showBug(){ 422 423 if( $this->id == "bugreport" AND !empty($this->bug) ){ 424 SwitchDB(3); // nastavení databáze na web 425 426 $this->sql_select['sql'] = mysql_query("SELECT * FROM `bug_report` WHERE id=".$this->bug." LIMIT 1"); 427 if( @mysql_num_rows($this->sql_select['sql']) > 0 ){ 428 $this->sql_select['bug'] = MySQL_Fetch_Array($this->sql_select['sql']); 429 if( empty($this->sql_select['bug']['opravil_nick']) ){ 430 $this->sql_select['bug']['opravil_nick'] = "Zatím nikdo"; }; 431 if( $this->sql_select['bug']['opraveno'] == 0 ){ 432 $this->sql_select['bug']['opraveno'] = "<img src=\"img/aff_cross.gif\" alt=\"ne\" height=\"16\" width=\"16\"> Čeká na vyřízení"; } 433 elseif( $this->sql_select['bug']['opraveno'] == 1 ){ 434 $this->sql_select['bug']['opraveno'] = "<img src=\"img/aff_tick.gif\" alt=\"ne\" height=\"16\" width=\"16\"> Opraveno"; } 435 } 436 else{ 437 $this->sql_select['error'] = "<p>V databázi není záznam s touto chybou.</p>"; 438 }; 439 return true; 440 }; 441 442 return false; 443 } 444 445 function sendBug(){ 446 global $_POST; 447 448 if( $this->id == "sendbug" AND isset($_POST['send']) ){ 449 SwitchDB(3); // nastavení databáze na web 450 451 $sql_insert['sql'] = "INSERT INTO `bug_report` (`nick`,`typ`,`vlozeno`,`popis`) VALUES('".$_POST['game_nick']."','".$_POST['err_type']."','".time()."','".$_POST['popis']."')"; 452 if( mysql_query($sql_insert['sql']) ){ 453 $this->sql_select['result'] = "<p>Bug byl uložen do databáze.</p>"; 454 } 455 else{ 456 $this->sql_select['result'] = "<p>Bug se nepodařilo uložit do databáze.<br>Zkuste to později znovu prosím.</p>"; 457 }; 458 return true; 459 }; 460 461 return false; 462 } 463 464 /* ================================================== 465 * showMyAcc() 466 * 467 * Tato funkce vrací informace o uživatelově účtu 468 * 469 ================================================== */ 470 471 function showMyAcc(){ 472 global $user, $Database; 473 474 if( $this->id == "myacc" ){ 475 SwitchDB(2); // nastavení databáze na realmd 476 477 $sql_select['sql'] = mysql_query("SELECT * FROM `account` WHERE `username`='".$user['nick']."' LIMIT 1"); 478 $this->sql_select['result']['acc'] = @mysql_fetch_array($sql_select['sql']); 479 480 SwitchDB(1); // nastavení databáze na mangos 481 482 $sql_select['sql'] = mysql_query("SELECT * FROM `character` WHERE `account`='".$this->sql_select['result']['acc']['id']."' "); 483 $this->sql_select['result']['char_count'] = @mysql_num_rows($sql_select['sql']); 484 for($i=0;$this->sql_select['result']['char'][$i] = @mysql_fetch_array($sql_select['sql']) ;$i++){ 485 $this->sql_select['result']['char'][$i]['data'] = explode(" ", $this->sql_select['result']['char'][$i]['data']); 486 }; 487 488 switch($this->sql_select['result']['acc']['gmlevel']){ 489 case 0: $this->sql_select['result']['other']['opravneni'] = "Player"; break; 490 case 1: $this->sql_select['result']['other']['opravneni'] = "Moderator"; break; 491 case 2: $this->sql_select['result']['other']['opravneni'] = "GameMaster"; break; 492 case 3: $this->sql_select['result']['other']['opravneni'] = "Administrator"; break; 493 default: $this->sql_select['result']['other']['opravneni'] = "unknown"; 494 }; 495 496 switch($this->sql_select['result']['acc']['tbc']){ 497 case 0: $this->sql_select['result']['other']['version'] = "Normal"; break; 498 case 1: $this->sql_select['result']['other']['version'] = "Burning Crusade"; break; 499 }; 500 501 $this->sql_select['result']['other']['chars'] .= "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n"; 502 for($i=0; $i < $this->sql_select['result']['char_count'] ;$i++){ 503 $this->sql_select['result']['other']['chars'] .= "<tr><td>".$this->sql_select['result']['char'][$i]['name']."</td>"; 504 $this->sql_select['result']['other']['chars'] .= "<td title=\"Level\">".$this->sql_select['result']['char'][$i]['data'][34]."</td>"; 505 $this->sql_select['result']['other']['chars'] .= "<td title=\"Rasa\">".$Database['race'][$this->sql_select['result']['char'][$i]['race']]."</td>"; 506 $this->sql_select['result']['other']['chars'] .= "<td title=\"Povolání\">".$Database['class'][$this->sql_select['result']['char'][$i]['class']]."</td>\n"; 507 $this->sql_select['result']['other']['chars'] .= "<td> - <a href=\"./character.php?char=".$this->sql_select['result']['char'][$i]['guid']."\">Exportovat</a></td></tr>\n"; 508 }; 509 $this->sql_select['result']['other']['chars'] .= "</table>"; 510 511 return true; 512 }; 513 514 return false; 515 } 516 517 518 }; // konec třídy 303 519 304 520 }; // vložení souboru
Note:
See TracChangeset
for help on using the changeset viewer.