Update of /cvsroot/php-blog/serendipity/include/tpl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31744/include/tpl
Added Files:
config_local.inc.php config_personal.inc.php
Removed Files:
config_local.tpl config_user.tpl
Log Message:
- Convert old .tpl files into plain and valid .php files
- Use native PHP array to store configuration templates
- Add flag called "nosave" which will cause the data not to be saved in the database (useful for db vars, leaves a very clean db table)
- Add flag called "hideValue" which will not print the value of the var to the user (for passwords)
- Add flag called "local" which will not save the variable in the database, but only when the var is being saved in the configuration
- Fix bug with autolang (someone misspelled $serendipity, bad bad)
- Convert list of languages to a real array, which is sexy - move it to serendipity_config.inc.php
Tested with installer and config saving.
Please test - any breakage will be fixed ASAP - but please don't commit anything without pinging me.
TODO: Make a function to parse/obey the configuration flags, so we don't have to maintain it 3 places. Will do tomorrow.
NOTE: Do not add any logic to config files, or I will personally hunt you down.
--- NEW FILE: config_local.inc.php ---
<?php # $Id: config_local.inc.php,v 1.1 2004/12/02 20:57:46 tomsommer Exp $
$res = array();
$res[] = array('title' => INSTALL_CAT_DB,
'description' => INSTALL_CAT_DB_DESC,
'items' => array(array('var' => 'dbType',
'title' => INSTALL_DBTYPE,
'description' => INSTALL_DBTYPE_DESC,
'type' => 'list',
'default' => array('mysql' => 'MySQL',
'postgres' => 'PostgreSQL',
'mysqli' => 'MySQLi',
'sqlite' => 'SQLite'),
'flags' => array('nosave')),
array('var' => 'dbHost',
'title' => INSTALL_DBHOST,
'description' => INSTALL_DBHOST_DESC,
'type' => 'string',
'default' => 'localhost',
'flags' => array('nosave')),
array('var' => 'dbUser',
'title' => INSTALL_DBUSER,
'description' => INSTALL_DBUSER_DESC,
'type' => 'string',
'default' => 'serendipity',
'flags' => array('nosave')),
array('var' => 'dbPass',
'title' => INSTALL_DBPASS,
'description' => INSTALL_DBPASS_DESC,
'type' => 'protected',
'default' => '',
'flags' => array('nosave', 'hideValue')),
array('var' => 'dbName',
'title' => INSTALL_DBNAME,
'description' => INSTALL_DBNAME_DESC,
'type' => 'string',
'default' => 'serendipity',
'flags' => array('nosave')),
array('var' => 'dbPrefix',
'title' => INSTALL_DBPREFIX,
'description' => INSTALL_DBPREFIX_DESC,
'type' => 'string',
'default' => 'serendipity_',
'flags' => array('nosave')),
array('var' => 'dbPersistant',
'title' => INSTALL_DBPERSISTENT,
'description' => INSTALL_DBPERSISTENT_DESC,
'type' => 'bool',
'default' => false,
'flags' => array('nosave'))
));
$res[] = array('title' => INSTALL_CAT_PATHS,
'description' => INSTALL_CAT_PATHS_DESC,
'items' => array(array('var' => 'serendipityPath',
'title' => INSTALL_FULLPATH,
'description' => INSTALL_FULLPATH_DESC,
'type' => 'string',
'default' => '/webroot/serendipity/'),
array('var' => 'uploadPath',
'title' => INSTALL_UPLOADPATH,
'description' => INSTALL_UPLOADPATH_DESC,
'type' => 'string',
'default' => 'uploads/'),
array('var' => 'serendipityHTTPPath',
'title' => INSTALL_RELPATH,
'description' => INSTALL_RELPATH_DESC,
'type' => 'string',
'default' => '/serendipity/'),
array('var' => 'templatePath',
'title' => INSTALL_RELTEMPLPATH,
'description' => INSTALL_RELTEMPLPATH_DESC,
'type' => 'string',
'default' => 'templates/'),
array('var' => 'uploadHTTPPath',
'title' => INSTALL_RELUPLOADPATH,
'description' => INSTALL_RELUPLOADPATH_DESC,
'type' => 'string',
'default' => 'uploads/'),
array('var' => 'baseURL',
'title' => INSTALL_URL,
'description' => INSTALL_URL_DESC,
'type' => 'string',
'default' => 'http://www.example.com/serendipity/'),
array('var' => 'indexFile',
'title' => INSTALL_INDEXFILE,
'description' => INSTALL_INDEXFILE_DESC,
'type' => 'string',
'default' => 'index.php'),
));
$res[] = array('title' => INSTALL_CAT_SETTINGS,
'description' => INSTALL_CAT_SETTINGS_DESC,
'items' => array(array('var' => 'user',
'title' => INSTALL_USERNAME,
'description' => INSTALL_USERNAME_DESC,
'type' => 'string',
'default' => 'John Doe',
'flags' => array('installOnly', 'local')),
array('var' => 'pass',
'title' => INSTALL_PASSWORD,
'description' => INSTALL_PASSWORD_DESC,
'type' => 'protected',
'default' => 'john',
'flags' => array('installOnly', 'local')),
array('var' => 'email',
'title' => INSTALL_EMAIL,
'description' => INSTALL_EMAIL_DESC,
'type' => 'string',
'default' => 'jo...@ex...',
'flags' => array('installOnly', 'local')),
array('var' => 'want_mail',
'title' => INSTALL_SENDMAIL,
'description' => INSTALL_SENDMAIL_DESC,
'type' => 'bool',
'default' => true,
'flags' => array('installOnly', 'local')),
array('var' => 'allowSubscriptions',
'title' => INSTALL_SUBSCRIBE,
'description' => INSTALL_SUBSCRIBE_DESC,
'type' => 'bool',
'default' => true,
'flags' => array('installOnly')),
array('var' => 'blogTitle',
'title' => INSTALL_BLOGNAME,
'description' => INSTALL_BLOGNAME_DESC,
'type' => 'string',
'default' => 'John Doe\'s personal blog',
'userlevel' => USERLEVEL_CHIEF),
array('var' => 'blogDescription',
'title' => INSTALL_BLOGDESC,
'description' => INSTALL_BLOGDESC_DESC,
'type' => 'string',
'default' => 'My little place on the web...',
'userlevel' => USERLEVEL_CHIEF),
array('var' => 'lang',
'title' => INSTALL_LANG,
'description' => INSTALL_LANG_DESC,
'type' => 'list',
'default' => $serendipity['languages']),
));
$res[] = array('title' => INSTALL_CAT_DISPLAY,
'description' => INSTALL_CAT_DISPLAY_DESC,
'items' => array(array('var' => 'fetchLimit',
'title' => INSTALL_FETCHLIMIT,
'description' => INSTALL_FETCHLIMIT_DESC,
'type' => 'int',
'default' => 15),
array('var' => 'useGzip',
'title' => INSTALL_USEGZIP,
'description' => INSTALL_USEGZIP_DESC,
'type' => 'bool',
'default' => true),
array('var' => 'extCSS',
'title' => INSTALL_EXTERNALSTYLE,
'description' => INSTALL_EXTERNALSTYLE_DESC,
'type' => 'string',
'default' => 'none'),
array('var' => 'wysiwyg',
'title' => INSTALL_WYSIWYG,
'description' => INSTALL_WYSIWYG_DESC,
'type' => 'bool',
'default' => false,
'userlevel' => USERLEVEL_CHIEF),
array('var' => 'XHTML11',
'title' => INSTALL_XHTML11,
'description' => INSTALL_XHTML11_DESC,
'type' => 'bool',
'default' => false),
array('var' => 'enablePopup',
'title' => INSTALL_POPUP,
'description' => INSTALL_POPUP_DESC,
'type' => 'bool',
'default' => false),
array('var' => 'embed',
'title' => INSTALL_EMBED,
'description' => INSTALL_EMBED_DESC,
'type' => 'bool',
'default' => 'false'),
array('var' => 'top_as_links',
'title' => INSTALL_SHOW_EXTERNAL_LINKS,
'description' => INSTALL_SHOW_EXTERNAL_LINKS_DESC,
'type' => 'bool',
'default' => false),
array('var' => 'blockReferer',
'title' => INSTALL_BLOCKREF,
'description' => INSTALL_BLOCKREF_DESC,
'type' => 'string',
'default' => ';'),
array('var' => 'rewrite',
'title' => INSTALL_REWRITE,
'description' => INSTALL_REWRITE,
'type' => 'list',
'default' => array('none' => 'Disable URL Rewriting',
'errordocs' => 'Use Apache errorhandling',
'rewrite' => 'Use Apache mod_rewrite')),
array('var' => 'serverOffsetHours',
'title' => INSTALL_OFFSET,
'description' => INSTALL_OFFSET_DESC,
'type' => 'int',
'default' => 0),
array('var' => 'showFutureEntries',
'title' => INSTALL_SHOWFUTURE,
'description' => INSTALL_SHOWFUTURE_DESC,
'type' => 'bool',
'default' => false),
));
$res[] = array('title' => INSTALL_CAT_IMAGECONV,
'description' => INSTALL_CAT_IMAGECONV_DESC,
'items' => array(array('var' => 'magick',
'title' => INSTALL_IMAGEMAGICK,
'description' => INSTALL_IMAGEMAGICK_DESC,
'type' => 'bool',
'default' => false),
array('var' => 'convert',
'title' => INSTALL_IMAGEMAGICKPATH,
'description' => INSTALL_IMAGEMAGICKPATH_DESC,
'type' => 'string',
'default' => '/usr/local/bin/convert'),
array('var' => 'thumbSuffix',
'title' => INSTALL_THUMBSUFFIX,
'description' => INSTALL_THUMBSUFFIX_DESC,
'type' => 'string',
'default' => 'serendipityThumb'),
array('var' => 'thumbSize',
'title' => INSTALL_THUMBWIDTH,
'description' => INSTALL_THUMBWIDTH_DESC,
'type' => 'int',
'default' => 110),
));
return $res;
?>
--- config_local.tpl DELETED ---
--- config_user.tpl DELETED ---
--- NEW FILE: config_personal.inc.php ---
<?php # $Id: config_personal.inc.php,v 1.1 2004/12/02 20:57:46 tomsommer Exp $
$res = array();
$res[] = array('title' => USERCONF_CAT_PERSONAL,
'description' => USERCONF_CAT_PERSONAL_DESC,
'items' => array(array('var' => 'username',
'title' => USERCONF_USERNAME,
'description' => USERCONF_USERNAME_DESC,
'type' => 'string',
'default' => 'John',
'userlevel' => USERLEVEL_EDITOR),
array('var' => 'password',
'title' => USERCONF_PASSWORD,
'description' => USERCONF_PASSWORD_DESC,
'type' => 'protected',
'default' => '',
'userlevel' => USERLEVEL_EDITOR),
array('var' => 'userlevel',
'title' => USERCONF_USERLEVEL,
'description' => USERCONF_USERLEVEL_DESC,
'type' => 'int',
'default' => USERLEVEL_EDITOR,
'userlevel' => USERLEVEL_CHIEF),
array('var' => 'email',
'title' => USERCONF_EMAIL,
'description' => USERCONF_EMAIL_DESC,
'type' => 'string',
'default' => 'jo...@ex...',
'userlevel' => USERLEVEL_EDITOR),
array('var' => 'mail_comments',
'title' => USERCONF_SENDCOMMENTS,
'description' => USERCONF_SENDCOMMENTS_DESC,
'type' => 'bool',
'default' => true,
'userlevel' => USERLEVEL_EDITOR),
array('var' => 'mail_trackbacks',
'title' => USERCONF_SENDTRACKBACKS,
'description' => USERCONF_SENDTRACKBACKS_DESC,
'type' => 'bool',
'default' => true,
'userlevel' => USERLEVEL_EDITOR),
array('var' => 'right_publish',
'title' => USERCONF_ALLOWPUBLISH,
'description' => USERCONF_ALLOWPUBLISH_DESC,
'type' => 'bool',
'default' => true,
'userlevel' => USERLEVEL_CHIEF),
));
return $res;
?>
|