Commit 5c14fe8245e7fde1b47021c52562c490dce3cd00

Authored by kevin_fourie
1 parent 80285871

Merged in from DEV trunk...

Some whitespace updates.

KTS-3431
"Disk Usage stats should be a background task and cached"
Implemented.

KTS-3432
"Storage Usage status should be retrieved in a background task and cached"
Implemented.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/branches/3.5.3-Branch@8607 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/housekeeper/DiskUsageDashlet.inc.php
... ... @@ -38,165 +38,54 @@
38 38  
39 39 class DiskUsageDashlet extends KTBaseDashlet
40 40 {
41   - private $dfCmd;
42   - private $usage;
43   - private $warningPercent;
44   - private $urgentPercent;
  41 + private $usage;
45 42  
46   - function DiskUsageDashlet()
47   - {
48   - $this->sTitle = _kt('Storage Utilization');
49   - $this->sClass = "ktInfo";
50   - }
51   -
52   - function is_active($oUser)
53   - {
54   - $dfCmd = KTUtil::findCommand('externalBinary/df','df');
55   - if ($dfCmd === false)
56   - {
57   - return false;
58   - }
59   - $this->dfCmd = $dfCmd;
60   -
61   - $config = KTConfig::getSingleton();
62   - $this->warningPercent = $config->get('DiskUsage/warningThreshold', 15);
63   - $this->urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
64   -
65   - $got_usage = $this->getUsage();
66   -
67   - if ($got_usage == false)
68   - {
69   - return false;
70   - }
71   -
72   - return Permission::userIsSystemAdministrator();
73   - }
74   -
75   - function getUsage($refresh=false)
76   - {
77   - if (isset($_SESSION['DiskUsage']['problem']))
78   - {
79   - return false;
80   - }
81   -
82   - $check = true;
83   - // check if we have a cached result
84   - if (isset($_SESSION['DiskUsage']))
85   - {
86   - // we will only do the check every 5 minutes
87   - if (time() - $_SESSION['DiskUsage']['time'] < 5 * 60)
88   - {
89   - $check = false;
90   - $this->usage = $_SESSION['DiskUsage']['usage'];
91   - }
92   - }
93   -
94   - // we will only check if the result is not cached, or after 5 minutes
95   - if ($check)
96   - {
97   - $cmd = $this->dfCmd;
98   -
99   - if (OS_WINDOWS)
100   - {
101   - $cmd = str_replace( '/','\\',$cmd);
102   - $res = KTUtil::pexec("\"$cmd\" -B 1 2>&1");
103   - $result = implode("\r\n",$res['out']);
104   - }
105   - else
106   - {
107   - if(strtolower(PHP_OS) == 'darwin'){
108   - $result = shell_exec($cmd." -k 2>&1");
109   - }else{
110   - $result = shell_exec($cmd." -B 1 2>&1");
111   - }
112   - }
113   -
114   - if (strpos($result, 'cannot read table of mounted file systems') !== false)
115   - {
116   - $_SESSION['DiskUsage']['problem'] = true;
117   - return false;
118   - }
119   -
120   -
121   - $result = explode("\n", $result);
122   -
123   - unset($result[0]); // gets rid of headings
124   -
125   - $usage=array();
126   - foreach($result as $line)
127   - {
128   - if (empty($line)) continue;
129   - preg_match('/(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)/', $line, $matches);
130   - list($line, $filesystem, $size, $used, $avail, $usedp, $mount) = $matches;
131   -
132   - if ($size === 0) continue;
133   -
134   - if(strtolower(PHP_OS) == 'darwin'){
135   - $size = $size * 1024;
136   - $used = $used * 1024;
137   - $avail = $avail * 1024;
138   - }
139   -
140   - $colour = '';
141   - if ($usedp >= 100 - $this->urgentPercent)
142   - {
143   - $colour = 'red';
144   - }
145   - elseif ($usedp >= 100 - $this->warningPercent)
146   - {
147   - $colour = 'orange';
148   - }
149   -
150   - $usage[] = array(
151   - 'filesystem'=>$filesystem,
152   - 'size'=>KTUtil::filesizeToString($size),
153   - 'used'=>KTUtil::filesizeToString($used),
154   - 'available'=>KTUtil::filesizeToString($avail),
155   - 'usage'=>$usedp . '%',
156   - 'mounted'=>$mount,
157   - 'colour'=>$colour
158   - );
159   - }
160   -
161   - $this->usage = $usage;
162   -
163   - $_SESSION['DiskUsage']['time'] = time();
164   - $_SESSION['DiskUsage']['usage'] = $this->usage;
165   - }
  43 + function DiskUsageDashlet()
  44 + {
  45 + $this->sTitle = _kt('Storage Utilization');
  46 + $this->sClass = "ktInfo";
  47 + }
166 48  
167   - return true;
168   - }
  49 + function is_active($oUser)
  50 + {
  51 + $usage = unserialize(KTUtil::getSystemSetting('DiskUsage','n/a'));
  52 + if ($usage == 'n/a') return false;
  53 + $this->usage = $usage;
  54 + return Permission::userIsSystemAdministrator();
  55 + }
169 56  
170   - function render()
171   - {
172   - $oTemplating =& KTTemplating::getSingleton();
173   - $oTemplate = $oTemplating->loadTemplate('DiskUsage');
  57 + function render()
  58 + {
  59 + $oTemplating =& KTTemplating::getSingleton();
  60 + $oTemplate = $oTemplating->loadTemplate('DiskUsage');
174 61  
175   - $oRegistry =& KTPluginRegistry::getSingleton();
176   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
  62 + $oRegistry =& KTPluginRegistry::getSingleton();
  63 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
177 64  
178   - $config = KTConfig::getSingleton();
179   - $rootUrl = $config->get('KnowledgeTree/rootUrl');
  65 + $config = KTConfig::getSingleton();
  66 + $rootUrl = $config->get('KnowledgeTree/rootUrl');
180 67  
181   - $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
182   - if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
183   - $dispatcherURL = str_replace( '\\', '/', $dispatcherURL);
  68 + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
  69 + if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
  70 + $dispatcherURL = str_replace( '\\', '/', $dispatcherURL);
184 71 if ( substr( $dispatcherURL, 0,1 ) != '/')
185   - {
186   - $dispatcherURL = '/'.$dispatcherURL;
187   - }
  72 + {
  73 + $dispatcherURL = '/'.$dispatcherURL;
  74 + }
  75 +
  76 + $warningPercent = $config->get('DiskUsage/warningThreshold', 15);
  77 + $urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
188 78  
189   - $aTemplateData = array(
190   - 'context' => $this,
191   - 'usages'=>$this->usage,
192   - 'warnPercent'=>$this->warningPercent,
193   - 'urgentPercent'=>$this->urgentPercent,
194   - 'dispatcherURL'=>$dispatcherURL
195   - );
  79 + $aTemplateData = array(
  80 + 'context' => $this,
  81 + 'usages'=> $this->usage,
  82 + 'warnPercent'=>$warningPercent,
  83 + 'urgentPercent'=>$urgentPercent,
  84 + 'dispatcherURL'=>$dispatcherURL
  85 + );
196 86  
197 87 return $oTemplate->render($aTemplateData);
198 88 }
199 89 }
200 90  
201   -
202 91 ?>
... ...
plugins/housekeeper/FolderUsageDashlet.inc.php
... ... @@ -38,141 +38,48 @@
38 38  
39 39 class FolderUsageDashlet extends KTBaseDashlet
40 40 {
41   - private $usage;
  41 + private $usage;
42 42  
43   - function FolderUsageDashlet()
44   - {
45   - $this->sTitle = _kt('System Folder Utilization');
46   - $this->sClass = "ktInfo";
47   - }
  43 + function FolderUsageDashlet()
  44 + {
  45 + $this->sTitle = _kt('System Folder Utilization');
  46 + $this->sClass = "ktInfo";
  47 + }
48 48  
49   - function is_active($oUser)
50   - {
51   - return Permission::userIsSystemAdministrator();
52   - }
  49 + function is_active($oUser)
  50 + {
  51 + return Permission::userIsSystemAdministrator();
  52 + }
53 53  
54   - function scanPath($path,$pattern)
55   - {
56   - $files=0;
57   - $filesize=0;
  54 + function render()
  55 + {
  56 + $oTemplating =& KTTemplating::getSingleton();
  57 + $oTemplate = $oTemplating->loadTemplate('FolderUsage');
58 58  
59   - if (is_dir($path) && ($dh = opendir($path)))
60   - {
61   - while (($file = readdir($dh)) !== false)
62   - {
63   - if (substr($file,0,1) == '.')
64   - {
65   - continue;
66   - }
  59 + $oRegistry =& KTPluginRegistry::getSingleton();
  60 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
67 61  
68   - $full = $path . '/' . $file;
  62 + $config = KTConfig::getSingleton();
  63 + $rootUrl = $config->get('KnowledgeTree/rootUrl');
69 64  
70   - if (!is_readable($full) || !is_writable($full))
71   - {
72   - continue;
73   - }
74   -
75   - if (is_dir($full))
76   - {
77   - $result = $this->scanPath($full,$pattern);
78   - $files += $result['files'];
79   - $filesize += $result['filesize'];
80   - continue;
81   - }
82   - if ($pattern != '')
83   - {
84   - if (preg_match('/' . $pattern . '/', $file) === false)
85   - {
86   - continue;
87   - }
88   - }
89   -
90   - $files++;
91   - $filesize += filesize($full);
92   - }
93   - closedir($dh);
94   - }
95   - return array('files'=>$files,'filesize'=>$filesize,'dir'=>$path);
96   - }
97   -
98   - function getUsage()
99   - {
100   - $check = true;
101   - // check if we have a cached result
102   - if (isset($_SESSION['SystemFolderUsage']))
103   - {
104   - // we will only do the check every 5 minutes
105   - if (time() - $_SESSION['SystemFolderUsage']['time'] < 5 * 60)
106   - {
107   - $check = false;
108   - $this->usage = $_SESSION['SystemFolderUsage']['usage'];
109   - }
110   - }
111   -
112   - // we will only check if the result is not cached, or after 5 minutes
113   - if ($check)
114   - {
115   - $usage = array();
116   -
117   - $oRegistry =& KTPluginRegistry::getSingleton();
118   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
119   -
120   - $folders = $oPlugin->getDirectories();
121   -
122   - foreach($folders as $folder)
123   - {
124   - $directory = $folder['folder'];
125   - $pattern = $folder['pattern'];
126   - $canClean = $folder['canClean'];
127   - $name = $folder['name'];
128   -
129   - $temp = $this->scanPath($directory,$pattern);
130   -
131   - $usage[] = array(
132   - 'description'=>$name,
133   - 'folder'=>$directory,
134   - 'files'=>number_format($temp['files'],0,'.',','),
135   - 'filesize'=>KTUtil::filesizeToString($temp['filesize']),
136   - 'action'=>$i,
137   - 'canClean'=>$canClean
138   - );
139   - $this->usage = $usage;
140   - }
141   -
142   - $_SESSION['SystemFolderUsage']['time'] = time();
143   - $_SESSION['SystemFolderUsage']['usage'] = $this->usage;
144   - }
145   - }
146   -
147   - function render()
148   - {
149   - $oTemplating =& KTTemplating::getSingleton();
150   - $oTemplate = $oTemplating->loadTemplate('FolderUsage');
151   -
152   - $oRegistry =& KTPluginRegistry::getSingleton();
153   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
154   -
155   - $config = KTConfig::getSingleton();
156   - $rootUrl = $config->get('KnowledgeTree/rootUrl');
157   -
158   - $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
159   - if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
  65 + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php');
  66 + if (!empty($rootUrl)) $dispatcherURL = $rootUrl . $dispatcherURL;
160 67 $dispatcherURL = str_replace( '\\', '/', $dispatcherURL);
161 68 if ( substr( $dispatcherURL, 0,1 ) != '/')
162   - {
163   - $dispatcherURL = '/'.$dispatcherURL;
164   - }
  69 + {
  70 + $dispatcherURL = '/'.$dispatcherURL;
  71 + }
165 72  
166   - $this->getUsage();
  73 + $usage = unserialize(KTUtil::getSystemSetting('KTUsage','n/a'));
167 74  
168   - $aTemplateData = array(
169   - 'context' => $this,
170   - 'usages'=>$this->usage,
171   - 'dispatcherURL'=>$dispatcherURL
172   - );
  75 + $aTemplateData = array(
  76 + 'context' => $this,
  77 + 'usages'=>$usage,
  78 + 'dispatcherURL'=>$dispatcherURL
  79 + );
173 80  
174   - return $oTemplate->render($aTemplateData);
175   - }
  81 + return $oTemplate->render($aTemplateData);
  82 + }
176 83 }
177 84  
178 85  
... ...
plugins/housekeeper/HouseKeeper.inc.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +class HouseKeeper
  41 +{
  42 + public static
  43 + function getDiskUsageStats($update = true)
  44 + {
  45 + $config = KTConfig::getSingleton();
  46 +
  47 + $cmd = KTUtil::findCommand('externalBinary/df','df');
  48 + if ($cmd === false)
  49 + {
  50 + if ($update)
  51 + KTUtil::setSystemSetting('DiskUsage','n/a');
  52 + return false;
  53 + }
  54 +
  55 +
  56 + $warningPercent = $config->get('DiskUsage/warningThreshold', 15);
  57 + $urgentPercent = $config->get('DiskUsage/urgentThreshold', 5);
  58 +
  59 + if (OS_WINDOWS)
  60 + {
  61 + $cmd = str_replace( '/','\\',$cmd);
  62 + $res = KTUtil::pexec("\"$cmd\" -B 1 2>&1");
  63 + $result = implode("\r\n",$res['out']);
  64 + }
  65 + else
  66 + {
  67 + if(strtolower(PHP_OS) == 'darwin'){
  68 + $result = shell_exec($cmd." -k 2>&1");
  69 + }else{
  70 + $result = shell_exec($cmd." -B 1 2>&1");
  71 + }
  72 + }
  73 +
  74 + if (strpos($result, 'cannot read table of mounted file systems') !== false)
  75 + {
  76 + if ($update)
  77 + KTUtil::setSystemSetting('DiskUsage','n/a');
  78 + return false;
  79 + }
  80 +
  81 + $result = explode("\n", $result);
  82 +
  83 + unset($result[0]); // gets rid of headings
  84 +
  85 + $usage=array();
  86 + foreach($result as $line)
  87 + {
  88 + if (empty($line)) continue;
  89 + preg_match('/(.*)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\%\s+(.*)/', $line, $matches);
  90 + list($line, $filesystem, $size, $used, $avail, $usedp, $mount) = $matches;
  91 +
  92 + if ($size === 0) continue;
  93 +
  94 + if(strtolower(PHP_OS) == 'darwin'){
  95 + $size = $size * 1024;
  96 + $used = $used * 1024;
  97 + $avail = $avail * 1024;
  98 + }
  99 +
  100 + $colour = '';
  101 + if ($usedp >= 100 - $urgentPercent)
  102 + {
  103 + $colour = 'red';
  104 + }
  105 + elseif ($usedp >= 100 - $warningPercent)
  106 + {
  107 + $colour = 'orange';
  108 + }
  109 +
  110 + $usage[] = array(
  111 + 'filesystem'=>trim($filesystem),
  112 + 'size'=>KTUtil::filesizeToString($size),
  113 + 'used'=>KTUtil::filesizeToString($used),
  114 + 'available'=>KTUtil::filesizeToString($avail),
  115 + 'usage'=>$usedp . '%',
  116 + 'mounted'=>trim($mount),
  117 + 'colour'=>$colour
  118 + );
  119 + }
  120 +
  121 + if ($update)
  122 + KTUtil::setSystemSetting('DiskUsage',serialize($usage));
  123 +
  124 + return $usage;
  125 + }
  126 +
  127 + private static
  128 + function scanPath($path,$pattern)
  129 + {
  130 + $files=0;
  131 + $filesize=0;
  132 +
  133 + if (is_dir($path) && ($dh = opendir($path)))
  134 + {
  135 + while (($file = readdir($dh)) !== false)
  136 + {
  137 + if (substr($file,0,1) == '.')
  138 + {
  139 + continue;
  140 + }
  141 +
  142 + $full = $path . '/' . $file;
  143 +
  144 + if (!is_readable($full) || !is_writable($full))
  145 + {
  146 + continue;
  147 + }
  148 +
  149 + if (is_dir($full))
  150 + {
  151 + $result = self::scanPath($full,$pattern);
  152 + $files += $result['files'];
  153 + $filesize += $result['filesize'];
  154 + continue;
  155 + }
  156 + if ($pattern != '')
  157 + {
  158 + if (preg_match('/' . $pattern . '/', $file) === false)
  159 + {
  160 + continue;
  161 + }
  162 + }
  163 +
  164 + $files++;
  165 + $filesize += filesize($full);
  166 + }
  167 + closedir($dh);
  168 + }
  169 + return array('files'=>$files,'filesize'=>$filesize,'dir'=>$path);
  170 + }
  171 +
  172 +
  173 +
  174 + private static
  175 + function getDirectories()
  176 + {
  177 + $config = KTConfig::getSingleton();
  178 + $cacheDir = $config->get('cache/cacheDirectory');
  179 +
  180 + $tempDir = $config->get('urls/tmpDirectory');
  181 + $logDir = $config->get('urls/logDirectory');
  182 + $docsDir = $config->get('urls/documentRoot');
  183 +
  184 + $indexer = Indexer::get();
  185 + $luceneDir = $indexer->getIndexDirectory();
  186 +
  187 + $systemDir = OS_UNIX?'/tmp':'c:/windows/temp';
  188 +
  189 + $folders = array(
  190 + array(
  191 + 'name'=>_kt('Smarty Cache'),
  192 + 'folder'=>$tempDir,
  193 + 'pattern'=>'^%%.*',
  194 + 'canClean'=>true
  195 + ),
  196 + array(
  197 + 'name'=>_kt('System Cache'),
  198 + 'folder'=>$cacheDir,
  199 + 'pattern'=>'',
  200 + 'canClean'=>true
  201 + ),
  202 + array(
  203 + 'name'=>_kt('System Logs'),
  204 + 'folder'=>$logDir,
  205 + 'pattern'=>'.+\.txt$',
  206 + 'canClean'=>true
  207 + ));
  208 +
  209 + $folders[] =
  210 + array(
  211 + 'name'=>_kt('Temporary Folder'),
  212 + 'folder'=>$tempDir,
  213 + 'pattern'=>'',
  214 + 'canClean'=>true
  215 + );
  216 +
  217 + $folders[] =
  218 + array(
  219 + 'name'=>_kt('System Temporary Folder'),
  220 + 'folder'=>$systemDir,
  221 + 'pattern'=>'(sess_.+)?(.+\.log$)?',
  222 + 'canClean'=>true
  223 + );
  224 +
  225 + if (is_dir($docsDir))
  226 + {
  227 + $folders[] =
  228 + array(
  229 + 'name'=>_kt('Documents'),
  230 + 'folder'=>$docsDir,
  231 + 'pattern'=>'',
  232 + 'canClean'=>false
  233 + );
  234 + }
  235 +
  236 + if (is_dir($luceneDir))
  237 + {
  238 + $folders[] =
  239 + array(
  240 + 'name'=>_kt('Document Index'),
  241 + 'folder'=>$luceneDir,
  242 + 'pattern'=>'',
  243 + 'canClean'=>false
  244 + );
  245 +
  246 + }
  247 + return $folders;
  248 + }
  249 +
  250 +
  251 + public static
  252 + function getKTUsageStats($update = true)
  253 + {
  254 + $usage = array();
  255 +
  256 + $oRegistry =& KTPluginRegistry::getSingleton();
  257 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
  258 +
  259 + $folders = self::getDirectories();
  260 +
  261 + foreach($folders as $folder)
  262 + {
  263 + $directory = $folder['folder'];
  264 + $pattern = $folder['pattern'];
  265 + $canClean = $folder['canClean'];
  266 + $name = $folder['name'];
  267 +
  268 + $temp = self::scanPath($directory,$pattern);
  269 +
  270 + $usage[] = array(
  271 + 'description'=>$name,
  272 + 'folder'=>$directory,
  273 + 'files'=>number_format($temp['files'],0,'.',','),
  274 + 'filesize'=>KTUtil::filesizeToString($temp['filesize']),
  275 + 'action'=>$i,
  276 + 'canClean'=>$canClean
  277 + );
  278 + }
  279 +
  280 + if ($update)
  281 + KTUtil::setSystemSetting('KTUsage',serialize($usage));
  282 + return $usage;
  283 + }
  284 +
  285 + private static $folders = null;
  286 +
  287 + public static
  288 + function getDirectory($folder)
  289 + {
  290 + if (is_null(self::$folders))
  291 + {
  292 + self::$folders = self::getDirectories();
  293 + }
  294 + foreach(self::$folders as $dir)
  295 + {
  296 + if ($dir['folder'] == $folder)
  297 + {
  298 + return $dir;
  299 + }
  300 + }
  301 + return null;
  302 + }
  303 +
  304 +
  305 + public static
  306 + function cleanDirectory($path, $pattern)
  307 + {
  308 + if (!is_readable($path))
  309 + {
  310 + return;
  311 + }
  312 + if ($dh = opendir($path))
  313 + {
  314 + while (($file = readdir($dh)) !== false)
  315 + {
  316 + if (substr($file,0,1) == '.')
  317 + {
  318 + continue;
  319 + }
  320 +
  321 + $full = $path . '/' . $file;
  322 + if (is_dir($full))
  323 + {
  324 + self::cleanDirectory($full,$pattern);
  325 + if (is_writable($full))
  326 + {
  327 + @rmdir($full);
  328 + }
  329 + continue;
  330 + }
  331 +
  332 + if (!empty($pattern) && !preg_match('/' . $pattern . '/', $file))
  333 + {
  334 + continue;
  335 + }
  336 +
  337 + if (is_writable($full))
  338 + {
  339 + @unlink($full);
  340 + }
  341 +
  342 + }
  343 + closedir($dh);
  344 + }
  345 + }
  346 +
  347 +}
  348 +
  349 +
  350 +?>
0 351 \ No newline at end of file
... ...
plugins/housekeeper/HouseKeeperDispatcher.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 */
... ... @@ -41,85 +41,34 @@ session_start();
41 41 require_once("../../config/dmsDefaults.php");
42 42 require_once(KT_LIB_DIR . "/templating/templating.inc.php");
43 43 require_once(KT_LIB_DIR . "/dispatcher.inc.php");
  44 +require_once('HouseKeeper.inc.php');
44 45  
45 46 class HouseKeeperDispatcher extends KTStandardDispatcher
46 47 {
47   - function cleanDirectory($path, $pattern)
48   - {
49   - if (!is_readable($path))
50   - {
51   - return;
52   - }
53   - if ($dh = opendir($path))
54   - {
55   - while (($file = readdir($dh)) !== false)
56   - {
57   - if (substr($file,0,1) == '.')
58   - {
59   - continue;
60   - }
61   -
62   - $full = $path . '/' . $file;
63   - if (is_dir($full))
64   - {
65   - $this->cleanDirectory($full,$pattern);
66   - if (is_writable($full))
67   - {
68   - @rmdir($full);
69   - }
70   - continue;
71   - }
72   -
73   - if (!empty($pattern) && !preg_match('/' . $pattern . '/', $file))
74   - {
75   - continue;
76   - }
77 48  
78   - if (is_writable($full))
79   - {
80   - @unlink($full);
81   - }
82   -
83   - }
84   - closedir($dh);
85   - }
86   -
87   - }
88   -
89   - function do_cleanup()
90   - {
91   - $folder = KTUtil::arrayGet($_REQUEST, 'folder');
92   - if (is_null($folder))
93   - {
94   - exit(redirect(generateControllerLink('dashboard')));
95   - }
  49 + function do_cleanup()
  50 + {
  51 + $folder = KTUtil::arrayGet($_REQUEST, 'folder');
  52 + if (is_null($folder))
  53 + {
  54 + exit(redirect(generateControllerLink('dashboard')));
  55 + }
96 56  
97   - $oRegistry =& KTPluginRegistry::getSingleton();
98   - $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
  57 + $oRegistry =& KTPluginRegistry::getSingleton();
  58 + $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin');
99 59  
100 60 // we must avoid doing anything to the documents folder at all costs!
101   - $folder = $oPlugin->getDirectory($folder);
  61 + $folder = HouseKeeper::getDirectory($folder);
102 62 if (is_null($folder) || !$folder['canClean'])
103 63 {
104   - exit(redirect(generateControllerLink('dashboard')));
  64 + exit(redirect(generateControllerLink('dashboard')));
105 65 }
106 66  
107   - $this->cleanDirectory($folder['folder'], $folder['pattern']);
108   -
109   - $this->do_refreshFolderUsage();
110   - }
111   -
112   - function do_refreshDiskUsage()
113   - {
114   - session_unregister('DiskUsage');
115   - exit(redirect(generateControllerLink('dashboard')));
116   - }
  67 + HouseKeeper::cleanDirectory($folder['folder'], $folder['pattern']);
  68 + HouseKeeper::getKTUsageStats();
117 69  
118   - function do_refreshFolderUsage()
119   - {
120   - session_unregister('SystemFolderUsage');
121   - exit(redirect(generateControllerLink('dashboard')));
122   - }
  70 + exit(redirect(generateControllerLink('dashboard')));
  71 + }
123 72 }
124 73 $oDispatcher = new HouseKeeperDispatcher();
125 74 $oDispatcher->dispatch();
... ...
plugins/housekeeper/HouseKeeperPlugin.php
... ... @@ -7,31 +7,31 @@
7 7 * Document Management Made Simple
8 8 * Copyright (C) 2008 KnowledgeTree Inc.
9 9 * Portions copyright The Jam Warehouse Software (Pty) Limited
10   - *
  10 + *
11 11 * This program is free software; you can redistribute it and/or modify it under
12 12 * the terms of the GNU General Public License version 3 as published by the
13 13 * Free Software Foundation.
14   - *
  14 + *
15 15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 17 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 18 * details.
19   - *
  19 + *
20 20 * You should have received a copy of the GNU General Public License
21 21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22   - *
23   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
24 24 * California 94120-7775, or email info@knowledgetree.com.
25   - *
  25 + *
26 26 * The interactive user interfaces in modified source and object code versions
27 27 * of this program must display Appropriate Legal Notices, as required under
28 28 * Section 5 of the GNU General Public License version 3.
29   - *
  29 + *
30 30 * In accordance with Section 7(b) of the GNU General Public License version 3,
31 31 * these Appropriate Legal Notices must retain the display of the "Powered by
32   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
33 33 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
34   - * must display the words "Powered by KnowledgeTree" and retain the original
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
35 35 * copyright notice.
36 36 * Contributor( s): ______________________________________
37 37 */
... ... @@ -40,118 +40,26 @@ require_once(KT_LIB_DIR . &#39;/plugins/plugin.inc.php&#39;);
40 40 require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
41 41  
42 42 class HouseKeeperPlugin extends KTPlugin
43   - {
44   - var $autoRegister = true;
45   - var $sNamespace = 'ktcore.housekeeper.plugin';
  43 +{
  44 + var $autoRegister = true;
  45 + var $sNamespace = 'ktcore.housekeeper.plugin';
46 46  
47   - var $folders = array();
  47 + var $folders = array();
48 48  
49   - function HouseKeeperPlugin($sFilename = null)
50   - {
51   - parent::KTPlugin($sFilename);
  49 + function HouseKeeperPlugin($sFilename = null)
  50 + {
  51 + parent::KTPlugin($sFilename);
52 52  
53 53 $this->sFriendlyName = _kt('Housekeeper');
54   -
55   - $config = KTConfig::getSingleton();
56   - $cacheDir = $config->get('cache/cacheDirectory');
57   - $cacheFile = $cacheDir . '/houseKeeper.folders';
58   -
59   - if (is_file($cacheFile))
60   - {
61   - $this->folders = unserialize(file_get_contents($cacheFile));
62   - return;
63   - }
64   -
65   - $tempDir = $config->get('urls/tmpDirectory');
66   - $logDir = $config->get('urls/logDirectory');
67   - $docsDir = $config->get('urls/documentRoot');
68   -
69   - $indexer = Indexer::get();
70   - $luceneDir = $indexer->getIndexDirectory();
71   -
72   - $systemDir = OS_UNIX?'/tmp':'c:/windows/temp';
73   -
74   - $this->folders = array(
75   - array(
76   - 'name'=>_kt('Smarty Cache'),
77   - 'folder'=>$tempDir,
78   - 'pattern'=>'^%%.*',
79   - 'canClean'=>true
80   - ),
81   - array(
82   - 'name'=>_kt('System Cache'),
83   - 'folder'=>$cacheDir,
84   - 'pattern'=>'',
85   - 'canClean'=>true
86   - ),
87   - array(
88   - 'name'=>_kt('System Logs'),
89   - 'folder'=>$logDir,
90   - 'pattern'=>'.+\.txt$',
91   - 'canClean'=>true
92   - ));
93   -
94   - $this->folders[] =
95   - array(
96   - 'name'=>_kt('System Temporary Folder'),
97   - 'folder'=>$systemDir,
98   - 'pattern'=>'(sess_.+)?(.+\.log$)?',
99   - 'canClean'=>true
100   - );
101   -
102   - if (is_dir($docsDir))
103   - {
104   - $this->folders[] =
105   - array(
106   - 'name'=>_kt('Documents'),
107   - 'folder'=>$docsDir,
108   - 'pattern'=>'',
109   - 'canClean'=>false
110   - );
111   - }
112   -
113   - if (is_dir($luceneDir))
114   - {
115   - $this->folders[] =
116   - array(
117   - 'name'=>_kt('Document Index'),
118   - 'folder'=>$luceneDir,
119   - 'pattern'=>'',
120   - 'canClean'=>false
121   - );
122   -
123   - // lets only cache this once it has been resolved!
124   - file_put_contents($cacheFile, serialize($this->folders));
125   - }
126   -
127   -
128   -
129   - }
130   -
131   - function getDirectories()
132   - {
133   - return $this->folders;
134   - }
135   -
136   - function getDirectory($folder)
137   - {
138   - foreach($this->folders as $dir)
139   - {
140   - if ($dir['folder'] == $folder)
141   - {
142   - return $dir;
143   - }
144   - }
145   - return null;
146 54 }
147 55  
148 56 function setup()
149 57 {
150   - $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php');
151   - $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php');
  58 + $this->registerDashlet('DiskUsageDashlet', 'ktcore.diskusage.dashlet', 'DiskUsageDashlet.inc.php');
  59 + $this->registerDashlet('FolderUsageDashlet', 'ktcore.folderusage.dashlet', 'FolderUsageDashlet.inc.php');
152 60  
153 61 $oTemplating =& KTTemplating::getSingleton();
154   - $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates');
  62 + $oTemplating->addLocation('housekeeper', '/plugins/housekeeper/templates');
155 63 }
156 64  
157 65 }
... ...
plugins/housekeeper/bin/UpdateStats.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +chdir(dirname(__FILE__));
  41 +require_once(realpath('../../../config/dmsDefaults.php'));
  42 +require_once('../HouseKeeper.inc.php');
  43 +
  44 +HouseKeeper::getDiskUsageStats();
  45 +HouseKeeper::getKTUsageStats();
  46 +
  47 +?>
0 48 \ No newline at end of file
... ...
plugins/housekeeper/templates/DiskUsage.smarty
... ... @@ -43,5 +43,5 @@
43 43 {if $red==1}
44 44 <td bgcolor=red><nobr> &lt; {$urgentPercent} %</td>
45 45 {/if}
46   -<td width="100%" align="right"><a href="{$dispatcherURL}?action=refreshDiskUsage">{i18n}refresh{/i18n}</a></td>
  46 +<td width="100%" align="right">&nbsp;</td>
47 47 </table>
48 48 \ No newline at end of file
... ...
plugins/housekeeper/templates/FolderUsage.smarty
... ... @@ -30,7 +30,3 @@ function cleanupFolder(path)
30 30 {/section}
31 31 <tr><td colspan=4><hr></tr>
32 32 </table>
33   -<table width="100%">
34   -<tr width="100%">
35   -<td align="right"><a href="{$dispatcherURL}?action=refreshFolderUsage">{i18n}refresh{/i18n}</a></td>
36   -</table>
... ...
plugins/ktstandard/AdminVersionPlugin/AdminVersion.inc.php 0 → 100644
  1 +<?php
  2 +
  3 +class AdminVersion
  4 +{
  5 + //const KT_VERSION_URL = 'http://version.knowledgetree.com/kt_versions';
  6 + const KT_VERSION_URL = 'http://ktdms.trunk/plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php';
  7 +
  8 + public static
  9 + function refresh($url = null)
  10 + {
  11 + $aEncoded = array();
  12 + $aVersions = KTUtil::getKTVersions();
  13 +
  14 + foreach ($aVersions as $k => $v)
  15 + {
  16 + $aEncoded[] = sprintf("%s=%s", urlencode($k), urlencode($v));
  17 + }
  18 +
  19 + if (empty($url))
  20 + $sUrl = self::KT_VERSION_URL;
  21 + else
  22 + $sUrl = $url;
  23 + $sUrl .= '?' . implode('&', $aEncoded);
  24 +
  25 + $sIdentifier = KTUtil::getSystemIdentifier();
  26 + $sUrl .= '&' . sprintf("system_identifier=%s", $sIdentifier);
  27 +
  28 + if (!function_exists('curl_init'))
  29 + {
  30 + $stuff = @file_get_contents($sUrl);
  31 + }
  32 + else
  33 + {
  34 + $ch = @curl_init($sUrl);
  35 + if (!$ch)
  36 + {
  37 + return false;
  38 + }
  39 + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  40 + curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  41 + $stuff = curl_exec($ch);
  42 + curl_close($ch);
  43 + }
  44 + if ($stuff === false)
  45 + {
  46 + $stuff = "";
  47 + }
  48 + else
  49 + {
  50 + $stuff = str_replace('\'','"', $stuff);
  51 + $decoded = json_decode($stuff);
  52 + if ($decoded === false)
  53 + {
  54 + return false;
  55 + }
  56 + KTUtil::setSystemSetting('ktadminversion_lastcheck', date('Y-m-d H:i:s'));
  57 + KTUtil::setSystemSetting('ktadminversion_lastvalue', serialize($decoded));
  58 + }
  59 + }
  60 +
  61 + public static
  62 + function isNewVersionAvailable()
  63 + {
  64 + $aVersions = KTUtil::getKTVersions();
  65 +
  66 + $name = array_keys($aVersions);
  67 + $name = $name[0];
  68 + $version = array_values($aVersions);
  69 + $version = $version[0];
  70 +
  71 + $aRemoteVersions = unserialize(KTUtil::getSystemSetting('ktadminversion_lastvalue'));
  72 +
  73 + $aVersions = get_object_vars($aRemoteVersions);
  74 +
  75 + if (!isset($aVersions[$name]))
  76 + {
  77 + return false;
  78 + }
  79 +
  80 + $newVersion = $aRemoteVersions->$name;
  81 + if (version_compare($version, $newVersion) == -1)
  82 + {
  83 + return array('name'=>$name,'version'=>$aRemoteVersions->$name);
  84 + }
  85 +
  86 + return false;
  87 + }
  88 +}
  89 +
  90 +?>
0 91 \ No newline at end of file
... ...
plugins/ktstandard/AdminVersionPlugin/AdminVersionDashlet.php
... ... @@ -6,71 +6,70 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
37 37 */
38 38  
  39 +require_once('AdminVersion.inc.php');
  40 +
39 41 class AdminVersionDashlet extends KTBaseDashlet {
40   - var $oUser;
41 42 var $sClass = 'ktError';
42   -
  43 +
43 44 function AdminVersionDashlet(){
44 45 $this->sTitle = _kt('New Version Available');
45 46 }
46   -
47   - /*function is_active($oUser) {
48   - $this->oUser = $oUser;
49   - return true;
50   - }
51   - */
52   -
53   - function is_active($oUser) {
54   - $this->oUser = $oUser;
55   - return Permission::userIsSystemAdministrator($oUser);
  47 +
  48 + function is_active($oUser)
  49 + {
  50 + $this->version = AdminVersion::isNewVersionAvailable();
  51 + if ($this->version === false)
  52 + {
  53 + return false;
  54 + }
  55 + return Permission::userIsSystemAdministrator();
56 56 }
57   -
  57 +
58 58 function render() {
59 59 global $main;
60   - $main->requireJSResource("plugins/ktstandard/AdminVersionPlugin/js/update.js");
61   -
62   - $oPlugin =& $this->oPlugin;
63   -
  60 +
64 61 $oTemplating =& KTTemplating::getSingleton();
65   - $oTemplate = $oTemplating->loadTemplate('AdminVersionPlugin/dashlet');
66   -
  62 + $oTemplate = $oTemplating->loadTemplate('dashlet');
  63 +
  64 + $name = $this->version['name'];
  65 + $version = $this->version['version'];
  66 +
67 67 $aTemplateData = array(
68 68 'context' => $this,
69   - 'url' => $oPlugin->getPagePath('versions'),
70   -
  69 + 'name' => $name,
  70 + 'version' => $version
71 71 );
72   -
73   -
  72 +
74 73 return $oTemplate->render($aTemplateData);
75 74 }
76 75 }
... ...
plugins/ktstandard/AdminVersionPlugin/AdminVersionPage.php deleted
1   -<?php
2   -/*
3   - * $Id:$
4   - *
5   - * KnowledgeTree Community Edition
6   - * Document Management Made Simple
7   - * Copyright (C) 2008 KnowledgeTree Inc.
8   - * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
10   - * This program is free software; you can redistribute it and/or modify it under
11   - * the terms of the GNU General Public License version 3 as published by the
12   - * Free Software Foundation.
13   - *
14   - * This program is distributed in the hope that it will be useful, but WITHOUT
15   - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16   - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17   - * details.
18   - *
19   - * You should have received a copy of the GNU General Public License
20   - * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23   - * California 94120-7775, or email info@knowledgetree.com.
24   - *
25   - * The interactive user interfaces in modified source and object code versions
26   - * of this program must display Appropriate Legal Notices, as required under
27   - * Section 5 of the GNU General Public License version 3.
28   - *
29   - * In accordance with Section 7(b) of the GNU General Public License version 3,
30   - * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32   - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
34   - * copyright notice.
35   - * Contributor( s): ______________________________________
36   - *
37   - */
38   -
39   -
40   -require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");
41   -require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
42   -require_once(KT_LIB_DIR . "/dashboard/dashlet.inc.php");
43   -
44   -define('KT_VERSION_URL', 'http://version.knowledgetree.com/kt_versions');
45   -
46   -class AdminVersionPage extends KTStandardDispatcher {
47   -
48   - function _checkCache() {
49   - global $default;
50   - $iLastCheck = KTUtil::getSystemSetting('ktadminversion_lastcheck');
51   - if (empty($iLastCheck)) {
52   - return;
53   - }
54   - $sLastValue = KTUtil::getSystemSetting('ktadminversion_lastvalue');
55   - if (empty($sLastValue)) {
56   - $now = time();
57   - $diff = $now - $iLastCheck;
58   - if ($diff > (24*60*60)) {
59   - return;
60   - }
61   - }
62   - $now = time();
63   - $diff = $now - $iLastCheck;
64   - if ($diff > (24*60*60)) {
65   - return;
66   - }
67   - return $sLastValue;
68   - }
69   -
70   - function do_main() {
71   - session_write_close();
72   -
73   - $sCache = $this->_checkCache();
74   - if (!is_null($sCache)) {
75   - $sCachedVersion = $sCache;
76   -
77   - $sVName = "";
78   - $sVNum = "";
79   -
80   - $sTrimmer = str_replace('{', '', str_replace('}', '', str_replace('\'', '', $sCachedVersion)));
81   - $aCachedVersionsTemp = explode(',',$sTrimmer);
82   -
83   - for($i=0;$i<count($aCachedVersionsTemp);$i++){
84   - $aCachedVersionsTemp[$i] = explode(':', $aCachedVersionsTemp[$i]);
85   - }
86   - for($i=0;$i<count($aCachedVersionsTemp);$i++){
87   - $key = trim($aCachedVersionsTemp[$i][0]);
88   - $value = trim($aCachedVersionsTemp[$i][1]);
89   - $aCachedVersions[$key] = $value;
90   - }
91   -
92   - $aVersions = KTUtil::getKTVersions();
93   -
94   -/*
95   - echo "<pre>";
96   - print_r($aCachedVersions);
97   - echo "</pre>";
98   - echo "<pre>";
99   - print_r($aVersions);
100   - echo "</pre>";
101   - exit;
102   -*/
103   -
104   - foreach ($aVersions as $k => $v) {
105   - foreach($aCachedVersions as $j => $l) {
106   - if (($k == $j) && (version_compare($aVersions[$k], $aCachedVersions[$j]) == -1))
107   - {
108   - //save new name and version
109   - $sVName = $j;
110   - $sVNum = $l;
111   - }
112   - }//end foreach
113   -
114   - }//end foreach
115   -
116   - if ($sVName != "")
117   - {
118   - return "<div id=\"AdminVersion\"><a href=\"http://www.knowledgetree.com/products/whats-new\" target=\"_blank\">".$sVName." version ".$sVNum."</a></div><br>";
119   - }
120   - else
121   - {
122   - return "";
123   - }
124   - }
125   -
126   - $sUrl = KT_VERSION_URL;
127   - $aVersions = KTUtil::getKTVersions();
128   -
129   - foreach ($aVersions as $k => $v) {
130   - $sUrl .= '?' . sprintf("%s=%s", $k, $v);
131   - }
132   - $sIdentifier = KTUtil::getSystemIdentifier();
133   - $sUrl .= '&' . sprintf("system_identifier=%s", $sIdentifier);
134   -
135   - if (!function_exists('curl_init')) {
136   - if (OS_WINDOWS) {
137   - return "";
138   - }
139   -
140   - $stuff = @file_get_contents($sUrl);
141   - if ($stuff === false) {
142   - $stuff = "";
143   - }
144   - } else {
145   -
146   - $ch = @curl_init($sUrl);
147   - if (!$ch) {
148   - return "";
149   - }
150   - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
151   - curl_setopt($ch, CURLOPT_TIMEOUT, 10);
152   - $stuff = curl_exec($ch);
153   - curl_close($ch);
154   - if (!$stuff) {
155   - $stuff = "";
156   - }
157   - }
158   - KTUtil::setSystemSetting('ktadminversion_lastcheck', time());
159   - KTUtil::setSystemSetting('ktadminversion_lastvalue', (string)$stuff);
160   -
161   - $sVName = "";
162   - $sVNum = "";
163   -
164   - $trim_stuff = str_replace('{', '', str_replace('}', '', str_replace('\'', '', $stuff)));
165   - $aRemoteVersionstemp = explode(',',$trim_stuff);
166   -
167   - for($i=0;$i<count($aRemoteVersionstemp);$i++){
168   - $aRemoteVersionstemp[$i] = explode(':', $aRemoteVersionstemp[$i]);
169   - }
170   - for($i=0;$i<count($aRemoteVersionstemp);$i++){
171   - $key = trim($aRemoteVersionstemp[$i][0]);
172   - $value = trim($aRemoteVersionstemp[$i][1]);
173   - $aRemoteVersions[$key] = $value;
174   - }
175   -/*
176   - echo "<pre>";
177   - print_r($aRemoteVersions);
178   - echo "</pre>";
179   - echo "<pre>";
180   - print_r($aVersions);
181   - echo "</pre>";
182   - exit;
183   -*/
184   - foreach ($aVersions as $k => $v) {
185   - foreach($aRemoteVersions as $j => $l) {
186   - if (($k == $j) && (version_compare($aVersions[$k], $aRemoteVersions[$j]) == -1))
187   - {
188   - //save new name and version
189   - $sVName = $j;
190   - $sVNum = $l;
191   - }
192   - }
193   - }
194   -
195   - if ($sVName != "")
196   - {
197   - return "<div id=\"AdminVersion\"><a href=\"http://www.knowledgetree.com/products/whats-new\" target=\"_blank\">".$sVName." version ".$sVNum."</a></div><br>";
198   - }
199   - else
200   - {
201   - return "";
202   - }
203   - }
204   -
205   - function handleOutput($sOutput) {
206   - print $sOutput;
207   - }
208   -}
209   -
210   -?>
211 0 \ No newline at end of file
plugins/ktstandard/AdminVersionPlugin/AdminVersionPlugin.php
... ... @@ -6,63 +6,63 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
37 37 */
38   -
  38 +
39 39 require_once(KT_LIB_DIR . "/plugins/plugin.inc.php");
40 40 require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
  41 +require_once(KT_LIB_DIR . "/templating/templating.inc.php");
41 42  
42 43 class AdminVersionPlugin extends KTPlugin
43 44 {
44 45 var $sNamespace = 'ktstandard.adminversion.plugin';
45 46 var $autoRegister = true;
46   -
  47 +
47 48 function AdminVersionPlugin($sFilename = null) {
48   -
  49 +
49 50 $res = parent::KTPlugin($sFilename);
50 51 $this->sFriendlyName = _kt('Admin Version Notifier');
51 52 return $res;
52   -
  53 +
53 54 }
54   -
  55 +
55 56 function setup() {
56   -
  57 +
57 58 $this->registerDashlet('AdminVersionDashlet', 'ktstandard.adminversion.dashlet', 'AdminVersionDashlet.php');
58   - $this->registerPage('versions', 'AdminVersionPage', 'AdminVersionPage.php');
59   -
60   - require_once(KT_LIB_DIR . "/templating/templating.inc.php");
  59 +
61 60 $oTemplating =& KTTemplating::getSingleton();
62 61 $oTemplating->addLocation('AdminVersionDashlet', '/plugins/ktstandard/AdminVersionPlugin/templates');
63 62 }
64 63 }
  64 +
65 65 $oPluginRegistry =& KTPluginRegistry::getSingleton();
66 66 $oPluginRegistry->registerPlugin('AdminVersionPlugin', 'ktstandard.adminversion.plugin', __FILE__);
67 67  
68 68 -?>
  69 +?>
69 70 \ No newline at end of file
... ...
plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +chdir(dirname(__FILE__));
  41 +require_once(realpath('../../../../config/dmsDefaults.php'));
  42 +require_once('../AdminVersion.inc.php');
  43 +
  44 +AdminVersion::refresh();
  45 +
... ...
plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png renamed to plugins/ktstandard/AdminVersionPlugin/templates/computer_go.png

777 Bytes

plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/dashlet.smarty renamed to plugins/ktstandard/AdminVersionPlugin/templates/dashlet.smarty
1   -{literal}
2   -
3   -<style type="text/css">
4   -#AdminVersionDashlet {
5   - display: none;
6   -
7   -
8   -}
9   -#AdminVersionDashlet .action_close{
10   - display: none;
11   -}
12   -
13   -#AdminHeader { font-weight: bold;
14   - margin-left: 25px;}
15   -#AdminVersionBlock {
16   - background: url(./plugins/ktstandard/AdminVersionPlugin/templates/AdminVersionPlugin/computer_go.png) no-repeat scroll left;
17   - font-weight: bold;
18   - padding-left:25px;
19   -
20   - background-position: top left;
21   -
22   -}
23   -</style>
24   -
25   -{/literal}
26   -
27   -<script type="text/javascript">var VERSIONS_URL = "{$url}";</script>
28   -<script type="text/javascript">CheckVersion();</script>
29   -<div>
30   -<div id="AdminHeader">
31   - The following upgrade is available:
32   -</div>
33   -<div id="AdminVersionBlock" name="AdminVersionBlock">
34   -
35   -</div>
36   -
  1 +{literal}
  2 +
  3 +<style type="text/css">
  4 +
  5 +#AdminVersionDashlet .action_close {
  6 + display: none;
  7 +}
  8 +#AdminHeader { font-weight: bold;
  9 + margin-left: 25px;}
  10 +#AdminVersionBlock {
  11 + background: url(./plugins/ktstandard/AdminVersionPlugin/templates/computer_go.png) no-repeat scroll left;
  12 + font-weight: bold;
  13 + padding-left:25px;
  14 + background-position: top left;
  15 +}
  16 +</style>
  17 +
  18 +{/literal}
  19 +
  20 +<div>
  21 +<div id="AdminHeader">
  22 + The following upgrade is available:
  23 +</div>
  24 +<div id="AdminVersionBlock" name="AdminVersionBlock">
  25 +<div id="AdminVersion"><a href="http://www.knowledgetree.com/products/whats-new" target="_blank">{$name} version {$version}</a></div><br></div>
