X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=3cd8b752863b6a68b49a04113a9aa6659b8e7cd9;hb=bf0b98017decf73123891e935993f2921d3b0acf;hp=e1116c346b53f3fc3aa1663d6519cd4b9ad536e6;hpb=7ffcb25321ce9b8517669c461fe58d90ad6d7ec6;p=friendica.git diff --git a/mod/photos.php b/mod/photos.php index e1116c346b..3cd8b75286 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -6,6 +6,7 @@ use Friendica\App; use Friendica\Content\Feature; use Friendica\Content\Nav; +use Friendica\Content\Text\BBCode; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; @@ -17,7 +18,6 @@ use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\Photo; use Friendica\Model\Profile; -use Friendica\Model\Term; use Friendica\Network\Probe; use Friendica\Object\Image; use Friendica\Protocol\DFRN; @@ -27,9 +27,7 @@ use Friendica\Util\Temporal; require_once 'include/items.php'; require_once 'include/acl_selectors.php'; -require_once 'include/bbcode.php'; require_once 'include/security.php'; -require_once 'include/threads.php'; function photos_init(App $a) { @@ -286,25 +284,12 @@ function photos_post(App $a) ); // find and delete the corresponding item with all the comments and likes/dislikes - $r = q("SELECT `id`, `parent-uri`, `visible` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", + $r = q("SELECT `id` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", intval($page_owner_uid) ); if (DBM::is_result($r)) { foreach ($r as $rr) { - q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", - dbesc(DateTimeFormat::utcNow()), - dbesc($rr['parent-uri']), - intval($page_owner_uid) - ); - Term::insertFromTagFieldByItemUri($rr['parent-uri'], $page_owner_uid); - Item::deleteThreadFromUri($rr['parent-uri'], $page_owner_uid); - - $drop_id = intval($rr['id']); - - // send the notification upstream/downstream as the case may be - if ($rr['visible']) { - Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id); - } + Item::deleteById($rr['id']); } } @@ -359,29 +344,15 @@ function photos_post(App $a) intval($page_owner_uid), dbesc($r[0]['resource-id']) ); - $i = q("SELECT `id`, `uri`, `visible` FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1", + $i = q("SELECT `id` FROM `item` WHERE `resource-id` = '%s' AND `uid` = %d LIMIT 1", dbesc($r[0]['resource-id']), intval($page_owner_uid) ); if (DBM::is_result($i)) { - q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", - dbesc(DateTimeFormat::utcNow()), - dbesc(DateTimeFormat::utcNow()), - dbesc($i[0]['uri']), - intval($page_owner_uid) - ); - Term::insertFromTagFieldByItemUri($i[0]['uri'], $page_owner_uid); - Item::deleteThreadFromUri($i[0]['uri'], $page_owner_uid); - - $url = System::baseUrl(); - $drop_id = intval($i[0]['id']); + Item::deleteById($i[0]['id']); // Update the photo albums cache Photo::clearAlbumCache($page_owner_uid); - - if ($i[0]['visible']) { - Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id); - } } } @@ -647,16 +618,9 @@ function photos_post(App $a) } $newinform .= $inform; - $r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d", - dbesc($newtag), - dbesc($newinform), - dbesc(DateTimeFormat::utcNow()), - dbesc(DateTimeFormat::utcNow()), - intval($item_id), - intval($page_owner_uid) - ); - Term::insertFromTagFieldByItemId($item_id); - Item::updateThread($item_id); + $fields = ['tag' => $newtag, 'inform' => $newinform, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()]; + $condition = ['id' => $item_id]; + Item::update($fields, $condition); $best = 0; foreach ($p as $scales) { @@ -874,7 +838,7 @@ function photos_post(App $a) $smallest = 0; - $photo_hash = photo_new_resource(); + $photo_hash = Photo::newResource(); $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); @@ -900,7 +864,7 @@ function photos_post(App $a) // Create item container $lat = $lon = null; - if ($exif && $exif['GPS'] && Feature::isEnabled($channel_id, 'photo_location')) { + if ($exif && $exif['GPS'] && Feature::isEnabled($page_owner_uid, 'photo_location')) { $lat = Photo::getGps($exif['GPS']['GPSLatitude'], $exif['GPS']['GPSLatitudeRef']); $lon = Photo::getGps($exif['GPS']['GPSLongitude'], $exif['GPS']['GPSLongitudeRef']); } @@ -969,7 +933,6 @@ function photos_content(App $a) return; } - require_once 'include/bbcode.php'; require_once 'include/security.php'; require_once 'include/conversation.php'; @@ -1428,11 +1391,7 @@ function photos_content(App $a) ); if (local_user() && (local_user() == $link_item['uid'])) { - q("UPDATE `item` SET `unseen` = 0 WHERE `parent` = %d and `uid` = %d", - intval($link_item['parent']), - intval(local_user()) - ); - Item::updateThread($link_item['parent']); + Item::update(['unseen' => false], ['parent' => $link_item['parent']]); } if ($link_item['coord']) { @@ -1450,7 +1409,7 @@ function photos_content(App $a) if (strlen($tag_str)) { $tag_str .= ', '; } - $tag_str .= bbcode($t); + $tag_str .= BBCode::convert($t); } $tags = [L10n::t('Tags: '), $tag_str]; if ($cmd === 'edit') { @@ -1613,7 +1572,7 @@ function photos_content(App $a) $name_e = $profile_name; $title_e = $item['title']; - $body_e = bbcode($item['body']); + $body_e = BBCode::convert($item['body']); $comments .= replace_macros($template,[ '$id' => $item['item_id'],