-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_config.php
More file actions
97 lines (87 loc) · 3.83 KB
/
_config.php
File metadata and controls
97 lines (87 loc) · 3.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
# -- BEGIN LICENSE BLOCK ----------------------------------
# This file is part of Freshy2, a theme for Dotclear.
# Original WP Theme from Julien de Luca
# (http://www.jide.fr/francais/)
#
# Copyright (c) 2008-2018
# Bruno Hondelatte dsls@morefnu.org
# Pierre Van Glabeke contact@brol.info
#
# Licensed under the GPL version 2.0 license.
# A copy of this license is available in LICENSE file or at
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# -- END LICENSE BLOCK ------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
return;
}
l10n::set(__DIR__ . '/locales/' . dcCore::app()->lang . '/main');
require __DIR__ . '/lib/class.freshy2.config.php';
dcCore::app()->blog->settings->addNamespace('freshy2');
$freshy2_settings = dcCore::app()->blog->settings->freshy2;
$config = new freshy2Config();
$sidebar_combo = [__('None') => 'none',__('Navigation sidebar') => 'nav', __('Extra sidebar') => 'extra'];
$menu_combo = [
__('simpleMenu') => 'simplemenu',
__('menuFreshy or Menu') => 'freshymenu',
];
$images = $config->getHeaderImages();
if (!empty($_POST)) {
$config->custom_theme = $_POST['freshy_custom'];
$config->top_image = $_POST['freshy_top_image'];
$config->menu = (isset($_POST['menu']) && $_POST['menu'] == 'freshymenu') ? 'freshymenu' : 'simplemenu';
$config->menu;
if (!isset($images[$config->top_image])) {
$config->top_image = 'default';
}
$config->left_sidebar = $_POST['left_sidebar'];
$config->right_sidebar = $_POST['right_sidebar'];
$config->store();
dcCore::app()->blog->triggerBlog();
dcPage::success(__('Theme configuration has been successfully updated.'));
}
$custom_themes_combo = $config->getCustomThemes();
$current_custom_theme = $config->custom_theme;
$current_top_image = $config->top_image;
$left_sidebar = $config->left_sidebar;
$right_sidebar = $config->right_sidebar;
$menu = $config->menu;
$has_freshy_menu = dcCore::app()->plugins->moduleExists('menuFreshy') || dcCore::app()->plugins->moduleExists('menu');
echo'<style type="text/css" media="screen">';
include __DIR__ . '/lib/admin_style.css';
echo '</style>';
# Options display
echo '<div class="fieldset"><h4>' . __('Preferences') . '</h4>';
echo
'<p><label for="freshy_custom">' . __('Custom theme: ') . ' ' .
form::combo('freshy_custom', $config->getCustomThemes(), $current_custom_theme) . '</label></p>';
echo '</div>';
if ($has_freshy_menu) {
echo '<div class="fieldset"><h4>' . __('Menus') . '</h4>' .
'<p><label for="menu">' . __('Menu: ') . form::combo('menu', $menu_combo, $menu) . '</label></p>' .
'</div>';
}
echo '<div class="fieldset"><h4>' . __('Sidebars') . '</h4>' .
'<p><label for="left_sidebar">' . __('Left sidebar: ') . form::combo('left_sidebar', $sidebar_combo, $left_sidebar) . '</label></p>' .
'<p><label for="right_sidebar">' . __('Right sidebar: ') . form::combo('right_sidebar', $sidebar_combo, $right_sidebar) . '</label>';
if (!$has_freshy_menu) {
echo form::hidden('menu', 'simplemenu');
}
echo '</p>' .
'</div>';
echo '<div class="fieldset clearfix"><h4>' . __('Top Image') . '</h4>';
$nb_img = count($images);
$nb_img_by_col = 1 + ($nb_img - $nb_img % 3) / 3;
echo '<div id="imgheaders">';
echo '<p>' . form::radio(['freshy_top_image','default'], 'default', $current_top_image == 'default') . __('Use custom theme default header') . '</p>';
$count = 0;
echo '<div class="three-cols"><div class="col"><ul>';
foreach ($images as $ref => $image) {
if ($count != 0 && $count % $nb_img_by_col == 0) {
echo '</ul></div><div class="col"><ul>';
}
echo '<li>' . form::radio(['freshy_top_image',$ref], $ref, ($current_top_image == $ref) ? 1 : 0) . '<img src="' . $image['thumb'] . '" alt="' . $ref . '" /></li>';
$count++;
}
echo '</ul></div></div></div>';
echo '</div>';