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