]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Issue-#3873
[friendica.git] / mod / photos.php
index 6c9f4bd66214bcbd1d05aac08c5ab3cd16079f1f..4110e805778841af8ca284d808f0e37cf61b2f16 100644 (file)
@@ -3,6 +3,7 @@
 use Friendica\App;
 use Friendica\Core\System;
 use Friendica\Core\Config;
+use Friendica\Core\Worker;
 use Friendica\Network\Probe;
 
 require_once 'include/Photo.php';
@@ -21,7 +22,7 @@ function photos_init(App $a) {
                auto_redir($a, $a->argv[1]);
        }
 
-       if ((get_config('system', 'block_public')) && (! local_user()) && (! remote_user())) {
+       if ((Config::get('system', 'block_public')) && (! local_user()) && (! remote_user())) {
                return;
        }
 
@@ -304,7 +305,7 @@ function photos_post(App $a) {
                                        // send the notification upstream/downstream as the case may be
 
                                        if ($rr['visible']) {
-                                               proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
+                                               Worker::add(PRIORITY_HIGH, "notifier", "drop", $drop_id);
                                        }
                                }
                        }
@@ -381,7 +382,7 @@ function photos_post(App $a) {
                                photo_albums($page_owner_uid, true);
 
                                if ($i[0]['visible']) {
-                                       proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
+                                       Worker::add(PRIORITY_HIGH, "notifier", "drop", $drop_id);
                                }
                        }
                }
@@ -729,7 +730,7 @@ function photos_post(App $a) {
 
                                        $item_id = item_store($arr);
                                        if ($item_id) {
-                                               proc_run(PRIORITY_HIGH, "include/notifier.php", "tag", $item_id);
+                                               Worker::add(PRIORITY_HIGH, "notifier", "tag", $item_id);
                                        }
                                }
                        }
@@ -810,7 +811,7 @@ function photos_post(App $a) {
 
        logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
 
-       $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);
@@ -832,24 +833,6 @@ function photos_post(App $a) {
 
        $imagedata = @file_get_contents($src);
 
-
-       $limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
-
-       if ($limit) {
-               $r = q("SELECT SUM(OCTET_LENGTH(`data`)) AS `total` FROM `photo` WHERE `uid` = %d AND `scale` = 0 AND `album` != 'Contact Photos'",
-                       intval($a->data['user']['uid'])
-               );
-               $size = $r[0]['total'];
-
-               if (($size + strlen($imagedata)) > $limit) {
-                       notice( upgrade_message() . EOL );
-                       @unlink($src);
-                       $foo = 0;
-                       call_hooks('photo_post_end',$foo);
-                       killme();
-               }
-       }
-
        $ph = new Photo($imagedata, $type);
 
        if (! $ph->is_valid()) {
@@ -864,7 +847,7 @@ function photos_post(App $a) {
        $exif = $ph->orient($src);
        @unlink($src);
 
-       $max_length = get_config('system', 'max_image_length');
+       $max_length = Config::get('system', 'max_image_length');
        if (! $max_length) {
                $max_length = MAX_IMAGE_LENGTH;
        }
@@ -952,7 +935,7 @@ function photos_post(App $a) {
        photo_albums($page_owner_uid, true);
 
        if ($visible) {
-               proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);
+               Worker::add(PRIORITY_HIGH, "notifier", 'wall-new', $item_id);
        }
 
        call_hooks('photo_post_end',intval($item_id));
@@ -978,7 +961,7 @@ function photos_content(App $a) {
        // photos/name/image/xxxxx/edit
 
 
-       if ((get_config('system', 'block_public')) && (! local_user()) && (! remote_user())) {
+       if ((Config::get('system', 'block_public')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
                return;
        }
@@ -1145,15 +1128,6 @@ function photos_content(App $a) {
                ));
 
                $usage_message = '';
-               $limit = service_class_fetch($a->data['user']['uid'], 'photo_upload_limit');
-               if ($limit !== false) {
-
-                       $r = q("SELECT SUM(`datasize`) AS `total` FROM `photo` WHERE `uid` = %d AND `scale` = 0 AND `album` != 'Contact Photos'",
-                               intval($a->data['user']['uid'])
-                       );
-                       $usage_message = sprintf(t("You have used %1$.2f Mbytes of %2$.2f Mbytes photo storage."), $r[0]['total'] / 1024000, $limit / 1024000 );
-               }
-
 
                // Private/public post links for the non-JS ACL form
                $private_post = 1;