Browse Source

Revert "Move Objects to Model"

pull/4035/head
Michael Vogel 4 years ago
committed by GitHub
parent
commit
5747cfc79c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      boot.php
  2. 6
      include/acl_selectors.php
  3. 57
      include/api.php
  4. 2
      include/bb2diaspora.php
  5. 2
      include/bbcode.php
  6. 10
      include/contact_widgets.php
  7. 8
      include/conversation.php
  8. 2
      include/follow.php
  9. 2
      include/identity.php
  10. 20
      include/items.php
  11. 2
      include/like.php
  12. 18
      include/network.php
  13. 6
      include/plaintext.php
  14. 6
      include/post_update.php
  15. 20
      include/tags.php
  16. 2
      include/threads.php
  17. 8
      include/uimport.php
  18. 2
      mod/admin.php
  19. 8
      mod/allfriends.php
  20. 2
      mod/cal.php
  21. 12
      mod/common.php
  22. 10
      mod/contacts.php
  23. 2
      mod/crepair.php
  24. 2
      mod/dfrn_confirm.php
  25. 2
      mod/dfrn_notify.php
  26. 2
      mod/dfrn_request.php
  27. 2
      mod/directory.php
  28. 6
      mod/dirfind.php
  29. 2
      mod/display.php
  30. 4
      mod/fbrowser.php
  31. 2
      mod/follow.php
  32. 6
      mod/hovercard.php
  33. 4
      mod/install.php
  34. 8
      mod/item.php
  35. 2
      mod/match.php
  36. 2
      mod/message.php
  37. 2
      mod/network.php
  38. 2
      mod/nogroup.php
  39. 18
      mod/photo.php
  40. 63
      mod/photos.php
  41. 2
      mod/ping.php
  42. 57
      mod/profile_photo.php
  43. 6
      mod/profiles.php
  44. 31
      mod/proxy.php
  45. 4
      mod/randprof.php
  46. 4
      mod/settings.php
  47. 6
      mod/suggest.php
  48. 2
      mod/unfollow.php
  49. 2
      mod/videos.php
  50. 2
      mod/viewcontacts.php
  51. 37
      mod/wall_upload.php
  52. 2
      src/Core/NotificationsManager.php
  53. 6
      src/Model/GlobalContact.php
  54. 174
      src/Model/Photo.php
  55. 23
      src/Model/User.php
  56. 2
      src/Network/Probe.php
  57. 9
      src/Object/Contact.php
  58. 22
      src/Object/Conversation.php
  59. 43
      src/Object/Item.php
  60. 328
      src/Object/Photo.php
  61. 8
      src/Object/Profile.php
  62. 6
      src/ParseUrl.php
  63. 14
      src/Protocol/DFRN.php
  64. 10
      src/Protocol/Diaspora.php
  65. 14
      src/Protocol/OStatus.php
  66. 25
      src/Protocol/PortableContact.php
  67. 6
      src/Worker/CronJobs.php
  68. 2
      src/Worker/Delivery.php
  69. 10
      src/Worker/DiscoverPoCo.php
  70. 4
      src/Worker/GProbe.php
  71. 2
      src/Worker/Notifier.php
  72. 2
      src/Worker/OnePoll.php
  73. 11
      update.php
  74. 2
      util/global_community_block.php
  75. 4
      view/theme/frio/theme.php
  76. 4
      view/theme/frost/theme.php
  77. 4
      view/theme/vier/theme.php

3
boot.php

@ -27,7 +27,8 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
use Friendica\Util\Lock;
require_once 'include/network.php';
require_once 'include/plugin.php';

6
include/acl_selectors.php

@ -6,8 +6,8 @@ use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
require_once "include/contact_selectors.php";
require_once "include/contact_widgets.php";
@ -774,7 +774,7 @@ function navbar_complete(App $a) {
}
if ($localsearch) {
$x = GContact::searchByName($search, $mode);
$x = GlobalContact::searchByName($search, $mode);
return $x;
}

57
include/api.php

