Revision 1791
Added by Dietmar about 12 years ago
- fixed save search settings
branches/2.8.x/CHANGELOG | ||
---|---|---|
13 | 13 |
|
14 | 14 |
|
15 | 15 |
|
16 |
24 Oct-2012 Build 1791 Dietmar Woellbrink (Luisehahne) |
|
17 |
# fixed save search settings |
|
16 | 18 |
14 Oct-2012 Build 1790 Dietmar Woellbrink (Luisehahne) |
17 | 19 |
! update group permission, |
18 | 20 |
14 Oct-2012 Build 1789 Dietmar Woellbrink (Luisehahne) |
branches/2.8.x/wb/upgrade-script.php | ||
---|---|---|
66 | 66 |
'[ADMIN]/themes/', |
67 | 67 |
); |
68 | 68 |
|
69 |
if(version_compare(WB_REVISION, '1788', '<'))
|
|
69 |
if(version_compare(WB_REVISION, '1791', '<'))
|
|
70 | 70 |
{ |
71 | 71 |
$filesRemove['0'] = array( |
72 | 72 |
|
branches/2.8.x/wb/admin/skel/themes/htt/settings.htt | ||
---|---|---|
417 | 417 |
<div class="mbox sub-row"> |
418 | 418 |
<label class="setting_name">{TEXT_NO_RESULTS}:</label> |
419 | 419 |
<div class="input" > |
420 |
<input type="text" name="search_no_results" value="{SEARCH_NO_RESULTS}" />
|
|
420 |
<textarea class="vert" name="search_no_results" cols="50" rows="3">{SEARCH_NO_RESULTS}</textarea>
|
|
421 | 421 |
</div> |
422 | 422 |
</div> |
423 | 423 |
<div class="mbox sub-row"> |
branches/2.8.x/wb/admin/pages/settings.php | ||
---|---|---|
206 | 206 |
$oTpl->set_var('p_menu_icon0_dir', p($sHelp,$mLang->TEXT_MENU_ICON_0_DIR)); |
207 | 207 |
$oTpl->set_var('p_menu_icon1_dir', p($sHelp,$mLang->TEXT_MENU_ICON_1_DIR)); |
208 | 208 |
$oTpl->set_var('p_menu_page_code', p($mLang->HELP_PAGE_CODE,$mLang->TEXT_PAGE_CODE)); |
209 |
$oTpl->set_var('p_menu_filename', p($sFilename,$mLang->TEXT_SEO_TITLE)); |
|
209 |
$oTpl->set_var('p_menu_filename', p($sFilename,$mLang->TEXT_SEO_TITLE));
|
|
210 | 210 |
|
211 | 211 |
if(is_readable(WB_PATH.$sIconDir)) { |
212 | 212 |
$oIterator = new DirectoryIterator(WB_PATH.$sIconDir); |
branches/2.8.x/wb/admin/interface/version.php | ||
---|---|---|
51 | 51 |
|
52 | 52 |
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled) |
53 | 53 |
if(!defined('VERSION')) define('VERSION', '2.8.3'); |
54 |
if(!defined('REVISION')) define('REVISION', '1790');
|
|
54 |
if(!defined('REVISION')) define('REVISION', '1791');
|
|
55 | 55 |
if(!defined('SP')) define('SP', ''); |
branches/2.8.x/wb/admin/settings/save.php | ||
---|---|---|
198 | 198 |
'website_description', |
199 | 199 |
'website_keywords', |
200 | 200 |
'wysiwyg_style', |
201 |
'search_module_order', |
|
202 |
'search_max_excerpt', |
|
203 |
'search_time_limit', |
|
204 | 201 |
'pages_directory', |
205 | 202 |
'page_icon_dir', |
206 | 203 |
'media_directory', |
... | ... | |
298 | 295 |
} |
299 | 296 |
|
300 | 297 |
} |
298 |
/** |
|
299 |
* now save search settings |
|
300 |
*/ |
|
301 | 301 |
$StripCodeFromISearch = array( |
302 | 302 |
'search_header', |
303 | 303 |
'search_results_header', |
304 | 304 |
'search_results_loop', |
305 | 305 |
'search_results_footer', |
306 |
'search_no_results', |
|
307 | 306 |
'search_footer', |
308 | 307 |
'search_module_order', |
309 | 308 |
'search_max_excerpt', |
309 |
'search_no_results', |
|
310 | 310 |
'search_time_limit', |
311 |
'search_max_excerpt', |
|
311 | 312 |
); |
312 | 313 |
$allow_empty_values = array( |
313 |
'search_footer', |
|
314 |
'header', |
|
315 |
'results_header', |
|
316 |
'results_loop', |
|
317 |
'results_footer', |
|
318 |
'footer', |
|
319 |
'module_order', |
|
320 |
'no_results', |
|
314 | 321 |
); |
322 |
$allow_tags_in_fields = array( |
|
323 |
'header', |
|
324 |
'results_header', |
|
325 |
'results_loop', |
|
326 |
'results_footer', |
|
327 |
'no_results', |
|
328 |
'footer', |
|
329 |
); |
|
315 | 330 |
|
316 | 331 |
// Query current search settings in the db, then loop through them and update the db with the new value |
317 | 332 |
$sql = 'SELECT `name`, `value` FROM `'.TABLE_PREFIX.'search` '; |
318 |
$sql .= 'WHERE `extra` = ""';
|
|
319 |
$res_search = $database->query($sql);
|
|
320 |
|
|
321 |
if($database->is_error()) {
|
|
322 |
$admin->print_error($database->is_error(), $js_back );
|
|
333 |
$sql .= 'WHERE `extra` = \'\' ';
|
|
334 |
if( !($oSearch = $database->query($sql)) ) {
|
|
335 |
if($database->is_error()) { |
|
336 |
$admin->print_error(explode(';',$database->get_error()), $js_back );
|
|
337 |
}
|
|
323 | 338 |
} |
324 | 339 |
|
325 |
while($search_setting = $res_search->fetchRow(MYSQL_ASSOC))
|
|
340 |
while($aSearch = $oSearch->fetchRow(MYSQL_ASSOC))
|
|
326 | 341 |
{ |
327 |
$old_value = $search_setting['value']; |
|
328 |
$setting_name = $search_setting['name']; |
|
329 |
$post_name = 'search_'.$setting_name; |
|
342 |
$passed = false; |
|
343 |
$old_value = $aSearch['value']; |
|
344 |
$sSearchName = $aSearch['name']; |
|
345 |
$sPostName = 'search_'.$sSearchName; |
|
330 | 346 |
|
331 |
// hold old value if post is empty |
|
332 |
// check search template |
|
333 |
$value = ($admin->get_post($post_name)); |
|
334 |
if(in_array($post_name, $StripCodeFromISearch) ) { |
|
347 |
$value = $admin->get_post($sPostName); |
|
348 |
$value = isset($value) ? $value : $old_value; |
|
349 |
if(in_array($sPostName, $StripCodeFromISearch) ) { |
|
335 | 350 |
$value = $admin->StripCodeFromText($value); |
336 | 351 |
} |
337 | 352 |
|
338 |
$passed = in_array($post_name, $allow_empty_values); |
|
353 |
/** |
|
354 |
* hold old value if post is empty |
|
355 |
* check search template |
|
356 |
*/ |
|
357 |
switch ($sSearchName) { |
|
358 |
case 'template': |
|
359 |
$passed = true; |
|
360 |
$value = ( !($admin->get_post($sPostName)) || ($value == DEFAULT_TEMPLATE ) ) ? '' : $admin->get_post($sPostName); |
|
361 |
break; |
|
362 |
case 'max_excerpt': |
|
363 |
$passed = true; |
|
364 |
if(preg_match('/[^0-9]+/i', $value)) { |
|
365 |
$value = $old_value; |
|
366 |
} |
|
367 |
break; |
|
368 |
case 'time_limit': |
|
369 |
$passed = true; |
|
370 |
if(preg_match('/[^0-9]+/i', $value)) { |
|
371 |
$value = $old_value; |
|
372 |
} |
|
373 |
break; |
|
374 |
default : |
|
375 |
$passed = ($admin->get_post($sPostName) || in_array($sSearchName, $allow_empty_values)); |
|
339 | 376 |
|
340 |
$value = ( (!in_array($post_name, $allow_empty_values)) && ($setting_name != 'template') ) ? $old_value : $value; |
|
377 |
if (!in_array($sSearchName, $allow_tags_in_fields)) |
|
378 |
{ |
|
379 |
$value = strip_tags($value); |
|
380 |
} |
|
381 |
break; |
|
382 |
} |
|
341 | 383 |
|
342 |
// $value = ( ($admin->get_post($post_name) == '') && ($setting_name == 'template') ) ? DEFAULT_TEMPLATE : $admin->get_post($post_name); |
|
343 |
if(isset($value)) |
|
384 |
if ( ($passed == true) ) |
|
344 | 385 |
{ |
345 | 386 |
$value = $admin->add_slashes($value); |
346 | 387 |
$sql = 'UPDATE `'.TABLE_PREFIX.'search` '; |
347 | 388 |
$sql .= 'SET `value` = \''.$value.'\' '; |
348 |
$sql .= 'WHERE `name` = \''.$setting_name.'\' ';
|
|
389 |
$sql .= 'WHERE `name` = \''.$sSearchName.'\' ';
|
|
349 | 390 |
$sql .= 'AND `extra` = \'\' '; |
350 | 391 |
if($database->query($sql)) { |
392 |
|
|
351 | 393 |
} |
352 | 394 |
$sql_info = mysql_info($database->db_handle); |
353 | 395 |
} |
branches/2.8.x/wb/framework/class.wb.php | ||
---|---|---|
37 | 37 |
parent::__construct($mode); |
38 | 38 |
} |
39 | 39 |
|
40 |
/** |
|
41 |
* |
|
42 |
* |
|
43 |
* @return array of first visible language pages with defined fields |
|
44 |
* |
|
45 |
*/ |
|
46 |
public function GetLanguagesDetailsInUsed ( ) { |
|
47 |
global $database; |
|
48 |
$retVal = array(); |
|
49 |
$sql = |
|
50 |
'SELECT DISTINCT `language`'. |
|
51 |
', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'. |
|
52 |
', `visibility`,`viewing_groups`,`viewing_users`,`position` '. |
|
53 |
'FROM `'.TABLE_PREFIX.'pages` '. |
|
54 |
'WHERE `level`= \'0\' '. |
|
55 |
'AND `root_parent`=`page_id` '. |
|
56 |
'AND `visibility`!=\'none\' '. |
|
57 |
'AND `visibility`!=\'hidden\' '. |
|
58 |
'GROUP BY `language` '. |
|
59 |
'ORDER BY `position`'; |
|
40 | 60 |
|
41 |
/** |
|
42 |
* |
|
43 |
* |
|
44 |
* @param mixed $lang |
|
45 |
* @param mixed $level |
|
46 |
* @param mixed $parent |
|
47 |
* @return |
|
48 |
*/ |
|
49 |
public function GetLanguagesPages ( $lang, $level, $parent ) { |
|
50 |
global $database; |
|
51 |
$page = array(); |
|
52 |
$sql = |
|
53 |
'SELECT `language`,`visibility`,`viewing_groups`,`viewing_users`,`language`,`position`, '. |
|
54 |
'`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link` '. |
|
55 |
'FROM `'.TABLE_PREFIX.'pages` '. |
|
56 |
'WHERE `level`=\''.$level.'\' '. |
|
57 |
'AND `language`=\''.$lang['language'].'\' '. |
|
58 |
'AND `visibility`!=\'none\' '. |
|
59 |
'AND `visibility`!=\'hidden\' '. |
|
60 |
'AND `parent`=\''.$parent.'\' '. |
|
61 |
'AND `root_parent`=`page_id` '. |
|
62 |
'ORDER BY `position`'; |
|
63 |
if($oPage = $database->query($sql)) |
|
64 |
{ |
|
65 |
$page = $oPage->fetchRow(MYSQL_ASSOC); |
|
66 |
} |
|
67 |
return $page; |
|
61 |
if($oRes = $database->query($sql)) |
|
62 |
{ |
|
63 |
while($page = $oRes->fetchRow(MYSQL_ASSOC)) |
|
64 |
{ |
|
65 |
if(!$this->page_is_visible($page)) {continue;} |
|
66 |
$retVal[$page['language']] = $page; |
|
67 |
} |
|
68 |
} |
|
69 |
return $retVal; |
|
68 | 70 |
} |
69 | 71 |
|
70 |
/** |
|
71 |
* |
|
72 |
* |
|
73 |
* @return |
|
74 |
*/ |
|
75 |
public function GetLanguagesInUsed ( ) { |
|
72 |
/** |
|
73 |
* |
|
74 |
* |
|
75 |
* @return comma separate list of first visible languages |
|
76 |
* |
|
77 |
*/ |
|
78 |
public function GetLanguagesInUsed ( ) { |
|
76 | 79 |
global $database; |
77 | 80 |
$retVal = ''; |
78 | 81 |
$page = array(); |
79 | 82 |
$sql = |
80 |
'SELECT DISTINCT `language` '. |
|
81 |
'FROM `'.TABLE_PREFIX.'pages` '. |
|
82 |
'WHERE `level`= \'0\' '. |
|
83 |
'AND `visibility`!=\'none\' '. |
|
84 |
'AND `visibility`!=\'hidden\' '. |
|
85 |
'ORDER BY `position`'; |
|
83 |
'SELECT DISTINCT `language`'. |
|
84 |
', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'. |
|
85 |
', `visibility`,`viewing_groups`,`viewing_users`,`position` '. |
|
86 |
'FROM `'.TABLE_PREFIX.'pages` '. |
|
87 |
'WHERE `level`= \'0\' '. |
|
88 |
'AND `root_parent`=`page_id` '. |
|
89 |
'AND `visibility`!=\'none\' '. |
|
90 |
'AND `visibility`!=\'hidden\' '. |
|
91 |
'GROUP BY `language` '. |
|
92 |
'ORDER BY `position`'; |
|
86 | 93 |
|
87 |
if($oRes = $database->query($sql)) |
|
88 |
{ |
|
89 |
while($lang = $oRes->fetchRow(MYSQL_ASSOC)) |
|
94 |
if($oRes = $database->query($sql)) |
|
90 | 95 |
{ |
91 |
$page = $this->GetLanguagesPages ( $lang, 0, 0 ); |
|
92 |
if(!$this->page_is_visible($page)) {continue;} |
|
93 |
$retVal .= $page['language'].','; |
|
96 |
while($page = $oRes->fetchRow(MYSQL_ASSOC)) |
|
97 |
{ |
|
98 |
if(!$this->page_is_visible($page)) {continue;} |
|
99 |
$retVal .= $page['language'].','; |
|
100 |
} |
|
94 | 101 |
} |
95 |
} |
|
96 |
return trim($retVal,','); |
|
102 |
return trim($retVal,','); |
|
97 | 103 |
} |
98 | 104 |
|
99 | 105 |
|
... | ... | |
135 | 141 |
return $this->is_group_match( $groups_list, $this->get_groups_id() ); |
136 | 142 |
} |
137 | 143 |
|
138 |
// Check whether a page is visible or not.
|
|
139 |
// This will check page-visibility and user- and group-rights.
|
|
140 |
/* page_is_visible() returns
|
|
141 |
false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page.
|
|
142 |
true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page.
|
|
143 |
*/
|
|
144 |
// Check whether a page is visible or not. |
|
145 |
// This will check page-visibility and user- and group-rights. |
|
146 |
/* page_is_visible() returns |
|
147 |
false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page. |
|
148 |
true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page. |
|
149 |
*/ |
|
144 | 150 |
public function page_is_visible($page) |
145 | 151 |
{ |
146 | 152 |
// First check if visibility is 'none', 'deleted' |
branches/2.8.x/wb/templates/wb_theme/css/screen.css | ||
---|---|---|
141 | 141 |
form.settings_table input[type="password"] { border :1px solid #666666; margin :0px auto; padding-left :5px; width :59%; } |
142 | 142 |
form.settings_table input.radio { border :1px none #666666; margin :0px auto; padding-left :0.5em; height :1em; } |
143 | 143 |
form.settings_table input[type="button"].button { border :1px solid #666666; color :#000000; text-align :left; font-weight :bold; background-color :#dddddd; margin :2px auto; padding :2px 0px 2px 6px; width :60%; } |
144 |
form.settings_table textarea { border :1px solid #666666; margin :3px auto; padding-left :0.5em; min-height :1em; width :60%; }
|
|
144 |
form.settings_table textarea { border :1px solid #666666; margin :3px auto; padding-left :0.5em; min-height :1em; width :59%; }
|
|
145 | 145 |
form.settings_table select { border :1px solid #666666; margin :3px auto; padding-left :0.5em; min-height :1em; width :60%; } |
146 | 146 |
/* */ |
147 | 147 |
div.content_box form { } |
Also available in: Unified diff