Commit da698969afc954a496045821e5c17414f6913fa5

Authored by kevin_fourie
1 parent fb8e0077

Merged in from DEV trunk...

"KTS-1994"
"KT webservice: add_document not working"
Fixed. Some types still incorrect.

Reviewed By: Kevin Fourie

"KTS-2020"
"Web Service functions for 'small_document' need to be aliased."
Implemented.

Reviewed By: Kevin Fourie

"KTS-1781"
"New Upgrade Utility should be password protected"
Fixed.

Reviewed By: Kevin Fourie

"KTS-1781"
"New Upgrade Utility should be password protected"
Implemented. Also applied some recommendations to 'back' and 'next' vs previous 'home' and 'continue'.

Reviewed By: Kevin Fourie

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@6699 c91229c3-7414-0410-bfa2-8a42b809f60b
config/config.ini
@@ -273,3 +273,8 @@ cacheDirectory = ${varDirectory}/cache @@ -273,3 +273,8 @@ cacheDirectory = ${varDirectory}/cache
273 debug = off 273 debug = off
274 ; To allow write access to WebDAV clients set safe mode to "off" below 274 ; To allow write access to WebDAV clients set safe mode to "off" below
275 safemode = on 275 safemode = on
  276 +
  277 +[backup]
  278 +; Identify location of kt-backup for database backups.
  279 +;backupDirectory=c:/kt-backups
  280 +;backupDirectory=/tmp/kt-backups