37 26 </div>
38 27 \ No newline at end of file
... ...
plugins/ktstandard/AdminVersionPlugin/test/checkVersion.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +chdir(dirname(__FILE__));
  41 +require_once(realpath('../../../../config/dmsDefaults.php'));
  42 +require_once('../AdminVersion.inc.php');
  43 +
  44 +$version = AdminVersion::isNewVersionAvailable();
  45 +
  46 +if ($version == false)
  47 +print 'No new version available.';
  48 +else
  49 +print_r($version);
  50 +
... ...
plugins/ktstandard/AdminVersionPlugin/test/latestVersion.php 0 → 100644
  1 +<?php
  2 +
  3 +/**
  4 + * $Id: $
  5 + *
  6 + * KnowledgeTree Community Edition
  7 + * Document Management Made Simple
  8 + * Copyright (C) 2008 KnowledgeTree Inc.
  9 + * Portions copyright The Jam Warehouse Software (Pty) Limited
  10 + *
  11 + * This program is free software; you can redistribute it and/or modify it under
  12 + * the terms of the GNU General Public License version 3 as published by the
  13 + * Free Software Foundation.
  14 + *
  15 + * This program is distributed in the hope that it will be useful, but WITHOUT
  16 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17 + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18 + * details.
  19 + *
  20 + * You should have received a copy of the GNU General Public License
  21 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22 + *
  23 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  24 + * California 94120-7775, or email info@knowledgetree.com.
  25 + *
  26 + * The interactive user interfaces in modified source and object code versions
  27 + * of this program must display Appropriate Legal Notices, as required under
  28 + * Section 5 of the GNU General Public License version 3.
  29 + *
  30 + * In accordance with Section 7(b) of the GNU General Public License version 3,
  31 + * these Appropriate Legal Notices must retain the display of the "Powered by
  32 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  33 + * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
  34 + * must display the words "Powered by KnowledgeTree" and retain the original
  35 + * copyright notice.
  36 + * Contributor( s): ______________________________________
  37 + *
  38 + */
  39 +
  40 +// NOTE: this is a test script. The values are for test purposes only.
  41 +
  42 +$versions = array(
  43 +'Development OSS'=> '3.5'
  44 +);
  45 +
  46 +print json_encode($versions);
  47 +
  48 +?>
