X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fphotos.php;h=7b58bb645d358647814f5984e510746edc27e838;hb=a5e91175243a41c77a56e73efc3672f20a7e6d23;hp=4110e805778841af8ca284d808f0e37cf61b2f16;hpb=acb4630eed14175ef35f09e21609d6329f3f990c;p=friendica.git diff --git a/mod/photos.php b/mod/photos.php index 4110e80577..7b58bb645d 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -4,7 +4,9 @@ use Friendica\App; use Friendica\Core\System; use Friendica\Core\Config; use Friendica\Core\Worker; +use Friendica\Database\DBM; use Friendica\Network\Probe; +use Friendica\Object\Contact; require_once 'include/Photo.php'; require_once 'include/photos.php'; @@ -34,7 +36,7 @@ function photos_init(App $a) { dbesc($nick) ); - if (! dbm::is_result($user)) { + if (! DBM::is_result($user)) { return; } @@ -44,7 +46,7 @@ function photos_init(App $a) { $profile = get_profiledata_by_nick($nick, $a->profile_uid); - $account_type = account_type($profile); + $account_type = Contact::getAccountType($profile); $tpl = get_markup_template("vcard-widget.tpl"); @@ -158,7 +160,7 @@ function photos_post(App $a) { intval($contact_id), intval($page_owner_uid) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $can_post = true; $visitor = $contact_id; } @@ -176,7 +178,7 @@ function photos_post(App $a) { intval($page_owner_uid) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { notice( t('Contact information unavailable') . EOL); logger('photos_post: unable to locate contact record for page owner. uid=' . $page_owner_uid); killme(); @@ -197,7 +199,7 @@ function photos_post(App $a) { dbesc($album), intval($page_owner_uid) ); - if (!dbm::is_result($r)) { + if (!DBM::is_result($r)) { notice( t('Album not found.') . EOL); goaway($_SESSION['photo_return']); return; // NOTREACHED @@ -268,7 +270,7 @@ function photos_post(App $a) { dbesc($album) ); } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $rr) { $res[] = "'" . dbesc($rr['rid']) . "'" ; } @@ -290,7 +292,7 @@ function photos_post(App $a) { $r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d", intval($page_owner_uid) ); - if (dbm::is_result($r)) { + 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(datetime_convert()), @@ -305,7 +307,7 @@ function photos_post(App $a) { // send the notification upstream/downstream as the case may be if ($rr['visible']) { - Worker::add(PRIORITY_HIGH, "notifier", "drop", $drop_id); + Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id); } } } @@ -356,7 +358,7 @@ function photos_post(App $a) { dbesc($a->argv[2]) ); } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'", intval($page_owner_uid), dbesc($r[0]['resource-id']) @@ -365,7 +367,7 @@ function photos_post(App $a) { dbesc($r[0]['resource-id']), intval($page_owner_uid) ); - if (dbm::is_result($i)) { + if (DBM::is_result($i)) { q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", dbesc(datetime_convert()), dbesc(datetime_convert()), @@ -382,7 +384,7 @@ function photos_post(App $a) { photo_albums($page_owner_uid, true); if ($i[0]['visible']) { - Worker::add(PRIORITY_HIGH, "notifier", "drop", $drop_id); + Worker::add(PRIORITY_HIGH, "Notifier", "drop", $drop_id); } } } @@ -418,7 +420,7 @@ function photos_post(App $a) { dbesc($resource_id), intval($page_owner_uid) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $ph = new Photo($r[0]['data'], $r[0]['type']); if ($ph->is_valid()) { $rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 ); @@ -470,7 +472,7 @@ function photos_post(App $a) { dbesc($resource_id), intval($page_owner_uid) ); - if (dbm::is_result($p)) { + if (DBM::is_result($p)) { $ext = $phototypes[$p[0]['type']]; $r = q("UPDATE `photo` SET `desc` = '%s', `album` = '%s', `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s' WHERE `resource-id` = '%s' AND `uid` = %d", dbesc($desc), @@ -541,7 +543,7 @@ function photos_post(App $a) { intval($page_owner_uid) ); } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $old_tag = $r[0]['tag']; $old_inform = $r[0]['inform']; } @@ -608,7 +610,7 @@ function photos_post(App $a) { intval($page_owner_uid) ); - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { //select someone by attag or nick and the name passed in $r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1", dbesc($name), @@ -618,7 +620,7 @@ function photos_post(App $a) { } } - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $newname = $r[0]['name']; $profile = $r[0]['url']; $notify = 'cid:' . $r[0]['id']; @@ -730,7 +732,7 @@ function photos_post(App $a) { $item_id = item_store($arr); if ($item_id) { - Worker::add(PRIORITY_HIGH, "notifier", "tag", $item_id); + Worker::add(PRIORITY_HIGH, "Notifier", "tag", $item_id); } } } @@ -775,7 +777,7 @@ function photos_post(App $a) { dbesc($album), intval($page_owner_uid) ); - if ((! dbm::is_result($r)) || ($album == t('Profile Photos'))) { + if ((! DBM::is_result($r)) || ($album == t('Profile Photos'))) { $visible = 1; } else { $visible = 0; @@ -935,7 +937,7 @@ function photos_post(App $a) { photo_albums($page_owner_uid, true); if ($visible) { - Worker::add(PRIORITY_HIGH, "notifier", 'wall-new', $item_id); + Worker::add(PRIORITY_HIGH, "Notifier", 'wall-new', $item_id); } call_hooks('photo_post_end',intval($item_id)); @@ -1030,7 +1032,7 @@ function photos_content(App $a) { intval($contact_id), intval($owner_uid) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $can_post = true; $contact = $r[0]; $remote_contact = true; @@ -1058,7 +1060,7 @@ function photos_content(App $a) { intval($contact_id), intval($owner_uid) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $contact = $r[0]; $remote_contact = true; } @@ -1153,13 +1155,8 @@ function photos_content(App $a) { $tpl = get_markup_template('photos_upload.tpl'); - if ($a->theme['template_engine'] === 'internal') { - $albumselect_e = template_escape($albumselect); - $aclselect_e = (($visitor) ? '' : template_escape(populate_acl($a->user))); - } else { - $albumselect_e = $albumselect; - $aclselect_e = (($visitor) ? '' : populate_acl($a->user)); - } + $albumselect_e = $albumselect; + $aclselect_e = (($visitor) ? '' : populate_acl($a->user)); $o .= replace_macros($tpl,array( '$pagename' => t('Upload Photos'), @@ -1205,7 +1202,7 @@ function photos_content(App $a) { intval($owner_uid), dbesc($album) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $a->set_pager_total(count($r)); $a->set_pager_itemspage(20); } @@ -1234,11 +1231,7 @@ function photos_content(App $a) { if ($can_post) { $edit_tpl = get_markup_template('album_edit.tpl'); - if ($a->theme['template_engine'] === 'internal') { - $album_e = template_escape($album); - } else { - $album_e = $album; - } + $album_e = $album; $o .= replace_macros($edit_tpl,array( '$nametext' => t('New album name: '), @@ -1264,7 +1257,7 @@ function photos_content(App $a) { $photos = array(); - if (dbm::is_result($r)) + if (DBM::is_result($r)) $twist = 'rotright'; foreach ($r as $rr) { if ($twist == 'rotright') { @@ -1275,13 +1268,8 @@ function photos_content(App $a) { $ext = $phototypes[$rr['type']]; - if ($a->theme['template_engine'] === 'internal') { - $imgalt_e = template_escape($rr['filename']); - $desc_e = template_escape($rr['desc']); - } else { - $imgalt_e = $rr['filename']; - $desc_e = $rr['desc']; - } + $imgalt_e = $rr['filename']; + $desc_e = $rr['desc']; $photos[] = array( 'id' => $rr['id'], @@ -1326,13 +1314,13 @@ function photos_content(App $a) { dbesc($datum) ); - if (! dbm::is_result($ph)) { + if (! DBM::is_result($ph)) { $ph = q("SELECT `id` FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' LIMIT 1", intval($owner_uid), dbesc($datum) ); - if (dbm::is_result($ph)) { + if (DBM::is_result($ph)) { notice(t('Permission denied. Access to this item may be restricted.')); } else { notice(t('Photo not available') . EOL ); @@ -1358,7 +1346,7 @@ function photos_content(App $a) { intval($owner_uid) ); - if (dbm::is_result($prvnxt)) { + if (DBM::is_result($prvnxt)) { foreach ($prvnxt as $z => $entry) { if ($entry['resource-id'] == $ph[0]['resource-id']) { $prv = $z - 1; @@ -1449,7 +1437,7 @@ function photos_content(App $a) { $map = null; - if (dbm::is_result($linked_items)) { + if (DBM::is_result($linked_items)) { $link_item = $linked_items[0]; $r = q("SELECT COUNT(*) AS `total` @@ -1464,7 +1452,7 @@ function photos_content(App $a) { ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $a->set_pager_total($r[0]['total']); } @@ -1546,15 +1534,9 @@ function photos_content(App $a) { $public_post_link = '&public=1'; } - if ($a->theme['template_engine'] === 'internal') { - $album_e = template_escape($ph[0]['album']); - $caption_e = template_escape($ph[0]['desc']); - $aclselect_e = template_escape(populate_acl($ph[0])); - } else { - $album_e = $ph[0]['album']; - $caption_e = $ph[0]['desc']; - $aclselect_e = populate_acl($ph[0]); - } + $album_e = $ph[0]['album']; + $caption_e = $ph[0]['desc']; + $aclselect_e = populate_acl($ph[0]); $edit = replace_macros($edit_tpl, array( '$id' => $ph[0]['id'], @@ -1607,7 +1589,7 @@ function photos_content(App $a) { } $comments = ''; - if (! dbm::is_result($r)) { + if (! DBM::is_result($r)) { if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) { $comments .= replace_macros($cmnt_tpl, array( '$return_path' => '', @@ -1641,7 +1623,7 @@ function photos_content(App $a) { ); // display comments - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { foreach ($r as $item) { builtin_activity_puller($item, $conv_responses); @@ -1706,15 +1688,9 @@ function photos_content(App $a) { 'delete' => t('Delete'), ); - if ($a->theme['template_engine'] === 'internal') { - $name_e = template_escape($profile_name); - $title_e = template_escape($item['title']); - $body_e = template_escape(bbcode($item['body'])); - } else { - $name_e = $profile_name; - $title_e = $item['title']; - $body_e = bbcode($item['body']); - } + $name_e = $profile_name; + $title_e = $item['title']; + $body_e = bbcode($item['body']); $comments .= replace_macros($template,array( '$id' => $item['item_id'], @@ -1764,17 +1740,10 @@ function photos_content(App $a) { $photo_tpl = get_markup_template('photo_view.tpl'); - if ($a->theme['template_engine'] === 'internal') { - $album_e = array($album_link,template_escape($ph[0]['album'])); - $tags_e = template_escape($tags); - $like_e = template_escape($like); - $dislike_e = template_escape($dislike); - } else { - $album_e = array($album_link, $ph[0]['album']); - $tags_e = $tags; - $like_e = $like; - $dislike_e = $dislike; - } + $album_e = array($album_link, $ph[0]['album']); + $tags_e = $tags; + $like_e = $like; + $dislike_e = $dislike; $o .= replace_macros($photo_tpl, array( '$id' => $ph[0]['id'], @@ -1815,7 +1784,7 @@ function photos_content(App $a) { dbesc('Contact Photos'), dbesc( t('Contact Photos')) ); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $a->set_pager_total(count($r)); $a->set_pager_itemspage(20); } @@ -1833,7 +1802,7 @@ function photos_content(App $a) { ); $photos = array(); - if (dbm::is_result($r)) { + if (DBM::is_result($r)) { $twist = 'rotright'; foreach ($r as $rr) { //hide profile photos to others @@ -1847,13 +1816,8 @@ function photos_content(App $a) { $ext = $phototypes[$rr['type']]; - if ($a->theme['template_engine'] === 'internal') { - $alt_e = template_escape($rr['filename']); - $name_e = template_escape($rr['album']); - } else { - $alt_e = $rr['filename']; - $name_e = $rr['album']; - } + $alt_e = $rr['filename']; + $name_e = $rr['album']; $photos[] = array( 'id' => $rr['id'],