summaryrefslogtreecommitdiffstats
path: root/modules-available
diff options
context:
space:
mode:
authorJannik Schönartz2017-02-21 17:32:26 +0100
committerJannik Schönartz2017-02-21 17:32:26 +0100
commitfe4993a7bc08bc20b7d84c82597f852e6e7f7282 (patch)
tree25907032851c58d9260a294b0f4cee09170179df /modules-available
parentTypos behoben, und die cretendials werden auserhalb der Klasse gesetzt (diff)
downloadslx-admin-fe4993a7bc08bc20b7d84c82597f852e6e7f7282.tar.gz
slx-admin-fe4993a7bc08bc20b7d84c82597f852e6e7f7282.tar.xz
slx-admin-fe4993a7bc08bc20b7d84c82597f852e6e7f7282.zip
Database: Changed login/passwd to credentials. install.php needs to be executed.
Diffstat (limited to 'modules-available')
-rw-r--r--modules-available/locationinfo/api.inc.php12
-rw-r--r--modules-available/locationinfo/install.inc.php36
-rw-r--r--modules-available/locationinfo/page.inc.php16
3 files changed, 46 insertions, 18 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index d854df64..4b3a0462 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -20,16 +20,16 @@ function HandleParameters() {
} elseif ($getAction == "config") {
$getRoomID = Request::get('id', 0, 'int');
getConfig($getRoomID);
- } elseif ($getAction == "calendar") {
- $getRoomID = Request::get('id', 0, 'int');
- echo getCalendar($getRoomID);
- } elseif ($getAction == "roomtree") {
- $roomIDS = Request::get('ids', 0, 'string');
- getRoomTree($roomIDS);
} elseif ($getAction == "pcstates") {
$roomIDs = Request::get('id', 0, 'string');
$array = getMultipleInformations($roomIDs);
echo getPcStates($array);
+ } elseif ($getAction == "roomtree") {
+ $roomIDS = Request::get('ids', 0, 'string');
+ getRoomTree($roomIDS);
+ } elseif ($getAction == "calendar") {
+ $getRoomID = Request::get('id', 0, 'int');
+ echo getCalendar($getRoomID);
} elseif ($getAction == "calendars") {
$roomIDS = Request::get('ids', 0, 'string');
getCalendars($roomIDS);
diff --git a/modules-available/locationinfo/install.inc.php b/modules-available/locationinfo/install.inc.php
index 4494ffdd..c6e8f1f3 100644
--- a/modules-available/locationinfo/install.inc.php
+++ b/modules-available/locationinfo/install.inc.php
@@ -5,7 +5,7 @@ $res = array();
$res[] = tableCreate('location_info', '
`locationid` INT(11) NOT NULL,
`serverid` INT(11) NOT NULL,
- `serverroomid` INT(11) NOT NULL,
+ `serverroomid` VARCHAR(2000),
`hidden` BOOLEAN NOT NULL DEFAULT 0,
`openingtime` VARCHAR(2000),
`config` VARCHAR(2000),
@@ -19,12 +19,42 @@ $res[] = tableCreate('setting_location_info', '
`servername` VARCHAR(2000) NOT NULL,
`serverurl` VARCHAR(2000) NOT NULL,
`servertype` VARCHAR(100) NOT NULL,
- `login` VARCHAR(100) NOT NULL,
- `passwd` VARCHAR(150) NOT NULL,
+ `auth` VARCHAR(100) NOT NULL,
PRIMARY KEY (`serverid`)
');
// Create response for browser
+if (!tableHasColumn('setting_location_info', 'credentials')) {
+ $ret = Database::exec("ALTER TABLE `setting_location_info` ADD `credentials` VARCHAR(2000) AFTER `servertype`");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Adding column credentials failed: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+
+if (tableHasColumn('setting_location_info', 'login')) {
+ $ret = Database::exec("ALTER TABLE `setting_location_info` DROP COLUMN login");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Dropping column login failed: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+
+if (tableHasColumn('setting_location_info', 'passwd')) {
+ $ret = Database::exec("ALTER TABLE `setting_location_info` DROP COLUMN passwd");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Dropping column passwd failed: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+
+if (tableHasColumn('location_info', 'serverroomid')) {
+ $ret = Database::exec("ALTER TABLE `location_info` MODIFY serverroomid VARCHAR(2000)");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Updateing column serverroomid failed: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
if (tableHasColumn('location_info', 'openingtime')) {
$ret = Database::exec("ALTER TABLE `location_info` MODIFY openingtime VARCHAR(2000)");
diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php
index 13ac09b1..7dae0762 100644
--- a/modules-available/locationinfo/page.inc.php
+++ b/modules-available/locationinfo/page.inc.php
@@ -61,14 +61,12 @@ class Page_LocationInfo extends Page
private function updateServer() {
$id = Request::post('id', 0, 'int');
if ($id == 0) {
- Database::exec("INSERT INTO `setting_location_info` (servername, serverurl, servertype, login, passwd) VALUES (:name, :url, :type, :login, :passwd)",
- array('name' => Request::post('name', '', 'string'), 'url' => Request::post('url', '', 'string'), 'type' => Request::post('type', '', 'string'),
- 'login' => Request::post('user', '', 'string'), 'passwd' => Request::post('password', '', 'string')));
+ Database::exec("INSERT INTO `setting_location_info` (servername, serverurl, servertype) VALUES (:name, :url, :type)",
+ array('name' => Request::post('name', '', 'string'), 'url' => Request::post('url', '', 'string'), 'type' => Request::post('type', '', 'string')));
} else {
- Database::exec("INSERT INTO `setting_location_info` (serverid, servername, servertype, serverurl, login, passwd) VALUES (:id, :name, :type, :url, :login, :passwd)
- ON DUPLICATE KEY UPDATE servername=:name, serverurl=:url, servertype=:type, login=:login, passwd=:passwd",
- array('id' => $id, 'name' => Request::post('name', '', 'string'), 'url' => Request::post('url', '', 'string'), 'type' => Request::post('type', '', 'string'),
- 'login' => Request::post('user', '', 'string'), 'passwd' => Request::post('password', '', 'string')));
+ Database::exec("INSERT INTO `setting_location_info` (serverid, servername, servertype, serverurl) VALUES (:id, :name, :type, :url)
+ ON DUPLICATE KEY UPDATE servername=:name, serverurl=:url, servertype=:type",
+ array('id' => $id, 'name' => Request::post('name', '', 'string'), 'url' => Request::post('url', '', 'string'), 'type' => Request::post('type', '', 'string')));
}
Util::redirect('?do=locationinfo&action=infoscreen');
}
@@ -349,8 +347,8 @@ class Page_LocationInfo extends Page
}
*/
$server['url'] = $db['serverurl'];
- $server['user'] = $db['login'];
- $server['password'] = $db['passwd'];
+ $server['user'] = "TODO: Auth";
+ $server['password'] = "Needs a change to Auth";
$serverlist[] = $server;
}