2017-07-30 16:48:34 -04:00
|
|
|
#!/usr/local/bin/php
|
2014-10-30 10:59:38 -04:00
|
|
|
<?
|
|
|
|
set_include_path("../include");
|
|
|
|
require("header.inc.php");
|
|
|
|
|
|
|
|
if (empty($argv[1]) || empty($argv[2]) || empty($argv[3]) || empty($argv[4])) {
|
2014-10-31 15:06:12 -04:00
|
|
|
die("Usage: $argv[0] " . '$username $email $password $real_user_name' . "\n");
|
2014-10-30 10:59:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$username = $argv[1];
|
|
|
|
$email = $argv[2];
|
|
|
|
$password = $argv[3];
|
|
|
|
$real_user = $argv[4];
|
|
|
|
|
|
|
|
echo "Adding new user $username\n";
|
|
|
|
|
2017-07-30 16:11:34 -04:00
|
|
|
$passwordhash = md5($password);
|
2014-10-31 14:55:43 -04:00
|
|
|
#$libraryID = Zotero_Libraries::add('user', 1);
|
2014-10-30 10:59:38 -04:00
|
|
|
|
|
|
|
|
|
|
|
Zotero_DB::beginTransaction();
|
|
|
|
|
2017-07-30 16:50:54 -04:00
|
|
|
$sql = "INSERT INTO zotero_www_test.users (username, password) VALUES (?,?)";
|
2014-10-30 10:59:38 -04:00
|
|
|
Zotero_DB::query($sql, array( $username,$passwordhash));
|
|
|
|
|
2017-07-30 16:50:54 -04:00
|
|
|
$sql = "SELECT userID FROM zotero_www_test.users WHERE username=?";
|
2014-10-31 14:55:43 -04:00
|
|
|
$userID = Zotero_DB::valueQuery($sql, $username);
|
2014-10-30 10:59:38 -04:00
|
|
|
|
2014-10-31 14:55:43 -04:00
|
|
|
# $sql = "INSERT INTO zotero_master.users (userID, libraryID, username) VALUES (?,?)";
|
|
|
|
# Zotero_DB::query($sql, array($userID, $libraryID, $username));
|
2014-10-30 10:59:38 -04:00
|
|
|
|
2014-10-31 14:55:43 -04:00
|
|
|
# $sql = "INSERT INTO zotero_master.storageAccounts (userID, quota, expiration) VALUES (?,?,?);";
|
|
|
|
# Zotero_DB::query($sql,array($userID, '10000', '2020-12-31 00:00:00'));
|
2014-10-30 10:59:38 -04:00
|
|
|
|
2017-07-30 16:50:54 -04:00
|
|
|
$sql = "INSERT INTO zotero_www_test.users_email (userID, email) VALUES (?,?);";
|
2014-10-30 10:59:38 -04:00
|
|
|
Zotero_DB::query($sql,array($userID, $email));
|
|
|
|
|
2017-07-30 16:50:54 -04:00
|
|
|
$sql = "INSERT INTO zotero_www_test.LUM_User (RoleID, UserID) VALUES (3,?);";
|
2014-10-30 10:59:38 -04:00
|
|
|
Zotero_DB::query($sql,array($userID));
|
|
|
|
|
2017-07-30 16:50:54 -04:00
|
|
|
$sql = "INSERT INTO zotero_www_test.users_meta (userID, metaKey, metaValue) VALUES (?,'profile_realname',?);";
|
2014-10-30 10:59:38 -04:00
|
|
|
Zotero_DB::query($sql,array($userID,$real_user));
|
|
|
|
|
|
|
|
Zotero_DB::commit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|