source: extensions/ShareThis/admin.php

Last change on this file was 31106, checked in by SergeD, 10 years ago

version 1.0.3 - see changelog for details

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
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
7defined('SHARETHIS_PATH') or die('Hacking attempt!');
8
9global $template, $page, $conf;
10
11load_language('plugin.lang', SHARETHIS_PATH);
12$params = $conf['sharethis'];
13
14// Save configuration
15if (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    'tumblr'     => !empty($_POST['inc_tumblr'])
23  );
24
25  conf_update_param('sharethis', $params, true);
26
27  pwg_set_session_var( 'purge_template', 1 );
28
29  array_push($page['infos'], l10n('Plugin Settings are saved'));
30}
31
32// Try to find GreyDragon Theme and use Theme's styles for admin area
33$css_file = str_replace('/./', '/', dirname(dirname(dirname(__FILE__))) . '/' . GDTHEME_PATH . "admin/css/styles.css");
34if (@file_exists($css_file)):
35  $custom_css = "yes";
36else:
37  $custom_css = "no";
38endif;
39
40// template vars
41$template->assign(array(
42  'SHARETHIS_PATH'    => SHARETHIS_PATH, // used for images, scripts, ... access
43  'SHARETHIS_ABS_PATH'=> realpath(SHARETHIS_PATH), // used for template inclusion (Smarty needs a real path)
44  'SHARETHIS_ADMIN'   => SHARETHIS_ADMIN,
45  'SHARETHIS_VERSION' => SHARETHIS_VERSION,
46  'GDTHEME_PATH'      => GDTHEME_PATH,
47  'CUSTOM_CSS'        => $custom_css,
48  'PHPWG_ROOT_PATH'   => PHPWG_ROOT_PATH,
49
50  'INC_FACEBOOK'      => isset($params['facebook']) && $params['facebook'],
51  'INC_PINTEREST'     => isset($params['pinterest']) && $params['pinterest'],
52  'INC_TWITTER'       => isset($params['twitter']) && $params['twitter'],
53  'INC_GOOGLEPLUS'    => isset($params['googleplus']) && $params['googleplus'],
54  'INC_TUMBLR'        => isset($params['tumblr']) && $params['tumblr']
55
56));
57
58// send page content
59$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/template/admin.tpl'));
60$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
Note: See TracBrowser for help on using the repository browser.