0 49 \ No newline at end of file
... ...
preferences.php
... ... @@ -6,31 +6,31 @@
6 6 * Document Management Made Simple
7 7 * Copyright (C) 2008 KnowledgeTree Inc.
8 8 * Portions copyright The Jam Warehouse Software (Pty) Limited
9   - *
  9 + *
10 10 * This program is free software; you can redistribute it and/or modify it under
11 11 * the terms of the GNU General Public License version 3 as published by the
12 12 * Free Software Foundation.
13   - *
  13 + *
14 14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 17 * details.
18   - *
  18 + *
19 19 * You should have received a copy of the GNU General Public License
20 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21   - *
22   - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
  21 + *
  22 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
23 23 * California 94120-7775, or email info@knowledgetree.com.
24   - *
  24 + *
25 25 * The interactive user interfaces in modified source and object code versions
26 26 * of this program must display Appropriate Legal Notices, as required under
27 27 * Section 5 of the GNU General Public License version 3.
28   - *
  28 + *
29 29 * In accordance with Section 7(b) of the GNU General Public License version 3,
30 30 * these Appropriate Legal Notices must retain the display of the "Powered by
31   - * KnowledgeTree" logo and retain the original copyright notice. If the display of the
  31 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
32 32 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
33   - * must display the words "Powered by KnowledgeTree" and retain the original
  33 + * must display the words "Powered by KnowledgeTree" and retain the original
