source: extensions/greydragon/admin/admin.inc.php @ 30484

Revision 30484, 3.2 KB checked in by SergeD, 5 years ago (diff)

version 1.0.14 - please refer to changelog for details

  • Property svn:eol-style set to native
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5define('GDTHEME_VERSION', '1.0.14');
6
7require_once( PHPWG_THEMES_PATH . 'greydragon/include/greydragon.class.php');
8require_once( PHPWG_THEMES_PATH . 'greydragon/admin/upgrade.inc.php');
9
10load_language('theme.lang', PHPWG_THEMES_PATH.'greydragon/');
11
12$themeCore = greyDragonCore::Instance(GDTHEME_VERSION);
13$themeroot = './themes/' . basename(dirname(dirname(__FILE__))) . '/';
14
15// Store settings on Save
16if ($themeCore->hasSettingFromPost('submit_greydragon')):
17
18  if ($themeCore->getSettingFromPost('p_main_menu') == "static"):
19    $_POST['p_expand_main_menu'] = "off";
20  endif;
21
22  $themeCore->saveSettingsFromPost();
23
24  if ($themeCore->getOption('p_rootpage') == 'on'):
25    global $prefixeTable, $conf;
26    $ap_conf = @unserialize($conf['additional_pages']);
27    if ($ap_conf['homepage']):
28      $config_temp = $themeCore->getConfig();
29      if ($themeCore->prepareHomePage($prefixeTable, $ap_conf['homepage'])):
30        array_push($page['infos'], l10n('Home Page Content for "Additional Pages" plugin has been updated'));
31      endif;
32    else:
33      array_push($page['infos'], l10n('Please Create Home Page in "Additional Pages" Plugin'));
34    endif;
35  endif;
36
37  $config_min = $themeCore->getConfig(FALSE);
38
39  $conf['greydragon'] = serialize($config_min);
40  conf_update_param('greydragon', pwg_db_real_escape_string($conf['greydragon']));
41
42  if ($themeCore->getOption('p_lowertext') == "on"):
43    $css  = "/* Theme dynamic settings. Do not modify */\n"
44          . "html, body, input, select, textarea, file { text-transform: lowercase; }\n\n";
45  else:
46    $css = "";
47  endif;
48  $temp = $themeCore->getOption('p_customcss');
49  if ($temp):
50    $css .= "/* Custom CSS. Do not modify */\n" . $temp;
51  endif;
52
53  $fileName = $themeroot . 'css/custom.css';
54  if ($css):
55    $handle = fopen($fileName, "w");
56    if ($handle):
57      fwrite($handle, $css);
58      fclose($handle);
59    endif;
60  else:
61    @unlink($fileName);
62  endif;
63
64  pwg_set_session_var( 'purge_template', 1 );
65
66  array_push($page['infos'], l10n('Theme Settings are saved'));
67endif;
68
69$template->set_filenames(array('theme_admin_content' => dirname(__FILE__) . '/admin.tpl'));
70
71foreach ($template->smarty->tpl_vars['plugin_menu_items']->value as $key => $value):
72  if ($value["NAME"] == "Additional Pages"):
73    $themeCore->setSetting("hasAP", "yes");
74  endif;
75  if ($value["NAME"] == "Extended Description"):
76    $themeCore->setSetting("hasED", "yes");
77  endif;
78  if ($value["NAME"] == "gdThumb"):
79    $themeCore->setSetting("hasGT", "yes");
80  endif;
81  if ($value["NAME"] == "Admin Tools"):
82    $themeCore->setSetting("hasAT", "yes");
83  endif;
84endforeach;
85
86if (PHPWG_VERSION >= '2.6.3'):
87  $themeCore->setSetting("hasMinVer", "yes");
88endif;
89
90$packlist = array();
91$packroot = $themeroot . 'css/colorpack/';
92foreach (scandir($packroot) as $pack_name):
93  if (file_exists($packroot . "$pack_name/styles.css")):
94    if ($pack_name[0] == "."):
95      continue;
96    endif;
97    $packlist[] = $pack_name;
98  endif;
99endforeach;
100
101// Ensure default values are set
102$template->assign('options', $themeCore->getConfig());
103$template->assign('colorpackArr', $packlist);
104$template->assign_var_from_handle('ADMIN_CONTENT', 'theme_admin_content');
105
106?>
Note: See TracBrowser for help on using the repository browser.