aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/File_upload.php2
-rw-r--r--Zotlabs/Module/Wall_attach.php17
-rw-r--r--Zotlabs/Module/Wall_upload.php2
-rw-r--r--Zotlabs/Module/Wiki.php22
-rw-r--r--include/channel.php9
-rw-r--r--include/widgets.php2
6 files changed, 26 insertions, 28 deletions
diff --git a/Zotlabs/Module/File_upload.php b/Zotlabs/Module/File_upload.php
index d5c0c7e05..769134808 100644
--- a/Zotlabs/Module/File_upload.php
+++ b/Zotlabs/Module/File_upload.php
@@ -12,7 +12,7 @@ class File_upload extends \Zotlabs\Web\Controller {
// logger('file upload: ' . print_r($_REQUEST,true));
- $channel = (($_REQUEST['channick']) ? get_channel_by_nick($_REQUEST['channick']) : null);
+ $channel = (($_REQUEST['channick']) ? channelx_by_nick($_REQUEST['channick']) : null);
if(! $channel) {
logger('channel not found');
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 9a1019ddb..9268fbb0a 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -14,13 +14,18 @@ class Wall_attach extends \Zotlabs\Web\Controller {
if(\App::$data['api_info'] && array_key_exists('media',$_FILES)) {
$using_api = true;
- $user_info = \App::$data['api_info'];
- $nick = $user_info['screen_name'];
- $channel = get_channel_by_nick($user_info['screen_name']);
}
- elseif(argc() > 1)
- $channel = get_channel_by_nick(argv(1));
-
+
+ if($using_api) {
+ require_once('include/api.php');
+ if(api_user())
+ $channel = channelx_by_n(api_user());
+ }
+ else {
+ if(argc() > 1)
+ $channel = channelx_by_nick(argv(1));
+ }
+
if(! $channel)
killme();
diff --git a/Zotlabs/Module/Wall_upload.php b/Zotlabs/Module/Wall_upload.php
index 46ebe13b1..6d58e4032 100644
--- a/Zotlabs/Module/Wall_upload.php
+++ b/Zotlabs/Module/Wall_upload.php
@@ -22,7 +22,7 @@ class Wall_upload extends \Zotlabs\Web\Controller {
}
else {
if(argc() > 1)
- $channel = get_channel_by_nick(argv(1));
+ $channel = channelx_by_nick(argv(1));
}
if(! $channel) {
diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php
index 8cf106b33..aaa1f1e3d 100644
--- a/Zotlabs/Module/Wiki.php
+++ b/Zotlabs/Module/Wiki.php
@@ -54,7 +54,7 @@ class Wiki extends \Zotlabs\Web\Controller {
// init() should have forced the URL to redirect to /wiki/channel so assume argc() > 1
$nick = argv(1);
- $channel = get_channel_by_nick($nick); // The channel who owns the wikis being viewed
+ $channel = channelx_by_nick($nick); // The channel who owns the wikis being viewed
if(! $channel) {
notice('Invalid channel' . EOL);
goaway('/' . argv(0));
@@ -271,7 +271,7 @@ class Wiki extends \Zotlabs\Web\Controller {
// /wiki/channel/create/wiki
if ((argc() > 3) && (argv(2) === 'create') && (argv(3) === 'wiki')) {
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
// Determine if observer has permission to create wiki
$observer_hash = get_observer_hash();
// Only the channel owner can create a wiki, at least until we create a
@@ -309,7 +309,7 @@ class Wiki extends \Zotlabs\Web\Controller {
// Delete a wiki
if ((argc() > 3) && (argv(2) === 'delete') && (argv(3) === 'wiki')) {
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
// Only the channel owner can delete a wiki, at least until we create a
// more detail permissions framework
if (local_channel() !== intval($channel['channel_id'])) {
@@ -332,7 +332,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$nick = argv(1);
$resource_id = $_POST['resource_id'];
// Determine if observer has permission to create a page
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
$perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
@@ -357,7 +357,7 @@ class Wiki extends \Zotlabs\Web\Controller {
// Fetch page list for a wiki
if ((argc() === 5) && (argv(2) === 'get') && (argv(3) === 'page') && (argv(4) === 'list')) {
$resource_id = $_POST['resource_id']; // resource_id for wiki in db
- $channel = get_channel_by_nick(argv(1));
+ $channel = channelx_by_nick(argv(1));
$observer_hash = get_observer_hash();
if (local_channel() !== intval($channel['channel_id'])) {
$perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
@@ -385,7 +385,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$commitMsg = 'Updated ' . $pageHtmlName;
}
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
// Determine if observer has permission to save content
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
@@ -423,7 +423,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$pageUrlName = $_POST['name'];
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
// Determine if observer has permission to read content
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
@@ -449,7 +449,7 @@ class Wiki extends \Zotlabs\Web\Controller {
}
// Determine if observer has permission to delete pages
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
$perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
@@ -484,7 +484,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$commitHash = $_POST['commitHash'];
// Determine if observer has permission to revert pages
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
$perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
@@ -509,7 +509,7 @@ class Wiki extends \Zotlabs\Web\Controller {
$currentCommit = $_POST['currentCommit'];
// Determine if observer has permission to revert pages
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
$perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
@@ -540,7 +540,7 @@ class Wiki extends \Zotlabs\Web\Controller {
}
// Determine if observer has permission to rename pages
$nick = argv(1);
- $channel = get_channel_by_nick($nick);
+ $channel = channelx_by_nick($nick);
if (local_channel() !== intval($channel['channel_id'])) {
$observer_hash = get_observer_hash();
$perms = wiki_get_permissions($resource_id, intval($channel['channel_id']), $observer_hash);
diff --git a/include/channel.php b/include/channel.php
index 1f12e9927..c02d5266e 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -1532,19 +1532,12 @@ function remote_online_status($webbie) {
}
-function get_channel_by_nick($nick) {
- $r = q("select * from channel where channel_address = '%s' limit 1",
- dbesc($nick)
- );
- return(($r) ? $r[0] : false);
-
-}
-
/**
* @brief
*
* @return string
*/
+
function identity_selector() {
if (local_channel()) {
$r = q("select channel.*, xchan.* from channel left join xchan on channel.channel_hash = xchan.xchan_hash where channel.channel_account_id = %d and channel_removed = 0 order by channel_name ",
diff --git a/include/widgets.php b/include/widgets.php
index 6cff4e4b7..ff97b8bd5 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -905,7 +905,7 @@ function widget_wiki_list($arr) {
// This should not occur because /wiki should redirect to /wiki/channel ...
$channel = \App::get_channel();
} else {
- $channel = get_channel_by_nick(argv(1)); // Channel being viewed by observer
+ $channel = channelx_by_nick(argv(1)); // Channel being viewed by observer
}
if (!$channel) {
return '';