34 34 * copyright notice.
35 35 * Contributor( s): ______________________________________
36 36 *
... ... @@ -49,17 +49,17 @@ class PreferencesDispatcher extends KTStandardDispatcher {
49 49  
50 50 function check() {
51 51 $oConfig =& KTConfig::getSingleton();
52   - if ($this->oUser->getId() == -2 ||
53   - ($oConfig->get('user_prefs/restrictPreferences', false) && !Permission::userIsSystemAdministrator($this->oUser->getId()))) {
54   - return false;
55   - }
56   - $this->aBreadcrumbs = array(array('action' => 'preferences', 'name' => _kt('Preferences')));
  52 + if ($this->oUser->getId() == -2 ||
  53 + ($oConfig->get('user_prefs/restrictPreferences', false) && !Permission::userIsSystemAdministrator($this->oUser->getId()))) {
  54 + return false;
  55 + }
  56 + $this->aBreadcrumbs = array(array('action' => 'preferences', 'name' => _kt('Preferences')));
57 57 return parent::check();
58 58 }
59   -
  59 +
60 60 function form_main() {
61 61 $oForm = new KTForm;
62   -
  62 +
63 63 $oForm->setOptions(array(
64 64 'context' => &$this,
65 65 'identifier' => 'ktcore.preferences.main',
... ... @@ -68,8 +68,8 @@ class PreferencesDispatcher extends KTStandardDispatcher {
68 68 'label' => _kt('Your Details'),
69 69 'submit_label' => _kt('Update Preferences'),
70 70 'extraargs' => $this->meldPersistQuery("","", true),
71   - ));
72   -
  71 + ));
  72 +
73 73 // widgets
74 74 $oForm->setWidgets(array(
75 75 array('ktcore.widgets.string', array(
... ... @@ -83,37 +83,37 @@ class PreferencesDispatcher extends KTStandardDispatcher {
83 83 'label' => _kt('Email Address'),
84 84 'description' => _kt('Your email address. Notifications and alerts are mailed to this address if <strong>email notifications</strong> is set below. e.g. <strong>jsmith@acme.com</strong>'),
85 85 'required' => false,
86   - 'name' => 'email_address',
87   - 'value' => sanitizeForHTML($this->oUser->getEmail()),
88   - 'autocomplete' => false)),
  86 + 'name' => 'email_address',
  87 + 'value' => sanitizeForHTML($this->oUser->getEmail()),
  88 + 'autocomplete' => false)),
89 89 array('ktcore.widgets.boolean', array(
90 90 'label' => _kt('Email Notifications'),
91 91 'description' => _kt('If this is specified then the you will receive certain notifications. If it is not set, then you will only see notifications on the <strong>Dashboard</strong>'),
92 92 'required' => false,
93   - 'name' => 'email_notifications',
94   - 'value' => $this->oUser->getEmailNotification(),
95   - 'autocomplete' => false)),
  93 + 'name' => 'email_notifications',
  94 + 'value' => $this->oUser->getEmailNotification(),
  95 + 'autocomplete' => false)),
