Update of /cvsroot/php-blog/serendipity/include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12869/include
Modified Files:
functions_installer.inc.php functions_config.inc.php
Log Message:
* Re-Introduce wysiwyg and language settings per-user - flag 'config' (sigh ;)
* Added flag 'parseDescription' to replace [USERLEVEL_ADMIN] etc. in language strings
* When managing users, fetch their personal 'config'-flag settings from the DB and not from the session of another user
Index: functions_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/functions_config.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- functions_config.inc.php 2 Dec 2004 10:54:55 -0000 1.4
+++ functions_config.inc.php 3 Dec 2004 10:55:22 -0000 1.5
@@ -24,6 +24,18 @@
}
}
+function serendipity_get_user_config_var($name, $authorid, $default = '') {
+ global $serendipity;
+
+ $r = serendipity_db_query("SELECT value FROM {$serendipity['dbPrefix']}config WHERE authorid = " . (int)$authorid . " AND name = '" . $name . "' LIMIT 1", true);
+
+ if (is_array($r)) {
+ return $r[0];
+ } else {
+ return $default;
+ }
+}
+
function serendipity_get_user_var($name, $authorid, $default) {
global $serendipity;
Index: functions_installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/functions_installer.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- functions_installer.inc.php 2 Dec 2004 20:57:44 -0000 1.9
+++ functions_installer.inc.php 3 Dec 2004 10:55:22 -0000 1.10
@@ -169,6 +169,21 @@
return $config;
}
+function serendipity_replaceEmbeddedConfigVars ($s) {
+ return str_replace(
+ array(
+ '[USERLEVEL_ADMIN]',
+ '[USERLEVEL_CHIEF]',
+ '[USERLEVEL_EDITOR]'
+ ),
+
+ array(
+ USERLEVEL_ADMIN,
+ USERLEVEL_CHIEF,
+ USERLEVEL_EDITOR
+ ), $s);
+}
+
function serendipity_guessInput($type, $name, $value='', $default='') {
global $serendipity;
@@ -303,6 +318,14 @@
if ( in_array('hideValue', $item['flags']) ) {
$value = '';
}
+
+ if (in_array('config', $item['flags']) && isset($from['authorid'])) {
+ $value = serendipity_get_user_config_var($item['var'], $from['authorid'], $item['default']);
+ }
+
+ if (in_array('parseDescription', $item['flags'])) {
+ $item['description'] = serendipity_replaceEmbeddedConfigVars($item['description']);
+ }
?>
<tr>
<td style="border-bottom: 1px #000000 solid" align="left" valign="top" width="75%">
|