Merge pull request #4036 from MrPetovan/task/3878-move-objects-to-model
Move objects to model (redux)
This commit is contained in:
commit
5ba6c7717a
3
boot.php
3
boot.php
|
@ -27,8 +27,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\Lock;
|
|
||||||
|
|
||||||
require_once 'include/network.php';
|
require_once 'include/network.php';
|
||||||
require_once 'include/plugin.php';
|
require_once 'include/plugin.php';
|
||||||
|
|
|
@ -6,8 +6,8 @@ use Friendica\App;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
require_once "include/contact_selectors.php";
|
require_once "include/contact_selectors.php";
|
||||||
require_once "include/contact_widgets.php";
|
require_once "include/contact_widgets.php";
|
||||||
|
@ -774,7 +774,7 @@ function navbar_complete(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($localsearch) {
|
if ($localsearch) {
|
||||||
$x = GlobalContact::searchByName($search, $mode);
|
$x = GContact::searchByName($search, $mode);
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\NotificationsManager;
|
use Friendica\Core\NotificationsManager;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\FKOAuth1;
|
use Friendica\Network\FKOAuth1;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
|
@ -23,8 +25,7 @@ use Friendica\Network\HTTPException\NotFoundException;
|
||||||
use Friendica\Network\HTTPException\NotImplementedException;
|
use Friendica\Network\HTTPException\NotImplementedException;
|
||||||
use Friendica\Network\HTTPException\UnauthorizedException;
|
use Friendica\Network\HTTPException\UnauthorizedException;
|
||||||
use Friendica\Network\HTTPException\TooManyRequestsException;
|
use Friendica\Network\HTTPException\TooManyRequestsException;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Object\Photo;
|
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -1192,7 +1193,7 @@ function api_statuses_update($type)
|
||||||
api_user()
|
api_user()
|
||||||
);
|
);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$phototypes = Photo::supportedTypes();
|
$phototypes = Image::supportedTypes();
|
||||||
$ext = $phototypes[$r[0]['type']];
|
$ext = $phototypes[$r[0]['type']];
|
||||||
$_REQUEST['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']';
|
$_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]';
|
$_REQUEST['body'] .= '[img]' . System::baseUrl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . '[/img][/url]';
|
||||||
|
@ -2377,7 +2378,7 @@ function api_get_attachments(&$body)
|
||||||
$attachments = array();
|
$attachments = array();
|
||||||
|
|
||||||
foreach ($images[1] as $image) {
|
foreach ($images[1] as $image) {
|
||||||
$imagedata = Photo::getInfoFromURL($image);
|
$imagedata = Image::getInfoFromURL($image);
|
||||||
|
|
||||||
if ($imagedata) {
|
if ($imagedata) {
|
||||||
$attachments[] = array("url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]);
|
$attachments[] = array("url" => $image, "mimetype" => $imagedata["mime"], "size" => $imagedata["size"]);
|
||||||
|
@ -2509,7 +2510,7 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
|
|
||||||
$start = iconv_strpos($text, $url, $offset, "UTF-8");
|
$start = iconv_strpos($text, $url, $offset, "UTF-8");
|
||||||
if (!($start === false)) {
|
if (!($start === false)) {
|
||||||
$image = Photo::getInfoFromURL($url);
|
$image = Image::getInfoFromURL($url);
|
||||||
if ($image) {
|
if ($image) {
|
||||||
// If image cache is activated, then use the following sizes:
|
// If image cache is activated, then use the following sizes:
|
||||||
// thumb (150), small (340), medium (600) and large (1024)
|
// thumb (150), small (340), medium (600) and large (1024)
|
||||||
|
@ -2517,19 +2518,19 @@ function api_get_entitities(&$text, $bbcode)
|
||||||
$media_url = proxy_url($url);
|
$media_url = proxy_url($url);
|
||||||
|
|
||||||
$sizes = array();
|
$sizes = array();
|
||||||
$scale = Photo::scaleImageTo($image[0], $image[1], 150);
|
$scale = Image::getScalingDimensions($image[0], $image[1], 150);
|
||||||
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
|
|
||||||
if (($image[0] > 150) || ($image[1] > 150)) {
|
if (($image[0] > 150) || ($image[1] > 150)) {
|
||||||
$scale = Photo::scaleImageTo($image[0], $image[1], 340);
|
$scale = Image::getScalingDimensions($image[0], $image[1], 340);
|
||||||
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
}
|
}
|
||||||
|
|
||||||
$scale = Photo::scaleImageTo($image[0], $image[1], 600);
|
$scale = Image::getScalingDimensions($image[0], $image[1], 600);
|
||||||
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
|
|
||||||
if (($image[0] > 600) || ($image[1] > 600)) {
|
if (($image[0] > 600) || ($image[1] > 600)) {
|
||||||
$scale = Photo::scaleImageTo($image[0], $image[1], 1024);
|
$scale = Image::getScalingDimensions($image[0], $image[1], 1024);
|
||||||
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3946,7 +3947,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filetype == "") {
|
if ($filetype == "") {
|
||||||
$filetype=Photo::guessImageType($filename);
|
$filetype=Image::guessType($filename);
|
||||||
}
|
}
|
||||||
$imagedata = getimagesize($src);
|
$imagedata = getimagesize($src);
|
||||||
if ($imagedata) {
|
if ($imagedata) {
|
||||||
|
@ -3970,13 +3971,13 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
|
|
||||||
// create Photo instance with the data of the image
|
// create Photo instance with the data of the image
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$ph = new Photo($imagedata, $filetype);
|
$Image = new Image($imagedata, $filetype);
|
||||||
if (! $ph->isValid()) {
|
if (! $Image->isValid()) {
|
||||||
throw new InternalServerErrorException("unable to process image data");
|
throw new InternalServerErrorException("unable to process image data");
|
||||||
}
|
}
|
||||||
|
|
||||||
// check orientation of image
|
// check orientation of image
|
||||||
$ph->orient($src);
|
$Image->orient($src);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
// check max length of images on server
|
// check max length of images on server
|
||||||
|
@ -3985,11 +3986,11 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$ph->scaleImage($max_length);
|
$Image->scaleDown($max_length);
|
||||||
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
|
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
// create a new resource-id if not already provided
|
// create a new resource-id if not already provided
|
||||||
$hash = ($photo_id == null) ? photo_new_resource() : $photo_id;
|
$hash = ($photo_id == null) ? photo_new_resource() : $photo_id;
|
||||||
|
@ -3998,21 +3999,21 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
// upload normal image (scales 0, 1, 2)
|
// upload normal image (scales 0, 1, 2)
|
||||||
logger("photo upload: starting new photo upload", LOGGER_DEBUG);
|
logger("photo upload: starting new photo upload", LOGGER_DEBUG);
|
||||||
|
|
||||||
$r =$ph->store(local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 0, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger("photo upload: image upload with scale 0 (original size) failed");
|
logger("photo upload: image upload with scale 0 (original size) failed");
|
||||||
}
|
}
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(640);
|
||||||
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 1, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger("photo upload: image upload with scale 1 (640x640) failed");
|
logger("photo upload: image upload with scale 1 (640x640) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$ph->scaleImage(320);
|
$Image->scaleDown(320);
|
||||||
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 2, 0, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger("photo upload: image upload with scale 2 (320x320) failed");
|
logger("photo upload: image upload with scale 2 (320x320) failed");
|
||||||
}
|
}
|
||||||
|
@ -4023,29 +4024,29 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
|
||||||
logger("photo upload: starting new profile image upload", LOGGER_DEBUG);
|
logger("photo upload: starting new profile image upload", LOGGER_DEBUG);
|
||||||
|
|
||||||
if ($width > 175 || $height > 175) {
|
if ($width > 175 || $height > 175) {
|
||||||
$ph->scaleImage(175);
|
$Image->scaleDown(175);
|
||||||
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 4, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger("photo upload: profile image upload with scale 4 (175x175) failed");
|
logger("photo upload: profile image upload with scale 4 (175x175) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 80 || $height > 80) {
|
if ($width > 80 || $height > 80) {
|
||||||
$ph->scaleImage(80);
|
$Image->scaleDown(80);
|
||||||
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 5, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger("photo upload: profile image upload with scale 5 (80x80) failed");
|
logger("photo upload: profile image upload with scale 5 (80x80) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 48 || $height > 48) {
|
if ($width > 48 || $height > 48) {
|
||||||
$ph->scaleImage(48);
|
$Image->scaleDown(48);
|
||||||
$r = $ph->store(local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
$r = Photo::store($Image, local_user(), $visitor, $hash, $filename, $album, 6, $profile, $allow_cid, $allow_gid, $deny_cid, $deny_gid, $desc);
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger("photo upload: profile image upload with scale 6 (48x48) failed");
|
logger("photo upload: profile image upload with scale 6 (48x48) failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$ph->__destruct();
|
$Image->__destruct();
|
||||||
logger("photo upload: new profile image upload ended", LOGGER_DEBUG);
|
logger("photo upload: new profile image upload ended", LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
|
|
||||||
use League\HTMLToMarkdown\HtmlConverter;
|
use League\HTMLToMarkdown\HtmlConverter;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ use Friendica\Content\Smilies;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/oembed.php';
|
require_once 'include/oembed.php';
|
||||||
require_once 'include/event.php';
|
require_once 'include/event.php';
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
|
|
||||||
|
@ -250,18 +250,18 @@ function common_friends_visitor_widget($profile_uid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$t = GlobalContact::countCommonFriends($profile_uid, $cid);
|
$t = GContact::countCommonFriends($profile_uid, $cid);
|
||||||
} else {
|
} else {
|
||||||
$t = GlobalContact::countCommonFriendsZcid($profile_uid, $zcid);
|
$t = GContact::countCommonFriendsZcid($profile_uid, $zcid);
|
||||||
}
|
}
|
||||||
if (! $t) {
|
if (! $t) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$r = GlobalContact::commonFriends($profile_uid, $cid, 0, 5, true);
|
$r = GContact::commonFriends($profile_uid, $cid, 0, 5, true);
|
||||||
} else {
|
} else {
|
||||||
$r = GlobalContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
|
$r = GContact::commonFriendsZcid($profile_uid, $zcid, 0, 5, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
return replace_macros(get_markup_template('remote_friends_common.tpl'), array(
|
||||||
|
|
|
@ -8,9 +8,9 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Conversation;
|
use Friendica\Object\Thread;
|
||||||
use Friendica\Object\Item;
|
use Friendica\Object\Post;
|
||||||
|
|
||||||
require_once "include/bbcode.php";
|
require_once "include/bbcode.php";
|
||||||
require_once "include/acl_selectors.php";
|
require_once "include/acl_selectors.php";
|
||||||
|
@ -840,7 +840,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
// Normal View
|
// Normal View
|
||||||
$page_template = get_markup_template("threaded_conversation.tpl");
|
$page_template = get_markup_template("threaded_conversation.tpl");
|
||||||
|
|
||||||
$conv = new Conversation($mode, $preview);
|
$conv = new Thread($mode, $preview);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* get all the topmost parents
|
* get all the topmost parents
|
||||||
|
@ -880,8 +880,8 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
$item['pagedrop'] = $page_dropping;
|
$item['pagedrop'] = $page_dropping;
|
||||||
|
|
||||||
if ($item['id'] == $item['parent']) {
|
if ($item['id'] == $item['parent']) {
|
||||||
$item_object = new Item($item);
|
$item_object = new Post($item);
|
||||||
$conv->addThread($item_object);
|
$conv->addParent($item_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
|
|
|
@ -12,7 +12,7 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/bbcode.php';
|
require_once 'include/bbcode.php';
|
||||||
require_once 'mod/proxy.php';
|
require_once 'mod/proxy.php';
|
||||||
|
|
|
@ -10,11 +10,11 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\Lock;
|
|
||||||
|
|
||||||
require_once 'include/bbcode.php';
|
require_once 'include/bbcode.php';
|
||||||
require_once 'include/oembed.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.
|
* On comments the author is the better choice.
|
||||||
*/
|
*/
|
||||||
if ($arr['parent-uri'] === $arr['uri']) {
|
if ($arr['parent-uri'] === $arr['uri']) {
|
||||||
$arr["gcontact-id"] = GlobalContact::getId(array("url" => $arr['owner-link'], "network" => $arr['network'],
|
$arr["gcontact-id"] = GContact::getId(array("url" => $arr['owner-link'], "network" => $arr['network'],
|
||||||
"photo" => $arr['owner-avatar'], "name" => $arr['owner-name']));
|
"photo" => $arr['owner-avatar'], "name" => $arr['owner-name']));
|
||||||
} else {
|
} else {
|
||||||
$arr["gcontact-id"] = GlobalContact::getId(array("url" => $arr['author-link'], "network" => $arr['network'],
|
$arr["gcontact-id"] = GContact::getId(array("url" => $arr['author-link'], "network" => $arr['network'],
|
||||||
"photo" => $arr['author-avatar'], "name" => $arr['author-name']));
|
"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]);
|
$width = intval($match[1]);
|
||||||
$height = intval($match[2]);
|
$height = intval($match[2]);
|
||||||
|
|
||||||
$ph = new Photo($data, $type);
|
$Image = new Image($data, $type);
|
||||||
if ($ph->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$ph->scaleImage(max($width, $height));
|
$Image->scaleDown(max($width, $height));
|
||||||
$data = $ph->imageString();
|
$data = $Image->asString();
|
||||||
$type = $ph->getType();
|
$type = $Image->getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -710,18 +710,18 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
|
||||||
}
|
}
|
||||||
|
|
||||||
// guess mimetype from headers or filename
|
// guess mimetype from headers or filename
|
||||||
$type = Photo::guessImageType($mtch[1], true);
|
$type = Image::guessType($mtch[1], true);
|
||||||
|
|
||||||
if ($i) {
|
if ($i) {
|
||||||
$ph = new Photo($i, $type);
|
$Image = new Image($i, $type);
|
||||||
if ($ph->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$orig_width = $ph->getWidth();
|
$orig_width = $Image->getWidth();
|
||||||
$orig_height = $ph->getHeight();
|
$orig_height = $Image->getHeight();
|
||||||
|
|
||||||
if ($orig_width > 640 || $orig_height > 640) {
|
if ($orig_width > 640 || $orig_height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(640);
|
||||||
$new_width = $ph->getWidth();
|
$new_width = $Image->getWidth();
|
||||||
$new_height = $ph->getHeight();
|
$new_height = $Image->getHeight();
|
||||||
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
|
logger('scale_external_images: ' . $orig_width . '->' . $new_width . 'w ' . $orig_height . '->' . $new_height . 'h' . ' match: ' . $mtch[0], LOGGER_DEBUG);
|
||||||
$s = str_replace(
|
$s = str_replace(
|
||||||
$mtch[0],
|
$mtch[0],
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\ParseUrl;
|
use Friendica\ParseUrl;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
require_once "include/bbcode.php";
|
require_once "include/bbcode.php";
|
||||||
require_once "include/html2plain.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)) {
|
if (preg_match("/\[img\]([$URLSearchString]*)\[\/img\]/ism", $attacheddata, $matches)) {
|
||||||
|
|
||||||
$picturedata = Photo::getInfoFromURL($matches[1]);
|
$picturedata = Image::getInfoFromURL($matches[1]);
|
||||||
|
|
||||||
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1]))
|
if (($picturedata[0] >= 500) && ($picturedata[0] >= $picturedata[1]))
|
||||||
$post["image"] = $matches[1];
|
$post["image"] = $matches[1];
|
||||||
|
@ -221,7 +221,7 @@ function get_attached_data($body, $item = array()) {
|
||||||
$post["preview"] = $pictures[0][2];
|
$post["preview"] = $pictures[0][2];
|
||||||
$post["text"] = str_replace($pictures[0][0], "", $body);
|
$post["text"] = str_replace($pictures[0][0], "", $body);
|
||||||
} else {
|
} else {
|
||||||
$imgdata = Photo::getInfoFromURL($pictures[0][1]);
|
$imgdata = Image::getInfoFromURL($pictures[0][1]);
|
||||||
if (substr($imgdata["mime"], 0, 6) == "image/") {
|
if (substr($imgdata["mime"], 0, 6) == "image/") {
|
||||||
$post["type"] = "photo";
|
$post["type"] = "photo";
|
||||||
$post["image"] = $pictures[0][1];
|
$post["image"] = $pictures[0][1];
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calls the post update functions
|
* @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
|
// Set the "gcontact-id" in the item table and add a new gcontact entry if needed
|
||||||
foreach ($item_arr AS $item) {
|
foreach ($item_arr AS $item) {
|
||||||
$gcontact_id = GlobalContact::getId(array("url" => $item['author-link'], "network" => $item['network'],
|
$gcontact_id = GContact::getId(array("url" => $item['author-link'], "network" => $item['network'],
|
||||||
"photo" => $item['author-avatar'], "name" => $item['author-name']));
|
"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",
|
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"]));
|
intval($gcontact_id), intval($item["uid"]), dbesc($item["author-link"]));
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Friendica\App;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
function create_tags_from_item($itemid) {
|
function create_tags_from_item($itemid) {
|
||||||
$profile_base = System::baseUrl();
|
$profile_base = System::baseUrl();
|
||||||
|
@ -157,13 +157,13 @@ function update_items() {
|
||||||
/**
|
/**
|
||||||
* @brief Get alphabetical sorted array of used tags/terms of an user including
|
* @brief Get alphabetical sorted array of used tags/terms of an user including
|
||||||
* a weighting by frequency of use.
|
* a weighting by frequency of use.
|
||||||
*
|
*
|
||||||
* @param int $uid The user ID.
|
* @param int $uid The user ID.
|
||||||
* @param int $count Max number of displayed tags/terms.
|
* @param int $count Max number of displayed tags/terms.
|
||||||
* @param int $owner_id The contact id of the owner of the tagged items.
|
* @param int $owner_id The contact id of the owner of the tagged items.
|
||||||
* @param string $flags Special item flags.
|
* @param string $flags Special item flags.
|
||||||
* @param int $type The tag/term type.
|
* @param int $type The tag/term type.
|
||||||
*
|
*
|
||||||
* @return arr Alphabetical sorted array of used tags of an user.
|
* @return arr Alphabetical sorted array of used tags of an user.
|
||||||
*/
|
*/
|
||||||
function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HASHTAG) {
|
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)) {
|
if(!DBM::is_result($r)) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tag_calc($r);
|
return tag_calc($r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a tag/term cloud block for an user.
|
* @brief Construct a tag/term cloud block for an user.
|
||||||
*
|
*
|
||||||
* @param int $uid The user ID.
|
* @param int $uid The user ID.
|
||||||
* @param int $count Max number of displayed tags/terms.
|
* @param int $count Max number of displayed tags/terms.
|
||||||
* @param int $owner_id The contact ID of the owner of the tagged items.
|
* @param int $owner_id The contact ID of the owner of the tagged items.
|
||||||
* @param string $flags Special item flags.
|
* @param string $flags Special item flags.
|
||||||
* @param int $type The tag/term type.
|
* @param int $type The tag/term type.
|
||||||
*
|
*
|
||||||
* @return string HTML formatted output.
|
* @return string HTML formatted output.
|
||||||
*/
|
*/
|
||||||
function wtagblock($uid, $count = 0,$owner_id = 0, $flags = '', $type = TERM_HASHTAG) {
|
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.
|
* @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.
|
* @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.
|
* @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.
|
* @brief Compare function to sort tags/terms alphabetically.
|
||||||
*
|
*
|
||||||
* @param type $a
|
* @param type $a
|
||||||
* @param type $b
|
* @param type $b
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function tags_sort($a, $b) {
|
function tags_sort($a, $b) {
|
||||||
|
@ -294,7 +294,7 @@ function tags_sort($a, $b) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Insert a tag cloud widget for the present profile.
|
* @brief Insert a tag cloud widget for the present profile.
|
||||||
*
|
*
|
||||||
* @param int $limit Max number of displayed tags.
|
* @param int $limit Max number of displayed tags.
|
||||||
* @return string HTML formattat output.
|
* @return string HTML formattat output.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
function add_thread($itemid, $onlyshadow = false) {
|
function add_thread($itemid, $onlyshadow = false) {
|
||||||
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
|
$items = q("SELECT `uid`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`,
|
||||||
|
|
|
@ -7,7 +7,8 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Photo;
|
||||||
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
define("IMPORT_DEBUG", False);
|
define("IMPORT_DEBUG", False);
|
||||||
|
|
||||||
|
@ -260,8 +261,9 @@ function import_account(App $a, $file) {
|
||||||
$photo['uid'] = $newuid;
|
$photo['uid'] = $newuid;
|
||||||
$photo['data'] = hex2bin($photo['data']);
|
$photo['data'] = hex2bin($photo['data']);
|
||||||
|
|
||||||
$p = new Photo($photo['data'], $photo['type']);
|
$Image = new Image($photo['data'], $photo['type']);
|
||||||
$r = $p->store(
|
$r = Photo::store(
|
||||||
|
$Image,
|
||||||
$photo['uid'], $photo['contact-id'], //0
|
$photo['uid'], $photo['contact-id'], //0
|
||||||
$photo['resource-id'], $photo['filename'], $photo['album'], $photo['scale'], $photo['profile'], //1
|
$photo['resource-id'], $photo['filename'], $photo['album'], $photo['scale'], $photo['profile'], //1
|
||||||
$photo['allow_cid'], $photo['allow_gid'], $photo['deny_cid'], $photo['deny_gid']
|
$photo['allow_cid'], $photo['allow_gid'], $photo['deny_cid'], $photo['deny_gid']
|
||||||
|
|
|
@ -10,8 +10,8 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
require_once 'include/text.php';
|
require_once 'include/text.php';
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
require_once 'mod/contacts.php';
|
require_once 'mod/contacts.php';
|
||||||
|
@ -41,12 +41,12 @@ function allfriends_content(App $a) {
|
||||||
$a->page['aside'] = "";
|
$a->page['aside'] = "";
|
||||||
profile_load($a, "", 0, Contact::getDetailsByURL($c[0]["url"]));
|
profile_load($a, "", 0, Contact::getDetailsByURL($c[0]["url"]));
|
||||||
|
|
||||||
$total = GlobalContact::countAllFriends(local_user(), $cid);
|
$total = GContact::countAllFriends(local_user(), $cid);
|
||||||
|
|
||||||
if(count($total))
|
if(count($total))
|
||||||
$a->set_pager_total($total);
|
$a->set_pager_total($total);
|
||||||
|
|
||||||
$r = GlobalContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
$r = GContact::allFriends(local_user(), $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||||
|
|
||||||
if (! DBM::is_result($r)) {
|
if (! DBM::is_result($r)) {
|
||||||
$o .= t('No friends to display.');
|
$o .= t('No friends to display.');
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/event.php';
|
require_once 'include/event.php';
|
||||||
require_once 'include/redir.php';
|
require_once 'include/redir.php';
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
*/
|
*/
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
require_once 'mod/contacts.php';
|
require_once 'mod/contacts.php';
|
||||||
|
@ -85,9 +85,9 @@ function common_content(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$t = GlobalContact::countCommonFriends($uid, $cid);
|
$t = GContact::countCommonFriends($uid, $cid);
|
||||||
} else {
|
} else {
|
||||||
$t = GlobalContact::countCommonFriendsZcid($uid, $zcid);
|
$t = GContact::countCommonFriendsZcid($uid, $zcid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($t)) {
|
if (count($t)) {
|
||||||
|
@ -99,9 +99,9 @@ function common_content(App $a) {
|
||||||
|
|
||||||
|
|
||||||
if ($cid) {
|
if ($cid) {
|
||||||
$r = GlobalContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
$r = GContact::commonFriends($uid, $cid, $a->pager['start'], $a->pager['itemspage']);
|
||||||
} else {
|
} else {
|
||||||
$r = GlobalContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
$r = GContact::commonFriendsZcid($uid, $zcid, $a->pager['start'], $a->pager['itemspage']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
require_once 'mod/proxy.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);
|
Contact::updateAvatar($data['photo'], local_user(), $contact_id, true);
|
||||||
|
|
||||||
// Update the entry in the gcontact table
|
// Update the entry in the gcontact table
|
||||||
GlobalContact::updateFromProbe($data["url"]);
|
GContact::updateFromProbe($data["url"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _contact_block($contact_id, $orig_record) {
|
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
|
// Show this tab only if there is visible friend list
|
||||||
$x = GlobalContact::countAllFriends(local_user(), $contact_id);
|
$x = GContact::countAllFriends(local_user(), $contact_id);
|
||||||
if ($x)
|
if ($x)
|
||||||
$tabs[] = array('label'=>t('Contacts'),
|
$tabs[] = array('label'=>t('Contacts'),
|
||||||
'url' => "allfriends/".$contact_id,
|
'url' => "allfriends/".$contact_id,
|
||||||
|
@ -897,7 +897,7 @@ function contacts_tab($a, $contact_id, $active_tab) {
|
||||||
'accesskey' => 't');
|
'accesskey' => 't');
|
||||||
|
|
||||||
// Show this tab only if there is visible common friend list
|
// Show this tab only if there is visible common friend list
|
||||||
$common = GlobalContact::countCommonFriends(local_user(), $contact_id);
|
$common = GContact::countCommonFriends(local_user(), $contact_id);
|
||||||
if ($common)
|
if ($common)
|
||||||
$tabs[] = array('label'=>t('Common Friends'),
|
$tabs[] = array('label'=>t('Common Friends'),
|
||||||
'url' => "common/loc/".local_user()."/".$contact_id,
|
'url' => "common/loc/".local_user()."/".$contact_id,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
require_once 'mod/contacts.php';
|
require_once 'mod/contacts.php';
|
||||||
|
|
|
@ -24,8 +24,8 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
|
@ -15,8 +15,8 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
require_once 'include/group.php';
|
require_once 'include/group.php';
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
function directory_init(App $a) {
|
function directory_init(App $a) {
|
||||||
$a->set_pager_itemspage(60);
|
$a->set_pager_itemspage(60);
|
||||||
|
|
|
@ -6,9 +6,9 @@ use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
|
|
||||||
require_once 'include/contact_widgets.php';
|
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
|
// 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)) {
|
if (($contact["cid"] == 0) && ($contact["zid"] == 0) && ($contact["gid"] == 0)) {
|
||||||
GlobalContact::update($user_data);
|
GContact::update($user_data);
|
||||||
}
|
}
|
||||||
} elseif ($local) {
|
} elseif ($local) {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
|
|
||||||
function display_init(App $a) {
|
function display_init(App $a) {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param App $a
|
* @param App $a
|
||||||
|
@ -66,7 +66,7 @@ function fbrowser_content(App $a) {
|
||||||
|
|
||||||
function _map_files1($rr){
|
function _map_files1($rr){
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$types = Photo::supportedTypes();
|
$types = Image::supportedTypes();
|
||||||
$ext = $types[$rr['type']];
|
$ext = $types[$rr['type']];
|
||||||
$filename_e = $rr['filename'];
|
$filename_e = $rr['filename'];
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
|
|
||||||
require_once 'include/follow.php';
|
require_once 'include/follow.php';
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
function hovercard_init(App $a) {
|
function hovercard_init(App $a) {
|
||||||
// Just for testing purposes
|
// Just for testing purposes
|
||||||
|
@ -47,7 +47,7 @@ function hovercard_content() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it's the url containing https it should be converted to http
|
// if it's the url containing https it should be converted to http
|
||||||
$nurl = normalise_link(GlobalContact::cleanContactUrl($profileurl));
|
$nurl = normalise_link(GContact::cleanContactUrl($profileurl));
|
||||||
if($nurl) {
|
if($nurl) {
|
||||||
// Search for contact data
|
// Search for contact data
|
||||||
$contact = Contact::getDetailsByURL($nurl);
|
$contact = Contact::getDetailsByURL($nurl);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
$install_wizard_pass = 1;
|
$install_wizard_pass = 1;
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ function check_imagik(&$checks) {
|
||||||
|
|
||||||
if (class_exists('Imagick')) {
|
if (class_exists('Imagick')) {
|
||||||
$imagick = true;
|
$imagick = true;
|
||||||
$supported = Photo::supportedTypes();
|
$supported = Image::supportedTypes();
|
||||||
if (array_key_exists('image/gif', $supported)) {
|
if (array_key_exists('image/gif', $supported)) {
|
||||||
$gif = true;
|
$gif = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
use Friendica\Util\Emailer;
|
use Friendica\Util\Emailer;
|
||||||
|
@ -743,7 +743,7 @@ function item_post(App $a) {
|
||||||
$datarray['postopts'] = $postopts;
|
$datarray['postopts'] = $postopts;
|
||||||
$datarray['origin'] = $origin;
|
$datarray['origin'] = $origin;
|
||||||
$datarray['moderated'] = $allow_moderated;
|
$datarray['moderated'] = $allow_moderated;
|
||||||
$datarray['gcontact-id'] = GlobalContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'],
|
$datarray['gcontact-id'] = GContact::getId(array("url" => $datarray['author-link'], "network" => $datarray['network'],
|
||||||
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
|
"photo" => $datarray['author-avatar'], "name" => $datarray['author-name']));
|
||||||
$datarray['object'] = $object;
|
$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)) {
|
if (!DBM::is_result($r)) {
|
||||||
$probed = Probe::uri($name);
|
$probed = Probe::uri($name);
|
||||||
if ($result['network'] != NETWORK_PHANTOM) {
|
if ($result['network'] != NETWORK_PHANTOM) {
|
||||||
GlobalContact::update($probed);
|
GContact::update($probed);
|
||||||
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
$r = q("SELECT `url`, `name`, `nick`, `network`, `alias`, `notify` FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
|
||||||
dbesc(normalise_link($probed["url"])));
|
dbesc(normalise_link($probed["url"])));
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/text.php';
|
require_once 'include/text.php';
|
||||||
require_once 'include/contact_widgets.php';
|
require_once 'include/contact_widgets.php';
|
||||||
|
|
|
@ -4,7 +4,7 @@ use Friendica\App;
|
||||||
use Friendica\Content\Smilies;
|
use Friendica\Content\Smilies;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/acl_selectors.php';
|
require_once 'include/acl_selectors.php';
|
||||||
require_once 'include/message.php';
|
require_once 'include/message.php';
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/conversation.php';
|
require_once 'include/conversation.php';
|
||||||
require_once 'include/group.php';
|
require_once 'include/group.php';
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
require_once 'include/security.php';
|
require_once 'include/security.php';
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ function photo_init(App $a) {
|
||||||
|
|
||||||
$uid = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $person);
|
$uid = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $person);
|
||||||
|
|
||||||
foreach (Photo::supportedTypes() AS $m => $e) {
|
foreach (Image::supportedTypes() AS $m => $e) {
|
||||||
$uid = str_replace('.'.$e, '', $uid);
|
$uid = str_replace('.'.$e, '', $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ function photo_init(App $a) {
|
||||||
$resolution = 0;
|
$resolution = 0;
|
||||||
$photo = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $photo);
|
$photo = str_replace(array('.jpg', '.png', '.gif'), array('', '', ''), $photo);
|
||||||
|
|
||||||
foreach (Photo::supportedTypes() AS $m => $e) {
|
foreach (Image::supportedTypes() AS $m => $e) {
|
||||||
$photo = str_replace('.'.$e, '', $photo);
|
$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
|
// Resize only if its not a GIF and it is supported by the library
|
||||||
if (($mimetype != "image/gif") && in_array($mimetype, Photo::supportedTypes())) {
|
if (($mimetype != "image/gif") && in_array($mimetype, Image::supportedTypes())) {
|
||||||
$ph = new Photo($data, $mimetype);
|
$Image = new Image($data, $mimetype);
|
||||||
if ($ph->isValid()) {
|
if ($Image->isValid()) {
|
||||||
if (isset($customres) && $customres > 0 && $customres < 500) {
|
if (isset($customres) && $customres > 0 && $customres < 500) {
|
||||||
$ph->scaleImageSquare($customres);
|
$Image->scaleToSquare($customres);
|
||||||
}
|
}
|
||||||
$data = $ph->imageString();
|
$data = $Image->asString();
|
||||||
$mimetype = $ph->getType();
|
$mimetype = $Image->getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,10 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Object\Photo;
|
|
||||||
|
|
||||||
require_once 'include/photos.php';
|
require_once 'include/photos.php';
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
@ -136,7 +137,7 @@ function photos_post(App $a) {
|
||||||
logger('mod_photos: REQUEST ' . print_r($_REQUEST,true), LOGGER_DATA);
|
logger('mod_photos: REQUEST ' . print_r($_REQUEST,true), LOGGER_DATA);
|
||||||
logger('mod_photos: FILES ' . print_r($_FILES,true), LOGGER_DATA);
|
logger('mod_photos: FILES ' . print_r($_FILES,true), LOGGER_DATA);
|
||||||
|
|
||||||
$phototypes = Photo::supportedTypes();
|
$phototypes = Image::supportedTypes();
|
||||||
|
|
||||||
$can_post = false;
|
$can_post = false;
|
||||||
$visitor = 0;
|
$visitor = 0;
|
||||||
|
@ -424,16 +425,16 @@ function photos_post(App $a) {
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
);
|
);
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$ph = new Photo($r[0]['data'], $r[0]['type']);
|
$Image = new Image($r[0]['data'], $r[0]['type']);
|
||||||
if ($ph->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
|
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
|
||||||
$ph->rotate($rotate_deg);
|
$Image->rotate($rotate_deg);
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 0",
|
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 0",
|
||||||
dbesc($ph->imageString()),
|
dbesc($Image->asString()),
|
||||||
intval($height),
|
intval($height),
|
||||||
intval($width),
|
intval($width),
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
|
@ -441,12 +442,12 @@ function photos_post(App $a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(640);
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 1",
|
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 1",
|
||||||
dbesc($ph->imageString()),
|
dbesc($Image->asString()),
|
||||||
intval($height),
|
intval($height),
|
||||||
intval($width),
|
intval($width),
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
|
@ -455,12 +456,12 @@ function photos_post(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$ph->scaleImage(320);
|
$Image->scaleDown(320);
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 2",
|
$x = q("UPDATE `photo` SET `data` = '%s', `height` = %d, `width` = %d WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = 2",
|
||||||
dbesc($ph->imageString()),
|
dbesc($Image->asString()),
|
||||||
intval($height),
|
intval($height),
|
||||||
intval($width),
|
intval($width),
|
||||||
dbesc($resource_id),
|
dbesc($resource_id),
|
||||||
|
@ -811,7 +812,7 @@ function photos_post(App $a) {
|
||||||
$type = $_FILES['userfile']['type'];
|
$type = $_FILES['userfile']['type'];
|
||||||
}
|
}
|
||||||
if ($type == "") {
|
if ($type == "") {
|
||||||
$type = Photo::guessImageType($filename);
|
$type = Image::guessType($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
|
logger('photos: upload: received file: ' . $filename . ' as ' . $src . ' ('. $type . ') ' . $filesize . ' bytes', LOGGER_DEBUG);
|
||||||
|
@ -838,9 +839,9 @@ function photos_post(App $a) {
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
|
|
||||||
$ph = new Photo($imagedata, $type);
|
$Image = new Image($imagedata, $type);
|
||||||
|
|
||||||
if (! $ph->isValid()) {
|
if (! $Image->isValid()) {
|
||||||
logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
|
logger('mod/photos.php: photos_post(): unable to process image' , LOGGER_DEBUG);
|
||||||
notice( t('Unable to process image.') . EOL );
|
notice( t('Unable to process image.') . EOL );
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
@ -849,7 +850,7 @@ function photos_post(App $a) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$exif = $ph->orient($src);
|
$exif = $Image->orient($src);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
$max_length = Config::get('system', 'max_image_length');
|
$max_length = Config::get('system', 'max_image_length');
|
||||||
|
@ -857,17 +858,17 @@ function photos_post(App $a) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$ph->scaleImage($max_length);
|
$Image->scaleDown($max_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
$smallest = 0;
|
$smallest = 0;
|
||||||
|
|
||||||
$photo_hash = photo_new_resource();
|
$photo_hash = photo_new_resource();
|
||||||
|
|
||||||
$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);
|
$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);
|
||||||
|
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
logger('mod/photos.php: photos_post(): image store failed' , LOGGER_DEBUG);
|
logger('mod/photos.php: photos_post(): image store failed' , LOGGER_DEBUG);
|
||||||
|
@ -876,14 +877,14 @@ function photos_post(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(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);
|
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);
|
||||||
$smallest = 1;
|
$smallest = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$ph->scaleImage(320);
|
$Image->scaleDown(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);
|
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);
|
||||||
$smallest = 2;
|
$smallest = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,7 +933,7 @@ function photos_post(App $a) {
|
||||||
$arr['origin'] = 1;
|
$arr['origin'] = 1;
|
||||||
|
|
||||||
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo_hash . ']'
|
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo_hash . ']'
|
||||||
. '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$ph->getExt() . '[/img]'
|
. '[img]' . System::baseUrl() . "/photo/{$photo_hash}-{$smallest}.".$Image->getExt() . '[/img]'
|
||||||
. '[/url]';
|
. '[/url]';
|
||||||
|
|
||||||
$item_id = item_store($arr);
|
$item_id = item_store($arr);
|
||||||
|
@ -980,7 +981,7 @@ function photos_content(App $a) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$phototypes = Photo::supportedTypes();
|
$phototypes = Image::supportedTypes();
|
||||||
|
|
||||||
$_SESSION['photo_return'] = $a->cmd;
|
$_SESSION['photo_return'] = $a->cmd;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\Core\Cache;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
require_once 'include/datetime.php';
|
require_once 'include/datetime.php';
|
||||||
|
|
|
@ -7,7 +7,8 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Photo;
|
||||||
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
function profile_photo_init(App $a) {
|
function profile_photo_init(App $a) {
|
||||||
|
|
||||||
|
@ -72,27 +73,27 @@ function profile_photo_post(App $a) {
|
||||||
|
|
||||||
$base_image = $r[0];
|
$base_image = $r[0];
|
||||||
|
|
||||||
$im = new Photo($base_image['data'], $base_image['type']);
|
$Image = new Image($base_image['data'], $base_image['type']);
|
||||||
if ($im->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$im->cropImage(175,$srcX,$srcY,$srcW,$srcH);
|
$Image->crop(175,$srcX,$srcY,$srcW,$srcH);
|
||||||
|
|
||||||
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
|
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
|
notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
|
||||||
}
|
}
|
||||||
|
|
||||||
$im->scaleImage(80);
|
$Image->scaleDown(80);
|
||||||
|
|
||||||
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
|
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
|
notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
|
||||||
}
|
}
|
||||||
|
|
||||||
$im->scaleImage(48);
|
$Image->scaleDown(48);
|
||||||
|
|
||||||
$r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
|
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
|
notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
|
||||||
|
@ -107,15 +108,15 @@ function profile_photo_post(App $a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `self` AND `uid` = %d",
|
$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.' . $im->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
|
||||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
|
||||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-6.' . $im->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-6.' . $Image->getExt()),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
|
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
|
||||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $im->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
|
||||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $im->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
|
||||||
intval($_REQUEST['profile']),
|
intval($_REQUEST['profile']),
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
@ -151,7 +152,7 @@ function profile_photo_post(App $a) {
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$filesize = intval($_FILES['userfile']['size']);
|
||||||
$filetype = $_FILES['userfile']['type'];
|
$filetype = $_FILES['userfile']['type'];
|
||||||
if ($filetype == "") {
|
if ($filetype == "") {
|
||||||
$filetype = Photo::guessImageType($filename);
|
$filetype = Image::guessType($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$maximagesize = Config::get('system', 'maximagesize');
|
$maximagesize = Config::get('system', 'maximagesize');
|
||||||
|
@ -163,7 +164,7 @@ function profile_photo_post(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$ph = new Photo($imagedata, $filetype);
|
$ph = new Image($imagedata, $filetype);
|
||||||
|
|
||||||
if (! $ph->isValid()) {
|
if (! $ph->isValid()) {
|
||||||
notice(t('Unable to process image.') . EOL);
|
notice(t('Unable to process image.') . EOL);
|
||||||
|
@ -239,7 +240,7 @@ function profile_photo_content(App $a) {
|
||||||
goaway(System::baseUrl() . '/profiles');
|
goaway(System::baseUrl() . '/profiles');
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
$ph = new Photo($r[0]['data'], $r[0]['type']);
|
$ph = new Image($r[0]['data'], $r[0]['type']);
|
||||||
profile_photo_crop_ui_head($a, $ph);
|
profile_photo_crop_ui_head($a, $ph);
|
||||||
// go ahead as we have jus uploaded a new photo to crop
|
// go ahead as we have jus uploaded a new photo to crop
|
||||||
}
|
}
|
||||||
|
@ -288,22 +289,22 @@ function profile_photo_content(App $a) {
|
||||||
|
|
||||||
|
|
||||||
if(! function_exists('profile_photo_crop_ui_head')) {
|
if(! function_exists('profile_photo_crop_ui_head')) {
|
||||||
function profile_photo_crop_ui_head(App $a, $ph) {
|
function profile_photo_crop_ui_head(App $a, Image $Image) {
|
||||||
$max_length = Config::get('system','max_image_length');
|
$max_length = Config::get('system','max_image_length');
|
||||||
if (! $max_length) {
|
if (! $max_length) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$ph->scaleImage($max_length);
|
$Image->scaleDown($max_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
if ($width < 175 || $height < 175) {
|
if ($width < 175 || $height < 175) {
|
||||||
$ph->scaleImageUp(200);
|
$Image->scaleUp(200);
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash = photo_new_resource();
|
$hash = photo_new_resource();
|
||||||
|
@ -311,7 +312,7 @@ function profile_photo_crop_ui_head(App $a, $ph) {
|
||||||
|
|
||||||
$smallest = 0;
|
$smallest = 0;
|
||||||
|
|
||||||
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
|
$r = Photo::store($Image, local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
info( t('Image uploaded successfully.') . EOL );
|
info( t('Image uploaded successfully.') . EOL );
|
||||||
|
@ -320,8 +321,8 @@ function profile_photo_crop_ui_head(App $a, $ph) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(640);
|
||||||
$r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
|
$r = Photo::store($Image, local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
|
notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
|
||||||
|
@ -332,7 +333,7 @@ function profile_photo_crop_ui_head(App $a, $ph) {
|
||||||
|
|
||||||
$a->config['imagecrop'] = $hash;
|
$a->config['imagecrop'] = $hash;
|
||||||
$a->config['imagecrop_resolution'] = $smallest;
|
$a->config['imagecrop_resolution'] = $smallest;
|
||||||
$a->config['imagecrop_ext'] = $ph->getExt();
|
$a->config['imagecrop_ext'] = $Image->getExt();
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array());
|
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), array());
|
||||||
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
|
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,9 +9,9 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Profile;
|
|
||||||
|
|
||||||
function profiles_init(App $a) {
|
function profiles_init(App $a) {
|
||||||
|
|
||||||
|
@ -509,7 +509,7 @@ function profiles_post(App $a) {
|
||||||
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
|
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
|
||||||
|
|
||||||
// Update the global contact for the user
|
// Update the global contact for the user
|
||||||
GlobalContact::updateForUser(local_user());
|
GContact::updateForUser(local_user());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,8 @@ use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Photo;
|
||||||
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
|
define('PROXY_DEFAULT_TIME', 86400); // 1 Day
|
||||||
|
|
||||||
|
@ -130,9 +131,9 @@ function proxy_init(App $a) {
|
||||||
|
|
||||||
// reduce quality - if it isn't a GIF
|
// reduce quality - if it isn't a GIF
|
||||||
if ($mime != 'image/gif') {
|
if ($mime != 'image/gif') {
|
||||||
$img = new Photo($img_str, $mime);
|
$Image = new Image($img_str, $mime);
|
||||||
if ($img->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$img_str = $img->imageString();
|
$img_str = $Image->asString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,10 +175,10 @@ function proxy_init(App $a) {
|
||||||
$mime = 'image/png';
|
$mime = 'image/png';
|
||||||
$cachefile = ''; // Clear the cachefile so that the dummy isn't stored
|
$cachefile = ''; // Clear the cachefile so that the dummy isn't stored
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$img = new Photo($img_str, 'image/png');
|
$Image = new Image($img_str, 'image/png');
|
||||||
if ($img->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$img->scaleImage(10);
|
$Image->scaleDown(10);
|
||||||
$img_str = $img->imageString();
|
$img_str = $Image->asString();
|
||||||
}
|
}
|
||||||
} elseif ($mime != 'image/jpeg' && !$direct_cache && $cachefile == '') {
|
} elseif ($mime != 'image/jpeg' && !$direct_cache && $cachefile == '') {
|
||||||
$image = @imagecreatefromstring($img_str);
|
$image = @imagecreatefromstring($img_str);
|
||||||
|
@ -192,9 +193,9 @@ function proxy_init(App $a) {
|
||||||
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime);
|
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime);
|
||||||
dba::insert('photo', $fields);
|
dba::insert('photo', $fields);
|
||||||
} else {
|
} else {
|
||||||
$img = new Photo($img_str, $mime);
|
$Image = new Image($img_str, $mime);
|
||||||
if ($img->isValid() && !$direct_cache && ($cachefile == '')) {
|
if ($Image->isValid() && !$direct_cache && ($cachefile == '')) {
|
||||||
$img->store(0, 0, $urlhash, $_REQUEST['url'], '', 100);
|
Photo::store($Image, 0, 0, $urlhash, $_REQUEST['url'], '', 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,10 +204,10 @@ function proxy_init(App $a) {
|
||||||
|
|
||||||
// reduce quality - if it isn't a GIF
|
// reduce quality - if it isn't a GIF
|
||||||
if ($mime != 'image/gif') {
|
if ($mime != 'image/gif') {
|
||||||
$img = new Photo($img_str, $mime);
|
$Image = new Image($img_str, $mime);
|
||||||
if ($img->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$img->scaleImage($size);
|
$Image->scaleDown($size);
|
||||||
$img_str = $img->imageString();
|
$img_str = $Image->asString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
function randprof_init(App $a) {
|
function randprof_init(App $a) {
|
||||||
$x = GlobalContact::getRandomUrl();
|
$x = GContact::getRandomUrl();
|
||||||
|
|
||||||
if ($x) {
|
if ($x) {
|
||||||
goaway(zrl($x));
|
goaway(zrl($x));
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\Core\Worker;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
|
|
||||||
|
@ -650,7 +650,7 @@ function settings_post(App $a) {
|
||||||
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
|
Worker::add(PRIORITY_LOW, 'ProfileUpdate', local_user());
|
||||||
|
|
||||||
// Update the global contact for the user
|
// Update the global contact for the user
|
||||||
GlobalContact::updateForUser(local_user());
|
GContact::updateForUser(local_user());
|
||||||
|
|
||||||
//$_SESSION['theme'] = $theme;
|
//$_SESSION['theme'] = $theme;
|
||||||
if ($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
|
if ($email_changed && $a->config['register_policy'] == REGISTER_VERIFY) {
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
require_once 'include/contact_widgets.php';
|
require_once 'include/contact_widgets.php';
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ function suggest_content(App $a) {
|
||||||
$a->page['aside'] .= follow_widget();
|
$a->page['aside'] .= follow_widget();
|
||||||
|
|
||||||
|
|
||||||
$r = GlobalContact::suggestionQuery(local_user());
|
$r = GContact::suggestionQuery(local_user());
|
||||||
|
|
||||||
if (! DBM::is_result($r)) {
|
if (! DBM::is_result($r)) {
|
||||||
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
$o .= t('No suggestions available. If this is a new site, please try again in 24 hours.');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/follow.php';
|
require_once 'include/follow.php';
|
||||||
require_once 'include/contact_selectors.php';
|
require_once 'include/contact_selectors.php';
|
||||||
|
|
|
@ -5,7 +5,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once('include/contact_selectors.php');
|
require_once('include/contact_selectors.php');
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Photo;
|
||||||
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
function wall_upload_post(App $a, $desktopmode = true) {
|
function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
|
|
||||||
|
@ -161,8 +162,8 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
$filetype = "";
|
$filetype = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($filetype=="") {
|
if ($filetype == "") {
|
||||||
$filetype=Photo::guessImageType($filename);
|
$filetype = Image::guessType($filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a temp name, then do a manual check
|
// If there is a temp name, then do a manual check
|
||||||
|
@ -190,9 +191,9 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$ph = new Photo($imagedata, $filetype);
|
$Image = new Image($imagedata, $filetype);
|
||||||
|
|
||||||
if (! $ph->isValid()) {
|
if (! $Image->isValid()) {
|
||||||
$msg = t('Unable to process image.');
|
$msg = t('Unable to process image.');
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
echo json_encode(array('error'=>$msg));
|
echo json_encode(array('error'=>$msg));
|
||||||
|
@ -203,7 +204,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ph->orient($src);
|
$Image->orient($src);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
|
|
||||||
$max_length = Config::get('system', 'max_image_length');
|
$max_length = Config::get('system', 'max_image_length');
|
||||||
|
@ -211,12 +212,12 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$ph->scaleImage($max_length);
|
$Image->scaleDown($max_length);
|
||||||
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
|
logger("File upload: Scaling picture to new size " . $max_length, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
$hash = photo_new_resource();
|
$hash = photo_new_resource();
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
|
|
||||||
$defperm = '<' . $default_cid . '>';
|
$defperm = '<' . $default_cid . '>';
|
||||||
|
|
||||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, $album, 0, 0, $defperm);
|
$r = Photo::store($Image, $page_owner_uid, $visitor, $hash, $filename, $album, 0, 0, $defperm);
|
||||||
|
|
||||||
if (! $r) {
|
if (! $r) {
|
||||||
$msg = t('Image upload failed.');
|
$msg = t('Image upload failed.');
|
||||||
|
@ -242,16 +243,16 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(640);
|
||||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, $album, 1, 0, $defperm);
|
$r = Photo::store($Image, $page_owner_uid, $visitor, $hash, $filename, $album, 1, 0, $defperm);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$smallest = 1;
|
$smallest = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$ph->scaleImage(320);
|
$Image->scaleDown(320);
|
||||||
$r = $ph->store($page_owner_uid, $visitor, $hash, $filename, $album, 2, 0, $defperm);
|
$r = Photo::store($Image, $page_owner_uid, $visitor, $hash, $filename, $album, 2, 0, $defperm);
|
||||||
if ($r && ($smallest == 0)) {
|
if ($r && ($smallest == 0)) {
|
||||||
$smallest = 2;
|
$smallest = 2;
|
||||||
}
|
}
|
||||||
|
@ -280,8 +281,8 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
$picture["height"] = $r[0]["height"];
|
$picture["height"] = $r[0]["height"];
|
||||||
$picture["type"] = $r[0]["type"];
|
$picture["type"] = $r[0]["type"];
|
||||||
$picture["albumpage"] = System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash;
|
$picture["albumpage"] = System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash;
|
||||||
$picture["picture"] = System::baseUrl() . "/photo/{$hash}-0." . $ph->getExt();
|
$picture["picture"] = System::baseUrl() . "/photo/{$hash}-0." . $Image->getExt();
|
||||||
$picture["preview"] = System::baseUrl() . "/photo/{$hash}-{$smallest}." . $ph->getExt();
|
$picture["preview"] = System::baseUrl() . "/photo/{$hash}-{$smallest}." . $Image->getExt();
|
||||||
|
|
||||||
if ($r_json) {
|
if ($r_json) {
|
||||||
echo json_encode(array('picture'=>$picture));
|
echo json_encode(array('picture'=>$picture));
|
||||||
|
@ -299,9 +300,9 @@ function wall_upload_post(App $a, $desktopmode = true) {
|
||||||
/* mod Waitman Gobble NO WARRANTY */
|
/* mod Waitman Gobble NO WARRANTY */
|
||||||
// if we get the signal then return the image url info in BBCODE
|
// if we get the signal then return the image url info in BBCODE
|
||||||
if ($_REQUEST['hush']!='yeah') {
|
if ($_REQUEST['hush']!='yeah') {
|
||||||
echo "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $hash . '][img]' . System::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}.".$Image->getExt()."[/img][/url]\n\n";
|
||||||
} else {
|
} else {
|
||||||
$m = '[url='.System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.System::baseUrl()."/photo/{$hash}-{$smallest}.".$ph->getExt()."[/img][/url]";
|
$m = '[url='.System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash.'][img]'.System::baseUrl()."/photo/{$hash}-{$smallest}.".$Image->getExt()."[/img][/url]";
|
||||||
return($m);
|
return($m);
|
||||||
}
|
}
|
||||||
/* mod Waitman Gobble NO WARRANTY */
|
/* mod Waitman Gobble NO WARRANTY */
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Friendica\Core;
|
||||||
use Friendica\Core\Pconfig;
|
use Friendica\Core\Pconfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'include/html2plain.php';
|
require_once 'include/html2plain.php';
|
||||||
require_once 'include/datetime.php';
|
require_once 'include/datetime.php';
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file src/Object/Contact.php
|
* @file src/Model/Contact.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Object;
|
namespace Friendica\Model;
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
|
@ -922,7 +921,7 @@ class Contact extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($r["avatar"] != $avatar) || $force) {
|
if (($r["avatar"] != $avatar) || $force) {
|
||||||
$photos = Photo::importProfilePhoto($avatar, $uid, $cid, true);
|
$photos = Image::importProfilePhoto($avatar, $uid, $cid, true);
|
||||||
|
|
||||||
if ($photos) {
|
if ($photos) {
|
||||||
dba::update(
|
dba::update(
|
|
@ -9,9 +9,9 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Object\Profile;
|
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use dba;
|
use dba;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
@ -23,7 +23,7 @@ require_once 'include/html2bbcode.php';
|
||||||
/**
|
/**
|
||||||
* @brief This class handles GlobalContact related functions
|
* @brief This class handles GlobalContact related functions
|
||||||
*/
|
*/
|
||||||
class GlobalContact
|
class GContact
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Search global contact table by nick or name
|
* @brief Search global contact table by nick or name
|
174
src/Model/Photo.php
Normal file
174
src/Model/Photo.php
Normal file
|
@ -0,0 +1,174 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file src/Model/Photo.php
|
||||||
|
* @brief This file contains the Photo class for database interface
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Friendica\Model;
|
||||||
|
|
||||||
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Object\Image;
|
||||||
|
use dba;
|
||||||
|
|
||||||
|
require_once "include/photos.php";
|
||||||
|
/**
|
||||||
|
* Class to handle photo dabatase table
|
||||||
|
*/
|
||||||
|
class Photo
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param integer $uid uid
|
||||||
|
* @param integer $cid cid
|
||||||
|
* @param integer $rid rid
|
||||||
|
* @param string $filename filename
|
||||||
|
* @param string $album album name
|
||||||
|
* @param integer $scale scale
|
||||||
|
* @param integer $profile optional, default = 0
|
||||||
|
* @param string $allow_cid optional, default = ''
|
||||||
|
* @param string $allow_gid optional, default = ''
|
||||||
|
* @param string $deny_cid optional, default = ''
|
||||||
|
* @param string $deny_gid optional, default = ''
|
||||||
|
* @param string $desc optional, default = ''
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
|
||||||
|
{
|
||||||
|
$r = dba::select('photo', array('guid'), array("`resource-id` = ? AND `guid` != ?", $rid, ''), array('limit' => 1));
|
||||||
|
if (DBM::is_result($r)) {
|
||||||
|
$guid = $r['guid'];
|
||||||
|
} else {
|
||||||
|
$guid = get_guid();
|
||||||
|
}
|
||||||
|
|
||||||
|
$x = dba::select('photo', array('id'), array('resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale), array('limit' => 1));
|
||||||
|
|
||||||
|
$fields = array(
|
||||||
|
'uid' => $uid,
|
||||||
|
'contact-id' => $cid,
|
||||||
|
'guid' => $guid,
|
||||||
|
'resource-id' => $rid,
|
||||||
|
'created' => datetime_convert(),
|
||||||
|
'edited' => datetime_convert(),
|
||||||
|
'filename' => basename($filename),
|
||||||
|
'type' => $Image->getType(),
|
||||||
|
'album' => $album,
|
||||||
|
'height' => $Image->getHeight(),
|
||||||
|
'width' => $Image->getWidth(),
|
||||||
|
'datasize' => strlen($Image->asString()),
|
||||||
|
'data' => $Image->asString(),
|
||||||
|
'scale' => $scale,
|
||||||
|
'profile' => $profile,
|
||||||
|
'allow_cid' => $allow_cid,
|
||||||
|
'allow_gid' => $allow_gid,
|
||||||
|
'deny_cid' => $deny_cid,
|
||||||
|
'deny_gid' => $deny_gid,
|
||||||
|
'desc' => $desc
|
||||||
|
);
|
||||||
|
|
||||||
|
if (DBM::is_result($x)) {
|
||||||
|
$r = dba::update('photo', $fields, array('id' => $x['id']));
|
||||||
|
} else {
|
||||||
|
$r = dba::insert('photo', $fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $photo photo
|
||||||
|
* @param integer $uid user id
|
||||||
|
* @param integer $cid contact id
|
||||||
|
* @param boolean $quit_on_error optional, default false
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function importProfilePhoto($photo, $uid, $cid, $quit_on_error = false)
|
||||||
|
{
|
||||||
|
$r = dba::select(
|
||||||
|
'photo', array('resource-id'), array('uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos'), array('limit' => 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (DBM::is_result($r) && strlen($r['resource-id'])) {
|
||||||
|
$hash = $r['resource-id'];
|
||||||
|
} else {
|
||||||
|
$hash = photo_new_resource();
|
||||||
|
}
|
||||||
|
|
||||||
|
$photo_failure = false;
|
||||||
|
|
||||||
|
$filename = basename($photo);
|
||||||
|
$img_str = fetch_url($photo, true);
|
||||||
|
|
||||||
|
if ($quit_on_error && ($img_str == "")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = Image::guessType($photo, true);
|
||||||
|
$Image = new Image($img_str, $type);
|
||||||
|
if ($Image->isValid()) {
|
||||||
|
$Image->scaleToSquare(175);
|
||||||
|
|
||||||
|
$r = self::store($Image, $uid, $cid, $hash, $filename, 'Contact Photos', 4);
|
||||||
|
|
||||||
|
if ($r === false) {
|
||||||
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$Image->scaleDown(80);
|
||||||
|
|
||||||
|
$r = self::store($Image, $uid, $cid, $hash, $filename, 'Contact Photos', 5);
|
||||||
|
|
||||||
|
if ($r === false) {
|
||||||
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$Image->scaleDown(48);
|
||||||
|
|
||||||
|
$r = self::store($Image, $uid, $cid, $hash, $filename, 'Contact Photos', 6);
|
||||||
|
|
||||||
|
if ($r === false) {
|
||||||
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$suffix = '?ts=' . time();
|
||||||
|
|
||||||
|
$photo = System::baseUrl() . '/photo/' . $hash . '-4.' . $Image->getExt() . $suffix;
|
||||||
|
$thumb = System::baseUrl() . '/photo/' . $hash . '-5.' . $Image->getExt() . $suffix;
|
||||||
|
$micro = System::baseUrl() . '/photo/' . $hash . '-6.' . $Image->getExt() . $suffix;
|
||||||
|
|
||||||
|
// Remove the cached photo
|
||||||
|
$a = get_app();
|
||||||
|
$basepath = $a->get_basepath();
|
||||||
|
|
||||||
|
if (is_dir($basepath . "/photo")) {
|
||||||
|
$filename = $basepath . '/photo/' . $hash . '-4.' . $Image->getExt();
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
$filename = $basepath . '/photo/' . $hash . '-5.' . $Image->getExt();
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
$filename = $basepath . '/photo/' . $hash . '-6.' . $Image->getExt();
|
||||||
|
if (file_exists($filename)) {
|
||||||
|
unlink($filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$photo_failure = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($photo_failure && $quit_on_error) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($photo_failure) {
|
||||||
|
$photo = System::baseUrl() . '/images/person-175.jpg';
|
||||||
|
$thumb = System::baseUrl() . '/images/person-80.jpg';
|
||||||
|
$micro = System::baseUrl() . '/images/person-48.jpg';
|
||||||
|
}
|
||||||
|
|
||||||
|
return array($photo, $thumb, $micro);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,14 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file src/Object/Profile.php
|
* @file src/Model/Profile.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Object;
|
namespace Friendica\Model;
|
||||||
|
|
||||||
use Friendica\BaseObject;
|
class Profile
|
||||||
|
|
||||||
class Profile extends BaseObject
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Returns a formatted location string from the given profile array
|
* @brief Returns a formatted location string from the given profile array
|
|
@ -11,8 +11,9 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Photo;
|
||||||
|
use Friendica\Object\Image;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
|
@ -381,32 +382,32 @@ class User
|
||||||
$filename = basename($photo);
|
$filename = basename($photo);
|
||||||
$img_str = fetch_url($photo, true);
|
$img_str = fetch_url($photo, true);
|
||||||
// guess mimetype from headers or filename
|
// guess mimetype from headers or filename
|
||||||
$type = Photo::guessImageType($photo, true);
|
$type = Image::guessType($photo, true);
|
||||||
|
|
||||||
|
|
||||||
$img = new Photo($img_str, $type);
|
$Image = new Image($img_str, $type);
|
||||||
if ($img->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$img->scaleImageSquare(175);
|
$Image->scaleToSquare(175);
|
||||||
|
|
||||||
$hash = photo_new_resource();
|
$hash = photo_new_resource();
|
||||||
|
|
||||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4);
|
$r = Photo::store($Image, $newuid, 0, $hash, $filename, t('Profile Photos'), 4);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$img->scaleImage(80);
|
$Image->scaleDown(80);
|
||||||
|
|
||||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5);
|
$r = Photo::store($Image, $newuid, 0, $hash, $filename, t('Profile Photos'), 5);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$img->scaleImage(48);
|
$Image->scaleDown(48);
|
||||||
|
|
||||||
$r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6);
|
$r = Photo::store($Image, $newuid, 0, $hash, $filename, t('Profile Photos'), 6);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
$photo_failure = true;
|
$photo_failure = true;
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file src/Object/Photo.php
|
* @file src/Object/Image.php
|
||||||
* @brief This file contains the Photo class for image processing
|
* @brief This file contains the Image class for image processing
|
||||||
*/
|
*/
|
||||||
namespace Friendica\Object;
|
namespace Friendica\Object;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use dba;
|
use Friendica\Model\Photo;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Imagick;
|
use Imagick;
|
||||||
use ImagickPixel;
|
use ImagickPixel;
|
||||||
|
@ -18,9 +18,9 @@ use ImagickPixel;
|
||||||
require_once "include/photos.php";
|
require_once "include/photos.php";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle Photos
|
* Class to handle images
|
||||||
*/
|
*/
|
||||||
class Photo
|
class Image
|
||||||
{
|
{
|
||||||
private $image;
|
private $image;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ class Photo
|
||||||
* @param integer $max max dimension
|
* @param integer $max max dimension
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scaleImage($max)
|
public function scaleDown($max)
|
||||||
{
|
{
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -350,7 +350,7 @@ class Photo
|
||||||
// FIXME - implement horizantal bias for scaling as in followin GD functions
|
// FIXME - implement horizantal bias for scaling as in followin GD functions
|
||||||
// to allow very tall images to be constrained only horizontally.
|
// to allow very tall images to be constrained only horizontally.
|
||||||
|
|
||||||
$this->image->scaleImage($dest_width, $dest_height);
|
$this->image->scaleDown($dest_width, $dest_height);
|
||||||
} while ($this->image->nextImage());
|
} while ($this->image->nextImage());
|
||||||
|
|
||||||
// These may not be necessary any more
|
// These may not be necessary any more
|
||||||
|
@ -524,7 +524,7 @@ class Photo
|
||||||
* @param integer $min minimum dimension
|
* @param integer $min minimum dimension
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scaleImageUp($min)
|
public function scaleUp($min)
|
||||||
{
|
{
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -563,7 +563,7 @@ class Photo
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isImagick()) {
|
if ($this->isImagick()) {
|
||||||
return $this->scaleImage($dest_width, $dest_height);
|
return $this->scaleDown($dest_width, $dest_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dest = imagecreatetruecolor($dest_width, $dest_height);
|
$dest = imagecreatetruecolor($dest_width, $dest_height);
|
||||||
|
@ -585,7 +585,7 @@ class Photo
|
||||||
* @param integer $dim dimension
|
* @param integer $dim dimension
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scaleImageSquare($dim)
|
public function scaleToSquare($dim)
|
||||||
{
|
{
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -594,7 +594,7 @@ class Photo
|
||||||
if ($this->isImagick()) {
|
if ($this->isImagick()) {
|
||||||
$this->image->setFirstIterator();
|
$this->image->setFirstIterator();
|
||||||
do {
|
do {
|
||||||
$this->image->scaleImage($dim, $dim);
|
$this->image->scaleDown($dim, $dim);
|
||||||
} while ($this->image->nextImage());
|
} while ($this->image->nextImage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -622,7 +622,7 @@ class Photo
|
||||||
* @param integer $h height
|
* @param integer $h height
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function cropImage($max, $x, $y, $w, $h)
|
public function crop($max, $x, $y, $w, $h)
|
||||||
{
|
{
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -639,7 +639,7 @@ class Photo
|
||||||
*/
|
*/
|
||||||
$this->image->setImagePage(0, 0, 0, 0);
|
$this->image->setImagePage(0, 0, 0, 0);
|
||||||
} while ($this->image->nextImage());
|
} while ($this->image->nextImage());
|
||||||
return $this->scaleImage($max);
|
return $this->scaleDown($max);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dest = imagecreatetruecolor($max, $max);
|
$dest = imagecreatetruecolor($max, $max);
|
||||||
|
@ -661,13 +661,13 @@ class Photo
|
||||||
* @param string $path file path
|
* @param string $path file path
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function saveImage($path)
|
public function saveToFilePath($path)
|
||||||
{
|
{
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$string = $this->imageString();
|
$string = $this->asString();
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
|
@ -676,10 +676,23 @@ class Photo
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->save_timestamp($stamp1, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Magic method allowing string casting of an Image object
|
||||||
|
*
|
||||||
|
* Ex: $data = $Image->asString();
|
||||||
|
* can be replaced by
|
||||||
|
* $data = (string) $Image;
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString() {
|
||||||
|
return $this->asString();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function imageString()
|
public function asString()
|
||||||
{
|
{
|
||||||
if (!$this->isValid()) {
|
if (!$this->isValid()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -720,46 +733,6 @@ class Photo
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param integer $uid uid
|
|
||||||
* @param integer $cid cid
|
|
||||||
* @param integer $rid rid
|
|
||||||
* @param string $filename filename
|
|
||||||
* @param string $album album name
|
|
||||||
* @param integer $scale scale
|
|
||||||
* @param integer $profile optional, default = 0
|
|
||||||
* @param string $allow_cid optional, default = ''
|
|
||||||
* @param string $allow_gid optional, default = ''
|
|
||||||
* @param string $deny_cid optional, default = ''
|
|
||||||
* @param string $deny_gid optional, default = ''
|
|
||||||
* @param string $desc optional, default = ''
|
|
||||||
* @return object
|
|
||||||
*/
|
|
||||||
public function store($uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
|
|
||||||
{
|
|
||||||
$r = dba::select('photo', array('guid'), array("`resource-id` = ? AND `guid` != ?", $rid, ''), array('limit' => 1));
|
|
||||||
if (DBM::is_result($r)) {
|
|
||||||
$guid = $r['guid'];
|
|
||||||
} else {
|
|
||||||
$guid = get_guid();
|
|
||||||
}
|
|
||||||
|
|
||||||
$x = dba::select('photo', array('id'), array('resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale), array('limit' => 1));
|
|
||||||
|
|
||||||
$fields = array('uid' => $uid, 'contact-id' => $cid, 'guid' => $guid, 'resource-id' => $rid, 'created' => datetime_convert(), 'edited' => datetime_convert(),
|
|
||||||
'filename' => basename($filename), 'type' => $this->getType(), 'album' => $album, 'height' => $this->getHeight(), 'width' => $this->getWidth(),
|
|
||||||
'datasize' => strlen($this->imageString()), 'data' => $this->imageString(), 'scale' => $scale, 'profile' => $profile,
|
|
||||||
'allow_cid' => $allow_cid, 'allow_gid' => $allow_gid, 'deny_cid' => $deny_cid, 'deny_gid' => $deny_gid, 'desc' => $desc);
|
|
||||||
|
|
||||||
if (DBM::is_result($x)) {
|
|
||||||
$r = dba::update('photo', $fields, array('id' => $x['id']));
|
|
||||||
} else {
|
|
||||||
$r = dba::insert('photo', $fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Guess image mimetype from filename or from Content-Type header
|
* Guess image mimetype from filename or from Content-Type header
|
||||||
*
|
*
|
||||||
|
@ -768,9 +741,9 @@ class Photo
|
||||||
*
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public static function guessImageType($filename, $fromcurl = false)
|
public static function guessType($filename, $fromcurl = false)
|
||||||
{
|
{
|
||||||
logger('Photo: guessImageType: '.$filename . ($fromcurl?' from curl headers':''), LOGGER_DEBUG);
|
logger('Image: guessType: '.$filename . ($fromcurl?' from curl headers':''), LOGGER_DEBUG);
|
||||||
$type = null;
|
$type = null;
|
||||||
if ($fromcurl) {
|
if ($fromcurl) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
@ -805,109 +778,10 @@ class Photo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger('Photo: guessImageType: type='.$type, LOGGER_DEBUG);
|
logger('Image: guessType: type='.$type, LOGGER_DEBUG);
|
||||||
return $type;
|
return $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $photo photo
|
|
||||||
* @param integer $uid user id
|
|
||||||
* @param integer $cid contact id
|
|
||||||
* @param boolean $quit_on_error optional, default false
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public static function importProfilePhoto($photo, $uid, $cid, $quit_on_error = false)
|
|
||||||
{
|
|
||||||
$r = dba::select(
|
|
||||||
'photo',
|
|
||||||
array('resource-id'),
|
|
||||||
array('uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos'),
|
|
||||||
array('limit' => 1)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (DBM::is_result($r) && strlen($r['resource-id'])) {
|
|
||||||
$hash = $r['resource-id'];
|
|
||||||
} else {
|
|
||||||
$hash = photo_new_resource();
|
|
||||||
}
|
|
||||||
|
|
||||||
$photo_failure = false;
|
|
||||||
|
|
||||||
$filename = basename($photo);
|
|
||||||
$img_str = fetch_url($photo, true);
|
|
||||||
|
|
||||||
if ($quit_on_error && ($img_str == "")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$type = self::guessImageType($photo, true);
|
|
||||||
$img = new Photo($img_str, $type);
|
|
||||||
if ($img->isValid()) {
|
|
||||||
$img->scaleImageSquare(175);
|
|
||||||
|
|
||||||
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 4);
|
|
||||||
|
|
||||||
if ($r === false) {
|
|
||||||
$photo_failure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$img->scaleImage(80);
|
|
||||||
|
|
||||||
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 5);
|
|
||||||
|
|
||||||
if ($r === false) {
|
|
||||||
$photo_failure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$img->scaleImage(48);
|
|
||||||
|
|
||||||
$r = $img->store($uid, $cid, $hash, $filename, 'Contact Photos', 6);
|
|
||||||
|
|
||||||
if ($r === false) {
|
|
||||||
$photo_failure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$suffix = '?ts='.time();
|
|
||||||
|
|
||||||
$photo = System::baseUrl() . '/photo/' . $hash . '-4.' . $img->getExt() . $suffix;
|
|
||||||
$thumb = System::baseUrl() . '/photo/' . $hash . '-5.' . $img->getExt() . $suffix;
|
|
||||||
$micro = System::baseUrl() . '/photo/' . $hash . '-6.' . $img->getExt() . $suffix;
|
|
||||||
|
|
||||||
// Remove the cached photo
|
|
||||||
$a = get_app();
|
|
||||||
$basepath = $a->get_basepath();
|
|
||||||
|
|
||||||
if (is_dir($basepath."/photo")) {
|
|
||||||
$filename = $basepath.'/photo/'.$hash.'-4.'.$img->getExt();
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
unlink($filename);
|
|
||||||
}
|
|
||||||
$filename = $basepath.'/photo/'.$hash.'-5.'.$img->getExt();
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
unlink($filename);
|
|
||||||
}
|
|
||||||
$filename = $basepath.'/photo/'.$hash.'-6.'.$img->getExt();
|
|
||||||
if (file_exists($filename)) {
|
|
||||||
unlink($filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$photo_failure = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($photo_failure && $quit_on_error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($photo_failure) {
|
|
||||||
$photo = System::baseUrl() . '/images/person-175.jpg';
|
|
||||||
$thumb = System::baseUrl() . '/images/person-80.jpg';
|
|
||||||
$micro = System::baseUrl() . '/images/person-48.jpg';
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($photo, $thumb, $micro);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $url url
|
* @param string $url url
|
||||||
* @return object
|
* @return object
|
||||||
|
@ -915,34 +789,34 @@ class Photo
|
||||||
public static function getInfoFromURL($url)
|
public static function getInfoFromURL($url)
|
||||||
{
|
{
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
$data = Cache::get($url);
|
$data = Cache::get($url);
|
||||||
|
|
||||||
if (is_null($data) || !$data || !is_array($data)) {
|
if (is_null($data) || !$data || !is_array($data)) {
|
||||||
$img_str = fetch_url($url, true, $redirects, 4);
|
$img_str = fetch_url($url, true, $redirects, 4);
|
||||||
$filesize = strlen($img_str);
|
$filesize = strlen($img_str);
|
||||||
|
|
||||||
if (function_exists("getimagesizefromstring")) {
|
if (function_exists("getimagesizefromstring")) {
|
||||||
$data = getimagesizefromstring($img_str);
|
$data = getimagesizefromstring($img_str);
|
||||||
} else {
|
} else {
|
||||||
$tempfile = tempnam(get_temppath(), "cache");
|
$tempfile = tempnam(get_temppath(), "cache");
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
file_put_contents($tempfile, $img_str);
|
file_put_contents($tempfile, $img_str);
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->save_timestamp($stamp1, "file");
|
||||||
|
|
||||||
$data = getimagesize($tempfile);
|
$data = getimagesize($tempfile);
|
||||||
unlink($tempfile);
|
unlink($tempfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data) {
|
if ($data) {
|
||||||
$data["size"] = $filesize;
|
$data["size"] = $filesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache::set($url, $data);
|
Cache::set($url, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,18 +826,18 @@ class Photo
|
||||||
* @param integer $max max
|
* @param integer $max max
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function scaleImageTo($width, $height, $max)
|
public static function getScalingDimensions($width, $height, $max)
|
||||||
{
|
{
|
||||||
$dest_width = $dest_height = 0;
|
$dest_width = $dest_height = 0;
|
||||||
|
|
||||||
if ((!$width) || (!$height)) {
|
if ((!$width) || (!$height)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > $max && $height > $max) {
|
if ($width > $max && $height > $max) {
|
||||||
// very tall image (greater than 16:9)
|
// very tall image (greater than 16:9)
|
||||||
// constrain the width - let the height float.
|
// constrain the width - let the height float.
|
||||||
|
|
||||||
if ((($height * 9) / 16) > $width) {
|
if ((($height * 9) / 16) > $width) {
|
||||||
$dest_width = $max;
|
$dest_width = $max;
|
||||||
$dest_height = intval(($height * $max) / $width);
|
$dest_height = intval(($height * $max) / $width);
|
||||||
|
@ -983,7 +857,7 @@ class Photo
|
||||||
if ($height > $max) {
|
if ($height > $max) {
|
||||||
// very tall image (greater than 16:9)
|
// very tall image (greater than 16:9)
|
||||||
// but width is OK - don't do anything
|
// but width is OK - don't do anything
|
||||||
|
|
||||||
if ((($height * 9) / 16) > $width) {
|
if ((($height * 9) / 16) > $width) {
|
||||||
$dest_width = $width;
|
$dest_width = $width;
|
||||||
$dest_height = $height;
|
$dest_height = $height;
|
||||||
|
@ -1015,152 +889,152 @@ class Photo
|
||||||
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
|
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!DBM::is_result($r)) {
|
if (!DBM::is_result($r)) {
|
||||||
logger("Can't detect user data for uid ".$uid, LOGGER_DEBUG);
|
logger("Can't detect user data for uid ".$uid, LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_owner_nick = $r[0]['nickname'];
|
$page_owner_nick = $r[0]['nickname'];
|
||||||
|
|
||||||
/// @TODO
|
/// @TODO
|
||||||
/// $default_cid = $r[0]['id'];
|
/// $default_cid = $r[0]['id'];
|
||||||
/// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
/// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||||
|
|
||||||
if ((strlen($imagedata) == 0) && ($url == "")) {
|
if ((strlen($imagedata) == 0) && ($url == "")) {
|
||||||
logger("No image data and no url provided", LOGGER_DEBUG);
|
logger("No image data and no url provided", LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
} elseif (strlen($imagedata) == 0) {
|
} elseif (strlen($imagedata) == 0) {
|
||||||
logger("Uploading picture from ".$url, LOGGER_DEBUG);
|
logger("Uploading picture from ".$url, LOGGER_DEBUG);
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
$imagedata = @file_get_contents($url);
|
$imagedata = @file_get_contents($url);
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->save_timestamp($stamp1, "file");
|
||||||
}
|
}
|
||||||
|
|
||||||
$maximagesize = Config::get('system', 'maximagesize');
|
$maximagesize = Config::get('system', 'maximagesize');
|
||||||
|
|
||||||
if (($maximagesize) && (strlen($imagedata) > $maximagesize)) {
|
if (($maximagesize) && (strlen($imagedata) > $maximagesize)) {
|
||||||
logger("Image exceeds size limit of ".$maximagesize, LOGGER_DEBUG);
|
logger("Image exceeds size limit of ".$maximagesize, LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$tempfile = tempnam(get_temppath(), "cache");
|
$tempfile = tempnam(get_temppath(), "cache");
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
$stamp1 = microtime(true);
|
||||||
file_put_contents($tempfile, $imagedata);
|
file_put_contents($tempfile, $imagedata);
|
||||||
$a->save_timestamp($stamp1, "file");
|
$a->save_timestamp($stamp1, "file");
|
||||||
|
|
||||||
$data = getimagesize($tempfile);
|
$data = getimagesize($tempfile);
|
||||||
|
|
||||||
if (!isset($data["mime"])) {
|
if (!isset($data["mime"])) {
|
||||||
unlink($tempfile);
|
unlink($tempfile);
|
||||||
logger("File is no picture", LOGGER_DEBUG);
|
logger("File is no picture", LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$ph = new Photo($imagedata, $data["mime"]);
|
$Image = new Image($imagedata, $data["mime"]);
|
||||||
|
|
||||||
if (!$ph->isValid()) {
|
if (!$Image->isValid()) {
|
||||||
unlink($tempfile);
|
unlink($tempfile);
|
||||||
logger("Picture is no valid picture", LOGGER_DEBUG);
|
logger("Picture is no valid picture", LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$ph->orient($tempfile);
|
$Image->orient($tempfile);
|
||||||
unlink($tempfile);
|
unlink($tempfile);
|
||||||
|
|
||||||
$max_length = Config::get('system', 'max_image_length');
|
$max_length = Config::get('system', 'max_image_length');
|
||||||
if (! $max_length) {
|
if (! $max_length) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
$ph->scaleImage($max_length);
|
$Image->scaleDown($max_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
$width = $ph->getWidth();
|
$width = $Image->getWidth();
|
||||||
$height = $ph->getHeight();
|
$height = $Image->getHeight();
|
||||||
|
|
||||||
$hash = photo_new_resource();
|
$hash = photo_new_resource();
|
||||||
|
|
||||||
$smallest = 0;
|
$smallest = 0;
|
||||||
|
|
||||||
// Pictures are always public by now
|
// Pictures are always public by now
|
||||||
//$defperm = '<'.$default_cid.'>';
|
//$defperm = '<'.$default_cid.'>';
|
||||||
$defperm = "";
|
$defperm = "";
|
||||||
$visitor = 0;
|
$visitor = 0;
|
||||||
|
|
||||||
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 0, 0, $defperm);
|
$r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, t('Wall Photos'), 0, 0, $defperm);
|
||||||
|
|
||||||
if (!$r) {
|
if (!$r) {
|
||||||
logger("Picture couldn't be stored", LOGGER_DEBUG);
|
logger("Picture couldn't be stored", LOGGER_DEBUG);
|
||||||
return(array());
|
return(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = array("page" => System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash,
|
$image = array("page" => System::baseUrl().'/photos/'.$page_owner_nick.'/image/'.$hash,
|
||||||
"full" => System::baseUrl()."/photo/{$hash}-0.".$ph->getExt());
|
"full" => System::baseUrl()."/photo/{$hash}-0.".$Image->getExt());
|
||||||
|
|
||||||
if ($width > 800 || $height > 800) {
|
if ($width > 800 || $height > 800) {
|
||||||
$image["large"] = System::baseUrl()."/photo/{$hash}-0.".$ph->getExt();
|
$image["large"] = System::baseUrl()."/photo/{$hash}-0.".$Image->getExt();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$ph->scaleImage(640);
|
$Image->scaleDown(640);
|
||||||
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 1, 0, $defperm);
|
$r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, t('Wall Photos'), 1, 0, $defperm);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$image["medium"] = System::baseUrl()."/photo/{$hash}-1.".$ph->getExt();
|
$image["medium"] = System::baseUrl()."/photo/{$hash}-1.".$Image->getExt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$ph->scaleImage(320);
|
$Image->scaleDown(320);
|
||||||
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 2, 0, $defperm);
|
$r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, t('Wall Photos'), 2, 0, $defperm);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$image["small"] = System::baseUrl()."/photo/{$hash}-2.".$ph->getExt();
|
$image["small"] = System::baseUrl()."/photo/{$hash}-2.".$Image->getExt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($width > 160 && $height > 160) {
|
if ($width > 160 && $height > 160) {
|
||||||
$x = 0;
|
$x = 0;
|
||||||
$y = 0;
|
$y = 0;
|
||||||
|
|
||||||
$min = $ph->getWidth();
|
$min = $Image->getWidth();
|
||||||
if ($min > 160) {
|
if ($min > 160) {
|
||||||
$x = ($min - 160) / 2;
|
$x = ($min - 160) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ph->getHeight() < $min) {
|
if ($Image->getHeight() < $min) {
|
||||||
$min = $ph->getHeight();
|
$min = $Image->getHeight();
|
||||||
if ($min > 160) {
|
if ($min > 160) {
|
||||||
$y = ($min - 160) / 2;
|
$y = ($min - 160) / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$min = 160;
|
$min = 160;
|
||||||
$ph->cropImage(160, $x, $y, $min, $min);
|
$Image->crop(160, $x, $y, $min, $min);
|
||||||
|
|
||||||
$r = $ph->store($uid, $visitor, $hash, $tempfile, t('Wall Photos'), 3, 0, $defperm);
|
$r = Photo::store($Image, $uid, $visitor, $hash, $tempfile, t('Wall Photos'), 3, 0, $defperm);
|
||||||
if ($r) {
|
if ($r) {
|
||||||
$image["thumb"] = System::baseUrl()."/photo/{$hash}-3.".$ph->getExt();
|
$image["thumb"] = System::baseUrl()."/photo/{$hash}-3.".$Image->getExt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the full image as preview image. This will be overwritten, if the picture is larger than 640.
|
// Set the full image as preview image. This will be overwritten, if the picture is larger than 640.
|
||||||
$image["preview"] = $image["full"];
|
$image["preview"] = $image["full"];
|
||||||
|
|
||||||
// Deactivated, since that would result in a cropped preview, if the picture wasn't larger than 320
|
// Deactivated, since that would result in a cropped preview, if the picture wasn't larger than 320
|
||||||
//if (isset($image["thumb"]))
|
//if (isset($image["thumb"]))
|
||||||
// $image["preview"] = $image["thumb"];
|
// $image["preview"] = $image["thumb"];
|
||||||
|
|
||||||
// Unsure, if this should be activated or deactivated
|
// Unsure, if this should be activated or deactivated
|
||||||
//if (isset($image["small"]))
|
//if (isset($image["small"]))
|
||||||
// $image["preview"] = $image["small"];
|
// $image["preview"] = $image["small"];
|
||||||
|
|
||||||
if (isset($image["medium"])) {
|
if (isset($image["medium"])) {
|
||||||
$image["preview"] = $image["medium"];
|
$image["preview"] = $image["medium"];
|
||||||
}
|
}
|
||||||
|
|
||||||
return($image);
|
return($image);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,25 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file src/Object/Item.php
|
* @file src/Object/Post.php
|
||||||
*/
|
*/
|
||||||
namespace Friendica\Object;
|
namespace Friendica\Object;
|
||||||
|
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Content\Feature;
|
use Friendica\Content\Feature;
|
||||||
use Friendica\Core\Config;
|
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
||||||
require_once 'include/text.php';
|
require_once 'include/text.php';
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
require_once "include/conversation.php";
|
require_once 'include/conversation.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An item
|
* An item
|
||||||
*/
|
*/
|
||||||
class Item extends BaseObject
|
class Post extends BaseObject
|
||||||
{
|
{
|
||||||
private $data = array();
|
private $data = array();
|
||||||
private $template = null;
|
private $template = null;
|
||||||
|
@ -32,7 +31,7 @@ class Item extends BaseObject
|
||||||
private $writable = false;
|
private $writable = false;
|
||||||
private $children = array();
|
private $children = array();
|
||||||
private $parent = null;
|
private $parent = null;
|
||||||
private $conversation = null;
|
private $thread = null;
|
||||||
private $redirect_url = null;
|
private $redirect_url = null;
|
||||||
private $owner_url = '';
|
private $owner_url = '';
|
||||||
private $owner_photo = '';
|
private $owner_photo = '';
|
||||||
|
@ -46,7 +45,7 @@ class Item extends BaseObject
|
||||||
*
|
*
|
||||||
* @param array $data data array
|
* @param array $data data array
|
||||||
*/
|
*/
|
||||||
public function __construct($data)
|
public function __construct(array $data)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ class Item extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
$item['pagedrop'] = $data['pagedrop'];
|
$item['pagedrop'] = $data['pagedrop'];
|
||||||
$child = new Item($item);
|
$child = new Post($item);
|
||||||
$this->addChild($child);
|
$this->addChild($child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +138,7 @@ class Item extends BaseObject
|
||||||
$osparkle = '';
|
$osparkle = '';
|
||||||
$total_children = $this->countDescendants();
|
$total_children = $this->countDescendants();
|
||||||
|
|
||||||
$conv = $this->getConversation();
|
$conv = $this->getThread();
|
||||||
|
|
||||||
$lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
$lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
|
||||||
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
|| strlen($item['deny_cid']) || strlen($item['deny_gid']))))
|
||||||
|
@ -472,14 +471,14 @@ class Item extends BaseObject
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function addChild(Item $item)
|
public function addChild(Post $item)
|
||||||
{
|
{
|
||||||
$item_id = $item->getId();
|
$item_id = $item->getId();
|
||||||
if (!$item_id) {
|
if (!$item_id) {
|
||||||
logger('[ERROR] Item::addChild : Item has no ID!!', LOGGER_DEBUG);
|
logger('[ERROR] Post::addChild : Item has no ID!!', LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
} elseif ($this->getChild($item->getId())) {
|
} elseif ($this->getChild($item->getId())) {
|
||||||
logger('[WARN] Item::addChild : Item already exists ('. $item->getId() .').', LOGGER_DEBUG);
|
logger('[WARN] Post::addChild : Item already exists ('. $item->getId() .').', LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -540,7 +539,7 @@ class Item extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->parent = $item;
|
$this->parent = $item;
|
||||||
$this->setConversation($item->getConversation());
|
$this->setThread($item->getThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -551,7 +550,7 @@ class Item extends BaseObject
|
||||||
protected function removeParent()
|
protected function removeParent()
|
||||||
{
|
{
|
||||||
$this->parent = null;
|
$this->parent = null;
|
||||||
$this->conversation = null;
|
$this->thread = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -594,15 +593,15 @@ class Item extends BaseObject
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setConversation($conv)
|
public function setThread($conv)
|
||||||
{
|
{
|
||||||
$previous_mode = ($this->conversation ? $this->conversation->getMode() : '');
|
$previous_mode = ($this->thread ? $this->thread->getMode() : '');
|
||||||
|
|
||||||
$this->conversation = $conv;
|
$this->thread = $conv;
|
||||||
|
|
||||||
// Set it on our children too
|
// Set it on our children too
|
||||||
foreach ($this->getChildren() as $child) {
|
foreach ($this->getChildren() as $child) {
|
||||||
$child->setConversation($conv);
|
$child->setThread($conv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,9 +610,9 @@ class Item extends BaseObject
|
||||||
*
|
*
|
||||||
* @return object
|
* @return object
|
||||||
*/
|
*/
|
||||||
public function getConversation()
|
public function getThread()
|
||||||
{
|
{
|
||||||
return $this->conversation;
|
return $this->thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -690,7 +689,7 @@ class Item extends BaseObject
|
||||||
*/
|
*/
|
||||||
private function isWritable()
|
private function isWritable()
|
||||||
{
|
{
|
||||||
$conv = $this->getConversation();
|
$conv = $this->getThread();
|
||||||
|
|
||||||
if ($conv) {
|
if ($conv) {
|
||||||
// This will allow us to comment on wall-to-wall items owned by our friends
|
// This will allow us to comment on wall-to-wall items owned by our friends
|
||||||
|
@ -748,7 +747,7 @@ class Item extends BaseObject
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
$comment_box = '';
|
$comment_box = '';
|
||||||
$conv = $this->getConversation();
|
$conv = $this->getThread();
|
||||||
$template = get_markup_template($this->getCommentBoxTemplate());
|
$template = get_markup_template($this->getCommentBoxTemplate());
|
||||||
$ww = '';
|
$ww = '';
|
||||||
if (($conv->getMode() === 'network') && $this->isWallToWall()) {
|
if (($conv->getMode() === 'network') && $this->isWallToWall()) {
|
||||||
|
@ -819,7 +818,7 @@ class Item extends BaseObject
|
||||||
protected function checkWallToWall()
|
protected function checkWallToWall()
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
$conv = $this->getConversation();
|
$conv = $this->getThread();
|
||||||
$this->wall_to_wall = false;
|
$this->wall_to_wall = false;
|
||||||
|
|
||||||
if ($this->isToplevel()) {
|
if ($this->isToplevel()) {
|
||||||
|
@ -889,14 +888,6 @@ class Item extends BaseObject
|
||||||
return $this->owner_url;
|
return $this->owner_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
private function getOwnerPhoto()
|
|
||||||
{
|
|
||||||
return $this->owner_photo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file src/Object/Conversation.php
|
* @file src/Object/Thread.php
|
||||||
*/
|
*/
|
||||||
namespace Friendica\Object;
|
namespace Friendica\Object;
|
||||||
|
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Object\Item;
|
use Friendica\Object\Post;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
require_once 'include/text.php';
|
require_once 'include/text.php';
|
||||||
|
@ -15,9 +15,9 @@ require_once 'include/text.php';
|
||||||
*
|
*
|
||||||
* We should think about making this a SPL Iterator
|
* We should think about making this a SPL Iterator
|
||||||
*/
|
*/
|
||||||
class Conversation extends BaseObject
|
class Thread extends BaseObject
|
||||||
{
|
{
|
||||||
private $threads = array();
|
private $parents = array();
|
||||||
private $mode = null;
|
private $mode = null;
|
||||||
private $writable = false;
|
private $writable = false;
|
||||||
private $profile_owner = 0;
|
private $profile_owner = 0;
|
||||||
|
@ -120,7 +120,7 @@ class Conversation extends BaseObject
|
||||||
* @return mixed The inserted item on success
|
* @return mixed The inserted item on success
|
||||||
* false on failure
|
* false on failure
|
||||||
*/
|
*/
|
||||||
public function addThread($item)
|
public function addParent(Post $item)
|
||||||
{
|
{
|
||||||
$item_id = $item->getId();
|
$item_id = $item->getId();
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class Conversation extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->getThread($item->getId())) {
|
if ($this->getParent($item->getId())) {
|
||||||
logger('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', LOGGER_DEBUG);
|
logger('[WARN] Conversation::addThread : Thread already exists ('. $item->getId() .').', LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -147,10 +147,10 @@ class Conversation extends BaseObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->setConversation($this);
|
$item->setThread($this);
|
||||||
$this->threads[] = $item;
|
$this->parents[] = $item;
|
||||||
|
|
||||||
return end($this->threads);
|
return end($this->parents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -169,7 +169,7 @@ class Conversation extends BaseObject
|
||||||
$result = array();
|
$result = array();
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
foreach ($this->threads as $item) {
|
foreach ($this->parents as $item) {
|
||||||
if ($item->getDataValue('network') === NETWORK_MAIL && local_user() != $item->getDataValue('uid')) {
|
if ($item->getDataValue('network') === NETWORK_MAIL && local_user() != $item->getDataValue('uid')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -194,9 +194,9 @@ class Conversation extends BaseObject
|
||||||
* @return mixed The found item on success
|
* @return mixed The found item on success
|
||||||
* false on failure
|
* false on failure
|
||||||
*/
|
*/
|
||||||
private function getThread($id)
|
private function getParent($id)
|
||||||
{
|
{
|
||||||
foreach ($this->threads as $item) {
|
foreach ($this->parents as $item) {
|
||||||
if ($item->getId() == $id) {
|
if ($item->getId() == $id) {
|
||||||
return $item;
|
return $item;
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
namespace Friendica;
|
namespace Friendica;
|
||||||
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
use dba;
|
use dba;
|
||||||
|
@ -353,7 +353,7 @@ class ParseUrl
|
||||||
}
|
}
|
||||||
|
|
||||||
$src = self::completeUrl($attr["src"], $url);
|
$src = self::completeUrl($attr["src"], $url);
|
||||||
$photodata = Photo::getInfoFromURL($src);
|
$photodata = Image::getInfoFromURL($src);
|
||||||
|
|
||||||
if (($photodata) && ($photodata[0] > 150) && ($photodata[1] > 150)) {
|
if (($photodata) && ($photodata[0] > 150) && ($photodata[1] > 150)) {
|
||||||
if ($photodata[0] > 300) {
|
if ($photodata[0] > 300) {
|
||||||
|
@ -374,7 +374,7 @@ class ParseUrl
|
||||||
|
|
||||||
unset($siteinfo["image"]);
|
unset($siteinfo["image"]);
|
||||||
|
|
||||||
$photodata = Photo::getInfoFromURL($src);
|
$photodata = Image::getInfoFromURL($src);
|
||||||
|
|
||||||
if (($photodata) && ($photodata[0] > 10) && ($photodata[1] > 10)) {
|
if (($photodata) && ($photodata[0] > 10) && ($photodata[1] > 10)) {
|
||||||
$siteinfo["images"][] = array("src" => $src,
|
$siteinfo["images"][] = array("src" => $src,
|
||||||
|
|
|
@ -13,10 +13,10 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Object\Profile;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -476,7 +476,7 @@ class DFRN
|
||||||
$uid
|
$uid
|
||||||
);
|
);
|
||||||
$photos = array();
|
$photos = array();
|
||||||
$ext = Photo::supportedTypes();
|
$ext = Image::supportedTypes();
|
||||||
|
|
||||||
foreach ($rp as $p) {
|
foreach ($rp as $p) {
|
||||||
$photos[$p['scale']] = System::baseUrl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
$photos[$p['scale']] = System::baseUrl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
||||||
|
@ -1678,9 +1678,9 @@ class DFRN
|
||||||
$poco["photo"] = $author["avatar"];
|
$poco["photo"] = $author["avatar"];
|
||||||
$poco["hide"] = $hide;
|
$poco["hide"] = $hide;
|
||||||
$poco["contact-type"] = $contact["contact-type"];
|
$poco["contact-type"] = $contact["contact-type"];
|
||||||
$gcid = GlobalContact::update($poco);
|
$gcid = GContact::update($poco);
|
||||||
|
|
||||||
GlobalContact::link($gcid, $importer["uid"], $contact["id"]);
|
GContact::link($gcid, $importer["uid"], $contact["id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return($author);
|
return($author);
|
||||||
|
|
|
@ -16,10 +16,10 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Object\Profile;
|
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
use dba;
|
use dba;
|
||||||
|
@ -2247,9 +2247,9 @@ class Diaspora
|
||||||
"addr" => $author, "nick" => $nick, "keywords" => $keywords,
|
"addr" => $author, "nick" => $nick, "keywords" => $keywords,
|
||||||
"hide" => !$searchable, "nsfw" => $nsfw);
|
"hide" => !$searchable, "nsfw" => $nsfw);
|
||||||
|
|
||||||
$gcid = GlobalContact::update($gcontact);
|
$gcid = GContact::update($gcontact);
|
||||||
|
|
||||||
GlobalContact::link($gcid, $importer["uid"], $contact["id"]);
|
GContact::link($gcid, $importer["uid"], $contact["id"]);
|
||||||
|
|
||||||
logger("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
|
logger("Profile of contact ".$contact["id"]." stored for user ".$importer["uid"], LOGGER_DEBUG);
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Object\Photo;
|
|
||||||
use Friendica\Util\Lock;
|
use Friendica\Util\Lock;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
use dba;
|
use dba;
|
||||||
|
@ -226,9 +226,9 @@ class OStatus
|
||||||
$contact["generation"] = 2;
|
$contact["generation"] = 2;
|
||||||
$contact["hide"] = false; // OStatus contacts are never hidden
|
$contact["hide"] = false; // OStatus contacts are never hidden
|
||||||
$contact["photo"] = $author["author-avatar"];
|
$contact["photo"] = $author["author-avatar"];
|
||||||
$gcid = GlobalContact::update($contact);
|
$gcid = GContact::update($contact);
|
||||||
|
|
||||||
GlobalContact::link($gcid, $contact["uid"], $contact["id"]);
|
GContact::link($gcid, $contact["uid"], $contact["id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $author;
|
return $author;
|
||||||
|
@ -1323,7 +1323,7 @@ class OStatus
|
||||||
|
|
||||||
switch ($siteinfo["type"]) {
|
switch ($siteinfo["type"]) {
|
||||||
case 'photo':
|
case 'photo':
|
||||||
$imgdata = Photo::getInfoFromURL($siteinfo["image"]);
|
$imgdata = Image::getInfoFromURL($siteinfo["image"]);
|
||||||
$attributes = array("rel" => "enclosure",
|
$attributes = array("rel" => "enclosure",
|
||||||
"href" => $siteinfo["image"],
|
"href" => $siteinfo["image"],
|
||||||
"type" => $imgdata["mime"],
|
"type" => $imgdata["mime"],
|
||||||
|
@ -1343,7 +1343,7 @@ class OStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Config::get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
|
if (!Config::get('system', 'ostatus_not_attach_preview') && ($siteinfo["type"] != "photo") && isset($siteinfo["image"])) {
|
||||||
$imgdata = Photo::getInfoFromURL($siteinfo["image"]);
|
$imgdata = Image::getInfoFromURL($siteinfo["image"]);
|
||||||
$attributes = array("rel" => "enclosure",
|
$attributes = array("rel" => "enclosure",
|
||||||
"href" => $siteinfo["image"],
|
"href" => $siteinfo["image"],
|
||||||
"type" => $imgdata["mime"],
|
"type" => $imgdata["mime"],
|
||||||
|
|
|
@ -12,10 +12,9 @@ namespace Friendica\Protocol;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Photo;
|
|
||||||
use Friendica\Object\Profile;
|
|
||||||
use dba;
|
use dba;
|
||||||
use DOMDocument;
|
use DOMDocument;
|
||||||
use DomXPath;
|
use DomXPath;
|
||||||
|
@ -193,10 +192,10 @@ class PortableContact
|
||||||
"generation" => $generation);
|
"generation" => $generation);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$gcontact = GlobalContact::sanitize($gcontact);
|
$gcontact = GContact::sanitize($gcontact);
|
||||||
$gcid = GlobalContact::update($gcontact);
|
$gcid = GContact::update($gcontact);
|
||||||
|
|
||||||
GlobalContact::link($gcid, $uid, $cid, $zcid);
|
GContact::link($gcid, $uid, $cid, $zcid);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
logger($e->getMessage(), LOGGER_DEBUG);
|
logger($e->getMessage(), LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
@ -425,7 +424,7 @@ class PortableContact
|
||||||
|
|
||||||
$contact = array_merge($contact, $noscrape);
|
$contact = array_merge($contact, $noscrape);
|
||||||
|
|
||||||
GlobalContact::update($contact);
|
GContact::update($contact);
|
||||||
|
|
||||||
if (trim($noscrape["updated"]) != "") {
|
if (trim($noscrape["updated"]) != "") {
|
||||||
q(
|
q(
|
||||||
|
@ -447,7 +446,7 @@ class PortableContact
|
||||||
if (!$force && !self::updateNeeded($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
|
if (!$force && !self::updateNeeded($gcontacts[0]["created"], $gcontacts[0]["updated"], $gcontacts[0]["last_failure"], $gcontacts[0]["last_contact"])) {
|
||||||
logger("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
|
logger("Profile ".$profile." was last updated at ".$gcontacts[0]["updated"]." (cached)", LOGGER_DEBUG);
|
||||||
|
|
||||||
GlobalContact::update($contact);
|
GContact::update($contact);
|
||||||
return $gcontacts[0]["updated"];
|
return $gcontacts[0]["updated"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,8 +467,8 @@ class PortableContact
|
||||||
$gcontact["server_url"] = $data["baseurl"];
|
$gcontact["server_url"] = $data["baseurl"];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$gcontact = GlobalContact::sanitize($gcontact);
|
$gcontact = GContact::sanitize($gcontact);
|
||||||
GlobalContact::update($gcontact);
|
GContact::update($gcontact);
|
||||||
|
|
||||||
self::lastUpdated($data["url"], $force);
|
self::lastUpdated($data["url"], $force);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -495,7 +494,7 @@ class PortableContact
|
||||||
|
|
||||||
$contact["server_url"] = $data["baseurl"];
|
$contact["server_url"] = $data["baseurl"];
|
||||||
|
|
||||||
GlobalContact::update($contact);
|
GContact::update($contact);
|
||||||
|
|
||||||
$feedret = z_fetch_url($data["poll"]);
|
$feedret = z_fetch_url($data["poll"]);
|
||||||
|
|
||||||
|
@ -1601,8 +1600,8 @@ class PortableContact
|
||||||
"generation" => $generation);
|
"generation" => $generation);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$gcontact = GlobalContact::sanitize($gcontact);
|
$gcontact = GContact::sanitize($gcontact);
|
||||||
GlobalContact::update($gcontact);
|
GContact::update($gcontact);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
logger($e->getMessage(), LOGGER_DEBUG);
|
logger($e->getMessage(), LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ use Friendica\App;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ class CronJobs
|
||||||
$r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`");
|
$r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`");
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
foreach ($r AS $user) {
|
foreach ($r AS $user) {
|
||||||
GlobalContact::updateForUser($user["uid"]);
|
GContact::updateForUser($user["uid"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\DFRN;
|
use Friendica\Protocol\DFRN;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class DiscoverPoCo {
|
||||||
}
|
}
|
||||||
logger($result, LOGGER_DEBUG);
|
logger($result, LOGGER_DEBUG);
|
||||||
} elseif ($mode == 3) {
|
} elseif ($mode == 3) {
|
||||||
GlobalContact::updateSuggestions();
|
GContact::updateSuggestions();
|
||||||
} elseif (($mode == 2) && Config::get('system', 'poco_completion')) {
|
} elseif (($mode == 2) && Config::get('system', 'poco_completion')) {
|
||||||
self::discoverUsers();
|
self::discoverUsers();
|
||||||
} elseif (($mode == 1) && ($search != "") && Config::get('system', 'poco_local_search')) {
|
} elseif (($mode == 1) && ($search != "") && Config::get('system', 'poco_local_search')) {
|
||||||
|
@ -102,7 +102,7 @@ class DiscoverPoCo {
|
||||||
|
|
||||||
// Query GNU Social servers for their users ("statistics" addon has to be enabled on the GS server)
|
// Query GNU Social servers for their users ("statistics" addon has to be enabled on the GS server)
|
||||||
if (!Config::get('system', 'ostatus_disabled')) {
|
if (!Config::get('system', 'ostatus_disabled')) {
|
||||||
GlobalContact::discoverGsUsers();
|
GContact::discoverGsUsers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ class DiscoverPoCo {
|
||||||
|
|
||||||
$data["server_url"] = $data["baseurl"];
|
$data["server_url"] = $data["baseurl"];
|
||||||
|
|
||||||
GlobalContact::update($data);
|
GContact::update($data);
|
||||||
} else {
|
} else {
|
||||||
logger("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], LOGGER_DEBUG);
|
logger("Profile ".$jj->url." is not responding or no Friendica contact - but network ".$data["network"], LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
@ -297,7 +297,7 @@ class DiscoverPoCo {
|
||||||
$contact = Probe::uri($user->site_address."/".$user->name);
|
$contact = Probe::uri($user->site_address."/".$user->name);
|
||||||
if ($contact["network"] != NETWORK_PHANTOM) {
|
if ($contact["network"] != NETWORK_PHANTOM) {
|
||||||
$contact["about"] = $user->description;
|
$contact["about"] = $user->description;
|
||||||
GlobalContact::update($contact);
|
GContact::update($contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Friendica\Worker;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class GProbe {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
|
if (!in_array($arr["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
|
||||||
GlobalContact::update($arr);
|
GContact::update($arr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q(
|
$r = q(
|
||||||
|
|
|
@ -7,8 +7,8 @@ namespace Friendica\Worker;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Network\Probe;
|
use Friendica\Network\Probe;
|
||||||
use Friendica\Object\Contact;
|
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
use Friendica\Protocol\OStatus;
|
||||||
use Friendica\Protocol\Salmon;
|
use Friendica\Protocol\Salmon;
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Friendica\Worker;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Protocol\Email;
|
use Friendica\Protocol\Email;
|
||||||
use Friendica\Protocol\PortableContact;
|
use Friendica\Protocol\PortableContact;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
11
update.php
11
update.php
|
@ -6,7 +6,8 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Model\Photo;
|
||||||
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -153,10 +154,10 @@ function update_1014()
|
||||||
$r = q("SELECT * FROM `photo` WHERE `scale` = 4");
|
$r = q("SELECT * FROM `photo` WHERE `scale` = 4");
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
$ph = new Photo($rr['data']);
|
$Image = new Image($rr['data']);
|
||||||
if ($ph->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$ph->scaleImage(48);
|
$Image->scaleDown(48);
|
||||||
$ph->store($rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
|
Photo::store($Image, $rr['uid'],$rr['contact-id'],$rr['resource-id'],$rr['filename'],$rr['album'],6,(($rr['profile']) ? 1 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ if ($argc != 2 || $argv[1] == "-h" || $argv[1] == "--help" || $argv[1] == "-?")
|
||||||
}
|
}
|
||||||
|
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Object\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
|
|
@ -12,7 +12,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
$frio = "view/theme/frio";
|
$frio = "view/theme/frio";
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ function frio_uninstall() {
|
||||||
*/
|
*/
|
||||||
function frio_item_photo_links(App $a, &$body_info)
|
function frio_item_photo_links(App $a, &$body_info)
|
||||||
{
|
{
|
||||||
$phototypes = Photo::supportedTypes();
|
$phototypes = Image::supportedTypes();
|
||||||
$occurence = 1;
|
$occurence = 1;
|
||||||
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Object\Photo;
|
use Friendica\Object\Image;
|
||||||
|
|
||||||
function frost_init(App $a) {
|
function frost_init(App $a) {
|
||||||
$a->videowidth = 400;
|
$a->videowidth = 400;
|
||||||
|
@ -48,7 +48,7 @@ function frost_uninstall() {
|
||||||
|
|
||||||
function frost_item_photo_links(App $a, &$body_info)
|
function frost_item_photo_links(App $a, &$body_info)
|
||||||
{
|
{
|
||||||
$phototypes = Photo::supportedTypes();
|
$phototypes = Image::supportedTypes();
|
||||||
|
|
||||||
$occurence = 1;
|
$occurence = 1;
|
||||||
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
$p = bb_find_open_close($body_info['html'], "<a", ">");
|
||||||
|
|
|
@ -15,7 +15,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Model\GlobalContact;
|
use Friendica\Model\GContact;
|
||||||
|
|
||||||
require_once "include/plugin.php";
|
require_once "include/plugin.php";
|
||||||
require_once "mod/proxy.php";
|
require_once "mod/proxy.php";
|
||||||
|
@ -139,7 +139,7 @@ function vier_community_info() {
|
||||||
|
|
||||||
// comunity_profiles
|
// comunity_profiles
|
||||||
if ($show_profiles) {
|
if ($show_profiles) {
|
||||||
$r = GlobalContact::suggestionQuery(local_user(), 0, 9);
|
$r = GContact::suggestionQuery(local_user(), 0, 9);
|
||||||
|
|
||||||
$tpl = get_markup_template('ch_directory_item.tpl');
|
$tpl = get_markup_template('ch_directory_item.tpl');
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
|
|
Loading…
Reference in a new issue