[geeklog-cvs] geeklog-1.3/public_html/admin user.php,1.86,1.87

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/admin
In directory www:/tmp/cvs-serv27315/admin

Modified Files:
	user.php 
Log Message:
Rename userphoto when changing a username (bug #321)


Index: user.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/public_html/admin/user.php,v
retrieving revision 1.86
retrieving revision 1.87
diff -C2 -d -r1.86 -r1.87
*** user.php	7 Oct 2004 21:10:23 -0000	1.86
--- user.php	14 Nov 2004 20:55:14 -0000	1.87
***************
*** 331,334 ****
--- 331,356 ----
                  $curphoto = '';
              }
+ 
+             if (($_CONF['allow_user_photo'] == 1) && !empty ($curphoto)) {
+                 $curusername = DB_getItem ($_TABLES['users'], 'username',
+                                            "uid = $uid");
+                 if ($curusername != $username) {
+                     // user has been renamed - rename the photo, too
+                     $newphoto = preg_replace ('/' . $curusername . '/',
+                                               $username, $curphoto, 1);
+                     $imgpath = $_CONF['path_images'] . 'userphotos/';
+                     if (rename ($imgpath . $curphoto,
+                                 $imgpath . $newphoto) === false) {
+                         $display = COM_siteHeader ('menu');
+                         $display .= COM_errorLog ('Could not rename userphoto "'
+                                         . $photo . '" to "' . $newphoto . '".');
+                         $display .= COM_siteFooter ();
+                         return $display;
+                     }
+                     $curphoto = $newphoto;
+                 }
+             }
+ 
+             $curphoto = addslashes ($curphoto);
              DB_query("UPDATE {$_TABLES['users']} SET username = '$username', fullname = '$fullname', passwd = '$passwd', email = '$email', homepage = '$homepage', photo = '$curphoto' WHERE uid = $uid");
              if ($_CONF['custom_registration'] AND (function_exists('custom_usersave'))) {




More information about the geeklog-cvs mailing list