[31051] | 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']), |
---|
[31106] | 21 | 'googleplus' => !empty($_POST['inc_googleplus']), |
---|
| 22 | 'tumblr' => !empty($_POST['inc_tumblr']) |
---|
[31051] | 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"); |
---|
| 34 | if (@file_exists($css_file)): |
---|
| 35 | $custom_css = "yes"; |
---|
| 36 | else: |
---|
| 37 | $custom_css = "no"; |
---|
| 38 | endif; |
---|
| 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'], |
---|
[31106] | 53 | 'INC_GOOGLEPLUS' => isset($params['googleplus']) && $params['googleplus'], |
---|
| 54 | 'INC_TUMBLR' => isset($params['tumblr']) && $params['tumblr'] |
---|
[31051] | 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'); |
---|