1 | <?php |
---|
2 | // Chech whether we are indeed included by Piwigo. |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | global $template, $conf, $page, $lang; |
---|
6 | |
---|
7 | if ((!empty($_POST['modified'])) and ($_POST['modified']=true)) { |
---|
8 | switch ($_POST['main_button_type']) { |
---|
9 | case $lang['round']: $_POST['main_button_type'] = 'round'; break; |
---|
10 | case $lang['round_nocount']: $_POST['main_button_type'] = 'round_nocount'; break; |
---|
11 | case $lang['button']: $_POST['main_button_type'] = 'button'; break; |
---|
12 | case $lang['button_nocount']: $_POST['main_button_type'] = 'button_nocount'; break; |
---|
13 | case $lang['link']: $_POST['main_button_type'] = 'link'; break; |
---|
14 | case $lang['link_noicon']: $_POST['main_button_type'] = 'link_noicon'; break; |
---|
15 | case $lang['icon']: $_POST['main_button_type'] = 'icon'; break; |
---|
16 | } |
---|
17 | switch ($_POST['pic_button_type']) { |
---|
18 | case $lang['round']: $_POST['pic_button_type'] = 'round'; break; |
---|
19 | case $lang['round_nocount']: $_POST['pic_button_type'] = 'round_nocount'; break; |
---|
20 | case $lang['button']: $_POST['pic_button_type'] = 'button'; break; |
---|
21 | case $lang['button_nocount']: $_POST['pic_button_type'] = 'button_nocount'; break; |
---|
22 | case $lang['link']: $_POST['pic_button_type'] = 'link'; break; |
---|
23 | case $lang['link_noicon']: $_POST['pic_button_type'] = 'link_noicon'; break; |
---|
24 | case $lang['icon']: $_POST['pic_button_type'] = 'icon'; break; |
---|
25 | } |
---|
26 | $vkb_conf = array( |
---|
27 | 'main_button_type' => $_POST['main_button_type'], |
---|
28 | 'record_title' => $_POST['record_title'], |
---|
29 | 'record_text' => $_POST['record_text'], |
---|
30 | 'record_img' => $_POST['record_img'], |
---|
31 | 'pic_button_type' => $_POST['pic_button_type'] |
---|
32 | ); |
---|
33 | if (!empty($_POST['show_main_button'])) { |
---|
34 | $vkb_conf['show_main_button'] = $_POST['show_main_button']; |
---|
35 | }else{ |
---|
36 | $vkb_conf['show_main_button'] = false; |
---|
37 | } |
---|
38 | if (!empty($_POST['show_pic_button'])) { |
---|
39 | $vkb_conf['show_pic_button'] = $_POST['show_pic_button']; |
---|
40 | }else{ |
---|
41 | $vkb_conf['show_pic_button'] = false; |
---|
42 | } |
---|
43 | pwg_query(' |
---|
44 | UPDATE '.CONFIG_TABLE.' |
---|
45 | SET '.CONFIG_TABLE.'.value = "'.pwg_db_real_escape_string(serialize($vkb_conf)).'" |
---|
46 | WHERE '.CONFIG_TABLE.'.param = "vkbutton" LIMIT 1 ; |
---|
47 | '); |
---|
48 | array_push($page['infos'], l10n('config_is_saved')); |
---|
49 | }else{ |
---|
50 | $vkb_conf = @unserialize($conf['vkbutton']); |
---|
51 | } |
---|
52 | |
---|
53 | $template->assign('show_main_button', $vkb_conf['show_main_button']); |
---|
54 | $template->assign('main_button_type', $vkb_conf['main_button_type']); |
---|
55 | $template->assign('record_title', $vkb_conf['record_title']); |
---|
56 | $template->assign('record_text', $vkb_conf['record_text']); |
---|
57 | $template->assign('record_img', $vkb_conf['record_img']); |
---|
58 | $template->assign('show_pic_button', $vkb_conf['show_pic_button']); |
---|
59 | $template->assign('pic_button_type', $vkb_conf['pic_button_type']); |
---|
60 | |
---|
61 | $template->func_combine_css(array( |
---|
62 | 'path' => vkbutton_PATH.'admin.css', |
---|
63 | ) |
---|
64 | ); |
---|
65 | //определяем адрес шаблона плагина |
---|
66 | $template->set_template_dir(vkbutton_PATH); |
---|
67 | $template->set_filename('admin', 'admin.tpl'); |
---|
68 | |
---|
69 | $template->set_filenames( array('plugin_admin_content' => dirname(__FILE__).'/admin.tpl') ); |
---|
70 | $template->assign_var_from_handle( 'ADMIN_CONTENT', 'plugin_admin_content'); |
---|
71 | ?> |
---|