25 |
25 |
26 // $plugins->attachHook('session_started', 'SpecialAdmin_paths_init();'); |
26 // $plugins->attachHook('session_started', 'SpecialAdmin_paths_init();'); |
27 |
27 |
28 function SpecialAdmin_paths_init() |
28 function SpecialAdmin_paths_init() |
29 { |
29 { |
30 global $paths; |
30 global $paths; |
31 |
31 |
32 register_special_page('Administration', 'specialpage_administration'); |
32 register_special_page('Administration', 'specialpage_administration'); |
33 register_special_page('EditSidebar', 'specialpage_manage_sidebar'); |
33 register_special_page('EditSidebar', 'specialpage_manage_sidebar'); |
34 } |
34 } |
35 |
35 |
36 $plugins->attachHook('base_classes_initted', 'SpecialAdmin_include();'); |
36 $plugins->attachHook('base_classes_initted', 'SpecialAdmin_include();'); |
37 |
37 |
38 function SpecialAdmin_include() |
38 function SpecialAdmin_include() |
39 { |
39 { |
40 global $db, $session, $paths, $template, $plugins; // Common objects |
40 global $db, $session, $paths, $template, $plugins; // Common objects |
41 |
41 |
42 // Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1. |
42 // Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1. |
43 // Only load these files if we're looking to load the admin panel |
43 // Only load these files if we're looking to load the admin panel |
44 list($pid, $ns) = RenderMan::strToPageID($paths->get_pageid_from_url()); |
44 list($pid, $ns) = RenderMan::strToPageID($paths->get_pageid_from_url()); |
45 if ( $ns == 'Admin' || ( $pid == 'Administration' && $ns == 'Special' ) ) |
45 if ( $ns == 'Admin' || ( $pid == 'Administration' && $ns == 'Special' ) ) |
46 { |
46 { |
47 require(ENANO_ROOT . '/plugins/admin/Home.php'); |
47 require(ENANO_ROOT . '/plugins/admin/Home.php'); |
48 require(ENANO_ROOT . '/plugins/admin/PageManager.php'); |
48 require(ENANO_ROOT . '/plugins/admin/PageManager.php'); |
49 require(ENANO_ROOT . '/plugins/admin/PageEditor.php'); |
49 require(ENANO_ROOT . '/plugins/admin/PageEditor.php'); |
50 require(ENANO_ROOT . '/plugins/admin/PageGroups.php'); |
50 require(ENANO_ROOT . '/plugins/admin/PageGroups.php'); |
51 require(ENANO_ROOT . '/plugins/admin/GroupManager.php'); |
51 require(ENANO_ROOT . '/plugins/admin/GroupManager.php'); |
52 require(ENANO_ROOT . '/plugins/admin/SecurityLog.php'); |
52 require(ENANO_ROOT . '/plugins/admin/SecurityLog.php'); |
53 require(ENANO_ROOT . '/plugins/admin/UserManager.php'); |
53 require(ENANO_ROOT . '/plugins/admin/UserManager.php'); |
54 require(ENANO_ROOT . '/plugins/admin/UserRanks.php'); |
54 require(ENANO_ROOT . '/plugins/admin/UserRanks.php'); |
55 require(ENANO_ROOT . '/plugins/admin/LangManager.php'); |
55 require(ENANO_ROOT . '/plugins/admin/LangManager.php'); |
56 require(ENANO_ROOT . '/plugins/admin/ThemeManager.php'); |
56 require(ENANO_ROOT . '/plugins/admin/ThemeManager.php'); |
57 require(ENANO_ROOT . '/plugins/admin/PluginManager.php'); |
57 require(ENANO_ROOT . '/plugins/admin/PluginManager.php'); |
58 require(ENANO_ROOT . '/plugins/admin/CacheManager.php'); |
58 require(ENANO_ROOT . '/plugins/admin/CacheManager.php'); |
59 } |
59 } |
60 } |
60 } |
61 |
61 |
62 // For convenience and nothing more. |
62 // For convenience and nothing more. |
63 function acp_start_form() |
63 function acp_start_form() |
64 { |
64 { |
65 global $db, $session, $paths, $template, $plugins; // Common objects |
65 global $db, $session, $paths, $template, $plugins; // Common objects |
66 echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', ( isset($_GET['sqldbg']) ? 'sqldbg&' : '' ) . ( isset($_GET['nocompress']) ? 'nocompress&' : '' ) . 'module='.$paths->cpage['module']).'" method="post" enctype="multipart/form-data">'; |
66 echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', ( isset($_GET['sqldbg']) ? 'sqldbg&' : '' ) . ( isset($_GET['nocompress']) ? 'nocompress&' : '' ) . 'module='.$paths->cpage['module']).'" method="post" enctype="multipart/form-data">'; |
67 } |
67 } |
68 |
68 |
69 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
69 // function names are IMPORTANT!!! The name pattern is: page_<namespace ID>_<page URLname, without namespace> |
70 |
70 |
71 function page_Admin_GeneralConfig() |
71 function page_Admin_GeneralConfig() |
72 { |
72 { |
73 global $db, $session, $paths, $template, $plugins; // Common objects |
73 global $db, $session, $paths, $template, $plugins; // Common objects |
74 global $lang; |
74 global $lang; |
75 global $cache; |
75 global $cache; |
76 |
76 |
77 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
77 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
78 { |
78 { |
79 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
79 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
80 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
80 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
81 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
81 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
82 return; |
82 return; |
83 } |
83 } |
84 |
84 |
85 // FIXME: is this a bad place for this? I couldn't think of anything much better. Not helped by the fact that I hate misc scripts. |
85 // FIXME: is this a bad place for this? I couldn't think of anything much better. Not helped by the fact that I hate misc scripts. |
86 if ( isset($_POST['act']) && $_POST['act'] === 'gzip_check' ) |
86 if ( isset($_POST['act']) && $_POST['act'] === 'gzip_check' ) |
87 { |
87 { |
88 global $is_https; |
88 global $is_https; |
89 header('Content-type: application/json'); |
89 header('Content-type: application/json'); |
90 require(ENANO_ROOT . '/includes/http.php'); |
90 require(ENANO_ROOT . '/includes/http.php'); |
91 try |
91 try |
92 { |
92 { |
93 if ( !isset($_SERVER['SERVER_ADDR']) ) |
93 if ( !isset($_SERVER['SERVER_ADDR']) ) |
94 throw new Exception('No SERVER_ADDR support - can\'t test server environment'); |
94 throw new Exception('No SERVER_ADDR support - can\'t test server environment'); |
95 |
95 |
96 $server_addr = $_SERVER['SERVER_ADDR']; |
96 $server_addr = $_SERVER['SERVER_ADDR']; |
97 // cheap ipv6 test |
97 // cheap ipv6 test |
98 if ( strstr($server_addr, ":") ) |
98 if ( strstr($server_addr, ":") ) |
99 $server_addr = "[$server_addr]"; |
99 $server_addr = "[$server_addr]"; |
100 |
100 |
101 $req = new Request_HTTP($server_addr, makeUrlNS('System', 'GzipTest', 'disable_builtin_gzip'), 'GET', intval($_SERVER['SERVER_PORT']), $is_https); |
101 $req = new Request_HTTP($server_addr, makeUrlNS('System', 'GzipTest', 'disable_builtin_gzip'), 'GET', intval($_SERVER['SERVER_PORT']), $is_https); |
102 $req->add_header('Accept-Encoding', 'gzip,deflate'); |
102 $req->add_header('Accept-Encoding', 'gzip,deflate'); |
103 $headers = $req->get_response_headers_array(); |
103 $headers = $req->get_response_headers_array(); |
104 $send = array( |
104 $send = array( |
105 'server_does_it' => ( isset($headers['Content-encoding']) && in_array($headers['Content-encoding'], array('gzip', 'deflate')) ), |
105 'server_does_it' => ( isset($headers['Content-encoding']) && in_array($headers['Content-encoding'], array('gzip', 'deflate')) ), |
106 'php_supports_gzip' => function_exists('gzdeflate') |
106 'php_supports_gzip' => function_exists('gzdeflate') |
107 ); |
107 ); |
108 } |
108 } |
109 catch ( Exception $e ) |
109 catch ( Exception $e ) |
110 { |
110 { |
111 $send = array( |
111 $send = array( |
112 'mode' => 'error', |
112 'mode' => 'error', |
113 'error' => "HTTP request exception: <pre>$e</pre>" |
113 'error' => "HTTP request exception: <pre>$e</pre>" |
114 ); |
114 ); |
115 } |
115 } |
116 echo enano_json_encode($send); |
116 echo enano_json_encode($send); |
117 return; |
117 return; |
118 } |
118 } |
119 |
119 |
120 if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') ) |
120 if(isset($_POST['submit']) && !defined('ENANO_DEMO_MODE') ) |
121 { |
121 { |
122 |
122 |
123 // Global site options |
123 // Global site options |
124 setConfig('site_name', $_POST['site_name']); |
124 setConfig('site_name', $_POST['site_name']); |
125 setConfig('site_desc', $_POST['site_desc']); |
125 setConfig('site_desc', $_POST['site_desc']); |
126 setConfig('main_page', sanitize_page_id($_POST['main_page'])); |
126 setConfig('main_page', sanitize_page_id($_POST['main_page'])); |
127 setConfig('copyright_notice', $_POST['copyright']); |
127 setConfig('copyright_notice', $_POST['copyright']); |
128 setConfig('contact_email', $_POST['contact_email']); |
128 setConfig('contact_email', $_POST['contact_email']); |
129 |
129 |
130 setConfig('main_page_alt_enable', ( isset($_POST['main_page_alt_enable']) && $_POST['main_page_alt_enable'] === '1' ? '1' : '0' )); |
130 setConfig('main_page_alt_enable', ( isset($_POST['main_page_alt_enable']) && $_POST['main_page_alt_enable'] === '1' ? '1' : '0' )); |
131 if ( !empty($_POST['main_page_alt']) ) |
131 if ( !empty($_POST['main_page_alt']) ) |
132 { |
132 { |
133 setConfig('main_page_alt', sanitize_page_id($_POST['main_page_alt'])); |
133 setConfig('main_page_alt', sanitize_page_id($_POST['main_page_alt'])); |
134 } |
134 } |
135 |
135 |
136 // Wiki mode |
136 // Wiki mode |
137 if(isset($_POST['wikimode'])) setConfig('wiki_mode', '1'); |
137 if(isset($_POST['wikimode'])) setConfig('wiki_mode', '1'); |
138 else setConfig('wiki_mode', '0'); |
138 else setConfig('wiki_mode', '0'); |
139 if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1'); |
139 if(isset($_POST['wiki_mode_require_login'])) setConfig('wiki_mode_require_login', '1'); |
140 else setConfig('wiki_mode_require_login', '0'); |
140 else setConfig('wiki_mode_require_login', '0'); |
141 if(isset($_POST['editmsg'])) setConfig('wiki_edit_notice', '1'); |
141 if(isset($_POST['editmsg'])) setConfig('wiki_edit_notice', '1'); |
142 else setConfig('wiki_edit_notice', '0'); |
142 else setConfig('wiki_edit_notice', '0'); |
143 setConfig('wiki_edit_notice_text', $_POST['editmsg_text']); |
143 setConfig('wiki_edit_notice_text', $_POST['editmsg_text']); |
144 $cache->purge('wiki_edit_notice'); |
144 $cache->purge('wiki_edit_notice'); |
145 if(isset($_POST['guest_edit_require_captcha'])) setConfig('guest_edit_require_captcha', '1'); |
145 if(isset($_POST['guest_edit_require_captcha'])) setConfig('guest_edit_require_captcha', '1'); |
146 else setConfig('guest_edit_require_captcha', '0'); |
146 else setConfig('guest_edit_require_captcha', '0'); |
147 |
147 |
148 // Stats |
148 // Stats |
149 if(isset($_POST['log_hits'])) setConfig('log_hits', '1'); |
149 if(isset($_POST['log_hits'])) setConfig('log_hits', '1'); |
150 else setConfig('log_hits', '0'); |
150 else setConfig('log_hits', '0'); |
151 |
151 |
152 // Disablement |
152 // Disablement |
153 if(isset($_POST['site_disabled'])) { setConfig('site_disabled', '1'); setConfig('site_disabled_notice', $_POST['site_disabled_notice']); } |
153 if(isset($_POST['site_disabled'])) { setConfig('site_disabled', '1'); setConfig('site_disabled_notice', $_POST['site_disabled_notice']); } |
154 else setConfig('site_disabled', '0'); |
154 else setConfig('site_disabled', '0'); |
155 |
155 |
156 // Account activation |
156 // Account activation |
157 setConfig('account_activation', $_POST['account_activation']); |
157 setConfig('account_activation', $_POST['account_activation']); |
158 |
158 |
159 // W3C compliance buttons |
159 // W3C compliance buttons |
160 if(isset($_POST['w3c-vh32'])) setConfig("w3c_vh32", "1"); |
160 if(isset($_POST['w3c-vh32'])) setConfig("w3c_vh32", "1"); |
161 else setConfig("w3c_vh32", "0"); |
161 else setConfig("w3c_vh32", "0"); |
162 if(isset($_POST['w3c-vh40'])) setConfig("w3c_vh40", "1"); |
162 if(isset($_POST['w3c-vh40'])) setConfig("w3c_vh40", "1"); |
163 else setConfig("w3c_vh40", "0"); |
163 else setConfig("w3c_vh40", "0"); |
164 if(isset($_POST['w3c-vh401'])) setConfig("w3c_vh401", "1"); |
164 if(isset($_POST['w3c-vh401'])) setConfig("w3c_vh401", "1"); |
165 else setConfig("w3c_vh401", "0"); |
165 else setConfig("w3c_vh401", "0"); |
166 if(isset($_POST['w3c-vxhtml10'])) setConfig("w3c_vxhtml10", "1"); |
166 if(isset($_POST['w3c-vxhtml10'])) setConfig("w3c_vxhtml10", "1"); |
167 else setConfig("w3c_vxhtml10", "0"); |
167 else setConfig("w3c_vxhtml10", "0"); |
168 if(isset($_POST['w3c-vxhtml11'])) setConfig("w3c_vxhtml11", "1"); |
168 if(isset($_POST['w3c-vxhtml11'])) setConfig("w3c_vxhtml11", "1"); |
169 else setConfig("w3c_vxhtml11", "0"); |
169 else setConfig("w3c_vxhtml11", "0"); |
170 if(isset($_POST['w3c-vcss'])) setConfig("w3c_vcss", "1"); |
170 if(isset($_POST['w3c-vcss'])) setConfig("w3c_vcss", "1"); |
171 else setConfig("w3c_vcss", "0"); |
171 else setConfig("w3c_vcss", "0"); |
172 |
172 |
173 // SourceForge.net logo |
173 // SourceForge.net logo |
174 if(isset($_POST['showsf'])) setConfig('sflogo_enabled', '1'); |
174 if(isset($_POST['showsf'])) setConfig('sflogo_enabled', '1'); |
175 else setConfig('sflogo_enabled', '0'); |
175 else setConfig('sflogo_enabled', '0'); |
176 setConfig('sflogo_groupid', $_POST['sfgroup']); |
176 setConfig('sflogo_groupid', $_POST['sfgroup']); |
177 setConfig('sflogo_type', $_POST['sflogo']); |
177 setConfig('sflogo_type', $_POST['sflogo']); |
178 |
178 |
179 // Comment options |
179 // Comment options |
180 if(isset($_POST['comment-approval'])) setConfig('approve_comments', '1'); |
180 if(isset($_POST['comment-approval'])) setConfig('approve_comments', '1'); |
181 else setConfig('approve_comments', '0'); |
181 else setConfig('approve_comments', '0'); |
182 if(isset($_POST['enable-comments'])) setConfig('enable_comments', '1'); |
182 if(isset($_POST['enable-comments'])) setConfig('enable_comments', '1'); |
183 else setConfig('enable_comments', '0'); |
183 else setConfig('enable_comments', '0'); |
184 setConfig('comments_need_login', $_POST['comments_need_login']); |
184 setConfig('comments_need_login', $_POST['comments_need_login']); |
185 if ( in_array($_POST['comment_spam_policy'], array('moderate', 'reject', 'accept')) ) |
185 if ( in_array($_POST['comment_spam_policy'], array('moderate', 'reject', 'accept')) ) |
186 { |
186 { |
187 setConfig('comment_spam_policy', $_POST['comment_spam_policy']); |
187 setConfig('comment_spam_policy', $_POST['comment_spam_policy']); |
188 } |
188 } |
189 |
189 |
190 // Powered by link |
190 // Powered by link |
191 if ( isset($_POST['enano_powered_link']) ) setConfig('powered_btn', '1'); |
191 if ( isset($_POST['enano_powered_link']) ) setConfig('powered_btn', '1'); |
192 else setConfig('powered_btn', '0'); |
192 else setConfig('powered_btn', '0'); |
193 |
193 |
194 if(isset($_POST['dbdbutton'])) setConfig('dbd_button', '1'); |
194 if(isset($_POST['dbdbutton'])) setConfig('dbd_button', '1'); |
195 else setConfig('dbd_button', '0'); |
195 else setConfig('dbd_button', '0'); |
196 |
196 |
197 if($_POST['emailmethod'] == 'phpmail') setConfig('smtp_enabled', '0'); |
197 if($_POST['emailmethod'] == 'phpmail') setConfig('smtp_enabled', '0'); |
198 else setConfig('smtp_enabled', '1'); |
198 else setConfig('smtp_enabled', '1'); |
199 |
199 |
200 setConfig('smtp_server', $_POST['smtp_host']); |
200 setConfig('smtp_server', $_POST['smtp_host']); |
201 setConfig('smtp_user', $_POST['smtp_user']); |
201 setConfig('smtp_user', $_POST['smtp_user']); |
202 if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']); |
202 if($_POST['smtp_pass'] != 'XXXXXXXXXXXX') setConfig('smtp_password', $_POST['smtp_pass']); |
203 |
203 |
204 // Password strength |
204 // Password strength |
205 if ( isset($_POST['pw_strength_enable']) ) setConfig('pw_strength_enable', '1'); |
205 if ( isset($_POST['pw_strength_enable']) ) setConfig('pw_strength_enable', '1'); |
206 else setConfig('pw_strength_enable', '0'); |
206 else setConfig('pw_strength_enable', '0'); |
207 |
207 |
208 $strength = intval($_POST['pw_strength_minimum']); |
208 $strength = intval($_POST['pw_strength_minimum']); |
209 if ( $strength >= -10 && $strength <= 30 ) |
209 if ( $strength >= -10 && $strength <= 30 ) |
210 { |
210 { |
211 $strength = strval($strength); |
211 $strength = strval($strength); |
212 setConfig('pw_strength_minimum', $strength); |
212 setConfig('pw_strength_minimum', $strength); |
213 } |
213 } |
214 |
214 |
215 // Default theme |
215 // Default theme |
216 $default_theme = ( isset($template->named_theme_list[@$_POST['default_theme']]) ) ? $_POST['default_theme'] : $template->theme_list[0]['theme_id']; |
216 $default_theme = ( isset($template->named_theme_list[@$_POST['default_theme']]) ) ? $_POST['default_theme'] : $template->theme_list[0]['theme_id']; |
217 setConfig('theme_default', $default_theme); |
217 setConfig('theme_default', $default_theme); |
218 |
218 |
219 // Breadcrumb mode |
219 // Breadcrumb mode |
220 if ( in_array($_POST['breadcrumb_mode'], array('subpages', 'always', 'never')) ) |
220 if ( in_array($_POST['breadcrumb_mode'], array('subpages', 'always', 'never')) ) |
221 { |
221 { |
222 setConfig('breadcrumb_mode', $_POST['breadcrumb_mode']); |
222 setConfig('breadcrumb_mode', $_POST['breadcrumb_mode']); |
223 } |
223 } |
224 |
224 |
225 // CDN path |
225 // CDN path |
226 if ( preg_match('/^http:\/\//', $_POST['cdn_path']) || $_POST['cdn_path'] === '' ) |
226 if ( preg_match('/^http:\/\//', $_POST['cdn_path']) || $_POST['cdn_path'] === '' ) |
227 { |
227 { |
228 // trim off a trailing slash |
228 // trim off a trailing slash |
229 setConfig('cdn_path', preg_replace('#/$#', '', $_POST['cdn_path'])); |
229 setConfig('cdn_path', preg_replace('#/$#', '', $_POST['cdn_path'])); |
230 } |
230 } |
231 |
231 |
232 setConfig('register_tou', RenderMan::preprocess_text($_POST['register_tou'], true, false)); |
232 setConfig('register_tou', RenderMan::preprocess_text($_POST['register_tou'], true, false)); |
233 |
233 |
234 // Account lockout policy |
234 // Account lockout policy |
235 if ( ctype_digit($_POST['lockout_threshold']) ) |
235 if ( ctype_digit($_POST['lockout_threshold']) ) |
236 setConfig('lockout_threshold', $_POST['lockout_threshold']); |
236 setConfig('lockout_threshold', $_POST['lockout_threshold']); |
237 |
237 |
238 if ( ctype_digit($_POST['lockout_duration']) ) |
238 if ( ctype_digit($_POST['lockout_duration']) ) |
239 setConfig('lockout_duration', $_POST['lockout_duration']); |
239 setConfig('lockout_duration', $_POST['lockout_duration']); |
240 |
240 |
241 if ( in_array($_POST['lockout_policy'], array('disable', 'captcha', 'lockout')) ) |
241 if ( in_array($_POST['lockout_policy'], array('disable', 'captcha', 'lockout')) ) |
242 setConfig('lockout_policy', $_POST['lockout_policy']); |
242 setConfig('lockout_policy', $_POST['lockout_policy']); |
243 |
243 |
244 // Session time |
244 // Session time |
245 foreach ( array('session_short_time', 'session_remember_time') as $k ) |
245 foreach ( array('session_short_time', 'session_remember_time') as $k ) |
246 { |
246 { |
247 if ( strval(intval($_POST[$k])) === $_POST[$k] && intval($_POST[$k]) >= 0 ) |
247 if ( strval(intval($_POST[$k])) === $_POST[$k] && intval($_POST[$k]) >= 0 ) |
248 { |
248 { |
249 setConfig($k, $_POST[$k]); |
249 setConfig($k, $_POST[$k]); |
250 } |
250 } |
251 } |
251 } |
252 |
252 |
253 // Avatar settings |
253 // Avatar settings |
254 setConfig('avatar_enable', ( isset($_POST['avatar_enable']) ? '1' : '0' )); |
254 setConfig('avatar_enable', ( isset($_POST['avatar_enable']) ? '1' : '0' )); |
255 // for these next three values, set the config value if it's a valid integer; this is |
255 // for these next three values, set the config value if it's a valid integer; this is |
256 // done by using strval(intval($foo)) === $foo, which flattens $foo to an integer and |
256 // done by using strval(intval($foo)) === $foo, which flattens $foo to an integer and |
257 // then converts it back to a string. This effectively verifies that var $foo is both |
257 // then converts it back to a string. This effectively verifies that var $foo is both |
258 // set and that it's a valid string representing an integer. |
258 // set and that it's a valid string representing an integer. |
259 setConfig('avatar_max_size', ( strval(intval($_POST['avatar_max_size'])) === $_POST['avatar_max_size'] ? $_POST['avatar_max_size'] : '10240' )); |
259 setConfig('avatar_max_size', ( strval(intval($_POST['avatar_max_size'])) === $_POST['avatar_max_size'] ? $_POST['avatar_max_size'] : '10240' )); |
260 setConfig('avatar_max_width', ( strval(intval($_POST['avatar_max_width'])) === $_POST['avatar_max_width'] ? $_POST['avatar_max_width'] : '96' )); |
260 setConfig('avatar_max_width', ( strval(intval($_POST['avatar_max_width'])) === $_POST['avatar_max_width'] ? $_POST['avatar_max_width'] : '96' )); |
261 setConfig('avatar_max_height', ( strval(intval($_POST['avatar_max_height'])) === $_POST['avatar_max_height'] ? $_POST['avatar_max_height'] : '96' )); |
261 setConfig('avatar_max_height', ( strval(intval($_POST['avatar_max_height'])) === $_POST['avatar_max_height'] ? $_POST['avatar_max_height'] : '96' )); |
262 setConfig('avatar_enable_anim', ( isset($_POST['avatar_enable_anim']) ? '1' : '0' )); |
262 setConfig('avatar_enable_anim', ( isset($_POST['avatar_enable_anim']) ? '1' : '0' )); |
263 setConfig('avatar_upload_file', ( isset($_POST['avatar_upload_file']) ? '1' : '0' )); |
263 setConfig('avatar_upload_file', ( isset($_POST['avatar_upload_file']) ? '1' : '0' )); |
264 setConfig('avatar_upload_http', ( isset($_POST['avatar_upload_http']) ? '1' : '0' )); |
264 setConfig('avatar_upload_http', ( isset($_POST['avatar_upload_http']) ? '1' : '0' )); |
265 setConfig('avatar_upload_gravatar', ( isset($_POST['avatar_upload_gravatar']) ? '1' : '0' )); |
265 setConfig('avatar_upload_gravatar', ( isset($_POST['avatar_upload_gravatar']) ? '1' : '0' )); |
266 if ( in_array($_POST['gravatar_rating'], array('g', 'pg', 'r', 'x')) ) |
266 if ( in_array($_POST['gravatar_rating'], array('g', 'pg', 'r', 'x')) ) |
267 { |
267 { |
268 setConfig('gravatar_rating', $_POST['gravatar_rating']); |
268 setConfig('gravatar_rating', $_POST['gravatar_rating']); |
269 } |
269 } |
270 |
270 |
271 setConfig('avatar_directory', 'files/avatars'); |
271 setConfig('avatar_directory', 'files/avatars'); |
272 |
272 |
273 setConfig('userpage_grant_acl', ( isset($_POST['userpage_grant_acl']) ? '1' : '0' )); |
273 setConfig('userpage_grant_acl', ( isset($_POST['userpage_grant_acl']) ? '1' : '0' )); |
274 setConfig('gzip_output', ( isset($_POST['gzip_output']) ? '1' : '0' )); |
274 setConfig('gzip_output', ( isset($_POST['gzip_output']) ? '1' : '0' )); |
275 |
275 |
276 // Allow plugins to save their changes |
276 // Allow plugins to save their changes |
277 $code = $plugins->setHook('acp_general_save'); |
277 $code = $plugins->setHook('acp_general_save'); |
278 foreach ( $code as $cmd ) |
278 foreach ( $code as $cmd ) |
279 { |
279 { |
280 eval($cmd); |
280 eval($cmd); |
281 } |
281 } |
282 |
282 |
283 echo '<div class="info-box">' . $lang->get('acpgc_msg_save_success') . '</div><br />'; |
283 echo '<div class="info-box">' . $lang->get('acpgc_msg_save_success') . '</div><br />'; |
284 |
284 |
285 } |
285 } |
286 else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') ) |
286 else if ( isset($_POST['submit']) && defined('ENANO_DEMO_MODE') ) |
287 { |
287 { |
288 echo '<div class="error-box">Saving the general site configuration is blocked in the administration demo.</div>'; |
288 echo '<div class="error-box">Saving the general site configuration is blocked in the administration demo.</div>'; |
289 } |
289 } |
290 echo('<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post" onsubmit="if(!submitAuthorized) return false;">'); |
290 echo('<form name="main" action="'.htmlspecialchars(makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module'])).'" method="post" onsubmit="if(!submitAuthorized) return false;">'); |
291 ?> |
291 ?> |
292 <div class="tblholder"> |
292 <div class="tblholder"> |
293 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
293 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
294 |
294 |
295 <!-- Global options --> |
295 <!-- Global options --> |
296 |
296 |
297 <tr><th colspan="2"><?php echo $lang->get('acpgc_heading_main'); ?></th></tr> |
297 <tr><th colspan="2"><?php echo $lang->get('acpgc_heading_main'); ?></th></tr> |
298 |
298 |
299 <tr> |
299 <tr> |
300 <th colspan="2" class="subhead"><?php echo $lang->get('acpgc_heading_submain'); ?></th> |
300 <th colspan="2" class="subhead"><?php echo $lang->get('acpgc_heading_submain'); ?></th> |
301 </tr> |
301 </tr> |
302 |
302 |
303 <!-- site name --> |
303 <!-- site name --> |
304 |
304 |
305 <tr> |
305 <tr> |
306 <td class="row1" style="width: 50%;"> |
306 <td class="row1" style="width: 50%;"> |
307 <?php echo $lang->get('acpgc_field_site_name'); ?> |
307 <?php echo $lang->get('acpgc_field_site_name'); ?> |
308 </td> |
308 </td> |
309 <td class="row1" style="width: 50%;"> |
309 <td class="row1" style="width: 50%;"> |
310 <input type="text" name="site_name" size="30" value="<?php echo htmlspecialchars(getConfig('site_name')); ?>" /> |
310 <input type="text" name="site_name" size="30" value="<?php echo htmlspecialchars(getConfig('site_name')); ?>" /> |
311 </td> |
311 </td> |
312 </tr> |
312 </tr> |
313 |
313 |
314 <!-- site tagline --> |
314 <!-- site tagline --> |
315 <tr> |
315 <tr> |
316 <td class="row2"> |
316 <td class="row2"> |
317 <?php echo $lang->get('acpgc_field_site_desc'); ?> |
317 <?php echo $lang->get('acpgc_field_site_desc'); ?> |
318 </td> |
318 </td> |
319 <td class="row2"> |
319 <td class="row2"> |
320 <input type="text" name="site_desc" size="30" value="<?php echo htmlspecialchars(getConfig('site_desc')); ?>" /> |
320 <input type="text" name="site_desc" size="30" value="<?php echo htmlspecialchars(getConfig('site_desc')); ?>" /> |
321 </td> |
321 </td> |
322 </tr> |
322 </tr> |
323 |
323 |
324 <!-- main page --> |
324 <!-- main page --> |
325 <tr> |
325 <tr> |
326 <td class="row1"> |
326 <td class="row1"> |
327 <?php echo $lang->get('acpgc_field_main_page'); ?></td> |
327 <?php echo $lang->get('acpgc_field_main_page'); ?></td> |
328 <td class="row1"> |
328 <td class="row1"> |
329 <?php echo $template->pagename_field('main_page', sanitize_page_id(getConfig('main_page', 'Main_Page'))); ?><br /> |
329 <?php echo $template->pagename_field('main_page', sanitize_page_id(getConfig('main_page', 'Main_Page'))); ?><br /> |
330 <label><input type="radio" name="main_page_alt_enable" value="0" onclick="$('#main_page_alt_tr').hide();" <?php if ( getConfig('main_page_alt_enable', '0') == '0' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_main_page_option_same'); ?></label><br /> |
330 <label><input type="radio" name="main_page_alt_enable" value="0" onclick="$('#main_page_alt_tr').hide();" <?php if ( getConfig('main_page_alt_enable', '0') == '0' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_main_page_option_same'); ?></label><br /> |
331 <label><input type="radio" name="main_page_alt_enable" value="1" onclick="$('#main_page_alt_tr').show();" <?php if ( getConfig('main_page_alt_enable', '0') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_main_page_option_members'); ?></label> |
331 <label><input type="radio" name="main_page_alt_enable" value="1" onclick="$('#main_page_alt_tr').show();" <?php if ( getConfig('main_page_alt_enable', '0') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_main_page_option_members'); ?></label> |
332 </td> |
332 </td> |
333 </tr> |
333 </tr> |
334 <tr id="main_page_alt_tr"<?php if ( getConfig('main_page_alt_enable', '0') == '0' ) echo ' style="display: none;"'; ?>> |
334 <tr id="main_page_alt_tr"<?php if ( getConfig('main_page_alt_enable', '0') == '0' ) echo ' style="display: none;"'; ?>> |
335 <td class="row3"> |
335 <td class="row3"> |
336 <?php echo $lang->get('acpgc_field_main_page_members'); ?> |
336 <?php echo $lang->get('acpgc_field_main_page_members'); ?> |
337 </td> |
337 </td> |
338 <td class="row3"> |
338 <td class="row3"> |
339 <?php echo $template->pagename_field('main_page_alt', sanitize_page_id(getConfig('main_page_alt', /* default alt to current main page */ getConfig('main_page', 'Main_Page')))); ?> |
339 <?php echo $template->pagename_field('main_page_alt', sanitize_page_id(getConfig('main_page_alt', /* default alt to current main page */ getConfig('main_page', 'Main_Page')))); ?> |
340 </td> |
340 </td> |
341 </tr> |
341 </tr> |
342 |
342 |
343 <!-- copyright notice --> |
343 <!-- copyright notice --> |
344 <tr> |
344 <tr> |
345 <td class="row2"> |
345 <td class="row2"> |
346 <?php echo $lang->get('acpgc_field_copyright'); ?> |
346 <?php echo $lang->get('acpgc_field_copyright'); ?> |
347 </td> |
347 </td> |
348 <td class="row2"> |
348 <td class="row2"> |
349 <input type="text" name="copyright" size="30" value="<?php echo htmlspecialchars(getConfig('copyright_notice')); ?>" /> |
349 <input type="text" name="copyright" size="30" value="<?php echo htmlspecialchars(getConfig('copyright_notice')); ?>" /> |
350 </td> |
350 </td> |
351 </tr> |
351 </tr> |
352 <tr> |
352 <tr> |
353 <td class="row1" colspan="2"> |
353 <td class="row1" colspan="2"> |
354 <?php echo $lang->get('acpgc_field_copyright_hint'); ?> |
354 <?php echo $lang->get('acpgc_field_copyright_hint'); ?> |
355 </td> |
355 </td> |
356 </tr> |
356 </tr> |
357 |
357 |
358 <!-- contact e-mail --> |
358 <!-- contact e-mail --> |
359 <tr> |
359 <tr> |
360 <td class="row2"> |
360 <td class="row2"> |
361 <?php echo $lang->get('acpgc_field_contactemail'); ?><br /> |
361 <?php echo $lang->get('acpgc_field_contactemail'); ?><br /> |
362 <small><?php echo $lang->get('acpgc_field_contactemail_hint'); ?></small> |
362 <small><?php echo $lang->get('acpgc_field_contactemail_hint'); ?></small> |
363 </td> |
363 </td> |
364 <td class="row2"> |
364 <td class="row2"> |
365 <input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" /> |
365 <input name="contact_email" type="text" size="40" value="<?php echo htmlspecialchars(getConfig('contact_email')); ?>" /> |
366 </td> |
366 </td> |
367 </tr> |
367 </tr> |
368 |
368 |
369 <!-- Wiki mode --> |
369 <!-- Wiki mode --> |
370 |
370 |
371 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_wikimode'); ?></th></tr> |
371 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_wikimode'); ?></th></tr> |
372 |
372 |
373 <tr> |
373 <tr> |
374 <td class="row3" rowspan="2"> |
374 <td class="row3" rowspan="2"> |
375 <?php echo $lang->get('acpgc_field_wikimode_intro'); ?><br /><br /> |
375 <?php echo $lang->get('acpgc_field_wikimode_intro'); ?><br /><br /> |
376 <?php echo $lang->get('acpgc_field_wikimode_info_sanitize'); ?><br /><br /> |
376 <?php echo $lang->get('acpgc_field_wikimode_info_sanitize'); ?><br /><br /> |
377 <?php echo $lang->get('acpgc_field_wikimode_info_history'); ?> |
377 <?php echo $lang->get('acpgc_field_wikimode_info_history'); ?> |
378 </td> |
378 </td> |
379 <td class="row1"> |
379 <td class="row1"> |
380 <input type="checkbox" name="wikimode" id="wikimode" <?php if(getConfig('wiki_mode')=='1') echo('CHECKED '); ?> /><label for="wikimode"><?php echo $lang->get('acpgc_field_wikimode'); ?></label> |
380 <input type="checkbox" name="wikimode" id="wikimode" <?php if(getConfig('wiki_mode')=='1') echo('CHECKED '); ?> /><label for="wikimode"><?php echo $lang->get('acpgc_field_wikimode'); ?></label> |
381 </td> |
381 </td> |
382 </tr> |
382 </tr> |
383 |
383 |
384 <tr><td class="row2"><label><input type="checkbox" name="wiki_mode_require_login"<?php if(getConfig('wiki_mode_require_login')=='1') echo('CHECKED '); ?>/> Only for logged in users</label></td></tr> |
384 <tr><td class="row2"><label><input type="checkbox" name="wiki_mode_require_login"<?php if(getConfig('wiki_mode_require_login')=='1') echo('CHECKED '); ?>/> Only for logged in users</label></td></tr> |
385 |
385 |
386 <tr> |
386 <tr> |
387 <td class="row3" rowspan="2"> |
387 <td class="row3" rowspan="2"> |
388 <b><?php echo $lang->get('acpgc_field_editnotice_title'); ?></b><br /> |
388 <b><?php echo $lang->get('acpgc_field_editnotice_title'); ?></b><br /> |
389 <?php echo $lang->get('acpgc_field_editnotice_info'); ?> |
389 <?php echo $lang->get('acpgc_field_editnotice_info'); ?> |
390 </td> |
390 </td> |
391 <td class="row1"> |
391 <td class="row1"> |
392 <input onclick="if(this.checked) document.getElementById('editmsg_text').style.display='block'; else document.getElementById('editmsg_text').style.display='none';" type="checkbox" name="editmsg" id="editmsg" <?php if(getConfig('wiki_edit_notice', '0')=='1') echo('CHECKED '); ?>/> |
392 <input onclick="if(this.checked) document.getElementById('editmsg_text').style.display='block'; else document.getElementById('editmsg_text').style.display='none';" type="checkbox" name="editmsg" id="editmsg" <?php if(getConfig('wiki_edit_notice', '0')=='1') echo('CHECKED '); ?>/> |
393 <label for="editmsg"><?php echo $lang->get('acpgc_field_editnotice'); ?></label> |
393 <label for="editmsg"><?php echo $lang->get('acpgc_field_editnotice'); ?></label> |
394 </td> |
394 </td> |
395 </tr> |
395 </tr> |
396 |
396 |
397 <tr> |
397 <tr> |
398 <td class="row2"> |
398 <td class="row2"> |
399 <textarea <?php if(getConfig('wiki_edit_notice', '0')!='1') echo('style="display:none" '); ?>rows="5" cols="30" name="editmsg_text" id="editmsg_text"><?php echo getConfig('wiki_edit_notice_text'); ?></textarea> |
399 <textarea <?php if(getConfig('wiki_edit_notice', '0')!='1') echo('style="display:none" '); ?>rows="5" cols="30" name="editmsg_text" id="editmsg_text"><?php echo getConfig('wiki_edit_notice_text'); ?></textarea> |
400 </td> |
400 </td> |
401 </tr> |
401 </tr> |
402 |
402 |
403 <tr> |
403 <tr> |
404 <td class="row1"> |
404 <td class="row1"> |
405 <b><?php echo $lang->get('acpgc_field_edit_require_captcha_title'); ?></b><br /> |
405 <b><?php echo $lang->get('acpgc_field_edit_require_captcha_title'); ?></b><br /> |
406 <?php echo $lang->get('acpgc_field_edit_require_captcha_hint'); ?> |
406 <?php echo $lang->get('acpgc_field_edit_require_captcha_hint'); ?> |
407 </td> |
407 </td> |
408 <td class="row1"> |
408 <td class="row1"> |
409 <label> |
409 <label> |
410 <input type="checkbox" name="guest_edit_require_captcha" <?php if ( getConfig('guest_edit_require_captcha') == '1' ) echo 'checked="checked" '; ?>/> |
410 <input type="checkbox" name="guest_edit_require_captcha" <?php if ( getConfig('guest_edit_require_captcha') == '1' ) echo 'checked="checked" '; ?>/> |
411 <?php echo $lang->get('acpgc_field_edit_require_captcha'); ?> |
411 <?php echo $lang->get('acpgc_field_edit_require_captcha'); ?> |
412 </label> |
412 </label> |
413 </td> |
413 </td> |
414 </tr> |
414 </tr> |
415 |
415 |
416 <!-- Site statistics --> |
416 <!-- Site statistics --> |
417 |
417 |
418 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_stats'); ?></th></tr> |
418 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_stats'); ?></th></tr> |
419 |
419 |
420 <tr> |
420 <tr> |
421 <td class="row1"> |
421 <td class="row1"> |
422 <?php echo $lang->get('acpgc_stats_intro'); ?><br /><br /> |
422 <?php echo $lang->get('acpgc_stats_intro'); ?><br /><br /> |
423 <?php echo $lang->get('acpgc_stats_hint_privacy'); ?> |
423 <?php echo $lang->get('acpgc_stats_hint_privacy'); ?> |
424 </td> |
424 </td> |
425 <td class="row1"> |
425 <td class="row1"> |
426 <label> |
426 <label> |
427 <input type="checkbox" name="log_hits" <?php if(getConfig('log_hits') == '1') echo 'checked="checked" '; ?>/> |
427 <input type="checkbox" name="log_hits" <?php if(getConfig('log_hits') == '1') echo 'checked="checked" '; ?>/> |
428 <?php echo $lang->get('acpgc_field_stats_enable'); ?> |
428 <?php echo $lang->get('acpgc_field_stats_enable'); ?> |
429 </label><br /> |
429 </label><br /> |
430 <small><?php echo $lang->get('acpgc_field_stats_hint'); ?></small> |
430 <small><?php echo $lang->get('acpgc_field_stats_hint'); ?></small> |
431 </td> |
431 </td> |
432 </tr> |
432 </tr> |
433 |
433 |
434 <!-- Comment options --> |
434 <!-- Comment options --> |
435 |
435 |
436 <tr> |
436 <tr> |
437 <th class="subhead" colspan="2"> |
437 <th class="subhead" colspan="2"> |
438 <?php echo $lang->get('acpgc_heading_comments'); ?> |
438 <?php echo $lang->get('acpgc_heading_comments'); ?> |
439 </th> |
439 </th> |
440 </tr> |
440 </tr> |
441 |
441 |
442 <tr> |
442 <tr> |
443 <td class="row1"> |
443 <td class="row1"> |
444 <label for="enable-comments"> |
444 <label for="enable-comments"> |
445 <b><?php echo $lang->get('acpgc_field_enable_comments'); ?></b> |
445 <b><?php echo $lang->get('acpgc_field_enable_comments'); ?></b> |
446 </label> |
446 </label> |
447 </td> |
447 </td> |
448 <td class="row1"> |
448 <td class="row1"> |
449 <input name="enable-comments" id="enable-comments" type="checkbox" <?php if(getConfig('enable_comments', '1')=='1') echo('CHECKED '); ?>/> |
449 <input name="enable-comments" id="enable-comments" type="checkbox" <?php if(getConfig('enable_comments', '1')=='1') echo('CHECKED '); ?>/> |
450 </td> |
450 </td> |
451 </tr> |
451 </tr> |
452 |
452 |
453 <tr> |
453 <tr> |
454 <td class="row2"> |
454 <td class="row2"> |
455 <label for="comment-approval"> |
455 <label for="comment-approval"> |
456 <?php echo $lang->get('acpgc_field_approve_comments'); ?> |
456 <?php echo $lang->get('acpgc_field_approve_comments'); ?> |
457 </label> |
457 </label> |
458 </td> |
458 </td> |
459 <td class="row2"> |
459 <td class="row2"> |
460 <input name="comment-approval" id="comment-approval" type="checkbox" <?php if(getConfig('approve_comments', '0')=='1') echo('CHECKED '); ?>/> |
460 <input name="comment-approval" id="comment-approval" type="checkbox" <?php if(getConfig('approve_comments', '0')=='1') echo('CHECKED '); ?>/> |
461 </td> |
461 </td> |
462 </tr> |
462 </tr> |
463 |
463 |
464 <tr> |
464 <tr> |
465 <td class="row1"> |
465 <td class="row1"> |
466 <?php echo $lang->get('acpgc_field_comment_allow_guests'); ?> |
466 <?php echo $lang->get('acpgc_field_comment_allow_guests'); ?> |
467 </td> |
467 </td> |
468 <td class="row1"> |
468 <td class="row1"> |
469 <label> |
469 <label> |
470 <input name="comments_need_login" type="radio" value="0" <?php if(getConfig('comments_need_login')=='0') echo 'checked="checked" '; ?>/> |
470 <input name="comments_need_login" type="radio" value="0" <?php if(getConfig('comments_need_login')=='0') echo 'checked="checked" '; ?>/> |
471 <?php echo $lang->get('acpgc_field_comment_allow_guests_yes'); ?> |
471 <?php echo $lang->get('acpgc_field_comment_allow_guests_yes'); ?> |
472 </label> |
472 </label> |
473 <label> |
473 <label> |
474 <input name="comments_need_login" type="radio" value="1" <?php if(getConfig('comments_need_login')=='1') echo 'checked="checked" '; ?>/> |
474 <input name="comments_need_login" type="radio" value="1" <?php if(getConfig('comments_need_login')=='1') echo 'checked="checked" '; ?>/> |
475 <?php echo $lang->get('acpgc_field_comment_allow_guests_captcha'); ?> |
475 <?php echo $lang->get('acpgc_field_comment_allow_guests_captcha'); ?> |
476 </label> |
476 </label> |
477 <label> |
477 <label> |
478 <input name="comments_need_login" type="radio" value="2" <?php if(getConfig('comments_need_login')=='2') echo 'checked="checked" '; ?>/> |
478 <input name="comments_need_login" type="radio" value="2" <?php if(getConfig('comments_need_login')=='2') echo 'checked="checked" '; ?>/> |
479 <?php echo $lang->get('acpgc_field_comment_allow_guests_no'); ?> |
479 <?php echo $lang->get('acpgc_field_comment_allow_guests_no'); ?> |
480 </label> |
480 </label> |
481 </td> |
481 </td> |
482 </tr> |
482 </tr> |
483 |
483 |
484 <tr> |
484 <tr> |
485 <td class="row2"> |
485 <td class="row2"> |
486 <?php echo $lang->get('acpgc_field_comment_spam_policy'); ?><br /> |
486 <?php echo $lang->get('acpgc_field_comment_spam_policy'); ?><br /> |
487 <small><?php echo $lang->get('acpgc_field_comment_spam_policy_hint'); ?></small> |
487 <small><?php echo $lang->get('acpgc_field_comment_spam_policy_hint'); ?></small> |
488 </td> |
488 </td> |
489 <td class="row2"> |
489 <td class="row2"> |
490 <label> |
490 <label> |
491 <input name="comment_spam_policy" type="radio" value="moderate" <?php if ( getConfig('comment_spam_policy', 'moderate') == 'moderate' ) echo 'checked="checked"'; ?>/> |
491 <input name="comment_spam_policy" type="radio" value="moderate" <?php if ( getConfig('comment_spam_policy', 'moderate') == 'moderate' ) echo 'checked="checked"'; ?>/> |
492 <?php echo $lang->get('acpgc_field_comment_spam_policy_moderate'); ?> |
492 <?php echo $lang->get('acpgc_field_comment_spam_policy_moderate'); ?> |
493 </label><br /> |
493 </label><br /> |
494 <label> |
494 <label> |
495 <input name="comment_spam_policy" type="radio" value="reject" <?php if ( getConfig('comment_spam_policy', 'moderate') == 'reject' ) echo 'checked="checked"'; ?>/> |
495 <input name="comment_spam_policy" type="radio" value="reject" <?php if ( getConfig('comment_spam_policy', 'moderate') == 'reject' ) echo 'checked="checked"'; ?>/> |
496 <?php echo $lang->get('acpgc_field_comment_spam_policy_reject'); ?> |
496 <?php echo $lang->get('acpgc_field_comment_spam_policy_reject'); ?> |
497 </label><br /> |
497 </label><br /> |
498 <label> |
498 <label> |
499 <input name="comment_spam_policy" type="radio" value="accept" <?php if ( getConfig('comment_spam_policy', 'moderate') == 'accept' ) echo 'checked="checked"'; ?>/> |
499 <input name="comment_spam_policy" type="radio" value="accept" <?php if ( getConfig('comment_spam_policy', 'moderate') == 'accept' ) echo 'checked="checked"'; ?>/> |
500 <?php echo $lang->get('acpgc_field_comment_spam_policy_accept'); ?> |
500 <?php echo $lang->get('acpgc_field_comment_spam_policy_accept'); ?> |
501 </label> |
501 </label> |
502 </td> |
502 </td> |
503 </tr> |
503 </tr> |
504 |
504 |
505 <!-- Site disablement --> |
505 <!-- Site disablement --> |
506 |
506 |
507 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_disablesite'); ?></th></tr> |
507 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_disablesite'); ?></th></tr> |
508 |
508 |
509 <tr> |
509 <tr> |
510 <td class="row3" rowspan="2"> |
510 <td class="row3" rowspan="2"> |
511 <?php echo $lang->get('acpgc_field_disablesite_hint'); ?> |
511 <?php echo $lang->get('acpgc_field_disablesite_hint'); ?> |
512 </td> |
512 </td> |
513 <td class="row1"> |
513 <td class="row1"> |
514 <label> |
514 <label> |
515 <input onclick="if(this.checked) document.getElementById('site_disabled_notice').style.display='block'; else document.getElementById('site_disabled_notice').style.display='none';" type="checkbox" name="site_disabled" <?php if(getConfig('site_disabled') == '1') echo 'checked="checked" '; ?>/> |
515 <input onclick="if(this.checked) document.getElementById('site_disabled_notice').style.display='block'; else document.getElementById('site_disabled_notice').style.display='none';" type="checkbox" name="site_disabled" <?php if(getConfig('site_disabled') == '1') echo 'checked="checked" '; ?>/> |
516 <?php echo $lang->get('acpgc_field_disablesite'); ?> |
516 <?php echo $lang->get('acpgc_field_disablesite'); ?> |
517 </label> |
517 </label> |
518 </td> |
518 </td> |
519 </tr> |
519 </tr> |
520 <tr> |
520 <tr> |
521 <td class="row2"> |
521 <td class="row2"> |
522 <div id="site_disabled_notice"<?php if(getConfig('site_disabled')!='1') echo(' style="display:none"'); ?>> |
522 <div id="site_disabled_notice"<?php if(getConfig('site_disabled')!='1') echo(' style="display:none"'); ?>> |
523 <?php echo $lang->get('acpgc_field_disablesite_message'); ?><br /> |
523 <?php echo $lang->get('acpgc_field_disablesite_message'); ?><br /> |
524 <textarea name="site_disabled_notice" rows="7" cols="30"><?php echo getConfig('site_disabled_notice'); ?></textarea> |
524 <textarea name="site_disabled_notice" rows="7" cols="30"><?php echo getConfig('site_disabled_notice'); ?></textarea> |
525 </div> |
525 </div> |
526 </td> |
526 </td> |
527 </tr> |
527 </tr> |
528 |
528 |
529 <!-- Default theme --> |
529 <!-- Default theme --> |
530 |
530 |
531 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_default_theme'); ?></th></tr> |
531 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_default_theme'); ?></th></tr> |
532 |
532 |
533 <tr> |
533 <tr> |
534 <td class="row2"> |
534 <td class="row2"> |
535 <?php echo $lang->get('acpgc_field_default_theme'); ?> |
535 <?php echo $lang->get('acpgc_field_default_theme'); ?> |
536 </td> |
536 </td> |
537 <td class="row2"> |
537 <td class="row2"> |
538 <select name="default_theme"> |
538 <select name="default_theme"> |
539 <?php |
539 <?php |
540 foreach ( $template->named_theme_list as $theme_id => $theme_data ) |
540 foreach ( $template->named_theme_list as $theme_id => $theme_data ) |
541 { |
541 { |
542 if ( !isset($theme_data['theme_name']) ) |
542 if ( !isset($theme_data['theme_name']) ) |
543 // probably a system theme |
543 // probably a system theme |
544 continue; |
544 continue; |
545 |
545 |
546 $theme_name = htmlspecialchars($theme_data['theme_name']); |
546 $theme_name = htmlspecialchars($theme_data['theme_name']); |
547 $selected = ( $theme_id === getConfig('theme_default') ) ? ' selected="selected"' : ''; |
547 $selected = ( $theme_id === getConfig('theme_default') ) ? ' selected="selected"' : ''; |
548 echo " <option value=\"$theme_id\"$selected>$theme_name</option>\n "; |
548 echo " <option value=\"$theme_id\"$selected>$theme_name</option>\n "; |
549 } |
549 } |
550 ?> |
550 ?> |
551 </select> |
551 </select> |
552 </td> |
552 </td> |
553 </tr> |
553 </tr> |
554 |
554 |
555 <!-- Breadcrumbs --> |
555 <!-- Breadcrumbs --> |
556 |
556 |
557 <tr> |
557 <tr> |
558 <td class="row1"> |
558 <td class="row1"> |
559 <?php echo $lang->get('acpgc_field_breadcrumb_mode'); ?> |
559 <?php echo $lang->get('acpgc_field_breadcrumb_mode'); ?> |
560 </td> |
560 </td> |
561 <td class="row1"> |
561 <td class="row1"> |
562 <select name="breadcrumb_mode"> |
562 <select name="breadcrumb_mode"> |
563 <?php |
563 <?php |
564 foreach ( array('subpages', 'always', 'never') as $mode ) |
564 foreach ( array('subpages', 'always', 'never') as $mode ) |
565 { |
565 { |
566 $str = $lang->get("acpgc_field_breadcrumb_mode_$mode"); |
566 $str = $lang->get("acpgc_field_breadcrumb_mode_$mode"); |
567 $sel = ( getConfig('breadcrumb_mode') == $mode ) ? ' selected="selected"' : ''; |
567 $sel = ( getConfig('breadcrumb_mode') == $mode ) ? ' selected="selected"' : ''; |
568 echo " <option value=\"$mode\"$sel>$str</option>\n "; |
568 echo " <option value=\"$mode\"$sel>$str</option>\n "; |
569 } |
569 } |
570 ?> |
570 ?> |
571 </select> |
571 </select> |
572 </td> |
572 </td> |
573 </tr> |
573 </tr> |
574 |
574 |
575 <!-- CDN settings --> |
575 <!-- CDN settings --> |
576 |
576 |
577 <tr> |
577 <tr> |
578 <td class="row2"> |
578 <td class="row2"> |
579 <p> |
579 <p> |
580 <?php echo $lang->get('acpgc_field_cdn_path'); ?><br /> |
580 <?php echo $lang->get('acpgc_field_cdn_path'); ?><br /> |
581 <small><?php echo $lang->get('acpgc_field_cdn_path_hint'); ?></small> |
581 <small><?php echo $lang->get('acpgc_field_cdn_path_hint'); ?></small> |
582 </p> |
582 </p> |
583 <p> |
583 <p> |
584 <small><?php echo $lang->get('acpgc_field_cdn_path_example'); ?></small> |
584 <small><?php echo $lang->get('acpgc_field_cdn_path_example'); ?></small> |
585 </p> |
585 </p> |
586 </td> |
586 </td> |
587 <td class="row2"> |
587 <td class="row2"> |
588 <input type="text" name="cdn_path" value="<?php echo htmlspecialchars(getConfig('cdn_path', '')); ?>" style="width: 98%;" /> |
588 <input type="text" name="cdn_path" value="<?php echo htmlspecialchars(getConfig('cdn_path', '')); ?>" style="width: 98%;" /> |
589 </td> |
589 </td> |
590 </tr> |
590 </tr> |
591 |
591 |
592 <!-- Gzip --> |
592 <!-- Gzip --> |
593 |
593 |
594 <tr> |
594 <tr> |
595 <td class="row1"> |
595 <td class="row1"> |
596 <b><?php echo $lang->get('acpgc_field_gzip'); ?></b><br /> |
596 <b><?php echo $lang->get('acpgc_field_gzip'); ?></b><br /> |
597 <small><?php echo $lang->get('acpgc_field_gzip_hint'); ?></small><br /> |
597 <small><?php echo $lang->get('acpgc_field_gzip_hint'); ?></small><br /> |
598 <br /> |
598 <br /> |
599 <a href="#" onclick="ajaxGzipCheck(); return false;"><?php echo $lang->get('acpgc_field_gzip_btn_check'); ?></a> |
599 <a href="#" onclick="ajaxGzipCheck(); return false;"><?php echo $lang->get('acpgc_field_gzip_btn_check'); ?></a> |
600 </td> |
600 </td> |
601 <td class="row1"> |
601 <td class="row1"> |
602 <div id="gzip_check_result"></div> |
602 <div id="gzip_check_result"></div> |
603 <label> |
603 <label> |
604 <input type="checkbox" name="gzip_output" <?php if ( getConfig('gzip_output', false) == 1 ) echo 'checked="checked" '; ?>/> |
604 <input type="checkbox" name="gzip_output" <?php if ( getConfig('gzip_output', false) == 1 ) echo 'checked="checked" '; ?>/> |
605 <?php echo $lang->get('acpgc_field_gzip_lbl'); ?> |
605 <?php echo $lang->get('acpgc_field_gzip_lbl'); ?> |
606 </label> |
606 </label> |
607 </td> |
607 </td> |
608 </tr> |
608 </tr> |
609 |
609 |
610 <!-- Allow plugins to add code --> |
610 <!-- Allow plugins to add code --> |
611 <?php |
611 <?php |
612 $code = $plugins->setHook('acp_general_basic'); |
612 $code = $plugins->setHook('acp_general_basic'); |
613 foreach ( $code as $cmd ) |
613 foreach ( $code as $cmd ) |
614 { |
614 { |
615 eval($cmd); |
615 eval($cmd); |
616 } |
616 } |
617 ?> |
617 ?> |
618 |
618 |
619 </table> |
619 </table> |
620 </div> |
620 </div> |
621 |
621 |
622 <div class="tblholder"> |
622 <div class="tblholder"> |
623 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
623 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
624 |
624 |
625 <tr> |
625 <tr> |
626 <th colspan="2"><?php echo $lang->get('acpgc_heading_users'); ?></th> |
626 <th colspan="2"><?php echo $lang->get('acpgc_heading_users'); ?></th> |
627 </tr> |
627 </tr> |
628 |
628 |
629 <!-- Account activation --> |
629 <!-- Account activation --> |
630 |
630 |
631 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_activate'); ?></th></tr> |
631 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_activate'); ?></th></tr> |
632 |
632 |
633 <tr> |
633 <tr> |
634 <td class="row3" colspan="2"> |
634 <td class="row3" colspan="2"> |
635 <?php echo $lang->get('acpgc_activate_intro_line1'); ?><br /><br /> |
635 <?php echo $lang->get('acpgc_activate_intro_line1'); ?><br /><br /> |
636 <?php echo $lang->get('acpgc_activate_intro_line2'); ?><br /><br /> |
636 <?php echo $lang->get('acpgc_activate_intro_line2'); ?><br /><br /> |
637 <b><?php echo $lang->get('acpgc_activate_intro_sfnet_warning'); ?></b> |
637 <b><?php echo $lang->get('acpgc_activate_intro_sfnet_warning'); ?></b> |
638 </td> |
638 </td> |
639 </tr> |
639 </tr> |
640 |
640 |
641 <tr> |
641 <tr> |
642 <td class="row1" style="width: 50%;"><?php echo $lang->get('acpgc_field_activate'); ?></td><td class="row1"> |
642 <td class="row1" style="width: 50%;"><?php echo $lang->get('acpgc_field_activate'); ?></td><td class="row1"> |
643 <?php |
643 <?php |
644 echo '<label><input'; if(getConfig('account_activation') == 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="disable" /> ' . $lang->get('acpgc_field_activate_disable') . '</label><br />'; |
644 echo '<label><input'; if(getConfig('account_activation') == 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="disable" /> ' . $lang->get('acpgc_field_activate_disable') . '</label><br />'; |
645 echo '<label><input'; if(getConfig('account_activation') != 'user' && getConfig('account_activation') != 'admin' && getConfig('account_activation') != 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="none" /> ' . $lang->get('acpgc_field_activate_none') . '</label>'; |
645 echo '<label><input'; if(getConfig('account_activation') != 'user' && getConfig('account_activation') != 'admin' && getConfig('account_activation') != 'disable') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="none" /> ' . $lang->get('acpgc_field_activate_none') . '</label>'; |
646 echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> ' . $lang->get('acpgc_field_activate_user') . '</label>'; |
646 echo '<label><input'; if(getConfig('account_activation') == 'user') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="user" /> ' . $lang->get('acpgc_field_activate_user') . '</label>'; |
647 echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> ' . $lang->get('acpgc_field_activate_admin') . '</label>'; |
647 echo '<label><input'; if(getConfig('account_activation') == 'admin') echo ' checked="checked"'; echo ' type="radio" name="account_activation" value="admin" /> ' . $lang->get('acpgc_field_activate_admin') . '</label>'; |
648 ?> |
648 ?> |
649 </td> |
649 </td> |
650 </tr> |
650 </tr> |
651 |
651 |
652 <!-- Terms of Use --> |
652 <!-- Terms of Use --> |
653 |
653 |
654 <tr> |
654 <tr> |
655 <th class="subhead" colspan="2"> |
655 <th class="subhead" colspan="2"> |
656 <?php echo $lang->get('acpgc_heading_tou'); ?> |
656 <?php echo $lang->get('acpgc_heading_tou'); ?> |
657 </th> |
657 </th> |
658 </tr> |
658 </tr> |
659 |
659 |
660 <tr> |
660 <tr> |
661 <td class="row2"> |
661 <td class="row2"> |
662 <b><?php echo $lang->get('acpgc_field_tou'); ?></b><br /> |
662 <b><?php echo $lang->get('acpgc_field_tou'); ?></b><br /> |
663 <small><?php echo $lang->get('acpgc_field_tou_hint'); ?></small> |
663 <small><?php echo $lang->get('acpgc_field_tou_hint'); ?></small> |
664 </td> |
664 </td> |
665 <td class="row2"> |
665 <td class="row2"> |
666 <?php |
666 <?php |
667 $terms = getConfig('register_tou'); |
667 $terms = getConfig('register_tou'); |
668 echo $template->tinymce_textarea('register_tou', $terms, 10, 40); |
668 echo $template->tinymce_textarea('register_tou', $terms, 10, 40); |
669 ?> |
669 ?> |
670 </td> |
670 </td> |
671 </tr> |
671 </tr> |
672 |
672 |
673 <!-- Account lockout --> |
673 <!-- Account lockout --> |
674 |
674 |
675 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_lockout'); ?></th></tr> |
675 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_lockout'); ?></th></tr> |
676 |
676 |
677 <tr><td class="row3" colspan="2"><?php echo $lang->get('acpgc_lockout_intro'); ?></td></tr> |
677 <tr><td class="row3" colspan="2"><?php echo $lang->get('acpgc_lockout_intro'); ?></td></tr> |
678 |
678 |
679 <tr> |
679 <tr> |
680 <td class="row2"><?php echo $lang->get('acpgc_field_lockout_threshold'); ?><br /> |
680 <td class="row2"><?php echo $lang->get('acpgc_field_lockout_threshold'); ?><br /> |
681 <small><?php echo $lang->get('acpgc_field_lockout_threshold_hint'); ?></small> |
681 <small><?php echo $lang->get('acpgc_field_lockout_threshold_hint'); ?></small> |
682 </td> |
682 </td> |
683 <td class="row2"> |
683 <td class="row2"> |
684 <input type="text" name="lockout_threshold" value="<?php echo ( $_ = getConfig('lockout_threshold') ) ? $_ : '5' ?>" /> |
684 <input type="text" name="lockout_threshold" value="<?php echo ( $_ = getConfig('lockout_threshold') ) ? $_ : '5' ?>" /> |
685 </td> |
685 </td> |
686 </tr> |
686 </tr> |
687 |
687 |
688 <tr> |
688 <tr> |
689 <td class="row1"><?php echo $lang->get('acpgc_field_lockout_duration'); ?><br /> |
689 <td class="row1"><?php echo $lang->get('acpgc_field_lockout_duration'); ?><br /> |
690 <small><?php echo $lang->get('acpgc_field_lockout_duration_hint'); ?></small> |
690 <small><?php echo $lang->get('acpgc_field_lockout_duration_hint'); ?></small> |
691 </td> |
691 </td> |
692 <td class="row1"> |
692 <td class="row1"> |
693 <input type="text" name="lockout_duration" value="<?php echo ( $_ = getConfig('lockout_duration') ) ? $_ : '15' ?>" /> |
693 <input type="text" name="lockout_duration" value="<?php echo ( $_ = getConfig('lockout_duration') ) ? $_ : '15' ?>" /> |
694 </td> |
694 </td> |
695 </tr> |
695 </tr> |
696 |
696 |
697 <tr> |
697 <tr> |
698 <td class="row2"><?php echo $lang->get('acpgc_field_lockout_policy'); ?><br /> |
698 <td class="row2"><?php echo $lang->get('acpgc_field_lockout_policy'); ?><br /> |
699 <small><?php echo $lang->get('acpgc_field_lockout_policy_hint'); ?></small> |
699 <small><?php echo $lang->get('acpgc_field_lockout_policy_hint'); ?></small> |
700 </td> |
700 </td> |
701 <td class="row2"> |
701 <td class="row2"> |
702 <label><input type="radio" name="lockout_policy" value="disable" <?php if ( getConfig('lockout_policy') == 'disable' ) echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_lockout_policy_nothing'); ?></label><br /> |
702 <label><input type="radio" name="lockout_policy" value="disable" <?php if ( getConfig('lockout_policy') == 'disable' ) echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_lockout_policy_nothing'); ?></label><br /> |
703 <label><input type="radio" name="lockout_policy" value="captcha" <?php if ( getConfig('lockout_policy') == 'captcha' ) echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_lockout_policy_captcha'); ?></label><br /> |
703 <label><input type="radio" name="lockout_policy" value="captcha" <?php if ( getConfig('lockout_policy') == 'captcha' ) echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_lockout_policy_captcha'); ?></label><br /> |
704 <label><input type="radio" name="lockout_policy" value="lockout" <?php if ( getConfig('lockout_policy') == 'lockout' || !getConfig('lockout_policy') ) echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_lockout_policy_lockout'); ?></label> |
704 <label><input type="radio" name="lockout_policy" value="lockout" <?php if ( getConfig('lockout_policy') == 'lockout' || !getConfig('lockout_policy') ) echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_lockout_policy_lockout'); ?></label> |
705 </td> |
705 </td> |
706 </tr> |
706 </tr> |
707 |
707 |
708 <!-- Password strength --> |
708 <!-- Password strength --> |
709 |
709 |
710 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_passstrength'); ?></th></tr> |
710 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_passstrength'); ?></th></tr> |
711 |
711 |
712 <tr> |
712 <tr> |
713 <td class="row2"> |
713 <td class="row2"> |
714 <b><?php echo $lang->get('acpgc_field_passstrength_title'); ?></b><br /> |
714 <b><?php echo $lang->get('acpgc_field_passstrength_title'); ?></b><br /> |
715 <small><?php echo $lang->get('acpgc_field_passstrength_hint'); ?></small> |
715 <small><?php echo $lang->get('acpgc_field_passstrength_hint'); ?></small> |
716 </td> |
716 </td> |
717 <td class="row2"> |
717 <td class="row2"> |
718 <label><input type="checkbox" name="pw_strength_enable" <?php if ( getConfig('pw_strength_enable') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_passstrength'); ?></label> |
718 <label><input type="checkbox" name="pw_strength_enable" <?php if ( getConfig('pw_strength_enable') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_passstrength'); ?></label> |
719 </td> |
719 </td> |
720 </tr> |
720 </tr> |
721 |
721 |
722 <tr> |
722 <tr> |
723 <td class="row1"> |
723 <td class="row1"> |
724 <b><?php echo $lang->get('acpgc_field_passminimum_title'); ?></b><br /> |
724 <b><?php echo $lang->get('acpgc_field_passminimum_title'); ?></b><br /> |
725 <small><?php echo $lang->get('acpgc_field_passminimum_hint'); ?></small> |
725 <small><?php echo $lang->get('acpgc_field_passminimum_hint'); ?></small> |
726 </td> |
726 </td> |
727 <td class="row1"> |
727 <td class="row1"> |
728 <input type="text" name="pw_strength_minimum" value="<?php echo strval(getConfig('pw_strength_minimum', -10)); ?>" /> |
728 <input type="text" name="pw_strength_minimum" value="<?php echo strval(getConfig('pw_strength_minimum', -10)); ?>" /> |
729 </td> |
729 </td> |
730 </tr> |
730 </tr> |
731 |
731 |
732 <!-- E-mail options --> |
732 <!-- E-mail options --> |
733 |
733 |
734 <tr> |
734 <tr> |
735 <th class="subhead" colspan="2"> |
735 <th class="subhead" colspan="2"> |
736 <?php echo $lang->get('acpgc_heading_email'); ?> |
736 <?php echo $lang->get('acpgc_heading_email'); ?> |
737 </th> |
737 </th> |
738 </tr> |
738 </tr> |
739 |
739 |
740 <tr> |
740 <tr> |
741 <td class="row1"> |
741 <td class="row1"> |
742 <?php echo $lang->get('acpgc_field_email_method'); ?><br /> |
742 <?php echo $lang->get('acpgc_field_email_method'); ?><br /> |
743 <small><?php echo $lang->get('acpgc_field_email_method_hint'); ?></small> |
743 <small><?php echo $lang->get('acpgc_field_email_method_hint'); ?></small> |
744 </td> |
744 </td> |
745 <td class="row1"> |
745 <td class="row1"> |
746 <label> |
746 <label> |
747 <input <?php if(getConfig('smtp_enabled') != '1') echo 'checked="checked"'; ?> type="radio" name="emailmethod" value="phpmail" /> |
747 <input <?php if(getConfig('smtp_enabled') != '1') echo 'checked="checked"'; ?> type="radio" name="emailmethod" value="phpmail" /> |
748 <?php echo $lang->get('acpgc_field_email_method_builtin'); ?> |
748 <?php echo $lang->get('acpgc_field_email_method_builtin'); ?> |
749 </label> |
749 </label> |
750 |
750 |
751 <br /> |
751 <br /> |
752 |
752 |
753 <label> |
753 <label> |
754 <input <?php if(getConfig('smtp_enabled') == '1') echo 'checked="checked"'; ?> type="radio" name="emailmethod" value="smtp" /> |
754 <input <?php if(getConfig('smtp_enabled') == '1') echo 'checked="checked"'; ?> type="radio" name="emailmethod" value="smtp" /> |
755 <?php echo $lang->get('acpgc_field_email_method_smtp'); ?> |
755 <?php echo $lang->get('acpgc_field_email_method_smtp'); ?> |
756 </label> |
756 </label> |
757 </td> |
757 </td> |
758 </tr> |
758 </tr> |
759 |
759 |
760 <tr> |
760 <tr> |
761 <td class="row2"> |
761 <td class="row2"> |
762 <?php echo $lang->get('acpgc_field_email_smtp_hostname'); ?><br /> |
762 <?php echo $lang->get('acpgc_field_email_smtp_hostname'); ?><br /> |
763 <small><?php echo $lang->get('acpgc_field_email_smtp_hostname_hint'); ?></small> |
763 <small><?php echo $lang->get('acpgc_field_email_smtp_hostname_hint'); ?></small> |
764 </td> |
764 </td> |
765 <td class="row2"> |
765 <td class="row2"> |
766 <input value="<?php echo getConfig('smtp_server'); ?>" name="smtp_host" type="text" size="30" /> |
766 <input value="<?php echo getConfig('smtp_server'); ?>" name="smtp_host" type="text" size="30" /> |
767 </td> |
767 </td> |
768 </tr> |
768 </tr> |
769 |
769 |
770 <tr> |
770 <tr> |
771 <td class="row1"> |
771 <td class="row1"> |
772 <?php echo $lang->get('acpgc_field_email_smtp_auth'); ?><br /> |
772 <?php echo $lang->get('acpgc_field_email_smtp_auth'); ?><br /> |
773 <small><?php echo $lang->get('acpgc_field_email_smtp_hostname_hint'); ?></small> |
773 <small><?php echo $lang->get('acpgc_field_email_smtp_hostname_hint'); ?></small> |
774 </td> |
774 </td> |
775 <td class="row1"> |
775 <td class="row1"> |
776 <?php echo $lang->get('acpgc_field_email_smtp_username'); ?> <input value="<?php echo getConfig('smtp_user'); ?>" name="smtp_user" type="text" size="30" /><br /> |
776 <?php echo $lang->get('acpgc_field_email_smtp_username'); ?> <input value="<?php echo getConfig('smtp_user'); ?>" name="smtp_user" type="text" size="30" /><br /> |
777 <?php echo $lang->get('acpgc_field_email_smtp_password'); ?> <input value="<?php if(getConfig('smtp_password') != false) echo 'XXXXXXXXXXXX'; ?>" name="smtp_pass" type="password" size="30" /> |
777 <?php echo $lang->get('acpgc_field_email_smtp_password'); ?> <input value="<?php if(getConfig('smtp_password') != false) echo 'XXXXXXXXXXXX'; ?>" name="smtp_pass" type="password" size="30" /> |
778 </td> |
778 </td> |
779 </tr> |
779 </tr> |
780 |
780 |
781 <!-- Session length --> |
781 <!-- Session length --> |
782 |
782 |
783 <tr> |
783 <tr> |
784 <th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_sessions'); ?></th> |
784 <th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_sessions'); ?></th> |
785 </tr> |
785 </tr> |
786 |
786 |
787 <tr> |
787 <tr> |
788 <td class="row3" colspan="2"><?php echo $lang->get('acpgc_hint_sessions_noelev'); ?></td> |
788 <td class="row3" colspan="2"><?php echo $lang->get('acpgc_hint_sessions_noelev'); ?></td> |
789 </tr> |
789 </tr> |
790 |
790 |
791 <tr> |
791 <tr> |
792 <td class="row1"> |
792 <td class="row1"> |
793 <?php echo $lang->get('acpgc_field_short_time'); ?><br /> |
793 <?php echo $lang->get('acpgc_field_short_time'); ?><br /> |
794 <small><?php echo $lang->get('acpgc_field_short_time_hint'); ?></small> |
794 <small><?php echo $lang->get('acpgc_field_short_time_hint'); ?></small> |
795 </td> |
795 </td> |
796 <td class="row1"> |
796 <td class="row1"> |
797 <input type="text" name="session_short_time" value="<?php echo getConfig('session_short_time', '720'); ?>" size="4" /> |
797 <input type="text" name="session_short_time" value="<?php echo getConfig('session_short_time', '720'); ?>" size="4" /> |
798 </td> |
798 </td> |
799 </tr> |
799 </tr> |
800 |
800 |
801 <tr> |
801 <tr> |
802 <td class="row2"> |
802 <td class="row2"> |
803 <?php echo $lang->get('acpgc_field_long_time'); ?><br /> |
803 <?php echo $lang->get('acpgc_field_long_time'); ?><br /> |
804 <small><?php echo $lang->get('acpgc_field_long_time_hint'); ?></small> |
804 <small><?php echo $lang->get('acpgc_field_long_time_hint'); ?></small> |
805 </td> |
805 </td> |
806 <td class="row2"> |
806 <td class="row2"> |
807 <input type="text" name="session_remember_time" value="<?php echo getConfig('session_remember_time', '30'); ?>" size="4" /> |
807 <input type="text" name="session_remember_time" value="<?php echo getConfig('session_remember_time', '30'); ?>" size="4" /> |
808 </td> |
808 </td> |
809 </tr> |
809 </tr> |
810 |
810 |
811 <!-- Avatar support --> |
811 <!-- Avatar support --> |
812 |
812 |
813 <tr> |
813 <tr> |
814 <th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_avatars'); ?></th> |
814 <th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_avatars'); ?></th> |
815 </tr> |
815 </tr> |
816 |
816 |
817 <tr> |
817 <tr> |
818 <td class="row3" colspan="2"> |
818 <td class="row3" colspan="2"> |
819 <?php echo $lang->get('acpgc_avatars_intro'); ?> |
819 <?php echo $lang->get('acpgc_avatars_intro'); ?> |
820 </th> |
820 </th> |
821 </tr> |
821 </tr> |
822 |
822 |
823 <tr> |
823 <tr> |
824 <td class="row1"> |
824 <td class="row1"> |
825 <?php echo $lang->get('acpgc_field_avatar_enable'); ?><br /> |
825 <?php echo $lang->get('acpgc_field_avatar_enable'); ?><br /> |
826 <small><?php echo $lang->get('acpgc_field_avatar_enable_hint'); ?></small> |
826 <small><?php echo $lang->get('acpgc_field_avatar_enable_hint'); ?></small> |
827 </td> |
827 </td> |
828 <td class="row1"> |
828 <td class="row1"> |
829 <label><input type="checkbox" name="avatar_enable" <?php if ( getConfig('avatar_enable') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_avatar_enable_label'); ?></label> |
829 <label><input type="checkbox" name="avatar_enable" <?php if ( getConfig('avatar_enable') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_avatar_enable_label'); ?></label> |
830 </td> |
830 </td> |
831 </tr> |
831 </tr> |
832 |
832 |
833 <tr> |
833 <tr> |
834 <td class="row2"> |
834 <td class="row2"> |
835 <?php echo $lang->get('acpgc_field_avatar_max_filesize'); ?><br /> |
835 <?php echo $lang->get('acpgc_field_avatar_max_filesize'); ?><br /> |
836 <small><?php echo $lang->get('acpgc_field_avatar_max_filesize_hint'); ?></small> |
836 <small><?php echo $lang->get('acpgc_field_avatar_max_filesize_hint'); ?></small> |
837 </td> |
837 </td> |
838 <td class="row2"> |
838 <td class="row2"> |
839 <input type="text" name="avatar_max_size" size="7" <?php if ( ($x = getConfig('avatar_max_size')) !== false ) echo "value=\"$x\" "; else echo "value=\"10240\" "; ?>/> <?php echo $lang->get('etc_unit_bytes'); ?> |
839 <input type="text" name="avatar_max_size" size="7" <?php if ( ($x = getConfig('avatar_max_size')) !== false ) echo "value=\"$x\" "; else echo "value=\"10240\" "; ?>/> <?php echo $lang->get('etc_unit_bytes'); ?> |
840 </td> |
840 </td> |
841 </tr> |
841 </tr> |
842 |
842 |
843 <tr> |
843 <tr> |
844 <td class="row1"> |
844 <td class="row1"> |
845 <?php echo $lang->get('acpgc_field_avatar_max_dimensions'); ?><br /> |
845 <?php echo $lang->get('acpgc_field_avatar_max_dimensions'); ?><br /> |
846 <small><?php echo $lang->get('acpgc_field_avatar_max_dimensions_hint'); ?></small> |
846 <small><?php echo $lang->get('acpgc_field_avatar_max_dimensions_hint'); ?></small> |
847 </td> |
847 </td> |
848 <td class="row1"> |
848 <td class="row1"> |
849 <input type="text" name="avatar_max_width" size="7" <?php if ( $x = getConfig('avatar_max_width') ) echo "value=\"$x\" "; else echo "value=\"150\" "; ?>/> × |
849 <input type="text" name="avatar_max_width" size="7" <?php if ( $x = getConfig('avatar_max_width') ) echo "value=\"$x\" "; else echo "value=\"150\" "; ?>/> × |
850 <input type="text" name="avatar_max_height" size="7" <?php if ( $x = getConfig('avatar_max_height') ) echo "value=\"$x\" "; else echo "value=\"150\" "; ?>/> <?php echo $lang->get('etc_unit_pixels'); ?> |
850 <input type="text" name="avatar_max_height" size="7" <?php if ( $x = getConfig('avatar_max_height') ) echo "value=\"$x\" "; else echo "value=\"150\" "; ?>/> <?php echo $lang->get('etc_unit_pixels'); ?> |
851 </td> |
851 </td> |
852 </tr> |
852 </tr> |
853 |
853 |
854 <tr> |
854 <tr> |
855 <td class="row2"> |
855 <td class="row2"> |
856 <?php echo $lang->get('acpgc_field_avatar_allow_anim_title'); ?><br /> |
856 <?php echo $lang->get('acpgc_field_avatar_allow_anim_title'); ?><br /> |
857 <small><?php echo $lang->get('acpgc_field_avatar_allow_anim_hint'); ?></small> |
857 <small><?php echo $lang->get('acpgc_field_avatar_allow_anim_hint'); ?></small> |
858 </td> |
858 </td> |
859 <td class="row2"> |
859 <td class="row2"> |
860 <label><input type="checkbox" name="avatar_enable_anim" <?php if ( getConfig('avatar_enable_anim') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_avatar_allow_anim'); ?></label> |
860 <label><input type="checkbox" name="avatar_enable_anim" <?php if ( getConfig('avatar_enable_anim') == '1' ) echo 'checked="checked" '; ?>/> <?php echo $lang->get('acpgc_field_avatar_allow_anim'); ?></label> |
861 </td> |
861 </td> |
862 </tr> |
862 </tr> |
863 |
863 |
864 <tr> |
864 <tr> |
865 <td class="row1"> |
865 <td class="row1"> |
866 <?php echo $lang->get('acpgc_field_avatar_upload_methods'); ?><br /> |
866 <?php echo $lang->get('acpgc_field_avatar_upload_methods'); ?><br /> |
867 <small></small> |
867 <small></small> |
868 </td> |
868 </td> |
869 <td class="row1"> |
869 <td class="row1"> |
870 <label> |
870 <label> |
871 <input type="checkbox" name="avatar_upload_file" <?php if ( getConfig('avatar_upload_file', 1) == 1 ) echo 'checked="checked" '; ?>/> |
871 <input type="checkbox" name="avatar_upload_file" <?php if ( getConfig('avatar_upload_file', 1) == 1 ) echo 'checked="checked" '; ?>/> |
872 <?php echo $lang->get('acpgc_field_avatar_upload_file'); ?> |
872 <?php echo $lang->get('acpgc_field_avatar_upload_file'); ?> |
873 </label> |
873 </label> |
874 |
874 |
875 <br /> |
875 <br /> |
876 |
876 |
877 <label> |
877 <label> |
878 <input type="checkbox" name="avatar_upload_http" <?php if ( getConfig('avatar_upload_http', 1) == 1 ) echo 'checked="checked" '; ?>/> |
878 <input type="checkbox" name="avatar_upload_http" <?php if ( getConfig('avatar_upload_http', 1) == 1 ) echo 'checked="checked" '; ?>/> |
879 <?php echo $lang->get('acpgc_field_avatar_upload_http'); ?> |
879 <?php echo $lang->get('acpgc_field_avatar_upload_http'); ?> |
880 </label> |
880 </label> |
881 |
881 |
882 <br /> |
882 <br /> |
883 |
883 |
884 <label> |
884 <label> |
885 <input type="checkbox" name="avatar_upload_gravatar" <?php if ( getConfig('avatar_upload_gravatar', 1) == 1 ) echo 'checked="checked" '; ?>onclick="document.getElementById('acp_gravatar_rating').style.display = ( this.checked ) ? 'block' : 'none';" /> |
885 <input type="checkbox" name="avatar_upload_gravatar" <?php if ( getConfig('avatar_upload_gravatar', 1) == 1 ) echo 'checked="checked" '; ?>onclick="document.getElementById('acp_gravatar_rating').style.display = ( this.checked ) ? 'block' : 'none';" /> |
886 <?php echo $lang->get('acpgc_field_avatar_upload_gravatar'); ?> |
886 <?php echo $lang->get('acpgc_field_avatar_upload_gravatar'); ?> |
887 </label> |
887 </label> |
888 |
888 |
889 <br /> |
889 <br /> |
890 |
890 |
891 <fieldset id="acp_gravatar_rating" style="margin-top: 10px; <?php if ( getConfig('avatar_upload_gravatar', 1) == 0 ) echo ' display: none;'; ?>"> |
891 <fieldset id="acp_gravatar_rating" style="margin-top: 10px; <?php if ( getConfig('avatar_upload_gravatar', 1) == 0 ) echo ' display: none;'; ?>"> |
892 |
892 |
893 <?php /* The four ratings are g, pg, r, and x - loop through each and output a localized string and a radiobutton */ ?> |
893 <?php /* The four ratings are g, pg, r, and x - loop through each and output a localized string and a radiobutton */ ?> |
894 <legend><?php echo $lang->get('acpgc_field_avatar_gravatar_rating'); ?></legend> |
894 <legend><?php echo $lang->get('acpgc_field_avatar_gravatar_rating'); ?></legend> |
895 |
895 |
896 <?php foreach ( array('g', 'pg', 'r', 'x') as $rating ): ?> |
896 <?php foreach ( array('g', 'pg', 'r', 'x') as $rating ): ?> |
897 |
897 |
898 <label> |
898 <label> |
899 |
899 |
900 <input type="radio" name="gravatar_rating" value="<?php echo $rating; ?>"<?php |
900 <input type="radio" name="gravatar_rating" value="<?php echo $rating; ?>"<?php |
901 // Check the button if this is the current selection *or* if we're on "G" and the current configuration value is unset |
901 // Check the button if this is the current selection *or* if we're on "G" and the current configuration value is unset |
902 if ( getConfig('gravatar_rating', 'g') == $rating ) |
902 if ( getConfig('gravatar_rating', 'g') == $rating ) |
903 echo ' checked="checked"'; |
903 echo ' checked="checked"'; |
904 ?> /> |
904 ?> /> |
905 |
905 |
906 <?php /* The localized string */ ?> |
906 <?php /* The localized string */ ?> |
907 <?php echo $lang->get("acpgc_field_avatar_gravatar_rating_$rating"); ?> |
907 <?php echo $lang->get("acpgc_field_avatar_gravatar_rating_$rating"); ?> |
908 |
908 |
909 </label> |
909 </label> |
910 |
910 |
911 <br /> |
911 <br /> |
912 |
912 |
913 <?php endforeach; ?> |
913 <?php endforeach; ?> |
914 </fieldset> |
914 </fieldset> |
915 </td> |
915 </td> |
916 </tr> |
916 </tr> |
917 |
917 |
918 <!-- Misc. options --> |
918 <!-- Misc. options --> |
919 |
919 |
920 <tr> |
920 <tr> |
921 <th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_usermisc'); ?></th> |
921 <th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_usermisc'); ?></th> |
922 </tr> |
922 </tr> |
923 |
923 |
924 <tr> |
924 <tr> |
925 <td class="row1"> |
925 <td class="row1"> |
926 <b><?php echo $lang->get('acpgc_field_userpage_acl_title'); ?></b><br /> |
926 <b><?php echo $lang->get('acpgc_field_userpage_acl_title'); ?></b><br /> |
927 <small> |
927 <small> |
928 <?php echo $lang->get('acpgc_field_userpage_acl_hint'); ?> |
928 <?php echo $lang->get('acpgc_field_userpage_acl_hint'); ?> |
929 </small> |
929 </small> |
930 </td> |
930 </td> |
931 <td class="row1"> |
931 <td class="row1"> |
932 <label> |
932 <label> |
933 <input type="checkbox" name="userpage_grant_acl" <?php if ( getConfig('userpage_grant_acl', '1') == '1' ) echo 'checked="checked" '; ?>/> |
933 <input type="checkbox" name="userpage_grant_acl" <?php if ( getConfig('userpage_grant_acl', '1') == '1' ) echo 'checked="checked" '; ?>/> |
934 <?php echo $lang->get('acpgc_field_userpage_acl'); ?> |
934 <?php echo $lang->get('acpgc_field_userpage_acl'); ?> |
935 </label> |
935 </label> |
936 </td> |
936 </td> |
937 </tr> |
937 </tr> |
938 |
938 |
939 <!-- Allow plugins to add code --> |
939 <!-- Allow plugins to add code --> |
940 <?php |
940 <?php |
941 $code = $plugins->setHook('acp_general_users'); |
941 $code = $plugins->setHook('acp_general_users'); |
942 foreach ( $code as $cmd ) |
942 foreach ( $code as $cmd ) |
943 { |
943 { |
944 eval($cmd); |
944 eval($cmd); |
945 } |
945 } |
946 ?> |
946 ?> |
947 |
947 |
948 </table> |
948 </table> |
949 </div> |
949 </div> |
950 |
950 |
951 <div class="tblholder"> |
951 <div class="tblholder"> |
952 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
952 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
953 |
953 |
954 <tr> |
954 <tr> |
955 <th colspan="2"><?php echo $lang->get('acpgc_heading_sidebar'); ?></th> |
955 <th colspan="2"><?php echo $lang->get('acpgc_heading_sidebar'); ?></th> |
956 </tr> |
956 </tr> |
957 |
957 |
958 <!-- enanocms.org link --> |
958 <!-- enanocms.org link --> |
959 |
959 |
960 <tr> |
960 <tr> |
961 <th colspan="2" class="subhead"><?php echo $lang->get('acpgc_heading_promoteenano'); ?></th> |
961 <th colspan="2" class="subhead"><?php echo $lang->get('acpgc_heading_promoteenano'); ?></th> |
962 </tr> |
962 </tr> |
963 <tr> |
963 <tr> |
964 <td class="row3" style="width: 50%;"> |
964 <td class="row3" style="width: 50%;"> |
965 <b><?php echo $lang->get('acpgc_field_enano_link_title'); ?></b><br /> |
965 <b><?php echo $lang->get('acpgc_field_enano_link_title'); ?></b><br /> |
966 <small><?php echo $lang->get('acpgc_field_enano_link_hint'); ?></small> |
966 <small><?php echo $lang->get('acpgc_field_enano_link_hint'); ?></small> |
967 </td> |
967 </td> |
968 <td class="row1"> |
968 <td class="row1"> |
969 <label> |
969 <label> |
970 <input name="enano_powered_link" type="checkbox" <?php if(getConfig('powered_btn', '1') == '1') echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_enano_link'); ?> |
970 <input name="enano_powered_link" type="checkbox" <?php if(getConfig('powered_btn', '1') == '1') echo 'checked="checked"'; ?> /> <?php echo $lang->get('acpgc_field_enano_link'); ?> |
971 </label> |
971 </label> |
972 </td> |
972 </td> |
973 </tr> |
973 </tr> |
974 |
974 |
975 <!-- SourceForge.net logo --> |
975 <!-- SourceForge.net logo --> |
976 |
976 |
977 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_sfnet_logo'); ?></th></tr> |
977 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_sfnet_logo'); ?></th></tr> |
978 |
978 |
979 <tr> |
979 <tr> |
980 <td colspan="2" class="row3"> |
980 <td colspan="2" class="row3"> |
981 <?php echo $lang->get('acpgc_sfnet_intro'); ?> |
981 <?php echo $lang->get('acpgc_sfnet_intro'); ?> |
982 </td> |
982 </td> |
983 </tr> |
983 </tr> |
984 |
984 |
985 <?php |
985 <?php |
986 if ( getConfig("sflogo_enabled") == '1' ) |
986 if ( getConfig("sflogo_enabled") == '1' ) |
987 $c='checked="checked" '; |
987 $c='checked="checked" '; |
988 else |
988 else |
989 $c=''; |
989 $c=''; |
990 |
990 |
991 if ( getConfig("sflogo_groupid") ) |
991 if ( getConfig("sflogo_groupid") ) |
992 $g = getConfig("sflogo_groupid"); |
992 $g = getConfig("sflogo_groupid"); |
993 else |
993 else |
994 $g = ''; |
994 $g = ''; |
995 |
995 |
996 if ( getConfig("sflogo_type") ) |
996 if ( getConfig("sflogo_type") ) |
997 $t = getConfig("sflogo_type"); |
997 $t = getConfig("sflogo_type"); |
998 else |
998 else |
999 $t = '1'; |
999 $t = '1'; |
1000 ?> |
1000 ?> |
1001 |
1001 |
1002 <tr> |
1002 <tr> |
1003 <td class="row1"><?php echo $lang->get('acpgc_field_sfnet_display'); ?></td> |
1003 <td class="row1"><?php echo $lang->get('acpgc_field_sfnet_display'); ?></td> |
1004 <td class="row1"><input type=checkbox name="showsf" id="showsf" <?php echo $c; ?> /></td> |
1004 <td class="row1"><input type=checkbox name="showsf" id="showsf" <?php echo $c; ?> /></td> |
1005 </tr> |
1005 </tr> |
1006 |
1006 |
1007 <tr> |
1007 <tr> |
1008 <td class="row2"><?php echo $lang->get('acpgc_field_sfnet_group_id'); ?></td> |
1008 <td class="row2"><?php echo $lang->get('acpgc_field_sfnet_group_id'); ?></td> |
1009 <td class="row2"><input value="<?php echo $g; ?>" type=text size=15 name=sfgroup /></td> |
1009 <td class="row2"><input value="<?php echo $g; ?>" type=text size=15 name=sfgroup /></td> |
1010 </tr> |
1010 </tr> |
1011 |
1011 |
1012 <tr> |
1012 <tr> |
1013 <td class="row1"><?php echo $lang->get('acpgc_field_sfnet_logo_style'); ?></td> |
1013 <td class="row1"><?php echo $lang->get('acpgc_field_sfnet_logo_style'); ?></td> |
1014 <td class="row1"> |
1014 <td class="row1"> |
1015 <select name="sflogo"> |
1015 <select name="sflogo"> |
1016 <option <?php if($t=='1') echo('selected="selected" '); ?>value=1><?php echo $lang->get('acpgc_field_sfnet_logo_style_1'); ?></option> |
1016 <option <?php if($t=='1') echo('selected="selected" '); ?>value=1><?php echo $lang->get('acpgc_field_sfnet_logo_style_1'); ?></option> |
1017 <option <?php if($t=='2') echo('selected="selected" '); ?>value=2><?php echo $lang->get('acpgc_field_sfnet_logo_style_2'); ?></option> |
1017 <option <?php if($t=='2') echo('selected="selected" '); ?>value=2><?php echo $lang->get('acpgc_field_sfnet_logo_style_2'); ?></option> |
1018 <option <?php if($t=='3') echo('selected="selected" '); ?>value=3><?php echo $lang->get('acpgc_field_sfnet_logo_style_3'); ?></option> |
1018 <option <?php if($t=='3') echo('selected="selected" '); ?>value=3><?php echo $lang->get('acpgc_field_sfnet_logo_style_3'); ?></option> |
1019 <option <?php if($t=='4') echo('selected="selected" '); ?>value=4><?php echo $lang->get('acpgc_field_sfnet_logo_style_4'); ?></option> |
1019 <option <?php if($t=='4') echo('selected="selected" '); ?>value=4><?php echo $lang->get('acpgc_field_sfnet_logo_style_4'); ?></option> |
1020 <option <?php if($t=='5') echo('selected="selected" '); ?>value=5><?php echo $lang->get('acpgc_field_sfnet_logo_style_5'); ?></option> |
1020 <option <?php if($t=='5') echo('selected="selected" '); ?>value=5><?php echo $lang->get('acpgc_field_sfnet_logo_style_5'); ?></option> |
1021 <option <?php if($t=='6') echo('selected="selected" '); ?>value=6><?php echo $lang->get('acpgc_field_sfnet_logo_style_6'); ?></option> |
1021 <option <?php if($t=='6') echo('selected="selected" '); ?>value=6><?php echo $lang->get('acpgc_field_sfnet_logo_style_6'); ?></option> |
1022 <option <?php if($t=='7') echo('selected="selected" '); ?>value=7><?php echo $lang->get('acpgc_field_sfnet_logo_style_7'); ?></option> |
1022 <option <?php if($t=='7') echo('selected="selected" '); ?>value=7><?php echo $lang->get('acpgc_field_sfnet_logo_style_7'); ?></option> |
1023 </select> |
1023 </select> |
1024 </td> |
1024 </td> |
1025 </tr> |
1025 </tr> |
1026 |
1026 |
1027 <!-- W3C validator buttons --> |
1027 <!-- W3C validator buttons --> |
1028 |
1028 |
1029 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_w3clogos'); ?></th></tr> |
1029 <tr><th class="subhead" colspan="2"><?php echo $lang->get('acpgc_heading_w3clogos'); ?></th></tr> |
1030 <tr><td colspan="2" class="row3"><?php echo $lang->get('acpgc_w3clogos_intro'); ?></th></tr> |
1030 <tr><td colspan="2" class="row3"><?php echo $lang->get('acpgc_w3clogos_intro'); ?></th></tr> |
1031 |
1031 |
1032 <tr><td class="row1"><label for="w3c-vh32"><?php echo $lang->get('acpgc_w3clogos_btn_html32'); ?></label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vh32')=='1') echo('checked="checked" '); ?> id="w3c-vh32" name="w3c-vh32" /></td></tr> |
1032 <tr><td class="row1"><label for="w3c-vh32"><?php echo $lang->get('acpgc_w3clogos_btn_html32'); ?></label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vh32')=='1') echo('checked="checked" '); ?> id="w3c-vh32" name="w3c-vh32" /></td></tr> |
1033 <tr><td class="row2"><label for="w3c-vh40"><?php echo $lang->get('acpgc_w3clogos_btn_html40'); ?></label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vh40')=='1') echo('checked="checked" '); ?> id="w3c-vh40" name="w3c-vh40" /></td></tr> |
1033 <tr><td class="row2"><label for="w3c-vh40"><?php echo $lang->get('acpgc_w3clogos_btn_html40'); ?></label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vh40')=='1') echo('checked="checked" '); ?> id="w3c-vh40" name="w3c-vh40" /></td></tr> |
1034 <tr><td class="row1"><label for="w3c-vh401"><?php echo $lang->get('acpgc_w3clogos_btn_html401'); ?></label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vh401')=='1') echo('checked="checked" '); ?> id="w3c-vh401" name="w3c-vh401" /></td></tr> |
1034 <tr><td class="row1"><label for="w3c-vh401"><?php echo $lang->get('acpgc_w3clogos_btn_html401'); ?></label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vh401')=='1') echo('checked="checked" '); ?> id="w3c-vh401" name="w3c-vh401" /></td></tr> |
1035 <tr><td class="row2"><label for="w3c-vxhtml10"><?php echo $lang->get('acpgc_w3clogos_btn_xhtml10'); ?></label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vxhtml10')=='1') echo('checked="checked" '); ?> id="w3c-vxhtml10" name="w3c-vxhtml10" /></td></tr> |
1035 <tr><td class="row2"><label for="w3c-vxhtml10"><?php echo $lang->get('acpgc_w3clogos_btn_xhtml10'); ?></label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vxhtml10')=='1') echo('checked="checked" '); ?> id="w3c-vxhtml10" name="w3c-vxhtml10" /></td></tr> |
1036 <tr><td class="row1"><label for="w3c-vxhtml11"><?php echo $lang->get('acpgc_w3clogos_btn_xhtml11'); ?></label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vxhtml11')=='1') echo('checked="checked" '); ?> id="w3c-vxhtml11" name="w3c-vxhtml11" /></td></tr> |
1036 <tr><td class="row1"><label for="w3c-vxhtml11"><?php echo $lang->get('acpgc_w3clogos_btn_xhtml11'); ?></label></td><td class="row1"><input type="checkbox" <?php if(getConfig('w3c_vxhtml11')=='1') echo('checked="checked" '); ?> id="w3c-vxhtml11" name="w3c-vxhtml11" /></td></tr> |
1037 <tr><td class="row2"><label for="w3c-vcss"><?php echo $lang->get('acpgc_w3clogos_btn_css'); ?></label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vcss')=='1') echo('checked="checked" '); ?> id="w3c-vcss" name="w3c-vcss" /></td></tr> |
1037 <tr><td class="row2"><label for="w3c-vcss"><?php echo $lang->get('acpgc_w3clogos_btn_css'); ?></label></td><td class="row2"><input type="checkbox" <?php if(getConfig('w3c_vcss')=='1') echo('checked="checked" '); ?> id="w3c-vcss" name="w3c-vcss" /></td></tr> |
1038 |
1038 |
1039 <!-- DefectiveByDesign.org ad --> |
1039 <!-- DefectiveByDesign.org ad --> |
1040 |
1040 |
1041 <tr> |
1041 <tr> |
1042 <th class="subhead" colspan="2"> |
1042 <th class="subhead" colspan="2"> |
1043 <?php echo $lang->get('acpgc_heading_dbd'); ?> |
1043 <?php echo $lang->get('acpgc_heading_dbd'); ?> |
1044 </th> |
1044 </th> |
1045 </tr> |
1045 </tr> |
1046 |
1046 |
1047 <tr> |
1047 <tr> |
1048 <td colspan="2" class="row3"> |
1048 <td colspan="2" class="row3"> |
1049 <b><?php echo $lang->get('acpgc_dbd_intro'); ?></b> |
1049 <b><?php echo $lang->get('acpgc_dbd_intro'); ?></b> |
1050 <?php echo $lang->get('acpgc_dbd_explain'); ?> |
1050 <?php echo $lang->get('acpgc_dbd_explain'); ?> |
1051 </td> |
1051 </td> |
1052 </tr> |
1052 </tr> |
1053 |
1053 |
1054 <tr> |
1054 <tr> |
1055 <td class="row1"> |
1055 <td class="row1"> |
1056 <label for="dbdbutton"> |
1056 <label for="dbdbutton"> |
1057 <?php echo $lang->get('acpgc_field_stopdrm'); ?> |
1057 <?php echo $lang->get('acpgc_field_stopdrm'); ?> |
1058 </label> |
1058 </label> |
1059 </td> |
1059 </td> |
1060 <td class="row1"> |
1060 <td class="row1"> |
1061 <input type="checkbox" name="dbdbutton" id="dbdbutton" <?php if(getConfig('dbd_button')=='1') echo('checked="checked" '); ?>/> |
1061 <input type="checkbox" name="dbdbutton" id="dbdbutton" <?php if(getConfig('dbd_button')=='1') echo('checked="checked" '); ?>/> |
1062 </td> |
1062 </td> |
1063 </tr> |
1063 </tr> |
1064 |
1064 |
1065 <!-- Allow plugins to add code --> |
1065 <!-- Allow plugins to add code --> |
1066 <?php |
1066 <?php |
1067 $code = $plugins->setHook('acp_general_sidebar'); |
1067 $code = $plugins->setHook('acp_general_sidebar'); |
1068 foreach ( $code as $cmd ) |
1068 foreach ( $code as $cmd ) |
1069 { |
1069 { |
1070 eval($cmd); |
1070 eval($cmd); |
1071 } |
1071 } |
1072 ?> |
1072 ?> |
1073 |
1073 |
1074 <!-- Save button --> |
1074 <!-- Save button --> |
1075 |
1075 |
1076 </table> |
1076 </table> |
1077 </div> |
1077 </div> |
1078 |
1078 |
1079 <!-- Allow plugins to add code --> |
1079 <!-- Allow plugins to add code --> |
1080 <?php |
1080 <?php |
1081 $code = $plugins->setHook('acp_general_tail'); |
1081 $code = $plugins->setHook('acp_general_tail'); |
1082 foreach ( $code as $cmd ) |
1082 foreach ( $code as $cmd ) |
1083 { |
1083 { |
1084 eval($cmd); |
1084 eval($cmd); |
1085 } |
1085 } |
1086 ?> |
1086 ?> |
1087 |
1087 |
1088 <div class="tblholder"> |
1088 <div class="tblholder"> |
1089 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
1089 <table border="0" width="100%" cellspacing="1" cellpadding="4"> |
1090 |
1090 |
1091 <tr><th colspan="2"><input type="submit" name="submit" value="<?php echo $lang->get('acpgc_btn_save_changes'); ?>" /></th></tr> |
1091 <tr><th colspan="2"><input type="submit" name="submit" value="<?php echo $lang->get('acpgc_btn_save_changes'); ?>" /></th></tr> |
1092 |
1092 |
1093 </table> |
1093 </table> |
1094 </div> |
1094 </div> |
1095 </form> |
1095 </form> |
1096 |
1096 |
1097 <script type="text/javascript">addOnloadHook(function() { admin_table_onload(namespace_list['Admin'] + 'GeneralConfig') });</script> |
1097 <script type="text/javascript">addOnloadHook(function() { admin_table_onload(namespace_list['Admin'] + 'GeneralConfig') });</script> |
1098 <?php |
1098 <?php |
1099 } |
1099 } |
1100 |
1100 |
1101 function page_Admin_UploadConfig() |
1101 function page_Admin_UploadConfig() |
1102 { |
1102 { |
1103 global $db, $session, $paths, $template, $plugins; // Common objects |
1103 global $db, $session, $paths, $template, $plugins; // Common objects |
1104 global $lang; |
1104 global $lang; |
1105 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1105 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1106 { |
1106 { |
1107 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1107 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1108 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1108 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1109 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1109 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1110 return; |
1110 return; |
1111 } |
1111 } |
1112 |
1112 |
1113 if(isset($_POST['save'])) |
1113 if(isset($_POST['save'])) |
1114 { |
1114 { |
1115 if(isset($_POST['enable_uploads']) && getConfig('enable_uploads') != '1') |
1115 if(isset($_POST['enable_uploads']) && getConfig('enable_uploads') != '1') |
1116 { |
1116 { |
1117 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'upload_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1117 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'upload_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1118 if ( !$q ) |
1118 if ( !$q ) |
1119 $db->_die(); |
1119 $db->_die(); |
1120 setConfig('enable_uploads', '1'); |
1120 setConfig('enable_uploads', '1'); |
1121 } |
1121 } |
1122 else if ( !isset($_POST['enable_uploads']) && getConfig('enable_uploads') == '1' ) |
1122 else if ( !isset($_POST['enable_uploads']) && getConfig('enable_uploads') == '1' ) |
1123 { |
1123 { |
1124 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'upload_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1124 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'upload_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1125 if ( !$q ) |
1125 if ( !$q ) |
1126 $db->_die(); |
1126 $db->_die(); |
1127 setConfig('enable_uploads', '0'); |
1127 setConfig('enable_uploads', '0'); |
1128 } |
1128 } |
1129 if(isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') != '1') |
1129 if(isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') != '1') |
1130 { |
1130 { |
1131 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'magick_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1131 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'magick_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1132 if ( !$q ) |
1132 if ( !$q ) |
1133 $db->_die(); |
1133 $db->_die(); |
1134 setConfig('enable_imagemagick', '1'); |
1134 setConfig('enable_imagemagick', '1'); |
1135 } |
1135 } |
1136 else if ( !isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') == '1' ) |
1136 else if ( !isset($_POST['enable_imagemagick']) && getConfig('enable_imagemagick') == '1' ) |
1137 { |
1137 { |
1138 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'magick_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1138 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'magick_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\', ' . $session->user_id . ');'); |
1139 if ( !$q ) |
1139 if ( !$q ) |
1140 $db->_die(); |
1140 $db->_die(); |
1141 setConfig('enable_imagemagick', '0'); |
1141 setConfig('enable_imagemagick', '0'); |
1142 } |
1142 } |
1143 if(isset($_POST['cache_thumbs'])) |
1143 if(isset($_POST['cache_thumbs'])) |
1144 { |
1144 { |
1145 setConfig('cache_thumbs', '1'); |
1145 setConfig('cache_thumbs', '1'); |
1146 } |
1146 } |
1147 else |
1147 else |
1148 { |
1148 { |
1149 setConfig('cache_thumbs', '0'); |
1149 setConfig('cache_thumbs', '0'); |
1150 } |
1150 } |
1151 if(isset($_POST['file_history']) && getConfig('file_history') != '1' ) |
1151 if(isset($_POST['file_history']) && getConfig('file_history') != '1' ) |
1152 { |
1152 { |
1153 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');'); |
1153 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_enable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');'); |
1154 if ( !$q ) |
1154 if ( !$q ) |
1155 $db->_die(); |
1155 $db->_die(); |
1156 setConfig('file_history', '1'); |
1156 setConfig('file_history', '1'); |
1157 } |
1157 } |
1158 else if ( !isset($_POST['file_history']) && getConfig('file_history') == '1' ) |
1158 else if ( !isset($_POST['file_history']) && getConfig('file_history') == '1' ) |
1159 { |
1159 { |
1160 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');'); |
1160 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid) VALUES(\'security\',\'filehist_disable\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ');'); |
1161 if ( !$q ) |
1161 if ( !$q ) |
1162 $db->_die(); |
1162 $db->_die(); |
1163 setConfig('file_history', '0'); |
1163 setConfig('file_history', '0'); |
1164 } |
1164 } |
1165 if(file_exists($_POST['imagemagick_path']) && $_POST['imagemagick_path'] != getConfig('imagemagick_path')) |
1165 if(file_exists($_POST['imagemagick_path']) && $_POST['imagemagick_path'] != getConfig('imagemagick_path')) |
1166 { |
1166 { |
1167 if ( defined('ENANO_DEMO_MODE') ) |
1167 if ( defined('ENANO_DEMO_MODE') ) |
1168 // Hackish but safe. |
1168 // Hackish but safe. |
1169 $_POST['imagemagick_path'] = '/usr/bin/convert'; |
1169 $_POST['imagemagick_path'] = '/usr/bin/convert'; |
1170 $old = getConfig('imagemagick_path'); |
1170 $old = getConfig('imagemagick_path'); |
1171 $oldnew = "{$old}||{$_POST['imagemagick_path']}"; |
1171 $oldnew = "{$old}||{$_POST['imagemagick_path']}"; |
1172 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'magick_path\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ',\'' . $db->escape($oldnew) . '\');'); |
1172 $q = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,edit_summary,author,author_uid,page_text) VALUES(\'security\',\'magick_path\',' . time() . ',\'' . $db->escape($_SERVER['REMOTE_ADDR']) . '\',\'' . $db->escape($session->username) . '\',' . $session->user_id . ',\'' . $db->escape($oldnew) . '\');'); |
1173 if ( !$q ) |
1173 if ( !$q ) |
1174 $db->_die(); |
1174 $db->_die(); |
1175 setConfig('imagemagick_path', $_POST['imagemagick_path']); |
1175 setConfig('imagemagick_path', $_POST['imagemagick_path']); |
1176 } |
1176 } |
1177 else if ( $_POST['imagemagick_path'] != getConfig('imagemagick_path') ) |
1177 else if ( $_POST['imagemagick_path'] != getConfig('imagemagick_path') ) |
1178 { |
1178 { |
1179 echo '<span style="color: red">' . $lang->get('acpup_err_magick_not_found', array('magick_path' => htmlspecialchars($_POST['imagemagick_path']))) . '</span>'; |
1179 echo '<span style="color: red">' . $lang->get('acpup_err_magick_not_found', array('magick_path' => htmlspecialchars($_POST['imagemagick_path']))) . '</span>'; |
1180 } |
1180 } |
1181 $max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']); |
1181 $max_upload = floor((float)$_POST['max_file_size'] * (int)$_POST['fs_units']); |
1182 if ( $max_upload > 1048576 && defined('ENANO_DEMO_MODE') ) |
1182 if ( $max_upload > 1048576 && defined('ENANO_DEMO_MODE') ) |
1183 { |
1183 { |
1184 echo '<div class="error-box">Wouldn\'t want the server DoS\'ed now. Stick to under a megabyte for the demo, please.</div>'; |
1184 echo '<div class="error-box">Wouldn\'t want the server DoS\'ed now. Stick to under a megabyte for the demo, please.</div>'; |
1185 } |
1185 } |
1186 else |
1186 else |
1187 { |
1187 { |
1188 setConfig('max_file_size', $max_upload.''); |
1188 setConfig('max_file_size', $max_upload.''); |
1189 } |
1189 } |
1190 } |
1190 } |
1191 acp_start_form(); |
1191 acp_start_form(); |
1192 ?> |
1192 ?> |
1193 <h3><?php echo $lang->get('acpup_heading_main'); ?></h3> |
1193 <h3><?php echo $lang->get('acpup_heading_main'); ?></h3> |
1194 |
1194 |
1195 <p> |
1195 <p> |
1196 <?php echo $lang->get('acpup_intro'); ?> |
1196 <?php echo $lang->get('acpup_intro'); ?> |
1197 </p> |
1197 </p> |
1198 <p> |
1198 <p> |
1199 <label> |
1199 <label> |
1200 <input type="checkbox" name="enable_uploads" <?php if(getConfig('enable_uploads')=='1') echo 'checked="checked"'; ?> /> |
1200 <input type="checkbox" name="enable_uploads" <?php if(getConfig('enable_uploads')=='1') echo 'checked="checked"'; ?> /> |
1201 <b><?php echo $lang->get('acpup_field_enable'); ?></b> |
1201 <b><?php echo $lang->get('acpup_field_enable'); ?></b> |
1202 </label> |
1202 </label> |
1203 </p> |
1203 </p> |
1204 <p> |
1204 <p> |
1205 <?php echo $lang->get('acpup_field_max_size'); ?> |
1205 <?php echo $lang->get('acpup_field_max_size'); ?> |
1206 <input name="max_file_size" onkeyup="if(!this.value.match(/^([0-9\.]+)$/ig)) this.value = this.value.substr(0,this.value.length-1);" value="<?php echo getConfig('max_file_size', '256000'); ?>" /> |
1206 <input name="max_file_size" onkeyup="if(!this.value.match(/^([0-9\.]+)$/ig)) this.value = this.value.substr(0,this.value.length-1);" value="<?php echo getConfig('max_file_size', '256000'); ?>" /> |
1207 <select name="fs_units"> |
1207 <select name="fs_units"> |
1208 <option value="1" selected="selected"><?php echo $lang->get('etc_unit_bytes'); ?></option> |
1208 <option value="1" selected="selected"><?php echo $lang->get('etc_unit_bytes'); ?></option> |
1209 <option value="1024"><?php echo $lang->get('etc_unit_kilobytes_short'); ?></option> |
1209 <option value="1024"><?php echo $lang->get('etc_unit_kilobytes_short'); ?></option> |
1210 <option value="1048576"><?php echo $lang->get('etc_unit_megabytes_short'); ?></option> |
1210 <option value="1048576"><?php echo $lang->get('etc_unit_megabytes_short'); ?></option> |
1211 </select> |
1211 </select> |
1212 </p> |
1212 </p> |
1213 |
1213 |
1214 <p><?php echo $lang->get('acpup_info_magick'); ?></p> |
1214 <p><?php echo $lang->get('acpup_info_magick'); ?></p> |
1215 <p> |
1215 <p> |
1216 <label> |
1216 <label> |
1217 <input type="checkbox" name="enable_imagemagick" <?php if(getConfig('enable_imagemagick')=='1') echo 'checked="checked"'; ?> /> |
1217 <input type="checkbox" name="enable_imagemagick" <?php if(getConfig('enable_imagemagick')=='1') echo 'checked="checked"'; ?> /> |
1218 <?php echo $lang->get('acpup_field_magick_enable'); ?> |
1218 <?php echo $lang->get('acpup_field_magick_enable'); ?> |
1219 </label> |
1219 </label> |
1220 <br /> |
1220 <br /> |
1221 <?php echo $lang->get('acpup_field_magick_path'); ?> <input type="text" name="imagemagick_path" value="<?php if(getConfig('imagemagick_path')) echo getConfig('imagemagick_path'); else echo '/usr/bin/convert'; ?>" /><br /> |
1221 <?php echo $lang->get('acpup_field_magick_path'); ?> <input type="text" name="imagemagick_path" value="<?php if(getConfig('imagemagick_path')) echo getConfig('imagemagick_path'); else echo '/usr/bin/convert'; ?>" /><br /> |
1222 <?php echo $lang->get('acpup_field_magick_path_hint'); ?> |
1222 <?php echo $lang->get('acpup_field_magick_path_hint'); ?> |
1223 </p> |
1223 </p> |
1224 |
1224 |
1225 <p><?php echo $lang->get('acpup_info_cache'); ?></p> |
1225 <p><?php echo $lang->get('acpup_info_cache'); ?></p> |
1226 <p> |
1226 <p> |
1227 <?php echo $lang->get('acpup_info_cache_chmod'); ?> |
1227 <?php echo $lang->get('acpup_info_cache_chmod'); ?> |
1228 |
1228 |
1229 <?php |
1229 <?php |
1230 if(!is_writable(ENANO_ROOT.'/cache/')) |
1230 if(!is_writable(ENANO_ROOT.'/cache/')) |
1231 echo $lang->get('acpup_msg_cache_not_writable'); |
1231 echo $lang->get('acpup_msg_cache_not_writable'); |
1232 ?> |
1232 ?> |
1233 </p> |
1233 </p> |
1234 |
1234 |
1235 <p> |
1235 <p> |
1236 <label> |
1236 <label> |
1237 <input type="checkbox" name="cache_thumbs" <?php if(getConfig('cache_thumbs')=='1' && is_writable(ENANO_ROOT.'/cache/')) echo 'checked="checked"'; else if ( ! is_writable(ENANO_ROOT . '/cache/') ) echo 'readonly="readonly"'; ?> /> |
1237 <input type="checkbox" name="cache_thumbs" <?php if(getConfig('cache_thumbs')=='1' && is_writable(ENANO_ROOT.'/cache/')) echo 'checked="checked"'; else if ( ! is_writable(ENANO_ROOT . '/cache/') ) echo 'readonly="readonly"'; ?> /> |
1238 <?php echo $lang->get('acpup_field_cache'); ?> |
1238 <?php echo $lang->get('acpup_field_cache'); ?> |
1239 </label> |
1239 </label> |
1240 </p> |
1240 </p> |
1241 |
1241 |
1242 <p><?php echo $lang->get('acpup_info_history'); ?></p> |
1242 <p><?php echo $lang->get('acpup_info_history'); ?></p> |
1243 <p> |
1243 <p> |
1244 <label> |
1244 <label> |
1245 <input type="checkbox" name="file_history" <?php if(getConfig('file_history')=='1') echo 'checked="checked"'; ?> /> |
1245 <input type="checkbox" name="file_history" <?php if(getConfig('file_history')=='1') echo 'checked="checked"'; ?> /> |
1246 <?php echo $lang->get('acpup_field_history'); ?> |
1246 <?php echo $lang->get('acpup_field_history'); ?> |
1247 </label> |
1247 </label> |
1248 </p> |
1248 </p> |
1249 |
1249 |
1250 <hr style="margin-left: 1em;" /> |
1250 <hr style="margin-left: 1em;" /> |
1251 <p><input type="submit" name="save" value="<?php echo $lang->get('acpup_btn_save'); ?>" style="font-weight: bold;" /></p> |
1251 <p><input type="submit" name="save" value="<?php echo $lang->get('acpup_btn_save'); ?>" style="font-weight: bold;" /></p> |
1252 <?php |
1252 <?php |
1253 echo '</form>'; |
1253 echo '</form>'; |
1254 } |
1254 } |
1255 |
1255 |
1256 function page_Admin_UploadAllowedMimeTypes() |
1256 function page_Admin_UploadAllowedMimeTypes() |
1257 { |
1257 { |
1258 global $db, $session, $paths, $template, $plugins; // Common objects |
1258 global $db, $session, $paths, $template, $plugins; // Common objects |
1259 global $lang; |
1259 global $lang; |
1260 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1260 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1261 { |
1261 { |
1262 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1262 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1263 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1263 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1264 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1264 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1265 return; |
1265 return; |
1266 } |
1266 } |
1267 |
1267 |
1268 global $mime_types, $mimetype_exps, $mimetype_extlist; |
1268 global $mime_types, $mimetype_exps, $mimetype_extlist; |
1269 if(isset($_POST['save']) && !defined('ENANO_DEMO_MODE')) |
1269 if(isset($_POST['save']) && !defined('ENANO_DEMO_MODE')) |
1270 { |
1270 { |
1271 $bits = ''; |
1271 $bits = ''; |
1272 $keys = array_keys($mime_types); |
1272 $keys = array_keys($mime_types); |
1273 foreach($keys as $i => $k) |
1273 foreach($keys as $i => $k) |
1274 { |
1274 { |
1275 if(isset($_POST['ext_'.$k])) $bits .= '1'; |
1275 if(isset($_POST['ext_'.$k])) $bits .= '1'; |
1276 else $bits .= '0'; |
1276 else $bits .= '0'; |
1277 } |
1277 } |
1278 $bits = compress_bitfield($bits); |
1278 $bits = compress_bitfield($bits); |
1279 setConfig('allowed_mime_types', $bits); |
1279 setConfig('allowed_mime_types', $bits); |
1280 echo '<div class="info-box">' . $lang->get('acpft_msg_saved') . '</div>'; |
1280 echo '<div class="info-box">' . $lang->get('acpft_msg_saved') . '</div>'; |
1281 } |
1281 } |
1282 else if ( isset($_POST['save']) && defined('ENANO_DEMO_MODE') ) |
1282 else if ( isset($_POST['save']) && defined('ENANO_DEMO_MODE') ) |
1283 { |
1283 { |
1284 echo '<div class="error-box">' . $lang->get('acpft_msg_demo_mode') . '</div>'; |
1284 echo '<div class="error-box">' . $lang->get('acpft_msg_demo_mode') . '</div>'; |
1285 } |
1285 } |
1286 $allowed = fetch_allowed_extensions(); |
1286 $allowed = fetch_allowed_extensions(); |
1287 ?> |
1287 ?> |
1288 <h3><?php echo $lang->get('acpft_heading_main'); ?></h3> |
1288 <h3><?php echo $lang->get('acpft_heading_main'); ?></h3> |
1289 <p><?php echo $lang->get('acpft_hint'); ?></p> |
1289 <p><?php echo $lang->get('acpft_hint'); ?></p> |
1290 <?php |
1290 <?php |
1291 acp_start_form(); |
1291 acp_start_form(); |
1292 $c = -1; |
1292 $c = -1; |
1293 $t = -1; |
1293 $t = -1; |
1294 $cl = 'row1'; |
1294 $cl = 'row1'; |
1295 echo "\n".' <div class="tblholder">'."\n".' <table cellspacing="1" cellpadding="2" style="margin: 0; padding: 0;" border="0">'."\n".' <tr>'."\n "; |
1295 echo "\n".' <div class="tblholder">'."\n".' <table cellspacing="1" cellpadding="2" style="margin: 0; padding: 0;" border="0">'."\n".' <tr>'."\n "; |
1296 ksort($mime_types); |
1296 ksort($mime_types); |
1297 foreach($mime_types as $e => $m) |
1297 foreach($mime_types as $e => $m) |
1298 { |
1298 { |
1299 $c++; |
1299 $c++; |
1300 $t++; |
1300 $t++; |
1301 if($c == 3) |
1301 if($c == 3) |
1302 { |
1302 { |
1303 $c = 0; |
1303 $c = 0; |
1304 $cl = ( $cl == 'row1' ) ? 'row2' : 'row1'; |
1304 $cl = ( $cl == 'row1' ) ? 'row2' : 'row1'; |
1305 echo '</tr>'."\n".' <tr>'."\n "; |
1305 echo '</tr>'."\n".' <tr>'."\n "; |
1306 } |
1306 } |
1307 $seed = "extchkbx_{$e}_".md5(microtime() . mt_rand()); |
1307 $seed = "extchkbx_{$e}_".md5(microtime() . mt_rand()); |
1308 $chk = (!empty($allowed[$e])) ? ' checked="checked"' : ''; |
1308 $chk = (!empty($allowed[$e])) ? ' checked="checked"' : ''; |
1309 echo " <td class='$cl'>\n <label><input id='{$seed}' type='checkbox' name='ext_{$e}'{$chk} />.{$e}\n ({$m})</label>\n </td>\n "; |
1309 echo " <td class='$cl'>\n <label><input id='{$seed}' type='checkbox' name='ext_{$e}'{$chk} />.{$e}\n ({$m})</label>\n </td>\n "; |
1310 } |
1310 } |
1311 while($c < 2) |
1311 while($c < 2) |
1312 { |
1312 { |
1313 $c++; |
1313 $c++; |
1314 echo " <td class='{$cl}'></td>\n "; |
1314 echo " <td class='{$cl}'></td>\n "; |
1315 } |
1315 } |
1316 echo '<tr><th class="subhead" colspan="3"><input type="submit" name="save" value="' . $lang->get('etc_save_changes') . '" /></th></tr>'; |
1316 echo '<tr><th class="subhead" colspan="3"><input type="submit" name="save" value="' . $lang->get('etc_save_changes') . '" /></th></tr>'; |
1317 echo '</tr>'."\n".' </table>'."\n".' </div>'; |
1317 echo '</tr>'."\n".' </table>'."\n".' </div>'; |
1318 echo '</form>'; |
1318 echo '</form>'; |
1319 ?> |
1319 ?> |
1320 <?php |
1320 <?php |
1321 } |
1321 } |
1322 |
1322 |
1323 function page_Admin_DBBackup() |
1323 function page_Admin_DBBackup() |
1324 { |
1324 { |
1325 global $db, $session, $paths, $template, $plugins; // Common objects |
1325 global $db, $session, $paths, $template, $plugins; // Common objects |
1326 global $lang; |
1326 global $lang; |
1327 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1327 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1328 { |
1328 { |
1329 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1329 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1330 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1330 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1331 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1331 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1332 return; |
1332 return; |
1333 } |
1333 } |
1334 |
1334 |
1335 if ( ENANO_DBLAYER != 'MYSQL' ) |
1335 if ( ENANO_DBLAYER != 'MYSQL' ) |
1336 die('<h3>' . $lang->get('acpdb_err_not_supported_title') . '</h3> |
1336 die('<h3>' . $lang->get('acpdb_err_not_supported_title') . '</h3> |
1337 <p>' . $lang->get('acpdb_err_not_supported_desc') . '</p>'); |
1337 <p>' . $lang->get('acpdb_err_not_supported_desc') . '</p>'); |
1338 |
1338 |
1339 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes' && defined('ENANO_DEMO_MODE') ) |
1339 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes' && defined('ENANO_DEMO_MODE') ) |
1340 { |
1340 { |
1341 redirect(makeUrlComplete('Special', 'Administration'), $lang->get('acpdb_err_demo_mode_title'), $lang->get('acpdb_err_demo_mode_desc'), 5); |
1341 redirect(makeUrlComplete('Special', 'Administration'), $lang->get('acpdb_err_demo_mode_title'), $lang->get('acpdb_err_demo_mode_desc'), 5); |
1342 } |
1342 } |
1343 |
1343 |
1344 global $system_table_list; |
1344 global $system_table_list; |
1345 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes') |
1345 if(isset($_GET['submitting']) && $_GET['submitting'] == 'yes') |
1346 { |
1346 { |
1347 |
1347 |
1348 if(defined('SQL_BACKUP_CRYPT')) |
1348 if(defined('SQL_BACKUP_CRYPT')) |
1349 // Try to increase our time limit |
1349 // Try to increase our time limit |
1350 @set_time_limit(0); |
1350 @set_time_limit(0); |
1351 // Do the actual export |
1351 // Do the actual export |
1352 $aesext = ( defined('SQL_BACKUP_CRYPT') ) ? '.tea' : ''; |
1352 $aesext = ( defined('SQL_BACKUP_CRYPT') ) ? '.tea' : ''; |
1353 $filename = 'enano_backup_' . enano_date('ymd') . '.sql' . $aesext; |
1353 $filename = 'enano_backup_' . enano_date('ymd') . '.sql' . $aesext; |
1354 ob_start(); |
1354 ob_start(); |
1355 // Spew some headers |
1355 // Spew some headers |
1356 $headdate = enano_date(ED_DATE | ED_TIME); |
1356 $headdate = enano_date(ED_DATE | ED_TIME); |
1357 echo <<<HEADER |
1357 echo <<<HEADER |
1358 -- Enano CMS SQL backup |
1358 -- Enano CMS SQL backup |
1359 -- Generated on {$headdate} by {$session->username} |
1359 -- Generated on {$headdate} by {$session->username} |
1360 |
1360 |
1361 HEADER; |
1361 HEADER; |
1362 // build the table list |
1362 // build the table list |
1363 $base = ( isset($_POST['do_system_tables']) ) ? $system_table_list : Array(); |
1363 $base = ( isset($_POST['do_system_tables']) ) ? $system_table_list : Array(); |
1364 $add = ( isset($_POST['additional_tables'])) ? $_POST['additional_tables'] : Array(); |
1364 $add = ( isset($_POST['additional_tables'])) ? $_POST['additional_tables'] : Array(); |
1365 $tables = array_merge($base, $add); |
1365 $tables = array_merge($base, $add); |
1366 |
1366 |
1367 // Log it! |
1367 // Log it! |
1368 $e = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,edit_summary,page_text) VALUES(\'security\', \'db_backup\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($session->username).'\',' . $session->user_id . ', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', \'' . $db->escape(implode(', ', $tables)) . '\')'); |
1368 $e = $db->sql_query('INSERT INTO '.table_prefix.'logs(log_type,action,time_id,date_string,author,author_uid,edit_summary,page_text) VALUES(\'security\', \'db_backup\', '.time().', \''.enano_date(ED_DATE | ED_TIME).'\', \''.$db->escape($session->username).'\',' . $session->user_id . ', \''.$db->escape($_SERVER['REMOTE_ADDR']).'\', \'' . $db->escape(implode(', ', $tables)) . '\')'); |
1369 if ( !$e ) |
1369 if ( !$e ) |
1370 $db->_die(); |
1370 $db->_die(); |
1371 |
1371 |
1372 foreach($tables as $i => $t) |
1372 foreach($tables as $i => $t) |
1373 { |
1373 { |
1374 if(!preg_match('#^([a-z0-9_]+)$#i', $t)) |
1374 if(!preg_match('#^([a-z0-9_]+)$#i', $t)) |
1375 die('Hacking attempt'); |
1375 die('Hacking attempt'); |
1376 // if($t == table_prefix.'files' && isset($_POST['do_data'])) |
1376 // if($t == table_prefix.'files' && isset($_POST['do_data'])) |
1377 // unset($tables[$i]); |
1377 // unset($tables[$i]); |
1378 } |
1378 } |
1379 foreach($tables as $t) |
1379 foreach($tables as $t) |
1380 { |
1380 { |
1381 // THE FOLLOWING COMMENT DOES NOT APPLY AS OF 1.0. |
1381 // THE FOLLOWING COMMENT DOES NOT APPLY AS OF 1.0. |
1382 // Sorry folks - this script CAN'T backup enano_files and enano_search_index due to the sheer size of the tables. |
1382 // Sorry folks - this script CAN'T backup enano_files and enano_search_index due to the sheer size of the tables. |
1383 // If encryption is enabled the log data will be excluded too. |
1383 // If encryption is enabled the log data will be excluded too. |
1384 $result = export_table( |
1384 $result = export_table( |
1385 $t, |
1385 $t, |
1386 isset($_POST['do_struct']), |
1386 isset($_POST['do_struct']), |
1387 ( isset($_POST['do_data']) ), |
1387 ( isset($_POST['do_data']) ), |
1388 false |
1388 false |
1389 ) . "\n"; |
1389 ) . "\n"; |
1390 if ( !$result ) |
1390 if ( !$result ) |
1391 { |
1391 { |
1392 $db->_die(); |
1392 $db->_die(); |
1393 } |
1393 } |
1394 echo $result; |
1394 echo $result; |
1395 } |
1395 } |
1396 $data = ob_get_contents(); |
1396 $data = ob_get_contents(); |
1397 ob_end_clean(); |
1397 ob_end_clean(); |
1398 if(defined('SQL_BACKUP_CRYPT')) |
1398 if(defined('SQL_BACKUP_CRYPT')) |
1399 { |
1399 { |
1400 // Free some memory, we don't need this stuff any more |
1400 // Free some memory, we don't need this stuff any more |
1401 $db->close(); |
1401 $db->close(); |
1402 unset($paths, $db, $template, $plugins); |
1402 unset($paths, $db, $template, $plugins); |
1403 $tea = new TEACrypt(); |
1403 $tea = new TEACrypt(); |
1404 $data = $tea->encrypt($data, $session->private_key); |
1404 $data = $tea->encrypt($data, $session->private_key); |
1405 } |
1405 } |
1406 header('Content-disposition: attachment; filename='.$filename.''); |
1406 header('Content-disposition: attachment; filename='.$filename.''); |
1407 header('Content-type: application/octet-stream'); |
1407 header('Content-type: application/octet-stream'); |
1408 header('Content-length: '.strlen($data)); |
1408 header('Content-length: '.strlen($data)); |
1409 echo $data; |
1409 echo $data; |
1410 exit; |
1410 exit; |
1411 } |
1411 } |
1412 else |
1412 else |
1413 { |
1413 { |
1414 // Show the UI |
1414 // Show the UI |
1415 echo '<form action="'.makeUrlNS('Admin', 'DBBackup', 'submitting=yes', true).'" method="post" enctype="multipart/form-data">'; |
1415 echo '<form action="'.makeUrlNS('Admin', 'DBBackup', 'submitting=yes', true).'" method="post" enctype="multipart/form-data">'; |
1416 ?> |
1416 ?> |
1417 <p><?php echo $lang->get('acpdb_intro'); ?></p> |
1417 <p><?php echo $lang->get('acpdb_intro'); ?></p> |
1418 <p><label><input type="checkbox" name="do_system_tables" checked="checked" /> <?php echo $lang->get('acpdb_lbl_system_tables'); ?></label><p> |
1418 <p><label><input type="checkbox" name="do_system_tables" checked="checked" /> <?php echo $lang->get('acpdb_lbl_system_tables'); ?></label><p> |
1419 <p><?php echo $lang->get('acpdb_lbl_additional_tables'); ?></p> |
1419 <p><?php echo $lang->get('acpdb_lbl_additional_tables'); ?></p> |
1420 <p><select name="additional_tables[]" multiple="multiple"> |
1420 <p><select name="additional_tables[]" multiple="multiple"> |
1421 <?php |
1421 <?php |
1422 if ( ENANO_DBLAYER == 'MYSQL' ) |
1422 if ( ENANO_DBLAYER == 'MYSQL' ) |
1423 { |
1423 { |
1424 $q = $db->sql_query('SHOW TABLES;') or $db->_die('Somehow we were denied the request to get the list of tables.'); |
1424 $q = $db->sql_query('SHOW TABLES;') or $db->_die('Somehow we were denied the request to get the list of tables.'); |
1425 } |
1425 } |
1426 else if ( ENANO_DBLAYER == 'PGSQL' ) |
1426 else if ( ENANO_DBLAYER == 'PGSQL' ) |
1427 { |
1427 { |
1428 $q = $db->sql_query('SELECT relname FROM pg_stat_user_tables ORDER BY relname;') or $db->_die('Somehow we were denied the request to get the list of tables.'); |
1428 $q = $db->sql_query('SELECT relname FROM pg_stat_user_tables ORDER BY relname;') or $db->_die('Somehow we were denied the request to get the list of tables.'); |
1429 } |
1429 } |
1430 while($row = $db->fetchrow_num()) |
1430 while($row = $db->fetchrow_num()) |
1431 { |
1431 { |
1432 if(!in_array($row[0], $system_table_list)) echo '<option value="'.$row[0].'">'.$row[0].'</option>'; |
1432 if(!in_array($row[0], $system_table_list)) echo '<option value="'.$row[0].'">'.$row[0].'</option>'; |
1433 } |
1433 } |
1434 ?> |
1434 ?> |
1435 </select> |
1435 </select> |
1436 </p> |
1436 </p> |
1437 <p><label><input type="checkbox" name="do_struct" checked="checked" /> <?php echo $lang->get('acpdb_lbl_include_structure'); ?></label><br /> |
1437 <p><label><input type="checkbox" name="do_struct" checked="checked" /> <?php echo $lang->get('acpdb_lbl_include_structure'); ?></label><br /> |
1438 <label><input type="checkbox" name="do_data" checked="checked" /> <?php echo $lang->get('acpdb_lbl_include_data'); ?></label> |
1438 <label><input type="checkbox" name="do_data" checked="checked" /> <?php echo $lang->get('acpdb_lbl_include_data'); ?></label> |
1439 </p> |
1439 </p> |
1440 <p><input type="submit" value="<?php echo $lang->get('acpdb_btn_create_backup'); ?>" /></p> |
1440 <p><input type="submit" value="<?php echo $lang->get('acpdb_btn_create_backup'); ?>" /></p> |
1441 <?php |
1441 <?php |
1442 echo '</form>'; |
1442 echo '</form>'; |
1443 } |
1443 } |
1444 } |
1444 } |
1445 |
1445 |
1446 /* |
1446 /* |
1447 * Admin:PageManager sources are in /plugins/admin/PageManager.php. |
1447 * Admin:PageManager sources are in /plugins/admin/PageManager.php. |
1448 */ |
1448 */ |
1459 * Admin:GroupManager sources are in /plugins/admin/GroupManager.php. |
1459 * Admin:GroupManager sources are in /plugins/admin/GroupManager.php. |
1460 */ |
1460 */ |
1461 |
1461 |
1462 function page_Admin_COPPA() |
1462 function page_Admin_COPPA() |
1463 { |
1463 { |
1464 global $db, $session, $paths, $template, $plugins; // Common objects |
1464 global $db, $session, $paths, $template, $plugins; // Common objects |
1465 global $lang; |
1465 global $lang; |
1466 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1466 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1467 { |
1467 { |
1468 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1468 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1469 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1469 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1470 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1470 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1471 return; |
1471 return; |
1472 } |
1472 } |
1473 |
1473 |
1474 echo '<h2>' . $lang->get('acpcp_heading_main') . '</h2>'; |
1474 echo '<h2>' . $lang->get('acpcp_heading_main') . '</h2>'; |
1475 echo '<p> |
1475 echo '<p> |
1476 ' . $lang->get('acpcp_intro') . ' |
1476 ' . $lang->get('acpcp_intro') . ' |
1477 </p>'; |
1477 </p>'; |
1478 |
1478 |
1479 // Start form |
1479 // Start form |
1480 |
1480 |
1481 if ( isset($_POST['coppa_address']) ) |
1481 if ( isset($_POST['coppa_address']) ) |
1482 { |
1482 { |
1483 // Saving changes |
1483 // Saving changes |
1484 $enable_coppa = ( isset($_POST['enable_coppa']) ) ? '1' : '0'; |
1484 $enable_coppa = ( isset($_POST['enable_coppa']) ) ? '1' : '0'; |
1485 setConfig('enable_coppa', $enable_coppa); |
1485 setConfig('enable_coppa', $enable_coppa); |
1486 |
1486 |
1487 $address = $_POST['coppa_address']; // RenderMan::preprocess_text($_POST['coppa_address'], true, false); |
1487 $address = $_POST['coppa_address']; // RenderMan::preprocess_text($_POST['coppa_address'], true, false); |
1488 setConfig('coppa_address', $address); |
1488 setConfig('coppa_address', $address); |
1489 |
1489 |
1490 echo '<div class="info-box">' . $lang->get('acpcp_msg_save_success') . '</div>'; |
1490 echo '<div class="info-box">' . $lang->get('acpcp_msg_save_success') . '</div>'; |
1491 } |
1491 } |
1492 |
1492 |
1493 acp_start_form(); |
1493 acp_start_form(); |
1494 |
1494 |
1495 echo '<div class="tblholder">'; |
1495 echo '<div class="tblholder">'; |
1496 echo '<table border="0" cellspacing="1" cellpadding="4">'; |
1496 echo '<table border="0" cellspacing="1" cellpadding="4">'; |
1497 echo '<tr> |
1497 echo '<tr> |
1498 <th colspan="2"> |
1498 <th colspan="2"> |
1499 ' . $lang->get('acpcp_th_form') . ' |
1499 ' . $lang->get('acpcp_th_form') . ' |
1500 </th> |
1500 </th> |
1501 </tr>'; |
1501 </tr>'; |
1502 |
1502 |
1503 echo '<tr> |
1503 echo '<tr> |
1504 <td class="row1"> |
1504 <td class="row1"> |
1505 ' . $lang->get('acpcp_field_enable_title') . ' |
1505 ' . $lang->get('acpcp_field_enable_title') . ' |
1506 </td> |
1506 </td> |
1507 <td class="row2"> |
1507 <td class="row2"> |
1508 <label><input type="checkbox" name="enable_coppa" ' . ( ( getConfig('enable_coppa') == '1' ) ? 'checked="checked"' : '' ) . ' /> ' . $lang->get('acpcp_field_enable') . '</label><br /> |
1508 <label><input type="checkbox" name="enable_coppa" ' . ( ( getConfig('enable_coppa') == '1' ) ? 'checked="checked"' : '' ) . ' /> ' . $lang->get('acpcp_field_enable') . '</label><br /> |
1509 <small>' . $lang->get('acpcp_field_enable_hint') . '</small> |
1509 <small>' . $lang->get('acpcp_field_enable_hint') . '</small> |
1510 </td> |
1510 </td> |
1511 </tr>'; |
1511 </tr>'; |
1512 |
1512 |
1513 echo '<tr> |
1513 echo '<tr> |
1514 <td class="row1"> |
1514 <td class="row1"> |
1515 ' . $lang->get('acpcp_field_address') . '<br /> |
1515 ' . $lang->get('acpcp_field_address') . '<br /> |
1516 <small>' . $lang->get('acpcp_field_address_hint') . '</small> |
1516 <small>' . $lang->get('acpcp_field_address_hint') . '</small> |
1517 </td> |
1517 </td> |
1518 <td class="row2"> |
1518 <td class="row2"> |
1519 <textarea name="coppa_address" rows="7" cols="40">' . getConfig('coppa_address') . '</textarea> |
1519 <textarea name="coppa_address" rows="7" cols="40">' . getConfig('coppa_address') . '</textarea> |
1520 </td> |
1520 </td> |
1521 </tr>'; |
1521 </tr>'; |
1522 |
1522 |
1523 echo '<tr> |
1523 echo '<tr> |
1524 <th colspan="2" class="subhead"> |
1524 <th colspan="2" class="subhead"> |
1525 <input type="submit" value="' . $lang->get('etc_save_changes') . '" /> |
1525 <input type="submit" value="' . $lang->get('etc_save_changes') . '" /> |
1526 </th> |
1526 </th> |
1527 </tr>'; |
1527 </tr>'; |
1528 |
1528 |
1529 echo '</table>'; |
1529 echo '</table>'; |
1530 |
1530 |
1531 echo '</form>'; |
1531 echo '</form>'; |
1532 |
1532 |
1533 } |
1533 } |
1534 |
1534 |
1535 function page_Admin_MassEmail() |
1535 function page_Admin_MassEmail() |
1536 { |
1536 { |
1537 global $db, $session, $paths, $template, $plugins; // Common objects |
1537 global $db, $session, $paths, $template, $plugins; // Common objects |
1538 global $lang; |
1538 global $lang; |
1539 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1539 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1540 { |
1540 { |
1541 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1541 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1542 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1542 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1543 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1543 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1544 return; |
1544 return; |
1545 } |
1545 } |
1546 |
1546 |
1547 global $enano_config; |
1547 global $enano_config; |
1548 if ( isset($_POST['do_send']) && !defined('ENANO_DEMO_MODE') ) |
1548 if ( isset($_POST['do_send']) && !defined('ENANO_DEMO_MODE') ) |
1549 { |
1549 { |
1550 $use_smtp = getConfig('smtp_enabled') == '1'; |
1550 $use_smtp = getConfig('smtp_enabled') == '1'; |
1551 |
1551 |
1552 // |
1552 // |
1553 // Let's do some checking to make sure that mass mail functions |
1553 // Let's do some checking to make sure that mass mail functions |
1554 // are working in win32 versions of php. (copied from phpBB) |
1554 // are working in win32 versions of php. (copied from phpBB) |
1555 // |
1555 // |
1556 if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$use_smtp) |
1556 if ( preg_match('/[c-z]:\\\.*/i', getenv('PATH')) && !$use_smtp) |
1557 { |
1557 { |
1558 $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; |
1558 $ini_val = ( @phpversion() >= '4.0.0' ) ? 'ini_get' : 'get_cfg_var'; |
1559 |
1559 |
1560 // We are running on windows, force delivery to use our smtp functions |
1560 // We are running on windows, force delivery to use our smtp functions |
1561 // since php's are broken by default |
1561 // since php's are broken by default |
1562 $use_smtp = true; |
1562 $use_smtp = true; |
1563 $enano_config['smtp_server'] = @$ini_val('SMTP'); |
1563 $enano_config['smtp_server'] = @$ini_val('SMTP'); |
1564 } |
1564 } |
1565 |
1565 |
1566 $mail = new emailer( !empty($use_smtp) ); |
1566 $mail = new emailer( !empty($use_smtp) ); |
1567 |
1567 |
1568 // Validate subject/message body |
1568 // Validate subject/message body |
1569 $subject = stripslashes(trim($_POST['subject'])); |
1569 $subject = stripslashes(trim($_POST['subject'])); |
1570 $message = stripslashes(trim($_POST['message'])); |
1570 $message = stripslashes(trim($_POST['message'])); |
1571 |
1571 |
1572 if ( empty($subject) ) |
1572 if ( empty($subject) ) |
1573 $errors[] = $lang->get('acpmm_err_need_subject'); |
1573 $errors[] = $lang->get('acpmm_err_need_subject'); |
1574 if ( empty($message) ) |
1574 if ( empty($message) ) |
1575 $errors[] = $lang->get('acpmm_err_need_message'); |
1575 $errors[] = $lang->get('acpmm_err_need_message'); |
1576 |
1576 |
1577 // Get list of members |
1577 // Get list of members |
1578 if ( !empty($_POST['userlist']) ) |
1578 if ( !empty($_POST['userlist']) ) |
1579 { |
1579 { |
1580 $userlist = str_replace(', ', ',', $_POST['userlist']); |
1580 $userlist = str_replace(', ', ',', $_POST['userlist']); |
1581 $userlist = explode(',', $userlist); |
1581 $userlist = explode(',', $userlist); |
1582 foreach ( $userlist as $k => $u ) |
1582 foreach ( $userlist as $k => $u ) |
1583 { |
1583 { |
1584 if ( $u == $session->username ) |
1584 if ( $u == $session->username ) |
1585 { |
1585 { |
1586 // Message is automatically sent to the sender |
1586 // Message is automatically sent to the sender |
1587 unset($userlist[$k]); |
1587 unset($userlist[$k]); |
1588 } |
1588 } |
1589 else |
1589 else |
1590 { |
1590 { |
1591 $userlist[$k] = $db->escape($u); |
1591 $userlist[$k] = $db->escape($u); |
1592 } |
1592 } |
1593 } |
1593 } |
1594 $userlist = 'WHERE username=\'' . implode('\' OR username=\'', $userlist) . '\''; |
1594 $userlist = 'WHERE username=\'' . implode('\' OR username=\'', $userlist) . '\''; |
1595 |
1595 |
1596 $q = $db->sql_query('SELECT email FROM '.table_prefix.'users ' . $userlist . ';'); |
1596 $q = $db->sql_query('SELECT email FROM '.table_prefix.'users ' . $userlist . ';'); |
1597 if ( !$q ) |
1597 if ( !$q ) |
1598 $db->_die(); |
1598 $db->_die(); |
1599 |
1599 |
1600 if ( $row = $db->fetchrow() ) |
1600 if ( $row = $db->fetchrow() ) |
1601 { |
1601 { |
1602 do { |
1602 do { |
1603 $mail->cc($row['email']); |
1603 $mail->cc($row['email']); |
1604 } while ( $row = $db->fetchrow() ); |
1604 } while ( $row = $db->fetchrow() ); |
1605 } |
1605 } |
1606 |
1606 |
1607 $db->free_result(); |
1607 $db->free_result(); |
1608 |
1608 |
1609 } |
1609 } |
1610 else |
1610 else |
1611 { |
1611 { |
1612 // Sending to a usergroup |
1612 // Sending to a usergroup |
1613 |
1613 |
1614 $group_id = intval($_POST['group_id']); |
1614 $group_id = intval($_POST['group_id']); |
1615 if ( $group_id < 1 ) |
1615 if ( $group_id < 1 ) |
1616 { |
1616 { |
1617 $errors[] = 'Invalid group ID'; |
1617 $errors[] = 'Invalid group ID'; |
1618 } |
1618 } |
1619 else |
1619 else |
1620 { |
1620 { |
1621 $q = $db->sql_query('SELECT u.email FROM '.table_prefix.'group_members AS g |
1621 $q = $db->sql_query('SELECT u.email FROM '.table_prefix.'group_members AS g |
1622 LEFT JOIN '.table_prefix.'users AS u |
1622 LEFT JOIN '.table_prefix.'users AS u |
1623 ON (u.user_id=g.user_id) |
1623 ON (u.user_id=g.user_id) |
1624 WHERE g.group_id=' . $group_id . ';'); |
1624 WHERE g.group_id=' . $group_id . ';'); |
1625 if ( !$q ) |
1625 if ( !$q ) |
1626 $db->_die(); |
1626 $db->_die(); |
1627 |
1627 |
1628 if ( $row = $db->fetchrow() ) |
1628 if ( $row = $db->fetchrow() ) |
1629 { |
1629 { |
1630 do { |
1630 do { |
1631 $mail->cc($row['email']); |
1631 $mail->cc($row['email']); |
1632 } while ( $row = $db->fetchrow() ); |
1632 } while ( $row = $db->fetchrow() ); |
1633 } |
1633 } |
1634 |
1634 |
1635 $db->free_result(); |
1635 $db->free_result(); |
1636 } |
1636 } |
1637 } |
1637 } |
1638 |
1638 |
1639 if ( sizeof($errors) < 1 ) |
1639 if ( sizeof($errors) < 1 ) |
1640 { |
1640 { |
1641 |
1641 |
1642 $mail->from(getConfig('contact_email')); |
1642 $mail->from(getConfig('contact_email')); |
1643 $mail->replyto(getConfig('contact_email')); |
1643 $mail->replyto(getConfig('contact_email')); |
1644 $mail->set_subject($subject); |
1644 $mail->set_subject($subject); |
1645 $mail->email_address(getConfig('contact_email')); |
1645 $mail->email_address(getConfig('contact_email')); |
1646 |
1646 |
1647 // Copied/modified from phpBB |
1647 // Copied/modified from phpBB |
1648 $email_headers = 'X-AntiAbuse: Website server name - ' . $_SERVER['SERVER_NAME'] . "\n"; |
1648 $email_headers = 'X-AntiAbuse: Website server name - ' . $_SERVER['SERVER_NAME'] . "\n"; |
1649 $email_headers .= 'X-AntiAbuse: User_id - ' . $session->user_id . "\n"; |
1649 $email_headers .= 'X-AntiAbuse: User_id - ' . $session->user_id . "\n"; |
1650 $email_headers .= 'X-AntiAbuse: Username - ' . $session->username . "\n"; |
1650 $email_headers .= 'X-AntiAbuse: Username - ' . $session->username . "\n"; |
1651 $email_headers .= 'X-AntiAbuse: User IP - ' . $_SERVER['REMOTE_ADDR'] . "\n"; |
1651 $email_headers .= 'X-AntiAbuse: User IP - ' . $_SERVER['REMOTE_ADDR'] . "\n"; |
1652 |
1652 |
1653 $mail->extra_headers($email_headers); |
1653 $mail->extra_headers($email_headers); |
1654 |
1654 |
1655 // FIXME: how to handle l10n with this? |
1655 // FIXME: how to handle l10n with this? |
1656 $tpl = 'The following message was mass-mailed by {SENDER}, one of the administrators from {SITE_NAME}. If this message contains spam or any comments which you find abusive or offensive, please contact the administration team at: |
1656 $tpl = 'The following message was mass-mailed by {SENDER}, one of the administrators from {SITE_NAME}. If this message contains spam or any comments which you find abusive or offensive, please contact the administration team at: |
1657 |
1657 |
1658 {CONTACT_EMAIL} |
1658 {CONTACT_EMAIL} |
1659 |
1659 |
1660 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1660 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
1661 {MESSAGE} |
1661 {MESSAGE} |
1662 '; |
1662 '; |
1663 |
1663 |
1664 $mail->use_template($tpl); |
1664 $mail->use_template($tpl); |
1665 |
1665 |
1666 $mail->assign_vars(array( |
1666 $mail->assign_vars(array( |
1667 'SENDER' => $session->username, |
1667 'SENDER' => $session->username, |
1668 'SITE_NAME' => getConfig('site_name'), |
1668 'SITE_NAME' => getConfig('site_name'), |
1669 'CONTACT_EMAIL' => getConfig('contact_email'), |
1669 'CONTACT_EMAIL' => getConfig('contact_email'), |
1670 'MESSAGE' => $message |
1670 'MESSAGE' => $message |
1671 )); |
1671 )); |
1672 |
1672 |
1673 //echo '<pre>'.print_r($mail,true).'</pre>'; |
1673 //echo '<pre>'.print_r($mail,true).'</pre>'; |
1674 |
1674 |
1675 // All done |
1675 // All done |
1676 $mail->send(); |
1676 $mail->send(); |
1677 $mail->reset(); |
1677 $mail->reset(); |
1678 |
1678 |
1679 echo '<div class="info-box">' . $lang->get('acpmm_msg_send_success') . '</div>'; |
1679 echo '<div class="info-box">' . $lang->get('acpmm_msg_send_success') . '</div>'; |
1680 |
1680 |
1681 } |
1681 } |
1682 else |
1682 else |
1683 { |
1683 { |
1684 echo '<div class="warning-box">' . $lang->get('acpmm_err_send_fail') . '<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>'; |
1684 echo '<div class="warning-box">' . $lang->get('acpmm_err_send_fail') . '<ul><li>' . implode('</li><li>', $errors) . '</li></ul></div>'; |
1685 } |
1685 } |
1686 |
1686 |
1687 } |
1687 } |
1688 else if ( isset($_POST['do_send']) && defined('ENANO_DEMO_MODE') ) |
1688 else if ( isset($_POST['do_send']) && defined('ENANO_DEMO_MODE') ) |
1689 { |
1689 { |
1690 echo '<div class="error-box">' . $lang->get('acpmm_err_demo') . '</div>'; |
1690 echo '<div class="error-box">' . $lang->get('acpmm_err_demo') . '</div>'; |
1691 } |
1691 } |
1692 acp_start_form(); |
1692 acp_start_form(); |
1693 ?> |
1693 ?> |
1694 <div class="tblholder"> |
1694 <div class="tblholder"> |
1695 <table border="0" cellspacing="1" cellpadding="4"> |
1695 <table border="0" cellspacing="1" cellpadding="4"> |
1696 <tr> |
1696 <tr> |
1697 <th colspan="2"><?php echo $lang->get('acpmm_heading_main'); ?></th> |
1697 <th colspan="2"><?php echo $lang->get('acpmm_heading_main'); ?></th> |
1698 </tr> |
1698 </tr> |
1699 <tr> |
1699 <tr> |
1700 <td class="row2" rowspan="2" style="width: 30%; min-width: 200px;"> |
1700 <td class="row2" rowspan="2" style="width: 30%; min-width: 200px;"> |
1701 <?php echo $lang->get('acpmm_field_group_to'); ?><br /> |
1701 <?php echo $lang->get('acpmm_field_group_to'); ?><br /> |
1702 <small> |
1702 <small> |
1703 <?php echo $lang->get('acpmm_field_group_to_hint'); ?> |
1703 <?php echo $lang->get('acpmm_field_group_to_hint'); ?> |
1704 </small> |
1704 </small> |
1705 </td> |
1705 </td> |
1706 <td class="row1"> |
1706 <td class="row1"> |
1707 <select name="group_id"> |
1707 <select name="group_id"> |
1708 <?php |
1708 <?php |
1709 $q = $db->sql_query('SELECT group_name,group_id FROM '.table_prefix.'groups ORDER BY group_name ASC;'); |
1709 $q = $db->sql_query('SELECT group_name,group_id FROM '.table_prefix.'groups ORDER BY group_name ASC;'); |
1710 if ( !$q ) |
1710 if ( !$q ) |
1711 $db->_die(); |
1711 $db->_die(); |
1712 while ( $row = $db->fetchrow() ) |
1712 while ( $row = $db->fetchrow() ) |
1713 { |
1713 { |
1714 list($g_name) = array_values($row); |
1714 list($g_name) = array_values($row); |
1715 $g_name_langstr = 'groupcp_grp_' . strtolower($g_name); |
1715 $g_name_langstr = 'groupcp_grp_' . strtolower($g_name); |
1716 if ( ($g_langstr = $lang->get($g_name_langstr)) != $g_name_langstr ) |
1716 if ( ($g_langstr = $lang->get($g_name_langstr)) != $g_name_langstr ) |
1717 { |
1717 { |
1718 $g_name = $g_langstr; |
1718 $g_name = $g_langstr; |
1719 } |
1719 } |
1720 echo '<option value="' . $row['group_id'] . '">' . htmlspecialchars($g_name) . '</option>'; |
1720 echo '<option value="' . $row['group_id'] . '">' . htmlspecialchars($g_name) . '</option>'; |
1721 } |
1721 } |
1722 ?> |
1722 ?> |
1723 </select> |
1723 </select> |
1724 </td> |
1724 </td> |
1725 </tr> |
1725 </tr> |
1726 <tr> |
1726 <tr> |
1727 <td class="row1"> |
1727 <td class="row1"> |
1728 <?php echo $lang->get('acpmm_field_username'); ?> <input type="text" name="userlist" size="50" /> |
1728 <?php echo $lang->get('acpmm_field_username'); ?> <input type="text" name="userlist" size="50" /> |
1729 </td> |
1729 </td> |
1730 </tr> |
1730 </tr> |
1731 <tr> |
1731 <tr> |
1732 <td class="row2" style="width: 30%; min-width: 200px;"> |
1732 <td class="row2" style="width: 30%; min-width: 200px;"> |
1733 <?php echo $lang->get('acpmm_field_subject'); ?> |
1733 <?php echo $lang->get('acpmm_field_subject'); ?> |
1734 </td> |
1734 </td> |
1735 <td class="row1"> |
1735 <td class="row1"> |
1736 <input name="subject" type="text" size="50" /> |
1736 <input name="subject" type="text" size="50" /> |
1737 </td> |
1737 </td> |
1738 </tr> |
1738 </tr> |
1739 <tr> |
1739 <tr> |
1740 <td class="row2" style="width: 30%; min-width: 200px;"> |
1740 <td class="row2" style="width: 30%; min-width: 200px;"> |
1741 <?php echo $lang->get('acpmm_field_message'); ?> |
1741 <?php echo $lang->get('acpmm_field_message'); ?> |
1742 </td> |
1742 </td> |
1743 <td class="row1"> |
1743 <td class="row1"> |
1744 <textarea name="message" rows="30" cols="60" style="width: 100%;"></textarea> |
1744 <textarea name="message" rows="30" cols="60" style="width: 100%;"></textarea> |
1745 </td> |
1745 </td> |
1746 </tr> |
1746 </tr> |
1747 <tr> |
1747 <tr> |
1748 <th class="subhead" colspan="2" style="text-align: left;" valign="middle"> |
1748 <th class="subhead" colspan="2" style="text-align: left;" valign="middle"> |
1749 <div style="float: right;"><input type="submit" name="do_send" value="<?php echo $lang->get('acpmm_btn_send'); ?>" /></div> |
1749 <div style="float: right;"><input type="submit" name="do_send" value="<?php echo $lang->get('acpmm_btn_send'); ?>" /></div> |
1750 <small style="font-weight: normal;"><?php echo $lang->get('acpmm_msg_send_takeawhile'); ?></small> |
1750 <small style="font-weight: normal;"><?php echo $lang->get('acpmm_msg_send_takeawhile'); ?></small> |
1751 </th> |
1751 </th> |
1752 </tr> |
1752 </tr> |
1753 |
1753 |
1754 </table> |
1754 </table> |
1755 </div> |
1755 </div> |
1756 <?php |
1756 <?php |
1757 echo '</form>'; |
1757 echo '</form>'; |
1758 } |
1758 } |
1759 |
1759 |
1760 function page_Admin_BanControl() |
1760 function page_Admin_BanControl() |
1761 { |
1761 { |
1762 global $db, $session, $paths, $template, $plugins; // Common objects |
1762 global $db, $session, $paths, $template, $plugins; // Common objects |
1763 global $lang; |
1763 global $lang; |
1764 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1764 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1765 { |
1765 { |
1766 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1766 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1767 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1767 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1768 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1768 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1769 return; |
1769 return; |
1770 } |
1770 } |
1771 |
1771 |
1772 if(isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && $_GET['id'] != '') |
1772 if(isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && $_GET['id'] != '') |
1773 { |
1773 { |
1774 $e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . intval($_GET['id']) . ''); |
1774 $e = $db->sql_query('DELETE FROM '.table_prefix.'banlist WHERE ban_id=' . intval($_GET['id']) . ''); |
1775 if ( !$e ) |
1775 if ( !$e ) |
1776 $db->_die('The ban list entry was not deleted.'); |
1776 $db->_die('The ban list entry was not deleted.'); |
1777 } |
1777 } |
1778 if(isset($_POST['create']) && !defined('ENANO_DEMO_MODE')) |
1778 if(isset($_POST['create']) && !defined('ENANO_DEMO_MODE')) |
1779 { |
1779 { |
1780 $type = intval($_POST['type']); |
1780 $type = intval($_POST['type']); |
1781 $value = trim($_POST['value']); |
1781 $value = trim($_POST['value']); |
1782 if ( !in_array($type, array(BAN_IP, BAN_USER, BAN_EMAIL)) ) |
1782 if ( !in_array($type, array(BAN_IP, BAN_USER, BAN_EMAIL)) ) |
1783 { |
1783 { |
1784 echo '<div class="error-box">Hacking attempt.</div>'; |
1784 echo '<div class="error-box">Hacking attempt.</div>'; |
1785 } |
1785 } |
1786 else if ( empty($value) ) |
1786 else if ( empty($value) ) |
1787 { |
1787 { |
1788 echo '<div class="error-box">' . $lang->get('acpbc_err_empty') . '</div>'; |
1788 echo '<div class="error-box">' . $lang->get('acpbc_err_empty') . '</div>'; |
1789 } |
1789 } |
1790 else |
1790 else |
1791 { |
1791 { |
1792 $entries = array(); |
1792 $entries = array(); |
1793 $input = explode(',', $_POST['value']); |
1793 $input = explode(',', $_POST['value']); |
1794 $error = false; |
1794 $error = false; |
1795 foreach ( $input as $entry ) |
1795 foreach ( $input as $entry ) |
1796 { |
1796 { |
1797 $entry = trim($entry); |
1797 $entry = trim($entry); |
1798 if ( empty($entry) ) |
1798 if ( empty($entry) ) |
1799 { |
1799 { |
1800 echo '<div class="error-box">' . $lang->get('acpbc_err_invalid_ip_range') . '</div>'; |
1800 echo '<div class="error-box">' . $lang->get('acpbc_err_invalid_ip_range') . '</div>'; |
1801 $error = true; |
1801 $error = true; |
1802 break; |
1802 break; |
1803 } |
1803 } |
1804 if ( $type == BAN_IP ) |
1804 if ( $type == BAN_IP ) |
1805 { |
1805 { |
1806 if ( !isset($_POST['regex']) ) |
1806 if ( !isset($_POST['regex']) ) |
1807 { |
1807 { |
1808 // as of 1.0.2 parsing is done at runtime |
1808 // as of 1.0.2 parsing is done at runtime |
1809 $entries[] = $entry; |
1809 $entries[] = $entry; |
1810 } |
1810 } |
1811 else |
1811 else |
1812 { |
1812 { |
1813 $entries[] = $entry; |
1813 $entries[] = $entry; |
1814 } |
1814 } |
1815 } |
1815 } |
1816 else |
1816 else |
1817 { |
1817 { |
1818 $entries[] = $entry; |
1818 $entries[] = $entry; |
1819 } |
1819 } |
1820 } |
1820 } |
1821 if ( !$error ) |
1821 if ( !$error ) |
1822 { |
1822 { |
1823 $regex = ( isset($_POST['regex']) ) ? '1' : '0'; |
1823 $regex = ( isset($_POST['regex']) ) ? '1' : '0'; |
1824 $to_insert = array(); |
1824 $to_insert = array(); |
1825 $reason = $db->escape($_POST['reason']); |
1825 $reason = $db->escape($_POST['reason']); |
1826 foreach ( $entries as $entry ) |
1826 foreach ( $entries as $entry ) |
1827 { |
1827 { |
1828 $entry = $db->escape($entry); |
1828 $entry = $db->escape($entry); |
1829 $to_insert[] = "($type, '$entry', '$reason', $regex)"; |
1829 $to_insert[] = "($type, '$entry', '$reason', $regex)"; |
1830 } |
1830 } |
1831 $q = 'INSERT INTO '.table_prefix."banlist(ban_type, ban_value, reason, is_regex)\n VALUES" . implode(",\n ", $to_insert) . ';'; |
1831 $q = 'INSERT INTO '.table_prefix."banlist(ban_type, ban_value, reason, is_regex)\n VALUES" . implode(",\n ", $to_insert) . ';'; |
1832 @set_time_limit(0); |
1832 @set_time_limit(0); |
1833 $e = $db->sql_query($q); |
1833 $e = $db->sql_query($q); |
1834 if(!$e) $db->_die('The banlist could not be updated.'); |
1834 if(!$e) $db->_die('The banlist could not be updated.'); |
1835 } |
1835 } |
1836 } |
1836 } |
1837 } |
1837 } |
1838 else if ( isset($_POST['create']) && defined('ENANO_DEMO_MODE') ) |
1838 else if ( isset($_POST['create']) && defined('ENANO_DEMO_MODE') ) |
1839 { |
1839 { |
1840 echo '<div class="error-box">' . $lang->get('acpbc_err_demo', array('ban_target' => htmlspecialchars($_POST['value']))) . '</div>'; |
1840 echo '<div class="error-box">' . $lang->get('acpbc_err_demo', array('ban_target' => htmlspecialchars($_POST['value']))) . '</div>'; |
1841 } |
1841 } |
1842 $q = $db->sql_query('SELECT ban_id,ban_type,ban_value,is_regex FROM '.table_prefix.'banlist ORDER BY ban_type;'); |
1842 $q = $db->sql_query('SELECT ban_id,ban_type,ban_value,is_regex FROM '.table_prefix.'banlist ORDER BY ban_type;'); |
1843 if ( !$q ) |
1843 if ( !$q ) |
1844 $db->_die('The banlist data could not be selected.'); |
1844 $db->_die('The banlist data could not be selected.'); |
1845 echo '<div class="tblholder" style="max-height: 800px; clip: rect(0px,auto,auto,0px); overflow: auto;"> |
1845 echo '<div class="tblholder" style="max-height: 800px; clip: rect(0px,auto,auto,0px); overflow: auto;"> |
1846 <table border="0" cellspacing="1" cellpadding="4">'; |
1846 <table border="0" cellspacing="1" cellpadding="4">'; |
1847 echo '<tr> |
1847 echo '<tr> |
1848 <th>' . $lang->get('acpbc_col_type') . '</th> |
1848 <th>' . $lang->get('acpbc_col_type') . '</th> |
1849 <th>' . $lang->get('acpbc_col_value') . '</th> |
1849 <th>' . $lang->get('acpbc_col_value') . '</th> |
1850 <th>' . $lang->get('acpbc_col_regex') . '</th> |
1850 <th>' . $lang->get('acpbc_col_regex') . '</th> |
1851 <th></th> |
1851 <th></th> |
1852 </tr>'; |
1852 </tr>'; |
1853 if ( $db->numrows() < 1 ) |
1853 if ( $db->numrows() < 1 ) |
1854 { |
1854 { |
1855 echo '<td class="row1" colspan="4">' . $lang->get('acpbc_msg_no_rules') . '</td>'; |
1855 echo '<td class="row1" colspan="4">' . $lang->get('acpbc_msg_no_rules') . '</td>'; |
1856 } |
1856 } |
1857 $cls = 'row2'; |
1857 $cls = 'row2'; |
1858 while ( $r = $db->fetchrow() ) |
1858 while ( $r = $db->fetchrow() ) |
1859 { |
1859 { |
1860 $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
1860 $cls = ( $cls == 'row1' ) ? 'row2' : 'row1'; |
1861 if ( $r['ban_type'] == BAN_IP ) |
1861 if ( $r['ban_type'] == BAN_IP ) |
1862 $t = $lang->get('acpbc_ban_type_ip'); |
1862 $t = $lang->get('acpbc_ban_type_ip'); |
1863 else if ( $r['ban_type'] == BAN_USER ) |
1863 else if ( $r['ban_type'] == BAN_USER ) |
1864 $t = $lang->get('acpbc_ban_type_username'); |
1864 $t = $lang->get('acpbc_ban_type_username'); |
1865 else if ( $r['ban_type'] == BAN_EMAIL ) |
1865 else if ( $r['ban_type'] == BAN_EMAIL ) |
1866 $t = $lang->get('acpbc_ban_type_email'); |
1866 $t = $lang->get('acpbc_ban_type_email'); |
1867 $g = ( $r['is_regex'] ) ? '<b>' . $lang->get('acpbc_ban_regex_yes') . '</b>' : $lang->get('acpbc_ban_regex_no'); |
1867 $g = ( $r['is_regex'] ) ? '<b>' . $lang->get('acpbc_ban_regex_yes') . '</b>' : $lang->get('acpbc_ban_regex_no'); |
1868 echo '<tr> |
1868 echo '<tr> |
1869 <td class="'.$cls.'">'.$t.'</td> |
1869 <td class="'.$cls.'">'.$t.'</td> |
1870 <td class="'.$cls.'">'.htmlspecialchars($r['ban_value']).'</td> |
1870 <td class="'.$cls.'">'.htmlspecialchars($r['ban_value']).'</td> |
1871 <td class="'.$cls.'">'.$g.'</td> |
1871 <td class="'.$cls.'">'.$g.'</td> |
1872 <td class="'.$cls.'"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'BanControl&action=delete&id='.$r['ban_id']).'">' . $lang->get('acpbc_btn_delete') . '</a></td> |
1872 <td class="'.$cls.'"><a href="'.makeUrlNS('Special', 'Administration', 'module='.$paths->nslist['Admin'].'BanControl&action=delete&id='.$r['ban_id']).'">' . $lang->get('acpbc_btn_delete') . '</a></td> |
1873 </tr>'; |
1873 </tr>'; |
1874 } |
1874 } |
1875 $db->free_result(); |
1875 $db->free_result(); |
1876 echo '</table></div>'; |
1876 echo '</table></div>'; |
1877 echo '<h3>' . $lang->get('acpbc_heading_create_new') . '</h3>'; |
1877 echo '<h3>' . $lang->get('acpbc_heading_create_new') . '</h3>'; |
1878 acp_start_form(); |
1878 acp_start_form(); |
1879 ?> |
1879 ?> |
1880 |
1880 |
1881 <?php echo $lang->get('acpbc_field_type'); ?> |
1881 <?php echo $lang->get('acpbc_field_type'); ?> |
1882 <select name="type"> |
1882 <select name="type"> |
1883 <option value="<?php echo BAN_IP; ?>"><?php echo $lang->get('acpbc_ban_type_ip'); ?></option> |
1883 <option value="<?php echo BAN_IP; ?>"><?php echo $lang->get('acpbc_ban_type_ip'); ?></option> |
1884 <option value="<?php echo BAN_USER; ?>"><?php echo $lang->get('acpbc_ban_type_username'); ?></option> |
1884 <option value="<?php echo BAN_USER; ?>"><?php echo $lang->get('acpbc_ban_type_username'); ?></option> |
1885 <option value="<?php echo BAN_EMAIL; ?>"><?php echo $lang->get('acpbc_ban_type_email'); ?></option> |
1885 <option value="<?php echo BAN_EMAIL; ?>"><?php echo $lang->get('acpbc_ban_type_email'); ?></option> |
1886 </select> |
1886 </select> |
1887 <br /> |
1887 <br /> |
1888 |
1888 |
1889 <?php echo $lang->get('acpbc_field_rule'); ?> |
1889 <?php echo $lang->get('acpbc_field_rule'); ?> |
1890 <input type="text" name="value" size="30" /><br /> |
1890 <input type="text" name="value" size="30" /><br /> |
1891 <small><?php echo $lang->get('acpbc_field_rule_hint'); ?></small><br /> |
1891 <small><?php echo $lang->get('acpbc_field_rule_hint'); ?></small><br /> |
1892 |
1892 |
1893 <?php echo $lang->get('acpbc_field_reason'); ?> |
1893 <?php echo $lang->get('acpbc_field_reason'); ?> |
1894 <textarea name="reason" rows="7" cols="40"></textarea><br /> |
1894 <textarea name="reason" rows="7" cols="40"></textarea><br /> |
1895 |
1895 |
1896 <label><input type="checkbox" name="regex" id="regex" /> <?php echo $lang->get('acpbc_field_regex'); ?></label> |
1896 <label><input type="checkbox" name="regex" id="regex" /> <?php echo $lang->get('acpbc_field_regex'); ?></label> |
1897 <?php echo $lang->get('acpbc_field_regex_hint'); ?><br /> |
1897 <?php echo $lang->get('acpbc_field_regex_hint'); ?><br /> |
1898 |
1898 |
1899 <input type="submit" style="font-weight: bold;" name="create" value="<?php echo $lang->get('acpbc_btn_create'); ?>" /> |
1899 <input type="submit" style="font-weight: bold;" name="create" value="<?php echo $lang->get('acpbc_btn_create'); ?>" /> |
1900 <?php |
1900 <?php |
1901 echo '</form>'; |
1901 echo '</form>'; |
1902 } |
1902 } |
1903 |
1903 |
1904 function page_Admin_AdminLogout() |
1904 function page_Admin_AdminLogout() |
1905 { |
1905 { |
1906 global $db, $session, $paths, $template, $plugins; // Common objects |
1906 global $db, $session, $paths, $template, $plugins; // Common objects |
1907 global $lang; |
1907 global $lang; |
1908 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1908 if ( $session->auth_level < USER_LEVEL_ADMIN || $session->user_level < USER_LEVEL_ADMIN ) |
1909 { |
1909 { |
1910 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1910 $login_link = makeUrlNS('Special', 'Login/' . $paths->nslist['Special'] . 'Administration', 'level=' . USER_LEVEL_ADMIN, true); |
1911 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1911 echo '<h3>' . $lang->get('adm_err_not_auth_title') . '</h3>'; |
1912 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1912 echo '<p>' . $lang->get('adm_err_not_auth_body', array( 'login_link' => $login_link )) . '</p>'; |
1913 return; |
1913 return; |
1914 } |
1914 } |
1915 |
1915 |
1916 $session->logout(USER_LEVEL_ADMIN); |
1916 $session->logout(USER_LEVEL_ADMIN); |
1917 echo '<h3>' . $lang->get('acplo_heading_main') . '</h3> |
1917 echo '<h3>' . $lang->get('acplo_heading_main') . '</h3> |
1918 <p>' . $lang->get('acplo_msg_logout_complete', array('mainpage_link' => makeUrl(get_main_page()))) . '</p>'; |
1918 <p>' . $lang->get('acplo_msg_logout_complete', array('mainpage_link' => makeUrl(get_main_page()))) . '</p>'; |
1919 } |
1919 } |
1920 |
1920 |
1921 function page_Special_Administration() |
1921 function page_Special_Administration() |
1922 { |
1922 { |
1923 global $db, $session, $paths, $template, $plugins; // Common objects |
1923 global $db, $session, $paths, $template, $plugins; // Common objects |
1924 global $lang; |
1924 global $lang; |
1925 global $output; |
1925 global $output; |
1926 |
1926 |
1927 if ( $session->auth_level < USER_LEVEL_ADMIN ) |
1927 if ( $session->auth_level < USER_LEVEL_ADMIN ) |
1928 { |
1928 { |
1929 $query_string = 'level=' . USER_LEVEL_ADMIN; |
1929 $query_string = 'level=' . USER_LEVEL_ADMIN; |
1930 if ( !empty($_SERVER['QUERY_STRING']) ) |
1930 if ( !empty($_SERVER['QUERY_STRING']) ) |
1931 { |
1931 { |
1932 $query_string .= '&' . trim(preg_replace('/(?:&|^)title=.+?(?:&|$)/', '&', $_SERVER['QUERY_STRING']), '&'); |
1932 $query_string .= '&' . trim(preg_replace('/(?:&|^)title=.+?(?:&|$)/', '&', $_SERVER['QUERY_STRING']), '&'); |
1933 } |
1933 } |
1934 redirect(makeUrlNS('Special', 'Login/'.$paths->page, $query_string), 'Not authorized', 'You need an authorization level of '.USER_LEVEL_ADMIN.' to use this page, your auth level is: ' . $session->auth_level, 0); |
1934 redirect(makeUrlNS('Special', 'Login/'.$paths->page, $query_string), 'Not authorized', 'You need an authorization level of '.USER_LEVEL_ADMIN.' to use this page, your auth level is: ' . $session->auth_level, 0); |
1935 exit; |
1935 exit; |
1936 } |
1936 } |
1937 else |
1937 else |
1938 { |
1938 { |
1939 $template->set_theme('admin', 'default'); |
1939 $template->set_theme('admin', 'default'); |
1940 $template->preload_js('fat'); |
1940 $template->preload_js('fat'); |
1941 $template->preload_js('ajax'); |
1941 $template->preload_js('ajax'); |
1942 $template->preload_js('l10n'); |
1942 $template->preload_js('l10n'); |
1943 $template->preload_js('jquery'); |
1943 $template->preload_js('jquery'); |
1944 $template->preload_js('jquery-ui'); |
1944 $template->preload_js('jquery-ui'); |
1945 $template->preload_js('autofill'); |
1945 $template->preload_js('autofill'); |
1946 $template->preload_js('admin-menu'); |
1946 $template->preload_js('admin-menu'); |
1947 |
1947 |
1948 $output->header(); |
1948 $output->header(); |
1949 |
1949 |
1950 echo $lang->get('adm_page_tagline'); |
1950 echo $lang->get('adm_page_tagline'); |
1951 ?> |
1951 ?> |
1952 <script type="text/javascript"> |
1952 <script type="text/javascript"> |
1953 function ajaxPage(t, qs) |
1953 function ajaxPage(t, qs) |
1954 { |
1954 { |
1955 if ( KILL_SWITCH ) |
1955 if ( KILL_SWITCH ) |
1956 { |
1956 { |
1957 document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
1957 document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
1958 return false; |
1958 return false; |
1959 } |
1959 } |
1960 if ( t == namespace_list.Admin + 'AdminLogout' ) |
1960 if ( t == namespace_list.Admin + 'AdminLogout' ) |
1961 { |
1961 { |
1962 load_component('messagebox'); |
1962 load_component('messagebox'); |
1963 miniPromptMessage({ |
1963 miniPromptMessage({ |
1964 title: $lang.get('user_logout_confirm_title_elev'), |
1964 title: $lang.get('user_logout_confirm_title_elev'), |
1965 message: $lang.get('user_logout_confirm_body_elev'), |
1965 message: $lang.get('user_logout_confirm_body_elev'), |
1966 buttons: [ |
1966 buttons: [ |
1967 { |
1967 { |
1968 text: $lang.get('user_logout_confirm_btn_logout'), |
1968 text: $lang.get('user_logout_confirm_btn_logout'), |
1969 color: 'red', |
1969 color: 'red', |
1970 style: { |
1970 style: { |
1971 fontWeight: 'bold' |
1971 fontWeight: 'bold' |
1972 }, |
1972 }, |
1973 onclick: function() |
1973 onclick: function() |
1974 { |
1974 { |
1975 var tigraentry = document.getElementById('i_div0_0').parentNode; |
1975 var tigraentry = document.getElementById('i_div0_0').parentNode; |
1976 var tigraobj = $dynano(tigraentry); |
1976 var tigraobj = $dynano(tigraentry); |
1977 var div = document.createElement('div'); |
1977 var div = document.createElement('div'); |
1978 div.style.backgroundColor = '#FFFFFF'; |
1978 div.style.backgroundColor = '#FFFFFF'; |
1979 domObjChangeOpac(70, div); |
1979 domObjChangeOpac(70, div); |
1980 div.style.position = 'absolute'; |
1980 div.style.position = 'absolute'; |
1981 var top = tigraobj.Top(); |
1981 var top = tigraobj.Top(); |
1982 var left = tigraobj.Left(); |
1982 var left = tigraobj.Left(); |
1983 var width = tigraobj.Width(); |
1983 var width = tigraobj.Width(); |
1984 var height = tigraobj.Height(); |
1984 var height = tigraobj.Height(); |
1985 div.style.top = top + 'px'; |
1985 div.style.top = top + 'px'; |
1986 div.style.left = left + 'px'; |
1986 div.style.left = left + 'px'; |
1987 div.style.width = width + 'px'; |
1987 div.style.width = width + 'px'; |
1988 div.style.height = height + 'px'; |
1988 div.style.height = height + 'px'; |
1989 var body = document.getElementsByTagName('body')[0]; |
1989 var body = document.getElementsByTagName('body')[0]; |
1990 miniPromptDestroy(this); |
1990 miniPromptDestroy(this); |
1991 body.appendChild(div); |
1991 body.appendChild(div); |
1992 ajaxPageBin(namespace_list.Admin + 'AdminLogout'); |
1992 ajaxPageBin(namespace_list.Admin + 'AdminLogout'); |
1993 } |
1993 } |
1994 }, |
1994 }, |
1995 { |
1995 { |
1996 text: $lang.get('etc_cancel'), |
1996 text: $lang.get('etc_cancel'), |
1997 onclick: function() |
1997 onclick: function() |
1998 { |
1998 { |
1999 miniPromptDestroy(this); |
1999 miniPromptDestroy(this); |
2000 } |
2000 } |
2001 } |
2001 } |
2002 ] |
2002 ] |
2003 }); |
2003 }); |
2004 return; |
2004 return; |
2005 } |
2005 } |
2006 ajaxPageBin(t, qs); |
2006 ajaxPageBin(t, qs); |
2007 } |
2007 } |
2008 function ajaxPageBin(t, qs) |
2008 function ajaxPageBin(t, qs) |
2009 { |
2009 { |
2010 if ( KILL_SWITCH ) |
2010 if ( KILL_SWITCH ) |
2011 { |
2011 { |
2012 document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
2012 document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
2013 return false; |
2013 return false; |
2014 } |
2014 } |
2015 document.getElementById('ajaxPageContainer').innerHTML = '<div class="wait-box">Loading page...</div>'; |
2015 document.getElementById('ajaxPageContainer').innerHTML = '<div class="wait-box">Loading page...</div>'; |
2016 qs = qs ? '&' + qs : ''; |
2016 qs = qs ? '&' + qs : ''; |
2017 ajaxGet(makeUrl(t, 'noheaders' + qs), function(ajax) |
2017 ajaxGet(makeUrl(t, 'noheaders' + qs), function(ajax) |
2018 { |
2018 { |
2019 if ( ajax.readyState == 4 && ajax.status == 200 ) |
2019 if ( ajax.readyState == 4 && ajax.status == 200 ) |
2020 { |
2020 { |
2021 var response = String(ajax.responseText + ''); |
2021 var response = String(ajax.responseText + ''); |
2022 if ( check_json_response(response) ) |
2022 if ( check_json_response(response) ) |
2023 { |
2023 { |
2024 response = parseJSON(response); |
2024 response = parseJSON(response); |
2025 if ( response.mode == 'error' ) |
2025 if ( response.mode == 'error' ) |
2026 { |
2026 { |
2027 if ( response.error == 'need_auth_to_admin' ) |
2027 if ( response.error == 'need_auth_to_admin' ) |
2028 { |
2028 { |
2029 load_component('login'); |
2029 load_component('login'); |
2030 ajaxDynamicReauth(t); |
2030 ajaxDynamicReauth(t); |
2031 } |
2031 } |
2032 else |
2032 else |
2033 { |
2033 { |
2034 alert(response.error); |
2034 alert(response.error); |
2035 } |
2035 } |
2036 } |
2036 } |
2037 } |
2037 } |
2038 else |
2038 else |
2039 { |
2039 { |
2040 document.getElementById('ajaxPageContainer').innerHTML = ajax.responseText; |
2040 document.getElementById('ajaxPageContainer').innerHTML = ajax.responseText; |
2041 fadeInfoBoxes(); |
2041 fadeInfoBoxes(); |
2042 autofill_onload(); |
2042 autofill_onload(); |
2043 admin_table_onload(t); |
2043 admin_table_onload(t); |
2044 // allow JS hooks |
2044 // allow JS hooks |
2045 eval(setHook('admin_page_onload')); |
2045 eval(setHook('admin_page_onload')); |
2046 } |
2046 } |
2047 } |
2047 } |
2048 }); |
2048 }); |
2049 } |
2049 } |
2050 <?php |
2050 <?php |
2051 if ( !isset($_GET['module']) ) |
2051 if ( !isset($_GET['module']) ) |
2052 { |
2052 { |
2053 echo <<<EOF |
2053 echo <<<EOF |
2054 var _enanoAdminOnload = function() { ajaxPage('{$paths->nslist['Admin']}Home'); }; |
2054 var _enanoAdminOnload = function() { ajaxPage('{$paths->nslist['Admin']}Home'); }; |
2055 addOnloadHook(_enanoAdminOnload); |
2055 addOnloadHook(_enanoAdminOnload); |
2056 |
2056 |
2057 EOF; |
2057 EOF; |
2058 } |
2058 } |
2059 ?> |
2059 ?> |
2060 var TREE_TPL = { |
2060 var TREE_TPL = { |
2061 'target' : '_self', // name of the frame links will be opened in |
2061 'target' : '_self', // name of the frame links will be opened in |
2062 // other possible values are: _blank, _parent, _search, _self and _top |
2062 // other possible values are: _blank, _parent, _search, _self and _top |
2063 |
2063 |
2064 'icon_e' : '<?php echo cdnPath; ?>/images/icons/empty.gif', // empty image |
2064 'icon_e' : '<?php echo cdnPath; ?>/images/icons/empty.gif', // empty image |
2065 'icon_l' : '<?php echo cdnPath; ?>/images/icons/line.gif', // vertical line |
2065 'icon_l' : '<?php echo cdnPath; ?>/images/icons/line.gif', // vertical line |
2066 'icon_32' : '<?php echo cdnPath; ?>/images/spacer.gif', // root leaf icon normal |
2066 'icon_32' : '<?php echo cdnPath; ?>/images/spacer.gif', // root leaf icon normal |
2067 'icon_36' : '<?php echo cdnPath; ?>/images/spacer.gif', // root leaf icon selected |
2067 'icon_36' : '<?php echo cdnPath; ?>/images/spacer.gif', // root leaf icon selected |
2068 'icon_48' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon normal |
2068 'icon_48' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon normal |
2069 'icon_52' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon selected |
2069 'icon_52' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon selected |
2070 'icon_56' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon opened |
2070 'icon_56' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon opened |
2071 'icon_60' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon selected |
2071 'icon_60' : '<?php echo cdnPath; ?>/images/spacer.gif', // root icon selected |
2072 'icon_16' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon normal |
2072 'icon_16' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon normal |
2073 'icon_20' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon selected |
2073 'icon_20' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon selected |
2074 'icon_24' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon opened |
2074 'icon_24' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon opened |
2075 'icon_28' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon selected opened |
2075 'icon_28' : '<?php echo cdnPath; ?>/images/spacer.gif', // node icon selected opened |
2076 'icon_0' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon normal |
2076 'icon_0' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon normal |
2077 'icon_4' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon selected |
2077 'icon_4' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon selected |
2078 'icon_8' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon opened |
2078 'icon_8' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon opened |
2079 'icon_12' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon selected |
2079 'icon_12' : '<?php echo cdnPath; ?>/images/icons/page.gif', // leaf icon selected |
2080 'icon_2' : '<?php echo cdnPath; ?>/images/icons/joinbottom.gif', // junction for leaf |
2080 'icon_2' : '<?php echo cdnPath; ?>/images/icons/joinbottom.gif', // junction for leaf |
2081 'icon_3' : '<?php echo cdnPath; ?>/images/icons/join.gif', // junction for last leaf |
2081 'icon_3' : '<?php echo cdnPath; ?>/images/icons/join.gif', // junction for last leaf |
2082 'icon_18' : '<?php echo cdnPath; ?>/images/icons/plusbottom.gif', // junction for closed node |
2082 'icon_18' : '<?php echo cdnPath; ?>/images/icons/plusbottom.gif', // junction for closed node |
2083 'icon_19' : '<?php echo cdnPath; ?>/images/icons/plus.gif', // junction for last closed node |
2083 'icon_19' : '<?php echo cdnPath; ?>/images/icons/plus.gif', // junction for last closed node |
2084 'icon_26' : '<?php echo cdnPath; ?>/images/icons/minusbottom.gif',// junction for opened node |
2084 'icon_26' : '<?php echo cdnPath; ?>/images/icons/minusbottom.gif',// junction for opened node |
2085 'icon_27' : '<?php echo cdnPath; ?>/images/icons/minus.gif' // junction for last opended node |
2085 'icon_27' : '<?php echo cdnPath; ?>/images/icons/minus.gif' // junction for last opended node |
2086 }; |
2086 }; |
2087 |
2087 |
2088 <?php |
2088 <?php |
2089 echo $paths->parseAdminTree(); // Make a Javascript array that defines the tree |
2089 echo $paths->parseAdminTree(); // Make a Javascript array that defines the tree |
2090 ?> |
2090 ?> |
2091 |
2091 |
2092 addOnloadHook(function() |
2092 addOnloadHook(function() |
2093 { |
2093 { |
2094 new tree(TREE_ITEMS, TREE_TPL, 'admin_tree'); |
2094 new tree(TREE_ITEMS, TREE_TPL, 'admin_tree'); |
2095 keepalive_onload(); |
2095 keepalive_onload(); |
2096 }); |
2096 }); |
2097 </script> |
2097 </script> |
2098 <table border="0" width="100%"> |
2098 <table border="0" width="100%"> |
2099 <tr> |
2099 <tr> |
2100 <td class="holder" valign="top"> |
2100 <td class="holder" valign="top"> |
2101 <div class="pad" style="padding-right: 20px;" id="admin_tree"> |
2101 <div class="pad" style="padding-right: 20px;" id="admin_tree"> |
2102 </div> |
2102 </div> |
2103 </td> |
2103 </td> |
2104 <td width="100%" valign="top"> |
2104 <td width="100%" valign="top"> |
2105 <div class="pad" id="ajaxPageContainer"> |
2105 <div class="pad" id="ajaxPageContainer"> |
2106 <?php |
2106 <?php |
2107 if ( isset($_GET['module']) ) |
2107 if ( isset($_GET['module']) ) |
2108 { |
2108 { |
2109 list($module) = explode('/', $_GET['module']); |
2109 list($module) = explode('/', $_GET['module']); |
2110 list($page_id, $namespace) = RenderMan::strToPageID($module); |
2110 list($page_id, $namespace) = RenderMan::strToPageID($module); |
2111 if ( $namespace != 'Admin' ) |
2111 if ( $namespace != 'Admin' ) |
2112 { |
2112 { |
2113 echo '<div class="error-box">Module must be in the Admin namespace</div>'; |
2113 echo '<div class="error-box">Module must be in the Admin namespace</div>'; |
2114 } |
2114 } |
2115 else |
2115 else |
2116 { |
2116 { |
2117 $paths->fullpage = $_GET['module']; |
2117 $paths->fullpage = $_GET['module']; |
2118 $paths->cpage['module'] = $_GET['module']; |
2118 $paths->cpage['module'] = $_GET['module']; |
2119 $page = new PageProcessor($page_id, $namespace); |
2119 $page = new PageProcessor($page_id, $namespace); |
2120 $page->send_headers = false; |
2120 $page->send_headers = false; |
2121 $page->send(); |
2121 $page->send(); |
2122 $paths->fullpage = $paths->page; |
2122 $paths->fullpage = $paths->page; |
2123 } |
2123 } |
2124 } |
2124 } |
2125 else |
2125 else |
2126 { |
2126 { |
2127 echo '<script type="text/javascript">document.write(\'<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>\');</script><noscript><div class="error-box">It looks like Javascript isn\'t enabled in your browser. Please enable Javascript or use a different browser to continue.</div></noscript>'; |
2127 echo '<script type="text/javascript">document.write(\'<div class="wait-box">Please wait while the administration panel loads. You need to be using a recent browser with AJAX support in order to use Runt.</div>\');</script><noscript><div class="error-box">It looks like Javascript isn\'t enabled in your browser. Please enable Javascript or use a different browser to continue.</div></noscript>'; |
2128 } |
2128 } |
2129 ?> |
2129 ?> |
2130 </div> |
2130 </div> |
2131 <script type="text/javascript"> |
2131 <script type="text/javascript"> |
2132 addOnloadHook(function() |
2132 addOnloadHook(function() |
2133 { |
2133 { |
2134 if ( KILL_SWITCH ) |
2134 if ( KILL_SWITCH ) |
2135 { |
2135 { |
2136 document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
2136 document.getElementById('ajaxPageContainer').innerHTML = '<div class="error-box">Because of the lack of AJAX support, support for Internet Explorer versions less than 6.0 has been disabled in Runt. You can download and use Mozilla Firefox (or Seamonkey under Windows 95); both have an up-to-date standards-compliant rendering engine that has been tested thoroughly with Enano.</div>'; |
2137 } |
2137 } |
2138 } |
2138 } |
2139 ); |
2139 ); |
2140 </script> |
2140 </script> |
2141 </td> |
2141 </td> |
2142 </tr> |
2142 </tr> |
2143 </table> |
2143 </table> |
2144 |
2144 |
2145 <?php |
2145 <?php |
2146 $output->footer(); |
2146 $output->footer(); |
2147 } |
2147 } |
2148 } |
2148 } |
2149 |
2149 |
2150 function page_Special_EditSidebar() |
2150 function page_Special_EditSidebar() |
2151 { |
2151 { |
2152 global $db, $session, $paths, $template, $plugins; // Common objects |
2152 global $db, $session, $paths, $template, $plugins; // Common objects |
2153 global $lang; |
2153 global $lang; |
2154 global $cache; |
2154 global $cache; |
2155 |
2155 |
2156 if($session->auth_level < USER_LEVEL_ADMIN) |
2156 if($session->auth_level < USER_LEVEL_ADMIN) |
2157 { |
2157 { |
2158 redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), '', '', false); |
2158 redirect(makeUrlNS('Special', 'Login/'.$paths->page, 'level='.USER_LEVEL_ADMIN), '', '', false); |
2159 exit; |
2159 exit; |
2160 } |
2160 } |
2161 else |
2161 else |
2162 { |
2162 { |
2163 if ( isset($_GET['update_order']) ) |
2163 if ( isset($_GET['update_order']) ) |
2164 { |
2164 { |
2165 header('Content-type: text/javascript'); |
2165 header('Content-type: text/javascript'); |
2166 $order = @$_POST['order']; |
2166 $order = @$_POST['order']; |
2167 try |
2167 try |
2168 { |
2168 { |
2169 $order = enano_json_decode($order); |
2169 $order = enano_json_decode($order); |
2170 } |
2170 } |
2171 catch ( Zend_Json_Exception $e ) |
2171 catch ( Zend_Json_Exception $e ) |
2172 { |
2172 { |
2173 return print enano_json_encode(array( |
2173 return print enano_json_encode(array( |
2174 'mode' => 'error', |
2174 'mode' => 'error', |
2175 'error' => 'bad order' |
2175 'error' => 'bad order' |
2176 )); |
2176 )); |
2177 } |
2177 } |
2178 |
2178 |
2179 foreach ( $order as $sidebar_id => $blocks ) |
2179 foreach ( $order as $sidebar_id => $blocks ) |
2180 { |
2180 { |
2181 foreach ( $blocks as $order => $block_id ) |
2181 foreach ( $blocks as $order => $block_id ) |
2182 { |
2182 { |
2183 $sbid = intval($sidebar_id); |
2183 $sbid = intval($sidebar_id); |
2184 $order = intval($order); |
2184 $order = intval($order); |
2185 $block_id = intval($block_id); |
2185 $block_id = intval($block_id); |
2186 $q = $db->sql_query('UPDATE ' . table_prefix . "sidebar SET sidebar_id = $sbid, item_order = $order WHERE item_id = $block_id;"); |
2186 $q = $db->sql_query('UPDATE ' . table_prefix . "sidebar SET sidebar_id = $sbid, item_order = $order WHERE item_id = $block_id;"); |
2187 if ( !$q ) |
2187 if ( !$q ) |
2188 $db->die_json(); |
2188 $db->die_json(); |
2189 } |
2189 } |
2190 } |
2190 } |
2191 |
2191 |
2192 return print enano_json_encode(array( |
2192 return print enano_json_encode(array( |
2193 'mode' => 'success' |
2193 'mode' => 'success' |
2194 )); |
2194 )); |
2195 } |
2195 } |
2196 |
2196 |
2197 $template->preload_js(array('l10n', 'jquery', 'jquery-ui')); |
2197 $template->preload_js(array('l10n', 'jquery', 'jquery-ui')); |
2198 $template->add_header('<script type="text/javascript" src="'.cdnPath.'/includes/clientside/sbedit.js"></script>'); |
2198 $template->add_header('<script type="text/javascript" src="'.cdnPath.'/includes/clientside/sbedit.js"></script>'); |
2199 |
2199 |
2200 $template->header(); |
2200 $template->header(); |
2201 |
2201 |
2202 if(isset($_POST['save'])) |
2202 if(isset($_POST['save'])) |
2203 { |
2203 { |
2204 // Write the new block order to the database |
2204 // Write the new block order to the database |
2205 // The only way to do this is with tons of queries (one per block + one select query at the start to count everything) but afaik its safe... |
2205 // The only way to do this is with tons of queries (one per block + one select query at the start to count everything) but afaik its safe... |
2206 // Anyone know a better way to do this? |
2206 // Anyone know a better way to do this? |
2207 $q = $db->sql_query('SELECT item_order,item_id,sidebar_id FROM '.table_prefix.'sidebar ORDER BY sidebar_id ASC, item_order ASC;'); |
2207 $q = $db->sql_query('SELECT item_order,item_id,sidebar_id FROM '.table_prefix.'sidebar ORDER BY sidebar_id ASC, item_order ASC;'); |
2208 if ( !$q ) |
2208 if ( !$q ) |
2209 { |
2209 { |
2210 $db->_die('The sidebar order data could not be selected.'); |
2210 $db->_die('The sidebar order data could not be selected.'); |
2211 } |
2211 } |
2212 $orders = Array(); |
2212 $orders = Array(); |
2213 while($row = $db->fetchrow()) |
2213 while($row = $db->fetchrow()) |
2214 { |
2214 { |
2215 $orders[] = Array( |
2215 $orders[] = Array( |
2216 count($orders), |
2216 count($orders), |
2217 $row['item_id'], |
2217 $row['item_id'], |
2218 $row['sidebar_id'], |
2218 $row['sidebar_id'], |
2219 ); |
2219 ); |
2220 } |
2220 } |
2221 $db->free_result(); |
2221 $db->free_result(); |
2222 |
2222 |
2223 // We now have an array with each sidebar ID in its respective order. Explode the order string in $_POST['order_(left|right)'] and use it to build a set of queries. |
2223 // We now have an array with each sidebar ID in its respective order. Explode the order string in $_POST['order_(left|right)'] and use it to build a set of queries. |
2224 $ol = explode(',', $_POST['order_left']); |
2224 $ol = explode(',', $_POST['order_left']); |
2225 $odr = explode(',', $_POST['order_right']); |
2225 $odr = explode(',', $_POST['order_right']); |
2226 $om = array_merge($ol, $odr); |
2226 $om = array_merge($ol, $odr); |
2227 unset($ol, $odr); |
2227 unset($ol, $odr); |
2228 $queries = Array(); |
2228 $queries = Array(); |
2229 foreach($orders as $k => $v) |
2229 foreach($orders as $k => $v) |
2230 { |
2230 { |
2231 $queries[] = 'UPDATE '.table_prefix.'sidebar SET item_order='.intval($om[$k]).' WHERE item_id='.intval($v[1]).';'; |
2231 $queries[] = 'UPDATE '.table_prefix.'sidebar SET item_order='.intval($om[$k]).' WHERE item_id='.intval($v[1]).';'; |
2232 } |
2232 } |
2233 foreach($queries as $sql) |
2233 foreach($queries as $sql) |
2234 { |
2234 { |
2235 $q = $db->sql_query($sql); |
2235 $q = $db->sql_query($sql); |
2236 if(!$q) |
2236 if(!$q) |
2237 { |
2237 { |
2238 $t = $db->get_error(); |
2238 $t = $db->get_error(); |
2239 echo $t; |
2239 echo $t; |
2240 $template->footer(); |
2240 $template->footer(); |
2241 exit; |
2241 exit; |
2242 } |
2242 } |
2243 } |
2243 } |
2244 $cache->purge('anon_sidebar'); |
2244 $cache->purge('anon_sidebar'); |
2245 echo '<div class="info-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_order_update_success') . '</div>'; |
2245 echo '<div class="info-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_order_update_success') . '</div>'; |
2246 } |
2246 } |
2247 elseif(isset($_POST['create'])) |
2247 elseif(isset($_POST['create'])) |
2248 { |
2248 { |
2249 switch((int)$_POST['type']) |
2249 switch((int)$_POST['type']) |
2250 { |
2250 { |
2251 case BLOCK_WIKIFORMAT: |
2251 case BLOCK_WIKIFORMAT: |
2252 $content = $_POST['wikiformat_content']; |
2252 $content = $_POST['wikiformat_content']; |
2253 break; |
2253 break; |
2254 case BLOCK_TEMPLATEFORMAT: |
2254 case BLOCK_TEMPLATEFORMAT: |
2255 $content = $_POST['templateformat_content']; |
2255 $content = $_POST['templateformat_content']; |
2256 break; |
2256 break; |
2257 case BLOCK_HTML: |
2257 case BLOCK_HTML: |
2258 $content = $_POST['html_content']; |
2258 $content = $_POST['html_content']; |
2259 break; |
2259 break; |
2260 case BLOCK_PHP: |
2260 case BLOCK_PHP: |
2261 $content = $_POST['php_content']; |
2261 $content = $_POST['php_content']; |
2262 break; |
2262 break; |
2263 case BLOCK_PLUGIN: |
2263 case BLOCK_PLUGIN: |
2264 $content = $_POST['plugin_id']; |
2264 $content = $_POST['plugin_id']; |
2265 break; |
2265 break; |
2266 } |
2266 } |
2267 |
2267 |
2268 if ( defined('ENANO_DEMO_MODE') ) |
2268 if ( defined('ENANO_DEMO_MODE') ) |
2269 { |
2269 { |
2270 // Sanitize the HTML |
2270 // Sanitize the HTML |
2271 $content = sanitize_html($content, true); |
2271 $content = sanitize_html($content, true); |
2272 } |
2272 } |
2273 |
2273 |
2274 if ( defined('ENANO_DEMO_MODE') && intval($_POST['type']) == BLOCK_PHP ) |
2274 if ( defined('ENANO_DEMO_MODE') && intval($_POST['type']) == BLOCK_PHP ) |
2275 { |
2275 { |
2276 echo '<div class="error-box" style="margin: 10px 0 10px 0;">' . $lang->get('sbedit_err_demo_php_disable') . '</div>'; |
2276 echo '<div class="error-box" style="margin: 10px 0 10px 0;">' . $lang->get('sbedit_err_demo_php_disable') . '</div>'; |
2277 $_POST['php_content'] = '?><Nulled>'; |
2277 $_POST['php_content'] = '?><Nulled>'; |
2278 $content = $_POST['php_content']; |
2278 $content = $_POST['php_content']; |
2279 } |
2279 } |
2280 |
2280 |
2281 // Get the value of item_order |
2281 // Get the value of item_order |
2282 |
2282 |
2283 $q = $db->sql_query('SELECT * FROM '.table_prefix.'sidebar WHERE sidebar_id='.intval($_POST['sidebar_id']).';'); |
2283 $q = $db->sql_query('SELECT * FROM '.table_prefix.'sidebar WHERE sidebar_id='.intval($_POST['sidebar_id']).';'); |
2284 if(!$q) $db->_die('The order number could not be selected'); |
2284 if(!$q) $db->_die('The order number could not be selected'); |
2285 $io = $db->numrows(); |
2285 $io = $db->numrows(); |
2286 |
2286 |
2287 $db->free_result(); |
2287 $db->free_result(); |
2288 |
2288 |
2289 $q = 'INSERT INTO '.table_prefix.'sidebar(block_name, block_type, sidebar_id, block_content, item_order) VALUES ( \''.$db->escape($_POST['title']).'\', \''.$db->escape($_POST['type']).'\', \''.$db->escape($_POST['sidebar_id']).'\', \''.$db->escape($content).'\', '.$io.' );'; |
2289 $q = 'INSERT INTO '.table_prefix.'sidebar(block_name, block_type, sidebar_id, block_content, item_order) VALUES ( \''.$db->escape($_POST['title']).'\', \''.$db->escape($_POST['type']).'\', \''.$db->escape($_POST['sidebar_id']).'\', \''.$db->escape($content).'\', '.$io.' );'; |
2290 $result = $db->sql_query($q); |
2290 $result = $db->sql_query($q); |
2291 if(!$result) |
2291 if(!$result) |
2292 { |
2292 { |
2293 echo $db->get_error(); |
2293 echo $db->get_error(); |
2294 $template->footer(); |
2294 $template->footer(); |
2295 exit; |
2295 exit; |
2296 } |
2296 } |
2297 |
2297 |
2298 $cache->purge('anon_sidebar'); |
2298 $cache->purge('anon_sidebar'); |
2299 echo '<div class="info-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_item_added') . '</div>'; |
2299 echo '<div class="info-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_item_added') . '</div>'; |
2300 |
2300 |
2301 } |
2301 } |
2302 |
2302 |
2303 if(isset($_GET['action']) && isset($_GET['id'])) |
2303 if(isset($_GET['action']) && isset($_GET['id'])) |
2304 { |
2304 { |
2305 if(!preg_match('#^([0-9]*)$#', $_GET['id'])) |
2305 if(!preg_match('#^([0-9]*)$#', $_GET['id'])) |
2306 { |
2306 { |
2307 echo '<div class="warning-box">Error with action: $_GET["id"] was not an integer, aborting to prevent SQL injection</div>'; |
2307 echo '<div class="warning-box">Error with action: $_GET["id"] was not an integer, aborting to prevent SQL injection</div>'; |
2308 } |
2308 } |
2309 switch($_GET['action']) |
2309 switch($_GET['action']) |
2310 { |
2310 { |
2311 case 'new': |
2311 case 'new': |
2312 ?> |
2312 ?> |
2313 <script type="text/javascript"> |
2313 <script type="text/javascript"> |
2314 function setType(input) |
2314 function setType(input) |
2315 { |
2315 { |
2316 val = input.value; |
2316 val = input.value; |
2317 if(!val) |
2317 if(!val) |
2318 { |
2318 { |
2319 return false; |
2319 return false; |
2320 } |
2320 } |
2321 var divs = getElementsByClassName(document, 'div', 'sbadd_block'); |
2321 var divs = getElementsByClassName(document, 'div', 'sbadd_block'); |
2322 for(var i in divs) |
2322 for(var i in divs) |
2323 { |
2323 { |
2324 if(divs[i].id == 'blocktype_'+val) divs[i].style.display = 'block'; |
2324 if(divs[i].id == 'blocktype_'+val) divs[i].style.display = 'block'; |
2325 else divs[i].style.display = 'none'; |
2325 else divs[i].style.display = 'none'; |
2326 } |
2326 } |
2327 } |
2327 } |
2328 </script> |
2328 </script> |
2329 |
2329 |
2330 <form action="<?php echo makeUrl($paths->page); ?>" method="post"> |
2330 <form action="<?php echo makeUrl($paths->page); ?>" method="post"> |
2331 |
2331 |
2332 <p> |
2332 <p> |
2333 <?php echo $lang->get('sbedit_create_intro'); ?> |
2333 <?php echo $lang->get('sbedit_create_intro'); ?> |
2334 </p> |
2334 </p> |
2335 <p> |
2335 <p> |
2336 <select name="type" onchange="setType(this)"> <?php /* (NOT WORKING, at least in firefox 2) onload="var thingy = this; setTimeout('setType(thingy)', 500);" */ ?> |
2336 <select name="type" onchange="setType(this)"> <?php /* (NOT WORKING, at least in firefox 2) onload="var thingy = this; setTimeout('setType(thingy)', 500);" */ ?> |
2337 <option value="<?php echo BLOCK_WIKIFORMAT; ?>"><?php echo $lang->get('sbedit_block_type_wiki'); ?></option> |
2337 <option value="<?php echo BLOCK_WIKIFORMAT; ?>"><?php echo $lang->get('sbedit_block_type_wiki'); ?></option> |
2338 <option value="<?php echo BLOCK_TEMPLATEFORMAT; ?>"><?php echo $lang->get('sbedit_block_type_tpl'); ?></option> |
2338 <option value="<?php echo BLOCK_TEMPLATEFORMAT; ?>"><?php echo $lang->get('sbedit_block_type_tpl'); ?></option> |
2339 <option value="<?php echo BLOCK_HTML; ?>"><?php echo $lang->get('sbedit_block_type_html'); ?></option> |
2339 <option value="<?php echo BLOCK_HTML; ?>"><?php echo $lang->get('sbedit_block_type_html'); ?></option> |
2340 <option value="<?php echo BLOCK_PHP; ?>"><?php echo $lang->get('sbedit_block_type_php'); ?></option> |
2340 <option value="<?php echo BLOCK_PHP; ?>"><?php echo $lang->get('sbedit_block_type_php'); ?></option> |
2341 <option value="<?php echo BLOCK_PLUGIN; ?>"><?php echo $lang->get('sbedit_block_type_plugin'); ?></option> |
2341 <option value="<?php echo BLOCK_PLUGIN; ?>"><?php echo $lang->get('sbedit_block_type_plugin'); ?></option> |
2342 </select> |
2342 </select> |
2343 </p> |
2343 </p> |
2344 |
2344 |
2345 <p> |
2345 <p> |
2346 |
2346 |
2347 <?php echo $lang->get('sbedit_field_block_title'); ?> <input name="title" type="text" size="40" /><br /> |
2347 <?php echo $lang->get('sbedit_field_block_title'); ?> <input name="title" type="text" size="40" /><br /> |
2348 <?php echo $lang->get('sbedit_field_block_sidebar'); ?> |
2348 <?php echo $lang->get('sbedit_field_block_sidebar'); ?> |
2349 <select name="sidebar_id"> |
2349 <select name="sidebar_id"> |
2350 <option value="<?php echo SIDEBAR_LEFT; ?>"><?php echo $lang->get('sbedit_field_block_sidebar_left'); ?></option> |
2350 <option value="<?php echo SIDEBAR_LEFT; ?>"><?php echo $lang->get('sbedit_field_block_sidebar_left'); ?></option> |
2351 <option value="<?php echo SIDEBAR_RIGHT; ?>"><?php echo $lang->get('sbedit_field_block_sidebar_right'); ?></option> |
2351 <option value="<?php echo SIDEBAR_RIGHT; ?>"><?php echo $lang->get('sbedit_field_block_sidebar_right'); ?></option> |
2352 </select> |
2352 </select> |
2353 |
2353 |
2354 </p> |
2354 </p> |
2355 |
2355 |
2356 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_WIKIFORMAT; ?>"> |
2356 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_WIKIFORMAT; ?>"> |
2357 <?php echo $lang->get('sbedit_field_wikitext'); ?> |
2357 <?php echo $lang->get('sbedit_field_wikitext'); ?> |
2358 <p> |
2358 <p> |
2359 <textarea style="width: 98%;" name="wikiformat_content" rows="15" cols="50"></textarea> |
2359 <textarea style="width: 98%;" name="wikiformat_content" rows="15" cols="50"></textarea> |
2360 </p> |
2360 </p> |
2361 </div> |
2361 </div> |
2362 |
2362 |
2363 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_TEMPLATEFORMAT; ?>"> |
2363 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_TEMPLATEFORMAT; ?>"> |
2364 <?php echo $lang->get('sbedit_field_tplcode'); ?> |
2364 <?php echo $lang->get('sbedit_field_tplcode'); ?> |
2365 <p> |
2365 <p> |
2366 <textarea style="width: 98%;" name="templateformat_content" rows="15" cols="50"></textarea> |
2366 <textarea style="width: 98%;" name="templateformat_content" rows="15" cols="50"></textarea> |
2367 </p> |
2367 </p> |
2368 </div> |
2368 </div> |
2369 |
2369 |
2370 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_HTML; ?>"> |
2370 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_HTML; ?>"> |
2371 <?php echo $lang->get('sbedit_field_html'); ?> |
2371 <?php echo $lang->get('sbedit_field_html'); ?> |
2372 <p> |
2372 <p> |
2373 <textarea style="width: 98%;" name="html_content" rows="15" cols="50"></textarea> |
2373 <textarea style="width: 98%;" name="html_content" rows="15" cols="50"></textarea> |
2374 </p> |
2374 </p> |
2375 </div> |
2375 </div> |
2376 |
2376 |
2377 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_PHP; ?>"> |
2377 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_PHP; ?>"> |
2378 <?php if ( defined('ENANO_DEMO_MODE') ) { ?> |
2378 <?php if ( defined('ENANO_DEMO_MODE') ) { ?> |
2379 <p><?php echo $lang->get('sbedit_field_php_disabled'); ?></p> |
2379 <p><?php echo $lang->get('sbedit_field_php_disabled'); ?></p> |
2380 <?php } else { ?> |
2380 <?php } else { ?> |
2381 <?php echo $lang->get('sbedit_field_php'); ?> |
2381 <?php echo $lang->get('sbedit_field_php'); ?> |
2382 |
2382 |
2383 <p> |
2383 <p> |
2384 <textarea style="width: 98%;" name="php_content" rows="15" cols="50"></textarea> |
2384 <textarea style="width: 98%;" name="php_content" rows="15" cols="50"></textarea> |
2385 </p> |
2385 </p> |
2386 <?php } ?> |
2386 <?php } ?> |
2387 </div> |
2387 </div> |
2388 |
2388 |
2389 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_PLUGIN; ?>"> |
2389 <div class="sbadd_block" id="blocktype_<?php echo BLOCK_PLUGIN; ?>"> |
2390 <?php echo $lang->get('sbedit_field_plugin'); ?> |
2390 <?php echo $lang->get('sbedit_field_plugin'); ?> |
2391 <p> |
2391 <p> |
2392 <select name="plugin_id"> |
2392 <select name="plugin_id"> |
2393 <?php |
2393 <?php |
2394 foreach($template->plugin_blocks as $k => $c) |
2394 foreach($template->plugin_blocks as $k => $c) |
2395 { |
2395 { |
2396 echo '<option value="'.$k.'">'.$lang->get($k).'</option>'; |
2396 echo '<option value="'.$k.'">'.$lang->get($k).'</option>'; |
2397 } |
2397 } |
2398 ?> |
2398 ?> |
2399 </select> |
2399 </select> |
2400 </p> |
2400 </p> |
2401 </div> |
2401 </div> |
2402 |
2402 |
2403 <p> |
2403 <p> |
2404 |
2404 |
2405 <input type="submit" name="create" value="<?php echo $lang->get('sbedit_btn_create_block'); ?>" style="font-weight: bold;" /> |
2405 <input type="submit" name="create" value="<?php echo $lang->get('sbedit_btn_create_block'); ?>" style="font-weight: bold;" /> |
2406 <input type="submit" name="cancel" value="<?php echo $lang->get('etc_cancel'); ?>" /> |
2406 <input type="submit" name="cancel" value="<?php echo $lang->get('etc_cancel'); ?>" /> |
2407 |
2407 |
2408 </p> |
2408 </p> |
2409 |
2409 |
2410 </form> |
2410 </form> |
2411 |
2411 |
2412 <script type="text/javascript"> |
2412 <script type="text/javascript"> |
2413 addOnloadHook(function() |
2413 addOnloadHook(function() |
2414 { |
2414 { |
2415 var divs = getElementsByClassName(document, 'div', 'sbadd_block'); |
2415 var divs = getElementsByClassName(document, 'div', 'sbadd_block'); |
2416 for(var i in divs) |
2416 for(var i in divs) |
2417 { |
2417 { |
2418 if(divs[i].id != 'blocktype_<?php echo BLOCK_WIKIFORMAT; ?>') setTimeout("document.getElementById('"+divs[i].id+"').style.display = 'none';", 500); |
2418 if(divs[i].id != 'blocktype_<?php echo BLOCK_WIKIFORMAT; ?>') setTimeout("document.getElementById('"+divs[i].id+"').style.display = 'none';", 500); |
2419 } |
2419 } |
2420 }); |
2420 }); |
2421 </script> |
2421 </script> |
2422 |
2422 |
2423 <?php |
2423 <?php |
2424 $template->footer(); |
2424 $template->footer(); |
2425 return; |
2425 return; |
2426 break; |
2426 break; |
2427 case 'move': |
2427 case 'move': |
2428 $cache->purge('anon_sidebar'); |
2428 $cache->purge('anon_sidebar'); |
2429 if( !isset($_GET['side']) || ( isset($_GET['side']) && !preg_match('#^([0-9]+)$#', $_GET['side']) ) ) |
2429 if( !isset($_GET['side']) || ( isset($_GET['side']) && !preg_match('#^([0-9]+)$#', $_GET['side']) ) ) |
2430 { |
2430 { |
2431 echo '<div class="warning-box" style="margin: 10px 0;">$_GET[\'side\'] contained an SQL injection attempt</div>'; |
2431 echo '<div class="warning-box" style="margin: 10px 0;">$_GET[\'side\'] contained an SQL injection attempt</div>'; |
2432 break; |
2432 break; |
2433 } |
2433 } |
2434 $query = $db->sql_query('UPDATE '.table_prefix.'sidebar SET sidebar_id=' . $db->escape($_GET['side']) . ' WHERE item_id=' . intval($_GET['id']) . ';'); |
2434 $query = $db->sql_query('UPDATE '.table_prefix.'sidebar SET sidebar_id=' . $db->escape($_GET['side']) . ' WHERE item_id=' . intval($_GET['id']) . ';'); |
2435 if(!$query) |
2435 if(!$query) |
2436 { |
2436 { |
2437 echo $db->get_error(); |
2437 echo $db->get_error(); |
2438 $template->footer(); |
2438 $template->footer(); |
2439 exit; |
2439 exit; |
2440 } |
2440 } |
2441 echo '<div class="info-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_block_moved') . '</div>'; |
2441 echo '<div class="info-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_block_moved') . '</div>'; |
2442 break; |
2442 break; |
2443 case 'delete': |
2443 case 'delete': |
2444 $query = $db->sql_query('DELETE FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); // Already checked for injection attempts ;-) |
2444 $query = $db->sql_query('DELETE FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); // Already checked for injection attempts ;-) |
2445 if(!$query) |
2445 if(!$query) |
2446 { |
2446 { |
2447 echo $db->get_error(); |
2447 echo $db->get_error(); |
2448 $template->footer(); |
2448 $template->footer(); |
2449 exit; |
2449 exit; |
2450 } |
2450 } |
2451 $cache->purge('anon_sidebar'); |
2451 $cache->purge('anon_sidebar'); |
2452 if(isset($_GET['ajax'])) |
2452 if(isset($_GET['ajax'])) |
2453 { |
2453 { |
2454 die('GOOD'); |
2454 die('GOOD'); |
2455 } |
2455 } |
2456 echo '<div class="error-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_block_deleted') . '</div>'; |
2456 echo '<div class="error-box" style="margin: 10px 0;">' . $lang->get('sbedit_msg_block_deleted') . '</div>'; |
2457 break; |
2457 break; |
2458 case 'disenable'; |
2458 case 'disenable'; |
2459 $q = $db->sql_query('SELECT item_enabled FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); |
2459 $q = $db->sql_query('SELECT item_enabled FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); |
2460 if(!$q) |
2460 if(!$q) |
2461 { |
2461 { |
2462 echo $db->get_error(); |
2462 echo $db->get_error(); |
2463 $template->footer(); |
2463 $template->footer(); |
2464 exit; |
2464 exit; |
2465 } |
2465 } |
2466 $r = $db->fetchrow(); |
2466 $r = $db->fetchrow(); |
2467 $db->free_result(); |
2467 $db->free_result(); |
2468 $e = ( $r['item_enabled'] == 1 ) ? '0' : '1'; |
2468 $e = ( $r['item_enabled'] == 1 ) ? '0' : '1'; |
2469 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET item_enabled='.$e.' WHERE item_id=' . intval($_GET['id']) . ';'); |
2469 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET item_enabled='.$e.' WHERE item_id=' . intval($_GET['id']) . ';'); |
2470 if(!$q) |
2470 if(!$q) |
2471 { |
2471 { |
2472 echo $db->get_error(); |
2472 echo $db->get_error(); |
2473 $template->footer(); |
2473 $template->footer(); |
2474 exit; |
2474 exit; |
2475 } |
2475 } |
2476 if(isset($_GET['ajax'])) |
2476 if(isset($_GET['ajax'])) |
2477 { |
2477 { |
2478 die('GOOD'); |
2478 die('GOOD'); |
2479 } |
2479 } |
2480 break; |
2480 break; |
2481 case 'rename'; |
2481 case 'rename'; |
2482 $newname = $db->escape($_POST['newname']); |
2482 $newname = $db->escape($_POST['newname']); |
2483 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_name=\''.$newname.'\' WHERE item_id=' . intval($_GET['id']) . ';'); |
2483 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_name=\''.$newname.'\' WHERE item_id=' . intval($_GET['id']) . ';'); |
2484 if(!$q) |
2484 if(!$q) |
2485 { |
2485 { |
2486 echo $db->get_error(); |
2486 echo $db->get_error(); |
2487 $template->footer(); |
2487 $template->footer(); |
2488 exit; |
2488 exit; |
2489 } |
2489 } |
2490 if(isset($_GET['ajax'])) |
2490 if(isset($_GET['ajax'])) |
2491 { |
2491 { |
2492 die('GOOD'); |
2492 die('GOOD'); |
2493 } |
2493 } |
2494 break; |
2494 break; |
2495 case 'getsource': |
2495 case 'getsource': |
2496 $q = $db->sql_query('SELECT block_content,block_type FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); |
2496 $q = $db->sql_query('SELECT block_content,block_type FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); |
2497 if(!$q) |
2497 if(!$q) |
2498 { |
2498 { |
2499 echo $db->get_error(); |
2499 echo $db->get_error(); |
2500 $template->footer(); |
2500 $template->footer(); |
2501 exit; |
2501 exit; |
2502 } |
2502 } |
2503 $r = $db->fetchrow(); |
2503 $r = $db->fetchrow(); |
2504 $db->free_result(); |
2504 $db->free_result(); |
2505 $cache->purge('anon_sidebar'); |
2505 $cache->purge('anon_sidebar'); |
2506 |
2506 |
2507 if($r['block_type'] == BLOCK_PLUGIN) die('HOUSTON_WE_HAVE_A_PLUGIN'); |
2507 if($r['block_type'] == BLOCK_PLUGIN) die('HOUSTON_WE_HAVE_A_PLUGIN'); |
2508 die($r['block_content']); |
2508 die($r['block_content']); |
2509 break; |
2509 break; |
2510 case 'save': |
2510 case 'save': |
2511 if ( defined('ENANO_DEMO_MODE') ) |
2511 if ( defined('ENANO_DEMO_MODE') ) |
2512 { |
2512 { |
2513 $q = $db->sql_query('SELECT block_type FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); |
2513 $q = $db->sql_query('SELECT block_type FROM '.table_prefix.'sidebar WHERE item_id=' . intval($_GET['id']) . ';'); |
2514 if(!$q) |
2514 if(!$q) |
2515 { |
2515 { |
2516 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
2516 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
2517 exit; |
2517 exit; |
2518 } |
2518 } |
2519 $row = $db->fetchrow(); |
2519 $row = $db->fetchrow(); |
2520 if ( $row['block_type'] == BLOCK_PHP ) |
2520 if ( $row['block_type'] == BLOCK_PHP ) |
2521 { |
2521 { |
2522 $_POST['content'] = '?><Nulled>'; |
2522 $_POST['content'] = '?><Nulled>'; |
2523 } |
2523 } |
2524 else |
2524 else |
2525 { |
2525 { |
2526 $_POST['content'] = sanitize_html($_POST['content'], true); |
2526 $_POST['content'] = sanitize_html($_POST['content'], true); |
2527 } |
2527 } |
2528 } |
2528 } |
2529 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_content=\''.$db->escape(rawurldecode($_POST['content'])).'\' WHERE item_id=' . intval($_GET['id']) . ';'); |
2529 $q = $db->sql_query('UPDATE '.table_prefix.'sidebar SET block_content=\''.$db->escape(rawurldecode($_POST['content'])).'\' WHERE item_id=' . intval($_GET['id']) . ';'); |
2530 if(!$q) |
2530 if(!$q) |
2531 { |
2531 { |
2532 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
2532 echo 'var status=unescape(\''.hexencode($db->get_error()).'\');'; |
2533 exit; |
2533 exit; |
2534 } |
2534 } |
2535 echo 'GOOD'; |
2535 echo 'GOOD'; |
2536 return; |
2536 return; |
2537 |
2537 |
2538 break; |
2538 break; |
2539 } |
2539 } |
2540 } |
2540 } |
2541 |
2541 |
2542 ?> |
2542 ?> |
2543 <p> |
2543 <p> |
2544 <?php echo $lang->get('sbedit_header_msg', array( 'create_link' => makeUrlNS('Special', 'EditSidebar', 'action=new&id=0', true) )); ?> |
2544 <?php echo $lang->get('sbedit_header_msg', array( 'create_link' => makeUrlNS('Special', 'EditSidebar', 'action=new&id=0', true) )); ?> |
2545 </p> |
2545 </p> |
2546 <?php |
2546 <?php |
2547 |
2547 |
2548 $q = $db->sql_query('SELECT item_id, sidebar_id, block_name, block_type, block_content, item_enabled FROM ' . table_prefix . "sidebar ORDER BY sidebar_id ASC, item_order ASC;"); |
2548 $q = $db->sql_query('SELECT item_id, sidebar_id, block_name, block_type, block_content, item_enabled FROM ' . table_prefix . "sidebar ORDER BY sidebar_id ASC, item_order ASC;"); |
2549 if ( !$q ) |
2549 if ( !$q ) |
2550 $db->_die(); |
2550 $db->_die(); |
2551 |
2551 |
2552 $switched_to_right = false; |
2552 $switched_to_right = false; |
2553 |
2553 |
2554 echo '<table border="0" cellspacing="4" cellpadding="0"><tr><td class="sbedit-column">'; |
2554 echo '<table border="0" cellspacing="4" cellpadding="0"><tr><td class="sbedit-column">'; |
2555 while ( $row = $db->fetchrow() ) |
2555 while ( $row = $db->fetchrow() ) |
2556 { |
2556 { |
2557 if ( $row['sidebar_id'] == SIDEBAR_RIGHT && !$switched_to_right ) |
2557 if ( $row['sidebar_id'] == SIDEBAR_RIGHT && !$switched_to_right ) |
2558 { |
2558 { |
2559 echo '</td><td class="sbedit-column">'; |
2559 echo '</td><td class="sbedit-column">'; |
2560 $switched_to_right = true; |
2560 $switched_to_right = true; |
2561 } |
2561 } |
2562 $disabled_class = ( $row['item_enabled'] ) ? '' : ' disabled'; |
2562 $disabled_class = ( $row['item_enabled'] ) ? '' : ' disabled'; |
2563 echo '<div class="sbedit-block' . $disabled_class . '" id="block:' . $row['item_id'] . '"> |
2563 echo '<div class="sbedit-block' . $disabled_class . '" id="block:' . $row['item_id'] . '"> |
2564 <div class="sbedit-handle"> |
2564 <div class="sbedit-handle"> |
2565 <span>' . htmlspecialchars($template->compile_template_text_post($row['block_name'])) . '</span> |
2565 <span>' . htmlspecialchars($template->compile_template_text_post($row['block_name'])) . '</span> |
2566 <input type="text" id="block_name:' . $row['item_id'] . '" value="' . htmlspecialchars($row['block_name']) . '" /> |
2566 <input type="text" id="block_name:' . $row['item_id'] . '" value="' . htmlspecialchars($row['block_name']) . '" /> |
2567 </div>'; |
2567 </div>'; |
2568 ?> |
2568 ?> |
2569 <div class="sbedit-metainfo"> |
2569 <div class="sbedit-metainfo"> |
2570 <?php |
2570 <?php |
2571 $toolbarvars = $template->extract_vars('toolbar.tpl'); |
2571 $toolbarvars = $template->extract_vars('toolbar.tpl'); |
2572 $parser_start = $template->makeParserText($toolbarvars['toolbar_vert_start']); |
2572 $parser_start = $template->makeParserText($toolbarvars['toolbar_vert_start']); |
2573 echo $parser_start->run(); |
2573 echo $parser_start->run(); |
2574 |
2574 |
2575 $button = $template->makeParserText($toolbarvars['toolbar_vert_button']); |
2575 $button = $template->makeParserText($toolbarvars['toolbar_vert_button']); |
2576 $label = $template->makeParserText($toolbarvars['toolbar_vert_label']); |
2576 $label = $template->makeParserText($toolbarvars['toolbar_vert_label']); |
2577 |
2577 |
2578 $type = '<b>'; |
2578 $type = '<b>'; |
2579 switch($row['block_type']) |
2579 switch($row['block_type']) |
2580 { |
2580 { |
2581 case BLOCK_WIKIFORMAT: $type .= $lang->get('sbedit_block_type_wiki'); break; |
2581 case BLOCK_WIKIFORMAT: $type .= $lang->get('sbedit_block_type_wiki'); break; |
2582 case BLOCK_TEMPLATEFORMAT: $type .= $lang->get('sbedit_block_type_tpl'); break; |
2582 case BLOCK_TEMPLATEFORMAT: $type .= $lang->get('sbedit_block_type_tpl'); break; |
2583 case BLOCK_HTML: $type .= $lang->get('sbedit_block_type_html'); break; |
2583 case BLOCK_HTML: $type .= $lang->get('sbedit_block_type_html'); break; |
2584 case BLOCK_PHP: $type .= $lang->get('sbedit_block_type_php'); break; |
2584 case BLOCK_PHP: $type .= $lang->get('sbedit_block_type_php'); break; |
2585 case BLOCK_PLUGIN: $type .= $lang->get('sbedit_block_type_plugin'); break; |
2585 case BLOCK_PLUGIN: $type .= $lang->get('sbedit_block_type_plugin'); break; |
2586 default: $type .= '$&#@'; break; |
2586 default: $type .= '$&#@'; break; |
2587 } |
2587 } |
2588 $type .= '</b>'; |
2588 $type .= '</b>'; |
2589 if ( $row['block_type'] == BLOCK_PLUGIN ) |
2589 if ( $row['block_type'] == BLOCK_PLUGIN ) |
2590 { |
2590 { |
2591 $type .= ': ' . $lang->get($row['block_content']); |
2591 $type .= ': ' . $lang->get($row['block_content']); |
2592 } |
2592 } |
2593 |
2593 |
2594 $label->assign_vars(array( |
2594 $label->assign_vars(array( |
2595 'TITLE' => $type |
2595 'TITLE' => $type |
2596 )); |
2596 )); |
2597 echo $label->run(); |
2597 echo $label->run(); |
2598 |
2598 |
2599 // edit |
2599 // edit |
2600 if ( $row['block_type'] != BLOCK_PLUGIN ) |
2600 if ( $row['block_type'] != BLOCK_PLUGIN ) |
2601 { |
2601 { |
2602 $button->assign_vars(array( |
2602 $button->assign_vars(array( |
2603 'TITLE' => $lang->get('sbedit_tip_edit'), |
2603 'TITLE' => $lang->get('sbedit_tip_edit'), |
2604 'FLAGS' => 'href="#" onclick="sbedit_open_editor(this); return false;"', |
2604 'FLAGS' => 'href="#" onclick="sbedit_open_editor(this); return false;"', |
2605 'IMAGE' => cdnPath . '/images/edit.png' |
2605 'IMAGE' => cdnPath . '/images/edit.png' |
2606 )); |
2606 )); |
2607 echo $button->run(); |
2607 echo $button->run(); |
2608 } |
2608 } |
2609 |
2609 |
2610 // delete |
2610 // delete |
2611 $button->assign_vars(array( |
2611 $button->assign_vars(array( |
2612 'TITLE' => $lang->get('sbedit_tip_delete'), |
2612 'TITLE' => $lang->get('sbedit_tip_delete'), |
2613 'FLAGS' => 'href="#" onclick="sbedit_delete_block(this); return false;"', |
2613 'FLAGS' => 'href="#" onclick="sbedit_delete_block(this); return false;"', |
2614 'IMAGE' => cdnPath . '/images/delete.png' |
2614 'IMAGE' => cdnPath . '/images/delete.png' |
2615 )); |
2615 )); |
2616 echo $button->run(); |
2616 echo $button->run(); |
2617 |
2617 |
2618 // rename |
2618 // rename |
2619 $button->assign_vars(array( |
2619 $button->assign_vars(array( |
2620 'TITLE' => $lang->get('sbedit_tip_rename'), |
2620 'TITLE' => $lang->get('sbedit_tip_rename'), |
2621 'FLAGS' => 'href="#" onclick="sbedit_rename_block(this); return false;"', |
2621 'FLAGS' => 'href="#" onclick="sbedit_rename_block(this); return false;"', |
2622 'IMAGE' => cdnPath . '/images/rename.png' |
2622 'IMAGE' => cdnPath . '/images/rename.png' |
2623 )); |
2623 )); |
2624 echo $button->run(); |
2624 echo $button->run(); |
2625 |
2625 |
2626 // disenable |
2626 // disenable |
2627 $button->assign_vars(array( |
2627 $button->assign_vars(array( |
2628 'TITLE' => $lang->get('sbedit_tip_disenable'), |
2628 'TITLE' => $lang->get('sbedit_tip_disenable'), |
2629 'FLAGS' => 'href="#" onclick="sbedit_disenable_block(this); return false;"', |
2629 'FLAGS' => 'href="#" onclick="sbedit_disenable_block(this); return false;"', |
2630 'IMAGE' => cdnPath . '/images/disenable.png' |
2630 'IMAGE' => cdnPath . '/images/disenable.png' |
2631 )); |
2631 )); |
2632 echo $button->run(); |
2632 echo $button->run(); |
2633 |
2633 |
2634 $parser_end = $template->makeParserText($toolbarvars['toolbar_vert_end']); |
2634 $parser_end = $template->makeParserText($toolbarvars['toolbar_vert_end']); |
2635 echo $parser_end->run(); |
2635 echo $parser_end->run(); |
2636 ?> |
2636 ?> |
2637 </div> |
2637 </div> |
2638 <?php |
2638 <?php |
2639 echo '</div>'; |
2639 echo '</div>'; |
2640 } |
2640 } |
2641 |
2641 |
2642 if ( !$switched_to_right ) |
2642 if ( !$switched_to_right ) |
2643 echo '</td><td class="sbedit-column">'; |
2643 echo '</td><td class="sbedit-column">'; |
2644 |
2644 |
2645 echo '</td></tr></table>'; |
2645 echo '</td></tr></table>'; |
2646 } |
2646 } |
2647 |
2647 |
2648 $template->footer(); |
2648 $template->footer(); |
2649 } |
2649 } |
2650 |
2650 |
2651 ?> |
2651 ?> |