minor cleanup
This commit is contained in:
parent
80c9a8b8f6
commit
ab17b2e0d6
@ -10,44 +10,38 @@ require_once('include/conversation.php');
|
|||||||
class Editpost extends \Zotlabs\Web\Controller {
|
class Editpost extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
function get() {
|
function get() {
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if(! local_channel()) {
|
if(! local_channel()) {
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$post_id = ((argc() > 1) ? intval(argv(1)) : 0);
|
$post_id = ((argc() > 1) ? intval(argv(1)) : 0);
|
||||||
|
|
||||||
if(! $post_id) {
|
if(! $post_id) {
|
||||||
notice( t('Item not found') . EOL);
|
notice( t('Item not found') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$itm = q("SELECT * FROM `item` WHERE `id` = %d AND ( owner_xchan = '%s' OR author_xchan = '%s' ) LIMIT 1",
|
$itm = q("SELECT * FROM `item` WHERE `id` = %d AND ( owner_xchan = '%s' OR author_xchan = '%s' ) LIMIT 1",
|
||||||
intval($post_id),
|
intval($post_id),
|
||||||
dbesc(get_observer_hash()),
|
dbesc(get_observer_hash()),
|
||||||
dbesc(get_observer_hash())
|
dbesc(get_observer_hash())
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! count($itm)) {
|
if(! count($itm)) {
|
||||||
notice( t('Item is not editable') . EOL);
|
notice( t('Item is not editable') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) {
|
if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) {
|
||||||
goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
|
goaway(z_root() . '/events/' . $itm[0]['resource_id'] . '?expandform=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$owner_uid = $itm[0]['uid'];
|
$owner_uid = $itm[0]['uid'];
|
||||||
|
|
||||||
|
|
||||||
$plaintext = true;
|
|
||||||
// if(feature_enabled(local_channel(),'richtext'))
|
|
||||||
// $plaintext = false;
|
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = \App::get_channel();
|
||||||
|
|
||||||
if(intval($itm[0]['item_obscured'])) {
|
if(intval($itm[0]['item_obscured'])) {
|
||||||
@ -57,10 +51,10 @@ class Editpost extends \Zotlabs\Web\Controller {
|
|||||||
if($itm[0]['body'])
|
if($itm[0]['body'])
|
||||||
$itm[0]['body'] = crypto_unencapsulate(json_decode_plus($itm[0]['body']),$key);
|
$itm[0]['body'] = crypto_unencapsulate(json_decode_plus($itm[0]['body']),$key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$category = '';
|
$category = '';
|
||||||
$catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : '');
|
$catsenabled = ((feature_enabled($owner_uid,'categories')) ? 'categories' : '');
|
||||||
|
|
||||||
if ($catsenabled){
|
if ($catsenabled){
|
||||||
$itm = fetch_post_tags($itm);
|
$itm = fetch_post_tags($itm);
|
||||||
|
|
||||||
@ -72,7 +66,7 @@ class Editpost extends \Zotlabs\Web\Controller {
|
|||||||
$category .= $cat['term'];
|
$category .= $cat['term'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($itm[0]['attach']) {
|
if($itm[0]['attach']) {
|
||||||
$j = json_decode($itm[0]['attach'],true);
|
$j = json_decode($itm[0]['attach'],true);
|
||||||
if($j) {
|
if($j) {
|
||||||
@ -106,16 +100,14 @@ class Editpost extends \Zotlabs\Web\Controller {
|
|||||||
);
|
);
|
||||||
|
|
||||||
$editor = status_editor($a, $x);
|
$editor = status_editor($a, $x);
|
||||||
|
|
||||||
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
$o .= replace_macros(get_markup_template('edpost_head.tpl'), array(
|
||||||
'$title' => t('Edit post'),
|
'$title' => t('Edit post'),
|
||||||
'$editor' => $editor
|
'$editor' => $editor
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user