]> git.mxchange.org Git - friendica.git/blobdiff - mod/editpost.php
Functionality is now split
[friendica.git] / mod / editpost.php
index 04caaf0a20fe2a0fa15ed192a4c03c951a7fb555..d6493b3c0c1a8aa34f4d9c547ca1688fe3ca8759 100644 (file)
@@ -9,10 +9,10 @@ use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Core\System;
 use Friendica\Model\Item;
-use Friendica\Database\DBM;
-
-function editpost_content(App $a) {
+use Friendica\Database\DBA;
 
+function editpost_content(App $a)
+{
        $o = '';
 
        if (!local_user()) {
@@ -21,16 +21,24 @@ function editpost_content(App $a) {
        }
 
        $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
+       $return_url = (($a->argc > 2) ? base64_decode($a->argv[2]) : '');
 
        if (!$post_id) {
                notice(L10n::t('Item not found') . EOL);
                return;
        }
 
+       // Fallback to SESSION return_path
+       if (empty($return_url)) {
+               $return_url = $_SESSION['return_url'];
+       }
+
        $fields = ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid',
-               'type', 'body', 'title', 'file'];
+               'type', 'body', 'title', 'file', 'wall', 'post-type'];
+
        $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $post_id, 'uid' => local_user()]);
-       if (!DBM::is_result($item)) {
+
+       if (!DBA::isResult($item)) {
                notice(L10n::t('Item not found') . EOL);
                return;
        }
@@ -49,15 +57,6 @@ function editpost_content(App $a) {
                '$nickname' => $a->user['nickname']
        ]);
 
-       $tpl = get_markup_template('jot-end.tpl');
-       $a->page['end'] .= replace_macros($tpl, [
-               '$baseurl' => System::baseUrl(),
-               '$ispublic' => '&nbsp;', // L10n::t('Visible to <strong>everybody</strong>'),
-               '$geotag' => $geotag,
-               '$nickname' => $a->user['nickname']
-       ]);
-
-
        $tpl = get_markup_template("jot.tpl");
 
        if (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])) {
@@ -69,7 +68,7 @@ function editpost_content(App $a) {
        $jotplugins = '';
        $jotnets = '';
 
-       $mail_disabled = ((function_exists('imap_open') && !Config::get('system','imap_disabled')) ? 0 : 1);
+       $mail_disabled = ((function_exists('imap_open') && !Config::get('system', 'imap_disabled')) ? 0 : 1);
 
        $mail_enabled = false;
        $pubmail_enabled = false;
@@ -78,8 +77,10 @@ function editpost_content(App $a) {
                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
                        intval(local_user())
                );
-               if (DBM::is_result($r)) {
+
+               if (DBA::isResult($r)) {
                        $mail_enabled = true;
+
                        if (intval($r[0]['pubmail'])) {
                                $pubmail_enabled = true;
                        }
@@ -91,7 +92,7 @@ function editpost_content(App $a) {
 
        $o .= replace_macros($tpl, [
                '$is_edit' => true,
-               '$return_path' => $_SESSION['return_url'],
+               '$return_path' => $return_url,
                '$action' => 'item',
                '$share' => L10n::t('Save'),
                '$upload' => L10n::t('Upload photo'),
@@ -110,7 +111,8 @@ function editpost_content(App $a) {
                '$shortnoloc' => L10n::t('clear location'),
                '$wait' => L10n::t('Please wait'),
                '$permset' => L10n::t('Permission settings'),
-               '$ptyp' => $item['type'],
+               '$wall' => $item['wall'],
+               '$posttype' => $item['post-type'],
                '$content' => undo_post_tagging($item['body']),
                '$post_id' => $post_id,
                '$baseurl' => System::baseUrl(),