X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fwall_upload.php;h=ce73f85151dde9277796c619baaef129110a299d;hb=3359f3f5c7ecc4b6a34c4fcfc095ab4dd5fab0f1;hp=1707040e6c91dfac04c9ad7b5c69551e3b416204;hpb=56ee734b00aead633d5d213a6b140b75bc17ba96;p=friendica.git diff --git a/mod/wall_upload.php b/mod/wall_upload.php index 1707040e6c..ce73f85151 100644 --- a/mod/wall_upload.php +++ b/mod/wall_upload.php @@ -9,9 +9,11 @@ * to the url */ +use Friendica\App; +use Friendica\Core\System; use Friendica\Core\Config; - -require_once 'include/Photo.php'; +use Friendica\Database\DBM; +use Friendica\Object\Photo; function wall_upload_post(App $a, $desktopmode = true) { @@ -30,7 +32,7 @@ function wall_upload_post(App $a, $desktopmode = true) { dbesc($nick) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { if ($r_json) { echo json_encode(array('error'=>t('Invalid request.'))); killme(); @@ -86,7 +88,7 @@ function wall_upload_post(App $a, $desktopmode = true) { intval($contact_id), intval($page_owner_uid) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $can_post = true; $visitor = $contact_id; } @@ -160,7 +162,7 @@ function wall_upload_post(App $a, $desktopmode = true) { } if ($filetype=="") { - $filetype=guess_image_type($filename); + $filetype=Photo::guessImageType($filename); } // If there is a temp name, then do a manual check @@ -187,33 +189,10 @@ function wall_upload_post(App $a, $desktopmode = true) { killme(); } - - $limit = service_class_fetch($page_owner_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($page_owner_uid) - ); - $size = $r[0]['total']; - - if (($size + strlen($imagedata)) > $limit) { - $msg = upgrade_message(true); - if ($r_json) { - echo json_encode(array('error'=>$msg)); - } else { - echo $msg. EOL; - } - @unlink($src); - killme(); - } - } - $imagedata = @file_get_contents($src); $ph = new Photo($imagedata, $filetype); - if (! $ph->is_valid()) { + if (! $ph->isValid()) { $msg = t('Unable to process image.'); if ($r_json) { echo json_encode(array('error'=>$msg)); @@ -300,9 +279,9 @@ function wall_upload_post(App $a, $desktopmode = true) { $picture["width"] = $r[0]["width"]; $picture["height"] = $r[0]["height"]; $picture["type"] = $r[0]["type"]; - $picture["albumpage"] = App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash; - $picture["picture"] = App::get_baseurl() . "/photo/{$hash}-0." . $ph->getExt(); - $picture["preview"] = App::get_baseurl() . "/photo/{$hash}-{$smallest}." . $ph->getExt(); + $picture["albumpage"] = System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash; + $picture["picture"] = System::baseUrl() . "/photo/{$hash}-0." . $ph->getExt(); + $picture["preview"] = System::baseUrl() . "/photo/{$hash}-{$smallest}." . $ph->getExt(); if ($r_json) { echo json_encode(array('picture'=>$picture)); @@ -320,9 +299,9 @@ function wall_upload_post(App $a, $desktopmode = true) { /* mod Waitman Gobble NO WARRANTY */ // if we get the signal then return the image url info in BBCODE if ($_REQUEST['hush']!='yeah') { - echo "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . App::get_baseurl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n"; + echo "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . System::baseUrl() . "/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]\n\n"; } else { - $m = '[url='.App::get_baseurl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.App::get_baseurl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]"; + $m = '[url='.System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.System::baseUrl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]"; return($m); } /* mod Waitman Gobble NO WARRANTY */