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('1.0.13'); |
---|
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 | if ($themeCore->getOption('p_rootpage') == 'on'): |
---|
23 | global $prefixeTable, $conf; |
---|
24 | $ap_conf = @unserialize($conf['additional_pages']); |
---|
25 | if ($ap_conf['homepage']): |
---|
26 | $config_temp = $themeCore->getConfig(); |
---|
27 | if ($themeCore->prepareHomePage($prefixeTable, $ap_conf['homepage'])): |
---|
28 | array_push($page['infos'], l10n('Home Page Content for "Additional Pages" plugin has been updated')); |
---|
29 | endif; |
---|
30 | else: |
---|
31 | array_push($page['infos'], l10n('Please Create Home Page in "Additional Pages" Plugin')); |
---|
32 | endif; |
---|
33 | endif; |
---|
34 | |
---|
35 | $config_min = $themeCore->getConfig(FALSE); |
---|
36 | |
---|
37 | $conf['greydragon'] = serialize($config_min); |
---|
38 | conf_update_param('greydragon', pwg_db_real_escape_string($conf['greydragon'])); |
---|
39 | |
---|
40 | if ($themeCore->getOption('p_lowertext') == "on"): |
---|
41 | $css = "/* Theme dynamic settings. Do not modify */\n" |
---|
42 | . "html, body, input, select, textarea, file { text-transform: lowercase; }\n\n"; |
---|
43 | else: |
---|
44 | $css = ""; |
---|
45 | endif; |
---|
46 | $temp = $themeCore->getOption('p_customcss'); |
---|
47 | if ($temp): |
---|
48 | $css .= "/* Custom CSS. Do not modify */\n" . $temp; |
---|
49 | endif; |
---|
50 | |
---|
51 | $fileName = $themeroot . 'css/custom.css'; |
---|
52 | if ($css): |
---|
53 | $handle = fopen($fileName, "w"); |
---|
54 | if ($handle): |
---|
55 | fwrite($handle, $css); |
---|
56 | fclose($handle); |
---|
57 | endif; |
---|
58 | else: |
---|
59 | @unlink($fileName); |
---|
60 | endif; |
---|
61 | |
---|
62 | pwg_set_session_var( 'purge_template', 1 ); |
---|
63 | |
---|
64 | array_push($page['infos'], l10n('Theme Settings are saved')); |
---|
65 | endif; |
---|
66 | |
---|
67 | $template->set_filenames(array('theme_admin_content' => dirname(__FILE__) . '/admin.tpl')); |
---|
68 | |
---|
69 | foreach ($template->smarty->tpl_vars['plugin_menu_items']->value as $key => $value): |
---|
70 | if ($value["NAME"] == "Additional Pages"): |
---|
71 | $themeCore->setSetting("hasAP", "yes"); |
---|
72 | endif; |
---|
73 | if ($value["NAME"] == "Extended Description"): |
---|
74 | $themeCore->setSetting("hasED", "yes"); |
---|
75 | endif; |
---|
76 | if ($value["NAME"] == "gdThumb"): |
---|
77 | $themeCore->setSetting("hasGT", "yes"); |
---|
78 | endif; |
---|
79 | if ($value["NAME"] == "Admin Tools"): |
---|
80 | $themeCore->setSetting("hasAT", "yes"); |
---|
81 | endif; |
---|
82 | endforeach; |
---|
83 | |
---|
84 | if (PHPWG_VERSION >= '2.6.3'): |
---|
85 | $themeCore->setSetting("hasMinVer", "yes"); |
---|
86 | endif; |
---|
87 | |
---|
88 | $packlist = array(); |
---|
89 | $packroot = $themeroot . 'css/colorpack/'; |
---|
90 | foreach (scandir($packroot) as $pack_name): |
---|
91 | if (file_exists($packroot . "$pack_name/styles.css")): |
---|
92 | if ($pack_name[0] == "."): |
---|
93 | continue; |
---|
94 | endif; |
---|
95 | $packlist[] = $pack_name; |
---|
96 | endif; |
---|
97 | endforeach; |
---|
98 | |
---|
99 | // Ensure default values are set |
---|
100 | $template->assign('options', $themeCore->getConfig()); |
---|
101 | $template->assign('colorpackArr', $packlist); |
---|
102 | $template->assign_var_from_handle('ADMIN_CONTENT', 'theme_admin_content'); |
---|
103 | |
---|
104 | ?> |
---|