1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | |
---|
5 | require_once( PHPWG_THEMES_PATH . 'greydragon/include/greydragon.class.php'); |
---|
6 | require_once( PHPWG_THEMES_PATH . 'greydragon/admin/upgrade.inc.php'); |
---|
7 | |
---|
8 | load_language('theme.lang', PHPWG_THEMES_PATH.'greydragon/'); |
---|
9 | |
---|
10 | $themeCore = greyDragonCore::Instance(GDTHEME_VERSION); |
---|
11 | $themeroot = './themes/' . basename(dirname(dirname(__FILE__))) . '/'; |
---|
12 | |
---|
13 | // Store settings on Save |
---|
14 | if ($themeCore->hasSettingFromPost('submit_greydragon')): |
---|
15 | |
---|
16 | if ($themeCore->getSettingFromPost('p_main_menu') == "static"): |
---|
17 | $_POST['p_expand_main_menu'] = "off"; |
---|
18 | endif; |
---|
19 | |
---|
20 | $themeCore->saveSettingsFromPost(); |
---|
21 | |
---|
22 | // Prepare Root Page |
---|
23 | global $prefixeTable, $conf; |
---|
24 | if (array_key_exists('additional_pages', $conf)): |
---|
25 | $ap_conf = @unserialize($conf['additional_pages']); |
---|
26 | if (array_key_exists('homepage', $ap_conf) && ($ap_conf['homepage'])): |
---|
27 | $config_temp = $themeCore->getConfig(); |
---|
28 | if ($themeCore->getOption('p_rootpage') == 'on'): |
---|
29 | if ($themeCore->prepareHomePage($prefixeTable, $ap_conf['homepage'], false)): |
---|
30 | array_push($page['infos'], l10n('Home Page Content for "Additional Pages" plugin has been updated')); |
---|
31 | else: |
---|
32 | array_push($page['infos'], l10n('Home Page Content for "Additional Pages" plugin was not updated. No new content detected.')); |
---|
33 | endif; |
---|
34 | else: |
---|
35 | $themeCore->prepareHomePage($prefixeTable, $ap_conf['homepage'], true); |
---|
36 | array_push($page['infos'], l10n('Home Page Content for "Additional Pages" plugin has been removed')); |
---|
37 | endif; |
---|
38 | else: |
---|
39 | array_push($page['infos'], l10n('Please Create Home Page in "Additional Pages" Plugin')); |
---|
40 | endif; |
---|
41 | else: |
---|
42 | array_push($page['infos'], l10n('Please Create Home Page in "Additional Pages" Plugin')); |
---|
43 | endif; |
---|
44 | |
---|
45 | $config_min = $themeCore->getConfig(FALSE); |
---|
46 | $conf['greydragon'] = serialize($config_min); |
---|
47 | conf_update_param('greydragon', pwg_db_real_escape_string($conf['greydragon'])); |
---|
48 | |
---|
49 | $themeCore->prepareCustomCSS(); |
---|
50 | |
---|
51 | pwg_set_session_var( 'purge_template', 1 ); |
---|
52 | |
---|
53 | array_push($page['infos'], l10n('Theme Settings are saved')); |
---|
54 | endif; |
---|
55 | |
---|
56 | $themeCore->setSetting("pwgVer", PHPWG_VERSION); |
---|
57 | $ver_parts = explode('.', PHPWG_VERSION); |
---|
58 | $ver_int = intval($ver_parts[0]) * 100 + intval($ver_parts[1]); |
---|
59 | |
---|
60 | |
---|
61 | if ($ver_int >= 1100): |
---|
62 | $themeCore->setSetting("hasMinVer", "yes"); |
---|
63 | endif; |
---|
64 | |
---|
65 | $template->set_filenames(array('theme_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
66 | |
---|
67 | if ($ver_int > 1100): |
---|
68 | global $pwg_loaded_plugins; |
---|
69 | |
---|
70 | if (isset($pwg_loaded_plugins['AdditionalPages'])): |
---|
71 | $themeCore->setSetting("hasAP", "yes"); |
---|
72 | endif; |
---|
73 | if (isset($pwg_loaded_plugins['ExtendedDescription'])): |
---|
74 | $themeCore->setSetting("hasED", "yes"); |
---|
75 | endif; |
---|
76 | if (isset($pwg_loaded_plugins['GDThumb'])): |
---|
77 | $themeCore->setSetting("hasGT", "yes"); |
---|
78 | endif; |
---|
79 | if (isset($pwg_loaded_plugins['AdminTools'])): |
---|
80 | $themeCore->setSetting("hasAT", "yes"); |
---|
81 | endif; |
---|
82 | else: |
---|
83 | if (array_key_exists('plugin_menu_items', $template->smarty->tpl_vars)): |
---|
84 | foreach ($template->smarty->tpl_vars['plugin_menu_items']->value as $key => $value): |
---|
85 | if ($value["NAME"] == "Additional Pages"): |
---|
86 | $themeCore->setSetting("hasAP", "yes"); |
---|
87 | endif; |
---|
88 | if ($value["NAME"] == "Extended Description"): |
---|
89 | $themeCore->setSetting("hasED", "yes"); |
---|
90 | endif; |
---|
91 | if ($value["NAME"] == "gdThumb"): |
---|
92 | $themeCore->setSetting("hasGT", "yes"); |
---|
93 | endif; |
---|
94 | if ($value["NAME"] == "Admin Tools"): |
---|
95 | $themeCore->setSetting("hasAT", "yes"); |
---|
96 | endif; |
---|
97 | endforeach; |
---|
98 | endif; |
---|
99 | endif; |
---|
100 | |
---|
101 | $packlist = $themeCore->getColorPackList(); |
---|
102 | |
---|
103 | // Ensure default values are set |
---|
104 | $template->assign('options', $themeCore->getConfig()); |
---|
105 | $template->assign('colorpackArr', $packlist); |
---|
106 | $template->assign_var_from_handle('ADMIN_CONTENT', 'theme_admin_content'); |
---|
107 | |
---|
108 | ?> |
---|