PHP Source Code

<?php

/**
 * File getMODXSystemSettings.php (requires MODx Revolution 2.1)
 * Created on: 9/5/11 at 10:38 AM
 * Project shawn_wilkerson
 * @elements
 * @version 1.0
 * @category
 * @author W. Shawn Wilkerson
 * @link http://www.shawnWilkerson.com
 * @copyright Copyright (c) 2011, Sanity LLC. All rights reserved.
 * @license
 *
 * Categorizes each section of the System Settings and displays its respective values
 */
$out = '';
$query = $modx->newQuery('modSystemSetting');
$query->groupby('modSystemSetting.area');
$query->sortby('modSystemSetting.area', 'ASC');
$collection = $modx->getCollection('modSystemSetting', $query);
foreach ($collection as $area) {
    if (is_object($area)) {
        $area = $area->get('area');
        $query = $modx->newQuery('modSystemSetting');
        $query->sortby('modSystemSetting.key', 'ASC');
        $query->select('key,value,namespace');
        $query->where(array(
            'modSystemSetting.area' => $area,
        ));
        $out .= '<h2>' . (($area) ? $area : 'Unassigned') . '</h2>';        
        $out .= '<table><tr><td>Key</td><td>Value</td><td>Namespace</td></tr>';
        $settings = $modx->getCollection('modSystemSetting', $query);
        foreach ($settings as $setting) {
            $out .= '<tr><td class="settingKey">' . $setting->get('key') . '</td><td class="settingValue">' . $setting->get('value') . '</td><td class="settingNamespace">' . $setting->get('namespace') . '</td></tr>';
        }
        $out .= '</table><hr/><br/>';
    }
}
return $out;

Example Output

Unassigned

KeyValueNamespace
jquery_load1sanity
jquery_version1.7.1sanity
notifyTwitterTpl articles

authentication

KeyValueNamespace
access_category_enabled1core
access_context_enabled1core
access_resource_group_enabled1core
allow_manager_login_forgot_password1core
allow_multiple_emails1core
blocked_minutes60core
emailsendershawn@sanityllc.comcore
emailsubjectYour login detailscore
failed_login_attempts5core
forgot_login_email

Hello ,

A request for a password reset has been issued for your MODX user. If you sent this, you may follow this link and use this password to login. If you did not send this request, please ignore this email.

Activation Link: ?modahsh=
Username:
Password:

After you log into the MODX Manager, you can change your password again, if you wish.

Regards,
Site Administrator

core
manager_login_url_alternatecore
password_generated_length8core
password_min_length8core
principal_targetsmodAccessContext,modAccessResourceGroup,modAccessCategory,sources.modAccessMediaSourcecore
signupemail_message

Hello ,

Here are your login details for the MODX Manager:

Username:
Password:

Once you log into the MODX Manager at , you can change your password.

Regards,
Site Administrator

core
udperms_allowrootcore
webpwdreminder_message

Hello ,

To activate your new password click the following link:

If successful you can use the following password to login:

Password:

If you did not request this email then please ignore it.

Regards,
Site Administrator

core
websignupemail_message

Hello ,

Here are your login details for :

Username:
Password:

Once you log into at , you can change your password.

Regards,
Site Administrator

core

caching

KeyValueNamespace
cache_action_map1core
cache_context_settings1core
cache_db0core
cache_db_expires0core
cache_db_session0core
cache_db_session_lifetimecore
cache_default1core
cache_disabled0core
cache_expires0core
cache_format0core
cache_handlerxPDOFileCachecore
cache_lang_js1core
cache_lexicon_topics1core
cache_noncore_lexicon_topics1core
cache_resource1core
cache_resource_expires0core
cache_scripts1core
cache_system_settings1core
clear_cache_refresh_trees0core

editor

KeyValueNamespace
editor_css_pathcore
editor_css_selectorscore
use_editor1core
which_editorcore
which_element_editorcore

email

KeyValueNamespace
quip.emails_from_nameQuipquip
quip.emailsFromshawn@shawnwilkerson.comquip
quip.emailsReplyToshawn@shawnwilkerson.comquip
quip.emailsToshawn@shawnwilkerson.comquip

file

KeyValueNamespace
filemanager_pathcore
filemanager_path_relative1core
filemanager_urlcore
filemanager_url_relative1core
rb_base_dircore
rb_base_urlcore
strip_image_paths1core
upload_filestxt,html,htm,xml,js,css,zip,gz,rar,z,tgz,tar,htaccess,mp3,mp4,aac,wav,au,wmv,avi,mpg,mpeg,pdf,doc,xls,txt,ppt,pptx,docx,xlsx,jpg,jpeg,png,gif,psd,ico,bmp,odt,ods,odp,odb,odg,odf,docx,pptx,xlsxcore
upload_flashswf,flacore
upload_imagesjpg,jpeg,png,gif,psd,ico,bmpcore
upload_maxsize1048576core
upload_mediamp3,wav,au,wmv,avi,mpg,mpegcore
use_browser1core

furls

