remove zot includes

This commit is contained in:
Mario
2021-05-27 09:45:39 +00:00
parent c9d4802bf1
commit 7776283a47
13 changed files with 84 additions and 100 deletions

View File

@@ -1,41 +1,38 @@
<?php <?php
namespace Zotlabs\Module; namespace Zotlabs\Module;
require_once('include/zot.php');
class Authtest extends \Zotlabs\Web\Controller { class Authtest extends \Zotlabs\Web\Controller {
function get() { function get() {
$auth_success = false; $auth_success = false;
$o .= '<h3>Magic-Auth Diagnostic</h3>'; $o .= '<h3>Magic-Auth Diagnostic</h3>';
if(! local_channel()) { if(! local_channel()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return $o; return $o;
} }
$o .= '<form action="authtest" method="get">'; $o .= '<form action="authtest" method="get">';
$o .= 'Target URL: <input type="text" style="width: 250px;" name="dest" value="' . $_GET['dest'] .'" />'; $o .= 'Target URL: <input type="text" style="width: 250px;" name="dest" value="' . $_GET['dest'] .'" />';
$o .= '<input type="submit" name="submit" value="Submit" /></form>'; $o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br /><br />'; $o .= '<br /><br />';
if(x($_GET,'dest')) { if(x($_GET,'dest')) {
if(strpos($_GET['dest'],'@')) { if(strpos($_GET['dest'],'@')) {
$_GET['dest'] = $_REQUEST['dest'] = 'https://' . substr($_GET['dest'],strpos($_GET['dest'],'@')+1) . '/channel/' . substr($_GET['dest'],0,strpos($_GET['dest'],'@')); $_GET['dest'] = $_REQUEST['dest'] = 'https://' . substr($_GET['dest'],strpos($_GET['dest'],'@')+1) . '/channel/' . substr($_GET['dest'],0,strpos($_GET['dest'],'@'));
} }
$_REQUEST['test'] = 1; $_REQUEST['test'] = 1;
$mod = new Magic(); $mod = new Magic();
$x = $mod->init($a); $x = $mod->init($a);
$o .= 'Local Setup returns: ' . print_r($x,true); $o .= 'Local Setup returns: ' . print_r($x,true);
if($x['url']) { if($x['url']) {
$z = z_fetch_url($x['url'] . '&test=1'); $z = z_fetch_url($x['url'] . '&test=1');
if($z['success']) { if($z['success']) {
@@ -50,12 +47,12 @@ class Authtest extends \Zotlabs\Web\Controller {
$o .= 'fetch url failure.' . print_r($z,true); $o .= 'fetch url failure.' . print_r($z,true);
} }
} }
if(! $auth_success) if(! $auth_success)
$o .= 'Authentication Failed!' . EOL; $o .= 'Authentication Failed!' . EOL;
} }
return str_replace("\n",'<br />',$o); return str_replace("\n",'<br />',$o);
} }
} }

View File

@@ -3,7 +3,6 @@ namespace Zotlabs\Module;
use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Libzot;
require_once('include/zot.php');
require_once('include/crypto.php'); require_once('include/crypto.php');
/* fix missing or damaged hublocs */ /* fix missing or damaged hublocs */

View File

@@ -2,7 +2,6 @@
namespace Zotlabs\Module; namespace Zotlabs\Module;
require_once('include/zot.php');
require_once('include/channel.php'); require_once('include/channel.php');
require_once('include/import.php'); require_once('include/import.php');
require_once('include/perm_upgrade.php'); require_once('include/perm_upgrade.php');

View File

@@ -38,7 +38,6 @@ class Notes extends Controller {
// push updates to channel clones // push updates to channel clones
if((argc() > 1) && (argv(1) === 'sync')) { if((argc() > 1) && (argv(1) === 'sync')) {
require_once('include/zot.php');
Libsync::build_sync_packet(); Libsync::build_sync_packet();
} }

View File

@@ -600,7 +600,6 @@ class Profiles extends \Zotlabs\Web\Controller {
intval(local_channel()) intval(local_channel())
); );
if($r) { if($r) {
require_once('include/zot.php');
Libsync::build_sync_packet(local_channel(),array('profile' => $r)); Libsync::build_sync_packet(local_channel(),array('profile' => $r));
} }

View File

@@ -6,12 +6,11 @@ require_once('include/crypto.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/taxonomy.php'); require_once('include/taxonomy.php');
require_once('include/conversation.php'); require_once('include/conversation.php');
require_once('include/zot.php');
require_once('include/bookmarks.php'); require_once('include/bookmarks.php');
/** /**
* remote bookmark * remote bookmark
* *
* https://yoursite/rbmark?f=&title=&url=&private=&remote_return= * https://yoursite/rbmark?f=&title=&url=&private=&remote_return=
* *
* This can be called via either GET or POST, use POST for long body content as suhosin often limits GET parameter length * This can be called via either GET or POST, use POST for long body content as suhosin often limits GET parameter length
@@ -31,45 +30,45 @@ class Rbmark extends \Zotlabs\Web\Controller {
function post() { function post() {
if($_POST['submit'] !== t('Save')) if($_POST['submit'] !== t('Save'))
return; return;
logger('rbmark_post: ' . print_r($_REQUEST,true)); logger('rbmark_post: ' . print_r($_REQUEST,true));
$channel = \App::get_channel(); $channel = \App::get_channel();
$t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title'])); $t = array('url' => escape_tags($_REQUEST['url']),'term' => escape_tags($_REQUEST['title']));
bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0), bookmark_add($channel,$channel,$t,((x($_REQUEST,'private')) ? intval($_REQUEST['private']) : 0),
array('menu_id' => ((x($_REQUEST,'menu_id')) ? intval($_REQUEST['menu_id']) : 0), array('menu_id' => ((x($_REQUEST,'menu_id')) ? intval($_REQUEST['menu_id']) : 0),
'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : ''), 'menu_name' => ((x($_REQUEST,'menu_name')) ? escape_tags($_REQUEST['menu_name']) : ''),
'ischat' => ((x($_REQUEST['ischat'])) ? intval($_REQUEST['ischat']) : 0) 'ischat' => ((x($_REQUEST['ischat'])) ? intval($_REQUEST['ischat']) : 0)
)); ));
goaway(z_root() . '/bookmarks'); goaway(z_root() . '/bookmarks');
} }
function get() { function get() {
$o = ''; $o = '';
if(! local_channel()) { if(! local_channel()) {
// The login procedure is going to bugger our $_REQUEST variables // The login procedure is going to bugger our $_REQUEST variables
// so save them in the session. // so save them in the session.
if(array_key_exists('url',$_REQUEST)) { if(array_key_exists('url',$_REQUEST)) {
$_SESSION['bookmark'] = $_REQUEST; $_SESSION['bookmark'] = $_REQUEST;
} }
return login(); return login();
} }
// If we have saved rbmark session variables, but nothing in the current $_REQUEST, recover the saved variables // If we have saved rbmark session variables, but nothing in the current $_REQUEST, recover the saved variables
if((! array_key_exists('url',$_REQUEST)) && (array_key_exists('bookmark',$_SESSION))) { if((! array_key_exists('url',$_REQUEST)) && (array_key_exists('bookmark',$_SESSION))) {
$_REQUEST = $_SESSION['bookmark']; $_REQUEST = $_SESSION['bookmark'];
unset($_SESSION['bookmark']); unset($_SESSION['bookmark']);
} }
if($_REQUEST['remote_return']) { if($_REQUEST['remote_return']) {
$_SESSION['remote_return'] = $_REQUEST['remote_return']; $_SESSION['remote_return'] = $_REQUEST['remote_return'];
} }
@@ -78,12 +77,12 @@ class Rbmark extends \Zotlabs\Web\Controller {
goaway($_SESSION['remote_return']); goaway($_SESSION['remote_return']);
goaway(z_root() . '/bookmarks'); goaway(z_root() . '/bookmarks');
} }
$channel = \App::get_channel(); $channel = \App::get_channel();
$m = menu_list($channel['channel_id'],'',MENU_BOOKMARK); $m = menu_list($channel['channel_id'],'',MENU_BOOKMARK);
$menus = array(); $menus = array();
if($m) { if($m) {
$menus = array(0 => ''); $menus = array(0 => '');
@@ -92,10 +91,10 @@ class Rbmark extends \Zotlabs\Web\Controller {
} }
} }
$menu_select = array('menu_id',t('Select a bookmark folder'),false,'',$menus); $menu_select = array('menu_id',t('Select a bookmark folder'),false,'',$menus);
$o .= replace_macros(get_markup_template('rbmark.tpl'), array( $o .= replace_macros(get_markup_template('rbmark.tpl'), array(
'$header' => t('Save Bookmark'), '$header' => t('Save Bookmark'),
'$url' => array('url',t('URL of bookmark'),escape_tags($_REQUEST['url'])), '$url' => array('url',t('URL of bookmark'),escape_tags($_REQUEST['url'])),
'$title' => array('title',t('Description'),escape_tags($_REQUEST['title'])), '$title' => array('title',t('Description'),escape_tags($_REQUEST['title'])),
@@ -104,18 +103,18 @@ class Rbmark extends \Zotlabs\Web\Controller {
'$submit' => t('Save'), '$submit' => t('Save'),
'$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''), '$menu_name' => array('menu_name',t('Or enter new bookmark folder name'),'',''),
'$menus' => $menu_select '$menus' => $menu_select
)); ));
return $o; return $o;
} }
} }

View File

@@ -8,7 +8,6 @@ require_once('include/crypto.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/taxonomy.php'); require_once('include/taxonomy.php');
require_once('include/conversation.php'); require_once('include/conversation.php');
require_once('include/zot.php');
/** /**
* remote post * remote post

View File

@@ -1,7 +1,6 @@
<?php <?php
namespace Zotlabs\Module; /** @file */ namespace Zotlabs\Module; /** @file */
require_once('include/zot.php');
require_once('include/security.php'); require_once('include/security.php');
class Settings extends \Zotlabs\Web\Controller { class Settings extends \Zotlabs\Web\Controller {
@@ -11,68 +10,68 @@ class Settings extends \Zotlabs\Web\Controller {
function init() { function init() {
if(! local_channel()) if(! local_channel())
return; return;
if($_SESSION['delegate']) if($_SESSION['delegate'])
return; return;
\App::$profile_uid = local_channel(); \App::$profile_uid = local_channel();
// default is channel settings in the absence of other arguments // default is channel settings in the absence of other arguments
if(argc() == 1) { if(argc() == 1) {
// We are setting these values - don't use the argc(), argv() functions here // We are setting these values - don't use the argc(), argv() functions here
\App::$argc = 2; \App::$argc = 2;
\App::$argv[] = 'channel'; \App::$argv[] = 'channel';
} }
$this->sm = new \Zotlabs\Web\SubModule(); $this->sm = new \Zotlabs\Web\SubModule();
} }
function post() { function post() {
if(! local_channel()) if(! local_channel())
return; return;
if($_SESSION['delegate']) if($_SESSION['delegate'])
return; return;
// logger('mod_settings: ' . print_r($_REQUEST,true)); // logger('mod_settings: ' . print_r($_REQUEST,true));
if(argc() > 1) { if(argc() > 1) {
if($this->sm->call('post') !== false) { if($this->sm->call('post') !== false) {
return; return;
} }
} }
goaway(z_root() . '/settings' ); goaway(z_root() . '/settings' );
return; // NOTREACHED return; // NOTREACHED
} }
function get() { function get() {
nav_set_selected('Settings'); nav_set_selected('Settings');
if((! local_channel()) || ($_SESSION['delegate'])) { if((! local_channel()) || ($_SESSION['delegate'])) {
notice( t('Permission denied.') . EOL ); notice( t('Permission denied.') . EOL );
return login(); return login();
} }
$channel = \App::get_channel(); $channel = \App::get_channel();
if($channel) if($channel)
head_set_icon($channel['xchan_photo_s']); head_set_icon($channel['xchan_photo_s']);
$o = $this->sm->call('get'); $o = $this->sm->call('get');
if($o !== false) if($o !== false)
return $o; return $o;
$o = ''; $o = '';
} }
} }

View File

@@ -1,8 +1,6 @@
<?php <?php
namespace Zotlabs\Module; namespace Zotlabs\Module;
require_once('include/zot.php');
use Zotlabs\Lib\Keyutils; use Zotlabs\Lib\Keyutils;
use Zotlabs\Lib\Libzot; use Zotlabs\Lib\Libzot;
@@ -21,7 +19,7 @@ class Wfinger extends \Zotlabs\Web\Controller {
elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) elseif(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443))
$scheme = 'https'; $scheme = 'https';
elseif(x($_SERVER,'HTTP_X_FORWARDED_PROTO') && ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) elseif(x($_SERVER,'HTTP_X_FORWARDED_PROTO') && ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
$scheme = 'https'; $scheme = 'https';
$zot = intval($_REQUEST['zot']); $zot = intval($_REQUEST['zot']);
@@ -69,7 +67,7 @@ class Wfinger extends \Zotlabs\Web\Controller {
$channel = substr($channel,1); $channel = substr($channel,1);
$channel = substr($channel,0,-1); $channel = substr($channel,0,-1);
$pchan = true; $pchan = true;
$r = q("select * from pchan left join xchan on pchan_hash = xchan_hash $r = q("select * from pchan left join xchan on pchan_hash = xchan_hash
where pchan_guid = '%s' limit 1", where pchan_guid = '%s' limit 1",
dbesc($channel) dbesc($channel)
); );
@@ -78,7 +76,7 @@ class Wfinger extends \Zotlabs\Web\Controller {
} }
} }
else { else {
$r = q("select * from channel left join xchan on channel_hash = xchan_hash $r = q("select * from channel left join xchan on channel_hash = xchan_hash
where channel_address = '%s' limit 1", where channel_address = '%s' limit 1",
dbesc($channel) dbesc($channel)
); );

View File

@@ -9,7 +9,6 @@ use Zotlabs\Lib\Libzot;
require_once('include/oembed.php'); require_once('include/oembed.php');
require_once('include/event.php'); require_once('include/event.php');
require_once('include/zot.php');
require_once('include/html2plain.php'); require_once('include/html2plain.php');
function get_bb_tag_pos($s, $name, $occurance = 1) { function get_bb_tag_pos($s, $name, $occurance = 1) {

View File

@@ -16,7 +16,6 @@ use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Connect; use Zotlabs\Lib\Connect;
use Zotlabs\Lib\Libsync; use Zotlabs\Lib\Libsync;
require_once('include/zot.php');
require_once('include/crypto.php'); require_once('include/crypto.php');
require_once('include/menu.php'); require_once('include/menu.php');
require_once('include/perm_upgrade.php'); require_once('include/perm_upgrade.php');

View File

@@ -4,7 +4,6 @@
// Red cli interpreter // Red cli interpreter
require_once('include/cli_startup.php'); require_once('include/cli_startup.php');
require_once('include/zot.php');
cli_startup(); cli_startup();
@@ -23,7 +22,7 @@ function fresh_main($argc,$argv) {
$line = fgets(STDIN); $line = fgets(STDIN);
} }
if($line === FALSE) { if($line === FALSE) {
if(feof(STDIN)) { if(feof(STDIN)) {
break; break;
@@ -34,7 +33,7 @@ function fresh_main($argc,$argv) {
$line = trim($line); $line = trim($line);
if($line == 'quit' || $line == 'exit') if($line == 'quit' || $line == 'exit')
exit(); exit();
process_command($line); process_command($line);
} }
@@ -62,7 +61,7 @@ function process_command($line) {
case '?': case '?':
case 'help': case 'help':
fresh_help(); fresh_help();
break; break;
case 'finger': case 'finger':
if(argv(1)) { if(argv(1)) {
@@ -92,13 +91,13 @@ function process_command($line) {
echo 'logged in'; echo 'logged in';
$channel = App::get_channel(); $channel = App::get_channel();
if($channel) if($channel)
echo ' as ' . $channel['channel_name']; echo ' as ' . $channel['channel_name'];
} }
else else
echo 'login failed.'; echo 'login failed.';
} }
break; break;
case 'channel': case 'channel':
if(! local_channel()) if(! local_channel())
echo 'Permission denied.'; echo 'Permission denied.';
@@ -115,19 +114,19 @@ function process_command($line) {
else else
echo 'Channel not found.'; echo 'Channel not found.';
} }
break; break;
case 'conn': case 'conn':
if(! local_channel()) { if(! local_channel()) {
echo "Permission denied."; echo "Permission denied.";
break; break;
} }
if(argc() > 1) { if(argc() > 1) {
for($x = 1; $x < argc(); $x ++) { for($x = 1; $x < argc(); $x ++) {
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d", $r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_channel = %d",
intval(argv($x)), intval(argv($x)),
intval(local_channel()) intval(local_channel())
); );
if($r) echo jindent(json_encode($r[0])) . "\n"; if($r) echo jindent(json_encode($r[0])) . "\n";
} }
} }
else { else {
@@ -144,12 +143,12 @@ function process_command($line) {
default: default:
break; break;
} }
} }
function fresh_help() { function fresh_help() {
if(argc() == 1) { if(argc() == 1) {
@@ -161,4 +160,4 @@ function fresh_help() {
echo "quit|exit - terminate fresh\n"; echo "quit|exit - terminate fresh\n";
} }
} }

View File

@@ -14,7 +14,6 @@ if(!file_exists('include/cli_startup.php')) {
require_once('include/cli_startup.php'); require_once('include/cli_startup.php');
require_once('include/zot.php');
cli_startup(); cli_startup();
@@ -36,7 +35,7 @@ Usage: util/pconfig
Displays all of the the channel's config entries Displays all of the the channel's config entries
util/pconfig <channel_id> <family> util/pconfig <channel_id> <family>
Displays all of the channel's config entries for the specified family Displays all of the channel's config entries for the specified family
(system, database, etc) (system, database, etc)
util/pconfig <channel_id> <family> <key> util/pconfig <channel_id> <family> <key>