From 74947d1c1cb7c669ef2a167990066b34d89b5b07 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 8 Nov 2016 18:15:57 -0800 Subject: deprecate/remove get_channel_by_nick() which is just a less generalised variant of channelx_by_nick() --- Zotlabs/Module/File_upload.php | 2 +- Zotlabs/Module/Wall_attach.php | 17 +++++++++++------ Zotlabs/Module/Wall_upload.php | 2 +- Zotlabs/Module/Wiki.php | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 19 deletions(-) (limited to 'Zotlabs') 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); -- cgit v1.2.3