diff --git a/ktapi/KTAPISession.inc.php b/ktapi/KTAPISession.inc.php
index 097a640..4b7805b 100644
--- a/ktapi/KTAPISession.inc.php
+++ b/ktapi/KTAPISession.inc.php
@@ -282,7 +282,7 @@ class KTAPI_UserSession extends KTAPI_Session
if ($validateSession)
{
- $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'";
+ $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'";
$row = DBUtil::getOneResult($sql);
if (PEAR::isError($row))
@@ -301,9 +301,9 @@ class KTAPI_UserSession extends KTAPI_Session
$session = session_id();
$newSessionRequired = false;
- if ($app == 'ws')
+ if ($app != 'webapp')
{
- $sql = "select id from active_sessions where user_id=$user_id AND apptype='ws' and ip='$ip'";
+ $sql = "select id from active_sessions where user_id=$user_id AND apptype='$app' and ip='$ip'";
$row = DBUtil::getOneResult($sql);
if (empty($row))
diff --git a/ktwebservice/KTDownloadManager.inc.php b/ktwebservice/KTDownloadManager.inc.php
index f5b3e4b..1779615 100644
--- a/ktwebservice/KTDownloadManager.inc.php
+++ b/ktwebservice/KTDownloadManager.inc.php
@@ -132,7 +132,7 @@ class KTDownloadManager
*
* @access public
*/
- function download($document_id, $hash, $version = null)
+ function download($document_id, $hash, $version = null, $apptype = 'ws')
{
$sql = "SELECT 1 FROM download_files WHERE hash=? AND session=? AND document_id=?";
$rows = DBUtil::getResultArray(array($sql, array($hash, $this->session, $document_id)));
@@ -156,7 +156,7 @@ class KTDownloadManager
$storage =& KTStorageManagerUtil::getSingleton();
$ktapi = &new KTAPI();
- $res = $ktapi->get_active_session($this->session);
+ $res = $ktapi->get_active_session($this->session, null, $apptype);
if (PEAR::isError($res))
{
return $res;
diff --git a/ktwebservice/download.php b/ktwebservice/download.php
index 8f3bea0..9adb4a0 100644
--- a/ktwebservice/download.php
+++ b/ktwebservice/download.php
@@ -8,31 +8,31 @@
* Document Management Made Simple
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
- * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
+ * must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
@@ -64,6 +64,7 @@ if (!array_key_exists('u',$_GET))
}
$session = $_GET['u'];
+$apptype = (isset($_GET['apptype'])) ? $_GET['apptype'] : 'ws';
require_once('../config/dmsDefaults.php');
require_once('../ktapi/ktapi.inc.php');
@@ -72,7 +73,7 @@ require_once('KTDownloadManager.inc.php');
$download_manager = new KTDownloadManager();
$download_manager->set_session($session);
-$response = $download_manager->download($document_id, $hash);
+$response = $download_manager->download($document_id, $hash, null, $apptype);
if (PEAR::isError($response))
{
$msg = urlencode($response->getMessage());
@@ -80,4 +81,4 @@ if (PEAR::isError($response))
exit;
}
-?>
+?>
\ No newline at end of file
diff --git a/ktwebservice/upload.php b/ktwebservice/upload.php
index 47551bb..67f4ffc 100644
--- a/ktwebservice/upload.php
+++ b/ktwebservice/upload.php
@@ -10,31 +10,31 @@
* Document Management Made Simple
* Copyright (C) 2008, 2009 KnowledgeTree Inc.
* Portions copyright The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
- * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
+ *
+ * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
* California 94120-7775, or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
+ * must display the words "Powered by KnowledgeTree" and retain the original
* copyright notice.
* Contributor( s): ______________________________________
*
@@ -94,9 +94,11 @@ if ($action == 'C')
require_once('../ktapi/ktapi.inc.php');
require_once('KTUploadManager.inc.php');
+$apptype = (isset($_POST['apptype'])) ? $_POST['apptype'] : 'ws';
$session_id = $_POST['session_id'];
+
$ktapi = new KTAPI();
-$session = $ktapi->get_active_session($session_id);
+$session = $ktapi->get_active_session($session_id, null, $apptype);
if (PEAR::isError($session))
{
respond(4, $session->getMessage());
@@ -204,4 +206,4 @@ function respond($code, $msg, $uploads=array())
}
-?>
+?>
\ No newline at end of file