Commit 2d3419cab224673396bf9b4d86025f49de553f5f

Authored by Megan
1 parent 3013fe57

Added check for electronic signatures. When enabled, WebDAV is disabled.

Fixed.

Committed by: Megan Watson
Reviewed by: Kevin Cyster
ktwebdav/lib/KTWebDAVServer.inc.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 *
... ... @@ -228,7 +228,7 @@ class KTWebDAVServer extends HTTP_WebDAV_Server
228 228  
229 229 $ident = 'KTWEBDAV';
230 230 $conf = array('mode' => 0644, 'timeFormat' => '%X %x');
231   - $logger = &Log::singleton('file', '../var/log/ktwebdav-' . date('Y-m-d') . '.txt', $ident, $conf);
  231 + $logger = &Log::singleton('file', '../../var/log/ktwebdav-' . date('Y-m-d') . '.txt', $ident, $conf);
232 232 if ($type == 'error') $logger->log($entry, PEAR_LOG_ERR);
233 233 else $logger->log($entry, PEAR_LOG_INFO);
234 234 return true;
... ... @@ -272,6 +272,27 @@ class KTWebDAVServer extends HTTP_WebDAV_Server
272 272 $this->ktwebdavLog('_SERVER is ' . print_r($_SERVER, true), 'info', true);
273 273 }
274 274  
  275 + // Check for electronic signatures - if enabled exit
  276 + $oConfig =& KTConfig::getSingleton();
  277 + $enabled = $oConfig->get('e_signatures/enableApiSignatures', false);
  278 + if($enabled){
  279 + $this->ktwebdavLog('Electronic Signatures have been enabled, disabling WebDAV.', 'info');
  280 +
  281 + $data = "<html><head><title>KTWebDAV - The KnowledgeTree WebDAV Server</title></head>";
  282 + $data .= "<body>";
  283 + $data .= "<div align=\"center\"><IMG src=\"../resources/graphics/ktlogo-topbar_base.png\" width=\"308\" height=\"61\" border=\"0\"></div><br>";
  284 + $data .= "<div align=\"center\"><h2><strong>Welcome to KnowledgeTree WebDAV Server</strong></h2></div><br><br>";
  285 + $data .= "<div align=\"center\">The WebDAV Server has been disabled!</div><br><br>";
  286 + $data .= "<div align=\"center\">Electronic Signatures are enabled.</div><br><br>";
  287 + $data .= "</body>";
  288 +
  289 + header('HTTP/1.1 403 Forbidden');
  290 + header('Content-Type: text/html; charset="utf-8"');
  291 + echo $data;
  292 +
  293 + exit(0);
  294 + }
  295 +
275 296 // Get the client info
276 297 $this->checkSafeMode();
277 298  
... ...