source: extensions/imgpreview/admin/admin.php @ 14919

Last change on this file since 14919 was 13923, checked in by flop25, 12 years ago

features added :

  • preload images option
File size: 1.7 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5global $conf, $template, $lang, $page;
6load_language('plugin.lang', IMGP_PATH);
7
8
9$page['infos'] = array();
10
11if (isset($_POST['envoi_config']) and $_POST['envoi_config']=='imgpreview')
12{
13        $conf_imgp = explode("#" , $conf['imgpreview']);
14        check_pwg_token();
15        $newconf_plugin = (isset($_POST['max-width']) and preg_match("#^[0-9]+$#",$_POST['max-width'])) ? $_POST['max-width'] : $conf_imgp[0];
16        $newconf_plugin .= '#';
17        $newconf_plugin .= (isset($_POST['max-height']) and preg_match("#^[0-9]+$#",$_POST['max-height'])) ? $_POST['max-height'] : $conf_imgp[1];
18        $newconf_plugin .= '#';
19        $newconf_plugin .= (isset($_POST['show-title'])) ? "true" : "false";
20        $newconf_plugin .= '#';
21        $newconf_plugin .= (isset($_POST['opacity'])) ? "true" : "false";
22        $newconf_plugin .= '#';
23        $newconf_plugin .= (isset($_POST['preloadImages'])) ? "true" : "false";
24        conf_update_param('imgpreview', pwg_db_real_escape_string($newconf_plugin));                           
25        array_push($page['infos'], l10n('imgp_conf_updated'));
26}
27
28load_conf_from_db();
29$conf_imgp = explode("#" , $conf['imgpreview']);
30$val_title=(isset($conf_imgp[2]) and $conf_imgp[2]=="true") ? "checked" : ""; 
31$val_opacity=(isset($conf_imgp[3]) and $conf_imgp[3]=="true") ? "checked" : ""; 
32$val_preloadImages=(isset($conf_imgp[4]) and $conf_imgp[4]=="true") ? "checked" : ""; 
33$template->assign(
34        array(
35                'MAX_W' => 'value="'.$conf_imgp[0].'"',
36                'MAX_H' => 'value="'.$conf_imgp[1].'"',
37                'SHOW_TITTLE' => $val_title,
38                'OPACITY' => $val_opacity,
39                'preloadImages' => $val_preloadImages,
40                'PWG_TOKEN' => get_pwg_token()
41        )
42        );
43$template->set_filename('plugin_admin_content', dirname(__FILE__).'/admin.tpl');
44$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
45?>
Note: See TracBrowser for help on using the repository browser.