Changeset 118 for db/post_read.php


Ignore:
Timestamp:
Nov 4, 2007, 5:38:25 PM (17 years ago)
Author:
hosiplan
Message:

Už ani pořádně nevím :D
+ eventy
+ Návody (zatím bez administarce)
+ Vylepšní přihlášení
+ Malá změna struktuty (stránka hlavni.php nyní obsahuje stránku obsah.php kvůli změnám do budoucna)

Location:
db
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • db

    • Property svn:ignore
      •  

        old new  
        11config.php
         2navrh
  • db/post_read.php

    r114 r118  
    11<?php
    2 if($vlozeni_souboru == "OK"){
     2if (!defined('IN_CODE')){ exit; };
    33
    44  class BasicWiewer{
     
    66    var $id; // současná stránka
    77    var $limit; // současná stránka
     8    var $kategorie; // kategorie z nabídky
    89    var $nastranu = 20; // počet výsledků hledání které budou vypsány
    910    var $sql_select; // proměnná obsahující všechny výsledky pro výpis
     
    1112
    1213    // konkrétní proměnné podle toho s čím pracujme
    13     var $quest; // GUID Questu
    1414    var $lvl_d; // min. lvl u Questu
    1515    var $lvl_h; // max. lvl u Questu
     16    var $quest; // GUID Questu
    1617    var $bug; // GUID Bugu
    1718    var $creature; // GUID Creepa
     
    4243      }
    4344
     45    public function searchItem($q,$limit,$nastranu){
     46      $this->q = $q;
     47      $this->limit = $limit;
     48      $this->nastranu = $nastranu;
     49      $this->searchItems(); // vykonáme hledání
     50      return $this->sql_select;
     51      }
     52
    4453    public function quest($quest){
    4554      $this->quest = $quest;
     
    7382    public function item($item){
    7483      $this->item = $item;
    75       # need to complete !!!
     84      $this->showItem(); // získání dat o Itemu
    7685      return $this->sql_select;
    7786      }
     
    8291      }
    8392
     93    public function guids($kategorie,$guid,$str){
     94      $this->kategorie = $kategorie;
     95      $this->guid = $guid;
     96      $this->str = $str;
     97      $this->showGuids(); // získání dat o užvatelově účtu
     98      return $this->sql_select;
     99      }
     100
    84101  /* ==================================================
    85102   * searchQuests()
    86    *
    87    * Tato funkce vyhledává
    88    * v databázi questy
     103   * showQuest()
     104   * startQuest($x)   
     105   *
     106   * Tato funkce vrací konkrétní Quest
     107   * + provádí pár dalších operací s jeho daty
    89108   *
    90109  ================================================== */
     
    105124          while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){
    106125            $this->sql_select['result'] .= "  <tr valign='top'>";
    107             $this->sql_select['result'] .= "<td><a href=\"index.php?quest=".$result['entry']."\">".$result['Title']."</a></td>";
     126            $this->sql_select['result'] .= "<td><a href=\"index.php?quest=".$result['entry'].$this->sid."\">".$result['Title']."</a></td>";
    108127            $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               $startovni_dotaz_item = mysql_query("SELECT * FROM item_template WHERE startquest='".$result['entry']."' ");
    120                 if( @mysql_num_rows($startovni_dotaz_item) > 0 ){
    121                   while($start_item = @MySQL_Fetch_Array($startovni_dotaz_item)){
    122                   switch($start_item['Quality']){
    123                     case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break;
    124                     case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break;
    125                     case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break;
    126                     case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break;
    127                     case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break;
    128                     case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break;
    129                     case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break;
    130                     };
    131                   $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?item=".$start_item['entry']."\"".$sql_select['other']['item_color'].">".$start_item['name']."</a><br>\n";
    132                   }; };
    133 
    134             $this->sql_select['result'] .= "</td>";
     128            $this->sql_select['result'] .= "<td>".$this->startQuest($result['entry'])."</td>";
    135129            $this->sql_select['result'] .= "<td>".$result['Objectives']."</td>";
    136130            $this->sql_select['result'] .= "</tr>\n";
     
    148142      }
    149143
     144    function showQuest(){
     145
     146      if( is_numeric($this->quest) AND empty($this->id) ){
     147
     148        $sql_select['sql'] = mysql_query("SELECT * FROM quest_template WHERE `entry`='".$this->quest."' LIMIT 1");
     149        if( @mysql_num_rows($sql_select['sql']) > 0 ){
     150          $this->sql_select['quest'] = MySQL_Fetch_Array($sql_select['sql']);
     151
     152          // Zjištění creatur a gameobjectů kde se Quest dá vzít
     153          $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']." ");
     154            if( @mysql_num_rows($startovni_NPC_dotaz_creature) > 0 ){
     155              while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_creature)){
     156              $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?creature=".$start_NPC['entry'].$this->sid."\">".$start_NPC['name']."</a><br>\n";
     157              }; };
     158          $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']." ");
     159            if( @mysql_num_rows($startovni_NPC_dotaz_gameobject) > 0 ){
     160              while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_gameobject)){
     161              $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?gameobject=".$start_NPC['entry'].$this->sid."\">".$start_NPC['name']."</a><br>\n";
     162              }; };
     163          $startovni_dotaz_item = mysql_query("SELECT * FROM item_template WHERE startquest='".$this->sql_select['quest']['entry']."' ");
     164            if( @mysql_num_rows($startovni_dotaz_item) > 0 ){
     165              while($start_NPC = @MySQL_Fetch_Array($startovni_dotaz_item)){
     166              $item_color = $this->itemQuality($start_NPC['Quality'],1);
     167              $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?item=".$start_NPC['entry'].$this->sid."\"".$item_color.">".$start_NPC['name']."</a><br>\n";
     168              }; };
     169          if( empty($this->sql_select['other']['StartNPC']) ){
     170            $this->sql_select['other']['EndNPC'] = "<b>Úkol není kde začít!</b>"; };
     171
     172          $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']." ");
     173            if( @mysql_num_rows($ukoncovaci_NPC_dotaz_creature) > 0 ){
     174              while($end_NPC = @MySQL_Fetch_Array($ukoncovaci_NPC_dotaz_creature)){
     175              $this->sql_select['other']['EndNPC'] .= "<a href=\"index.php?creature=".$end_NPC['entry'].$this->sid."\">".$end_NPC['name']."</a><br>\n";
     176              }; };
     177          $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']." ");
     178            if( @mysql_num_rows($ukoncovaci_NPC_dotaz_gameobject) > 0 ){
     179              while($end_NPC = @MySQL_Fetch_Array($ukoncovaci_NPC_dotaz_gameobject)){
     180              $this->sql_select['other']['EndNPC'] .= "<a href=\"index.php?gameobject=".$end_NPC['entry'].$this->sid."\">".$end_NPC['name']."</a><br>\n";
     181              }; };
     182          if( empty($this->sql_select['other']['EndNPC']) ){
     183            $this->sql_select['other']['EndNPC'] = "<b>Úkol není kde skončit!</b>"; };
     184
     185          // Zjištění Oblasti
     186          if( AbsCheck($this->sql_select['quest']['ZoneOrSort']) ){  }
     187          else{  };
     188
     189          // Důležitá věc
     190          $SrcItemId_dotaz = mysql_query("SELECT * FROM item_template WHERE entry =".$this->sql_select['quest']['SrcItemId']." LIMIT 1;");
     191          if( @mysql_num_rows($SrcItemId_dotaz) > 0 ){
     192              $SrcItemId = @MySQL_Fetch_Array($SrcItemId_dotaz);
     193              $item_color = $this->itemQuality($SrcItemId['Quality'],1);
     194              $this->sql_select['other']['SrcItemId'] .= "<a href=\"index.php?item=".$SrcItemId['entry'].$this->sid."\"".$item_color.">".$SrcItemId['name']."</a><br>\n";
     195              };
     196
     197            $this->sql_select['quest']['PrevQuestId'];
     198            $this->sql_select['quest']['NextQuestId'];
     199     
     200            $this->sql_select['other']['ReqItems']; // ReqItemId1-4.ReqItemCount1-4
     201     
     202            $this->sql_select['other']['ReqSource']; // ??
     203      /*        ReqSourceId1-4
     204            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.
     205            The same for ReqSourceId2-4
     206            You may define 1, 2, 3 or even all 4 sources for the same ReqItem/ReqSpellCast or use 4 sources for 4 ReqItems/ReqSpellCasts.
     207                ReqSourceCount1-4
     208            Amount of ReqSourceId items the player may gather per unfinished ReqItemId or ReqSpellCast.
     209            So ReqSourceId1 items will drop up to a total amount of (ReqItemCount(ReqSourceRef1) - already owned ReqItemId(ReqSourceRef1)) * ReqSourceCount1. Same for ReqSpellCast objectives.
     210                ReqSourceRef1-4
     211            Should be 0 or 1..4. See ReqSourceId description. */
     212     
     213            $this->sql_select['other']['ReqCreatureOrGOId']; // need to kill/cast
     214      /*    Value > 0: 1.-4. required creature_template ID the player needs to kill/cast on in order to complete the quest.
     215            Value < 0: 1.-4. required gameobject_template ID the player needs to cast on in order to complete the quest.
     216            If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */
     217     
     218            $this->sql_select['other']['ReqSpellCast'];
     219      /*    Spell ID of Spell that needs to be cast in order to fulfill a quest objective.
     220            If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */
     221     
     222            $this->sql_select['other']['ReqSpellCast'];
     223      /*    Spell ID of Spell that needs to be cast in order to fulfill a quest objective.
     224            If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */
     225     
     226            $this->sql_select['other']['RewChoiceItemId']; // !!! RewChoiceItemCount
     227      /*    Id of the 1.-6. Item available for reward choice.  */
     228           
     229            $this->sql_select['other']['RewItemId']; // !!! RewItemCount
     230      /*    1.-4. item Id given for reward (no choice).   */
     231           
     232 
     233          }
     234        else{
     235          $this->sql_select['error'] = "<p>Quest nebyl nalezen.</p>";
     236          };
     237        return true;
     238        };
     239
     240      return false;
     241      }
     242   
     243    function startQuest($x){
     244      $startovni_dotaz_creature = mysql_query("SELECT * FROM creature_template LEFT JOIN creature_questrelation ON creature_questrelation.id = creature_template.entry WHERE creature_questrelation.quest =".$x." LIMIT 10 ");
     245        if( @mysql_num_rows($startovni_dotaz_creature) > 0 ){
     246          while($start_NPC = @MySQL_Fetch_Array($startovni_dotaz_creature)){
     247          $startNPC .= "<a href=\"index.php?creature=".$start_NPC['entry'].$this->sid."\">".$start_NPC['name']."</a><br>\n";
     248          }; };
     249      $startovni_dotaz_gameobject = mysql_query("SELECT * FROM gameobject_template LEFT JOIN gameobject_questrelation ON gameobject_questrelation.id = gameobject_template.entry WHERE gameobject_questrelation.quest =".$x." LIMIT 10 ");
     250        if( @mysql_num_rows($startovni_dotaz_gameobject) > 0 ){
     251          while($start_NPC = @MySQL_Fetch_Array($startovni_dotaz_gameobject)){
     252          $startGO .= "<a href=\"index.php?gameobject=".$start_NPC['entry'].$this->sid."\">".$start_NPC['name']."</a><br>\n";
     253          }; };
     254      $startovni_dotaz_item = mysql_query("SELECT * FROM item_template WHERE startquest='".$x."' LIMIT 10 ");
     255        if( @mysql_num_rows($startovni_dotaz_item) > 0 ){
     256          while($start_NPC = @MySQL_Fetch_Array($startovni_dotaz_item)){
     257          $item_color = $this->itemQuality($start_NPC['Quality'],1);
     258          $startI .= "<a href=\"index.php?item=".$start_NPC['entry'].$this->sid."\"".$item_color.">".$start_NPC['name']."</a><br>\n";
     259          }; };
     260      $StartQuest = $startNPC.$startGO.$startI;
     261      if( empty($StartQuest) ){ $StartQuest = "<b>Úkol není kde začít!</b>"; };
     262      return $StartQuest;
     263      }
     264
    150265  /* ==================================================
    151266   * searchCreeps()
    152    *
    153    * Tato funkce vyhledává
    154    * v databázi creepy
     267   * showCreature()
     268   *
     269   * Tato funkce vrací konkrétního Creepa
     270   * + provádí pár dalších operací s jeho daty
    155271   *
    156272  ================================================== */
     
    167283            while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){
    168284              $this->sql_select['result'] .= "  <tr valign='top'>";
    169               $this->sql_select['result'] .= "<td><a href=\"index.php?creature=".$result['entry']."\">".$result['name']."</a></td>";
     285              $this->sql_select['result'] .= "<td><a href=\"index.php?creature=".$result['entry'].$this->sid."\">".$result['name']."</a></td>";
    170286              if( $result['rank'] != 3 ){
    171287                $this->sql_select['result'] .= "<td align='center'>".$result['minlevel']." - ".$result['maxlevel']."</td>";
     
    184300      return false;
    185301      }
    186 
    187   /* ==================================================
    188    * showQuest()
    189    *
    190    * Tato funkce vrací konkrétní Quest
    191    * + provádí pár dalších operací s jeho daty
    192    *
    193   ================================================== */
    194 
    195     function showQuest(){
    196 
    197       if( is_numeric($this->quest) AND empty($this->id) ){
    198 
    199         $sql_select['sql'] = mysql_query("SELECT * FROM quest_template WHERE `entry`='".$this->quest."' LIMIT 1");
    200         if( @mysql_num_rows($sql_select['sql']) > 0 ){
    201           $this->sql_select['quest'] = MySQL_Fetch_Array($sql_select['sql']);
    202 
    203           // Zjištění creatur a gameobjectů kde se Quest dá vzít
    204           $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']." ");
    205             if( @mysql_num_rows($startovni_NPC_dotaz_creature) > 0 ){
    206               while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_creature)){
    207               $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?creature=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n";
    208               }; };
    209           $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']." ");
    210             if( @mysql_num_rows($startovni_NPC_dotaz_gameobject) > 0 ){
    211               while($start_NPC = @MySQL_Fetch_Array($startovni_NPC_dotaz_gameobject)){
    212               $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?gameobject=".$start_NPC['entry']."\">".$start_NPC['name']."</a><br>\n";
    213               }; };
    214           $startovni_dotaz_item = mysql_query("SELECT * FROM item_template WHERE startquest='".$this->sql_select['quest']['entry']."' ");
    215             if( @mysql_num_rows($startovni_dotaz_item) > 0 ){
    216               while($start_NPC = @MySQL_Fetch_Array($startovni_dotaz_item)){
    217               switch($start_NPC['Quality']){
    218                 case 0: $item_color = "class=\"graylink\""; break;
    219                 case 1: $item_color = "class=\"whitelink\""; break;
    220                 case 2: $item_color = "class=\"greenlink\""; break;
    221                 case 3: $item_color = "class=\"bluelink\""; break;
    222                 case 4: $item_color = "class=\"purplelink\""; break;
    223                 case 5: $item_color = "class=\"orangelink\""; break;
    224                 case 6: $item_color = "class=\"redlink\""; break;
    225                 };
    226               $this->sql_select['other']['StartNPC'] .= "<a href=\"index.php?item=".$start_NPC['entry']."\"".$item_color.">".$start_NPC['name']."</a><br>\n";
    227               }; };
    228           if( empty($this->sql_select['other']['StartNPC']) ){
    229             $this->sql_select['other']['EndNPC'] = "<b>Úkol není kde začít!</b>"; };
    230 
    231           $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']." ");
    232             if( @mysql_num_rows($ukoncovaci_NPC_dotaz_creature) > 0 ){
    233               while($end_NPC = @MySQL_Fetch_Array($ukoncovaci_NPC_dotaz_creature)){
    234               $this->sql_select['other']['EndNPC'] .= "<a href=\"index.php?creature=".$end_NPC['entry']."\">".$end_NPC['name']."</a><br>\n";
    235               }; };
    236           $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']." ");
    237             if( @mysql_num_rows($ukoncovaci_NPC_dotaz_gameobject) > 0 ){
    238               while($end_NPC = @MySQL_Fetch_Array($ukoncovaci_NPC_dotaz_gameobject)){
    239               $this->sql_select['other']['EndNPC'] .= "<a href=\"index.php?gameobject=".$end_NPC['entry']."\">".$end_NPC['name']."</a><br>\n";
    240               }; };
    241           if( empty($this->sql_select['other']['EndNPC']) ){
    242             $this->sql_select['other']['EndNPC'] = "<b>Úkol není kde skončit!</b>"; };
    243 
    244           // Zjištění Oblasti
    245           if( AbsCheck($this->sql_select['quest']['ZoneOrSort']) ){  }
    246           else{  };
    247 
    248           // Důležitá věc
    249           $SrcItemId_dotaz = mysql_query("SELECT * FROM item_template WHERE entry =".$this->sql_select['quest']['SrcItemId']." LIMIT 1;");
    250           if( @mysql_num_rows($SrcItemId_dotaz) > 0 ){
    251               $SrcItemId = @MySQL_Fetch_Array($SrcItemId_dotaz);
    252               switch($SrcItemId['Quality']){
    253                 case 0: $item_color = "class=\"graylink\""; break;
    254                 case 1: $item_color = "class=\"whitelink\""; break;
    255                 case 2: $item_color = "class=\"greenlink\""; break;
    256                 case 3: $item_color = "class=\"bluelink\""; break;
    257                 case 4: $item_color = "class=\"purplelink\""; break;
    258                 case 5: $item_color = "class=\"orangelink\""; break;
    259                 case 6: $item_color = "class=\"redlink\""; break;
    260                 };
    261               $this->sql_select['other']['SrcItemId'] .= "<a href=\"index.php?item=".$SrcItemId['entry']."\"".$item_color.">".$SrcItemId['name']."</a><br>\n";
    262               };
    263 
    264             $this->sql_select['quest']['PrevQuestId'];
    265             $this->sql_select['quest']['NextQuestId'];
    266      
    267             $this->sql_select['other']['ReqItems']; // ReqItemId1-4.ReqItemCount1-4
    268      
    269             $this->sql_select['other']['ReqSource']; // ??
    270       /*        ReqSourceId1-4
    271             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.
    272             The same for ReqSourceId2-4
    273             You may define 1, 2, 3 or even all 4 sources for the same ReqItem/ReqSpellCast or use 4 sources for 4 ReqItems/ReqSpellCasts.
    274                 ReqSourceCount1-4
    275             Amount of ReqSourceId items the player may gather per unfinished ReqItemId or ReqSpellCast.
    276             So ReqSourceId1 items will drop up to a total amount of (ReqItemCount(ReqSourceRef1) - already owned ReqItemId(ReqSourceRef1)) * ReqSourceCount1. Same for ReqSpellCast objectives.
    277                 ReqSourceRef1-4
    278             Should be 0 or 1..4. See ReqSourceId description. */
    279      
    280             $this->sql_select['other']['ReqCreatureOrGOId']; // need to kill/cast
    281       /*    Value > 0: 1.-4. required creature_template ID the player needs to kill/cast on in order to complete the quest.
    282             Value < 0: 1.-4. required gameobject_template ID the player needs to cast on in order to complete the quest.
    283             If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */
    284      
    285             $this->sql_select['other']['ReqSpellCast'];
    286       /*    Spell ID of Spell that needs to be cast in order to fulfill a quest objective.
    287             If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */
    288      
    289             $this->sql_select['other']['ReqSpellCast'];
    290       /*    Spell ID of Spell that needs to be cast in order to fulfill a quest objective.
    291             If ReqSpellCastN > 0 then at ReqCreatureOrGOIdN must be casted spell ReqSpellCastN, if ReqSpellCastN = 0 then it must be killed. */
    292      
    293             $this->sql_select['other']['RewChoiceItemId']; // !!! RewChoiceItemCount
    294       /*    Id of the 1.-6. Item available for reward choice.  */
    295            
    296             $this->sql_select['other']['RewItemId']; // !!! RewItemCount
    297       /*    1.-4. item Id given for reward (no choice).   */
    298            
    299  
    300           }
    301         else{
    302           $this->sql_select['error'] = "<p>Quest nebyl nalezen.</p>";
    303           };
    304         return true;
    305         };
    306 
    307       return false;
    308       }
    309 
    310   /* ==================================================
    311    * showCreature()
    312    *
    313    * Tato funkce vrací konkrétního Creepa
    314    * + provádí pár dalších operací s jeho daty
    315    *
    316   ================================================== */
    317302
    318303    function showCreature(){
     
    334319            if( @mysql_num_rows($questy_dotaz_creature) > 0 ){
    335320              while($quest_NPC = @MySQL_Fetch_Array($questy_dotaz_creature)){
    336                 $this->sql_select['other']['creature_quests'] .= "<a href=\"index.php?quest=".$quest_NPC['entry']."\">".$quest_NPC['Title']."</a><br>\n";
     321                $this->sql_select['other']['creature_quests'] .= "<a href=\"index.php?quest=".$quest_NPC['entry'].$this->sid."\">".$quest_NPC['Title']."</a><br>\n";
    337322              }; };
    338323     
     
    340325            if( @mysql_num_rows($drop_creature) > 0 ){
    341326              while($drop_NPC = @MySQL_Fetch_Array($drop_creature)){
    342                 switch($drop_NPC['Quality']){
    343                   case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break;
    344                   case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break;
    345                   case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break;
    346                   case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break;
    347                   case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break;
    348                   case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break;
    349                   case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break;
    350                   };
    351                 $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>";
     327                $item_color = $this->itemQuality($drop_NPC['Quality'],1);
     328                $this->sql_select['other']['creature_drop'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry'].$this->sid."\" ".$item_color.">".$drop_NPC['name']."</a></td>";
    352329                $this->sql_select['other']['creature_drop'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n";
    353330              }; } else{ $this->sql_select['other']['creature_drop'] = "<tr><td colspan='2'>Tento creep nemá žádný drop !</td></tr>"; };
     
    356333            if( @mysql_num_rows($pickpocket_creature) > 0 ){
    357334              while($drop_NPC = @MySQL_Fetch_Array($pickpocket_creature)){
    358                 switch($drop_NPC['Quality']){
    359                   case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break;
    360                   case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break;
    361                   case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break;
    362                   case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break;
    363                   case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break;
    364                   case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break;
    365                   case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break;
    366                   };
    367                 $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>";
     335                $item_color = $this->itemQuality($drop_NPC['Quality'],1);
     336                $this->sql_select['other']['creature_pickpocket'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry'].$this->sid."\" ".$item_color.">".$drop_NPC['name']."</a></td>";
    368337                $this->sql_select['other']['creature_pickpocket'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n";
    369338              }; } else{ $this->sql_select['other']['creature_pickpocket'] = "<tr><td colspan='2'>Tento creep nemá žádný Pickpocket !</td></tr>"; };
     
    372341            if( @mysql_num_rows($skin_creature) > 0 ){
    373342              while($drop_NPC = @MySQL_Fetch_Array($skin_creature)){
    374                 switch($drop_NPC['Quality']){
    375                   case 0: $sql_select['other']['item_color'] = "class=\"graylink\""; break;
    376                   case 1: $sql_select['other']['item_color'] = "class=\"whitelink\""; break;
    377                   case 2: $sql_select['other']['item_color'] = "class=\"greenlink\""; break;
    378                   case 3: $sql_select['other']['item_color'] = "class=\"bluelink\""; break;
    379                   case 4: $sql_select['other']['item_color'] = "class=\"purplelink\""; break;
    380                   case 5: $sql_select['other']['item_color'] = "class=\"orangelink\""; break;
    381                   case 6: $sql_select['other']['item_color'] = "class=\"redlink\""; break;
    382                   };
    383                 $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>";
     343                $item_color = $this->itemQuality($drop_NPC['Quality'],1);
     344                $this->sql_select['other']['creature_skin'] .= "<tr><td><a href=\"index.php?item=".$drop_NPC['entry'].$this->sid."\" ".$item_color.">".$drop_NPC['name']."</a></td>";
    384345                $this->sql_select['other']['creature_skin'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n";
    385346              }; } else{ $this->sql_select['other']['creature_skin'] = "<tr><td colspan='2'>Tento creep nemá žádný Skin !</td></tr>"; };
     
    396357
    397358  /* ==================================================
     359   * searchItems()
     360   * showItem()
     361   * itemSpellCheck($x)   
     362   * itemAttribCheck()   
     363   * itemQuality($x)   
     364   *
     365   * Tato funkce vrací konkrétní Item
     366   * + provádí pár dalších operací s jeho daty
     367   *
     368  ================================================== */
     369
     370    function searchItems(){
     371
     372      if( !empty($this->q) AND $this->id == "items" ){
     373
     374          $this->sql_select = SQLselect_Strankovani("SELECT * FROM `item_template` WHERE ( `name` LIKE '%".$this->q."%' ) ORDER BY `Quality` DESC", $this->limit, $this->nastranu, "?id=items&amp;q=".$this->q, $this->sid);
     375          if( @mysql_num_rows($this->sql_select[1]) > 0 ){
     376            $this->sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" cellspacing=\"0\" cellpadding=\"0\">\n";
     377            $this->sql_select['result'] .= "<thead><tr><td>Název itemu</td><td>Level</td></tr></thead>\n<col><col width=\"70px\">";
     378
     379            while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){
     380              if( $result['RequiredLevel'] == 0 ){ $result['RequiredLevel'] = 1; };
     381              $item_color = $this->itemQuality($result['Quality'],1);
     382
     383              $this->sql_select['result'] .= "  <tr valign='top'>";
     384              $this->sql_select['result'] .= "<td><a href=\"index.php?item=".$result['entry'].$this->sid."\" $item_color>".$result['name']."</a></td>";
     385              $this->sql_select['result'] .= "<td align='center'>".$result['RequiredLevel']."</td>";
     386              $this->sql_select['result'] .= "</tr>\n";
     387              };
     388
     389            $this->sql_select['result'] .= "</table>\n";
     390            }  else{ $this->sql_select['error'] = "<p>Nebyly nalezeny žádné itemy.</p>"; };
     391        return true;
     392        };
     393
     394      return false;
     395      }
     396
     397    function showItem(){
     398      global $databaseR;
     399
     400      if( is_numeric($this->item) AND empty($this->id) ){
     401        $this->sql_select['sql'] = mysql_query("SELECT * FROM item_template WHERE `entry`='".$this->item."' LIMIT 1");
     402        if( @mysql_num_rows($this->sql_select['sql']) > 0 ){
     403          $this->sql_select['item'] = MySQL_Fetch_Array($this->sql_select['sql']);
     404
     405          $item_color = $this->itemQuality($this->sql_select['item']['Quality'],2);
     406          $item_content .= "<h2 $item_color>".$this->sql_select['item']['name']."</h2>\n"; // jméno
     407          if( $this->sql_select['item']['bonding'] != 0 ){
     408            $databaseR->resetSelection('bonding',$this->sql_select['item']['bonding'],'item');
     409            $item_content .= "<p>".$databaseR->returnResult()."</p>\n"; // bonding
     410            };
     411         
     412          if( $this->sql_select['item']['class'] == 0 ){
     413            # need to complete !!!
     414            }
     415          elseif( $this->sql_select['item']['class'] == 1 ){
     416            # need to complete !!!
     417            } // .. 15
     418          # need to complete !!!               
     419
     420          $item_content .= $this->itemBattleCheck();
     421          $item_content .= $this->itemAttribCheck();
     422          $item_content .= $this->itemSpellCheck();
     423
     424          $this->sql_select['other']['item_content'] = $item_content;
     425
     426          $this->sql_select['other']['item_content'] =
     427            "<table id=\"item\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n".
     428            "  <tr><td class=\"lefttop\"></td><td class=\"top\"></td><td class=\"righttop\"></td></tr><tr><td class=\"left\"></td><td class=\"item_content\">\n".
     429            "  ".$this->sql_select['other']['item_content'].
     430            "  </td><td class=\"right\"></td></tr><tr><td class=\"leftbottom\"></td><td class=\"bottom\"></td><td class=\"rightbottom\"></td></tr>\n".
     431            "</table>\n";
     432
     433          // drop
     434          $drop_dotaz_creature = mysql_query("SELECT * FROM `creature_loot_template` LEFT JOIN `creature_template` ON `creature_template`.`lootid` = `creature_loot_template`.`entry` WHERE (`creature_loot_template`.`item` ='".$this->sql_select['item']['entry']."' ) ORDER BY `creature_loot_template`.`ChanceOrRef` DESC ");
     435            if( @mysql_num_rows($drop_dotaz_creature) > 0 ){
     436              while($drop_NPC = @MySQL_Fetch_Array($drop_dotaz_creature)){
     437                $this->sql_select['other']['item_drop_c'] .= "<tr><td><a href=\"index.php?creature=".$drop_NPC['entry'].$this->sid."\">".$drop_NPC['name']."</a></td>";
     438                switch($drop_NPC['rank']){
     439                  case 0: $creature_type = ""; break;
     440                  case 1: $creature_type = " Elite"; break;
     441                  case 2: $creature_type = " Rare"; break;
     442                  case 3: $creature_type = ""; break;
     443                  case 4: $creature_type = " Rare"; break;
     444                  };
     445                if( $drop_NPC['rank'] != 3 ){ 
     446                  $this->sql_select['other']['item_drop_c'] .= "<td>".$drop_NPC['minlevel']." - ".$drop_NPC['maxlevel'].$creature_type."</td>\n";
     447                  } else{ $this->sql_select['other']['item_drop_c'] .= "<td>Boss</td>"; };
     448                $this->sql_select['other']['item_drop_c'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n";
     449              }; } else{ $this->sql_select['other']['item_drop_c'] = "<tr><td colspan='3'>Tento předmět nepadá z žádného Creepa !</td></tr>"; };
     450
     451          $drop_dotaz_gameobject = mysql_query("SELECT * FROM `gameobject_loot_template` LEFT JOIN `gameobject_template` ON `gameobject_template`.`lootid` = `gameobject_loot_template`.`entry` WHERE (`gameobject_loot_template`.`item` =".$this->sql_select['item']['entry']." AND `gameobject_loot_template`.`quest_freeforall`='1' ) ORDER BY `gameobject_loot_template`.`ChanceOrRef` DESC ");
     452            if( @mysql_num_rows($drop_dotaz_gameobject) > 0 ){
     453              while($drop_NPC = @MySQL_Fetch_Array($drop_dotaz_gameobject)){
     454                $this->sql_select['other']['item_drop_o'] .= "<tr><td><a href=\"index.php?gameobject=".$drop_NPC['entry'].$this->sid."\">".$drop_NPC['name']."</a></td>";
     455                $this->sql_select['other']['item_drop_o'] .= "<td>".$drop_NPC['ChanceOrRef']."%</td></tr>\n";
     456              }; }  else{ $this->sql_select['other']['item_drop_o'] = "<tr><td colspan='2'>Tento předmět nepadá z žádného Objektu !</td></tr>"; };
     457
     458          // questy
     459          $quest_dotaz_sql = "SELECT * FROM `quest_template` WHERE (  ";
     460              $quest_dotaz_sql .= "`SrcItemId` =".$this->sql_select['item']['entry']." ";
     461              $quest_dotaz_sql .= "OR `ReqItemId1`=".$this->sql_select['item']['entry']." ";
     462              $quest_dotaz_sql .= "OR `ReqItemId2`=".$this->sql_select['item']['entry']." ";
     463              $quest_dotaz_sql .= "OR `ReqItemId3`=".$this->sql_select['item']['entry']." ";
     464              $quest_dotaz_sql .= "OR `ReqItemId4`=".$this->sql_select['item']['entry']." ";
     465              $quest_dotaz_sql .= ") ";
     466          $quest_dotaz = mysql_query($quest_dotaz_sql);
     467            if( @mysql_num_rows($quest_dotaz) > 0 ){
     468              while($quest = @MySQL_Fetch_Array($quest_dotaz)){
     469                $StartQuest = $this->startQuest($quest['entry']);
     470
     471                $this->sql_select['other']['item_quests'] .= "<tr><td><a href=\"index.php?quest=".$quest['entry'].$this->sid."\">".$quest['Title']."</a></td>";
     472                $this->sql_select['other']['item_quests'] .= "<td>".$quest['MinLevel']."</td>";
     473                $this->sql_select['other']['item_quests'] .= "<td>".$StartQuest."</td></tr>\n";
     474              }; };
     475          if( empty($this->sql_select['other']['item_quests']) ){
     476            $this->sql_select['other']['item_quests'] = "<tr><td colspan='3'>Tento předmět nezačíná žádný Quest, ani v žádném není potřebný !</td></tr>";
     477            };
     478
     479          }
     480        else{
     481          $this->sql_select['error'] = "<p>Item nebyl nalezen.</p>";
     482          };
     483        return true;
     484        };
     485
     486      return false;
     487      }
     488
     489    function itemSpellCheck(){
     490      for($x=1; $x<=5 ;$x++){
     491        if( $this->sql_select['item']['spellid_'.$x] != 0 ){
     492          if( !AbsCheck($this->sql_select['item']['spellcooldown_'.$x]) AND $this->sql_select['item']['spellcharges_'.$x] == 0 ){ $action = "Equip"; }
     493          else{ $action = "Use"; };
     494          $item_content .= "<p class='green'>$action: Unknown spell ID ".$this->sql_select['item']['spellid_'.$x]."</p>\n";
     495          if(AbsCheck($this->sql_select['item']['spellcharges_'.$x]) AND $this->sql_select['item']['spellcharges_'.$x] != 0 ){
     496            $item_content .= "<p>Charges: ".$this->sql_select['item']['spellcharges_'.$x]."</p>\n";
     497            };
     498          };
     499        };
     500      return $item_content;
     501      }
     502
     503    function itemAttribCheck(){
     504      global $databaseR;
     505      for($x=1; $x<=10 ;$x++){
     506        if( $this->sql_select['item']['stat_type'.$x] != 0 AND $this->sql_select['item']['stat_value'.$x] != 0 ){
     507          $databaseR->resetSelection('stat_type',$this->sql_select['item']['stat_type'.$x],'item');
     508          if( AbsCheck($this->sql_select['item']['stat_value'.$x]) ){ $num = "+"; } else{ $num = "-"; };
     509          $item_content .= "<p>".$num.$this->sql_select['item']['stat_value'.$x]." ".$databaseR->returnResult()."</p>\n";
     510          };
     511        };
     512      $resistances = array("holy","fire","nature","frost","shadow","arcane");
     513      for($x=0; $x<count($resistances) ;$x++){
     514        if( $this->sql_select['item'][$resistances[$x].'_res'] != 0 ){
     515          if( AbsCheck($this->sql_select['item'][$resistances[$x].'_res']) ){ $num = "+"; } else{ $num = "-"; };
     516          $item_content .= "<p>".$num.$this->sql_select['item'][$resistances[$x].'_res']." ".FirstLetter($resistances[$x])." Resistance</p>\n";
     517          };
     518        };
     519      return $item_content;
     520      }
     521
     522    function itemBattleCheck(){
     523      global $databaseR;
     524      // dmg_min1       dmg_max1        dmg_type1
     525      for($x=1; $x<=5 ;$x++){
     526        if( $this->sql_select['item']['dmg_min'.$x] != 0 AND $this->sql_select['item']['dmg_max'.$x] != 0 ){
     527          if( $this->sql_select['item']['dmg_type'.$x] != 0 ){
     528            $databaseR->resetSelection('dmg_type',$this->sql_select['item']['dmg_type'.$x],'item');
     529            $dmg_type = " ".$databaseR->returnResult(); };
     530          if( $x>1 ){ $num = "+ "; } else{ unset($num); };
     531          $item_content .= "<p>".$num.$this->sql_select['item']['dmg_min'.$x]." - ".$this->sql_select['item']['dmg_max'.$x].$dmg_type." Damage</p>\n";
     532          };
     533        };
     534      return $item_content;
     535      }
     536
     537    function itemQuality($x,$y){
     538      if( $y==1 ){ // odkaz
     539        switch($x){
     540          case 0: $item_color = "class='graylink'"; break;
     541          case 1: $item_color = "class='whitelink'"; break;
     542          case 2: $item_color = "class='greenlink'"; break;
     543          case 3: $item_color = "class='bluelink'"; break;
     544          case 4: $item_color = "class='purplelink'"; break;
     545          case 5: $item_color = "class='orangelink'"; break;
     546          case 6: $item_color = "class='redlink'"; break;
     547          };
     548        }
     549      elseif( $y==2 ){ // barva normálního textu
     550        switch($x){
     551          case 0: $item_color = "class='gray'"; break;
     552          case 1: $item_color = "class='white'"; break;
     553          case 2: $item_color = "class='green'"; break;
     554          case 3: $item_color = "class='blue'"; break;
     555          case 4: $item_color = "class='purple'"; break;
     556          case 5: $item_color = "class='orange'"; break;
     557          case 6: $item_color = "class='red'"; break;
     558          };
     559        };
     560      return $item_color;
     561      }
     562
     563  /* ==================================================
    398564   * showBugs()
    399565   * showBug()
     
    419585          while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){
    420586            $this->sql_select['result'] .= "<tr><td valign='top'>";
    421             $this->sql_select['result'] .= "<a href=\"./index.php?id=bugreport&amp;bug=".$result['id']."\">".@date("d.m.Y H:i", $result['vlozeno'])."</a>";
     587            $this->sql_select['result'] .= "<a href=\"./index.php?id=bugreport&amp;bug=".$result['id'].$this->sid."\">".@date("d.m.Y H:i", $result['vlozeno'])."</a>";
    422588            $this->sql_select['result'] .= "</td><td valign='top'>";
    423589            $this->sql_select['result'] .= nl2br(preg_replace(array("(\<)","(\>)"), array("&#60;","&#62;"), $result['popis']));
     
    528694          $this->sql_select['result']['other']['chars'] .= "<td title=\"Rasa\">".$Database['race'][$this->sql_select['result']['char'][$i]['race']]."</td>";
    529695          $this->sql_select['result']['other']['chars'] .= "<td title=\"Povolání\">".$Database['class'][$this->sql_select['result']['char'][$i]['class']]."</td>\n";
    530           $this->sql_select['result']['other']['chars'] .= "<td> - <a href=\"./character.php?char=".$this->sql_select['result']['char'][$i]['guid']."\">Exportovat</a></td></tr>\n";
     696          $this->sql_select['result']['other']['chars'] .= "<td> - <a href=\"./character.php?char=".$this->sql_select['result']['char'][$i]['guid'].$this->sid."\">Exportovat</a></td></tr>\n";
    531697          };
     698        if( $this->sql_select['result']['char_count'] == 0 ){
     699          $this->sql_select['result']['other']['chars'] .= "  <tr><td>Na tomto účtu nemáte žádné postavy</td></tr>\n";
     700          };
    532701        $this->sql_select['result']['other']['chars'] .= "</table>";
    533702
     
    538707      }
    539708
     709  /* ==================================================
     710   * showGuids()
     711   *
     712   * Tato funkce slouží k práci s návody
     713   *
     714  ================================================== */
     715
     716    function showGuids(){
     717      global $Database,$_POST,$user;
     718      SwitchDB(3); // nastavení databáze na web
     719
     720      if( isset($_POST['send']) ){
     721        $bunky = array("nazev","keywords","obsah","vlozil","vlozil_acc","vlozil_date","kategorie");
     722        $hodnoty = array($_POST['nazev'],$_POST['keywords'],$_POST['clanek'],$_POST['podpis'],$user['acc'],time(),$_POST['kategorie']);
     723        if(mysql_query("INSERT INTO `data_navody` (`".implode("`,`",$bunky)."`) VALUES ('".implode("','",$hodnoty)."') ")){
     724          $this->sql_select['other']['insert'] = "Váš návod byl vložen";
     725          }
     726        else{ $this->sql_select['other']['insert'] = "Návod se nepodařilo vložit"; };
     727        };
     728     
     729      if( $this->id == "navody" ){
     730
     731        $this->sql_select['other']['kategorie'] = "      <li><a href=\"./index.php?id=navody&amp;kat=".$this->sid."\" title=\"Vše\"><b>Kategorie:</b></a></li>\n";
     732        $this->sql_select['other']['f_options'] = "    <option value=\"0\"> - - - </option>\n";
     733        $sql_select['kateg'] = mysql_query("SELECT * FROM `data_navody_kategorie` WHERE (`zobrazit`!=0) ORDER BY `poradi` ASC");
     734        while( $result = @mysql_fetch_array($sql_select['kateg']) ){
     735          $this->sql_select['other']['kategorie'] .= "      <li><a href=\"./index.php?id=navody&amp;kat=".$result['entry'].$this->sid."\">".$result['nazev_kategorie']."(".$result['pocet_navodu'].")</a></li>\n";
     736          $this->sql_select['other']['f_options'] .= "    <option value=\"".$result['entry']."\">".$result['nazev_kategorie']."</option>\n";
     737          };
     738
     739        if( !empty($this->kategorie) AND $this->kategorie != 0 ){
     740          $where = "WHERE ( `data_navody`.`kategorie`='".$this->kategorie."' AND ";
     741          // `nadpis` LIKE '%".$this->q."%' OR `subname` LIKE '%".$this->q."%'
     742          }
     743        else{ $where = " LEFT JOIN `data_navody_kategorie` ON `data_navody`.`kategorie` = `data_navody_kategorie`.`entry` WHERE ( "; };
     744
     745        $sql_select = SQLselect_Strankovani("SELECT * FROM `data_navody` $where `data_navody`.`schvaleno`=1 ) ORDER BY `vlozil_date` DESC, `data_navody`.`kategorie` ASC", $this->limit, $this->nastranu, "?id=navody&amp;kat=".$this->kategorie, $this->sid);
     746        $this->sql_select = array_merge($this->sql_select, $sql_select);
     747
     748        if( @mysql_num_rows($sql_select[1]) > 0 ){  unset($result['nazev_kategorie']);
     749          $this->sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" cellspacing=\"0\" cellpadding=\"0\">\n";
     750          $this->sql_select['result'] .= "<thead><tr><td>Nadpis</td><td>Vložil</td><td>Vloženo</td></tr></thead>\n<col><col width=\"160px\"><col width=\"140px\">\n";
     751
     752          while( $result = MySQL_Fetch_Array($sql_select[1]) ){
     753            if( !empty($result['nazev_kategorie']) ){
     754              $result['nazev'] = $result['nazev_kategorie']." - ".$result['nazev'];
     755              };
     756            $this->sql_select['result'] .= "  <tr valign='top'>";
     757            $this->sql_select['result'] .= "<td><a href=\"index.php?navod=".$result['id'].$this->sid."\">".$result['nazev']."</a></td>";
     758            $this->sql_select['result'] .= "<td>".$result['vlozil']."</td>";
     759            $this->sql_select['result'] .= "<td>".date("H:i d.m.Y" ,$result['vlozil_date'])."</td>";
     760            $this->sql_select['result'] .= "</tr>\n";
     761            };
     762         
     763          $this->sql_select['result'] .= "</table>\n";
     764          } else{ $this->sql_select['result'] = "<p>Nebyly nalezeny žádné návody.</p>"; };
     765
     766        return true;
     767        }
     768      elseif( !empty($this->guid) ){
     769        $sql_select['sql'] = mysql_query("SELECT * FROM `data_navody` WHERE (`id`=".$this->guid.") LIMIT 1");
     770        if( @mysql_num_rows($sql_select['sql']) > 0 ){
     771          $this->sql_select['result'] = MySQL_Fetch_Array($sql_select['sql']);
     772          mysql_query("UPDATE `data_navody` SET `precteni`='".++$this->sql_select['result']['precteni']."' WHERE `id`=".$this->guid." LIMIT 1");
     773          } else{ $this->sql_select['error'] = "<p>Návod nenalezen !</p>"; };
     774
     775        return true;
     776        };
     777
     778      return false;
     779      }
     780
     781  /* ==================================================
     782   * showEvents()
     783   *
     784   * Tato funkce vrací dynamické eventy ve hře
     785   *
     786  ================================================== */
     787
     788    public function showEvents($limit,$nastranu){
     789
     790      $this->limit = $limit;
     791      $this->nastranu = $nastranu;
     792
     793      if( $this->id == "eventy" ){
     794
     795        $this->sql_select = SQLselect_Strankovani("SELECT * FROM `game_event` ORDER BY `entry` ASC", $this->limit, $this->nastranu, "?id=eventy", $this->sid);
     796
     797        if( @mysql_num_rows($this->sql_select[1]) > 0 ){
     798          $this->sql_select['result'] .= "<table width=\"100%\" class=\"search_result\" cellspacing=\"0\" cellpadding=\"0\">\n";
     799          $this->sql_select['result'] .= "<thead><tr><td>Event</td><td>Počátek</td><td title='Po jakých časových úsecích se událost opakuje'>Perioda</td><td title='Doba trvání'>Trvání</td></tr></thead>\n<col><col width=\"140px\">\n";
     800
     801          //entry - Entry of the game event     
     802          //start - Absolute start date, the event will never start before     
     803          //end - Absolute end date, the event will never start afler   
     804          //occurence - Delay in minutes between occurences of the event       
     805          //length - Length in minutes of the event     description
     806          //description - of the event displayed in console
     807
     808          while( $result = MySQL_Fetch_Array($this->sql_select[1]) ){
     809
     810            if( $result['occurence'] > 60 ){
     811              $hours = $result['occurence']/60;
     812              $time = explode(".", $hours);
     813              if( $time[1] == 0 OR empty($time[1]) ){ $time[1] = "00"; }
     814                else{ $time[1] = $time[1]*60; };
     815              if( $time[0] > 23 ){
     816                $days = $time[0]/24;
     817                $days = explode(".", $days);
     818                if( $days[1] == 0 OR empty($days[1]) ){ $days[1] = "00"; }
     819                  else{ $days[1] = $days[1]*24; };
     820                $time[0] = $days[1];
     821                } else{ $days[0] = "0"; };
     822              $result['occurence'] = $time[0]."h ".$time[1]."m ".$days[0]."d";
     823              };
     824/*
     825            if( $result['length'] > 60 ){
     826              $hours = $result['length']/60;
     827              $time = explode(".", $hours);
     828              if( $time[1] == 0 OR empty($time[1]) ){ $time[1] = "00"; }
     829                else{ $time[1] = $time[1]*60; };
     830              $result['length'] = $time[0]."h ".$time[1]."m";
     831              };
     832
     833            if( $result['length'] == 0 OR empty($result['length']) ){
     834              $result['length'] = "Nedefinované"; };
     835/*
     836            $time = time();
     837            $zacatek_eventu = DatabaseTime2Sec($result['start']);
     838            $konec_eventu = DatabaseTime2Sec($result['end']);
     839
     840            if( $konec_eventu <= $time AND $konec_eventu != 0 AND $result['length'] != "Neustále" ){
     841              $probehne_za = "Už neproběhne"; }
     842            elseif( $konec_eventu != 0 AND !empty($konec_eventu) AND $result['length'] != "Neustále" ){
     843              $time_betwen = $time-$zacatek_eventu; //čas mezi začátkem a tímto okamžikem
     844              while( $time_betwen%$result['occurence'] > 1 ){
     845                $time_betwen = $time_betwen - $result['occurence'];
     846                };
     847              $time_betwen = abs($time_betwen);
     848              $probehne_za = date("m", $time_betwen)."d ".
     849                             date("d", $time_betwen)."d ".
     850                             date("H", $time_betwen)."h ".
     851                             date("i", $time_betwen)."m";
     852              }
     853            else{
     854              $probehne_za = "Právě probíhá";
     855              };
     856*/
     857
     858            $this->sql_select['result'] .= "  <tr valign='top'>";
     859            $this->sql_select['result'] .= "<td>".$result['description']."</td>";
     860            $this->sql_select['result'] .= "<td>".ReorderDate($result['start'])."</td>";
     861            $this->sql_select['result'] .= "<td>".$result['occurence']."</td>";
     862            $this->sql_select['result'] .= "<td>".$result['length']."m</td>";
     863            //$this->sql_select['result'] .= "<td>".$probehne_za."</td>";
     864            $this->sql_select['result'] .= "</tr>\n";
     865            };
     866
     867          $this->sql_select['result'] .= "</table>\n";
     868          } else{ $this->sql_select['result'] = "<p>Nebyly nalezeny žádné eventy.</p>"; };
     869
     870        return $this->sql_select;
     871        }
     872
     873      return false;
     874      }
     875
    540876
    541877    }; // konec třídy
    542878
    543   }; // vložení souboru
    544879?>
Note: See TracChangeset for help on using the changeset viewer.