96 96 ));
97   -
  97 +
98 98 $oForm->setValidators(array(
99 99 array('ktcore.validators.string', array(
100 100 'test' => 'name',
101 101 'output' => 'name')),
102 102 array('ktcore.validators.emailaddress', array(
103 103 'test' => 'email_address',
104   - 'output' => 'email_address')),
  104 + 'output' => 'email_address')),
105 105 array('ktcore.validators.boolean', array(
106 106 'test' => 'email_notifications',
107   - 'output' => 'email_notifications')),
  107 + 'output' => 'email_notifications')),
108 108 ));
109   -
  109 +
110 110 return $oForm;
111   -
  111 +
112 112 }
113   -
  113 +
114 114 function form_password() {
115 115 $oForm = new KTForm;
116   -
  116 +
117 117 $oForm->setOptions(array(
118 118 'context' => &$this,
119 119 'identifier' => 'ktcore.preferences.password',
... ... @@ -123,24 +123,24 @@ class PreferencesDispatcher extends KTStandardDispatcher {
123 123 'label' => _kt('Change your password'),
124 124 'submit_label' => _kt('Set password'),
125 125 'extraargs' => $this->meldPersistQuery("","", true),
126   - ));
127   -
  126 + ));
  127 +
128 128 // widgets
129 129 $oForm->setWidgets(array(
130 130 array('ktcore.widgets.password', array(
131 131 'label' => _kt('Password'),
132 132 'description' => _kt('Specify your new password.'),
133   - 'confirm_description' => _kt('Confirm the new password you specified above.'),
  133 + 'confirm_description' => _kt('Confirm the new password you specified above.'),
134 134 'confirm' => true,
135 135 'required' => true,
136 136 'name' => 'new_password',
137 137 'autocomplete' => false)),
138 138 ));
139   -
140   -
  139 +
  140 +
