@@ -7,16 +7,16 @@ |
||
7 | 7 | */ |
8 | 8 | class HTML_QuickForm_Rule_Date extends HTML_QuickForm_Rule |
9 | 9 | { |
10 | - /** |
|
11 | - * Check a date |
|
12 | - * @see HTML_QuickForm_Rule |
|
13 | - * @param string $date example 2014-04-30 |
|
10 | + /** |
|
11 | + * Check a date |
|
12 | + * @see HTML_QuickForm_Rule |
|
13 | + * @param string $date example 2014-04-30 |
|
14 | 14 | * @param array $options |
15 | 15 | * |
16 | - * @return boolean True if date is valid |
|
17 | - */ |
|
18 | - public function validate($date, $options) |
|
19 | - { |
|
16 | + * @return boolean True if date is valid |
|
17 | + */ |
|
18 | + public function validate($date, $options) |
|
19 | + { |
|
20 | 20 | return api_is_valid_date($date, 'Y-m-d'); |
21 | - } |
|
21 | + } |
|
22 | 22 | } |
@@ -6,24 +6,24 @@ |
||
6 | 6 | */ |
7 | 7 | class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule |
8 | 8 | { |
9 | - /** |
|
10 | - * Function to check if a username is available |
|
11 | - * @see HTML_QuickForm_Rule |
|
12 | - * @param string $username Wanted username |
|
13 | - * @param string $current_username |
|
14 | - * @return boolean True if username is available |
|
15 | - */ |
|
16 | - function validate($username, $current_username = null) { |
|
17 | - $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
9 | + /** |
|
10 | + * Function to check if a username is available |
|
11 | + * @see HTML_QuickForm_Rule |
|
12 | + * @param string $username Wanted username |
|
13 | + * @param string $current_username |
|
14 | + * @return boolean True if username is available |
|
15 | + */ |
|
16 | + function validate($username, $current_username = null) { |
|
17 | + $user_table = Database::get_main_table(TABLE_MAIN_USER); |
|
18 | 18 | $username = Database::escape_string($username); |
19 | 19 | $current_username = Database::escape_string($current_username); |
20 | 20 | |
21 | - $sql = "SELECT * FROM $user_table WHERE username = '$username'"; |
|
22 | - if (!is_null($current_username)) { |
|
23 | - $sql .= " AND username != '$current_username'"; |
|
24 | - } |
|
25 | - $res = Database::query($sql); |
|
26 | - $number = Database::num_rows($res); |
|
27 | - return $number == 0; |
|
28 | - } |
|
21 | + $sql = "SELECT * FROM $user_table WHERE username = '$username'"; |
|
22 | + if (!is_null($current_username)) { |
|
23 | + $sql .= " AND username != '$current_username'"; |
|
24 | + } |
|
25 | + $res = Database::query($sql); |
|
26 | + $number = Database::num_rows($res); |
|
27 | + return $number == 0; |
|
28 | + } |
|
29 | 29 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @return boolean True if the 2 given dates match the operator |
13 | 13 | */ |
14 | 14 | function validate($values, $operator = null) { |
15 | - $datetime1 = api_strtotime($values[0]); |
|
15 | + $datetime1 = api_strtotime($values[0]); |
|
16 | 16 | $datetime2 = api_strtotime($values[1]); |
17 | 17 | |
18 | 18 | if (strpos($operator, 'allow_empty') !== false) { |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | return true; |
22 | 22 | } |
23 | 23 | } |
24 | - $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
24 | + $result = parent::validate(array($datetime1, $datetime2), $operator); |
|
25 | 25 | return $result; |
26 | 26 | } |
27 | 27 | } |
@@ -27,10 +27,10 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
31 | - { |
|
32 | - $value = implode(null,$value); |
|
33 | - } |
|
30 | + if(is_array($value)) |
|
31 | + { |
|
32 | + $value = implode(null,$value); |
|
33 | + } |
|
34 | 34 | if ((string)$value == '') { |
35 | 35 | return false; |
36 | 36 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | class HTML_QuickForm_Rule_FileName extends HTML_QuickForm_Rule |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * @param $value array Uploaded file info (from $_FILES) |
|
14 | - * @param null $options |
|
15 | - * @return bool |
|
16 | - */ |
|
17 | - public function validate($value, $options = null) |
|
18 | - { |
|
19 | - if ((isset($elementValue['error']) && $elementValue['error'] == 0) || |
|
20 | - (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { |
|
21 | - return is_uploaded_file($elementValue['tmp_name']); |
|
22 | - } else { |
|
23 | - return false; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * @param $value array Uploaded file info (from $_FILES) |
|
14 | + * @param null $options |
|
15 | + * @return bool |
|
16 | + */ |
|
17 | + public function validate($value, $options = null) |
|
18 | + { |
|
19 | + if ((isset($elementValue['error']) && $elementValue['error'] == 0) || |
|
20 | + (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) { |
|
21 | + return is_uploaded_file($elementValue['tmp_name']); |
|
22 | + } else { |
|
23 | + return false; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |
@@ -7,22 +7,22 @@ |
||
7 | 7 | */ |
8 | 8 | class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule |
9 | 9 | { |
10 | - /** |
|
11 | - * @param $value array Uploaded file info (from $_FILES) |
|
12 | - * @param null $options |
|
13 | - * @return bool |
|
14 | - */ |
|
15 | - public function validate($elementValue, $maxSize) |
|
16 | - { |
|
17 | - if (!empty($elementValue['error']) && |
|
18 | - (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
19 | - ) { |
|
20 | - return false; |
|
21 | - } |
|
22 | - if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
23 | - return true; |
|
24 | - } |
|
10 | + /** |
|
11 | + * @param $value array Uploaded file info (from $_FILES) |
|
12 | + * @param null $options |
|
13 | + * @return bool |
|
14 | + */ |
|
15 | + public function validate($elementValue, $maxSize) |
|
16 | + { |
|
17 | + if (!empty($elementValue['error']) && |
|
18 | + (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
19 | + ) { |
|
20 | + return false; |
|
21 | + } |
|
22 | + if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
23 | + return true; |
|
24 | + } |
|
25 | 25 | |
26 | - return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
27 | - } |
|
26 | + return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
27 | + } |
|
28 | 28 | } |
@@ -6,24 +6,24 @@ |
||
6 | 6 | */ |
7 | 7 | class HTML_QuickForm_Compare_Fields extends HTML_QuickForm_Rule_Compare |
8 | 8 | { |
9 | - /** |
|
10 | - * Function to check an array of fields |
|
11 | - * @param array of field names |
|
9 | + /** |
|
10 | + * Function to check an array of fields |
|
11 | + * @param array of field names |
|
12 | 12 | * @param string operator ==, >=, etc |
13 | 13 | * @param string the value to compare |
14 | - * @return boolean True if date is valid |
|
15 | - */ |
|
16 | - function validate($values, $operator_and_max_value) { |
|
14 | + * @return boolean True if date is valid |
|
15 | + */ |
|
16 | + function validate($values, $operator_and_max_value) { |
|
17 | 17 | if (is_array($values) && !empty($values) && !empty($operator_and_max_value)) { |
18 | - $final_value = 0; |
|
19 | - foreach ($values as $value) { |
|
20 | - $final_value += $value; |
|
21 | - } |
|
22 | - $params = explode('@', $operator_and_max_value); |
|
23 | - $operator = $params[0]; |
|
24 | - $max_value = $params[1]; |
|
25 | - return parent::validate(array($final_value, $max_value), $operator); |
|
18 | + $final_value = 0; |
|
19 | + foreach ($values as $value) { |
|
20 | + $final_value += $value; |
|
21 | + } |
|
22 | + $params = explode('@', $operator_and_max_value); |
|
23 | + $operator = $params[0]; |
|
24 | + $max_value = $params[1]; |
|
25 | + return parent::validate(array($final_value, $max_value), $operator); |
|
26 | 26 | } |
27 | 27 | return false; |
28 | - } |
|
28 | + } |
|
29 | 29 | } |
30 | 30 | \ No newline at end of file |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | |
26 | 26 | function GetInt4d($data, $pos) |
27 | 27 | { |
28 | - $value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24); |
|
29 | - if ($value>=4294967294) |
|
30 | - { |
|
31 | - $value=-2; |
|
32 | - } |
|
33 | - return $value; |
|
28 | + $value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24); |
|
29 | + if ($value>=4294967294) |
|
30 | + { |
|
31 | + $value=-2; |
|
32 | + } |
|
33 | + return $value; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -45,30 +45,30 @@ discard block |
||
45 | 45 | |
46 | 46 | function read($sFileName){ |
47 | 47 | |
48 | - // check if file exist and is readable (Darko Miljanovic) |
|
49 | - if(!is_readable($sFileName)) { |
|
50 | - $this->error = 1; |
|
51 | - return false; |
|
52 | - } |
|
48 | + // check if file exist and is readable (Darko Miljanovic) |
|
49 | + if(!is_readable($sFileName)) { |
|
50 | + $this->error = 1; |
|
51 | + return false; |
|
52 | + } |
|
53 | 53 | |
54 | - $this->data = @file_get_contents($sFileName); |
|
55 | - if (!$this->data) { |
|
56 | - $this->error = 1; |
|
57 | - return false; |
|
58 | - } |
|
59 | - //echo IDENTIFIER_OLE; |
|
60 | - //echo 'start'; |
|
61 | - if (substr($this->data, 0, 8) != IDENTIFIER_OLE) { |
|
62 | - $this->error = 1; |
|
63 | - return false; |
|
64 | - } |
|
54 | + $this->data = @file_get_contents($sFileName); |
|
55 | + if (!$this->data) { |
|
56 | + $this->error = 1; |
|
57 | + return false; |
|
58 | + } |
|
59 | + //echo IDENTIFIER_OLE; |
|
60 | + //echo 'start'; |
|
61 | + if (substr($this->data, 0, 8) != IDENTIFIER_OLE) { |
|
62 | + $this->error = 1; |
|
63 | + return false; |
|
64 | + } |
|
65 | 65 | $this->numBigBlockDepotBlocks = GetInt4d($this->data, NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); |
66 | 66 | $this->sbdStartBlock = GetInt4d($this->data, SMALL_BLOCK_DEPOT_BLOCK_POS); |
67 | 67 | $this->rootStartBlock = GetInt4d($this->data, ROOT_START_BLOCK_POS); |
68 | 68 | $this->extensionBlock = GetInt4d($this->data, EXTENSION_BLOCK_POS); |
69 | 69 | $this->numExtensionBlocks = GetInt4d($this->data, NUM_EXTENSION_BLOCK_POS); |
70 | 70 | |
71 | - /* |
|
71 | + /* |
|
72 | 72 | echo $this->numBigBlockDepotBlocks." "; |
73 | 73 | echo $this->sbdStartBlock." "; |
74 | 74 | echo $this->rootStartBlock." "; |
@@ -78,16 +78,16 @@ discard block |
||
78 | 78 | //echo "sbdStartBlock = $this->sbdStartBlock\n"; |
79 | 79 | $bigBlockDepotBlocks = array(); |
80 | 80 | $pos = BIG_BLOCK_DEPOT_BLOCKS_POS; |
81 | - // echo "pos = $pos"; |
|
82 | - $bbdBlocks = $this->numBigBlockDepotBlocks; |
|
81 | + // echo "pos = $pos"; |
|
82 | + $bbdBlocks = $this->numBigBlockDepotBlocks; |
|
83 | 83 | |
84 | 84 | if ($this->numExtensionBlocks != 0) { |
85 | 85 | $bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS)/4; |
86 | 86 | } |
87 | 87 | |
88 | 88 | for ($i = 0; $i < $bbdBlocks; $i++) { |
89 | - $bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos); |
|
90 | - $pos += 4; |
|
89 | + $bigBlockDepotBlocks[$i] = GetInt4d($this->data, $pos); |
|
90 | + $pos += 4; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - // var_dump($bigBlockDepotBlocks); |
|
109 | + // var_dump($bigBlockDepotBlocks); |
|
110 | 110 | |
111 | 111 | // readBigBlockDepot |
112 | 112 | $pos = 0; |
@@ -123,26 +123,26 @@ discard block |
||
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | - //var_dump($this->bigBlockChain); |
|
126 | + //var_dump($this->bigBlockChain); |
|
127 | 127 | //echo '=====2'; |
128 | 128 | // readSmallBlockDepot(); |
129 | 129 | $pos = 0; |
130 | - $index = 0; |
|
131 | - $sbdBlock = $this->sbdStartBlock; |
|
132 | - $this->smallBlockChain = array(); |
|
130 | + $index = 0; |
|
131 | + $sbdBlock = $this->sbdStartBlock; |
|
132 | + $this->smallBlockChain = array(); |
|
133 | 133 | |
134 | - while ($sbdBlock != -2) { |
|
134 | + while ($sbdBlock != -2) { |
|
135 | 135 | |
136 | - $pos = ($sbdBlock + 1) * BIG_BLOCK_SIZE; |
|
136 | + $pos = ($sbdBlock + 1) * BIG_BLOCK_SIZE; |
|
137 | 137 | |
138 | - for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) { |
|
139 | - $this->smallBlockChain[$index] = GetInt4d($this->data, $pos); |
|
140 | - $pos += 4; |
|
141 | - $index++; |
|
142 | - } |
|
138 | + for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) { |
|
139 | + $this->smallBlockChain[$index] = GetInt4d($this->data, $pos); |
|
140 | + $pos += 4; |
|
141 | + $index++; |
|
142 | + } |
|
143 | 143 | |
144 | - $sbdBlock = $this->bigBlockChain[$sbdBlock]; |
|
145 | - } |
|
144 | + $sbdBlock = $this->bigBlockChain[$sbdBlock]; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | |
148 | 148 | // readData(rootStartBlock) |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | - function __readData($bl) { |
|
165 | + function __readData($bl) { |
|
166 | 166 | $block = $bl; |
167 | 167 | $pos = 0; |
168 | 168 | $data = ''; |
@@ -171,28 +171,28 @@ discard block |
||
171 | 171 | $pos = ($block + 1) * BIG_BLOCK_SIZE; |
172 | 172 | $data = $data.substr($this->data, $pos, BIG_BLOCK_SIZE); |
173 | 173 | //echo "pos = $pos data=$data\n"; |
174 | - $block = $this->bigBlockChain[$block]; |
|
174 | + $block = $this->bigBlockChain[$block]; |
|
175 | + } |
|
176 | + return $data; |
|
175 | 177 | } |
176 | - return $data; |
|
177 | - } |
|
178 | 178 | |
179 | 179 | function __readPropertySets(){ |
180 | 180 | $offset = 0; |
181 | 181 | //var_dump($this->entry); |
182 | 182 | while ($offset < strlen($this->entry)) { |
183 | - $d = substr($this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE); |
|
183 | + $d = substr($this->entry, $offset, PROPERTY_STORAGE_BLOCK_SIZE); |
|
184 | 184 | |
185 | - $nameSize = ord($d[SIZE_OF_NAME_POS]) | (ord($d[SIZE_OF_NAME_POS+1]) << 8); |
|
185 | + $nameSize = ord($d[SIZE_OF_NAME_POS]) | (ord($d[SIZE_OF_NAME_POS+1]) << 8); |
|
186 | 186 | |
187 | - $type = ord($d[TYPE_POS]); |
|
188 | - //$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1; |
|
187 | + $type = ord($d[TYPE_POS]); |
|
188 | + //$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1; |
|
189 | 189 | |
190 | - $startBlock = GetInt4d($d, START_BLOCK_POS); |
|
191 | - $size = GetInt4d($d, SIZE_POS); |
|
190 | + $startBlock = GetInt4d($d, START_BLOCK_POS); |
|
191 | + $size = GetInt4d($d, SIZE_POS); |
|
192 | 192 | |
193 | 193 | $name = ''; |
194 | 194 | for ($i = 0; $i < $nameSize ; $i++) { |
195 | - $name .= $d[$i]; |
|
195 | + $name .= $d[$i]; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | $name = str_replace("\x00", "", $name); |
@@ -221,50 +221,50 @@ discard block |
||
221 | 221 | |
222 | 222 | |
223 | 223 | function getWorkBook(){ |
224 | - if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD){ |
|
224 | + if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD){ |
|
225 | 225 | // getSmallBlockStream(PropertyStorage ps) |
226 | 226 | |
227 | - $rootdata = $this->__readData($this->props[$this->rootentry]['startBlock']); |
|
227 | + $rootdata = $this->__readData($this->props[$this->rootentry]['startBlock']); |
|
228 | 228 | |
229 | - $streamData = ''; |
|
230 | - $block = $this->props[$this->wrkbook]['startBlock']; |
|
231 | - //$count = 0; |
|
232 | - $pos = 0; |
|
233 | - while ($block != -2) { |
|
234 | - $pos = $block * SMALL_BLOCK_SIZE; |
|
235 | - $streamData .= substr($rootdata, $pos, SMALL_BLOCK_SIZE); |
|
229 | + $streamData = ''; |
|
230 | + $block = $this->props[$this->wrkbook]['startBlock']; |
|
231 | + //$count = 0; |
|
232 | + $pos = 0; |
|
233 | + while ($block != -2) { |
|
234 | + $pos = $block * SMALL_BLOCK_SIZE; |
|
235 | + $streamData .= substr($rootdata, $pos, SMALL_BLOCK_SIZE); |
|
236 | 236 | |
237 | - $block = $this->smallBlockChain[$block]; |
|
238 | - } |
|
237 | + $block = $this->smallBlockChain[$block]; |
|
238 | + } |
|
239 | 239 | |
240 | - return $streamData; |
|
240 | + return $streamData; |
|
241 | 241 | |
242 | 242 | |
243 | - }else{ |
|
243 | + }else{ |
|
244 | 244 | |
245 | - $numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE; |
|
246 | - if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) { |
|
247 | - $numBlocks++; |
|
248 | - } |
|
245 | + $numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE; |
|
246 | + if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) { |
|
247 | + $numBlocks++; |
|
248 | + } |
|
249 | 249 | |
250 | - if ($numBlocks == 0) return ''; |
|
250 | + if ($numBlocks == 0) return ''; |
|
251 | 251 | |
252 | - //echo "numBlocks = $numBlocks\n"; |
|
253 | - //byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE]; |
|
254 | - //print_r($this->wrkbook); |
|
255 | - $streamData = ''; |
|
256 | - $block = $this->props[$this->wrkbook]['startBlock']; |
|
257 | - //$count = 0; |
|
258 | - $pos = 0; |
|
259 | - //echo "block = $block"; |
|
260 | - while ($block != -2) { |
|
261 | - $pos = ($block + 1) * BIG_BLOCK_SIZE; |
|
262 | - $streamData .= substr($this->data, $pos, BIG_BLOCK_SIZE); |
|
263 | - $block = $this->bigBlockChain[$block]; |
|
264 | - } |
|
265 | - //echo 'stream'.$streamData; |
|
266 | - return $streamData; |
|
267 | - } |
|
252 | + //echo "numBlocks = $numBlocks\n"; |
|
253 | + //byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE]; |
|
254 | + //print_r($this->wrkbook); |
|
255 | + $streamData = ''; |
|
256 | + $block = $this->props[$this->wrkbook]['startBlock']; |
|
257 | + //$count = 0; |
|
258 | + $pos = 0; |
|
259 | + //echo "block = $block"; |
|
260 | + while ($block != -2) { |
|
261 | + $pos = ($block + 1) * BIG_BLOCK_SIZE; |
|
262 | + $streamData .= substr($this->data, $pos, BIG_BLOCK_SIZE); |
|
263 | + $block = $this->bigBlockChain[$block]; |
|
264 | + } |
|
265 | + //echo 'stream'.$streamData; |
|
266 | + return $streamData; |
|
267 | + } |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | } |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | case SPREADSHEET_EXCEL_READER_TYPE_SST: |
465 | 465 | //echo "Type_SST\n"; |
466 | 466 | $spos = $pos + 4; |
467 | - $limitpos = $spos + $length; |
|
468 | - $uniqueStrings = $this->_GetInt4d($this->data, $spos+4); |
|
467 | + $limitpos = $spos + $length; |
|
468 | + $uniqueStrings = $this->_GetInt4d($this->data, $spos+4); |
|
469 | 469 | $spos += 8; |
470 | - for ($i = 0; $i < $uniqueStrings; $i++) { |
|
470 | + for ($i = 0; $i < $uniqueStrings; $i++) { |
|
471 | 471 | // Read in the number of characters |
472 | 472 | if ($spos == $limitpos) { |
473 | 473 | $opcode = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | } |
497 | 497 | |
498 | 498 | if ($extendedString) { |
499 | - // Read in cchExtRst |
|
500 | - $extendedRunLength = $this->_GetInt4d($this->data, $spos); |
|
501 | - $spos += 4; |
|
499 | + // Read in cchExtRst |
|
500 | + $extendedRunLength = $this->_GetInt4d($this->data, $spos); |
|
501 | + $spos += 4; |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | $len = ($asciiEncoding)? $numChars : $numChars*2; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $charsLeft = $numChars - (($asciiEncoding) ? $bytesRead : ($bytesRead / 2)); |
513 | 513 | $spos = $limitpos; |
514 | 514 | |
515 | - while ($charsLeft > 0){ |
|
515 | + while ($charsLeft > 0){ |
|
516 | 516 | $opcode = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8; |
517 | 517 | $conlength = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; |
518 | 518 | if ($opcode != 0x3c) { |
@@ -522,29 +522,29 @@ discard block |
||
522 | 522 | $limitpos = $spos + $conlength; |
523 | 523 | $option = ord($this->data[$spos]); |
524 | 524 | $spos += 1; |
525 | - if ($asciiEncoding && ($option == 0)) { |
|
525 | + if ($asciiEncoding && ($option == 0)) { |
|
526 | 526 | $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength); |
527 | 527 | $retstr .= substr($this->data, $spos, $len); |
528 | 528 | $charsLeft -= $len; |
529 | 529 | $asciiEncoding = true; |
530 | - }elseif (!$asciiEncoding && ($option != 0)){ |
|
530 | + }elseif (!$asciiEncoding && ($option != 0)){ |
|
531 | 531 | $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength); |
532 | 532 | $retstr .= substr($this->data, $spos, $len); |
533 | 533 | $charsLeft -= $len/2; |
534 | 534 | $asciiEncoding = false; |
535 | - }elseif (!$asciiEncoding && ($option == 0)) { |
|
535 | + }elseif (!$asciiEncoding && ($option == 0)) { |
|
536 | 536 | // Bummer - the string starts off as Unicode, but after the |
537 | 537 | // continuation it is in straightforward ASCII encoding |
538 | 538 | $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength); |
539 | 539 | for ($j = 0; $j < $len; $j++) { |
540 | - $retstr .= $this->data[$spos + $j].chr(0); |
|
540 | + $retstr .= $this->data[$spos + $j].chr(0); |
|
541 | 541 | } |
542 | 542 | $charsLeft -= $len; |
543 | 543 | $asciiEncoding = false; |
544 | - }else{ |
|
544 | + }else{ |
|
545 | 545 | $newstr = ''; |
546 | 546 | for ($j = 0; $j < strlen($retstr); $j++) { |
547 | - $newstr = $retstr[$j].chr(0); |
|
547 | + $newstr = $retstr[$j].chr(0); |
|
548 | 548 | } |
549 | 549 | $retstr = $newstr; |
550 | 550 | $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength); |
@@ -552,28 +552,28 @@ discard block |
||
552 | 552 | $charsLeft -= $len/2; |
553 | 553 | $asciiEncoding = false; |
554 | 554 | //echo "Izavrat\n"; |
555 | - } |
|
556 | - $spos += $len; |
|
555 | + } |
|
556 | + $spos += $len; |
|
557 | 557 | |
558 | - } |
|
558 | + } |
|
559 | 559 | } |
560 | 560 | //We check the string before send it check the _encodeUTF16 |
561 | 561 | //$retstr = ($asciiEncoding) ? $retstr : $this->_encodeUTF16($retstr); |
562 | 562 | $retstr = ($asciiEncoding) ? $this->_encodeUTF16($retstr, true) : $this->_encodeUTF16($retstr); |
563 | 563 | // echo "Str $i = $retstr\n"; |
564 | 564 | if ($richString){ |
565 | - $spos += 4 * $formattingRuns; |
|
565 | + $spos += 4 * $formattingRuns; |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | // For extended strings, skip over the extended string data |
569 | 569 | if ($extendedString) { |
570 | - $spos += $extendedRunLength; |
|
570 | + $spos += $extendedRunLength; |
|
571 | 571 | } |
572 | 572 | //if ($retstr == 'Derby'){ |
573 | 573 | // echo "bb\n"; |
574 | 574 | //} |
575 | 575 | $this->sst[]=$retstr; |
576 | - } |
|
576 | + } |
|
577 | 577 | /*$continueRecords = array(); |
578 | 578 | while ($this->getNextCode() == Type_CONTINUE) { |
579 | 579 | $continueRecords[] = &$this->nextRecord(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $this->shareStrings = new SSTRecord($r, $continueRecords); |
583 | 583 | //print_r($this->shareStrings->strings); |
584 | 584 | */ |
585 | - // echo 'SST read: '.($time_end-$time_start)."\n"; |
|
585 | + // echo 'SST read: '.($time_end-$time_start)."\n"; |
|
586 | 586 | break; |
587 | 587 | |
588 | 588 | case SPREADSHEET_EXCEL_READER_TYPE_FILEPASS: |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | $this->formatRecords[$indexCode] = $formatString; |
610 | - // echo "Type.FORMAT\n"; |
|
610 | + // echo "Type.FORMAT\n"; |
|
611 | 611 | break; |
612 | 612 | case SPREADSHEET_EXCEL_READER_TYPE_XF: |
613 | 613 | //global $dateFormats, $numberFormats; |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | $rec_name = substr($this->data, $pos+11, $rec_length); |
679 | 679 | } |
680 | 680 | $this->boundsheets[] = array('name'=>$rec_name, |
681 | - 'offset'=>$rec_offset); |
|
681 | + 'offset'=>$rec_offset); |
|
682 | 682 | |
683 | 683 | break; |
684 | 684 | |
@@ -820,14 +820,14 @@ discard block |
||
820 | 820 | } |
821 | 821 | $string = sprintf($this->curformat, $numValue * $this->multiplier); |
822 | 822 | } |
823 | - //$rec['rknumbers'][$i]['xfindex'] = ord($rec['data'][$pos]) | ord($rec['data'][$pos+1]) << 8; |
|
824 | - $tmppos += 6; |
|
825 | - $this->addcell($row, $colFirst + $i, $string, $raw); |
|
826 | - //echo "MULRK $row ".($colFirst + $i)." $string\n"; |
|
823 | + //$rec['rknumbers'][$i]['xfindex'] = ord($rec['data'][$pos]) | ord($rec['data'][$pos+1]) << 8; |
|
824 | + $tmppos += 6; |
|
825 | + $this->addcell($row, $colFirst + $i, $string, $raw); |
|
826 | + //echo "MULRK $row ".($colFirst + $i)." $string\n"; |
|
827 | 827 | } |
828 | - //MulRKRecord($r); |
|
828 | + //MulRKRecord($r); |
|
829 | 829 | // Get the individual cell records from the multiple record |
830 | - //$num = ; |
|
830 | + //$num = ; |
|
831 | 831 | |
832 | 832 | break; |
833 | 833 | case SPREADSHEET_EXCEL_READER_TYPE_NUMBER: |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | $tmp = unpack("ddouble", substr($this->data, $spos + 6, 8)); // It machine machine dependent |
837 | 837 | if ($this->isDate($spos)) { |
838 | 838 | list($string, $raw) = $this->createDate($tmp['double']); |
839 | - // $this->addcell(DateRecord($r, 1)); |
|
839 | + // $this->addcell(DateRecord($r, 1)); |
|
840 | 840 | }else{ |
841 | 841 | //$raw = $tmp['']; |
842 | 842 | if (isset($this->_columnsFormat[$column + 1])){ |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $raw = $this->createNumber($spos); |
846 | 846 | $string = sprintf($this->curformat, $raw * $this->multiplier); |
847 | 847 | |
848 | - // $this->addcell(NumberRecord($r)); |
|
848 | + // $this->addcell(NumberRecord($r)); |
|
849 | 849 | } |
850 | 850 | $this->addcell($row, $column, $string, $raw); |
851 | 851 | //echo "Number $row $column $string\n"; |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | $tmp = unpack("ddouble", substr($this->data, $spos + 6, 8)); // It machine machine dependent |
869 | 869 | if ($this->isDate($spos)) { |
870 | 870 | list($string, $raw) = $this->createDate($tmp['double']); |
871 | - // $this->addcell(DateRecord($r, 1)); |
|
871 | + // $this->addcell(DateRecord($r, 1)); |
|
872 | 872 | }else{ |
873 | 873 | //$raw = $tmp['']; |
874 | 874 | if (isset($this->_columnsFormat[$column + 1])){ |
@@ -877,7 +877,7 @@ discard block |
||
877 | 877 | $raw = $this->createNumber($spos); |
878 | 878 | $string = sprintf($this->curformat, $raw * $this->multiplier); |
879 | 879 | |
880 | - // $this->addcell(NumberRecord($r)); |
|
880 | + // $this->addcell(NumberRecord($r)); |
|
881 | 881 | } |
882 | 882 | $this->addcell($row, $column, $string, $raw); |
883 | 883 | //echo "Number $row $column $string\n"; |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | $column = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8; |
900 | 900 | $this->addcell($row, $column, substr($this->data, $spos + 8, ord($this->data[$spos + 6]) | ord($this->data[$spos + 7])<<8)); |
901 | 901 | |
902 | - // $this->addcell(LabelRecord($r)); |
|
902 | + // $this->addcell(LabelRecord($r)); |
|
903 | 903 | break; |
904 | 904 | |
905 | 905 | case SPREADSHEET_EXCEL_READER_TYPE_EOF: |
@@ -914,9 +914,9 @@ discard block |
||
914 | 914 | } |
915 | 915 | |
916 | 916 | if (!isset($this->sheets[$this->sn]['numRows'])) |
917 | - $this->sheets[$this->sn]['numRows'] = $this->sheets[$this->sn]['maxrow']; |
|
917 | + $this->sheets[$this->sn]['numRows'] = $this->sheets[$this->sn]['maxrow']; |
|
918 | 918 | if (!isset($this->sheets[$this->sn]['numCols'])) |
919 | - $this->sheets[$this->sn]['numCols'] = $this->sheets[$this->sn]['maxcol']; |
|
919 | + $this->sheets[$this->sn]['numCols'] = $this->sheets[$this->sn]['maxcol']; |
|
920 | 920 | |
921 | 921 | } |
922 | 922 | |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | // The RK format calls for using only the most significant 30 bits of the |
1034 | 1034 | // 64 bit floating point value. The other 34 bits are assumed to be 0 |
1035 | 1035 | // So, we use the upper 30 bits of $rknum as follows... |
1036 | - $sign = ($rknum & 0x80000000) >> 31; |
|
1036 | + $sign = ($rknum & 0x80000000) >> 31; |
|
1037 | 1037 | $exp = ($rknum & 0x7ff00000) >> 20; |
1038 | 1038 | $mantissa = (0x100000 | ($rknum & 0x000ffffc)); |
1039 | 1039 | $value = $mantissa / pow( 2 , (20- ($exp - 1023))); |