'. "\n";
+
+
+ $aInfo['js'] = $js;
+
+ return $aInfo;
+ }
+
+ function getScript()
+ {
+ if ($this->function_provided_by_action === false)
+ {
+ return '';
+ }
+ return "function " . $this->getScriptActivation() . '{'.$this->getFunctionScript().'}';
+ }
+
+ function getFunctionScript()
+ {
+ return 'alert(\''. $this->getDisplayName() .' not implemented!\');';
+ }
+
+ function getScriptActivation()
+ {
+ if (!is_null($this->function_name))
+ {
+ return $this->function_name;
+ }
+
+ global $AjaxDocumentActions;
+ $class = get_class($this);
+ return 'js' . $class. 'Dispatcher()';
+ }
+
+
+
+}
+
class KTDocumentActionUtil {
function getDocumentActionInfo($slot = 'documentaction') {
$oRegistry =& KTActionRegistry::getSingleton();
diff --git a/lib/actions/folderaction.inc.php b/lib/actions/folderaction.inc.php
index 11879af..d3090ba 100644
--- a/lib/actions/folderaction.inc.php
+++ b/lib/actions/folderaction.inc.php
@@ -5,32 +5,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2008 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*
*/
@@ -177,6 +177,122 @@ class KTFolderAction extends KTStandardDispatcher {
}
+class JavascriptFolderAction extends KTFolderAction
+{
+ /**
+ * This is an array of js files to be included for this action
+ *
+ * @var array
+ */
+ var $js_paths = array();
+ /**
+ * This is custom javascript that should be included
+ *
+ * @var array
+ */
+ var $js = array();
+ /**
+ * Indicates if a custom function should be provided, or if the function is part of an existing js file.
+ * If true
+ *
+ * @var boolean
+ */
+ var $function_provided_by_action = true;
+
+ /**
+ * Set the function name if you have a custom name you want to provide.
+ *
+ * @var string
+ */
+ var $function_name = null;
+
+ function JavascriptFolderAction($oFolder = null, $oUser = null, $oPlugin = null)
+ {
+ parent::KTFolderAction($oFolder, $oUser, $oPlugin);
+ $this->js_initialise();
+ }
+
+ function js_initialise()
+ {
+ // this will be overridden
+ }
+
+ function js_include($js)
+ {
+ $this->js[] = $js;
+ }
+
+ function js_include_file($path)
+ {
+ global $AjaxDocumentJSPaths;
+
+ if (!isset($AjaxDocumentJSPaths))
+ {
+ $AjaxDocumentJSPaths = array();
+ }
+
+ if (!in_array($AjaxDocumentJSPaths))
+ {
+ $AjaxDocumentJSPaths[] = $path;
+ $this->js_paths [] = $path;
+ }
+ }
+
+ function customiseInfo($aInfo)
+ {
+ $js = '';
+ foreach($this->js_paths as $path)
+ {
+ $js .= "\n";
+ }
+
+ $js .= ''. "\n";
+
+ $js .= '
'. "\n";
+
+
+ $aInfo['js'] = $js;
+
+ return $aInfo;
+ }
+
+ function getScript()
+ {
+ if ($this->function_provided_by_action === false)
+ {
+ return '';
+ }
+ return "function " . $this->getScriptActivation() . '{'.$this->getFunctionScript().'}';
+ }
+
+ function getFunctionScript()
+ {
+ return 'alert(\''. $this->getDisplayName() .' not implemented!\');';
+ }
+
+ function getScriptActivation()
+ {
+ if (!is_null($this->function_name))
+ {
+ return $this->function_name;
+ }
+
+ global $AjaxDocumentActions;
+ $class = get_class($this);
+ return 'js' . $class. 'Dispatcher()';
+ }
+
+
+
+}
+
+
class KTFolderActionUtil {
function getFolderActions() {
$oRegistry =& KTActionRegistry::getSingleton();
diff --git a/lib/security/Permission.inc b/lib/security/Permission.inc
index e12fc28..0a9454a 100644
--- a/lib/security/Permission.inc
+++ b/lib/security/Permission.inc
@@ -118,7 +118,14 @@ class Permission {
if ($iUserID == '') {
$iUserID = $_SESSION['userID'];
}
+ if (empty($iUserID)) {
+ return false;
+ }
$iUserID = KTUtil::getId($iUserID);
+ if (PEAR::isError($iUserID))
+ {
+ return false;
+ }
$query = 'SELECT UGL.group_id
FROM '.$default->users_groups_table.' AS UGL
diff --git a/lib/util/ktutil.inc b/lib/util/ktutil.inc
index 2dc71e1..d9c6f58 100644
--- a/lib/util/ktutil.inc
+++ b/lib/util/ktutil.inc
@@ -53,8 +53,22 @@ class KTUtil {
{
global $default;
- return ($default->sslEnabled ? 'https' : 'http') .'://'.$_SERVER['HTTP_HOST'] . $default->rootUrl;
+ $config = KTConfig::getSingleton();
+ $serverName = $config->get('knowledgeTree/serverName', $_SERVER['HTTP_HOST']);
+ return ($default->sslEnabled ? 'https' : 'http') .'://'.$serverName . $default->rootUrl;
+
+ }
+
+ static function call_page($path)
+ {
+ $kt_url = KTUtil::kt_url();
+
+ $full_url = $kt_url . '/' . $path;
+
+ $ch = curl_init($full_url);
+ curl_exec($ch);
+ curl_close($ch);
}
static function computePeriod($diff, $suffix = null, $returnArray=false)
diff --git a/search2/bin/cronIndexer.php b/search2/bin/cronIndexer.php
new file mode 100644
index 0000000..485bbf8
--- /dev/null
+++ b/search2/bin/cronIndexer.php
@@ -0,0 +1,45 @@
+.
+ *
+ * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
+ * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "Powered by
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
+ * Contributor( s): ______________________________________
+ *
+ */
+
+chdir(dirname(__FILE__));
+require_once(realpath('../../config/dmsDefaults.php'));
+
+KTUtil::call_page('search2/indexing/bin/cronIndexer.php');
+
+
+?>
\ No newline at end of file
diff --git a/search2/bin/cronMigration.php b/search2/bin/cronMigration.php
new file mode 100644
index 0000000..ae03d10
--- /dev/null
+++ b/search2/bin/cronMigration.php
@@ -0,0 +1,44 @@
+.
+ *
+ * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
+ * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "Powered by
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
+ * Contributor( s): ______________________________________
+ *
+ */
+
+chdir(dirname(__FILE__));
+require_once(realpath('../../config/dmsDefaults.php'));
+
+KTUtil::call_page('search2/indexing/bin/cronMigration.php');
+
+?>
\ No newline at end of file
diff --git a/search2/bin/optimise.php b/search2/bin/optimise.php
new file mode 100644
index 0000000..6921f03
--- /dev/null
+++ b/search2/bin/optimise.php
@@ -0,0 +1,45 @@
+.
+ *
+ * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
+ * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
+ *
+ * The interactive user interfaces in modified source and object code versions
+ * of this program must display Appropriate Legal Notices, as required under
+ * Section 5 of the GNU General Public License version 3.
+ *
+ * In accordance with Section 7(b) of the GNU General Public License version 3,
+ * these Appropriate Legal Notices must retain the display of the "Powered by
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
+ * Contributor( s): ______________________________________
+ *
+ */
+
+chdir(dirname(__FILE__));
+require_once(realpath('../../config/dmsDefaults.php'));
+
+KTUtil::call_page('search2/indexing/bin/optimise.php');
+
+
+?>
\ No newline at end of file
diff --git a/search2/search/expr.inc.php b/search2/search/expr.inc.php
index a4ed3a7..0b47c8d 100644
--- a/search2/search/expr.inc.php
+++ b/search2/search/expr.inc.php
@@ -591,22 +591,25 @@ class ValueExpr extends Expr
public function getSQL($field, $fieldname, $op, $not=false)
{
$val = $this->getValue();
- switch($op)
- {
- case ExprOp::LIKE:
-
- break;
- case ExprOp::CONTAINS:
- $val = "%$val%";
- break;
- case ExprOp::STARTS_WITH:
- $val = "$val%";
- break;
- case ExprOp::ENDS_WITH:
- $val = "%$val";
- break;
- }
+ if (strpos($val, '*') !== false || strpos($val, '?') !== false)
+ {
+ $val = str_replace(array('?','*'), array('%','%'), $val);
+ }
+ switch($op)
+ {
+ case ExprOp::LIKE:
+ break;
+ case ExprOp::CONTAINS:
+ $val = "%$val%";
+ break;
+ case ExprOp::STARTS_WITH:
+ $val = "$val%";
+ break;
+ case ExprOp::ENDS_WITH:
+ $val = "%$val";
+ break;
+ }
$val = $field->modifyValue($val);
$quote = '';
diff --git a/search2/search/fieldRegistry.inc.php b/search2/search/fieldRegistry.inc.php
index 46a4117..e240372 100644
--- a/search2/search/fieldRegistry.inc.php
+++ b/search2/search/fieldRegistry.inc.php
@@ -158,10 +158,18 @@ class ExprFieldRegistry
public function resolveMetadataField($fieldset, $field)
{
+ if ($fieldset instanceof ValueExpr)
+ {
+ $fieldset = $fieldset->getValue();
+ }
if (!array_key_exists($fieldset,$this->metadata))
{
throw new ResolutionException("Metadata class for fieldset '$fieldset' and field '$field' not found.");
}
+ if ($field instanceof ValueExpr)
+ {
+ $field = $field->getValue();
+ }
if (!array_key_exists($field,$this->metadata[$fieldset]))
{
throw new ResolutionException("Metadata class for fieldset '$fieldset' and field '$field' not found.");
@@ -249,7 +257,7 @@ class ExprFieldRegistry
private function registerMetdataFields()
{
$sql = "SELECT
- fs.name as fieldset, f.name as field, fs.id as fsid, f.id as fid
+ fs.name as fieldset, f.name as field, fs.id as fsid, f.id as fid, f.data_type
FROM
fieldsets fs
INNER JOIN document_fields f ON f.parent_fieldset=fs.id
@@ -263,6 +271,7 @@ class ExprFieldRegistry
$field = addslashes($record['field']);
$fieldsetid = $record['fsid'];
$fieldid = $record['fid'];
+ $type = $record['data_type'];
$classname = "MetadataField$fieldid";
$classdefn = "
@@ -270,7 +279,9 @@ class ExprFieldRegistry
{
public function __construct()
{
- parent::__construct('$fieldset','$field',$fieldsetid, $fieldid);
+ parent::__construct('$fieldset','$field',$fieldsetid, $fieldid);" .
+
+ (($type=='INT')?'$this->isValueQuoted(false);':'') . "
}
}";
eval($classdefn);
diff --git a/search2/search/fields/FullPathField.inc.php b/search2/search/fields/FullPathField.inc.php
index 2b855e9..515b97b 100644
--- a/search2/search/fields/FullPathField.inc.php
+++ b/search2/search/fields/FullPathField.inc.php
@@ -43,7 +43,7 @@ class FullPathField extends DBFieldExpr
public function __construct()
{
parent::__construct('full_path', 'documents', _kt('Full Path'));
- $this->setAlias('Full Path');
+ $this->setAlias('FullPath');
}
public function getInputRequirements()
diff --git a/search2/search/fields/TitleField.inc.php b/search2/search/fields/TitleField.inc.php
index 2b2de0c..6b6a2ca 100644
--- a/search2/search/fields/TitleField.inc.php
+++ b/search2/search/fields/TitleField.inc.php
@@ -38,7 +38,6 @@
class TitleField extends DBFieldExpr
{
- public $general_op = ExprOp::CONTAINS;
public function __construct()
{
diff --git a/sql/mysql/install/data.sql b/sql/mysql/install/data.sql
index 961f50f..a94d388 100644
--- a/sql/mysql/install/data.sql
+++ b/sql/mysql/install/data.sql
@@ -804,9 +804,9 @@ UNLOCK TABLES;
LOCK TABLES `scheduler_tasks` WRITE;
/*!40000 ALTER TABLE `scheduler_tasks` DISABLE KEYS */;
INSERT INTO `scheduler_tasks` VALUES
-(1,'Indexing','search2/indexing/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'),
-(2,'Index Migration','search2/indexing/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),
-(3,'Index Optimisation','search2/indexing/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'),
+(1,'Indexing','search2/bin/cronIndexer.php','',0,'1min','2007-10-01',NULL,0,'system'),
+(2,'Index Migration','search2/bin/cronMigration.php','',0,'5mins','2007-10-01',NULL,0,'system'),
+(3,'Index Optimisation','search2/bin/optimise.php','',0,'weekly','2007-10-01',NULL,0,'system'),
(4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'),
(5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
(6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled');
diff --git a/sql/mysql/upgrade/3.5.2/scheduler_permissions.sql b/sql/mysql/upgrade/3.5.2/scheduler_permissions.sql
new file mode 100644
index 0000000..87eb271
--- /dev/null
+++ b/sql/mysql/upgrade/3.5.2/scheduler_permissions.sql
@@ -0,0 +1,3 @@
+UPDATE scheduler_tasks SET script_url='search2/bin/cronIndexer.php' WHERE task='Indexing';
+UPDATE scheduler_tasks SET script_url='search2/bin/cronMigration.php' WHERE task='Index Migration';
+UPDATE scheduler_tasks SET script_url='search2/bin/optimise.php' WHERE task='Index Optimisation';
\ No newline at end of file
diff --git a/templates/kt3/portlets/actions_portlet.smarty b/templates/kt3/portlets/actions_portlet.smarty
index 8739ab3..e271fc4 100644
--- a/templates/kt3/portlets/actions_portlet.smarty
+++ b/templates/kt3/portlets/actions_portlet.smarty
@@ -2,6 +2,9 @@
{foreach item=action from=$context->actions }
{if $action != null}