KeyValueNamespace
articles.container_ids,3:arc_,4:arc_articles
automatic_alias1core
container_suffix/core
friendly_alias_lowercase_only1core
friendly_alias_max_length0core
friendly_alias_restrict_charspatterncore
friendly_alias_restrict_chars_pattern/[\0\x0B\t\n\r\f\a&=+%#<>"~:`@\?\[\]\{\}\|\^'\\]/core
friendly_alias_strip_element_tags1core
friendly_alias_translitnonecore
friendly_alias_translit_classtranslit.modTransliteratecore
friendly_alias_translit_class_path{core_path}components/core
friendly_alias_trim_chars/.-_core
friendly_alias_word_delimiter-core
friendly_alias_word_delimiters-_core
friendly_urls1core
global_duplicate_uri_check0core
use_alias_path1core

gateway

KeyValueNamespace
request_controllerindex.phpcore
request_method_strict0core
request_param_aliasqcore
request_param_ididcore

language

KeyValueNamespace
cultureKeyencore
fe_editor_langencore
localecore
manager_directionltrcore
manager_lang_attributeencore
manager_languageencore
modx_charsetUTF-8core
use_multibyte1core

mail

KeyValueNamespace
mail_charsetUTF-8core
mail_encoding8bitcore
mail_smtp_authcore
mail_smtp_helocore
mail_smtp_hostslocalhostcore
mail_smtp_keepalivecore
mail_smtp_passcore
mail_smtp_port587core
mail_smtp_prefixcore
mail_smtp_single_tocore
mail_smtp_timeout10core
mail_smtp_usercore
mail_use_smtpcore

manager

KeyValueNamespace
base_help_urlhttp://rtfm.modx.com/display/revolution20/core
compress_css1core
compress_js1core
compress_js_groupscore
compress_js_max_files10core
context_tree_sortcore
context_tree_sortbyrankcore
context_tree_sortdirASCcore
default_duplicate_publish_optionpreservecore
default_media_source1core
default_per_page20core
enable_dragdrop1core
inline_help1core
manager_date_formatY-m-dcore
manager_favicon_urlcore
manager_html5_cache0core
manager_js_cache_file_locking1core
manager_js_cache_max_age3600core
manager_js_document_rootcore
manager_js_zlib_output_compression0core
manager_themedefaultcore
manager_time_formatg:i acore
resource_tree_node_namepagetitlecore
resource_tree_node_tooltipcore
richtext_default1core
show_tv_categories_header1core
topmenu_show_descriptions1core
tree_default_sortmenuindexcore
tree_root_id0core
tvs_below_content0core
welcome_screencore
welcome_screen_urlhttp://misc.modx.com/revolution/welcome.22.htmlcore

phpthumb

KeyValueNamespace
phpthumb_allow_src_above_docrootcore
phpthumb_cache_maxage30core
phpthumb_cache_maxfiles10000core
phpthumb_cache_maxsize100core
phpthumb_cache_source_enabledcore
phpthumb_document_rootcore
phpthumb_error_bgcolorCCCCFFcore
phpthumb_error_fontsize1core
phpthumb_error_textcolorFF0000core
phpthumb_farCcore
phpthumb_imagemagick_pathcore
phpthumb_nohotlink_enabled1core
phpthumb_nohotlink_erase_image1core
phpthumb_nohotlink_text_messageOff-server thumbnailing is not allowedcore
phpthumb_nohotlink_valid_domains{http_host}core
phpthumb_nooffsitelink_enabledcore
phpthumb_nooffsitelink_erase_image1core
phpthumb_nooffsitelink_require_refercore
phpthumb_nooffsitelink_text_messageOff-server linking is not allowedcore
phpthumb_nooffsitelink_valid_domains{http_host}core
phpthumb_nooffsitelink_watermark_srccore
phpthumb_zoomcrop0core

proxy

KeyValueNamespace
proxy_auth_typeBASICcore
proxy_hostcore
proxy_passwordcore
proxy_portcore
proxy_usernamecore

reCaptcha

KeyValueNamespace
recaptcha.private_keyrecaptcha
recaptcha.public_keyrecaptcha
recaptcha.use_sslrecaptcha

session

KeyValueNamespace
session_cookie_domaincore
session_cookie_lifetime604800core
session_cookie_pathcore
session_cookie_securecore
session_gc_maxlifetime604800core
session_handler_classmodSessionHandlercore
session_namecore

site

KeyValueNamespace
articles.default_article_template5articles
articles.default_container_template4articles
auto_menuindex1core
default_content_type1core
default_template1core
error_page1core
hidemenu_default0core
link_tag_scheme-1core
publish_defaultcore
search_default1core
site_nameW. Shawn Wilkersoncore
site_start1core
site_status1core
site_unavailable_messageThe site is currently unavailablecore
site_unavailable_page0core
symlink_merge_fields1core
unauthorized_page1core
use_weblink_targetcore
xhtml_urls1core

system

KeyValueNamespace
allow_forward_across_contextscore
allow_tags_in_post1core
archive_withcore
auto_check_pkg_updates1core
auto_check_pkg_updates_cache_expire15core
date_timezonecore
debugcore
extension_packages[{"articles":{"path":"/home/wsw/public_html/core/components/articles/model/"}}]core
feed_modx_newshttp://feeds.feedburner.com/modx-announcecore
feed_modx_news_enabled1core
feed_modx_securityhttp://feeds.feedburner.com/modxsecuritycore
feed_modx_security_enabled1core
forward_merge_excludestype,published,class_key,context_keycore
log_level1core
log_targetFILEcore
resolve_hostnames0core
server_offset_time0core
server_protocolhttpcore
set_header1core
settings_distrotraditionalcore
settings_version2.2.0-pl2core

Tags

KeyValueNamespace
quip.allowed_tags
quip

Comments

In team meetings, client discussions, and various other situations, a simple single presentation of the settings assigned to a web project can quickly get everyone on the same page. It can also clarify nomenclature, project needs, and establish a consistent key/value structure which can then be used by each of the teams/individuals assigned to the specific components of the project.

Notice what's missing

When I first posted similar code to this example, it displayed multiple copies of the site database username and password. Essentially, all of the information required to access the database was dumped to the screen, unless they were manually edited. These have since been removed from the MODX Revolution System Settings, as I suggested sometime ago - they were not needed once xPDO successfully connected the instance to the database.

This should make admins and site owners breath easier, as Manager users will not have access to these values outside of PHP, unless it is given directly to them.