17 require_once SQ_LIB_PATH.
'/config/config.inc';
39 public $config_vars = Array(
40 'SQ_CONF_PEAR_PATH' => Array(
'editable' => 0,
'default' =>
''),
41 'SQ_CONF_BACKEND_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_admin'),
42 'SQ_CONF_LIMBO_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_edit'),
43 'SQ_CONF_LOGIN_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_login'),
44 'SQ_CONF_NOCACHE_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_nocache'),
45 'SQ_CONF_RECACHE_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_recache'),
46 'SQ_CONF_PERFORMANCE_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_performance'),
47 'SQ_CONF_PERFORMANCE_TIMING_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_performance_timing'),
48 'SQ_CONF_PERFORMANCE_RESULT_SUFFIX' => Array(
'editable' => 1,
'default' =>
'_performance_result'),
49 'SQ_CONF_ASSET_TREE_BASE' => Array(
'editable' => 0,
'default' => 64),
50 'SQ_CONF_ASSET_TREE_SIZE' => Array(
'editable' => 0,
'default' => 4),
51 'SQ_CONF_ASSET_CACHE_SIZE_WEB' => Array(
'editable' => 0,
'default' => -1),
52 'SQ_CONF_ASSET_CACHE_SIZE_CLI' => Array(
'editable' => 0,
'default' => -1),
53 'SQ_CONF_ROLLBACK_ENABLED' => Array(
'editable' => 1,
'default' =>
'0'),
54 'SQ_CONF_DEBUG' => Array(
'editable' => 1,
'default' => 0),
55 'SQ_CONF_SYSTEM_NAME' => Array(
'editable' => 1,
'default' =>
'The System'),
56 'SQ_CONF_SYSTEM_OWNER' => Array(
'editable' => 1,
'default' =>
''),
57 'SQ_CONF_SYSTEM_ROOT_URLS' => Array(
'editable' => 1,
'default' =>
''),
58 'SQ_CONF_SYSTEM_PARENT_DOMAINS' => Array(
'editable' => 1,
'default' =>
''),
59 'SQ_CONF_STATIC_ROOT_URL' => Array(
'editable' => 1,
'default' =>
''),
60 'SQ_CONF_WEB_PATH_SEPARATOR' => Array(
'editable' => 1,
'default' =>
'-'),
61 'SQ_CONF_REDIRECT_URL_WITH_TRAILING_SLASH' => Array(
'editable' => 1,
'default' =>
'1'),
62 'SQ_CONF_STATIC_ROOT_HTTP' => Array(
'editable' => 1,
'default' => TRUE),
63 'SQ_CONF_STATIC_ROOT_HTTPS' => Array(
'editable' => 1,
'default' => FALSE),
64 'SQ_CONF_DEFAULT_EMAIL' => Array(
'editable' => 1,
'default' =>
''),
65 'SQ_CONF_TECH_EMAIL' => Array(
'editable' => 1,
'default' =>
''),
66 'SQ_CONF_MAX_LOGIN_ATTEMPTS' => Array(
'editable' => 1,
'default' => 3),
67 'SQ_CONF_REFRESH_INTERVAL' => Array(
'editable' => 1,
'default' => 120),
68 'SQ_CONF_LOCK_LENGTH' => Array(
'editable' => 1,
'default' => 600),
69 'SQ_CONF_ASSET_MAP_ASSET_LIMIT' => Array(
'editable' => 1,
'default' => 50),
70 'SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME' => Array(
'editable' => 1,
'default' =>
'%asset_short_name%'),
71 'SQ_CONF_SEND_CACHEABLE_HEADER' => Array(
'editable' => 1,
'default' =>
'0'),
72 'SQ_CONF_SEND_LAST_MODIFIED_HEADER' => Array(
'editable' => 1,
'default' =>
'0'),
73 'SQ_CONF_SEND_NOT_MODIFIED_HEADER' => Array(
'editable' => 1,
'default' =>
'0'),
74 'SQ_CONF_SEND_NO_CACHE_HEADER' => Array(
'editable' => 1,
'default' =>
'0'),
75 'SQ_CONF_SEND_404_CACHEABLE_HEADER' => Array(
'editable' => 1,
'default' =>
'0'),
76 'SQ_CONF_USE_HTTP_X_FORWARDED_FOR' => Array(
'editable' => 1,
'default' =>
'0'),
77 'SQ_CONF_FORWARDED_IP_PROXY_LIST' => Array(
'editable' => 1,
'default' =>
''),
78 'SQ_CONF_ERRORS_LOG_TO_SYSLOG' => Array(
'editable' => 1,
'default' => FALSE),
79 'SQ_CONF_ERRORS_SYSLOG_FACILITY' => Array(
'editable' => 1,
'default' =>
'user'),
80 'SQ_CONF_ERRORS_HIDE_FRONTEND' => Array(
'editable' => 1,
'default' => FALSE),
81 'SQ_CONF_DEFAULT_FRONTEND_LANGUAGE' => Array(
'editable' => 1,
'default' =>
'en'),
82 'SQ_CONF_DEFAULT_BACKEND_LOCALE' => Array(
'editable' => 1,
'default' =>
'en_AU'),
83 'SQ_CONF_DEFAULT_CHARACTER_SET' => Array(
'editable' => 1,
'default' =>
'utf-8'),
84 'SQ_CONF_USE_LANG_CHAR_MAP' => Array(
'editable' => 1,
'default' => FALSE),
85 'SQ_CONF_ALLOW_IP_CHANGE' => Array(
'editable' => 1,
'default' =>
'0'),
86 'SQ_CONF_ALLOW_HTTP_LOGIN' => Array(
'editable' => 1,
'default' =>
'0'),
87 'SQ_CONF_ENABLE_HTTP_LOGIN' => Array(
'editable' => 1,
'default' =>
'0'),
88 'SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS' => Array(
'editable' => 1,
'default' => TRUE),
89 'SQ_CONF_HTTP_LOGIN_VAR' => Array(
'editable' => 1,
'default' =>
'REMOTE_USER'),
90 'SQ_CONF_ACCEPT_HTTP_CREDS' => Array(
'editable' => 1,
'default' =>
'0'),
91 'SQ_CONF_COMMIT_BUTTON_TEXT' => Array(
'editable' => 1,
'default' =>
'Commit'),
92 'SQ_CONF_CONFIRM_SAVE_CHANGES' => Array(
'editable' => 1,
'default' =>
'1'),
93 'SQ_CONF_LOG_EXTENSION' => Array(
'editable' => 0,
'default' =>
'.log'),
94 'SQ_CONF_LOG_FILE_SYSTEM' => Array(
'editable' => 0,
'default' =>
'system'),
95 'SQ_CONF_LOG_FILE_ERROR' => Array(
'editable' => 0,
'default' =>
'error'),
96 'SQ_CONF_LOG_ERRORS' => Array(
'editable' => 1,
'default' => TRUE),
97 'SQ_CONF_LOCKING_METHOD' => Array(
'editable' => 0,
'default' =>
'default'),
98 'SQ_CONF_SESSION_HANDLER' => Array(
'editable' => 0,
'default' =>
''),
99 'SQ_CONF_SESSION_GC_MAXLIFETIME' => Array(
'editable' => 1,
'default' => 604800),
100 'SQ_CONF_EDITING_TIME' => Array(
'editable' => 0,
'default' => 3600),
101 'SQ_CONF_NUM_DATA_DIRS' => Array(
'editable' => 0,
'default' => 20),
102 'SQ_CONF_FORCE_SECURE_LOGIN_URLS' => Array(
'editable' => 1,
'default' =>
''),
103 'SQ_CONF_WEB_MEMORY_LIMIT' => Array(
'editable' => 1,
'default' => 64),
104 'SQ_CONF_CRON_MEMORY_LIMIT' => Array(
'editable' => 1,
'default' => 64),
105 'SQ_CONF_USE_DEFAULT_SESSION_SAVE_PATH' => Array(
'editable' => 1,
'default' => FALSE),
106 'SQ_CONF_CUSTOM_SESSION_SAVE_PATH' => Array(
'editable' => 1,
'default' =>
''),
107 'SQ_CONF_ENABLE_ROLES_PERM_SYSTEM' => Array(
'editable' => 1,
'default' => FALSE),
108 'SQ_CONF_ENABLE_ROLES_WF_SYSTEM' => Array(
'editable' => 1,
'default' => FALSE),
109 'SQ_CONF_ENABLE_GLOBAL_ROLES' => Array(
'editable' => 1,
'default' => FALSE),
110 'SQ_CONF_NO_ASSET_SELF_LINKS' => Array(
'editable' => 1,
'default' => FALSE),
111 'SQ_CONF_TIMEZONE' => Array(
'editable' => 1,
'default' =>
'Australia/Sydney'),
112 'SQ_CONF_FORCE_LOWERCASE_USERNAME' => Array(
'editable' => 0,
'default' => FALSE),
113 'SQ_LICENCE_INSTALL_KEY' => Array(
'editable' => 1,
'default' =>
''),
114 'SQ_LICENCE_WARRANTY_KEY' => Array(
'editable' => 1,
'default' =>
''),
115 'SQ_CONF_COOKIE_OPTION_HTTP_ONLY' => Array(
'editable' => 1,
'default' => FALSE),
116 'SQ_CONF_COOKIE_OPTION_SECURE' => Array(
'editable' => 1,
'default' => FALSE),
117 'SQ_CONF_USE_SECURITY_TOKEN' => Array(
'editable' => 0,
'default' => TRUE),
126 private $debug_options = Array(
127 1 =>
'Show File and Line number in error messages',
128 2 =>
'Show Stack Trace in error messages',
129 4 =>
'Show additional information about memory and performance',
141 parent::__construct();
142 $this->config_file = SQ_DATA_PATH.
'/private/conf/main.inc';
158 public function save($vars, $backup_existing=FALSE, $send_message=TRUE)
160 if (isset($GLOBALS[
'SQ_SYSTEM'])) {
161 if ($GLOBALS[
'SQ_SYSTEM']->runLevelEnables(SQ_SECURITY_PERMISSIONS)) {
163 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
164 $is_admin = ($is_root || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
168 trigger_localised_error(
'SYS0267', E_USER_WARNING, $this->name);
176 if ($GLOBALS[
'SQ_SYSTEM']->runLevelEnables(SQ_SECURITY_DATA_VALIDATION)) {
180 unset($vars[
'SQ_CONF_MAX_LOGIN_ATTEMPTS']);
181 unset($vars[
'SQ_CONF_LOG_ERRORS']);
182 unset($vars[
'SQ_CONF_ERRORS_HIDE_FRONTEND']);
183 unset($vars[
'SQ_CONF_ERRORS_LOG_TO_SYSLOG']);
184 unset($vars[
'SQ_CONF_BACKEND_SUFFIX']);
185 unset($vars[
'SQ_CONF_LIMBO_SUFFIX']);
186 unset($vars[
'SQ_CONF_LOGIN_SUFFIX']);
187 unset($vars[
'SQ_CONF_ROLLBACK_ENABLED']);
188 unset($vars[
'SQ_CONF_WEB_MEMORY_LIMIT']);
189 unset($vars[
'SQ_CONF_CRON_MEMORY_LIMIT']);
192 if (isset($vars[
'SQ_CONF_FORCE_SECURE_LOGIN_URLS'])) {
193 if(empty($vars[
'SQ_CONF_FORCE_SECURE_LOGIN_URLS'])) {
194 $vars[
'SQ_CONF_FORCE_SECURE_LOGIN_URLS'] =
'';
197 $vars[
'SQ_CONF_FORCE_SECURE_LOGIN_URLS'] = implode(
"\n", $vars[
'SQ_CONF_FORCE_SECURE_LOGIN_URLS']);
201 if (isset($vars[
'SQ_CONF_STATIC_ROOT_URL']) && substr($vars[
'SQ_CONF_STATIC_ROOT_URL'], -1) ==
'/') {
202 $vars[
'SQ_CONF_STATIC_ROOT_URL'] = substr($vars[
'SQ_CONF_STATIC_ROOT_URL'], 0, strlen($vars[
'SQ_CONF_STATIC_ROOT_URL']) -1);
204 foreach (Array(
'SQ_CONF_REFRESH_INTERVAL',
'SQ_CONF_LOCK_LENGTH') as $var_name) {
205 if (isset($vars[$var_name])) {
206 $vars[$var_name] = max(60, (
int) $vars[$var_name]);
209 if (isset($vars[
'SQ_LICENCE_WARRANTY_KEY'])) {
210 $vars[
'SQ_LICENCE_WARRANTY_KEY'] = trim($vars[
'SQ_LICENCE_WARRANTY_KEY']);
216 return parent::save($vars, $backup_existing, $send_message);
234 case 'SQ_CONF_PEAR_PATH' :
236 if ($var_export && substr($value, 0, strlen(SQ_SYSTEM_ROOT)) == SQ_SYSTEM_ROOT) {
237 if (!parent::_paintConfigVar($var_name,
'SQ_SYSTEM_ROOT.'.var_export(substr($value, strlen(SQ_SYSTEM_ROOT)), TRUE), FALSE)) {
241 if (!parent::_paintConfigVar($var_name, $value, $var_export)) {
246 $sep = (substr(PHP_OS, 0, 3) ==
'WIN') ?
';' :
':';
251 echo
"\$inc_dir = ini_get('include_path');\n";
252 echo
"\$inc_dir = (substr(\$inc_dir, 0, 2) == '.".$sep.
"') ? '.".$sep.
"'.SQ_CONF_PEAR_PATH.'".$sep.
"'.substr(\$inc_dir, 2) : SQ_CONF_PEAR_PATH.'".$sep.
"'.\$inc_dir;\n";
253 echo
"ini_set('include_path', \$inc_dir);\n\n";
259 case 'SQ_CONF_LOG_ERRORS' :
260 if (!parent::_paintConfigVar($var_name, $value, $var_export)) {
265 if ($value) echo
"ini_set('log_errors', '1');\n";
271 case 'SQ_CONF_LOG_FILE_ERROR' :
272 $value = trim($value);
283 $value = basename($value);
284 if (!empty($value)) {
285 $value = $this->config_vars[$var_name][
'default'];
288 if (!parent::_paintConfigVar($var_name, $value, $var_export)) {
292 echo
"ini_set('error_log', SQ_LOG_PATH.'/'.SQ_CONF_LOG_FILE_ERROR.SQ_CONF_LOG_EXTENSION);\n";
297 case 'SQ_CONF_SYSTEM_ROOT_URLS' :
298 case 'SQ_CONF_STATIC_ROOT_URL' :
299 case 'SQ_CONF_FORWARDED_IP_PROXY_LIST' :
300 return parent::_paintConfigVar($var_name, trim($value), $var_export);
303 case 'SQ_CONF_SESSION_GC_MAXLIFETIME' :
304 if (!parent::_paintConfigVar($var_name, $value, $var_export)) {
307 echo
"ini_set('session.gc_maxlifetime', $value);\n";
312 return parent::_paintConfigVar($var_name, $value, $var_export);
329 return ($GLOBALS[
'SQ_SYSTEM']->userRoot() || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
342 if (!parent::writeAccess())
return FALSE;
343 if (!isset($GLOBALS[
'SQ_SYSTEM']))
return TRUE;
344 if (!$GLOBALS[
'SQ_SYSTEM']->runLevelEnables(SQ_SECURITY_PERMISSIONS)) {
349 return ($GLOBALS[
'SQ_SYSTEM']->userRoot() || $GLOBALS[
'SQ_SYSTEM']->userSystemAdmin());
368 parent::paintBackend($o);
372 $is_root = $GLOBALS[
'SQ_SYSTEM']->userRoot();
374 $class = get_class_lower($this);
376 $o->openSection(translate(
'system_settings'));
378 $o->openField(translate(
'system_name'));
380 text_box($class.
'[SQ_CONF_SYSTEM_NAME]', SQ_CONF_SYSTEM_NAME, 30);
382 echo SQ_CONF_SYSTEM_NAME;
386 $o->openField(translate(
'system_owner'));
388 text_box($class.
'[SQ_CONF_SYSTEM_OWNER]', SQ_CONF_SYSTEM_OWNER, 30);
390 echo SQ_CONF_SYSTEM_OWNER;
394 $o->openField(translate(
'system_backend_suffix'));
396 text_box($class.
'[SQ_CONF_BACKEND_SUFFIX]', SQ_CONF_BACKEND_SUFFIX, 15);
398 echo nl2br(SQ_CONF_BACKEND_SUFFIX);
401 $o->openField(translate(
'system_simple_edit_suffix'));
403 text_box($class.
'[SQ_CONF_LIMBO_SUFFIX]', SQ_CONF_LIMBO_SUFFIX, 15);
405 echo nl2br(SQ_CONF_LIMBO_SUFFIX);
408 $o->openField(translate(
'system_login_suffix'));
410 text_box($class.
'[SQ_CONF_LOGIN_SUFFIX]', SQ_CONF_LOGIN_SUFFIX, 15);
412 echo nl2br(SQ_CONF_LOGIN_SUFFIX);
415 $o->openField(translate(
'system_nocache_suffix'));
417 text_box($class.
'[SQ_CONF_NOCACHE_SUFFIX]', SQ_CONF_NOCACHE_SUFFIX, 15);
419 echo nl2br(SQ_CONF_NOCACHE_SUFFIX);
422 $o->openField(translate(
'system_recache_suffix'));
424 text_box($class.
'[SQ_CONF_RECACHE_SUFFIX]', SQ_CONF_RECACHE_SUFFIX, 15);
426 echo nl2br(SQ_CONF_RECACHE_SUFFIX);
429 $o->openField(translate(
'system_performance_suffix'));
431 text_box($class.
'[SQ_CONF_PERFORMANCE_SUFFIX]', SQ_CONF_PERFORMANCE_SUFFIX, 15);
433 echo nl2br(SQ_CONF_PERFORMANCE_SUFFIX);
436 $o->openField(translate(
'system_timezone'));
438 text_box($class.
'[SQ_CONF_TIMEZONE]', SQ_CONF_TIMEZONE, 15);
440 echo nl2br(SQ_CONF_TIMEZONE);
444 $o->openSection(translate(
'system_urls'));
446 require_once SQ_ATTRIBUTES_PATH.
'/option_list/option_list.inc';
449 $option_list->setEditParam(
'width', 60);
451 $o->openField(translate(
'system_root_urls'));
453 $option_list->value = SQ_CONF_SYSTEM_ROOT_URLS;
454 $option_list->paint(
'SQ_CONF_SYSTEM_ROOT_URLS');
456 echo nl2br(SQ_CONF_SYSTEM_ROOT_URLS);
460 $o->openField(translate(
'system_parent_domains'));
462 $option_list->value = SQ_CONF_SYSTEM_PARENT_DOMAINS;
463 $option_list->paint(
'SQ_CONF_SYSTEM_PARENT_DOMAINS');
465 if (SQ_CONF_SYSTEM_PARENT_DOMAINS ==
'') {
466 echo translate(
'none');
468 echo nl2br(SQ_CONF_SYSTEM_PARENT_DOMAINS);
471 $o->note(translate(
'system_parent_domains_note'));
474 $o->openField(translate(
'system_static_url'));
475 if ($write_access && $is_root) {
476 text_box($class.
'[SQ_CONF_STATIC_ROOT_URL]', SQ_CONF_STATIC_ROOT_URL, 80);
478 if (SQ_CONF_STATIC_ROOT_URL ==
'') {
479 echo translate(
'not_set');
481 echo SQ_CONF_STATIC_ROOT_URL;
484 $o->note(translate(
'system_static_url_note'));
487 $o->openField(translate(
'system_static_url_http'));
488 if ($write_access && $is_root) {
489 combo_box($class.
'[SQ_CONF_STATIC_ROOT_HTTP]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_STATIC_ROOT_HTTP);
491 echo (SQ_CONF_STATIC_ROOT_HTTP) ? translate(
'yes') : translate(
'no');
495 $o->openField(translate(
'system_static_url_https'));
496 if ($write_access && $is_root) {
497 combo_box($class.
'[SQ_CONF_STATIC_ROOT_HTTPS]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_STATIC_ROOT_HTTPS);
499 echo (SQ_CONF_STATIC_ROOT_HTTPS) ? translate(
'yes') : translate(
'no');
503 $o->openField(translate(
'system_web_path_separator'));
505 text_box($class.
'[SQ_CONF_WEB_PATH_SEPARATOR]', SQ_CONF_WEB_PATH_SEPARATOR, 1, 1);
507 echo nl2br(SQ_CONF_WEB_PATH_SEPARATOR);
511 $o->openField(translate(
'system_redirect_url_with_trailing_slash'));
512 if ($write_access && $is_root) {
513 combo_box($class.
'[SQ_CONF_REDIRECT_URL_WITH_TRAILING_SLASH]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_REDIRECT_URL_WITH_TRAILING_SLASH);
515 echo (SQ_CONF_REDIRECT_URL_WITH_TRAILING_SLASH) ? translate(
'yes') : translate(
'no');
517 $o->note(translate(
'system_redirect_url_with_trailing_slash_note'));
522 $o->openSection(translate(
'rollback_settings'));
524 $o->openField(translate(
'rollback_enabled'));
525 echo (SQ_CONF_ROLLBACK_ENABLED) ? translate(
'yes') : translate(
'no');
526 $o->note(translate(
'must_enable_rollback'));
531 $o->openSection(translate(
'email_settings'));
533 $o->openField(translate(
'default_email'));
535 text_box($class.
'[SQ_CONF_DEFAULT_EMAIL]', SQ_CONF_DEFAULT_EMAIL, 50);
537 echo SQ_CONF_DEFAULT_EMAIL;
541 $o->openField(translate(
'tech_email'));
543 text_box($class.
'[SQ_CONF_TECH_EMAIL]', SQ_CONF_TECH_EMAIL, 50);
545 echo SQ_CONF_TECH_EMAIL;
551 $o->openSection(translate(
'login/session_settings'));
553 $o->openField(translate(
'force_secure_login_urls'));
554 $root_urls = explode(
"\n", SQ_CONF_SYSTEM_ROOT_URLS);
555 $force_secure_urls = explode(
"\n", SQ_CONF_FORCE_SECURE_LOGIN_URLS);
557 <table
class=
"sq-backend-table" style=
"width: auto">
560 <th><?php echo translate(
'url'); ?></th>
561 <th><?php echo translate(
'require_secure_login'); ?></th>
566 foreach ($root_urls as $i => $url) {
569 <td><?php echo $url; ?></td>
573 check_box($class.
'[SQ_CONF_FORCE_SECURE_LOGIN_URLS][]', $url, in_array($url, $force_secure_urls));
575 $filename = in_array($url, $force_secure_urls) ?
'tick' :
'cross';
576 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.$filename.
'.gif" />';
587 $o->note(translate(
'force_secure_login_urls_note'));
589 $o->openField(translate(
'max_login_attempts'));
590 if ($write_access && $is_root) {
591 text_box($class.
'[SQ_CONF_MAX_LOGIN_ATTEMPTS]', SQ_CONF_MAX_LOGIN_ATTEMPTS, 5, 5);
593 echo SQ_CONF_MAX_LOGIN_ATTEMPTS;
595 $o->note(translate(
'0_is_unlimited_attempts'));
597 $o->openField(translate(
'allow_ip_change'));
598 if ($write_access && $is_root) {
599 combo_box($class.
'[SQ_CONF_ALLOW_IP_CHANGE]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ALLOW_IP_CHANGE);
601 echo (SQ_CONF_ALLOW_IP_CHANGE) ? translate(
'yes') : translate(
'no');
603 $o->note(translate(
'allow_user_ip_to_fluctuate'));
605 $o->openField(translate(
'process_php_credentials'));
606 if ($write_access && $is_root) {
607 combo_box($class.
'[SQ_CONF_ACCEPT_HTTP_CREDS]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ACCEPT_HTTP_CREDS);
609 echo (SQ_CONF_ACCEPT_HTTP_CREDS) ? translate(
'yes') : translate(
'no');
611 $o->note(translate(
'process_php_credentials_note'));
613 $o->openField(translate(
'enable_http_authentication'));
614 if ($write_access && $is_root) {
615 combo_box($class.
'[SQ_CONF_ENABLE_HTTP_LOGIN]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ENABLE_HTTP_LOGIN);
617 echo (SQ_CONF_ENABLE_HTTP_LOGIN) ? translate(
'yes') : translate(
'no');
619 $o->note(translate(
'enable_http_authentication_note'));
621 $o->openField(translate(
'allow_single_sign_in'));
622 if ($write_access && $is_root) {
623 combo_box($class.
'[SQ_CONF_ALLOW_HTTP_LOGIN]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ALLOW_HTTP_LOGIN);
625 echo (SQ_CONF_ALLOW_HTTP_LOGIN) ? translate(
'yes') : translate(
'no');
627 $o->note(translate(
'allow_single_sign_in_note'));
629 $o->openField(translate(
'http_login_var'));
630 if ($write_access && $is_root) {
632 $server = array_keys($_SERVER);
636 <script language=
"JavaScript" type=
"text/javascript">
638 function toggle_http_login_var() {
639 list = document.getElementById(
'sq-conf-http-login-var-list');
640 txt = document.getElementById(
'sq-conf-http-login-var-toggle');
642 list.style.display = (list.style.display ==
'none' ?
'block' :
'none');
643 txt.innerHTML = js_translate(
'http_login_var_' + (list.style.display ==
'none' ?
'show' :
'hide') +
'_server_var');
650 text_box($class.
'[SQ_CONF_HTTP_LOGIN_VAR]', SQ_CONF_HTTP_LOGIN_VAR, 40,
'', FALSE ,
'id="sq-conf-http-login-var"');
654 <span
id=
"sq-conf-http-login-var-toggle" class=
"clickable" onclick=toggle_http_login_var();><?php echo translate(
'http_login_var_show_server_var');?></span>
655 <div
id=
"sq-conf-http-login-var-list" style=
"display:none;">
656 <table
class=
"sq-backend-table" width=
"400">
659 <?php echo translate(
'http_login_var_list_header');?>
665 if (!empty($server)) {
667 for ($i=0; $i <
sizeof($server); $i++) {
669 if ($i == round(
sizeof($server)/2)) {
670 echo
'</ul></td><td ><ul>';
673 <span
class=
"clickable" onclick=
"elt=document.getElementById('sq-conf-http-login-var'); if(elt) elt.value='<?php echo $server[$i];?>';">
674 <?php echo $server[$i];?>
687 echo SQ_CONF_HTTP_LOGIN_VAR;
690 $o->openField(translate(
'enable_external_auth_systems'));
691 if ($write_access && $is_root) {
692 combo_box($class.
'[SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS);
694 echo (SQ_CONF_ENABLE_EXTERNAL_AUTH_SYSTEMS) ? translate(
'yes') : translate(
'no');
696 $o->note(translate(
'enable_external_auth_systems_note'));
698 $o->openField(translate(
'choose_session_save_path'));
699 if ($write_access && $is_root) {
700 combo_box($class.
'[SQ_CONF_USE_DEFAULT_SESSION_SAVE_PATH]', Array(
'1' => translate(
'true'),
'0' => translate(
'false')), FALSE, SQ_CONF_USE_DEFAULT_SESSION_SAVE_PATH);
702 echo (SQ_CONF_USE_DEFAULT_SESSION_SAVE_PATH) ? translate(
'true') : translate(
'false');
704 $o->note(translate(
'choose_session_save_path_note', session_save_path()));
708 $o->openSection(translate(
'intervals'));
710 $o->openField(translate(
'refresh_interval'));
712 text_box($class.
'[SQ_CONF_REFRESH_INTERVAL]', SQ_CONF_REFRESH_INTERVAL, 5, 5);
714 echo SQ_CONF_REFRESH_INTERVAL;
716 $o->note(translate(
'header_frame_mail_lock'));
718 $o->openField(translate(
'lock_length'));
720 text_box($class.
'[SQ_CONF_LOCK_LENGTH]', SQ_CONF_LOCK_LENGTH, 5, 5);
722 echo SQ_CONF_LOCK_LENGTH;
724 $o->closeField(translate(
'lock_length_time'));
728 $o->openSection(translate(
'php_config_settings'));
730 $o->openField(translate(
'php_config_web_memory_limit'));
731 if ($write_access && $is_root) {
732 int_text_box($class.
'[SQ_CONF_WEB_MEMORY_LIMIT]', SQ_CONF_WEB_MEMORY_LIMIT, FALSE, 5, NULL, NULL, 3);
735 echo SQ_CONF_WEB_MEMORY_LIMIT.
'MB';
737 $o->note(translate(
'php_config_web_memory_limit_note'));
740 $o->openField(translate(
'php_config_cron_memory_limit'));
741 if ($write_access && $is_root) {
742 int_text_box($class.
'[SQ_CONF_CRON_MEMORY_LIMIT]', SQ_CONF_CRON_MEMORY_LIMIT, FALSE, 5, NULL, NULL, 3);
745 echo SQ_CONF_CRON_MEMORY_LIMIT.
'MB';
747 $o->note(translate(
'php_config_cron_memory_limit_note'));
753 $o->openSection(translate(
'error/debug_settings'));
755 $o->openField(translate(
'log_errors'));
756 if ($write_access && $is_root) {
757 combo_box($class.
'[SQ_CONF_LOG_ERRORS]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_LOG_ERRORS);
759 echo (SQ_CONF_LOG_ERRORS) ? translate(
'yes') : translate(
'no');
763 $o->openField(translate(
'hide_errors_on_the_frontend'));
764 if ($write_access && $is_root) {
765 combo_box($class.
'[SQ_CONF_ERRORS_HIDE_FRONTEND]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ERRORS_HIDE_FRONTEND);
767 echo (SQ_CONF_ERRORS_HIDE_FRONTEND) ? translate(
'yes') : translate(
'no');
771 $o->openField(translate(
'log_errors_to_syslog'));
772 if ($write_access && $is_root) {
773 combo_box($class.
'[SQ_CONF_ERRORS_LOG_TO_SYSLOG]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ERRORS_LOG_TO_SYSLOG);
775 echo (SQ_CONF_ERRORS_LOG_TO_SYSLOG) ? translate(
'yes') : translate(
'no');
777 $o->note(translate(
'log_errors_to_syslog_note'));
780 $o->openField(translate(
'log_errors_syslog_facility'));
783 'user' => translate(
'syslog_facility_user'),
784 'local0' => translate(
'syslog_facility_local', 0),
785 'local1' => translate(
'syslog_facility_local', 1),
786 'local2' => translate(
'syslog_facility_local', 2),
787 'local3' => translate(
'syslog_facility_local', 3),
788 'local4' => translate(
'syslog_facility_local', 4),
789 'local5' => translate(
'syslog_facility_local', 5),
790 'local6' => translate(
'syslog_facility_local', 6),
791 'local7' => translate(
'syslog_facility_local', 7),
793 if ($write_access && $is_root) {
794 combo_box($class.
'[SQ_CONF_ERRORS_SYSLOG_FACILITY]', $options, FALSE, SQ_CONF_ERRORS_SYSLOG_FACILITY);
796 echo $options[SQ_CONF_ERRORS_SYSLOG_FACILITY];
799 $o->openField(translate(
'debug_settings'));
800 if ($write_access && $is_root) {
802 <script language=
"JavaScript" type=
"text/javascript">
804 function set_conf_debug(adding, bit) {
806 var current_debug = parseInt(get_form_element_value(
"<?php echo $class; ?>[SQ_CONF_DEBUG]"), 10);
807 if (isNaN(current_debug))
return;
810 current_debug |= bit;
812 current_debug &= ~bit;
815 set_hidden_field(
"<?php echo $class; ?>[SQ_CONF_DEBUG]", current_debug);
822 hidden_field($class.
'[SQ_CONF_DEBUG]', SQ_CONF_DEBUG);
823 foreach ($this->debug_options as $bit => $desc) {
824 check_box($class.
'_SQ_CONF_DEBUG_'.$bit, $bit, (
bool)(SQ_CONF_DEBUG & $bit),
'set_conf_debug(this.checked, '.$bit.
');');
825 echo $desc,
"<br />\n";
828 foreach ($this->debug_options as $bit => $desc) {
830 <img src=
"<?php echo sq_web_path('lib'); ?>/web/images/<?php echo (SQ_CONF_DEBUG & $bit) ? 'tick' : 'cross'; ?>.gif" width=
"15" height=
"15" />
832 echo $desc,
"<br />\n";
839 $o->openSection(translate(
'internationalisation_settings'));
841 $o->openField(translate(
'default_frontend_language'));
842 require SQ_FUDGE_PATH.
'/standards_lists/languages.inc';
844 combo_box($class.
'[SQ_CONF_DEFAULT_FRONTEND_LANGUAGE]', $standards_lists_languages, FALSE, SQ_CONF_DEFAULT_FRONTEND_LANGUAGE);
846 echo $standards_lists_languages[SQ_CONF_DEFAULT_FRONTEND_LANGUAGE];
849 $o->openField(translate(
'default_backend_locale'));
850 require SQ_FUDGE_PATH.
'/standards_lists/locales.inc';
852 $current_locale = !defined(
'SQ_CONF_DEFAULT_BACKEND_LOCALE') ?
'en_AU' : SQ_CONF_DEFAULT_BACKEND_LOCALE;
854 combo_box($class.
'[SQ_CONF_DEFAULT_BACKEND_LOCALE]', $standards_lists_locales, FALSE, $current_locale);
856 echo $standards_lists_locales[$current_locale];
859 $o->openField(translate(
'default_character_set'));
860 require SQ_FUDGE_PATH.
'/standards_lists/character_sets.inc';
862 combo_box($class.
'[SQ_CONF_DEFAULT_CHARACTER_SET]', $standards_lists_character_sets, FALSE, SQ_CONF_DEFAULT_CHARACTER_SET);
864 echo $standards_lists_character_sets[SQ_CONF_DEFAULT_CHARACTER_SET];
867 $o->openField(translate(
'use_lang_character_map'));
870 '0' => translate(
'no'),
871 '1' => translate(
'yes'),
873 combo_box($class.
'[SQ_CONF_USE_LANG_CHAR_MAP]', $options, FALSE, !defined(
'SQ_CONF_USE_LANG_CHAR_MAP') ?
'0' : SQ_CONF_USE_LANG_CHAR_MAP);
875 echo (SQ_CONF_USE_LANG_CHAR_MAP) ? translate(
'yes') : translate(
'no');
880 $o->openSection(translate(
'editing_interface_settings'));
882 $o->openField(translate(
'commit_button_text'));
884 text_box($class.
'[SQ_CONF_COMMIT_BUTTON_TEXT]', !defined(
'SQ_CONF_COMMIT_BUTTON_TEXT') ?
'Commit' : SQ_CONF_COMMIT_BUTTON_TEXT, 30);
886 echo !defined(
'SQ_CONF_COMMIT_BUTTON_TEXT') ?
'Commit' : SQ_CONF_COMMIT_BUTTON_TEXT;
888 $o->note(translate(
'rename_commit_button'));
891 $o->openField(translate(
'confirm_save_changes'));
894 '0' => translate(
'no'),
895 '1' => translate(
'yes'),
897 combo_box($class.
'[SQ_CONF_CONFIRM_SAVE_CHANGES]', $options, FALSE, !defined(
'SQ_CONF_CONFIRM_SAVE_CHANGES') ?
'1' : SQ_CONF_CONFIRM_SAVE_CHANGES);
899 if (defined(
'SQ_CONF_CONFIRM_SAVE_CHANGES')) {
901 <img src=
"<?php echo sq_web_path('lib'); ?>/web/images/<?php echo (SQ_CONF_CONFIRM_SAVE_CHANGES) ? 'tick' : 'cross'; ?>.gif" width=
"15" height=
"15" />
904 echo translate(
'not_set');
907 $o->note(translate(
'confirm_save_changes_msg'));
912 $o->openSection(translate(
'asset_map_settings'));
914 $o->openField(translate(
'asset_limit_per_node'));
916 text_box($class.
'[SQ_CONF_ASSET_MAP_ASSET_LIMIT]', !defined(
'SQ_CONF_ASSET_MAP_ASSET_LIMIT') ?
'50' : SQ_CONF_ASSET_MAP_ASSET_LIMIT, 30);
918 echo !defined(
'SQ_CONF_ASSET_MAP_ASSET_LIMIT') ?
'50' : SQ_CONF_ASSET_MAP_ASSET_LIMIT;
920 $o->note(translate(
'asset_limit_per_node_note'));
923 $o->openField(translate(
'asset_display_name'));
925 text_box($class.
'[SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME]', !defined(
'SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME') ? $this->config_vars[
'SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME'][
'default'] : SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME, 50);
927 echo !defined(
'SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME') ? $this->config_vars[
'SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME'][
'default'] : SQ_CONF_ASSET_MAP_ASSET_DISPLAY_NAME;
929 $o->note(translate(
'asset_display_name_note'));
934 $o->openSection(translate(
'http_header_section_name'));
936 $o->openField(translate(
'http_header_cacheable_field'));
937 if ($write_access && $is_root) {
938 combo_box($class.
'[SQ_CONF_SEND_CACHEABLE_HEADER]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_SEND_CACHEABLE_HEADER);
940 echo (SQ_CONF_SEND_CACHEABLE_HEADER) ? translate(
'yes') : translate(
'no');
942 $o->note(translate(
'http_header_cacheable_field_note'));
945 $o->openField(translate(
'http_header_last_modified_field'));
946 if ($write_access && $is_root) {
947 combo_box($class.
'[SQ_CONF_SEND_LAST_MODIFIED_HEADER]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_SEND_LAST_MODIFIED_HEADER);
949 echo (SQ_CONF_SEND_LAST_MODIFIED_HEADER) ? translate(
'yes') : translate(
'no');
951 $o->note(translate(
'http_header_last_modified_field_note'));
954 $o->openField(translate(
'http_header_not_modified_field'));
955 if ($write_access && $is_root) {
956 combo_box($class.
'[SQ_CONF_SEND_NOT_MODIFIED_HEADER]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_SEND_NOT_MODIFIED_HEADER);
958 echo (SQ_CONF_SEND_NOT_MODIFIED_HEADER) ? translate(
'yes') : translate(
'no');
960 $o->note(translate(
'http_header_not_modified_field_note'));
961 $o->note(translate(
'http_header_conditional_note'));
964 $o->openField(translate(
'http_header_send_no_cache_header_field'));
965 if ($write_access && $is_root) {
966 combo_box($class.
'[SQ_CONF_SEND_NO_CACHE_HEADER]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_SEND_NO_CACHE_HEADER);
968 echo (SQ_CONF_SEND_NO_CACHE_HEADER) ? translate(
'yes') : translate(
'no');
970 $o->note(translate(
'http_header_send_no_cache_header_field_note'));
973 $o->openField(translate(
'http_header_send_404_cacheable_header_field'));
974 if ($write_access && $is_root) {
975 combo_box($class.
'[SQ_CONF_SEND_404_CACHEABLE_HEADER]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_SEND_404_CACHEABLE_HEADER);
977 echo (SQ_CONF_SEND_404_CACHEABLE_HEADER) ? translate(
'yes') : translate(
'no');
979 $o->note(translate(
'http_header_send_404_cacheable_header_field_note'));
982 $o->openField(translate(
'http_header_use_http_x_forwarded_for'));
983 if ($write_access && $is_root) {
984 combo_box($class.
'[SQ_CONF_USE_HTTP_X_FORWARDED_FOR]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_USE_HTTP_X_FORWARDED_FOR);
986 echo (SQ_CONF_USE_HTTP_X_FORWARDED_FOR) ? translate(
'yes') : translate(
'no');
988 $o->note(translate(
'http_header_use_http_x_forwarded_for_note'));
990 $option_list->setEditParam(
'width', 30);
992 $option_list->value = SQ_CONF_FORWARDED_IP_PROXY_LIST;
993 $option_list->paint(
'SQ_CONF_FORWARDED_IP_PROXY_LIST');
995 if (SQ_CONF_FORWARDED_IP_PROXY_LIST ==
'') {
996 echo translate(
'none');
998 echo nl2br(SQ_CONF_FORWARDED_IP_PROXY_LIST);
1003 $o->openField(translate(
'http_header_cookie_http_only_field_name'));
1004 if ($write_access && $is_root) {
1005 combo_box($class.
'[SQ_CONF_COOKIE_OPTION_HTTP_ONLY]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_COOKIE_OPTION_HTTP_ONLY);
1007 echo (SQ_CONF_COOKIE_OPTION_HTTP_ONLY) ? translate(
'yes') : translate(
'no');
1009 $o->note(translate(
'http_header_cookie_http_only_note'));
1013 $o->openField(translate(
'http_header_cookie_secure_option_field_name'));
1014 if ($write_access && $is_root) {
1015 combo_box($class.
'[SQ_CONF_COOKIE_OPTION_SECURE]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_COOKIE_OPTION_SECURE);
1017 echo (SQ_CONF_COOKIE_OPTION_SECURE) ? translate(
'yes') : translate(
'no');
1019 $o->note(translate(
'http_header_cookie_secure_option_note'));
1027 $o->openSection(translate(
'roles_configuration_section_name'));
1029 $o->openField(translate(
'roles_configuration_enable_roles_perm_system'));
1030 if ($write_access && $is_root) {
1031 combo_box($class.
'[SQ_CONF_ENABLE_ROLES_PERM_SYSTEM]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ENABLE_ROLES_PERM_SYSTEM);
1033 echo (SQ_CONF_ENABLE_ROLES_PERM_SYSTEM) ? translate(
'yes') : translate(
'no');
1037 $o->openField(translate(
'roles_configuration_enable_roles_wf_system'));
1038 if ($write_access && $is_root) {
1039 combo_box($class.
'[SQ_CONF_ENABLE_ROLES_WF_SYSTEM]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ENABLE_ROLES_WF_SYSTEM);
1041 echo (SQ_CONF_ENABLE_ROLES_WF_SYSTEM) ? translate(
'yes') : translate(
'no');
1045 if ( ((defined(
'SQ_CONF_ENABLE_ROLES_PERM_SYSTEM') && (SQ_CONF_ENABLE_ROLES_PERM_SYSTEM ==
'1')) || (defined(
'SQ_CONF_ENABLE_ROLES_WF_SYSTEM') && (SQ_CONF_ENABLE_ROLES_WF_SYSTEM ==
'1')) ) || (!defined(
'SQ_CONF_ENABLE_ROLES_PERM_SYSTEM') && !defined(
'SQ_CONF_ENABLE_ROLES_WF_SYSTEM') )) {
1046 $o->openField(translate(
'roles_configuration_enable_global_roles'));
1047 if ($write_access && $is_root) {
1048 combo_box($class.
'[SQ_CONF_ENABLE_GLOBAL_ROLES]', Array(
'1' => translate(
'yes'),
'0' => translate(
'no')), FALSE, SQ_CONF_ENABLE_GLOBAL_ROLES);
1050 echo (SQ_CONF_ENABLE_GLOBAL_ROLES) ? translate(
'yes') : translate(
'no');
1057 $o->openSection(translate(
'search_engine_optimizations'));
1059 $o->openField(translate(
'remove_self_links'));
1060 if ($write_access) {
1062 '0' => translate(
'no'),
1063 '1' => translate(
'yes'),
1065 combo_box($class.
'[SQ_CONF_NO_ASSET_SELF_LINKS]', $options, FALSE, !defined(
'SQ_CONF_NO_ASSET_SELF_LINKS') ?
'0' : SQ_CONF_NO_ASSET_SELF_LINKS);
1067 echo (SQ_CONF_NO_ASSET_SELF_LINKS) ? translate(
'yes') : translate(
'no');
1069 $o->note(translate(
'remove_self_links_note'));
1074 $o->openSection(translate(
'install_and_warranty_key'));
1076 $o->openField(translate(
'install_key'));
1077 echo SQ_LICENCE_INSTALL_KEY;
1078 $o->note(translate(
'system_config_install_key_note'));
1081 $o->openField(translate(
'warranty_key'));
1082 if ($write_access) {
1083 text_box($class.
'[SQ_LICENCE_WARRANTY_KEY]', !defined(
'SQ_LICENCE_WARRANTY_KEY') ?
'' : SQ_LICENCE_WARRANTY_KEY, 30);
1085 echo SQ_LICENCE_WARRANTY_KEY;
1091 if ($write_access) $o->commitButton(
'', TRUE);
1108 if (!$write_access)
return parent::processBackend($o);
1110 $class = get_class_lower($this);
1112 require_once SQ_ATTRIBUTES_PATH.
'/option_list/option_list.inc';
1115 $list_settings = Array(
1116 'SQ_CONF_SYSTEM_ROOT_URLS',
1117 'SQ_CONF_SYSTEM_PARENT_DOMAINS',
1118 'SQ_CONF_FORWARDED_IP_PROXY_LIST'
1121 foreach ($list_settings as $list_setting) {
1122 $option_list->process($list_setting);
1123 $_POST[$class][$list_setting] = $option_list->value;
1126 $roles_changed = (isset($_POST[
'system_config'][
'SQ_CONF_ENABLE_ROLES_PERM_SYSTEM']) || isset($_POST[
'system_config'][
'SQ_CONF_ENABLE_ROLES_WF_SYSTEM']) || isset($_POST[
'system_config'][
'SQ_CONF_ENABLE_GLOBAL_ROLES']));
1128 $enable_roles_perm_system_setting = SQ_CONF_ENABLE_ROLES_PERM_SYSTEM;
1129 $enable_roles_wf_system_setting = SQ_CONF_ENABLE_ROLES_WF_SYSTEM;
1130 $enable_global_roles_setting = SQ_CONF_ENABLE_GLOBAL_ROLES;
1132 if ($roles_changed) {
1133 $enable_roles_perm_system_setting = (isset($_POST[
'system_config'][
'SQ_CONF_ENABLE_ROLES_PERM_SYSTEM'])) ? $_POST[
'system_config'][
'SQ_CONF_ENABLE_ROLES_PERM_SYSTEM'] : $enable_roles_perm_system_setting;
1134 $enable_roles_wf_system_setting = (isset($_POST[
'system_config'][
'SQ_CONF_ENABLE_ROLES_WF_SYSTEM'])) ? $_POST[
'system_config'][
'SQ_CONF_ENABLE_ROLES_WF_SYSTEM'] : $enable_roles_wf_system_setting;
1136 $enable_global_roles_setting = (isset($_POST[
'system_config'][
'SQ_CONF_ENABLE_GLOBAL_ROLES'])) ? $_POST[
'system_config'][
'SQ_CONF_ENABLE_GLOBAL_ROLES'] : $enable_global_roles_setting;
1139 if (($enable_global_roles_setting != SQ_CONF_ENABLE_GLOBAL_ROLES) || ($enable_roles_perm_system_setting != SQ_CONF_ENABLE_ROLES_PERM_SYSTEM) || $enable_roles_wf_system_setting != SQ_CONF_ENABLE_ROLES_WF_SYSTEM) {
1140 $enabled = ($enable_roles_perm_system_setting || $enable_roles_wf_system_setting);
1144 if(!isset($_POST[
'system_config'][
'SQ_CONF_FORCE_SECURE_LOGIN_URLS'])) {
1146 $_POST[
'system_config'][
'SQ_CONF_FORCE_SECURE_LOGIN_URLS'] =
'';
1148 return parent::processBackend($o);
1164 require_once SQ_LIB_PATH.
'/db_install/db_install.inc';
1165 $roles_changed = FALSE;
1167 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
1177 $create_role_view_sql = $this->_getCommonViewDefinition(
'views_roles', $db_type,
'sq_vw_ast_role '.((!$enable_global_roles) ?
'Disabled ' :
'').
'View');
1178 $create_perm_view_sql = $this->_getCommonViewDefinition(
'views_roles', $db_type,
'sq_vw_ast_perm '.((!$enable_roles_system) ?
'Disabled ' :
'').
'View');
1181 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
1183 $drop_success = FALSE;
1187 if ($db_type ==
'pgsql') {
1193 $drop_success = TRUE;
1194 }
else if ($db_type ==
'oci') {
1197 $perm_sql =
"SELECT VIEW_NAME FROM ALL_VIEWS WHERE VIEW_NAME = 'SQ_VW_AST_PERM'";
1198 $role_sql =
"SELECT VIEW_NAME FROM ALL_VIEWS WHERE VIEW_NAME = 'SQ_VW_AST_ROLE'";
1206 if (isset($perm_vw_exists[
'0'][
'view_name']) && $perm_vw_exists[
'0'][
'view_name'] ==
'SQ_VW_AST_PERM') {
1210 if (isset($role_vw_exists[
'0'][
'view_name']) && $role_vw_exists[
'0'][
'view_name'] ==
'SQ_VW_AST_ROLE') {
1214 $drop_success = TRUE;
1216 }
catch (Exception $e) {
1218 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
1221 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
1226 if (!$drop_success && ($db_type ==
'pgsql')) {
1231 $drop_success = TRUE;
1232 }
catch (Exception $e) {
1234 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
1237 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
1247 $roles_changed = TRUE;
1248 }
catch (Exception $e) {
1249 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
1250 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
1255 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
1256 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
1259 grant_secondary_user_perms(FALSE);
1261 return $roles_changed;
1277 private function _getCommonViewDefinition($relations, $db_type, $display_name, $package=NULL)
1281 if (is_null($package)) {
1282 $subdir =
'install';
1284 $subdir =
'packages/'.$package;
1286 $fns_file = SQ_SYSTEM_ROOT.
'/'.$subdir.
'/'.$db_type.
'_'.$relations.
'.xml';
1290 if (!file_exists($fns_file)) {
1291 $fns_file = SQ_SYSTEM_ROOT.
'/'.$subdir.
'/common_'.$relations.
'.xml';
1293 if (file_exists($fns_file)) {
1297 $root =
new SimpleXMLElement($fns_file, LIBXML_NOCDATA, TRUE);
1298 }
catch (Exception $e) {
1299 throw new Exception(
'Could not parse stored relations file: '.$e->getMessage());
1302 if ($root->getName() !=
'sql') {
1303 throw new Exception(
'Cannot install stored relations file: expected root element "sql", found "'.$root->getName().
'".');
1307 $display_names = Array();
1309 foreach ($root->children() as $sql_element) {
1310 $element_name = $sql_element->getName();
1311 if ($sql_element->getName() !=
'sql_element') {
1312 throw new Exception(
'Cannot install stored relations file: expected element "sql_element", found "'.$sql_element->getName().
'".');
1315 $display_names[] = isset($sql_element->attributes()->{
'display_name'}) ? $sql_element->attributes()->{
'display_name'} :
'<Unknown Element>';
1316 if ($sql_element->attributes()->{
'display_name'} == $display_name) {
1317 $sql = trim(xml_entity_decode((
string)$sql_element));