aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-02-20 17:07:43 -0800
committerfriendica <info@friendica.com>2014-02-20 17:07:43 -0800
commite55170c00a74675cc9654e3485e29372867e402f (patch)
tree5af5b816f6f10da693d4b262cc94f4b420960e1f
parent5c984aab66bd4a2202ac28244ab7e276ddf923e8 (diff)
downloadvolse-hubzilla-e55170c00a74675cc9654e3485e29372867e402f.tar.gz
volse-hubzilla-e55170c00a74675cc9654e3485e29372867e402f.tar.bz2
volse-hubzilla-e55170c00a74675cc9654e3485e29372867e402f.zip
code cleanup
-rw-r--r--include/identity.php9
-rw-r--r--mod/wall_attach.php17
-rw-r--r--mod/wall_upload.php11
3 files changed, 14 insertions, 23 deletions
diff --git a/include/identity.php b/include/identity.php
index d83498a69..82fc5fbea 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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);
+
+} \ No newline at end of file
diff --git a/mod/wall_attach.php b/mod/wall_attach.php
index 6e9443f12..47c097416 100644
--- a/mod/wall_attach.php
+++ b/mod/wall_attach.php
@@ -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();
diff --git a/mod/wall_upload.php b/mod/wall_upload.php
index dd5d760b3..2939cf0d1 100644
--- a/mod/wall_upload.php
+++ b/mod/wall_upload.php
@@ -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)