New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gsconfig definitions #982
Comments
/**
* GSCONFIG definitions
*/
$GS_constants = array(
'GSROOTPATH' => getGSRootPath(false), // root path of getsimple
"GSDATEFORMAT" => "M j, Y", // (str) short date-only format fallback
"GSDATEANDTIMEFORMAT" => "F jS, Y - g:i A", // (str) date/time format fallback
"GSTIMEFORMAT" => "g:i A", // (str) time only format fallback
'GSSTARTTIME' => microtime(), // (int) micro time stamp for gs loaded
'GSBASE' => false, // (bool) front end flag
'GSCONFIGFILE' => 'gsconfig.php', // (str) config filename
'GSWEBSITEFILE' => 'website.xml', // (str) website data filename
'GSCOMPONENTSFILE' => 'components.xml', // (str) components data filename
'GSSNIPPETSFILE' => 'snippets.xml', // (str) snippets data filename
'GSAUTHFILE' => 'authorization.xml', // (str) authorizaton salt data filename
'GSPLUGINTRIGGERFILE' => 'plugin-update.trigger', // (str) plugin update trigger filename
'GSCSSMAINFILE' => 'css.php', // (str) main css filename
'GSADMINTHEMEFILE' => 'admin.xml', // (str) custom admin xml theme file name
'GSPAGECACHEFILE' => 'pages.xml', // (str) page cache xml file name
'GSPLUGINSFILE' => 'plugins.xml', // (str) plugins xml file name
'GSADMINTHEMEENABLE' => true, // (bool) custom admin xml enabled
'GSCSSCUSTOMFILE' => 'admin.css', // (str) custom css file name
'GSCSSCUSTOMENABLE' => true, // (bool) custom css enabled
'GSSTYLECACHEENABLE' => false, // (bool) enable style.php cache
'GSTEMPLATEFILE' => 'template.php', // (str) default template file name
'GSINSTALLTEMPLATE' => 'Innovation', // (str) template to set on install
'GSINSTALLPLUGINS' => 'InnovationPlugin.php', // (str) csv comma delimited list of plugins to activate on install
'GSSTYLEWIDE' => 'wide', // (str) wide stylesheet constant
'GSSTYLE_SBFIXED' => 'sbfixed', // (str) fixed sidebar constant
'GSFRONT' => 1, // (int) front end enum constant
'GSBACK' => 2, // (int) back end enum constant
'GSBOTH' => 3, // (int) front and back enum constant
'GSDEFAULTLANG' => 'en_US', // (str) default language for core
'GSTITLEMAX' => 70, // (int) max length allowed for titles
'GSFILENAMEMAX' => 255, // (int) max length allowed for file names/slugs
'GSPASSLENGTHMIN' => 4, // (int) min length of passwords
'GSBAKFILESUFFIX' => '', // (str) backup file naming suffix after extension
'GSBAKFILEPREFIX' => '.bak', // (str) backup file naming prefix before extension
'GSRESETFILESUFFIX' => '.reset', // (str) password reset file naming suffix before extension
'GSRESETFILEPREFIX' => '', // (str) password reset file naming prefix after extension
'GSDEFAULTPERMALINK' => '%path%/%slug%/', // (str) default permalink structure to use if prettyurls is enabled, and custom not exist
'GSTOKENDELIM' => '%', // (str) delimiter for token boundaries
'GSLOGINQSALLOWED' => 'id,draft,nodraft,safemode,i,path', // (str) csv query string keys to allow during login redirects
'GSPAGECACHEEXCLUDE' => 'content', // (str) csv list of page fields to exlclude from page cache
# -----------------------------------------------------------------------------------------------------------------------------------------------
'GSCONSTANTSLOADED' => true // $GS_constants IS LOADED FLAG
);
$GS_definitions = array(
'GSSUPERUSER' => '', // (str) userid for superuser, defaults to website data/global $SITEUSR if it exists
'GSDEFAULTPAGE' => 'pages.php', // (str) Default backend index page
'GSHEADERCLASS' => '', // (str) custom class to add to header eg. `gradient` to add 3.3 gradients back
'GSHTTPPREFIX' => '', // (str) http slug prefix GSHTTPPREFIX.GSSLUGxx
'GSSLUGNOTFOUND' => '404', // (str) http slug for not found
'GSSLUGPRIVATE' => '403', // (str) http slug for private pages
'GSADMIN' => 'admin', // (str) admin foldername
'GSSITEMAPFILE' => 'sitemap.xml', // (str) sitemap file name, must modify in .htaccess as needed
'GSERRORLOGENABLE' => true, // (bool) should GS log php errors to GSERRORLOGFILE
'GSERRORLOGFILE' => 'errorlog.txt', // (str) error log filename
'GSASSETSCHEMES' => false, // (bool) should $ASSETURL contain the url scheme http|https
'GSASSETURLREL' => false, // (bool) Use root relative urls for $ASSETURL, overrides GSASSETSCHEMES
'GSSITEURLREL' => false, // (bool) Use root relative urls for $SITEURL
'GSEMAILLINKBACK' => 'http://get-simple.info/', // (str) url used in email template
'GSINDEXSLUG' => 'index', // (str) slug to use as index when no slug provided
'GSPLUGINORDER' => '', // (str-csv) csv list of live_plugins keys to load first and in order, kludge and not supported
'GSNOFRAME' => true, // (mixed) allow GS to be loaded in frames via x-frame policy
'GSNOFRAMEDEFAULT' => 'SAMEORIGIN', // (string) GSNOFRAME X-Frame-Options default value
'GSCDNFALLBACK' => true, // (bool) if true, CDN assets queued on GSFRONT will fallback to local version
'GSLOGINUPGRADES' => true, // (bool) if true, temporarily close front end during upgrades, must login to upgrade
'GSSANITIZEECHO' => true, // (bool) sanitize out put of echoreturn
# STYLES/UI -------------------------------------------------------------------------------------------------------------------------------------------
'GSTABS' => 'pages,upload,theme,backups,plugins', // (str) csv list of page ids and order to show tabs
'GSNOSIDEBAR' => 'theme-edit', // (str) csv list of page ids to hide sidebar
'GSSTYLE' => 'wide,sbfixed', // (str-csv) default style modifiers
'GSWIDTH' => '1024px', // (str) pagewidth on backend,(max-width), null,'none','' for 100% width
'GSWIDTHWIDE' => '1366px', // (str) page width on backend pages defined in GSWIDEPAGES, values as above
'GSWIDEPAGES' => 'theme-edit,components,snippets', // (str-csv) pages to apply GSWIDTHWIDE on
'GSTABICONS' => true, // (bool) show icons on nav tabs
'GSNOCDN' => true, // (bool) disable cdn for assets that have cdn urls in assets.php
'GSSUPPORTLINKHC' => false, // (bool) show healthcheck small nav instead of support
# CHMOD --------------------------------------------------------------------------------------------------------------------------------------------
'GSCHMOD' => 0644, // (octal) chmod mode legacy
'GSCHMODFILE' => 0644, // (octal) chmod mode for files
'GSCHMODDIR' => 0755, // (octal) chmod mode for dirs
'GSDOCHMOD' => true, // (bool) perform chmod when creating files or directories
'GSCHMODCHECK' => true, // (bool) warn on gschmod mismatches in health check
# ALLOW --------------------------------------------------------------------------------------------------------------------------------------------
'GSALLOWLOGIN' => true, // (bool) allow front end login
'GSALLOWRESETPASS' => true, // (bool) allow front end password resets
'GSALLOWDOWNLOADS' => true, // (bool) allow using downloads.php to download files from /uploads and backups/zip
'GSPROFILEALLOWADD' => true, // (bool) allow superuser to add new users
'GSPROFILEALLOWEDIT' => true, // (bool) allow superuser to edit other users
'GSEXECANON' => false, // (bool) allow callbacks to be anonymous closures, security implications
# ALLOW UPLOADS ------------------------------------------------------------------------------------------------------------------------------------
'GSALLOWUPLOADS' => true, // (bool) allow upload files
'GSALLOWUPLOADCREATE' => true, // (bool) allow upload folder creation
'GSALLOWUPLOADDELETE' => true, // (bool) allow upload file/folder delete
'GSALLOWBROWSEUPLOAD' => true, // (bool) allow uploading when browsing files
'GSUSEGSUPLOADER' => true, // (bool) use ajax upload library gsupload (dropzone) for uploads, else standard form
'GSUPLOADSLC' => true, // (bool) if true force upload filenames to lowercase
'GSUPLOADSEXTLC' => true, // (bool) if true force upload extensions to lowercase
'GSAUTOUPLOADPATH' => "autoupload", // (str) subpath to put uploads in when performing autouploads
# EDITORS ------------------------------------------------------------------------------------------------------------------------------------------
'GSEDITORCONFIGFILE' => 'config.js', // (str) custom user cke config filename override in themes/
'GSEDITORSTYLESFILE' => 'styles.js', // (str) custom user cke config filename override in themes/
'GSEDITORCSSFILE' => 'contents.css', // (str) custom user cke config filename override in themes/
'GSEDITORSTYLESID' => 'userstyles', // (str) custom user cke config filename override in themes/
'GSSNIPPETSATTRIB' => 'getHtmlEditorAttr', // (str) callback funcname for htmleditors used to init htmleditor
'GSCOMPONENTSATTRIB' => 'getCodeEditorAttr', // (str) callback funcname for codeeditors used to init codeeditor
'GSPAGESATTRIB' => 'getDefaultHtmlEditorAttr', // (str) callback funcname for page html editor
'GSSHOWCODEHINTS' => true, // (bool) show code hints on components page and snippets etc.
'GSAJAXSAVE' => true, // (bool) use ajax for saving themes, components, and pages
'GSTHEMEEDITROOT' => true, // (bool) allow editing theme root files
'GSTHEMEEDITEXTS' => 'php,css,js,html,htm,txt,xml,', // (str-csv) file extensions to show and edit in theme editor
'GSEDITORHEIGHT' => '500', // (str) wysiwyg editor height in px
'GSEDITORTOOL' => 'basic', // (str) wysiwyg editor toobar
'GSHTMLEDITINLINE' => false, // (bool) show html cke editors inline EXPERIMENTAL
'GSHTMLEDITCOMPACT' => true, // (bool) show html cke editors compacted, hides ui when not focused
'GSHTMLEDITAUTOHEIGHT' => true, // (bool) after init, auto set the ckeditors height
'GSCODEEDITORTHEMES' => '3024-day,3024-night,abcdef,ambiance-mobile,ambiance,base16-dark,base16-light,bespin,blackboard,cobalt,colorforth,default,dracula,duotone-dark,duotone-light,eclipse,elegant,erlang-dark,hopscotch,icecoder,isotope,lesser-dark,liquibyte,material,mbo,mdn-like,midnight,monokai,neat,neo,night,panda-syntax,paraiso-dark,paraiso-light,pastel-on-dark,railscasts,rubyblue,seti,solarized light,solarized dark,the-matrix,tomorrow-night-bright,tomorrow-night-eighties,ttcn,twilight,vibrant-ink,xq-dark,xq-light,yeti,zenburn', # themes for codemirror
'GSPAGETABS' => true, // (bool) use tabbed interface for page edit
'GSCOMPSORTSAVE' => true, // (bool) sort collections by title on save
'GSEDITNAVCLONE' => false, // (bool) show clone edit nav on page edit
'GSEDITNAVVIEW' => true, // (bool) show view edit nav on page edit
# DRAFTS -------------------------------------------------------------------------------------------------------------------------------------------
'GSUSEDRAFTS' => true, // (bool) use page drafts
'GSUSEPAGESTACK' => true, // (bool) use page stacks for drafts, else manually pass `nodraft` or `draft` qs
'GSDRAFTSTACKDEFAULT' => false, // (bool) default page stack editing to drafts if true
'GSSDRAFTSPUBLISHEDTAG'=> true, // (bool) show published label on non draft pages if true
'GSAUTOSAVE' => true, // (bool) auto save enabled, disabled if false, only used for drafts currently
'GSAUTOSAVEINTERVAL' => 6, // (int) auto save interval in seconds, only used for drafts currently
# IMAGES -------------------------------------------------------------------------------------------------------------------------------------------
'GSIMAGEWIDTH' => 200, // (int) thumbnail size
'GSTHUMBSMWIDTH' => 80, // (int) thumbsm max height
'GSTHUMBSMHEIGHT' => 160, // (int) thumbsm max width
'GSTHUMBSSHOW' => false, // (bool) always show thumbnails
# DEBUGGING ----------------------------------------------------------------------------------------------------------------------------------------
'GSDEBUGINSTALL' => false, // (bool) debug installs, prevent removal of installation files (install,setup,update)
'GSDEBUGINSTALLWIPE' => false, // (bool) debug installs, wipes website.xml on logouts
'GSDEBUG' => true, // (bool) output debug mode console
'GSDEBUGAPI' => false, // (bool) debug api calls to debuglog
'GSDEBUGREDIRECTS' => false, // (bool) if debug mode enabled, prevent redirects for debugging
'GSDEBUGFILEIO' => false, // (bool) debug filio operations
'GSDEBUGHOOKS' => false, // (bool) debug hooks, adds callee (file,line,core) to $plugins, always true if DEBUG MODE
'GSDEBUGLOGTIME' => false, // (bool) timestamp debuglog str entries
'GSDEBUGLOGDUR' => false, // (bool) duration timestamp debuglog str entries
'GSDEBUGHEADERS' => false, // (bool) enable header output debugging ( helpful for finding whitespace or headers already sent errors )
'GSDEBUGARRAYS' => false, // (bool) will dump all arrays on init for debugging
'GSDEBUGPATHS' => false, // (bool) will dump all arrays on init for debugging
# INIT ----------------------------------------------------------------------------------------------------------------------------------------------
'GSSAFEMODE' => false, // (bool) enable safe mode, safe mode disables plugins and components
'GSFORMATXML' => true, // (bool) format xml files before saving them, making them more legible
'GSSAFEMODE' => false, // (bool) enable safe mode, safe mode disables plugins and components
'GSINITPAGECACHE' => true, // (bool) initPageCache in common, solves issues with lazyload via getPages, or when still using Global $pagesArray
'GSUSELEGACYPLUGINS' => false, // (bool) use legacy plugins array for plugin hooks, some features will not work, namely priorities!
'GSNOPLUGINCHECK' => false, // (bool) perform no plugin api checks if false, api checks will be limited to 5 per run
# VARIABLES -----------------------------------------------------------------------------------------------------------------------------------------
'GSMETADLEN' => 160, // (int) optional meta description max length enforced
'GSBACKUPROOT' => false, // (bool) include all root files in archive backups
'GSAUTOMETAD' => false, // (bool) auto generate meta desc from content
// 'GSBACKUPEXTRAS' => '', // (str) testing add stuff to backup, only accepts files for now
# SANITY --------------------------------------------------------------------------------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------------------------------------------
'GSDEFINITIONSLOADED' => true // (bool) $GS_definitions IS LOADED FLAG |
If a plugin needs to change any of these, should it access globals Do you have a list of gsconfig settings for 3.4+ ? (If not, I can parse it and compare with 3.3.13) |
Plugins cannot change definitions(constants), so that is something I need to figure out, I also do not want undefined constants, it is bad practice. So we need to decide what we will allow to be runtime modified and move them to some other method using a global config array for things that we allow users to change at runtime. |
I thought you were moving these to arrays precissely so that they could be modified in runtime (by plugins or whatever) |
Not yet I will need to decide which configs plugins are allowed to configure, as mentioned above. The problem here is backward compatibility. Plugins still check definitions, they have to use getDef for this all to work , otherwise definitions are write only, they cannot be changed. So to add this kind of functionality it is literally 3 lines of code in the wrapper functions, to check a config array with fallback to definitions. But I have not decided how to implement it yet or communicate the changes without it being breaking. |
updated |
@tablatronix in the #982 (comment), GSSAFEMODE is in there twice. Also, won't safe mode ironically break the non-admin part if plugin functions are used in the templates? |
yeah it will pretty much break everything but allow you into admin if something is fatal |
All global variables that are not actual variables and code wide enviromentals, have been converted to constants.
This might be refactored further into extendable configs, as of right now I am still using constants as we always have been. We will probably want this to be 4 distinct groups.
gsconfig.php
or environment, will be initialized to defaults at runtimecommon
init timeCurrently there is the following
$GS_constants
constants that are not user definable in gsconfig or settable after runtime$GS_definitions
constants that are user definable in gsconfig but will be set to defaults when notRuntime
There is no feature for this yetGLOBALS
like $id, $data_index, $EDHEIGHT, $EDTOOL, $LANG , some of these need to be chosen to be allowed in gsconfig, as they are now initialized properly, as of now most globals cannot be set in gsconfig anymoreThese are all initialized dynamically using wrappers so we can modify this at anytime to set and unset configuration objects of any kind, this with getdef allows us to change out the config runtimes.
We can add a loader for yaml or json objects instead of gsconfigs
constants
or memcacheYou can see these here
https://github.com/GetSimpleCMS/GetSimpleCMS/blob/master/admin/inc/common.php
Todo
The text was updated successfully, but these errors were encountered: