Commit c7c468a26b6412c0174a8dc34a54736279a37971

Authored by Mark Holtzhausen
2 parents 85ea5df9 43fac341

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

plugins/thumbnails/thumbnails.php
@@ -154,14 +154,14 @@ class thumbnailGenerator extends BaseProcessor @@ -154,14 +154,14 @@ class thumbnailGenerator extends BaseProcessor
154 $pdfDir = $default->pdfDirectory; 154 $pdfDir = $default->pdfDirectory;
155 $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf'; 155 $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf';
156 } 156 }
157 - 157 +
158 $thumbnaildir = $default->internalVarDirectory.DIRECTORY_SEPARATOR.'thumbnails'; 158 $thumbnaildir = $default->internalVarDirectory.DIRECTORY_SEPARATOR.'thumbnails';
159 159
160 if (stristr(PHP_OS,'WIN')) { 160 if (stristr(PHP_OS,'WIN')) {
161 $thumbnaildir = str_replace('/', '\\', $thumbnaildir); 161 $thumbnaildir = str_replace('/', '\\', $thumbnaildir);
162 $pdfFile = str_replace('/', '\\', $pdfFile); 162 $pdfFile = str_replace('/', '\\', $pdfFile);
163 } 163 }
164 - 164 +
165 $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg'; 165 $thumbnailfile = $thumbnaildir.DIRECTORY_SEPARATOR.$this->document->iId.'.jpg';
166 //if thumbail dir does not exist, generate one and add an index file to block access 166 //if thumbail dir does not exist, generate one and add an index file to block access
167 if (!file_exists($thumbnaildir)) { 167 if (!file_exists($thumbnaildir)) {
@@ -225,11 +225,11 @@ class ThumbnailViewlet extends KTDocumentViewlet { @@ -225,11 +225,11 @@ class ThumbnailViewlet extends KTDocumentViewlet {
225 global $default; 225 global $default;
226 $varDir = $default->internalVarDirectory; 226 $varDir = $default->internalVarDirectory;
227 $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; 227 $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg';
228 - 228 +
229 if (stristr(PHP_OS,'WIN')) { 229 if (stristr(PHP_OS,'WIN')) {
230 $varDir = str_replace('/', '\\', $varDir); 230 $varDir = str_replace('/', '\\', $varDir);
231 } 231 }
232 - 232 +
233 $thumbnailCheck = $varDir . '/thumbnails/'.$documentId.'.jpg'; 233 $thumbnailCheck = $varDir . '/thumbnails/'.$documentId.'.jpg';
234 234
235 // if the thumbnail doesn't exist try to create it 235 // if the thumbnail doesn't exist try to create it
@@ -266,8 +266,12 @@ class ThumbnailViewlet extends KTDocumentViewlet { @@ -266,8 +266,12 @@ class ThumbnailViewlet extends KTDocumentViewlet {
266 global $default; 266 global $default;
267 $varDir = $default->internalVarDirectory; 267 $varDir = $default->internalVarDirectory;
268 $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg'; 268 $thumbnailfile = $varDir . '/thumbnails/'.$documentId.'.jpg';
269 - $size = getimagesize($thumbnailfile);  
270 - return $size[0]; 269 + if(file_exists($thumbnailfile)){
  270 + return 200;
  271 + }
  272 + return 0;
  273 + //$size = getimagesize($thumbnailfile);
  274 + //return $size[0];
271 } 275 }
272 } 276 }
273 277
thirdparty/pear/File/Gettext/PO.php
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 3
4 /** 4 /**
5 * File::Gettext 5 * File::Gettext
6 - * 6 + *
7 * PHP versions 4 and 5 7 * PHP versions 4 and 5
8 * 8 *
9 * @category FileFormats 9 * @category FileFormats
@@ -20,11 +20,11 @@ @@ -20,11 +20,11 @@
20 */ 20 */
21 require_once 'File/Gettext.php'; 21 require_once 'File/Gettext.php';
22 22
23 -/** 23 +/**
24 * File_Gettext_PO 24 * File_Gettext_PO
25 * 25 *
26 * GNU PO file reader and writer. 26 * GNU PO file reader and writer.
27 - * 27 + *
28 * @author Michael Wallner <mike@php.net> 28 * @author Michael Wallner <mike@php.net>
29 * @version $Revision$ 29 * @version $Revision$
30 * @access public 30 * @access public
@@ -55,7 +55,7 @@ class File_Gettext_PO extends File_Gettext @@ -55,7 +55,7 @@ class File_Gettext_PO extends File_Gettext
55 if (!isset($file)) { 55 if (!isset($file)) {
56 $file = $this->file; 56 $file = $this->file;
57 } 57 }
58 - 58 +
59 // load file 59 // load file
60 if (!$contents = @file($file)) { 60 if (!$contents = @file($file)) {
61 return parent::raiseError($php_errormsg . ' ' . $file); 61 return parent::raiseError($php_errormsg . ' ' . $file);
@@ -65,6 +65,35 @@ class File_Gettext_PO extends File_Gettext @@ -65,6 +65,35 @@ class File_Gettext_PO extends File_Gettext
65 $aMatches = array(); 65 $aMatches = array();
66 66
67 foreach ($contents as $line) { 67 foreach ($contents as $line) {
  68 + /*
  69 + Replaced the regular expressions to get translations working on windows.
  70 + */
  71 + if (preg_match('/^msgid(.*)$/', $line, $aMatches)) {
  72 + if ($msgid) {
  73 + $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
  74 + }
  75 + $msgid = trim($aMatches[1]);
  76 + $msgid = substr($msgid, 1, strlen($msgid) - 2);
  77 + $msgstr = "";
  78 + $msgstr_started = false;
  79 + }
  80 + //#^msgstr "(.*)"$#
  81 + if (preg_match('/^msgstr(.*)$/', $line, $aMatches)) {
  82 + $msgstr = trim($aMatches[1]);
  83 + $msgstr = substr($msgstr, 1, strlen($msgstr) - 2);
  84 + $msgstr_started = true;
  85 + }
  86 + //#^"(.*)"$#
  87 + if (preg_match('/^"(.*)"$/', $line, $aMatches)) {
  88 + if ($msgstr_started) {
  89 + $tmp = trim($aMatches[1]);
  90 + $msgstr .= substr($tmp, 1, strlen($tmp) - 2);
  91 + } else {
  92 + $tmp = trim($aMatches[1]);
  93 + $msgid .= substr($tmp, 1, strlen($tmp) - 2);
  94 + }
  95 + }
  96 + /* Original code
68 if (preg_match('#^msgid "(.*)"$#', $line, $aMatches)) { 97 if (preg_match('#^msgid "(.*)"$#', $line, $aMatches)) {
69 if ($msgid) { 98 if ($msgid) {
70 $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr); 99 $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
@@ -84,6 +113,7 @@ class File_Gettext_PO extends File_Gettext @@ -84,6 +113,7 @@ class File_Gettext_PO extends File_Gettext
84 $msgid .= $aMatches[1]; 113 $msgid .= $aMatches[1];
85 } 114 }
86 } 115 }
  116 + */
87 } 117 }
88 if ($msgid) { 118 if ($msgid) {
89 $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr); 119 $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
@@ -94,10 +124,10 @@ class File_Gettext_PO extends File_Gettext @@ -94,10 +124,10 @@ class File_Gettext_PO extends File_Gettext
94 $this->meta = parent::meta2array($this->strings['']); 124 $this->meta = parent::meta2array($this->strings['']);
95 unset($this->strings['']); 125 unset($this->strings['']);
96 } 126 }
97 - 127 +
98 return true; 128 return true;
99 } 129 }
100 - 130 +
101 /** 131 /**
102 * Save PO file 132 * Save PO file
103 * 133 *
@@ -110,7 +140,7 @@ class File_Gettext_PO extends File_Gettext @@ -110,7 +140,7 @@ class File_Gettext_PO extends File_Gettext
110 if (!isset($file)) { 140 if (!isset($file)) {
111 $file = $this->file; 141 $file = $this->file;
112 } 142 }
113 - 143 +
114 // open PO file 144 // open PO file
115 if (!is_resource($fh = @fopen($file, 'w'))) { 145 if (!is_resource($fh = @fopen($file, 'w'))) {
116 return parent::raiseError($php_errormsg . ' ' . $file); 146 return parent::raiseError($php_errormsg . ' ' . $file);
@@ -120,7 +150,7 @@ class File_Gettext_PO extends File_Gettext @@ -120,7 +150,7 @@ class File_Gettext_PO extends File_Gettext
120 @fclose($fh); 150 @fclose($fh);
121 return parent::raiseError($php_errmsg . ' ' . $file); 151 return parent::raiseError($php_errmsg . ' ' . $file);
122 } 152 }
123 - 153 +
124 // write meta info 154 // write meta info
125 if (count($this->meta)) { 155 if (count($this->meta)) {
126 $meta = 'msgid ""' . "\nmsgstr " . '""' . "\n"; 156 $meta = 'msgid ""' . "\nmsgstr " . '""' . "\n";
@@ -136,7 +166,7 @@ class File_Gettext_PO extends File_Gettext @@ -136,7 +166,7 @@ class File_Gettext_PO extends File_Gettext
136 'msgstr "' . parent::prepare($t, true) . '"' . "\n\n" 166 'msgstr "' . parent::prepare($t, true) . '"' . "\n\n"
137 ); 167 );
138 } 168 }
139 - 169 +
140 //done 170 //done
141 @flock($fh, LOCK_UN); 171 @flock($fh, LOCK_UN);
142 @fclose($fh); 172 @fclose($fh);