finishing #86 by jerome (adding sql to install, changing primary key,

..)
This commit is contained in:
Pepijn Over 2014-05-04 13:36:17 +02:00
parent 19ae7db77a
commit c58a91fc3b
4 changed files with 15 additions and 5 deletions

View File

@ -10,6 +10,7 @@ not yet released
* #75: Test mode for email and SMS settings. * #75: Test mode for email and SMS settings.
* #82: Added Danish translation. * #82: Added Danish translation.
* #83: Invalid redirect after switching languages and logging in. * #83: Invalid redirect after switching languages and logging in.
* #86: Different design styles on status page (list, table).
* Support for Danish SMS provider Smsit <http://www.smsit.dk/> * Support for Danish SMS provider Smsit <http://www.smsit.dk/>
* Composer added for dependencies. * Composer added for dependencies.

View File

@ -452,7 +452,7 @@ class User {
} }
$this->user_preferences = array(); $this->user_preferences = array();
foreach($this->db_connection->query('SELECT * FROM ' . PSM_DB_PREFIX . 'users_preferences WHERE user_id = ' . $this->user_id) as $row) { foreach($this->db_connection->query('SELECT `key`,`value` FROM `' . PSM_DB_PREFIX . 'users_preferences` WHERE `user_id` = ' . $this->user_id) as $row) {
$this->user_preferences[$row['key']] = $row['value']; $this->user_preferences[$row['key']] = $row['value'];
} }
} }
@ -486,9 +486,9 @@ class User {
if($this->user_preferences[$key] == $value) { if($this->user_preferences[$key] == $value) {
return; // no change return; // no change
} }
$sql = 'UPDATE ' . PSM_DB_PREFIX . 'users_preferences SET `key` = ?, `value` = ? WHERE `user_id` = ?'; $sql = 'UPDATE `' . PSM_DB_PREFIX . 'users_preferences` SET `key` = ?, `value` = ? WHERE `user_id` = ?';
} else{ } else{
$sql = 'INSERT INTO ' . PSM_DB_PREFIX . 'users_preferences SET `key` = ?, `value` = ?, `user_id` = ?'; $sql = 'INSERT INTO `' . PSM_DB_PREFIX . 'users_preferences` SET `key` = ?, `value` = ?, `user_id` = ?';
} }
$sth = $this->db_connection->prepare($sql); $sth = $this->db_connection->prepare($sql);
$sth->execute(array($key, $value, $this->user_id)); $sth->execute(array($key, $value, $this->user_id));

View File

@ -181,6 +181,12 @@ class Installer {
PRIMARY KEY (`user_id`), PRIMARY KEY (`user_id`),
UNIQUE KEY `unique_username` (`user_name`) UNIQUE KEY `unique_username` (`user_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;", ) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'users_preferences' => "CREATE TABLE IF NOT EXISTS `" . PSM_DB_PREFIX . "users_preferences` (
`user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`, `key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
PSM_DB_PREFIX . 'users_servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` ( PSM_DB_PREFIX . 'users_servers' => "CREATE TABLE `" . PSM_DB_PREFIX . "users_servers` (
`user_id` INT( 11 ) UNSIGNED NOT NULL , `user_id` INT( 11 ) UNSIGNED NOT NULL ,
`server_id` INT( 11 ) UNSIGNED NOT NULL , `server_id` INT( 11 ) UNSIGNED NOT NULL ,
@ -389,7 +395,7 @@ class Installer {
`user_id` int(11) unsigned NOT NULL, `user_id` int(11) unsigned NOT NULL,
`key` varchar(255) NOT NULL, `key` varchar(255) NOT NULL,
`value` varchar(255) NOT NULL, `value` varchar(255) NOT NULL,
PRIMARY KEY (`user_id`) PRIMARY KEY (`user_id`, `key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
$this->execSQL($queries); $this->execSQL($queries);
} }

View File

@ -123,7 +123,7 @@ fieldset {
} }
.tight { .tight {
width: 10px; width: 10px;
white-space: nowrap; white-space: nowrap;
} }
.nowrap { .nowrap {
white-space: nowrap; white-space: nowrap;
@ -237,6 +237,9 @@ legend {
padding: 6px 8px; padding: 6px 8px;
vertical-align: middle; vertical-align: middle;
} }
.row-offline, .row-online {
cursor: pointer;
}
.row-offline td, .row-offline tr:hover td { .row-offline td, .row-offline tr:hover td {
background: #a00000 !important; background: #a00000 !important;
color: #f7cece; color: #f7cece;