1 | <?php |
---|
2 | /** |
---|
3 | * This is the main administration page, if you have only one admin page you can put |
---|
4 | * directly its code here or using the tabsheet system like bellow |
---|
5 | */ |
---|
6 | |
---|
7 | defined('SHARETHIS_PATH') or die('Hacking attempt!'); |
---|
8 | |
---|
9 | global $template, $page, $conf; |
---|
10 | |
---|
11 | load_language('plugin.lang', SHARETHIS_PATH); |
---|
12 | $params = $conf['sharethis']; |
---|
13 | |
---|
14 | // Save configuration |
---|
15 | if (isset($_POST['submit'])) { |
---|
16 | |
---|
17 | $params = array( |
---|
18 | 'facebook' => !empty($_POST['inc_facebook']), |
---|
19 | 'pinterest' => !empty($_POST['inc_pinterest']), |
---|
20 | 'twitter' => !empty($_POST['inc_twitter']), |
---|
21 | 'googleplus' => !empty($_POST['inc_googleplus']) |
---|
22 | ); |
---|
23 | |
---|
24 | conf_update_param('sharethis', $params, true); |
---|
25 | |
---|
26 | pwg_set_session_var( 'purge_template', 1 ); |
---|
27 | |
---|
28 | array_push($page['infos'], l10n('Plugin Settings are saved')); |
---|
29 | } |
---|
30 | |
---|
31 | // Try to find GreyDragon Theme and use Theme's styles for admin area |
---|
32 | $css_file = str_replace('/./', '/', dirname(dirname(dirname(__FILE__))) . '/' . GDTHEME_PATH . "admin/css/styles.css"); |
---|
33 | if (@file_exists($css_file)): |
---|
34 | $custom_css = "yes"; |
---|
35 | else: |
---|
36 | $custom_css = "no"; |
---|
37 | endif; |
---|
38 | |
---|
39 | // template vars |
---|
40 | $template->assign(array( |
---|
41 | 'SHARETHIS_PATH' => SHARETHIS_PATH, // used for images, scripts, ... access |
---|
42 | 'SHARETHIS_ABS_PATH'=> realpath(SHARETHIS_PATH), // used for template inclusion (Smarty needs a real path) |
---|
43 | 'SHARETHIS_ADMIN' => SHARETHIS_ADMIN, |
---|
44 | 'SHARETHIS_VERSION' => SHARETHIS_VERSION, |
---|
45 | 'GDTHEME_PATH' => GDTHEME_PATH, |
---|
46 | 'CUSTOM_CSS' => $custom_css, |
---|
47 | 'PHPWG_ROOT_PATH' => PHPWG_ROOT_PATH, |
---|
48 | |
---|
49 | 'INC_FACEBOOK' => isset($params['facebook']) && $params['facebook'], |
---|
50 | 'INC_PINTEREST' => isset($params['pinterest']) && $params['pinterest'], |
---|
51 | 'INC_TWITTER' => isset($params['twitter']) && $params['twitter'], |
---|
52 | 'INC_GOOGLEPLUS' => isset($params['googleplus']) && $params['googleplus'] |
---|
53 | |
---|
54 | )); |
---|
55 | |
---|
56 | // send page content |
---|
57 | $template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/admin.tpl')); |
---|
58 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|