1 rizwank 1.1 <?php require_once 'conf.php'; ?>
2 <?php
3 $versionNumber = '1.3';
4
5 $connection = @mysql_connect($host, $user, $pass) or die('<p>Error connecting to MySQL Database. If you are installing SSPAdmin, return to start.php and check your server name. If you have already installed SSPAdmin, your MySQL Server may be down. Contact your host.</p>');
6
7 mysql_select_db($db);
8
9 // Nothing to see here..
10 $itbl = $pre.'images';
11 $atbl = $pre.'albums';
12 $utbl = $pre.'usrs';
13 $dtbl = $pre.'dynamic';
14 $dltbl = $pre.'dynamic_links';
15
16 function mysqlclean($array, $index, $maxlength, $connection)
17 {
18 if (isset($array["{$index}"]))
19 {
20 $input = substr($array["{$index}"], 0, $maxlength);
21 $input = mysql_real_escape_string($input, $connection);
22 rizwank 1.1 return ($input);
23 }
24 return NULL;
25 }
26
27 function getCount($s)
28 {
29 global $atbl, $itbl;
30 if ($s == 'album')
31 $t = $atbl.' WHERE active = 1';
32 else
33 $t = $itbl;
34
35 $query = "SELECT id FROM $t";
36
37 $result = mysql_query($query);
38
39 echo(mysql_num_rows($result));
40
41 if ($s == 'album')
42 {
43 rizwank 1.1 $query = "SELECT id FROM $atbl WHERE active = '0'";
44
45 $result = mysql_query($query);
46
47 if (mysql_num_rows($result) != 0)
48 echo ' ('.mysql_num_rows($result).' Inactive)';
49 }
50 }
51
52 function getAlbumCount($aid)
53 {
54 global $itbl;
55 $query = "SELECT id FROM $itbl WHERE active = '1' AND aid = $aid";
56
57 $result = mysql_query($query);
58
59 echo '('.mysql_num_rows($result).' Active Photos';
60
61 $query = "SELECT id FROM $itbl WHERE active = '0' and aid = $aid";
62
63 $result = mysql_query($query);
64 rizwank 1.1
65 if (mysql_num_rows($result) != 0)
66 echo ', '.mysql_num_rows($result).' Inactive';
67
68 echo')';
69 }
70
71 function writeImageBox($aid,$p,$s)
72 {
73 global $itbl;
74 if (!$s) $tag = ' AND active = 1';
75 $query = "SELECT * FROM $itbl WHERE aid=$aid{$tag} ORDER BY seq";
76 $result = mysql_query($query);
77
78 if (!$s)
79 {
80 echo '<div id="pic-spread-full">';
81 echo '<ul id="boxes">';
82 } else {
83 echo '<div id="pic-spread">';
84 }
85 rizwank 1.1 while ($row = mysql_fetch_array($result))
86 {
87 if ($s)
88 {
89 $f = 'javascript:editPic('.$row['id'].','.$aid.')';
90 if ( ereg("swf", $row['src']) || ereg("flv", $row['src']) )
91 {
92 $mid = '<div id="'.$row['id'].'" class="boxy"><a href="'.$f.'">'.$row['src'].'</a></div>';
93 }
94 else
95 {
96 $mid = '<a href="'.$f.'"><img id="'.$row['id'].'" src="albums/'.$p.'/lg/'.$row['src'].'" height="75" /></a>';
97 }
98 echo $mid;
99 }
100 else
101 {
102 if ( ereg("swf", $row['src']) || ereg("flv", $row['src']) )
103 {
104 echo('<li id="'.$row['id'].'"><div>'.$row['src'].'</div></li>');
105 }
106 rizwank 1.1 else
107 {
108 echo('<li id="'.$row['id'].'"><img src="albums/'.$p.'/lg/'.$row['src'].'" height="75" /></li>');
109 }
110 }
111 }
112 if (!$s)
113 {
114 echo '</ul><div style="clear: left;"><br/></div>';
115 }
116 echo '</div>';
117 }
118
119 function albumsList ()
120 {
121 global $atbl, $adminDir;
122 $query = "SELECT * FROM $atbl ORDER BY displayOrder";
123 $result = mysql_query($query);
124
125 if (mysql_num_rows($result) != 0)
126 {
127 rizwank 1.1 while ($row = mysql_fetch_array($result))
128 {
129 $aid = $row['id'];
130 $aName = $row['name'];
131 $aDes = $row['description'];
132 $p = $row['path'];
133 $tn = $row['tn'];
134 $st = $row['active'];
135 $start = $row['startHere'];
136 $atn = str_replace(($adminDir.'/'), '', $row['aTn']);
137
138 if ($st == 1)
139 {
140 $st = 'Active';
141 $l = 'Make Inactive';
142 $o = 0;
143 }
144 else
145 {
146 $st = 'Inactive';
147 $l = 'Make Active';
148 rizwank 1.1 $o = 1;
149 }
150
151 if ($atn != '')
152 $atn = "<img src=\"$atn\" class=\"album-thumb\" />";
153
154 if ($st == 'Active')
155 {
156 if ($start == 1)
157 $start = 'Slideshow Starts with This Album (<a href="swap-start-album.php?aid='.$aid.'&act=2">Disable</a>)';
158 else
159 $start = '<a href="swap-start-album.php?aid='.$aid.'&act=1">Make this the <strong>startHere</strong> album</a>';
160 }
161 else
162 {
163 $start = 'Album must be active to be the <strong>startHere</strong> album';
164
165 }
166
167 echo '<div class="album-wrap"><h3 class="album-header">'.$aName.'</strong><small> ';
168 getAlbumCount($aid);
169 rizwank 1.1 echo '</small></h3>'.$atn;
170 echo '<ul class="album-sub"><li>Album ID for Linking: <strong>'.$aid.'</strong></li><li class="lock">Currently '.$st.' (<a href="swap-activation.php?aid='.$aid.'&opt='.$o.'">'.$l.'</a>)</li>';
171 echo '<li class="start">'.$start.'</li>';
172 echo '<li class="config"><a href="edit-album.php?aid='.$aid.'">Edit Album Metadata</a></li><li class="img"><a href="edit-album-images.php?aid='.$aid.'">Edit Album Images</li><li class="img"><a href="edit-album-order.php?aid='.$aid.'">Edit Image Order</li><li class="img"><a href="generate-thumbs.php?aid='.$aid.'">Generate Thumbnails</li><li class="search"><a href="add-album-up-single.php?aid='.$aid.'">Upload a New Image to this Gallery</a></li><li class="search"><a href="album-rescan.php?aid='.$aid.'">Rescan for New Images</a></li><li class="delete"><a href="javascript:albumDeleteConfirm('.$aid.')">Delete this Album</a> (Cannot Be Undone)</li></ul></div>';
173 }
174 }
175 else
176 {
177 echo '<p>No Albums to Edit. <a href="add-album.php">Click here</a> to add an album.</p>';
178 }
179 }
180
181 function dynAlbumsList ()
182 {
183 global $dtbl, $adminDir;
184 $query = "SELECT * FROM $dtbl";
185 $result = mysql_query($query);
186
187 if (mysql_num_rows($result) != 0)
188 {
189 echo '<ul class="album-sub">';
190 rizwank 1.1 while ($row = mysql_fetch_array($result))
191 {
192 $did = $row['id'];
193 $aName = $row['name'];
194
195 echo '<li><a href="edit-dynamic-single.php?did='.$did.'">'.$aName.'</a> (ID for linking: <strong>'.$did.'</strong>) <a href="javascript:dynAlbumDeleteConfirm('.$did.')">Delete</a></li>';
196 }
197 echo '</ul>';
198 }
199 else
200 {
201 echo '<p><em>No dynamic Galleries Yet. Add One Above.</em></p>';
202 }
203 }
204
205 function albumsListOrder ()
206 {
207 global $atbl, $adminDir;
208 $query = "SELECT * FROM $atbl WHERE Active = '1' ORDER BY displayOrder";
209 $result = mysql_query($query);
210
211 rizwank 1.1 if (mysql_num_rows($result) != 0)
212 {
213 echo '<ul id="albums">';
214 while ($row = mysql_fetch_array($result))
215 {
216 $aid = $row['id'];
217 $aName = $row['name'];
218 echo '<li id="'.$aid.'">'.$aName.'</li>';
219 }
220 echo '</ul>';
221
222 }
223 else
224 {
225 echo '<p>No Active Albums.</p>';
226 }
227 }
228
229 function dynAlbumsListOrder ($did)
230 {
231 global $atbl, $dltbl;
232 rizwank 1.1 $query = "SELECT * FROM $dltbl WHERE did='$did' ORDER BY display";
233 $result = mysql_query($query);
234
235 if (mysql_num_rows($result) != 0)
236 {
237 echo '<ul id="albums">';
238 while ($row = mysql_fetch_array($result))
239 {
240 $aid = $row['aid'];
241 $q = "SELECT name FROM $atbl WHERE id=$aid";
242 $r = mysql_query($q);
243
244
245 while ($rw = mysql_fetch_array($r))
246 {
247 $aName = $rw['name'];
248 }
249 echo '<li id="'.$aid.'">'.$aName.'</li>';
250 }
251 echo '</ul>';
252
253 rizwank 1.1 }
254 else
255 {
256 echo '<p>No Active Albums.</p>';
257 }
258 }
259 ?>
|