]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
forgot to check this in earlier... splits up text and html into two different templat...
[friendica.git] / mod / settings.php
index 1923c58da1148d4f69742dd6df209fce410559b3..dbbac8bdeb3c9b14f2eededb6a74242c64889d29 100644 (file)
@@ -87,11 +87,14 @@ function settings_post(&$a) {
 
        $err = '';
 
+       $name_change = false;
+
        if($username != $a->user['username']) {
-               if(strlen($username) > 40)
-                       $err .= t(' Please use a shorter name.');
-               if(strlen($username) < 3)
-                       $err .= t(' Name too short.');
+               $name_change = true;
+               if(strlen($username) > 40)
+                       $err .= t(' Please use a shorter name.');
+               if(strlen($username) < 3)
+                       $err .= t(' Name too short.');
        }
 
        if($email != $a->user['email']) {
@@ -165,13 +168,22 @@ function settings_post(&$a) {
                intval(local_user())
        );
 
+
+       if($name_change) {
+               q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self` = 1 LIMIT 1",
+                       dbesc($username),
+                       dbesc(datetime_convert()),
+                       intval(local_user())
+               );
+       }               
+
        if($old_visibility != $net_publish) {
                // Update global directory in background
                $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
                $url = $_SESSION['my_url'];
                if($url && strlen(get_config('system','directory_submit_url')))
-                       proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",
-                               array(),$foo));
+                       //proc_close(proc_open("\"$php_path\" \"include/directory.php\" \"$url\" &",array(),$foo));
+                       proc_run($php_path,"include/directory.php","$url");
        }
 
        $_SESSION['theme'] = $theme;