X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=8dd6793d2cf097af817175314672b5b1589f27de;hb=e84ad1556926acfebadfb70fd3161a0bc9ef4c6d;hp=88eec1dc48794de8faa89f91ac80aeaaedf91ac0;hpb=85ff976f83b1037328fedd26fd817c720625e0e9;p=friendica.git diff --git a/include/items.php b/include/items.php index 88eec1dc48..8dd6793d2c 100644 --- a/include/items.php +++ b/include/items.php @@ -3,28 +3,26 @@ * @file include/items.php */ -use Friendica\BaseObject; -use Friendica\Content\Feature; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\Logger; -use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\System; +use Friendica\Core\Session; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Item; use Friendica\Protocol\DFRN; use Friendica\Protocol\Feed; use Friendica\Protocol\OStatus; -use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\ParseUrl; use Friendica\Util\Strings; -use Friendica\Util\Temporal; -require_once 'mod/share.php'; +require_once __DIR__ . '/../mod/share.php'; + function add_page_info_data(array $data, $no_photos = false) { Hook::callAll('page_info_data', $data); @@ -40,7 +38,7 @@ function add_page_info_data(array $data, $no_photos = false) $data["type"] = "link"; } - $data["title"] = defaults($data, "title", ""); + $data["title"] = $data["title"] ?? ''; if ((($data["type"] != "link") && ($data["type"] != "video") && ($data["type"] != "photo")) || ($data["title"] == $data["url"])) { return ""; @@ -325,7 +323,7 @@ function drop_items(array $items) { $uid = 0; - if (!local_user() && !remote_user()) { + if (!Session::isAuthenticated()) { return; } @@ -342,7 +340,7 @@ function drop_items(array $items) function drop_item($id, $return = '') { - $a = BaseObject::getApp(); + $a = DI::app(); // locate item to be deleted @@ -351,7 +349,7 @@ function drop_item($id, $return = '') if (!DBA::isResult($item)) { notice(L10n::t('Item not found.') . EOL); - $a->internalRedirect('network'); + DI::baseUrl()->redirect('network'); } if ($item['deleted']) { @@ -361,14 +359,8 @@ function drop_item($id, $return = '') $contact_id = 0; // check if logged in user is either the author or owner of this item - - if (!empty($_SESSION['remote'])) { - foreach ($_SESSION['remote'] as $visitor) { - if ($visitor['uid'] == $item['uid'] && $visitor['cid'] == $item['contact-id']) { - $contact_id = $visitor['cid']; - break; - } - } + if (Session::getRemoteContactID($item['uid']) == $item['contact-id']) { + $contact_id = $item['contact-id']; } if ((local_user() == $item['uid']) || $contact_id) { @@ -376,7 +368,7 @@ function drop_item($id, $return = '') if (!empty($_REQUEST['confirm'])) { //