Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31744/include/admin
Modified Files:
personal.inc.php users.inc.php
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.
Index: users.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/users.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- users.inc.php 27 Nov 2004 22:14:15 -0000 1.3
+++ users.inc.php 2 Dec 2004 20:57:45 -0000 1.4
@@ -53,14 +53,11 @@
} elseif ($_POST['userlevel'] > $serendipity['serendipityUserlevel']) {
echo '<strong>' . CREATE_NOT_AUTHORIZED_USERLEVEL . '</strong>';
} else {
- $u = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE, true);
- foreach($u AS $key => $entry) {
- serendipity_set_user_var(
- $entry['name'],
- $_POST[$entry['name']],
- $serendipity['POST']['user'],
- ($serendipity['authorid'] == $serendipity['POST']['authorid'] ? true : false)
- );
+ $config = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE);
+ foreach($config as $category) {
+ foreach ($category['items'] as $item) {
+ serendipity_set_user_var($item['var'], $_POST[$item['var']], $serendipity['POST']['user'], ($serendipity['authorid'] == $serendipity['POST']['authorid'] ? true : false));
+ }
}
printf('<strong>' . MODIFIED_USER . '</strong>', $_POST['username']);
echo '<br />';
@@ -149,9 +146,8 @@
</h3>
<?php
-$t = array();
-$t = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE, false, $t, false);
-serendipity_printConfigTemplate($t, $from, true, false);
+$config = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE);
+serendipity_printConfigTemplate($config, $from, true, false);
if (!empty($_POST['EDIT'])) { ?>
<input type="submit" name="SAVE" value="<?php echo SAVE; ?>" />
Index: personal.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/personal.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- personal.inc.php 2 Dec 2004 17:46:56 -0000 1.7
+++ personal.inc.php 2 Dec 2004 20:57:45 -0000 1.8
@@ -7,12 +7,14 @@
$from = array();
if ( $serendipity['GET']['adminAction'] == 'save' ) {
- $u = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE, true);
+ $config = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE);
if ((int)$_POST['userlevel'] > $serendipity['serendipityUserlevel']) {
echo '<div class="serendipityAdminMsgError">' . CREATE_NOT_AUTHORIZED_USERLEVEL . '</div>';
} else {
- foreach($u AS $var) {
- serendipity_set_user_var($var['name'], $_POST[$var['name']], $serendipity['authorid'], true);
+ foreach($config as $category) {
+ foreach ($category['items'] as $item) {
+ serendipity_set_user_var($item['var'], $_POST[$item['var']], $serendipity['authorid'], true);
+ }
}
$from = $_POST;
?>
|