move account and channel to zlib

This commit is contained in:
nobody 2022-01-24 17:26:12 -08:00
parent 61c698d188
commit ad52373312
168 changed files with 672 additions and 4006 deletions

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Access;
use Zotlabs\Lib as Zlib;
use Zotlabs\Lib\Channel;
/**
* @brief Extensible permissions.
@ -271,7 +272,7 @@ class Permissions
// the channel's channel_hash (the 'self' connection).
if (! $my_perms) {
$c = channelx_by_n($channel_id);
$c = Channel::from_id($channel_id);
if ($c) {
$my_perms = Permissions::FilledPerms(explode(',', get_abconfig($channel_id, $c['channel_hash'], 'system', 'my_perms', EMPTY_STR)));
}

View file

@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Channel;
class Channel_purge
{

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Channel;
require_once('include/cli_startup.php');
require_once('include/attach.php');
@ -23,7 +24,7 @@ class Content_importer
$m = parse_url($hz_server);
$channel = channelx_by_nick($channel_address);
$channel = Channel::from_username($channel_address);
if (! $channel) {
logger('itemhelper: channel not found');
killme();
@ -36,7 +37,7 @@ class Content_importer
'(request-target)' => 'get /api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page ,
];
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), true, 'sha512');
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), true, 'sha512');
$x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page, false, $redirects, [ 'headers' => $headers ]);

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Daemon;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\ASCollection;
use Zotlabs\Lib\Channel;
class Convo
{
@ -22,7 +23,7 @@ class Convo
$channel_id = intval($argv[2]);
$contact_hash = $argv[3];
$channel = channelx_by_n($channel_id);
$channel = Channel::from_id($channel_id);
if (! $channel) {
killme();
}

View file

@ -5,6 +5,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Channel;
class Cron
{

View file

@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Libzot;
@ -98,7 +99,7 @@ class Cron_daily
}
// expire any expired accounts
downgrade_accounts();
ServiceClass::downgrade_accounts();
Run::Summon([ 'Expire' ]);

View file

@ -2,6 +2,8 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Channel;
class Cron_weekly
{
@ -38,7 +40,7 @@ class Cron_weekly
);
if ($r) {
foreach ($r as $rv) {
channel_remove_final($rv['channel_id']);
Channel::channel_remove_final($rv['channel_id']);
}
}

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Daemon;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Queue;
use Zotlabs\Lib\Channel;
class Directory
{
@ -30,7 +31,7 @@ class Directory
logger('directory update', LOGGER_DEBUG);
$channel = channelx_by_n($argv[1]);
$channel = Channel::from_id($argv[1]);
if (! $channel) {
return;
}

View file

@ -2,6 +2,9 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\Channel;
class Expire
{
@ -50,7 +53,7 @@ class Expire
// service class default (if non-zero) over-rides the site default
$service_class_expire = service_class_fetch($rr['channel_id'], 'expire_days');
$service_class_expire = ServiceClass::fetch($rr['channel_id'], 'expire_days');
if (intval($service_class_expire)) {
$channel_expire = $service_class_expire;
} else {
@ -72,7 +75,7 @@ class Expire
}
}
$x = get_sys_channel();
$x = Channel::get_system();
if ($x) {
// this should probably just fetch the channel_expire_days from the sys channel,
// but there's no convenient way to set it.

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Channel;
require_once('include/cli_startup.php');
require_once('include/attach.php');
@ -22,7 +23,7 @@ class File_importer
$m = parse_url($hz_server);
$channel = channelx_by_nick($channel_address);
$channel = Channel::from_username($channel_address);
if (! $channel) {
logger('filehelper: channel not found');
killme();
@ -35,7 +36,7 @@ class File_importer
'(request-target)' => 'get /api/z/1.0/file/export?f=&zap_compat=1&file_id=' . $attach_id,
];
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), true, 'sha512');
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), true, 'sha512');
$x = z_fetch_url($hz_server . '/api/z/1.0/file/export?f=&zap_compat=1&file_id=' . $attach_id, false, $redirects, [ 'headers' => $headers ]);
if (! $x['success']) {

View file

@ -5,6 +5,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Channel;
class Importfile
{
@ -18,7 +19,7 @@ class Importfile
return;
}
$channel = channelx_by_n($argv[1]);
$channel = Channel::from_id($argv[1]);
if (! $channel) {
return;
}

View file

@ -8,6 +8,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\ActivityPub;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Channel;
require_once('include/html2plain.php');
require_once('include/conversation.php');
@ -110,7 +111,7 @@ class Notifier
self::$channel = null;
self::$private = false;
$sys = get_sys_channel();
$sys = Channel::get_system();
$top_level = false;
@ -123,7 +124,7 @@ class Notifier
return;
}
self::$channel = channelx_by_n($item_id);
self::$channel = Channel::from_id($item_id);
self::$private = true;
self::$recipients[] = $xchan;
@ -132,7 +133,7 @@ class Notifier
self::$encoding = 'zot';
$normal_mode = false;
} elseif ($cmd === 'keychange') {
self::$channel = channelx_by_n($item_id);
self::$channel = Channel::from_id($item_id);
$r = q(
"select abook_xchan from abook where abook_channel = %d",
intval($item_id)
@ -158,7 +159,7 @@ class Notifier
$recip = array_shift($r);
$uid = $recip['abook_channel'];
// Get the sender
self::$channel = channelx_by_n($uid);
self::$channel = Channel::from_id($uid);
if (self::$channel) {
$perm_update = [ 'sender' => self::$channel, 'recipient' => $recip, 'success' => false, 'deliveries' => '' ];
@ -197,7 +198,7 @@ class Notifier
} elseif ($cmd === 'refresh_all') {
logger('notifier: refresh_all: ' . $item_id);
self::$channel = channelx_by_n($item_id, true);
self::$channel = Channel::from_id($item_id, true);
$r = q(
"select abook_xchan from abook where abook_channel = %d",
intval($item_id)
@ -217,13 +218,13 @@ class Notifier
return;
}
self::$channel = channelx_by_n($item_id, true);
self::$channel = Channel::from_id($item_id, true);
self::$recipients = [ $xchan ];
self::$private = true;
self::$packet_type = 'purge';
} elseif ($cmd === 'purge_all') {
logger('notifier: purge_all: ' . $item_id);
self::$channel = channelx_by_n($item_id, true);
self::$channel = Channel::from_id($item_id, true);
self::$recipients = [];
$r = q(
@ -421,7 +422,7 @@ class Notifier
$upstream = true;
self::$packet_type = 'response';
$is_moderated = their_perms_contains($parent_item['uid'], $sendto, 'moderated');
if ($relay_to_owner && $thread_is_public && (! $is_moderated) && (! is_group($parent_item['uid']))) {
if ($relay_to_owner && $thread_is_public && (! $is_moderated) && (! Channel::is_group($parent_item['uid']))) {
if (get_pconfig($target_item['uid'], 'system', 'hyperdrive', true)) {
Run::Summon([ 'Notifier' , 'hyper', $item_id ]);
}

View file

@ -4,6 +4,8 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\ServiceClass;
class Poller
{
@ -106,7 +108,7 @@ class Poller
$c = $contact['abook_connected'];
if (intval($contact['abook_feed'])) {
$min = service_class_fetch($contact['abook_channel'], 'minimum_feedcheck_minutes');
$min = ServiceClass::fetch($contact['abook_channel'], 'minimum_feedcheck_minutes');
if (! $min) {
$min = intval(get_config('system', 'minimum_feedcheck_minutes'));
}

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Identity;
use OAuth2\Storage\Pdo;
use Zotlabs\Lib\Channel;
class OAuth2Storage extends Pdo
{
@ -51,7 +52,7 @@ class OAuth2Storage extends Pdo
public function getUser($username)
{
$x = channelx_by_n($username);
$x = Channel::from_id($username);
if (! $x) {
return false;
}
@ -64,7 +65,7 @@ class OAuth2Storage extends Pdo
$n = explode(' ', $x['channel_name']);
return( [
'webfinger' => channel_reddress($x),
'webfinger' => Channel::get_webfinger($x),
'portable_id' => $x['channel_hash'],
'email' => $a[0]['account_email'],
'username' => $x['channel_address'],

View file

@ -6,6 +6,8 @@ use App;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\Connect;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\AccessList;
use Zotlabs\Access\PermissionLimits;
use Zotlabs\Access\PermissionRoles;
@ -53,7 +55,7 @@ class Friendica
$account_id = $this->settings['account_id'];
$max_identities = account_service_class_fetch($account_id, 'total_identities');
$max_identities = ServiceClass::account_fetch($account_id, 'total_identities');
if ($max_identities !== false) {
$r = q(
@ -125,9 +127,9 @@ class Friendica
[
'hubloc_guid' => $channel['channel_guid'],
'hubloc_guid_sig' => $channel['channel_guid_sig'],
'hubloc_id_url' => channel_url($channel),
'hubloc_id_url' => Channel::url($channel),
'hubloc_hash' => $channel['channel_hash'],
'hubloc_addr' => channel_reddress($channel),
'hubloc_addr' => Channel::get_webfinger($channel),
'hubloc_primary' => 1,
'hubloc_url' => z_root(),
'hubloc_url_sig' => Libzot::sign(z_root(), $channel['channel_prvkey']),
@ -174,8 +176,8 @@ class Friendica
'xchan_photo_l' => z_root() . "/photo/profile/l/{$newuid}",
'xchan_photo_m' => z_root() . "/photo/profile/m/{$newuid}",
'xchan_photo_s' => z_root() . "/photo/profile/s/{$newuid}",
'xchan_addr' => channel_reddress($channel),
'xchan_url' => channel_url($channel),
'xchan_addr' => Channel::get_webfinger($channel),
'xchan_url' => Channel::url($channel),
'xchan_follow' => z_root() . '/follow?f=&url=%s',
'xchan_connurl' => z_root() . '/poco/' . $channel['channel_address'],
'xchan_name' => $channel['channel_name'],
@ -187,7 +189,7 @@ class Friendica
]
);
$r = profile_store_lowlevel(
$r = Channel::profile_store_lowlevel(
[
'aid' => intval($channel['channel_account_id']),
'uid' => intval($newuid),
@ -279,7 +281,7 @@ class Friendica
foreach ($accts as $acct) {
if (trim($acct)) {
$f = connect_and_sync($channel, trim($acct));
$f = Channel::connect_and_sync($channel, trim($acct));
if ($f['success']) {
$can_view_stream = their_perms_contains($channel['channel_id'], $f['abook']['abook_xchan'], 'view_stream');

View file

@ -17,6 +17,7 @@ use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Nodeinfo;
use Zotlabs\Lib\System;
use Zotlabs\Lib\Channel;
use Emoji;
require_once('include/html2bbcode.php');
@ -81,7 +82,7 @@ class Activity
return null;
}
if (!$channel) {
$channel = get_sys_channel();
$channel = Channel::get_system();
}
$parsed = parse_url($url);
@ -132,7 +133,7 @@ class Activity
if (isset($token)) {
$headers['Authorization'] = 'Bearer ' . $token;
}
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), false);
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), false);
$x = z_fetch_url($url, true, $redirects, ['headers' => $h]);
}
@ -1567,7 +1568,7 @@ class Activity
return $p['xchan_url'];
}
$c = ((array_key_exists('channel_id', $p)) ? $p : channelx_by_hash($p['xchan_hash']));
$c = ((array_key_exists('channel_id', $p)) ? $p : Channel::from_hash($p['xchan_hash']));
$ret['type'] = 'Person';
$auto_follow = false;
@ -1584,7 +1585,7 @@ class Activity
}
if ($c) {
$ret['id'] = channel_url($c);
$ret['id'] = Channel::url($c);
} else {
$ret['id'] = ((strpos($p['xchan_hash'], 'http') === 0) ? $p['xchan_hash'] : $p['xchan_url']);
}
@ -1661,7 +1662,7 @@ class Activity
$ret['alsoKnownAs'] = $locations;
}
$cp = get_cover_photo($c['channel_id'], 'array');
$cp = Channel::get_cover_photo($c['channel_id'], 'array');
if ($cp) {
$ret['image'] = [
'type' => 'Image',
@ -1740,13 +1741,13 @@ class Activity
{
$sys = get_sys_channel();
$sys = Channel::get_system();
// encode the sys channel information and over-ride with site
// information
$ret = self::encode_person($sys, true, true);
$ret['type'] = ((is_group($sys['channel_id'])) ? 'Group' : 'Service');
$ret['type'] = ((Channel::is_group($sys['channel_id'])) ? 'Group' : 'Service');
$ret['id'] = z_root();
$ret['alsoKnownAs'] = z_root() . '/channel/sys';
$auto_follow = false;
@ -1765,7 +1766,7 @@ class Activity
$ret['manuallyApprovesFollowers'] = ((get_config('system', 'allowed_sites')) ? true : false);
$cp = get_cover_photo($sys['channel_id'], 'array');
$cp = Channel::get_cover_photo($sys['channel_id'], 'array');
if ($cp) {
$ret['image'] = [
'type' => 'Image',
@ -2224,7 +2225,7 @@ class Activity
}
}
if (!(isset($icon) && $icon)) {
$icon = z_root() . '/' . get_default_profile_photo();
$icon = z_root() . '/' . Channel::get_default_profile_photo();
}
$cover_photo = false;
@ -2367,9 +2368,9 @@ class Activity
'xchan_network' => 'activitypub',
'xchan_type' => $xchan_type,
'xchan_photo_date' => datetime_convert('UTC', 'UTC', '1968-01-01'),
'xchan_photo_l' => z_root() . '/' . get_default_profile_photo(),
'xchan_photo_m' => z_root() . '/' . get_default_profile_photo(80),
'xchan_photo_s' => z_root() . '/' . get_default_profile_photo(48),
'xchan_photo_l' => z_root() . '/' . Channel::get_default_profile_photo(),
'xchan_photo_m' => z_root() . '/' . Channel::get_default_profile_photo(80),
'xchan_photo_s' => z_root() . '/' . Channel::get_default_profile_photo(48),
'xchan_photo_mimetype' => 'image/png',
'xchan_censored' => $censored
@ -2520,7 +2521,7 @@ class Activity
}
if (!$icon) {
$icon = z_root() . '/' . get_default_profile_photo(300);
$icon = z_root() . '/' . Channel::get_default_profile_photo(300);
}
// We store all ActivityPub actors we can resolve. Some of them may be able to communicate over Zot6. Find them.
@ -3487,12 +3488,12 @@ class Activity
return;
}
$is_sys_channel = is_sys_channel($channel['channel_id']);
$is_system = Channel::is_system($channel['channel_id']);
$is_child_node = false;
// Pleroma scrobbles can be really noisy and contain lots of duplicate activities. Disable them by default.
if (($act->type === 'Listen') && ($is_sys_channel || get_pconfig($channel['channel_id'], 'system', 'allow_scrobbles', false))) {
if (($act->type === 'Listen') && ($is_system || get_pconfig($channel['channel_id'], 'system', 'allow_scrobbles', false))) {
return;
}
@ -3504,7 +3505,7 @@ class Activity
// very unpleasant and imperfect way of determining a Mastodon DM
if ($act->raw_recips && array_key_exists('to', $act->raw_recips) && is_array($act->raw_recips['to']) && count($act->raw_recips['to']) === 1 && $act->raw_recips['to'][0] === channel_url($channel) && !$act->raw_recips['cc']) {
if ($act->raw_recips && array_key_exists('to', $act->raw_recips) && is_array($act->raw_recips['to']) && count($act->raw_recips['to']) === 1 && $act->raw_recips['to'][0] === Channel::url($channel) && !$act->raw_recips['cc']) {
$item['item_private'] = 2;
}
@ -3578,7 +3579,7 @@ class Activity
// reject public stream comments that weren't sent by the conversation owner
// but only on remote message deliveries to our site ($fetch_parents === true)
if ($is_sys_channel && $pubstream && $item['owner_xchan'] !== $observer_hash && !$fetch_parents) {
if ($is_system && $pubstream && $item['owner_xchan'] !== $observer_hash && !$fetch_parents) {
$allowed = false;
$reason[] = 'sender ' . $observer_hash . ' not owner ' . $item['owner_xchan'];
}
@ -3590,7 +3591,7 @@ class Activity
}
}
} else {
if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || ($is_sys_channel && $pubstream)) {
if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || ($is_system && $pubstream)) {
logger('allowed: permission allowed', LOGGER_DATA);
$allowed = true;
}
@ -3619,7 +3620,7 @@ class Activity
}
}
if ($is_sys_channel) {
if ($is_system) {
if (!check_pubstream_channelallowed($observer_hash)) {
$allowed = false;
$reason[] = 'pubstream channel blocked';
@ -4178,7 +4179,7 @@ class Activity
'id' => z_root() . '/bounces/' . new_uuid(),
'to' => [$observer_hash],
'type' => 'Reject',
'actor' => channel_url($channel),
'actor' => Channel::url($channel),
'name' => 'Permission denied',
'object' => $item['message_id']
];

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\Queue;
use Zotlabs\Lib\Libsync;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\IConfig;
use Zotlabs\Lib\Channel;
class ActivityPub
{
@ -51,10 +52,10 @@ class ActivityPub
if ($purge_all) {
$ti = [
'id' => channel_url($arr['channel']) . '?operation=delete',
'actor' => channel_url($arr['channel']),
'id' => Channel::url($arr['channel']) . '?operation=delete',
'actor' => Channel::url($arr['channel']),
'type' => 'Delete',
'object' => channel_url($arr['channel']),
'object' => Channel::url($arr['channel']),
'to' => ['https://www.w3.org/ns/activitystreams#Public']
];
@ -395,7 +396,7 @@ class ActivityPub
return;
}
$channel = channelx_by_n($recip[0]['abook_channel']);
$channel = Channel::from_id($recip[0]['abook_channel']);
if (!$channel) {
return;
}

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Channel;
/**
* Apps
@ -237,7 +238,7 @@ class Apps
}
if (!$ret['photo']) {
$ret['photo'] = $baseurl . '/' . get_default_profile_photo(80);
$ret['photo'] = $baseurl . '/' . Channel::get_default_profile_photo(80);
}
$ret['type'] = 'system';
@ -291,7 +292,7 @@ class Apps
}
break;
case 'public_profile':
if (!is_public_profile()) {
if (!Channel::is_public_profile()) {
unset($ret);
}
break;
@ -448,7 +449,7 @@ class Apps
*/
$channel_id = local_channel();
$sys_channel = is_sys_channel($channel_id);
$sys_channel = Channel::is_system($channel_id);
$installed = false;
@ -475,7 +476,7 @@ class Apps
if (strpos($papp['url'], '$baseurl') !== false || strpos($papp['url'], '$nick') !== false || strpos($papp['photo'], '$baseurl') !== false || strpos($papp['photo'], '$nick') !== false) {
$view_channel = $channel_id;
if (!$view_channel) {
$sys = get_sys_channel();
$sys = Channel::get_system();
$view_channel = $sys['channel_id'];
}
self::app_macros($view_channel, $papp);
@ -532,7 +533,7 @@ class Apps
}
break;
case 'public_profile':
if (!is_public_profile()) {
if (!Channel::is_public_profile()) {
return '';
}
break;
@ -1099,7 +1100,7 @@ class Apps
}
$baseurl = z_root();
$channel = channelx_by_n($uid);
$channel = Channel::from_id($uid);
$address = (($channel) ? $channel['channel_address'] : '');
// future expansion
@ -1119,7 +1120,7 @@ class Apps
$darray = [];
$ret = ['success' => false];
$sys = get_sys_channel();
$sys = Channel::get_system();
self::app_macros($arr['uid'], $arr);
@ -1148,7 +1149,7 @@ class Apps
$darray['app_author'] = ((x($arr, 'author')) ? $arr['author'] : get_observer_hash());
$darray['app_name'] = ((x($arr, 'name')) ? escape_tags($arr['name']) : t('Unknown'));
$darray['app_desc'] = ((x($arr, 'desc')) ? escape_tags($arr['desc']) : '');
$darray['app_photo'] = ((x($arr, 'photo')) ? $arr['photo'] : z_root() . '/' . get_default_profile_photo(80));
$darray['app_photo'] = ((x($arr, 'photo')) ? $arr['photo'] : z_root() . '/' . Channel::get_default_profile_photo(80));
$darray['app_version'] = ((x($arr, 'version')) ? escape_tags($arr['version']) : '');
$darray['app_addr'] = ((x($arr, 'addr')) ? escape_tags($arr['addr']) : '');
$darray['app_price'] = ((x($arr, 'price')) ? escape_tags($arr['price']) : '');
@ -1240,7 +1241,7 @@ class Apps
$darray['app_author'] = ((x($arr, 'author')) ? $arr['author'] : get_observer_hash());
$darray['app_name'] = ((x($arr, 'name')) ? escape_tags($arr['name']) : t('Unknown'));
$darray['app_desc'] = ((x($arr, 'desc')) ? escape_tags($arr['desc']) : '');
$darray['app_photo'] = ((x($arr, 'photo')) ? $arr['photo'] : z_root() . '/' . get_default_profile_photo(80));
$darray['app_photo'] = ((x($arr, 'photo')) ? $arr['photo'] : z_root() . '/' . Channel::get_default_profile_photo(80));
$darray['app_version'] = ((x($arr, 'version')) ? escape_tags($arr['version']) : '');
$darray['app_addr'] = ((x($arr, 'addr')) ? escape_tags($arr['addr']) : '');
$darray['app_price'] = ((x($arr, 'price')) ? escape_tags($arr['price']) : '');

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\ServiceClass;
/**
* @brief A class with chatroom related static methods.
@ -44,11 +45,11 @@ class Chatroom
intval($channel['channel_account_id'])
);
if ($r) {
$limit = service_class_fetch($channel['channel_id'], 'chatrooms');
$limit = ServiceClass::fetch($channel['channel_id'], 'chatrooms');
}
if (($r) && ($limit !== false) && ($r[0]['total'] >= $limit)) {
$ret['message'] = upgrade_message();
$ret['message'] = ServiceClass::upgrade_message();
return $ret;
}
@ -154,7 +155,7 @@ class Chatroom
return false;
}
$limit = service_class_fetch($r[0]['cr_uid'], 'chatters_inroom');
$limit = ServiceClass::fetch($r[0]['cr_uid'], 'chatters_inroom');
if ($limit !== false) {
$y = q(
"select count(*) as total from chatpresence where cp_room = %d",

View file

@ -1,10 +1,9 @@
<?php
/** @file */
namespace Zotlabs\Lib;
use App;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Access\Permissions;
use Zotlabs\Daemon\Run;
@ -66,8 +65,8 @@ class Connect
$total_channels = $r[0]['total'];
}
if (!service_class_allows($uid, 'total_channels', $total_channels)) {
$result['message'] = upgrade_message();
if (!ServiceClass::allows($uid, 'total_channels', $total_channels)) {
$result['message'] = ServiceClass::upgrade_message();
return $result;
}

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Lib\LibBlock;
use Zotlabs\Lib\System;
use Zotlabs\Lib\Channel;
/**
* @brief File with functions and a class for generating system and email notifications.
@ -677,7 +678,7 @@ class Enotify
// use $_SESSION['zid_override'] to force zid() to use
// the recipient address instead of the current observer
$_SESSION['zid_override'] = channel_reddress($recip);
$_SESSION['zid_override'] = Channel::get_webfinger($recip);
$_SESSION['zrl_override'] = z_root() . '/channel/' . $recip['channel_address'];
$textversion = zidify_links($textversion);

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Lib;
use Exception;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Channel;
require_once('library/jsonld/jsonld.php');
@ -36,7 +37,7 @@ class LDSignatures
$options = [
'type' => 'RsaSignature2017',
'nonce' => random_string(64),
'creator' => channel_url($channel),
'creator' => Channel::url($channel),
'created' => datetime_convert('UTC', 'UTC', 'now', 'Y-m-d\TH:i:s\Z')
];
@ -115,7 +116,7 @@ class LDSignatures
$data_type = 'application/activity+json';
$encoding = 'base64url';
$algorithm = 'RSA-SHA256';
$keyhash = base64url_encode(channel_url($channel));
$keyhash = base64url_encode(Channel::url($channel));
$data = str_replace(array(" ", "\t", "\r", "\n"), array("", "", "", ""), $data);
@ -131,7 +132,7 @@ class LDSignatures
'meDataType' => $data_type,
'meEncoding' => $encoding,
'meAlgorithm' => $algorithm,
'meCreator' => channel_url($channel),
'meCreator' => Channel::url($channel),
'meSignatureValue' => $signature
]);
}

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use App;
use Zotlabs\Lib\Channel;
class Libprofile
{
@ -29,7 +30,7 @@ class Libprofile
// logger('Libprofile::load: ' . $nickname . (($profile) ? ' profile: ' . $profile : ''));
$channel = channelx_by_nick($nickname);
$channel = Channel::from_username($nickname);
if (!$channel) {
logger('profile error: ' . App::$query_string, LOGGER_DEBUG);
@ -106,8 +107,8 @@ class Libprofile
if ($q) {
$extra_fields = [];
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
$profile_fields_basic = Channel::get_profile_fields_basic();
$profile_fields_advanced = Channel::get_profile_fields_advanced();
$advanced = ((feature_enabled(local_channel(), 'advanced_profiles')) ? true : false);
if ($advanced) {
@ -162,12 +163,12 @@ class Libprofile
App::$profile = $p[0];
App::$profile_uid = $p[0]['profile_uid'];
App::$page['title'] = App::$profile['channel_name'] . " - " . unpunify(channel_reddress(App::$profile));
App::$page['title'] = App::$profile['channel_name'] . " - " . unpunify(Channel::get_webfinger(App::$profile));
App::$profile['permission_to_view'] = $can_view_profile;
if ($can_view_profile) {
$online = get_online_status($nickname);
$online = Channel::get_online_status($nickname);
App::$profile['online_status'] = $online['result'];
}
@ -268,7 +269,7 @@ class Libprofile
head_set_icon($profile['thumb']);
if (is_sys_channel($profile['uid'])) {
if (Channel::is_system($profile['uid'])) {
$show_connect = false;
}
@ -307,7 +308,7 @@ class Libprofile
$connect_url = rconnect_url($profile['uid'], get_observer_hash());
$connect = (($connect_url) ? t('Connect') : '');
if ($connect_url) {
$connect_url = sprintf($connect_url, urlencode(channel_reddress($profile)));
$connect_url = sprintf($connect_url, urlencode(Channel::get_webfinger($profile)));
}
// premium channel - over-ride
@ -480,8 +481,8 @@ class Libprofile
}
if (App::$profile['fullname']) {
$profile_fields_basic = get_profile_fields_basic();
$profile_fields_advanced = get_profile_fields_advanced();
$profile_fields_basic = Channel::get_profile_fields_basic();
$profile_fields_advanced = Channel::get_profile_fields_advanced();
$advanced = ((feature_enabled(App::$profile['profile_uid'], 'advanced_profiles')) ? true : false);
if ($advanced) {

View file

@ -5,7 +5,9 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\Connect;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\DReport;
use Zotlabs\Daemon\Run;
@ -45,7 +47,7 @@ class Libsync
return;
}
$channel = channelx_by_n($uid);
$channel = Channel::from_id($uid);
if (!$channel) {
return;
}
@ -200,7 +202,7 @@ class Libsync
return;
}
$channel = channelx_by_n($uid);
$channel = Channel::from_id($uid);
if (!$channel) {
return;
}
@ -329,10 +331,10 @@ class Libsync
$channel = $r[0];
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
$DR->set_name($channel['channel_name'] . ' <' . Channel::get_webfinger($channel) . '>');
$max_friends = service_class_fetch($channel['channel_id'], 'total_channels');
$max_feeds = account_service_class_fetch($channel['channel_account_id'], 'total_feeds');
$max_friends = ServiceClass::fetch($channel['channel_id'], 'total_channels');
$max_feeds = ServiceClass::account_fetch($channel['channel_account_id'], 'total_feeds');
if ($channel['channel_hash'] != $sender && (!$linked_channel)) {
logger('Possible forgery. Sender ' . $sender . ' is not ' . $channel['channel_hash']);
@ -817,7 +819,7 @@ class Libsync
intval($channel['channel_id'])
);
if (!$x) {
profile_store_lowlevel(
Channel::profile_store_lowlevel(
[
'aid' => $channel['channel_account_id'],
'uid' => $channel['channel_id'],
@ -889,7 +891,7 @@ class Libsync
$DR = new DReport(z_root(), $d, $d, 'sync', 'channel sync delivered');
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
$DR->set_name($channel['channel_name'] . ' <' . Channel::get_webfinger($channel) . '>');
$result[] = $DR->get();
}

View file

@ -14,6 +14,7 @@ use Zotlabs\Access\PermissionLimits;
use Zotlabs\Access\PermissionRoles;
use Zotlabs\Lib\LibBlock;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\ASCollection;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Daemon\Run;
@ -127,7 +128,7 @@ class Libzot
}
if ($msg) {
$actor = channel_url($channel);
$actor = Channel::url($channel);
if ($encoding === 'activitystreams' && array_key_exists('actor', $msg) && is_string($msg['actor']) && $actor === $msg['actor']) {
$msg = JSalmon::sign($msg, $actor, $channel['channel_prvkey']);
}
@ -238,7 +239,7 @@ class Libzot
$h = HTTPSig::create_sig(
$headers,
$channel['channel_prvkey'],
channel_url($channel),
Channel::url($channel),
false,
'sha512',
(($crypto) ? ['key' => $crypto['hubloc_sitekey'], 'algorithm' => self::best_algorithm($crypto['site_crypto'])] : false)
@ -262,7 +263,7 @@ class Libzot
'(request-target)' => 'post ' . get_request_string($url)
];
$h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel),false,'sha512',
$h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],Channel::url($channel),false,'sha512',
(($crypto) ? [ 'key' => $crypto['hubloc_sitekey'], 'algorithm' => self::best_algorithm($crypto['site_crypto']) ] : false));
}
else {
@ -1611,7 +1612,7 @@ class Libzot
}
if ($include_sys) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys) {
$r[] = $sys['channel_hash'];
}
@ -1755,7 +1756,7 @@ class Libzot
$DR = new DReport(z_root(), $sender, $d, $arr['mid']);
$channel = channelx_by_hash($d);
$channel = Channel::from_hash($d);
if (!$channel) {
$DR->update('recipient not found');
@ -1763,7 +1764,7 @@ class Libzot
continue;
}
$DR->set_name($channel['channel_name'] . ' <' . channel_reddress($channel) . '>');
$DR->set_name($channel['channel_name'] . ' <' . Channel::get_webfinger($channel) . '>');
// if ($act->type === 'Tombstone') {
// $r = q("select * from item where mid in ( '%s', '%s' ) and uid = %d",
@ -3270,7 +3271,7 @@ class Libzot
$profile['region'] = $p[0]['region'];
$profile['postcode'] = $p[0]['postal_code'];
$profile['country'] = $p[0]['country_name'];
$profile['about'] = ((is_sys_channel($e['channel_id'])) ? get_config('system', 'siteinfo') : $p[0]['about']);
$profile['about'] = ((Channel::is_system($e['channel_id'])) ? get_config('system', 'siteinfo') : $p[0]['about']);
$profile['homepage'] = $p[0]['homepage'];
$profile['hometown'] = $p[0]['hometown'];
@ -3290,7 +3291,7 @@ class Libzot
}
}
$cover_photo = get_cover_photo($e['channel_id'], 'array');
$cover_photo = Channel::get_cover_photo($e['channel_id'], 'array');
// Communication details

View file

@ -6,6 +6,7 @@ use App;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Webfinger;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Channel;
require_once('include/permissions.php');
@ -246,7 +247,7 @@ class Libzotdir
$arr = ['channel_id' => $uid, 'hash' => $hash, 'profile' => $profile];
call_hooks('local_dir_update', $arr);
$address = channel_reddress($p[0]);
$address = Channel::get_webfinger($p[0]);
if (perm_is_allowed($uid, '', 'view_profile')) {
self::import_directory_profile($hash, $arr['profile'], $address, 0);
@ -264,7 +265,7 @@ class Libzotdir
}
$ud_hash = random_string() . '@' . App::get_hostname();
self::update_modtime($hash, $ud_hash, channel_reddress($p[0]), (($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
self::update_modtime($hash, $ud_hash, Channel::get_webfinger($p[0]), (($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
}

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\Channel;
class MastAPI
{
@ -34,7 +35,7 @@ class MastAPI
dbesc($channel['channel_hash'])
);
$cover_photo = get_cover_photo($channel['channel_id'], 'array');
$cover_photo = Channel::get_cover_photo($channel['channel_id'], 'array');
$item_normal = item_normal();
@ -56,7 +57,7 @@ class MastAPI
$ret['discoverable'] = ((1 - intval($channel['xchan_hidden'])) ? true : false);
$ret['created_at'] = datetime_convert('UTC', 'UTC', $a[0]['account_created'], ATOM_TIME);
$ret['note'] = bbcode($p[0]['about'], ['export' => true]);
$ret['url'] = channel_url($channel);
$ret['url'] = Channel::url($channel);
$ret['avatar'] = $channel['xchan_photo_l'];
$ret['avatar_static'] = $channel['xchan_photo_l'];
if ($cover_photo) {
@ -82,7 +83,7 @@ class MastAPI
$s = q("select count(site_url) as total from site");
$admins = q("select * from channel left join account on account_id = channel_account_id where ( account_roles & 4096 ) > 0 and account_default_channel = channel_id");
$adminsx = channelx_by_n($admins[0]['channel_id']);
$adminsx = Channel::from_id($admins[0]['channel_id']);
$ret = [];

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Lib;
use Zotlabs\Access\PermissionRoles;
use Zotlabs\Access\Permissions;
use Zotlabs\Lib\Channel;
/**
* @brief Permission Categories. Permission rules for various classes of connections.
@ -58,7 +59,7 @@ class Permcat
// if no autoperms it may be a custom role with manual perms
if (! $perms) {
$c = channelx_by_n($channel_id);
$c = Channel::from_id($channel_id);
if ($c) {
$perms = Permissions::FilledPerms(explode(',',get_abconfig($channel_id, $c['channel_hash'], 'system', 'my_perms', EMPTY_STR)));
}

View file

@ -8,6 +8,7 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Channel;
use Zotlabs\Zot6\Receiver;
use Zotlabs\Zot6\Zot6Handler;
@ -281,7 +282,7 @@ class Queue
}
if ($outq['outq_driver'] === 'asfetch') {
$channel = channelx_by_n($outq['outq_channel']);
$channel = Channel::from_id($outq['outq_channel']);
if (!$channel) {
logger('missing channel: ' . $outq['outq_channel']);
return;
@ -341,7 +342,7 @@ class Queue
}
if ($outq['outq_driver'] === 'activitypub') {
$channel = channelx_by_n($outq['outq_channel']);
$channel = Channel::from_id($outq['outq_channel']);
if (!$channel) {
logger('missing channel: ' . $outq['outq_channel']);
return;
@ -360,7 +361,7 @@ class Queue
$headers['Host'] = $m['host'];
$headers['(request-target)'] = 'post ' . get_request_string($outq['outq_posturl']);
$xhead = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel));
$xhead = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel));
if (strpos($outq['outq_posturl'], 'http') !== 0) {
logger('bad url: ' . $outq['outq_posturl']);
self::remove($outq['outq_hash']);
@ -470,7 +471,7 @@ class Queue
$channel = null;
if ($outq['outq_channel']) {
$channel = channelx_by_n($outq['outq_channel'], true);
$channel = Channel::from_id($outq['outq_channel'], true);
}
$host_crypto = null;

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Lib;
use App;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Channel;
class Share
{
@ -70,7 +71,7 @@ class Share
$owner_uid = $this->item['uid'];
$owner_aid = $this->item['aid'];
$channel = channelx_by_n($this->item['uid']);
$channel = Channel::from_id($this->item['uid']);
$observer = App::get_observer();
$can_comment = false;

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Channel;
class ZotURL
{
@ -47,7 +48,7 @@ class ZotURL
'Host' => $m['host'],
'(request-target)' => 'post ' . get_request_string($newurl)
];
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), false);
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), false);
} else {
$h = [ 'Accept: application/x-nomad+json, application/x-zot+json' ];
}

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Lib;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Channel;
class Zotfinger
{
@ -32,7 +33,7 @@ class Zotfinger
'Host' => $m['host'],
'(request-target)' => 'post ' . get_request_string($resource)
];
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), false);
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), false);
} else {
$h = ['Accept: application/x-nomad+json, application/x-zot+json'];
}

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\ThreadListener;
use Zotlabs\Lib\Channel;
use App;
class Activity extends Controller
@ -105,7 +106,7 @@ class Activity extends Controller
}
}
$channel = channelx_by_n($items[0]['uid']);
$channel = Channel::from_id($items[0]['uid']);
as_return_and_die(ZlibActivity::encode_activity($items[0], true), $channel);
}
@ -258,7 +259,7 @@ class Activity extends Controller
http_status_exit(404, 'Not found');
}
$chan = channelx_by_n($nitems[0]['uid']);
$chan = Channel::from_id($nitems[0]['uid']);
if (!$chan) {
http_status_exit(404, 'Not found');
@ -289,7 +290,7 @@ class Activity extends Controller
$ret = json_encode($x, JSON_UNESCAPED_SLASHES);
$headers['Digest'] = HTTPSig::generate_digest_header($ret);
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
$h = HTTPSig::create_sig($headers, $chan['channel_prvkey'], channel_url($chan));
$h = HTTPSig::create_sig($headers, $chan['channel_prvkey'], Channel::url($chan));
HTTPSig::set_headers($h);
echo $ret;
killme();

View file

@ -13,6 +13,7 @@ use App;
use Zotlabs\Web\Controller;
use Zotlabs\Web\SubModule;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\Channel;
/**
* @brief Admin area.

View file

@ -3,6 +3,8 @@
namespace Zotlabs\Module\Admin;
use App;
use Zotlabs\Lib\Account;
use Zotlabs\Lib\Channel;
class Accounts
{
@ -43,7 +45,7 @@ class Accounts
// account delete button was submitted
if (x($_POST, 'page_accounts_delete')) {
foreach ($users as $uid) {
account_remove($uid, true, false);
Account::remove($uid, true, false);
}
notice(sprintf(tt("%s account deleted", "%s accounts deleted", count($users)), count($users)));
}
@ -51,14 +53,14 @@ class Accounts
// registration approved button was submitted
if (x($_POST, 'page_accounts_approve')) {
foreach ($pending as $hash) {
account_allow($hash);
Account::allow($hash);
}
}
// registration deny button was submitted
if (x($_POST, 'page_accounts_deny')) {
foreach ($pending as $hash) {
account_deny($hash);
Account::deny($hash);
}
}
@ -94,7 +96,7 @@ class Accounts
switch (argv(2)) {
case 'delete':
// delete user
account_remove($uid, true, false);
Account::remove($uid, true, false);
notice(sprintf(t("Account '%s' deleted"), $account[0]['account_email']) . EOL);
break;

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Module\Admin;
use App;
use Zotlabs\Lib\Channel;
use Zotlabs\Daemon\Run;
/**
@ -48,7 +49,7 @@ class Channels
}
if (x($_POST, 'page_channels_delete')) {
foreach ($channels as $uid) {
channel_remove($uid, true);
Channel::channel_remove($uid, true);
}
notice(sprintf(tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)));
}
@ -80,7 +81,7 @@ class Channels
{
check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels', 't');
// delete channel
channel_remove($uid, true);
Channel::channel_remove($uid, true);
notice(sprintf(t("Channel '%s' deleted"), $channel[0]['channel_name']) . EOL);
}

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Access\AccessControl;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
/*
@file cover_photo.php
@ -35,7 +36,7 @@ class Cover_photo
return;
}
$channel = get_sys_channel();
$channel = Channel::get_system();
Libprofile::load($channel['channel_address']);
}
@ -53,7 +54,7 @@ class Cover_photo
return;
}
$channel = get_sys_channel();
$channel = Channel::get_system();
check_form_security_token_redirectOnErr('/admin/cover_photo', 'cover_photo');
@ -280,7 +281,7 @@ class Cover_photo
return;
}
$channel = get_sys_channel();
$channel = Channel::get_system();
$newuser = false;
@ -367,7 +368,7 @@ class Cover_photo
'$user' => $channel['channel_address'],
'$channel_id' => $channel['channel_id'],
'$info' => t('Your cover photo may be visible to anybody on the internet'),
'$existing' => get_cover_photo($channel['channel_id'], 'array', PHOTO_RES_COVER_850),
'$existing' => Channel::get_cover_photo($channel['channel_id'], 'array', PHOTO_RES_COVER_850),
'$lbl_upfile' => t('Upload File:'),
'$lbl_profiles' => t('Select a profile:'),
'$title' => t('Change Cover Photo'),

View file

@ -14,6 +14,7 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Config;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Channel;
require_once('include/photo_factory.php');
require_once('include/photos.php');
@ -36,7 +37,7 @@ class Profile_photo
return;
}
$channel = get_sys_channel();
$channel = Channel::get_system();
Libprofile::load($channel['channel_address']);
}
@ -54,7 +55,7 @@ class Profile_photo
return;
}
$channel = get_sys_channel();
$channel = Channel::get_system();
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
@ -309,7 +310,7 @@ class Profile_photo
return;
}
$channel = get_sys_channel();
$channel = Channel::get_system();
$pf = 0;
$newuser = false;

View file

@ -2,6 +2,8 @@
namespace Zotlabs\Module\Admin;
use Zotlabs\Lib\Channel;
class Profs
{
@ -123,10 +125,10 @@ class Profs
$basic = '';
$barr = [];
$fields = get_profile_fields_basic();
$fields = Channel::get_profile_fields_basic();
if (!$fields) {
$fields = get_profile_fields_basic(1);
$fields = Channel::get_profile_fields_basic(1);
}
if ($fields) {
foreach ($fields as $k => $v) {
@ -139,9 +141,9 @@ class Profs
}
$advanced = '';
$fields = get_profile_fields_advanced();
$fields = Channel::get_profile_fields_advanced();
if (!$fields) {
$fields = get_profile_fields_advanced(1);
$fields = Channel::get_profile_fields_advanced(1);
}
if ($fields) {
foreach ($fields as $k => $v) {
@ -156,7 +158,7 @@ class Profs
}
$all = '';
$fields = get_profile_fields_advanced(1);
$fields = Channel::get_profile_fields_advanced(1);
if ($fields) {
foreach ($fields as $k => $v) {
if ($all) {

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module\Admin;
use App;
use Zotlabs\Lib\System;
use Zotlabs\Access\PermissionRoles;
use Zotlabs\Lib\Channel;
class Site
{
@ -24,7 +25,7 @@ class Site
return;
}
$sys = get_sys_channel();
$sys = Channel::get_system();
check_form_security_token_redirectOnErr('/admin/site', 'admin_site');

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Channel;
require_once('include/security.php');
require_once('include/attach.php');
@ -49,7 +50,7 @@ class Album extends Controller
$channel = null;
if (argc() > 1) {
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
}
if (!$channel) {
http_status_exit(404, 'Not found.');

View file

@ -8,7 +8,7 @@ use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Yaml;
use Zotlabs\Lib\Channel;
class Ap_probe extends Controller
{
@ -30,7 +30,7 @@ class Ap_probe extends Controller
if ($_REQUEST['authf']) {
$channel = App::get_channel();
if (!$channel) {
$channel = get_sys_channel();
$channel = Channel::get_system();
}
}

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Channel;
class Appman extends Controller
{
@ -16,7 +17,7 @@ class Appman extends Controller
if (! $channel_id) {
return;
}
if (is_sys_channel($channel_id)) {
if (Channel::is_system($channel_id)) {
$channel_id = 0;
}
@ -98,7 +99,7 @@ class Appman extends Controller
return;
}
if (is_sys_channel($channel_id)) {
if (Channel::is_system($channel_id)) {
$channel_id = 0;
}

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib as Zlib;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
class Apps extends Controller
{
@ -30,7 +31,7 @@ class Apps extends Controller
Zlib\Apps::import_system_apps();
$syslist = [];
$cat = ((array_key_exists('cat', $_GET) && $_GET['cat']) ? [escape_tags($_GET['cat'])] : '');
$list = Zlib\Apps::app_list(($available || is_sys_channel(local_channel()) ? 0 : local_channel()), (($mode == 'edit') ? true : false), $cat);
$list = Zlib\Apps::app_list(($available || Channel::is_system(local_channel()) ? 0 : local_channel()), (($mode == 'edit') ? true : false), $cat);
if ($list) {
foreach ($list as $x) {
$syslist[] = Zlib\Apps::app_encode($x);

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use DBA;
use Zotlabs\Lib\Channel;
use Zotlabs\Web\Controller;
use Zotlabs\Identity\OAuth2Server;
use Zotlabs\Identity\OAuth2Storage;
@ -83,7 +84,7 @@ class Authorize extends Controller
$response = new Response();
// Note, "sub" field must match type and content. $user_id is used to populate - make sure it's a string.
$channel = channelx_by_n(local_channel());
$channel = Channel::from_id(local_channel());
$user_id = $channel['channel_id'];
$client_found = false;

View file

@ -5,8 +5,9 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
@ -18,7 +19,7 @@ class Blocks extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -55,7 +56,7 @@ class Blocks extends Controller
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;

View file

@ -6,6 +6,7 @@ use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Channel;
require_once('include/conversation.php');
require_once('include/bbcode.php');
@ -30,7 +31,7 @@ class Cal extends Controller
Libprofile::load($nick);
$channelx = channelx_by_nick($nick);
$channelx = Channel::from_username($nick);
if (!$channelx) {
return;
@ -62,7 +63,7 @@ class Cal extends Controller
$channel = null;
if (argc() > 1) {
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
}

View file

@ -6,8 +6,8 @@ use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
@ -49,7 +49,7 @@ class Card_edit extends Controller
$observer = App::get_observer();
$channel = channelx_by_n($owner);
$channel = Channel::from_id($owner);
if (!$channel) {
notice(t('Channel not found.') . EOL);
return;

View file

@ -7,8 +7,8 @@ use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
@ -89,7 +89,7 @@ class Cards extends Controller
$is_owner = ($uid && $uid == $owner);
$channel = channelx_by_n($owner);
$channel = Channel::from_id($owner);
if ($channel) {
$channel_acl = [

View file

@ -29,6 +29,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Storage\BasicAuth;
use Zotlabs\Lib\System;
use Zotlabs\Lib\Channel;
require_once('include/event.php');
require_once('include/auth.php');
@ -74,7 +75,7 @@ class Cdav extends Controller
dbesc($keyId)
);
if ($r) {
$c = channelx_by_hash($r[0]['hubloc_hash']);
$c = Channel::from_hash($r[0]['hubloc_hash']);
if ($c) {
$a = q(
"select * from account where account_id = %d limit 1",
@ -480,7 +481,7 @@ class Cdav extends Controller
$hash = $_REQUEST['sharee'];
$sharee_arr = channelx_by_hash($hash);
$sharee_arr = Channel::from_hash($hash);
$sharee = new Sharee();
@ -1191,7 +1192,7 @@ class Cdav extends Controller
killme();
}
$sharee_arr = channelx_by_hash($hash);
$sharee_arr = Channel::from_hash($hash);
$sharee = new Sharee();

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
/*
* Change channel nickname
@ -75,7 +76,7 @@ class Changeaddr extends Controller
return $ret;
}
channel_change_address($channel, $new_address);
Channel::change_address($channel, $new_address);
goaway(z_root() . '/changeaddr');
}

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Crypto;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib as Zlib;
use Zotlabs\Web\HTTPSig;
use App;
use Zotlabs\Web\Controller;
@ -67,7 +68,7 @@ class Channel extends Controller
$profile = argv(1);
}
$channel = channelx_by_nick($which, true);
$channel = Channel::from_username($which, true);
if (!$channel) {
http_status_exit(404, 'Not found');
}
@ -153,7 +154,7 @@ class Channel extends Controller
'Digest' => HTTPSig::generate_digest_header($data),
'(request-target)' => strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI']
];
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel));
$h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel));
HTTPSig::set_headers($h);
echo $data;
killme();
@ -169,7 +170,7 @@ class Channel extends Controller
App::$meta->set('og:title', $channel['channel_name']);
App::$meta->set('og:image', $channel['xchan_photo_l']);
App::$meta->set('og:type', 'webpage');
App::$meta->set('og:url:secure_url', channel_url($channel));
App::$meta->set('og:url:secure_url', Channel::url($channel));
if (App::$profile['about'] && perm_is_allowed($channel['channel_id'], get_observer_hash(), 'view_profile')) {
App::$meta->set('og:description', App::$profile['about']);
} else {
@ -241,7 +242,7 @@ class Channel extends Controller
if (!$this->updating) {
nav_set_selected('Channel Home');
$static = channel_manual_conv_update(App::$profile['profile_uid']);
$static = Zlib\Channel::manual_conv_update(App::$profile['profile_uid']);
// search terms header
if ($search) {
@ -565,7 +566,7 @@ class Channel extends Controller
}
// We reset $channel so that info can be obtained for unlogged visitors
$channel = channelx_by_n(App::$profile['profile_uid']);
$channel = Channel::from_id(App::$profile['profile_uid']);
if (isset($_REQUEST['mid']) && $_REQUEST['mid']) {
if (preg_match("/\[[zi]mg(.*?)\]([^\[]+)/is", $items[0]['body'], $matches)) {
@ -600,7 +601,7 @@ class Channel extends Controller
App::$meta->set('og:title', ($items[0]['title'] ? $items[0]['title'] : $channel['channel_name']));
App::$meta->set('og:image', ($ogimage ? $ogimage : $channel['xchan_photo_l']));
App::$meta->set('og:type', 'article');
App::$meta->set('og:url:secure_url', channel_url($channel));
App::$meta->set('og:url:secure_url', Channel::url($channel));
App::$meta->set('og:description', ($ogdesc ? $ogdesc : sprintf(t('This post was published on the home page of %s.'), $channel['channel_name'])));
}

View file

@ -4,11 +4,13 @@
namespace Zotlabs\Module;
require_once('include/security.php');
use App;
use Zotlabs\Lib as Zlib;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/security.php');
class Chatsvc extends Controller
{
@ -136,9 +138,9 @@ class Chatsvc extends Controller
$rv['xchan_url'] = z_root();
$rv['xchan_hidden'] = 1;
$rv['xchan_photo_mimetype'] = 'image/png';
$rv['xchan_photo_l'] = z_root() . '/' . get_default_profile_photo(300);
$rv['xchan_photo_m'] = z_root() . '/' . get_default_profile_photo(80);
$rv['xchan_photo_s'] = z_root() . '/' . get_default_profile_photo(48);
$rv['xchan_photo_l'] = z_root() . '/' . Channel::get_default_profile_photo(300);
$rv['xchan_photo_m'] = z_root() . '/' . Channel::get_default_profile_photo(80);
$rv['xchan_photo_s'] = z_root() . '/' . Channel::get_default_profile_photo(48);
}
switch ($rv['cp_status']) {

View file

@ -6,6 +6,7 @@ use App;
use Zotlabs\Web\Controller;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
class Connect extends Controller
{
@ -13,7 +14,7 @@ class Connect extends Controller
public function init()
{
if (argc() > 1) {
App::$data['channel'] = channelx_by_nick(argv(1));
App::$data['channel'] = Channel::from_username(argv(1));
Libprofile::load(argv(1), EMPTY_STR);
} else {
notice(t('Requested profile is not available.') . EOL);
@ -55,7 +56,7 @@ class Connect extends Controller
$observer = App::get_observer();
if (($observer) && ($_POST['submit'] === t('Continue'))) {
if ($observer['xchan_follow']) {
$url = sprintf($observer['xchan_follow'], urlencode(channel_reddress(App::$data['channel'])));
$url = sprintf($observer['xchan_follow'], urlencode(Channel::get_webfinger(App::$data['channel'])));
}
if (!$url) {
$r = q(
@ -63,7 +64,7 @@ class Connect extends Controller
dbesc($observer['xchan_hash'])
);
if ($r) {
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(channel_reddress(App::$data['channel']));
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(Channel::get_webfinger(App::$data['channel']));
}
}
}

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\ThreadListener;
use Zotlabs\Lib\Channel;
use App;
class Conversation extends Controller
@ -145,7 +146,7 @@ class Conversation extends Controller
http_status_exit(404, 'Not found');
}
$chan = channelx_by_n($nitems[0]['uid']);
$chan = Channel::from_id($nitems[0]['uid']);
if (!$chan) {
http_status_exit(404, 'Not found');
@ -164,7 +165,7 @@ class Conversation extends Controller
http_status_exit(404, 'Not found');
}
$channel = channelx_by_n($items[0]['uid']);
$channel = Channel::from_id($items[0]['uid']);
as_return_and_die($i, $channel);
}

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Access\AccessControl;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
/*
@file cover_photo.php

View file

@ -15,6 +15,7 @@ use Sabre\DAV\Auth\Plugin;
use Zotlabs\Lib\System;
use Zotlabs\Storage;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
use Zotlabs\Storage\BasicAuth;
use Zotlabs\Storage\Browser;
use Zotlabs\Web\Controller;
@ -67,7 +68,7 @@ class Dav extends Controller
dbesc($keyId)
);
if ($r) {
$c = channelx_by_hash($r[0]['hubloc_hash']);
$c = Channel::from_hash($r[0]['hubloc_hash']);
if ($c) {
$a = q(
"select * from account where account_id = %d limit 1",

View file

@ -7,6 +7,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\LibBlock;
use Zotlabs\Lib\Channel;
require_once('include/socgraph.php');
require_once('include/bbcode.php');
@ -185,7 +186,7 @@ class Directory extends Controller
$directory_admin = false;
$url = z_root() . '/dirsearch';
if (is_sys_channel(local_channel())) {
if (Channel::is_system(local_channel())) {
$directory_admin = true;
}
@ -286,7 +287,7 @@ class Directory extends Controller
$connect_link = ((local_channel()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
// Checking status is disabled ATM until someone checks the performance impact more carefully
//$online = remote_online_status($rr['address']);
//$online = Channel::remote_online_status($rr['address']);
$online = '';
if (in_array($rr['hash'], $contacts)) {

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\System;
use Zotlabs\Lib\PConfig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once("include/bbcode.php");
require_once('include/security.php');
@ -219,7 +220,7 @@ class Display extends Controller
}
if ((!$this->updating) && (!$this->loading)) {
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
$static = ((local_channel()) ? Channel::manual_conv_update(local_channel()) : 1);
// if the target item is not a post (eg a like) we want to address its thread parent
@ -284,7 +285,7 @@ class Display extends Controller
$r = null;
require_once('include/channel.php');
$sys = get_sys_channel();
$sys = Channel::get_system();
$sysid = $sys['channel_id'];
if (local_channel()) {
@ -308,7 +309,7 @@ class Display extends Controller
$r = null;
require_once('include/channel.php');
$sys = get_sys_channel();
$sys = Channel::get_system();
$sysid = $sys['channel_id'];
if (local_channel()) {

View file

@ -6,8 +6,9 @@ use App;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\MarkdownSoap;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
@ -18,7 +19,7 @@ class Editblock extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -52,7 +53,7 @@ class Editblock extends Controller
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;

View file

@ -5,8 +5,9 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
@ -17,7 +18,7 @@ class Editlayout extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -51,7 +52,7 @@ class Editlayout extends Controller
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\PermissionDescription;
require_once('include/acl_selectors.php');
@ -48,7 +49,7 @@ class Editpost extends Controller
$item = array_shift($item);
$owner_uid = intval($item['uid']);
$owner = channelx_by_n($owner_uid);
$owner = Channel::from_id($owner_uid);
if ($item['resource_type'] === 'photo' && $item['resource_id'] && $owner) {
goaway(z_root() . '/photos/' . $owner['channel_address'] . '/image/' . $item['resource_id'] . '?expandform=1');

View file

@ -7,8 +7,9 @@ use Zotlabs\Lib\MarkdownSoap;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/acl_selectors.php');
require_once('include/conversation.php');
@ -20,7 +21,7 @@ class Editwebpage extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -54,7 +55,7 @@ class Editwebpage extends Controller
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotabs\Lib\Account;
class Email_resend extends Controller
{
@ -11,7 +12,7 @@ class Email_resend extends Controller
{
if ($_POST['token']) {
if (!account_approve(trim($_POST['token']))) {
if (!Account::approve(trim($_POST['token']))) {
notice(t('Token verification failed.'));
}
}
@ -26,7 +27,7 @@ class Email_resend extends Controller
$email = hex2bin(argv(1));
if ($email) {
$result = verify_email_address(['resend' => true, 'email' => $email]);
$result = Account::verify_email_address(['resend' => true, 'email' => $email]);
}
if ($result) {

View file

@ -3,6 +3,8 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Account;
use Zotlabs\Lib\Channel;
class Email_validation extends Controller
{
@ -13,7 +15,7 @@ class Email_validation extends Controller
$success = false;
if ($_POST['token']) {
// This will redirect internally on success unless the channel is auto_created
if (account_approve(trim(basename($_POST['token'])))) {
if (Account::approve(trim(basename($_POST['token'])))) {
$success = true;
if (get_config('system', 'auto_channel_create')) {
$next_page = get_config('system', 'workflow_channel_next', 'profiles');

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/attach.php');
require_once('include/photos.php');
@ -62,7 +63,7 @@ class Embedphotos extends Controller
protected static function photolink($resource, $channel_id = 0)
{
if (intval($channel_id)) {
$channel = channelx_by_n($channel_id);
$channel = Channel::from_id($channel_id);
} else {
$channel = App::get_channel();
}
@ -128,7 +129,7 @@ class Embedphotos extends Controller
$channel_id = 0;
if (array_key_exists('channel_id', $args)) {
$channel_id = $args['channel_id'];
$channel = channelx_by_n($channel_id);
$channel = Channel::from_id($channel_id);
}
if (!$channel_id) {
@ -233,7 +234,7 @@ class Embedphotos extends Controller
public function embedphotos_album_list($channel_id)
{
$channel = channelx_by_n($channel_id);
$channel = Channel::from_id($channel_id);
$p = photos_albums_list($channel, App::get_observer());
if ($p['success']) {
return $p['albums'];

View file

@ -6,6 +6,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Channel;
use Zotlabs\Web\HTTPSig;
class Event extends Controller
@ -46,7 +47,7 @@ class Event extends Controller
xchan_query($r, true);
$items = fetch_post_tags($r, true);
$channel = channelx_by_n($items[0]['uid']);
$channel = Channel::from_id($items[0]['uid']);
if (!is_array($items[0]['obj'])) {
$obj = json_decode($items[0]['obj'], true);

View file

@ -3,13 +3,14 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
class Fedi_id extends Controller
{
public function post()
{
$channel = channelx_by_n(argv(1));
$channel = Channel::from_id(argv(1));
if (!$channel) {
return;
}
@ -23,14 +24,14 @@ class Fedi_id extends Controller
);
if ($ab) {
notice(t('You are already connected with this channel.'));
goaway(channel_url($channel));
goaway(Channel::url($channel));
}
$r = q(
"select * from xchan where xchan_hash = '%s'",
dbesc($x)
);
if ($r && $r[0]['xchan_follow']) {
goaway(sprintf($r[0]['xchan_follow'], urlencode(channel_reddress($channel))));
goaway(sprintf($r[0]['xchan_follow'], urlencode(Channel::get_webfinger($channel))));
}
}

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/feedutils.php');
@ -34,7 +35,7 @@ class Feed extends Controller
killme();
}
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
if (!$channel) {
killme();
}

View file

@ -4,9 +4,9 @@ namespace Zotlabs\Module;
use Zotlabs\Lib\Libsync;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/attach.php');
require_once('include/channel.php');
require_once('include/photos.php');
@ -19,7 +19,7 @@ class File_upload extends Controller
logger('file upload: ' . print_r($_REQUEST, true));
logger('file upload: ' . print_r($_FILES, true));
$channel = (($_REQUEST['channick']) ? channelx_by_nick($_REQUEST['channick']) : null);
$channel = (($_REQUEST['channick']) ? Channel::from_username($_REQUEST['channick']) : null);
if (!$channel) {
logger('channel not found');

View file

@ -12,6 +12,7 @@ use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libsync;
use Zotlabs\Access\AccessControl;
use Zotlabs\Lib\Channel;
class Filestorage extends Controller
{
@ -92,7 +93,7 @@ class Filestorage extends Controller
{
if (argc() > 1) {
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
}
if (!$channel) {
notice(t('Channel unavailable.') . EOL);

View file

@ -11,6 +11,7 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Connect;
use Zotlabs\Lib\Channel;
use Zotlabs\Daemon\Run;
class Follow extends Controller
@ -34,7 +35,7 @@ class Follow extends Controller
return;
}
$chan = channelx_by_n($r[0]['abook_channel']);
$chan = Channel::from_id($r[0]['abook_channel']);
if (!$chan) {
http_status_exit(404, 'Not found');

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
class Followers extends Controller
{
@ -26,7 +27,7 @@ class Followers extends Controller
http_status_exit(404, 'Not found');
}
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
if (!$channel) {
http_status_exit(404, 'Not found');
}

View file

@ -9,6 +9,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
class Following extends Controller
{
@ -26,7 +27,7 @@ class Following extends Controller
http_status_exit(404, 'Not found');
}
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
if (!$channel) {
http_status_exit(404, 'Not found');
}

View file

@ -4,6 +4,7 @@ namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Channel;
/**
* module: getfile
@ -79,7 +80,7 @@ class Getfile extends Controller
http_status_exit(403, 'Permission denied');
}
$channel = channelx_by_hash($hash);
$channel = Channel::from_hash($hash);
if (!$channel) {
logger('error: missing info');

View file

@ -10,6 +10,7 @@ use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Crypto;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/conversation.php');
@ -48,7 +49,7 @@ class Home extends Controller
}
if (Libzot::is_zot_request()) {
$channel = get_sys_channel();
$channel = Channel::get_system();
$sigdata = HTTPSig::verify(file_get_contents('php://input'), EMPTY_STR, 'zot6');
if ($sigdata && $sigdata['signer'] && $sigdata['header_valid']) {
@ -100,7 +101,7 @@ class Home extends Controller
intval($_SESSION['atoken'])
);
if ($r) {
$x = channelx_by_n($r[0]['atoken_uid']);
$x = Channel::from_id($r[0]['atoken_uid']);
if ($x) {
goaway(z_root() . '/channel/' . $x['channel_address']);
}

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Lib\Channel;
require_once("include/bbcode.php");
require_once('include/security.php');
@ -117,7 +118,7 @@ class Hq extends Controller
$simple_update .= " and item_thread_top = 0 and author_xchan = '" . protect_sprintf(get_observer_hash()) . "' ";
}
$sys = get_sys_channel();
$sys = Channel::get_system();
$sql_extra = item_permissions_sql($sys['channel_id']);
$sys_item = false;
@ -166,7 +167,7 @@ class Hq extends Controller
if (!$this->updating && !$this->loading) {
nav_set_selected('HQ');
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
$static = ((local_channel()) ? Channel::manual_conv_update(local_channel()) : 1);
if ($target_item) {
// if the target item is not a post (eg a like) we want to address its thread parent

View file

@ -20,6 +20,7 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\ThreadListener;
use Zotlabs\Lib\IConfig;
use Zotlabs\Lib\Enotify;
use Zotlabs\Lib\Channel;
use App;
require_once('include/attach.php');
@ -48,7 +49,7 @@ class Id extends Controller
$portable_id = $sigdata['portable_id'];
}
$chan = channelx_by_hash($request_portable_id);
$chan = Channel::from_hash($request_portable_id);
if ($chan) {
$channel_id = $chan['channel_id'];
@ -109,7 +110,7 @@ class Id extends Controller
$ret = json_encode($x, JSON_UNESCAPED_SLASHES);
$headers['Digest'] = HTTPSig::generate_digest_header($ret);
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
$h = HTTPSig::create_sig($headers, $chan['channel_prvkey'], channel_url($chan));
$h = HTTPSig::create_sig($headers, $chan['channel_prvkey'], Channel::url($chan));
HTTPSig::set_headers($h);
echo $ret;
killme();

View file

@ -8,9 +8,10 @@ use Zotlabs\Web\Controller;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Connect;
use Zotlabs\Lib\Channel;
use Zotlabs\Daemon\Run;
use Zotlabs\Import\Friendica;
use Zotlabs\Lib\ServiceClass;
require_once('include/import.php');
require_once('include/photo_factory.php');
@ -37,8 +38,8 @@ class Import extends Controller
return;
}
$max_friends = account_service_class_fetch($account_id, 'total_channels');
$max_feeds = account_service_class_fetch($account_id, 'total_feeds');
$max_friends = ServiceClass::account_fetch($account_id, 'total_channels');
$max_feeds = ServiceClass::account_fetch($account_id, 'total_feeds');
$data = null;
$seize = ((x($_REQUEST, 'make_primary')) ? intval($_REQUEST['make_primary']) : 0);
$import_posts = ((x($_REQUEST, 'import_posts')) ? intval($_REQUEST['import_posts']) : 0);
@ -149,7 +150,7 @@ class Import extends Controller
$relocate = ((array_key_exists('relocate', $data)) ? $data['relocate'] : null);
if (array_key_exists('channel', $data)) {
$max_identities = account_service_class_fetch($account_id, 'total_identities');
$max_identities = ServiceClass::account_fetch($account_id, 'total_identities');
if ($max_identities !== false) {
$r = q(
@ -227,7 +228,7 @@ class Import extends Controller
'xchan_photo_l' => z_root() . "/photo/profile/l/" . $channel['channel_id'],
'xchan_photo_m' => z_root() . "/photo/profile/m/" . $channel['channel_id'],
'xchan_photo_s' => z_root() . "/photo/profile/s/" . $channel['channel_id'],
'xchan_addr' => channel_reddress($channel),
'xchan_addr' => Channel::get_webfinger($channel),
'xchan_url' => z_root() . '/channel/' . $channel['channel_address'],
'xchan_connurl' => z_root() . '/poco/' . $channel['channel_address'],
'xchan_follow' => z_root() . '/follow?f=&url=%s',
@ -321,9 +322,9 @@ class Import extends Controller
[
'hubloc_guid' => $channel['channel_guid'],
'hubloc_guid_sig' => $channel['channel_guid_sig'],
'hubloc_id_url' => channel_url($channel),
'hubloc_id_url' => Channel::url($channel),
'hubloc_hash' => $channel['channel_hash'],
'hubloc_addr' => channel_reddress($channel),
'hubloc_addr' => Channel::get_webfinger($channel),
'hubloc_network' => 'nomad',
'hubloc_primary' => (($seize) ? 1 : 0),
'hubloc_url' => z_root(),
@ -540,7 +541,7 @@ class Import extends Controller
$addon = array('channel' => $channel, 'data' => $data);
call_hooks('import_channel', $addon);
$saved_notification_flags = notifications_off($channel['channel_id']);
$saved_notification_flags = Channel::notifications_off($channel['channel_id']);
if ($import_posts && array_key_exists('item', $data) && $data['item']) {
import_items($channel, $data['item'], false, $relocate);
}
@ -564,7 +565,7 @@ class Import extends Controller
'(request-target)' => 'get /api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page,
];
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), true, 'sha512');
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), true, 'sha512');
$x = z_fetch_url($hz_server . '/api/z/1.0/item/export_page?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until) . '&page=' . $page, false, $redirects, ['headers' => $headers]);
@ -599,7 +600,7 @@ class Import extends Controller
'(request-target)' => 'get /api/z/1.0/files?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until),
];
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), true, 'sha512');
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), true, 'sha512');
$x = z_fetch_url($hz_server . '/api/z/1.0/files?f=&zap_compat=1&since=' . urlencode($since) . '&until=' . urlencode($until), false, $redirects, ['headers' => $headers]);
@ -633,7 +634,7 @@ class Import extends Controller
notice(t('Files and Posts imported.') . EOL);
}
notifications_on($channel['channel_id'], $saved_notification_flags);
Channel::notifications_on($channel['channel_id'], $saved_notification_flags);
// send out refresh requests

View file

@ -12,6 +12,7 @@ use Zotlabs\Lib\Activity;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\Channel;
class Inbox extends Controller
{
@ -44,7 +45,7 @@ class Inbox extends Controller
if (argc() == 1 || argv(1) === '[public]') {
$is_public = true;
} else {
$c = channelx_by_nick(argv(1));
$c = Channel::from_username(argv(1));
if (!$c) {
http_status_exit(410, 'Gone');
}
@ -238,7 +239,7 @@ class Inbox extends Controller
if (!$sys_disabled) {
$channels[] = get_sys_channel();
$channels[] = Channel::get_system();
}
}
}

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Channel;
class Inspect extends Controller
{
@ -19,7 +20,7 @@ class Inspect extends Controller
return $output;
}
$sys = get_sys_channel();
$sys = Channel::get_system();
if (argc() > 2) {
$item_type = argv(1);

View file

@ -27,7 +27,9 @@ use Zotlabs\Web\HTTPSig;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\ThreadListener;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\IConfig;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\Enotify;
@ -141,7 +143,7 @@ class Item extends Controller
xchan_query($r, true);
$items = fetch_post_tags($r, false);
$chan = channelx_by_n($items[0]['uid']);
$chan = Channel::from_id($items[0]['uid']);
if (!$chan) {
http_status_exit(404, 'Not found');
@ -270,7 +272,7 @@ class Item extends Controller
if (!$items) {
http_status_exit(404, 'Not found');
}
$chan = channelx_by_n($items[0]['uid']);
$chan = Channel::from_id($items[0]['uid']);
if (!$chan) {
http_status_exit(404, 'Not found');
@ -300,7 +302,7 @@ class Item extends Controller
$ret = json_encode($x, JSON_UNESCAPED_SLASHES);
$headers['Digest'] = HTTPSig::generate_digest_header($ret);
$headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI'];
$h = HTTPSig::create_sig($headers, $chan['channel_prvkey'], channel_url($chan));
$h = HTTPSig::create_sig($headers, $chan['channel_prvkey'], Channel::url($chan));
HTTPSig::set_headers($h);
echo $ret;
killme();
@ -320,7 +322,7 @@ class Item extends Controller
if ($x) {
foreach ($x as $xv) {
if (intval($xv['item_wall'])) {
$c = channelx_by_n($xv['uid']);
$c = Channel::from_id($xv['uid']);
if ($c) {
goaway($c['xchan_url'] . '?mid=' . gen_link_id($xv['mid']));
}
@ -406,7 +408,7 @@ class Item extends Controller
// Comments and replies are excluded because further below we also check for sys channel ownership and
// will make a copy of the parent that you can interact with in your own stream
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && $profile_uid && ($sys['channel_id'] == $profile_uid) && is_site_admin() && !$parent) {
$uid = intval($sys['channel_id']);
$channel = $sys;
@ -556,7 +558,7 @@ class Item extends Controller
// $r may have changed. Check it again before trying to use it.
if ($r && local_channel() && (!is_sys_channel(local_channel()))) {
if ($r && local_channel() && (!Channel::is_system(local_channel()))) {
$old_id = $r[0]['id'];
$r = [copy_of_pubitem(App::get_channel(), $r[0]['mid'])];
if ($r[0]['id'] !== $old_id) {
@ -599,7 +601,7 @@ class Item extends Controller
$observer = App::get_observer();
if (!$observer) {
// perhaps we're allowing moderated comments from anonymous viewers
$observer = anon_identity_init($_REQUEST);
$observer = Channel::anon_identity_init($_REQUEST);
if ($observer) {
$moderated = true;
$remote_xchan = $remote_observer = $observer;
@ -1303,7 +1305,7 @@ class Item extends Controller
if ($obj) {
$obj['url'] = $obj['id'] = $mid;
$obj['attributedTo'] = channel_url($channel);
$obj['attributedTo'] = Channel::url($channel);
$datarray['obj'] = $obj;
$obj_type = 'Question';
if ($obj['endTime']) {
@ -1814,7 +1816,7 @@ class Item extends Controller
if ($i[0]['resource_type'] === 'photo') {
attach_delete($i[0]['uid'], $i[0]['resource_id'], true);
$ch = channelx_by_n($i[0]['uid']);
$ch = Channel::from_id($i[0]['uid']);
if ($ch && $regular_delete) {
$sync = attach_export_data($ch, $i[0]['resource_id'], true);
if ($sync) {
@ -1881,15 +1883,15 @@ class Item extends Controller
if (!$iswebpage) {
$max = engr_units_to_bytes(service_class_fetch($channel_id, 'total_items'));
if (!service_class_allows($channel_id, 'total_items', $r[0]['total'])) {
$result['message'] .= upgrade_message() . sprintf(t('You have reached your limit of %1$.0f top level posts.'), $max);
$max = engr_units_to_bytes(ServiceClass::fetch($channel_id, 'total_items'));
if (!ServiceClass::allows($channel_id, 'total_items', $r[0]['total'])) {
$result['message'] .= ServiceClass::upgrade_message() . sprintf(t('You have reached your limit of %1$.0f top level posts.'), $max);
return $result;
}
} else {
$max = engr_units_to_bytes(service_class_fetch($channel_id, 'total_pages'));
if (!service_class_allows($channel_id, 'total_pages', $r[0]['total'])) {
$result['message'] .= upgrade_message() . sprintf(t('You have reached your limit of %1$.0f webpages.'), $max);
$max = engr_units_to_bytes(ServiceClass::fetch($channel_id, 'total_pages'));
if (!ServiceClass::allows($channel_id, 'total_pages', $r[0]['total'])) {
$result['message'] .= ServiceClass::upgrade_message() . sprintf(t('You have reached your limit of %1$.0f webpages.'), $max);
return $result;
}
}

View file

@ -5,8 +5,9 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
@ -17,7 +18,7 @@ class Layouts extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -53,7 +54,7 @@ class Layouts extends Controller
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Activity;
use Zotlabs\Web\Controller;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Channel;
require_once('include/security.php');
require_once('include/bbcode.php');
@ -81,7 +82,7 @@ class Like extends Controller
// create a copy of the parent in your stream.
if ($r) {
if (local_channel() && (! is_sys_channel(local_channel()))) {
if (local_channel() && (! Channel::is_system(local_channel()))) {
$r = [ copy_of_pubitem(App::get_channel(), $r[0]['mid']) ];
}
}

View file

@ -9,6 +9,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib as Zlib;
require_once('include/security.php');
@ -397,7 +398,7 @@ class Linkinfo extends Controller
// get the channel to check permissions
$u = channelx_by_nick($nick);
$u = Channel::from_username($nick);
if ($u && $p) {
$sql_extra = permissions_sql(intval($u['channel_id']));

View file

@ -10,6 +10,7 @@ use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\LDSignatures;
class Lists extends Controller
@ -52,7 +53,7 @@ class Lists extends Controller
http_status_exit(403, 'Permission denied');
}
$channel = channelx_by_n($group['uid']);
$channel = Channel::from_id($group['uid']);
if (!$channel) {
http_status_exit(404, 'Not found');

View file

@ -7,6 +7,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\SConfig;
use Zotlabs\Lib\Channel;
class Magic extends Controller
{
@ -110,7 +111,7 @@ class Magic extends Controller
$headers['Host'] = $parsed['host'];
$headers['(request-target)'] = 'post ' . '/owa';
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel), true, 'sha512');
$headers = HTTPSig::create_sig($headers, $channel['channel_prvkey'], Channel::url($channel), true, 'sha512');
$x = z_post_url($owapath, $data, $redirects, ['headers' => $headers]);
logger('owa fetch returned: ' . print_r($x, true), LOGGER_DATA);
if ($x['success']) {

View file

@ -5,6 +5,8 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\Channel;
require_once('include/security.php');
@ -68,7 +70,7 @@ class Manage extends Controller
$account = App::get_account();
if ($r && count($r)) {
$channels = ((is_site_admin()) ? array_merge([get_sys_channel()], $r) : $r);
$channels = ((is_site_admin()) ? array_merge([Channel::get_system()], $r) : $r);
for ($x = 0; $x < count($channels); $x++) {
$channels[$x]['link'] = 'manage/' . intval($channels[$x]['channel_id']);
$channels[$x]['include_in_menu'] = intval(PConfig::get($channels[$x]['channel_id'], 'system', 'include_in_menu', 0));
@ -143,7 +145,7 @@ class Manage extends Controller
"select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0",
intval(get_account_id())
);
$limit = account_service_class_fetch(get_account_id(), 'total_identities');
$limit = ServiceClass::account_fetch(get_account_id(), 'total_identities');
if ($limit !== false) {
$channel_usage_message = sprintf(t("You have created %1$.0f of %2$.0f allowed channels."), $r[0]['total'], $limit);
} else {

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/menu.php');
@ -17,7 +18,7 @@ class Menu extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -46,7 +47,7 @@ class Menu extends Controller
$uid = App::$profile['channel_id'];
if (array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
$uid = intval($sys['channel_id']);
App::$is_sys = true;
}
@ -111,7 +112,7 @@ class Menu extends Controller
$channel = App::get_channel();
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
$uid = $owner = intval($sys['channel_id']);
$channel = $sys;
@ -121,7 +122,7 @@ class Menu extends Controller
if (!$owner) {
// Figure out who the page owner is.
$r = channelx_by_nick($which);
$r = Channel::from_username($which);
if ($r) {
$owner = intval($r['channel_id']);
}
@ -148,7 +149,7 @@ class Menu extends Controller
}
if (argc() == 2) {
$channel = (($sys) ? $sys : channelx_by_n($owner));
$channel = (($sys) ? $sys : Channel::from_id($owner));
// list menus
$x = menu_list($owner);

View file

@ -6,6 +6,7 @@ use App;
use Zotlabs\Access\AccessControl;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/menu.php');
require_once('include/acl_selectors.php');
@ -18,7 +19,7 @@ class Mitem extends Controller
{
if (argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
if ($sys && intval($sys['channel_id'])) {
App::$is_sys = true;
}
@ -57,7 +58,7 @@ class Mitem extends Controller
$uid = App::$profile['channel_id'];
if (array_key_exists('sys', $_REQUEST) && $_REQUEST['sys'] && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
$uid = intval($sys['channel_id']);
App::$is_sys = true;
}
@ -122,7 +123,7 @@ class Mitem extends Controller
$uid = local_channel();
$owner = App::$profile['channel_id'];
$channel = channelx_by_n($owner);
$channel = Channel::from_id($owner);
$observer = App::get_observer();
$which = argv(1);
@ -130,7 +131,7 @@ class Mitem extends Controller
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
if (App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
$sys = Channel::get_system();
$uid = intval($sys['channel_id']);
$channel = $sys;
$ob_hash = $sys['xchan_hash'];

View file

@ -5,6 +5,7 @@ namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Channel;
use Zotlabs\Daemon\Run;
require_once('include/conversation.php');

View file

@ -6,8 +6,9 @@ use App;
use URLify;
use Zotlabs\Access\PermissionRoles;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\ServiceClass;
use Zotlabs\Lib\Channel;
require_once('include/channel.php');
require_once('include/permissions.php');
@ -123,7 +124,7 @@ class New_channel extends Controller
return;
}
$result = create_identity($arr);
$result = Channel::create($arr);
if (!$result['success']) {
notice($result['message']);
@ -159,7 +160,7 @@ class New_channel extends Controller
$default_role = get_config('system', 'default_permissions_role', 'social');
}
$limit = account_service_class_fetch(get_account_id(), 'total_identities');
$limit = ServiceClass::account_fetch(get_account_id(), 'total_identities');
if ($r && ($limit !== false)) {
$channel_usage_message = sprintf(t("You have created %1$.0f of %2$.0f allowed channels."), $r[0]['total'], $limit);

View file

@ -3,6 +3,7 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
require_once('include/security.php');
@ -95,7 +96,7 @@ class Oep extends Controller
return;
}
$c = channelx_by_n($p[0]['uid']);
$c = Channel::from_id($p[0]['uid']);
if (!($c && $res)) {
@ -178,7 +179,7 @@ class Oep extends Controller
return $ret;
}
$channel = channelx_by_nick($nick);
$channel = Channel::from_username($nick);
if (!$channel) {
return $ret;
@ -268,7 +269,7 @@ class Oep extends Controller
return $ret;
}
$channel = channelx_by_nick($nick);
$channel = Channel::from_username($nick);
if (!$channel) {
return $ret;
@ -440,7 +441,7 @@ class Oep extends Controller
return;
}
$c = channelx_by_nick($chn);
$c = Channel::from_username($chn);
if (!$c) {
return;
@ -469,7 +470,7 @@ class Oep extends Controller
$ret['width'] = intval($width);
$ret['height'] = intval($height);
$ret['html'] = get_zcard_embed($c, get_observer_hash(), array('width' => $width, 'height' => $height));
$ret['html'] = Channel::get_zcard_embed($c, get_observer_hash(), array('width' => $width, 'height' => $height));
return $ret;
}

View file

@ -2,6 +2,7 @@
namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Channel;
class Online extends Controller
{
@ -12,6 +13,6 @@ class Online extends Controller
if (argc() != 2) {
json_return_and_die($ret);
}
json_return_and_die(get_online_status(argv(1)));
json_return_and_die(Channel::get_online_status(argv(1)));
}
}

View file

@ -11,6 +11,7 @@ use Zotlabs\Web\HTTPSig;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityPub;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\Channel;
/**
* Implements an ActivityPub outbox.
@ -24,7 +25,7 @@ class Outbox extends Controller
killme();
}
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
if (!$channel) {
killme();
}
@ -205,7 +206,7 @@ class Outbox extends Controller
killme();
}
$channel = channelx_by_nick(argv(1));
$channel = Channel::from_username(argv(1));
if (!$channel) {
killme();
}

View file

@ -6,6 +6,7 @@ use App;
use Zotlabs\Render\Comanche;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
require_once('include/conversation.php');
@ -37,7 +38,7 @@ class Page extends Controller
// perm_is_allowed is denied unconditionally when 'site blocked to unauthenticated members'.
// This bypasses that restriction for sys channel (public) content
if ((!perm_is_allowed(App::$profile['profile_uid'], $ob_hash, 'view_pages')) && (!is_sys_channel(App::$profile['profile_uid']))) {
if ((!perm_is_allowed(App::$profile['profile_uid'], $ob_hash, 'view_pages')) && (!Channel::is_system(App::$profile['profile_uid']))) {
notice(t('Permission denied.') . EOL);
return;
}

View file

@ -6,6 +6,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Activity;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Config;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\LDSignatures;
use Zotlabs\Web\HTTPSig;
@ -55,7 +56,7 @@ class Photo extends Controller
if (!$allowed) {
http_status_exit(404, 'Permission denied.');
}
$channel = channelx_by_n($r[0]['uid']);
$channel = Channel::from_id($r[0]['uid']);
$obj = json_decode($r[0]['obj'], true);
@ -84,7 +85,7 @@ class Photo extends Controller
$token = ((isset($_REQUEST['token'])) ? $_REQUEST['token'] : EMPTY_STR);
$observer_xchan = get_observer_hash();
$default = z_root() . '/' . get_default_profile_photo();
$default = z_root() . '/' . Channel::get_default_profile_photo();
if (isset($type)) {
@ -97,11 +98,11 @@ class Photo extends Controller
switch ($res) {
case 'm':
$resolution = 5;
$default = z_root() . '/' . get_default_profile_photo(80);
$default = z_root() . '/' . Channel::get_default_profile_photo(80);
break;
case 's':
$resolution = 6;
$default = z_root() . '/' . get_default_profile_photo(48);
$default = z_root() . '/' . Channel::get_default_profile_photo(48);
break;
case 'l':
default:
@ -210,7 +211,7 @@ class Photo extends Controller
$allowed = attach_can_view($r[0]['uid'], $observer_xchan, $photo, $bear);
}
$channel = channelx_by_n($r[0]['uid']);
$channel = Channel::from_id($r[0]['uid']);
// Now we'll see if we can access the photo
$e = q(
@ -246,13 +247,13 @@ class Photo extends Controller
if (isset($resolution)) {
switch ($resolution) {
case 4:
$data = fetch_image_from_url(z_root() . '/' . get_default_profile_photo(), $mimetype);
$data = fetch_image_from_url(z_root() . '/' . Channel::get_default_profile_photo(), $mimetype);
break;
case 5:
$data = fetch_image_from_url(z_root() . '/' . get_default_profile_photo(80), $mimetype);
$data = fetch_image_from_url(z_root() . '/' . Channel::get_default_profile_photo(80), $mimetype);
break;
case 6:
$data = fetch_image_from_url(z_root() . '/' . get_default_profile_photo(48), $mimetype);
$data = fetch_image_from_url(z_root() . '/' . Channel::get_default_profile_photo(48), $mimetype);
break;
default:
killme();

View file

@ -6,6 +6,7 @@ use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Lib\Channel;
use Zotlabs\Lib\PermissionDescription;
use Zotlabs\Web\Controller;
use Zotlabs\Access\AccessControl;
@ -36,7 +37,7 @@ class Photos extends Controller
Libprofile::load($nick);
$channelx = channelx_by_nick($nick);
$channelx = Channel::from_username($nick);
$profile_uid = 0;

View file

@ -7,6 +7,7 @@ use Zotlabs\Web\Controller;
use Zotlabs\Lib\Enotify;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\PConfig;
use Zotlabs\Lib\Channel;
require_once('include/bbcode.php');
@ -147,7 +148,7 @@ class Ping extends Controller
$notify_pubs = false;
}
$sys = get_sys_channel();
$sys = Channel::get_system();
$seenstr = EMPTY_STR;
@ -451,7 +452,7 @@ class Ping extends Controller
'name' => $rr['account_email'],
'addr' => $rr['account_email'],
'url' => '',
'photo' => z_root() . '/' . get_default_profile_photo(48),
'photo' => z_root() . '/' . Channel::get_default_profile_photo(48),
'when' => relative_date($rr['account_created']),
'hclass' => ('notify-unseen'),
'message' => t('requires approval')

View file

@ -7,6 +7,7 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Activity;
use Zotlabs\Web\Controller;
use Zotlabs\Daemon\Run;
use Zotlabs\Lib\Channel;
require_once('include/security.php');
require_once('include/bbcode.php');
@ -53,7 +54,7 @@ class Plike extends Controller
$allow_cid = $allow_gid = $deny_cid = $deny_gid = '';
$output = EMPTY_STR;
$sys_channel = get_sys_channel();
$sys_channel = Channel::get_system();
$sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0);
$observer = App::get_observer();
@ -144,13 +145,13 @@ class Plike extends Controller
killme();
}
$channel = channelx_by_n($owner_uid);
$channel = Channel::from_id($owner_uid);
if (! $channel) {
killme();
}
$object = json_encode(Activity::fetch_profile([ 'id' => channel_url($channel) ]));
$object = json_encode(Activity::fetch_profile([ 'id' => Channel::url($channel) ]));
// second like of the same thing is "undo" for the first like

Some files were not shown because too many files have changed in this diff Show more