X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Feditpost.php;h=dc98e93d9199b11176d1db0235f13b80dcfcfb06;hb=4714cb746b6fb8e7bc4ae9676866c9da37af75af;hp=af8f4e317926648f6a8d9ee31a92a7c1ce0b3357;hpb=66fe4cc5d6c553a9b5f825b1213b2eb27c4a5004;p=friendica.git diff --git a/mod/editpost.php b/mod/editpost.php index af8f4e3179..dc98e93d91 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -8,10 +8,9 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\L10n; use Friendica\Core\System; +use Friendica\Model\Item; use Friendica\Database\DBM; -require_once 'include/acl_selectors.php'; - function editpost_content(App $a) { $o = ''; @@ -28,16 +27,16 @@ function editpost_content(App $a) { return; } - $itm = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1", - intval($post_id), - intval(local_user()) - ); - + $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid', + 'type', 'body', 'title', 'file']; + $itm = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]); if (! DBM::is_result($itm)) { notice(L10n::t('Item not found') . EOL); return; } + $geotag = ''; + $o .= replace_macros(get_markup_template("section_title.tpl"),[ '$title' => L10n::t('Edit post') ]); @@ -61,10 +60,11 @@ function editpost_content(App $a) { $tpl = get_markup_template("jot.tpl"); - if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) + if (strlen($itm['allow_cid']) || strlen($itm['allow_gid']) || strlen($itm['deny_cid']) || strlen($itm['deny_gid'])) { $lockstate = 'lock'; - else + } else { $lockstate = 'unlock'; + } $jotplugins = ''; $jotnets = ''; @@ -123,8 +123,8 @@ function editpost_content(App $a) { '$shortnoloc' => L10n::t('clear location'), '$wait' => L10n::t('Please wait'), '$permset' => L10n::t('Permission settings'), - '$ptyp' => $itm[0]['type'], - '$content' => undo_post_tagging($itm[0]['body']), + '$ptyp' => $itm['type'], + '$content' => undo_post_tagging($itm['body']), '$post_id' => $post_id, '$baseurl' => System::baseUrl(), '$defloc' => $a->user['default-location'], @@ -133,14 +133,14 @@ function editpost_content(App $a) { '$emailcc' => L10n::t('CC: email addresses'), '$public' => L10n::t('Public post'), '$jotnets' => $jotnets, - '$title' => htmlspecialchars($itm[0]['title']), + '$title' => htmlspecialchars($itm['title']), '$placeholdertitle' => L10n::t('Set title'), - '$category' => file_tag_file_to_list($itm[0]['file'], 'category'), + '$category' => file_tag_file_to_list($itm['file'], 'category'), '$placeholdercategory' => (Feature::isEnabled(local_user(),'categories') ? L10n::t("Categories \x28comma-separated list\x29") : ''), '$emtitle' => L10n::t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, '$acl' => '', // populate_acl((($group) ? $group_acl : $a->user)), - '$bang' => (($group) ? '!' : ''), + '$bang' => ($lockstate === 'lock' ? '!' : ''), '$profile_uid' => $_SESSION['uid'], '$preview' => L10n::t('Preview'), '$jotplugins' => $jotplugins,