@@ -18,6 +18,9 @@ discard block |
||
| 18 | 18 | // Use {page} in link_url als placeholder for the selected page number |
| 19 | 19 | // and/or {offset} for the 0-based data offset of the selected page. |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $link_url |
|
| 23 | + */ |
|
| 21 | 24 | public function __construct($link_url, $min_pages_shown = 2, $max_pages_shown = 15) |
| 22 | 25 | { |
| 23 | 26 | global $tpl; |
@@ -31,6 +34,10 @@ discard block |
||
| 31 | 34 | } |
| 32 | 35 | |
| 33 | 36 | |
| 37 | + /** |
|
| 38 | + * @param double $current_page |
|
| 39 | + * @param double $total_pages |
|
| 40 | + */ |
|
| 34 | 41 | public function make_from_pagenr($current_page, $total_pages, $page_size = false) |
| 35 | 42 | { |
| 36 | 43 | global $tpl; |
@@ -94,6 +101,9 @@ discard block |
||
| 94 | 101 | } |
| 95 | 102 | |
| 96 | 103 | |
| 104 | + /** |
|
| 105 | + * @param boolean $page_size |
|
| 106 | + */ |
|
| 97 | 107 | private function pagelink($page, $page_size) |
| 98 | 108 | { |
| 99 | 109 | return mb_ereg_replace( |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $to_page = min($last_page, max($first_page, $current_page - $lrspan) + $this->max_pages_shown - 1); |
| 60 | 60 | $from_page = max($first_page, $to_page - $this->max_pages_shown + 1); |
| 61 | 61 | |
| 62 | - for ($page = $from_page; $page <= $to_page; $page ++) { |
|
| 62 | + for ($page = $from_page; $page <= $to_page; $page++) { |
|
| 63 | 63 | if ($page == $current_page) { |
| 64 | 64 | $pages[$page] = false; |
| 65 | 65 | } else { |
@@ -19,6 +19,10 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | /* primaryKey may be an array |
| 21 | 21 | */ |
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @param string $sTable |
|
| 25 | + */ |
|
| 22 | 26 | public function __construct($sTable) |
| 23 | 27 | { |
| 24 | 28 | $this->pk = array(); |
@@ -26,6 +30,11 @@ discard block |
||
| 26 | 30 | $this->sTable = $sTable; |
| 27 | 31 | } |
| 28 | 32 | |
| 33 | + /** |
|
| 34 | + * @param string $sField |
|
| 35 | + * @param boolean $bNullable |
|
| 36 | + * @param integer $nInsertFunction |
|
| 37 | + */ |
|
| 29 | 38 | public function addPKInt($sField, $nDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 30 | 39 | { |
| 31 | 40 | $this->pk[$sField] = array( |
@@ -100,6 +109,11 @@ discard block |
||
| 100 | 109 | ); |
| 101 | 110 | } |
| 102 | 111 | |
| 112 | + /** |
|
| 113 | + * @param string $sField |
|
| 114 | + * @param boolean $bNullable |
|
| 115 | + * @param integer $nInsertFunction |
|
| 116 | + */ |
|
| 103 | 117 | public function addInt($sField, $nDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 104 | 118 | { |
| 105 | 119 | $this->fields[$sField] = array( |
@@ -112,6 +126,11 @@ discard block |
||
| 112 | 126 | ); |
| 113 | 127 | } |
| 114 | 128 | |
| 129 | + /** |
|
| 130 | + * @param string $sField |
|
| 131 | + * @param integer $nDefault |
|
| 132 | + * @param boolean $bNullable |
|
| 133 | + */ |
|
| 115 | 134 | public function addFloat($sField, $nDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 116 | 135 | { |
| 117 | 136 | $this->fields[$sField] = array( |
@@ -124,6 +143,11 @@ discard block |
||
| 124 | 143 | ); |
| 125 | 144 | } |
| 126 | 145 | |
| 146 | + /** |
|
| 147 | + * @param string $sField |
|
| 148 | + * @param integer $nDefault |
|
| 149 | + * @param boolean $bNullable |
|
| 150 | + */ |
|
| 127 | 151 | public function addDouble($sField, $nDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 128 | 152 | { |
| 129 | 153 | $this->fields[$sField] = array( |
@@ -136,6 +160,11 @@ discard block |
||
| 136 | 160 | ); |
| 137 | 161 | } |
| 138 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $sField |
|
| 165 | + * @param boolean $bNullable |
|
| 166 | + * @param integer $nInsertFunction |
|
| 167 | + */ |
|
| 139 | 168 | public function addString($sField, $sDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 140 | 169 | { |
| 141 | 170 | $this->fields[$sField] = array( |
@@ -148,6 +177,10 @@ discard block |
||
| 148 | 177 | ); |
| 149 | 178 | } |
| 150 | 179 | |
| 180 | + /** |
|
| 181 | + * @param string $sField |
|
| 182 | + * @param boolean $bNullable |
|
| 183 | + */ |
|
| 151 | 184 | public function addBoolean($sField, $bDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 152 | 185 | { |
| 153 | 186 | $this->fields[$sField] = array( |
@@ -160,6 +193,11 @@ discard block |
||
| 160 | 193 | ); |
| 161 | 194 | } |
| 162 | 195 | |
| 196 | + /** |
|
| 197 | + * @param string $sField |
|
| 198 | + * @param boolean $bNullable |
|
| 199 | + * @param integer $nInsertFunction |
|
| 200 | + */ |
|
| 163 | 201 | public function addDate($sField, $dDefault, $bNullable, $nInsertFunction = RE_INSERT_NOTHING) |
| 164 | 202 | { |
| 165 | 203 | $this->fields[$sField] = array( |
@@ -339,6 +377,9 @@ discard block |
||
| 339 | 377 | return join(' AND ', $fwhere); |
| 340 | 378 | } |
| 341 | 379 | |
| 380 | + /** |
|
| 381 | + * @param string $sField |
|
| 382 | + */ |
|
| 342 | 383 | public function getValue($sField) |
| 343 | 384 | { |
| 344 | 385 | if (isset($this->pk[$sField])) { |
@@ -353,6 +394,9 @@ discard block |
||
| 353 | 394 | return $this->fields[$sField]['default']; |
| 354 | 395 | } |
| 355 | 396 | |
| 397 | + /** |
|
| 398 | + * @param string $sField |
|
| 399 | + */ |
|
| 356 | 400 | public function getChanged($sField) |
| 357 | 401 | { |
| 358 | 402 | return $this->fields[$sField]['changed']; |
@@ -367,6 +411,9 @@ discard block |
||
| 367 | 411 | } |
| 368 | 412 | } |
| 369 | 413 | |
| 414 | + /** |
|
| 415 | + * @param string $sField |
|
| 416 | + */ |
|
| 370 | 417 | public function setValue($sField, $sValue) |
| 371 | 418 | { |
| 372 | 419 | if ($this->bLoaded == false || ($this->bAddNew == false && $this->bExist == false)) { |
@@ -556,6 +603,9 @@ discard block |
||
| 556 | 603 | return $sql; |
| 557 | 604 | } |
| 558 | 605 | |
| 606 | + /** |
|
| 607 | + * @param string $field |
|
| 608 | + */ |
|
| 559 | 609 | public function saveField($field) |
| 560 | 610 | { |
| 561 | 611 | if ($this->bLoaded == false || $this->bExist == false || $this->bAddNew == true) { |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | public $sTable; |
| 11 | 11 | public $sAutoIncrementField = null; |
| 12 | - public $pk; // (idx:name; type, default, nullable, value, insertfunction) |
|
| 12 | + public $pk; // (idx:name; type, default, nullable, value, insertfunction) |
|
| 13 | 13 | public $fields; // (idx:name; type, default, nullable, value, changed, insertfunction) |
| 14 | 14 | |
| 15 | 15 | // status var |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | if ($i == $index) { |
| 255 | 255 | return $k; |
| 256 | 256 | } |
| 257 | - $i ++; |
|
| 257 | + $i++; |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | $fselect = array(); |
| 316 | 316 | $sql = 'SELECT '; |
| 317 | 317 | foreach ($this->fields as $k => $field) { |
| 318 | - $fselect[] = '`' . sql_escape($k) . '`'; |
|
| 318 | + $fselect[] = '`'.sql_escape($k).'`'; |
|
| 319 | 319 | } |
| 320 | 320 | $sql .= join(', ', $fselect); |
| 321 | 321 | |
| 322 | - $sql .= ' FROM `' . sql_escape($this->sTable) . '`'; |
|
| 323 | - $sql .= ' WHERE ' . $this->pBuildPK(); |
|
| 322 | + $sql .= ' FROM `'.sql_escape($this->sTable).'`'; |
|
| 323 | + $sql .= ' WHERE '.$this->pBuildPK(); |
|
| 324 | 324 | |
| 325 | 325 | return $sql; |
| 326 | 326 | } |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | $fwhere = array(); |
| 331 | 331 | foreach ($this->pk as $k => $field) { |
| 332 | 332 | if ($field['value'] === null) { |
| 333 | - $fwhere[] = 'ISNULL(`' . sql_escape($k) . '`)'; |
|
| 333 | + $fwhere[] = 'ISNULL(`'.sql_escape($k).'`)'; |
|
| 334 | 334 | } else { |
| 335 | - $fwhere[] = '`' . sql_escape($k) . '`=\'' . sql_escape($field['value']) . '\''; |
|
| 335 | + $fwhere[] = '`'.sql_escape($k).'`=\''.sql_escape($field['value']).'\''; |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | public function pBuildInsert() |
| 464 | 464 | { |
| 465 | - $sql = 'INSERT IGNORE INTO `' . sql_escape($this->sTable) . '` ('; |
|
| 465 | + $sql = 'INSERT IGNORE INTO `'.sql_escape($this->sTable).'` ('; |
|
| 466 | 466 | |
| 467 | 467 | $sFields = array(); |
| 468 | 468 | $sValues = array(); |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | continue; |
| 481 | 481 | } |
| 482 | 482 | |
| 483 | - $sFields[] = '`' . sql_escape($k) . '`'; |
|
| 483 | + $sFields[] = '`'.sql_escape($k).'`'; |
|
| 484 | 484 | |
| 485 | 485 | if ((($field['insertfunction'] & RE_INSERT_OVERWRITE) == RE_INSERT_OVERWRITE) || (($field['changed'] == false) && ($field['insertfunction'] != RE_INSERT_NOTHING))) { |
| 486 | 486 | if (($field['insertfunction'] & RE_INSERT_NOW) == RE_INSERT_NOW) { |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | if ($field['value'] === null) { |
| 493 | 493 | $sValues[] = 'NULL'; |
| 494 | 494 | } else { |
| 495 | - $sValues[] = '\'' . sql_escape($this->pFormatValueSql($field['type'], $field['value'])) . '\''; |
|
| 495 | + $sValues[] = '\''.sql_escape($this->pFormatValueSql($field['type'], $field['value'])).'\''; |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | } |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | continue; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - $sFields[] = '`' . sql_escape($k) . '`'; |
|
| 505 | + $sFields[] = '`'.sql_escape($k).'`'; |
|
| 506 | 506 | |
| 507 | 507 | if ((($field['insertfunction'] & RE_INSERT_OVERWRITE) == RE_INSERT_OVERWRITE) || (($field['changed'] == false) && ($field['insertfunction'] != RE_INSERT_NOTHING))) { |
| 508 | 508 | if (($field['insertfunction'] & RE_INSERT_NOW) == RE_INSERT_NOW) { |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | if ($field['value'] === null) { |
| 515 | 515 | $sValues[] = 'NULL'; |
| 516 | 516 | } else { |
| 517 | - $sValues[] = '\'' . sql_escape($this->pFormatValueSql($field['type'], $field['value'])) . '\''; |
|
| 517 | + $sValues[] = '\''.sql_escape($this->pFormatValueSql($field['type'], $field['value'])).'\''; |
|
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | public function pBuildUpdate() |
| 530 | 530 | { |
| 531 | - $sql = 'UPDATE IGNORE `' . sql_escape($this->sTable) . '` SET '; |
|
| 531 | + $sql = 'UPDATE IGNORE `'.sql_escape($this->sTable).'` SET '; |
|
| 532 | 532 | |
| 533 | 533 | $sSet = ''; |
| 534 | 534 | foreach ($this->fields as $k => $field) { |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | if ($field['value'] === null) { |
| 541 | - $sSet .= '`' . sql_escape($k) . '`=NULL'; |
|
| 541 | + $sSet .= '`'.sql_escape($k).'`=NULL'; |
|
| 542 | 542 | } else { |
| 543 | - $sSet .= '`' . sql_escape($k) . '`=\'' . sql_escape($this->pFormatValueSql($field['type'], $field['value'])) . '\''; |
|
| 543 | + $sSet .= '`'.sql_escape($k).'`=\''.sql_escape($this->pFormatValueSql($field['type'], $field['value'])).'\''; |
|
| 544 | 544 | } |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -567,12 +567,12 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | if ($this->fields[$field]['value'] === null) { |
| 570 | - $sSet = '`' . sql_escape($field) . '`=NULL'; |
|
| 570 | + $sSet = '`'.sql_escape($field).'`=NULL'; |
|
| 571 | 571 | } else { |
| 572 | - $sSet = '`' . sql_escape($field) . '`=\'' . sql_escape($this->pFormatValueSql($this->fields[$field]['type'], $this->fields[$field]['value'])) . '\''; |
|
| 572 | + $sSet = '`'.sql_escape($field).'`=\''.sql_escape($this->pFormatValueSql($this->fields[$field]['type'], $this->fields[$field]['value'])).'\''; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | - $sql = 'UPDATE `' . sql_escape($this->sTable) . '` SET ' . $sSet; |
|
| 575 | + $sql = 'UPDATE `'.sql_escape($this->sTable).'` SET '.$sSet; |
|
| 576 | 576 | $sql .= ' WHERE '; |
| 577 | 577 | $sql .= $this->pBuildPK(); |
| 578 | 578 | |
@@ -13,6 +13,7 @@ |
||
| 13 | 13 | * |
| 14 | 14 | * @param int $items number of feeditems to parse from feed |
| 15 | 15 | * @param string $url url of the feed to parse |
| 16 | + * @param boolean $includetext |
|
| 16 | 17 | * |
| 17 | 18 | * @return string $item feeditems as HTML-string |
| 18 | 19 | */ |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | 'description' => $item->description |
| 67 | 67 | ); |
| 68 | 68 | // increment counter |
| 69 | - $i ++; |
|
| 69 | + $i++; |
|
| 70 | 70 | // htmlspecialchars_decode() works around inconsistent HTML encoding |
| 71 | 71 | // e.g. in SMF Forum Threads |
| 72 | 72 | } elseif (!in_array(htmlspecialchars_decode($item->title), $headlines) && |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | 'title' => $item->title, |
| 79 | 79 | 'link' => $item->link |
| 80 | 80 | ); |
| 81 | - $headlines[] = "" . htmlspecialchars_decode($item->title); |
|
| 81 | + $headlines[] = "".htmlspecialchars_decode($item->title); |
|
| 82 | 82 | // increment counter |
| 83 | - $i ++; |
|
| 83 | + $i++; |
|
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -71,7 +71,8 @@ |
||
| 71 | 71 | // e.g. in SMF Forum Threads |
| 72 | 72 | } elseif (!in_array(htmlspecialchars_decode($item->title), $headlines) && |
| 73 | 73 | strpos($item->title, 'VERSCHOBEN') === false |
| 74 | - ) { // hack to exclude forum thread-move messages |
|
| 74 | + ) { |
|
| 75 | +// hack to exclude forum thread-move messages |
|
| 75 | 76 | // fill array |
| 76 | 77 | $rss[] = array( |
| 77 | 78 | 'pubDate' => date('Y-m-d', strtotime($item->pubDate)), |
@@ -159,6 +159,9 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | // str = long text |
| 162 | +/** |
|
| 163 | + * @param boolean $simple |
|
| 164 | + */ |
|
| 162 | 165 | function ftsearch_split(&$str, $simple) |
| 163 | 166 | { |
| 164 | 167 | global $ftsearch_ignores; |
@@ -488,6 +491,9 @@ discard block |
||
| 488 | 491 | sql("DELETE FROM `search_index_times` WHERE `object_type`='&1' AND `object_id`='&2'", $object_type, $object_id); |
| 489 | 492 | } |
| 490 | 493 | |
| 494 | +/** |
|
| 495 | + * @param integer $object_type |
|
| 496 | + */ |
|
| 491 | 497 | function ftsearch_set_entries($object_type, $object_id, $cache_id, &$text, $last_modified) |
| 492 | 498 | { |
| 493 | 499 | ftsearch_delete_entries($object_type, $object_id, $cache_id); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $str = ''; |
| 189 | 189 | |
| 190 | 190 | ftsearch_load_ignores(); |
| 191 | - for ($i = count($astr) - 1; $i >= 0; $i --) { |
|
| 191 | + for ($i = count($astr) - 1; $i >= 0; $i--) { |
|
| 192 | 192 | // ignore? |
| 193 | 193 | if (array_search(mb_strtolower($astr[$i]), $ftsearch_ignores) !== false) { |
| 194 | 194 | unset($astr[$i]); |
@@ -237,11 +237,11 @@ discard block |
||
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | // doppelte chars ersetzen |
| 240 | - for ($c = ord('a'); $c <= ord('z'); $c ++) { |
|
| 240 | + for ($c = ord('a'); $c <= ord('z'); $c++) { |
|
| 241 | 241 | $old_str = ''; |
| 242 | 242 | while ($old_str != $str) { |
| 243 | 243 | $old_str = $str; |
| 244 | - $str = mb_ereg_replace(chr($c) . chr($c), chr($c), $str); |
|
| 244 | + $str = mb_ereg_replace(chr($c).chr($c), chr($c), $str); |
|
| 245 | 245 | } |
| 246 | 246 | $old_str = ''; |
| 247 | 247 | } |
@@ -569,6 +569,9 @@ |
||
| 569 | 569 | return $str; |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | +/** |
|
| 573 | + * @return string |
|
| 574 | + */ |
|
| 572 | 575 | function changePlaceholder($str, $inverse = false) |
| 573 | 576 | { |
| 574 | 577 | static $translate = array( |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $gpxHead = |
| 31 | 31 | '<?xml version="1.0" encoding="utf-8"?> |
| 32 | -<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="' . $server_name . ' - ' . $server_address . '" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0/1 http://www.groundspeak.com/cache/1/0/1/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0"> |
|
| 33 | - <name>Cache listing generated from ' . $server_name . '</name> |
|
| 34 | - <desc>This is a waypoint file generated from ' . $server_name . '{wpchildren}</desc> |
|
| 32 | +<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="' . $server_name.' - '.$server_address.'" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.groundspeak.com/cache/1/0/1 http://www.groundspeak.com/cache/1/0/1/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0"> |
|
| 33 | + <name>Cache listing generated from ' . $server_name.'</name> |
|
| 34 | + <desc>This is a waypoint file generated from ' . $server_name.'{wpchildren}</desc> |
|
| 35 | 35 | <author>Opencaching.de</author> |
| 36 | - <email>' . text_xmlentities($opt['mail']['contact']) . '</email> |
|
| 37 | - <url>' . $server_domain . '</url> |
|
| 38 | - <urlname>' . $opt['page']['slogan'] . '</urlname> |
|
| 36 | + <email>' . text_xmlentities($opt['mail']['contact']).'</email> |
|
| 37 | + <url>' . $server_domain.'</url> |
|
| 38 | + <urlname>' . $opt['page']['slogan'].'</urlname> |
|
| 39 | 39 | <time>{time}</time> |
| 40 | 40 | <keywords>cache, geocache, opencaching, waypoint</keywords> |
| 41 | 41 | '; |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | <time>{time}</time> |
| 46 | 46 | <name>{waypoint}</name> |
| 47 | 47 | <desc>{cachename}</desc> |
| 48 | - <src>' . $server_domain . '</src> |
|
| 49 | - <url>' . $server_address . 'viewcache.php?cacheid={cacheid}</url> |
|
| 48 | + <src>' . $server_domain.'</src> |
|
| 49 | + <url>' . $server_address.'viewcache.php?cacheid={cacheid}</url> |
|
| 50 | 50 | <urlname>{cachename}</urlname> |
| 51 | 51 | <sym>{sym}</sym> |
| 52 | 52 | <type>Geocache|{type}</type> |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | <name>{name}</name> |
| 112 | 112 | <cmt>{comment}</cmt> |
| 113 | 113 | <desc>{desc}</desc> |
| 114 | - <url>' . $server_address . 'viewcache.php?cacheid={cacheid}</url> |
|
| 114 | + <url>' . $server_address.'viewcache.php?cacheid={cacheid}</url> |
|
| 115 | 115 | <urlname>{parent} {cachename}</urlname> |
| 116 | 116 | <sym>{type}</sym> |
| 117 | 117 | <type>Waypoint|{type}</type> |
@@ -251,18 +251,18 @@ discard block |
||
| 251 | 251 | } else { |
| 252 | 252 | // Ocprop: <groundspeak:encoded_hints>(.*?)<\/groundspeak:encoded_hints> |
| 253 | 253 | $hint = html_entity_decode(strip_tags($r['hint']), ENT_COMPAT, "UTF-8"); |
| 254 | - $thisline = mb_ereg_replace('{hints}', ' <groundspeak:encoded_hints>' . text_xmlentities($hint) . '</groundspeak:encoded_hints>', $thisline); |
|
| 254 | + $thisline = mb_ereg_replace('{hints}', ' <groundspeak:encoded_hints>'.text_xmlentities($hint).'</groundspeak:encoded_hints>', $thisline); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $thisline = mb_ereg_replace('{shortdesc}', text_xmlentities($r['short_desc']), $thisline); |
| 258 | 258 | |
| 259 | 259 | $desc = $r['desc']; |
| 260 | - $desc = str_replace(' src="images/uploads/', ' src="' . $server_address . 'images/uploads/', $desc); |
|
| 260 | + $desc = str_replace(' src="images/uploads/', ' src="'.$server_address.'images/uploads/', $desc); |
|
| 261 | 261 | if ($r['listing_outdated']) { |
| 262 | - $desc = "<p style='color:#c00000'><strong>" . |
|
| 263 | - $translate->t('This geocache description may be outdated.', '', basename(__FILE__), __LINE__) . '</strong> ' . |
|
| 264 | - $translate->t('See the log entries for more information.', '', basename(__FILE__), __LINE__) . |
|
| 265 | - "</p>\n" . $desc; |
|
| 262 | + $desc = "<p style='color:#c00000'><strong>". |
|
| 263 | + $translate->t('This geocache description may be outdated.', '', basename(__FILE__), __LINE__).'</strong> '. |
|
| 264 | + $translate->t('See the log entries for more information.', '', basename(__FILE__), __LINE__). |
|
| 265 | + "</p>\n".$desc; |
|
| 266 | 266 | } |
| 267 | 267 | $license = getLicenseDisclaimer( |
| 268 | 268 | $r['userid'], |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | $sDiffDecimals = '.5'; |
| 305 | 305 | } |
| 306 | 306 | $r['difficulty'] -= $r['difficulty'] % 2; |
| 307 | - $thisline = mb_ereg_replace('{difficulty}', ($r['difficulty'] / 2) . $sDiffDecimals, $thisline); |
|
| 307 | + $thisline = mb_ereg_replace('{difficulty}', ($r['difficulty'] / 2).$sDiffDecimals, $thisline); |
|
| 308 | 308 | |
| 309 | 309 | $sTerrDecimals = ''; |
| 310 | 310 | if ($r['terrain'] % 2) { |
| 311 | 311 | $sTerrDecimals = '.5'; |
| 312 | 312 | } |
| 313 | 313 | $r['terrain'] -= $r['terrain'] % 2; |
| 314 | - $thisline = mb_ereg_replace('{terrain}', ($r['terrain'] / 2) . $sTerrDecimals, $thisline); |
|
| 314 | + $thisline = mb_ereg_replace('{terrain}', ($r['terrain'] / 2).$sTerrDecimals, $thisline); |
|
| 315 | 315 | |
| 316 | 316 | $thisline = mb_ereg_replace('{owner}', text_xmlentities($r['username']), $thisline); |
| 317 | 317 | $thisline = mb_ereg_replace('{userid}', $r['userid'], $thisline); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $thislog = mb_ereg_replace('{type}', $gpxLogType[3], $thislog); |
| 343 | 343 | $thislog = mb_ereg_replace('{text}', text_xmlentities($cacheNote['note']), $thislog); |
| 344 | 344 | |
| 345 | - $logentries .= $thislog . "\n"; |
|
| 345 | + $logentries .= $thislog."\n"; |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | WHERE |
| 374 | 374 | `cache_logs`.`user_id`=`user`.`user_id` AND |
| 375 | 375 | `cache_logs`.`cache_id`='&1' AND |
| 376 | - `user`.`user_id`" . $user_operator . "'&2' |
|
| 376 | + `user`.`user_id`" . $user_operator."'&2' |
|
| 377 | 377 | ORDER BY |
| 378 | 378 | `cache_logs`.`order_date` DESC, |
| 379 | 379 | `cache_logs`.`date_created` DESC, |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | $thislog = mb_ereg_replace('{username}', text_xmlentities($rLog['username']), $thislog); |
| 391 | 391 | |
| 392 | 392 | if ($rLog['type'] == 3 && $rLog['needs_maintenance'] == 2) { |
| 393 | - $logtype = 'Needs Maintenance'; // with capital M, other than cache attribute |
|
| 393 | + $logtype = 'Needs Maintenance'; // with capital M, other than cache attribute |
|
| 394 | 394 | } elseif (isset($gpxLogType[$rLog['type']])) { |
| 395 | 395 | $logtype = $gpxLogType[$rLog['type']]; |
| 396 | 396 | } else { |
@@ -416,16 +416,16 @@ discard block |
||
| 416 | 416 | foreach ($flags as &$flag) { |
| 417 | 417 | $ft = $translate->t($flag, '', basename(__FILE__), __LINE__); |
| 418 | 418 | if (strstr($flag, 'is ok') == false) { |
| 419 | - $flag = '<span style="color:#c00000">' . $ft . '</span>'; |
|
| 419 | + $flag = '<span style="color:#c00000">'.$ft.'</span>'; |
|
| 420 | 420 | } else { |
| 421 | - $flag = '<span style="color:#00c000">' . $ft . '</span>'; |
|
| 421 | + $flag = '<span style="color:#00c000">'.$ft.'</span>'; |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | - $logtext = "<p><i>" . implode(', ', $flags) . "</i></p>\n" . $logtext; |
|
| 424 | + $logtext = "<p><i>".implode(', ', $flags)."</i></p>\n".$logtext; |
|
| 425 | 425 | } |
| 426 | 426 | $thislog = mb_ereg_replace('{text}', text_xmlentities($logtext), $thislog); |
| 427 | 427 | |
| 428 | - $logentries .= $thislog . "\n"; |
|
| 428 | + $logentries .= $thislog."\n"; |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | mysql_free_result($rsLogs); |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | $thisattribute = mb_ereg_replace('{attrib_id}', $rAttrib['gc_id'], $gpxAttributes); |
| 452 | 452 | $thisattribute = mb_ereg_replace('{attrib_inc}', $rAttrib['gc_inc'], $thisattribute); |
| 453 | 453 | $thisattribute = mb_ereg_replace('{attrib_name}', text_xmlentities($rAttrib['gc_name']), $thisattribute); |
| 454 | - $attribentries .= $thisattribute . "\n"; |
|
| 454 | + $attribentries .= $thisattribute."\n"; |
|
| 455 | 455 | $gc_ids[$rAttrib['gc_id']] = true; |
| 456 | 456 | } |
| 457 | 457 | } |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | $thisattribute = mb_ereg_replace('{attrib_inc}', '1', $thisattribute); |
| 463 | 463 | $thisattribute = mb_ereg_replace('{attrib_name}', 'Needs maintenance', $thisattribute); |
| 464 | 464 | // with lowercase m, other than log type |
| 465 | - $attribentries .= $thisattribute . "\n"; |
|
| 465 | + $attribentries .= $thisattribute."\n"; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | $thisline = mb_ereg_replace('{attributes}', $attribentries, $thisline); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $thiskrety = mb_ereg_replace('{gkref}', sprintf("GK%04X", $rGK['id']), $thiskrety); |
| 490 | 490 | $thiskrety = mb_ereg_replace('{gkname}', text_xmlentities($rGK['name']), $thiskrety); |
| 491 | 491 | |
| 492 | - $gkentries .= $thiskrety . "\n"; |
|
| 492 | + $gkentries .= $thiskrety."\n"; |
|
| 493 | 493 | } |
| 494 | 494 | mysql_free_result($rsGeokrety); |
| 495 | 495 | $thisline = mb_ereg_replace('{geokrety}', $gkentries, $thisline); |
@@ -497,42 +497,42 @@ discard block |
||
| 497 | 497 | // additional waypoints, including personal cache note |
| 498 | 498 | $childWaypoints = $childwphandler->getChildWps($r['cacheid']); |
| 499 | 499 | $n = 1; |
| 500 | - $digits = "%0" . strlen(count($childWaypoints)) . "d"; |
|
| 500 | + $digits = "%0".strlen(count($childWaypoints))."d"; |
|
| 501 | 501 | |
| 502 | 502 | foreach ($childWaypoints as $childWaypoint) { |
| 503 | 503 | $thiswp = $gpxWaypoints; |
| 504 | 504 | $thiswp = mb_ereg_replace('{wp_lat}', sprintf('%01.5f', $childWaypoint['latitude']), $thiswp); |
| 505 | 505 | $thiswp = mb_ereg_replace('{wp_lon}', sprintf('%01.5f', $childWaypoint['longitude']), $thiswp); |
| 506 | 506 | $thiswp = mb_ereg_replace('{time}', $time, $thiswp); |
| 507 | - $thiswp = mb_ereg_replace('{name}', $r['waypoint'] . '-' . sprintf($digits, $n), $thiswp); |
|
| 507 | + $thiswp = mb_ereg_replace('{name}', $r['waypoint'].'-'.sprintf($digits, $n), $thiswp); |
|
| 508 | 508 | $thiswp = mb_ereg_replace('{cachename}', text_xmlentities($r['name']), $thiswp); |
| 509 | 509 | $thiswp = mb_ereg_replace('{comment}', text_xmlentities($childWaypoint['description']), $thiswp); |
| 510 | 510 | $thiswp = mb_ereg_replace('{desc}', text_xmlentities($childWaypoint['name']), $thiswp); |
| 511 | 511 | switch ($childWaypoint['type']) { |
| 512 | 512 | case 1: |
| 513 | 513 | $wp_typename = "Parking Area"; |
| 514 | - break; // well-known garmin symbols |
|
| 514 | + break; // well-known garmin symbols |
|
| 515 | 515 | case 2: |
| 516 | 516 | $wp_typename = "Flag, Green"; |
| 517 | - break; // stage / ref point |
|
| 517 | + break; // stage / ref point |
|
| 518 | 518 | case 3: |
| 519 | 519 | $wp_typename = "Flag, Blue"; |
| 520 | - break; // path |
|
| 520 | + break; // path |
|
| 521 | 521 | case 4: |
| 522 | 522 | $wp_typename = "Circle with X"; |
| 523 | 523 | break; // final |
| 524 | 524 | case 5: |
| 525 | 525 | $wp_typename = "Diamond, Green"; |
| 526 | - break; // point of interest |
|
| 526 | + break; // point of interest |
|
| 527 | 527 | default: |
| 528 | 528 | $wp_typename = "Flag, Blue"; |
| 529 | - break; // for the case new types are forgotten here .. |
|
| 529 | + break; // for the case new types are forgotten here .. |
|
| 530 | 530 | } |
| 531 | 531 | $thiswp = mb_ereg_replace('{type}', text_xmlentities($wp_typename), $thiswp); |
| 532 | 532 | $thiswp = mb_ereg_replace('{parent}', $r['waypoint'], $thiswp); |
| 533 | 533 | $thiswp = mb_ereg_replace('{cacheid}', $r['cacheid'], $thiswp); |
| 534 | 534 | $waypoints .= $thiswp; |
| 535 | - ++ $n; |
|
| 535 | + ++$n; |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | if ($cacheNote && !empty($cacheNote['latitude']) && !empty($cacheNote['longitude'])) { |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | $thiswp = mb_ereg_replace('{wp_lat}', sprintf('%01.5f', $cacheNote['latitude']), $thiswp); |
| 541 | 541 | $thiswp = mb_ereg_replace('{wp_lon}', sprintf('%01.5f', $cacheNote['longitude']), $thiswp); |
| 542 | 542 | $thiswp = mb_ereg_replace('{time}', $time, $thiswp); |
| 543 | - $thiswp = mb_ereg_replace('{name}', $r['waypoint'] . 'NOTE', $thiswp); |
|
| 543 | + $thiswp = mb_ereg_replace('{name}', $r['waypoint'].'NOTE', $thiswp); |
|
| 544 | 544 | $thiswp = mb_ereg_replace('{cachename}', text_xmlentities($r['name']), $thiswp); |
| 545 | 545 | $thiswp = mb_ereg_replace('{comment}', text_xmlentities($cacheNote['note']), $thiswp); |
| 546 | 546 | $thiswp = mb_ereg_replace('{desc}', text_xmlentities($cache_note_text), $thiswp); |
@@ -620,11 +620,11 @@ discard block |
||
| 620 | 620 | $cacheid |
| 621 | 621 | ); |
| 622 | 622 | while ($r = sql_fetch_array($rs)) { |
| 623 | - $retval .= '<div style="float:left; padding:8px"><a href="' . $r['url'] . '" target="_blank">' . |
|
| 624 | - '<img src="' . $server_address . 'thumbs.php?type=2&uuid=' . $r["uuid"] . '" />' . |
|
| 625 | - '</a><br />' . $r['title']; |
|
| 623 | + $retval .= '<div style="float:left; padding:8px"><a href="'.$r['url'].'" target="_blank">'. |
|
| 624 | + '<img src="'.$server_address.'thumbs.php?type=2&uuid='.$r["uuid"].'" />'. |
|
| 625 | + '</a><br />'.$r['title']; |
|
| 626 | 626 | if ($r['spoiler']) { |
| 627 | - $retval .= ' (' . _('click on spoiler to display') . ')'; |
|
| 627 | + $retval .= ' ('._('click on spoiler to display').')'; |
|
| 628 | 628 | } |
| 629 | 629 | $retval .= "</div>"; |
| 630 | 630 | } |
@@ -202,6 +202,10 @@ |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | +/** |
|
| 206 | + * @param string $interval |
|
| 207 | + * @param string $dateTimeEnd |
|
| 208 | + */ |
|
| 205 | 209 | function dateDiff($interval, $dateTimeBegin, $dateTimeEnd) |
| 206 | 210 | { |
| 207 | 211 | //Parse about any English textual datetime |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | LEFT JOIN `caches_attributes` AS `tbloconly` |
| 25 | 25 | ON `caches`.`cache_id`=`tbloconly`.`cache_id` AND `tbloconly`.`attrib_id`=6 |
| 26 | 26 | LEFT JOIN `sys_trans_text` `stt` ON `stt`.`trans_id`=`cache_type`.`trans_id` |
| 27 | - AND `stt`.`lang`=\'' . sql_escape($opt['template']['locale']) . '\''; |
|
| 27 | + AND `stt`.`lang`=\'' . sql_escape($opt['template']['locale']).'\''; |
|
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | function search_output() |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $tpl->menuitem = MNU_CACHES_SEARCH_RESULT; |
| 39 | 39 | |
| 40 | 40 | $startat = floor($startat / $caches_per_page) * $caches_per_page; |
| 41 | - $sql .= ' LIMIT ' . $startat . ', ' . $caches_per_page; |
|
| 41 | + $sql .= ' LIMIT '.$startat.', '.$caches_per_page; |
|
| 42 | 42 | |
| 43 | 43 | // run SQL query |
| 44 | 44 | sql_enable_foundrows(); |
| 45 | - $rs_caches = sql_slave("SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS " . $sql); |
|
| 45 | + $rs_caches = sql_slave("SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS ".$sql); |
|
| 46 | 46 | $resultcount = sql_value_slave('SELECT FOUND_ROWS()', 0); |
| 47 | 47 | sql_foundrows_done(); |
| 48 | 48 | $tpl->assign('results_count', $resultcount); |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | if ($options['sort'] != 'bymylastlog' || !$login->logged_in()) { |
| 96 | 96 | $ownlogs = ""; |
| 97 | 97 | } else { |
| 98 | - $ownlogs = " AND `cache_logs`.`user_id`='" . sql_escape($login->userid) . "'"; |
|
| 98 | + $ownlogs = " AND `cache_logs`.`user_id`='".sql_escape($login->userid)."'"; |
|
| 99 | 99 | } |
| 100 | 100 | $sql = " |
| 101 | 101 | SELECT `cache_logs`.`id`, `cache_logs`.`type`, `cache_logs`.`date`, `log_types`.`icon_small` |
| 102 | 102 | FROM `cache_logs`, `log_types` |
| 103 | - WHERE `cache_logs`.`cache_id`='" . sql_escape($rCache['cache_id']) . "' |
|
| 104 | - AND `log_types`.`id`=`cache_logs`.`type`" . $ownlogs . " |
|
| 103 | + WHERE `cache_logs`.`cache_id`='" . sql_escape($rCache['cache_id'])."' |
|
| 104 | + AND `log_types`.`id`=`cache_logs`.`type`" . $ownlogs." |
|
| 105 | 105 | ORDER BY `cache_logs`.`order_date` DESC, `cache_logs`.`date_created` DESC, `cache_logs`.`id` DESC |
| 106 | 106 | LIMIT 6"; |
| 107 | 107 | $rs = sql_slave($sql); |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | $tpl->assign('caches', $caches); |
| 140 | 140 | |
| 141 | - $page = 'search.php?queryid=' . $options['queryid'] . '&startat={offset}&sortby=' . $options['sort']; |
|
| 141 | + $page = 'search.php?queryid='.$options['queryid'].'&startat={offset}&sortby='.$options['sort']; |
|
| 142 | 142 | if (isset($options['sortorder']) && $options['sortorder']) { |
| 143 | - $page .= "&sortorder=" . $options['sortorder']; |
|
| 143 | + $page .= "&sortorder=".$options['sortorder']; |
|
| 144 | 144 | } |
| 145 | 145 | if (isset($options['creationdate']) && $options['creationdate']) { |
| 146 | - $page .= "&creationdate=" . $options['creationdate']; |
|
| 146 | + $page .= "&creationdate=".$options['creationdate']; |
|
| 147 | 147 | } |
| 148 | 148 | $pager = new pager($page, 2, 9); |
| 149 | 149 | $pager->make_from_offset($startat, $resultcount, $caches_per_page); |
@@ -203,6 +203,9 @@ |
||
| 203 | 203 | return $str; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | +/** |
|
| 207 | + * @param string $str |
|
| 208 | + */ |
|
| 206 | 209 | function lf2crlf($str) |
| 207 | 210 | { |
| 208 | 211 | return str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $str)); |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | <status id=\"{statusid}\">{status}</status> |
| 36 | 36 | <lon value=\"{lonvalue}\">{lon}</lon> |
| 37 | 37 | <lat value=\"{latvalue}\">{lat}</lat> |
| 38 | - <distance unit=\"" . $distance_unit . "\">{distance}</distance> |
|
| 38 | + <distance unit=\"" . $distance_unit."\">{distance}</distance> |
|
| 39 | 39 | <type id=\"{typeid}\">{type}</type> |
| 40 | 40 | <difficulty>{difficulty}</difficulty> |
| 41 | 41 | <terrain>{terrain}</terrain> |
| 42 | 42 | <size id=\"{sizeid}\">{container}</size> |
| 43 | 43 | <country id=\"{countryid}\">{country}</country> |
| 44 | - <link><![CDATA[" . $opt['page']['default_absolute_url'] . "viewcache.php?wp={waypoint}]]></link> |
|
| 44 | + <link><![CDATA[" . $opt['page']['default_absolute_url']."viewcache.php?wp={waypoint}]]></link> |
|
| 45 | 45 | <desc><![CDATA[{shortdesc}]]></desc> |
| 46 | 46 | <hints><![CDATA[{hints}]]></hints> |
| 47 | 47 | </cache> |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // create temporary table |
| 51 | 51 | sql_temp_table_slave('searchtmp'); |
| 52 | - sql_slave('CREATE TEMPORARY TABLE &searchtmp SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS ' . $sql . $sqlLimit); |
|
| 52 | + sql_slave('CREATE TEMPORARY TABLE &searchtmp SELECT SQL_BUFFER_RESULT SQL_CALC_FOUND_ROWS '.$sql.$sqlLimit); |
|
| 53 | 53 | |
| 54 | 54 | $resultcount = sql_value_slave('SELECT FOUND_ROWS()', 0); |
| 55 | 55 | |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // start output |
| 61 | 61 | if (!$db['debug']) { |
| 62 | - header("Content-type: application/xml; charset=" . $encoding); |
|
| 62 | + header("Content-type: application/xml; charset=".$encoding); |
|
| 63 | 63 | //header("Content-Disposition: attachment; filename=" . $sFilebasename . ".txt"); |
| 64 | 64 | |
| 65 | - echo "<?xml version=\"1.0\" encoding=\"" . $encoding . "\"?>\n"; |
|
| 65 | + echo "<?xml version=\"1.0\" encoding=\"".$encoding."\"?>\n"; |
|
| 66 | 66 | echo "<result>\n"; |
| 67 | 67 | |
| 68 | 68 | echo " <docinfo>\n"; |
| 69 | - echo " <results>" . $rCount['count'] . "</results>\n"; |
|
| 70 | - echo " <startat>" . $startat . "</startat>\n"; |
|
| 71 | - echo " <perpage>" . $count . "</perpage>\n"; |
|
| 72 | - echo " <total>" . $resultcount . "</total>\n"; |
|
| 69 | + echo " <results>".$rCount['count']."</results>\n"; |
|
| 70 | + echo " <startat>".$startat."</startat>\n"; |
|
| 71 | + echo " <perpage>".$count."</perpage>\n"; |
|
| 72 | + echo " <total>".$resultcount."</total>\n"; |
|
| 73 | 73 | echo " </docinfo>\n"; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -107,6 +107,9 @@ discard block |
||
| 107 | 107 | return $rsResult; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | + /** |
|
| 111 | + * @param string $sql |
|
| 112 | + */ |
|
| 110 | 113 | public function strip_temptable($sql) |
| 111 | 114 | { |
| 112 | 115 | $start = stripos($sql, 'SELECT '); |
@@ -118,6 +121,9 @@ discard block |
||
| 118 | 121 | return substr($sql, $start); |
| 119 | 122 | } |
| 120 | 123 | |
| 124 | + /** |
|
| 125 | + * @param string $sql |
|
| 126 | + */ |
|
| 121 | 127 | public function strip_from($sql) |
| 122 | 128 | { |
| 123 | 129 | $start = stripos($sql, 'FROM '); |
@@ -129,6 +135,9 @@ discard block |
||
| 129 | 135 | return 'SELECT * ' . substr($sql, $start); |
| 130 | 136 | } |
| 131 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $sql |
|
| 140 | + */ |
|
| 132 | 141 | public function insert_nocache($sql) |
| 133 | 142 | { |
| 134 | 143 | if (strtoupper(substr($sql, 0, 7)) == 'SELECT ') { |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * This modules gives you a very usefull SQL debugger for MySQL ... |
| 8 | 8 | ***************************************************************************/ |
| 9 | 9 | |
| 10 | -require_once $opt['rootpath'] . 'lib2/bench.inc.php'; |
|
| 10 | +require_once $opt['rootpath'].'lib2/bench.inc.php'; |
|
| 11 | 11 | |
| 12 | 12 | $sqldebugger = new sqldebugger(); |
| 13 | 13 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $command['mode'] = $db['mode']; |
| 49 | 49 | $command['slave'] = $bQuerySlave; |
| 50 | 50 | $command['server'] = $sServer; |
| 51 | - $command['dblink'] = '' . $dblink; |
|
| 51 | + $command['dblink'] = ''.$dblink; |
|
| 52 | 52 | |
| 53 | 53 | $bUseExplain = false; |
| 54 | 54 | $sql = trim($sql); |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | break; |
| 75 | 75 | } |
| 76 | 76 | $command['result'][] = $r; |
| 77 | - $c ++; |
|
| 77 | + $c++; |
|
| 78 | 78 | } |
| 79 | 79 | sql_free_result($rs); |
| 80 | 80 | |
| 81 | - $rs = mysql_query('EXPLAIN EXTENDED ' . $sqlexplain, $dblink); |
|
| 81 | + $rs = mysql_query('EXPLAIN EXTENDED '.$sqlexplain, $dblink); |
|
| 82 | 82 | while ($r = sql_fetch_assoc($rs)) { |
| 83 | 83 | $command['explain'][] = $r; |
| 84 | 84 | } |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | return ''; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - return 'SELECT * ' . substr($sql, $start); |
|
| 129 | + return 'SELECT * '.substr($sql, $start); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | public function insert_nocache($sql) |
| 133 | 133 | { |
| 134 | 134 | if (strtoupper(substr($sql, 0, 7)) == 'SELECT ') { |
| 135 | - $sql = 'SELECT SQL_NO_CACHE ' . substr($sql, 7); |
|
| 135 | + $sql = 'SELECT SQL_NO_CACHE '.substr($sql, 7); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | return $sql; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | /** Removes entry from the archive. |
| 284 | 284 | * please be very carefull with this function, there is no undo after you save the archive |
| 285 | 285 | * |
| 286 | - * @return bool true on success or false on failure |
|
| 286 | + * @return boolean|null true on success or false on failure |
|
| 287 | 287 | * |
| 288 | 288 | * @param int $idx |
| 289 | 289 | */ |
@@ -334,6 +334,10 @@ discard block |
||
| 334 | 334 | return $idx >= 0 and $idx < $this->cnt; |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | + /** |
|
| 338 | + * @param string $name |
|
| 339 | + * @param string $data |
|
| 340 | + */ |
|
| 337 | 341 | public function _write($name, $data) |
| 338 | 342 | { |
| 339 | 343 | $fp = fopen($name, "w"); |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | } |
| 145 | 145 | $fnl = strlen($filename); |
| 146 | - $fh = "\x14\x00"; // ver needed to extract |
|
| 147 | - $fh .= "\x00\x00"; // gen purpose bit flag |
|
| 148 | - $fh .= "\x08\x00"; // compression method |
|
| 146 | + $fh = "\x14\x00"; // ver needed to extract |
|
| 147 | + $fh .= "\x00\x00"; // gen purpose bit flag |
|
| 148 | + $fh .= "\x08\x00"; // compression method |
|
| 149 | 149 | $fh .= "\x00\x00\x00\x00"; // last mod time and date |
| 150 | 150 | $fh .= pack( |
| 151 | 151 | "V3v2", |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | //local file header |
| 161 | 161 | $lfh = "PK\x03\x04"; |
| 162 | - $lfh .= $fh . $filename; |
|
| 162 | + $lfh .= $fh.$filename; |
|
| 163 | 163 | $zipdata = $lfh; |
| 164 | 164 | $zipdata .= $gzdata; |
| 165 | 165 | $zipdata .= pack("V3", $crc, $gzsize, $datasize); |
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | "va*v3V2", |
| 171 | 171 | 0, |
| 172 | 172 | $fh, |
| 173 | - 0, // file comment length |
|
| 174 | - 0, // disk number start |
|
| 175 | - 0, // internal file attributes |
|
| 176 | - $attr, // external file attributes - 'archive/directory' bit set |
|
| 173 | + 0, // file comment length |
|
| 174 | + 0, // disk number start |
|
| 175 | + 0, // internal file attributes |
|
| 176 | + $attr, // external file attributes - 'archive/directory' bit set |
|
| 177 | 177 | $this->offset |
| 178 | - ) . $filename; |
|
| 178 | + ).$filename; |
|
| 179 | 179 | |
| 180 | 180 | $this->offset += 42 + $fnl + $gzsize; |
| 181 | 181 | $this->cdir[] = $cdir; |
| 182 | - $this->cnt ++; |
|
| 182 | + $this->cnt++; |
|
| 183 | 183 | $this->idx = $this->cnt - 1; |
| 184 | 184 | } |
| 185 | 185 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | $cdsl, // size of central dir |
| 229 | 229 | $zdsl, // offset to start of central dir |
| 230 | 230 | 0 |
| 231 | - ); // .zip file comment length |
|
| 231 | + ); // .zip file comment length |
|
| 232 | 232 | return $this->zipfile; |
| 233 | 233 | } |
| 234 | 234 | |