Esempio n. 1
0
      exec_query("UPDATE ${p}grp SET grp_name = ".
          quoteForSql($name).
          " WHERE grp_ID = $group[grp_ID]");
    }
    
}

if ((int)$revisionDB < 1326) {
    Logger::logfile("-- update to r1326");
    exec_query("INSERT INTO ${p}var (`var`,`value`) VALUES('editLimit','-')");
}

if ((int)$revisionDB < 1327) {
    Logger::logfile("-- update to r1327");
    $result = $database->queryAll("SELECT value FROM ${p}var WHERE var = 'defaultTimezone'");
    $timezone = quoteForSql($result[0][0]);
    exec_query("ALTER TABLE ${p}knd ADD COLUMN `knd_timezone` varchar(255) NOT NULL DEFAULT $timezone");
    exec_query("ALTER TABLE ${p}knd ALTER COLUMN `knd_timezone` DROP DEFAULT");
}

if ((int)$revisionDB < 1328) {
    Logger::logfile("-- update to r1328");
    exec_query("DELETE FROM ${p}var WHERE var='login' LIMIT 1;");
}

if ((int)$revisionDB < 1331) {
    Logger::logfile("-- update to r1331");
    exec_query("ALTER TABLE ${p}evt ADD COLUMN `evt_assignable` TINYINT(1) NOT NULL DEFAULT '0';");
    $result = $database->queryAll("SELECT DISTINCT evt_ID FROM ${p}pct_evt");
    foreach ($result as $row) {
      exec_query("UPDATE ${p}evt SET evt_assignable=1 WHERE evt_ID=".$row[0]);
Esempio n. 2
0
// GROUPS
$defaultGroup = $kga['lang']['defaultGroup'];
$query = "INSERT INTO `{$p}groups` (`name`) VALUES ('admin');";
exec_query($query);
// MISC
$query = "INSERT INTO `{$p}activities` (`activityID`, `name`, `comment`) VALUES (1, '" . $kga['lang']['testActivity'] . "', '');";
exec_query($query);
$query = "INSERT INTO `{$p}customers` (`customerID`, `name`, `comment`, `company`, `vat`, `contact`, `street`, `zipcode`, `city`, `phone`, `fax`, `mobile`, `mail`, `homepage`, `timezone`) VALUES (1, '" . $kga['lang']['testCustomer'] . "', '', '', '', '', '', '', '', '', '', '', '',''," . quoteForSql($_REQUEST['timezone']) . ");";
exec_query($query);
$query = "INSERT INTO `{$p}projects` (`projectID`, `customerID`, `name`, `comment`) VALUES (1, 1, '" . $kga['lang']['testProject'] . "', '');";
exec_query($query);
// ADMIN USER
$adminPassword = md5($kga['password_salt'] . 'changeme' . $kga['password_salt']);
$query = "INSERT INTO `{$p}users` (`userID`,`name`,`mail`,`password`, `globalRoleID` ) VALUES ('{$randomAdminID}','admin','*****@*****.**','{$adminPassword}',1);";
exec_query($query);
$query = "INSERT INTO `{$p}preferences` (`userID`,`option`,`value`) VALUES\n('{$randomAdminID}','ui.rowlimit','100'),\n('{$randomAdminID}','ui.skin','standard'),\n('{$randomAdminID}','ui.showCommentsByDefault','0'),\n('{$randomAdminID}','ui.hideOverlapLines','1'),\n('{$randomAdminID}','ui.showTrackingNumber','1'),\n('{$randomAdminID}','timezone'," . quoteForSql($_REQUEST['timezone']) . ");";
exec_query($query);
// CROSS TABLES
$query = "INSERT INTO `{$p}groups_users` (`groupID`,`userID`, `membershipRoleID`) VALUES ('1','{$randomAdminID}','1');";
exec_query($query);
$query = "INSERT INTO `{$p}groups_activities` (`groupID`, `activityID`) VALUES (1, 1);";
exec_query($query);
$query = "INSERT INTO `{$p}groups_customers` (`groupID`, `customerID`) VALUES (1, 1);";
exec_query($query);
$query = "INSERT INTO `{$p}groups_projects` (`groupID`, `projectID`) VALUES (1, 1);";
exec_query($query);
// VARS
$query = "INSERT INTO `{$p}configuration` (`option`, `value`) VALUES ('version', '" . $kga['version'] . "');";
exec_query($query);
$query = "INSERT INTO `{$p}configuration` (`option`, `value`) VALUES ('login', '1');";
exec_query($query);