* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+define('INSTALLDIR', dirname(__DIR__));
+define('PUBLICDIR', INSTALLDIR . DIRECTORY_SEPARATOR . 'public');
$shortoptions = 'n:w:f:e:';
$longoptions = array('nickname=', 'password=', 'fullname=', 'email=');
try {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (!empty($user)) {
throw new Exception("A user named '$nickname' already exists.");
'fullname' => $fullname));
if (empty($user)) {
- throw new Exception("Cannot register user '$nickname' with password '$password' and fullname '$fullname'.");
+ throw new Exception("Can't register user '$nickname' with password '$password' and fullname '$fullname'.");
}
if (!empty($email)) {
$user->email = $email;
- if (!$user->updateKeys($orig)) {
- print "Failed!\n";
- throw new Exception("Cannot update email address.");
- }
+ // Throws exception on failure.
+ $user->updateWithKeys($orig);
}
} catch (Exception $e) {