]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile_photo.php
Merge develop into 0308-Notifications-restructure
[friendica.git] / mod / profile_photo.php
index e3d6adb4914244dffe5564c64b4553ffb9e6dc34..11e671afc58a2f58e5ef51655d55a473e78aa708 100644 (file)
@@ -2,7 +2,6 @@
 
 require_once("include/Photo.php");
 
-if(! function_exists('profile_photo_init')) {
 function profile_photo_init(&$a) {
 
        if(! local_user()) {
@@ -10,10 +9,10 @@ function profile_photo_init(&$a) {
        }
 
        profile_load($a,$a->user['nickname']);
+
 }
-}
 
-if(! function_exists('profile_photo_post')) {
+
 function profile_photo_post(&$a) {
 
        if(! local_user()) {
@@ -126,7 +125,7 @@ function profile_photo_post(&$a) {
                                // Update global directory in background
                                $url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
                                if($url && strlen(get_config('system','directory')))
-                                       proc_run('php',"include/directory.php","$url");
+                                       proc_run(PRIORITY_LOW, "include/directory.php", $url);
 
                                require_once('include/profile_update.php');
                                profile_change();
@@ -144,7 +143,7 @@ function profile_photo_post(&$a) {
        $filesize = intval($_FILES['userfile']['size']);
        $filetype = $_FILES['userfile']['type'];
     if ($filetype=="") $filetype=guess_image_type($filename);
-
+    
        $maximagesize = get_config('system','maximagesize');
 
        if(($maximagesize) && ($filesize > $maximagesize)) {
@@ -165,7 +164,7 @@ function profile_photo_post(&$a) {
        $ph->orient($src);
        @unlink($src);
        return profile_photo_crop_ui_head($a, $ph);
-}
+       
 }
 
 
@@ -176,7 +175,7 @@ function profile_photo_content(&$a) {
                notice( t('Permission denied.') . EOL );
                return;
        }
-
+       
        $newuser = false;
 
        if($a->argc == 2 && $a->argv[1] === 'new')
@@ -187,9 +186,9 @@ function profile_photo_content(&$a) {
                        notice( t('Permission denied.') . EOL );
                        return;
                };
-
+               
 //             check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
-
+        
                $resource_id = $a->argv[2];
                //die(":".local_user());
                $r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC",
@@ -225,7 +224,7 @@ function profile_photo_content(&$a) {
                        // Update global directory in background
                        $url = $_SESSION['my_url'];
                        if($url && strlen(get_config('system','directory')))
-                               proc_run('php',"include/directory.php","$url");
+                               proc_run(PRIORITY_LOW, "include/directory.php", $url);
 
                        goaway($a->get_baseurl() . '/profiles');
                        return; // NOTREACHED
@@ -241,7 +240,7 @@ function profile_photo_content(&$a) {
 
 
        if(! x($a->config,'imagecrop')) {
-
+       
                $tpl = get_markup_template('profile_photo.tpl');
 
                $o .= replace_macros($tpl,array(
@@ -296,11 +295,11 @@ function profile_photo_crop_ui_head(&$a, $ph){
        }
 
        $hash = photo_new_resource();
-
+       
 
        $smallest = 0;
 
-       $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
+       $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );   
 
        if($r)
                info( t('Image uploaded successfully.') . EOL );
@@ -309,8 +308,8 @@ function profile_photo_crop_ui_head(&$a, $ph){
 
        if($width > 640 || $height > 640) {
                $ph->scaleImage(640);
-               $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
-
+               $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );   
+               
                if($r === false)
                        notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
                else
@@ -324,3 +323,4 @@ function profile_photo_crop_ui_head(&$a, $ph){
        $a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
        return;
 }}
+