ktapi/ktapi.inc.php
@@ -419,9 +419,9 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -419,9 +419,9 @@ class KTAPI_Folder extends KTAPI_FolderItem
419 function get_detail() 419 function get_detail()
420 { 420 {
421 $detail = array( 421 $detail = array(
422 - 'id'=>$this->folderid, 422 + 'id'=>(int) $this->folderid,
423 'folder_name'=>$this->get_folder_name(), 423 'folder_name'=>$this->get_folder_name(),
424 - 'parent_id'=>$this->get_parent_folder_id(), 424 + 'parent_id'=>(int) $this->get_parent_folder_id(),
425 'full_path'=>$this->get_full_path(), 425 'full_path'=>$this->get_full_path(),
426 ); 426 );
427 427
@@ -430,7 +430,7 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -430,7 +430,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
430 430
431 function get_parent_folder_id() 431 function get_parent_folder_id()
432 { 432 {
433 - return $this->folder->getParentID(); 433 + return (int) $this->folder->getParentID();
434 } 434 }
435 435
436 function get_folder_name() 436 function get_folder_name()
@@ -446,7 +446,7 @@ class KTAPI_Folder extends KTAPI_FolderItem @@ -446,7 +446,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
446 */ 446 */
447 function get_folderid() 447 function get_folderid()
448 { 448 {
449 - return $this->folderid; 449 + return (int) $this->folderid;
450 } 450 }
451 451
452 /** 452 /**
@@ -1864,8 +1864,8 @@ class KTAPI_Document extends KTAPI_FolderItem @@ -1864,8 +1864,8 @@ class KTAPI_Document extends KTAPI_FolderItem
1864 $username='n/a'; 1864 $username='n/a';
1865 } 1865 }
1866 $detail['updated_by'] = $username; 1866 $detail['updated_by'] = $username;
1867 - $detail['document_id'] = $document->getId();  
1868 - $detail['folder_id'] = $document->getFolderID(); 1867 + $detail['document_id'] = (int) $document->getId();
  1868 + $detail['folder_id'] = (int) $document->getFolderID();
1869 1869
1870 $workflowid = $document->getWorkflowId(); 1870 $workflowid = $document->getWorkflowId();
1871 if (is_numeric($workflowid)) 1871 if (is_numeric($workflowid))
ktwebservice/webservice.php
@@ -378,6 +378,12 @@ class KTWebService @@ -378,6 +378,12 @@ class KTWebService
378 'out' => array( 'return' => "{urn:$this->namespace}kt_response" ), 378 'out' => array( 'return' => "{urn:$this->namespace}kt_response" ),
379 ); 379 );
380 380
  381 + // checkin_base64_document
  382 + $this->__dispatch_map['checkin_base64_document'] =
  383 + array('in' => array('session_id'=>'string','document_id'=>'int','filename'=>'string','reason' =>'string','base64' =>'string', 'major_update'=>'boolean' ),
  384 + 'out' => array( 'return' => "{urn:$this->namespace}kt_response" ),
  385 + 'alias' => 'checkin_small_document'
  386 + );
381 387
382 // add_document 388 // add_document
383 $this->__dispatch_map['add_document'] = 389 $this->__dispatch_map['add_document'] =
@@ -390,7 +396,16 @@ class KTWebService @@ -390,7 +396,16 @@ class KTWebService
390 array('in' => array('session_id'=>'string','folder_id'=>'int','title'=>'string','filename'=>'string','documentype' =>'string','base64' =>'string' ), 396 array('in' => array('session_id'=>'string','folder_id'=>'int','title'=>'string','filename'=>'string','documentype' =>'string','base64' =>'string' ),
391 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ), 397 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ),
392 ); 398 );
393 - 399 +
  400 + // add_base64_document
  401 + $this->__dispatch_map['add_base64_document'] =
  402 + array('in' => array('session_id'=>'string','folder_id'=>'int','title'=>'string','filename'=>'string','documentype' =>'string','base64' =>'string' ),
  403 + 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ),
  404 + 'alias' => 'add_small_document'
  405 +
  406 + );
  407 +
  408 +
394 // get_document_detail_by_name 409 // get_document_detail_by_name
395 $this->__dispatch_map['get_document_detail_by_name'] = 410 $this->__dispatch_map['get_document_detail_by_name'] =
396 array('in' => array('session_id' => 'string', 'document_name' => 'string', 'what'=>'string' ), 411 array('in' => array('session_id' => 'string', 'document_name' => 'string', 'what'=>'string' ),
@@ -409,6 +424,12 @@ class KTWebService @@ -409,6 +424,12 @@ class KTWebService
409 'out' => array('return' => "{urn:$this->namespace}kt_response" ), 424 'out' => array('return' => "{urn:$this->namespace}kt_response" ),
410 ); 425 );
411 426
  427 + // checkout_base64_document
  428 + $this->__dispatch_map['checkout_base64_document'] =
  429 + array('in' => array('session_id'=>'string','document_id'=>'int','reason' =>'string','download' => 'boolean'),
  430 + 'out' => array('return' => "{urn:$this->namespace}kt_response" ),
  431 + 'alias' => 'checkout_small_document'
  432 + );
412 433
413 // undo_document_checkout 434 // undo_document_checkout
414 $this->__dispatch_map['undo_document_checkout'] = 435 $this->__dispatch_map['undo_document_checkout'] =
@@ -428,7 +449,13 @@ class KTWebService @@ -428,7 +449,13 @@ class KTWebService
428 'out' => array('return' => "{urn:$this->namespace}kt_response" ), 449 'out' => array('return' => "{urn:$this->namespace}kt_response" ),
429 ); 450 );
430 451
431 - 452 + // download_base64_document
  453 + $this->__dispatch_map['download_base64_document'] =
  454 + array('in' => array('session_id'=>'string','document_id'=>'int' ),
  455 + 'out' => array('return' => "{urn:$this->namespace}kt_response" ),
  456 + 'alias' => 'download_small_document'
  457 + );
  458 +
432 // delete_document 459 // delete_document
433 $this->__dispatch_map['delete_document'] = 460 $this->__dispatch_map['delete_document'] =
434 array('in' => array('session_id'=>'string','document_id'=>'int','reason'=>'string'), 461 array('in' => array('session_id'=>'string','document_id'=>'int','reason'=>'string'),
setup/upgrade-title.jpg

4.77 KB | W: | H:

9.28 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
setup/upgrade.php
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 $GLOBALS["checkup"] = true; 32 $GLOBALS["checkup"] = true;
33 session_start(); 33 session_start();
34 require_once('../config/dmsDefaults.php'); 34 require_once('../config/dmsDefaults.php');
  35 +require_once(KT_LIB_DIR . '/authentication/authenticationutil.inc.php');
35 require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php'); 36 require_once(KT_LIB_DIR . '/upgrades/upgrade.inc.php');
36 require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); 37 require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php');
37 38
@@ -177,8 +178,6 @@ $action = trim($_REQUEST["go"]); @@ -177,8 +178,6 @@ $action = trim($_REQUEST["go"]);
177 switch ($action) 178 switch ($action)
178 { 179 {
179 case 'UpgradeConfirm': 180 case 'UpgradeConfirm':
180 - upgradeConfirm();  
181 - break;  
182 case 'UpgradePreview': 181 case 'UpgradePreview':
183 UpgradePreview(); 182 UpgradePreview();
184 break; 183 break;
@@ -209,11 +208,92 @@ switch ($action) @@ -209,11 +208,92 @@ switch ($action)
209 case 'RestoreDone': 208 case 'RestoreDone':
210 restoreDone(); 209 restoreDone();
211 break; 210 break;
  211 + case 'Login':
  212 + login();
  213 + break;
  214 + case 'LoginProcess':
  215 + loginProcess();
  216 + break;
212 default: 217 default:
213 - welcome(); 218 + if (!isset($_SESSION['setup_user']))
  219 + login();
  220 + else
  221 + welcome();
214 break; 222 break;
215 } 223 }
216 224
  225 +function login()
  226 +{
  227 +?>
  228 +<P>
  229 +The database upgrade wizard completes the upgrade process on an existing KnowledgeTree installation. It applies
  230 +any upgrades to the database that may be required.
  231 +<P>
  232 +Only administrator users may access the upgrade wizard.
  233 +<P>
  234 +
  235 +<form method=post action="?go=LoginProcess">
  236 +<table>
  237 +<tr><td>Username<td><input name=username>
  238 +<tr><td>Password<td><input name=password type="password">
  239 +<tr><td colspan=2 align=center><input type=submit value="login">
  240 +</table>
  241 +</form>
  242 +<?
  243 +}
  244 +
  245 +function loginProcess()
  246 +{
  247 + $username=$_REQUEST['username'];
  248 + $password=$_REQUEST['password'];
  249 +
  250 + $oUser = User::getByUserName($username);
  251 +
  252 + if (PEAR::isError($oUser))
  253 + {
  254 + session_unset();
  255 + loginFailed(_kt('Could not identify user'));
  256 + return;
  257 + }
  258 +
  259 + $is_admin=false;
  260 + $groups = GroupUtil::listGroupsForUser($oUser);
  261 + foreach($groups as $group)
  262 + {
  263 + if ($group->getSysAdmin())
  264 + {
  265 + $is_admin=true;
  266 + break;
  267 + }
  268 + }
  269 +
  270 + if (!$is_admin)
  271 + {
  272 + session_unset();
  273 + loginFailed(_kt('Could not identify administrator'));
  274 + return;
  275 + }
  276 +
  277 + $authenticated = KTAuthenticationUtil::checkPassword($oUser, $password);
  278 +
  279 + if (!$authenticated)
  280 + {
  281 + session_unset();
  282 + loginFailed(_kt('Could not authenticate user'));
  283 + return;
  284 + }
  285 +
  286 + $_SESSION['setup_user'] = $oUser;
  287 +
  288 + welcome();
  289 +}
  290 +
  291 +function loginFailed($message)
  292 +{
  293 + print "<font color=red>$message</font>";
  294 + login();
  295 +}
  296 +
217 function resolveMysqlDir() 297 function resolveMysqlDir()
218 { 298 {
219 299
@@ -336,11 +416,16 @@ function create_restore_stmt($targetfile) @@ -336,11 +416,16 @@ function create_restore_stmt($targetfile)
336 416
337 function title($title) 417 function title($title)
338 { 418 {
  419 + if (!isset($_SESSION['setup_user']))
  420 + {
  421 + print "<script>document.location='?go=Login'</script>";
  422 + }
339 print "<h1>$title</h1>"; 423 print "<h1>$title</h1>";
340 } 424 }
341 425
342 function resolveTempDir() 426 function resolveTempDir()
343 { 427 {
  428 +
344 if (OS_UNIX) 429 if (OS_UNIX)
345 { 430 {
346 $dir='/tmp/kt-db-backup'; 431 $dir='/tmp/kt-db-backup';
@@ -349,6 +434,9 @@ function resolveTempDir() @@ -349,6 +434,9 @@ function resolveTempDir()
349 { 434 {
350 $dir='c:/kt-db-backup'; 435 $dir='c:/kt-db-backup';
351 } 436 }
  437 +
  438 + $dir = $oKTConfig->get('backups/backupDirectory',$dir);
  439 +
352 if (!is_dir($dir)) 440 if (!is_dir($dir))
353 { 441 {
354 mkdir($dir); 442 mkdir($dir);
@@ -374,8 +462,8 @@ function upgradeConfirm() @@ -374,8 +462,8 @@ function upgradeConfirm()
374 We are about to start the upgrade process. 462 We are about to start the upgrade process.
375 <P> 463 <P>
376 464
377 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('welcome')">  
378 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="continue to preview available upgrades" onclick="javascript:do_start('UpgradePreview')"> 465 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('welcome')">
  466 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="next" onclick="javascript:do_start('UpgradePreview')">
379 467
380 <? 468 <?
381 469
@@ -425,14 +513,14 @@ You can continue to do the backup manually using the following process: @@ -425,14 +513,14 @@ You can continue to do the backup manually using the following process:
425 Press <i>continue to backup</i> to attempt the command(s) above. 513 Press <i>continue to backup</i> to attempt the command(s) above.
426 <P> 514 <P>
427 515
428 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('home')"> &nbsp;&nbsp; &nbsp; &nbsp; 516 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('home')"> &nbsp;&nbsp; &nbsp; &nbsp;
429 517
430 <? 518 <?
431 if ($dir != '') 519 if ($dir != '')
432 { 520 {
433 ?> 521 ?>
434 522
435 -<input type=button value="continue to backup" onclick="javascript:do_start('Backup')"> 523 +<input type=button value="next" onclick="javascript:do_start('Backup')">
436 524
437 525
438 <? 526 <?
@@ -501,7 +589,7 @@ function restoreSelect() @@ -501,7 +589,7 @@ function restoreSelect()
501 ?> 589 ?>
502 590
503 <p> 591 <p>
504 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('welcome')"> 592 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('welcome')">
505 <? 593 <?
506 594
507 } 595 }
@@ -577,8 +665,8 @@ Press &lt;i&gt;continue to restore&lt;/i&gt; to attempt the command(s) above. @@ -577,8 +665,8 @@ Press &lt;i&gt;continue to restore&lt;/i&gt; to attempt the command(s) above.
577 } 665 }
578 ?> 666 ?>
579 667
580 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('home')">  
581 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="select another backup to restore" onclick="javascript:do_start('RestoreSelect')"> 668 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('home')">
  669 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="select another backup" onclick="javascript:do_start('RestoreSelect')">
582 670
583 <? 671 <?
584 if ($dir != '') 672 if ($dir != '')
@@ -593,7 +681,7 @@ function restore() @@ -593,7 +681,7 @@ function restore()
593 } 681 }
594 } 682 }
595 </script> 683 </script>
596 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="continue to restore" onclick="javascript:restore()"> 684 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="next" onclick="javascript:restore()">
597 685
598 686
599 <? 687 <?
@@ -666,12 +754,12 @@ We appologise for the inconvenience. @@ -666,12 +754,12 @@ We appologise for the inconvenience.
666 ?> 754 ?>
667 <br> 755 <br>
668 756
669 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('welcome')"> 757 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('welcome')">
670 <? 758 <?
671 if ($status) 759 if ($status)
672 { 760 {
673 ?> 761 ?>
674 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="continue to upgrade" onclick="javascript:do_start('UpgradeConfirm')"> 762 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="next" onclick="javascript:do_start('UpgradeConfirm')">
675 763
676 <? 764 <?
677 } 765 }
@@ -718,7 +806,7 @@ We appologise for the inconvenience. @@ -718,7 +806,7 @@ We appologise for the inconvenience.
718 806
719 <br> 807 <br>
720 808
721 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('welcome')"> 809 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('welcome')">
722 810
723 <? 811 <?
724 812
@@ -758,7 +846,7 @@ function backup() @@ -758,7 +846,7 @@ function backup()
758 ob_flush(); 846 ob_flush();
759 flush(); 847 flush();
760 ?> 848 ?>
761 - The back is now underway. Please wait till it completes. 849 + The backup is now underway. Please wait till it completes.
762 <? 850 <?
763 851
764 ob_flush(); 852 ob_flush();
@@ -798,7 +886,7 @@ function backup() @@ -798,7 +886,7 @@ function backup()
798 <P> 886 <P>
799 The <i>mysqldump</i> utility was not found in the <?=$dir?> subdirectory. 887 The <i>mysqldump</i> utility was not found in the <?=$dir?> subdirectory.
800 888
801 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('welcome')"> 889 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('welcome')">
802 <? 890 <?
803 } 891 }
804 892
@@ -870,7 +958,7 @@ function restore() @@ -870,7 +958,7 @@ function restore()
870 <P> 958 <P>
871 The <i>mysql</i> utility was not found in the <?=$dir?> subdirectory. 959 The <i>mysql</i> utility was not found in the <?=$dir?> subdirectory.
872 960
873 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('welcome')"> 961 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('welcome')">
874 <? 962 <?
875 } 963 }
876 964
@@ -884,20 +972,21 @@ function welcome() @@ -884,20 +972,21 @@ function welcome()
884 set_state(1); 972 set_state(1);
885 ?> 973 ?>
886 <br> 974 <br>
887 -Welcome to the <?php echo APP_NAME;?> Database Upgrade Utility.<P> If you have just applied an upgrade stack installer or have updated 975 +Welcome to the <?php echo APP_NAME;?> Database Upgrade Wizard.<P> If you have just updated
888 your <?php echo APP_NAME;?> code base, you will need to complete the upgrade process in order to ensure your system is fully operational with the new version. 976 your <?php echo APP_NAME;?> code base, you will need to complete the upgrade process in order to ensure your system is fully operational with the new version.
889 <P> 977 <P>
  978 +You will not be able to log into <?php echo APP_NAME;?> until your the database upgrade process is completed.
  979 +<P>
890 <font color=orange>!!NB!! You are advised to backup the database before attempting the upgrade. !!NB!!</font> 980 <font color=orange>!!NB!! You are advised to backup the database before attempting the upgrade. !!NB!!</font>
891 -  
892 <P> 981 <P>
893 If you have already done this, you may skip this step can continue directly to the upgade. 982 If you have already done this, you may skip this step can continue directly to the upgade.
894 <P> 983 <P>
895 984
896 985
897 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="return to <?php echo APP_NAME;?>" onclick="document.location='..';">  
898 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="backup" onclick="javascript:do_start('BackupConfirm');">  
899 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="continue to upgrade" onclick="javascript:do_start('UpgradeConfirm');">  
900 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="restore" onclick="javascript:do_start('RestoreConfirm');"> 986 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="cancel" onclick="document.location='..';">
  987 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="backup now" onclick="javascript:do_start('BackupConfirm');">
  988 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="next" onclick="javascript:do_start('UpgradeConfirm');">
  989 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="restore database" onclick="javascript:do_start('RestoreConfirm');">
901 990
902 991
903 <? 992 <?
@@ -920,8 +1009,8 @@ function UpgradePreview() @@ -920,8 +1009,8 @@ function UpgradePreview()
920 ?> 1009 ?>
921 <br> 1010 <br>
922 1011
923 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('home')">  
924 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="upgrade" onclick="javascript:do_start('Upgrade')"> 1012 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('home')">
  1013 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="next" onclick="javascript:do_start('Upgrade')">
925 <? 1014 <?
926 1015
927 } 1016 }
@@ -954,8 +1043,8 @@ function Upgrade() @@ -954,8 +1043,8 @@ function Upgrade()
954 ?> 1043 ?>
955 <p> 1044 <p>
956 1045
957 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="home" onclick="javascript:do_start('home')">  
958 -&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="return to <?php echo APP_NAME;?>" onclick="javascript:document.location='..';"> 1046 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="back" onclick="javascript:do_start('home')">
  1047 +&nbsp;&nbsp; &nbsp; &nbsp; <input type=button value="next" onclick="javascript:document.location='..';">
959 <? 1048 <?
960 } 1049 }
961 1050