Adds a constant for the root username which can be overriden in LocalConfig.php, a=chris
Adds a constant for the root username which can be overriden in LocalConfig.php, a=chris
diff --git a/src/configs/Config.php b/src/configs/Config.php
index 22da2c892..a92f2eb2f 100755
--- a/src/configs/Config.php
+++ b/src/configs/Config.php
@@ -425,6 +425,10 @@ if (isset($_SERVER['HTTP_USER_AGENT'])) {
*/
/** ID of the root user */
nsdefine('ROOT_ID', 1);
+/**User name of the root user. If you want to change this, change
+ the value in LocalConfig.php, then run the Createdb.php script. You
+ should do this before you have much data in your system. */
+nsconddefine('ROOT_USERNAME', "root");
/** Role of the root user */
nsdefine('ADMIN_ROLE', 1);
/** Default role of an active user */
diff --git a/src/configs/Createdb.php b/src/configs/Createdb.php
index 5efdf71d0..186aa1076 100755
--- a/src/configs/Createdb.php
+++ b/src/configs/Createdb.php
@@ -64,13 +64,13 @@ if (!in_array(DBMS, ['sqlite', 'sqlite3'])) {
foreach ($database_tables as $table) {
$db->execute("DROP TABLE ".$table);
}
- $db->execute("DROP DATABASE IF EXISTS ".DB_NAME);
- $db->execute("CREATE DATABASE ".DB_NAME);
+ $db->execute("DROP DATABASE IF EXISTS " . DB_NAME);
+ $db->execute("CREATE DATABASE " . DB_NAME);
$db->disconnect();
$db->connect(); // default connection goes to actual DB
} else {
- @unlink(CRAWL_DIR."/data/".DB_NAME.".db");
+ @unlink(CRAWL_DIR."/data/" . DB_NAME . ".db");
$db = new $db_class();
$db->connect();
}
@@ -78,7 +78,7 @@ if (!$profile_model->createDatabaseTables($db, $dbinfo)) {
echo "\n\nCouldn't create database tables!!!\n\n";
exit();
}
-$db->execute("INSERT INTO VERSION VALUES (".YIOOP_VERSION.")");
+$db->execute("INSERT INTO VERSION VALUES (" . YIOOP_VERSION . ")");
$creation_time = L\microTimestamp();
//numerical value of the blank password
$profile = $profile_model->getProfile(WORK_DIRECTORY);
@@ -91,9 +91,10 @@ $temp = bcpow($sha1_of_blank_string . '', '2');
$zkp_password = ($new_profile['FIAT_SHAMIR_MODULUS']) ?
bcmod($temp, $new_profile['FIAT_SHAMIR_MODULUS']) : "";
//default account is root without a password
-$sql ="INSERT INTO USERS VALUES (".ROOT_ID.", 'admin', 'admin','root',
+$sql ="INSERT INTO USERS VALUES (" . ROOT_ID . ", 'admin', 'admin','" .
+ ROOT_USERNAME . "',
'root@dev.null', '".L\crawlCrypt('')."', '".ACTIVE_STATUS.
- "', '".L\crawlCrypt('root'.AUTH_KEY.$creation_time).
+ "', '".L\crawlCrypt(ROOT_USERNAME . AUTH_KEY . $creation_time).
"', 0,'$creation_time', 0, 0, '$zkp_password')";
$db->execute($sql);
/* public account is an inactive account for used for public permissions