Changeset 246 for quests/ListQuests.php
- Timestamp:
- Jan 18, 2008, 8:34:12 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quests/ListQuests.php
r245 r246 20 20 } 21 21 22 if(array_key_exists('limitx', $_GET)) { 23 $_SESSION['limitx'] = mysql_escape_string($_GET['limitx']); 24 $_SESSION['limity'] = mysql_escape_string($_GET['limity']); 25 } else { 26 if (isset($_SESSION['limitx']) == false) { 27 $_SESSION['limitx'] = '0'; 28 $_SESSION['limity'] = $NumberQuests; 29 } 30 } 31 32 function WritePages($Addres, $Where) 33 { // BEGIN function WritePages 34 global $Database, $NumberQuests; 35 36 $Line = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM quests $Where")); 37 $CountLists = $Line[0]/$NumberQuests; 38 39 echo 'Poèet questù: <b>'.$Line[0].'</b><br /> 40 Zobrazit stránku: '; 41 42 for ($i=0; $i< $CountLists; ++$i) { 43 $limity = $NumberQuests; 44 $limitx = $i*$limity; 45 $Page = $i+1; 46 if ($_SESSION['limitx'] == $limitx) 47 echo '<b>'.$Page.'</b> '; 48 else 49 echo '<a href="'.$Addres.'&limitx='.$limitx.'&limity='.$limity.'">'.$Page.'</a> '; 50 } 51 52 if (@$_SESSION['limitx'] > $limitx) $_SESSION['limitx'] = 0; 53 54 } // END function WritePages 55 22 56 function WriteQuests($sql, $limit, $address) 23 57 { // BEGIN function WriteQuests … … 40 74 <th><a href="ListQuests.php?'.$address.'&order=Title&desc='.$desc.'">Název Questu</a></th>'; 41 75 if ($address == 'selection') echo '<th><a href="ListQuests.php?'.$address.'&order=CountQuests&desc='.$desc.'">Výskyd</a></th>'; else 42 if ($address <> ' limitx') echo '<th><a href="ListQuests.php?'.$address.'&order=user&desc='.$desc.'">User</a></th>76 if ($address <> 'notran') echo '<th><a href="ListQuests.php?'.$address.'&order=user&desc='.$desc.'">User</a></th> 43 77 <th><a href="ListQuests.php?'.$address.'&order=vote&desc='.$desc.'">Známka</a></th> 44 78 <th><a href="ListQuests.php?'.$address.'&order=CountVote&desc='.$desc.'">Poèet hlasování</a></th>'; … … 53 87 <td>'.htmlspecialchars($Line['Title']).'</td>'; 54 88 if ($address == 'selection') echo '<td>'.$Line['CountQuest'].'</td>'; else 55 if ($address <> ' limitx') echo '<td>'.@$Line['User'].'</td>89 if ($address <> 'nottran') echo '<td>'.@$Line['User'].'</td> 56 90 <td>'.substr($Line['Vote'], 0, 4).'</td> 57 91 <td>'.$Line['CountVote'].'</td>'; … … 63 97 64 98 if(array_key_exists('selection', $_GET)) { 99 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 100 <a Title="Zde mù¾ete zaèít pøekládat" href="ListQuests.php?selection">Nepøelo¾ené questy</a><br><br>'; 65 101 66 102 echo '<table border="1" cellspacing="0" cellpadding="10"><tr><td> … … 73 109 <b>Ostatní:</b><br /><br />'; 74 110 75 for ($i=0; $i<24; ++$i) { 76 $limity = $NumberQuests; 77 $limitx = $i*$limity; 78 $Under = $limitx+$limity; 79 echo '<a href="ListQuests.php?limitx='.$limitx.'&limity='.$limity.'">'.$limitx.' - '.$Under.'</a><br />'; 80 } 81 echo '<a href="ListQuests.php?limitx='.$limitx.'&limity=6000">Zbytek</a><br />'; 111 WritePages('ListQuests.php?notran',"items WHERE items.Language = '0' AND 112 NOT EXISTS(SELECT 1 FROM quests sub WHERE sub.Language <> 0 AND sub.entry = items.entry)"); 113 82 114 echo '</td></tr></table>'; 83 115 } 84 116 85 117 86 if(array_key_exists('limitx', $_GET)) { 87 if(array_key_exists('limity', $_GET)) { 88 $_SESSION['limitx'] = mysql_escape_string($_GET['limitx']); 89 $_SESSION['limity'] = mysql_escape_string($_GET['limity']); 90 } 118 if(array_key_exists('notran', $_GET)) { 119 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 120 <a Title="Zde mù¾ete zaèít pøekládat" href="ListQuests.php?selection">Nepøelo¾ené questy</a> - > 121 <b>Vypsání nepøelo¾ených questù s limitem na stránku</b><br><br>'; 122 123 WritePages('ListQuests.php?notran',"items WHERE items.Language = '0' AND 124 NOT EXISTS(SELECT 1 FROM quests sub WHERE sub.Language <> 0 AND sub.entry = items.entry)"); 125 91 126 WriteQuests("SELECT * FROM quests items WHERE items.Language = '0' AND 92 NOT EXISTS(SELECT 1 FROM quests sub WHERE sub.Language <> 0 AND sub.entry = items.entry) ", $_SESSION['limitx'].','.$_SESSION['limity'],' limitx');127 NOT EXISTS(SELECT 1 FROM quests sub WHERE sub.Language <> 0 AND sub.entry = items.entry) ", $_SESSION['limitx'].','.$_SESSION['limity'],'notran'); 93 128 } 94 129 95 130 if(array_key_exists('Translate', $_GET)) { 96 if(array_key_exists('trans_limitx', $_GET)) { 97 $_SESSION['limitx'] = mysql_escape_string($_GET['trans_limitx']); 98 $_SESSION['limity'] = mysql_escape_string($_GET['trans_limity']); 99 } else { 100 if (isset($_SESSION['limitx']) == false) { 101 $_SESSION['limitx'] = '0'; 102 $_SESSION['limity'] = $NumberQuests; 103 } 104 } 105 106 $Line = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM quests WHERE quests.Language = '1' AND quests.Complete = '1'")); 107 $CountLists = $Line[0]/$NumberQuests; 108 109 echo 'Poèet questù: <b>'.$Line[0].'</b> Zobrazit stránku: '; 110 for ($i=0; $i< $CountLists; ++$i) { 111 $limity = $NumberQuests; 112 $limitx = $i*$limity; 113 $Page = $i+1; 114 if ($_SESSION['limitx'] == $limitx) $color = 'style="color: red"'; 115 else $color = ''; 116 echo '<a '.$color.' href="ListQuests.php?Translate&trans_limitx='.$limitx.'&trans_limity='.$limity.'">'.$Page.'</a> '; 117 } 118 131 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 132 <a Title="Pøelo¾ené questy, mù¾ete zde hlasovat, nebo opravovat Quest" href="ListQuests.php?Translate">Pøelo¾ené questy</a><br><br>'; 133 134 WritePages('ListQuests.php?Translate', "WHERE quests.Language = '1' AND quests.Complete = '1'"); 135 119 136 WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User FROM 120 137 quests WHERE quests.Language = '1' AND quests.Complete = '1'", $_SESSION['limitx'].','.$_SESSION['limity'], 'Translate'); … … 122 139 123 140 if(array_key_exists('my', $_GET) and Licence(0)) { 141 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 142 <a Title="Pøelo¾ené questy pøilá¹eného u¾ivatele" href="ListQuests.php?my">Moje questy</a><br><br>'; 124 143 WriteQuests("SELECT * FROM quests Where user = ".$_SESSION['UserID'], '', 'my'); 125 144 } 126 145 127 146 if(array_key_exists('mydevelop', $_GET) and Licence(0)) { 147 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 148 <a Title="Nedokonèené questy" href="ListQuests.php?mydevelop">Rozepsané questy</a><br><br>'; 128 149 WriteQuests("SELECT * FROM quests Where user = ".$_SESSION['UserID']." AND complete = '0'", '', 'mydevelop'); 129 150 } 130 151 152 if(array_key_exists('filter', $_GET)) { 153 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a><br><br><br>'; 154 echo '<table border="1" cellpadding="3" cellspacing="0"> 155 <tr><th>Odkaz</th><th>Popis</th></tr>'; 156 157 echo '<tr><td><a Title="Zde mù¾ete zaèít pøekládat" href="ListQuests.php?selection">Nepøelo¾ené questy</a></td> 158 <td>Nikým nepøelo¾ené questy, zde mù¾ete zaèít pøekládat</td></tr> 159 <tr><td><a Title="Pøelo¾ené questy, mù¾ete zde hlasovat, nebo opravovat Quest" href="ListQuests.php?Translate">Pøelo¾ené questy</a></td> 160 <td>Pøelo¾ené questy, mù¾ete zde hlasovat, nebo opravovat Quest</td></tr> 161 '; 162 163 if (Licence(0)) { 164 echo '<tr><td><a Title="Nedokonèené questy" href="ListQuests.php?mydevelop">Rozepsané questy</a></td> 165 <td>Nedokonèené questy pøilá¹eného u¾ivatele</td></tr> 166 <tr><td><a Title="Pøelo¾ené questy pøilá¹eného u¾ivatele" href="ListQuests.php?my">Moje questy</a></td> 167 <td>Pøelo¾ené questy pøilá¹eného u¾ivatele</td></tr>'; 168 } 169 170 echo '<tr><td><form action="ListQuests.php?users" method="post"> 171 <select name="users[]" size="10" multiple>'; 172 173 $ID = $Database->SQLCommand("SELECT user,ID FROM `user`"); 174 while ($Line = mysql_fetch_array($ID)) 175 echo '<option value="'.$Line['ID'].'">'.$Line['user'].'</option>'; 176 177 echo '</select><br> 178 <input type="submit" value="Vypsat"></form></td> 179 <td>Vypsat pouze od tìchto u¾ivatalù<br> 180 Vybrat více u¾ivatelù mù¾ete pomocí CTRL+click</td></tr>'; 181 182 echo '<tr><td> 183 <form action="ListQuests.php?byvote" method="post"> 184 Poèet hlasù: <br /> 185 <input type="radio" name="SingNumberVote" value="=" checked="true" title="Rovná se "=""> 186 <input type="radio" name="SingNumberVote" value=">" checked="true" title="Je vìt¹í ne¾ ">""> 187 <input type="radio" name="SingNumberVote" value="<" checked="true" title="Je men¹í ne¾ "<""> 188 <input type="text" name="NumberVote" value="3" size="1"><br> 189 Známka: <br /> 190 <input type="radio" name="SingVote" value="=" checked="true" title="Rovná se "=""> 191 <input type="radio" name="SingVote" value=">" checked="true" title="Je vìt¹í ne¾ ">""> 192 <input type="radio" name="SingVote" value="<" checked="true" title="Je men¹í ne¾ "<""> 193 <input type="text" name="Vote" value="3" size="1"><br> 194 <input type="submit" value="Vypsat"></form> 195 </td><td>Zobrazit podle známky</td></tr>'; 196 197 echo '<tr><td><form action="action.php" method="get"> 198 <input type="text" name="search" size="8"> 199 <input type="submit" value="Hledat"> 200 </form> 201 </td><td>Vyhledat pomocí textu</td></tr> 202 '; 203 204 205 206 echo '</table>'; 207 // WriteQuests("SELECT * FROM quests Where user = ".$_SESSION['UserID']." AND complete = '0'", '', 'mydevelop'); 208 } 209 210 if(array_key_exists('users', $_GET)) { 211 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 212 <b>Vypsání questù od urèitých u¾ivatelù</b><br><br>'; 213 $users = @$_POST['users']; 214 215 $WhereUsers = ''; 216 217 for ($i=0; $i<Count($users); $i++): 218 if ($WhereUsers <> '') 219 $WhereUsers .= " OR User = ".$users[$i]; 220 else 221 $WhereUsers .= " User = ".$users[$i]; 222 endfor; 223 WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User FROM quests Where $WhereUsers", '', 'users'); 224 225 } 226 227 if(array_key_exists('byvote', $_GET)) { 228 echo '<a Title="Zobrazit questy podle vlasního filtru" href="ListQuests.php?filter">Filtr questù</a> -> 229 <b>Vypsání podle známky</b><br><br>'; 230 231 $SingVote = $_POST['SingVote']; 232 $SingNumberVote = $_POST['SingNumberVote']; 233 $Vote = $_POST['Vote']; 234 $NumberVote = $_POST['NumberVote']; 235 236 WriteQuests("SELECT *, (SELECT user.user FROM user WHERE user.id = quests.user) as User 237 FROM quests WHERE Vote $SingVote $Vote AND CountVote $SingNumberVote $NumberVote", '', 'users'); 238 239 } 240 131 241 ShowFooter(); 132 242 ?> 243
Note:
See TracChangeset
for help on using the changeset viewer.