141 141 $KTConfig =& KTConfig::getSingleton();
142 142 $minLength = ((int) $KTConfig->get('user_prefs/passwordLength', 6));
143   -
  143 +
144 144 $oForm->setValidators(array(
145 145 array('ktcore.validators.string', array(
146 146 'test' => 'new_password',
... ... @@ -148,16 +148,16 @@ class PreferencesDispatcher extends KTStandardDispatcher {
148 148 'min_length_warning' => sprintf(_kt("Your password is too short - passwords must be at least %d characters long."), $minLength),
149 149 'output' => 'password')),
150 150 ));
151   -
  151 +
152 152 return $oForm;
153   -
  153 +
154 154 }
155 155  
156 156 function do_main() {
157 157 $this->oPage->setBreadcrumbDetails(_kt("Your Preferences"));
158 158 $this->oPage->title = _kt("Dashboard");
159 159 $oUser =& $this->oUser;
160   -
  160 +
161 161 $oForm = $this->form_main();
162 162  
163 163 $oTemplating =& KTTemplating::getSingleton();
... ... @@ -172,22 +172,22 @@ class PreferencesDispatcher extends KTStandardDispatcher {
172 172 'edit_form' => $oForm,
173 173 "show_password" => $bChangePassword,
174 174 );
175   - return $oTemplate->render($aTemplateData);
  175 + return $oTemplate->render($aTemplateData);
176 176 }
177 177  
178 178 function do_setPassword() {
179 179 $this->oPage->setBreadcrumbDetails(_kt("Your Password"));
180 180 $this->oPage->title = _kt("Dashboard");
181   -
  181 +
182 182 $oForm = $this->form_password();
183   -
  183 +
184 184 $oTemplating =& KTTemplating::getSingleton();
185 185 $oTemplate = $oTemplating->loadTemplate("ktcore/principals/password");
186 186 $aTemplateData = array(
187 187 "context" => $this,
188 188 'form' => $oForm,
189 189 );
190   - return $oTemplate->render($aTemplateData);
  190 + return $oTemplate->render($aTemplateData);
191 191 }
192 192  
193 193  
... ... @@ -199,25 +199,25 @@ class PreferencesDispatcher extends KTStandardDispatcher {
199 199 $oForm->handleError();
200 200 }
201 201 $res = $res['results'];
202   -
  202 +
203 203 $this->startTransaction();
204   -
  204 +
205 205 $oUser =& $this->oUser;
206   -
207   -
208   - // FIXME this almost certainly has side-effects. do we _really_ want
209   - $oUser->setPassword(md5($res['password'])); //
210   -
211   - $res = $oUser->update();
212   -
213   -
  206 +
  207 +
  208 + // FIXME this almost certainly has side-effects. do we _really_ want
  209 + $oUser->setPassword(md5($res['password'])); //
  210 +
  211 + $res = $oUser->update();
  212 +
  213 +
214 214 if (PEAR::isError($res) || ($res == false)) {
215   - $this->errorRedirectoToMain(_kt('Failed to update user.'));
  215 + $this->errorRedirectToMain(_kt('Failed to update user.'));
216 216 }
217   -
  217 +
218 218 $this->commitTransaction();
219 219 $this->successRedirectToMain(_kt('Your password has been changed.'));
220   -
  220 +
