From a52131c9006e861093a5e3514fce70e1a4967048 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Thu, 17 Jan 2008 14:39:43 +0000 Subject: [PATCH] Merged in whitespace and comments from DEV trunk. --- bin/win32/installScheduler.php | 36 ++++++++++++++++++++++++++++++++++++ bin/win32/schedulerServiceStatus.php | 36 ++++++++++++++++++++++++++++++++++++ bin/win32/uninstallScheduler.php | 36 ++++++++++++++++++++++++++++++++++++ ktwebservice/download_cleanup.php | 2 +- ktwebservice/index.php | 2 +- ktwebservice/upload_cleanup.php | 2 +- lib/util/ktutil.inc | 43 +++++++++++++++++++++++++++++++++++++++++++ plugins/ktcore/folder/addDocument.php | 2 +- plugins/ktstandard/PDFGeneratorAction.php | 46 ++++++++++++++++++++++++++-------------------- plugins/ktstandard/admin/manageDisclaimers.php | 2 +- plugins/ktstandard/contents/BaseIndexer.php | 46 ++++++++++++++++++++++++++-------------------- plugins/ktstandard/contents/WordIndexer.php | 52 +++++++++++++++++++++++++++------------------------- plugins/rssplugin/RSSDashlet.php | 2 +- plugins/rssplugin/RSSDocumentLinkAction.php | 50 +++++++++++++++++++++++++++++--------------------- plugins/rssplugin/RSSFolderLinkAction.php | 2 +- plugins/rssplugin/manageRSSFeeds.php | 2 +- plugins/tagcloud/TagCloudRedirectPage.php | 2 +- presentation/i18nJavascript.php | 2 +- sql/mysql/upgrade/3.4.6/remove_backslashes.sql | 6 +----- thirdparty/pear/GraphViz.php | 8 ++++---- thirdparty/pear/HTTP/Upload.php | 6 +++--- thirdparty/pear/Net/Ping.php | 6 +++--- 22 files changed, 280 insertions(+), 111 deletions(-) diff --git a/bin/win32/installScheduler.php b/bin/win32/installScheduler.php index f0b3ce8..92dc9ab 100644 --- a/bin/win32/installScheduler.php +++ b/bin/win32/installScheduler.php @@ -1,5 +1,41 @@ . + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. 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 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + $scriptPath = realpath(dirname(__FILE__) . '/taskrunner.bat'); win32_create_service(array( diff --git a/bin/win32/schedulerServiceStatus.php b/bin/win32/schedulerServiceStatus.php index 5281972..e0fcbb4 100644 --- a/bin/win32/schedulerServiceStatus.php +++ b/bin/win32/schedulerServiceStatus.php @@ -1,5 +1,41 @@ . + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. 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 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + var_dump(win32_query_service_status('ktscheduler')); ?> diff --git a/bin/win32/uninstallScheduler.php b/bin/win32/uninstallScheduler.php index 47cd515..f7fc099 100644 --- a/bin/win32/uninstallScheduler.php +++ b/bin/win32/uninstallScheduler.php @@ -1,5 +1,41 @@ . + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. 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 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. + * Contributor( s): ______________________________________ + * + */ + win32_delete_service('ktscheduler'); ?> \ No newline at end of file diff --git a/ktwebservice/download_cleanup.php b/ktwebservice/download_cleanup.php index 434e19a..ea713f9 100644 --- a/ktwebservice/download_cleanup.php +++ b/ktwebservice/download_cleanup.php @@ -2,7 +2,7 @@ /** * - * $Id:$ + * $Id$ * * Cleans up the download_files table. * diff --git a/ktwebservice/index.php b/ktwebservice/index.php index d162815..2157e0b 100644 --- a/ktwebservice/index.php +++ b/ktwebservice/index.php @@ -2,7 +2,7 @@ /** * - * $Id:$ + * $Id$ * * A wrapper for webservice.php * diff --git a/ktwebservice/upload_cleanup.php b/ktwebservice/upload_cleanup.php index c114e07..4662c97 100644 --- a/ktwebservice/upload_cleanup.php +++ b/ktwebservice/upload_cleanup.php @@ -2,7 +2,7 @@ /** * - * $Id:$ + * $Id$ * * Cleans up the uploaded_files table and the upload. * diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc index a2dfecd..8bfa9d5 100644 --- a/lib/util/ktutil.inc +++ b/lib/util/ktutil.inc @@ -303,6 +303,49 @@ class KTUtil { } // }}} + + // {{{ winexec + /** + * Execute a command on a windows platform. + */ + function winexec($aCmd, $aOptions = null) { + if (is_array($aCmd)) { + $sCmd = KTUtil::safeShellString($aCmd); + } else { + $sCmd = $aCmd; + } + $sAppend = KTUtil::arrayGet($aOptions, 'append'); + if ($sAppend) { + $sCmd .= " >> " . escapeshellarg($sAppend); + } + + $sCmd = str_replace( '/','\\',$sCmd); + + // Set wait to true if the execute must wait for the script to complete before continuing + $wait = true; + if(isset($aOptions['exec_wait']) && ($aOptions['exec_wait'] == 'false')){ + $wait = false; + } + + // Iterate through the various execute functions till one works. + $WshShell = new COM("WScript.Shell"); + $res = $WshShell->Run($sCmd, 0, $wait); + + if($res){ + return $res; + } + + $sCmd = "start /b \"kt\" " . $sCmd; + $fp = popen($sCmd, 'r'); + fclose($fp); + + if($wait){ + sleep(1); + } + return 1; + } + // }}} + // {{{ copyDirectory function copyDirectory($sSrc, $sDst, $bMove = false) { if (file_exists($sDst)) { diff --git a/plugins/ktcore/folder/addDocument.php b/plugins/ktcore/folder/addDocument.php index bbaac75..e46df60 100644 --- a/plugins/ktcore/folder/addDocument.php +++ b/plugins/ktcore/folder/addDocument.php @@ -311,7 +311,7 @@ class KTFolderAddDocumentAction extends KTFolderAction { ); $aFile = $this->oValidator->validateFile($extra_d['file'], $aErrorOptions); - $sTitle = sanitizeForSQL($extra_d['document_name']); + $sTitle = $extra_d['document_name']; $iFolderId = $this->oFolder->getId(); $aOptions = array( diff --git a/plugins/ktstandard/PDFGeneratorAction.php b/plugins/ktstandard/PDFGeneratorAction.php index 42d6188..054de9a 100644 --- a/plugins/ktstandard/PDFGeneratorAction.php +++ b/plugins/ktstandard/PDFGeneratorAction.php @@ -2,29 +2,35 @@ /** * $Id$ * - * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1.2 ("License"); You may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.knowledgetree.com/KPL + * KnowledgeTree Open Source Edition + * Document Management Made Simple + * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. - * See the License for the specific language governing rights and - * limitations under the License. - * - * All copies of the Covered Code must include on each user interface screen: - * (i) the "Powered by KnowledgeTree" logo and - * (ii) the KnowledgeTree copyright notice - * in the same form as they appear in the distribution. See the License for - * requirements. + * 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 The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. * - * The Original Code is: KnowledgeTree Open Source + * 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. * - * The Initial Developer of the Original Code is The Jam Warehouse Software - * (Pty) Ltd, trading as KnowledgeTree. - * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright - * (C) 2007 The Jam Warehouse Software (Pty) Ltd; - * All Rights Reserved. + * 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 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/admin/manageDisclaimers.php b/plugins/ktstandard/admin/manageDisclaimers.php index e153d29..ce31c20 100644 --- a/plugins/ktstandard/admin/manageDisclaimers.php +++ b/plugins/ktstandard/admin/manageDisclaimers.php @@ -1,7 +1,7 @@ . - * + * * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. 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 - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ -class KTBaseIndexerTrigger { +class KTBaseIndexerTrigger { /** * Which MIME types that this indexer acts upon. */ @@ -76,8 +76,8 @@ class KTBaseIndexerTrigger { * If it is false, the temporary file will be sent as the last * parameter. */ - var $use_pipes = true; - + var $use_pipes = true; + /* return a diagnostic string _if_ there is something wrong. NULL otherwise. */ function getDiagnostic() { return null; @@ -103,9 +103,10 @@ class KTBaseIndexerTrigger { } $oKTConfig =& KTConfig::getSingleton(); - $sBasedir = $oKTConfig->get("urls/tmpDirectory"); - + $sBasedir = $oKTConfig->get("urls/tmpDirectory"); + $myfilename = tempnam($sBasedir, 'kt.' . $tempstub); + if (OS_WINDOWS) { $intermediate = tempnam($sBasedir, 'kt.' . $tempstub); if (!@copy($sFile, $intermediate)) { @@ -114,9 +115,9 @@ class KTBaseIndexerTrigger { } else { $intermediate = $sFile; } - + $contents = $this->extract_contents($intermediate, $myfilename); - + @unlink($myfilename); if (OS_WINDOWS) { @unlink($intermediate); } if (empty($contents)) { @@ -127,14 +128,14 @@ class KTBaseIndexerTrigger { 'document_text' => $contents, ); $sTable = KTUtil::getTableName('document_text'); - + // clean up the document query "stuff". // FIXME this suggests that we should move the _old_ document_searchable_text across to the old-document's id if its a checkin. DBUtil::runQuery(array('DELETE FROM ' . $sTable . ' WHERE document_id = ?', array($this->oDocument->getId()))); DBUtil::autoInsert($sTable, $aInsertValues, array('noid' => true)); } - + // handles certain, _very_ simple reader types. function extract_contents($sFilename, $sTempFilename) { $sCommand = KTUtil::findCommand($this->commandconfig, $this->command); @@ -145,7 +146,7 @@ class KTBaseIndexerTrigger { $cmdline = array($sCommand); $cmdline = kt_array_merge($cmdline, $this->args); $cmdline[] = $sFilename; - + $aOptions = array(); $aOptions['exec_wait'] = 'true'; if ($this->use_pipes) { @@ -153,7 +154,12 @@ class KTBaseIndexerTrigger { } else { $cmdline[] = $sTempFilename; } - $aRet = KTUtil::pexec($cmdline, $aOptions); + + if(OS_WINDOWS){ + $aRet = KTUtil::winexec($cmdline, $aOptions); + }else{ + $aRet = KTUtil::pexec($cmdline, $aOptions); + } $this->aCommandOutput = $aRet['out']; $contents = file_get_contents($sTempFilename); diff --git a/plugins/ktstandard/contents/WordIndexer.php b/plugins/ktstandard/contents/WordIndexer.php index 0d7662d..d288b2a 100644 --- a/plugins/ktstandard/contents/WordIndexer.php +++ b/plugins/ktstandard/contents/WordIndexer.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 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 The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. 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 - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -45,62 +45,64 @@ class KTWordIndexerTrigger extends KTBaseIndexerTrigger { var $commandconfig = 'indexer/catdoc'; // could be any application. var $args = array("-w", "-d", "UTF-8"); var $use_pipes = true; - + function extract_contents($sFilename, $sTempFilename) { - if (OS_WINDOWS) { + if (OS_WINDOWS) { $this->command = 'c:\antiword\antiword.exe'; $this->commandconfig = 'indexer/antiword'; $this->args = array(); } putenv('LANG=en_US.UTF-8'); - + $sCommand = KTUtil::findCommand($this->commandconfig, $this->command); if (empty($sCommand)) { return false; } - - if (OS_WINDOWS) { + + if (OS_WINDOWS) { $sDir = dirname(dirname($sCommand)); - putenv('HOME=' . $sDir); + putenv('HOME=' . $sDir); + /* $cmdline = array($sCommand); $cmdline = kt_array_merge($cmdline, $this->args); $cmdline[] = $sFilename; - + $sCmd = KTUtil::safeShellString($cmdline); $sCmd .= " >> " . escapeshellarg($sTempFilename); - + $sCmd = str_replace( '/','\\',$sCmd); - + $sCmd = "start /b \"kt\" " . $sCmd; - + pclose(popen($sCmd, 'r')); - + $this->aCommandOutput = 1; $contents = file_get_contents($sTempFilename); return $contents; + */ } return parent::extract_contents($sFilename, $sTempFilename); } - + function findLocalCommand() { if (OS_WINDOWS) { $this->command = 'c:\antiword\antiword.exe'; $this->commandconfig = 'indexer/antiword'; $this->args = array(); - } + } $sCommand = KTUtil::findCommand($this->commandconfig, $this->command); return $sCommand; } - + function getDiagnostic() { $sCommand = $this->findLocalCommand(); - + // can't find the local command. if (empty($sCommand)) { return sprintf(_kt('Unable to find required command for indexing. Please ensure that %s is installed and in the %s Path. For more information on indexers and helper applications, please visit the %s site.'), $this->command, APP_NAME, $this->support_url, APP_NAME); } - + return null; } } diff --git a/plugins/rssplugin/RSSDashlet.php b/plugins/rssplugin/RSSDashlet.php index 454e90b..a304fe6 100644 --- a/plugins/rssplugin/RSSDashlet.php +++ b/plugins/rssplugin/RSSDashlet.php @@ -1,6 +1,6 @@ . + * + * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, + * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. * - * The Original Code is: KnowledgeTree Open Source + * 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. * - * The Initial Developer of the Original Code is The Jam Warehouse Software - * (Pty) Ltd, trading as KnowledgeTree. - * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright - * (C) 2007 The Jam Warehouse Software (Pty) Ltd; - * All Rights Reserved. + * 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 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -76,4 +84,4 @@ class RSSDocumentLinkAction extends KTDocumentAction { return $oTemplate->render($aTemplateData); } } -?> \ No newline at end of file +?> diff --git a/plugins/rssplugin/RSSFolderLinkAction.php b/plugins/rssplugin/RSSFolderLinkAction.php index 0a41309..5e45df0 100644 --- a/plugins/rssplugin/RSSFolderLinkAction.php +++ b/plugins/rssplugin/RSSFolderLinkAction.php @@ -1,6 +1,6 @@ and + * Copyright (c) 2001-2006, Dr. Volker G�bbels and * Sebastian Bergmann . All rights reserved. * * LICENSE: This source file is subject to version 3.0 of the PHP license @@ -15,7 +15,7 @@ * * @category Image * @package GraphViz - * @author Dr. Volker Göbbels + * @author Dr. Volker G�bbels * @author Sebastian Bergmann * @author Karsten Dambekalns * @author Michael Lively Jr. @@ -90,10 +90,10 @@ require_once 'System.php'; * @category Image * @package GraphViz * @author Sebastian Bergmann - * @author Dr. Volker Göbbels + * @author Dr. Volker G�bbels * @author Karsten Dambekalns * @author Michael Lively Jr. - * @copyright Copyright © 2001-2006 Dr. Volker Göbbels and Sebastian Bergmann + * @copyright Copyright © 2001-2006 Dr. Volker G�bbels and Sebastian Bergmann * @license http://www.php.net/license/3_0.txt The PHP License, Version 3.0 * @version Release: @package_version@ * @link http://pear.php.net/package/Image_GraphViz diff --git a/thirdparty/pear/HTTP/Upload.php b/thirdparty/pear/HTTP/Upload.php index d2390e0..10b8276 100644 --- a/thirdparty/pear/HTTP/Upload.php +++ b/thirdparty/pear/HTTP/Upload.php @@ -205,7 +205,7 @@ class HTTP_Upload_Error extends PEAR 'en' => 'The file was only partially uploaded.', 'de' => 'Die Datei wurde unvollständig übertragen.', 'nl' => 'Het bestand is slechts gedeeltelijk geupload.', - 'pt_BR' => 'O arquivo não foi enviado por completo.' + 'pt_BR' => 'O arquivo n�o foi enviado por completo.' ), 'ERROR' => array( 'es' => 'Error en subida:', @@ -215,7 +215,7 @@ class HTTP_Upload_Error extends PEAR 'pt_BR' => 'Erro de upload:' ), 'DEV_NO_DEF_FILE' => array( - 'es' => 'No está definido en el formulario este nombre de fichero como <input type="file" name=?>.', + 'es' => 'No est� definido en el formulario este nombre de fichero como <input type="file" name=?>.', 'en' => 'This filename is not defined in the form as <input type="file" name=?>.', 'de' => 'Dieser Dateiname ist im Formular nicht als <input type="file" name=?> definiert.', 'nl' => 'Deze bestandsnaam is niett gedefineerd in het formulier als <input type="file" name=?>.' @@ -660,7 +660,7 @@ class HTTP_Upload_File extends HTTP_Upload_Error */ function nameToSafe($name, $maxlen=250) { - $noalpha = 'ÁÉÍÓÚÝáéíóúýÂÊÎÔÛâêîôûÀÈÌÒÙàèìòùÄËÏÖÜäëïöüÿÃãÕõÅåÑñÇç@°ºª'; + $noalpha = '�����������������������������������������������������@���'; $alpha = 'AEIOUYaeiouyAEIOUaeiouAEIOUaeiouAEIOUaeiouyAaOoAaNnCcaooa'; $name = substr($name, 0, $maxlen); diff --git a/thirdparty/pear/Net/Ping.php b/thirdparty/pear/Net/Ping.php index 8446cf5..b2c254b 100644 --- a/thirdparty/pear/Net/Ping.php +++ b/thirdparty/pear/Net/Ping.php @@ -16,7 +16,7 @@ // | Authors: Martin Jansen | // | Tomas V.V.Cox | // | Jan Lehnardt | -// | Kai Schröder | +// | Kai Schr�der | // +----------------------------------------------------------------------+ // // $Id$ @@ -408,7 +408,7 @@ class Net_Ping * @param mixed $error a PEAR error or a string with the error message * @return bool false * @access private - * @author Kai Schröder + * @author Kai Schr�der */ function _raiseError($error) { @@ -864,7 +864,7 @@ class Net_Ping_Result /** * Parses the output of Windows' ping command * - * @author Kai Schröder + * @author Kai Schr�der * @access private */ function _parseResultwindows() -- libgit2 0.21.4