18 require_once SQ_LIB_PATH.
'/config/prefs.inc';
19 require_once SQ_ATTRIBUTES_PATH.
'/duration/duration.inc';
20 require_once SQ_ATTRIBUTES_PATH.
'/int/int.inc';
37 var $pref_vars = Array (
38 'SQ_USER_SESSION_PREFS' => Array(
39 'name' =>
'user_prefs_session_settings_header',
40 'description' =>
'This preference allows you to change the session settings for this user group',
41 'default' => Array(Array(
'persist' =>
'0',
'timeout' =>
'0',
'max_length' =>
'0')),
44 'SQ_USER_ASSET_MAP_LINEAGE' => Array(
45 'name' =>
'user_prefs_asset_map_root_asset_header',
46 'description' =>
'This preference allows you to change the root node that is displated in the Asset Map',
50 'SQ_USER_SAFE_TYPE3_TRASH' => Array(
51 'name' =>
'safe_trash',
52 'description' =>
'This preference allows you to prohibit the deletion of an asset until all notice links are removed',
56 'SQ_USER_ASSET_MAP_WIDTH' => Array(
57 'name' =>
'asset_map_width',
58 'description' =>
'Allows changing of asset map frame width',
62 'SQ_USER_COMMIT_BUTTON_POS' => Array(
63 'name' =>
'commit_button_position',
68 'SQ_USER_LIMBO_HIDE_FRAMES' => Array(
69 'name' =>
'user_prefs_limbo_hide_frames',
70 'description' =>
'This preference determines whether or not the default frames are painted in Simple Edit',
74 'SQ_USER_ATTRIBUTE_IMAGE' => Array(
75 'name' =>
'user_prefs_attribute_image',
76 'description' =>
'This preference allows you to specify settings for the attribute images',
77 'default' => Array(
'face' =>
'3',
'size' =>
'12',
'hpad' =>
'0',
'vpad' =>
'0',
'fgcol' =>
'000000',
'bgcol' =>
'FFFFFF'),
80 'SQ_USER_SET_CONTEXT_ON_LOGIN' => Array(
81 'name' =>
'user_prefs_set_context_on_login',
82 'description' =>
'Set the selected context when a user in this user group logs in.',
83 'default' =>
'default',
86 'SQ_USER_FILTER_FRONT_END_INPUT' => Array(
87 'name' =>
'filter_front_end_user_input',
88 'description' =>
'Filter (strip keywords, strip script tags and escape html) of any input by the user from the front end.',
94 var $int_am_frame_width;
95 var $int_am_frame_width_default = 275;
104 $this->
Prefs($pref_file);
108 $this->int_am_frame_width->setParam(
'allow_negative', FALSE);
109 $this->int_am_frame_width->setParam(
'allow_empty', FALSE);
110 $this->int_am_frame_width->setParam(
'range_lower', $this->int_am_frame_width_default);
127 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
128 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
130 if (is_null($pref) || $pref ==
'SQ_USER_SESSION_PREFS') {
131 if (is_null($pref)) {
132 $o->openField(translate($this->pref_vars[
'SQ_USER_SESSION_PREFS'][
'name']));
134 $session_settings = $this->pref_vars[
'SQ_USER_SESSION_PREFS'][
'default'];
136 <style type=
"text/css">
138 list-style-type: none;
147 div.sq-backend-table-cell {
153 foreach ($session_settings as $id => $extra_setting) {
155 <div
class=
"sq-backend-table sq-backend-table-cell">
156 <?php echo ($id ==
'0') ? translate(
'default').
' '.translate(
'rule') : translate(
'rule_number', $id); ?><br />
157 <?php echo translate(
'end_user_session'); ?>...
161 if ($have_lock && $is_admin) {
162 check_box(
'prefs[SQ_USER_SESSION_PREFS]['.$id.
'][persist]',
'0', ($extra_setting[
'persist'] == 0),
'',
'id="prefs_SQ_USER_SESSION_PREFS_'.$id.
'_persist"');
163 label(translate(
'session_persist'),
'prefs_SQ_USER_SESSION_PREFS_'.$id.
'_persist');
165 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.(empty($extra_setting[
'persist']) ?
'tick' :
'cross').
'.gif" />';
166 echo translate(
'session_persist');
170 <li
id=
"timeout<?php echo $id; ?>">
173 if ($have_lock && $is_admin) {
174 check_box(
'prefs[SQ_USER_SESSION_PREFS]['.$id.
'][timeout_enabled]',
'1', ($extra_setting[
'timeout'] != 0),
'toggleInputs(this.parentNode)',
'id="prefs_SQ_USER_SESSION_PREFS_'.$id.
'_timeout_enabled"');
175 label(translate(
'session_timeout'),
'prefs_SQ_USER_SESSION_PREFS_'.$id.
'_timeout_enabled');
178 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.(!empty($extra_setting[
'timeout']) ?
'tick' :
'cross').
'.gif" />';
179 echo translate(
'session_timeout');
181 $dur->paint(
'prefs_dur_timeout_'.$id, !$have_lock);
184 <li
id=
"max_length<?php echo $id; ?>">
187 if ($have_lock && $is_admin) {
188 check_box(
'prefs[SQ_USER_SESSION_PREFS]['.$id.
'][max_length_enabled]',
'1', ($extra_setting[
'max_length'] != 0),
'toggleInputs(this.parentNode)',
'id="prefs_SQ_USER_SESSION_PREFS_'.$id.
'_max_length_enabled"');
189 label(translate(
'session_max_length'),
'prefs_SQ_USER_SESSION_PREFS_'.$id.
'_max_length_enabled');
192 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.(!empty($extra_setting[
'max_length']) ?
'tick' :
'cross').
'.gif" />';
193 echo translate(
'session_max_length');
195 $dur->paint(
'prefs_dur_max_length_'.$id, !$have_lock); ?>
200 if (!isset($extra_setting[
'ip_from'])) {
201 $extra_setting[
'ip_from'] =
'';
203 if (!isset($extra_setting[
'ip_to'])) {
204 $extra_setting[
'ip_to'] =
'';
208 if ($have_lock && $is_admin) {
209 $js =
"onChange=\"Javascript: if (this.checked == false) { document.getElementById('prefs[SQ_USER_SESSION_PREFS][".$id.
"][ip_from]').value = ''; } \"";
210 check_box(
'prefs[SQ_USER_SESSION_PREFS]['.$id.
'][limit]',
'0', (!empty($extra_setting[
'ip_from'])),
'',
'id="prefs_SQ_USER_SESSION_PREFS_'.$id.
'_limit" '.$js);
211 label(translate(
'limit_by_ip_address'),
'prefs_SQ_USER_SESSION_PREFS_'.$id.
'_limit');
213 text_box(
'prefs[SQ_USER_SESSION_PREFS]['.$id.
'][ip_from]', $extra_setting[
'ip_from']);
215 text_box(
'prefs[SQ_USER_SESSION_PREFS]['.$id.
'][ip_to]', $extra_setting[
'ip_to']);
217 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.((!empty($extra_setting[
'ip_from'])) ?
'tick' :
'cross').
'.gif" />';
218 echo translate(
'limit_by_ip_address');
220 echo $extra_setting[
'ip_from'];
221 if (!empty($extra_setting[
'ip_to'])) {
223 echo $extra_setting[
'ip_to'];
230 if ($id !=
'0' && $have_lock && $is_admin) {
234 $js =
"onChange=\"Javascript: if (this.checked == true) { if(!confirm(js_translate('confirm_delete_rule'))) { this.checked=false; } } \"";
235 check_box(
'prefs_delete_rule_number_'.$id,
'1', FALSE,
'prefs_sq_user_prefs_delete_'.$id, $js);
236 label(translate(
'delete_rule'),
'prefs_sq_user_prefs_delete_'.$id);
246 echo
'*'.translate(
'session_timeout_explanation');
251 if ($have_lock && $is_admin) {
252 check_box(
'prefs_make_new_rule',
'1', FALSE,
'prefs_sq_user_prefs_new');
253 label(translate(
'add_session_expiry_rule'),
'prefs_sq_user_prefs_new');
256 if ($have_lock && $is_admin) {
258 <script type=
"text/javascript">
259 function toggleInputs(elt) {
260 var inputs = elt.getElementsByTagName(
'INPUT');
261 for (var i=0; i < inputs.length; i++) {
262 if (inputs[i].type.toLowerCase() ==
'text') {
263 inputs[i].disabled = !inputs[i].disabled;
269 foreach (Array(
'timeout',
'max_length') as $field) {
270 foreach ($session_settings as $id => $session_setting) {
271 if (empty($session_setting[$field])) {
273 toggleInputs(document.getElementById(
'<?php echo $field.$id; ?>'));
282 if (is_null($pref)) $o->closeField();
285 if (is_null($pref) || $pref ==
'SQ_USER_ASSET_MAP_LINEAGE') {
286 if (is_null($pref)) {
287 $o->openField(translate($this->pref_vars[
'SQ_USER_ASSET_MAP_LINEAGE'][
'name']));
290 <div
class=
"sq-backend-table sq-backend-table-cell">
293 if ($have_lock && $is_admin) {
295 if (isset($this->pref_vars[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'])) {
296 $asset_map_settings = $this->pref_vars[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'];
298 $asset_map_settings =
'';
300 asset_finder(
'prefs[SQ_USER_ASSET_MAP_LINEAGE]', $asset_map_settings);
302 if (!empty($this->pref_vars[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'])) {
303 echo get_asset_tag_line($this->pref_vars[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default']);
305 echo translate(
'root_folder');
311 echo translate(
'user_prefs_asset_map_root_asset_explanation');
316 if (is_null($pref)) $o->closeField();
319 if (is_null($pref) || $pref ==
'SQ_USER_SAFE_TYPE3_TRASH') {
320 if (is_null($pref)) $o->openField(translate($this->pref_vars[
'SQ_USER_SAFE_TYPE3_TRASH'][
'name']));
322 <div
class=
"sq-backend-table sq-backend-table-cell">
324 $safe_trash = $this->pref_vars[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default'];
325 if ($have_lock && $is_admin) {
326 check_box(
'prefs[SQ_USER_SAFE_TYPE3_TRASH]', 1, ($safe_trash),
'',
'id="prefs_SQ_USER_SAFE_TYPE3_TRASH"');
327 label(
'Check this box if you want to prohibit the deletion of an asset until all notice links are removed',
'prefs_SQ_USER_SAFE_TYPE3_TRASH');
329 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.($safe_trash ?
'tick' :
'cross').
'.gif" />';
330 echo(
'Check this box if you want the system to prohibit the deletion of an asset until all notice links are removed');
337 if (is_null($pref)) $o->closeField();
341 if (is_null($pref) || $pref ==
'SQ_USER_ASSET_MAP_WIDTH') {
342 if (is_null($pref)) $o->openField(translate($this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'name']));
344 <div
class=
"sq-backend-table sq-backend-table-cell">
347 if ($have_lock && $is_admin) {
349 if (isset($this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'default'])) {
350 $asset_map_settings = $this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'default'];
352 $asset_map_settings =
'';
354 $this->int_am_frame_width->value = $asset_map_settings;
355 $this->int_am_frame_width->paint($pref.
'_am_frame_width', !$have_lock);
357 if (!empty($this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'default'])) {
358 echo $this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'default'];
364 echo $this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'description'];
369 if (is_null($pref)) $o->closeField();
372 if (is_null($pref) || $pref ==
'SQ_USER_COMMIT_BUTTON_POS') {
373 if (is_null($pref)) $o->openField(translate($this->pref_vars[
'SQ_USER_COMMIT_BUTTON_POS'][
'name']));
375 <div
class=
"sq-backend-table sq-backend-table-cell">
378 FALSE =>
'Bottom of page',
379 TRUE =>
'Anchored to bottom of frame',
382 $position = $this->pref_vars[
'SQ_USER_COMMIT_BUTTON_POS'][
'default'];
383 if ($have_lock && $is_admin) {
384 combo_box(
'prefs[SQ_USER_COMMIT_BUTTON_POS]', $options, FALSE, $position, 0,
'id="prefs_SQ_USER_COMMIT_BUTTON_POS"');
386 label(
'If set to "Anchored to bottom of frame", the Commit button will appear at the bottom of the frame and not scroll with the rest of the page. Note that this setting does not affect Simple Edit mode',
'prefs_SQ_USER_COMMIT_BUTTON_POS');
388 echo $options[$position].
'<br/>';
389 echo(
'If set to "Anchored to bottom of frame", the Commit button will appear at the bottom of the frame and not scroll with the rest of the page. Note that this setting does not affect Simple Edit mode');
396 if (is_null($pref)) $o->closeField();
399 if (is_null($pref) || $pref ==
'SQ_USER_LIMBO_HIDE_FRAMES') {
400 if (is_null($pref)) $o->openField(translate($this->pref_vars[
'SQ_USER_LIMBO_HIDE_FRAMES'][
'name']));
402 <div
class=
"sq-backend-table sq-backend-table-cell">
405 FALSE =>
'Do not hide frames',
406 TRUE =>
'Hide frames',
408 $hide_frames = $this->pref_vars[
'SQ_USER_LIMBO_HIDE_FRAMES'][
'default'];
409 if ($have_lock && $is_admin) {
410 combo_box(
'prefs[SQ_USER_LIMBO_HIDE_FRAMES]', $options, FALSE, $hide_frames, 0,
'id="prefs_SQ_USER_LIMBO_HIDE_FRAMES"');
412 label(
'If set to "Do not hide frames", MySource Matrix will paint the default Simple Edit Interface which includes the header bar and Asset Map resizing frame.',
'prefs_SQ_USER_LIMBO_HIDE_FRAMES');
414 echo $options[$hide_frames].
'<br/>';
415 echo(
'If set to "Do not hide frames", MySource Matrix will paint the default Simple Edit Interface which includes the header bar and Asset Map resizing frame');
424 if (is_null($pref) || $pref ==
'SQ_USER_ATTRIBUTE_IMAGE') {
425 if (is_null($pref)) {
426 $o->openField(translate($this->pref_vars[
'SQ_USER_ATTRIBUTE_IMAGE'][
'name']));
428 $attribute_settings = $this->pref_vars[
'SQ_USER_ATTRIBUTE_IMAGE'][
'default'];
430 <table
class=
"sq-backend-table" style=
"width: 350px;">
432 <td
class=
"sq-backend-table-header" nowrap=
"nowrap"><?php echo translate(
'attribute_image_face'); ?></td>
433 <td
class=
"sq-backend-table-cell" style=
"width: 100%;">
435 require_once(SQ_FUDGE_PATH.
'/general/file_system.inc');
436 $font_files = list_files(SQ_LIB_PATH.
'/fonts');
437 $fonts_installed = Array(
438 1 => translate(
'default_gd_font_1'),
439 2 => translate(
'default_gd_font_2'),
440 3 => translate(
'default_gd_font_3'),
441 4 => translate(
'default_gd_font_4'),
442 5 => translate(
'default_gd_font_5'),
444 foreach ($font_files as $font_file) {
445 $result = preg_match(
'/(.*)\.ttf$/i', $font_file, $matches);
446 if (isset($matches[1]) && !empty($matches[1])) {
447 $fonts_installed[$matches[1]] = ucwords($matches[1]);
450 if ($have_lock && $is_admin) {
451 combo_box(
'prefs[SQ_USER_ATTRIBUTE_IMAGE][face]', $fonts_installed, FALSE, $attribute_settings[
'face'], 1,
'id="prefs_SQ_USER_ATTRIBUTE_IMAGE_face"');
453 if (isset($fonts_installed[$attribute_settings[
'face']])) {
454 echo $fonts_installed[$attribute_settings[
'face']];
456 echo translate(
'no_valid_font');
463 <td
class=
"sq-backend-table-header" nowrap=
"nowrap"><?php echo translate(
'attribute_image_size'); ?></td>
464 <td
class=
"sq-backend-table-cell" style=
"width: 100%;">
466 $default_fonts = Array( 1,2,3,4,5 );
467 if ($have_lock && $is_admin && !in_array($attribute_settings[
'face'], $default_fonts)) {
468 text_box(
'prefs[SQ_USER_ATTRIBUTE_IMAGE][size]', $attribute_settings[
'size'],
'id="prefs_SQ_USER_ATTRIBUTE_IMAGE_size"');
470 if (in_array($attribute_settings[
'face'], $default_fonts)) {
471 echo translate(
'using_default_font');
473 echo $attribute_settings[
'size'];
480 <td
class=
"sq-backend-table-header" nowrap=
"nowrap"><?php echo translate(
'attribute_image_hpad'); ?></td>
481 <td
class=
"sq-backend-table-cell" style=
"width: 100%;">
483 if ($have_lock && $is_admin) {
484 text_box(
'prefs[SQ_USER_ATTRIBUTE_IMAGE][hpad]', $attribute_settings[
'hpad'],
'id="prefs_SQ_USER_ATTRIBUTE_IMAGE_hpad"');
486 echo $attribute_settings[
'hpad'];
492 <td
class=
"sq-backend-table-header" nowrap=
"nowrap"><?php echo translate(
'attribute_image_vpad'); ?></td>
493 <td
class=
"sq-backend-table-cell" style=
"width: 100%;">
495 if ($have_lock && $is_admin) {
496 text_box(
'prefs[SQ_USER_ATTRIBUTE_IMAGE][vpad]', $attribute_settings[
'vpad'],
'id="prefs_SQ_USER_ATTRIBUTE_IMAGE_vpad"');
498 echo $attribute_settings[
'vpad'];
504 <td
class=
"sq-backend-table-header" nowrap=
"nowrap"><?php echo translate(
'attribute_image_fgcol'); ?></td>
505 <td
class=
"sq-backend-table-cell" style=
"width: 100%;">
507 require_once(SQ_ATTRIBUTES_PATH.
'/colour/colour.inc');
509 $fg->paint(
'prefs_image_fgcol_', !($have_lock && $is_admin));
514 <td
class=
"sq-backend-table-header" nowrap=
"nowrap"><?php echo translate(
'attribute_image_bgcol'); ?></td>
515 <td
class=
"sq-backend-table-cell" style=
"width: 100%;">
517 require_once(SQ_ATTRIBUTES_PATH.
'/colour/colour.inc');
519 $bg->paint(
'prefs_image_bgcol_', !($have_lock && $is_admin));
525 if (is_null($pref)) $o->closeField();
529 if (is_null($pref) || $pref ==
'SQ_USER_SET_CONTEXT_ON_LOGIN') {
530 if (is_null($pref)) $o->openField(translate($this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'name']));
531 $contexts = $GLOBALS[
'SQ_SYSTEM']->getAllContexts();
533 'default' =>
'Do not change context on login',
534 'sep' =>
'-----------',
536 foreach ($contexts as $contextid => $context_data) {
537 $options[$contextid] = $context_data[
'name'];
540 <div
class=
"sq-backend-table sq-backend-table-cell">
543 if ($have_lock && $is_admin) {
544 if (isset($this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'default'])) {
545 $set_context_on_login = $this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'default'];
546 if (array_key_exists($set_context_on_login, $contexts) === FALSE) {
547 $set_context_on_login =
'default';
549 $set_context_on_login = (int)$set_context_on_login;
552 $set_context_on_login =
'default';
555 $default = $set_context_on_login;
557 combo_box(
'prefs[SQ_USER_SET_CONTEXT_ON_LOGIN]', $options, FALSE, Array($default));
559 if (!empty($this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'default'])) {
560 echo $options[$this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'default']];
566 echo $this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'description'];
571 if (is_null($pref)) $o->closeField();
574 if (is_null($pref) || $pref ==
'SQ_USER_FILTER_FRONT_END_INPUT') {
575 if (is_null($pref)) $o->openField(translate($this->pref_vars[
'SQ_USER_FILTER_FRONT_END_INPUT'][
'name']));
577 <div
class=
"sq-backend-table sq-backend-table-cell">
580 FALSE =>
'Do not filter input',
581 TRUE =>
'Filter input',
583 $filter_input = $this->pref_vars[
'SQ_USER_FILTER_FRONT_END_INPUT'][
'default'];
584 if ($have_lock && $is_admin) {
585 combo_box(
'prefs[SQ_USER_FILTER_FRONT_END_INPUT]', $options, FALSE, $filter_input, 0,
'id="prefs_SQ_USER_FILTER_FRONT_END_INPUT"');
587 label(
"If set to 'Filter Input', Matrix will ".$this->pref_vars[
'SQ_USER_FILTER_FRONT_END_INPUT'][
'description'],
'prefs_SQ_USER_FILTER_FRONT_END_INPUT');
589 echo $options[$filter_input].
'<br/>';
590 echo(
"If set to 'Filter Input', Matrix will ".$this->pref_vars[
'SQ_USER_FILTER_FRONT_END_INPUT'][
'description']);
596 if (is_null($pref)) $o->closeField();
615 if (!($GLOBALS[
'SQ_SYSTEM']->userRoot() || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin())) {
627 $new_prefs = Array( $make_new );
628 if (is_null($pref) || $pref ==
'SQ_USER_SESSION_PREFS') {
629 foreach ($_POST[
'prefs'][
'SQ_USER_SESSION_PREFS'] as $id => $submitted_pref) {
630 $new_prefs[$id][
'ip_from'] = (isset($submitted_pref[
'ip_from'])) ? $submitted_pref[
'ip_from'] :
'';
631 $new_prefs[$id][
'ip_to'] = (isset($submitted_pref[
'ip_to'])) ? $submitted_pref[
'ip_to'] :
'';
632 $new_prefs[$id][
'persist'] = !isset($submitted_pref[
'persist']);
634 if (isset($submitted_pref[
'timeout_enabled'])) {
636 $timeout_dur->process(
'prefs_dur_timeout_'.$id);
637 $new_prefs[$id][
'timeout'] = $timeout_dur->value;
639 $new_prefs[$id][
'timeout'] =
'0';
641 if (isset($submitted_pref[
'max_length_enabled'])) {
643 $max_length_dur->process(
'prefs_dur_max_length_'.$id);
644 $new_prefs[$id][
'max_length'] = $max_length_dur->value;
646 $new_prefs[$id][
'max_length'] =
'0';
650 if (isset($_POST[
'prefs_delete_rule_number_'.$id]) && $_POST[
'prefs_delete_rule_number_'.$id]) {
651 unset($new_prefs[$id]);
657 if (isset($_POST[
'prefs_make_new_rule']) && $_POST[
'prefs_make_new_rule']) {
658 $new_prefs[] = $make_new;
661 $this->pref_vars[
'SQ_USER_SESSION_PREFS'][
'default'] = $new_prefs;
664 if (is_null($pref) || $pref ==
'SQ_USER_ASSET_MAP_LINEAGE') {
666 if (isset($_POST[
'prefs'][
'SQ_USER_ASSET_MAP_LINEAGE'])) {
667 $this->pref_vars[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'] = $_POST[
'prefs'][
'SQ_USER_ASSET_MAP_LINEAGE'][
'assetid'];
673 foreach ($new_prefs as $id => $new_pref) {
675 if (isset($new_pref[
'ip_from'])) {
676 if (!empty($new_pref[
'ip_from'])) {
682 $temp = max($new_pref[
'timeout'], $new_pref[
'max_length']);
685 if (!empty($temp) && $temp > $gc_min) {
690 if ($gc_min > SQ_CONF_SESSION_GC_MAXLIFETIME) {
692 include_once(SQ_INCLUDE_PATH.
'/system_config.inc');
694 if (!$system_conf->canAcquireLock()) {
695 trigger_localised_error(
'CORE0233', E_USER_NOTICE);
699 $system_conf->acquireLock();
700 $system_conf->save(Array(
'SQ_CONF_SESSION_GC_MAXLIFETIME' => $gc_min + 86400), FALSE, FALSE);
701 $system_conf->releaseLock();
704 if (is_null($pref) || $pref ==
'SQ_USER_SAFE_TYPE3_TRASH') {
706 if (isset($_POST[
'prefs'][
'SQ_USER_SAFE_TYPE3_TRASH'])) {
707 $this->pref_vars[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default'] = $_POST[
'prefs'][
'SQ_USER_SAFE_TYPE3_TRASH'];
709 $this->pref_vars[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default'] = FALSE;
713 if (is_null($pref) || $pref ==
'SQ_USER_COMMIT_BUTTON_POS') {
715 if (isset($_POST[
'prefs'][
'SQ_USER_COMMIT_BUTTON_POS'])) {
716 $this->pref_vars[
'SQ_USER_COMMIT_BUTTON_POS'][
'default'] = $_POST[
'prefs'][
'SQ_USER_COMMIT_BUTTON_POS'];
718 $this->pref_vars[
'SQ_USER_COMMIT_BUTTON_POS'][
'default'] = FALSE;
723 if (is_null($pref) || $pref ==
'SQ_USER_ASSET_MAP_WIDTH') {
724 @$this->int_am_frame_width->process($pref.
'_am_frame_width');
725 if (!empty($this->int_am_frame_width->value)) {
726 $this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'default'] = $this->int_am_frame_width->value;
728 trigger_localised_error(
'CORE0270', E_USER_NOTICE);
729 $this->pref_vars[
'SQ_USER_ASSET_MAP_WIDTH'][
'default'] = $this->int_am_frame_width_default;
733 if (is_null($pref) || $pref ==
'SQ_USER_SET_CONTEXT_ON_LOGIN') {
735 if (isset($_POST[
'prefs'][
'SQ_USER_SET_CONTEXT_ON_LOGIN']) && (strpos($_POST[
'prefs'][
'SQ_USER_SET_CONTEXT_ON_LOGIN'],
'sep') === FALSE)) {
736 $this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'default'] = $_POST[
'prefs'][
'SQ_USER_SET_CONTEXT_ON_LOGIN'];
738 $this->pref_vars[
'SQ_USER_SET_CONTEXT_ON_LOGIN'][
'default'] =
'default';
742 if (is_null($pref) || $pref ==
'SQ_USER_LIMBO_HIDE_FRAMES') {
744 if (isset($_POST[
'prefs'][
'SQ_USER_LIMBO_HIDE_FRAMES'])) {
745 $this->pref_vars[
'SQ_USER_LIMBO_HIDE_FRAMES'][
'default'] = $_POST[
'prefs'][
'SQ_USER_LIMBO_HIDE_FRAMES'];
747 $this->pref_vars[
'SQ_USER_LIMBO_HIDE_FRAMES'][
'default'] = FALSE;
751 if (is_null($pref) || $pref ==
'SQ_USER_FILTER_FRONT_END_INPUT') {
753 if (isset($_POST[
'prefs'][
'SQ_USER_FILTER_FRONT_END_INPUT'])) {
754 $this->pref_vars[
'SQ_USER_FILTER_FRONT_END_INPUT'][
'default'] = $_POST[
'prefs'][
'SQ_USER_FILTER_FRONT_END_INPUT'];
756 $this->pref_vars[
'SQ_USER_FILTER_FRONT_END_INPUT'][
'default'] = FALSE;
760 if (is_null($pref) || $pref ==
'SQ_USER_ATTRIBUTE_IMAGE') {
769 if (isset($_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'face'])) {
770 $new_prefs[
'face'] = $_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'face'];
772 if (isset($_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'size'])) {
773 $new_prefs[
'size'] = $_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'size'];
775 if (isset($_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'hpad'])) {
776 $new_prefs[
'hpad'] = $_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'hpad'];
778 if (isset($_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'vpad'])) {
779 $new_prefs[
'vpad'] = $_POST[
'prefs'][
'SQ_USER_ATTRIBUTE_IMAGE'][
'vpad'];
781 require_once(SQ_ATTRIBUTES_PATH.
'/colour/colour.inc');
783 $fg->process(
'prefs_image_fgcol_');
784 $new_prefs[
'fgcol'] = $fg->value;
786 $bg->process(
'prefs_image_bgcol_');
787 $new_prefs[
'bgcol'] = $bg->value;
788 $this->pref_vars[
'SQ_USER_ATTRIBUTE_IMAGE'][
'default'] = $new_prefs;
814 if (isset($prefs1[
'SQ_USER_SESSION_PREFS'][
'default']) && isset($prefs2[
'SQ_USER_SESSION_PREFS'][
'default'])) {
817 $session_settings_1 = $prefs1[
'SQ_USER_SESSION_PREFS'][
'default'];
818 if (is_array($prefs2[
'SQ_USER_SESSION_PREFS']) && isset($prefs2[
'SQ_USER_SESSION_PREFS'][
'default'])) {
819 $session_settings_2 = $prefs2[
'SQ_USER_SESSION_PREFS'][
'default'];
821 $session_settings_2 = $prefs2[
'SQ_USER_SESSION_PREFS'];
823 $merged[
'persist'] = max($session_settings_1[
'persist'], $session_settings_2[
'persist']);
824 foreach (Array(
'timeout',
'max_length') as $pref_comp) {
825 if (0 == min($session_settings_1[$pref_comp], $session_settings_2[$pref_comp])) {
826 $merged[$pref_comp] = 0;
828 $merged[$pref_comp] = max($session_settings_1[$pref_comp], $session_settings_2[$pref_comp]);
832 $res[
'SQ_USER_SESSION_PREFS'][
'default'] = $merged;
833 }
else if (isset($prefs1[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default']) && isset($prefs2[
'SQ_USER_ASSET_MAP_LINEAGE'])) {
836 $asset_map_settings1 = $prefs1[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'];
837 if (is_array($prefs2[
'SQ_USER_ASSET_MAP_LINEAGE']) && isset($prefs2[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'])) {
838 $asset_map_settings2 = $prefs2[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'];
840 $asset_map_settings2 = $prefs2[
'SQ_USER_ASSET_MAP_LINEAGE'];
843 if (empty($asset_map_settings1) && !empty($asset_map_settings2)) {
844 $asset_map_settings1 = $asset_map_settings2;
845 $asset_map_settings2 =
'';
848 $res[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'] = $asset_map_settings1;
850 if (!empty($asset_map_settings2)) {
851 $res[
'SQ_USER_ASSET_MAP_LINEAGE'][
'default'] .=
','.$asset_map_settings2;
856 if (isset($prefs1[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default']) && isset($prefs2[
'SQ_USER_SAFE_TYPE3_TRASH'])) {
860 $safe_trash1 = $prefs1[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default'];
861 $safe_trash2 = $prefs2[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default'];
862 $res[
'SQ_USER_SAFE_TYPE3_TRASH'][
'default'] = ($safe_trash1 || $safe_trash2) ? TRUE : FALSE;