221 221 }
222 222  
223 223  
... ... @@ -225,36 +225,36 @@ class PreferencesDispatcher extends KTStandardDispatcher {
225 225 $aErrorOptions = array(
226 226 'redirect_to' => array('main'),
227 227 );
228   -
  228 +
229 229 $oForm = $this->form_main();
230 230 $res = $oForm->validate();
231 231 if (!empty($res['errors'])) {
232 232 $oForm->handleError();
233 233 }
234   -
  234 +
235 235 $res = $res['results'];
236   -
  236 +
237 237 $this->startTransaction();
238 238 $oUser =& $this->oUser;
239 239 $oUser->setName($res['name']);
240 240 $oUser->setEmail($res['email_address']);
241 241 $oUser->setEmailNotification($res['email_notifications']);
242   -
243   -
244   -
  242 +
  243 +
  244 +
245 245 // old system used the very evil store.php.
246 246 // here we need to _force_ a limited update of the object, via a db statement.
247 247 //
248   - // $res = $oUser->update();
  248 + // $res = $oUser->update();
249 249 $res = $oUser->doLimitedUpdate(); // ignores a fix blacklist of items.
250   -
  250 +
251 251 if (PEAR::isError($res) || ($res == false)) {
252   - $this->errorRedirectoToMain(_kt('Failed to update your details.'));
  252 + $this->errorRedirectToMain(_kt('Failed to update your details.'));
253 253 }
254   -
  254 +
255 255 $this->commitTransaction();
256 256 $this->successRedirectToMain(_kt('Your details have been updated.'));
257   -
  257 +
258 258 }
259 259  
260 260  
... ...
sql/mysql/install/data.sql
... ... @@ -121,13 +121,114 @@ UNLOCK TABLES;
121 121  
122 122 LOCK TABLES `config_settings` WRITE;
123 123 /*!40000 ALTER TABLE `config_settings` DISABLE KEYS */;
124   -INSERT INTO `config_settings`(`id`,`group_name`,`item`,`type`,`value`,`helptext`,`default_value`,`can_edit`) VALUES (1,'ui','appName','','KnowledgeTree','OEM application name','KnowledgeTree',1),(2,'KnowledgeTree','schedulerInterval','','30','','30',1),(3,'dashboard','alwaysShowYCOD','boolean','default','Display the \"Your Checked-out Documents\" dashlet even when empty.','0',1),(4,'urls','graphicsUrl','','${rootUrl}/graphics','','${rootUrl}/graphics',1),(5,'urls','uiUrl','','${rootUrl}/presentation/lookAndFeel/knowledgeTree','','${rootUrl}/presentation/lookAndFeel/knowledgeTree',1),(6,'tweaks','browseToUnitFolder','boolean','default','Whether to browse to the user\'s (first) unit when first going to the browse section.','0',1),(7,'tweaks','genericMetaDataRequired','boolean','1','','1',1),(8,'tweaks','developmentWindowLog','boolean','0','','0',1),(9,'tweaks','noisyBulkOperations','boolean','default','Whether bulk operations should generate a transaction notice on each ; item, or only on the folder. Default of \"false\" indicates that only the folder transaction should occur.','0',1),(10,'email','emailServer','','none','','none',1),(11,'email','emailPort','','default','','',1),(12,'email','emailAuthentication','boolean','0','Do you need auth to connect to SMTP?\r\n','0',1),(13,'email','emailUsername','','username','','username',1),(14,'email','emailPassword','','password','','password',1),(15,'email','emailFrom','','kt@example.org','','kt@example.org',1),(16,'email','emailFromName','','KnowledgeTree Document Management System','','KnowledgeTree Document Management System',1),(17,'email','allowAttachment','boolean','default','Set to true to allow users to send attachments from the document\r\n management system\r\n.','0',1),(18,'email','allowEmailAddresses','boolean','default','Set to true to allow users to send to any email address, as opposed to\r\n only users of the system\r\n.','0',1),(19,'email','sendAsSystem','boolean','default','Set to true to always send email from the emailFrom address listed above, even if there is an identifiable sending user\r\n.','0',1),(20,'email','onlyOwnGroups','boolean','default','Set to true to only allow users to send emails to those in the same\r\n groups as them\r\n.','0',1),(21,'user_prefs','passwordLength','','6','Minimum password length on password-setting\r\n','6',1),(22,'user_prefs','restrictAdminPasswords','boolean','default','Apply the minimum password length to admin while creating / editing accounts?\r\n default is set to \"false\" meaning that admins can create users with shorter passwords.\r\n','0',1),
125   -(23,'user_prefs','restrictPreferences','boolean','0','Restrict users from accessing their preferences menus?\r\n','0',1),(24,'session','sessionTimeout','','1200','Session timeout (in seconds)\r\n','1200',1),(25,'session','allowAnonymousLogin','boolean','0','By default, do not auto-login users as anonymous.\r\n Set this to true if you UNDERSTAND the security system that KT\r\n uses, and have sensibly applied the roles \"Everyone\" and \"Authenticated Users\".\r\n','0',1),(26,'ui','companyLogo','','${rootUrl}/resources/companylogo.png','Add the logo of your company to the site\'s appearance. This logo MUST be 50px tall, and on a white background.\r\n','${rootUrl}/resources/companylogo.png',1),(27,'ui','companyLogoWidth','','313px','The logo\'s width in pixels\r\n','313px',1),(28,'ui','companyLogoTitle','','ACME Corporation','ALT text - for accessibility purposes.\r\n','ACME Corporation',1),(29,'ui','alwaysShowAll','boolean','0','Do not restrict to searches (e.g. always show_all) on users and groups pages.\r\n','0',1),(30,'ui','condensedAdminUI','boolean','0','Use a condensed admin ui\r\n?','0',1),(31,'ui','fakeMimetype','boolean','0','Allow \"open\" from downloads. Changing this to \"true\" will prevent (most)\r\n browsers from giving users the \"open\" option.\r\n','0',1),(32,'ui','metadata_sort','boolean','0','Sort the metadata fields alphabetically\r\n','1',1),(33,'i18n','useLike','boolean','default','If your language doesn\'t have distinguishable words (usually, doesn\'t\r\n have a space character), set useLike to true to use a search that can\r\n deal with this, but which is slower.\r\n','0',1),(34,'import','unzip','','unzip','Unzip command - will use execSearchPath to find if the path to the binary is not given\r\n.','unzip',1),(35,'export','zip','','zip','Zip command - will use execSearchPath to find if the path to the\r\n binary is not given\r\n.','zip',1),(36,'externalBinary','xls2csv','','xls2csv','','xls2csv',1),
126   -(37,'externalBinary','pdftotext','','pdftotext','','pdftotext',1),(38,'externalBinary','catppt','','catppt','','catppt',1),(39,'externalBinary','pstotext','','pstotext','','pstotext',1),(40,'externalBinary','catdoc','','catdoc','','catdoc',1),(41,'externalBinary','antiword','','antiword','','antiword',1),(42,'externalBinary','python','','python','','python',1),(43,'externalBinary','java','','java','','java',1),(44,'externalBinary','php','','php','','php',1),(45,'externalBinary','df','','df','','df',1),(46,'cache','proxyCacheDirectory','','${varDirectory}/proxies','','${varDirectory}/proxies',1),(47,'cache','proxyCacheEnabled','boolean','1','','1',1),(48,'KTWebDAVSettings','debug','','off','This section is for KTWebDAV only, _LOTS_ of debug info will be logged if the following is \"on\"\r\n','off',1),(49,'KTWebDAVSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\".','on',1),(50,'BaobabSettings','debug','','off','This section is for Baobab only\r\n, _LOTS_ of debug info will be logged if the following is \"on\"\r\n.','off',1),(51,'BaobabSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\" below\r\n.','on',1),(52,'search','searchBasePath','','${fileSystemRoot}/search2','','${fileSystemRoot}/search2',1),(53,'search','fieldsPath','','${searchBasePath}/search/fields','','${searchBasePath}/search/fields',1),(54,'search','resultsDisplayFormat','','searchengine','The format in which to display the results\r\n options are searchengine or browseview defaults to searchengine\r\n.','searchengine',1),(55,'search','resultsPerPage','','50','The number of results per page\r\n, defaults to 25\r\n','25',1),(56,'search','dateFormat','','Y-m-d','The date format used when making queries using widgets\r\n, defaults to Y-m-d\r\n','Y-m-d',1),(57,'browse','previewActivation','','default','The document info box / preview is activated by mousing over or clicking on the icon\r\n. Options: mouse-over (default) or onclick\r\n.','mouse-over',1),
127   -(58,'indexer','coreClass','','JavaXMLRPCLuceneIndexer','The core indexing class\r\n. Choices: JavaXMLRPCLuceneIndexer or PHPLuceneIndexer.','JavaXMLRPCLuceneIndexer',1),(59,'indexer','batchDocuments','','20','The number of documents to be indexed in a cron session, defaults to 20\r\n.','20',1),(60,'indexer','batchMigrateDocuments','','500','The number of documents to be migrated in a cron session, defaults to 500\r\n.','500',1),(61,'indexer','indexingBasePath','','${searchBasePath}/indexing','','${searchBasePath}/indexing',1),(62,'indexer','luceneDirectory','','${varDirectory}/indexes','The location of the lucene indexes\r\n.','${varDirectory}/indexes',1),(63,'indexer','extractorPath','','${indexingBasePath}/extractors','','${indexingBasePath}/extractors',1),(64,'indexer','extractorHookPath','','${indexingBasePath}/extractorHooks','','${indexingBasePath}/extractorHooks',1),(65,'indexer','javaLuceneURL','','http://127.0.0.1:8875','The url for the Java Lucene Server. This should match up the the Lucene Server configuration. Defaults to http://127.0.0.1:8875\r\n','http://127.0.0.1:8875',1),(66,'openoffice','host','','default','The host on which open office is installed\r\n. Defaults to 127.0.0.1\r\n','127.0.0.1',1),(67,'openoffice','port','','default','The port on which open office is listening. Defaults to 8100\r\n','8100',1),(68,'webservice','uploadDirectory','','${varDirectory}/uploads','Directory to which all uploads via webservices are persisted before moving into the repository\r\n.','${varDirectory}/uploads',1),
128   -(69,'webservice','downloadUrl','','${rootUrl}/ktwebservice/download.php','Url which is sent to clients via web service calls so they can then download file via HTTP GET\r\n.','${rootUrl}/ktwebservice/download.php',1),(70,'webservice','uploadExpiry','','30','Period indicating how long a file should be retained in the uploads directory.\r\n','30',1),(71,'webservice','downloadExpiry','','30','Period indicating how long a download link will be available.','30',1),(72,'webservice','randomKeyText','','bkdfjhg23yskjdhf2iu','Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.\r\n','bkdfjhg23yskjdhf2iu',1),(73,'webservice','validateSessionCount','boolean','0','Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.\r\n','0',1),(74,'webservice','useDefaultDocumentTypeIfInvalid','boolean','1','If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.\r\n','1',1),(75,'webservice','debug','boolean','0','The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.\r\n Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.\r\n','0',1),(76,'clientToolPolicies','explorerMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a\r\n document is added to knowledgetree via KTtools. It defaults to true.\r\n','1',1),(77,'clientToolPolicies','officeMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a document is added to knowledgetree via KTtools. It defaults to true.','1',1),
129   -(78,'clientToolPolicies','captureReasonsDelete','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(79,'clientToolPolicies','captureReasonsCheckin','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(80,'clientToolPolicies','captureReasonsCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(81,'clientToolPolicies','captureReasonsCancelCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(82,'clientToolPolicies','captureReasonsCopyInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),(83,'clientToolPolicies','captureReasonsMoveInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
130   -(84,'clientToolPolicies','allowRememberPassword','boolean','1','This setting governs whether the password can be stored on the client or not.','1',1),(85,'DiskUsage','warningThreshold','','10','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in ORANGE\r\n.','10',1),(86,'DiskUsage','urgentThreshold','','5','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in RED\r\n.','5',1),(87,'KnowledgeTree','useNewDashboard','','default','','1',1),(88,'i18n','defaultLanguage','','en','Default language for the interface\r\n.','en',1),(89,'CustomErrorMessages','customerrormessages','','off','Turn custom error messages on or off here','on',1),(90,'CustomErrorMessages','customerrorpagepath','','customerrorpage.php','Name or url of custom error page\r\n.','customerrorpage.php',1),(91,'CustomErrorMessages','customerrorhandler','','off','Turn custom error handler on or off','on',1),(92,'ui','morphEnabled','boolean','0','Enable Morph','0',1),(93,'ui','morphTo','','blue','Morph Theme\r\n','blue',1),(94,'KnowledgeTree','logLevel','','default','Choice: INFO or DEBUG','INFO',1),(95,'storage','manager','','default','','KTOnDiskHashedStorageManager',1),(96,'ui','ieGIF','boolean','0','','1',1),(97,'ui','automaticRefresh','boolean','0','','0',1),(98,'ui','dot','','dot','','dot',1),(99,'tweaks','phpErrorLogFile','boolean','default','If you want to enable PHP error logging to the log/php_error_log file, change this setting to true\r\n.','0',1),(100,'urls','logDirectory','','default','','${varDirectory}/log',1),(101,'urls','uiDirectory','','default','','${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree',1),(102,'urls','tmpDirectory','','default','','${varDirectory}/tmp',1),(103,'urls','stopwordsFile','','default','','${fileSystemRoot}/config/stopwords.txt',1),(104,'cache','cacheEnabled','boolean','default','','0',1),(105,'cache','cacheDirectory','','default','','${varDirectory}/cache',1),(106,'cache','cachePlugins','boolean','default','','1',1),(107,'urls','varDirectory','','default','','${fileSystemRoot}/var',1);
  124 +INSERT INTO `config_settings`(`id`,`group_name`,`item`,`type`,`value`,`helptext`,`default_value`,`can_edit`) VALUES
  125 +(1,'ui','appName','','KnowledgeTree','OEM application name','KnowledgeTree',1),
  126 +(2,'KnowledgeTree','schedulerInterval','','30','','30',1),
  127 +(3,'dashboard','alwaysShowYCOD','boolean','default','Display the \"Your Checked-out Documents\" dashlet even when empty.','0',1),
  128 +(4,'urls','graphicsUrl','','${rootUrl}/graphics','','${rootUrl}/graphics',1),
  129 +(5,'urls','uiUrl','','${rootUrl}/presentation/lookAndFeel/knowledgeTree','','${rootUrl}/presentation/lookAndFeel/knowledgeTree',1),
  130 +(6,'tweaks','browseToUnitFolder','boolean','default','Whether to browse to the user\'s (first) unit when first going to the browse section.','0',1),
  131 +(7,'tweaks','genericMetaDataRequired','boolean','1','','1',1),
  132 +(8,'tweaks','developmentWindowLog','boolean','0','','0',1),
  133 +(9,'tweaks','noisyBulkOperations','boolean','default','Whether bulk operations should generate a transaction notice on each ; item, or only on the folder. Default of \"false\" indicates that only the folder transaction should occur.','0',1),
  134 +(10,'email','emailServer','','none','','none',1),
  135 +(11,'email','emailPort','','default','','',1),
  136 +(12,'email','emailAuthentication','boolean','0','Do you need auth to connect to SMTP?\r\n','0',1),
  137 +(13,'email','emailUsername','','username','','username',1),
  138 +(14,'email','emailPassword','','password','','password',1),
  139 +(15,'email','emailFrom','','kt@example.org','','kt@example.org',1),
  140 +(16,'email','emailFromName','','KnowledgeTree Document Management System','','KnowledgeTree Document Management System',1),
  141 +(17,'email','allowAttachment','boolean','default','Set to true to allow users to send attachments from the document\r\n management system\r\n.','0',1),
  142 +(18,'email','allowEmailAddresses','boolean','default','Set to true to allow users to send to any email address, as opposed to\r\n only users of the system\r\n.','0',1),(19,'email','sendAsSystem','boolean','default','Set to true to always send email from the emailFrom address listed above, even if there is an identifiable sending user\r\n.','0',1),
  143 +(20,'email','onlyOwnGroups','boolean','default','Set to true to only allow users to send emails to those in the same\r\n groups as them\r\n.','0',1),
  144 +(21,'user_prefs','passwordLength','','6','Minimum password length on password-setting\r\n','6',1),
  145 +(22,'user_prefs','restrictAdminPasswords','boolean','default','Apply the minimum password length to admin while creating / editing accounts?\r\n default is set to \"false\" meaning that admins can create users with shorter passwords.\r\n','0',1),
  146 +(23,'user_prefs','restrictPreferences','boolean','0','Restrict users from accessing their preferences menus?\r\n','0',1),
  147 +(24,'session','sessionTimeout','','1200','Session timeout (in seconds)\r\n','1200',1),
  148 +(25,'session','allowAnonymousLogin','boolean','0','By default, do not auto-login users as anonymous.\r\n Set this to true if you UNDERSTAND the security system that KT\r\n uses, and have sensibly applied the roles \"Everyone\" and \"Authenticated Users\".\r\n','0',1),
  149 +(26,'ui','companyLogo','','${rootUrl}/resources/companylogo.png','Add the logo of your company to the site\'s appearance. This logo MUST be 50px tall, and on a white background.\r\n','${rootUrl}/resources/companylogo.png',1),
  150 +(27,'ui','companyLogoWidth','','313px','The logo\'s width in pixels\r\n','313px',1),
  151 +(28,'ui','companyLogoTitle','','ACME Corporation','ALT text - for accessibility purposes.\r\n','ACME Corporation',1),
  152 +(29,'ui','alwaysShowAll','boolean','0','Do not restrict to searches (e.g. always show_all) on users and groups pages.\r\n','0',1),
  153 +(30,'ui','condensedAdminUI','boolean','0','Use a condensed admin ui\r\n?','0',1),
  154 +(31,'ui','fakeMimetype','boolean','0','Allow \"open\" from downloads. Changing this to \"true\" will prevent (most)\r\n browsers from giving users the \"open\" option.\r\n','0',1),
  155 +(32,'ui','metadata_sort','boolean','0','Sort the metadata fields alphabetically\r\n','1',1),
  156 +(33,'i18n','useLike','boolean','default','If your language doesn\'t have distinguishable words (usually, doesn\'t\r\n have a space character), set useLike to true to use a search that can\r\n deal with this, but which is slower.\r\n','0',1),
  157 +(34,'import','unzip','','unzip','Unzip command - will use execSearchPath to find if the path to the binary is not given\r\n.','unzip',1),
  158 +(35,'export','zip','','zip','Zip command - will use execSearchPath to find if the path to the\r\n binary is not given\r\n.','zip',1),
  159 +(36,'externalBinary','xls2csv','','xls2csv','','xls2csv',1),
  160 +(37,'externalBinary','pdftotext','','pdftotext','','pdftotext',1),
  161 +(38,'externalBinary','catppt','','catppt','','catppt',1),
  162 +(39,'externalBinary','pstotext','','pstotext','','pstotext',1),
  163 +(40,'externalBinary','catdoc','','catdoc','','catdoc',1),
  164 +(41,'externalBinary','antiword','','antiword','','antiword',1),
  165 +(42,'externalBinary','python','','python','','python',1),
  166 +(43,'externalBinary','java','','java','','java',1),
  167 +(44,'externalBinary','php','','php','','php',1),
  168 +(45,'externalBinary','df','','df','','df',1),
  169 +(46,'cache','proxyCacheDirectory','','${varDirectory}/proxies','','${varDirectory}/proxies',1),
  170 +(47,'cache','proxyCacheEnabled','boolean','1','','1',1),
  171 +(48,'KTWebDAVSettings','debug','','off','This section is for KTWebDAV only, _LOTS_ of debug info will be logged if the following is \"on\"\r\n','off',1),
  172 +(49,'KTWebDAVSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\".','on',1),
  173 +(50,'BaobabSettings','debug','','off','This section is for Baobab only\r\n, _LOTS_ of debug info will be logged if the following is \"on\"\r\n.','off',1),
  174 +(51,'BaobabSettings','safemode','','on','To allow write access to WebDAV clients set safe mode to \"off\" below\r\n.','on',1),
  175 +(52,'search','searchBasePath','','${fileSystemRoot}/search2','','${fileSystemRoot}/search2',1),
  176 +(53,'search','fieldsPath','','${searchBasePath}/search/fields','','${searchBasePath}/search/fields',1),
  177 +(54,'search','resultsDisplayFormat','','searchengine','The format in which to display the results\r\n options are searchengine or browseview defaults to searchengine\r\n.','searchengine',1),
  178 +(55,'search','resultsPerPage','','50','The number of results per page\r\n, defaults to 25\r\n','25',1),
  179 +(56,'search','dateFormat','','Y-m-d','The date format used when making queries using widgets\r\n, defaults to Y-m-d\r\n','Y-m-d',1),
  180 +(57,'browse','previewActivation','','default','The document info box / preview is activated by mousing over or clicking on the icon\r\n. Options: mouse-over (default) or onclick\r\n.','mouse-over',1),
  181 +(58,'indexer','coreClass','','JavaXMLRPCLuceneIndexer','The core indexing class\r\n. Choices: JavaXMLRPCLuceneIndexer or PHPLuceneIndexer.','JavaXMLRPCLuceneIndexer',1),
  182 +(59,'indexer','batchDocuments','','20','The number of documents to be indexed in a cron session, defaults to 20\r\n.','20',1),
  183 +(60,'indexer','batchMigrateDocuments','','500','The number of documents to be migrated in a cron session, defaults to 500\r\n.','500',1),
  184 +(61,'indexer','indexingBasePath','','${searchBasePath}/indexing','','${searchBasePath}/indexing',1),
  185 +(62,'indexer','luceneDirectory','','${varDirectory}/indexes','The location of the lucene indexes\r\n.','${varDirectory}/indexes',1),
  186 +(63,'indexer','extractorPath','','${indexingBasePath}/extractors','','${indexingBasePath}/extractors',1),
  187 +(64,'indexer','extractorHookPath','','${indexingBasePath}/extractorHooks','','${indexingBasePath}/extractorHooks',1),
  188 +(65,'indexer','javaLuceneURL','','http://127.0.0.1:8875','The url for the Java Lucene Server. This should match up the the Lucene Server configuration. Defaults to http://127.0.0.1:8875\r\n','http://127.0.0.1:8875',1),
  189 +(66,'openoffice','host','','default','The host on which open office is installed\r\n. Defaults to 127.0.0.1\r\n','127.0.0.1',1),
  190 +(67,'openoffice','port','','default','The port on which open office is listening. Defaults to 8100\r\n','8100',1),
  191 +(68,'webservice','uploadDirectory','','${varDirectory}/uploads','Directory to which all uploads via webservices are persisted before moving into the repository\r\n.','${varDirectory}/uploads',1),
  192 +(69,'webservice','downloadUrl','','${rootUrl}/ktwebservice/download.php','Url which is sent to clients via web service calls so they can then download file via HTTP GET\r\n.','${rootUrl}/ktwebservice/download.php',1),
  193 +(70,'webservice','uploadExpiry','','30','Period indicating how long a file should be retained in the uploads directory.\r\n','30',1),
  194 +(71,'webservice','downloadExpiry','','30','Period indicating how long a download link will be available.','30',1),
  195 +(72,'webservice','randomKeyText','','bkdfjhg23yskjdhf2iu','Random text used to construct a hash. This can be customised on installations so there is less chance of overlap between installations.\r\n','bkdfjhg23yskjdhf2iu',1),
  196 +(73,'webservice','validateSessionCount','boolean','0','Validating session counts can interfere with access. It is best to leave this disabled, unless very strict access is required.\r\n','0',1),
  197 +(74,'webservice','useDefaultDocumentTypeIfInvalid','boolean','1','If the document type is invalid when adding a document, we can be tollerant and just default to the Default document type.\r\n','1',1),
  198 +(75,'webservice','debug','boolean','0','The web service debugging if the logLevel is set to DEBUG. We can set the value to 4 or 5 to get more verbose web service logging.\r\n Level 4 logs the name of functions being accessed. Level 5 logs the SOAP XML requests and responses.\r\n','0',1),
  199 +(76,'clientToolPolicies','explorerMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a\r\n document is added to knowledgetree via KTtools. It defaults to true.\r\n','1',1),
  200 +(77,'clientToolPolicies','officeMetadataCapture','boolean','1','This setting is one of two which control whether or not the client is prompted for metadata when a document is added to knowledgetree via KTtools. It defaults to true.','1',1),
  201 +(78,'clientToolPolicies','captureReasonsDelete','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  202 +(79,'clientToolPolicies','captureReasonsCheckin','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  203 +(80,'clientToolPolicies','captureReasonsCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  204 +(81,'clientToolPolicies','captureReasonsCancelCheckout','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  205 +(82,'clientToolPolicies','captureReasonsCopyInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  206 +(83,'clientToolPolicies','captureReasonsMoveInKT','boolean','1','This setting is one of six which govern whether reasons are asked for in KTtools\r\n.','1',1),
  207 +(84,'clientToolPolicies','allowRememberPassword','boolean','1','This setting governs whether the password can be stored on the client or not.','1',1),
  208 +(85,'DiskUsage','warningThreshold','','10','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in ORANGE\r\n.','10',1),
  209 +(86,'DiskUsage','urgentThreshold','','5','When free space in a mount point is less than this percentage, the disk usage dashlet will highlight the mount in RED\r\n.','5',1),
  210 +(87,'KnowledgeTree','useNewDashboard','','default','','1',1),
  211 +(88,'i18n','defaultLanguage','','en','Default language for the interface\r\n.','en',1),
  212 +(89,'CustomErrorMessages','customerrormessages','','off','Turn custom error messages on or off here','on',1),
  213 +(90,'CustomErrorMessages','customerrorpagepath','','customerrorpage.php','Name or url of custom error page\r\n.','customerrorpage.php',1),
  214 +(91,'CustomErrorMessages','customerrorhandler','','off','Turn custom error handler on or off','on',1),
  215 +(92,'ui','morphEnabled','boolean','0','Enable Morph','0',1),
  216 +(93,'ui','morphTo','','blue','Morph Theme\r\n','blue',1),
  217 +(94,'KnowledgeTree','logLevel','','default','Choice: INFO or DEBUG','INFO',1),
  218 +(95,'storage','manager','','default','','KTOnDiskHashedStorageManager',1),
  219 +(96,'ui','ieGIF','boolean','0','','1',1),
  220 +(97,'ui','automaticRefresh','boolean','0','','0',1),
  221 +(98,'ui','dot','','dot','','dot',1),
  222 +(99,'tweaks','phpErrorLogFile','boolean','default','If you want to enable PHP error logging to the log/php_error_log file, change this setting to true\r\n.','0',1),
  223 +(100,'urls','logDirectory','','default','','${varDirectory}/log',1),
  224 +(101,'urls','uiDirectory','','default','','${fileSystemRoot}/presentation/lookAndFeel/knowledgeTree',1),
  225 +(102,'urls','tmpDirectory','','default','','${varDirectory}/tmp',1),
  226 +(103,'urls','stopwordsFile','','default','','${fileSystemRoot}/config/stopwords.txt',1),
  227 +(104,'cache','cacheEnabled','boolean','default','','0',1),
  228 +(105,'cache','cacheDirectory','','default','','${varDirectory}/cache',1),
  229 +(106,'cache','cachePlugins','boolean','default','','1',1),
  230 +(107,'urls','varDirectory','','default','','${fileSystemRoot}/var',1),
  231 +(108,'urls','documentRoot','','default','','${varDirectory}/Documents',0);
131 232 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
132 233 UNLOCK TABLES;
133 234  
... ... @@ -830,8 +931,9 @@ INSERT INTO `scheduler_tasks` VALUES
830 931 (4,'Periodic Document Expunge','bin/expungeall.php','',0,'weekly','2007-10-01',NULL,0,'disabled'),
831 932 (5,'Database Maintenance','bin/dbmaint.php','optimize',0,'monthly','2007-10-01',NULL,0,'disabled'),
832 933 (6,'Open Office test','bin/checkopenoffice.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
833   -(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled');
834   -
  934 +(7,'Cleanup Temporary Directory','search2/bin/cronCleanup.php','',0,'1min','2007-10-01',NULL,0,'enabled'),
  935 +(8,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled'),
  936 +(9,'Check Latest Version','plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php','',0,'daily','2007-10-01',NULL,0,'enabled');
835 937 /*!40000 ALTER TABLE `scheduler_tasks` ENABLE KEYS */;
836 938 UNLOCK TABLES;
837 939  
... ... @@ -1745,7 +1847,7 @@ UNLOCK TABLES;
1745 1847  
1746 1848 LOCK TABLES `zseq_scheduler_tasks` WRITE;
1747 1849 /*!40000 ALTER TABLE `zseq_scheduler_tasks` DISABLE KEYS */;
1748   -INSERT INTO `zseq_scheduler_tasks` VALUES (7);
  1850 +INSERT INTO `zseq_scheduler_tasks` VALUES (9);
1749 1851 /*!40000 ALTER TABLE `zseq_scheduler_tasks` ENABLE KEYS */;
1750 1852 UNLOCK TABLES;
1751 1853  
... ...
sql/mysql/upgrade/3.5.2/zdashboard_tasks.sql 0 → 100644
  1 +select @id:=max(id)+1 from scheduler_tasks;
  2 +INSERT INTO `scheduler_tasks` VALUES (@id,'Disk Usage and Folder Utilisation Statistics','plugins/housekeeper/bin/UpdateStats.php','',0,'5mins','2007-10-01',NULL,0,'enabled');
  3 +
  4 +select @id:=max(id)+1 from scheduler_tasks;
  5 +INSERT INTO `scheduler_tasks` VALUES (@id,'Check Latest Version','plugins/ktstandard/AdminVersionPlugin/bin/UpdateNewVersion.php','',0,'daily','2007-10-01',NULL,0,'enabled');
  6 +
  7 +UPDATE zseq_scheduler_tasks set id=@id;
0 8 \ No newline at end of file
... ...