@ -12,8 +12,6 @@ use Friendica\Core\Config;
use Friendica\Core\NotificationsManager;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Photo;
use Friendica\Model\User;
use Friendica\Network\FKOAuth1;
use Friendica\Network\HTTPException;
@ -25,7 +23,8 @@ use Friendica\Network\HTTPException\NotFoundException;
use Friendica\Network\HTTPException\NotImplementedException;
use Friendica\Network\HTTPException\UnauthorizedException;
use Friendica\Network\HTTPException\TooManyRequestsException;
use Friendica\Object\Image;
use Friendica\Object\Contact;
use Friendica\Object\Photo;
use Friendica\Protocol\Diaspora;
use Friendica\Util\XML;
@ -1193,7 +1192,7 @@ function api_statuses_update($type)
api_user()
);
if (DBM::is_result($r)) {
$phototypes = Image::supportedTypes();
$phototypes = Photo::supportedTypes();
$ext = $phototypes[$r[0]['type']];
$_REQUEST['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']';
$_REQUEST['body'] .= '[img]' . System::baseUrl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . '[/img][/url]';
@ -2378,7 +2377,7 @@ function api_get_attachments(&$body)
$attachments = array();
foreach ($images[1] as $image) {
$imagedata = Image::getInfoFromURL($image);
$imagedata = Photo::getInfoFromURL($image);
if ($imagedata) {
$attachments[] = array("url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]);
@ -2510,7 +2509,7 @@ function api_get_entitities(&$text, $bbcode)
$start = iconv_strpos($text, $url, $offset, "UTF-8");
if (!($start === false)) {
$image = Image::getInfoFromURL($url);
$image = Photo::getInfoFromURL($url);
if ($image) {
// If image cache is activated, then use the following sizes:
// thumb (150), small (340), medium (600) and large (1024)
@ -2518,19 +2517,19 @@ function api_get_entitities(&$text, $bbcode)
$media_url = proxy_url($url);
$sizes = array();
$scale = Image::getScalingDimensions($image[0], $image[1], 150);
$scale = Photo::scaleImageTo($image[0], $image[1], 150);
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
if (($image[0] > 150) || ($image[1] > 150)) {
$scale = Image::getScalingDimensions($image[0], $image[1], 340);
$scale = Photo::scaleImageTo($image[0], $image[1], 340);
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
}
$scale = Image::getScalingDimensions($image[0], $image[1], 600);
$scale = Photo::scaleImageTo($image[0], $image[1], 600);
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
if (($image[0] > 600) || ($image[1] > 600)) {
$scale = Image::getScalingDimensions($image[0], $image[1], 1024);
$scale = Photo::scaleImageTo($image[0], $image[1], 1024);
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
}
} else {
@ -3947,7 +3946,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
}
if ($filetype == "") {
$filetype=Image::guessType($filename);
$filetype=Photo::guessImageType($filename);
}
$imagedata = getimagesize($src);
if ($imagedata) {
@ -3971,13 +3970,13 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
// create Photo instance with the data of the image
$imagedata = @file_get_contents($src);
$Image = new Image($imagedata, $filetype);
if (! $Image->isValid()) {
$ph = new Photo($imagedata, $filetype);
if (! $ph->isValid()) {
throw new InternalServerErrorException("unable to process image data");
}
// check orientation of image
$Image->orient($src);
$ph->orient($src);
@unlink($src);
// check max length of images on server
@ -3986,11 +3985,11 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
$max_length = MAX_IMAGE_LENGTH;
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
$ph->scaleImage($max_length);
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
}
$width = $Image->getWidth();
$height = $Image->getHeight();
$width = $ph->getWidth();
$height = $ph->getHeight();
// create a new resource-id if not already provided
$hash = ($photo_id == null) ? photo_new_resource() : $photo_id;
@ -3999,21 +3998,21 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
// upload normal image (scales 0, 1, 2)
logger("photo upload: starting new photo upload", LOGGER_DEBUG);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
$r =$ph->store(local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (! $r) {
logger("photo upload: image upload with scale 0 (original size) failed");
}
if ($width > 640 || $height > 640) {
$Image->scaleDown(640);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
$ph->scaleImage(640);
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (! $r) {
logger("photo upload: image upload with scale 1 (640x640) failed");
}
}
if ($width > 320 || $height > 320) {
$Image->scaleDown(320);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
$ph->scaleImage(320);
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (! $r) {
logger("photo upload: image upload with scale 2 (320x320) failed");
}
@ -4024,29 +4023,29 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
logger("photo upload: starting new profile image upload", LOGGER_DEBUG);
if ($width > 175 || $height > 175) {
$Image->scaleDown(175);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
$ph->scaleImage(175);
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (! $r) {
logger("photo upload: profile image upload with scale 4 (175x175) failed");
}
}
if ($width > 80 || $height > 80) {
$Image->scaleDown(80);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
$ph->scaleImage(80);
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (! $r) {
logger("photo upload: profile image upload with scale 5 (80x80) failed");
}
}
if ($width > 48 || $height > 48) {
$Image->scaleDown(48);
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
$ph->scaleImage(48);
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
if (! $r) {
logger("photo upload: profile image upload with scale 6 (48x48) failed");
}
}
$Image->__destruct();
$ph->__destruct();
logger("photo upload: new profile image upload ended", LOGGER_DEBUG);
}

2
include/bb2diaspora.php

@ -2,8 +2,8 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use League\HTMLToMarkdown\HtmlConverter;

2
include/bbcode.php

@ -5,7 +5,7 @@ use Friendica\Content\Smilies;
use Friendica\Core\Cache;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/oembed.php';
require_once 'include/event.php';

10
include/contact_widgets.php

@ -7,7 +7,7 @@ use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
require_once 'include/contact_selectors.php';
@ -250,18 +250,18 @@ function common_friends_visitor_widget($profile_uid) {
}
if ($cid) {
$t = GContact::countCommonFriends($profile_uid, $cid);
$t = GlobalContact::countCommonFriends($profile_uid, $cid);
} else {
$t = GContact::countCommonFriendsZcid($profile_uid, $zcid);
$t = GlobalContact::countCommonFriendsZcid($profile_uid, $zcid);
}
if (! $t) {
return;
}
if ($cid) {
$r = GContact::commonFriends($profile_uid, $cid, 0, 5, true);
$r = GlobalContact::commonFriends($profile_uid, $cid, 0, 5, true);
} else {
$r = GContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
$r = GlobalContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
}
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(

8
include/conversation.php

@ -8,8 +8,8 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Thread;
use Friendica\Object\Contact;
use Friendica\Object\Conversation;
use Friendica\Object\Item;
require_once "include/bbcode.php";
@ -840,7 +840,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
// Normal View
$page_template = get_markup_template("threaded_conversation.tpl");
$conv = new Thread($mode, $preview);
$conv = new Conversation($mode, $preview);
/*
* get all the topmost parents
@ -881,7 +881,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
if ($item['id'] == $item['parent']) {
$item_object = new Item($item);
$conv->addParent($item_object);
$conv->addThread($item_object);
}
}

2
include/follow.php

@ -7,8 +7,8 @@ use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\PortableContact;

2
include/identity.php

@ -12,7 +12,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/bbcode.php';
require_once 'mod/proxy.php';

20
include/items.php

@ -10,11 +10,11 @@ use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Object\Image;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
use Friendica\Protocol\DFRN;
use Friendica\Protocol\OStatus;
use Friendica\Util\Lock;
require_once 'include/bbcode.php';
require_once 'include/oembed.php';
@ -742,10 +742,10 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
* On comments the author is the better choice.
*/
if ($arr['parent-uri'] === $arr['uri']) {
$arr["gcontact-id"] = GContact::getId(array("url" => $arr['owner-link'], "network" => $arr['network'],
$arr["gcontact-id"] = GlobalContact::getId(array("url" => $arr['owner-link'], "network" => $arr['network'],
"photo" => $arr['owner-avatar'], "name" => $arr['owner-name']));
} else {
$arr["gcontact-id"] = GContact::getId(array("url" => $arr['author-link'], "network" => $arr['network'],
$arr["gcontact-id"] = GlobalContact::getId(array("url" => $arr['author-link'], "network" => $arr['network'],
"photo" => $arr['author-avatar'], "name" => $arr['author-name']));
}
}
@ -1887,11 +1887,11 @@ function fix_private_photos($s, $uid, $item = null, $cid = 0) {
$width = intval($match[1]);
$height = intval($match[2]);
$Image = new Image($data, $type);
if ($Image->isValid()) {
$Image->scaleDown(max($width, $height));
$data = $Image->asString();
$type = $Image->getType();
$ph = new Photo($data, $type);
if ($ph->isValid()) {
$ph->scaleImage(max($width, $height));
$data = $ph->imageString();
$type = $ph->getType();
}
}

2
include/like.php

@ -4,7 +4,7 @@ use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
use Friendica\Protocol\Diaspora;
/**

18
include/network.php

@ -6,7 +6,7 @@ use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Object\Photo;
use Friendica\Util\XML;
/**
@ -710,18 +710,18 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
}
// guess mimetype from headers or filename
$type = Image::guessType($mtch[1], true);
$type = Photo::guessImageType($mtch[1], true);
if ($i) {
$Image = new Image($i, $type);
if ($Image->isValid()) {
$orig_width = $Image->getWidth();
$orig_height = $Image->getHeight();
$ph = new Photo($i, $type);
if ($ph->isValid()) {
$orig_width = $ph->getWidth();
$orig_height = $ph->getHeight();
if ($orig_width > 640 || $orig_height > 640) {
$Image->scaleDown(640);
$new_width = $Image->getWidth();
$new_height = $Image->getHeight();
$ph->scaleImage(640);
$new_width = $ph->getWidth();
$new_height = $ph->getHeight();
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
$s = str_replace(
$mtch[0],

6
include/plaintext.php

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\ParseUrl;
use Friendica\Core\PConfig;
use Friendica\Object\Image;
use Friendica\Object\Photo;
require_once "include/bbcode.php";
require_once "include/html2plain.php";
@ -51,7 +51,7 @@ function get_old_attachment_data($body) {
if (preg_match("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $attacheddata, $matches)) {
$picturedata = Image::getInfoFromURL($matches[1]);
$picturedata = Photo::getInfoFromURL($matches[1]);
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1]))
$post["image"] = $matches[1];
@ -221,7 +221,7 @@ function get_attached_data($body, $item = array()) {
$post["preview"] = $pictures[0][2];
$post["text"] = str_replace($pictures[0][0], "", $body);
} else {
$imgdata = Image::getInfoFromURL($pictures[0][1]);
$imgdata = Photo::getInfoFromURL($pictures[0][1]);
if (substr($imgdata["mime"], 0, 6) == "image/") {
$post["type"] = "photo";
$post["image"] = $pictures[0][1];

6
include/post_update.php

@ -5,8 +5,8 @@
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
/**
* @brief Calls the post update functions
@ -74,7 +74,7 @@ function post_update_1192() {
// Set the "gcontact-id" in the item table and add a new gcontact entry if needed
foreach ($item_arr AS $item) {
$gcontact_id = GContact::getId(array("url" => $item['author-link'], "network" => $item['network'],
$gcontact_id = GlobalContact::getId(array("url" => $item['author-link'], "network" => $item['network'],
"photo" => $item['author-avatar'], "name" => $item['author-name']));
q("UPDATE `item` SET `gcontact-id` = %d WHERE `uid` = %d AND `author-link` = '%s' AND `gcontact-id` = 0",
intval($gcontact_id), intval($item["uid"]), dbesc($item["author-link"]));

20
include/tags.php

@ -6,7 +6,7 @@ use Friendica\App;
use Friendica\Content\Feature;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
function create_tags_from_item($itemid) {
$profile_base = System::baseUrl();
@ -157,13 +157,13 @@ function update_items() {
/**
* @brief Get alphabetical sorted array of used tags/terms of an user including
* a weighting by frequency of use.
*
*
* @param int $uid The user ID.
* @param int $count Max number of displayed tags/terms.
* @param int $owner_id The contact id of the owner of the tagged items.
* @param string $flags Special item flags.
* @param int $type The tag/term type.
*
*
* @return arr Alphabetical sorted array of used tags of an user.
*/
function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG) {
@ -197,19 +197,19 @@ function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA
if(!DBM::is_result($r)) {
return array();
}
return tag_calc($r);
}
/**
* @brief Construct a tag/term cloud block for an user.
*
*
* @param int $uid The user ID.
* @param int $count Max number of displayed tags/terms.
* @param int $owner_id The contact ID of the owner of the tagged items.
* @param string $flags Special item flags.
* @param int $type The tag/term type.
*
*
* @return string HTML formatted output.
*/
function wtagblock($uid, $count = 0,$owner_id = 0, $flags = '', $type = TERM_HASHTAG) {
@ -244,7 +244,7 @@ function wtagblock($uid, $count = 0,$owner_id = 0, $flags = '', $type = TERM_HAS
/**
* @brief Calculate weighting of tags according to the frequency of use.
*
*
* @param array $arr Array of tags/terms with tag/term name and total count of use.
* @return array Alphabetical sorted array of used tags/terms of an user.
*/
@ -279,10 +279,10 @@ function tag_calc($arr) {
/**
* @brief Compare function to sort tags/terms alphabetically.
*
*
* @param type $a
* @param type $b
*
*
* @return int
*/
function tags_sort($a, $b) {
@ -294,7 +294,7 @@ function tags_sort($a, $b) {
/**
* @brief Insert a tag cloud widget for the present profile.
*
*
* @param int $limit Max number of displayed tags.
* @return string HTML formattat output.
*/

2
include/threads.php

@ -3,7 +3,7 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
function add_thread($itemid, $onlyshadow = false) {
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,

8
include/uimport.php

@ -7,8 +7,7 @@ use Friendica\Core\System;
use Friendica\Core\PConfig;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Object\Photo;
define("IMPORT_DEBUG", False);
@ -261,9 +260,8 @@ function import_account(App $a, $file) {
$photo['uid'] = $newuid;
$photo['data'] = hex2bin($photo['data']);
$Image = new Image($photo['data'], $photo['type']);
$r = Photo::store(
$Image,
$p = new Photo($photo['data'], $photo['type']);
$r = $p->store(
$photo['uid'], $photo['contact-id'], //0
$photo['resource-id'], $photo['filename'], $photo['album'], $photo['scale'], $photo['profile'], //1
$photo['allow_cid'], $photo['allow_gid'], $photo['deny_cid'], $photo['deny_gid']

2
mod/admin.php

@ -10,8 +10,8 @@ use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\User;
use Friendica\Object\Contact;
require_once 'include/enotify.php';
require_once 'include/text.php';

8
mod/allfriends.php

@ -5,8 +5,8 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
require_once 'include/contact_selectors.php';
require_once 'mod/contacts.php';
@ -41,12 +41,12 @@ function allfriends_content(App $a) {
$a->page['aside'] = "";
profile_load($a, "", 0, Contact::getDetailsByURL($c[0]["url"]));
$total = GContact::countAllFriends(local_user(), $cid);
$total = GlobalContact::countAllFriends(local_user(), $cid);
if(count($total))
$a->set_pager_total($total);
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
$r = GlobalContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
if (! DBM::is_result($r)) {
$o .= t('No friends to display.');

2
mod/cal.php

@ -11,7 +11,7 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/event.php';
require_once 'include/redir.php';

12
mod/common.php

@ -4,8 +4,8 @@
*/
use Friendica\App;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
require_once 'include/contact_selectors.php';
require_once 'mod/contacts.php';
@ -85,9 +85,9 @@ function common_content(App $a) {
}
if ($cid) {
$t = GContact::countCommonFriends($uid, $cid);
$t = GlobalContact::countCommonFriends($uid, $cid);
} else {
$t = GContact::countCommonFriendsZcid($uid, $zcid);
$t = GlobalContact::countCommonFriendsZcid($uid, $zcid);
}
if (count($t)) {
@ -99,9 +99,9 @@ function common_content(App $a) {
if ($cid) {
$r = GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
$r = GlobalContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
} else {
$r = GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
$r = GlobalContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
}

10
mod/contacts.php

@ -6,9 +6,9 @@ use Friendica\App;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
require_once 'include/contact_selectors.php';
require_once 'mod/proxy.php';
@ -313,7 +313,7 @@ function _contact_update_profile($contact_id) {
Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
// Update the entry in the gcontact table
GContact::updateFromProbe($data["url"]);
GlobalContact::updateFromProbe($data["url"]);
}
function _contact_block($contact_id, $orig_record) {
@ -887,7 +887,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
);
// Show this tab only if there is visible friend list
$x = GContact::countAllFriends(local_user(), $contact_id);
$x = GlobalContact::countAllFriends(local_user(), $contact_id);
if ($x)
$tabs[] = array('label'=>t('Contacts'),
'url' => "allfriends/".$contact_id,
@ -897,7 +897,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
'accesskey' => 't');
// Show this tab only if there is visible common friend list
$common = GContact::countCommonFriends(local_user(), $contact_id);
$common = GlobalContact::countCommonFriends(local_user(), $contact_id);
if ($common)
$tabs[] = array('label'=>t('Common Friends'),
'url' => "common/loc/".local_user()."/".$contact_id,

2
mod/crepair.php

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/contact_selectors.php';
require_once 'mod/contacts.php';

2
mod/dfrn_confirm.php

@ -24,8 +24,8 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Protocol\Diaspora;
require_once 'include/enotify.php';

2
mod/dfrn_notify.php

@ -9,7 +9,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
use Friendica\Protocol\DFRN;
require_once 'include/items.php';

2
mod/dfrn_request.php

@ -15,8 +15,8 @@ use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
require_once 'include/enotify.php';
require_once 'include/group.php';

2
mod/directory.php

@ -3,7 +3,7 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
function directory_init(App $a) {
$a->set_pager_itemspage(60);

6
mod/dirfind.php

@ -6,9 +6,9 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Protocol\PortableContact;
require_once 'include/contact_widgets.php';
@ -82,7 +82,7 @@ function dirfind_content(App $a, $prefix = "") {
// Add the contact to the global contacts if it isn't already in our system
if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
GContact::update($user_data);
GlobalContact::update($user_data);
}
} elseif ($local) {

2
mod/display.php

@ -4,7 +4,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
use Friendica\Protocol\DFRN;
function display_init(App $a) {

4
mod/fbrowser.php

@ -7,7 +7,7 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Object\Image;
use Friendica\Object\Photo;
/**
* @param App $a
@ -66,7 +66,7 @@ function fbrowser_content(App $a) {
function _map_files1($rr){
$a = get_app();
$types = Image::supportedTypes();
$types = Photo::supportedTypes();
$ext = $types[$rr['type']];
$filename_e = $rr['filename'];

2
mod/follow.php

@ -3,8 +3,8 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
require_once 'include/follow.php';
require_once 'include/contact_selectors.php';

6
mod/hovercard.php

@ -10,8 +10,8 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Object\Contact;
function hovercard_init(App $a) {
// Just for testing purposes
@ -47,7 +47,7 @@ function hovercard_content() {
}
// if it's the url containing https it should be converted to http
$nurl = normalise_link(GContact::cleanContactUrl($profileurl));
$nurl = normalise_link(GlobalContact::cleanContactUrl($profileurl));
if($nurl) {
// Search for contact data
$contact = Contact::getDetailsByURL($nurl);

4
mod/install.php

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Object\Image;
use Friendica\Object\Photo;
$install_wizard_pass = 1;
@ -503,7 +503,7 @@ function check_imagik(&$checks) {
if (class_exists('Imagick')) {
$imagick = true;
$supported = Image::supportedTypes();
$supported = Photo::supportedTypes();
if (array_key_exists('image/gif', $supported)) {
$gif = true;
}

8
mod/item.php

@ -22,9 +22,9 @@ use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\GContact;
use Friendica\Model\GlobalContact;
use Friendica\Network\Probe;
use Friendica\Object\Contact;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\Email;
use Friendica\Util\Emailer;
@ -743,7 +743,7 @@ function item_post(App $a) {
$datarray['postopts'] = $postopts;
$datarray['origin'] = $origin;
$datarray['moderated'] = $allow_moderated;
$datarray['gcontact-id'] = GContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'],
$datarray['gcontact-id'] = GlobalContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'],
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
$datarray['object'] = $object;
@ -1244,7 +1244,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
if (!DBM::is_result($r)) {
$probed = Probe::uri($name);
if ($result['network'] != NETWORK_PHANTOM) {
GContact::update($probed);
GlobalContact::update($probed);
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($probed["url"])));
}

2
mod/match.php

@ -6,7 +6,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/text.php';
require_once 'include/contact_widgets.php';

2
mod/message.php

@ -4,7 +4,7 @@ use Friendica\App;
use Friendica\Content\Smilies;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/acl_selectors.php';
require_once 'include/message.php';

2
mod/network.php

@ -9,7 +9,7 @@ use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/conversation.php';
require_once 'include/group.php';

2
mod/nogroup.php

@ -4,7 +4,7 @@
*/
use Friendica\App;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
require_once 'include/contact_selectors.php';

18
mod/photo.php

@ -4,7 +4,7 @@
*/
use Friendica\App;
use Friendica\Database\DBM;
use Friendica\Object\Image;
use Friendica\Object\Photo;
require_once 'include/security.php';
@ -75,7 +75,7 @@ function photo_init(App $a) {
$uid = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $person);
foreach (Image::supportedTypes() AS $m => $e) {
foreach (Photo::supportedTypes() AS $m => $e) {
$uid = str_replace('.'.$e, '', $uid);
}
@ -100,7 +100,7 @@ function photo_init(App $a) {
$resolution = 0;
$photo = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $photo);
foreach (Image::supportedTypes() AS $m => $e) {
foreach (Photo::supportedTypes() AS $m => $e) {
$photo = str_replace('.'.$e, '', $photo);
}
@ -167,14 +167,14 @@ function photo_init(App $a) {
}
// Resize only if its not a GIF and it is supported by the library
if (($mimetype != "image/gif") && in_array($mimetype, Image::supportedTypes())) {
$Image = new Image($data, $mimetype);
if ($Image->isValid()) {
if (($mimetype != "image/gif") && in_array($mimetype, Photo::supportedTypes())) {
$ph = new Photo($data, $mimetype);
if ($ph->isValid()) {
if (isset($customres) && $customres > 0 && $customres < 500) {
$Image->scaleToSquare($customres);
$ph->scaleImageSquare($customres);
}
$data = $Image->asString();
$mimetype = $Image->getType();
$data = $ph->imageString();
$mimetype = $ph->getType();
}
}

63
mod/photos.php

@ -8,10 +8,9 @@ use Friendica\Core\System;
use Friendica\Core\Config;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Model\Photo;
use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Object\Contact;
use Friendica\Object\Photo;
require_once 'include/photos.php';
require_once 'include/items.php';
@ -137,7 +136,7 @@ function photos_post(App $a) {
logger('mod_photos: REQUEST ' . print_r($_REQUEST,true), LOGGER_DATA);
logger('mod_photos: FILES ' . print_r($_FILES,true), LOGGER_DATA);
$phototypes = Image::supportedTypes();
$phototypes = Photo::supportedTypes();
$can_post = false;
$visitor = 0;
@ -425,16 +424,16 @@ function photos_post(App $a) {
intval($page_owner_uid)
);
if (DBM::is_result($r)) {
$Image = new Image($r[0]['data'], $r[0]['type']);
if ($Image->isValid()) {
$ph = new Photo($r[0]['data'], $r[0]['type']);
if ($ph->isValid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
$Image->rotate($rotate_deg);
$ph->rotate($rotate_deg);
$width = $Image->getWidth();
$height = $Image->getHeight();
$width = $ph->getWidth();
$height = $ph->getHeight();
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 0",
dbesc($Image->asString()),
dbesc($ph->imageString()),
intval($height),
intval($width),
dbesc($resource_id),
@ -442,12 +441,12 @@ function photos_post(App $a) {
);
if ($width > 640 || $height > 640) {
$Image->scaleDown(640);
$width = $Image->getWidth();
$height = $Image->getHeight();
$ph->scaleImage(640);
$width = $ph->getWidth();
$height = $ph->getHeight();
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 1",
dbesc($Image->asString()),
dbesc($ph->imageString()),
intval($height),
intval($width),
dbesc($resource_id),
@ -456,12 +455,12 @@ function photos_post(App $a) {
}
if ($width > 320 || $height > 320) {
$Image->scaleDown(320);
$width = $Image->getWidth();
$height = $Image->getHeight();
$ph->scaleImage(320);
$width = $ph->getWidth();
$height = $ph->getHeight();
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 2",
dbesc($Image->asString()),
dbesc($ph->imageString()),
intval($height),
intval($width),
dbesc($resource_id),
@ -812,7 +811,7 @@ function photos_post(App $a) {
$type = $_FILES['userfile']['type'];
}
if ($type == "") {
$type = Image::guessType($filename);
$type = Photo::guessImageType($filename);
}
logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
@ -839,9 +838,9 @@ function photos_post(App $a) {
$imagedata = @file_get_contents($src);
$Image = new Image($imagedata, $type);
$ph = new Photo($imagedata, $type);
if (! $Image->isValid()) {
if (! $ph->isValid()) {
logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
notice( t('Unable to process image.') . EOL );
@unlink($src);
@ -850,7 +849,7 @@ function photos_post(App $a) {
killme();
}
$exif = $Image->orient($src);
$exif = $ph->orient($src);
@unlink($src);
$max_length = Config::get('system', 'max_image_length');
@ -858,17 +857,17 @@ function photos_post(App $a) {
$max_length = MAX_IMAGE_LENGTH;
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
$ph->scaleImage($max_length);
}
$width = $Image->getWidth();
$height = $Image->getHeight();
$width = $ph->getWidth();
$height = $ph->getHeight();
$smallest = 0;
$photo_hash = photo_new_resource();
$r = Photo::store($Image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
$r = $ph->store($page_owner_uid, $visitor, $photo_hash, $filename, $album, 0 , 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
if (! $r) {
logger('mod/photos.php: photos_post(): image store failed' , LOGGER_DEBUG);
@ -877,14 +876,14 @@ function photos_post(App $a) {
}
if ($width > 640 || $height > 640) {
$Image->scaleDown(640);
Photo::store($Image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 1, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
$ph->scaleImage(640);
$ph->store($page_owner_uid, $visitor, $photo_hash, $filename, $album, 1, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
$smallest = 1;
}
if ($width > 320 || $height > 320) {
$Image->scaleDown(320);
Photo::store($Image, $page_owner_uid, $visitor, $photo_hash, $filename, $album, 2, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
$ph->scaleImage(320);
$ph->store($page_owner_uid, $visitor, $photo_hash, $filename, $album, 2, 0, $str_contact_allow, $str_group_allow, $str_contact_deny, $str_group_deny);
$smallest = 2;
}
@ -933,7 +932,7 @@ function photos_post(App $a) {
$arr['origin'] = 1;
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo_hash . ']'
. '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$Image->getExt() . '[/img]'
. '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/img]'
. '[/url]';
$item_id = item_store($arr);
@ -981,7 +980,7 @@ function photos_content(App $a) {
return;
}
$phototypes = Image::supportedTypes();
$phototypes = Photo::supportedTypes();
$_SESSION['photo_return'] = $a->cmd;

2
mod/ping.php

@ -9,7 +9,7 @@ use Friendica\Core\Cache;
use Friendica\Core\System;
use Friendica\Core\PConfig;
use Friendica\Database\DBM;
use Friendica\Model\Contact;
use Friendica\Object\Contact;
use Friendica\Util\XML;
require_once 'include/datetime.php';

57
mod/profile_photo.php

@ -7,8 +7,7 @@ use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Object\Photo;
function profile_photo_init(App $a) {
@ -73,27 +72,27 @@ function profile_photo_post(App $a) {
$base_image = $r[0];
$Image = new Image($base_image['data'], $base_image['type']);
if ($Image->isValid()) {
$Image->crop(175,$srcX,$srcY,$srcW,$srcH);
$im = new Photo($base_image['data'], $base_image['type']);
if ($im->isValid()) {
$im->cropImage(175,$srcX,$srcY,$srcW,$srcH);
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
if ($r === false) {
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
}
$Image->scaleDown(80);
$im->scaleImage(80);
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
}
$Image->scaleDown(48);
$im->scaleImage(48);
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
if ($r === false) {
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
@ -108,15 +107,15 @@ function profile_photo_post(App $a) {
);
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `self` AND `uid` = %d",
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-6.' . $Image->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(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->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())
);
@ -152,7 +151,7 @@ function profile_photo_post(App $a) {
$filesize = intval($_FILES['userfile']['size']);
$filetype = $_FILES['userfile']['type'];
if ($filetype == "") {
$filetype = Image::guessType($filename);
$filetype = Photo::guessImageType($filename);
}
$maximagesize = Config::get('system', 'maximagesize');
@ -164,7 +163,7 @@ function profile_photo_post(App $a) {
}
$imagedata = @file_get_contents($src);
$ph = new Image($imagedata, $filetype);
$ph = new Photo($imagedata, $filetype);
if (! $ph->isValid()) {
notice(t('Unable to process image.') . EOL);
@ -240,7 +239,7 @@ function profile_photo_content(App $a) {
goaway(System::baseUrl() . '/profiles');
return; // NOTREACHED
}
$ph = new Image($r[0]['data'], $r[0]['type']);
$ph = new Photo($r[0]['data'], $r[0]['type']);
profile_photo_crop_ui_head($a, $ph);
// go ahead as we have jus uploaded a new photo to crop
}
@ -289,22 +288,22 @@ function profile_photo_content(App $a) {
if(! function_exists('profile_photo_crop_ui_head')) {
function profile_photo_crop_ui_head(App $a, Image $Image) {
function profile_photo_crop_ui_head(App $a, $ph) {
$max_length = Config::get('system','max_image_length');
if (! $max_length) {
$max_length = MAX_IMAGE_LENGTH;
}
if ($max_length > 0) {
$Image->scaleDown($max_length);
$ph->scaleImage($max_length);
}
$width = $Image->getWidth();
$height = $Image->getHeight();
$width = $ph->getWidth();
$height = $ph->getHeight();
if ($width < 175 || $height < 175) {
$Image->scaleUp(200);
$width = $Image->getWidth();
$height = $Image->getHeight();
$ph->scaleImageUp(200);
$width = $ph->getWidth();
$height = $ph->getHeight();
}
$hash = photo_new_resource();
@ -312,7 +311,7 @@ function profile_photo_crop_ui_head(App $a, Image $Image) {
$smallest = 0;
$r = Photo::store($Image, 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 );
@ -321,8 +320,8 @@ function profile_photo_crop_ui_head(App $a, Image $Image) {
}
if ($width > 640 || $height > 640) {
$Image->scaleDown(640);
$r = Photo::store($Image, local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
$ph->scaleImage(640);
$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 );
@ -333,7 +332,7 @@ function profile_photo_crop_ui_head(App $a, Image $Image) {
$a->config['imagecrop'] = $hash;
$a->config['imagecrop_resolution'] = $smallest;
$a->config['imagecrop_ext'] = $Image->getExt();
$a->config['imagecrop_ext'] = $ph->getExt();
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array());
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
return;

6
mod/profiles.php

@ -9,9 +9,9 @@ use Friendica\Core\PConfig;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBM;
use Friendica\Model\GContact;
use Friendica\Model\Profile;
use Friendica\Model\GlobalContact;
use Friendica\Network\Probe;
use Friendica\Object\Profile;
function profiles_init(App $a) {
@ -509,7 +509,7 @@ function profiles_post(App $a) {
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
// Update the global contact for the user
GContact::updateForUser(local_user());
GlobalContact::updateForUser(local_user());
}
}
}

31
mod/proxy.php

@ -8,8 +8,7 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\Database\DBM;
use Friendica\Model\Photo;
use Friendica\Object\Image;
use Friendica\Object\Photo;
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
@ -131,9 +130,9 @@ function proxy_init(App $a) {
// reduce quality - if it isn't a GIF
if ($mime != 'image/gif') {
$Image = new Image($img_str, $mime);
if ($Image->isValid()) {
$img_str = $Image->asString();
$img = new Photo($img_str, $mime);
if ($img->isValid()) {
$img_str = $img->imageString();
}
}
@ -175,10 +174,10 @@ function proxy_init(App $a) {
$mime = 'image/png';
$cachefile = ''; // Clear the cachefile so that the dummy isn't stored
$valid = false;
$Image = new Image($img_str, 'image/png');
if ($Image->isValid()) {
$Image->scaleDown(10);
$img_str = $Image->asString();
$img = new Photo($img_str, 'image/png');
if ($img->isValid()) {
$img->scaleImage(10);
$img_str = $img->imageString();
}
} elseif ($mime != 'image/jpeg' && !$direct_cache && $cachefile == '') {
$image = @imagecreatefromstring($img_str);
@ -193,9 +192,9 @@ function proxy_init(App $a) {
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime);
dba::insert('photo', $fields);
} else {