From 55c0fc24e8cc348880fb31b73e883b2a34f8d7c3 Mon Sep 17 00:00:00 2001 From: kevin_fourie Date: Wed, 30 May 2007 10:08:30 +0000 Subject: [PATCH] KTC-95 "Update License Headers" Updated and added some missing headers. --- about.php | 140 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------- action.php | 16 +++++++++++----- admin.php | 16 +++++++++++----- bin/automated_upgrade.php | 16 +++++++++++----- bin/cleanup.php | 16 +++++++++++----- bin/storageverification.php | 28 ++++++++++++++++++++++++++++ bin/upgrade/pre-upgrade-3.0b3.php | 16 +++++++++++----- bin/upgrade/upgrade-to-2.0.6.php | 16 +++++++++++----- browse.php | 16 +++++++++++----- config/dmsDefaults.php | 16 +++++++++++----- config/siteMap.inc | 16 +++++++++++----- config/tableMappings.inc | 16 +++++++++++----- control.php | 16 +++++++++++----- dashboard.php | 16 +++++++++++----- examples/fieldsynchronisation/syncFieldFromLDAP.php | 16 +++++++++++----- help.php | 16 +++++++++++----- ktapi/ktapi.inc.php | 16 +++++++++++----- ktwebdav/index.php | 16 +++++++++++----- ktwebdav/ktwebdav.php | 16 +++++++++++----- ktwebdav/lib/KTWebDAVServer.inc.php | 4372 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ktwebservice/KTDownloadManager.inc.php | 16 +++++++++++----- ktwebservice/KTUploadManager.inc.php | 16 +++++++++++----- ktwebservice/download.php | 16 +++++++++++----- ktwebservice/download_cleanup.php | 16 +++++++++++----- ktwebservice/index.php | 16 +++++++++++----- ktwebservice/upload.php | 16 +++++++++++----- ktwebservice/upload_cleanup.php | 16 +++++++++++----- ktwebservice/webservice.php | 16 +++++++++++----- ktwsapi/php/examples/ktws_eg_add_document.php | 16 +++++++++++----- ktwsapi/php/examples/ktws_eg_anonymous.php | 16 +++++++++++----- ktwsapi/php/examples/ktws_eg_checkin.php | 16 +++++++++++----- ktwsapi/php/examples/ktws_eg_create_folder.php | 16 +++++++++++----- ktwsapi/php/examples/ktws_eg_doc_info.php | 16 +++++++++++----- ktwsapi/php/examples/ktws_eg_folder_listing.php | 16 +++++++++++----- ktwsapi/php/ktwsapi.inc.php | 16 +++++++++++----- ktwsapi/php/ktwsapi_cfg.inc.php | 16 +++++++++++----- lib/Log.inc | 16 +++++++++++----- lib/actions/actionregistry.inc.php | 16 +++++++++++----- lib/actions/bulkaction.php | 16 +++++++++++----- lib/actions/documentaction.inc.php | 16 +++++++++++----- lib/actions/documentviewlet.inc.php | 16 +++++++++++----- lib/actions/entitylist.php | 16 +++++++++++----- lib/actions/folderaction.inc.php | 16 +++++++++++----- lib/actions/portletregistry.inc.php | 16 +++++++++++----- lib/alert/delivery/EmailAlert.inc | 16 +++++++++++----- lib/alert/delivery/SMSAlert.inc | 16 +++++++++++----- lib/authentication/Authenticator.inc | 16 +++++++++++----- lib/authentication/DBAuthenticator.inc | 16 +++++++++++----- lib/authentication/authenticationprovider.inc.php | 16 +++++++++++----- lib/authentication/authenticationproviderregistry.inc.php | 16 +++++++++++----- lib/authentication/authenticationsource.inc.php | 16 +++++++++++----- lib/authentication/authenticationutil.inc.php | 16 +++++++++++----- lib/authentication/builtinauthenticationprovider.inc.php | 16 +++++++++++----- lib/authentication/interceptor.inc.php | 16 +++++++++++----- lib/authentication/interceptorinstances.inc.php | 16 +++++++++++----- lib/authentication/interceptorregistry.inc.php | 16 +++++++++++----- lib/browse/BrowseColumns.inc.php | 16 +++++++++++----- lib/browse/Criteria.inc | 16 +++++++++++----- lib/browse/DocumentCollection.inc.php | 16 +++++++++++----- lib/browse/PartialQuery.inc.php | 16 +++++++++++----- lib/browse/browseutil.inc.php | 16 +++++++++++----- lib/browse/columnentry.inc.php | 16 +++++++++++----- lib/browse/columnregistry.inc.php | 16 +++++++++++----- lib/browse/criteriaregistry.php | 16 +++++++++++----- lib/cache/cache.inc.php | 28 ++++++++++++++++++++++++++++ lib/config/config.inc.php | 16 +++++++++++----- lib/dashboard/DashletDisables.inc.php | 16 +++++++++++----- lib/dashboard/Notification.inc.php | 16 +++++++++++----- lib/dashboard/NotificationRegistry.inc.php | 16 +++++++++++----- lib/dashboard/dashlet.inc.php | 16 +++++++++++----- lib/dashboard/dashletregistry.inc.php | 16 +++++++++++----- lib/database/datetime.inc | 16 +++++++++++----- lib/database/dbcompat.inc | 16 +++++++++++----- lib/database/dbutil.inc | 16 +++++++++++----- lib/database/lookup.inc | 16 +++++++++++----- lib/database/sqlfile.inc.php | 16 +++++++++++----- lib/discussions/DiscussionComment.inc | 16 +++++++++++----- lib/discussions/DiscussionThread.inc | 16 +++++++++++----- lib/dispatcher.inc.php | 16 +++++++++++----- lib/documentmanagement/Document.inc | 16 +++++++++++----- lib/documentmanagement/DocumentField.inc | 16 +++++++++++----- lib/documentmanagement/DocumentFieldLink.inc | 16 +++++++++++----- lib/documentmanagement/DocumentLink.inc | 16 +++++++++++----- lib/documentmanagement/DocumentTransaction.inc | 16 +++++++++++----- lib/documentmanagement/DocumentTransactionType.inc.php | 16 +++++++++++----- lib/documentmanagement/DocumentType.inc | 16 +++++++++++----- lib/documentmanagement/LinkType.inc | 16 +++++++++++----- lib/documentmanagement/MDTree.inc | 16 +++++++++++----- lib/documentmanagement/MetaData.inc | 16 +++++++++++----- lib/documentmanagement/PhysicalDocumentManager.inc | 16 +++++++++++----- lib/documentmanagement/documentcontentversion.inc.php | 16 +++++++++++----- lib/documentmanagement/documentcore.inc.php | 16 +++++++++++----- lib/documentmanagement/documentmetadataversion.inc.php | 16 +++++++++++----- lib/documentmanagement/documentutil.inc.php | 16 +++++++++++----- lib/documentmanagement/observers.inc.php | 16 +++++++++++----- lib/email/Email.inc | 16 +++++++++++----- lib/filelike/filelike.inc.php | 16 +++++++++++----- lib/filelike/filelikeutil.inc.php | 16 +++++++++++----- lib/filelike/fsfilelike.inc.php | 16 +++++++++++----- lib/filelike/stringfilelike.inc.php | 16 +++++++++++----- lib/foldermanagement/Folder.inc | 16 +++++++++++----- lib/foldermanagement/PhysicalFolderManagement.inc | 16 +++++++++++----- lib/foldermanagement/foldertransaction.inc.php | 16 +++++++++++----- lib/foldermanagement/folderutil.inc.php | 16 +++++++++++----- lib/groups/Group.inc | 16 +++++++++++----- lib/groups/GroupUtil.php | 16 +++++++++++----- lib/help/help.inc.php | 16 +++++++++++----- lib/help/helpentity.inc.php | 16 +++++++++++----- lib/help/helpreplacement.inc.php | 16 +++++++++++----- lib/i18n/i18n.inc.php | 16 +++++++++++----- lib/i18n/i18nregistry.inc.php | 16 +++++++++++----- lib/i18n/i18nutil.inc.php | 16 +++++++++++----- lib/import/bulkimport.inc.php | 16 +++++++++++----- lib/import/fsimportstorage.inc.php | 16 +++++++++++----- lib/import/importstorage.inc.php | 16 +++++++++++----- lib/import/zipimportstorage.inc.php | 16 +++++++++++----- lib/ktentity.inc | 16 +++++++++++----- lib/metadata/fieldbehaviour.inc.php | 16 +++++++++++----- lib/metadata/fieldset.inc.php | 16 +++++++++++----- lib/metadata/fieldsetregistry.inc.php | 28 ++++++++++++++++++++++++++++ lib/metadata/metadatautil.inc.php | 16 +++++++++++----- lib/metadata/valueinstance.inc.php | 16 +++++++++++----- lib/mime.inc.php | 16 +++++++++++----- lib/permissions/permission.inc.php | 16 +++++++++++----- lib/permissions/permissionassignment.inc.php | 16 +++++++++++----- lib/permissions/permissiondescriptor.inc.php | 16 +++++++++++----- lib/permissions/permissiondynamiccondition.inc.php | 16 +++++++++++----- lib/permissions/permissionlookup.inc.php | 16 +++++++++++----- lib/permissions/permissionlookupassignment.inc.php | 16 +++++++++++----- lib/permissions/permissionobject.inc.php | 16 +++++++++++----- lib/permissions/permissionutil.inc.php | 16 +++++++++++----- lib/plugins/KTAdminNavigation.php | 16 +++++++++++----- lib/plugins/pageregistry.inc.php | 16 +++++++++++----- lib/plugins/plugin.inc.php | 16 +++++++++++----- lib/plugins/pluginentity.inc.php | 16 +++++++++++----- lib/plugins/pluginregistry.inc.php | 16 +++++++++++----- lib/plugins/pluginutil.inc.php | 16 +++++++++++----- lib/roles/Role.inc | 16 +++++++++++----- lib/roles/documentroleallocation.inc.php | 28 ++++++++++++++++++++++++++++ lib/roles/roleallocation.inc.php | 16 +++++++++++----- lib/sanitize.inc | 16 +++++++++++----- lib/search/savedsearch.inc.php | 16 +++++++++++----- lib/search/searchutil.inc.php | 16 +++++++++++----- lib/security/Permission.inc | 16 +++++++++++----- lib/session/Session.inc | 16 +++++++++++----- lib/session/SiteMap.inc | 16 +++++++++++----- lib/session/control.inc | 16 +++++++++++----- lib/storage/ondiskhashedstoragemanager.inc.php | 16 +++++++++++----- lib/storage/ondiskpathstoragemanager.inc.php | 16 +++++++++++----- lib/storage/storagemanager.inc.php | 16 +++++++++++----- lib/subscriptions/Subscription.inc | 16 +++++++++++----- lib/subscriptions/SubscriptionConstants.inc | 16 +++++++++++----- lib/subscriptions/SubscriptionManager.inc | 16 +++++++++++----- lib/subscriptions/subscriptions.inc.php | 16 +++++++++++----- lib/templating/kt3template.inc.php | 16 +++++++++++----- lib/templating/smartytemplate.inc.php | 16 +++++++++++----- lib/templating/template.inc.php | 16 +++++++++++----- lib/templating/templating.inc.php | 16 +++++++++++----- lib/triggers/triggerregistry.inc.php | 16 +++++++++++----- lib/unitmanagement/Unit.inc | 16 +++++++++++----- lib/upgrades/UpgradeFunctions.inc.php | 16 +++++++++++----- lib/upgrades/UpgradeItems.inc.php | 16 +++++++++++----- lib/upgrades/upgrade.inc.php | 16 +++++++++++----- lib/users/User.inc | 16 +++++++++++----- lib/users/userhistory.inc.php | 16 +++++++++++----- lib/util/KTStopwords.php | 16 +++++++++++----- lib/util/ktutil.inc | 16 +++++++++++----- lib/util/legacy.inc | 16 +++++++++++----- lib/util/sanitize.inc | 16 +++++++++++----- lib/validation/basevalidator.inc.php | 28 ++++++++++++++++++++++++++++ lib/validation/dispatchervalidation.inc.php | 16 +++++++++++----- lib/validation/errorviewer.inc.php | 16 +++++++++++----- lib/validation/validatorfactory.inc.php | 28 ++++++++++++++++++++++++++++ lib/widgets/FieldsetDisplayRegistry.inc.php | 16 +++++++++++----- lib/widgets/basewidget.inc.php | 28 ++++++++++++++++++++++++++++ lib/widgets/fieldWidgets.php | 16 +++++++++++----- lib/widgets/fieldsetDisplay.inc.php | 16 +++++++++++----- lib/widgets/forms.inc.php | 28 ++++++++++++++++++++++++++++ lib/widgets/portlet.inc.php | 16 +++++++++++----- lib/widgets/reorderdisplay.inc.php | 16 +++++++++++----- lib/widgets/widgetfactory.inc.php | 29 +++++++++++++++++++++++++++++ lib/workflow/workflow.inc.php | 16 +++++++++++----- lib/workflow/workflowadminutil.inc.php | 28 ++++++++++++++++++++++++++++ lib/workflow/workflowstate.inc.php | 16 +++++++++++----- lib/workflow/workflowstatepermissionsassignment.inc.php | 16 +++++++++++----- lib/workflow/workflowtransition.inc.php | 16 +++++++++++----- lib/workflow/workflowtrigger.inc.php | 16 +++++++++++----- lib/workflow/workflowtriggerinstance.inc.php | 16 +++++++++++----- lib/workflow/workflowutil.inc.php | 16 +++++++++++----- login.php | 16 +++++++++++----- notify.php | 16 +++++++++++----- olddashboard.php | 16 +++++++++++----- plugin.php | 16 +++++++++++----- plugins/browseabledashlet/BrowseableDashlet.php | 16 +++++++++++----- plugins/browseabledashlet/BrowseableDashletPlugin.php | 16 +++++++++++----- plugins/generalmetadata/GeneralMetadataDashlet.php | 16 +++++++++++----- plugins/generalmetadata/GeneralMetadataPage.php | 22 ++++++++++++++-------- plugins/generalmetadata/GeneralMetadataPlugin.php | 16 +++++++++++----- plugins/ktcore/KTAssist.php | 16 +++++++++++----- plugins/ktcore/KTBulkActions.php | 16 +++++++++++----- plugins/ktcore/KTColumns.inc.php | 28 ++++++++++++++++++++++++++++ plugins/ktcore/KTCoreLanguagePlugin.php | 16 +++++++++++----- plugins/ktcore/KTCorePlugin.php | 16 +++++++++++----- plugins/ktcore/KTDashlets.php | 16 +++++++++++----- plugins/ktcore/KTDocumentActions.php | 16 +++++++++++----- plugins/ktcore/KTDocumentViewlets.php | 16 +++++++++++----- plugins/ktcore/KTFolderActions.php | 16 +++++++++++----- plugins/ktcore/KTMiscPages.php | 16 +++++++++++----- plugins/ktcore/KTPermissions.php | 16 +++++++++++----- plugins/ktcore/KTPortlets.php | 16 +++++++++++----- plugins/ktcore/KTValidators.php | 28 ++++++++++++++++++++++++++++ plugins/ktcore/KTWidgets.php | 28 ++++++++++++++++++++++++++++ plugins/ktcore/KTWorkflowTriggers.inc.php | 16 +++++++++++----- plugins/ktcore/admin/ajaxComplexConditionals.php | 16 +++++++++++----- plugins/ktcore/admin/ajaxSimpleConditionals.php | 16 +++++++++++----- plugins/ktcore/admin/archivedDocuments.php | 16 +++++++++++----- plugins/ktcore/admin/conditions.php | 16 +++++++++++----- plugins/ktcore/admin/deletedDocuments.php | 16 +++++++++++----- plugins/ktcore/admin/documentCheckout.php | 16 +++++++++++----- plugins/ktcore/admin/documentFieldsv2.php | 16 +++++++++++----- plugins/ktcore/admin/documentTypes.php | 16 +++++++++++----- plugins/ktcore/admin/expungeList.php | 31 +++++++++++++++++++++++++++---- plugins/ktcore/admin/fieldsets/basic.inc.php | 16 +++++++++++----- plugins/ktcore/admin/fieldsets/conditional.inc.php | 16 +++++++++++----- plugins/ktcore/admin/groupManagement.php | 16 +++++++++++----- plugins/ktcore/admin/manageCleanup.php | 16 +++++++++++----- plugins/ktcore/admin/manageConditionals.php | 16 +++++++++++----- plugins/ktcore/admin/manageHelp.php | 16 +++++++++++----- plugins/ktcore/admin/managePermissions.php | 16 +++++++++++----- plugins/ktcore/admin/manageViews.php | 28 ++++++++++++++++++++++++++++ plugins/ktcore/admin/plugins.php | 16 +++++++++++----- plugins/ktcore/admin/roleManagement.php | 16 +++++++++++----- plugins/ktcore/admin/savedSearch.php | 16 +++++++++++----- plugins/ktcore/admin/techsupport.php | 16 +++++++++++----- plugins/ktcore/admin/unitManagement.php | 16 +++++++++++----- plugins/ktcore/admin/userManagement.php | 16 +++++++++++----- plugins/ktcore/admin/workflow/newworkflow.inc.php | 28 ++++++++++++++++++++++++++++ plugins/ktcore/admin/workflowsv2.php | 28 ++++++++++++++++++++++++++++ plugins/ktcore/authentication/authenticationadminpage.inc.php | 16 +++++++++++----- plugins/ktcore/document/Rename.php | 16 +++++++++++----- plugins/ktcore/document/edit.php | 16 +++++++++++----- plugins/ktcore/folder/BulkImport.php | 16 +++++++++++----- plugins/ktcore/folder/BulkUpload.php | 16 +++++++++++----- plugins/ktcore/folder/Permissions.php | 29 ++++++++++++++++++++++++++++- plugins/ktcore/folder/Rename.php | 16 +++++++++++----- plugins/ktcore/folder/Transactions.php | 16 +++++++++++----- plugins/ktcore/folder/addDocument.php | 16 +++++++++++----- plugins/ktstandard/ImmutableActionPlugin.php | 16 +++++++++++----- plugins/ktstandard/KTAdminVersionPlugin.php | 16 +++++++++++----- plugins/ktstandard/KTBulkExportPlugin.php | 16 +++++++++++----- plugins/ktstandard/KTDisclaimers.php | 16 +++++++++++----- plugins/ktstandard/KTDiscussion.php | 16 +++++++++++----- plugins/ktstandard/KTDocumentLinks.php | 16 +++++++++++----- plugins/ktstandard/KTDocumentLinksColumns.php | 16 +++++++++++----- plugins/ktstandard/KTEmail.php | 16 +++++++++++----- plugins/ktstandard/KTIndexer.php | 16 +++++++++++----- plugins/ktstandard/KTLDAPAuthenticationPlugin.php | 16 +++++++++++----- plugins/ktstandard/KTStandardPlugin.php | 16 +++++++++++----- plugins/ktstandard/KTSubscriptions.php | 16 +++++++++++----- plugins/ktstandard/KTWorkflowAssociation.php | 16 +++++++++++----- plugins/ktstandard/PDFGeneratorAction.php | 576 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/ktstandard/PDFGeneratorPlugin.php | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- plugins/ktstandard/SearchDashlet.php | 16 +++++++++++----- plugins/ktstandard/SearchDashletPlugin.php | 16 +++++++++++----- plugins/ktstandard/admin/manageDisclaimers.php | 16 +++++++++++----- plugins/ktstandard/contents/BaseIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/ExcelIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/OpenDocumentIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/PdfIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/PowerpointIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/PsIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/RtfIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/TextIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/WordIndexer.php | 16 +++++++++++----- plugins/ktstandard/contents/XmlHtmlIndexer.php | 16 +++++++++++----- plugins/ktstandard/ldap/activedirectoryauthenticationprovider.inc.php | 16 +++++++++++----- plugins/ktstandard/ldap/ldapauthenticationprovider.inc.php | 16 +++++++++++----- plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php | 16 +++++++++++----- plugins/ktstandard/workflow/FolderAssociator.php | 16 +++++++++++----- plugins/ktstandard/workflow/TypeAssociator.php | 16 +++++++++++----- plugins/ktstandard/workflow/adminpage.php | 16 +++++++++++----- plugins/rssplugin/KTrss.inc.php | 1270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/rssplugin/RSSDashlet.php | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------- plugins/rssplugin/RSSDocumentLinkAction.php | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------ plugins/rssplugin/RSSFolderLinkAction.php | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------- plugins/rssplugin/RSSPlugin.php | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------- plugins/rssplugin/loadFeed.inc.php | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------- plugins/rssplugin/manageRSSFeeds.php | 308 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/rssplugin/rss2array.inc.php | 794 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/tagcloud/TagCloudDashlet.php | 296 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------- plugins/tagcloud/TagCloudPlugin.php | 16 +++++++++++----- plugins/tagcloud/TagCloudRedirectPage.php | 16 +++++++++++----- preferences.php | 16 +++++++++++----- presentation/i18nJavascript.php | 16 +++++++++++----- presentation/logout.php | 16 +++++++++++----- presentation/lookAndFeel/knowledgeTree/ajaxConditional.php | 16 +++++++++++----- presentation/lookAndFeel/knowledgeTree/documentmanagement/getTypeMetadataFields.php | 16 +++++++++++----- presentation/lookAndFeel/knowledgeTree/help.php | 16 +++++++++++----- presentation/lookAndFeel/knowledgeTree/noAccess.php | 16 +++++++++++----- rss.php | 31 +++++++++++++++++++++++++++---- search/ajaxBooleanSearch.php | 16 +++++++++++----- search/booleanSearch.php | 16 +++++++++++----- search/simpleSearch.php | 16 +++++++++++----- setup/postcheckup.php | 16 +++++++++++----- setup/precheckup.php | 16 +++++++++++----- setup/upgrade.php | 16 +++++++++++----- sql/mysql/install/data.sql | 28 ++++++++++++++++++++++++++++ sql/mysql/install/structure.sql | 36 ++++++++++++++++++++++++++++-------- sql/mysql/install/user.sql | 29 +++++++++++++++++++++++++++++ view.php | 2 +- 310 files changed, 7943 insertions(+), 5622 deletions(-) diff --git a/about.php b/about.php index 4a866a9..d61f199 100644 --- a/about.php +++ b/about.php @@ -1,67 +1,73 @@ -aBreadcrumbs = array(array('action' => 'aboutkt', 'name' => _kt("About"))); - $oUser =& $this->oUser; - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate("ktcore/principals/about"); - - $aVersionInfo = explode(' ', $default->versionName); - foreach($aVersionInfo as $sVersionpiece){ - if(substr($sVersionpiece, 1, 1) == '.'){ - $sVersionNo = $sVersionpiece; - }else{ - $sVersionName .= " ".$sVersionpiece; - } - } - - $aTemplateData = array( - "context" => $this, - "versionname" => $sVersionName, - "versionnumber" => $sVersionNo, - ); - return $oTemplate->render($aTemplateData); - } -} - -$oDispatcher = new KTAbout(); -$oDispatcher->dispatch(); - -?> +aBreadcrumbs = array(array('action' => 'aboutkt', 'name' => _kt("About"))); + $oUser =& $this->oUser; + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate("ktcore/principals/about"); + + $aVersionInfo = explode(' ', $default->versionName); + foreach($aVersionInfo as $sVersionpiece){ + if(substr($sVersionpiece, 1, 1) == '.'){ + $sVersionNo = $sVersionpiece; + }else{ + $sVersionName .= " ".$sVersionpiece; + } + } + + $aTemplateData = array( + "context" => $this, + "versionname" => $sVersionName, + "versionnumber" => $sVersionNo, + ); + return $oTemplate->render($aTemplateData); + } +} + +$oDispatcher = new KTAbout(); +$oDispatcher->dispatch(); + +?> diff --git a/action.php b/action.php index 19b82e6..cf4ea70 100644 --- a/action.php +++ b/action.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/admin.php b/admin.php index 3e2e6c8..0d57820 100644 --- a/admin.php +++ b/admin.php @@ -3,15 +3,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -20,6 +25,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/bin/automated_upgrade.php b/bin/automated_upgrade.php index 540f6db..f98666e 100644 --- a/bin/automated_upgrade.php +++ b/bin/automated_upgrade.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/bin/cleanup.php b/bin/cleanup.php index 3e196d3..552041d 100644 --- a/bin/cleanup.php +++ b/bin/cleanup.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/bin/storageverification.php b/bin/storageverification.php index 71efc1e..0882b0e 100755 --- a/bin/storageverification.php +++ b/bin/storageverification.php @@ -1,4 +1,32 @@ initConfig()) { - $this->ktwebdavLog('Could not load configiration.', 'error'); - exit(0); - } - - if ($this->debugInfo == 'on') { - - $this->ktwebdavLog('====================='); - $this->ktwebdavLog(' Debug Info is : ' . $this->debugInfo); - $this->ktwebdavLog(' SafeMode is : ' . $this->safeMode); - $this->ktwebdavLog(' Root Folder is : ' . $this->rootFolder); - $this->ktwebdavLog('====================='); - } - - } - - /** - * Load KTWebDAV configuration from conf file - * - * @param void - * @return bool true on success - */ - function initConfig() { - - global $default; - $oConfig =& KTConfig::getSingleton(); - - // Assign Content - $this->debugInfo = $oConfig->get('KTWebDAVSettings/debug', 'off'); - $this->safeMode = $oConfig->get('KTWebDAVSettings/safemode', 'on'); - $this->rootFolder = $oConfig->get('KTWebDAVSettings/rootfolder', 'Root Folder'); - $this->kt_version = $default->systemVersion; - - return true; - } - - /** - * Log to the KTWebDAV logfile - * - * @todo Add other log levels for warning, profile, etc - * @param string log message - * @param bool debug only? - * @return bool true on success - */ - function ktwebdavLog($entry, $type = 'info', $debug_only = false) { - - if ($debug_only && $this->debugInfo != 'on') return false; - - $ident = 'KTWEBDAV'; - $conf = array('mode' => 0644, 'timeFormat' => '%X %x'); - $logger = &Log::singleton('file', '../var/log/ktwebdav-' . date('Y-m-d') . '.txt', $ident, $conf); - if ($type == 'error') $logger->log($entry, PEAR_LOG_ERR); - else $logger->log($entry, PEAR_LOG_INFO); - return true; - } - - /** - * Get the current UserID - * - * @access private - * @param void - * @return int userID - */ - function _getUserID() { - return $this->userID; - } - - /** - * Set the current UserID - * - * @access private - * @param void - * @return int UserID - */ - function _setUserID($iUserID) { - return $this->userID = $iUserID; - } - - /** - * Serve a webdav request - * - * @access public - * @param void - * @return void - */ - function ServeRequest() { - - global $default; - - if ($this->debugInfo == 'on') { - - $this->ktwebdavLog('_SERVER is ' . print_r($_SERVER, true), 'info', true); - } - - // Get the client info - $this->checkSafeMode(); - - // identify ourselves - $this->ktwebdavLog('WebDAV Server : ' . $this->dav_powered_by . ' [KT:'.$default->systemVersion."]", 'info', true); - header('X-Dav-Powered-By: '.$this->dav_powered_by . ' [KT:'.$default->systemVersion.']'); - - // check authentication - if (!$this->_check_auth()) { - $this->ktwebdavLog('401 Unauthorized - Authorisation failed.' .$this->lastMsg, 'info', true); - $this->ktwebdavLog('----------------------------------------', 'info', true); - $this->http_status('401 Unauthorized - Authorisation failed. ' .$this->lastMsg); - - // RFC2518 says we must use Digest instead of Basic - // but Microsoft Clients do not support Digest - // and we don't support NTLM and Kerberos - // so we are stuck with Basic here - header('WWW-Authenticate: Basic realm="'.($this->http_auth_realm).'"'); - - return; - } - - // check - if(! $this->_check_if_header_conditions()) { - $this->http_status('412 Precondition failed'); - return; - } - - // set path - $request_uri = $this->_urldecode(!empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'); - $this->path = str_replace($_SERVER['SCRIPT_NAME'], '', $request_uri); - if(ini_get('magic_quotes_gpc')) { - $this->path = stripslashes($this->path); - } - - $this->ktwebdavLog('PATH_INFO is ' . $_SERVER['PATH_INFO'], 'info', true); - $this->ktwebdavLog('REQUEST_URI is ' . $_SERVER['REQUEST_URI'], 'info', true); - $this->ktwebdavLog('SCRIPT_NAME is ' . $_SERVER['SCRIPT_NAME'], 'info', true); - $this->ktwebdavLog('PHP_SELF is ' . $_SERVER['PHP_SELF'], 'info', true); - $this->ktwebdavLog('path set to ' . $this->path, 'info', true); - - // detect requested method names - $method = strtolower($_SERVER['REQUEST_METHOD']); - $wrapper = 'http_'.$method; - - $this->currentMethod = $method; - // activate HEAD emulation by GET if no HEAD method found - if ($method == 'head' && !method_exists($this, 'head')) { - // rfc2068 Sec: 10.2.1 - //HEAD the entity-header fields corresponding to the requested resource - // are sent in the response without any message-body - $method = 'get'; - } - $this->ktwebdavLog("Entering $method request", 'info', true); - - if (method_exists($this, $wrapper) && ($method == 'options' || method_exists($this, $method))) { - $this->$wrapper(); // call method by name - } else { // method not found/implemented - if ($_SERVER['REQUEST_METHOD'] == 'LOCK') { - $this->http_status('412 Precondition failed'); - } else { - $this->http_status('405 Method not allowed'); - header('Allow: '.join(', ', $this->_allow())); // tell client what's allowed - } - } - - $this->ktwebdavLog("Exiting $method request", 'info', true); - - } - - - /** - * check authentication if check is implemented - * - * @param void - * @return bool true if authentication succeded or not necessary - */ - function _check_auth() - { - $this->ktwebdavLog('Entering _check_auth...', 'info', true); - - if (method_exists($this, 'checkAuth')) { - // PEAR style method name - return $this->checkAuth(@$_SERVER['AUTH_TYPE'], - @$_SERVER['PHP_AUTH_USER'], - @$_SERVER['PHP_AUTH_PW']); - } else if (method_exists($this, 'check_auth')) { - // old (pre 1.0) method name - return $this->check_auth(@$_SERVER['AUTH_TYPE'], - @$_SERVER['PHP_AUTH_USER'], - @$_SERVER['PHP_AUTH_PW']); - } else { - // no method found -> no authentication required - return true; - } - } - - /** - * Authenticate user - * - * @access private - * @param string HTTP Authentication type (Basic, Digest, ...) - * @param string Username - * @param string Password - * @return bool true on successful authentication - */ - function checkAuth($sType, $sUser, $sPass) { - - $this->ktwebdavLog('Entering checkAuth params are: ', 'info', true); - $this->ktwebdavLog('sType: ' . $sType, 'info', true); - $this->ktwebdavLog('sUser: ' . $sUser, 'info', true); - $this->ktwebdavLog('sPass: ' . $sPass, 'info', true); - - // Authenticate user - - require_once(KT_LIB_DIR . '/authentication/authenticationutil.inc.php'); - - if ( empty($sUser) ) { - $this->ktwebdavLog('sUser is empty, returning false.', 'info', true); - return false; - } - - if ( empty($sPass) ) { - $this->ktwebdavLog('sPass is empty, returning false.', 'info', true); - return false; - } - - $oUser =& User::getByUsername($sUser); - if (PEAR::isError($oUser) || ($oUser === false)) { - $this->ktwebdavLog('User not found: ' . $sUser . '.', 'error'); - $this->lastMsg = 'User not found: ' . $sUser . '.'; - return false; - } - $authenticated = KTAuthenticationUtil::checkPassword($oUser, $sPass); - - if ($authenticated === false) { - $this->ktwebdavLog('Password incorrect for ' . $sUser . '.', 'error'); - $this->lastMsg = 'Password incorrect for ' . $sUser . '.'; - return false; - } - - if (PEAR::isError($authenticated)) { - $this->ktwebdavLog('Password incorrect for ' . $sUser . '.', 'error'); - $this->lastMsg = 'Password incorrect for ' . $sUser . '.'; - return false; - } - - $this->ktwebdavLog('UserID is: ' . $oUser->getId(), 'info', true ); - $this->_setUserID($oUser->getId()); - $_SESSION['userID'] = $this->_getUserID(); - $this->ktwebdavLog('SESSION UserID is: ' . $_SESSION['userID'], 'info', true ); - - $this->ktwebdavLog("Authentication Success.", 'info', true); - - return true; - } - - /** - * PROPFIND method handler - * - * @param array options - * @param array return array for file properties - * @return bool true on success - */ - function PROPFIND(&$options, &$files) { - - $this->ktwebdavLog("Entering PROPFIND. options are " . print_r($options, true), 'info', true); - - global $default; - - $fspath = $default->documentRoot . "/" . $this->rootFolder . $options["path"]; - $this->ktwebdavLog("fspath is " . $fspath, 'info', true); - - $path = $options["path"]; - - list($iFolderID, $iDocumentID) = $this->_folderOrDocument($path); - $this->ktwebdavLog("Folder/Doc is " . print_r(array($iFolderID, $iDocumentID), true), 'info', true); - - // Folder does not exist - if($iFolderID == '') return false; - - if (is_null($iDocumentID)) { - return $this->_PROPFINDFolder($options, $files, $iFolderID); - } - return $this->_PROPFINDDocument($options, $files, $iDocumentID); - - } - - /** - * PROPFIND helper for Folders - * - * @param array options - * @param array Return array for file props - * @param int Folder ID - * @return bool true on success - */ - function _PROPFINDFolder(&$options, &$files, $iFolderID) { - - global $default; - - $this->ktwebdavLog("Entering PROPFINDFolder. options are " . print_r($options, true), 'info', true); - - $folder_path = $options["path"]; - if (substr($folder_path, -1) != "/") { - $folder_path .= "/"; - } - $options["path"] = $folder_path; - - $files["files"] = array(); - $files["files"][] = $this->_fileinfoForFolderID($iFolderID, $folder_path); - - $oPerm =& KTPermission::getByName('ktcore.permissions.read'); - $oUser =& User::get($this->userID); - - if (!empty($options["depth"])) { - $aChildren = Folder::getList(array('parent_id = ?', $iFolderID)); - // FIXME: Truncation Time Workaround - //foreach (array_slice($aChildren, 0, 50) as $oChildFolder) { - foreach ($aChildren as $oChildFolder) { - // Check if the user has permissions to view this folder - $oFolderDetailsPerm =& KTPermission::getByName('ktcore.permissions.folder_details'); - - if(KTPermissionUtil::userHasPermissionOnItem($oUser, $oFolderDetailsPerm, $oChildFolder)) - { - $this->ktwebdavLog("Folder Details permissions GRANTED for user ". $_SESSION["userID"] ." on folder " . $oChildFolder->getName(), 'info', true); - $files["files"][] = $this->_fileinfoForFolder($oChildFolder, $folder_path . $oChildFolder->getName()); - } - else - { - $this->ktwebdavLog("Folder Details permissions DENIED for ". $_SESSION["userID"] ." on folder " . $oChildFolder->getName(), 'info', true); - } - } - $aDocumentChildren = Document::getList(array('folder_id = ? AND status_id = 1', $iFolderID)); - // FIXME: Truncation Time Workaround - //foreach (array_slice($aDocumentChildren, 0, 50) as $oChildDocument) { - foreach ($aDocumentChildren as $oChildDocument) { - // Check if the user has permissions to view this document - if (KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oChildDocument)) { - $this->ktwebdavLog("Read permissions GRANTED for ". $_SESSION["userID"] ." on document " . $oChildDocument->getName(), 'info', true); - $files["files"][] = $this->_fileinfoForDocument($oChildDocument, $folder_path . $oChildDocument->getFileName()); - } else $this->ktwebdavLog("Read permissions DENIED for ". $_SESSION["userID"] ." on document " . $oChildDocument->getName(), 'info', true); - } - } - return true; - } - - /** - * PROPFIND helper for Documents - * - * @param array options - * @param array Return array for file props - * @param int Document ID - * @return bool true on success - */ - function _PROPFINDDocument(&$options, &$files, $iDocumentID) { - - global $default; - - $this->ktwebdavLog("Entering PROPFINDDocument. files are " . print_r($files, true), 'info', true); - - $res = $this->_fileinfoForDocumentID($iDocumentID, $options["path"]); - $this->ktwebdavLog("_fileinfoForDocumentID result is " . print_r($res, true), 'info', true); - if ($res === false) { - return false; - } - $files["files"] = array(); - $files["files"][] = $res; - return true; - } - - /** - * PROPFIND helper for Document Info - * - * @param Document Document Object - * @param string Path - * @return array Doc info array - */ - function _fileinfoForDocument(&$oDocument, $path) { - - global $default; - - $this->ktwebdavLog("Entering _fileinfoForDocument. Document is " . print_r($oDocument, true), 'info', true); - - $fspath = $default->documentRoot . "/" . $this->rootFolder . $path; - $this->ktwebdavLog("fspath is " . $fspath, 'info', true); - - // create result array - $info = array(); - $info["path"] = $path; - $info["props"] = array(); - - // no special beautified displayname here ... - $info["props"][] = $this->mkprop("displayname", $oDocument->getName()); - - // creation and modification time - $info["props"][] = $this->mkprop("creationdate", strtotime($oDocument->getCreatedDateTime())); - $info["props"][] = $this->mkprop("getlastmodified", strtotime($oDocument->getVersionCreated())); - - // plain file (WebDAV resource) - $info["props"][] = $this->mkprop("resourcetype", ''); - // FIXME: Direct database access - $sQuery = array("SELECT mimetypes FROM $default->mimetypes_table WHERE id = ?", array($oDocument->getMimeTypeID())); - $res = DBUtil::getOneResultKey($sQuery, 'mimetypes'); - $info["props"][] = $this->mkprop("getcontenttype", $res); - - $info["props"][] = $this->mkprop("getcontentlength", $oDocument->getFileSize()); - - // explorer wants these? - $info["props"][] = $this->mkprop("name", ''); - $info["props"][] = $this->mkprop("parentname", ''); - $info["props"][] = $this->mkprop("href", ''); - $info["props"][] = $this->mkprop("ishidden", ''); - $info["props"][] = $this->mkprop("iscollection", ''); - $info["props"][] = $this->mkprop("isreadonly", ''); - $info["props"][] = $this->mkprop("contentclass", ''); - $info["props"][] = $this->mkprop("getcontentlanguage", ''); - $info["props"][] = $this->mkprop("lastaccessed", ''); - $info["props"][] = $this->mkprop("isstructureddocument", ''); - $info["props"][] = $this->mkprop("defaultdocument", ''); - $info["props"][] = $this->mkprop("isroot", ''); - - return $info; - } - - - /** - * PROPFIND helper for Document Info - * - * @param int Document ID - * @param string path - * @return array Doc info array - */ - function _fileinfoForDocumentID($iDocumentID, $path) { - - global $default; - - $this->ktwebdavLog("Entering _fileinfoForDocumentID. DocumentID is " . print_r($iDocumentID, true), 'info', true); - - if ($iDocumentID == '') return false; - - $oDocument =& Document::get($iDocumentID); - - if (is_null($oDocument) || ($oDocument === false) || PEAR::isError($oDocument)) { - return false; - } - - return $this->_fileinfoForDocument($oDocument, $path); - - } - - /** - * PROPFIND helper for Folder Info - * - * @param Folder Folder Object - * @param string $path - * @return array Folder info array - */ - function _fileinfoForFolder($oFolder, $path) { - - global $default; - - $this->ktwebdavLog("Entering _fileinfoForFolder. Folder is " . print_r($oFolder, true), 'info', true); - - // create result array - $info = array(); - $info["path"] = $path; - $fspath = $default->documentRoot . "/" . $this->rootFolder . $path; - //$fspath = $default->documentRoot . '/' . $oFolder->generateFolderPath($oFolder->getID()); - $info["props"] = array(); - - // no special beautified displayname here ... - $info["props"][] = $this->mkprop("displayname", $oFolder->getName()); - - // creation and modification time - //$info["props"][] = $this->mkprop("creationdate", strtotime($oFolder->getCreatedDateTime())); - //$info["props"][] = $this->mkprop("getlastmodified", strtotime($oFolder->getVersionCreated())); - - // directory (WebDAV collection) - $info["props"][] = $this->mkprop("resourcetype", "collection"); - $info["props"][] = $this->mkprop("getcontenttype", "httpd/unix-directory"); - $info["props"][] = $this->mkprop("getcontentlength", 0); - - return $info; - } - - /** - * PROPFIND method handler - * - * @param void - * @return void - */ - function http_PROPFIND() - { - $options = Array(); - $options["path"] = $this->path; - - // search depth from header (default is "infinity) - if (isset($_SERVER['HTTP_DEPTH'])) { - $options["depth"] = $_SERVER["HTTP_DEPTH"]; - } else { - $options["depth"] = "infinity"; - } - - // analyze request payload - $propinfo = new _parse_propfind("php://input"); - if (!$propinfo->success) { - $this->http_status("400 Error"); - return; - } - $options['props'] = $propinfo->props; - - // call user handler - if (!$this->PROPFIND($options, $files)) { - $this->http_status("404 Not Found"); - return; - } - - // collect namespaces here - $ns_hash = array(); - - // Microsoft Clients need this special namespace for date and time values - $ns_defs = "xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\""; - - // now we loop over all returned file entries - foreach($files["files"] as $filekey => $file) { - - // nothing to do if no properties were returned for a file - if (!isset($file["props"]) || !is_array($file["props"])) { - continue; - } - - // now loop over all returned properties - foreach($file["props"] as $key => $prop) { - // as a convenience feature we do not require that user handlers - // restrict returned properties to the requested ones - // here we strip all unrequested entries out of the response - - switch($options['props']) { - case "all": - // nothing to remove - break; - - case "names": - // only the names of all existing properties were requested - // so we remove all values - unset($files["files"][$filekey]["props"][$key]["val"]); - break; - - default: - $found = false; - - // search property name in requested properties - foreach((array)$options["props"] as $reqprop) { - if ( $reqprop["name"] == $prop["name"] - && $reqprop["xmlns"] == $prop["ns"]) { - $found = true; - break; - } - } - - // unset property and continue with next one if not found/requested - if (!$found) { - $files["files"][$filekey]["props"][$key]=''; - continue(2); - } - break; - } - - // namespace handling - if (empty($prop["ns"])) continue; // no namespace - $ns = $prop["ns"]; - if ($ns == "DAV:") continue; // default namespace - if (isset($ns_hash[$ns])) continue; // already known - - // register namespace - $ns_name = "ns".(count($ns_hash) + 1); - $ns_hash[$ns] = $ns_name; - $ns_defs .= " xmlns:$ns_name=\"$ns\""; - } - - // we also need to add empty entries for properties that were requested - // but for which no values where returned by the user handler - if (is_array($options['props'])) { - foreach($options["props"] as $reqprop) { - if($reqprop['name']=='') continue; // skip empty entries - - $found = false; - - // check if property exists in result - foreach($file["props"] as $prop) { - if ( $reqprop["name"] == $prop["name"] - && $reqprop["xmlns"] == $prop["ns"]) { - $found = true; - break; - } - } - - if (!$found) { - if($reqprop["xmlns"]==="DAV:" && $reqprop["name"]==="lockdiscovery") { - // lockdiscovery is handled by the base class - $files["files"][$filekey]["props"][] - = $this->mkprop("DAV:", - "lockdiscovery" , - $this->lockdiscovery($files["files"][$filekey]['path'])); - } else { - // add empty value for this property - $files["files"][$filekey]["noprops"][] = $this->mkprop($reqprop["xmlns"], $reqprop["name"], ''); - - // register property namespace if not known yet - if ($reqprop["xmlns"] != "DAV:" && !isset($ns_hash[$reqprop["xmlns"]])) { - $ns_name = "ns".(count($ns_hash) + 1); - $ns_hash[$reqprop["xmlns"]] = $ns_name; - $ns_defs .= " xmlns:$ns_name=\"$reqprop[xmlns]\""; - } - } - } - } - } - } - - // now we generate the reply header ... - $this->http_status("207 Multi-Status"); - header('Content-Type: text/xml; charset="utf-8"'); - - // ... and payload - echo "\n"; - echo "\n"; - - foreach($files["files"] as $file) { - // ignore empty or incomplete entries - if(!is_array($file) || empty($file) || !isset($file["path"])) continue; - $path = $file['path']; - if(!is_string($path) || $path==='') continue; - - echo " \n"; - - $href = htmlspecialchars($this->_slashify($this->_mergePathes($_SERVER['SCRIPT_NAME'], $path))); - - echo " $href\n"; - - $this->ktwebdavLog("\nfile is: " . print_r($file, true), 'info', true); - - // report all found properties and their values (if any) - if (isset($file["props"]) && is_array($file["props"])) { - echo " \n"; - echo " \n"; - - foreach($file["props"] as $key => $prop) { - - if (!is_array($prop)) continue; - if (!isset($prop["name"])) continue; - - $this->ktwebdavLog("Namespace is " . $prop["ns"], 'info', true); - - if (!isset($prop["val"]) || $prop["val"] === '' || $prop["val"] === false) { - // empty properties (cannot use empty() for check as "0" is a legal value here) - if($prop["ns"]=="DAV:") { - echo " \n"; - } else if(!empty($prop["ns"])) { - echo " <".$ns_hash[$prop["ns"]].":$prop[name]/>\n"; - } else { - echo " <$prop[name] xmlns=\"\"/>"; - } - } else if ($prop["ns"] == "DAV:") { - $this->ktwebdavLog("Getting DAV: Properties...", 'info', true); - // some WebDAV properties need special treatment - switch ($prop["name"]) { - case "creationdate": - $this->ktwebdavLog("Getting creationdate...", 'info', true); - echo " " - . gmdate("Y-m-d\\TH:i:s\\Z",$prop['val']) - . "\n"; - break; - case "getlastmodified": - $this->ktwebdavLog("Getting getlastmodified...", 'info', true); - echo " " - . gmdate("D, d M Y H:i:s ", $prop['val']) - . "GMT\n"; - break; - case "resourcetype": - $this->ktwebdavLog("Getting resourcetype...", 'info', true); - echo " \n"; - break; - case "supportedlock": - $this->ktwebdavLog("Getting supportedlock...", 'info', true); - echo " $prop[val]\n"; - break; - case "lockdiscovery": - $this->ktwebdavLog("Getting lockdiscovery...", 'info', true); - echo " \n"; - echo $prop["val"]; - echo " \n"; - break; - default: - $this->ktwebdavLog("Getting default...", 'info', true); - $this->ktwebdavLog("name is: " . $prop['name'], 'info', true); - $this->ktwebdavLog("val is: " . $this->_prop_encode(htmlspecialchars($prop['val'])), 'info', true); - echo " " - . $this->_prop_encode(htmlspecialchars($prop['val'])) - . "\n"; - break; - } - } else { - // properties from namespaces != "DAV:" or without any namespace - $this->ktwebdavLog('Getting != "DAV:" or without any namespace Properties...', 'info', true); - if ($prop["ns"]) { - echo " <" . $ns_hash[$prop["ns"]] . ":$prop[name]>" - . $this->_prop_encode(htmlspecialchars($prop['val'])) - . "\n"; - } else { - echo " <$prop[name] xmlns=\"\">" - . $this->_prop_encode(htmlspecialchars($prop['val'])) - . "\n"; - } - } - } - - echo " \n"; - echo " HTTP/1.1 200 OK\n"; - echo " \n"; - } - - // now report all properties requested but not found - $this->ktwebdavLog('Getting all properties requested but not found...', 'info', true); - if (isset($file["noprops"])) { - echo " \n"; - echo " \n"; - - foreach($file["noprops"] as $key => $prop) { - if ($prop["ns"] == "DAV:") { - echo " \n"; - } else if ($prop["ns"] == '') { - echo " <$prop[name] xmlns=\"\"/>\n"; - } else { - echo " <" . $ns_hash[$prop["ns"]] . ":$prop[name]/>\n"; - } - } - - echo " \n"; - echo " HTTP/1.1 404 Not Found\n"; - echo " \n"; - } - - echo " \n"; - } - - echo "\n"; - } - - /** - * PROPFIND helper for Folder Info - * - * @param int Folder ID - * @param string path - * @return array Folder info array - */ - function _fileinfoForFolderID($iFolderID, $path) { - - global $default; - - $this->ktwebdavLog("Entering _fileinfoForFolderID. FolderID is " . $iFolderID, 'info', true); - - if($iFolderID == '') return false; - - $oFolder =& Folder::get($iFolderID); - - if (is_null($oFolder) || ($oFolder === false)) { - $this->ktwebdavLog("oFolderID error. ", 'info', true); - return false; - } - - return $this->_fileinfoForFolder($oFolder, $path); - } - - /** - * GET method handler - * - * @param array parameter passing array - * @return bool true on success - */ - function GET(&$options) - { - // required for KT - global $default; - - $this->ktwebdavLog("Entering GET. options are " . print_r($options, true), 'info', true); - - // Get the client info - $this->checkSafeMode(); - - // get path to requested resource - $path = $options["path"]; - - list($iFolderID, $iDocumentID) = $this->_folderOrDocument($path); - - if ($iDocumentID === false) { - $this->ktwebdavLog("Document not found.", 'info', true); - return "404 Not found - Document not found."; - } - - if (is_null($iDocumentID)) { - return $this->_GETFolder($options, $iFolderID); - } - return $this->_GETDocument($options, $iDocumentID); - - } - - /** - * GET method helper - * - * @param array parameter passing array - * @param int MainFolder ID - * @return bool true on success - */ - function _GETFolder(&$options, $iMainFolderID) { - - global $default; - - $this->ktwebdavLog("Entering _GETFolder. options are " . print_r($options, true), 'info', true); - - $oMainFolder =& Folder::get($iMainFolderID); - $aFolderID = array(); - $aChildren = Folder::getList(array('parent_id = ?', $iMainFolderID)); - // $sFolderName = $oMainFolder->getName(); - - if (is_writeable("../var") && is_writeable("../var/log")) { - $writeperms = "OK"; - }else { - $writeperms = "NOT SET"; - } - - if ($this->ktdmsPath != '') { - $ktdir = $this->ktdmsPath; - } - - $srv_proto = split('/', $_SERVER['SERVER_PROTOCOL']); - - $data = "KTWebDAV - The KnowledgeTree WebDAV Server"; - $data .= ""; - $data .= "

"; - $data .= "

Welcome to KnowledgeTree WebDAV Server



"; - $data .= "
To access KTWebDAV copy the following URL and paste it into your WebDAV enabled client...


"; - $data .= "
" . strtolower($srv_proto[0]) . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "
"; - $data .= ""; - - $options['mimetype'] = 'text/html'; - $options["data"] = $data; - return true; - } - - /** - * GET method helper - * - * @param array parameter passing array - * @param int Document ID - * @return bool true on success - */ - function _GETDocument(&$options, $iDocumentID) { - global $default; - - $oDocument =& Document::get($iDocumentID); - - // get a temp file, and read. NOTE: NEVER WRITE TO THIS - $oStorage =& KTStorageManagerUtil::getSingleton(); - $fspath = $oStorage->temporaryFile($oDocument); - - $this->ktwebdavLog("Filesystem Path is " . $fspath, 'info', true ); - - // detect resource type - $mimetype = KTMime::getMimeTypeName($oDocument->getMimeTypeID()); - $options['mimetype'] = KTMime::getFriendlyNameForString($mimetype); - // detect modification time - // see rfc2518, section 13.7 - // some clients seem to treat this as a reverse rule - // requiering a Last-Modified header if the getlastmodified header was set - - $options['mtime'] = $oDocument->getVersionCreated(); - - // detect resource size - $options['size'] = $oDocument->getFileSize(); - - // no need to check result here, it is handled by the base class - $options['stream'] = fopen($fspath, "r"); - - $this->ktwebdavLog("Method is " . $this->currentMethod, 'info', true ); - - if ($this->currentMethod == "get") { - - // create the document transaction record - include_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc'); - $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document viewed via KTWebDAV", 'ktcore.transactions.view'); - $oDocumentTransaction->iUserID = $this->userID; - $oDocumentTransaction->create(); - - } - return true; - } - - /** - * GET method helper - * - * @param string directory path - * @return array or false - */ - function _folderOrDocument($path) { - - global $default; - - $this->ktwebdavLog("Entering _folderOrDocument. path is " . $path, 'info', true); - - if ( !(strstr($path,"__BAOBABCLIENT__") === false) ) { - return array(0, 1); - } - - $sFileName = basename($path); - // for windows replace backslash with forwardslash - $sFolderPath = str_replace("\\", '/', dirname($path) ); - - if ($sFolderPath == "/" || $sFolderPath == "/ktwebdav") { - $this->ktwebdavLog("This is the root folder.", 'info', true); - $sFolderPath = $this->rootFolder; - $iFolderID = 0; - } else $iFolderID = 1; - if ($sFileName == "ktwebdav.php") { - $this->ktwebdavLog("This is the root folder file.", 'info', true); - $sFileName = ''; - } - - $this->ktwebdavLog("sFileName is " . $sFileName, 'info', true); - $this->ktwebdavLog("sFolderName is " . $sFolderPath, 'info', true); - $this->ktwebdavLog("iFolderID is " . $iFolderID, 'info', true); - - $aFolderNames = split('/', $sFolderPath); - - $this->ktwebdavLog("aFolderNames are: " . print_r($aFolderNames, true), 'info', true); - $aRemaining = $aFolderNames; - while (count($aRemaining)) { - $sFolderName = $aRemaining[0]; - $aRemaining = array_slice($aRemaining, 1); - if ($sFolderName == '') { - continue; - } - // FIXME: Direct database access - $sQuery = "SELECT id FROM folders WHERE parent_id = ? AND name = ?"; - $aParams = array($iFolderID, $sFolderName); - $id = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id'); - if (PEAR::isError($id)) { - $this->ktwebdavLog("A DB error occurred in _folderOrDocument", 'info', true); - return false; - } - if (is_null($id)) { - // Some intermediary folder path doesn't exist - $this->ktwebdavLog("Some intermediary folder does not exist in _folderOrDocument", 'error', true); - return array(false, false); - } - $iFolderID = (int)$id; - $this->ktwebdavLog("iFolderID set to " . $iFolderID, 'info', true); - } - - // FIXME: Direct database access - // $sQuery = "SELECT id FROM documents WHERE folder_id = ? AND filename = ? AND status_id = 1"; - $sQuery = "SELECT D.id "; - $sQuery .= "FROM documents AS D "; - $sQuery .= "LEFT JOIN document_metadata_version AS DM "; - $sQuery .= "ON D.metadata_version_id = DM.id "; - $sQuery .= "LEFT JOIN document_content_version AS DC "; - $sQuery .= "ON DM.content_version_id = DC.id "; - $sQuery .= "WHERE D.folder_id = ? AND DC.filename = ?"; - - $aParams = array($iFolderID, $sFileName); - $iDocumentID = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id'); - - if (PEAR::isError($iDocumentID)) { - $this->ktwebdavLog("iDocumentID error in _folderOrDocument", 'info', true); - return false; - } - - if ($iDocumentID === null) { - $this->ktwebdavLog("iDocumentID is null", 'info', true); - // FIXME: Direct database access - $sQuery = "SELECT id FROM folders WHERE parent_id = ? AND name = ?"; - $aParams = array($iFolderID, $sFileName); - $id = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id'); - if (PEAR::isError($id)) { - $this->ktwebdavLog("A DB(2) error occurred in _folderOrDocument", 'info', true); - return false; - } - if (is_null($id)) { - if ($sFileName == '') { - return array($iFolderID, null); - } - $this->ktwebdavLog("id is null in _folderOrDocument", 'info', true); - return array($iFolderID, false); - } - if (substr($path, -1) !== "/") { - $this->ktwebdavLog("Setting Location Header to " . "Location: " . $_SERVER["PHP_SELF"] . "/", 'info', true); - header("Location: " . $_SERVER["PHP_SELF"] . "/"); - } - return array($id, null); - } - - return array($iFolderID, (int)$iDocumentID); - } - - /** - * PUT method handler - * - * @param array parameter passing array - * @return string HTTP status code or false - */ - function PUT(&$options) - { - global $default; - - if ($this->checkSafeMode()) { - - $this->ktwebdavLog("Entering PUT. options are " . print_r($options, true), 'info', true); - $this->ktwebdavLog("dav_client is: " . $this->dav_client, 'info', true); - - $path = $options["path"]; - - $res = $this->_folderOrDocument($path); - list($iFolderID, $iDocumentID) = $res; - - if ($iDocumentID === false && $iFolderID === false) { - // Couldn't find intermediary paths - /* - * RFC2518: 8.7.1 PUT for Non-Collection Resources - * - * 409 (Conflict) - A PUT that would result in the creation - * of a resource without an appropriately scoped parent collection - * MUST fail with a 409 (Conflict). - */ - return "409 Conflict - Couldn't find intermediary paths"; - } - - $oParentFolder =& Folder::get($iFolderID); - // Check if the user has permissions to write in this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.write'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oParentFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - - $this->ktwebdavLog("iDocumentID is " . $iDocumentID, 'info', true); - - if (is_null($iDocumentID)) { - // This means there is a folder with the given path - $this->ktwebdavLog("405 Method not allowed", 'info', true); - return "405 Method not allowed - There is a folder with the given path"; - } - - if ($iDocumentID == false) { - $this->ktwebdavLog("iDocumentID is false", 'info', true); - } - - if ($iDocumentID !== false) { - // This means there is a document with the given path - $oDocument = Document::get($iDocumentID); - - $this->ktwebdavLog("oDocument is " . print_r($oDocument, true), 'info', true); - $this->ktwebdavLog("oDocument statusid is " . print_r($oDocument->getStatusID(), true), 'info', true); - - if ( ( (int)$oDocument->getStatusID() != STATUS_WEBDAV ) && ( (int)$oDocument->getStatusID() != DELETED )) { - $this->ktwebdavLog("Trying to PUT to an existing document", 'info', true); - if (!$this->dav_client == "MS" && !$this->dav_client == "MC") return "409 Conflict - There is a document with the given path"; - } - - // FIXME: Direct filesystem access - $fh = $options["stream"]; - $sTempFilename = tempnam('/tmp', 'ktwebdav_dav_put'); - $ofh = fopen($sTempFilename, 'w'); - - $contents = ''; - while (!feof($fh)) { - $contents .= fread($fh, 8192); - } - $fres = fwrite($ofh, $contents); - $this->ktwebdavLog("A DELETED or CHECKEDOUT document exists. Overwriting...", 'info', true); - $this->ktwebdavLog("Temp Filename is: " . $sTempFilename, 'info', true ); - $this->ktwebdavLog("File write result size was: " . $fres, 'info', true ); - - fflush($fh); - fclose($fh); - fflush($ofh); - fclose($ofh); - $this->ktwebdavLog("Files have been flushed and closed.", 'info', true ); - - $name = basename($path); - $aFileArray = array( - "name" => $name, - "size" => filesize($sTempFilename), - "type" => false, - "userID" => $this->_getUserID(), - ); - $this->ktwebdavLog("aFileArray is " . print_r($aFileArray, true), 'info', true); - - include_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); - $aOptions = array( - 'contents' => new KTFSFileLike($sTempFilename), - 'metadata' => array(), - 'novalidate' => true, - ); - $oDocument =& KTDocumentUtil::add($oParentFolder, $name, $oUser, $aOptions); - - if(PEAR::isError($oDocument)) { - $this->ktwebdavLog("oDocument ERROR: " . $oDocument->getMessage(), 'info', true); - unlink($sTempFilename); - return "409 Conflict - " . $oDocument->getMessage(); - } - - $this->ktwebdavLog("oDocument is " . print_r($oDocument, true), 'info', true); - - unlink($sTempFilename); - return "204 No Content"; - } - - $options["new"] = true; - // FIXME: Direct filesystem access - $fh = $options["stream"]; - $sTempFilename = tempnam('/tmp', 'ktwebdav_dav_put'); - $ofh = fopen($sTempFilename, 'w'); - - $contents = ''; - while (!feof($fh)) { - $contents .= fread($fh, 8192); - } - $fres = fwrite( $ofh, $contents); - $this->ktwebdavLog("Content length was not 0, doing the whole thing.", 'info', true ); - $this->ktwebdavLog("Temp Filename is: " . $sTempFilename, 'info', true ); - $this->ktwebdavLog("File write result size was: " . $fres, 'info', true ); - - fflush($fh); - fclose($fh); - fflush($ofh); - fclose($ofh); - $this->ktwebdavLog("Files have been flushed and closed.", 'info', true ); - - $name = basename($path); - $aFileArray = array( - "name" => $name, - "size" => filesize($sTempFilename), - "type" => false, - "userID" => $this->_getUserID(), - ); - $this->ktwebdavLog("aFileArray is " . print_r($aFileArray, true), 'info', true); - - include_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); - $aOptions = array( - 'contents' => new KTFSFileLike($sTempFilename), - 'metadata' => array(), - 'novalidate' => true, - ); - $oDocument =& KTDocumentUtil::add($oParentFolder, $name, $oUser, $aOptions); - - if(PEAR::isError($oDocument)) { - $this->ktwebdavLog("oDocument ERROR: " . $oDocument->getMessage(), 'info', true); - unlink($sTempFilename); - return "409 Conflict - " . $oDocument->getMessage(); - } - - $this->ktwebdavLog("oDocument is " . print_r($oDocument, true), 'info', true); - - unlink($sTempFilename); - return "201 Created"; - - } else return "423 Locked - KTWebDAV is in SafeMode"; - - } - - /** - * MKCOL method handler - * - * @param array parameter passing array - * @return string HTTP status code or false - */ - function MKCOL($options) - { - $this->ktwebdavLog("Entering MKCOL. options are " . print_r($options, true), 'info', true); - - if ($this->checkSafeMode()) { - - global $default; - - if (!empty($_SERVER["CONTENT_LENGTH"])) { - /* - * RFC2518: 8.3.2 MKCOL status codes - * - * 415 (Unsupported Media Type)- The server does not support - * the request type of the body. - */ - return "415 Unsupported media type"; - } - - // Take Windows's escapes out - $path = str_replace('\\', '' , $options['path']); - - - $res = $this->_folderOrDocument($path); - list($iFolderID, $iDocumentID) = $res; - - if ($iDocumentID === false && $iFolderID === false) { - // Couldn't find intermediary paths - /* - * RFC2518: 8.3.2 MKCOL status codes - * - * 409 (Conflict) - A collection cannot be made at the - * Request-URI until one or more intermediate collections - * have been created. - */ - $this->ktwebdavLog("409 Conflict in MKCOL", 'info', true); - return "409 Conflict - Couldn't find intermediary paths"; - } - - - if (is_null($iDocumentID)) { - // This means there is a folder with the given path - /* - * RFC2518: 8.3.2 MKCOL status codes - * - * 405 (Method Not Allowed) - MKCOL can only be executed on - * a deleted/non-existent resource. - */ - $this->ktwebdavLog("405 Method not allowed - There is a folder with the given path", 'info', true); - return "405 Method not allowed - There is a folder with the given path"; - } - if ($iDocumentID !== false) { - // This means there is a document with the given path - /* - * RFC2518: 8.3.2 MKCOL status codes - * - * 405 (Method Not Allowed) - MKCOL can only be executed on - * a deleted/non-existent resource. - */ - $this->ktwebdavLog("405 Method not allowed - There is a document with the given path", 'info', true); - return "405 Method not allowed - There is a document with the given path"; - } - - $sFolderName = basename($path); - $sFolderPath = dirname($path); - - $dest_fspath = $default->documentRoot . "/" . $this->rootFolder . $path; - $this->ktwebdavLog("Will create a physical path of " . $dest_fspath, 'info', true); - - $oParentFolder =& Folder::get($iFolderID); - $this->ktwebdavLog("Got an oParentFolder of " . print_r($oParentFolder, true), 'info', true); - - // Check if the user has permissions to write in this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.addFolder'); - $oUser =& User::get($this->userID); - - $this->ktwebdavLog("oPerm is " . print_r($oPerm, true), 'info', true); - $this->ktwebdavLog("oUser is " . print_r($oUser, true), 'info', true); - $this->ktwebdavLog("oFolder is " . print_r($oParentFolder, true), 'info', true); - - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oParentFolder)) { - $this->ktwebdavLog("Permission denied.", 'info', true); - return "403 Forbidden - User does not have sufficient permissions"; - } else $this->ktwebdavLog("Permission granted.", 'info', true); - - - include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); - - KTFolderUtil::add($oParentFolder, $sFolderName, $oUser); - /* - * RFC 2518: 8.3.2 MKCOL status codes - * - * 201 (Created) - The collection or structured resource was - * created in its entirety. - */ - $this->ktwebdavLog("201 Created", 'info', true); - return "201 Created"; - - } else return "423 Locked - KTWebDAV is in SafeMode"; - } - - - /** - * DELETE method handler - * - * @param array parameter passing array - * @return string HTTP status code or false - */ - function DELETE($options) - { - $this->ktwebdavLog("Entering DELETE. options are " . print_r($options, true), 'info', true); - - if ($this->checkSafeMode()) { - - $path = $options["path"]; - $res = $this->_folderOrDocument($path); - $this->ktwebdavLog("DELETE res is " . print_r($res, true), 'info', true); - if ($res === false) { - $this->ktwebdavLog("404 Not found - The Document was not found.", 'info', true); - return "404 Not found - The Document was not found."; - } - list($iFolderID, $iDocumentID) = $res; - - if ($iDocumentID === false) { - $this->ktwebdavLog("404 Not found - The Folder was not found.", 'info', true); - return "404 Not found - The Folder was not found."; - } - - if (is_null($iDocumentID)) { - return $this->_DELETEFolder($options, $iFolderID); - } - return $this->_DELETEDocument($options, $iFolderID, $iDocumentID); - - } else return "423 Locked - KTWebDAV is in SafeMode"; - } - - /** - * DELETE method helper for Documents - * - * @param array parameter passing array - * @param int Folder ID - * @param int Document ID - * @return string HTTP status code or false - */ - function _DELETEDocument($options, $iFolderID, $iDocumentID) { - - $this->ktwebdavLog("Entering _DELETEDocument. options are " . print_r($options, true), 'info', true); - - global $default; - - $oDocument =& Document::get($iDocumentID); - - // Check if the user has permissions to delete this document - $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDocument)) { - return "403 Forbidden - The user does not have sufficient permissions"; - } - - $res = KTDocumentUtil::delete($oDocument, $_SERVER['HTTP_REASON']); - - if (PEAR::isError($res)) { - $this->ktwebdavLog("404 Not Found - " . $res->getMessage(), 'info', true); - return "404 Not Found - " . $res->getMessage(); - } - - $this->ktwebdavLog("204 No Content", 'info', true); - return "204 No Content"; - } - - /** - * DELETE method helper for Folders - * - * @param array paramter passing array - * @param int Folder ID - * @return string HTTP status code or false - */ - function _DELETEFolder($options, $iFolderID) { - - $this->ktwebdavLog("Entering _DELETEFolder. options are " . print_r($options, true), 'info', true); - - global $default; - - require_once(KT_LIB_DIR . "/foldermanagement/folderutil.inc.php"); - - // Check if the user has permissions to delete this folder - $oFolder =& Folder::get($iFolderID); - $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oFolder)) { - return "403 Forbidden - The user does not have sufficient permissions"; - } - $this->ktwebdavLog("Got an oFolder of " . print_r($oFolder, true), 'info', true); - $this->ktwebdavLog("Got an oUser of " . print_r($oUser, true), 'info', true); - $res = KTFolderUtil::delete($oFolder, $oUser, 'KTWebDAV Delete'); - - if (PEAR::isError($res)) { - $this->ktwebdavLog("Delete Result error " . print_r($res, true), 'info', true); - return "403 Forbidden - ".$res->getMessage(); - } - - return "204 No Content"; - } - - /** - * MOVE method handler - * - * @param array parameter passing array - * @return string HTTP status code or false - */ - function MOVE($options) - { - // Use the WebDAV standards way. - // See rfc2518 Section 8.9 - // This does a copy with delete - // FIXME: This way does not retain document history and other info - - //return $this->COPY($options, true); - - // Use the KT way. - // FIXME: This way does not allow overwrite - - $this->ktwebdavLog("Entering MOVE. options are " . print_r($options, true), 'info', true); - - if ($this->checkSafeMode()) { - - if (!empty($_SERVER["CONTENT_LENGTH"])) { // no body parsing yet - $this->ktwebdavLog("415 Unsupported media type", 'info', true); - return "415 Unsupported media type"; - } - - /* // no moving to different WebDAV Servers yet - if (isset($options["dest_url"])) { - $this->ktwebdavLog("502 bad gateway - No moving to different WebDAV Servers yet", 'info', true); - return "502 bad gateway - No moving to different WebDAV Servers yet"; - } - */ - $source_path = $options["path"]; - $source_res = $this->_folderOrDocument($source_path); - if ($source_res === false) { - $this->ktwebdavLog("404 Not found - Document was not found.", 'info', true); - return "404 Not found - Document was not found."; - } - - list($iFolderID, $iDocumentID) = $source_res; - if ($iDocumentID === false) { - $this->ktwebdavLog("404 Not found - Folder was not found.", 'info', true); - return "404 Not found - Folder was not found."; - } - - if (is_null($iDocumentID)) { - // Source is a folder - $movestat = $this->_MOVEFolder($options, $iFolderID); - - } else { - // Source is a document - $movestat = $this->_MOVEDocument($options, $iFolderID, $iDocumentID); - - } - - $this->ktwebdavLog("Final movestat result is: " . $movestat, 'info', true); - return $movestat; - - } else return "423 Locked - KTWebDAV is in SafeMode"; - - } - - /** - * MOVE method helper for Documents - * - * @param array parameter passing array - * @param int Folder ID - * @param int Document ID - * @return string HTTP status code or false - */ - function _MOVEDocument($options, $iFolderID, $iDocumentID) { - - if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); - $this->ktwebdavLog("Entering _MOVEDocument. options are " . print_r($options, true), 'info', true); - global $default; - $new = true; - //FIXME: refactor me into KTDocumentUtil - - $oDocument = Document::get($iDocumentID); - $oSrcFolder = Folder::get($iFolderID); - $oUser =& User::get($this->userID); - - $source_path = $options["path"]; - $dest_path = urldecode($options["dest"]); - - // Is this a rename? - if (dirname($source_path) == dirname($dest_path)) { - // This is a rename - //if ($options['overwrite'] != 'T') { - // $this->ktwebdavLog("This is a Rename. Overwrite needs to be TRUE.", 'info', true); - // return "412 Precondition Failed - This is a Rename. Overwrite needs to be TRUE."; - //} - $this->ktwebdavLog("Got an oDocument of " . print_r($oDocument, true), 'info', true); - $this->ktwebdavLog("Got an new name of " . basename($dest_path), 'info', true); - - // Check if the user has permissions to write this document - $oPerm =& KTPermission::getByName('ktcore.permissions.write'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDocument)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - $res = KTDocumentUtil::rename($oDocument, basename($dest_path), $oUser); - if (PEAR::isError($res) || is_null($res) || ($res === false)) { - return "404 Not Found - " . $res->getMessage(); - } else { - $this->ktwebdavLog("201 Created", 'info', true); - return "201 Created"; - } - - } - - list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); - - if (is_null($iDestDoc)) { - // the dest is a folder - } else if ($iDestDoc !== false) { - // Document exists - $this->ktwebdavLog("Destination Document exists.", 'info', true); - $oReplaceDoc = Document::get($iDestDoc); - if ($options['overwrite'] != 'T') { - $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); - return "412 Precondition Failed - Destination Document exists. Overwrite needs to be TRUE."; - } - $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Document.", 'info', true); - - // Check if the user has permissions to delete this document - $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceDoc)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTDocumentUtil::delete($oReplaceDoc, 'KTWebDAV move overwrites target.'); - $new = false; - } - - $oDestFolder = Folder::get($iDestFolder); - $this->ktwebdavLog("Got a destination folder of " . print_r($oDestFolder, true), 'info', true); - - // Check if the user has permissions to write in this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.write'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDestFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - - $oOriginalFolder = $oSrcFolder; - $iOriginalFolderPermissionObjectId = $oOriginalFolder->getPermissionObjectId(); - $iDocumentPermissionObjectId = $oDocument->getPermissionObjectId(); - - if ($iDocumentPermissionObjectId === $iOriginalFolderPermissionObjectId) { - $oDocument->setPermissionObjectId($oDestFolder->getPermissionObjectId()); - } - - //put the document in the new folder - $oDocument->setFolderID($oDestFolder->getId()); - if (!$oDocument->update(true)) { - return "502 Bad Gateway - Document update failed."; - } - - //move the document on the file system - $oStorage =& KTStorageManagerUtil::getSingleton(); - if (!$oStorage->moveDocument($oDocument, $oSrcFolder, $oDestFolder)) { - $oDocument->setFolderID($oSrcDocumentFolder->getId()); - $oDocument->update(true); - return "502 Bad Gateway"; - } - - $sMoveMessage = sprintf("Moved from %s/%s to %s/%s: %s", - $oSrcFolder->getFullPath(), - $oSrcFolder->getName(), - $oDestFolder->getFullPath(), - $oDestFolder->getName(), - $_SERVER['HTTP_REASON']); - - // create the document transaction record - $oDocumentTransaction = & new DocumentTransaction($oDocument, $sMoveMessage, 'ktcore.transactions.move'); - $oDocumentTransaction->create(); - - $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); - $aTriggers = $oKTTriggerRegistry->getTriggers('moveDocument', 'postValidate'); - foreach ($aTriggers as $aTrigger) { - $sTrigger = $aTrigger[0]; - $oTrigger = new $sTrigger; - $aInfo = array( - "document" => $oDocument, - "old_folder" => $oSrcFolder, - "new_folder" => $oDestFolder, - ); - $oTrigger->setInfo($aInfo); - $ret = $oTrigger->postValidate(); - // FIXME: handle trigger subfailures. - } - - if ($new) { - return "201 Created"; - } else { - return "204 No Content"; - } - } - - /** - * MOVE method helper for Folders - * - * @param array parameter passing array - * @param int Folder ID - * @return string HTTP status code or false - - */ - function _MOVEFolder($options, $iFolderID) { - - if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); - $this->ktwebdavLog("Entering _MOVEFolder. options are " . print_r($options, true), 'info', true); - - if ($options["depth"] != "infinity") { - // RFC 2518 Section 9.2, last paragraph - $this->ktwebdavLog("400 Bad request", 'info', true); - return "400 Bad request - depth must be 'inifinity'."; - } - - global $default; - - $source_path = $options["path"]; - $dest_path = urldecode($options["dest"]); - - $oSrcFolder = Folder::get($iFolderID); - - list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); - - $oDestFolder = Folder::get($iDestFolder); - - // Is this a rename? - if (dirname($source_path) == dirname($dest_path)) { - // This is a rename - //if ($options['overwrite'] != 'T') { - // $this->ktwebdavLog("This is a Rename. Overwrite needs to be TRUE.", 'info', true); - // return "412 Precondition Failed - This is a Rename. Overwrite needs to be TRUE."; - //} - - $this->ktwebdavLog("Got an oSrcFolder of " . print_r($oSrcFolder, true), 'info', true); - $this->ktwebdavLog("Got an new name of " . basename($dest_path), 'info', true); - - include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); - - // Check if the user has permissions to write this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.folder_rename'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oSrcFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - $res = KTFolderUtil::rename($oSrcFolder, basename($dest_path), $oUser); - if (PEAR::isError($res) || is_null($res) || ($res === false)) { - return "404 Not Found - " . $res->getMessage(); - } else { - $this->ktwebdavLog("201 Created", 'info', true); - return "201 Created"; - } - - } - - if (is_null($iDestDoc)) { - // the dest is a folder - } else if ($iDestDoc !== false) { - // Folder exists - $this->ktwebdavLog("Destination Folder exists.", 'info', true); - $oReplaceFolder = Folder::get($iDestDoc); - if ($options['overwrite'] != 'T') { - $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); - return "412 Precondition Failed - Destination Folder exists. Overwrite needs to be TRUE."; - } - $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Folder.", 'info', true); - - // Check if the user has permissions to delete this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTFolderUtil::delete($oReplaceFolder, 'KTWebDAV move overwrites target.'); - $new = false; - } - - include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); - - $oUser =& User::get($this->userID); - $this->ktwebdavLog("Got an oSrcFolder of " . print_r($oSrcFolder, true), 'info', true); - $this->ktwebdavLog("Got an oDestFolder of " . print_r($oDestFolder, true), 'info', true); - $this->ktwebdavLog("Got an oUser of " . print_r($oUser, true), 'info', true); - - // Check if the user has permissions to write in this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.write'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDestFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTFolderUtil::move($oSrcFolder, $oDestFolder, $oUser); - - $this->ktwebdavLog("201 Created", 'info', true); - return "201 Created"; - - } - - /** - * COPY method handler - * - * @param array parameter passing array - * @param string delete source flag - * @return string HTTP status code or false - */ - function COPY($options, $del = false) - { - $this->ktwebdavLog("Entering COPY. options are " . print_r($options, true), 'info', true); - $this->ktwebdavLog("del is: " . $del, 'info', true); - - if ($this->checkSafeMode()) { - - if (!empty($_SERVER["CONTENT_LENGTH"])) { // no body parsing yet - $this->ktwebdavLog("415 Unsupported media type", 'info', true); - return "415 Unsupported media type - No body parsing yet"; - } - - /* // no copying to different WebDAV Servers yet - if (isset($options["dest_url"])) { - $this->ktwebdavLog("502 bad gateway", 'info', true); - return "502 bad gateway - No copying to different WebDAV Servers yet"; - } - */ - $source_path = $options["path"]; - $this->ktwebdavLog("SourcePath is: " . $source_path, 'info', true); - $source_res = $this->_folderOrDocument($source_path); - if ($source_res === false) { - $this->ktwebdavLog("404 Not found - The document could not be found.", 'info', true); - return "404 Not found - The document could not be found."; - } - - list($iFolderID, $iDocumentID) = $source_res; - if ($iDocumentID === false) { - $this->ktwebdavLog("404 Not found - The folder could not be found.", 'info', true); - return "404 Not found - The folder could not be found."; - } - - if (is_null($iDocumentID)) { - // Source is a folder - $this->ktwebdavLog("Source is a Folder.", 'info', true); - $copystat = $this->_COPYFolder($options, $iFolderID); - - } else { - // Source is a document - $this->ktwebdavLog("Source is a Document.", 'info', true); - $copystat = $this->_COPYDocument($options, $iFolderID, $iDocumentID, $dest_folder_id); - - } - - // Delete the source if this is a move and the copy was ok - if ($del && ($copystat{0} == "2")) { - $delstat = $this->DELETE(array("path" => $options["path"])); - $this->ktwebdavLog("DELETE in COPY/MOVE stat is: " . $delstat, 'info', true); - if (($delstat{0} != "2") && (substr($delstat, 0, 3) != "404")) { - return $delstat; - } - } - - $this->ktwebdavLog("Final copystat result is: " . $copystat, 'info', true); - return $copystat; - - } else return "423 Locked - KTWebDAV is in SafeMode"; - } - - /** - * COPY method helper for Documents - * - * @param array parameter passing array - * @param int Folder ID - * @param int Document ID - * @return string HTTP status code or false - */ - function _COPYDocument($options, $iFolderID, $iDocumentID) { - - if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); - $this->ktwebdavLog("Entering _COPYDocument. options are " . print_r($options, true), 'info', true); - - if ($options["depth"] != "infinity") { - // RFC 2518 Section 9.2, last paragraph - $this->ktwebdavLog("400 Bad request", 'info', true); - return "400 Bad request - Depth must be 'infinity'."; - } - - global $default; - - $source_path = $options["path"]; - $dest_path = urldecode($options["dest"]); - - $oSrcFolder = Folder::get($iFolderID); - - list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); - - if (is_null($iDestDoc)) { - // the dest is a folder - // $this->ktwebdavLog("400 Bad request", 'info', true); - return "400 Bad request - Destination is a Folder"; - } else if ($iDestDoc !== false) { - // Document exists - $this->ktwebdavLog("Destination Document exists.", 'info', true); - $oReplaceDoc = Document::get($iDestDoc); - if ($options['overwrite'] != 'T') { - $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); - return "412 Precondition Failed - Destination Document exists. Overwrite needs to be TRUE."; - } - $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Document.", 'info', true); - - // Check if the user has permissions to delete this document - $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceDoc)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTDocumentUtil::delete($oReplaceDoc, 'KTWebDAV copy with overwrite set.'); - $new = false; - } - - $oDestFolder = Folder::get($iDestFolder); - $oSrcDoc = Document::get($iDocumentID); - - include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); - - $this->ktwebdavLog("Got an oSrcDoc of " . print_r($oSrcDoc, true), 'info', true); - $this->ktwebdavLog("Got an oDestFolder of " . print_r($oDestFolder, true), 'info', true); - - // Check if the user has permissions to write in this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.write'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oSrcDoc)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTDocumentUtil::copy($oSrcDoc, $oDestFolder, $_SERVER['HTTP_REASON']); - - // FIXME: Do failure checking here - - $new = false; - if ($new) { - $this->ktwebdavLog("201 Created", 'info', true); - return "201 Created"; - } else { - $this->ktwebdavLog("204 No Content", 'info', true); - return "204 No Content"; - } - } - - /** - * COPY method helper for Folders - * - * @param array parameter passing array - * @param int Parent Folder ID - * @return string HTTP status code or false - */ - function _COPYFolder($options, $iFolderID) { - - if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); - $this->ktwebdavLog("Entering _COPYFolder. options are " . print_r($options, true), 'info', true); - - if ($options["depth"] != "infinity") { - // RFC 2518 Section 9.2, last paragraph - $this->ktwebdavLog("400 Bad request", 'info', true); - return "400 Bad request - Depth must be 'infinity'."; - } - - global $default; - - $new = true; - - $source_path = $options["path"]; - $dest_path = urldecode($options["dest"]); - - $oSrcFolder = Folder::get($iFolderID); - - list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); - - $oDestFolder = Folder::get($iDestFolder); - - include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); - - if (is_null($iDestDoc)) { - // the dest is a folder - $this->ktwebdavLog("The Destination is a Folder.", 'info', true); - } else if ($iDestDoc !== false) { - // Folder exists - $this->ktwebdavLog("Destination Folder exists.", 'info', true); - $oReplaceFolder = Folder::get($iDestDoc); - if ($options['overwrite'] != 'T') { - $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); - return "412 Precondition Failed - Destination Folder exists. Overwrite needs to be TRUE."; - } - $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Folder.", 'info', true); - - // Check if the user has permissions to delete this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTFolderUtil::delete($oReplaceFolder, 'KTWebDAV move overwrites target.'); - $new = false; - } - - $oUser =& User::get($this->userID); - $this->ktwebdavLog("Got an oSrcFolder of " . print_r($oSrcFolder, true), 'info', true); - $this->ktwebdavLog("Got an oDestFolder of " . print_r($oDestFolder, true), 'info', true); - $this->ktwebdavLog("Got an oUser of " . print_r($oUser, true), 'info', true); - - // Check if the user has permissions to write in this folder - $oPerm =& KTPermission::getByName('ktcore.permissions.write'); - $oUser =& User::get($this->userID); - if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDestFolder)) { - return "403 Forbidden - User does not have sufficient permissions"; - } - KTFolderUtil::copy($oSrcFolder, $oDestFolder, $oUser, 'KTWebDAV Copy.'); - - if ($new) { - $this->ktwebdavLog("201 Created", 'info', true); - return "201 Created"; - } else { - $this->ktwebdavLog("204 No Content", 'info', true); - return "204 No Content"; - } - - } - - /** - * LOCK method handler - * - * @param array parameter passing array - * @return string HTTP status code or false - */ - function LOCK(&$options) - { - return "200 OK"; - } - - /** - * UNLOCK method handler - * - * @param array parameter passing array - * @return string HTTP status code or false - */ - function UNLOCK(&$options) - { - return "200 OK"; - } - - /** - * checkLock() helper - * - * @param string resource path to check for locks - * @return string HTTP status code or false - */ - function checkLock($path) - { - $result = false; - - return $result; - } - - /** - * checkSafeMode() helper - * - * @return string true or false - */ - function checkSafeMode() - { - - // Check/Set the WebDAV Client - $userAgentValue = $_SERVER['HTTP_USER_AGENT']; - // KT Explorer - if (stristr($userAgentValue,"Microsoft Data Access Internet Publishing Provider DAV")) { - $this->dav_client = "MS"; - $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); - } - // Mac Finder - if (stristr($userAgentValue,"Macintosh")) { - $this->dav_client = "MC"; - $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); - } - // Konqueror - if (stristr($userAgentValue,"Konqueror")) { - $this->dav_client = "KO"; - $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); - } - // Neon Library ( Gnome Nautilus, cadaver, etc) - if (stristr($userAgentValue,"neon")) { - $this->dav_client = "NE"; - $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); - } - // Windows WebDAV - if ($this->dav_client == 'MS' && $this->safeMode == 'off') { - - $this->ktwebdavLog("This is MS type client with SafeMode Off.", 'info', true); - return true; - - } - if ($this->dav_client == 'MS' && $this->safeMode != 'off') { - - $this->ktwebdavLog("This is MS type client with SafeMode On.", 'info', true); - return false; - - } - // Mac Finder - if ($this->dav_client == 'MC') { - - $this->ktwebdavLog("This is Mac Finder type client which only supports SafeMode.", 'info', true); - return false; - - } - // Konqueror - if ($this->dav_client == 'KO' && $this->safeMode == 'off') { - - $this->ktwebdavLog("This is Konqueror type client with SafeMode Off.", 'info', true); - return true; - - } - if ($this->dav_client == 'KO' && $this->safeMode != 'off') { - - $this->ktwebdavLog("This is Konqueror type client with SafeMode On.", 'info', true); - return false; - - } - // Neon Library (Gnome Nautilus, cadaver, etc.) - if ($this->dav_client == 'NE' && $this->safeMode == 'off') { - - $this->ktwebdavLog("This is Neon type client with SafeMode Off.", 'info', true); - return true; - - } - if ($this->dav_client == 'NE' && $this->safeMode != 'off') { - - $this->ktwebdavLog("This is Neon type client with SafeMode On.", 'info', true); - return false; - - } - - $this->ktwebdavLog("Unknown client. SafeMode needed.", 'info', true); - return false; - - } - - } - - - ?> +initConfig()) { + $this->ktwebdavLog('Could not load configiration.', 'error'); + exit(0); + } + + if ($this->debugInfo == 'on') { + + $this->ktwebdavLog('====================='); + $this->ktwebdavLog(' Debug Info is : ' . $this->debugInfo); + $this->ktwebdavLog(' SafeMode is : ' . $this->safeMode); + $this->ktwebdavLog(' Root Folder is : ' . $this->rootFolder); + $this->ktwebdavLog('====================='); + } + + } + + /** + * Load KTWebDAV configuration from conf file + * + * @param void + * @return bool true on success + */ + function initConfig() { + + global $default; + $oConfig =& KTConfig::getSingleton(); + + // Assign Content + $this->debugInfo = $oConfig->get('KTWebDAVSettings/debug', 'off'); + $this->safeMode = $oConfig->get('KTWebDAVSettings/safemode', 'on'); + $this->rootFolder = $oConfig->get('KTWebDAVSettings/rootfolder', 'Root Folder'); + $this->kt_version = $default->systemVersion; + + return true; + } + + /** + * Log to the KTWebDAV logfile + * + * @todo Add other log levels for warning, profile, etc + * @param string log message + * @param bool debug only? + * @return bool true on success + */ + function ktwebdavLog($entry, $type = 'info', $debug_only = false) { + + if ($debug_only && $this->debugInfo != 'on') return false; + + $ident = 'KTWEBDAV'; + $conf = array('mode' => 0644, 'timeFormat' => '%X %x'); + $logger = &Log::singleton('file', '../var/log/ktwebdav-' . date('Y-m-d') . '.txt', $ident, $conf); + if ($type == 'error') $logger->log($entry, PEAR_LOG_ERR); + else $logger->log($entry, PEAR_LOG_INFO); + return true; + } + + /** + * Get the current UserID + * + * @access private + * @param void + * @return int userID + */ + function _getUserID() { + return $this->userID; + } + + /** + * Set the current UserID + * + * @access private + * @param void + * @return int UserID + */ + function _setUserID($iUserID) { + return $this->userID = $iUserID; + } + + /** + * Serve a webdav request + * + * @access public + * @param void + * @return void + */ + function ServeRequest() { + + global $default; + + if ($this->debugInfo == 'on') { + + $this->ktwebdavLog('_SERVER is ' . print_r($_SERVER, true), 'info', true); + } + + // Get the client info + $this->checkSafeMode(); + + // identify ourselves + $this->ktwebdavLog('WebDAV Server : ' . $this->dav_powered_by . ' [KT:'.$default->systemVersion."]", 'info', true); + header('X-Dav-Powered-By: '.$this->dav_powered_by . ' [KT:'.$default->systemVersion.']'); + + // check authentication + if (!$this->_check_auth()) { + $this->ktwebdavLog('401 Unauthorized - Authorisation failed.' .$this->lastMsg, 'info', true); + $this->ktwebdavLog('----------------------------------------', 'info', true); + $this->http_status('401 Unauthorized - Authorisation failed. ' .$this->lastMsg); + + // RFC2518 says we must use Digest instead of Basic + // but Microsoft Clients do not support Digest + // and we don't support NTLM and Kerberos + // so we are stuck with Basic here + header('WWW-Authenticate: Basic realm="'.($this->http_auth_realm).'"'); + + return; + } + + // check + if(! $this->_check_if_header_conditions()) { + $this->http_status('412 Precondition failed'); + return; + } + + // set path + $request_uri = $this->_urldecode(!empty($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'); + $this->path = str_replace($_SERVER['SCRIPT_NAME'], '', $request_uri); + if(ini_get('magic_quotes_gpc')) { + $this->path = stripslashes($this->path); + } + + $this->ktwebdavLog('PATH_INFO is ' . $_SERVER['PATH_INFO'], 'info', true); + $this->ktwebdavLog('REQUEST_URI is ' . $_SERVER['REQUEST_URI'], 'info', true); + $this->ktwebdavLog('SCRIPT_NAME is ' . $_SERVER['SCRIPT_NAME'], 'info', true); + $this->ktwebdavLog('PHP_SELF is ' . $_SERVER['PHP_SELF'], 'info', true); + $this->ktwebdavLog('path set to ' . $this->path, 'info', true); + + // detect requested method names + $method = strtolower($_SERVER['REQUEST_METHOD']); + $wrapper = 'http_'.$method; + + $this->currentMethod = $method; + // activate HEAD emulation by GET if no HEAD method found + if ($method == 'head' && !method_exists($this, 'head')) { + // rfc2068 Sec: 10.2.1 + //HEAD the entity-header fields corresponding to the requested resource + // are sent in the response without any message-body + $method = 'get'; + } + $this->ktwebdavLog("Entering $method request", 'info', true); + + if (method_exists($this, $wrapper) && ($method == 'options' || method_exists($this, $method))) { + $this->$wrapper(); // call method by name + } else { // method not found/implemented + if ($_SERVER['REQUEST_METHOD'] == 'LOCK') { + $this->http_status('412 Precondition failed'); + } else { + $this->http_status('405 Method not allowed'); + header('Allow: '.join(', ', $this->_allow())); // tell client what's allowed + } + } + + $this->ktwebdavLog("Exiting $method request", 'info', true); + + } + + + /** + * check authentication if check is implemented + * + * @param void + * @return bool true if authentication succeded or not necessary + */ + function _check_auth() + { + $this->ktwebdavLog('Entering _check_auth...', 'info', true); + + if (method_exists($this, 'checkAuth')) { + // PEAR style method name + return $this->checkAuth(@$_SERVER['AUTH_TYPE'], + @$_SERVER['PHP_AUTH_USER'], + @$_SERVER['PHP_AUTH_PW']); + } else if (method_exists($this, 'check_auth')) { + // old (pre 1.0) method name + return $this->check_auth(@$_SERVER['AUTH_TYPE'], + @$_SERVER['PHP_AUTH_USER'], + @$_SERVER['PHP_AUTH_PW']); + } else { + // no method found -> no authentication required + return true; + } + } + + /** + * Authenticate user + * + * @access private + * @param string HTTP Authentication type (Basic, Digest, ...) + * @param string Username + * @param string Password + * @return bool true on successful authentication + */ + function checkAuth($sType, $sUser, $sPass) { + + $this->ktwebdavLog('Entering checkAuth params are: ', 'info', true); + $this->ktwebdavLog('sType: ' . $sType, 'info', true); + $this->ktwebdavLog('sUser: ' . $sUser, 'info', true); + $this->ktwebdavLog('sPass: ' . $sPass, 'info', true); + + // Authenticate user + + require_once(KT_LIB_DIR . '/authentication/authenticationutil.inc.php'); + + if ( empty($sUser) ) { + $this->ktwebdavLog('sUser is empty, returning false.', 'info', true); + return false; + } + + if ( empty($sPass) ) { + $this->ktwebdavLog('sPass is empty, returning false.', 'info', true); + return false; + } + + $oUser =& User::getByUsername($sUser); + if (PEAR::isError($oUser) || ($oUser === false)) { + $this->ktwebdavLog('User not found: ' . $sUser . '.', 'error'); + $this->lastMsg = 'User not found: ' . $sUser . '.'; + return false; + } + $authenticated = KTAuthenticationUtil::checkPassword($oUser, $sPass); + + if ($authenticated === false) { + $this->ktwebdavLog('Password incorrect for ' . $sUser . '.', 'error'); + $this->lastMsg = 'Password incorrect for ' . $sUser . '.'; + return false; + } + + if (PEAR::isError($authenticated)) { + $this->ktwebdavLog('Password incorrect for ' . $sUser . '.', 'error'); + $this->lastMsg = 'Password incorrect for ' . $sUser . '.'; + return false; + } + + $this->ktwebdavLog('UserID is: ' . $oUser->getId(), 'info', true ); + $this->_setUserID($oUser->getId()); + $_SESSION['userID'] = $this->_getUserID(); + $this->ktwebdavLog('SESSION UserID is: ' . $_SESSION['userID'], 'info', true ); + + $this->ktwebdavLog("Authentication Success.", 'info', true); + + return true; + } + + /** + * PROPFIND method handler + * + * @param array options + * @param array return array for file properties + * @return bool true on success + */ + function PROPFIND(&$options, &$files) { + + $this->ktwebdavLog("Entering PROPFIND. options are " . print_r($options, true), 'info', true); + + global $default; + + $fspath = $default->documentRoot . "/" . $this->rootFolder . $options["path"]; + $this->ktwebdavLog("fspath is " . $fspath, 'info', true); + + $path = $options["path"]; + + list($iFolderID, $iDocumentID) = $this->_folderOrDocument($path); + $this->ktwebdavLog("Folder/Doc is " . print_r(array($iFolderID, $iDocumentID), true), 'info', true); + + // Folder does not exist + if($iFolderID == '') return false; + + if (is_null($iDocumentID)) { + return $this->_PROPFINDFolder($options, $files, $iFolderID); + } + return $this->_PROPFINDDocument($options, $files, $iDocumentID); + + } + + /** + * PROPFIND helper for Folders + * + * @param array options + * @param array Return array for file props + * @param int Folder ID + * @return bool true on success + */ + function _PROPFINDFolder(&$options, &$files, $iFolderID) { + + global $default; + + $this->ktwebdavLog("Entering PROPFINDFolder. options are " . print_r($options, true), 'info', true); + + $folder_path = $options["path"]; + if (substr($folder_path, -1) != "/") { + $folder_path .= "/"; + } + $options["path"] = $folder_path; + + $files["files"] = array(); + $files["files"][] = $this->_fileinfoForFolderID($iFolderID, $folder_path); + + $oPerm =& KTPermission::getByName('ktcore.permissions.read'); + $oUser =& User::get($this->userID); + + if (!empty($options["depth"])) { + $aChildren = Folder::getList(array('parent_id = ?', $iFolderID)); + // FIXME: Truncation Time Workaround + //foreach (array_slice($aChildren, 0, 50) as $oChildFolder) { + foreach ($aChildren as $oChildFolder) { + // Check if the user has permissions to view this folder + $oFolderDetailsPerm =& KTPermission::getByName('ktcore.permissions.folder_details'); + + if(KTPermissionUtil::userHasPermissionOnItem($oUser, $oFolderDetailsPerm, $oChildFolder)) + { + $this->ktwebdavLog("Folder Details permissions GRANTED for user ". $_SESSION["userID"] ." on folder " . $oChildFolder->getName(), 'info', true); + $files["files"][] = $this->_fileinfoForFolder($oChildFolder, $folder_path . $oChildFolder->getName()); + } + else + { + $this->ktwebdavLog("Folder Details permissions DENIED for ". $_SESSION["userID"] ." on folder " . $oChildFolder->getName(), 'info', true); + } + } + $aDocumentChildren = Document::getList(array('folder_id = ? AND status_id = 1', $iFolderID)); + // FIXME: Truncation Time Workaround + //foreach (array_slice($aDocumentChildren, 0, 50) as $oChildDocument) { + foreach ($aDocumentChildren as $oChildDocument) { + // Check if the user has permissions to view this document + if (KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oChildDocument)) { + $this->ktwebdavLog("Read permissions GRANTED for ". $_SESSION["userID"] ." on document " . $oChildDocument->getName(), 'info', true); + $files["files"][] = $this->_fileinfoForDocument($oChildDocument, $folder_path . $oChildDocument->getFileName()); + } else $this->ktwebdavLog("Read permissions DENIED for ". $_SESSION["userID"] ." on document " . $oChildDocument->getName(), 'info', true); + } + } + return true; + } + + /** + * PROPFIND helper for Documents + * + * @param array options + * @param array Return array for file props + * @param int Document ID + * @return bool true on success + */ + function _PROPFINDDocument(&$options, &$files, $iDocumentID) { + + global $default; + + $this->ktwebdavLog("Entering PROPFINDDocument. files are " . print_r($files, true), 'info', true); + + $res = $this->_fileinfoForDocumentID($iDocumentID, $options["path"]); + $this->ktwebdavLog("_fileinfoForDocumentID result is " . print_r($res, true), 'info', true); + if ($res === false) { + return false; + } + $files["files"] = array(); + $files["files"][] = $res; + return true; + } + + /** + * PROPFIND helper for Document Info + * + * @param Document Document Object + * @param string Path + * @return array Doc info array + */ + function _fileinfoForDocument(&$oDocument, $path) { + + global $default; + + $this->ktwebdavLog("Entering _fileinfoForDocument. Document is " . print_r($oDocument, true), 'info', true); + + $fspath = $default->documentRoot . "/" . $this->rootFolder . $path; + $this->ktwebdavLog("fspath is " . $fspath, 'info', true); + + // create result array + $info = array(); + $info["path"] = $path; + $info["props"] = array(); + + // no special beautified displayname here ... + $info["props"][] = $this->mkprop("displayname", $oDocument->getName()); + + // creation and modification time + $info["props"][] = $this->mkprop("creationdate", strtotime($oDocument->getCreatedDateTime())); + $info["props"][] = $this->mkprop("getlastmodified", strtotime($oDocument->getVersionCreated())); + + // plain file (WebDAV resource) + $info["props"][] = $this->mkprop("resourcetype", ''); + // FIXME: Direct database access + $sQuery = array("SELECT mimetypes FROM $default->mimetypes_table WHERE id = ?", array($oDocument->getMimeTypeID())); + $res = DBUtil::getOneResultKey($sQuery, 'mimetypes'); + $info["props"][] = $this->mkprop("getcontenttype", $res); + + $info["props"][] = $this->mkprop("getcontentlength", $oDocument->getFileSize()); + + // explorer wants these? + $info["props"][] = $this->mkprop("name", ''); + $info["props"][] = $this->mkprop("parentname", ''); + $info["props"][] = $this->mkprop("href", ''); + $info["props"][] = $this->mkprop("ishidden", ''); + $info["props"][] = $this->mkprop("iscollection", ''); + $info["props"][] = $this->mkprop("isreadonly", ''); + $info["props"][] = $this->mkprop("contentclass", ''); + $info["props"][] = $this->mkprop("getcontentlanguage", ''); + $info["props"][] = $this->mkprop("lastaccessed", ''); + $info["props"][] = $this->mkprop("isstructureddocument", ''); + $info["props"][] = $this->mkprop("defaultdocument", ''); + $info["props"][] = $this->mkprop("isroot", ''); + + return $info; + } + + + /** + * PROPFIND helper for Document Info + * + * @param int Document ID + * @param string path + * @return array Doc info array + */ + function _fileinfoForDocumentID($iDocumentID, $path) { + + global $default; + + $this->ktwebdavLog("Entering _fileinfoForDocumentID. DocumentID is " . print_r($iDocumentID, true), 'info', true); + + if ($iDocumentID == '') return false; + + $oDocument =& Document::get($iDocumentID); + + if (is_null($oDocument) || ($oDocument === false) || PEAR::isError($oDocument)) { + return false; + } + + return $this->_fileinfoForDocument($oDocument, $path); + + } + + /** + * PROPFIND helper for Folder Info + * + * @param Folder Folder Object + * @param string $path + * @return array Folder info array + */ + function _fileinfoForFolder($oFolder, $path) { + + global $default; + + $this->ktwebdavLog("Entering _fileinfoForFolder. Folder is " . print_r($oFolder, true), 'info', true); + + // create result array + $info = array(); + $info["path"] = $path; + $fspath = $default->documentRoot . "/" . $this->rootFolder . $path; + //$fspath = $default->documentRoot . '/' . $oFolder->generateFolderPath($oFolder->getID()); + $info["props"] = array(); + + // no special beautified displayname here ... + $info["props"][] = $this->mkprop("displayname", $oFolder->getName()); + + // creation and modification time + //$info["props"][] = $this->mkprop("creationdate", strtotime($oFolder->getCreatedDateTime())); + //$info["props"][] = $this->mkprop("getlastmodified", strtotime($oFolder->getVersionCreated())); + + // directory (WebDAV collection) + $info["props"][] = $this->mkprop("resourcetype", "collection"); + $info["props"][] = $this->mkprop("getcontenttype", "httpd/unix-directory"); + $info["props"][] = $this->mkprop("getcontentlength", 0); + + return $info; + } + + /** + * PROPFIND method handler + * + * @param void + * @return void + */ + function http_PROPFIND() + { + $options = Array(); + $options["path"] = $this->path; + + // search depth from header (default is "infinity) + if (isset($_SERVER['HTTP_DEPTH'])) { + $options["depth"] = $_SERVER["HTTP_DEPTH"]; + } else { + $options["depth"] = "infinity"; + } + + // analyze request payload + $propinfo = new _parse_propfind("php://input"); + if (!$propinfo->success) { + $this->http_status("400 Error"); + return; + } + $options['props'] = $propinfo->props; + + // call user handler + if (!$this->PROPFIND($options, $files)) { + $this->http_status("404 Not Found"); + return; + } + + // collect namespaces here + $ns_hash = array(); + + // Microsoft Clients need this special namespace for date and time values + $ns_defs = "xmlns:ns0=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\""; + + // now we loop over all returned file entries + foreach($files["files"] as $filekey => $file) { + + // nothing to do if no properties were returned for a file + if (!isset($file["props"]) || !is_array($file["props"])) { + continue; + } + + // now loop over all returned properties + foreach($file["props"] as $key => $prop) { + // as a convenience feature we do not require that user handlers + // restrict returned properties to the requested ones + // here we strip all unrequested entries out of the response + + switch($options['props']) { + case "all": + // nothing to remove + break; + + case "names": + // only the names of all existing properties were requested + // so we remove all values + unset($files["files"][$filekey]["props"][$key]["val"]); + break; + + default: + $found = false; + + // search property name in requested properties + foreach((array)$options["props"] as $reqprop) { + if ( $reqprop["name"] == $prop["name"] + && $reqprop["xmlns"] == $prop["ns"]) { + $found = true; + break; + } + } + + // unset property and continue with next one if not found/requested + if (!$found) { + $files["files"][$filekey]["props"][$key]=''; + continue(2); + } + break; + } + + // namespace handling + if (empty($prop["ns"])) continue; // no namespace + $ns = $prop["ns"]; + if ($ns == "DAV:") continue; // default namespace + if (isset($ns_hash[$ns])) continue; // already known + + // register namespace + $ns_name = "ns".(count($ns_hash) + 1); + $ns_hash[$ns] = $ns_name; + $ns_defs .= " xmlns:$ns_name=\"$ns\""; + } + + // we also need to add empty entries for properties that were requested + // but for which no values where returned by the user handler + if (is_array($options['props'])) { + foreach($options["props"] as $reqprop) { + if($reqprop['name']=='') continue; // skip empty entries + + $found = false; + + // check if property exists in result + foreach($file["props"] as $prop) { + if ( $reqprop["name"] == $prop["name"] + && $reqprop["xmlns"] == $prop["ns"]) { + $found = true; + break; + } + } + + if (!$found) { + if($reqprop["xmlns"]==="DAV:" && $reqprop["name"]==="lockdiscovery") { + // lockdiscovery is handled by the base class + $files["files"][$filekey]["props"][] + = $this->mkprop("DAV:", + "lockdiscovery" , + $this->lockdiscovery($files["files"][$filekey]['path'])); + } else { + // add empty value for this property + $files["files"][$filekey]["noprops"][] = $this->mkprop($reqprop["xmlns"], $reqprop["name"], ''); + + // register property namespace if not known yet + if ($reqprop["xmlns"] != "DAV:" && !isset($ns_hash[$reqprop["xmlns"]])) { + $ns_name = "ns".(count($ns_hash) + 1); + $ns_hash[$reqprop["xmlns"]] = $ns_name; + $ns_defs .= " xmlns:$ns_name=\"$reqprop[xmlns]\""; + } + } + } + } + } + } + + // now we generate the reply header ... + $this->http_status("207 Multi-Status"); + header('Content-Type: text/xml; charset="utf-8"'); + + // ... and payload + echo "\n"; + echo "\n"; + + foreach($files["files"] as $file) { + // ignore empty or incomplete entries + if(!is_array($file) || empty($file) || !isset($file["path"])) continue; + $path = $file['path']; + if(!is_string($path) || $path==='') continue; + + echo " \n"; + + $href = htmlspecialchars($this->_slashify($this->_mergePathes($_SERVER['SCRIPT_NAME'], $path))); + + echo " $href\n"; + + $this->ktwebdavLog("\nfile is: " . print_r($file, true), 'info', true); + + // report all found properties and their values (if any) + if (isset($file["props"]) && is_array($file["props"])) { + echo " \n"; + echo " \n"; + + foreach($file["props"] as $key => $prop) { + + if (!is_array($prop)) continue; + if (!isset($prop["name"])) continue; + + $this->ktwebdavLog("Namespace is " . $prop["ns"], 'info', true); + + if (!isset($prop["val"]) || $prop["val"] === '' || $prop["val"] === false) { + // empty properties (cannot use empty() for check as "0" is a legal value here) + if($prop["ns"]=="DAV:") { + echo " \n"; + } else if(!empty($prop["ns"])) { + echo " <".$ns_hash[$prop["ns"]].":$prop[name]/>\n"; + } else { + echo " <$prop[name] xmlns=\"\"/>"; + } + } else if ($prop["ns"] == "DAV:") { + $this->ktwebdavLog("Getting DAV: Properties...", 'info', true); + // some WebDAV properties need special treatment + switch ($prop["name"]) { + case "creationdate": + $this->ktwebdavLog("Getting creationdate...", 'info', true); + echo " " + . gmdate("Y-m-d\\TH:i:s\\Z",$prop['val']) + . "\n"; + break; + case "getlastmodified": + $this->ktwebdavLog("Getting getlastmodified...", 'info', true); + echo " " + . gmdate("D, d M Y H:i:s ", $prop['val']) + . "GMT\n"; + break; + case "resourcetype": + $this->ktwebdavLog("Getting resourcetype...", 'info', true); + echo " \n"; + break; + case "supportedlock": + $this->ktwebdavLog("Getting supportedlock...", 'info', true); + echo " $prop[val]\n"; + break; + case "lockdiscovery": + $this->ktwebdavLog("Getting lockdiscovery...", 'info', true); + echo " \n"; + echo $prop["val"]; + echo " \n"; + break; + default: + $this->ktwebdavLog("Getting default...", 'info', true); + $this->ktwebdavLog("name is: " . $prop['name'], 'info', true); + $this->ktwebdavLog("val is: " . $this->_prop_encode(htmlspecialchars($prop['val'])), 'info', true); + echo " " + . $this->_prop_encode(htmlspecialchars($prop['val'])) + . "\n"; + break; + } + } else { + // properties from namespaces != "DAV:" or without any namespace + $this->ktwebdavLog('Getting != "DAV:" or without any namespace Properties...', 'info', true); + if ($prop["ns"]) { + echo " <" . $ns_hash[$prop["ns"]] . ":$prop[name]>" + . $this->_prop_encode(htmlspecialchars($prop['val'])) + . "\n"; + } else { + echo " <$prop[name] xmlns=\"\">" + . $this->_prop_encode(htmlspecialchars($prop['val'])) + . "\n"; + } + } + } + + echo " \n"; + echo " HTTP/1.1 200 OK\n"; + echo " \n"; + } + + // now report all properties requested but not found + $this->ktwebdavLog('Getting all properties requested but not found...', 'info', true); + if (isset($file["noprops"])) { + echo " \n"; + echo " \n"; + + foreach($file["noprops"] as $key => $prop) { + if ($prop["ns"] == "DAV:") { + echo " \n"; + } else if ($prop["ns"] == '') { + echo " <$prop[name] xmlns=\"\"/>\n"; + } else { + echo " <" . $ns_hash[$prop["ns"]] . ":$prop[name]/>\n"; + } + } + + echo " \n"; + echo " HTTP/1.1 404 Not Found\n"; + echo " \n"; + } + + echo " \n"; + } + + echo "\n"; + } + + /** + * PROPFIND helper for Folder Info + * + * @param int Folder ID + * @param string path + * @return array Folder info array + */ + function _fileinfoForFolderID($iFolderID, $path) { + + global $default; + + $this->ktwebdavLog("Entering _fileinfoForFolderID. FolderID is " . $iFolderID, 'info', true); + + if($iFolderID == '') return false; + + $oFolder =& Folder::get($iFolderID); + + if (is_null($oFolder) || ($oFolder === false)) { + $this->ktwebdavLog("oFolderID error. ", 'info', true); + return false; + } + + return $this->_fileinfoForFolder($oFolder, $path); + } + + /** + * GET method handler + * + * @param array parameter passing array + * @return bool true on success + */ + function GET(&$options) + { + // required for KT + global $default; + + $this->ktwebdavLog("Entering GET. options are " . print_r($options, true), 'info', true); + + // Get the client info + $this->checkSafeMode(); + + // get path to requested resource + $path = $options["path"]; + + list($iFolderID, $iDocumentID) = $this->_folderOrDocument($path); + + if ($iDocumentID === false) { + $this->ktwebdavLog("Document not found.", 'info', true); + return "404 Not found - Document not found."; + } + + if (is_null($iDocumentID)) { + return $this->_GETFolder($options, $iFolderID); + } + return $this->_GETDocument($options, $iDocumentID); + + } + + /** + * GET method helper + * + * @param array parameter passing array + * @param int MainFolder ID + * @return bool true on success + */ + function _GETFolder(&$options, $iMainFolderID) { + + global $default; + + $this->ktwebdavLog("Entering _GETFolder. options are " . print_r($options, true), 'info', true); + + $oMainFolder =& Folder::get($iMainFolderID); + $aFolderID = array(); + $aChildren = Folder::getList(array('parent_id = ?', $iMainFolderID)); + // $sFolderName = $oMainFolder->getName(); + + if (is_writeable("../var") && is_writeable("../var/log")) { + $writeperms = "OK"; + }else { + $writeperms = "NOT SET"; + } + + if ($this->ktdmsPath != '') { + $ktdir = $this->ktdmsPath; + } + + $srv_proto = split('/', $_SERVER['SERVER_PROTOCOL']); + + $data = "KTWebDAV - The KnowledgeTree WebDAV Server"; + $data .= ""; + $data .= "

"; + $data .= "

Welcome to KnowledgeTree WebDAV Server



"; + $data .= "
To access KTWebDAV copy the following URL and paste it into your WebDAV enabled client...


"; + $data .= "
" . strtolower($srv_proto[0]) . "://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "
"; + $data .= ""; + + $options['mimetype'] = 'text/html'; + $options["data"] = $data; + return true; + } + + /** + * GET method helper + * + * @param array parameter passing array + * @param int Document ID + * @return bool true on success + */ + function _GETDocument(&$options, $iDocumentID) { + global $default; + + $oDocument =& Document::get($iDocumentID); + + // get a temp file, and read. NOTE: NEVER WRITE TO THIS + $oStorage =& KTStorageManagerUtil::getSingleton(); + $fspath = $oStorage->temporaryFile($oDocument); + + $this->ktwebdavLog("Filesystem Path is " . $fspath, 'info', true ); + + // detect resource type + $mimetype = KTMime::getMimeTypeName($oDocument->getMimeTypeID()); + $options['mimetype'] = KTMime::getFriendlyNameForString($mimetype); + // detect modification time + // see rfc2518, section 13.7 + // some clients seem to treat this as a reverse rule + // requiering a Last-Modified header if the getlastmodified header was set + + $options['mtime'] = $oDocument->getVersionCreated(); + + // detect resource size + $options['size'] = $oDocument->getFileSize(); + + // no need to check result here, it is handled by the base class + $options['stream'] = fopen($fspath, "r"); + + $this->ktwebdavLog("Method is " . $this->currentMethod, 'info', true ); + + if ($this->currentMethod == "get") { + + // create the document transaction record + include_once(KT_LIB_DIR . '/documentmanagement/DocumentTransaction.inc'); + $oDocumentTransaction = & new DocumentTransaction($oDocument, "Document viewed via KTWebDAV", 'ktcore.transactions.view'); + $oDocumentTransaction->iUserID = $this->userID; + $oDocumentTransaction->create(); + + } + return true; + } + + /** + * GET method helper + * + * @param string directory path + * @return array or false + */ + function _folderOrDocument($path) { + + global $default; + + $this->ktwebdavLog("Entering _folderOrDocument. path is " . $path, 'info', true); + + if ( !(strstr($path,"__BAOBABCLIENT__") === false) ) { + return array(0, 1); + } + + $sFileName = basename($path); + // for windows replace backslash with forwardslash + $sFolderPath = str_replace("\\", '/', dirname($path) ); + + if ($sFolderPath == "/" || $sFolderPath == "/ktwebdav") { + $this->ktwebdavLog("This is the root folder.", 'info', true); + $sFolderPath = $this->rootFolder; + $iFolderID = 0; + } else $iFolderID = 1; + if ($sFileName == "ktwebdav.php") { + $this->ktwebdavLog("This is the root folder file.", 'info', true); + $sFileName = ''; + } + + $this->ktwebdavLog("sFileName is " . $sFileName, 'info', true); + $this->ktwebdavLog("sFolderName is " . $sFolderPath, 'info', true); + $this->ktwebdavLog("iFolderID is " . $iFolderID, 'info', true); + + $aFolderNames = split('/', $sFolderPath); + + $this->ktwebdavLog("aFolderNames are: " . print_r($aFolderNames, true), 'info', true); + $aRemaining = $aFolderNames; + while (count($aRemaining)) { + $sFolderName = $aRemaining[0]; + $aRemaining = array_slice($aRemaining, 1); + if ($sFolderName == '') { + continue; + } + // FIXME: Direct database access + $sQuery = "SELECT id FROM folders WHERE parent_id = ? AND name = ?"; + $aParams = array($iFolderID, $sFolderName); + $id = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id'); + if (PEAR::isError($id)) { + $this->ktwebdavLog("A DB error occurred in _folderOrDocument", 'info', true); + return false; + } + if (is_null($id)) { + // Some intermediary folder path doesn't exist + $this->ktwebdavLog("Some intermediary folder does not exist in _folderOrDocument", 'error', true); + return array(false, false); + } + $iFolderID = (int)$id; + $this->ktwebdavLog("iFolderID set to " . $iFolderID, 'info', true); + } + + // FIXME: Direct database access + // $sQuery = "SELECT id FROM documents WHERE folder_id = ? AND filename = ? AND status_id = 1"; + $sQuery = "SELECT D.id "; + $sQuery .= "FROM documents AS D "; + $sQuery .= "LEFT JOIN document_metadata_version AS DM "; + $sQuery .= "ON D.metadata_version_id = DM.id "; + $sQuery .= "LEFT JOIN document_content_version AS DC "; + $sQuery .= "ON DM.content_version_id = DC.id "; + $sQuery .= "WHERE D.folder_id = ? AND DC.filename = ?"; + + $aParams = array($iFolderID, $sFileName); + $iDocumentID = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id'); + + if (PEAR::isError($iDocumentID)) { + $this->ktwebdavLog("iDocumentID error in _folderOrDocument", 'info', true); + return false; + } + + if ($iDocumentID === null) { + $this->ktwebdavLog("iDocumentID is null", 'info', true); + // FIXME: Direct database access + $sQuery = "SELECT id FROM folders WHERE parent_id = ? AND name = ?"; + $aParams = array($iFolderID, $sFileName); + $id = DBUtil::getOneResultKey(array($sQuery, $aParams), 'id'); + if (PEAR::isError($id)) { + $this->ktwebdavLog("A DB(2) error occurred in _folderOrDocument", 'info', true); + return false; + } + if (is_null($id)) { + if ($sFileName == '') { + return array($iFolderID, null); + } + $this->ktwebdavLog("id is null in _folderOrDocument", 'info', true); + return array($iFolderID, false); + } + if (substr($path, -1) !== "/") { + $this->ktwebdavLog("Setting Location Header to " . "Location: " . $_SERVER["PHP_SELF"] . "/", 'info', true); + header("Location: " . $_SERVER["PHP_SELF"] . "/"); + } + return array($id, null); + } + + return array($iFolderID, (int)$iDocumentID); + } + + /** + * PUT method handler + * + * @param array parameter passing array + * @return string HTTP status code or false + */ + function PUT(&$options) + { + global $default; + + if ($this->checkSafeMode()) { + + $this->ktwebdavLog("Entering PUT. options are " . print_r($options, true), 'info', true); + $this->ktwebdavLog("dav_client is: " . $this->dav_client, 'info', true); + + $path = $options["path"]; + + $res = $this->_folderOrDocument($path); + list($iFolderID, $iDocumentID) = $res; + + if ($iDocumentID === false && $iFolderID === false) { + // Couldn't find intermediary paths + /* + * RFC2518: 8.7.1 PUT for Non-Collection Resources + * + * 409 (Conflict) - A PUT that would result in the creation + * of a resource without an appropriately scoped parent collection + * MUST fail with a 409 (Conflict). + */ + return "409 Conflict - Couldn't find intermediary paths"; + } + + $oParentFolder =& Folder::get($iFolderID); + // Check if the user has permissions to write in this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.write'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oParentFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + + $this->ktwebdavLog("iDocumentID is " . $iDocumentID, 'info', true); + + if (is_null($iDocumentID)) { + // This means there is a folder with the given path + $this->ktwebdavLog("405 Method not allowed", 'info', true); + return "405 Method not allowed - There is a folder with the given path"; + } + + if ($iDocumentID == false) { + $this->ktwebdavLog("iDocumentID is false", 'info', true); + } + + if ($iDocumentID !== false) { + // This means there is a document with the given path + $oDocument = Document::get($iDocumentID); + + $this->ktwebdavLog("oDocument is " . print_r($oDocument, true), 'info', true); + $this->ktwebdavLog("oDocument statusid is " . print_r($oDocument->getStatusID(), true), 'info', true); + + if ( ( (int)$oDocument->getStatusID() != STATUS_WEBDAV ) && ( (int)$oDocument->getStatusID() != DELETED )) { + $this->ktwebdavLog("Trying to PUT to an existing document", 'info', true); + if (!$this->dav_client == "MS" && !$this->dav_client == "MC") return "409 Conflict - There is a document with the given path"; + } + + // FIXME: Direct filesystem access + $fh = $options["stream"]; + $sTempFilename = tempnam('/tmp', 'ktwebdav_dav_put'); + $ofh = fopen($sTempFilename, 'w'); + + $contents = ''; + while (!feof($fh)) { + $contents .= fread($fh, 8192); + } + $fres = fwrite($ofh, $contents); + $this->ktwebdavLog("A DELETED or CHECKEDOUT document exists. Overwriting...", 'info', true); + $this->ktwebdavLog("Temp Filename is: " . $sTempFilename, 'info', true ); + $this->ktwebdavLog("File write result size was: " . $fres, 'info', true ); + + fflush($fh); + fclose($fh); + fflush($ofh); + fclose($ofh); + $this->ktwebdavLog("Files have been flushed and closed.", 'info', true ); + + $name = basename($path); + $aFileArray = array( + "name" => $name, + "size" => filesize($sTempFilename), + "type" => false, + "userID" => $this->_getUserID(), + ); + $this->ktwebdavLog("aFileArray is " . print_r($aFileArray, true), 'info', true); + + include_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); + $aOptions = array( + 'contents' => new KTFSFileLike($sTempFilename), + 'metadata' => array(), + 'novalidate' => true, + ); + $oDocument =& KTDocumentUtil::add($oParentFolder, $name, $oUser, $aOptions); + + if(PEAR::isError($oDocument)) { + $this->ktwebdavLog("oDocument ERROR: " . $oDocument->getMessage(), 'info', true); + unlink($sTempFilename); + return "409 Conflict - " . $oDocument->getMessage(); + } + + $this->ktwebdavLog("oDocument is " . print_r($oDocument, true), 'info', true); + + unlink($sTempFilename); + return "204 No Content"; + } + + $options["new"] = true; + // FIXME: Direct filesystem access + $fh = $options["stream"]; + $sTempFilename = tempnam('/tmp', 'ktwebdav_dav_put'); + $ofh = fopen($sTempFilename, 'w'); + + $contents = ''; + while (!feof($fh)) { + $contents .= fread($fh, 8192); + } + $fres = fwrite( $ofh, $contents); + $this->ktwebdavLog("Content length was not 0, doing the whole thing.", 'info', true ); + $this->ktwebdavLog("Temp Filename is: " . $sTempFilename, 'info', true ); + $this->ktwebdavLog("File write result size was: " . $fres, 'info', true ); + + fflush($fh); + fclose($fh); + fflush($ofh); + fclose($ofh); + $this->ktwebdavLog("Files have been flushed and closed.", 'info', true ); + + $name = basename($path); + $aFileArray = array( + "name" => $name, + "size" => filesize($sTempFilename), + "type" => false, + "userID" => $this->_getUserID(), + ); + $this->ktwebdavLog("aFileArray is " . print_r($aFileArray, true), 'info', true); + + include_once(KT_LIB_DIR . '/filelike/fsfilelike.inc.php'); + $aOptions = array( + 'contents' => new KTFSFileLike($sTempFilename), + 'metadata' => array(), + 'novalidate' => true, + ); + $oDocument =& KTDocumentUtil::add($oParentFolder, $name, $oUser, $aOptions); + + if(PEAR::isError($oDocument)) { + $this->ktwebdavLog("oDocument ERROR: " . $oDocument->getMessage(), 'info', true); + unlink($sTempFilename); + return "409 Conflict - " . $oDocument->getMessage(); + } + + $this->ktwebdavLog("oDocument is " . print_r($oDocument, true), 'info', true); + + unlink($sTempFilename); + return "201 Created"; + + } else return "423 Locked - KTWebDAV is in SafeMode"; + + } + + /** + * MKCOL method handler + * + * @param array parameter passing array + * @return string HTTP status code or false + */ + function MKCOL($options) + { + $this->ktwebdavLog("Entering MKCOL. options are " . print_r($options, true), 'info', true); + + if ($this->checkSafeMode()) { + + global $default; + + if (!empty($_SERVER["CONTENT_LENGTH"])) { + /* + * RFC2518: 8.3.2 MKCOL status codes + * + * 415 (Unsupported Media Type)- The server does not support + * the request type of the body. + */ + return "415 Unsupported media type"; + } + + // Take Windows's escapes out + $path = str_replace('\\', '' , $options['path']); + + + $res = $this->_folderOrDocument($path); + list($iFolderID, $iDocumentID) = $res; + + if ($iDocumentID === false && $iFolderID === false) { + // Couldn't find intermediary paths + /* + * RFC2518: 8.3.2 MKCOL status codes + * + * 409 (Conflict) - A collection cannot be made at the + * Request-URI until one or more intermediate collections + * have been created. + */ + $this->ktwebdavLog("409 Conflict in MKCOL", 'info', true); + return "409 Conflict - Couldn't find intermediary paths"; + } + + + if (is_null($iDocumentID)) { + // This means there is a folder with the given path + /* + * RFC2518: 8.3.2 MKCOL status codes + * + * 405 (Method Not Allowed) - MKCOL can only be executed on + * a deleted/non-existent resource. + */ + $this->ktwebdavLog("405 Method not allowed - There is a folder with the given path", 'info', true); + return "405 Method not allowed - There is a folder with the given path"; + } + if ($iDocumentID !== false) { + // This means there is a document with the given path + /* + * RFC2518: 8.3.2 MKCOL status codes + * + * 405 (Method Not Allowed) - MKCOL can only be executed on + * a deleted/non-existent resource. + */ + $this->ktwebdavLog("405 Method not allowed - There is a document with the given path", 'info', true); + return "405 Method not allowed - There is a document with the given path"; + } + + $sFolderName = basename($path); + $sFolderPath = dirname($path); + + $dest_fspath = $default->documentRoot . "/" . $this->rootFolder . $path; + $this->ktwebdavLog("Will create a physical path of " . $dest_fspath, 'info', true); + + $oParentFolder =& Folder::get($iFolderID); + $this->ktwebdavLog("Got an oParentFolder of " . print_r($oParentFolder, true), 'info', true); + + // Check if the user has permissions to write in this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.addFolder'); + $oUser =& User::get($this->userID); + + $this->ktwebdavLog("oPerm is " . print_r($oPerm, true), 'info', true); + $this->ktwebdavLog("oUser is " . print_r($oUser, true), 'info', true); + $this->ktwebdavLog("oFolder is " . print_r($oParentFolder, true), 'info', true); + + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oParentFolder)) { + $this->ktwebdavLog("Permission denied.", 'info', true); + return "403 Forbidden - User does not have sufficient permissions"; + } else $this->ktwebdavLog("Permission granted.", 'info', true); + + + include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); + + KTFolderUtil::add($oParentFolder, $sFolderName, $oUser); + /* + * RFC 2518: 8.3.2 MKCOL status codes + * + * 201 (Created) - The collection or structured resource was + * created in its entirety. + */ + $this->ktwebdavLog("201 Created", 'info', true); + return "201 Created"; + + } else return "423 Locked - KTWebDAV is in SafeMode"; + } + + + /** + * DELETE method handler + * + * @param array parameter passing array + * @return string HTTP status code or false + */ + function DELETE($options) + { + $this->ktwebdavLog("Entering DELETE. options are " . print_r($options, true), 'info', true); + + if ($this->checkSafeMode()) { + + $path = $options["path"]; + $res = $this->_folderOrDocument($path); + $this->ktwebdavLog("DELETE res is " . print_r($res, true), 'info', true); + if ($res === false) { + $this->ktwebdavLog("404 Not found - The Document was not found.", 'info', true); + return "404 Not found - The Document was not found."; + } + list($iFolderID, $iDocumentID) = $res; + + if ($iDocumentID === false) { + $this->ktwebdavLog("404 Not found - The Folder was not found.", 'info', true); + return "404 Not found - The Folder was not found."; + } + + if (is_null($iDocumentID)) { + return $this->_DELETEFolder($options, $iFolderID); + } + return $this->_DELETEDocument($options, $iFolderID, $iDocumentID); + + } else return "423 Locked - KTWebDAV is in SafeMode"; + } + + /** + * DELETE method helper for Documents + * + * @param array parameter passing array + * @param int Folder ID + * @param int Document ID + * @return string HTTP status code or false + */ + function _DELETEDocument($options, $iFolderID, $iDocumentID) { + + $this->ktwebdavLog("Entering _DELETEDocument. options are " . print_r($options, true), 'info', true); + + global $default; + + $oDocument =& Document::get($iDocumentID); + + // Check if the user has permissions to delete this document + $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDocument)) { + return "403 Forbidden - The user does not have sufficient permissions"; + } + + $res = KTDocumentUtil::delete($oDocument, $_SERVER['HTTP_REASON']); + + if (PEAR::isError($res)) { + $this->ktwebdavLog("404 Not Found - " . $res->getMessage(), 'info', true); + return "404 Not Found - " . $res->getMessage(); + } + + $this->ktwebdavLog("204 No Content", 'info', true); + return "204 No Content"; + } + + /** + * DELETE method helper for Folders + * + * @param array paramter passing array + * @param int Folder ID + * @return string HTTP status code or false + */ + function _DELETEFolder($options, $iFolderID) { + + $this->ktwebdavLog("Entering _DELETEFolder. options are " . print_r($options, true), 'info', true); + + global $default; + + require_once(KT_LIB_DIR . "/foldermanagement/folderutil.inc.php"); + + // Check if the user has permissions to delete this folder + $oFolder =& Folder::get($iFolderID); + $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oFolder)) { + return "403 Forbidden - The user does not have sufficient permissions"; + } + $this->ktwebdavLog("Got an oFolder of " . print_r($oFolder, true), 'info', true); + $this->ktwebdavLog("Got an oUser of " . print_r($oUser, true), 'info', true); + $res = KTFolderUtil::delete($oFolder, $oUser, 'KTWebDAV Delete'); + + if (PEAR::isError($res)) { + $this->ktwebdavLog("Delete Result error " . print_r($res, true), 'info', true); + return "403 Forbidden - ".$res->getMessage(); + } + + return "204 No Content"; + } + + /** + * MOVE method handler + * + * @param array parameter passing array + * @return string HTTP status code or false + */ + function MOVE($options) + { + // Use the WebDAV standards way. + // See rfc2518 Section 8.9 + // This does a copy with delete + // FIXME: This way does not retain document history and other info + + //return $this->COPY($options, true); + + // Use the KT way. + // FIXME: This way does not allow overwrite + + $this->ktwebdavLog("Entering MOVE. options are " . print_r($options, true), 'info', true); + + if ($this->checkSafeMode()) { + + if (!empty($_SERVER["CONTENT_LENGTH"])) { // no body parsing yet + $this->ktwebdavLog("415 Unsupported media type", 'info', true); + return "415 Unsupported media type"; + } + + /* // no moving to different WebDAV Servers yet + if (isset($options["dest_url"])) { + $this->ktwebdavLog("502 bad gateway - No moving to different WebDAV Servers yet", 'info', true); + return "502 bad gateway - No moving to different WebDAV Servers yet"; + } + */ + $source_path = $options["path"]; + $source_res = $this->_folderOrDocument($source_path); + if ($source_res === false) { + $this->ktwebdavLog("404 Not found - Document was not found.", 'info', true); + return "404 Not found - Document was not found."; + } + + list($iFolderID, $iDocumentID) = $source_res; + if ($iDocumentID === false) { + $this->ktwebdavLog("404 Not found - Folder was not found.", 'info', true); + return "404 Not found - Folder was not found."; + } + + if (is_null($iDocumentID)) { + // Source is a folder + $movestat = $this->_MOVEFolder($options, $iFolderID); + + } else { + // Source is a document + $movestat = $this->_MOVEDocument($options, $iFolderID, $iDocumentID); + + } + + $this->ktwebdavLog("Final movestat result is: " . $movestat, 'info', true); + return $movestat; + + } else return "423 Locked - KTWebDAV is in SafeMode"; + + } + + /** + * MOVE method helper for Documents + * + * @param array parameter passing array + * @param int Folder ID + * @param int Document ID + * @return string HTTP status code or false + */ + function _MOVEDocument($options, $iFolderID, $iDocumentID) { + + if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); + $this->ktwebdavLog("Entering _MOVEDocument. options are " . print_r($options, true), 'info', true); + global $default; + $new = true; + //FIXME: refactor me into KTDocumentUtil + + $oDocument = Document::get($iDocumentID); + $oSrcFolder = Folder::get($iFolderID); + $oUser =& User::get($this->userID); + + $source_path = $options["path"]; + $dest_path = urldecode($options["dest"]); + + // Is this a rename? + if (dirname($source_path) == dirname($dest_path)) { + // This is a rename + //if ($options['overwrite'] != 'T') { + // $this->ktwebdavLog("This is a Rename. Overwrite needs to be TRUE.", 'info', true); + // return "412 Precondition Failed - This is a Rename. Overwrite needs to be TRUE."; + //} + $this->ktwebdavLog("Got an oDocument of " . print_r($oDocument, true), 'info', true); + $this->ktwebdavLog("Got an new name of " . basename($dest_path), 'info', true); + + // Check if the user has permissions to write this document + $oPerm =& KTPermission::getByName('ktcore.permissions.write'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDocument)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + $res = KTDocumentUtil::rename($oDocument, basename($dest_path), $oUser); + if (PEAR::isError($res) || is_null($res) || ($res === false)) { + return "404 Not Found - " . $res->getMessage(); + } else { + $this->ktwebdavLog("201 Created", 'info', true); + return "201 Created"; + } + + } + + list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); + + if (is_null($iDestDoc)) { + // the dest is a folder + } else if ($iDestDoc !== false) { + // Document exists + $this->ktwebdavLog("Destination Document exists.", 'info', true); + $oReplaceDoc = Document::get($iDestDoc); + if ($options['overwrite'] != 'T') { + $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); + return "412 Precondition Failed - Destination Document exists. Overwrite needs to be TRUE."; + } + $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Document.", 'info', true); + + // Check if the user has permissions to delete this document + $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceDoc)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTDocumentUtil::delete($oReplaceDoc, 'KTWebDAV move overwrites target.'); + $new = false; + } + + $oDestFolder = Folder::get($iDestFolder); + $this->ktwebdavLog("Got a destination folder of " . print_r($oDestFolder, true), 'info', true); + + // Check if the user has permissions to write in this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.write'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDestFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + + $oOriginalFolder = $oSrcFolder; + $iOriginalFolderPermissionObjectId = $oOriginalFolder->getPermissionObjectId(); + $iDocumentPermissionObjectId = $oDocument->getPermissionObjectId(); + + if ($iDocumentPermissionObjectId === $iOriginalFolderPermissionObjectId) { + $oDocument->setPermissionObjectId($oDestFolder->getPermissionObjectId()); + } + + //put the document in the new folder + $oDocument->setFolderID($oDestFolder->getId()); + if (!$oDocument->update(true)) { + return "502 Bad Gateway - Document update failed."; + } + + //move the document on the file system + $oStorage =& KTStorageManagerUtil::getSingleton(); + if (!$oStorage->moveDocument($oDocument, $oSrcFolder, $oDestFolder)) { + $oDocument->setFolderID($oSrcDocumentFolder->getId()); + $oDocument->update(true); + return "502 Bad Gateway"; + } + + $sMoveMessage = sprintf("Moved from %s/%s to %s/%s: %s", + $oSrcFolder->getFullPath(), + $oSrcFolder->getName(), + $oDestFolder->getFullPath(), + $oDestFolder->getName(), + $_SERVER['HTTP_REASON']); + + // create the document transaction record + $oDocumentTransaction = & new DocumentTransaction($oDocument, $sMoveMessage, 'ktcore.transactions.move'); + $oDocumentTransaction->create(); + + $oKTTriggerRegistry = KTTriggerRegistry::getSingleton(); + $aTriggers = $oKTTriggerRegistry->getTriggers('moveDocument', 'postValidate'); + foreach ($aTriggers as $aTrigger) { + $sTrigger = $aTrigger[0]; + $oTrigger = new $sTrigger; + $aInfo = array( + "document" => $oDocument, + "old_folder" => $oSrcFolder, + "new_folder" => $oDestFolder, + ); + $oTrigger->setInfo($aInfo); + $ret = $oTrigger->postValidate(); + // FIXME: handle trigger subfailures. + } + + if ($new) { + return "201 Created"; + } else { + return "204 No Content"; + } + } + + /** + * MOVE method helper for Folders + * + * @param array parameter passing array + * @param int Folder ID + * @return string HTTP status code or false + + */ + function _MOVEFolder($options, $iFolderID) { + + if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); + $this->ktwebdavLog("Entering _MOVEFolder. options are " . print_r($options, true), 'info', true); + + if ($options["depth"] != "infinity") { + // RFC 2518 Section 9.2, last paragraph + $this->ktwebdavLog("400 Bad request", 'info', true); + return "400 Bad request - depth must be 'inifinity'."; + } + + global $default; + + $source_path = $options["path"]; + $dest_path = urldecode($options["dest"]); + + $oSrcFolder = Folder::get($iFolderID); + + list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); + + $oDestFolder = Folder::get($iDestFolder); + + // Is this a rename? + if (dirname($source_path) == dirname($dest_path)) { + // This is a rename + //if ($options['overwrite'] != 'T') { + // $this->ktwebdavLog("This is a Rename. Overwrite needs to be TRUE.", 'info', true); + // return "412 Precondition Failed - This is a Rename. Overwrite needs to be TRUE."; + //} + + $this->ktwebdavLog("Got an oSrcFolder of " . print_r($oSrcFolder, true), 'info', true); + $this->ktwebdavLog("Got an new name of " . basename($dest_path), 'info', true); + + include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); + + // Check if the user has permissions to write this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.folder_rename'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oSrcFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + $res = KTFolderUtil::rename($oSrcFolder, basename($dest_path), $oUser); + if (PEAR::isError($res) || is_null($res) || ($res === false)) { + return "404 Not Found - " . $res->getMessage(); + } else { + $this->ktwebdavLog("201 Created", 'info', true); + return "201 Created"; + } + + } + + if (is_null($iDestDoc)) { + // the dest is a folder + } else if ($iDestDoc !== false) { + // Folder exists + $this->ktwebdavLog("Destination Folder exists.", 'info', true); + $oReplaceFolder = Folder::get($iDestDoc); + if ($options['overwrite'] != 'T') { + $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); + return "412 Precondition Failed - Destination Folder exists. Overwrite needs to be TRUE."; + } + $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Folder.", 'info', true); + + // Check if the user has permissions to delete this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTFolderUtil::delete($oReplaceFolder, 'KTWebDAV move overwrites target.'); + $new = false; + } + + include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); + + $oUser =& User::get($this->userID); + $this->ktwebdavLog("Got an oSrcFolder of " . print_r($oSrcFolder, true), 'info', true); + $this->ktwebdavLog("Got an oDestFolder of " . print_r($oDestFolder, true), 'info', true); + $this->ktwebdavLog("Got an oUser of " . print_r($oUser, true), 'info', true); + + // Check if the user has permissions to write in this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.write'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDestFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTFolderUtil::move($oSrcFolder, $oDestFolder, $oUser); + + $this->ktwebdavLog("201 Created", 'info', true); + return "201 Created"; + + } + + /** + * COPY method handler + * + * @param array parameter passing array + * @param string delete source flag + * @return string HTTP status code or false + */ + function COPY($options, $del = false) + { + $this->ktwebdavLog("Entering COPY. options are " . print_r($options, true), 'info', true); + $this->ktwebdavLog("del is: " . $del, 'info', true); + + if ($this->checkSafeMode()) { + + if (!empty($_SERVER["CONTENT_LENGTH"])) { // no body parsing yet + $this->ktwebdavLog("415 Unsupported media type", 'info', true); + return "415 Unsupported media type - No body parsing yet"; + } + + /* // no copying to different WebDAV Servers yet + if (isset($options["dest_url"])) { + $this->ktwebdavLog("502 bad gateway", 'info', true); + return "502 bad gateway - No copying to different WebDAV Servers yet"; + } + */ + $source_path = $options["path"]; + $this->ktwebdavLog("SourcePath is: " . $source_path, 'info', true); + $source_res = $this->_folderOrDocument($source_path); + if ($source_res === false) { + $this->ktwebdavLog("404 Not found - The document could not be found.", 'info', true); + return "404 Not found - The document could not be found."; + } + + list($iFolderID, $iDocumentID) = $source_res; + if ($iDocumentID === false) { + $this->ktwebdavLog("404 Not found - The folder could not be found.", 'info', true); + return "404 Not found - The folder could not be found."; + } + + if (is_null($iDocumentID)) { + // Source is a folder + $this->ktwebdavLog("Source is a Folder.", 'info', true); + $copystat = $this->_COPYFolder($options, $iFolderID); + + } else { + // Source is a document + $this->ktwebdavLog("Source is a Document.", 'info', true); + $copystat = $this->_COPYDocument($options, $iFolderID, $iDocumentID, $dest_folder_id); + + } + + // Delete the source if this is a move and the copy was ok + if ($del && ($copystat{0} == "2")) { + $delstat = $this->DELETE(array("path" => $options["path"])); + $this->ktwebdavLog("DELETE in COPY/MOVE stat is: " . $delstat, 'info', true); + if (($delstat{0} != "2") && (substr($delstat, 0, 3) != "404")) { + return $delstat; + } + } + + $this->ktwebdavLog("Final copystat result is: " . $copystat, 'info', true); + return $copystat; + + } else return "423 Locked - KTWebDAV is in SafeMode"; + } + + /** + * COPY method helper for Documents + * + * @param array parameter passing array + * @param int Folder ID + * @param int Document ID + * @return string HTTP status code or false + */ + function _COPYDocument($options, $iFolderID, $iDocumentID) { + + if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); + $this->ktwebdavLog("Entering _COPYDocument. options are " . print_r($options, true), 'info', true); + + if ($options["depth"] != "infinity") { + // RFC 2518 Section 9.2, last paragraph + $this->ktwebdavLog("400 Bad request", 'info', true); + return "400 Bad request - Depth must be 'infinity'."; + } + + global $default; + + $source_path = $options["path"]; + $dest_path = urldecode($options["dest"]); + + $oSrcFolder = Folder::get($iFolderID); + + list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); + + if (is_null($iDestDoc)) { + // the dest is a folder + // $this->ktwebdavLog("400 Bad request", 'info', true); + return "400 Bad request - Destination is a Folder"; + } else if ($iDestDoc !== false) { + // Document exists + $this->ktwebdavLog("Destination Document exists.", 'info', true); + $oReplaceDoc = Document::get($iDestDoc); + if ($options['overwrite'] != 'T') { + $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); + return "412 Precondition Failed - Destination Document exists. Overwrite needs to be TRUE."; + } + $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Document.", 'info', true); + + // Check if the user has permissions to delete this document + $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceDoc)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTDocumentUtil::delete($oReplaceDoc, 'KTWebDAV copy with overwrite set.'); + $new = false; + } + + $oDestFolder = Folder::get($iDestFolder); + $oSrcDoc = Document::get($iDocumentID); + + include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); + + $this->ktwebdavLog("Got an oSrcDoc of " . print_r($oSrcDoc, true), 'info', true); + $this->ktwebdavLog("Got an oDestFolder of " . print_r($oDestFolder, true), 'info', true); + + // Check if the user has permissions to write in this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.write'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oSrcDoc)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTDocumentUtil::copy($oSrcDoc, $oDestFolder, $_SERVER['HTTP_REASON']); + + // FIXME: Do failure checking here + + $new = false; + if ($new) { + $this->ktwebdavLog("201 Created", 'info', true); + return "201 Created"; + } else { + $this->ktwebdavLog("204 No Content", 'info', true); + return "204 No Content"; + } + } + + /** + * COPY method helper for Folders + * + * @param array parameter passing array + * @param int Parent Folder ID + * @return string HTTP status code or false + */ + function _COPYFolder($options, $iFolderID) { + + if ($options['dest'] == '') $options["dest"] = substr($options["dest_url"], strlen($_SERVER["SCRIPT_NAME"])); + $this->ktwebdavLog("Entering _COPYFolder. options are " . print_r($options, true), 'info', true); + + if ($options["depth"] != "infinity") { + // RFC 2518 Section 9.2, last paragraph + $this->ktwebdavLog("400 Bad request", 'info', true); + return "400 Bad request - Depth must be 'infinity'."; + } + + global $default; + + $new = true; + + $source_path = $options["path"]; + $dest_path = urldecode($options["dest"]); + + $oSrcFolder = Folder::get($iFolderID); + + list($iDestFolder, $iDestDoc) = $this->_folderOrDocument($dest_path); + + $oDestFolder = Folder::get($iDestFolder); + + include_once(KT_LIB_DIR . '/foldermanagement/folderutil.inc.php'); + + if (is_null($iDestDoc)) { + // the dest is a folder + $this->ktwebdavLog("The Destination is a Folder.", 'info', true); + } else if ($iDestDoc !== false) { + // Folder exists + $this->ktwebdavLog("Destination Folder exists.", 'info', true); + $oReplaceFolder = Folder::get($iDestDoc); + if ($options['overwrite'] != 'T') { + $this->ktwebdavLog("Overwrite needs to be TRUE.", 'info', true); + return "412 Precondition Failed - Destination Folder exists. Overwrite needs to be TRUE."; + } + $this->ktwebdavLog("Overwrite is TRUE, deleting Destination Folder.", 'info', true); + + // Check if the user has permissions to delete this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.delete'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oReplaceFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTFolderUtil::delete($oReplaceFolder, 'KTWebDAV move overwrites target.'); + $new = false; + } + + $oUser =& User::get($this->userID); + $this->ktwebdavLog("Got an oSrcFolder of " . print_r($oSrcFolder, true), 'info', true); + $this->ktwebdavLog("Got an oDestFolder of " . print_r($oDestFolder, true), 'info', true); + $this->ktwebdavLog("Got an oUser of " . print_r($oUser, true), 'info', true); + + // Check if the user has permissions to write in this folder + $oPerm =& KTPermission::getByName('ktcore.permissions.write'); + $oUser =& User::get($this->userID); + if (!KTPermissionUtil::userHasPermissionOnItem($oUser, $oPerm, $oDestFolder)) { + return "403 Forbidden - User does not have sufficient permissions"; + } + KTFolderUtil::copy($oSrcFolder, $oDestFolder, $oUser, 'KTWebDAV Copy.'); + + if ($new) { + $this->ktwebdavLog("201 Created", 'info', true); + return "201 Created"; + } else { + $this->ktwebdavLog("204 No Content", 'info', true); + return "204 No Content"; + } + + } + + /** + * LOCK method handler + * + * @param array parameter passing array + * @return string HTTP status code or false + */ + function LOCK(&$options) + { + return "200 OK"; + } + + /** + * UNLOCK method handler + * + * @param array parameter passing array + * @return string HTTP status code or false + */ + function UNLOCK(&$options) + { + return "200 OK"; + } + + /** + * checkLock() helper + * + * @param string resource path to check for locks + * @return string HTTP status code or false + */ + function checkLock($path) + { + $result = false; + + return $result; + } + + /** + * checkSafeMode() helper + * + * @return string true or false + */ + function checkSafeMode() + { + + // Check/Set the WebDAV Client + $userAgentValue = $_SERVER['HTTP_USER_AGENT']; + // KT Explorer + if (stristr($userAgentValue,"Microsoft Data Access Internet Publishing Provider DAV")) { + $this->dav_client = "MS"; + $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); + } + // Mac Finder + if (stristr($userAgentValue,"Macintosh")) { + $this->dav_client = "MC"; + $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); + } + // Konqueror + if (stristr($userAgentValue,"Konqueror")) { + $this->dav_client = "KO"; + $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); + } + // Neon Library ( Gnome Nautilus, cadaver, etc) + if (stristr($userAgentValue,"neon")) { + $this->dav_client = "NE"; + $this->ktwebdavLog("WebDAV Client : " . $userAgentValue, 'info', true); + } + // Windows WebDAV + if ($this->dav_client == 'MS' && $this->safeMode == 'off') { + + $this->ktwebdavLog("This is MS type client with SafeMode Off.", 'info', true); + return true; + + } + if ($this->dav_client == 'MS' && $this->safeMode != 'off') { + + $this->ktwebdavLog("This is MS type client with SafeMode On.", 'info', true); + return false; + + } + // Mac Finder + if ($this->dav_client == 'MC') { + + $this->ktwebdavLog("This is Mac Finder type client which only supports SafeMode.", 'info', true); + return false; + + } + // Konqueror + if ($this->dav_client == 'KO' && $this->safeMode == 'off') { + + $this->ktwebdavLog("This is Konqueror type client with SafeMode Off.", 'info', true); + return true; + + } + if ($this->dav_client == 'KO' && $this->safeMode != 'off') { + + $this->ktwebdavLog("This is Konqueror type client with SafeMode On.", 'info', true); + return false; + + } + // Neon Library (Gnome Nautilus, cadaver, etc.) + if ($this->dav_client == 'NE' && $this->safeMode == 'off') { + + $this->ktwebdavLog("This is Neon type client with SafeMode Off.", 'info', true); + return true; + + } + if ($this->dav_client == 'NE' && $this->safeMode != 'off') { + + $this->ktwebdavLog("This is Neon type client with SafeMode On.", 'info', true); + return false; + + } + + $this->ktwebdavLog("Unknown client. SafeMode needed.", 'info', true); + return false; + + } + + } + + + ?> diff --git a/ktwebservice/KTDownloadManager.inc.php b/ktwebservice/KTDownloadManager.inc.php index 8a2afe6..cf866fd 100644 --- a/ktwebservice/KTDownloadManager.inc.php +++ b/ktwebservice/KTDownloadManager.inc.php @@ -5,15 +5,20 @@ * KTDownloadManager manages files in the download_files table. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/KTUploadManager.inc.php b/ktwebservice/KTUploadManager.inc.php index b3663d8..2faaf21 100644 --- a/ktwebservice/KTUploadManager.inc.php +++ b/ktwebservice/KTUploadManager.inc.php @@ -5,15 +5,20 @@ * KTUploadManager manages files in the uploaded_files table. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/download.php b/ktwebservice/download.php index c1f2499..e1f3eb6 100644 --- a/ktwebservice/download.php +++ b/ktwebservice/download.php @@ -5,15 +5,20 @@ * This does the download of a file based on the download_files table. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/download_cleanup.php b/ktwebservice/download_cleanup.php index 9673ffd..76ef034 100644 --- a/ktwebservice/download_cleanup.php +++ b/ktwebservice/download_cleanup.php @@ -5,15 +5,20 @@ * Cleans up the download_files table. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/index.php b/ktwebservice/index.php index cad0fb5..b99ae48 100644 --- a/ktwebservice/index.php +++ b/ktwebservice/index.php @@ -5,15 +5,20 @@ * A wrapper for webservice.php * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/upload.php b/ktwebservice/upload.php index 5aefce0..2a39d43 100644 --- a/ktwebservice/upload.php +++ b/ktwebservice/upload.php @@ -5,15 +5,20 @@ * This uploads a file onto the file server. A web service method can later move the file to the correct location. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/upload_cleanup.php b/ktwebservice/upload_cleanup.php index 6ec98f6..e4b4590 100644 --- a/ktwebservice/upload_cleanup.php +++ b/ktwebservice/upload_cleanup.php @@ -5,15 +5,20 @@ * Cleans up the uploaded_files table and the upload. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwebservice/webservice.php b/ktwebservice/webservice.php index 7f4191a..b8bfdad 100644 --- a/ktwebservice/webservice.php +++ b/ktwebservice/webservice.php @@ -5,15 +5,20 @@ * This implements the KnowledgeTree Web Service in SOAP. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/examples/ktws_eg_add_document.php b/ktwsapi/php/examples/ktws_eg_add_document.php index 78c623f..62fd5da 100644 --- a/ktwsapi/php/examples/ktws_eg_add_document.php +++ b/ktwsapi/php/examples/ktws_eg_add_document.php @@ -5,15 +5,20 @@ * This is a sample of how to add a document to the repository. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/examples/ktws_eg_anonymous.php b/ktwsapi/php/examples/ktws_eg_anonymous.php index 6c97a08..2c449e6 100644 --- a/ktwsapi/php/examples/ktws_eg_anonymous.php +++ b/ktwsapi/php/examples/ktws_eg_anonymous.php @@ -5,15 +5,20 @@ * Demonstrates how to create an anonymous session. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/examples/ktws_eg_checkin.php b/ktwsapi/php/examples/ktws_eg_checkin.php index d542439..7db3a5d 100644 --- a/ktwsapi/php/examples/ktws_eg_checkin.php +++ b/ktwsapi/php/examples/ktws_eg_checkin.php @@ -5,15 +5,20 @@ * Demonstrates document checkout and checkin * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/examples/ktws_eg_create_folder.php b/ktwsapi/php/examples/ktws_eg_create_folder.php index 0e90ad2..9b0e6d3 100644 --- a/ktwsapi/php/examples/ktws_eg_create_folder.php +++ b/ktwsapi/php/examples/ktws_eg_create_folder.php @@ -5,15 +5,20 @@ * Demonstrates creating a folder in an active session. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/examples/ktws_eg_doc_info.php b/ktwsapi/php/examples/ktws_eg_doc_info.php index e9b0e57..56da863 100644 --- a/ktwsapi/php/examples/ktws_eg_doc_info.php +++ b/ktwsapi/php/examples/ktws_eg_doc_info.php @@ -5,15 +5,20 @@ * Demonstrates using an active session and getting document info and metadata. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/examples/ktws_eg_folder_listing.php b/ktwsapi/php/examples/ktws_eg_folder_listing.php index 50cb222..6954e3f 100644 --- a/ktwsapi/php/examples/ktws_eg_folder_listing.php +++ b/ktwsapi/php/examples/ktws_eg_folder_listing.php @@ -5,15 +5,20 @@ * Demonstrates document checkout and checkin * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/ktwsapi.inc.php b/ktwsapi/php/ktwsapi.inc.php index af50fd6..7d7294a 100644 --- a/ktwsapi/php/ktwsapi.inc.php +++ b/ktwsapi/php/ktwsapi.inc.php @@ -5,15 +5,20 @@ * This is the object model for the KnowledgeTree WebService. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/ktwsapi/php/ktwsapi_cfg.inc.php b/ktwsapi/php/ktwsapi_cfg.inc.php index 4de94af..0ab29ec 100644 --- a/ktwsapi/php/ktwsapi_cfg.inc.php +++ b/ktwsapi/php/ktwsapi_cfg.inc.php @@ -5,15 +5,20 @@ /* * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/Log.inc b/lib/Log.inc index b2fe88a..f57cfc5 100644 --- a/lib/Log.inc +++ b/lib/Log.inc @@ -10,15 +10,20 @@ define("ERROR", 2); * File logging class. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -27,6 +32,7 @@ define("ERROR", 2); * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/actions/actionregistry.inc.php b/lib/actions/actionregistry.inc.php index 924cbb4..9874334 100644 --- a/lib/actions/actionregistry.inc.php +++ b/lib/actions/actionregistry.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/actions/bulkaction.php b/lib/actions/bulkaction.php index 7325576..8083f58 100644 --- a/lib/actions/bulkaction.php +++ b/lib/actions/bulkaction.php @@ -4,15 +4,20 @@ * $Id: documentaction.inc.php 5848 2006-08-16 15:58:51Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/actions/documentaction.inc.php b/lib/actions/documentaction.inc.php index 4ee5642..d3d579a 100644 --- a/lib/actions/documentaction.inc.php +++ b/lib/actions/documentaction.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/actions/documentviewlet.inc.php b/lib/actions/documentviewlet.inc.php index 2479677..6213af0 100644 --- a/lib/actions/documentviewlet.inc.php +++ b/lib/actions/documentviewlet.inc.php @@ -4,15 +4,20 @@ * $Id: documentaction.inc.php 5848 2006-08-16 15:58:51Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/actions/entitylist.php b/lib/actions/entitylist.php index 72eb029..4609df5 100644 --- a/lib/actions/entitylist.php +++ b/lib/actions/entitylist.php @@ -4,15 +4,20 @@ * $Id: entity.php 5758 2006-07-27 10:17:43Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/actions/folderaction.inc.php b/lib/actions/folderaction.inc.php index dfc81a4..d08c07e 100644 --- a/lib/actions/folderaction.inc.php +++ b/lib/actions/folderaction.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/actions/portletregistry.inc.php b/lib/actions/portletregistry.inc.php index e301c30..37aa2d7 100644 --- a/lib/actions/portletregistry.inc.php +++ b/lib/actions/portletregistry.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/alert/delivery/EmailAlert.inc b/lib/alert/delivery/EmailAlert.inc index 209a5d7..a8ee82c 100644 --- a/lib/alert/delivery/EmailAlert.inc +++ b/lib/alert/delivery/EmailAlert.inc @@ -6,15 +6,20 @@ require_once(KT_LIB_DIR . '/email/Email.inc'); * Sends an email (subscription) alert. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -23,6 +28,7 @@ require_once(KT_LIB_DIR . '/email/Email.inc'); * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/alert/delivery/SMSAlert.inc b/lib/alert/delivery/SMSAlert.inc index 5c3738c..7b04ac2 100644 --- a/lib/alert/delivery/SMSAlert.inc +++ b/lib/alert/delivery/SMSAlert.inc @@ -5,15 +5,20 @@ * Sends an sms (subscription) alert (UNIMPLEMENTED). * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/authentication/Authenticator.inc b/lib/authentication/Authenticator.inc index 4e5fab8..5237af9 100644 --- a/lib/authentication/Authenticator.inc +++ b/lib/authentication/Authenticator.inc @@ -6,15 +6,20 @@ require_once(KT_LIB_DIR . '/users/User.inc'); * Interface class that performs all authentication functions. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -23,6 +28,7 @@ require_once(KT_LIB_DIR . '/users/User.inc'); * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/authentication/DBAuthenticator.inc b/lib/authentication/DBAuthenticator.inc index b779c84..831439e 100644 --- a/lib/authentication/DBAuthenticator.inc +++ b/lib/authentication/DBAuthenticator.inc @@ -6,15 +6,20 @@ require_once(KT_LIB_DIR . "/authentication/Authenticator.inc"); * Perform authentication tasks against the database. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -23,6 +28,7 @@ require_once(KT_LIB_DIR . "/authentication/Authenticator.inc"); * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/authentication/authenticationprovider.inc.php b/lib/authentication/authenticationprovider.inc.php index 59208e9..b9d45ae 100644 --- a/lib/authentication/authenticationprovider.inc.php +++ b/lib/authentication/authenticationprovider.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/authenticationproviderregistry.inc.php b/lib/authentication/authenticationproviderregistry.inc.php index 82b569b..6f14db7 100644 --- a/lib/authentication/authenticationproviderregistry.inc.php +++ b/lib/authentication/authenticationproviderregistry.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/authenticationsource.inc.php b/lib/authentication/authenticationsource.inc.php index 26a02ad..5468b73 100644 --- a/lib/authentication/authenticationsource.inc.php +++ b/lib/authentication/authenticationsource.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/authenticationutil.inc.php b/lib/authentication/authenticationutil.inc.php index 18f2ab1..c246d0d 100644 --- a/lib/authentication/authenticationutil.inc.php +++ b/lib/authentication/authenticationutil.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/builtinauthenticationprovider.inc.php b/lib/authentication/builtinauthenticationprovider.inc.php index 3c4baca..1f423f2 100644 --- a/lib/authentication/builtinauthenticationprovider.inc.php +++ b/lib/authentication/builtinauthenticationprovider.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/interceptor.inc.php b/lib/authentication/interceptor.inc.php index 5c1dc8e..9bbcd60 100644 --- a/lib/authentication/interceptor.inc.php +++ b/lib/authentication/interceptor.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/interceptorinstances.inc.php b/lib/authentication/interceptorinstances.inc.php index 9164a9f..b70d22b 100644 --- a/lib/authentication/interceptorinstances.inc.php +++ b/lib/authentication/interceptorinstances.inc.php @@ -4,15 +4,20 @@ * $Id: authenticationsource.inc.php 5758 2006-07-27 10:17:43Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/authentication/interceptorregistry.inc.php b/lib/authentication/interceptorregistry.inc.php index 0722144..6b57435 100644 --- a/lib/authentication/interceptorregistry.inc.php +++ b/lib/authentication/interceptorregistry.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/browse/BrowseColumns.inc.php b/lib/browse/BrowseColumns.inc.php index b0b6c36..9abfcc1 100644 --- a/lib/browse/BrowseColumns.inc.php +++ b/lib/browse/BrowseColumns.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/browse/Criteria.inc b/lib/browse/Criteria.inc index 3f89b35..d245566 100644 --- a/lib/browse/Criteria.inc +++ b/lib/browse/Criteria.inc @@ -5,15 +5,20 @@ * Contains document browsing business logic. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -22,6 +27,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/browse/DocumentCollection.inc.php b/lib/browse/DocumentCollection.inc.php index 0a48954..5aaffc1 100644 --- a/lib/browse/DocumentCollection.inc.php +++ b/lib/browse/DocumentCollection.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/browse/PartialQuery.inc.php b/lib/browse/PartialQuery.inc.php index 86d65eb..027e1b4 100644 --- a/lib/browse/PartialQuery.inc.php +++ b/lib/browse/PartialQuery.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/browse/browseutil.inc.php b/lib/browse/browseutil.inc.php index 5832e76..b630022 100644 --- a/lib/browse/browseutil.inc.php +++ b/lib/browse/browseutil.inc.php @@ -6,15 +6,20 @@ * Utilities helpful to traversing the document repository * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -23,6 +28,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/browse/columnentry.inc.php b/lib/browse/columnentry.inc.php index 35f4ff4..ed78ccc 100644 --- a/lib/browse/columnentry.inc.php +++ b/lib/browse/columnentry.inc.php @@ -4,15 +4,20 @@ * $Id: columnentry.inc.php 5492 2006-06-04 20:50:43Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/browse/columnregistry.inc.php b/lib/browse/columnregistry.inc.php index 1d256c0..9da1af5 100644 --- a/lib/browse/columnregistry.inc.php +++ b/lib/browse/columnregistry.inc.php @@ -4,15 +4,20 @@ * $Id: columnregistry.inc.php 5492 2006-06-04 20:50:43Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/browse/criteriaregistry.php b/lib/browse/criteriaregistry.php index a0bb117..c8a152d 100644 --- a/lib/browse/criteriaregistry.php +++ b/lib/browse/criteriaregistry.php @@ -2,15 +2,20 @@ /* * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -19,6 +24,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/cache/cache.inc.php b/lib/cache/cache.inc.php index 825fc6e..771ab1e 100644 --- a/lib/cache/cache.inc.php +++ b/lib/cache/cache.inc.php @@ -1,4 +1,32 @@ , Jam Warehouse (Pty) Ltd, South Africa diff --git a/lib/util/legacy.inc b/lib/util/legacy.inc index 729931a..b6f676b 100644 --- a/lib/util/legacy.inc +++ b/lib/util/legacy.inc @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/lib/util/sanitize.inc b/lib/util/sanitize.inc index 75e9dee..d6eea7d 100644 --- a/lib/util/sanitize.inc +++ b/lib/util/sanitize.inc @@ -6,15 +6,20 @@ * This page is meant to provide functions to prevent XSS cracks. * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -23,6 +28,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * * * @version $Revision$ diff --git a/lib/validation/basevalidator.inc.php b/lib/validation/basevalidator.inc.php index e92c0db..ecafd80 100644 --- a/lib/validation/basevalidator.inc.php +++ b/lib/validation/basevalidator.inc.php @@ -1,4 +1,32 @@ , Jam Warehouse (Pty) Ltd, South Africa diff --git a/plugins/ktcore/admin/documentFieldsv2.php b/plugins/ktcore/admin/documentFieldsv2.php index dfeb566..35fc101 100644 --- a/plugins/ktcore/admin/documentFieldsv2.php +++ b/plugins/ktcore/admin/documentFieldsv2.php @@ -4,15 +4,20 @@ * $Id: documentFields.php 5801 2006-08-15 10:06:22Z bryndivey $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktcore/admin/documentTypes.php b/plugins/ktcore/admin/documentTypes.php index 40aca67..f9d987a 100755 --- a/plugins/ktcore/admin/documentTypes.php +++ b/plugins/ktcore/admin/documentTypes.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktcore/admin/expungeList.php b/plugins/ktcore/admin/expungeList.php index c78c990..96c842b 100644 --- a/plugins/ktcore/admin/expungeList.php +++ b/plugins/ktcore/admin/expungeList.php @@ -1,10 +1,33 @@ getMimeExtension(); - // make sure that the selected document id of an acceptable extension - foreach($this->aAcceptedMimeTypes as $acceptType){ - if($acceptType == $sDocType){ - return _kt('Generate PDF') . "  $this->oDocument->getId(), "action" => "pdfdownload") ) . "\" PDF"; - } - } - } - return ''; - } - - function form_main() { - $oForm = new KTForm; - $oForm->setOptions(array( - 'label' => _kt('Convert Document to PDF'), - 'action' => 'selectType', - 'fail_action' => 'main', - 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument), - 'submit_label' => _kt('Convert Document'), - 'context' => &$this, - )); - - $oForm->setWidgets(array( - array('ktcore.widgets.selection', array( - 'label' => _kt("Type of conversion"), - 'description' => _kt('The following are the types of conversions you can perform on this document.'), - 'important_description' => _kt('QA NOTE: Permissions checks are required here...'), - 'name' => 'convert_type', - 'vocab' => array('Download as PDF', 'Duplicate as PDF', 'Replace as PDF'), - 'simple_select' => true, - 'required' => true, - )), - )); - - return $oForm; - } - - function do_selectType() { - - switch($_REQUEST[data][convert_type]){ - case '0': - $this->do_pdfdownload(); - break; - case '1': - $this->do_pdfduplicate(); - break; - case '2': - $this->do_pdfreplace(); - break; - default: - $this->do_pdfdownload(); - } - redirect(KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId() ) ) ); - exit(0); - } - - function do_main() { - $this->oPage->setBreadcrumbDetails(_kt('Generate PDF')); - $oTemplate =& $this->oValidator->validateTemplate('ktstandard/PDFPlugin/PDFPlugin'); - - $oForm = $this->form_main(); - - $oTemplate->setData(array( - 'context' => &$this, - 'form' => $oForm, - )); - return $oTemplate->render(); - } - - /** - * Method for getting the MIME type extension for the current document. - * - * @return string mime time extension - */ - function getMimeExtension() { - - if($this->oDocument == null || $this->oDocument == "" || PEAR::isError($this->oDocument) ) return _kt('Unknown Type'); - - $oDocument = $this->oDocument; - $iMimeTypeId = $oDocument->getMimeTypeID(); - $mimetypename = KTMime::getMimeTypeName($iMimeTypeId); // mime type name - - $sTable = KTUtil::getTableName('mimetypes'); - $sQuery = "SELECT filetypes FROM " . $sTable . " WHERE mimetypes = ?"; - $aQuery = array($sQuery, array($mimetypename)); - $res = DBUtil::getResultArray($aQuery); - if (PEAR::isError($res)) { - return $res; - } else if (count($res) != 0){ - return $res[0]['filetypes']; - } - - return _kt('Unknown Type'); - } - - /** - * Method for downloading the document as a pdf. - * - * @return true on success else false - */ - function do_pdfdownload() { - - $oDocument = $this->oDocument; - $oStorage =& KTStorageManagerUtil::getSingleton(); - $oConfig =& KTConfig::getSingleton(); - - //get the actual path to the document on the server - $sPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $oStorage->getPath($oDocument)); - - if (file_exists($sPath)) { - - // Get a tmp file - $sTempFilename = tempnam('/tmp', 'ktpdf'); - - // We need to handle Windows differently - as usual ;) - if (substr( PHP_OS, 0, 3) == 'WIN') { - - $cmd = "\"" . KT_DIR . "/../openoffice/openoffice/program/python.bat\" \"". KT_DIR . "/bin/openoffice/pdfgen.py\" \"" . $sPath . "\" \"" . $sTempFilename . "\""; - $cmd = str_replace( '/','\\',$cmd); - - // TODO: Check for more errors here - // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands! - // Excecute the python script. TODO: Check this works with Windows - $res = `"$cmd" 2>&1`; - //print($res); - //print($cmd); - //exit; - - } else { - - // TODO: Check for more errors here - // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands! - // Excecute the python script. - $cmd = '../openoffice/program/python bin/openoffice/pdfgen.py ' . escapeshellcmd($sPath) . ' ' . escapeshellcmd($sTempFilename); - $res = shell_exec($cmd." 2>&1"); - //print($res); - //print($cmd); - //exit; - - } - - // Check the tempfile exists and the python script did not return anything (which would indicate an error) - if (file_exists($sTempFilename) && $res == '') { - - $sUrlEncodedFileName = substr($oDocument->getFileName(), 0, strrpos($oDocument->getFileName(), '.') ); - $browser = $_SERVER['HTTP_USER_AGENT']; - if ( strpos( strtoupper( $browser), 'MSIE') !== false) { - $sUrlEncodedFileName = rawurlencode($sUrlEncodedFileName); - } - // Set the correct headers - header("Content-Type: application/pdf"); - header("Content-Length: ". filesize($sTempFilename)); - header("Content-Disposition: attachment; filename=\"" . $sUrlEncodedFileName . ".pdf\""); - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: must-revalidate"); - - // Get a filelike object and send it to the browser - $oFile = new KTFSFileLike($sTempFilename); - KTFileLikeUtil::send_contents($oFile); - // Remove the tempfile - unlink($sTempFilename); - - // Create the document transaction - $oDocumentTransaction = & new DocumentTransaction($oDocument, 'Document downloaded as PDF', 'ktcore.transactions.download', $aOptions); - $oDocumentTransaction->create(); - // Just stop here - the content has already been sent. - exit(0); - - } else { - // Set the error messsage and redirect to view document - $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.
' . $res)); - redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId()))); - exit(0); - } - - } else { - // Set the error messsage and redirect to view document - $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.
The path to the document did not exist.')); - redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId()))); - exit(0); - } - - - } - - /** - * Method for duplicating the document as a pdf. - * - */ - function do_pdfduplicate() { - - $this->oPage->setBreadcrumbDetails(_kt('Generate PDF')); - $oTemplate =& $this->oValidator->validateTemplate('ktstandard/PDFPlugin/PDFPlugin'); - - $oForm = $this->form_main(); - - $oTemplate->setData(array( - 'context' => &$this, - 'form' => $oForm, - )); - $this->addErrorMessage(_kt('NOT IMPLEMENTED YET: This will create a pdf copy of the document as a new document.')); - return $oTemplate->render(); - - } - - /** - * Method for replacing the document as a pdf. - * - */ - function do_pdfreplace() { - - $this->oPage->setBreadcrumbDetails(_kt('Generate PDF')); - $oTemplate =& $this->oValidator->validateTemplate('ktstandard/PDFPlugin/PDFPlugin'); - - $oForm = $this->form_main(); - - $oTemplate->setData(array( - 'context' => &$this, - 'form' => $oForm, - )); - $this->addErrorMessage(_kt('NOT IMPLEMENTED YET: This will replace the document with a pdf copy of the document.')); - return $oTemplate->render(); - - } -} -?> +getMimeExtension(); + // make sure that the selected document id of an acceptable extension + foreach($this->aAcceptedMimeTypes as $acceptType){ + if($acceptType == $sDocType){ + return _kt('Generate PDF') . "  $this->oDocument->getId(), "action" => "pdfdownload") ) . "\" PDF"; + } + } + } + return ''; + } + + function form_main() { + $oForm = new KTForm; + $oForm->setOptions(array( + 'label' => _kt('Convert Document to PDF'), + 'action' => 'selectType', + 'fail_action' => 'main', + 'cancel_url' => KTBrowseUtil::getUrlForDocument($this->oDocument), + 'submit_label' => _kt('Convert Document'), + 'context' => &$this, + )); + + $oForm->setWidgets(array( + array('ktcore.widgets.selection', array( + 'label' => _kt("Type of conversion"), + 'description' => _kt('The following are the types of conversions you can perform on this document.'), + 'important_description' => _kt('QA NOTE: Permissions checks are required here...'), + 'name' => 'convert_type', + 'vocab' => array('Download as PDF', 'Duplicate as PDF', 'Replace as PDF'), + 'simple_select' => true, + 'required' => true, + )), + )); + + return $oForm; + } + + function do_selectType() { + + switch($_REQUEST[data][convert_type]){ + case '0': + $this->do_pdfdownload(); + break; + case '1': + $this->do_pdfduplicate(); + break; + case '2': + $this->do_pdfreplace(); + break; + default: + $this->do_pdfdownload(); + } + redirect(KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId() ) ) ); + exit(0); + } + + function do_main() { + $this->oPage->setBreadcrumbDetails(_kt('Generate PDF')); + $oTemplate =& $this->oValidator->validateTemplate('ktstandard/PDFPlugin/PDFPlugin'); + + $oForm = $this->form_main(); + + $oTemplate->setData(array( + 'context' => &$this, + 'form' => $oForm, + )); + return $oTemplate->render(); + } + + /** + * Method for getting the MIME type extension for the current document. + * + * @return string mime time extension + */ + function getMimeExtension() { + + if($this->oDocument == null || $this->oDocument == "" || PEAR::isError($this->oDocument) ) return _kt('Unknown Type'); + + $oDocument = $this->oDocument; + $iMimeTypeId = $oDocument->getMimeTypeID(); + $mimetypename = KTMime::getMimeTypeName($iMimeTypeId); // mime type name + + $sTable = KTUtil::getTableName('mimetypes'); + $sQuery = "SELECT filetypes FROM " . $sTable . " WHERE mimetypes = ?"; + $aQuery = array($sQuery, array($mimetypename)); + $res = DBUtil::getResultArray($aQuery); + if (PEAR::isError($res)) { + return $res; + } else if (count($res) != 0){ + return $res[0]['filetypes']; + } + + return _kt('Unknown Type'); + } + + /** + * Method for downloading the document as a pdf. + * + * @return true on success else false + */ + function do_pdfdownload() { + + $oDocument = $this->oDocument; + $oStorage =& KTStorageManagerUtil::getSingleton(); + $oConfig =& KTConfig::getSingleton(); + + //get the actual path to the document on the server + $sPath = sprintf("%s/%s", $oConfig->get('urls/documentRoot'), $oStorage->getPath($oDocument)); + + if (file_exists($sPath)) { + + // Get a tmp file + $sTempFilename = tempnam('/tmp', 'ktpdf'); + + // We need to handle Windows differently - as usual ;) + if (substr( PHP_OS, 0, 3) == 'WIN') { + + $cmd = "\"" . KT_DIR . "/../openoffice/openoffice/program/python.bat\" \"". KT_DIR . "/bin/openoffice/pdfgen.py\" \"" . $sPath . "\" \"" . $sTempFilename . "\""; + $cmd = str_replace( '/','\\',$cmd); + + // TODO: Check for more errors here + // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands! + // Excecute the python script. TODO: Check this works with Windows + $res = `"$cmd" 2>&1`; + //print($res); + //print($cmd); + //exit; + + } else { + + // TODO: Check for more errors here + // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands! + // Excecute the python script. + $cmd = '../openoffice/program/python bin/openoffice/pdfgen.py ' . escapeshellcmd($sPath) . ' ' . escapeshellcmd($sTempFilename); + $res = shell_exec($cmd." 2>&1"); + //print($res); + //print($cmd); + //exit; + + } + + // Check the tempfile exists and the python script did not return anything (which would indicate an error) + if (file_exists($sTempFilename) && $res == '') { + + $sUrlEncodedFileName = substr($oDocument->getFileName(), 0, strrpos($oDocument->getFileName(), '.') ); + $browser = $_SERVER['HTTP_USER_AGENT']; + if ( strpos( strtoupper( $browser), 'MSIE') !== false) { + $sUrlEncodedFileName = rawurlencode($sUrlEncodedFileName); + } + // Set the correct headers + header("Content-Type: application/pdf"); + header("Content-Length: ". filesize($sTempFilename)); + header("Content-Disposition: attachment; filename=\"" . $sUrlEncodedFileName . ".pdf\""); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: must-revalidate"); + + // Get a filelike object and send it to the browser + $oFile = new KTFSFileLike($sTempFilename); + KTFileLikeUtil::send_contents($oFile); + // Remove the tempfile + unlink($sTempFilename); + + // Create the document transaction + $oDocumentTransaction = & new DocumentTransaction($oDocument, 'Document downloaded as PDF', 'ktcore.transactions.download', $aOptions); + $oDocumentTransaction->create(); + // Just stop here - the content has already been sent. + exit(0); + + } else { + // Set the error messsage and redirect to view document + $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.
' . $res)); + redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId()))); + exit(0); + } + + } else { + // Set the error messsage and redirect to view document + $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.
The path to the document did not exist.')); + redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId()))); + exit(0); + } + + + } + + /** + * Method for duplicating the document as a pdf. + * + */ + function do_pdfduplicate() { + + $this->oPage->setBreadcrumbDetails(_kt('Generate PDF')); + $oTemplate =& $this->oValidator->validateTemplate('ktstandard/PDFPlugin/PDFPlugin'); + + $oForm = $this->form_main(); + + $oTemplate->setData(array( + 'context' => &$this, + 'form' => $oForm, + )); + $this->addErrorMessage(_kt('NOT IMPLEMENTED YET: This will create a pdf copy of the document as a new document.')); + return $oTemplate->render(); + + } + + /** + * Method for replacing the document as a pdf. + * + */ + function do_pdfreplace() { + + $this->oPage->setBreadcrumbDetails(_kt('Generate PDF')); + $oTemplate =& $this->oValidator->validateTemplate('ktstandard/PDFPlugin/PDFPlugin'); + + $oForm = $this->form_main(); + + $oTemplate->setData(array( + 'context' => &$this, + 'form' => $oForm, + )); + $this->addErrorMessage(_kt('NOT IMPLEMENTED YET: This will replace the document with a pdf copy of the document.')); + return $oTemplate->render(); + + } +} +?> diff --git a/plugins/ktstandard/PDFGeneratorPlugin.php b/plugins/ktstandard/PDFGeneratorPlugin.php index e3e9ed2..3aef542 100644 --- a/plugins/ktstandard/PDFGeneratorPlugin.php +++ b/plugins/ktstandard/PDFGeneratorPlugin.php @@ -1,47 +1,53 @@ -sFriendlyName = _kt('PDF Generator Plugin'); - return $res; - } - - function setup() { - $this->registerAction('documentaction', 'PDFGeneratorAction', 'ktstandard.pdf.generate', $sFilename = null); - } - } -$oPluginRegistry =& KTPluginRegistry::getSingleton(); -$oPluginRegistry->registerPlugin('PDFGeneratorPlugin', 'ktstandard.pdf.plugin', __FILE__); -?> +sFriendlyName = _kt('PDF Generator Plugin'); + return $res; + } + + function setup() { + $this->registerAction('documentaction', 'PDFGeneratorAction', 'ktstandard.pdf.generate', $sFilename = null); + } + } +$oPluginRegistry =& KTPluginRegistry::getSingleton(); +$oPluginRegistry->registerPlugin('PDFGeneratorPlugin', 'ktstandard.pdf.plugin', __FILE__); +?> diff --git a/plugins/ktstandard/SearchDashlet.php b/plugins/ktstandard/SearchDashlet.php index 283b9ec..93d4296 100644 --- a/plugins/ktstandard/SearchDashlet.php +++ b/plugins/ktstandard/SearchDashlet.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/SearchDashletPlugin.php b/plugins/ktstandard/SearchDashletPlugin.php index e2dfb73..c9243cd 100644 --- a/plugins/ktstandard/SearchDashletPlugin.php +++ b/plugins/ktstandard/SearchDashletPlugin.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/admin/manageDisclaimers.php b/plugins/ktstandard/admin/manageDisclaimers.php index 66dae40..8d26b44 100644 --- a/plugins/ktstandard/admin/manageDisclaimers.php +++ b/plugins/ktstandard/admin/manageDisclaimers.php @@ -4,15 +4,20 @@ * $Id * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/BaseIndexer.php b/plugins/ktstandard/contents/BaseIndexer.php index 3d440c4..86ffa25 100644 --- a/plugins/ktstandard/contents/BaseIndexer.php +++ b/plugins/ktstandard/contents/BaseIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/ExcelIndexer.php b/plugins/ktstandard/contents/ExcelIndexer.php index 53f3710..1464194 100644 --- a/plugins/ktstandard/contents/ExcelIndexer.php +++ b/plugins/ktstandard/contents/ExcelIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/OpenDocumentIndexer.php b/plugins/ktstandard/contents/OpenDocumentIndexer.php index f76c91d..5e6e879 100644 --- a/plugins/ktstandard/contents/OpenDocumentIndexer.php +++ b/plugins/ktstandard/contents/OpenDocumentIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/PdfIndexer.php b/plugins/ktstandard/contents/PdfIndexer.php index 28acbac..4e27a67 100644 --- a/plugins/ktstandard/contents/PdfIndexer.php +++ b/plugins/ktstandard/contents/PdfIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/PowerpointIndexer.php b/plugins/ktstandard/contents/PowerpointIndexer.php index a3a850d..fcd306f 100644 --- a/plugins/ktstandard/contents/PowerpointIndexer.php +++ b/plugins/ktstandard/contents/PowerpointIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/PsIndexer.php b/plugins/ktstandard/contents/PsIndexer.php index d409b16..67fa396 100644 --- a/plugins/ktstandard/contents/PsIndexer.php +++ b/plugins/ktstandard/contents/PsIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/RtfIndexer.php b/plugins/ktstandard/contents/RtfIndexer.php index e5611bf..a97c912 100644 --- a/plugins/ktstandard/contents/RtfIndexer.php +++ b/plugins/ktstandard/contents/RtfIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/TextIndexer.php b/plugins/ktstandard/contents/TextIndexer.php index a19f23c..36b3fec 100644 --- a/plugins/ktstandard/contents/TextIndexer.php +++ b/plugins/ktstandard/contents/TextIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/WordIndexer.php b/plugins/ktstandard/contents/WordIndexer.php index 77e66e6..b2ff688 100644 --- a/plugins/ktstandard/contents/WordIndexer.php +++ b/plugins/ktstandard/contents/WordIndexer.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/contents/XmlHtmlIndexer.php b/plugins/ktstandard/contents/XmlHtmlIndexer.php index 957190e..9d6e0ec 100644 --- a/plugins/ktstandard/contents/XmlHtmlIndexer.php +++ b/plugins/ktstandard/contents/XmlHtmlIndexer.php @@ -4,15 +4,20 @@ * $Id: OpenDocumentIndexer.php 5758 2006-07-27 10:17:43Z bshuttle $ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/ldap/activedirectoryauthenticationprovider.inc.php b/plugins/ktstandard/ldap/activedirectoryauthenticationprovider.inc.php index 0db2683..17290e1 100644 --- a/plugins/ktstandard/ldap/activedirectoryauthenticationprovider.inc.php +++ b/plugins/ktstandard/ldap/activedirectoryauthenticationprovider.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/ldap/ldapauthenticationprovider.inc.php b/plugins/ktstandard/ldap/ldapauthenticationprovider.inc.php index 6795509..64af82c 100644 --- a/plugins/ktstandard/ldap/ldapauthenticationprovider.inc.php +++ b/plugins/ktstandard/ldap/ldapauthenticationprovider.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php b/plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php index e67a53b..d922e98 100644 --- a/plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php +++ b/plugins/ktstandard/ldap/ldapbaseauthenticationprovider.inc.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/workflow/FolderAssociator.php b/plugins/ktstandard/workflow/FolderAssociator.php index 796543e..1b53ed3 100644 --- a/plugins/ktstandard/workflow/FolderAssociator.php +++ b/plugins/ktstandard/workflow/FolderAssociator.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/workflow/TypeAssociator.php b/plugins/ktstandard/workflow/TypeAssociator.php index d5be469..55f024b 100644 --- a/plugins/ktstandard/workflow/TypeAssociator.php +++ b/plugins/ktstandard/workflow/TypeAssociator.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/ktstandard/workflow/adminpage.php b/plugins/ktstandard/workflow/adminpage.php index e83020d..54c7cec 100644 --- a/plugins/ktstandard/workflow/adminpage.php +++ b/plugins/ktstandard/workflow/adminpage.php @@ -4,15 +4,20 @@ * $Id$ * * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -21,6 +26,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/rssplugin/KTrss.inc.php b/plugins/rssplugin/KTrss.inc.php index 2a0edfe..40fffd6 100644 --- a/plugins/rssplugin/KTrss.inc.php +++ b/plugins/rssplugin/KTrss.inc.php @@ -1,632 +1,638 @@ - strtotime($b[datetime])) ? -1 : 1;'; - - $compare = create_function('$a,$b', $code); - - usort($aFTransactions, $compare); - for($i=0; $i<4; $i++){ - $aFTransactions_new[] = $aFTransactions[$i]; - } - $aFTransactions = $aFTransactions_new; - - if($aFData){ - $aFData['itemType'] = 'folder'; - - // create mime info - $aFData['mimeTypeFName'] = 'Folder'; - $aFData['mimeTypeIcon'] = KTrss::getFolderIcon(); - - $aFolder[] = $aFData; - $aFolder[] = $aFTransactions; - $aFolderBox[] = $aFolder; - } - if (PEAR::isError($aFData)) { - return false; - } - if ($aFolder){ - return $aFolder; - } - } - - // Takes in an array as a parameter and returns rss2.0 compatible xml - function arrayToXML($aItems){ - // Build path to host - $aPath = explode('/', trim($_SERVER['PHP_SELF'])); - $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/"; - $feed = "\n"; - $feed .= "\n". - "\n" . - "".APP_NAME." RSS\n" . - "(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved\n" . - "".$hostPath."\n" . - "KT-RSS\n" . - "\n". - "".APP_NAME." RSS\n". - "140\n". - "28". - "".$hostPath."knowledgeTree/\n". - "".$hostPath."resources/graphics/ktlogo_rss.png\n". - "\n"; - foreach($aItems as $aItems){ - if($aItems[0][itemType] == 'folder'){ - $sTypeSelect = 'folder.transactions&fFolderId'; - }elseif($aItems[0][itemType] == 'document'){ - $sTypeSelect = 'document.transactionhistory&fDocumentId'; - } - $feed .= "\n" . - "".$aItems[0][0][name]."\n" . - "".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."\n" . - "\n" . - "<table border='0' width='90%'>\n". - "<tr>\n". - "<td width='5%' height='16px'>" . - "<a href='".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0][id]."' ><img src='".$aItems[0][mimeTypeIcon]."' align='left' height='16px' width='16px' alt='' border='0' /></a>" . - "</td>\n". - "<td align='left'> ".$aItems[0][mimeTypeFName]."</td>\n". - "</tr>\n". - "<tr>\n". - "<td colspan='2'>\n". - ucfirst($aItems[0]['itemType'])." Information (ID: ".$aItems[0][0][id].")</>\n". - "<hr>\n". - "<table width='95%'>\n". - "<tr>\n". - "<td>Filename: ".$aItems[0][0][filename]."</td>\n". - "<td>\n". - "</tr>\n". - "<tr>\n". - "<td>Author: ".$aItems[0][0][author]."</td>\n". - "<td>\n". - "</tr>\n". - "<tr>\n". - "<td>Owner: ";if($aItems[0][0][owner]){$feed .= $aItems[0][0][owner];}else{$feed .= "None";} - $feed .= "</td>\n". - "<td></td>\n". - "</tr>\n". - "<tr>\n";if($aItems[0][0][type]){ - $feed .= "<td>Document type: ".$aItems[0][0][type]."</td>\n". - "<td></td>\n";} - $feed .= "</tr>\n". - "<tr>\n". - "<td>Workflow status: ";if($aItems[0][0][workflow_status]){$feed .= $aItems[0][0][workflow_status];}else{$feed .= "No Workflow";} - $feed .= "</td>\n". - "<td></td>\n". - "</tr>\n". - "</table><br>\n". - "Transaction Summary (Last 3)\n". - "<hr>\n". - "<table width='100%'>\n"; - foreach($aItems[1] as $item){ - $feed .= "<tr>\n". - "<td>".$item[type]." name:</td>\n". - "<td>".$item[name]."</td>\n". - "</tr>\n". - "<tr>\n". - "<td>Path:</td>\n". - "<td>".$item[fullpath]."</td>\n". - "</tr>\n". - "<tr>\n". - "<td>Transaction:</td>\n". - "<td>".$item[transaction_name]."</td>\n". - "</tr>\n". - "<tr>\n". - "<td>Comment:</td>\n". - "<td>".$item[comment]."</td>\n". - "</tr>\n". - "<tr>\n";if($item[version]){ - $feed .= "<td>Version:</td>\n". - "<td>".$item[version]."</td>\n";} - $feed .= "</tr>\n". - "<tr>\n". - "<td>Date:</td>\n". - "<td>".$item[datetime]."</td>\n". - "</tr>\n". - "<tr>\n". - "<td>User:</td>\n". - "<td>".$item[user_name]."</td>\n". - "</tr>\n". - "<tr>\n". - "<td colspan='2'><hr width='100' align='left'></td>\n". - "</tr>\n";} - $feed .= "</table>\n". - "</td>\n". - "</tr>\n". - "</table>". - "\n". - "\n"; - } - $feed .= "\n" . - "\n"; - - return $feed; - } - - // Takes in an array as a parameter and returns rss2.0 compatible xml - function errorToXML($sError){ - // Build path to host - $aPath = explode('/', trim($_SERVER['PHP_SELF'])); - $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/"; - $feed = "\n"; - $feed .= "\n". - "\n" . - "".APP_NAME." RSS\n" . - "(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved\n" . - "".$hostPath."\n" . - "KT-RSS\n" . - "\n". - "".APP_NAME." RSS\n". - "140\n". - "28". - "".$hostPath."knowledgeTree/\n". - "".$hostPath."resources/graphics/ktlogo_rss.png\n". - "\n"; - $feed .= "\n". - "Feed load error\n" . - "".$sError."\n". - "\n"; - $feed .= "\n" . - "\n"; - - return $feed; - } - - // Delete feed function - function deleteFeed($iFeedId){ - $res = DBUtil::autoDelete('plugin_rss', $iFeedId); - } - - // Get title for external feed - function getExternalFeedTitle($iFeedId){ - $sQuery = "SELECT title FROM plugin_rss WHERE id = ?"; - $aParams = array($iFeedId); - $sFeedTitle = DBUtil::getOneResultKey(array($sQuery, $aParams), 'title'); - - if (PEAR::isError($sFeedTitle)) { - // XXX: log error - return false; - } - if ($sFeedTitle) { - return $sFeedTitle; - } - } - - // Get url for external feed - function getExternalFeedUrl($iFeedId){ - $sQuery = "SELECT url FROM plugin_rss WHERE id = ?"; - $aParams = array($iFeedId); - $sFeedUrl = DBUtil::getOneResultKey(array($sQuery, $aParams), 'url'); - - if (PEAR::isError($sFeedUrl)) { - // XXX: log error - return false; - } - if ($sFeedUrl) { - return $sFeedUrl; - } - } - - // Update external feed data - function updateFeed($iFeedId, $sFeedTitle, $sFeedUrl){ - $sQuery = "UPDATE plugin_rss SET title=?, url=? WHERE id=?"; - $aParams = array($sFeedTitle, $sFeedUrl, $iFeedId); - $res = DBUtil::runQuery(array($sQuery, $aParams)); - - return $res; - } - - // Create new external feed - function createFeed($sFeedTitle, $sFeedUrl, $iUserId){ - $aParams = array( - 'user_id' => $iUserId, - 'url' => $sFeedUrl, - 'title' => $sFeedTitle, - ); - $res = DBUtil::autoInsert('plugin_rss', $aParams); - - return $res; - } - - // Function to validate that a user has permissions for a specific document - function validateDocumentPermissions($iUserId, $iDocumentId){ - // check if user id is in session. If not, set it - if(!isset($_SESSION["userID"])){ - $_SESSION['userID'] = $iUserId; - } - // get document object - $oDocument =& Document::get($iDocumentId); - if (PEAR::isError($oDocument)) { - return false; - } - - // check permissions for document - if(Permission::userHasDocumentReadPermission($oDocument)){ - return true; - }else{ - return false; - } - } - - // Function to validate that a user has permissions for a specific folder - function validateFolderPermissions($iUserId, $iFolderId){ - // check if user id is in session. If not, set it - if(!isset($_SESSION["userID"])){ - $_SESSION['userID'] = $iUserId; - } - // get folder object - $oFolder = Folder::get($iFolderId); - if (PEAR::isError($oFolder)) { - return false; - } - - // check permissions for folder - if(Permission::userHasFolderReadPermission($oFolder)){ - return true; - }else{ - return false; - } - } - - // get icon link for rss - function getRssLinkIcon(){ - // built server path - $sHostPath = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/"; - - // create image - $icon = "RSS"; - - return $icon; - } - - // get rss link for a document/folder - function getRssLink($iItemId, $sItemType){ - $item = strToLower($sItemType); - if($item == 'folder'){ - $sItemParameter = '?folderId'; - }else if($item == 'document'){ - $sItemParameter = '?docId'; - } - - // built server path - $sHostPath = "http://".$_SERVER['HTTP_HOST']; - - // build link - $sLink = $sHostPath.KTBrowseUtil::buildBaseUrl('rss').$sItemParameter.'='.$iItemId; - - return $sLink; - } - - // get rss icon link - function getImageLink($iItemId, $sItemType){ - return "".KTrss::getRssLinkIcon().""; - } - - // get the mime type id for a document - function getDocumentMimeTypeId($iUserId, $iDocumentId){ - if(!isset($_SESSION["userID"])){ - $_SESSION['userID'] = $iUserId; - } - // get document object - $oDocument =& Document::get($iDocumentId); - - $docMime = $oDocument->getMimeTypeID(); - return $docMime; - } - - // get mime information for a document - function getMimeTypeInfo($iUserId, $iDocumentId){ - $mimeinfo['typeId'] = KTrss::getDocumentMimeTypeId($iUserId, $iDocumentId); // mime type id - $mimeinfo['typeName'] = KTMime::getMimeTypeName($mimeinfo['typeId']); // mime type name - $mimeinfo['typeFName'] = KTMime::getFriendlyNameForString($mimeinfo['typeName']); // mime type friendly name - $mimeinfo['typeIcon'] = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/resources/mimetypes/".KTMime::getIconPath($mimeinfo['typeId']).".png"; //icon path - - return $mimeinfo; - } - - // get the default folder icon - function getFolderIcon(){ - return $mimeinfo['typeIcon'] = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.png"; //icon path - } - - // get a document information - function getDocumentData($iUserId, $iDocumentId){ - if(!isset($_SESSION["userID"])){ - $_SESSION['userID'] = $iUserId; - } - // get document object - $oDocument =& Document::get($iDocumentId); - - $cv = $oDocument->getContentVersionId(); - $mv = $oDocument->getMetadataVersionId(); - - $sQuery = "SELECT dcv.document_id AS id, dmver.name AS name, dcv.filename AS filename, c.name AS author, o.name AS owner, dtl.name AS type, dwfs.name AS workflow_status " . - "FROM documents AS d LEFT JOIN document_content_version AS dcv ON d.id = dcv.document_id " . - "LEFT JOIN users AS o ON d.owner_id = o.id " . - "LEFT JOIN users AS c ON d.creator_id = c.id " . - "LEFT JOIN document_metadata_version AS dmv ON d.id = dmv.document_id " . - "LEFT JOIN document_types_lookup AS dtl ON dmv.document_type_id = dtl.id " . - "LEFT JOIN document_metadata_version AS dmver ON d.id = dmver.document_id " . - "LEFT JOIN workflow_states AS dwfs ON dmver.workflow_state_id = dwfs.id " . - "WHERE d.id = ? " . - "AND dmver.id = ? " . - "AND dcv.id = ? " . - "LIMIT 1"; - - $aParams = array($iDocumentId, $mv, $cv); - $aDocumentData = DBUtil::getResultArray(array($sQuery, $aParams)); - if($aDocumentData){ - return $aDocumentData; - } - } - - // get a folder information - function getFolderData($iFolderId){ - $sQuery = "SELECT f.id AS id, f.name AS name, f.name AS filename, c.name AS author, o.name AS owner, f.description AS description " . - "FROM folders AS f " . - "LEFT JOIN users AS o ON f.owner_id = o.id " . - "LEFT JOIN users AS c ON f.creator_id = c.id " . - "WHERE f.id = ? " . - "LIMIT 1"; - - $aParams = array($iFolderId); - $aFolderData = DBUtil::getResultArray(array($sQuery, $aParams)); - if($aFolderData){ - return $aFolderData; - } - } - - // get a listing of the latest 3 transactions for a document - function getDocumentTransactions($iDocumentId){ - $sQuery = "SELECT DT.datetime AS datetime, 'Document' AS type, DMV.name, D.full_path AS fullpath, DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment " . - "FROM document_transactions AS DT INNER JOIN users AS U ON DT.user_id = U.id " . - "INNER JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = DT.transaction_namespace " . - "LEFT JOIN document_metadata_version AS DMV ON DT.document_id = DMV.document_id " . - "LEFT JOIN documents AS D ON DT.document_id = D.id " . - "WHERE DT.document_id = ? " . - "ORDER BY DT.datetime DESC " . - "LIMIT 4"; - - $aParams = array($iDocumentId); - $aDocumentTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); - if($aDocumentTransactions){ - return $aDocumentTransactions; - } - } - - // Get a listing of the latest 3 transactions for a folder - function getFolderTransactions($iFolderId){ - $sQuery = "SELECT FT.datetime AS datetime, 'Folder' AS type, F.name, F.full_path AS fullpath, DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment " . - "FROM folder_transactions AS FT LEFT JOIN users AS U ON FT.user_id = U.id " . - "LEFT JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = FT.transaction_namespace " . - "LEFT JOIN folders AS F ON FT.folder_id = F.id " . - "WHERE FT.folder_id = ? " . - "ORDER BY FT.datetime DESC " . - "LIMIT 4"; - - $aParams = array($iFolderId); - $aFolderTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); - if($iFolderId){ - return $aFolderTransactions; - } - } -} -?> + strtotime($b[datetime])) ? -1 : 1;'; + + $compare = create_function('$a,$b', $code); + + usort($aFTransactions, $compare); + for($i=0; $i<4; $i++){ + $aFTransactions_new[] = $aFTransactions[$i]; + } + $aFTransactions = $aFTransactions_new; + + if($aFData){ + $aFData['itemType'] = 'folder'; + + // create mime info + $aFData['mimeTypeFName'] = 'Folder'; + $aFData['mimeTypeIcon'] = KTrss::getFolderIcon(); + + $aFolder[] = $aFData; + $aFolder[] = $aFTransactions; + $aFolderBox[] = $aFolder; + } + if (PEAR::isError($aFData)) { + return false; + } + if ($aFolder){ + return $aFolder; + } + } + + // Takes in an array as a parameter and returns rss2.0 compatible xml + function arrayToXML($aItems){ + // Build path to host + $aPath = explode('/', trim($_SERVER['PHP_SELF'])); + $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/"; + $feed = "\n"; + $feed .= "\n". + "\n" . + "".APP_NAME." RSS\n" . + "(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved\n" . + "".$hostPath."\n" . + "KT-RSS\n" . + "\n". + "".APP_NAME." RSS\n". + "140\n". + "28". + "".$hostPath."knowledgeTree/\n". + "".$hostPath."resources/graphics/ktlogo_rss.png\n". + "\n"; + foreach($aItems as $aItems){ + if($aItems[0][itemType] == 'folder'){ + $sTypeSelect = 'folder.transactions&fFolderId'; + }elseif($aItems[0][itemType] == 'document'){ + $sTypeSelect = 'document.transactionhistory&fDocumentId'; + } + $feed .= "\n" . + "".$aItems[0][0][name]."\n" . + "".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0]['id']."\n" . + "\n" . + "<table border='0' width='90%'>\n". + "<tr>\n". + "<td width='5%' height='16px'>" . + "<a href='".$hostPath."action.php?kt_path_info=ktcore.actions.".$sTypeSelect."=".$aItems[0][0][id]."' ><img src='".$aItems[0][mimeTypeIcon]."' align='left' height='16px' width='16px' alt='' border='0' /></a>" . + "</td>\n". + "<td align='left'> ".$aItems[0][mimeTypeFName]."</td>\n". + "</tr>\n". + "<tr>\n". + "<td colspan='2'>\n". + ucfirst($aItems[0]['itemType'])." Information (ID: ".$aItems[0][0][id].")</>\n". + "<hr>\n". + "<table width='95%'>\n". + "<tr>\n". + "<td>Filename: ".$aItems[0][0][filename]."</td>\n". + "<td>\n". + "</tr>\n". + "<tr>\n". + "<td>Author: ".$aItems[0][0][author]."</td>\n". + "<td>\n". + "</tr>\n". + "<tr>\n". + "<td>Owner: ";if($aItems[0][0][owner]){$feed .= $aItems[0][0][owner];}else{$feed .= "None";} + $feed .= "</td>\n". + "<td></td>\n". + "</tr>\n". + "<tr>\n";if($aItems[0][0][type]){ + $feed .= "<td>Document type: ".$aItems[0][0][type]."</td>\n". + "<td></td>\n";} + $feed .= "</tr>\n". + "<tr>\n". + "<td>Workflow status: ";if($aItems[0][0][workflow_status]){$feed .= $aItems[0][0][workflow_status];}else{$feed .= "No Workflow";} + $feed .= "</td>\n". + "<td></td>\n". + "</tr>\n". + "</table><br>\n". + "Transaction Summary (Last 3)\n". + "<hr>\n". + "<table width='100%'>\n"; + foreach($aItems[1] as $item){ + $feed .= "<tr>\n". + "<td>".$item[type]." name:</td>\n". + "<td>".$item[name]."</td>\n". + "</tr>\n". + "<tr>\n". + "<td>Path:</td>\n". + "<td>".$item[fullpath]."</td>\n". + "</tr>\n". + "<tr>\n". + "<td>Transaction:</td>\n". + "<td>".$item[transaction_name]."</td>\n". + "</tr>\n". + "<tr>\n". + "<td>Comment:</td>\n". + "<td>".$item[comment]."</td>\n". + "</tr>\n". + "<tr>\n";if($item[version]){ + $feed .= "<td>Version:</td>\n". + "<td>".$item[version]."</td>\n";} + $feed .= "</tr>\n". + "<tr>\n". + "<td>Date:</td>\n". + "<td>".$item[datetime]."</td>\n". + "</tr>\n". + "<tr>\n". + "<td>User:</td>\n". + "<td>".$item[user_name]."</td>\n". + "</tr>\n". + "<tr>\n". + "<td colspan='2'><hr width='100' align='left'></td>\n". + "</tr>\n";} + $feed .= "</table>\n". + "</td>\n". + "</tr>\n". + "</table>". + "\n". + "\n"; + } + $feed .= "\n" . + "\n"; + + return $feed; + } + + // Takes in an array as a parameter and returns rss2.0 compatible xml + function errorToXML($sError){ + // Build path to host + $aPath = explode('/', trim($_SERVER['PHP_SELF'])); + $hostPath = "http://".$_SERVER['HTTP_HOST']."/".$aPath[1]."/"; + $feed = "\n"; + $feed .= "\n". + "\n" . + "".APP_NAME." RSS\n" . + "(c) 2007 The Jam Warehouse Software (Pty) Ltd. All Rights Reserved\n" . + "".$hostPath."\n" . + "KT-RSS\n" . + "\n". + "".APP_NAME." RSS\n". + "140\n". + "28". + "".$hostPath."knowledgeTree/\n". + "".$hostPath."resources/graphics/ktlogo_rss.png\n". + "\n"; + $feed .= "\n". + "Feed load error\n" . + "".$sError."\n". + "\n"; + $feed .= "\n" . + "\n"; + + return $feed; + } + + // Delete feed function + function deleteFeed($iFeedId){ + $res = DBUtil::autoDelete('plugin_rss', $iFeedId); + } + + // Get title for external feed + function getExternalFeedTitle($iFeedId){ + $sQuery = "SELECT title FROM plugin_rss WHERE id = ?"; + $aParams = array($iFeedId); + $sFeedTitle = DBUtil::getOneResultKey(array($sQuery, $aParams), 'title'); + + if (PEAR::isError($sFeedTitle)) { + // XXX: log error + return false; + } + if ($sFeedTitle) { + return $sFeedTitle; + } + } + + // Get url for external feed + function getExternalFeedUrl($iFeedId){ + $sQuery = "SELECT url FROM plugin_rss WHERE id = ?"; + $aParams = array($iFeedId); + $sFeedUrl = DBUtil::getOneResultKey(array($sQuery, $aParams), 'url'); + + if (PEAR::isError($sFeedUrl)) { + // XXX: log error + return false; + } + if ($sFeedUrl) { + return $sFeedUrl; + } + } + + // Update external feed data + function updateFeed($iFeedId, $sFeedTitle, $sFeedUrl){ + $sQuery = "UPDATE plugin_rss SET title=?, url=? WHERE id=?"; + $aParams = array($sFeedTitle, $sFeedUrl, $iFeedId); + $res = DBUtil::runQuery(array($sQuery, $aParams)); + + return $res; + } + + // Create new external feed + function createFeed($sFeedTitle, $sFeedUrl, $iUserId){ + $aParams = array( + 'user_id' => $iUserId, + 'url' => $sFeedUrl, + 'title' => $sFeedTitle, + ); + $res = DBUtil::autoInsert('plugin_rss', $aParams); + + return $res; + } + + // Function to validate that a user has permissions for a specific document + function validateDocumentPermissions($iUserId, $iDocumentId){ + // check if user id is in session. If not, set it + if(!isset($_SESSION["userID"])){ + $_SESSION['userID'] = $iUserId; + } + // get document object + $oDocument =& Document::get($iDocumentId); + if (PEAR::isError($oDocument)) { + return false; + } + + // check permissions for document + if(Permission::userHasDocumentReadPermission($oDocument)){ + return true; + }else{ + return false; + } + } + + // Function to validate that a user has permissions for a specific folder + function validateFolderPermissions($iUserId, $iFolderId){ + // check if user id is in session. If not, set it + if(!isset($_SESSION["userID"])){ + $_SESSION['userID'] = $iUserId; + } + // get folder object + $oFolder = Folder::get($iFolderId); + if (PEAR::isError($oFolder)) { + return false; + } + + // check permissions for folder + if(Permission::userHasFolderReadPermission($oFolder)){ + return true; + }else{ + return false; + } + } + + // get icon link for rss + function getRssLinkIcon(){ + // built server path + $sHostPath = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/"; + + // create image + $icon = "RSS"; + + return $icon; + } + + // get rss link for a document/folder + function getRssLink($iItemId, $sItemType){ + $item = strToLower($sItemType); + if($item == 'folder'){ + $sItemParameter = '?folderId'; + }else if($item == 'document'){ + $sItemParameter = '?docId'; + } + + // built server path + $sHostPath = "http://".$_SERVER['HTTP_HOST']; + + // build link + $sLink = $sHostPath.KTBrowseUtil::buildBaseUrl('rss').$sItemParameter.'='.$iItemId; + + return $sLink; + } + + // get rss icon link + function getImageLink($iItemId, $sItemType){ + return "".KTrss::getRssLinkIcon().""; + } + + // get the mime type id for a document + function getDocumentMimeTypeId($iUserId, $iDocumentId){ + if(!isset($_SESSION["userID"])){ + $_SESSION['userID'] = $iUserId; + } + // get document object + $oDocument =& Document::get($iDocumentId); + + $docMime = $oDocument->getMimeTypeID(); + return $docMime; + } + + // get mime information for a document + function getMimeTypeInfo($iUserId, $iDocumentId){ + $mimeinfo['typeId'] = KTrss::getDocumentMimeTypeId($iUserId, $iDocumentId); // mime type id + $mimeinfo['typeName'] = KTMime::getMimeTypeName($mimeinfo['typeId']); // mime type name + $mimeinfo['typeFName'] = KTMime::getFriendlyNameForString($mimeinfo['typeName']); // mime type friendly name + $mimeinfo['typeIcon'] = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/resources/mimetypes/".KTMime::getIconPath($mimeinfo['typeId']).".png"; //icon path + + return $mimeinfo; + } + + // get the default folder icon + function getFolderIcon(){ + return $mimeinfo['typeIcon'] = "http://".$_SERVER['HTTP_HOST']."/".$GLOBALS['KTRootUrl']."/thirdparty/icon-theme/16x16/mimetypes/x-directory-normal.png"; //icon path + } + + // get a document information + function getDocumentData($iUserId, $iDocumentId){ + if(!isset($_SESSION["userID"])){ + $_SESSION['userID'] = $iUserId; + } + // get document object + $oDocument =& Document::get($iDocumentId); + + $cv = $oDocument->getContentVersionId(); + $mv = $oDocument->getMetadataVersionId(); + + $sQuery = "SELECT dcv.document_id AS id, dmver.name AS name, dcv.filename AS filename, c.name AS author, o.name AS owner, dtl.name AS type, dwfs.name AS workflow_status " . + "FROM documents AS d LEFT JOIN document_content_version AS dcv ON d.id = dcv.document_id " . + "LEFT JOIN users AS o ON d.owner_id = o.id " . + "LEFT JOIN users AS c ON d.creator_id = c.id " . + "LEFT JOIN document_metadata_version AS dmv ON d.id = dmv.document_id " . + "LEFT JOIN document_types_lookup AS dtl ON dmv.document_type_id = dtl.id " . + "LEFT JOIN document_metadata_version AS dmver ON d.id = dmver.document_id " . + "LEFT JOIN workflow_states AS dwfs ON dmver.workflow_state_id = dwfs.id " . + "WHERE d.id = ? " . + "AND dmver.id = ? " . + "AND dcv.id = ? " . + "LIMIT 1"; + + $aParams = array($iDocumentId, $mv, $cv); + $aDocumentData = DBUtil::getResultArray(array($sQuery, $aParams)); + if($aDocumentData){ + return $aDocumentData; + } + } + + // get a folder information + function getFolderData($iFolderId){ + $sQuery = "SELECT f.id AS id, f.name AS name, f.name AS filename, c.name AS author, o.name AS owner, f.description AS description " . + "FROM folders AS f " . + "LEFT JOIN users AS o ON f.owner_id = o.id " . + "LEFT JOIN users AS c ON f.creator_id = c.id " . + "WHERE f.id = ? " . + "LIMIT 1"; + + $aParams = array($iFolderId); + $aFolderData = DBUtil::getResultArray(array($sQuery, $aParams)); + if($aFolderData){ + return $aFolderData; + } + } + + // get a listing of the latest 3 transactions for a document + function getDocumentTransactions($iDocumentId){ + $sQuery = "SELECT DT.datetime AS datetime, 'Document' AS type, DMV.name, D.full_path AS fullpath, DTT.name AS transaction_name, U.name AS user_name, DT.version AS version, DT.comment AS comment " . + "FROM document_transactions AS DT INNER JOIN users AS U ON DT.user_id = U.id " . + "INNER JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = DT.transaction_namespace " . + "LEFT JOIN document_metadata_version AS DMV ON DT.document_id = DMV.document_id " . + "LEFT JOIN documents AS D ON DT.document_id = D.id " . + "WHERE DT.document_id = ? " . + "ORDER BY DT.datetime DESC " . + "LIMIT 4"; + + $aParams = array($iDocumentId); + $aDocumentTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); + if($aDocumentTransactions){ + return $aDocumentTransactions; + } + } + + // Get a listing of the latest 3 transactions for a folder + function getFolderTransactions($iFolderId){ + $sQuery = "SELECT FT.datetime AS datetime, 'Folder' AS type, F.name, F.full_path AS fullpath, DTT.name AS transaction_name, U.name AS user_name, FT.comment AS comment " . + "FROM folder_transactions AS FT LEFT JOIN users AS U ON FT.user_id = U.id " . + "LEFT JOIN document_transaction_types_lookup AS DTT ON DTT.namespace = FT.transaction_namespace " . + "LEFT JOIN folders AS F ON FT.folder_id = F.id " . + "WHERE FT.folder_id = ? " . + "ORDER BY FT.datetime DESC " . + "LIMIT 4"; + + $aParams = array($iFolderId); + $aFolderTransactions = DBUtil::getResultArray(array($sQuery, $aParams)); + if($iFolderId){ + return $aFolderTransactions; + } + } +} +?> diff --git a/plugins/rssplugin/RSSDashlet.php b/plugins/rssplugin/RSSDashlet.php index bb9856b..a971d5e 100644 --- a/plugins/rssplugin/RSSDashlet.php +++ b/plugins/rssplugin/RSSDashlet.php @@ -1,74 +1,80 @@ -sTitle = _kt('RSS Feeds'); - } - - function is_active($oUser) { - $this->oUser = $oUser; - return true; - } - - function render() { - global $main; - $main->requireJSResource("plugins/rssplugin/js/update.js"); - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('RSSPlugin/dashlet'); - - $iUId = $this->oUser->getId(); - - // Get internal Feed - $aInternalRSS = KTrss::getInternalFeed($iUId); - - // Get count of all items in feed - $iCountItems = count($aInternalRSS[items]); - - // Get listing of external feeds - $aExternalFeedsList = KTrss::getExternalFeedsList($iUId); - - // Create action for external feed management to be linked to inside of dashlet - $action = array("name" => _kt("Manage External RSS Feeds"), "url" => $this->oPlugin->getPagePath('managerssfeeds')); - - // Prepare template data - $aTemplateData = array( - 'context' => $this, - 'internalrss' => $aInternalRSS, - 'itemcount' => $iCountItems, - 'feedlist' => $aExternalFeedsList, - 'user' => $iUId, - 'action' => $action, - ); - - return $oTemplate->render($aTemplateData); - } -} -?> +sTitle = _kt('RSS Feeds'); + } + + function is_active($oUser) { + $this->oUser = $oUser; + return true; + } + + function render() { + global $main; + $main->requireJSResource("plugins/rssplugin/js/update.js"); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('RSSPlugin/dashlet'); + + $iUId = $this->oUser->getId(); + + // Get internal Feed + $aInternalRSS = KTrss::getInternalFeed($iUId); + + // Get count of all items in feed + $iCountItems = count($aInternalRSS[items]); + + // Get listing of external feeds + $aExternalFeedsList = KTrss::getExternalFeedsList($iUId); + + // Create action for external feed management to be linked to inside of dashlet + $action = array("name" => _kt("Manage External RSS Feeds"), "url" => $this->oPlugin->getPagePath('managerssfeeds')); + + // Prepare template data + $aTemplateData = array( + 'context' => $this, + 'internalrss' => $aInternalRSS, + 'itemcount' => $iCountItems, + 'feedlist' => $aExternalFeedsList, + 'user' => $iUId, + 'action' => $action, + ); + + return $oTemplate->render($aTemplateData); + } +} +?> diff --git a/plugins/rssplugin/RSSDocumentLinkAction.php b/plugins/rssplugin/RSSDocumentLinkAction.php index 1f0ea41..4f7f9af 100644 --- a/plugins/rssplugin/RSSDocumentLinkAction.php +++ b/plugins/rssplugin/RSSDocumentLinkAction.php @@ -1,73 +1,79 @@ -oDocument; - - // get document id - if(!isset($oDocument)){ - return null; - } - $iFId = $oDocument->getID(); - - // return link...there MIGHT be a nicer way of doing this? - return "RSS ".KTrss::getImageLink($iFId, 'document'); - } - - function do_main() { - //get document object - $oDocument = $this->oDocument; - - // get document id - $iDId = $oDocument->getID(); - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssdocumentaction'); - - $aTemplateData = array( - 'context' => $this, - 'link' => KTrss::getRssLink($iDId, 'document'), - 'linkIcon' => KTrss::getImageLink($iDId, 'document'), - ); - - return $oTemplate->render($aTemplateData); - } -} +oDocument; + + // get document id + if(!isset($oDocument)){ + return null; + } + $iFId = $oDocument->getID(); + + // return link...there MIGHT be a nicer way of doing this? + return "RSS ".KTrss::getImageLink($iFId, 'document'); + } + + function do_main() { + //get document object + $oDocument = $this->oDocument; + + // get document id + $iDId = $oDocument->getID(); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssdocumentaction'); + + $aTemplateData = array( + 'context' => $this, + 'link' => KTrss::getRssLink($iDId, 'document'), + 'linkIcon' => KTrss::getImageLink($iDId, 'document'), + ); + + return $oTemplate->render($aTemplateData); + } +} ?> \ No newline at end of file diff --git a/plugins/rssplugin/RSSFolderLinkAction.php b/plugins/rssplugin/RSSFolderLinkAction.php index f61d54f..cf9d8c6 100644 --- a/plugins/rssplugin/RSSFolderLinkAction.php +++ b/plugins/rssplugin/RSSFolderLinkAction.php @@ -1,70 +1,76 @@ -oFolder; - - // get folder id - $iFId = $oFolder->getID(); - - // return link...there MIGHT be a nicer way of doing this? - return "RSS ".KTrss::getImageLink($iFId, 'folder'); - } - - function do_main() { - //get folder object - $oFolder = $this->oFolder; - - // get folder id - $iFId = $oFolder->getID(); - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssfolderaction'); - - $aTemplateData = array( - 'context' => $this, - 'link' => KTrss::getRssLink($iFId, 'folder'), - 'linkIcon' => KTrss::getImageLink($iFId, 'folder'), - ); - - return $oTemplate->render($aTemplateData); - } -} +oFolder; + + // get folder id + $iFId = $oFolder->getID(); + + // return link...there MIGHT be a nicer way of doing this? + return "RSS ".KTrss::getImageLink($iFId, 'folder'); + } + + function do_main() { + //get folder object + $oFolder = $this->oFolder; + + // get folder id + $iFId = $oFolder->getID(); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('RSSPlugin/rssfolderaction'); + + $aTemplateData = array( + 'context' => $this, + 'link' => KTrss::getRssLink($iFId, 'folder'), + 'linkIcon' => KTrss::getImageLink($iFId, 'folder'), + ); + + return $oTemplate->render($aTemplateData); + } +} ?> \ No newline at end of file diff --git a/plugins/rssplugin/RSSPlugin.php b/plugins/rssplugin/RSSPlugin.php index 9e4f48f..d503c9e 100644 --- a/plugins/rssplugin/RSSPlugin.php +++ b/plugins/rssplugin/RSSPlugin.php @@ -1,57 +1,63 @@ -sFriendlyName = _kt('RSS Plugin'); - return $res; - } - - function setup() { - // automatically register the plugin - - $this->registerAction('folderaction', 'RSSFolderLinkAction', 'ktcore.rss.plugin.folder.link', $sFilename = null); - $this->registerAction('documentaction', 'RSSDocumentLinkAction', 'ktcore.rss.plugin.document.link', $sFilename = null); - $this->registerDashlet('RSSDashlet', 'ktcore.rss.feed.dashlet', 'RSSDashlet.php'); - $this->registerPage('managerssfeeds', 'ManageRSSFeedsDispatcher'); - - require_once(KT_LIB_DIR . "/templating/templating.inc.php"); - $oTemplating =& KTTemplating::getSingleton(); - $oTemplating->addLocation('RSS Plugin', '/plugins/rssplugin/templates'); - } - } -$oPluginRegistry =& KTPluginRegistry::getSingleton(); -$oPluginRegistry->registerPlugin('RSSPlugin', 'ktcore.rss.plugin', __FILE__); -?> +sFriendlyName = _kt('RSS Plugin'); + return $res; + } + + function setup() { + // automatically register the plugin + + $this->registerAction('folderaction', 'RSSFolderLinkAction', 'ktcore.rss.plugin.folder.link', $sFilename = null); + $this->registerAction('documentaction', 'RSSDocumentLinkAction', 'ktcore.rss.plugin.document.link', $sFilename = null); + $this->registerDashlet('RSSDashlet', 'ktcore.rss.feed.dashlet', 'RSSDashlet.php'); + $this->registerPage('managerssfeeds', 'ManageRSSFeedsDispatcher'); + + require_once(KT_LIB_DIR . "/templating/templating.inc.php"); + $oTemplating =& KTTemplating::getSingleton(); + $oTemplating->addLocation('RSS Plugin', '/plugins/rssplugin/templates'); + } + } +$oPluginRegistry =& KTPluginRegistry::getSingleton(); +$oPluginRegistry->registerPlugin('RSSPlugin', 'ktcore.rss.plugin', __FILE__); +?> diff --git a/plugins/rssplugin/loadFeed.inc.php b/plugins/rssplugin/loadFeed.inc.php index 14ac307..392a7a5 100644 --- a/plugins/rssplugin/loadFeed.inc.php +++ b/plugins/rssplugin/loadFeed.inc.php @@ -1,55 +1,61 @@ -".$aRSSArray[channel][title]."" . - "
" . - ""; - for($i=0;$i".$aRSSArray[items][$i][title]." - - - - - "; - } - $reposonse .= "
".$aRSSArray[items][$i][description]."


"; - - echo $reposonse; -?> +".$aRSSArray[channel][title]."" . + "
" . + ""; + for($i=0;$i".$aRSSArray[items][$i][title]." + + + + + "; + } + $reposonse .= "
".$aRSSArray[items][$i][description]."


"; + + echo $reposonse; +?> diff --git a/plugins/rssplugin/manageRSSFeeds.php b/plugins/rssplugin/manageRSSFeeds.php index 77c5555..594c580 100644 --- a/plugins/rssplugin/manageRSSFeeds.php +++ b/plugins/rssplugin/manageRSSFeeds.php @@ -1,151 +1,157 @@ -aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Manage External RSS Feeds','rssplugin')); - $iUId = $this->oUser->getId(); - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('RSSPlugin/managerssfeeds'); - - $aFeedsList = array(); - $aFeedsList = KTrss::getExternalFeedsList($iUId); - - $aTemplateData = array( - 'context' => $this, - 'feedlist' => $aFeedsList, - ); - - return $oTemplate->render($aTemplateData); - } - - // Delete feed function - function do_deleteFeed(){ - $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); - - $res = KTrss::deleteFeed($iFeedId); - - if (PEAR::isError($res)) { - $this->errorRedirectToMain(sprintf(_kt('Unable to delete item: %s','rssplugin'), $res->getMessage())); - } - else{ - $this->successRedirectToMain(sprintf(_kt('RSS feed deleted','rssplugin'))); - } - } - - // Edit feed function - function do_editFeed(){ - $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); - - $add_fields = array(); - $add_fields[] = new KTStringWidget(_kt('Title','rssplugin'),_kt('The title of the RSS feed','rssplugin'), 'title', KTrss::getExternalFeedTitle($iFeedId), $this->oPage, true, null, null); - $add_fields[] = new KTStringWidget(_kt('URL','rssplugin'),_kt('The url of the RSS feed','rssplugin'), 'url', KTrss::getExternalFeedUrl($iFeedId), $this->oPage, false, null, null); - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate("RSSPlugin/editfeed"); - $aTemplateData = array( - "context" => &$this, - "add_fields" => $add_fields, - "feed_id" => $iFeedId, - ); - return $oTemplate->render($aTemplateData); - - } - - // Update feed function on post - function do_updateFeed(){ - $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); - - $aErrorOptions = array( - 'redirect_to' => array('editFeed', sprintf('feed_id=%s', $iFeedId)) - ); - - $sTitle = $this->oValidator->validateString( - KTUtil::arrayGet($_REQUEST, 'title'), - KTUtil::meldOptions($aErrorOptions, array('message' => _kt("You must provide a title",'rssplugin'))) - ); - - $sUrl =KTUtil::arrayGet($_REQUEST, 'url'); - - $res = KTrss::updateFeed($iFeedId, $sTitle, $sUrl); - - if (PEAR::isError($res)) { - $this->errorRedirectToMain(sprintf(_kt('Unable to delete item: %s','rssplugin'), $res->getMessage())); - } - else{ - $this->successRedirectToMain(sprintf(_kt('Updated news item.','rssplugin'))); - } - } - - // Add feed function - function do_addFeed(){ - $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Manage RSS Feeds')); - $this->oPage->setBreadcrumbDetails(_kt("Create a new RSS feed",'rssplugin')); - $this->oPage->setTitle(_kt("Create a link to a new RSS feed",'rssplugin')); - - $add_fields = array(); - $add_fields[] = new KTStringWidget(_kt('Title','rssplugin'),_kt('The title of rss feed','rssplugin'), 'title', null, $this->oPage, true, null, null); - - $add_fields[] = new KTStringWidget(_kt('URL','rssplugin'),_kt('The url to the rss feed','rssplugin'), 'url', null, $this->oPage, false, null, null); - - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate("RSSPlugin/addfeed"); - $aTemplateData = array( - "context" => &$this, - "add_fields" => $add_fields, - ); - return $oTemplate->render($aTemplateData); - - } - - // Create feed on post - function do_createFeed() { - $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); - // use the validator object - $aErrorOptions = array('redirect_to' => array('addFeed'), 'message' => _kt('You must specify a title for the rss feed.','newsdashletplugin')); - $sTitle = $this->oValidator->validateString(KTUtil::arrayGet($_REQUEST, 'title'), $aErrorOptions); - - $sUrl = KTUtil::arrayGet($_REQUEST, 'url'); - $res = KTrss::createFeed($sTitle, $sUrl, $this->oUser->getId()); - - if (PEAR::isError($res)) { - $this->errorRedirectToMain(sprintf(_kt('Unable to create feed: %s','rssplugin'), $res->getMessage())); - } - else{ - $this->successRedirectToMain(sprintf(_kt('Created new rss feed: %s','rssplugin'), KTrss::getExternalFeedTitle($res))); - } - } -} - -?> +aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Manage External RSS Feeds','rssplugin')); + $iUId = $this->oUser->getId(); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('RSSPlugin/managerssfeeds'); + + $aFeedsList = array(); + $aFeedsList = KTrss::getExternalFeedsList($iUId); + + $aTemplateData = array( + 'context' => $this, + 'feedlist' => $aFeedsList, + ); + + return $oTemplate->render($aTemplateData); + } + + // Delete feed function + function do_deleteFeed(){ + $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); + + $res = KTrss::deleteFeed($iFeedId); + + if (PEAR::isError($res)) { + $this->errorRedirectToMain(sprintf(_kt('Unable to delete item: %s','rssplugin'), $res->getMessage())); + } + else{ + $this->successRedirectToMain(sprintf(_kt('RSS feed deleted','rssplugin'))); + } + } + + // Edit feed function + function do_editFeed(){ + $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); + + $add_fields = array(); + $add_fields[] = new KTStringWidget(_kt('Title','rssplugin'),_kt('The title of the RSS feed','rssplugin'), 'title', KTrss::getExternalFeedTitle($iFeedId), $this->oPage, true, null, null); + $add_fields[] = new KTStringWidget(_kt('URL','rssplugin'),_kt('The url of the RSS feed','rssplugin'), 'url', KTrss::getExternalFeedUrl($iFeedId), $this->oPage, false, null, null); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate("RSSPlugin/editfeed"); + $aTemplateData = array( + "context" => &$this, + "add_fields" => $add_fields, + "feed_id" => $iFeedId, + ); + return $oTemplate->render($aTemplateData); + + } + + // Update feed function on post + function do_updateFeed(){ + $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); + + $aErrorOptions = array( + 'redirect_to' => array('editFeed', sprintf('feed_id=%s', $iFeedId)) + ); + + $sTitle = $this->oValidator->validateString( + KTUtil::arrayGet($_REQUEST, 'title'), + KTUtil::meldOptions($aErrorOptions, array('message' => _kt("You must provide a title",'rssplugin'))) + ); + + $sUrl =KTUtil::arrayGet($_REQUEST, 'url'); + + $res = KTrss::updateFeed($iFeedId, $sTitle, $sUrl); + + if (PEAR::isError($res)) { + $this->errorRedirectToMain(sprintf(_kt('Unable to delete item: %s','rssplugin'), $res->getMessage())); + } + else{ + $this->successRedirectToMain(sprintf(_kt('Updated news item.','rssplugin'))); + } + } + + // Add feed function + function do_addFeed(){ + $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name' => _kt('Manage RSS Feeds')); + $this->oPage->setBreadcrumbDetails(_kt("Create a new RSS feed",'rssplugin')); + $this->oPage->setTitle(_kt("Create a link to a new RSS feed",'rssplugin')); + + $add_fields = array(); + $add_fields[] = new KTStringWidget(_kt('Title','rssplugin'),_kt('The title of rss feed','rssplugin'), 'title', null, $this->oPage, true, null, null); + + $add_fields[] = new KTStringWidget(_kt('URL','rssplugin'),_kt('The url to the rss feed','rssplugin'), 'url', null, $this->oPage, false, null, null); + + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate("RSSPlugin/addfeed"); + $aTemplateData = array( + "context" => &$this, + "add_fields" => $add_fields, + ); + return $oTemplate->render($aTemplateData); + + } + + // Create feed on post + function do_createFeed() { + $iFeedId = KTUtil::arrayGet($_REQUEST, 'feed_id'); + // use the validator object + $aErrorOptions = array('redirect_to' => array('addFeed'), 'message' => _kt('You must specify a title for the rss feed.','newsdashletplugin')); + $sTitle = $this->oValidator->validateString(KTUtil::arrayGet($_REQUEST, 'title'), $aErrorOptions); + + $sUrl = KTUtil::arrayGet($_REQUEST, 'url'); + $res = KTrss::createFeed($sTitle, $sUrl, $this->oUser->getId()); + + if (PEAR::isError($res)) { + $this->errorRedirectToMain(sprintf(_kt('Unable to create feed: %s','rssplugin'), $res->getMessage())); + } + else{ + $this->successRedirectToMain(sprintf(_kt('Created new rss feed: %s','rssplugin'), KTrss::getExternalFeedTitle($res))); + } + } +} + +?> diff --git a/plugins/rssplugin/rss2array.inc.php b/plugins/rssplugin/rss2array.inc.php index b3cdcb3..4ff4437 100644 --- a/plugins/rssplugin/rss2array.inc.php +++ b/plugins/rssplugin/rss2array.inc.php @@ -1,395 +1,401 @@ - trim($rss2array_globals[current_title]), link => trim($rss2array_globals[current_link]), description => trim($rss2array_globals[current_description])); - - # - # reset these vars for next loop - # - - $rss2array_globals[current_title] = ""; - $rss2array_globals[current_description] = ""; - $rss2array_globals[current_link] = ""; - - $rss2array_globals[inside_item] = false; - - } - - elseif($name == "RSS"){ - - $rss2array_globals[inside_rss] = false; - - } - - elseif($name == "RDF:RDF"){ - - $rss2array_globals[inside_rdf] = false; - - } - - elseif($name == "CHANNEL"){ - - $rss2array_globals[channel][title] = trim($rss2array_globals[channel_title]); - - $rss2array_globals[inside_channel] = false; - - } - - elseif($name == "IMAGE"){ - - $rss2array_globals[inside_image] = false; - - } - - } - + trim($rss2array_globals[current_title]), link => trim($rss2array_globals[current_link]), description => trim($rss2array_globals[current_description])); + + # + # reset these vars for next loop + # + + $rss2array_globals[current_title] = ""; + $rss2array_globals[current_description] = ""; + $rss2array_globals[current_link] = ""; + + $rss2array_globals[inside_item] = false; + + } + + elseif($name == "RSS"){ + + $rss2array_globals[inside_rss] = false; + + } + + elseif($name == "RDF:RDF"){ + + $rss2array_globals[inside_rdf] = false; + + } + + elseif($name == "CHANNEL"){ + + $rss2array_globals[channel][title] = trim($rss2array_globals[channel_title]); + + $rss2array_globals[inside_channel] = false; + + } + + elseif($name == "IMAGE"){ + + $rss2array_globals[inside_image] = false; + + } + + } + ?> \ No newline at end of file diff --git a/plugins/tagcloud/TagCloudDashlet.php b/plugins/tagcloud/TagCloudDashlet.php index b4f84f5..a1fc4b4 100644 --- a/plugins/tagcloud/TagCloudDashlet.php +++ b/plugins/tagcloud/TagCloudDashlet.php @@ -1,145 +1,151 @@ -sTitle = _kt('Tag Cloud'); - } - - /** - * Check to see if user is active - * - * @param object $oUser - * @return boolean - */ - function is_active($oUser) { - $this->oUser = $oUser; - return true; - } - - /** - * Render function for template - * - * @return unknown - */ - function render() { - $oTemplating =& KTTemplating::getSingleton(); - $oTemplate = $oTemplating->loadTemplate('TagCloud/dashlet'); - - $aTags = & $this->get_relevant_tags(); - $aTags = & $this->get_tag_weightings($aTags); - - $oRegistry =& KTPluginRegistry::getSingleton(); - $oPlugin =& $oRegistry->getPlugin('ktcore.tagcloud.plugin'); - $url = $oPlugin->getPagePath('TagCloudRedirection'); - - $aTemplateData = array( - 'tags' => $aTags, - 'url'=>$url - ); - return $oTemplate->render($aTemplateData); - } - - /** - * Builds the weightings for tags based on their frequency - * - * @param array $aTags - * @return array - */ - function & get_tag_weightings(&$aTags) - { - $aTags = $this->get_relevant_tags(); - - if (count($aTags) == 0) $min_freq=$max_freq=0; - else - { - $min_freq = min(array_values($aTags)); - $max_freq = max(array_values($aTags)); - } - $min_size = 12; - $max_size = 30; - - $distrib = $max_freq - $min_freq; - if ($distrib == 0) $distrib=1; - - $step = ($max_size - $min_size)/($distrib); - - foreach($aTags as $tag=>$freq) - { - $size = ceil($min_size + (($freq - $min_freq) * $step)); - $aTags[$tag] = $size; - } - - return $aTags; - } - - /** - * Returns the relevant tags for the current user - * - * @return array - */ - function & get_relevant_tags() - { - - list($where, $params, $joins) = KTSearchUtil::permissionToSQL($this->oUser, null); - - - $sql = " - SELECT - TW.tag, count(*) as freq - FROM - document_tags DT INNER JOIN tag_words TW ON DT.tag_id=TW.id - WHERE DT.document_id in (SELECT D.id FROM documents D $joins WHERE $where) GROUP BY TW.tag"; - - - $tags = DBUtil::getResultArray( - array($sql,$params) - - ); - $aTags = array(); - foreach($tags as $tag) - { - $word=$tag['tag']; - $freq=$tag['freq']; - $aTags[$word] = $freq; - } - return $aTags; - - } - -} -?> +sTitle = _kt('Tag Cloud'); + } + + /** + * Check to see if user is active + * + * @param object $oUser + * @return boolean + */ + function is_active($oUser) { + $this->oUser = $oUser; + return true; + } + + /** + * Render function for template + * + * @return unknown + */ + function render() { + $oTemplating =& KTTemplating::getSingleton(); + $oTemplate = $oTemplating->loadTemplate('TagCloud/dashlet'); + + $aTags = & $this->get_relevant_tags(); + $aTags = & $this->get_tag_weightings($aTags); + + $oRegistry =& KTPluginRegistry::getSingleton(); + $oPlugin =& $oRegistry->getPlugin('ktcore.tagcloud.plugin'); + $url = $oPlugin->getPagePath('TagCloudRedirection'); + + $aTemplateData = array( + 'tags' => $aTags, + 'url'=>$url + ); + return $oTemplate->render($aTemplateData); + } + + /** + * Builds the weightings for tags based on their frequency + * + * @param array $aTags + * @return array + */ + function & get_tag_weightings(&$aTags) + { + $aTags = $this->get_relevant_tags(); + + if (count($aTags) == 0) $min_freq=$max_freq=0; + else + { + $min_freq = min(array_values($aTags)); + $max_freq = max(array_values($aTags)); + } + $min_size = 12; + $max_size = 30; + + $distrib = $max_freq - $min_freq; + if ($distrib == 0) $distrib=1; + + $step = ($max_size - $min_size)/($distrib); + + foreach($aTags as $tag=>$freq) + { + $size = ceil($min_size + (($freq - $min_freq) * $step)); + $aTags[$tag] = $size; + } + + return $aTags; + } + + /** + * Returns the relevant tags for the current user + * + * @return array + */ + function & get_relevant_tags() + { + + list($where, $params, $joins) = KTSearchUtil::permissionToSQL($this->oUser, null); + + + $sql = " + SELECT + TW.tag, count(*) as freq + FROM + document_tags DT INNER JOIN tag_words TW ON DT.tag_id=TW.id + WHERE DT.document_id in (SELECT D.id FROM documents D $joins WHERE $where) GROUP BY TW.tag"; + + + $tags = DBUtil::getResultArray( + array($sql,$params) + + ); + $aTags = array(); + foreach($tags as $tag) + { + $word=$tag['tag']; + $freq=$tag['freq']; + $aTags[$word] = $freq; + } + return $aTags; + + } + +} +?> diff --git a/plugins/tagcloud/TagCloudPlugin.php b/plugins/tagcloud/TagCloudPlugin.php index 0ee1e75..a596a6c 100644 --- a/plugins/tagcloud/TagCloudPlugin.php +++ b/plugins/tagcloud/TagCloudPlugin.php @@ -2,15 +2,20 @@ /* * The contents of this file are subject to the KnowledgeTree Public - * License Version 1.1 ("License"); You may not use this file except in + * 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 * * 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. + * 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. * * The Original Code is: KnowledgeTree Open Source * @@ -19,6 +24,7 @@ * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright * (C) 2007 The Jam Warehouse Software (Pty) Ltd; * All Rights Reserved. + * Contributor( s): ______________________________________ * */ diff --git a/plugins/tagcloud/TagCloudRedirectPage.php b/plugins/tagcloud/TagCloudRedirectPage.php index 417db69..933991d 100644 --- a/plugins/tagcloud/TagCloudRedirectPage.php +++ b/plugins/tagcloud/TagCloudRedirectPage.php @@ -1,15 +1,20 @@