@@ -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 | } |
@@ -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 |
@@ -109,7 +109,7 @@ |
||
109 | 109 | }*/ |
110 | 110 | // If the session time has expired, refresh the starttime value, |
111 | 111 | // so we're starting to count down from a later time |
112 | - if ( $session->has('starttime') && $session->is_expired()) { |
|
112 | + if ($session->has('starttime') && $session->is_expired()) { |
|
113 | 113 | $session->destroy(); |
114 | 114 | } else { |
115 | 115 | //error_log('Time not expired, extend session for a bit more'); |
@@ -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 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | define('TYPE_POS', 0x42); |
15 | 15 | define('START_BLOCK_POS', 0x74); |
16 | 16 | define('SIZE_POS', 0x78); |
17 | -define('IDENTIFIER_OLE', pack("CCCCCCCC",0xd0,0xcf,0x11,0xe0,0xa1,0xb1,0x1a,0xe1)); |
|
17 | +define('IDENTIFIER_OLE', pack("CCCCCCCC", 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1)); |
|
18 | 18 | |
19 | 19 | //echo 'ROOT_START_BLOCK_POS = '.ROOT_START_BLOCK_POS."\n"; |
20 | 20 | |
@@ -25,10 +25,10 @@ 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) |
|
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 | 30 | { |
31 | - $value=-2; |
|
31 | + $value = -2; |
|
32 | 32 | } |
33 | 33 | return $value; |
34 | 34 | } |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | var $data = ''; |
39 | 39 | |
40 | 40 | |
41 | - function OLERead(){ |
|
41 | + function OLERead() { |
|
42 | 42 | |
43 | 43 | |
44 | 44 | } |
45 | 45 | |
46 | - function read($sFileName){ |
|
46 | + function read($sFileName) { |
|
47 | 47 | |
48 | 48 | // check if file exist and is readable (Darko Miljanovic) |
49 | - if(!is_readable($sFileName)) { |
|
49 | + if (!is_readable($sFileName)) { |
|
50 | 50 | $this->error = 1; |
51 | 51 | return false; |
52 | 52 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $bbdBlocks = $this->numBigBlockDepotBlocks; |
83 | 83 | |
84 | 84 | if ($this->numExtensionBlocks != 0) { |
85 | - $bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS)/4; |
|
85 | + $bbdBlocks = (BIG_BLOCK_SIZE - BIG_BLOCK_DEPOT_BLOCKS_POS) / 4; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | for ($i = 0; $i < $bbdBlocks; $i++) { |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | for ($i = 0; $i < $this->numBigBlockDepotBlocks; $i++) { |
117 | 117 | $pos = ($bigBlockDepotBlocks[$i] + 1) * BIG_BLOCK_SIZE; |
118 | 118 | //echo "pos = $pos"; |
119 | - for ($j = 0 ; $j < BIG_BLOCK_SIZE / 4; $j++) { |
|
119 | + for ($j = 0; $j < BIG_BLOCK_SIZE / 4; $j++) { |
|
120 | 120 | $this->bigBlockChain[$index] = GetInt4d($this->data, $pos); |
121 | - $pos += 4 ; |
|
121 | + $pos += 4; |
|
122 | 122 | $index++; |
123 | 123 | } |
124 | 124 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $pos = 0; |
168 | 168 | $data = ''; |
169 | 169 | |
170 | - while ($block != -2) { |
|
170 | + while ($block != -2) { |
|
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"; |
@@ -176,13 +176,13 @@ discard block |
||
176 | 176 | return $data; |
177 | 177 | } |
178 | 178 | |
179 | - function __readPropertySets(){ |
|
179 | + function __readPropertySets() { |
|
180 | 180 | $offset = 0; |
181 | 181 | //var_dump($this->entry); |
182 | 182 | while ($offset < strlen($this->entry)) { |
183 | 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 | 187 | $type = ord($d[TYPE_POS]); |
188 | 188 | //$maxBlock = strlen($d) / BIG_BLOCK_SIZE - 1; |
@@ -191,13 +191,13 @@ discard block |
||
191 | 191 | $size = GetInt4d($d, SIZE_POS); |
192 | 192 | |
193 | 193 | $name = ''; |
194 | - for ($i = 0; $i < $nameSize ; $i++) { |
|
194 | + for ($i = 0; $i < $nameSize; $i++) { |
|
195 | 195 | $name .= $d[$i]; |
196 | 196 | } |
197 | 197 | |
198 | 198 | $name = str_replace("\x00", "", $name); |
199 | 199 | |
200 | - $this->props[] = array ( |
|
200 | + $this->props[] = array( |
|
201 | 201 | 'name' => $name, |
202 | 202 | 'type' => $type, |
203 | 203 | 'startBlock' => $startBlock, |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | } |
221 | 221 | |
222 | 222 | |
223 | - function getWorkBook(){ |
|
224 | - if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD){ |
|
223 | + function getWorkBook() { |
|
224 | + if ($this->props[$this->wrkbook]['size'] < SMALL_BLOCK_THRESHOLD) { |
|
225 | 225 | // getSmallBlockStream(PropertyStorage ps) |
226 | 226 | |
227 | 227 | $rootdata = $this->__readData($this->props[$this->rootentry]['startBlock']); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | return $streamData; |
241 | 241 | |
242 | 242 | |
243 | - }else{ |
|
243 | + } else { |
|
244 | 244 | |
245 | 245 | $numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE; |
246 | 246 | if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) { |
@@ -240,14 +240,16 @@ |
||
240 | 240 | return $streamData; |
241 | 241 | |
242 | 242 | |
243 | - }else{ |
|
243 | + } else{ |
|
244 | 244 | |
245 | 245 | $numBlocks = $this->props[$this->wrkbook]['size'] / BIG_BLOCK_SIZE; |
246 | 246 | if ($this->props[$this->wrkbook]['size'] % BIG_BLOCK_SIZE != 0) { |
247 | 247 | $numBlocks++; |
248 | 248 | } |
249 | 249 | |
250 | - if ($numBlocks == 0) return ''; |
|
250 | + if ($numBlocks == 0) { |
|
251 | + return ''; |
|
252 | + } |
|
251 | 253 | |
252 | 254 | //echo "numBlocks = $numBlocks\n"; |
253 | 255 | //byte[] streamData = new byte[numBlocks * BIG_BLOCK_SIZE]; |
@@ -23,6 +23,9 @@ |
||
23 | 23 | //echo $data[ROOT_START_BLOCK_POS]; |
24 | 24 | //function log |
25 | 25 | |
26 | +/** |
|
27 | + * @param integer $pos |
|
28 | + */ |
|
26 | 29 | function GetInt4d($data, $pos) |
27 | 30 | { |
28 | 31 | $value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24); |
@@ -71,13 +71,13 @@ |
||
71 | 71 | // }}} |
72 | 72 | // {{{ accept() |
73 | 73 | |
74 | - /** |
|
75 | - * Accepts a renderer |
|
76 | - * |
|
77 | - * @param HTML_QuickForm_Renderer renderer object |
|
78 | - * @access public |
|
79 | - * @return void |
|
80 | - */ |
|
74 | + /** |
|
75 | + * Accepts a renderer |
|
76 | + * |
|
77 | + * @param HTML_QuickForm_Renderer renderer object |
|
78 | + * @access public |
|
79 | + * @return void |
|
80 | + */ |
|
81 | 81 | //function accept(&$renderer) |
82 | 82 | function accept(&$renderer, $required=false, $error=null) |
83 | 83 | { |
@@ -60,7 +60,7 @@ |
||
60 | 60 | * Freeze the element so that only its value is returned |
61 | 61 | * |
62 | 62 | * @access public |
63 | - * @return void |
|
63 | + * @return boolean |
|
64 | 64 | */ |
65 | 65 | function freeze() |
66 | 66 | { |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * @access public |
62 | 62 | * @return void |
63 | 63 | */ |
64 | - function accept(&$renderer, $required=false, $error=null) |
|
64 | + function accept(&$renderer, $required = false, $error = null) |
|
65 | 65 | { |
66 | 66 | $renderer->renderHeader($this); |
67 | 67 | } // end func accept |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | $jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]); |
435 | 435 | } |
436 | 436 | $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" . |
437 | - implode(",\n", $jsParts) . |
|
438 | - "\n];\n"; |
|
437 | + implode(",\n", $jsParts) . |
|
438 | + "\n];\n"; |
|
439 | 439 | // default value; if we don't actually have any values yet just use |
440 | 440 | // the first option (for single selects) or empty array (for multiple) |
441 | 441 | $values = array(); |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | } |
452 | 452 | $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " . |
453 | - $this->_convertArrayToJavascript($values, false) . ";\n"; |
|
453 | + $this->_convertArrayToJavascript($values, false) . ";\n"; |
|
454 | 454 | } |
455 | 455 | include_once('HTML/QuickForm/Renderer/Default.php'); |
456 | 456 | $renderer =& new HTML_QuickForm_Renderer_Default(); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") . |
467 | - $renderer->toHtml(); |
|
467 | + $renderer->toHtml(); |
|
468 | 468 | } // end func toHtml |
469 | 469 | |
470 | 470 | // }}} |
@@ -506,14 +506,14 @@ discard block |
||
506 | 506 | // }}} |
507 | 507 | // {{{ _convertArrayToJavascript() |
508 | 508 | |
509 | - /** |
|
510 | - * Converts PHP array to its Javascript analog |
|
511 | - * |
|
512 | - * @access private |
|
513 | - * @param array PHP array to convert |
|
514 | - * @param bool Generate Javascript object literal (default, works like PHP's associative array) or array literal |
|
515 | - * @return string Javascript representation of the value |
|
516 | - */ |
|
509 | + /** |
|
510 | + * Converts PHP array to its Javascript analog |
|
511 | + * |
|
512 | + * @access private |
|
513 | + * @param array PHP array to convert |
|
514 | + * @param bool Generate Javascript object literal (default, works like PHP's associative array) or array literal |
|
515 | + * @return string Javascript representation of the value |
|
516 | + */ |
|
517 | 517 | function _convertArrayToJavascript($array, $assoc = true) |
518 | 518 | { |
519 | 519 | if (!is_array($array)) { |
@@ -537,13 +537,13 @@ discard block |
||
537 | 537 | // }}} |
538 | 538 | // {{{ _convertScalarToJavascript() |
539 | 539 | |
540 | - /** |
|
541 | - * Converts PHP's scalar value to its Javascript analog |
|
542 | - * |
|
543 | - * @access private |
|
544 | - * @param mixed PHP value to convert |
|
545 | - * @return string Javascript representation of the value |
|
546 | - */ |
|
540 | + /** |
|
541 | + * Converts PHP's scalar value to its Javascript analog |
|
542 | + * |
|
543 | + * @access private |
|
544 | + * @param mixed PHP value to convert |
|
545 | + * @return string Javascript representation of the value |
|
546 | + */ |
|
547 | 547 | function _convertScalarToJavascript($val) |
548 | 548 | { |
549 | 549 | if (is_bool($val)) { |
@@ -563,13 +563,13 @@ discard block |
||
563 | 563 | // }}} |
564 | 564 | // {{{ _escapeString() |
565 | 565 | |
566 | - /** |
|
567 | - * Quotes the string so that it can be used in Javascript string constants |
|
568 | - * |
|
569 | - * @access private |
|
570 | - * @param string |
|
571 | - * @return string |
|
572 | - */ |
|
566 | + /** |
|
567 | + * Quotes the string so that it can be used in Javascript string constants |
|
568 | + * |
|
569 | + * @access private |
|
570 | + * @param string |
|
571 | + * @return string |
|
572 | + */ |
|
573 | 573 | function _escapeString($str) |
574 | 574 | { |
575 | 575 | return strtr($str,array( |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * @access public |
84 | 84 | * @return void |
85 | 85 | */ |
86 | - function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null) |
|
86 | + function HTML_QuickForm_hierselect($elementName = null, $elementLabel = null, $attributes = null, $separator = null) |
|
87 | 87 | { |
88 | 88 | $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes); |
89 | 89 | $this->_persistantFreeze = true; |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | // setDefaults has probably been called before this function |
155 | 155 | // check if all elements have been created |
156 | 156 | $totalNbElements = count($this->_options); |
157 | - for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) { |
|
158 | - $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
157 | + for ($i = $this->_nbElements; $i < $totalNbElements; $i++) { |
|
158 | + $this->_elements[] = & new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
159 | 159 | $this->_nbElements++; |
160 | 160 | } |
161 | 161 | } |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | // setDefaults has probably been called before this function |
210 | 210 | // check if all elements have been created |
211 | 211 | $totalNbElements = 2; |
212 | - for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) { |
|
213 | - $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
212 | + for ($i = $this->_nbElements; $i < $totalNbElements; $i++) { |
|
213 | + $this->_elements[] = & new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
214 | 214 | $this->_nbElements++; |
215 | 215 | } |
216 | 216 | } |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | foreach (array_keys($this->_elements) AS $key) { |
234 | 234 | $array = eval("return isset(\$this->_options[{$key}]{$toLoad})? \$this->_options[{$key}]{$toLoad}: null;"); |
235 | 235 | if (is_array($array)) { |
236 | - $select =& $this->_elements[$key]; |
|
236 | + $select = & $this->_elements[$key]; |
|
237 | 237 | $select->_options = array(); |
238 | 238 | $select->loadArray($array); |
239 | 239 | |
240 | - $value = is_array($v = $select->getValue()) ? $v[0] : key($array); |
|
241 | - $toLoad .= '[\'' . str_replace(array('\\', '\''), array('\\\\', '\\\''), $value) . '\']'; |
|
240 | + $value = is_array($v = $select->getValue()) ? $v[0] : key($array); |
|
241 | + $toLoad .= '[\''.str_replace(array('\\', '\''), array('\\\\', '\\\''), $value).'\']'; |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } // end func _setOptions |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | function _createElements() |
278 | 278 | { |
279 | 279 | for ($i = 0; $i < $this->_nbElements; $i++) { |
280 | - $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
280 | + $this->_elements[] = & new HTML_QuickForm_select($i, null, array(), $this->getAttributes()); |
|
281 | 281 | } |
282 | 282 | } // end func _createElements |
283 | 283 | |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | $keys = array_keys($this->_elements); |
293 | 293 | $onChange = array(); |
294 | 294 | for ($i = 0; $i < count($keys) - 1; $i++) { |
295 | - $select =& $this->_elements[$keys[$i]]; |
|
295 | + $select = & $this->_elements[$keys[$i]]; |
|
296 | 296 | $onChange[$i] = $select->getAttribute('onchange'); |
297 | 297 | $select->updateAttributes( |
298 | - array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i]) |
|
298 | + array('onchange' => '_hs_swapOptions(this.form, \''.$this->_escapeString($this->getName()).'\', '.$keys[$i].');'.$onChange[$i]) |
|
299 | 299 | ); |
300 | 300 | } |
301 | 301 | |
@@ -433,37 +433,36 @@ discard block |
||
433 | 433 | for ($i = 1; $i < $this->_nbElements; $i++) { |
434 | 434 | $jsParts[] = $this->_convertArrayToJavascript($this->_options[$i]); |
435 | 435 | } |
436 | - $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" . |
|
437 | - implode(",\n", $jsParts) . |
|
436 | + $this->_js .= "\n_hs_options['".$this->_escapeString($this->getName())."'] = [\n". |
|
437 | + implode(",\n", $jsParts). |
|
438 | 438 | "\n];\n"; |
439 | 439 | // default value; if we don't actually have any values yet just use |
440 | 440 | // the first option (for single selects) or empty array (for multiple) |
441 | 441 | $values = array(); |
442 | 442 | foreach (array_keys($this->_elements) as $key) { |
443 | 443 | if (is_array($v = $this->_elements[$key]->getValue())) { |
444 | - $values[] = count($v) > 1? $v: $v[0]; |
|
444 | + $values[] = count($v) > 1 ? $v : $v[0]; |
|
445 | 445 | } else { |
446 | 446 | // XXX: accessing the supposedly private _options array |
447 | - $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])? |
|
448 | - array(): |
|
449 | - $this->_elements[$key]->_options[0]['attr']['value']; |
|
447 | + $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0]) ? |
|
448 | + array() : $this->_elements[$key]->_options[0]['attr']['value']; |
|
450 | 449 | } |
451 | 450 | } |
452 | - $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " . |
|
453 | - $this->_convertArrayToJavascript($values, false) . ";\n"; |
|
451 | + $this->_js .= "_hs_defaults['".$this->_escapeString($this->getName())."'] = ". |
|
452 | + $this->_convertArrayToJavascript($values, false).";\n"; |
|
454 | 453 | } |
455 | 454 | include_once('HTML/QuickForm/Renderer/Default.php'); |
456 | - $renderer =& new HTML_QuickForm_Renderer_Default(); |
|
455 | + $renderer = & new HTML_QuickForm_Renderer_Default(); |
|
457 | 456 | $renderer->setElementTemplate('{element}'); |
458 | 457 | parent::accept($renderer); |
459 | 458 | |
460 | 459 | if (!empty($onChange)) { |
461 | - $keys = array_keys($this->_elements); |
|
460 | + $keys = array_keys($this->_elements); |
|
462 | 461 | for ($i = 0; $i < count($keys) - 1; $i++) { |
463 | 462 | $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i])); |
464 | 463 | } |
465 | 464 | } |
466 | - return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") . |
|
465 | + return (empty($this->_js) ? '' : "<script type=\"text/javascript\">\n//<![CDATA[\n".$this->_js."//]]>\n</script>"). |
|
467 | 466 | $renderer->toHtml(); |
468 | 467 | } // end func toHtml |
469 | 468 | |
@@ -491,12 +490,12 @@ discard block |
||
491 | 490 | $onReset = $caller->getAttribute('onreset'); |
492 | 491 | if (strlen($onReset)) { |
493 | 492 | if (strpos($onReset, '_hs_setupOnReset')) { |
494 | - $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset))); |
|
493 | + $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['".$this->_escapeString($this->getName())."', ", $onReset))); |
|
495 | 494 | } else { |
496 | - $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } ")); |
|
495 | + $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['".$this->_escapeString($this->getName())."']); } ")); |
|
497 | 496 | } |
498 | 497 | } else { |
499 | - $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } ")); |
|
498 | + $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['".$this->_escapeString($this->getName())."']); } ")); |
|
500 | 499 | } |
501 | 500 | } |
502 | 501 | return $ret; |
@@ -521,7 +520,7 @@ discard block |
||
521 | 520 | } else { |
522 | 521 | $items = array(); |
523 | 522 | foreach ($array as $key => $val) { |
524 | - $item = $assoc? "'" . $this->_escapeString($key) . "': ": ''; |
|
523 | + $item = $assoc ? "'".$this->_escapeString($key)."': " : ''; |
|
525 | 524 | if (is_array($val)) { |
526 | 525 | $item .= $this->_convertArrayToJavascript($val, $assoc); |
527 | 526 | } else { |
@@ -531,7 +530,7 @@ discard block |
||
531 | 530 | } |
532 | 531 | } |
533 | 532 | $js = implode(', ', $items); |
534 | - return $assoc? '{ ' . $js . ' }': '[' . $js . ']'; |
|
533 | + return $assoc ? '{ '.$js.' }' : '['.$js.']'; |
|
535 | 534 | } |
536 | 535 | |
537 | 536 | // }}} |
@@ -551,7 +550,7 @@ discard block |
||
551 | 550 | } elseif (is_int($val) || is_double($val)) { |
552 | 551 | return $val; |
553 | 552 | } elseif (is_string($val)) { |
554 | - return "'" . $this->_escapeString($val) . "'"; |
|
553 | + return "'".$this->_escapeString($val)."'"; |
|
555 | 554 | } elseif (is_null($val)) { |
556 | 555 | return 'null'; |
557 | 556 | } else { |
@@ -572,7 +571,7 @@ discard block |
||
572 | 571 | */ |
573 | 572 | function _escapeString($str) |
574 | 573 | { |
575 | - return strtr($str,array( |
|
574 | + return strtr($str, array( |
|
576 | 575 | "\r" => '\r', |
577 | 576 | "\n" => '\n', |
578 | 577 | "\t" => '\t', |
@@ -247,7 +247,7 @@ |
||
247 | 247 | unset($attr['name']); |
248 | 248 | |
249 | 249 | $html = $this->_getTabs() |
250 | - . '<span' . $this->_getAttrString($attr) . '>' |
|
250 | + . '<span'.$this->_getAttrString($attr).'>' |
|
251 | 251 | . htmlspecialchars($captcha) |
252 | 252 | . '</span>'; |
253 | 253 | return $html; |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @return void |
27 | 27 | * @throws |
28 | 28 | */ |
29 | - function HTML_QuickForm_email($elementName=null, $elementLabel=null, $attributes=null) |
|
29 | + function HTML_QuickForm_email($elementName = null, $elementLabel = null, $attributes = null) |
|
30 | 30 | { |
31 | 31 | parent::__construct($elementName, $elementLabel, $attributes); |
32 | 32 | $this->setType('email'); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | { |
36 | 36 | // save the form values and validation status to the session |
37 | 37 | $page->isFormBuilt() or $page->buildForm(); |
38 | - $pageName = $page->getAttribute('id'); |
|
39 | - $data =& $page->controller->container(); |
|
38 | + $pageName = $page->getAttribute('id'); |
|
39 | + $data = & $page->controller->container(); |
|
40 | 40 | $data['values'][$pageName] = $page->exportValues(); |
41 | 41 | if (!$page->controller->isModal()) { |
42 | 42 | if (PEAR::isError($valid = $page->validate())) { |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return $page->handle('jump'); |
54 | 54 | // |
55 | 55 | } else { |
56 | - $prev =& $page->controller->getPage($prevName); |
|
56 | + $prev = & $page->controller->getPage($prevName); |
|
57 | 57 | // Modified by Chamilo team, 16-MAR-2010. |
58 | 58 | //$prev->handle('jump'); |
59 | 59 | return $prev->handle('jump'); |