@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | function validate($html, $mode = NO_HTML) |
18 | 18 | { |
19 | - $allowed_tags = self::get_allowed_tags ($mode, $fullpage); |
|
19 | + $allowed_tags = self::get_allowed_tags($mode, $fullpage); |
|
20 | 20 | $cleaned_html = kses($html, $allowed_tags); |
21 | 21 | return $html == $cleaned_html; |
22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Include the allowed tags. |
34 | 34 | //include(dirname(__FILE__).'/allowed_tags.inc.php'); |
35 | 35 | global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page; |
36 | - switch($mode) |
|
36 | + switch ($mode) |
|
37 | 37 | { |
38 | 38 | case NO_HTML: |
39 | 39 | return array(); |
@@ -27,11 +27,11 @@ |
||
27 | 27 | */ |
28 | 28 | function validate($value, $options = null) |
29 | 29 | { |
30 | - if(is_array($value)) |
|
30 | + if (is_array($value)) |
|
31 | 31 | { |
32 | - $value = implode(null,$value); |
|
32 | + $value = implode(null, $value); |
|
33 | 33 | } |
34 | - if ((string)$value == '') { |
|
34 | + if ((string) $value == '') { |
|
35 | 35 | return false; |
36 | 36 | } |
37 | 37 | return true; |
@@ -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'); |
@@ -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) { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | foreach ($attributes as $key => $value) { |
144 | 144 | // Modified by Ivan Tcholakov, 16-MAR-2010 |
145 | 145 | $value = @htmlspecialchars($value, ENT_COMPAT, $charset); |
146 | - $strAttr .= ' ' . $key . '= "' . $value. '"'; |
|
146 | + $strAttr .= ' '.$key.'= "'.$value.'"'; |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | return $strAttr; |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | return $ret; |
171 | 171 | |
172 | 172 | } elseif (is_string($attributes)) { |
173 | - $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)" . |
|
173 | + $preg = "/(([A-Za-z_:]|[^\\x00-\\x7F])([A-Za-z0-9_:.-]|[^\\x00-\\x7F])*)". |
|
174 | 174 | "([ \\n\\t\\r]+)?(=([ \\n\\t\\r]+)?(\"[^\"]*\"|'[^']*'|[^ \\n\\t\\r]*))?/"; |
175 | 175 | if (preg_match_all($preg, $attributes, $regs)) { |
176 | - for ($counter=0; $counter<count($regs[1]); $counter++) { |
|
176 | + for ($counter = 0; $counter < count($regs[1]); $counter++) { |
|
177 | 177 | $name = $regs[1][$counter]; |
178 | 178 | $check = $regs[0][$counter]; |
179 | 179 | $value = $regs[7][$counter]; |
@@ -79,7 +79,7 @@ |
||
79 | 79 | * @return void |
80 | 80 | */ |
81 | 81 | //function accept(&$renderer) |
82 | - function accept(&$renderer, $required=false, $error=null) |
|
82 | + function accept(&$renderer, $required = false, $error = null) |
|
83 | 83 | { |
84 | 84 | $renderer->renderHidden($this); |
85 | 85 | } // end func accept |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | //return ('' != $value? htmlspecialchars($value): ' ') . |
289 | 289 | // $this->_getPersistantData(); |
290 | 290 | |
291 | - $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()): ' ') . |
|
291 | + $value = ('' != $value ? @htmlspecialchars($value, ENT_COMPAT, HTML_Common::charset()) : ' '). |
|
292 | 292 | $this->_getPersistantData(); |
293 | 293 | return '<span class="freeze">'.$value.'</span>'; |
294 | 294 | // |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | return ''; |
310 | 310 | } else { |
311 | 311 | $id = $this->getAttribute('id'); |
312 | - return '<input' . $this->_getAttrString(array( |
|
312 | + return '<input'.$this->_getAttrString(array( |
|
313 | 313 | 'type' => 'hidden', |
314 | 314 | 'name' => $this->getName(), |
315 | 315 | 'value' => $this->getValue() |
316 | - ) + (isset($id)? array('id' => $id): array())) . ' />'; |
|
316 | + ) + (isset($id) ? array('id' => $id) : array())).' />'; |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @access public |
345 | 345 | * @return void |
346 | 346 | */ |
347 | - function setPersistantFreeze($persistant=false) |
|
347 | + function setPersistantFreeze($persistant = false) |
|
348 | 348 | { |
349 | 349 | $this->_persistantFreeze = $persistant; |
350 | 350 | } //end func setPersistantFreeze |
@@ -414,10 +414,10 @@ discard block |
||
414 | 414 | if (isset($values[$elementName])) { |
415 | 415 | return $values[$elementName]; |
416 | 416 | } elseif (strpos($elementName, '[')) { |
417 | - $myVar = "['" . str_replace( |
|
417 | + $myVar = "['".str_replace( |
|
418 | 418 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
419 | 419 | $elementName |
420 | - ) . "']"; |
|
420 | + )."']"; |
|
421 | 421 | return eval("return (isset(\$values$myVar)) ? \$values$myVar : null;"); |
422 | 422 | } else { |
423 | 423 | return null; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @access public |
481 | 481 | * @return void |
482 | 482 | */ |
483 | - function accept(&$renderer, $required=false, $error=null) |
|
483 | + function accept(&$renderer, $required = false, $error = null) |
|
484 | 484 | { |
485 | 485 | $renderer->renderElement($this, $required, $error); |
486 | 486 | } |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | static $idx = 1; |
500 | 500 | |
501 | 501 | if (!$this->getAttribute('id')) { |
502 | - $this->updateAttributes(array('id' => 'qf_' . substr(md5(microtime() . $idx++), 0, 6))); |
|
502 | + $this->updateAttributes(array('id' => 'qf_'.substr(md5(microtime().$idx++), 0, 6))); |
|
503 | 503 | } |
504 | 504 | } |
505 | 505 | |
@@ -543,10 +543,10 @@ discard block |
||
543 | 543 | return array($name => $value); |
544 | 544 | } else { |
545 | 545 | $valueAry = array(); |
546 | - $myIndex = "['" . str_replace( |
|
546 | + $myIndex = "['".str_replace( |
|
547 | 547 | array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"), |
548 | 548 | $name |
549 | - ) . "']"; |
|
549 | + )."']"; |
|
550 | 550 | eval("\$valueAry$myIndex = \$value;"); |
551 | 551 | return $valueAry; |
552 | 552 | } |
@@ -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; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @access public |
92 | 92 | * @return void |
93 | 93 | */ |
94 | - public function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true) |
|
94 | + public function __construct($elementName = null, $elementLabel = null, $elements = null, $separator = null, $appendName = true) |
|
95 | 95 | { |
96 | 96 | parent::__construct($elementName, $elementLabel); |
97 | 97 | $this->_type = 'group'; |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | { |
175 | 175 | $value = null; |
176 | 176 | foreach (array_keys($this->_elements) as $key) { |
177 | - $element =& $this->_elements[$key]; |
|
177 | + $element = & $this->_elements[$key]; |
|
178 | 178 | switch ($element->getType()) { |
179 | 179 | case 'radio': |
180 | - $v = $element->getChecked()? $element->getValue(): null; |
|
180 | + $v = $element->getChecked() ? $element->getValue() : null; |
|
181 | 181 | break; |
182 | 182 | case 'checkbox': |
183 | - $v = $element->getChecked()? true: null; |
|
183 | + $v = $element->getChecked() ? true : null; |
|
184 | 184 | break; |
185 | 185 | default: |
186 | 186 | $v = $element->getValue(); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $value = $v; |
192 | 192 | } else { |
193 | 193 | if (!is_array($value)) { |
194 | - $value = is_null($value)? array(): array($value); |
|
194 | + $value = is_null($value) ? array() : array($value); |
|
195 | 195 | } |
196 | 196 | if ('' === $elementName) { |
197 | 197 | $value[] = $v; |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | if (is_null($elementName)) { |
361 | 361 | $this->_elements[$key]->setName($this->getName()); |
362 | 362 | } elseif ('' === $elementName) { |
363 | - $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); |
|
363 | + $this->_elements[$key]->setName($this->getName().'['.$key.']'); |
|
364 | 364 | } else { |
365 | - $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); |
|
365 | + $this->_elements[$key]->setName($this->getName().'['.$elementName.']'); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | $this->_elements[$key]->onQuickFormEvent('updateValue', $arg, $caller); |
@@ -393,12 +393,12 @@ discard block |
||
393 | 393 | $renderer->startGroup($this, $required, $error); |
394 | 394 | $name = $this->getName(); |
395 | 395 | foreach (array_keys($this->_elements) as $key) { |
396 | - $element =& $this->_elements[$key]; |
|
396 | + $element = & $this->_elements[$key]; |
|
397 | 397 | |
398 | 398 | if ($this->_appendName) { |
399 | 399 | $elementName = $element->getName(); |
400 | 400 | if (isset($elementName)) { |
401 | - $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']'); |
|
401 | + $element->setName($name.'['.(strlen($elementName) ? $elementName : $key).']'); |
|
402 | 402 | } else { |
403 | 403 | $element->setName($name); |
404 | 404 | } |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | if (is_null($elementName)) { |
430 | 430 | $this->_elements[$key]->setName($this->getName()); |
431 | 431 | } elseif ('' === $elementName) { |
432 | - $this->_elements[$key]->setName($this->getName() . '[' . $key . ']'); |
|
432 | + $this->_elements[$key]->setName($this->getName().'['.$key.']'); |
|
433 | 433 | } else { |
434 | - $this->_elements[$key]->setName($this->getName() . '[' . $elementName . ']'); |
|
434 | + $this->_elements[$key]->setName($this->getName().'['.$elementName.']'); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | $v = $this->_elements[$key]->exportValue($submitValues, $assoc); |