aboutsummaryrefslogtreecommitdiffstats
path: root/include/identity.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/identity.php')
-rw-r--r--include/identity.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/identity.php b/include/identity.php
index efc0d7d87..c8a925dac 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -80,6 +80,16 @@ function validate_channelname($name) {
function create_sys_channel() {
if(get_sys_channel())
return;
+
+ // Ensure that there is a host keypair.
+
+ if((! get_config('system','pubkey')) && (! get_config('system','prvkey'))) {
+ require_once('include/crypto.php');
+ $hostkey = new_keypair(4096);
+ set_config('system','pubkey',$hostkey['pubkey']);
+ set_config('system','prvkey',$hostkey['prvkey']);
+ }
+
create_identity(array(
'account_id' => 'xxx', // This will create an identity with an (integer) account_id of 0, but account_id is required
'nickname' => 'sys',
@@ -167,6 +177,11 @@ function create_identity($arr) {
return $ret;
}
+ if($nick === 'sys' && (! ($pageflags & PAGE_SYSTEM))) {
+ $ret['message'] = t('Reserved nickname. Please choose another.');
+ return $ret;
+ }
+
if(check_webbie(array($nick)) !== $nick) {
$ret['message'] = t('Nickname has unsupported characters or is already being used on this site.');
return $ret;