Commit eca24057203e35ccb2bf73ac90e949545c12ec07

Authored by Jarrett Jordaan
2 parents 6e778ae3 00b5ac53

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

plugins/thumbnails/sql/upgradeto0.sql deleted
1   -INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit)
2   -VALUES ('externalBinary', 'convert', 'The path to the ImageMagick "convert" binary', 'convertPath', 'default', 'convert', 'string', NULL, 1);
3 0 \ No newline at end of file
plugins/thumbnails/thumbnails.php
... ... @@ -154,8 +154,14 @@ class thumbnailGenerator extends BaseProcessor
154 154 $pdfDir = $default->pdfDirectory;
155 155 $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf';
156 156 }
157   -
  157 +
  158 + $pdfFile = str_replace('/', '\\', $pdfFile);
  159 +
158 160 $thumbnaildir = $default->internalVarDirectory.DIRECTORY_SEPARATOR.'thumbnails';
  161 + if (!KTUtil::isAbsolutePath($thumbnaildir)) {
  162 + $thumbnaildir = KT_DIR . $thumbnaildir;
  163 + }
  164 + $thumbnaildir = str_replace('/', '\\', $thumbnaildir);
159 165 $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg';
160 166  
161 167 //if thumbail dir does not exist, generate one and add an index file to block access
... ... @@ -179,6 +185,7 @@ class thumbnailGenerator extends BaseProcessor
179 185 // if (extension_loaded('imagick')) {
180 186 $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';
181 187 // windows path may contain spaces
  188 +
182 189 if (WINDOWS_OS) {
183 190 $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";
184 191 }
... ... @@ -220,7 +227,7 @@ class ThumbnailViewlet extends KTDocumentViewlet {
220 227 // Check for the thumbnail
221 228 global $default;
222 229 $varDir = $default->internalVarDirectory;
223   - $thumbnailfile = $varDir . DIRECTORY_SEPARATOR . 'thumbnails'. DIRECTORY_SEPARATOR .$documentId.'.jpg';
  230 + $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg';
224 231  
225 232 // if the thumbnail doesn't exist try to create it
226 233 if (!file_exists($thumbnailfile)){
... ... @@ -228,8 +235,12 @@ class ThumbnailViewlet extends KTDocumentViewlet {
228 235 $thumbnailer->setDocument($this->oDocument);
229 236 $thumbnailer->processDocument();
230 237  
  238 + $thumbcheck = $thumbnailfile;
231 239 // if it still doesn't exist, return an empty string
232   - if (!file_exists($thumbnailfile)) {
  240 + if (!KTUtil::isAbsolutePath($thumbcheck)) {
  241 + $thumbcheck = KT_DIR . $thumbcheck;
  242 + }
  243 + if (!file_exists($thumbcheck)) {
233 244 return '';
234 245 }
235 246 }
... ... @@ -255,7 +266,7 @@ class ThumbnailViewlet extends KTDocumentViewlet {
255 266 public function get_width($documentId){
256 267 global $default;
257 268 $varDir = $default->internalVarDirectory;
258   - $thumbnailfile = $varDir . DIRECTORY_SEPARATOR.'thumbnails'.DIRECTORY_SEPARATOR.$documentId.'.jpg';
  269 + $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg';
259 270 $size = getimagesize($thumbnailfile);
260 271 return $size[0];
261 272 }
... ...
setup/wizard/steps/database.php
... ... @@ -790,22 +790,6 @@ class database extends Step
790 790 // continue without attempting to set the path if we can't find the file in the specified location
791 791 if (!file_exists(SYSTEM_ROOT . $bin[1])) continue;
792 792  
793   - // thumbnails is a special case, being a plugin which won't have an entry on a new installation
794   - if ($displayName == 'convert') {
795   - // check if there is an entry, if not, insert and continue to next loop, else continue to update statement
796   - $query = 'SELECT id FROM config_settings WHERE display_name = "' . $displayName . '"';
797   - $this->util->dbUtilities->query($query);
798   - $result = $this->util->dbUtilities->fetchAssoc();
799   - if (is_null($result)) {
800   - $query = "INSERT INTO `config_settings` "
801   - . "(group_name, display_name, description, item, value, default_value, type, options, can_edit) "
802   - . "VALUES ('" . $bin[0] . "', 'convert', 'The path to the ImageMagick \"convert\" binary', 'convertPath', "
803   - . "'" . str_replace('\\', '\\\\', SYSTEM_ROOT . $bin[1]) . "', 'convert', 'string', NULL, 1);";
804   - $this->util->dbUtilities->query($query);
805   - continue;
806   - }
807   - }
808   -
809 793 $updateBin = 'UPDATE config_settings c SET c.value = "'. str_replace('\\', '\\\\', SYSTEM_ROOT . $bin[1]) . '" '
810 794 . 'where c.group_name = "' . $bin[0] . '" and c.display_name = "'.$displayName.'";';
811 795 $this->util->dbUtilities->query($updateBin);
... ...
sql/mysql/install/data.sql
... ... @@ -290,7 +290,8 @@ INSERT INTO `config_settings` VALUES
290 290 (115, 'ldapAuthentication', 'Allow Moving Users in LDAP/AD', 'Moving users around within the LDAP or Active Directory structure will cause failed logins for these users. When this setting is enabled, a failed login will trigger a search for the user using their sAMAccountName setting and update their authentication details.', 'enableLdapUpdate', 'default', 'false', 'boolean', NULL, 1),
291 291 (116, 'export', 'Use External Zip Binary', 'Utilises the external zip binary for compressing archives. The default is to use the PEAR archive class.', 'useBinary', 'default', 'true', 'boolean', NULL, 0),
292 292 (117, 'export', 'Use Bulk Download Queue', 'The bulk download can be large and can prevent normal browsing. The download queue performs the bulk downloads in the background.', 'useDownloadQueue', 'default', 'true', 'boolean', NULL, 1),
293   -(118, 'urls', 'Internal Var Directory', 'The path to the internal var directory that must sit within the web root', 'internalVarDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 0);
  293 +(118, 'urls', 'Internal Var Directory', 'The path to the internal var directory that must sit within the web root', 'internalVarDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 0),
  294 +(119, 'urls', 'PDF Directoy', 'The path for storing the generated PDF Documents', 'pdfDirectory', 'default', '${varDirectory}/Pdf', 'string', '', 1);
294 295 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
295 296 UNLOCK TABLES;
296 297  
... ...
sql/mysql/upgrade/3.7.0/config_settings.sql
1 1 INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit)
2   -VALUES ('urls', 'Internal Var Directory', 'The path to the internal var directory that must sit within the web root', 'internalVarDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 0);
3 2 \ No newline at end of file
  3 +VALUES ('urls', 'Internal Var Directory', 'The path to the internal var directory that must sit within the web root', 'internalVarDirectory', 'default', '${fileSystemRoot}/var', 'string', NULL, 0);
  4 +
  5 +INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit)
  6 +VALUES ('urls', 'PDF Directoy', 'The path for storing the generated PDF Documents', 'pdfDirectory', 'default', '${varDirectory}/Pdf', 'string', '', 1);
4 7 \ No newline at end of file
... ...