]> git.mxchange.org Git - friendica.git/blobdiff - mod/profile_photo.php
Remove unused upubkey and uprvkey from queries
[friendica.git] / mod / profile_photo.php
index c9fc5232df57862c50bbac0fa4035481289c6532..e80b9ee84e02a15024be814d3e070a8ad243222c 100644 (file)
@@ -1,6 +1,10 @@
 <?php
 
 use Friendica\App;
+use Friendica\Core\Config;
+use Friendica\Core\System;
+use Friendica\Core\Worker;
+use Friendica\Database\DBM;
 
 require_once("include/Photo.php");
 
@@ -32,7 +36,7 @@ function profile_photo_post(App $a) {
                                intval($_REQUEST['profile']),
                                intval(local_user())
                        );
-                       if (dbm::is_result($r) && (! intval($r[0]['is-default'])))
+                       if (DBM::is_result($r) && (! intval($r[0]['is-default'])))
                                $is_default_profile = 0;
                }
 
@@ -63,7 +67,7 @@ function profile_photo_post(App $a) {
                        dbesc(local_user()),
                        intval($scale));
 
-               if (dbm::is_result($r)) {
+               if (DBM::is_result($r)) {
 
                        $base_image = $r[0];
 
@@ -102,15 +106,15 @@ function profile_photo_post(App $a) {
                                        );
 
                                        $r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s'  WHERE `self` AND `uid` = %d",
-                                               dbesc(App::get_baseurl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
-                                               dbesc(App::get_baseurl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
-                                               dbesc(App::get_baseurl() . '/photo/' . $base_image['resource-id'] . '-6.' . $im->getExt()),
+                                               dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
+                                               dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
+                                               dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-6.' . $im->getExt()),
                                                intval(local_user())
                                        );
                                } else {
                                        $r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
-                                               dbesc(App::get_baseurl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
-                                               dbesc(App::get_baseurl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
+                                               dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
+                                               dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
                                                intval($_REQUEST['profile']),
                                                intval(local_user())
                                        );
@@ -126,18 +130,18 @@ function profile_photo_post(App $a) {
 
                                info( t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
                                // Update global directory in background
-                               $url = App::get_baseurl() . '/profile/' . $a->user['nickname'];
-                               if ($url && strlen(get_config('system','directory'))) {
-                                       proc_run(PRIORITY_LOW, "include/directory.php", $url);
+                               $url = System::baseUrl() . '/profile/' . $a->user['nickname'];
+                               if ($url && strlen(Config::get('system','directory'))) {
+                                       Worker::add(PRIORITY_LOW, "Directory", $url);
                                }
 
-                               proc_run(PRIORITY_LOW, 'include/profile_update.php', local_user());
+                               Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
                        } else {
                                notice( t('Unable to process image') . EOL);
                        }
                }
 
-               goaway(App::get_baseurl() . '/profiles');
+               goaway(System::baseUrl() . '/profiles');
                return; // NOTREACHED
        }
 
@@ -149,7 +153,7 @@ function profile_photo_post(App $a) {
                $filetype = guess_image_type($filename);
        }
 
-       $maximagesize = get_config('system','maximagesize');
+       $maximagesize = Config::get('system','maximagesize');
 
        if (($maximagesize) && ($filesize > $maximagesize)) {
                notice( sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL);
@@ -199,7 +203,7 @@ function profile_photo_content(App $a) {
                        intval(local_user()),
                        dbesc($resource_id)
                        );
-               if (!dbm::is_result($r)){
+               if (!DBM::is_result($r)){
                        notice( t('Permission denied.') . EOL );
                        return;
                }
@@ -227,11 +231,11 @@ function profile_photo_content(App $a) {
 
                        // Update global directory in background
                        $url = $_SESSION['my_url'];
-                       if ($url && strlen(get_config('system','directory'))) {
-                               proc_run(PRIORITY_LOW, "include/directory.php", $url);
+                       if ($url && strlen(Config::get('system','directory'))) {
+                               Worker::add(PRIORITY_LOW, "Directory", $url);
                        }
 
-                       goaway(App::get_baseurl() . '/profiles');
+                       goaway(System::baseUrl() . '/profiles');
                        return; // NOTREACHED
                }
                $ph = new Photo($r[0]['data'], $r[0]['type']);
@@ -256,7 +260,7 @@ function profile_photo_content(App $a) {
                        '$submit' => t('Upload'),
                        '$profiles' => $profiles,
                        '$form_security_token' => get_form_security_token("profile_photo"),
-                       '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . App::get_baseurl() . '">' . t('skip this step') . '</a>' : '<a href="'. App::get_baseurl() . '/photos/' . $a->user['nickname'] . '">' . t('select a photo from your photo albums') . '</a>')
+                       '$select' => sprintf('%s %s', t('or'), ($newuser) ? '<a href="' . System::baseUrl() . '">' . t('skip this step') . '</a>' : '<a href="'. System::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . t('select a photo from your photo albums') . '</a>')
                ));
 
                return $o;
@@ -269,7 +273,7 @@ function profile_photo_content(App $a) {
                        '$filename' => $filename,
                        '$profile' => intval($_REQUEST['profile']),
                        '$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'],
-                       '$image_url' => App::get_baseurl() . '/photo/' . $filename,
+                       '$image_url' => System::baseUrl() . '/photo/' . $filename,
                        '$title' => t('Crop Image'),
                        '$desc' => t('Please adjust the image cropping for optimum viewing.'),
                        '$form_security_token' => get_form_security_token("profile_photo"),
@@ -284,7 +288,7 @@ function profile_photo_content(App $a) {
 
 if(! function_exists('profile_photo_crop_ui_head')) {
 function profile_photo_crop_ui_head(App $a, $ph) {
-       $max_length = get_config('system','max_image_length');
+       $max_length = Config::get('system','max_image_length');
        if (! $max_length) {
                $max_length = MAX_IMAGE_LENGTH;
        }