some changes merged from wrong branch... new function channel_reddress() instead of hardwired generation and which fixes case-sensitivity; allow dot notation in config and pconfig utils, updated string file

This commit is contained in:
redmatrix 2016-09-17 14:51:57 -07:00
parent 31df7af61f
commit 0754da58da
9 changed files with 3848 additions and 3832 deletions

View File

@ -60,13 +60,13 @@ class Connect extends \Zotlabs\Web\Controller {
$observer = \App::get_observer();
if(($observer) && ($_POST['submit'] === t('Continue'))) {
if($observer['xchan_follow'])
$url = sprintf($observer['xchan_follow'],urlencode(\App::$data['channel']['channel_address'] . '@' . \App::get_hostname()));
$url = sprintf($observer['xchan_follow'],urlencode(channel_reddress(\App::$data['channel'])));
if(! $url) {
$r = q("select * from hubloc where hubloc_hash = '%s' order by hubloc_id desc limit 1",
dbesc($observer['xchan_hash'])
);
if($r)
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(\App::$data['channel']['channel_address'] . '@' . \App::get_hostname());
$url = $r[0]['hubloc_url'] . '/follow?f=&url=' . urlencode(channel_reddress(\App::$data['channel']));
}
}
if($url)

View File

@ -42,7 +42,7 @@ class Fhublocs extends \Zotlabs\Web\Controller {
if($y)
$primary_address = $y[0]['xchan_addr'];
$hub_address = $rr['channel']['channel_address'] . '@' . \App::get_hostname();
$hub_address = channel_reddress($rr['channel']);
$primary = (($hub_address === $primary_address) ? 1 : 0);
@ -61,7 +61,7 @@ class Fhublocs extends \Zotlabs\Web\Controller {
dbesc($rr['channel_guid']),
dbesc($rr['channel_guid_sig']),
dbesc($rr['channel_hash']),
dbesc($rr['channel_address'] . '@' . \App::get_hostname()),
dbesc(channel_reddress($rr)),
intval($primary),
dbesc(z_root()),
dbesc(base64url_encode(rsa_sign(z_root(),$rr['channel_prvkey']))),

View File

@ -209,7 +209,7 @@ class Import extends \Zotlabs\Web\Controller {
dbesc($channel['channel_guid']),
dbesc($channel['channel_guid_sig']),
dbesc($channel['channel_hash']),
dbesc($channel['channel_address'] . '@' . \App::get_hostname()),
dbesc(channel_reddress($channel)),
dbesc('zot'),
intval(($seize) ? 1 : 0),
dbesc(z_root()),
@ -252,7 +252,7 @@ class Import extends \Zotlabs\Web\Controller {
dbesc(z_root() . "/photo/profile/l/" . $channel['channel_id']),
dbesc(z_root() . "/photo/profile/m/" . $channel['channel_id']),
dbesc(z_root() . "/photo/profile/s/" . $channel['channel_id']),
dbesc($channel['channel_address'] . '@' . \App::get_hostname()),
dbesc(channel_reddress($channel)),
dbesc(z_root() . '/channel/' . $channel['channel_address']),
dbesc(z_root() . '/follow?f=&url=%s'),
dbesc(z_root() . '/poco/' . $channel['channel_address']),

View File

@ -140,7 +140,7 @@ class Magic extends \Zotlabs\Web\Controller {
\Zotlabs\Zot\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']);
$target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode($channel['channel_address'] . '@' . \App::get_hostname())
$target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode(channel_reddress($channel))
. '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION;
if($delegate)

View File

@ -43,7 +43,7 @@ class Xrd extends \Zotlabs\Web\Controller {
header("Content-type: application/xrd+xml");
$aliases = array('acct:' . $r[0]['channel_address'] . '@' . \App::get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
$aliases = array('acct:' . channel_reddress($r[0]), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
for($x = 0; $x < count($aliases); $x ++) {
if($aliases[$x] === $resource)

View File

@ -1894,3 +1894,8 @@ function channelx_by_n($id) {
return(($r) ? $r[0] : false);
}
function channel_reddress($channel) {
if(! ($channel && array_key_exists('channel_address',$channel)))
return '';
return strtolower($channel['channel_address'] . '@' . App::get_hostname());
}

View File

@ -48,7 +48,11 @@ EndOfOutput;
return;
}
if($argc > 1 && strpos($argv[1],'.')) {
$x = explode('.',$argv[1]);
$argv = [ $argv[0], $x[0], $x[1], (($argc > 2) ? $argv[2] : null) ];
$argc = $argc + 1;
}
if($argc > 3) {
set_config($argv[1],$argv[2],$argv[3]);

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,13 @@ EndOfOutput;
}
if($argc > 2 && strpos($argv[2],'.')) {
$x = explode('.',$argv[2]);
$argv = [ $argv[0], $argv[1], $x[0], $x[1], (($argc > 3) ? $argv[3] : null) ];
$argc = $argc + 1;
}
if($argc > 4) {
set_pconfig($argv[1],$argv[2],$argv[3],$argv[4]);
build_sync_packet($argv[1]);