aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-22 00:46:20 -0700
committerfriendica <info@friendica.com>2012-07-22 00:46:20 -0700
commit236ba8badcca39206e5a8595af5c1464bba2863e (patch)
treeca27bc811b360ffad153a8220df6c1d21f403022
parent6d74c2c594fd00c32f38f5ad8d7dd66e9e58b077 (diff)
downloadvolse-hubzilla-236ba8badcca39206e5a8595af5c1464bba2863e.tar.gz
volse-hubzilla-236ba8badcca39206e5a8595af5c1464bba2863e.tar.bz2
volse-hubzilla-236ba8badcca39206e5a8595af5c1464bba2863e.zip
more account infrastructure
-rw-r--r--boot.php1
-rw-r--r--database.sql330
-rw-r--r--htconfig.php2
-rw-r--r--include/account.php99
-rw-r--r--include/language.php5
-rw-r--r--index.php2
-rw-r--r--mod/zregister.php27
7 files changed, 135 insertions, 331 deletions
diff --git a/boot.php b/boot.php
index 7f5291ecc..a78ac2cfe 100644
--- a/boot.php
+++ b/boot.php
@@ -353,6 +353,7 @@ if(! class_exists('App')) {
class App {
public $account;
+ public $language;
public $module_loaded = false;
public $query_string;
public $config;
diff --git a/database.sql b/database.sql
index a93a17c04..df087b586 100644
--- a/database.sql
+++ b/database.sql
@@ -1,52 +1,33 @@
-
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
-
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--- --------------------------------------------------------
-
---
--- Table structure for table `account`
---
CREATE TABLE IF NOT EXISTS `account` (
`account_id` int(11) NOT NULL AUTO_INCREMENT,
- `account_name` char(255) NOT NULL,
+ `account_parent` int(10) unsigned NOT NULL,
`account_password` char(255) NOT NULL,
`account_email` char(255) NOT NULL,
- `account_openid` char(255) NOT NULL,
`account_language` char(16) NOT NULL DEFAULT 'en',
`account_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
- `account_verified` tinyint(1) unsigned NOT NULL DEFAULT '0',
- `account_blocked` tinyint(1) unsigned NOT NULL DEFAULT '0',
+ `account_flags` int(10) unsigned NOT NULL,
+ `account_roles` int(10) unsigned NOT NULL,
`account_reset` char(255) NOT NULL,
- `account_removed` tinyint(1) NOT NULL DEFAULT '0',
- `account_expired` tinyint(1) NOT NULL DEFAULT '0',
`account_expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`account_expire_notified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`account_service_class` char(32) NOT NULL,
PRIMARY KEY (`account_id`),
- KEY `account_name` (`account_name`),
KEY `account_password` (`account_password`),
KEY `account_email` (`account_email`),
- KEY `account_openid` (`account_openid`),
- KEY `account_verified` (`account_verified`),
- KEY `account_blocked` (`account_blocked`),
- KEY `account_removed` (`account_removed`),
- KEY `account_expired` (`account_expired`),
- KEY `account_service_class` (`account_service_class`)
+ KEY `account_service_class` (`account_service_class`),
+ KEY `account_parent` (`account_parent`),
+ KEY `account_flags` (`account_flags`),
+ KEY `account_roles` (`account_roles`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `addon`
---
-
CREATE TABLE IF NOT EXISTS `addon` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(255) NOT NULL,
@@ -61,12 +42,6 @@ CREATE TABLE IF NOT EXISTS `addon` (
KEY `installed` (`installed`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `attach`
---
-
CREATE TABLE IF NOT EXISTS `attach` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -84,12 +59,6 @@ CREATE TABLE IF NOT EXISTS `attach` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `auth_codes`
---
-
CREATE TABLE IF NOT EXISTS `auth_codes` (
`id` varchar(40) NOT NULL,
`client_id` varchar(20) NOT NULL,
@@ -99,12 +68,6 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `cache`
---
-
CREATE TABLE IF NOT EXISTS `cache` (
`k` char(255) NOT NULL,
`v` text NOT NULL,
@@ -112,12 +75,6 @@ CREATE TABLE IF NOT EXISTS `cache` (
PRIMARY KEY (`k`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `challenge`
---
-
CREATE TABLE IF NOT EXISTS `challenge` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`challenge` char(255) NOT NULL,
@@ -128,12 +85,6 @@ CREATE TABLE IF NOT EXISTS `challenge` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `clients`
---
-
CREATE TABLE IF NOT EXISTS `clients` (
`client_id` varchar(20) NOT NULL,
`pw` varchar(20) NOT NULL,
@@ -144,12 +95,6 @@ CREATE TABLE IF NOT EXISTS `clients` (
PRIMARY KEY (`client_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `config`
---
-
CREATE TABLE IF NOT EXISTS `config` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cat` char(255) CHARACTER SET ascii NOT NULL,
@@ -159,12 +104,6 @@ CREATE TABLE IF NOT EXISTS `config` (
UNIQUE KEY `access` (`cat`,`k`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `contact`
---
-
CREATE TABLE IF NOT EXISTS `contact` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL COMMENT 'owner uid',
@@ -243,12 +182,6 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `forum` (`forum`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `conv`
---
-
CREATE TABLE IF NOT EXISTS `conv` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`guid` char(64) NOT NULL,
@@ -263,12 +196,6 @@ CREATE TABLE IF NOT EXISTS `conv` (
KEY `updated` (`updated`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `deliverq`
---
-
CREATE TABLE IF NOT EXISTS `deliverq` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cmd` char(32) NOT NULL,
@@ -277,13 +204,7 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
PRIMARY KEY (`id`),
KEY `item` (`item`),
KEY `contact` (`contact`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `event`
---
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `event` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -315,12 +236,6 @@ CREATE TABLE IF NOT EXISTS `event` (
KEY `nofinish` (`nofinish`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `fcontact`
---
-
CREATE TABLE IF NOT EXISTS `fcontact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`url` char(255) NOT NULL,
@@ -343,12 +258,6 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
KEY `network` (`network`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `ffinder`
---
-
CREATE TABLE IF NOT EXISTS `ffinder` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -360,12 +269,6 @@ CREATE TABLE IF NOT EXISTS `ffinder` (
KEY `fid` (`fid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `fserver`
---
-
CREATE TABLE IF NOT EXISTS `fserver` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`server` char(255) NOT NULL,
@@ -377,12 +280,6 @@ CREATE TABLE IF NOT EXISTS `fserver` (
KEY `posturl` (`posturl`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `fsuggest`
---
-
CREATE TABLE IF NOT EXISTS `fsuggest` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -396,12 +293,6 @@ CREATE TABLE IF NOT EXISTS `fsuggest` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `gcign`
---
-
CREATE TABLE IF NOT EXISTS `gcign` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -411,12 +302,6 @@ CREATE TABLE IF NOT EXISTS `gcign` (
KEY `gcid` (`gcid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `gcontact`
---
-
CREATE TABLE IF NOT EXISTS `gcontact` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` char(255) NOT NULL,
@@ -430,12 +315,6 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
KEY `url` (`url`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `glink`
---
-
CREATE TABLE IF NOT EXISTS `glink` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`cid` int(11) NOT NULL,
@@ -451,12 +330,6 @@ CREATE TABLE IF NOT EXISTS `glink` (
KEY `updated` (`updated`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `group`
---
-
CREATE TABLE IF NOT EXISTS `group` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -469,12 +342,6 @@ CREATE TABLE IF NOT EXISTS `group` (
KEY `deleted` (`deleted`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `group_member`
---
-
CREATE TABLE IF NOT EXISTS `group_member` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -486,12 +353,6 @@ CREATE TABLE IF NOT EXISTS `group_member` (
KEY `contact-id` (`contact-id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `guid`
---
-
CREATE TABLE IF NOT EXISTS `guid` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`guid` char(64) NOT NULL,
@@ -499,12 +360,6 @@ CREATE TABLE IF NOT EXISTS `guid` (
KEY `guid` (`guid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `hook`
---
-
CREATE TABLE IF NOT EXISTS `hook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hook` char(255) NOT NULL,
@@ -514,12 +369,6 @@ CREATE TABLE IF NOT EXISTS `hook` (
KEY `hook` (`hook`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `intro`
---
-
CREATE TABLE IF NOT EXISTS `intro` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -542,15 +391,8 @@ CREATE TABLE IF NOT EXISTS `intro` (
KEY `contact-id` (`contact-id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `item`
---
-
CREATE TABLE IF NOT EXISTS `item` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `guid` char(64) NOT NULL,
`uri` char(255) CHARACTER SET ascii NOT NULL,
`uid` int(10) unsigned NOT NULL DEFAULT '0',
`contact-id` int(10) unsigned NOT NULL DEFAULT '0',
@@ -559,7 +401,6 @@ CREATE TABLE IF NOT EXISTS `item` (
`gravity` tinyint(1) NOT NULL DEFAULT '0',
`parent` int(10) unsigned NOT NULL DEFAULT '0',
`parent-uri` char(255) CHARACTER SET ascii NOT NULL,
- `extid` char(255) NOT NULL,
`thr-parent` char(255) NOT NULL,
`created` datetime NOT NULL,
`edited` datetime NOT NULL,
@@ -585,10 +426,8 @@ CREATE TABLE IF NOT EXISTS `item` (
`plink` char(255) NOT NULL,
`resource-id` char(255) NOT NULL,
`event-id` int(11) NOT NULL,
- `tag` mediumtext NOT NULL,
`attach` mediumtext NOT NULL,
`inform` mediumtext NOT NULL,
- `file` mediumtext NOT NULL,
`location` char(255) NOT NULL,
`coord` char(255) NOT NULL,
`allow_cid` mediumtext NOT NULL,
@@ -606,7 +445,6 @@ CREATE TABLE IF NOT EXISTS `item` (
`deleted` tinyint(1) NOT NULL DEFAULT '0',
`origin` tinyint(1) NOT NULL DEFAULT '0',
`forum_mode` tinyint(1) NOT NULL DEFAULT '0',
- `last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `uri` (`uri`),
KEY `uid` (`uid`),
@@ -618,12 +456,9 @@ CREATE TABLE IF NOT EXISTS `item` (
KEY `edited` (`edited`),
KEY `visible` (`visible`),
KEY `deleted` (`deleted`),
- KEY `last-child` (`last-child`),
KEY `unseen` (`unseen`),
- KEY `extid` (`extid`),
KEY `received` (`received`),
KEY `starred` (`starred`),
- KEY `guid` (`guid`),
KEY `origin` (`origin`),
KEY `wall` (`wall`),
KEY `forum_mode` (`forum_mode`),
@@ -637,17 +472,9 @@ CREATE TABLE IF NOT EXISTS `item` (
FULLTEXT KEY `allow_cid` (`allow_cid`),
FULLTEXT KEY `allow_gid` (`allow_gid`),
FULLTEXT KEY `deny_cid` (`deny_cid`),
- FULLTEXT KEY `deny_gid` (`deny_gid`),
- FULLTEXT KEY `tag` (`tag`),
- FULLTEXT KEY `file` (`file`)
+ FULLTEXT KEY `deny_gid` (`deny_gid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `item_id`
---
-
CREATE TABLE IF NOT EXISTS `item_id` (
`iid` int(11) NOT NULL,
`uid` int(11) NOT NULL,
@@ -659,12 +486,6 @@ CREATE TABLE IF NOT EXISTS `item_id` (
KEY `service` (`service`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `locks`
---
-
CREATE TABLE IF NOT EXISTS `locks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(128) NOT NULL,
@@ -672,12 +493,6 @@ CREATE TABLE IF NOT EXISTS `locks` (
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `mail`
---
-
CREATE TABLE IF NOT EXISTS `mail` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -709,12 +524,6 @@ CREATE TABLE IF NOT EXISTS `mail` (
KEY `contact-id` (`contact-id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `mailacct`
---
-
CREATE TABLE IF NOT EXISTS `mailacct` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -733,12 +542,6 @@ CREATE TABLE IF NOT EXISTS `mailacct` (
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `manage`
---
-
CREATE TABLE IF NOT EXISTS `manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -748,12 +551,6 @@ CREATE TABLE IF NOT EXISTS `manage` (
KEY `mid` (`mid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `notify`
---
-
CREATE TABLE IF NOT EXISTS `notify` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`hash` char(64) NOT NULL,
@@ -780,12 +577,6 @@ CREATE TABLE IF NOT EXISTS `notify` (
KEY `otype` (`otype`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `notify-threads`
---
-
CREATE TABLE IF NOT EXISTS `notify-threads` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`notify-id` int(11) NOT NULL,
@@ -797,12 +588,6 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
KEY `receiver-uid` (`receiver-uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `pconfig`
---
-
CREATE TABLE IF NOT EXISTS `pconfig` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0',
@@ -813,12 +598,6 @@ CREATE TABLE IF NOT EXISTS `pconfig` (
UNIQUE KEY `access` (`uid`,`cat`,`k`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `photo`
---
-
CREATE TABLE IF NOT EXISTS `photo` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -851,12 +630,6 @@ CREATE TABLE IF NOT EXISTS `photo` (
KEY `contact-id` (`contact-id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `poll`
---
-
CREATE TABLE IF NOT EXISTS `poll` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -874,12 +647,6 @@ CREATE TABLE IF NOT EXISTS `poll` (
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `poll_result`
---
-
CREATE TABLE IF NOT EXISTS `poll_result` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`poll_id` int(11) NOT NULL,
@@ -889,12 +656,6 @@ CREATE TABLE IF NOT EXISTS `poll_result` (
KEY `choice` (`choice`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `profile`
---
-
CREATE TABLE IF NOT EXISTS `profile` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -938,16 +699,21 @@ CREATE TABLE IF NOT EXISTS `profile` (
`publish` tinyint(1) NOT NULL DEFAULT '0',
`net-publish` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
+ KEY `uid` (`uid`),
+ KEY `is-default` (`is-default`),
+ KEY `locality` (`locality`),
+ KEY `postal-code` (`postal-code`),
+ KEY `country-name` (`country-name`),
+ KEY `hometown` (`hometown`),
+ KEY `gender` (`gender`),
+ KEY `marital` (`marital`),
+ KEY `sexual` (`sexual`),
+ KEY `publish` (`publish`),
+ KEY `net-publish` (`net-publish`),
FULLTEXT KEY `pub_keywords` (`pub_keywords`),
FULLTEXT KEY `prv_keywords` (`prv_keywords`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `profile_check`
---
-
CREATE TABLE IF NOT EXISTS `profile_check` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -961,13 +727,7 @@ CREATE TABLE IF NOT EXISTS `profile_check` (
KEY `dfrn_id` (`dfrn_id`),
KEY `sec` (`sec`),
KEY `expire` (`expire`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
--- --------------------------------------------------------
-
---
--- Table structure for table `queue`
---
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `queue` (
`id` int(11) NOT NULL AUTO_INCREMENT,
@@ -985,12 +745,6 @@ CREATE TABLE IF NOT EXISTS `queue` (
KEY `batch` (`batch`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `register`
---
-
CREATE TABLE IF NOT EXISTS `register` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`hash` char(255) NOT NULL,
@@ -1004,12 +758,6 @@ CREATE TABLE IF NOT EXISTS `register` (
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `session`
---
-
CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`sid` char(255) NOT NULL,
@@ -1020,12 +768,6 @@ CREATE TABLE IF NOT EXISTS `session` (
KEY `expire` (`expire`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `sign`
---
-
CREATE TABLE IF NOT EXISTS `sign` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`iid` int(10) unsigned NOT NULL DEFAULT '0',
@@ -1039,12 +781,6 @@ CREATE TABLE IF NOT EXISTS `sign` (
KEY `signer` (`signer`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `spam`
---
-
CREATE TABLE IF NOT EXISTS `spam` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
@@ -1059,12 +795,6 @@ CREATE TABLE IF NOT EXISTS `spam` (
KEY `term` (`term`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `term`
---
-
CREATE TABLE IF NOT EXISTS `term` (
`tid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`uid` int(10) unsigned NOT NULL,
@@ -1081,12 +811,6 @@ CREATE TABLE IF NOT EXISTS `term` (
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `tokens`
---
-
CREATE TABLE IF NOT EXISTS `tokens` (
`id` varchar(40) NOT NULL,
`secret` text NOT NULL,
@@ -1100,12 +824,6 @@ CREATE TABLE IF NOT EXISTS `tokens` (
KEY `uid` (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `user`
---
-
CREATE TABLE IF NOT EXISTS `user` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(10) unsigned NOT NULL,
@@ -1165,12 +883,6 @@ CREATE TABLE IF NOT EXISTS `user` (
KEY `account_id` (`account_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--- --------------------------------------------------------
-
---
--- Table structure for table `userd`
---
-
CREATE TABLE IF NOT EXISTS `userd` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` char(255) NOT NULL,
diff --git a/htconfig.php b/htconfig.php
index de7674c9a..8b265131f 100644
--- a/htconfig.php
+++ b/htconfig.php
@@ -35,7 +35,7 @@ $a->config['sitename'] = "Friendica Social Network";
// In order to perform system administration via the admin panel, admin_email
// must precisely match the email address of the person logged in.
-$a->config['register_policy'] = REGISTER_OPEN;
+$a->config['system']['register_policy'] = REGISTER_OPEN;
$a->config['register_text'] = '';
$a->config['admin_email'] = '';
diff --git a/include/account.php b/include/account.php
new file mode 100644
index 000000000..6e096b8bf
--- /dev/null
+++ b/include/account.php
@@ -0,0 +1,99 @@
+<?php
+
+require_once('include/config.php');
+require_once('include/network.php');
+require_once('include/plugin.php');
+require_once('include/text.php');
+require_once('include/language.php');
+require_once('include/datetime.php');
+
+function create_account($arr) {
+
+ // Required: { email, password, password2, tos }
+
+ $a = get_app();
+ $result = array('success' => false, 'user' => null, 'password' => '', 'message' => '');
+
+ $using_invites = get_config('system','invitation_only');
+ $num_invites = get_config('system','number_invites');
+
+
+ $invite_id = ((x($arr,'invite_id')) ? notags(trim($arr['invite_id'])) : '');
+ $email = ((x($arr,'email')) ? notags(trim($arr['email'])) : '');
+ $password = ((x($arr,'password')) ? trim($arr['password']) : '');
+ $password2 = ((x($arr,'password2')) ? trim($arr['password2']) : '');
+ $parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 );
+
+ $blocked = ((x($arr,'blocked')) ? intval($arr['blocked']) : 0);
+ $verified = ((x($arr,'verified')) ? intval($arr['verified']) : 0);
+
+ if($using_invites) {
+ if(! $invite_id) {
+ $result['message'] .= t('An invitation is required.') . EOL;
+ return $result;
+ }
+ $r = q("select * from register where `hash` = '%s' limit 1", dbesc($invite_id));
+ if(! results($r)) {
+ $result['message'] .= t('Invitation could not be verified.') . EOL;
+ return $result;
+ }
+ }
+
+ if((! x($email)) || (! x($password))) {
+ notice( t('Please enter the required information.') . EOL );
+ return;
+ }
+
+ if(! allowed_email($email))
+ $result['message'] .= t('Your email domain is not among those allowed on this site.') . EOL;
+
+ if((! valid_email($email)) || (! validate_email($email)))
+ $result['message'] .= t('Not a valid email address.') . EOL;
+
+
+ if(strlen($result['message'])) {
+ return $result;
+ }
+
+
+ $password_encoded = hash('whirlpool',$password);
+
+ $result['password'] = $new_password;
+
+ require_once('include/crypto.php');
+
+ $keys = new_keypair(4096);
+
+ if($keys === false) {
+ $result['message'] .= t('SERIOUS ERROR: Generation of security keys failed.') . EOL;
+ return $result;
+ }
+
+ $default_service_class = get_config('system','default_service_class');
+ if(! $default_service_class)
+ $default_service_class = '';
+
+
+ $prvkey = $keys['prvkey'];
+ $pubkey = $keys['pubkey'];
+
+ $r = q("INSERT INTO account
+ ( account_parent, account_password, account_email, account_language,
+ account_created, account_flags, account_roles, account_expires, account_service_class )
+ VALUES ( %d, '%s', '%s', '%s', '%s', %d, %d, '%s', '%s' )",
+ intval($parent),
+ dbesc($password_encoded),
+ dbesc($email),
+ dbesc($a->language),
+ dbesc(datetime_convert()),
+ dbesc($flags),
+ dbesc(0),
+ dbesc($expires),
+ dbesc($default_service_class)
+
+ );
+
+ $result['success'] = true;
+ return $result;
+
+}
diff --git a/include/language.php b/include/language.php
index f43b7e179..823fd3c96 100644
--- a/include/language.php
+++ b/include/language.php
@@ -80,7 +80,8 @@ function push_lang($language) {
}
$a->strings = array();
load_translation_table($language);
- $lang = $language;
+ $a->language = $lang = $language;
+
}
function pop_lang() {
@@ -94,7 +95,7 @@ function pop_lang() {
else
$a->strings = array();
- $lang = $a->langsave;
+ $a->language = $lang = $a->langsave;
}
diff --git a/index.php b/index.php
index 7c0a26f7b..a20cb4fc1 100644
--- a/index.php
+++ b/index.php
@@ -27,7 +27,7 @@ $install = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? false
@include(".htconfig.php");
-$lang = get_best_language();
+$a->language = $lang = get_best_language();
load_translation_table($lang);
diff --git a/mod/zregister.php b/mod/zregister.php
index f24da34c3..4eea51ddc 100644
--- a/mod/zregister.php
+++ b/mod/zregister.php
@@ -8,13 +8,11 @@ function zregister_init(&$a) {
function zregister_post(&$a) {
- global $lang;
-
$verified = 0;
$blocked = 1;
$arr = array('post' => $_POST);
- call_hooks('register_post', $arr);
+ call_hooks('zregister_post', $arr);
$max_dailies = intval(get_config('system','max_daily_registrations'));
if($max_dailies) {
@@ -24,21 +22,21 @@ function zregister_post(&$a) {
}
}
- switch($a->config['register_policy']) {
+ switch(get_config('system','register_policy')) {
-
case REGISTER_OPEN:
$blocked = 0;
- $verified = 1;
+ $verified = 0;
break;
case REGISTER_APPROVE:
- $blocked = 1;
+ $blocked = 0;
$verified = 0;
break;
default:
case REGISTER_CLOSED:
+ // TODO check against service class and fix this line
if((! x($_SESSION,'authenticated') && (! x($_SESSION,'administrator')))) {
notice( t('Permission denied.') . EOL );
return;
@@ -48,14 +46,14 @@ function zregister_post(&$a) {
break;
}
- require_once('include/user.php');
+ require_once('include/account.php');
$arr = $_POST;
$arr['blocked'] = $blocked;
$arr['verified'] = $verified;
- $result = create_user($arr);
+ $result = create_account($arr);
if(! $result['success']) {
notice($result['message']);
@@ -64,11 +62,6 @@ function zregister_post(&$a) {
$user = $result['user'];
- if($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
- $url = $a->get_baseurl() . '/profile/' . $user['nickname'];
- proc_run('php',"include/directory.php","$url");
- }
-
$using_invites = get_config('system','invitation_only');
$num_invites = get_config('system','number_invites');
$invite_id = ((x($_POST,'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
@@ -101,11 +94,9 @@ function zregister_post(&$a) {
info( t('Registration successful. Please check your email for further instructions.') . EOL ) ;
goaway(z_root());
}
- else {
- notice( t('Failed to send email message. Here is the message that failed.') . $email_tpl . EOL );
- }
}
elseif($a->config['register_policy'] == REGISTER_APPROVE) {
+
if(! strlen($a->config['admin_email'])) {
notice( t('Your registration can not be processed.') . EOL);
goaway(z_root());
@@ -117,7 +108,7 @@ function zregister_post(&$a) {
dbesc(datetime_convert()),
intval($user['uid']),
dbesc($result['password']),
- dbesc($lang)
+ dbesc($a->language)
);
$r = q("SELECT `language` FROM `user` WHERE `email` = '%s' LIMIT 1",