Update of /cvsroot/php-blog/serendipity/include/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7315/include/admin
Modified Files:
category.inc.php entries.inc.php installer.inc.php
overview.inc.php personal.inc.php plugins.inc.php
users.inc.php
Log Message:
- Added ability to define a real name for each author
- Added serendipity_addAuthor() and serendipity_deleteAuthor functions
Version bump
Index: users.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/users.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- users.inc.php 15 Feb 2005 08:29:13 -0000 1.12
+++ users.inc.php 24 Feb 2005 20:14:23 -0000 1.13
@@ -20,8 +20,8 @@
} elseif ($_POST['userlevel'] > $serendipity['serendipityUserlevel']) {
echo '<div class="serendipityAdminMsgError">' . CREATE_NOT_AUTHORIZED_USERLEVEL . '</div>';
} else {
- serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}authors WHERE authorid=" . (int)$serendipity['POST']['user']);
- printf('<div class="serendipityAdminMsgSuccess">' . DELETED_USER . '</div>', $serendipity['POST']['user'], $user[0]['username']);
+ serendipity_deleteAuthor($user[0]['authorid']);
+ printf('<div class="serendipityAdminMsgSuccess">' . DELETED_USER . '</div>', $serendipity['POST']['user'], $user[0]['realname']);
}
}
@@ -31,12 +31,7 @@
if ($_POST['userlevel'] >= $serendipity['serendipityUserlevel'] && $serendipity['serendipityUserlevel'] < USERLEVEL_ADMIN) {
echo '<div class="serendipityAdminMsgError">' . CREATE_NOT_AUTHORIZED . '</div>';
} else {
- $enc_pass = md5($_POST['pass']);
- $query = "INSERT INTO {$serendipity['dbPrefix']}authors (username, password)
- VALUES ('" . serendipity_db_escape_string($_POST['username']) . "',
- '" . serendipity_db_escape_String($enc_pass) . "')";
- serendipity_db_query($query);
- $serendipity['POST']['user'] = serendipity_db_insert_id('authors', 'authorid');
+ $serendipity['POST']['user'] = serendipity_addAuthor($_POST['username'], $_POST['pass'], $_POST['realname'], $_POST['email'], $_POST['userlevel']);
/* Save all the properties */
$config = serendipity_parseTemplate(S9Y_CONFIG_USERTEMPLATE);
@@ -51,7 +46,7 @@
}
}
- printf('<div class="serendipityAdminMsgSuccess">' . CREATED_USER . '</div>', '#' . $serendipity['POST']['user'] . ', ' . $_POST['username']);
+ printf('<div class="serendipityAdminMsgSuccess">' . CREATED_USER . '</div>', '#' . $serendipity['POST']['user'] . ', ' . $_POST['realname']);
}
}
@@ -75,7 +70,7 @@
}
}
}
- printf('<div class="serendipityAdminMsgSuccess">' . MODIFIED_USER . '</div>', $_POST['username']);
+ printf('<div class="serendipityAdminMsgSuccess">' . MODIFIED_USER . '</div>', $_POST['realname']);
}
}
@@ -106,7 +101,8 @@
<div class="serendipity_admin_list_item serendipity_admin_list_item_<?php echo ($i++ % 2) ? 'even' : 'uneven' ?>">
<table width="100%">
<tr>
- <td><img src="<?php echo $img ?>" alt="" style="border: 0px none ; vertical-align: bottom; display: inline;" /> <?php echo htmlspecialchars($user['username']); ?></td>
+<?php /* TODO: Add username to list once tom figures out how to fix uneven rowstyles */ ?>
+ <td><img src="<?php echo $img ?>" alt="" style="border: 0px none ; vertical-align: bottom; display: inline;" /> <?php echo htmlspecialchars($user['realname']); ?></td>
<td width="100" align="center"><?php echo $user['userlevel']; ?></td>
<td width="200" align="right"> [<a href="?serendipity[adminModule]=users&serendipity[adminAction]=edit&serendipity[userid]=<?php echo $user['authorid'] ?>"><?php echo EDIT ?></a>]
- [<a href="?serendipity[adminModule]=users&serendipity[adminAction]=delete&serendipity[userid]=<?php echo $user['authorid'] ?>"><?php echo DELETE ?></a>]</td>
@@ -180,7 +176,7 @@
?>
<form action="?serendipity[adminModule]=users" method="post">
<div>
- <?php printf(DELETE_USER, $serendipity['GET']['userid'], $user[0]['username']); ?>
+ <?php printf(DELETE_USER, $serendipity['GET']['userid'], $user[0]['realname']); ?>
<br /><br />
<input type="hidden" name="serendipity[user]" value="<?php echo $serendipity['GET']['userid']; ?>" />
<input type="submit" name="DELETE_YES" value="<?php echo DUMP_IT; ?>" class="serendipityPrettyButton" />
Index: entries.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/entries.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- entries.inc.php 3 Feb 2005 18:55:18 -0000 1.20
+++ entries.inc.php 24 Feb 2005 20:14:23 -0000 1.21
@@ -83,7 +83,7 @@
$users = serendipity_fetchUsers();
if (is_array($users)) {
foreach ($users AS $user) {
- echo '<option value="' . $user['authorid'] . '" ' . (isset($serendipity['GET']['filter']['author']) && $serendipity['GET']['filter']['author'] == $user['authorid'] ? 'selected="selected"' : '') . '>' . $user['username'] . '</option>' . "\n";
+ echo '<option value="' . $user['authorid'] . '" ' . (isset($serendipity['GET']['filter']['author']) && $serendipity['GET']['filter']['author'] == $user['authorid'] ? 'selected="selected"' : '') . '>' . $user['author'] . '</option>' . "\n";
}
}
?> </select>
@@ -201,7 +201,7 @@
<tr>
<td>
<?php
- echo POSTED_BY . ' ' . $entry['username'];
+ echo POSTED_BY . ' ' . $entry['author'];
if (count($entry['categories'])) {
echo ' ' . IN . ' ';
$cats = array();
@@ -319,8 +319,8 @@
$entry['comments'] = 0;
}
- if (!isset($entry['username']) || !$entry['username']) {
- $entry['username'] = $serendipity['serendipityUser'];
+ if (!isset($entry['realname']) || !$entry['realname']) {
+ $entry['realname'] = $serendipity['serendipityUser'];
}
$categories = (array)$entry['categories'];
Index: plugins.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/plugins.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- plugins.inc.php 22 Feb 2005 10:21:05 -0000 1.24
+++ plugins.inc.php 24 Feb 2005 20:14:23 -0000 1.25
@@ -168,10 +168,10 @@
foreach($users AS $user) {
if (!$is_plugin_owner && $user['authorid'] == $authorid) {
- $username = htmlspecialchars($user['username']);
+ $realname = htmlspecialchars($user['realname']);
} elseif ($is_plugin_owner) {
?>
- <option value="<?php echo $user['authorid']; ?>"<?php echo ($user['authorid'] == $authorid ? ' selected="selected"' : ''); ?>><?php echo htmlspecialchars($user['username']); ?></option>
+ <option value="<?php echo $user['authorid']; ?>"<?php echo ($user['authorid'] == $authorid ? ' selected="selected"' : ''); ?>><?php echo htmlspecialchars($user['realname']); ?></option>
<?php
}
}
Index: overview.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/overview.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- overview.inc.php 26 Jan 2005 14:14:04 -0000 1.4
+++ overview.inc.php 24 Feb 2005 20:14:23 -0000 1.5
@@ -5,9 +5,13 @@
if (IN_serendipity !== true) {
die ("Don't hack!");
}
+
+$user = serendipity_fetchAuthor($serendipity['authorid']);
?>
-<?php echo WELCOME_BACK . ' ' . $_SESSION['serendipityUser'] . '.'; ?>
+<?php echo WELCOME_BACK ?> <?php echo $user[0]['realname'] ?>.
+
+
<?php
/* vim: set sts=4 ts=4 expandtab : */
Index: category.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/category.inc.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- category.inc.php 3 Feb 2005 18:55:18 -0000 1.14
+++ category.inc.php 24 Feb 2005 20:14:23 -0000 1.15
@@ -226,7 +226,7 @@
<td width="16"><?php if ( !empty($category['category_icon']) ) {?><img src="<?php echo serendipity_getTemplateFile('admin/img/thumbnail.png') ?>" alt="" /><?php } else echo ' ' ?></td>
<td width="300" style="padding-left: <?php echo ($category['depth']*15)+20 ?>px"><img src="<?php echo serendipity_getTemplateFile('admin/img/folder.png') ?>" style="vertical-align: bottom;"> <?php echo htmlspecialchars($category['category_name']) ?></td>
<td><?php echo htmlspecialchars($category['category_description']) ?></td>
- <td align="right"><?php echo ($category['authorid'] == '0' ? ALL_AUTHORS : $category['username']); ?></td>
+ <td align="right"><?php echo ($category['authorid'] == '0' ? ALL_AUTHORS : $category['realname']); ?></td>
</tr>
<?php }
} ?>
Index: personal.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/personal.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- personal.inc.php 26 Jan 2005 14:14:04 -0000 1.11
+++ personal.inc.php 24 Feb 2005 20:14:23 -0000 1.12
@@ -26,7 +26,7 @@
}
$from = $_POST;
?>
- <div class="serendipityAdminMsgSuccess"><?php echo sprintf(MODIFIED_USER, $_POST['username']) ?></div>
+ <div class="serendipityAdminMsgSuccess"><?php echo sprintf(MODIFIED_USER, $_POST['realname']) ?></div>
<?php }
} ?>
Index: installer.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/include/admin/installer.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- installer.inc.php 5 Feb 2005 23:57:32 -0000 1.24
+++ installer.inc.php 24 Feb 2005 20:14:23 -0000 1.25
@@ -425,10 +425,13 @@
echo ' <strong>' . DONE . '</strong><br />';
echo sprintf(CREATING_PRIMARY_AUTHOR, $_POST['user']) .'...';
+ $authorid = serendipity_addAuthor($_POST['user'], $_POST['pass'], $_POST['realname'], $_POST['email'], USERLEVEL_ADMIN);
$mail_comments = (serendipity_db_bool($_POST['want_mail']) ? 1 : 0);
- $query = "INSERT INTO {$serendipity['dbPrefix']}authors (username, password, email, mail_comments, mail_trackbacks, userlevel)
- VALUES ('". $_POST['user'] ."', '". md5($_POST['pass']) ."', '". $_POST['email'] ."', ". $mail_comments .", ". $mail_comments .", " . USERLEVEL_ADMIN . ")";
- serendipity_db_query($query);
+ serendipity_set_user_var('mail_comments', $mail_comments, $authorid);
+ serendipity_set_user_var('mail_trackbacks', $mail_comments, $authorid);
+ serendipity_set_user_var('right_publish', 1, $authorid);
+
+
echo ' <strong>' . DONE . '</strong><br />';
echo SETTING_DEFAULT_TEMPLATE .'... ';
|