diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2016-02-24 17:44:27 +0100 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2016-02-24 17:44:27 +0100 |
commit | ddeab48f9b314eed067c31086945acee33964d37 (patch) | |
tree | a814d6244991017af57ea03670d45d9ca1286cc0 /mod | |
parent | cc264b2d60049a844fe17322fbcb367712a7071f (diff) | |
parent | 039eb585240a5fa106ede00a055036458a4f5393 (diff) | |
download | volse-hubzilla-ddeab48f9b314eed067c31086945acee33964d37.tar.gz volse-hubzilla-ddeab48f9b314eed067c31086945acee33964d37.tar.bz2 volse-hubzilla-ddeab48f9b314eed067c31086945acee33964d37.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod')
-rw-r--r-- | mod/chat.php | 6 | ||||
-rw-r--r-- | mod/cloud.php | 14 | ||||
-rw-r--r-- | mod/cover_photo.php | 2 | ||||
-rw-r--r-- | mod/dav.php | 16 | ||||
-rwxr-xr-x | mod/events.php | 4 | ||||
-rw-r--r-- | mod/filestorage.php | 2 | ||||
-rw-r--r-- | mod/help.php | 2 | ||||
-rw-r--r-- | mod/import.php | 2 | ||||
-rw-r--r-- | mod/item.php | 2 | ||||
-rw-r--r-- | mod/linkinfo.php | 2 | ||||
-rw-r--r-- | mod/mitem.php | 2 | ||||
-rw-r--r-- | mod/new_channel.php | 43 | ||||
-rw-r--r-- | mod/photos.php | 4 | ||||
-rw-r--r-- | mod/post.php | 4 | ||||
-rw-r--r-- | mod/pubsites.php | 25 | ||||
-rw-r--r-- | mod/register.php | 43 | ||||
-rw-r--r-- | mod/rpost.php | 2 | ||||
-rw-r--r-- | mod/settings.php | 74 | ||||
-rw-r--r-- | mod/siteinfo.php | 4 | ||||
-rw-r--r-- | mod/thing.php | 4 | ||||
-rw-r--r-- | mod/wfinger.php | 12 |
21 files changed, 136 insertions, 133 deletions
diff --git a/mod/chat.php b/mod/chat.php index 79a5c050b..f219bde73 100644 --- a/mod/chat.php +++ b/mod/chat.php @@ -54,7 +54,7 @@ function chat_post(&$a) { goaway(z_root() . '/chat/' . $channel['channel_address']); } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $acl->set_from_array($_REQUEST); $arr = $acl->get(); @@ -162,7 +162,7 @@ function chat_content(&$a) { intval($a->profile['profile_uid']) ); if($x) { - $acl = new AccessList(false); + $acl = new Zotlabs\Access\AccessList(false); $acl->set($x[0]); $private = $acl->is_private(); @@ -199,7 +199,7 @@ function chat_content(&$a) { if(local_channel() && argc() > 2 && argv(2) === 'new') { - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); require_once('include/acl_selectors.php'); diff --git a/mod/cloud.php b/mod/cloud.php index 67fc199bf..82d454477 100644 --- a/mod/cloud.php +++ b/mod/cloud.php @@ -7,7 +7,7 @@ */ use Sabre\DAV; -use RedMatrix\RedDAV; +use Zotlabs\Storage; // composer autoloader for SabreDAV require_once('vendor/autoload.php'); @@ -35,7 +35,7 @@ function cloud_init(&$a) { if ($which) profile_load($a, $which, $profile); - $auth = new RedDAV\RedBasicAuth(); + $auth = new Zotlabs\Storage\BasicAuth(); $ob_hash = get_observer_hash(); @@ -63,7 +63,7 @@ function cloud_init(&$a) { $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']); - $rootDirectory = new RedDAV\RedDirectory('/', $auth); + $rootDirectory = new Zotlabs\Storage\Directory('/', $auth); // A SabreDAV server-object $server = new DAV\Server($rootDirectory); @@ -86,16 +86,16 @@ function cloud_init(&$a) { } } - require_once('include/RedDAV/RedBrowser.php'); +// require_once('Zotlabs/Storage/Browser.php'); // provide a directory view for the cloud in Hubzilla - $browser = new RedDAV\RedBrowser($auth); + $browser = new Zotlabs\Storage\Browser($auth); $auth->setBrowserPlugin($browser); $server->addPlugin($browser); // Experimental QuotaPlugin -// require_once('include/RedDAV/QuotaPlugin.php'); -// $server->addPlugin(new RedDAV\QuotaPlugin($auth)); +// require_once('Zotlabs\Storage/QuotaPlugin.php'); +// $server->addPlugin(new Zotlabs\Storage\\QuotaPlugin($auth)); // All we need to do now, is to fire up the server $server->exec(); diff --git a/mod/cover_photo.php b/mod/cover_photo.php index de11857b0..9c99859ea 100644 --- a/mod/cover_photo.php +++ b/mod/cover_photo.php @@ -239,7 +239,7 @@ function send_cover_photo_activity($channel,$photo,$profile) { $arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext; - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $x = $acl->get(); $arr['allow_cid'] = $x['allow_cid']; diff --git a/mod/dav.php b/mod/dav.php index d4695a544..272dae4c8 100644 --- a/mod/dav.php +++ b/mod/dav.php @@ -7,7 +7,7 @@ */ use Sabre\DAV; -use RedMatrix\RedDAV; +use Zotlabs\Storage; // composer autoloader for SabreDAV require_once('vendor/autoload.php'); @@ -54,7 +54,7 @@ function dav_init(&$a) { if ($which) profile_load($a, $which, $profile); - $auth = new RedDAV\RedBasicAuth(); + $auth = new Zotlabs\Storage\BasicAuth(); $ob_hash = get_observer_hash(); @@ -82,7 +82,7 @@ function dav_init(&$a) { $_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = preg_replace('/[\?&]davguest=(.*?)([\?&]|$)/ism', '', $_SERVER['REQUEST_URI']); - $rootDirectory = new RedDAV\RedDirectory('/', $auth); + $rootDirectory = new Zotlabs\Storage\Directory('/', $auth); // A SabreDAV server-object $server = new DAV\Server($rootDirectory); @@ -108,7 +108,7 @@ function dav_init(&$a) { if ((! $auth->observer) && ($_SERVER['REQUEST_METHOD'] === 'GET')) { try { $x = RedFileData('/' . $a->cmd, $auth); - if($x instanceof RedDAV\RedFile) + if($x instanceof Zotlabs\Storage\File) $isapublic_file = true; } catch (Exception $e) { @@ -126,14 +126,14 @@ function dav_init(&$a) { } } - require_once('include/RedDAV/RedBrowser.php'); +// require_once('Zotlabs/Storage/Browser.php'); // provide a directory view for the cloud in Hubzilla - $browser = new RedDAV\RedBrowser($auth); + $browser = new Zotlabs\Storage\Browser($auth); $auth->setBrowserPlugin($browser); // Experimental QuotaPlugin -// require_once('include/RedDAV/QuotaPlugin.php'); -// $server->addPlugin(new RedDAV\QuotaPlugin($auth)); +// require_once('Zotlabs/Storage/QuotaPlugin.php'); +// $server->addPlugin(new Zotlabs\Storage\QuotaPlugin($auth)); // All we need to do now, is to fire up the server $server->exec(); diff --git a/mod/events.php b/mod/events.php index ed9f0f2e3..b07ffa184 100755 --- a/mod/events.php +++ b/mod/events.php @@ -118,7 +118,7 @@ function events_post(&$a) { $channel = $a->get_channel(); - $acl = new AccessList(false); + $acl = new Zotlabs\Access\AccessList(false); if($event_id) { $x = q("select * from event where id = %d and uid = %d limit 1", @@ -422,7 +422,7 @@ function events_content(&$a) { require_once('include/acl_selectors.php'); - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $perm_defaults = $acl->get(); $tpl = get_markup_template('event_form.tpl'); diff --git a/mod/filestorage.php b/mod/filestorage.php index 7ba8c1801..753300e89 100644 --- a/mod/filestorage.php +++ b/mod/filestorage.php @@ -30,7 +30,7 @@ function filestorage_post(&$a) { $channel = $a->get_channel(); - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $acl->set_from_array($_REQUEST); $x = $acl->get(); diff --git a/mod/help.php b/mod/help.php index 1539978f7..19bf251bd 100644 --- a/mod/help.php +++ b/mod/help.php @@ -160,7 +160,7 @@ function help_content(&$a) { $path = trim(substr($dirname,4),'/'); $o .= '<li><a href="help/' . (($path) ? $path . '/' : '') . $fname . '" >' . ucwords(str_replace('_',' ',notags($fname))) . '</a><br />' . - str_replace('$Projectname',get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; + str_replace('$Projectname',Zotlabs\Project\System::get_platform_name(),substr($rr['text'],0,200)) . '...<br /><br /></li>'; } $o .= '</ul>'; diff --git a/mod/import.php b/mod/import.php index 0bbd38ffe..184159585 100644 --- a/mod/import.php +++ b/mod/import.php @@ -120,7 +120,7 @@ function import_account(&$a, $account_id) { notice($t); } if(array_key_exists('server_role',$data['compatibility']) - && $data['compatibility']['server_role'] != get_server_role()) { + && $data['compatibility']['server_role'] != Zotlabs\Project\System::get_server_role()) { notice( t('Server platform is not compatible. Operation not permitted.') . EOL); return; } diff --git a/mod/item.php b/mod/item.php index d861967a9..f23bff3ac 100644 --- a/mod/item.php +++ b/mod/item.php @@ -310,7 +310,7 @@ function item_post(&$a) { } } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $public_policy = ((x($_REQUEST,'public_policy')) ? escape_tags($_REQUEST['public_policy']) : map_scope($channel['channel_r_stream'],true)); diff --git a/mod/linkinfo.php b/mod/linkinfo.php index 5d9e2bc67..07eaa02a0 100644 --- a/mod/linkinfo.php +++ b/mod/linkinfo.php @@ -115,7 +115,7 @@ function linkinfo_content(&$a) { // If this is a Red site, use zrl rather than url so they get zids sent to them by default - if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], get_platform_name() . ' ') === 0)) + if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], Zotlabs\Project\System::get_platform_name() . ' ') === 0)) $template = str_replace('url','zrl',$template); if($siteinfo["title"] == "") { diff --git a/mod/mitem.php b/mod/mitem.php index d6572bd56..7f582c649 100644 --- a/mod/mitem.php +++ b/mod/mitem.php @@ -127,7 +127,7 @@ function mitem_content(&$a) { $menu_names[] = $menus['menu_name']; } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $lockstate = (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'); diff --git a/mod/new_channel.php b/mod/new_channel.php index b22a5cacb..577137c37 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -8,7 +8,6 @@ function new_channel_init(&$a) { $cmd = ((argc() > 1) ? argv(1) : ''); - if($cmd === 'autofill.json') { require_once('library/urlify/URLify.php'); $result = array('error' => false, 'message' => ''); @@ -59,7 +58,6 @@ function new_channel_init(&$a) { } - function new_channel_post(&$a) { $arr = $_POST; @@ -94,15 +92,8 @@ function new_channel_post(&$a) { } - - - - - - function new_channel_content(&$a) { - $acc = $a->get_account(); if((! $acc) || $acc['account_id'] != get_account_id()) { @@ -119,29 +110,33 @@ function new_channel_content(&$a) { if($r && (! intval($r[0]['total']))) { $default_role = get_config('system','default_permissions_role'); } + + $limit = account_service_class_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); + } + else { + $channel_usage_message = ''; + } } - $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); - $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); + $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')); + $nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')); + $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)); $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); + $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>',get_roles()); $o = replace_macros(get_markup_template('new_channel.tpl'), array( - - '$title' => t('Add a Channel'), - '$desc' => t('A channel is your own collection of related web pages. A channel can be used to hold social network profiles, blogs, conversation groups and forums, celebrity pages, and much more. You may create as many channels as your service provider allows.'), - - '$label_name' => t('Name'), - '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), - '$label_nick' => t('Choose a short nickname'), - '$nick_hub' => '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')), - '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), - '$label_import' => t('Or <a href="import">import an existing channel</a> from another location'), + '$title' => t('Create Channel'), + '$desc' => t('A channel is your identity on this network. It can represent a person, a blog, or a forum to name a few. Channels can make connections with other channels to share information with highly detailed permissions.'), + '$label_import' => t('or <a href="import">import an existing channel</a> from another location.'), '$name' => $name, - '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), - '$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()), + '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, - '$submit' => t('Create') + '$submit' => t('Create'), + '$channel_usage_message' => $channel_usage_message )); return $o; diff --git a/mod/photos.php b/mod/photos.php index 944686637..8f44f01b2 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -85,7 +85,7 @@ function photos_post(&$a) { $owner_record = $s[0]; - $acl = new AccessList($a->data['channel']); + $acl = new Zotlabs\Access\AccessList($a->data['channel']); if((argc() > 3) && (argv(2) === 'album')) { @@ -595,7 +595,7 @@ function photos_content(&$a) { if($_is_owner) { $channel = $a->get_channel(); - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); $lockstate = (($acl->is_private()) ? 'lock' : 'unlock'); diff --git a/mod/post.php b/mod/post.php index 6555a16c2..481a4a896 100644 --- a/mod/post.php +++ b/mod/post.php @@ -12,7 +12,6 @@ require_once('include/zot.php'); function post_init(&$a) { if (array_key_exists('auth', $_REQUEST)) { - require_once('Zotlabs/Zot/Auth.php'); $x = new Zotlabs\Zot\Auth($_REQUEST); exit; } @@ -22,9 +21,6 @@ function post_init(&$a) { function post_post(&$a) { - require_once('Zotlabs/Zot/Receiver.php'); - require_once('Zotlabs/Zot/ZotHandler.php'); - $z = new Zotlabs\Zot\Receiver($_REQUEST['data'],get_config('system','prvkey'), new Zotlabs\Zot\ZotHandler()); // notreached; diff --git a/mod/pubsites.php b/mod/pubsites.php index ae8601366..dc6b09d9b 100644 --- a/mod/pubsites.php +++ b/mod/pubsites.php @@ -13,30 +13,39 @@ function pubsites_content(&$a) { } $url .= '/sites'; - $o .= '<div class="generic-content-wrapper-styled">'; + $o .= '<div class="generic-content-wrapper">'; - $o .= '<h1>' . t('Public Sites') . '</h1>'; + $o .= '<div class="section-title-wrapper"><h2>' . t('Public Hubs') . '</h2></div>'; - $o .= '<div class="descriptive-text">' . - t('The listed sites allow public registration for the $Projectname network. All sites in the network are interlinked so membership on any of them conveys membership in the network as a whole. Some sites may require subscription or provide tiered service plans. The provider links <strong>may</strong> provide additional details.') . '</div>' . EOL; + $o .= '<div class="section-content-tools-wrapper"><div class="descriptive-text">' . + t('The listed hubs allow public registration for the $Projectname network. All hubs in the network are interlinked so membership on any of them conveys membership in the network as a whole. Some hubs may require subscription or provide tiered service plans. The hub itself <strong>may</strong> provide additional details.') . '</div>' . EOL; $ret = z_fetch_url($url); if($ret['success']) { $j = json_decode($ret['body'],true); if($j) { - $rate_meta = ((local_channel()) ? '<td>' . t('Rate this hub') . '</td>' : ''); - $o .= '<table border="1"><tr><td>' . t('Site URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td>' . t('Location') . '</td><td>' . t('Project') . '</td><td>' . t('View hub ratings') . '</td>' . $rate_meta . '</tr>'; + $o .= '<table class="table table-striped table-hover"><tr><td>' . t('Hub URL') . '</td><td>' . t('Access Type') . '</td><td>' . t('Registration Policy') . '</td><td colspan="2">' . t('Ratings') . '</td></tr>'; if($j['sites']) { foreach($j['sites'] as $jj) { + if($jj['project'] !== Zotlabs\Project\System::get_platform_name()) + continue; $host = strtolower(substr($jj['url'],strpos($jj['url'],'://')+3)); $rate_links = ((local_channel()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="icon-check"></i> ' . t('Rate') . '</a></td>' : ''); - $o .= '<tr><td>' . '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" >' . $jj['url'] . '</a>' . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . $jj['location'] . '</td><td>' . $jj['project'] . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="icon-eye-open"></i> ' . t('View ratings') . '</a></td>' . $rate_links . '</tr>'; + $location = ''; + if(!empty($jj['location'])) { + $location = '<p title="' . t('Location') . '" style="margin: 5px 5px 0 0; text-align: right"><i class="icon-globe"></i> ' . $jj['location'] . '</p>'; + } + else { + $location = '<br /> '; + } + $urltext = str_replace(array('https://'), '', $jj['url']); + $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="icon-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="icon-eye-open"></i> ' . t('View') . '</a></td>' . $rate_links . '</tr>'; } } $o .= '</table>'; - $o .= '</div>'; + $o .= '</div></div>'; } } diff --git a/mod/register.php b/mod/register.php index 77ddfb4b1..2de13feae 100644 --- a/mod/register.php +++ b/mod/register.php @@ -177,7 +177,7 @@ function register_content(&$a) { if(get_config('system','register_policy') == REGISTER_CLOSED) { if(get_config('system','directory_mode') == DIRECTORY_MODE_STANDALONE) { - notice( t('Registration on this site is disabled.') . EOL); + notice( t('Registration on this hub is disabled.') . EOL); return; } @@ -186,8 +186,8 @@ function register_content(&$a) { } if(get_config('system','register_policy') == REGISTER_APPROVE) { - $registration_is = t('Registration on this site/hub is by approval only.'); - $other_sites = t('<a href="pubsites">Register at another affiliated site/hub</a>'); + $registration_is = t('Registration on this hub is by approval only.'); + $other_sites = t('<a href="pubsites">Register at another affiliated hub.</a>'); } $max_dailies = intval(get_config('system','max_daily_registrations')); @@ -208,7 +208,7 @@ function register_content(&$a) { if(! $tosurl) $tosurl = $a->get_baseurl() . '/help/TermsOfService'; - $toslink = '<a href="' . $tosurl . '" >' . t('Terms of Service') . '</a>'; + $toslink = '<a href="' . $tosurl . '" target="_blank">' . t('Terms of Service') . '</a>'; // Configurable whether to restrict age or not - default is based on international legal requirements // This can be relaxed if you are on a restricted server that does not share with public servers @@ -220,13 +220,16 @@ function register_content(&$a) { $enable_tos = 1 - intval(get_config('system','no_termsofservice')); - $email = ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : "" ); - $password = ((x($_REQUEST,'password')) ? trim($_REQUEST['password']) : "" ); - $password2 = ((x($_REQUEST,'password2')) ? trim($_REQUEST['password2']) : "" ); - $invite_code = ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : "" ); - $name = ((x($_REQUEST,'name')) ? escape_tags(trim($_REQUEST['name'])) : "" ); - $nickname = ((x($_REQUEST,'nickname')) ? strip_tags(trim($_REQUEST['nickname'])) : "" ); - $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); + $email = array('email', t('Your email address'), ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : "")); + $password = array('password', t('Choose a password'), ((x($_REQUEST,'password')) ? trim($_REQUEST['password']) : "")); + $password2 = array('password2', t('Please re-enter your password'), ((x($_REQUEST,'password2')) ? trim($_REQUEST['password2']) : "")); + $invite_code = array('invite_code', t('Please enter your invitation code'), ((x($_REQUEST,'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : "")); + $name = array('name', t('Name or caption'), ((x($_REQUEST,'name')) ? $_REQUEST['name'] : ''), t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"')); + $nickhub = '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')); + $nickname = array('nickname', t('Choose a short nickname'), ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : ''), sprintf( t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)); + $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : ""); + $role = array('permissions_role' , t('Channel role and privacy'), ($privacy_role) ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>',get_roles()); + $tos = array('tos', $label_tos, '', '', array(t('no'),t('yes'))); $auto_create = ((UNO) || (get_config('system','auto_channel_create')) ? true : false); $default_role = ((UNO) ? 'social' : get_config('system','default_permissions_role')); @@ -241,29 +244,17 @@ function register_content(&$a) { '$other_sites' => $other_sites, '$invitations' => get_config('system','invitation_only'), '$invite_desc' => t('Membership on this site is by invitation only.'), - '$label_invite' => t('Please enter your invitation code'), '$invite_code' => $invite_code, '$auto_create' => $auto_create, - '$label_name' => t('Name'), - '$help_name' => t('Enter your name'), - '$label_nick' => t('Choose a short nickname'), - '$nick_hub' => '@' . str_replace(array('http://','https://','/'), '', get_config('system','baseurl')), - '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), '$name' => $name, - '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), - '$role' => array('permissions_role' , t('Channel Type'), ($privacy_role) ? $privacy_role : 'social', '<a href="help/roles" target="_blank">'.t('Read more about roles').'</a>',get_roles()), + '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, - '$submit' => t('Create'), - '$label_email' => t('Your email address'), - '$label_pass1' => t('Choose a password'), - '$label_pass2' => t('Please re-enter your password'), - '$label_tos' => $label_tos, - '$enable_tos' => $enable_tos, + '$tos' => $tos, '$email' => $email, '$pass1' => $password, '$pass2' => $password2, - '$submit' => t('Register') + '$submit' => ((UNO || $auto_create || $registration_is) ? t('Register') : t('Proceed to create your first channel')) )); return $o; diff --git a/mod/rpost.php b/mod/rpost.php index ab5ef4ccd..915b1ca96 100644 --- a/mod/rpost.php +++ b/mod/rpost.php @@ -95,7 +95,7 @@ function rpost_content(&$a) { $channel = $a->get_channel(); - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); diff --git a/mod/settings.php b/mod/settings.php index ea9c73435..a6655f46a 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -225,10 +225,44 @@ function settings_post(&$a) { $errs = array(); + $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); + $account = $a->get_account(); + if($email != $account['account_email']) { + if(! valid_email($email)) + $errs[] = t('Not valid email.'); + $adm = trim(get_config('system','admin_email')); + if(($adm) && (strcasecmp($email,$adm) == 0)) { + $errs[] = t('Protected email address. Cannot change to that email.'); + $email = $a->user['email']; + } + if(! $errs) { + $r = q("update account set account_email = '%s' where account_id = %d", + dbesc($email), + intval($account['account_id']) + ); + if(! $r) + $errs[] = t('System failure storing new email. Please try again.'); + } + } + + if($errs) { + foreach($errs as $err) + notice($err . EOL); + $errs = array(); + } + + if((x($_POST,'npassword')) || (x($_POST,'confirm'))) { - $newpass = $_POST['npassword']; - $confirm = $_POST['confirm']; + $origpass = trim($_POST['origpass']); + + require_once('include/auth.php'); + if(! account_verify_password($email,$origpass)) { + $errs[] = t('Password verification failed.'); + } + + $newpass = trim($_POST['npassword']); + $confirm = trim($_POST['confirm']); if($newpass != $confirm ) { $errs[] = t('Passwords do not match. Password unchanged.'); @@ -255,31 +289,6 @@ function settings_post(&$a) { } } - if($errs) { - foreach($errs as $err) - notice($err . EOL); - $errs = array(); - } - - $email = ((x($_POST,'email')) ? trim(notags($_POST['email'])) : ''); - $account = $a->get_account(); - if($email != $account['account_email']) { - if(! valid_email($email)) - $errs[] = t('Not valid email.'); - $adm = trim(get_config('system','admin_email')); - if(($adm) && (strcasecmp($email,$adm) == 0)) { - $errs[] = t('Protected email address. Cannot change to that email.'); - $email = $a->user['email']; - } - if(! $errs) { - $r = q("update account set account_email = '%s' where account_id = %d", - dbesc($email), - intval($account['account_id']) - ); - if(! $r) - $errs[] = t('System failure storing new email. Please try again.'); - } - } if($errs) { foreach($errs as $err) @@ -314,7 +323,7 @@ function settings_post(&$a) { foreach($global_perms as $k => $v) { $set_perms .= ', ' . $v[0] . ' = ' . intval($_POST[$k]) . ' '; } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $acl->set_from_array($_POST); $x = $acl->get(); @@ -695,8 +704,9 @@ function settings_content(&$a) { $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_account"), '$title' => t('Account Settings'), - '$password1'=> array('npassword', t('Enter New Password:'), '', ''), - '$password2'=> array('confirm', t('Confirm New Password:'), '', t('Leave password fields blank unless changing')), + '$origpass' => array('origpass', t('Current Password'), ' ',''), + '$password1'=> array('npassword', t('Enter New Password'), '', ''), + '$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')), '$submit' => t('Submit'), '$email' => array('email', t('Email Address:'), $email, ''), '$removeme' => t('Remove Account'), @@ -992,7 +1002,7 @@ function settings_content(&$a) { $stpl = get_markup_template('settings.tpl'); - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $perm_defaults = $acl->get(); require_once('include/group.php'); @@ -1044,7 +1054,7 @@ function settings_content(&$a) { '$h_prv' => t('Security and Privacy Settings'), '$permissions_set' => $permissions_set, - '$server_role' => get_server_role(), + '$server_role' => Zotlabs\Project\System::get_server_role(), '$perms_set_msg' => t('Your permissions are already configured. Click to view/adjust'), '$hide_presence' => array('hide_presence', t('Hide my online presence'),$hide_presence, t('Prevents displaying in your profile that you are online'), $yes_no), diff --git a/mod/siteinfo.php b/mod/siteinfo.php index f7423506f..19b566b73 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -12,10 +12,10 @@ function siteinfo_init(&$a) { function siteinfo_content(&$a) { if(! get_config('system','hidden_version_siteinfo')) { - $version = sprintf( t('Version %s'), get_project_version()); + $version = sprintf( t('Version %s'), Zotlabs\Project\System::get_project_version()); if(@is_dir('.git') && function_exists('shell_exec')) { $commit = @shell_exec('git log -1 --format="%h"'); - $tag = get_std_version(); // @shell_exec('git describe --tags --abbrev=0'); + $tag = Zotlabs\Project\System::get_std_version(); // @shell_exec('git describe --tags --abbrev=0'); } if(! isset($commit) || strlen($commit) > 16) $commit = ''; diff --git a/mod/thing.php b/mod/thing.php index 7c5020e62..7e7d1bdc7 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -65,7 +65,7 @@ function thing_init(&$a) { if((! $name) || (! $translated_verb)) return; - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); if(array_key_exists('contact_allow',$_REQUEST) || array_key_exists('group_allow',$_REQUEST) @@ -271,7 +271,7 @@ function thing_content(&$a) { return; } - $acl = new AccessList($channel); + $acl = new Zotlabs\Access\AccessList($channel); $channel_acl = $acl->get(); $lockstate = (($acl->is_private()) ? 'lock' : 'unlock'); diff --git a/mod/wfinger.php b/mod/wfinger.php index 5270c8f31..3f9826f9b 100644 --- a/mod/wfinger.php +++ b/mod/wfinger.php @@ -51,8 +51,6 @@ function wfinger_init(&$a) { header('Access-Control-Allow-Origin: *'); - header('Content-type: application/jrd+json'); - if($resource && $r) { @@ -108,6 +106,11 @@ function wfinger_init(&$a) { array( 'rel' => 'http://purl.org/zot/protocol', 'href' => z_root() . '/.well-known/zot-info' . '?address=' . $r[0]['xchan_addr'], + ), + + array( + 'rel' => 'magic-public-key', + 'href' => 'data:application/magic-public-key,' . salmon_key($r[0]['channel_pubkey']), ) ); @@ -124,7 +127,6 @@ function wfinger_init(&$a) { $arr = array('channel' => $r[0], 'request' => $_REQUEST, 'result' => $result); call_hooks('webfinger',$arr); - echo json_encode($arr['result']); - killme(); + json_return_and_die($arr['result'],'application/jrd+json'); -}
\ No newline at end of file +} |