1 | <?php |
---|
2 | /* ----------------------------------------------------------------------------- |
---|
3 | Plugin : LMT |
---|
4 | Author : Grum |
---|
5 | email : grum@piwigo.org |
---|
6 | website : http://photos.grum.dnsalias.com |
---|
7 | |
---|
8 | << May the Little SpaceFrog be with you ! >> |
---|
9 | ------------------------------------------------------------------------------ |
---|
10 | See main.inc.php for release information |
---|
11 | |
---|
12 | LMT_AIP : classe to manage plugin admin pages |
---|
13 | |
---|
14 | --------------------------------------------------------------------------- */ |
---|
15 | |
---|
16 | include_once('lmt_root.class.inc.php'); |
---|
17 | include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/translate.class.inc.php'); |
---|
18 | include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/tables.class.inc.php'); |
---|
19 | include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/genericjs.class.inc.php'); |
---|
20 | include_once(PHPWG_PLUGINS_PATH.'grum_plugins_classes-2/pages_navigation.class.inc.php'); |
---|
21 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
22 | |
---|
23 | class LMT_AIP extends LMT_root |
---|
24 | { |
---|
25 | protected $google_translate; |
---|
26 | protected $tabsheet; |
---|
27 | |
---|
28 | public function LMT_AIP($prefixeTable, $filelocation) |
---|
29 | { |
---|
30 | parent::__construct($prefixeTable, $filelocation); |
---|
31 | $this->load_config(); |
---|
32 | $this->init_events(); |
---|
33 | |
---|
34 | $this->tabsheet = new tabsheet(); |
---|
35 | $this->tabsheet->add('list', |
---|
36 | l10n('lmt_list'), |
---|
37 | $this->page_link."&f_tabsheet=list"); |
---|
38 | $this->tabsheet->add('manage', |
---|
39 | l10n('lmt_manage'), |
---|
40 | $this->page_link."&f_tabsheet=manage"); |
---|
41 | $this->tabsheet->add('manageaut', |
---|
42 | l10n('lmt_manageaut'), |
---|
43 | $this->page_link."&f_tabsheet=manageaut"); |
---|
44 | $this->tabsheet->add('config', |
---|
45 | l10n('lmt_config'), |
---|
46 | $this->page_link."&f_tabsheet=config"); |
---|
47 | $this->tabsheet->add('help', |
---|
48 | l10n('lmt_help'), |
---|
49 | $this->page_link."&f_tabsheet=help"); |
---|
50 | |
---|
51 | // don't create this object inside root classe otherwise header is modified |
---|
52 | // everywhere in admin pages |
---|
53 | $this->ajax = new Ajax(); |
---|
54 | |
---|
55 | // don't create the google_translate object everytime, otherwise google's js |
---|
56 | // code is always included in the header even if translation functionalities |
---|
57 | // aren't needed |
---|
58 | // translation is needed only if we are in a ajax request |
---|
59 | /*if((isset($_POST['fmypolls_gomodify_translation'])||isset($_POST['fmypolls_goadd_translation']))) |
---|
60 | { |
---|
61 | $this->google_translate = new translate(); |
---|
62 | } |
---|
63 | */ |
---|
64 | } |
---|
65 | |
---|
66 | /* |
---|
67 | initialize events call for the plugin |
---|
68 | */ |
---|
69 | public function init_events() |
---|
70 | { |
---|
71 | parent::init_events(); |
---|
72 | add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS')); |
---|
73 | add_event_handler('loc_end_page_header', array(&$this->css_icn, 'apply_CSS')); |
---|
74 | } |
---|
75 | |
---|
76 | /* |
---|
77 | display administration page |
---|
78 | */ |
---|
79 | public function manage() |
---|
80 | { |
---|
81 | global $template; |
---|
82 | |
---|
83 | $this->return_ajax_content(); |
---|
84 | |
---|
85 | $template->set_filename('plugin_admin_content', dirname(__FILE__)."/admin/lmt_admin.tpl"); |
---|
86 | |
---|
87 | if(!isset($_REQUEST['f_tabsheet'])) |
---|
88 | { |
---|
89 | $_REQUEST['f_tabsheet']='list'; |
---|
90 | } |
---|
91 | |
---|
92 | switch($_REQUEST['f_tabsheet']) |
---|
93 | { |
---|
94 | case 'list': |
---|
95 | $this->display_list_page(); |
---|
96 | break; |
---|
97 | case 'manage': |
---|
98 | $this->display_manage_page(); |
---|
99 | break; |
---|
100 | case 'manageaut': |
---|
101 | $this->display_manageaut_page(); |
---|
102 | break; |
---|
103 | case 'managedoc': |
---|
104 | $this->display_managedoc_page(); |
---|
105 | break; |
---|
106 | case 'help': |
---|
107 | $this->display_help_page(); |
---|
108 | break; |
---|
109 | case 'config': |
---|
110 | $this->display_config_page(); |
---|
111 | break; |
---|
112 | } |
---|
113 | |
---|
114 | $this->tabsheet->select($_REQUEST['f_tabsheet']); |
---|
115 | $this->tabsheet->assign(); |
---|
116 | $selected_tab=$this->tabsheet->get_selected(); |
---|
117 | $template->assign($this->tabsheet->get_titlename(), "[".$selected_tab['caption']."]"); |
---|
118 | |
---|
119 | $template_plugin["LMT_VERSION"] = "<i>".$this->plugin_name."</i> ".l10n('lmt_release').LMT_VERSION; |
---|
120 | $template_plugin["LMT_PAGE"] = $_REQUEST['f_tabsheet']; |
---|
121 | $template_plugin["LMT_TITLE"] = ""; |
---|
122 | |
---|
123 | $template->assign('plugin', $template_plugin); |
---|
124 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
125 | } |
---|
126 | |
---|
127 | |
---|
128 | /* |
---|
129 | return ajax content |
---|
130 | */ |
---|
131 | protected function return_ajax_content() |
---|
132 | { |
---|
133 | global $ajax, $template; |
---|
134 | |
---|
135 | if(isset($_REQUEST['ajaxfct'])) |
---|
136 | { |
---|
137 | //$this->debug("AJAXFCT:".$_REQUEST['ajaxfct']); |
---|
138 | $result="<p class='errors'>An error has occured</p>"; |
---|
139 | switch($_REQUEST['ajaxfct']) |
---|
140 | { |
---|
141 | case 'img_list': |
---|
142 | $result=$this->ajax_img_list($_REQUEST['numpage']); |
---|
143 | break; |
---|
144 | case 'manage_list': |
---|
145 | $result=$this->ajax_manage_list($_REQUEST['numpage']); |
---|
146 | break; |
---|
147 | } |
---|
148 | //$template-> |
---|
149 | $this->ajax->return_result($result); |
---|
150 | } |
---|
151 | } |
---|
152 | |
---|
153 | |
---|
154 | /* |
---|
155 | manage display of config page & save config |
---|
156 | */ |
---|
157 | protected function display_config_page() |
---|
158 | { |
---|
159 | $languages=get_languages(); |
---|
160 | if(!$this->adviser_abort()) |
---|
161 | { |
---|
162 | |
---|
163 | if(isset($_POST['submit_save_config'])) |
---|
164 | { |
---|
165 | foreach($this->my_config as $key => $val) |
---|
166 | { |
---|
167 | if(is_array($val)) |
---|
168 | { |
---|
169 | foreach($languages as $key2 => $val2) |
---|
170 | { |
---|
171 | if(isset($_REQUEST[str2url('f_'.$key.'_'.$key2)])) |
---|
172 | { |
---|
173 | $this->my_config[$key][$key2] = htmlspecialchars(stripslashes($_REQUEST[str2url('f_'.$key.'_'.$key2)]), ENT_QUOTES); |
---|
174 | } |
---|
175 | } |
---|
176 | } |
---|
177 | else |
---|
178 | { |
---|
179 | if(isset($_REQUEST['f_'.$key])) |
---|
180 | { |
---|
181 | $this->my_config[$key] = $_REQUEST['f_'.$key]; |
---|
182 | } |
---|
183 | } |
---|
184 | |
---|
185 | } |
---|
186 | $this->display_result(l10n('lmt_save_config'), $this->save_config()); |
---|
187 | } |
---|
188 | } |
---|
189 | $this->display_config(); |
---|
190 | } |
---|
191 | |
---|
192 | |
---|
193 | /* |
---|
194 | |
---|
195 | */ |
---|
196 | protected function display_help_page() |
---|
197 | { |
---|
198 | global $template; |
---|
199 | |
---|
200 | $template->set_filename('body_page', |
---|
201 | dirname($this->filelocation).'/admin/plugin_admin_help.tpl'); |
---|
202 | |
---|
203 | $template->assign('imgdir', LMT_PATH."img/"); |
---|
204 | |
---|
205 | $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); |
---|
206 | } |
---|
207 | |
---|
208 | /* |
---|
209 | */ |
---|
210 | protected function display_list_page() |
---|
211 | { |
---|
212 | global $template, $conf, $user; |
---|
213 | |
---|
214 | $template->set_filename('body_page', |
---|
215 | dirname($this->filelocation).'/admin/plugin_admin_list.tpl'); |
---|
216 | |
---|
217 | if(!isset($_REQUEST['filter']) || |
---|
218 | !($_REQUEST['filter']=="BY" || |
---|
219 | $_REQUEST['filter']=="BY-SA" || |
---|
220 | $_REQUEST['filter']=="BY-ND" || |
---|
221 | $_REQUEST['filter']=="BY-NC-ND" || |
---|
222 | $_REQUEST['filter']=="BY-NC-SA" || |
---|
223 | $_REQUEST['filter']=="BY-NC" || |
---|
224 | $_REQUEST['filter']=="CRIGHT" || |
---|
225 | $_REQUEST['filter']=="CLEFT" |
---|
226 | )) |
---|
227 | { |
---|
228 | $_REQUEST['filter']=''; |
---|
229 | } |
---|
230 | |
---|
231 | $datas=array( |
---|
232 | "LMT_AJAX_URL_LIST" => $this->page_link.'&ajaxfct=img_list&numpage=' |
---|
233 | ); |
---|
234 | |
---|
235 | $filter_list_selected = ''; |
---|
236 | $filter_list_values = array_slice($this->licences,0,count($this->licences)-1); |
---|
237 | $filter_list_labels = array(); |
---|
238 | foreach($filter_list_values as $key=>$val) |
---|
239 | { |
---|
240 | $filter_list_labels[] = "[".l10n("lmt_lbl_cc_s-".strtolower($val))."] ".l10n("lmt_lbl_cc-".strtolower($val)); |
---|
241 | if($val==$_REQUEST['filter']) |
---|
242 | { |
---|
243 | $filter_list_selected = $val; |
---|
244 | } |
---|
245 | } |
---|
246 | |
---|
247 | $filter_list_values = array_merge(array(''), $filter_list_values); |
---|
248 | $filter_list_labels = array_merge(array(l10n('lmt_nofilter')), $filter_list_labels); |
---|
249 | $default_licence = l10n("lmt_lbl_cc-".strtolower($this->my_config['lmt_licence_default'])); |
---|
250 | $default_licence_img =LMT_PATH."img/".strtolower($this->my_config['lmt_licence_default'])."_80x15.png"; |
---|
251 | |
---|
252 | $results=true; |
---|
253 | if(isset($_POST["submit_replace_caddie"])) |
---|
254 | { |
---|
255 | $sql="DELETE FROM ".CADDIE_TABLE." WHERE user_id='".$user['id']."'"; |
---|
256 | $result=pwg_query($sql); |
---|
257 | ($result)?$results=true:$results=false; |
---|
258 | } |
---|
259 | |
---|
260 | if(isset($_POST["submit_add_to_caddie"]) || isset($_POST["submit_replace_caddie"])) |
---|
261 | { |
---|
262 | |
---|
263 | $sql="REPLACE INTO ".CADDIE_TABLE." |
---|
264 | SELECT '".$user['id']."', it.id FROM ".IMAGES_TABLE." it, ".$this->tables["images"]." lmti |
---|
265 | WHERE it.id = lmti.image_id"; |
---|
266 | if($_REQUEST['filter']!="") |
---|
267 | { |
---|
268 | $sql.=" AND lmti.licence_type='".$_REQUEST['filter']."'"; |
---|
269 | } |
---|
270 | |
---|
271 | $result=pwg_query($sql); |
---|
272 | if((!$results)||(!$result)) |
---|
273 | { |
---|
274 | $this->display_result(l10n("lmt_caddie_not_updated"), false); |
---|
275 | } |
---|
276 | else |
---|
277 | { |
---|
278 | $this->display_result(l10n("lmt_caddie_updated"), true); |
---|
279 | } |
---|
280 | } |
---|
281 | |
---|
282 | $template->assign('datas', $datas); |
---|
283 | $template->assign('default_licence', $default_licence); |
---|
284 | $template->assign('default_licence_img', $default_licence_img); |
---|
285 | $template->assign('filter_list_values', $filter_list_values); |
---|
286 | $template->assign('filter_list_labels', $filter_list_labels); |
---|
287 | $template->assign('filter_list_selected', $filter_list_selected); |
---|
288 | $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); |
---|
289 | } |
---|
290 | |
---|
291 | |
---|
292 | /* |
---|
293 | */ |
---|
294 | protected function display_manage_page() |
---|
295 | { |
---|
296 | global $template, $conf, $user; |
---|
297 | |
---|
298 | /* |
---|
299 | apply licence |
---|
300 | */ |
---|
301 | if(isset($_POST['submit_apply_licence'])) |
---|
302 | { |
---|
303 | $results=array("", ""); |
---|
304 | $lst=array(); |
---|
305 | foreach($_POST as $key => $val) |
---|
306 | { |
---|
307 | if((substr($key,0,2)=="fn")&&($val=="1")) $lst[]=substr($key,2); |
---|
308 | } |
---|
309 | |
---|
310 | if(count($lst)>0) |
---|
311 | { |
---|
312 | if($_POST['manage_caddie']!="napp_clear_selected") |
---|
313 | { |
---|
314 | if($_POST['licence']=='DEFAULT') |
---|
315 | { |
---|
316 | $sql="DELETE FROM ".$this->tables['images']." |
---|
317 | WHERE image_id IN (".implode(",", $lst).")"; |
---|
318 | } |
---|
319 | else |
---|
320 | { |
---|
321 | $sql="REPLACE INTO ".$this->tables['images']." |
---|
322 | SELECT id, '".$_POST['licence']."', '".$_POST['author']."' |
---|
323 | FROM ".IMAGES_TABLE." |
---|
324 | WHERE id IN (".implode(",", $lst).")"; |
---|
325 | } |
---|
326 | $result=pwg_query($sql); |
---|
327 | ($result)?$results[0].=l10n("lmt_add_licence_ok")."<br/>":$results[1].=l10n("lmt_add_licence_ko")."<br/>"; |
---|
328 | } |
---|
329 | |
---|
330 | switch($_POST['manage_caddie']) |
---|
331 | { |
---|
332 | case 'app_clear': |
---|
333 | $sql="DELETE FROM ".CADDIE_TABLE." WHERE user_id = '".$user['id']."'"; |
---|
334 | $result=pwg_query($sql); |
---|
335 | ($result)?$results[0].=l10n("lmt_clear_caddie_ok")."<br/>":$results[1].=l10n("lmt_clear_caddie_ko")."<br/>"; |
---|
336 | break; |
---|
337 | case 'app_clear_selected': |
---|
338 | case 'napp_clear_selected': |
---|
339 | $sql="DELETE FROM ".CADDIE_TABLE." |
---|
340 | WHERE user_id = '".$user['id']."' |
---|
341 | AND element_id IN (".implode(",", $lst).")"; |
---|
342 | $result=pwg_query($sql); |
---|
343 | ($result)?$results[0].=l10n("lmt_clear_si_caddie_ok")."<br/>":$results[1].=l10n("lmt_clear_si_caddie_ko")."<br/>"; |
---|
344 | break; |
---|
345 | } |
---|
346 | |
---|
347 | if($results[0]!="") |
---|
348 | { |
---|
349 | $this->display_result($results[0], true); |
---|
350 | } |
---|
351 | |
---|
352 | if($results[1]!="") |
---|
353 | { |
---|
354 | $this->display_result($results[1], false); |
---|
355 | } |
---|
356 | } |
---|
357 | else |
---|
358 | { |
---|
359 | $this->display_result(l10n("lmt_no_element_selected"), false); |
---|
360 | } |
---|
361 | } |
---|
362 | |
---|
363 | |
---|
364 | $template->set_filename('body_page', |
---|
365 | dirname($this->filelocation).'/admin/plugin_admin_manage.tpl'); |
---|
366 | |
---|
367 | $datas=array( |
---|
368 | "LMT_AJAX_URL_LIST" => $this->page_link.'&ajaxfct=manage_list&numpage=' |
---|
369 | ); |
---|
370 | |
---|
371 | if(!isset($_REQUEST['select'])) |
---|
372 | { |
---|
373 | $_REQUEST['select']="caddie"; |
---|
374 | } |
---|
375 | |
---|
376 | $sql="SELECT count(element_id) FROM ".CADDIE_TABLE." WHERE user_id = '".$user['id']."'"; |
---|
377 | $result=pwg_query($sql); |
---|
378 | $nbphotos=mysql_fetch_array($result); |
---|
379 | |
---|
380 | $author_list_values = array(0); |
---|
381 | $author_list_labels = array(l10n("lmt_no_author")); |
---|
382 | $sql="SELECT * FROM ".$this->tables["licence_author"]." ORDER BY id"; |
---|
383 | $result=pwg_query($sql); |
---|
384 | if($result) |
---|
385 | { |
---|
386 | while($row=mysql_fetch_array($result)) |
---|
387 | { |
---|
388 | $author_list_values[]=$row['id']; |
---|
389 | $author_list_labels[]=$row['text1']." ".$row['text2']; |
---|
390 | } |
---|
391 | } |
---|
392 | |
---|
393 | $licences_list_values = array(); |
---|
394 | $licences_list_values = $this->licences; |
---|
395 | $licences_list_labels = array(); |
---|
396 | foreach($licences_list_values as $key=>$val) |
---|
397 | { |
---|
398 | $licences_list_labels[] = "[".l10n("lmt_lbl_cc_s-".strtolower($val))."] ".l10n("lmt_lbl_cc-".strtolower($val)); |
---|
399 | } |
---|
400 | |
---|
401 | /* $licences_list_values = array_merge(array('DEFAULT'), $licences_list_values); |
---|
402 | $licences_list_labels = array_merge(array(l10n('lmt_bydefault')), $licences_list_labels);*/ |
---|
403 | |
---|
404 | $selectlist_list_values=array("-", "all", "none", "invert"); |
---|
405 | $selectlist_list_values=array_merge($selectlist_list_values, $licences_list_values); |
---|
406 | |
---|
407 | $selectlist_list_labels=array( |
---|
408 | l10n("lmt_choose_select"), |
---|
409 | l10n("lmt_select_all"), |
---|
410 | l10n("lmt_select_none"), |
---|
411 | l10n("lmt_select_invert") |
---|
412 | ); |
---|
413 | $selectlist_list_labels=array_merge($selectlist_list_labels, $licences_list_labels); |
---|
414 | |
---|
415 | $template->assign('datas', $datas); |
---|
416 | $template->assign('nbphotos', $nbphotos[0]); |
---|
417 | $template->assign('selectlist_list_values', $selectlist_list_values); |
---|
418 | $template->assign('selectlist_list_labels', $selectlist_list_labels); |
---|
419 | $template->assign('filter_list_selected', ""); |
---|
420 | $template->assign('licences_list_values', $licences_list_values); |
---|
421 | $template->assign('licences_list_labels', $licences_list_labels); |
---|
422 | $template->assign('licences_list_selected', ""); |
---|
423 | $template->assign('author_list_values', $author_list_values); |
---|
424 | $template->assign('author_list_labels', $author_list_labels); |
---|
425 | $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); |
---|
426 | } |
---|
427 | |
---|
428 | |
---|
429 | /* |
---|
430 | display config page |
---|
431 | */ |
---|
432 | protected function display_config() |
---|
433 | { |
---|
434 | global $template, $lang; |
---|
435 | |
---|
436 | $template->set_filename('body_page', |
---|
437 | dirname($this->filelocation).'/admin/plugin_admin_config.tpl'); |
---|
438 | |
---|
439 | |
---|
440 | $datas=array( |
---|
441 | "img_directory" => LMT_PATH."img/" |
---|
442 | ); |
---|
443 | foreach($this->my_config as $key => $val) |
---|
444 | { |
---|
445 | if(!is_array($val)) |
---|
446 | { |
---|
447 | $datas[$key]=$val; |
---|
448 | } |
---|
449 | } |
---|
450 | |
---|
451 | $lmt_yesno_values=array("y", "n"); |
---|
452 | $lmt_yesno_labels=array(l10n("lmt_yesno_y"), l10n("lmt_yesno_n")); |
---|
453 | |
---|
454 | $lmt_licence_logo_values=array("80x15", "88x31", "text"); |
---|
455 | $lmt_licence_logo_labels=array(l10n("lmt_icon_80x15"), l10n("lmt_icon_88x31"), l10n("lmt_icon_text")); |
---|
456 | |
---|
457 | $datas['lmt_redirect_urls']=array(); |
---|
458 | $lmt_licence_default_values = array_slice($this->licences,0,count($this->licences)-1); |
---|
459 | $lmt_licence_default_labels = array(); |
---|
460 | |
---|
461 | $tmp=array(); |
---|
462 | foreach($lmt_licence_default_values as $key=>$val) |
---|
463 | { |
---|
464 | $lmt_licence_default_labels[] = "[".l10n("lmt_lbl_cc_s-".strtolower($val))."] ".l10n("lmt_lbl_cc-".strtolower($val)); |
---|
465 | |
---|
466 | $tmp[]="'".str2url("ilmt_redirect_url-".strToLower($val))."'"; |
---|
467 | $datas['lmt_redirect_urls'][str2url('lmt_redirect_url-'.strToLower($val))]=array( |
---|
468 | 'text' => l10n("lmt_lbl_cc_s-".strToLower($val)), |
---|
469 | 'langs' => array() |
---|
470 | ); |
---|
471 | } |
---|
472 | $datas['objnames2'] = implode(",", $tmp); |
---|
473 | |
---|
474 | |
---|
475 | //langs list & texts |
---|
476 | $datas['lmt_warning_texts']=array(); |
---|
477 | |
---|
478 | $lmt_language_list=array(); |
---|
479 | $lmt_language_list_values=array(); |
---|
480 | $lmt_language_list_labels=array(); |
---|
481 | $lmt_language_selected=str2url(get_default_language()); |
---|
482 | $languages=get_languages(); |
---|
483 | |
---|
484 | foreach($languages as $key => $val) |
---|
485 | { |
---|
486 | $lmt_language_list_values[]=str2url($key); |
---|
487 | $lmt_language_list_labels[]=$val; |
---|
488 | |
---|
489 | $datas['lmt_warning_texts'][]=array( |
---|
490 | 'lang' => str2url($key), |
---|
491 | 'text' => $this->my_config['lmt_warning_texts'][$key] |
---|
492 | ); |
---|
493 | |
---|
494 | foreach($lmt_licence_default_values as $key2 => $val2) |
---|
495 | { |
---|
496 | $datas['lmt_redirect_urls'][str2url('lmt_redirect_url-'.strToLower($val2))]['langs'][str2url($key)]= |
---|
497 | $this->my_config['lmt_redirect_url-'.strToLower($val2)][$key]; |
---|
498 | } |
---|
499 | } |
---|
500 | |
---|
501 | $datas['help']=array(); |
---|
502 | foreach($lang["lmt_help_config"] as $key => $val) |
---|
503 | { |
---|
504 | $datas['help']['hlp'.$key]=addslashes($val); |
---|
505 | } |
---|
506 | |
---|
507 | $lmt_licence_default_author_values=array(0); |
---|
508 | $lmt_licence_default_author_labels=array(l10n("lmt_no_author")); |
---|
509 | $sql="SELECT * FROM ".$this->tables['licence_author']." ORDER BY id"; |
---|
510 | $result=pwg_query($sql); |
---|
511 | if($result) |
---|
512 | { |
---|
513 | while($row=mysql_fetch_array($result)) |
---|
514 | { |
---|
515 | $lmt_licence_default_author_values[]=$row['id']; |
---|
516 | $lmt_licence_default_author_labels[]=$row['text1']." ".$row['text2']; |
---|
517 | } |
---|
518 | } |
---|
519 | |
---|
520 | $template->assign('datas', $datas); |
---|
521 | $template->assign('extended_code', $this->generate_js_licence_author()); |
---|
522 | $template->assign('lmt_yesno_values', $lmt_yesno_values); |
---|
523 | $template->assign('lmt_yesno_labels', $lmt_yesno_labels); |
---|
524 | $template->assign('lmt_licence_logo_values', $lmt_licence_logo_values); |
---|
525 | $template->assign('lmt_licence_logo_labels', $lmt_licence_logo_labels); |
---|
526 | $template->assign('lmt_licence_default_values', $lmt_licence_default_values); |
---|
527 | $template->assign('lmt_licence_default_labels', $lmt_licence_default_labels); |
---|
528 | $template->assign('lmt_licence_default_author_values', $lmt_licence_default_author_values); |
---|
529 | $template->assign('lmt_licence_default_author_labels', $lmt_licence_default_author_labels); |
---|
530 | $template->assign('lmt_language_list_values', $lmt_language_list_values); |
---|
531 | $template->assign('lmt_language_list_labels', $lmt_language_list_labels); |
---|
532 | $template->assign('lmt_language_selected', $lmt_language_selected); |
---|
533 | $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); |
---|
534 | |
---|
535 | } //display_config |
---|
536 | |
---|
537 | |
---|
538 | |
---|
539 | |
---|
540 | /* |
---|
541 | */ |
---|
542 | protected function display_manageaut_page() |
---|
543 | { |
---|
544 | global $template, $conf, $user; |
---|
545 | |
---|
546 | if(!isset($_REQUEST['action'])) |
---|
547 | { |
---|
548 | $_REQUEST['action']="list"; |
---|
549 | } |
---|
550 | if(!isset($_REQUEST['id'])) |
---|
551 | { |
---|
552 | $_REQUEST['id']=""; |
---|
553 | } |
---|
554 | |
---|
555 | |
---|
556 | /* ------------------------------------------------------------------------ |
---|
557 | * Add an author |
---|
558 | * ---------------------------------------------------------------------- */ |
---|
559 | if(isset($_POST['submit_add_author'])) |
---|
560 | { |
---|
561 | if($_POST["text1"]!="") |
---|
562 | { |
---|
563 | $sql="INSERT INTO ".$this->tables["licence_author"]." VALUES('', '". addslashes($_POST["text1"])."', '".addslashes($_POST["text2"])."')"; |
---|
564 | $result=pwg_query($sql); |
---|
565 | if($result) |
---|
566 | { |
---|
567 | $this->display_result(l10n("lmt_author_added"), true); |
---|
568 | $_REQUEST['action']="list"; |
---|
569 | } |
---|
570 | else |
---|
571 | { |
---|
572 | $this->display_result(l10n("lmt_cannot_add_author"), false); |
---|
573 | } |
---|
574 | } |
---|
575 | else |
---|
576 | { |
---|
577 | $this->display_result(l10n("lmt_no_text"), false); |
---|
578 | } |
---|
579 | } |
---|
580 | |
---|
581 | /* ------------------------------------------------------------------------ |
---|
582 | * Modify an author |
---|
583 | * ---------------------------------------------------------------------- */ |
---|
584 | if(isset($_POST['submit_modify_author'])) |
---|
585 | { |
---|
586 | if($_POST["text1"]!="") |
---|
587 | { |
---|
588 | $sql="UPDATE ".$this->tables["licence_author"]." |
---|
589 | SET text1 = '". addslashes($_POST["text1"])."', |
---|
590 | text2 = '".addslashes($_POST["text2"])."' |
---|
591 | WHERE id = '".$_POST["id"]."'"; |
---|
592 | $result=pwg_query($sql); |
---|
593 | if($result) |
---|
594 | { |
---|
595 | $this->display_result(l10n("lmt_author_modified"), true); |
---|
596 | $_REQUEST['action']="list"; |
---|
597 | } |
---|
598 | else |
---|
599 | { |
---|
600 | $this->display_result(l10n("lmt_cannot_modify_author"), false); |
---|
601 | } |
---|
602 | } |
---|
603 | else |
---|
604 | { |
---|
605 | $this->display_result(l10n("lmt_no_text"), false); |
---|
606 | } |
---|
607 | } |
---|
608 | |
---|
609 | /* ------------------------------------------------------------------------ |
---|
610 | * delete an author |
---|
611 | * ---------------------------------------------------------------------- */ |
---|
612 | if($_REQUEST['action']=="delete") |
---|
613 | { |
---|
614 | $sql="DELETE FROM ".$this->tables['licence_author']." WHERE id = '".$_REQUEST['id']."'"; |
---|
615 | $result=pwg_query($sql); |
---|
616 | if($result) |
---|
617 | { |
---|
618 | if(mysql_affected_rows()==1) |
---|
619 | { |
---|
620 | $this->display_result(l10n("lmt_author_deleted"), true); |
---|
621 | |
---|
622 | $sql="UPDATE ".$this->tables["images"]." SET author_id = NULL |
---|
623 | WHERE author_id = '".$_REQUEST['id']."'"; |
---|
624 | $result=pwg_query($sql); |
---|
625 | if($result) |
---|
626 | { |
---|
627 | $nbimages=mysql_affected_rows(); |
---|
628 | if($nbimages>0) |
---|
629 | { |
---|
630 | $this->display_result($nbimages." ".l10n("lmt_author_nb_images_updated"), true); |
---|
631 | } |
---|
632 | } |
---|
633 | else |
---|
634 | { |
---|
635 | $this->display_result(l10n("lmt_cannot_delete_author"), false); |
---|
636 | } |
---|
637 | } |
---|
638 | else |
---|
639 | { |
---|
640 | $this->display_result(l10n("lmt_cannot_delete_author"), false); |
---|
641 | } |
---|
642 | } |
---|
643 | else |
---|
644 | { |
---|
645 | $this->display_result(l10n("lmt_cannot_delete_author"), false); |
---|
646 | } |
---|
647 | $this->display_manageaut_page_list(); |
---|
648 | } |
---|
649 | elseif($_REQUEST['action']=="add") |
---|
650 | { |
---|
651 | $this->display_manageaut_page_add_modify("add"); |
---|
652 | } |
---|
653 | elseif($_REQUEST['action']=="edit") |
---|
654 | { |
---|
655 | $this->display_manageaut_page_add_modify("edit"); |
---|
656 | } |
---|
657 | else |
---|
658 | { |
---|
659 | // list |
---|
660 | $this->display_manageaut_page_list(); |
---|
661 | } |
---|
662 | } //display_manageaut |
---|
663 | |
---|
664 | protected function display_manageaut_page_list() |
---|
665 | { |
---|
666 | global $template; |
---|
667 | |
---|
668 | $template->set_filename('body_page', |
---|
669 | dirname($this->filelocation).'/admin/plugin_admin_manageaut.tpl'); |
---|
670 | |
---|
671 | $datas=array( |
---|
672 | "author_list" => array(), |
---|
673 | "img_directory" => LMT_PATH."img/", |
---|
674 | "default_licencepublished" => l10n("lmt_lbl_under-".strToLower($this->my_config['lmt_licence_default'])), |
---|
675 | "default_licenceL" => strToLower($this->my_config['lmt_licence_default']), |
---|
676 | "default_licenceU" => l10n("lmt_lbl_cc_s-".strToLower($this->my_config['lmt_licence_default'])), |
---|
677 | "lmt_licence_logo" => $this->my_config['lmt_licence_logo'], |
---|
678 | "nbauthor" => 0, |
---|
679 | "add_link" => $this->page_link.'&f_tabsheet=manageaut&action=add' |
---|
680 | ); |
---|
681 | |
---|
682 | $sql="SELECT * FROM ".$this->tables['licence_author']." ORDER BY id"; |
---|
683 | $result=pwg_query($sql); |
---|
684 | if($result) |
---|
685 | { |
---|
686 | while($row=mysql_fetch_array($result)) |
---|
687 | { |
---|
688 | $datas["author_list"][]=array( |
---|
689 | "id" => $row['id'], |
---|
690 | "text1" => $row['text1'], |
---|
691 | "text2" => $row['text2'], |
---|
692 | "lnk_delete" => $this->page_link.'&f_tabsheet=manageaut&action=delete&id='.$row['id'], |
---|
693 | "lnk_edit" => $this->page_link.'&f_tabsheet=manageaut&action=edit&id='.$row['id'] |
---|
694 | ); |
---|
695 | } |
---|
696 | $datas["nbauthor"] = count($datas["author_list"]); |
---|
697 | } |
---|
698 | |
---|
699 | $template->assign('datas', $datas); |
---|
700 | //$template->assign('extended_code', $this->generate_js_licence_author()); |
---|
701 | $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); |
---|
702 | } |
---|
703 | |
---|
704 | protected function display_manageaut_page_add_modify() |
---|
705 | { |
---|
706 | global $template; |
---|
707 | |
---|
708 | $template->set_filename('body_page', |
---|
709 | dirname($this->filelocation).'/admin/plugin_admin_manageaut_edit.tpl'); |
---|
710 | |
---|
711 | if($_REQUEST["action"]=="edit") |
---|
712 | { |
---|
713 | $sql="SELECT * FROM ".$this->tables['licence_author']." WHERE id = '".$_REQUEST['id']."'"; |
---|
714 | $result = pwg_query($sql); |
---|
715 | if($result) |
---|
716 | { |
---|
717 | while($row=mysql_fetch_array($result)) |
---|
718 | { |
---|
719 | $datas=array( |
---|
720 | "action" => "modify", |
---|
721 | "id" => $_REQUEST['id'], |
---|
722 | "text1" => $row["text1"], |
---|
723 | "text2" => $row["text2"] |
---|
724 | ); |
---|
725 | } |
---|
726 | } |
---|
727 | else |
---|
728 | { |
---|
729 | $datas=array( |
---|
730 | "action" => "add", |
---|
731 | "id" => "", |
---|
732 | "text1" => "", |
---|
733 | "text2" => "", |
---|
734 | ); |
---|
735 | } |
---|
736 | } |
---|
737 | else |
---|
738 | { |
---|
739 | $datas=array( |
---|
740 | "action" => "add", |
---|
741 | "id" => "", |
---|
742 | "text1" => "", |
---|
743 | "text2" => "", |
---|
744 | ); |
---|
745 | } |
---|
746 | |
---|
747 | $datas["urllist"] = $this->page_link.'&f_tabsheet=manageaut'; |
---|
748 | |
---|
749 | $template->assign('datas', $datas); |
---|
750 | //$template->assign('extended_code', $this->generate_js_licence_author()); |
---|
751 | $template->assign_var_from_handle('LMT_BODY_PAGE', 'body_page'); |
---|
752 | } |
---|
753 | |
---|
754 | |
---|
755 | /* |
---|
756 | manage adviser profile |
---|
757 | return true if user is adviser |
---|
758 | */ |
---|
759 | protected function adviser_abort() |
---|
760 | { |
---|
761 | if(is_adviser()) |
---|
762 | { |
---|
763 | $this->display_result(l10n("lmt_adviser_not_allowed"), false); |
---|
764 | return(true); |
---|
765 | } |
---|
766 | return(false); |
---|
767 | } |
---|
768 | |
---|
769 | |
---|
770 | /* |
---|
771 | this function return a js to manage licence text |
---|
772 | */ |
---|
773 | protected function generate_js_licence_author() |
---|
774 | { |
---|
775 | $local_tpl = new Template(LMT_PATH."admin/", ""); |
---|
776 | $local_tpl->set_filename('body_page', |
---|
777 | dirname($this->filelocation).'/admin/lmt_js.tpl'); |
---|
778 | |
---|
779 | $lmt_licence_default_values=array_slice($this->licences,0,count($this->licences)-1); |
---|
780 | $datas['shortlicencetext']=array(); |
---|
781 | foreach($lmt_licence_default_values as $key=>$val) |
---|
782 | { |
---|
783 | $datas['shortlicencetext'][$val] = array( |
---|
784 | "txt" => l10n("lmt_lbl_cc_s-".strtolower($val)), |
---|
785 | "published" => l10n("lmt_lbl_under-".strtolower($val)) |
---|
786 | ); |
---|
787 | } |
---|
788 | |
---|
789 | $local_tpl->assign("datas",$datas); |
---|
790 | |
---|
791 | return($local_tpl->parse('body_page', true)); |
---|
792 | } |
---|
793 | |
---|
794 | protected function make_image_data($tmp) |
---|
795 | { |
---|
796 | $tmp2=array(); |
---|
797 | for($i=0;$i<count($tmp['id']);$i++) |
---|
798 | { |
---|
799 | $tmp2[]=array( |
---|
800 | 'id' => $tmp['id'][$i], |
---|
801 | 'name' => $tmp['name'][$i], |
---|
802 | 'type' => $tmp['type'][$i], |
---|
803 | 'plinks' => $tmp['plinks'][$i], |
---|
804 | 'link'=> make_index_url( |
---|
805 | array( |
---|
806 | 'category' => array( |
---|
807 | 'id' => $tmp['id'][$i], |
---|
808 | 'name' => $tmp['name'][$i], |
---|
809 | 'permalink' => $tmp['plinks'][$i]) |
---|
810 | ) |
---|
811 | ) |
---|
812 | ); |
---|
813 | } |
---|
814 | return($tmp2); |
---|
815 | } |
---|
816 | |
---|
817 | /* --------------------------------------------------------------------------- |
---|
818 | function to manage database manipulation |
---|
819 | --------------------------------------------------------------------------- */ |
---|
820 | |
---|
821 | |
---|
822 | |
---|
823 | |
---|
824 | |
---|
825 | /* --------------------------------------------------------------------------- |
---|
826 | ajax functions |
---|
827 | --------------------------------------------------------------------------- */ |
---|
828 | |
---|
829 | protected function ajax_img_list($pagenum) |
---|
830 | { |
---|
831 | global $conf; |
---|
832 | |
---|
833 | $local_tpl = new Template(LMT_PATH."admin/", ""); |
---|
834 | $local_tpl->set_filename('body_page', |
---|
835 | dirname($this->filelocation).'/admin/plugin_admin_listitems.tpl'); |
---|
836 | |
---|
837 | if(!isset($_REQUEST['filter']) || |
---|
838 | !($_REQUEST['filter']=="BY" || |
---|
839 | $_REQUEST['filter']=="BY-SA" || |
---|
840 | $_REQUEST['filter']=="BY-ND" || |
---|
841 | $_REQUEST['filter']=="BY-NC-ND" || |
---|
842 | $_REQUEST['filter']=="BY-NC-SA" || |
---|
843 | $_REQUEST['filter']=="BY-NC" || |
---|
844 | $_REQUEST['filter']=="CRIGHT" || |
---|
845 | $_REQUEST['filter']=="CLEFT" |
---|
846 | )) |
---|
847 | { |
---|
848 | $_REQUEST['filter']=''; |
---|
849 | } |
---|
850 | |
---|
851 | $img_ids=array(); |
---|
852 | $img_liste = array(); |
---|
853 | $sql="SELECT SQL_CALC_FOUND_ROWS lmti.*, img.file, img.path, img.tn_ext, |
---|
854 | GROUP_CONCAT(cat.id) AS catid, |
---|
855 | GROUP_CONCAT(CASE WHEN cat.name IS NULL THEN '' ELSE cat.name END SEPARATOR '@sep@') AS catname, |
---|
856 | GROUP_CONCAT(CASE WHEN cat.permalink IS NULL THEN '' ELSE cat.permalink END SEPARATOR '@sep@') AS catpermalink, |
---|
857 | GROUP_CONCAT(CASE WHEN cat.dir IS NULL THEN 'V' ELSE 'P' END) AS cattype, |
---|
858 | lmtla.text1, lmtla.text2 |
---|
859 | FROM ".$this->tables["images"]." lmti |
---|
860 | LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla ON lmtla.id = lmti.author_id, |
---|
861 | ".IMAGES_TABLE." img |
---|
862 | LEFT OUTER JOIN ".IMAGE_CATEGORY_TABLE." imgcat ON img.id = imgcat.image_id |
---|
863 | LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON imgcat.category_id = cat.id |
---|
864 | WHERE lmti.image_id = img.id "; |
---|
865 | if($_REQUEST['filter']!="") |
---|
866 | { |
---|
867 | $sql.=" AND lmti.licence_type='".$_REQUEST['filter']."'"; |
---|
868 | } |
---|
869 | |
---|
870 | $sql.=" GROUP BY lmti.image_id ORDER BY cat.id, img.id "; |
---|
871 | |
---|
872 | if($this->my_config['lmt_list_maxitems']>0) |
---|
873 | { |
---|
874 | $refdbt = ($pagenum-1)*$this->my_config['lmt_list_maxitems']; |
---|
875 | $sql.=" LIMIT ".$refdbt.", ".$this->my_config['lmt_list_maxitems']; |
---|
876 | } |
---|
877 | |
---|
878 | $result=pwg_query($sql); |
---|
879 | if($result) |
---|
880 | { |
---|
881 | while($row = mysql_fetch_array($result)) |
---|
882 | { |
---|
883 | $filenfo = pathinfo($row['path']); |
---|
884 | preg_match("/(.*)\./i", $filenfo["basename"], $tmp); |
---|
885 | $filenfo['filename'] = $tmp[1]; |
---|
886 | |
---|
887 | $tmp=array( |
---|
888 | 'id'=>explode(',',$row['catid']), |
---|
889 | 'name'=>explode('@sep@',$row['catname']), |
---|
890 | 'type'=>explode(',',$row['cattype']), |
---|
891 | 'plinks'=>explode('@sep@',$row['catpermalink']), |
---|
892 | 'link'=>array() |
---|
893 | ); |
---|
894 | $tmpcat=$this->make_image_data($tmp); |
---|
895 | |
---|
896 | $img_ids[]=$row['image_id']; |
---|
897 | $img_liste[]=array( |
---|
898 | 'id' => $row['image_id'], |
---|
899 | 'licence' => ($row['licence_type']=="CRIGHT")?l10n("lmt_lbl_cc_s-".strtolower($row['licence_type'])):"", |
---|
900 | 'licencei' => LMT_PATH."img/".strtolower($row['licence_type'])."_80x15.png", |
---|
901 | 'aut_text1' => $row['text1'], |
---|
902 | 'aut_text2' => $row['text2'], |
---|
903 | 'file' => $row['file'], |
---|
904 | 'cat' => $tmpcat, |
---|
905 | 'imglink' => make_picture_url( |
---|
906 | array( |
---|
907 | 'image_id' => $row['image_id'], |
---|
908 | 'category' => array( |
---|
909 | 'id' => $tmp['id'][0], |
---|
910 | 'name' => $tmp['name'][0], |
---|
911 | 'permalink' => $tmp['plinks'][0]) |
---|
912 | ) |
---|
913 | ), |
---|
914 | 'thumb' => $filenfo["dirname"]."/thumbnail/".$conf["prefix_thumbnail"].$filenfo["filename"].".".$row["tn_ext"] |
---|
915 | ); |
---|
916 | } |
---|
917 | } |
---|
918 | |
---|
919 | $sql="select FOUND_ROWS()"; |
---|
920 | $result=pwg_query($sql); |
---|
921 | $nb=mysql_fetch_array($result); |
---|
922 | |
---|
923 | $pages_navigation = new pages_navigation(); |
---|
924 | $pages_navigation->set_nb_items($nb[0]); |
---|
925 | $pages_navigation->set_nb_items_per_page($this->my_config['lmt_list_maxitems']); |
---|
926 | $pages_navigation->set_current_page($pagenum); |
---|
927 | $pages_navigation->set_options(array( |
---|
928 | "text_prev" => l10n("lmt_nav_prev"), |
---|
929 | "text_next" => l10n("lmt_nav_next"), |
---|
930 | "text_first" => l10n("lmt_nav_first"), |
---|
931 | "text_last" => l10n("lmt_nav_last") |
---|
932 | )); |
---|
933 | $navbar=$pages_navigation->make_navigation("loadpage"); |
---|
934 | if($navbar!="") |
---|
935 | { |
---|
936 | $navbar=", ".$navbar; |
---|
937 | } |
---|
938 | |
---|
939 | $local_tpl->assign('imgliste', $img_liste); |
---|
940 | return($nb[0]." ".l10n("lmt_lst_nb_photos").$navbar."#".$local_tpl->parse('body_page', true)); |
---|
941 | } |
---|
942 | |
---|
943 | protected function ajax_manage_list($pagenum) |
---|
944 | { |
---|
945 | global $conf, $user; |
---|
946 | |
---|
947 | $local_tpl = new Template(LMT_PATH."admin/", ""); |
---|
948 | $local_tpl->set_filename('body_page', |
---|
949 | dirname($this->filelocation).'/admin/plugin_admin_manageitems.tpl'); |
---|
950 | |
---|
951 | if(!isset($_REQUEST['select'])) |
---|
952 | { |
---|
953 | $_REQUEST['select']="caddie"; |
---|
954 | } |
---|
955 | |
---|
956 | $img_liste = array(); |
---|
957 | $sql="SELECT SQL_CALC_FOUND_ROWS img.id as image_id, img.file, img.path, img.tn_ext, |
---|
958 | GROUP_CONCAT(cat.id) AS catid, |
---|
959 | GROUP_CONCAT(CASE WHEN cat.name IS NULL THEN '' ELSE cat.name END SEPARATOR '@sep@') AS catname, |
---|
960 | GROUP_CONCAT(CASE WHEN cat.permalink IS NULL THEN '' ELSE cat.permalink END SEPARATOR '@sep@') AS catpermalink, |
---|
961 | GROUP_CONCAT(CASE WHEN cat.dir IS NULL THEN 'V' ELSE 'P' END) AS cattype, |
---|
962 | lmti.licence_type, lmtla.text1, lmtla.text2 |
---|
963 | FROM ".CADDIE_TABLE." caddie, |
---|
964 | (".IMAGES_TABLE." img |
---|
965 | LEFT OUTER JOIN ".IMAGE_CATEGORY_TABLE." imgcat ON img.id = imgcat.image_id |
---|
966 | LEFT OUTER JOIN ".CATEGORIES_TABLE." cat ON imgcat.category_id = cat.id) |
---|
967 | LEFT OUTER JOIN ".$this->tables["images"]." AS lmti ON img.id = lmti.image_id |
---|
968 | LEFT OUTER JOIN ".$this->tables["licence_author"]." lmtla ON lmtla.id = lmti.author_id |
---|
969 | WHERE img.id = caddie.element_id |
---|
970 | AND caddie.user_id = '".$user['id']."' |
---|
971 | GROUP BY img.id |
---|
972 | ORDER BY cat.id, img.id "; |
---|
973 | |
---|
974 | if($this->my_config['lmt_list_maxitems']>0) |
---|
975 | { |
---|
976 | $refdbt = ($pagenum-1)*$this->my_config['lmt_list_maxitems']; |
---|
977 | $sql.=" LIMIT ".$refdbt.", ".$this->my_config['lmt_list_maxitems']; |
---|
978 | } |
---|
979 | |
---|
980 | $result=pwg_query($sql); |
---|
981 | |
---|
982 | if($result) |
---|
983 | { |
---|
984 | while($row = mysql_fetch_array($result)) |
---|
985 | { |
---|
986 | $filenfo = pathinfo($row['path']); |
---|
987 | preg_match("/(.*)\./i", $filenfo["basename"], $tmp); |
---|
988 | $filenfo['filename'] = $tmp[1]; |
---|
989 | |
---|
990 | $tmp=array( |
---|
991 | 'id'=>explode(',',$row['catid']), |
---|
992 | 'name'=>explode('@sep@',$row['catname']), |
---|
993 | 'type'=>explode(',',$row['cattype']), |
---|
994 | 'plinks'=>explode('@sep@',$row['catpermalink']), |
---|
995 | 'link'=>array() |
---|
996 | ); |
---|
997 | $tmpcat=$this->make_image_data($tmp); |
---|
998 | |
---|
999 | $img_liste[]=array( |
---|
1000 | 'id' => $row['image_id'], |
---|
1001 | 'licence' => ($row['licence_type']=="")?"DEFAULT":$row['licence_type'], |
---|
1002 | 'licencei' => ($row['licence_type']=="")?"":LMT_PATH."img/".strtolower($row['licence_type'])."_80x15.png", |
---|
1003 | 'aut_text1' => $row['text1'], |
---|
1004 | 'aut_text2' => $row['text2'], |
---|
1005 | 'file' => $row['file'], |
---|
1006 | 'cat' => $tmpcat, |
---|
1007 | 'imglink' => make_picture_url( |
---|
1008 | array( |
---|
1009 | 'image_id' => $row['image_id'], |
---|
1010 | 'category' => array( |
---|
1011 | 'id' => $tmp['id'][0], |
---|
1012 | 'name' => $tmp['name'][0], |
---|
1013 | 'permalink' => $tmp['plinks'][0]) |
---|
1014 | ) |
---|
1015 | ), |
---|
1016 | 'thumb' => $filenfo["dirname"]."/thumbnail/".$conf["prefix_thumbnail"].$filenfo["filename"].".".$row["tn_ext"] |
---|
1017 | ); |
---|
1018 | } |
---|
1019 | } |
---|
1020 | |
---|
1021 | $sql="select FOUND_ROWS()"; |
---|
1022 | $result=pwg_query($sql); |
---|
1023 | $nb=mysql_fetch_array($result); |
---|
1024 | |
---|
1025 | $pages_navigation = new pages_navigation(); |
---|
1026 | $pages_navigation->set_nb_items($nb[0]); |
---|
1027 | $pages_navigation->set_nb_items_per_page($this->my_config['lmt_list_maxitems']); |
---|
1028 | $pages_navigation->set_current_page($pagenum); |
---|
1029 | $pages_navigation->set_options(array( |
---|
1030 | "text_prev" => l10n("lmt_nav_prev"), |
---|
1031 | "text_next" => l10n("lmt_nav_next"), |
---|
1032 | "text_first" => l10n("lmt_nav_first"), |
---|
1033 | "text_last" => l10n("lmt_nav_last") |
---|
1034 | )); |
---|
1035 | $navbar=$pages_navigation->make_navigation("loadpage"); |
---|
1036 | if($navbar!="") |
---|
1037 | { |
---|
1038 | $navbar=", ".$navbar; |
---|
1039 | } |
---|
1040 | |
---|
1041 | $local_tpl->assign('imgliste', $img_liste); |
---|
1042 | return($nb[0]." ".l10n("lmt_lst_nb_photos").$navbar."#".$local_tpl->parse('body_page', true)); |
---|
1043 | } |
---|
1044 | |
---|
1045 | } //class |
---|
1046 | |
---|
1047 | ?> |
---|