1 | <?php
|
---|
2 | include 'includes/Global.php';
|
---|
3 |
|
---|
4 | function test_authorized_characters($teststring){
|
---|
5 | $teststring=str_replace(" ", "%20", $teststring);
|
---|
6 | $teststring=str_replace("á", "%E1", $teststring);
|
---|
7 | $teststring=str_replace("í", "%ED", $teststring);
|
---|
8 | $teststring=str_replace("ý", "%FD", $teststring);
|
---|
9 | $teststring=str_replace("Ý", "%DD", $teststring);
|
---|
10 | // $teststring=str_replace("í", "%ED", $teststring);
|
---|
11 |
|
---|
12 | return mysql_escape_string($teststring);
|
---|
13 | }
|
---|
14 |
|
---|
15 |
|
---|
16 | if (array_key_exists('Album', $_GET)) { //seznam fotek
|
---|
17 | $Album = $_GET['Album'];
|
---|
18 | echo '<br /><a href="Picture.php">Seznam Albumù</a> >
|
---|
19 | <a href="Picture.php?Album='.$Album.'">Seznam Fotek</a> <br /><br />';
|
---|
20 | $sql = "SELECT * FROM pictures WHERE IDAlbum = '$Album'";
|
---|
21 | // echo $sql;
|
---|
22 | $ID = $db->SQLCommand($sql);
|
---|
23 | while($Line = mysql_fetch_array($ID)) {
|
---|
24 | echo '<a href="Picture.php?Picture='.$Line['ID'].'" title="'.$Line['Date'].'">
|
---|
25 | <img class="ViewPicture" alt="'.$Line['ViewFileName'].'" src="'.test_authorized_characters($UploadDirPictures.'/'.$Line['ViewFileName']).'"></a> ';
|
---|
26 | }
|
---|
27 | } else {
|
---|
28 | if (array_key_exists('Picture', $_GET)) { // jednotlivý obrázek
|
---|
29 | $Picture = $_GET['Picture'];
|
---|
30 |
|
---|
31 | $sql = "SELECT IDAlbum FROM pictures WHERE ID = '$Picture'";
|
---|
32 | $ID = $db->SQLCommand($sql);
|
---|
33 | $Line = mysql_fetch_array($ID);
|
---|
34 | echo '<br /><a href="Picture.php">Seznam Albumù</a> >
|
---|
35 | <a href="Picture.php?Album='.$Line['IDAlbum'].'">Seznam Fotek</a> >
|
---|
36 | <a href="Picture.php?Picture='.$Picture.'">Fotka</a> <br /> <br />';
|
---|
37 |
|
---|
38 | $sql = "SELECT * FROM pictures WHERE ID = '$Picture'";
|
---|
39 | $ID = $db->SQLCommand($sql);
|
---|
40 | while($Line = mysql_fetch_array($ID)) {
|
---|
41 | echo ' <a target="_blank" href="'.test_authorized_characters($UploadDirPictures.'/'.$Line['FileName']).'">
|
---|
42 | <img alt="'.$Line['ViewFileName'].'" class="Picture" src="'.test_authorized_characters($UploadDirPictures.'/'.$Line['FileName']).'"></a><br />';
|
---|
43 | //TODO: naèítat automaticky zda je pøedelý a následujíci, a pøidat tam spí jednotlivé odkazy <1,2,3,4 >
|
---|
44 | // echo '<A href="Picture.php?Picture='.$Last.'">Pøedelý</a> <A href="Picture.php?Picture='.$Next.'">následující</a>';
|
---|
45 | $Album = $Line['IDAlbum'];
|
---|
46 | // echo $Album;
|
---|
47 | }
|
---|
48 |
|
---|
49 | $sql = "SELECT * FROM pictures WHERE IDAlbum = '$Album'";
|
---|
50 | $ID = $db->SQLCommand($sql);
|
---|
51 | while($Line = mysql_fetch_array($ID)) {
|
---|
52 | if ($Line['ID'] == $Picture) {
|
---|
53 | if (isset($Last))
|
---|
54 | if ($Last <> '')
|
---|
55 | echo '<A href="Picture.php?Picture='.$Last.'">Pøedelý</a> ';
|
---|
56 | } else {
|
---|
57 | if (isset($Last))
|
---|
58 | if ($Last == $Picture)
|
---|
59 | echo '<A href="Picture.php?Picture='.$Line['ID'].'">Následující</a>';
|
---|
60 | }
|
---|
61 | $Last = $Line['ID'];
|
---|
62 | }
|
---|
63 |
|
---|
64 | } else {
|
---|
65 |
|
---|
66 | echo '<br /><a href="Picture.php">Seznam Albumù</a> <br /> <br />
|
---|
67 |
|
---|
68 | <table border="0">';
|
---|
69 |
|
---|
70 | $sql = "SELECT * FROM picturealbums";
|
---|
71 | $ID = $db->SQLCommand($sql);
|
---|
72 | while($Line = mysql_fetch_array($ID)) {
|
---|
73 | $IDAlbum = $Line['ID'];
|
---|
74 | $sql = "SELECT Count(ID) FROM pictures WHERE IDAlbum = '$IDAlbum'";
|
---|
75 | $IDPictures = $db->SQLCommand($sql);
|
---|
76 | $Pictures = mysql_fetch_row($IDPictures);
|
---|
77 |
|
---|
78 | echo '
|
---|
79 | <tr>
|
---|
80 | <td><a href="Picture.php?Album='.$Line['ID'].'" title="'.$Line['Name'].'">
|
---|
81 | <img class="ViewAlbum" alt="'.$Line['FileImg'].'" src="'.test_authorized_characters($UploadDirPictures.'/'.$Line['FileImg']).'">
|
---|
82 | </a>
|
---|
83 | </td>
|
---|
84 | <td>Název: <b>'.$Line['Name'].'</b><br />
|
---|
85 | Popis: <b>'.$Line['Description'].'</b><br />
|
---|
86 | Poèet fotek: <b>'.$Pictures[0].'</b><br />
|
---|
87 | Datum pøidání: <b>'.$Line['Date'].'</b>
|
---|
88 | </td></tr>';
|
---|
89 | // echo $Line['Description'];
|
---|
90 | } // konec while
|
---|
91 | echo ' </table>';
|
---|
92 | } //konec else picture
|
---|
93 | } //konec else albumu
|
---|
94 |
|
---|
95 | ShowFooter();
|
---|
96 | ?>
|
---|