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 $sname = str_replace('www.', '', $sname);
9 $self = 'http://www.'.$sname.$_SERVER['PHP_SELF'];
10 $self = str_replace($adminDir.'/images.php', '', $self);
11 $output .= '<gallery>';
12
13 if (!ISSET($_GET['gid'])){
14 $q = "SELECT * FROM $atbl WHERE active = 1 ORDER BY displayOrder";
15 $r = mysql_query($q);
16 } else {
17 $gid = $_GET['gid'];
18 $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";
19 $r = mysql_query($q);
20 }
21
22 rizwank 1.1 while ($rw = mysql_fetch_array($r))
23 {
24 $id = $rw['id'];
25 $n = ent2ncr(htmlentities($rw['name']));
26 $des = $rw['description'];
27 $des = str_replace("\n", '', $des);
28 $d = ent2ncr(htmlentities($des));
29 $tn = $rw['tn'];
30 $tgt = $rw['target'];
31 $s = $rw['startHere'];
32 $p = $self.$adminDir.'/albums/'.$rw['path'].'/lg/';
33 $aMp3 = $self.$adminDir.'/album-audio/'.$rw['audioFile'];
34 $ac = $rw['audioCap'];
35 $ac = nl2br($ac);
36 $ac = str_replace("\n", '', $ac);
37 $ac = str_replace("\r", '', $ac);
38 $aCap = ent2ncr(htmlentities($ac));
39 $atn = $rw['aTn'];
40 $cArr = explode('http://', $atn);
41 if (count($cArr) == 1){
42 $atn = $self.$atn;
43 rizwank 1.1 }
44
45 if ($tn == 1)
46 {
47 $tn = $self.$adminDir.'/albums/'.$rw['path'].'/tn/';
48 }
49 else
50 {
51 $tn = '';
52 }
53
54 if ($tgt == 1)
55 $t_str = ' target="_self"';
56 else
57 $t_str = '';
58
59 if ($s == 1)
60 $s = 'true';
61 else
62 $s = '';
63
64 rizwank 1.1 if (!empty($rw['audioFile']))
65 $audioStr = 'audio="'.$aMp3.'"';
66 else
67 $audioStr = '';
68
69 if (!empty($rw['audioFile']) && !empty($aCap))
70 $audioStr .= ' audioCaption="'.$aCap.'"';
71
72 $output .= "\n\t".'<album id="'.$id.'" title="'.$n.'" description="'.$d.'" lgPath="'.$p.'" tnPath="'.$tn.'" tn="'.$atn.'" '.$audioStr.' startHere="'.$s.'">';
73
74 $iq = "SELECT * FROM $itbl WHERE active = 1 AND aid = $id ORDER BY seq";
75 $ir = mysql_query($iq);
76
77 while ($irw = mysql_fetch_array($ir))
78 {
79 $sc = $irw['src'];
80 $cap = $irw['caption'];
81 $cap = nl2br($cap);
82 $cap = str_replace("\n", '', $cap);
83 $cap = str_replace("\r", '', $cap);
84 $output .= "\n\t\t".'<img src="'.$sc.'" caption="'.ent2ncr($cap).'" link="'.$irw['link'].'"'.$t_str.' />';
85 rizwank 1.1 }
86 $output .= "\n\t".'</album>';
87 }
88
89 $output .= "\n".'</gallery>';
90 echo $output;
91
92 /*
93 Many Thanks to Kaf Oseio
94 ent2ncr function from Entity2NCR Wordpress Plugin
95 http://guff.szub.net/2005/03/02/entity2ncr/
96 */
97
98 function ent2ncr($text) {
99 $to_ncr = array(
100 '"' => '"',
101 '&' => '&',
102 '⁄' => '/',
103 '<' => '<',
104 '>' => '>',
105 ' ' => ' ',
106 rizwank 1.1 '¡' => '¡',
107 '¢' => '¢',
108 '£' => '£',
109 '¤' => '¤',
110 '¥' => '¥',
111 '\|' => '¦',
112 '¦' => '¦',
113 '&brkbar;' => '¦',
114 '§' => '§',
115 '¨' => '¨',
116 '¨' => '¨',
117 '©' => '©',
118 'ª' => 'ª',
119 '«' => '«',
120 '¬' => '¬',
121 '­' => '­',
122 '®' => '®',
123 '¯' => '¯',
124 '&hibar;' => '¯',
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 '♣' => '♣',
355 '♥' => '♥',
356 '♦' => '♦'
357 );
358 rizwank 1.1
359 foreach ($to_ncr as $entity => $ncr) {
360 $text = preg_replace("/$entity/Us", $ncr, $text);
361 }
362 return $text;
363 }
364 ?>
|