Commit 1a750644add54c03973f75f2548a0f44aa795a58
1 parent
48338aea
Updated session management to allow for additional webservice apptypes for compa…
…tibility with the Office Addin. Committed by: Megan Watson Reviewed by: Martin Kirsten
Showing
4 changed files
with
30 additions
and
27 deletions
ktapi/KTAPISession.inc.php
| ... | ... | @@ -282,7 +282,7 @@ class KTAPI_UserSession extends KTAPI_Session |
| 282 | 282 | |
| 283 | 283 | if ($validateSession) |
| 284 | 284 | { |
| 285 | - $sql = "SELECT count(*) >= u.max_sessions as over_limit FROM active_sessions ass INNER JOIN users u ON ass.user_id=u.id WHERE ass.user_id = $user_id AND ass.apptype != 'ws'"; | |
| 285 | + $sql = "SELECT count(*) >= u.max_sessions as over_limit FROM active_sessions ass INNER JOIN users u ON ass.user_id=u.id WHERE ass.user_id = $user_id AND ass.apptype = 'webapp'"; | |
| 286 | 286 | $row = DBUtil::getOneResult($sql); |
| 287 | 287 | |
| 288 | 288 | if (PEAR::isError($row)) |
| ... | ... | @@ -301,9 +301,9 @@ class KTAPI_UserSession extends KTAPI_Session |
| 301 | 301 | |
| 302 | 302 | $session = session_id(); |
| 303 | 303 | $newSessionRequired = false; |
| 304 | - if ($app == 'ws') | |
| 304 | + if ($app != 'webapp') | |
| 305 | 305 | { |
| 306 | - $sql = "select id from active_sessions where user_id=$user_id AND apptype='ws' and ip='$ip'"; | |
| 306 | + $sql = "select id from active_sessions where user_id=$user_id AND apptype='$app' and ip='$ip'"; | |
| 307 | 307 | |
| 308 | 308 | $row = DBUtil::getOneResult($sql); |
| 309 | 309 | if (empty($row)) | ... | ... |
ktwebservice/KTDownloadManager.inc.php
| ... | ... | @@ -132,7 +132,7 @@ class KTDownloadManager |
| 132 | 132 | * |
| 133 | 133 | * @access public |
| 134 | 134 | */ |
| 135 | - function download($document_id, $hash, $version = null) | |
| 135 | + function download($document_id, $hash, $version = null, $apptype = 'ws') | |
| 136 | 136 | { |
| 137 | 137 | $sql = "SELECT 1 FROM download_files WHERE hash=? AND session=? AND document_id=?"; |
| 138 | 138 | $rows = DBUtil::getResultArray(array($sql, array($hash, $this->session, $document_id))); |
| ... | ... | @@ -156,7 +156,7 @@ class KTDownloadManager |
| 156 | 156 | $storage =& KTStorageManagerUtil::getSingleton(); |
| 157 | 157 | |
| 158 | 158 | $ktapi = &new KTAPI(); |
| 159 | - $res = $ktapi->get_active_session($this->session); | |
| 159 | + $res = $ktapi->get_active_session($this->session, null, $apptype); | |
| 160 | 160 | if (PEAR::isError($res)) |
| 161 | 161 | { |
| 162 | 162 | return $res; | ... | ... |
ktwebservice/download.php
| ... | ... | @@ -8,31 +8,31 @@ |
| 8 | 8 | * Document Management Made Simple |
| 9 | 9 | * Copyright (C) 2008, 2009 KnowledgeTree Inc. |
| 10 | 10 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 11 | - * | |
| 11 | + * | |
| 12 | 12 | * This program is free software; you can redistribute it and/or modify it under |
| 13 | 13 | * the terms of the GNU General Public License version 3 as published by the |
| 14 | 14 | * Free Software Foundation. |
| 15 | - * | |
| 15 | + * | |
| 16 | 16 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 17 | 17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 18 | 18 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 19 | 19 | * details. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You should have received a copy of the GNU General Public License |
| 22 | 22 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 | - * | |
| 24 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 23 | + * | |
| 24 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 25 | 25 | * California 94120-7775, or email info@knowledgetree.com. |
| 26 | - * | |
| 26 | + * | |
| 27 | 27 | * The interactive user interfaces in modified source and object code versions |
| 28 | 28 | * of this program must display Appropriate Legal Notices, as required under |
| 29 | 29 | * Section 5 of the GNU General Public License version 3. |
| 30 | - * | |
| 30 | + * | |
| 31 | 31 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 32 | 32 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 33 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 33 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 34 | 34 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 35 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 35 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 36 | 36 | * copyright notice. |
| 37 | 37 | * Contributor( s): ______________________________________ |
| 38 | 38 | * |
| ... | ... | @@ -64,6 +64,7 @@ if (!array_key_exists('u',$_GET)) |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $session = $_GET['u']; |
| 67 | +$apptype = (isset($_GET['apptype'])) ? $_GET['apptype'] : 'ws'; | |
| 67 | 68 | |
| 68 | 69 | require_once('../config/dmsDefaults.php'); |
| 69 | 70 | require_once('../ktapi/ktapi.inc.php'); |
| ... | ... | @@ -72,7 +73,7 @@ require_once('KTDownloadManager.inc.php'); |
| 72 | 73 | $download_manager = new KTDownloadManager(); |
| 73 | 74 | $download_manager->set_session($session); |
| 74 | 75 | |
| 75 | -$response = $download_manager->download($document_id, $hash); | |
| 76 | +$response = $download_manager->download($document_id, $hash, null, $apptype); | |
| 76 | 77 | if (PEAR::isError($response)) |
| 77 | 78 | { |
| 78 | 79 | $msg = urlencode($response->getMessage()); |
| ... | ... | @@ -80,4 +81,4 @@ if (PEAR::isError($response)) |
| 80 | 81 | exit; |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | -?> |
| 85 | +?> | |
| 84 | 86 | \ No newline at end of file | ... | ... |
ktwebservice/upload.php
| ... | ... | @@ -10,31 +10,31 @@ |
| 10 | 10 | * Document Management Made Simple |
| 11 | 11 | * Copyright (C) 2008, 2009 KnowledgeTree Inc. |
| 12 | 12 | * Portions copyright The Jam Warehouse Software (Pty) Limited |
| 13 | - * | |
| 13 | + * | |
| 14 | 14 | * This program is free software; you can redistribute it and/or modify it under |
| 15 | 15 | * the terms of the GNU General Public License version 3 as published by the |
| 16 | 16 | * Free Software Foundation. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 19 | 19 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 20 | 20 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 21 | 21 | * details. |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * You should have received a copy of the GNU General Public License |
| 24 | 24 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 25 | - * | |
| 26 | - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 25 | + * | |
| 26 | + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, | |
| 27 | 27 | * California 94120-7775, or email info@knowledgetree.com. |
| 28 | - * | |
| 28 | + * | |
| 29 | 29 | * The interactive user interfaces in modified source and object code versions |
| 30 | 30 | * of this program must display Appropriate Legal Notices, as required under |
| 31 | 31 | * Section 5 of the GNU General Public License version 3. |
| 32 | - * | |
| 32 | + * | |
| 33 | 33 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 34 | 34 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 35 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 35 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 36 | 36 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 37 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 37 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 38 | 38 | * copyright notice. |
| 39 | 39 | * Contributor( s): ______________________________________ |
| 40 | 40 | * |
| ... | ... | @@ -94,9 +94,11 @@ if ($action == 'C') |
| 94 | 94 | require_once('../ktapi/ktapi.inc.php'); |
| 95 | 95 | require_once('KTUploadManager.inc.php'); |
| 96 | 96 | |
| 97 | +$apptype = (isset($_POST['apptype'])) ? $_POST['apptype'] : 'ws'; | |
| 97 | 98 | $session_id = $_POST['session_id']; |
| 99 | + | |
| 98 | 100 | $ktapi = new KTAPI(); |
| 99 | -$session = $ktapi->get_active_session($session_id); | |
| 101 | +$session = $ktapi->get_active_session($session_id, null, $apptype); | |
| 100 | 102 | if (PEAR::isError($session)) |
| 101 | 103 | { |
| 102 | 104 | respond(4, $session->getMessage()); |
| ... | ... | @@ -204,4 +206,4 @@ function respond($code, $msg, $uploads=array()) |
| 204 | 206 | } |
| 205 | 207 | |
| 206 | 208 | |
| 207 | 209 | -?> |
| 210 | +?> | |
| 208 | 211 | \ No newline at end of file | ... | ... |