Changeset 251


Ignore:
Timestamp:
Jan 20, 2008, 8:44:37 PM (17 years ago)
Author:
maron
Message:

NPC_text

Location:
quests
Files:
7 added
7 edited

Legend:

Unmodified
Added
Removed
  • quests/export.php

    r249 r251  
    2323    $Vote = $_POST['Vote'];
    2424    $users = @$_POST['users'];
    25    
    26 
    27       $AddDetails = @$_POST['AddDetails'];
    28       $AddObjectives = @$_POST['AddObjectives'];
    29       $AddOfferRewardText = @$_POST['AddOfferRewardText'];
    30       $AddRequestItemsText = @$_POST['AddRequestItemsText'];
    31       $AddEndText = @$_POST['AddEndText'];
    32       $AddObjectiveText1 = @$_POST['AddObjectiveText1'];       
    33       $AddObjectiveText2 = @$_POST['AddObjectiveText2'];       
    34       $AddObjectiveText3 = @$_POST['AddObjectiveText3'];       
    35       $AddObjectiveText4 = @$_POST['AddObjectiveText4'];       
    36 
    37       if (($Export == 'Mangos') and (Licence(2) == False)) {die('Nemáte oprávnìní');}
    38    
    39    
    40     $Buffer = '
     25
     26    $BufferHeader = '
    4127/*  File made by maron web aplikacion
    4228    =================================
     
    4430    WebProject: http://wow.zdechov.net/quests/
    4531    email: maron2@cetrum.cz
    46     DateExport: '.date("m.d.y  H:i").'   */
     32    DateExport: '.date("m.d.y  H:i").'
     33    Diakritika: '.$Diacritical.'
     34    Poèet nutných hlasù: '.$NumberVote.'
     35    Známka vy¾¹í jak: '.$Vote.'
     36    Tabluky: Quests: '.@$_POST['Quests'].' , NPC_text: '.@$_POST['NPC_texts'].'   */
    4737   
    4838    ';
    4939   
    50     if (isset($Use)) $Buffer .= 'USE `mangos`;
     40    if (isset($Use)) $BufferHeader .= 'USE `mangos`;
    5141   
    5242    ';
    5343
    54     $sql = "SELECT * FROM quests.quests WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'";
     44
    5545    $WhereLang = '';
    5646    if (isset($CZ)) $WhereLang .= " Language = '1'";
     
    7666        $WhereUsers .= " User = ".$users[$i];
    7767    endfor;   
     68
     69   
     70    if (array_key_exists('Quests', $_POST)) {
     71      $AddDetails = @$_POST['AddDetails'];
     72      $AddObjectives = @$_POST['AddObjectives'];
     73      $AddOfferRewardText = @$_POST['AddOfferRewardText'];
     74      $AddRequestItemsText = @$_POST['AddRequestItemsText'];
     75      $AddEndText = @$_POST['AddEndText'];
     76      $AddObjectiveText1 = @$_POST['AddObjectiveText1'];       
     77      $AddObjectiveText2 = @$_POST['AddObjectiveText2'];       
     78      $AddObjectiveText3 = @$_POST['AddObjectiveText3'];       
     79      $AddObjectiveText4 = @$_POST['AddObjectiveText4'];       
     80
     81      if (($Export == 'Mangos') and (Licence(2) == False)) {die('Nemáte oprávnìní');}
     82   
     83   
     84    $sql = "SELECT * FROM quests.quests WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'";
    7885   
    7986    if ($WhereLang <> '') $sql .= " AND ($WhereLang)";
     
    8289   // echo $sql;
    8390
    84 
     91    $i = 0;
    8592    $ID = $Database->SQLCommand($sql." ORDER BY vote");
    8693    while ($Line = mysql_fetch_array($ID)) {
     
    127134    if ($Diacritical == False) $sql=WithOutDiacritical($sql);
    128135   
    129     if ($Export == 'Mangos') {     
    130       $Database->SelectDatabase($Config['Database']['DatabaseMangos']);   
    131       $Database->SQLCommand($sql);
    132     } 
    133     $Buffer .= $sql."
    134     ";
    135    
     136    $Buffer[$i] = $sql;
     137    ++$i;
     138   
     139  }
    136140  } 
    137141 
     142  //export npc_textù
     143  $x = 0;
     144  if (array_key_exists('NPC_texts', $_POST)) {
     145   
     146    $sql = "SELECT * FROM NPC_text WHERE Complete = '1' AND CountVote >= '$NumberVote' AND Vote >= '$Vote'";
     147   
     148    if ($WhereLang <> '') $sql .= " AND ($WhereLang)";
     149    if ($WhereUsers <> '') $sql .=  "AND ($WhereUsers)";
     150
     151    $ID = $Database->SQLCommand($sql." ORDER BY vote");
     152    while ($Line = mysql_fetch_array($ID)) {
     153   
     154      $sql = "UPDATE npc_text SET ";
     155      for ($i=0; $i<count($npc_text); ++$i) {
     156        if ($Line[$npc_text[$i]] <> '')
     157          $sql .= " ".$npc_text[$i]." = '".$Line[$npc_text[$i]]."' , ";
     158      }
     159      $sql .= " ID = '".$Line['entry']."' WHERE ID = ".$Line['entry'];
     160      if ($Diacritical == False) $sql=WithOutDiacritical($sql);
     161     
     162    $BufferNPC[$x] = $sql;
     163    ++$x;
     164    }
     165  } 
     166 
     167  //vypisování
    138168  if ($Export == 'Display') {
    139169    echo 'Vygenerovaný SQL kód: <br /><textarea rows="30" cols="100">';
    140     echo $Buffer;
     170      echo $BufferHeader;
     171      for ($i=0; $i<count(@$Buffer); ++$i) {
     172        echo $Buffer[$i].'
     173        ';
     174      }
     175      for ($i=0; $i<count(@$BufferNPC); ++$i) {
     176        echo $BufferNPC[$i].'
     177        ';
     178      }
    141179    echo '</textarea>';
    142180  }
    143   if ($Export == 'Mangos') {
    144     echo 'Hotovo';
    145   }
     181
     182  if ($Export == 'Mangos') {     
     183    $Database->SelectDatabase($Config['Database']['DatabaseMangos']);   
     184      for ($i=0; $i<count(@$Buffer); ++$i) {
     185        $Database->SQLCommand($Buffer[$i]);
     186      }
     187      for ($i=0; $i<count(@$BufferNPC); ++$i) {
     188        $Database->SQLCommand($BufferNPC[$i]);
     189      }
     190  } 
    146191 
    147192  if ($Export == 'Zip') {
     
    149194        $save_filename = 'SqlTranslate.zip';
    150195        $SQL_filename = 'SqlTranslate.sql';
    151          
     196       
     197        $BufferZip = $BufferHeader;
     198        for ($i=0; $i<count(@$Buffer); ++$i) {
     199          $BufferZip .= $Buffer[$i];
     200        }
     201        for ($i=0; $i<count(@$BufferNPC); ++$i) {
     202          $BufferZip .= $BufferNPC[$i];
     203        }
     204
     205        $Buffer  = $BufferZip;
     206       
    152207        $zipfile = new zipfile();
    153208        $zipfile -> addFile($Buffer, $SQL_filename);
     
    188243        <input type="checkbox" name="Use" checked="true"> Pøidat Use mangos <br>
    189244        <br />
     245        <input type="checkbox" name="Quests" checked="true"> Questy <br>
     246        <input type="checkbox" name="NPC_texts" checked="true"> NPC_texts <br>
    190247      </td><td>
    191248        &nbsp; <input type="text" name="NumberVote" value="3" size="1"> Poèet nutných hlasù <br>                                                               
     
    197254// multiple="multiple"
    198255    $ID = $Database->SQLCommand("SELECT user,ID FROM `user` WHERE
    199           EXISTS(SELECT 1 FROM quests WHERE user = user.ID) ORDER BY user");
     256          EXISTS(SELECT 1 FROM quests WHERE user = user.ID) OR
     257          EXISTS(SELECT 1 FROM npc_text WHERE user = user.ID) ORDER BY user");
    200258      while ($Line = mysql_fetch_array($ID))
    201259        echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>';
     
    225283      </td></tr>
    226284    </table>
    227     <br><input type="submit" value="Generovat SQL soubor Questù"> (Sta¾ení)
     285    <br><input type="submit" value="Generovat SQL soubor pøekladu"> (Sta¾ení)
    228286  </form> 
    229287  <b>Èeský pøeklad MaNGOS Minimanageru:</b><br />
  • quests/form.php

    r250 r251  
    8080        <td width="300">Anglický</td>
    8181        <td>
    82           Pøekládám do: <?php
     82          Pøelo¾eno do: <?php
    8383          if ($Line['Language'] <> 0)
    8484              $Language = $Line['Language'];
  • quests/includes/global.php

    r250 r251  
    2626  <script type="text/javascript" language="JavaScript">
    2727  <!--
    28     var Open = ""
    29     var Closed = ""
    30 
    3128    function show(what){
    3229      what.style.display=\'\';
     
    3936 
    4037  ';
    41 
    42 
    43 // SQL injection hack protection
    44 foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
    45 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    4638
    4739 
     
    8981        echo '<a Title="Registrace u¾ivatele pro pøekládání" href="registrace.php" style="color: red">Registrace</a><br />';
    9082
    91       echo '<br /><div style="background-color: #ffff66" onMouseMove="show(menu2outline)" onmouseout="hide(menu2outline)"><a Title="Pøekládání questù"
    92        href="ListQuests.php?filter">Questy</a></div>
     83      //questy rolovací menu
     84      echo '<br /><div style="background-color: #ffff66" onMouseMove="show(menu2outline)" onmouseout="hide(menu2outline)">
     85      <a href="ListQuests.php?filter">Questy</a></div>       
    9386       
    94        
    95        <div style="position: absolute; left: 70; top: 165;
    96         display:none; width: 200; font-family: Verdana;font-size: 13px; background-color: #ffff66;
    97         border: 2px dotted black;       padding: 5px 5px 5px 5px;"
    98         id="menu2outline" onMouseMove="show(menu2outline)" onmouseout="hide(menu2outline)">
    99         &nbsp;<a Title="Zde mù¾ete zaèít pøekládat" href="ListQuests.php?selection">Nepøelo¾ené questy</a><br>
    100         &nbsp;<a Title="Pøelo¾ené questy, mù¾ete zde hlasovat, nebo opravovat Quest" href="ListQuests.php?Translate">Pøelo¾ené questy</a><br>
     87       <div id="menu2outline" style="position: absolute; left: 100; top: 170; display:none; width: 200; background-color: #ffff66; border: 2px dotted black;    padding: 5px 5px 5px 5px;" onMouseMove="show(menu2outline)" onmouseout="hide(menu2outline)">
     88        &nbsp;<a href="ListQuests.php?selection">Nepøelo¾ené questy</a><br>
     89        &nbsp;<a href="ListQuests.php?Translate">Pøelo¾ené questy</a><br>
    10190        ';
    10291        if  (Licence(0)) {
    103           echo '&nbsp;<a Title="Nedokonèené questy" href="ListQuests.php?mydevelop">Rozepsané questy</a><br />
    104           &nbsp;<a Title="Pøelo¾ené questy pøilá¹eného u¾ivatele" href="ListQuests.php?my">Moje questy</a><br />
    105           &nbsp;<a Title="Zatím neznámkované questy" href="ListQuests.php?notvote">Neznámkované questy</a><br />';
     92          echo '&nbsp;<a href="ListQuests.php?mydevelop">Rozepsané questy</a><br>
     93          &nbsp;<a href="ListQuests.php?my">Moje questy</a><br>
     94          &nbsp;<a href="ListQuests.php?notvote">Neznámkované questy</a><br>';
    10695        }
    107         echo '&nbsp;<a Title="Zobrazit questy podle vlastního fitru" href="ListQuests.php?filter">Filtr questù ...</a><br>';
     96        echo '&nbsp;<a href="ListQuests.php?filter">Filtr questù ...</a><br>';
     97      echo '</div>';
     98     
     99      //npc rolovací menu
     100      echo '<br /><div style="background-color: #ffff66" onMouseMove="show(npc_menu)" onmouseout="hide(npc_menu)">
     101      <a href="npc_list.php?filter">NPC_texty</a></div>       
     102       
     103       <div id="npc_menu" style="position: absolute; left: 100; top: 213; display:none; width: 200; background-color: #ffff66; border: 2px dotted black;        padding: 0px 5px 5px 5px;" onMouseMove="show(npc_menu)" onmouseout="hide(npc_menu)">
     104        &nbsp;<a href="npc_list.php?notran">Nepøelo¾ené npc_text</a><br>
     105        &nbsp;<a href="npc_list.php?Translate">Pøelo¾ené npc_text</a><br>
     106        ';
     107  /*      if  (Licence(0)) {
     108          echo '&nbsp;<a href="npc_list.php?mydevelop">Rozepsané npc_text</a><br>
     109          &nbsp;<a href="npc_list.php?my">Moje npc_text</a><br>
     110          &nbsp;<a href="npc_list.php?notvote">Neznámkované npc_text</a><br>';
     111        }   */
     112        echo '&nbsp;<a href="npc_list.php?filter">Filtr npc_text ...</a><br>';
    108113      echo '</div>
    109114     
  • quests/includes/global_function.php

    r250 r251  
    6363  array('4','Moderátor', 'red', 'Pøihlá¹ení u¾ivatelù'),
    6464  array('5','Hlasování', 'yellowgreen', 'Pøihlá¹ení u¾ivatelù'),
     65  array('6','Npc_text', 'tomato', 'Operace s NPC_texty'),
    6566);
    6667
     
    8182  } // END function Log
    8283
     84$npc_text = array(
     85  '0' => 'text0_0',
     86  '1' => 'text0_1',
     87  '2' => 'text1_0',
     88  '3' => 'text1_1',
     89  '4' => 'text2_0',
     90  '5' => 'text2_1',
     91  '6' => 'text3_0',
     92  '7' => 'text3_1',
     93  '8' => 'text4_0',
     94  '9' => 'text4_1',
     95  '10' => 'text5_0',
     96  '11' => 'text5_1',
     97  '12' => 'text6_0',
     98  '13' => 'text6_1',
     99  '14' => 'text7_0',
     100  '15' => 'text7_1',
     101);
     102
    83103?>
  • quests/quests_statistic.php

    r245 r251  
    2828  imagefilledrectangle($obrazek,0,0,$PercentBar,59,$Color2);
    2929  imagestring($obrazek, 10, 120, 15, $NumberTranslate.'/'.$NumberAJQuests, $Color3);
     30  imagestring($obrazek, 3, 300, 15, 'Questy', $Color3);
    3031  imagestring($obrazek, 10, 120, 30, $Percent.' %', $Color3);
    3132  imagestring($obrazek, 1, 240, 50, 'Aktualizováno: '.date("m.d.y  H:i"), $Color3);
  • quests/save.php

    r247 r251  
    22
    33  include('includes/global.php');
     4
     5  // SQL injection hack protection
     6  foreach($_POST as $Index => $Item) $_POST[$Index] = addslashes($Item);
     7  foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($Item);
    48
    59  if (array_key_exists('entry', $_POST)) {
     
    3943    if (!$Line) {
    4044   
    41       $Database->SQLCommand("INSERT INTO `quests` (`entry` , `Title` , `Details` , `Objectives` , `OfferRewardText` , `RequestItemsText` , `EndText` , `ObjectiveText1` , `ObjectiveText2` , `ObjectiveText3` , `ObjectiveText4` , `Language` , `User` , `complete` , `Take` )
    42       VALUES('$entry','$Title','$Details','$Objectives','$OfferRewardText','$RequestItemsText','$EndText','$ObjectiveText1','$ObjectiveText2','$ObjectiveText3','$ObjectiveText4','$Language','$UserID','$complete','$QuestID')");
     45      $Database->SQLCommand("INSERT INTO `quests` (`entry` , `Title` , `Details` , `Objectives` , `OfferRewardText` , `RequestItemsText` ,
     46      `EndText` , `ObjectiveText1` , `ObjectiveText2` , `ObjectiveText3` , `ObjectiveText4` , `Language` , `User` , `complete` , `Take` , `Vote` , `CountVote` )
     47      VALUES('$entry','$Title','$Details','$Objectives','$OfferRewardText','$RequestItemsText','$EndText','$ObjectiveText1',
     48      '$ObjectiveText2','$ObjectiveText3','$ObjectiveText4','$Language','$UserID','$complete','$QuestID','3','1')");
    4349      echo 'Quest: '.$entry.' ulo¾en!<br />';
    44       WriteLog('Quest: '.$entry.' ulo¾en! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1);
     50      WriteLog('Quest: '.$entry.' uloµen! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1);
    4551    } else {
    4652      $sql = "UPDATE quests SET complete = '$complete', Title = '$Title',
     
    5460    //  echo $sql.'<br />';     
    5561      echo 'Zmìny v Questu: '.$entry.' ulo¾eny!<br />';
    56       WriteLog('Zmìny v Questu: '.$entry.' ulo¾eny! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1);
     62      WriteLog('Zmìny v Questu: '.$entry.' uloµeny! <a href="form.php?ID='.$QuestID.'">'.$QuestID.'</a>', 1);
    5763      $Database->SQLCommand("DELETE FROM `quests_vote` WHERE `quests_vote`.`IDquest` = ".$QuestID);
    5864    }
    5965   
    60     echo 'Pøekládat: <a href="ListQuests.php?selection">Nepøeloµené</a> ';
     66    echo 'Pøekládat: <a href="ListQuests.php?selection">Nepøeloœené</a> ';
    6167     
    6268  }
  • quests/statistic.php

    r247 r251  
    55?>
    66
    7 <b>Statistika pøelo¾ených questù:</b><br>
     7<b>Statistika:</b><br>
    88 <img alt="quests" src="quests_statistic.php" title="statistika pøekladu úkolù"><br />
     9<br />
     10 <img alt="npc_text" src="npc_statistic.php" title="statistika pøekladu NPC_textù"><br />
    911<br />
    1012<b>Statistika v závislosti na èase: </b><a href="http://game-server.zdechov.net/statistic/?Measure=18">Pøelo¾ených textù</a><br>
     
    3335
    3436  echo '<tr><th><a href="statistic.php?order=user&amp;desc='.$desc.'">Jméno</a></th>
    35   <th><a href="statistic.php?order=NumberTranslate&amp;desc='.$desc.'" Title="Poèet pøelo¾ených questù">Pøelo¾ených</a></th>
    36   <th><a href="statistic.php?order=vote&amp;desc='.$desc.'" Title="Prùmìrná známka questù">Známka</a></th>
     37  <th><a href="statistic.php?order=NumberTranslate&amp;desc='.$desc.'" Title="Poèet pøelo¾ených questù">Pøel. Q.</a></th>
     38  <th><a href="statistic.php?order=NumberTranslateNPC&amp;desc='.$desc.'" Title="Poèet pøelo¾ených NPC_textù">Pøel. N.</a></th>
     39  <th><a href="statistic.php?order=vote&amp;desc='.$desc.'" Title="Prùmìrná známka questù">Z. Q</a></th>
     40  <th><a href="statistic.php?order=voteNPC&amp;desc='.$desc.'" Title="Prùmìrná známka NPC_text">Z. N.</a></th>
    3741  <th><a href="statistic.php?order=GM&amp;desc='.$desc.'">Oprávnìní</a></th>
    3842  <th><a href="statistic.php?order=LastLogin&amp;desc='.$desc.'">Poslední pøipojení</a></th></tr>';
     
    4044  $ID = $Database->SQLCommand("SELECT user,Email,LastLogin,GM,
    4145  (SELECT count(*) FROM `quests` WHERE User = user.id AND User <> 0) as NumberTranslate,
    42   (SELECT avg(vote) FROM `quests` WHERE User = user.id AND Complete = 1) as vote
     46  (SELECT count(*) FROM `npc_text` WHERE User = user.id AND User <> 0) as NumberTranslateNPC,
     47  (SELECT avg(vote) FROM `quests` WHERE User = user.id AND Complete = 1) as vote,
     48  (SELECT avg(Vote) FROM `npc_text` WHERE User = user.id AND Complete = 1) as voteNPC
    4349   FROM `user` ORDER BY $order $desc");
    4450      while ($Line = mysql_fetch_array($ID))
    4551        echo '<tr><td>'.$Line['user'].'</td>
    4652        <td>'.$Line['NumberTranslate'].'</td>
     53        <td>'.$Line['NumberTranslateNPC'].'</td>
    4754        <td>'.substr($Line['vote'], 0, 4).'</td>
     55        <td>'.substr($Line['voteNPC'], 0, 4).'</td>
    4856        <td>'.$Moderators[$Line['GM']].'</td>
    4957        <td>'.$Line['LastLogin'].'</td></tr>';
Note: See TracChangeset for help on using the changeset viewer.