1 rizwank 1.1 <?php
2 require_once('./inc/connect.php');
3
4 header('Content-type: text/xml;');
5
6 $output = '<?xml version="1.0" encoding="utf-8"?>'."\n";
7 $sname = $_SERVER['SERVER_NAME'];
8 $self = 'http://'.$sname.$_SERVER['PHP_SELF'];
9 $self = str_replace($adminDir.'/images.php', '', $self);
10 $output .= '<gallery>';
11
12 if (!ISSET($_GET['gid'])){
13 $q = "SELECT * FROM $atbl WHERE active = 1 ORDER BY displayOrder";
14 $r = mysql_query($q);
15 } else {
16 $gid = $_GET['gid'];
17 $q = "SELECT $atbl.id, $atbl.name, $atbl.description, $atbl.tn, $atbl.target, $atbl.startHere, $atbl.audioFile, $atbl.aTn, $atbl.path, $atbl.audioCap FROM $atbl, $dltbl WHERE $dltbl.aid = $atbl.id and $dltbl.did = $gid ORDER BY $dltbl.display";
18 $r = mysql_query($q);
19 }
20
21 while ($rw = mysql_fetch_array($r))
22 rizwank 1.1 {
23 $id = $rw['id'];
24 $n = ent2ncr(htmlentities($rw['name']));
25 $des = $rw['description'];
26 $des = str_replace("\n", '', $des);
27 $d = ent2ncr(htmlentities($des));
28 $tn = $rw['tn'];
29 $tgt = $rw['target'];
30 $s = $rw['startHere'];
31 $p = $self.$adminDir.'/albums/'.$rw['path'].'/lg/';
32 $aMp3 = $self.$adminDir.'/album-audio/'.$rw['audioFile'];
33 $ac = $rw['audioCap'];
34 $ac = str_replace("\n", '', $ac);
35 $aCap = ent2ncr(htmlentities($ac));
36 $atn = $rw['aTn'];
37 $cArr = explode('http://', $atn);
38 if (count($cArr) == 1){
39 $atn = $self.$atn;
40 }
41
42 if ($tn == 1)
43 rizwank 1.1 {
44 $tn = $self.$adminDir.'/albums/'.$rw['path'].'/tn/';
45 }
46 else
47 {
48 $tn = '';
49 }
50
51 if ($tgt == 1)
52 $t_str = ' target="_self"';
53 else
54 $t_str = '';
55
56 if ($s == 1)
57 $s = 'true';
58 else
59 $s = '';
60
61 if (!empty($rw['audioFile']))
62 $audioStr = 'audio="'.$aMp3.'"';
63 else
64 rizwank 1.1 $audioStr = '';
65
66 if (!empty($rw['audioFile']) && !empty($aCap))
67 $audioStr .= ' audioCaption="'.$aCap.'"';
68
69 $output .= "\n\t".'<album id="'.$id.'" title="'.$n.'" description="'.$d.'" lgPath="'.$p.'" tnPath="'.$tn.'" tn="'.$atn.'" '.$audioStr.' startHere="'.$s.'">';
70
71 $iq = "SELECT * FROM $itbl WHERE active = 1 AND aid = $id ORDER BY seq";
72 $ir = mysql_query($iq);
73
74 while ($irw = mysql_fetch_array($ir))
75 {
76 $sc = $irw['src'];
77 $cap = $irw['caption'];
78 $cap = str_replace("\n", '', $cap);
79 $output .= "\n\t\t".'<img src="'.$sc.'" caption="'.ent2ncr($cap).'" link="'.$irw['link'].'"'.$t_str.' />';
80 }
81 $output .= "\n\t".'</album>';
82 }
83
84 $output .= "\n".'</gallery>';
85 rizwank 1.1 echo $output;
86
87 /*
88 Many Thanks to Kaf Oseio
89 ent2ncr function from Entity2NCR Wordpress Plugin
90 http://guff.szub.net/2005/03/02/entity2ncr/
91 */
92
93 function ent2ncr($text) {
94 $to_ncr = array(
95 '"' => '"',
96 '&' => '&',
97 '⁄' => '/',
98 '<' => '<',
99 '>' => '>',
100 ' ' => ' ',
101 '¡' => '¡',
102 '¢' => '¢',
103 '£' => '£',
104 '¤' => '¤',
105 '¥' => '¥',
106 rizwank 1.1 '\|' => '¦',
107 '¦' => '¦',
108 '&brkbar;' => '¦',
109 '§' => '§',
110 '¨' => '¨',
111 '¨' => '¨',
112 '©' => '©',
113 'ª' => 'ª',
114 '«' => '«',
115 '¬' => '¬',
116 '­' => '­',
117 '®' => '®',
118 '¯' => '¯',
119 '&hibar;' => '¯',
120 '°' => '°',
121 '±' => '±',
122 '²' => '²',
123 '³' => '³',
124 '´' => '´',
125 'µ' => 'µ',
126 '¶' => '¶',
127 rizwank 1.1 '·' => '·',
128 '¸' => '¸',
129 '¹' => '¹',
130 'º' => 'º',
131 '»' => '»',
132 '¼' => '¼',
133 '½' => '½',
134 '¾' => '¾',
135 '¿' => '¿',
136 'À' => 'À',
137 'Á' => 'Á',
138 'Â' => 'Â',
139 'Ã' => 'Ã',
140 'Ä' => 'Ä',
141 'Å' => 'Å',
142 'Æ' => 'Æ',
143 'Ç' => 'Ç',
144 'È' => 'È',
145 'É' => 'É',
146 'Ê' => 'Ê',
147 'Ë' => 'Ë',
148 rizwank 1.1 'Ì' => 'Ì',
149 'Í' => 'Í',
150 'Î' => 'Î',
151 'Ï' => 'Ï',
152 'Ð' => 'Ð',
153 'Ñ' => 'Ñ',
154 'Ò' => 'Ò',
155 'Ó' => 'Ó',
156 'Ô' => 'Ô',
157 'Õ' => 'Õ',
158 'Ö' => 'Ö',
159 '×' => '×',
160 'Ø' => 'Ø',
161 'Ù' => 'Ù',
162 'Ú' => 'Ú',
163 'Û' => 'Û',
164 'Ü' => 'Ü',
165 'Ý' => 'Ý',
166 'Þ' => 'Þ',
167 'ß' => 'ß',
168 'à' => 'à',
169 rizwank 1.1 'á' => 'á',
170 'â' => 'â',
171 'ã' => 'ã',
172 'ä' => 'ä',
173 'å' => 'å',
174 'æ' => 'æ',
175 'ç' => 'ç',
176 'è' => 'è',
177 'é' => 'é',
178 'ê' => 'ê',
179 'ë' => 'ë',
180 'ì' => 'ì',
181 'í' => 'í',
182 'î' => 'î',
183 'ï' => 'ï',
184 'ð' => 'ð',
185 'ñ' => 'ñ',
186 'ò' => 'ò',
187 'ó' => 'ó',
188 'ô' => 'ô',
189 'õ' => 'õ',
190 rizwank 1.1 'ö' => 'ö',
191 '÷' => '÷',
192 'ø' => 'ø',
193 'ù' => 'ù',
194 'ú' => 'ú',
195 'û' => 'û',
196 'ü' => 'ü',
197 'ý' => 'ý',
198 'þ' => 'þ',
199 'ÿ' => 'ÿ',
200 'Œ' => 'Œ',
201 'œ' => 'œ',
202 'Š' => 'Š',
203 'š' => 'š',
204 'Ÿ' => 'Ÿ',
205 'ƒ' => 'ƒ',
206 'ˆ' => 'ˆ',
207 '˜' => '˜',
208 'Α' => 'Α',
209 'Β' => 'Β',
210 'Γ' => 'Γ',
211 rizwank 1.1 'Δ' => 'Δ',
212 'Ε' => 'Ε',
213 'Ζ' => 'Ζ',
214 'Η' => 'Η',
215 'Θ' => 'Θ',
216 'Ι' => 'Ι',
217 'Κ' => 'Κ',
218 'Λ' => 'Λ',
219 'Μ' => 'Μ',
220 'Ν' => 'Ν',
221 'Ξ' => 'Ξ',
222 'Ο' => 'Ο',
223 'Π' => 'Π',
224 'Ρ' => 'Ρ',
225 'Σ' => 'Σ',
226 'Τ' => 'Τ',
227 'Υ' => 'Υ',
228 'Φ' => 'Φ',
229 'Χ' => 'Χ',
230 'Ψ' => 'Ψ',
231 'Ω' => 'Ω',
232 rizwank 1.1 'α' => 'α',
233 'β' => 'β',
234 'γ' => 'γ',
235 'δ' => 'δ',
236 'ε' => 'ε',
237 'ζ' => 'ζ',
238 'η' => 'η',
239 'θ' => 'θ',
240 'ι' => 'ι',
241 'κ' => 'κ',
242 'λ' => 'λ',
243 'μ' => 'μ',
244 'ν' => 'ν',
245 'ξ' => 'ξ',
246 'ο' => 'ο',
247 'π' => 'π',
248 'ρ' => 'ρ',
249 'ς' => 'ς',
250 'σ' => 'σ',
251 'τ' => 'τ',
252 'υ' => 'υ',
253 rizwank 1.1 'φ' => 'φ',
254 'χ' => 'χ',
255 'ψ' => 'ψ',
256 'ω' => 'ω',
257 'ϑ' => 'ϑ',
258 'ϒ' => 'ϒ',
259 'ϖ' => 'ϖ',
260 ' ' => ' ',
261 ' ' => ' ',
262 ' ' => ' ',
263 '‌' => '‌',
264 '‍' => '‍',
265 '‎' => '‎',
266 '‏' => '‏',
267 '–' => '–',
268 '—' => '—',
269 '‘' => '‘',
270 '’' => '’',
271 '‚' => '‚',
272 '“' => '“',
273 '”' => '”',
274 rizwank 1.1 '„' => '„',
275 '†' => '†',
276 '‡' => '‡',
277 '•' => '•',
278 '…' => '…',
279 '‰' => '‰',
280 '′' => '′',
281 '″' => '″',
282 '‹' => '‹',
283 '›' => '›',
284 '‾' => '‾',
285 '⁄' => '⁄',
286 '€' => '€',
287 'ℑ' => 'ℑ',
288 '℘' => '℘',
289 'ℜ' => 'ℜ',
290 '™' => '™',
291 'ℵ' => 'ℵ',
292 '↵' => '↵',
293 '⇐' => '⇐',
294 '⇑' => '⇑',
295 rizwank 1.1 '⇒' => '⇒',
296 '⇓' => '⇓',
297 '⇔' => '⇔',
298 '∀' => '∀',
299 '∂' => '∂',
300 '∃' => '∃',
301 '∅' => '∅',
302 '∇' => '∇',
303 '∈' => '∈',
304 '∉' => '∉',
305 '∋' => '∋',
306 '∏' => '∏',
307 '∑' => '∑',
308 '−' => '−',
309 '∗' => '∗',
310 '√' => '√',
311 '∝' => '∝',
312 '∞' => '∞',
313 '∠' => '∠',
314 '∧' => '∧',
315 '∨' => '∨',
316 rizwank 1.1 '∩' => '∩',
317 '∪' => '∪',
318 '∫' => '∫',
319 '∴' => '∴',
320 '∼' => '∼',
321 '≅' => '≅',
322 '≈' => '≈',
323 '≠' => '≠',
324 '≡' => '≡',
325 '≤' => '≤',
326 '≥' => '≥',
327 '⊂' => '⊂',
328 '⊃' => '⊃',
329 '⊄' => '⊄',
330 '⊆' => '⊆',
331 '⊇' => '⊇',
332 '⊕' => '⊕',
333 '⊗' => '⊗',
334 '⊥' => '⊥',
335 '⋅' => '⋅',
336 '⌈' => '⌈',
337 rizwank 1.1 '⌉' => '⌉',
338 '⌊' => '⌊',
339 '⌋' => '⌋',
340 '⟨' => '〈',
341 '⟩' => '〉',
342 '←' => '←',
343 '↑' => '↑',
344 '→' => '→',
345 '↓' => '↓',
346 '↔' => '↔',
347 '◊' => '◊',
348 '♠' => '♠',
349 '♣' => '♣',
350 '♥' => '♥',
351 '♦' => '♦'
352 );
353
354 foreach ($to_ncr as $entity => $ncr) {
355 $text = preg_replace("/$entity/Us", $ncr, $text);
356 }
357 return $text;
358 rizwank 1.1 }
359 ?>
|