code cleanup

This commit is contained in:
friendica 2014-02-20 17:07:43 -08:00
parent 5c984aab66
commit e55170c00a
3 changed files with 14 additions and 23 deletions

View File

@ -1206,3 +1206,12 @@ function remote_online_status($webbie) {
return $result;
}
function get_channel_by_nick($nick) {
$r = q("select * from channel where channel_address = '%s' limit 1",
dbesc($nick)
);
return(($r) ? $r[0] : false);
}

View File

@ -1,23 +1,12 @@
<?php
require_once('include/attach.php');
require_once('include/datetime.php');
require_once('include/identity.php');
function wall_attach_post(&$a) {
// Figure out who owns the page and if they allow attachments
if(argc() > 1) {
$nick = argv(1);
$r = q("SELECT channel.* from channel where channel_address = '%s' limit 1",
dbesc($nick)
);
if(! $r)
killme();
$channel = $r[0];
}
if(argc() > 1)
$channel = get_channel_by_nick(argv(1));
else
killme();

View File

@ -1,6 +1,7 @@
<?php
require_once('include/photo/photo_driver.php');
require_once('include/identity.php');
require_once('include/photos.php');
@ -19,15 +20,7 @@ function wall_upload_post(&$a) {
$nick = argv(1);
}
$channel = null;
if($nick) {
$r = q("SELECT channel.* from channel where channel_address = '%s' limit 1",
dbesc($nick)
);
if($r)
$channel = $r[0];
}
$channel = (($nick) ? get_channel_by_nick($nick) : false);
if(! $channel) {
if($using_api)