source: extensions/FacebookPlug/Plugin/admin.config.php @ 8243

Last change on this file since 8243 was 8243, checked in by rub, 13 years ago

Undo Fix 2.1.5 init FB
delete_compiled_templates on admin page

  • Property svn:eol-style set to LF
File size: 5.7 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | FacebookPlug - a Piwigo Plugin                                        |
4// | Copyright (C) 2010 Ruben ARNAUD - rub@piwigo.org                      |
5// +-----------------------------------------------------------------------+
6// | This program is free software; you can redistribute it and/or modify  |
7// | it under the terms of the GNU General Public License as published by  |
8// | the Free Software Foundation                                          |
9// |                                                                       |
10// | This program is distributed in the hope that it will be useful, but   |
11// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
12// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
13// | General Public License for more details.                              |
14// |                                                                       |
15// | You should have received a copy of the GNU General Public License     |
16// | along with this program; if not, write to the Free Software           |
17// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
18// | USA.                                                                  |
19// +-----------------------------------------------------------------------+
20
21if (!defined('PHPWG_ROOT_PATH'))
22{
23  die('Hacking attempt!');
24}
25
26// include
27include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
28
29// Lingua
30load_language('plugin.lang', FBP_DIR.'/');
31
32// Delete compiled templates
33$template->delete_compiled_templates();
34
35// Arguments
36$page['tab'] = (isset($_GET['tab']) ? $_GET['tab'] : 'social_plugin');
37
38// Data
39$base_url = get_admin_plugin_menu_link(__FILE__);
40$url_type = array('page', 'image');
41$url_type_l10n = array_map('l10n', $url_type);
42$layout = array('standard', 'button_count', 'box_count');
43$layout_l10n = array_map('l10n', $layout);
44$action = array('like', 'recommend');
45$action_l10n = array_map('l10n', $action);
46$colorscheme = array('light', 'dark');
47$colorscheme_l10n = array_map('l10n', $colorscheme);
48
49// Tabsheet
50$tabsheet = new tabsheet();
51$tabsheet->add('social_plugin',
52               l10n('Social plugin'),
53               add_url_params($base_url, array('tab' => 'social_plugin')));
54$tabsheet->add('advanced',
55               l10n('Advanced'),
56               add_url_params($base_url, array('tab' => 'advanced')));
57$tabsheet->select($page['tab']);
58$tabsheet->assign();
59
60// Update
61if (isset($_POST['submit']))
62{
63  switch ($page['tab'])
64  {
65    case 'social_plugin' :
66    {
67      $conf['fbp']['social_plugin_like_button']['enabled'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ENABLED']) ? false : true;
68      $conf['fbp']['social_plugin_like_button']['url_type'] = $url_type[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_URL_TYPE']];
69      $conf['fbp']['social_plugin_like_button']['layout'] = $layout[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_LAYOUT']];
70      $conf['fbp']['social_plugin_like_button']['show_faces'] = empty($_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_SHOW_FACES']) ? false : true;
71      $conf['fbp']['social_plugin_like_button']['action'] = $action[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_ACTION']];
72      $conf['fbp']['social_plugin_like_button']['colorscheme'] = $colorscheme[$_POST['FBP_SOCIAL_PLUGIN_LIKE_BUTTON_COLORSCHEME']];
73
74      break;
75    }
76
77    case 'advanced' :
78    {
79      $conf['fbp']['async_script'] = empty($_POST['FBP_ASYNC_SCRIPT']) ? false : true;
80      $conf['fbp']['allow_fb_access_private_page'] = empty($_POST['FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE']) ? false : true;
81    //~ if (isset($_POST['fbp_day_number']))
82    //~ {
83      //~ $conf['fbp']['day_number'] = $_POST['fbp_day_number'];
84    //~ }
85      break;
86    }
87  }
88
89  $query = '
90update '.CONFIG_TABLE.'
91set
92  value = \''.serialize($conf['fbp']).'\'
93where
94  param = \'fbp\'
95;';
96  pwg_query($query);
97}
98
99// Display
100switch ($page['tab'])
101{
102  case 'social_plugin' :
103  {
104    $template->assign(
105      $page['tab'],
106      array(
107        'like_button' => array
108          (
109            'FB_PAGE' => 'http://developers.facebook.com/docs/reference/plugins/like',
110            'ENABLED' => ($conf['fbp']['social_plugin_like_button']['enabled'] ? 'checked="checked"' : ''),
111            'URL_TYPE_OPTIONS' => $url_type_l10n,
112            'URL_TYPE_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['url_type'], $url_type),
113            'LAYOUT_OPTIONS' => $layout_l10n,
114            'LAYOUT_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['layout'], $layout),
115            'SHOW_FACES' => ($conf['fbp']['social_plugin_like_button']['show_faces'] ? 'checked="checked"' : ''),
116            'ACTION_OPTIONS' => $action_l10n,
117            'ACTION_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['action'], $action),
118            'COLORSCHEME_OPTIONS' => $colorscheme_l10n,
119            'COLORSCHEME_OPTIONS_SELECTED' => array_search($conf['fbp']['social_plugin_like_button']['colorscheme'], $colorscheme),
120          ),
121        ));
122    break;
123  }
124  case 'advanced' :
125  {
126    $template->assign(
127      $page['tab'],
128      array(
129        'FBP_ASYNC_SCRIPT'=> ($conf['fbp']['async_script'] ? 'checked="checked"' : ''),
130        'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
131        ));
132    break;
133  }
134}
135
136/*$template->assign(
137  array(
138    'FBP_ALLOW_FB_ACCESS_PRIVATE_PAGE'=> ($conf['fbp']['allow_fb_access_private_page'] ? 'checked="checked"' : ''),
139    //~ 'FBP_DAY_NUMBER'=> $conf['fbp']['day_number'],
140    ));*/
141
142$template->set_filename('plugin_admin_content', FBP_DIR.'/tpl/admin.config.tpl');
143$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
144
145
146?>
Note: See TracBrowser for help on using the repository browser.