[geeklog-cvs] geeklog-1.3/public_html usersettings.php,1.107,1.108
dhaun at iowaoutdoors.org
dhaun at iowaoutdoors.org
Sun Nov 14 15:55:16 EST 2004
Update of /var/cvs/geeklog-1.3/public_html
In directory www:/tmp/cvs-serv27315
Modified Files:
usersettings.php
Log Message:
Rename userphoto when changing a username (bug #321)
Index: usersettings.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/usersettings.php,v
retrieving revision 1.107
retrieving revision 1.108
diff -C2 -d -r1.107 -r1.108
*** usersettings.php 9 Oct 2004 20:44:41 -0000 1.107
--- usersettings.php 14 Nov 2004 20:55:14 -0000 1.108
***************
*** 798,801 ****
--- 798,819 ----
$A['new_username'] = addslashes ($A['new_username']);
if (DB_count ($_TABLES['users'], 'username', $A['new_username']) == 0) {
+ if ($_CONF['allow_user_photo'] == 1) {
+ $photo = DB_getItem ($_TABLES['users'], 'photo',
+ "uid = {$_USER['uid']}");
+ $newphoto = preg_replace ('/' . $_USER['username'] . '/',
+ $A['new_username'], $photo, 1);
+ $imgpath = $_CONF['path_images'] . 'userphotos/';
+ if (rename ($imgpath . $photo,
+ $imgpath . $newphoto) === false) {
+ $display = COM_siteHeader ('menu');
+ $display .= COM_errorLog ('Could not rename userphoto "'
+ . $photo . '" to "' . $newphoto . '".');
+ $display .= COM_siteFooter ();
+ return $display;
+ }
+ DB_change ($_TABLES['users'], 'photo',
+ addslashes ($newphoto), "uid", $_USER['uid']);
+ }
+
DB_change ($_TABLES['users'], 'username', $A['new_username'],
"uid", $_USER['uid']);
More information about the geeklog-cvs
mailing list