@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | public function load($id) |
83 | 83 | { |
84 | 84 | $id = (int)$id; |
85 | - $sql = 'SELECT * FROM ' . $this->db->prefix('newblocks') . ' WHERE bid = ' . $id; |
|
85 | + $sql = 'SELECT * FROM '.$this->db->prefix('newblocks').' WHERE bid = '.$id; |
|
86 | 86 | $arr = $this->db->fetchArray($this->db->query($sql)); |
87 | 87 | $this->assignVars($arr); |
88 | 88 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | ${$k} = $v; |
102 | 102 | } |
103 | 103 | if (empty($bid)) { |
104 | - $bid = $this->db->genId($this->db->prefix('newblocks') . '_bid_seq'); |
|
104 | + $bid = $this->db->genId($this->db->prefix('newblocks').'_bid_seq'); |
|
105 | 105 | $sql = sprintf('INSERT INTO %s (bid, mid, func_num, options, name, title, content, side, weight, visible, block_type, c_type, isactive, dirname, func_file, show_func, edit_func, template, bcachetime, last_modified) VALUES (%u, %u, %u, %s, %s, %s, %s, %u, %u, %u, %s, %s, %u, %s, %s, %s, %s, %s, %u, %u)', $this->db->prefix('newblocks'), $bid, $mid, $func_num, $this->db->quoteString($options), $this->db->quoteString($name), $this->db->quoteString($title), $this->db->quoteString($content), $side, $weight, $visible, $this->db->quoteString($block_type), $this->db->quoteString($c_type), 1, $this->db->quoteString($dirname), $this->db->quoteString($func_file), $this->db->quoteString($show_func), $this->db->quoteString($edit_func), $this->db->quoteString($template), $bcachetime, time()); |
106 | 106 | } else { |
107 | - $sql = 'UPDATE ' . $this->db->prefix('newblocks') . ' SET options=' . $this->db->quoteString($options); |
|
107 | + $sql = 'UPDATE '.$this->db->prefix('newblocks').' SET options='.$this->db->quoteString($options); |
|
108 | 108 | // a custom block needs its own name |
109 | 109 | if ($this->isCustom() /* in_array( $block_type , array( 'C' , 'E' ) ) */) { |
110 | - $sql .= ', name=' . $this->db->quoteString($name); |
|
110 | + $sql .= ', name='.$this->db->quoteString($name); |
|
111 | 111 | } |
112 | - $sql .= ', isactive=' . $isactive . ', title=' . $this->db->quoteString($title) . ', content=' . $this->db->quoteString($content) . ', side=' . $side . ', weight=' . $weight . ', visible=' . $visible . ', c_type=' . $this->db->quoteString($c_type) . ', template=' . $this->db->quoteString($template) . ', bcachetime=' . $bcachetime . ', last_modified=' . time() . ' WHERE bid=' . $bid; |
|
112 | + $sql .= ', isactive='.$isactive.', title='.$this->db->quoteString($title).', content='.$this->db->quoteString($content).', side='.$side.', weight='.$weight.', visible='.$visible.', c_type='.$this->db->quoteString($c_type).', template='.$this->db->quoteString($template).', bcachetime='.$bcachetime.', last_modified='.time().' WHERE bid='.$bid; |
|
113 | 113 | } |
114 | 114 | if (!$this->db->query($sql)) { |
115 | 115 | $this->setErrors('Could not save block data into database'); |
@@ -160,22 +160,22 @@ discard block |
||
160 | 160 | // S : use text sanitizater (smilies enabled) |
161 | 161 | // T : use text sanitizater (smilies disabled) |
162 | 162 | if ($c_type === 'H') { |
163 | - return str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); |
|
163 | + return str_replace('{X_SITEURL}', XOOPS_URL.'/', $this->getVar('content', 'n')); |
|
164 | 164 | } elseif ($c_type === 'P') { |
165 | 165 | ob_start(); |
166 | 166 | echo eval($this->getVar('content', 'n')); |
167 | 167 | $content = ob_get_contents(); |
168 | 168 | ob_end_clean(); |
169 | 169 | |
170 | - return str_replace('{X_SITEURL}', XOOPS_URL . '/', $content); |
|
170 | + return str_replace('{X_SITEURL}', XOOPS_URL.'/', $content); |
|
171 | 171 | } elseif ($c_type === 'S') { |
172 | 172 | $myts = MyTextSanitizer::getInstance(); |
173 | - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); |
|
173 | + $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $this->getVar('content', 'n')); |
|
174 | 174 | |
175 | 175 | return $myts->displayTarea($content, 1, 1); |
176 | 176 | } else { |
177 | 177 | $myts = MyTextSanitizer::getInstance(); |
178 | - $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n')); |
|
178 | + $content = str_replace('{X_SITEURL}', XOOPS_URL.'/', $this->getVar('content', 'n')); |
|
179 | 179 | |
180 | 180 | return $myts->displayTarea($content, 1, 0); |
181 | 181 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | if (!$show_func) { |
205 | 205 | return false; |
206 | 206 | } |
207 | - if (!file_exists($func_file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { |
|
207 | + if (!file_exists($func_file = $GLOBALS['xoops']->path('modules/'.$this->getVar('dirname').'/blocks/'.$this->getVar('func_file')))) { |
|
208 | 208 | return false; |
209 | 209 | } |
210 | 210 | // must get lang files b4 including the file |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | public function buildContent($position, $content = '', $contentdb = '') |
251 | 251 | { |
252 | 252 | if ($position == 0) { |
253 | - $ret = $contentdb . $content; |
|
253 | + $ret = $contentdb.$content; |
|
254 | 254 | } elseif ($position == 1) { |
255 | - $ret = $content . $contentdb; |
|
255 | + $ret = $content.$contentdb; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | return $ret; |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | if (!$edit_func) { |
301 | 301 | return false; |
302 | 302 | } |
303 | - if (file_exists($GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')))) { |
|
304 | - if (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/blocks.php'))) { |
|
303 | + if (file_exists($GLOBALS['xoops']->path('modules/'.$this->getVar('dirname').'/blocks/'.$this->getVar('func_file')))) { |
|
304 | + if (file_exists($file = $GLOBALS['xoops']->path('modules/'.$this->getVar('dirname').'/language/'.$xoopsConfig['language'].'/blocks.php'))) { |
|
305 | 305 | include_once $file; |
306 | - } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/language/english/blocks.php'))) { |
|
306 | + } elseif (file_exists($file = $GLOBALS['xoops']->path('modules/'.$this->getVar('dirname').'/language/english/blocks.php'))) { |
|
307 | 307 | include_once $file; |
308 | 308 | } |
309 | - include_once $GLOBALS['xoops']->path('modules/' . $this->getVar('dirname') . '/blocks/' . $this->getVar('func_file')); |
|
309 | + include_once $GLOBALS['xoops']->path('modules/'.$this->getVar('dirname').'/blocks/'.$this->getVar('func_file')); |
|
310 | 310 | $options = explode('|', $this->getVar('options')); |
311 | 311 | $edit_form = $edit_func($options); |
312 | 312 | if (!$edit_form) { |
@@ -346,20 +346,20 @@ discard block |
||
346 | 346 | if (!$asobject) { |
347 | 347 | $sql = 'SELECT b.bid '; |
348 | 348 | } |
349 | - $sql .= 'FROM ' . $db->prefix('newblocks') . ' b LEFT JOIN ' . $db->prefix('group_permission') . " l ON l.gperm_itemid=b.bid WHERE gperm_name = 'block_read' AND gperm_modid = 1"; |
|
349 | + $sql .= 'FROM '.$db->prefix('newblocks').' b LEFT JOIN '.$db->prefix('group_permission')." l ON l.gperm_itemid=b.bid WHERE gperm_name = 'block_read' AND gperm_modid = 1"; |
|
350 | 350 | if (is_array($groupid)) { |
351 | - $sql .= ' AND (l.gperm_groupid=' . $groupid[0] . ''; |
|
351 | + $sql .= ' AND (l.gperm_groupid='.$groupid[0].''; |
|
352 | 352 | $size = count($groupid); |
353 | 353 | if ($size > 1) { |
354 | 354 | for ($i = 1; $i < $size; ++$i) { |
355 | - $sql .= ' OR l.gperm_groupid=' . $groupid[$i] . ''; |
|
355 | + $sql .= ' OR l.gperm_groupid='.$groupid[$i].''; |
|
356 | 356 | } |
357 | 357 | } |
358 | 358 | $sql .= ')'; |
359 | 359 | } else { |
360 | - $sql .= ' AND l.gperm_groupid=' . $groupid . ''; |
|
360 | + $sql .= ' AND l.gperm_groupid='.$groupid.''; |
|
361 | 361 | } |
362 | - $sql .= ' AND b.isactive=' . $isactive; |
|
362 | + $sql .= ' AND b.isactive='.$isactive; |
|
363 | 363 | if (isset($side)) { |
364 | 364 | // get both sides in sidebox? (some themes need this) |
365 | 365 | if ($side == XOOPS_SIDEBLOCK_BOTH) { |
@@ -369,9 +369,9 @@ discard block |
||
369 | 369 | } elseif ($side == XOOPS_FOOTERBLOCK_ALL) { |
370 | 370 | $side = '(b.side=10 OR b.side=11 OR b.side=12 )'; |
371 | 371 | } else { |
372 | - $side = 'b.side=' . $side; |
|
372 | + $side = 'b.side='.$side; |
|
373 | 373 | } |
374 | - $sql .= ' AND ' . $side; |
|
374 | + $sql .= ' AND '.$side; |
|
375 | 375 | } |
376 | 376 | if (isset($visible)) { |
377 | 377 | $sql .= " AND b.visible=$visible"; |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | { |
408 | 408 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
409 | 409 | $ret = array(); |
410 | - $where_query = ' WHERE isactive=' . $isactive; |
|
410 | + $where_query = ' WHERE isactive='.$isactive; |
|
411 | 411 | if (isset($side)) { |
412 | 412 | // get both sides in sidebox? (some themes need this) |
413 | 413 | if ($side == XOOPS_SIDEBLOCK_BOTH) { |
@@ -417,24 +417,24 @@ discard block |
||
417 | 417 | } elseif ($side == XOOPS_FOOTERBLOCK_ALL) { |
418 | 418 | $side = '(side=10 OR side=11 OR side=12)'; |
419 | 419 | } else { |
420 | - $side = 'side=' . $side; |
|
420 | + $side = 'side='.$side; |
|
421 | 421 | } |
422 | - $where_query .= ' AND ' . $side; |
|
422 | + $where_query .= ' AND '.$side; |
|
423 | 423 | } |
424 | 424 | if (isset($visible)) { |
425 | - $where_query .= ' AND visible=.' . $visible; |
|
425 | + $where_query .= ' AND visible=.'.$visible; |
|
426 | 426 | } |
427 | - $where_query .= ' ORDER BY ' . $orderby; |
|
427 | + $where_query .= ' ORDER BY '.$orderby; |
|
428 | 428 | switch ($rettype) { |
429 | 429 | case 'object': |
430 | - $sql = 'SELECT * FROM ' . $db->prefix('newblocks') . '' . $where_query; |
|
430 | + $sql = 'SELECT * FROM '.$db->prefix('newblocks').''.$where_query; |
|
431 | 431 | $result = $db->query($sql); |
432 | 432 | while (false !== ($myrow = $db->fetchArray($result))) { |
433 | 433 | $ret[] = new XoopsBlock($myrow); |
434 | 434 | } |
435 | 435 | break; |
436 | 436 | case 'list': |
437 | - $sql = 'SELECT * FROM ' . $db->prefix('newblocks') . '' . $where_query; |
|
437 | + $sql = 'SELECT * FROM '.$db->prefix('newblocks').''.$where_query; |
|
438 | 438 | $result = $db->query($sql); |
439 | 439 | while (false !== ($myrow = $db->fetchArray($result))) { |
440 | 440 | $block = new XoopsBlock($myrow); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | break; |
446 | 446 | case 'id': |
447 | - $sql = 'SELECT bid FROM ' . $db->prefix('newblocks') . '' . $where_query; |
|
447 | + $sql = 'SELECT bid FROM '.$db->prefix('newblocks').''.$where_query; |
|
448 | 448 | $result = $db->query($sql); |
449 | 449 | while (false !== ($myrow = $db->fetchArray($result))) { |
450 | 450 | $ret[] = $myrow['bid']; |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | $moduleid = (int)$moduleid; |
469 | 469 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
470 | 470 | if ($asobject == true) { |
471 | - $sql = $sql = 'SELECT * FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $moduleid; |
|
471 | + $sql = $sql = 'SELECT * FROM '.$db->prefix('newblocks').' WHERE mid='.$moduleid; |
|
472 | 472 | } else { |
473 | - $sql = 'SELECT bid FROM ' . $db->prefix('newblocks') . ' WHERE mid=' . $moduleid; |
|
473 | + $sql = 'SELECT bid FROM '.$db->prefix('newblocks').' WHERE mid='.$moduleid; |
|
474 | 474 | } |
475 | 475 | $result = $db->query($sql); |
476 | 476 | $ret = array(); |
@@ -502,12 +502,12 @@ discard block |
||
502 | 502 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
503 | 503 | $ret = array(); |
504 | 504 | if (isset($groupid)) { |
505 | - $sql = 'SELECT DISTINCT gperm_itemid FROM ' . $db->prefix('group_permission') . " WHERE gperm_name = 'block_read' AND gperm_modid = 1"; |
|
505 | + $sql = 'SELECT DISTINCT gperm_itemid FROM '.$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1"; |
|
506 | 506 | if (is_array($groupid)) { |
507 | - $sql .= ' AND gperm_groupid IN (' . implode(',', $groupid) . ')'; |
|
507 | + $sql .= ' AND gperm_groupid IN ('.implode(',', $groupid).')'; |
|
508 | 508 | } else { |
509 | 509 | if ((int)$groupid > 0) { |
510 | - $sql .= ' AND gperm_groupid=' . (int)$groupid; |
|
510 | + $sql .= ' AND gperm_groupid='.(int)$groupid; |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | $result = $db->query($sql); |
@@ -519,14 +519,14 @@ discard block |
||
519 | 519 | return $blockids; |
520 | 520 | } |
521 | 521 | } |
522 | - $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, ' . $db->prefix('block_module_link') . ' m WHERE m.block_id=b.bid'; |
|
523 | - $sql .= ' AND b.isactive=' . $isactive; |
|
522 | + $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid'; |
|
523 | + $sql .= ' AND b.isactive='.$isactive; |
|
524 | 524 | if (isset($visible)) { |
525 | - $sql .= ' AND b.visible=' . (int)$visible; |
|
525 | + $sql .= ' AND b.visible='.(int)$visible; |
|
526 | 526 | } |
527 | 527 | if (!isset($module_id)) { |
528 | 528 | } elseif (!empty($module_id)) { |
529 | - $sql .= ' AND m.module_id IN (0,' . (int)$module_id; |
|
529 | + $sql .= ' AND m.module_id IN (0,'.(int)$module_id; |
|
530 | 530 | if ($toponlyblock) { |
531 | 531 | $sql .= ',-1'; |
532 | 532 | } |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | } |
540 | 540 | } |
541 | 541 | if (!empty($blockids)) { |
542 | - $sql .= ' AND b.bid IN (' . implode(',', $blockids) . ')'; |
|
542 | + $sql .= ' AND b.bid IN ('.implode(',', $blockids).')'; |
|
543 | 543 | } |
544 | - $sql .= ' ORDER BY ' . $orderby; |
|
544 | + $sql .= ' ORDER BY '.$orderby; |
|
545 | 545 | $result = $db->query($sql); |
546 | 546 | while (false !== ($myrow = $db->fetchArray($result))) { |
547 | 547 | $block = new XoopsBlock($myrow); |
@@ -567,13 +567,13 @@ discard block |
||
567 | 567 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
568 | 568 | $ret = array(); |
569 | 569 | $bids = array(); |
570 | - $sql = 'SELECT DISTINCT(bid) from ' . $db->prefix('newblocks'); |
|
570 | + $sql = 'SELECT DISTINCT(bid) from '.$db->prefix('newblocks'); |
|
571 | 571 | if ($result = $db->query($sql)) { |
572 | 572 | while (false !== ($myrow = $db->fetchArray($result))) { |
573 | 573 | $bids[] = $myrow['bid']; |
574 | 574 | } |
575 | 575 | } |
576 | - $sql = 'SELECT DISTINCT(p.gperm_itemid) from ' . $db->prefix('group_permission') . ' p, ' . $db->prefix('groups') . " g WHERE g.groupid=p.gperm_groupid AND p.gperm_name='block_read'"; |
|
576 | + $sql = 'SELECT DISTINCT(p.gperm_itemid) from '.$db->prefix('group_permission').' p, '.$db->prefix('groups')." g WHERE g.groupid=p.gperm_groupid AND p.gperm_name='block_read'"; |
|
577 | 577 | $grouped = array(); |
578 | 578 | if ($result = $db->query($sql)) { |
579 | 579 | while (false !== ($myrow = $db->fetchArray($result))) { |
@@ -582,14 +582,14 @@ discard block |
||
582 | 582 | } |
583 | 583 | $non_grouped = array_diff($bids, $grouped); |
584 | 584 | if (!empty($non_grouped)) { |
585 | - $sql = 'SELECT b.* FROM ' . $db->prefix('newblocks') . ' b, ' . $db->prefix('block_module_link') . ' m WHERE m.block_id=b.bid'; |
|
586 | - $sql .= ' AND b.isactive=' . (int)$isactive; |
|
585 | + $sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid'; |
|
586 | + $sql .= ' AND b.isactive='.(int)$isactive; |
|
587 | 587 | if (isset($visible)) { |
588 | - $sql .= ' AND b.visible=' . (int)$visible; |
|
588 | + $sql .= ' AND b.visible='.(int)$visible; |
|
589 | 589 | } |
590 | 590 | if (!isset($module_id)) { |
591 | 591 | } elseif (!empty($module_id)) { |
592 | - $sql .= ' AND m.module_id IN (0,' . (int)$module_id; |
|
592 | + $sql .= ' AND m.module_id IN (0,'.(int)$module_id; |
|
593 | 593 | if ($toponlyblock) { |
594 | 594 | $sql .= ',-1'; |
595 | 595 | } |
@@ -601,12 +601,12 @@ discard block |
||
601 | 601 | $sql .= ' AND m.module_id=0'; |
602 | 602 | } |
603 | 603 | } |
604 | - $sql .= ' AND b.bid IN (' . implode(',', $non_grouped) . ')'; |
|
605 | - $sql .= ' ORDER BY ' . $orderby; |
|
604 | + $sql .= ' AND b.bid IN ('.implode(',', $non_grouped).')'; |
|
605 | + $sql .= ' ORDER BY '.$orderby; |
|
606 | 606 | $result = $db->query($sql); |
607 | 607 | while (false !== ($myrow = $db->fetchArray($result))) { |
608 | 608 | $block = new XoopsBlock($myrow); |
609 | - $ret[$myrow['bid']] =& $block; |
|
609 | + $ret[$myrow['bid']] = & $block; |
|
610 | 610 | unset($block); |
611 | 611 | } |
612 | 612 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function __construct() |
34 | 34 | { |
35 | - $this->paths['XOOPS'] = array(XOOPS_PATH, XOOPS_URL . 'browse.php'); |
|
35 | + $this->paths['XOOPS'] = array(XOOPS_PATH, XOOPS_URL.'browse.php'); |
|
36 | 36 | $this->paths['www'] = array(XOOPS_ROOT_PATH, XOOPS_URL); |
37 | 37 | $this->paths['var'] = array(XOOPS_VAR_PATH, null); |
38 | - $this->paths['lib'] = array(XOOPS_PATH, XOOPS_URL . 'browse.php'); |
|
39 | - $this->paths['modules'] = array(XOOPS_ROOT_PATH . '/modules', XOOPS_URL . '/modules'); |
|
40 | - $this->paths['themes'] = array(XOOPS_ROOT_PATH . '/themes', XOOPS_URL . '/themes'); |
|
38 | + $this->paths['lib'] = array(XOOPS_PATH, XOOPS_URL.'browse.php'); |
|
39 | + $this->paths['modules'] = array(XOOPS_ROOT_PATH.'/modules', XOOPS_URL.'/modules'); |
|
40 | + $this->paths['themes'] = array(XOOPS_ROOT_PATH.'/themes', XOOPS_URL.'/themes'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | list($root, $path) = array('www', $url); |
56 | 56 | } |
57 | 57 | if (!$virtual) { // Returns a physical path |
58 | - $path = $this->paths[$root][0] . '/' . $path; |
|
58 | + $path = $this->paths[$root][0].'/'.$path; |
|
59 | 59 | $path = str_replace('/', DS, $path); |
60 | 60 | |
61 | 61 | return $path; |
62 | 62 | } |
63 | 63 | |
64 | - return !isset($this->paths[$root][1]) ? '' : ($this->paths[$root][1] . '/' . $path); |
|
64 | + return !isset($this->paths[$root][1]) ? '' : ($this->paths[$root][1].'/'.$path); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | } |
94 | 94 | if (!empty($params)) { |
95 | 95 | foreach ($params as $k => $v) { |
96 | - $params[$k] = $k . '=' . rawurlencode($v); |
|
96 | + $params[$k] = $k.'='.rawurlencode($v); |
|
97 | 97 | } |
98 | - $url .= '?' . implode('&', $params); |
|
98 | + $url .= '?'.implode('&', $params); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return $url; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; |
168 | 168 | } |
169 | 169 | if (isset($_SERVER['QUERY_STRING'])) { |
170 | - $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; |
|
170 | + $_SERVER['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING']; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $GLOBALS['xoopsLogger']->addDeprecated("'/class/xoopstopic.php' is deprecated since XOOPS 2.5.4, please create your own class instead."); |
23 | 23 | |
24 | -include_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
24 | +include_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Class XoopsTopic |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function getTopic($topicid) |
85 | 85 | { |
86 | 86 | $topicid = (int)$topicid; |
87 | - $sql = 'SELECT * FROM ' . $this->table . ' WHERE topic_id=' . $topicid . ''; |
|
87 | + $sql = 'SELECT * FROM '.$this->table.' WHERE topic_id='.$topicid.''; |
|
88 | 88 | $array = $this->db->fetchArray($this->db->query($sql)); |
89 | 89 | $this->makeTopic($array); |
90 | 90 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $this->topic_pid = 0; |
127 | 127 | } |
128 | 128 | if (empty($this->topic_id)) { |
129 | - $this->topic_id = $this->db->genId($this->table . '_topic_id_seq'); |
|
129 | + $this->topic_id = $this->db->genId($this->table.'_topic_id_seq'); |
|
130 | 130 | $sql = sprintf("INSERT INTO %s (topic_id, topic_pid, topic_imgurl, topic_title) VALUES (%u, %u, '%s', '%s')", $this->table, $this->topic_id, $this->topic_pid, $imgurl, $title); |
131 | 131 | } else { |
132 | 132 | $sql = sprintf("UPDATE %s SET topic_pid = %u, topic_imgurl = '%s', topic_title = '%s' WHERE topic_id = %u", $this->table, $this->topic_pid, $imgurl, $title, $this->topic_id); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public function getTopicsList() |
378 | 378 | { |
379 | - $result = $this->db->query('SELECT topic_id, topic_pid, topic_title FROM ' . $this->table); |
|
379 | + $result = $this->db->query('SELECT topic_id, topic_pid, topic_title FROM '.$this->table); |
|
380 | 380 | $ret = array(); |
381 | 381 | $myts = MyTextSanitizer::getInstance(); |
382 | 382 | while (false !== ($myrow = $this->db->fetchArray($result))) { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | */ |
395 | 395 | public function topicExists($pid, $title) |
396 | 396 | { |
397 | - $sql = 'SELECT COUNT(*) from ' . $this->table . ' WHERE topic_pid = ' . (int)$pid . " AND topic_title = '" . trim($title) . "'"; |
|
397 | + $sql = 'SELECT COUNT(*) from '.$this->table.' WHERE topic_pid = '.(int)$pid." AND topic_title = '".trim($title)."'"; |
|
398 | 398 | $rs = $this->db->query($sql); |
399 | 399 | list($count) = $this->db->fetchRow($rs); |
400 | 400 | if ($count > 0) { |
@@ -59,8 +59,8 @@ |
||
59 | 59 | // Method of a class |
60 | 60 | if (is_array($handler)) { |
61 | 61 | return call_user_func(array( |
62 | - $handler[0], |
|
63 | - $handler[1]), $data); |
|
62 | + $handler[0], |
|
63 | + $handler[1]), $data); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $data; |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | $stop = ''; |
127 | 127 | // Invalid email address |
128 | 128 | if (!checkEmail($email)) { |
129 | - $stop .= _US_INVALIDMAIL . '<br>'; |
|
129 | + $stop .= _US_INVALIDMAIL.'<br>'; |
|
130 | 130 | } |
131 | 131 | if (strrpos($email, ' ') > 0) { |
132 | - $stop .= _US_EMAILNOSPACES . '<br>'; |
|
132 | + $stop .= _US_EMAILNOSPACES.'<br>'; |
|
133 | 133 | } |
134 | 134 | // Check forbidden email address if current operator is not an administrator |
135 | 135 | if (!$xoopsUser_isAdmin) { |
136 | 136 | foreach ($xoopsConfigUser['bad_emails'] as $be) { |
137 | - if (!empty($be) && preg_match('/' . $be . '/i', $email)) { |
|
138 | - $stop .= _US_INVALIDMAIL . '<br>'; |
|
137 | + if (!empty($be) && preg_match('/'.$be.'/i', $email)) { |
|
138 | + $stop .= _US_INVALIDMAIL.'<br>'; |
|
139 | 139 | break; |
140 | 140 | } |
141 | 141 | } |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | break; |
157 | 157 | } |
158 | 158 | if (empty($uname) || preg_match($restriction, $uname)) { |
159 | - $stop .= _US_INVALIDNICKNAME . '<br>'; |
|
159 | + $stop .= _US_INVALIDNICKNAME.'<br>'; |
|
160 | 160 | } |
161 | 161 | // Check uname settings if current operator is not an administrator |
162 | 162 | if (!$xoopsUser_isAdmin) { |
163 | 163 | if (strlen($uname) > $xoopsConfigUser['maxuname']) { |
164 | - $stop .= sprintf(_US_NICKNAMETOOLONG, $xoopsConfigUser['maxuname']) . '<br>'; |
|
164 | + $stop .= sprintf(_US_NICKNAMETOOLONG, $xoopsConfigUser['maxuname']).'<br>'; |
|
165 | 165 | } |
166 | 166 | if (strlen($uname) < $xoopsConfigUser['minuname']) { |
167 | - $stop .= sprintf(_US_NICKNAMETOOSHORT, $xoopsConfigUser['minuname']) . '<br>'; |
|
167 | + $stop .= sprintf(_US_NICKNAMETOOSHORT, $xoopsConfigUser['minuname']).'<br>'; |
|
168 | 168 | } |
169 | 169 | foreach ($xoopsConfigUser['bad_unames'] as $bu) { |
170 | - if (!empty($bu) && preg_match('/' . $bu . '/i', $uname)) { |
|
171 | - $stop .= _US_NAMERESERVED . '<br>'; |
|
170 | + if (!empty($bu) && preg_match('/'.$bu.'/i', $uname)) { |
|
171 | + $stop .= _US_NAMERESERVED.'<br>'; |
|
172 | 172 | break; |
173 | 173 | } |
174 | 174 | } |
@@ -181,17 +181,17 @@ discard block |
||
181 | 181 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
182 | 182 | // Check if uname/email already exists if the user is a new one |
183 | 183 | $uid = is_object($user) ? $user->getVar('uid') : 0; |
184 | - $sql = 'SELECT COUNT(*) FROM `' . $xoopsDB->prefix('users') . '` WHERE `uname` = ' . $xoopsDB->quote(addslashes($uname)) . (($uid > 0) ? " AND `uid` <> {$uid}" : ''); |
|
184 | + $sql = 'SELECT COUNT(*) FROM `'.$xoopsDB->prefix('users').'` WHERE `uname` = '.$xoopsDB->quote(addslashes($uname)).(($uid > 0) ? " AND `uid` <> {$uid}" : ''); |
|
185 | 185 | $result = $xoopsDB->query($sql); |
186 | 186 | list($count) = $xoopsDB->fetchRow($result); |
187 | 187 | if ($count > 0) { |
188 | - $stop .= _US_NICKNAMETAKEN . '<br>'; |
|
188 | + $stop .= _US_NICKNAMETAKEN.'<br>'; |
|
189 | 189 | } |
190 | - $sql = 'SELECT COUNT(*) FROM `' . $xoopsDB->prefix('users') . '` WHERE `email` = ' . $xoopsDB->quote(addslashes($email)) . (($uid > 0) ? " AND `uid` <> {$uid}" : ''); |
|
190 | + $sql = 'SELECT COUNT(*) FROM `'.$xoopsDB->prefix('users').'` WHERE `email` = '.$xoopsDB->quote(addslashes($email)).(($uid > 0) ? " AND `uid` <> {$uid}" : ''); |
|
191 | 191 | $result = $xoopsDB->query($sql); |
192 | 192 | list($count) = $xoopsDB->fetchRow($result); |
193 | 193 | if ($count > 0) { |
194 | - $stop .= _US_EMAILTAKEN . '<br>'; |
|
194 | + $stop .= _US_EMAILTAKEN.'<br>'; |
|
195 | 195 | } |
196 | 196 | // If password is not set, skip password validation |
197 | 197 | if ($pass === null && $vpass === null) { |
@@ -199,12 +199,12 @@ discard block |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | if (!isset($pass) || $pass == '' || !isset($vpass) || $vpass == '') { |
202 | - $stop .= _US_ENTERPWD . '<br>'; |
|
202 | + $stop .= _US_ENTERPWD.'<br>'; |
|
203 | 203 | } |
204 | 204 | if (isset($pass) && ($pass != $vpass)) { |
205 | - $stop .= _US_PASSNOTSAME . '<br>'; |
|
205 | + $stop .= _US_PASSNOTSAME.'<br>'; |
|
206 | 206 | } elseif (($pass != '') && (strlen($pass) < $xoopsConfigUser['minpass'])) { |
207 | - $stop .= sprintf(_US_PWDTOOSHORT, $xoopsConfigUser['minpass']) . '<br>'; |
|
207 | + $stop .= sprintf(_US_PWDTOOSHORT, $xoopsConfigUser['minpass']).'<br>'; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | return $stop; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $users = array(); |
273 | 273 | if (count($userid) > 0) { |
274 | 274 | $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection(); |
275 | - $sql = 'SELECT uid, uname, name FROM ' . $xoopsDB->prefix('users') . ' WHERE level > 0 AND uid IN(' . implode(',', array_unique($userid)) . ')'; |
|
275 | + $sql = 'SELECT uid, uname, name FROM '.$xoopsDB->prefix('users').' WHERE level > 0 AND uid IN('.implode(',', array_unique($userid)).')'; |
|
276 | 276 | if (!$result = $xoopsDB->query($sql)) { |
277 | 277 | return $users; |
278 | 278 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | $users[$uid] = $myts->htmlSpecialChars($row['uname']); |
285 | 285 | } |
286 | 286 | if ($linked) { |
287 | - $users[$uid] = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $uid . '" title="' . $users[$uid] . '">' . $users[$uid] . '</a>'; |
|
287 | + $users[$uid] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$uid.'" title="'.$users[$uid].'">'.$users[$uid].'</a>'; |
|
288 | 288 | } |
289 | 289 | } |
290 | 290 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $username = $user->getVar('uname'); |
320 | 320 | } |
321 | 321 | if (!empty($linked)) { |
322 | - $username = '<a href="' . XOOPS_URL . '/userinfo.php?uid=' . $userid . '" title="' . $username . '">' . $username . '</a>'; |
|
322 | + $username = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$userid.'" title="'.$username.'">'.$username.'</a>'; |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | } |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | { |
176 | 176 | if ($key > 0) { |
177 | 177 | $value = $this->tree[$key]['obj']->getVar($this->myId); |
178 | - $ret .= '<option value="' . $value . '"'; |
|
178 | + $ret .= '<option value="'.$value.'"'; |
|
179 | 179 | if ($value == $selected) { |
180 | 180 | $ret .= ' selected'; |
181 | 181 | } |
182 | - $ret .= '>' . $prefix_curr . $this->tree[$key]['obj']->getVar($fieldName) . '</option>'; |
|
182 | + $ret .= '>'.$prefix_curr.$this->tree[$key]['obj']->getVar($fieldName).'</option>'; |
|
183 | 183 | $prefix_curr .= $prefix_orig; |
184 | 184 | } |
185 | 185 | if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) { |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | ) { |
216 | 216 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
217 | 217 | trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},"); |
218 | - $ret = '<select name="' . $name . '" id="' . $name . '" ' . $extra . '>'; |
|
218 | + $ret = '<select name="'.$name.'" id="'.$name.'" '.$extra.'>'; |
|
219 | 219 | if (false !== (bool)$addEmptyOption) { |
220 | 220 | $ret .= '<option value="0"></option>'; |
221 | 221 | } |
222 | 222 | $this->makeSelBoxOptions($fieldName, $selected, $key, $ret, $prefix); |
223 | 223 | |
224 | - return $ret . '</select>'; |
|
224 | + return $ret.'</select>'; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | /** |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | { |
279 | 279 | if ($key > 0) { |
280 | 280 | $value = $this->tree[$key]['obj']->getVar($this->myId); |
281 | - $name = $prefix_curr . $this->tree[$key]['obj']->getVar($fieldName); |
|
281 | + $name = $prefix_curr.$this->tree[$key]['obj']->getVar($fieldName); |
|
282 | 282 | $element->addOption($value, $name); |
283 | 283 | $prefix_curr .= $prefix_orig; |
284 | 284 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | return $this->tree; |
309 | 309 | } |
310 | 310 | trigger_error( |
311 | - 'Undefined property: XoopsObjectTree::$' . $name . |
|
311 | + 'Undefined property: XoopsObjectTree::$'.$name. |
|
312 | 312 | " in {$trace[0]['file']} line {$trace[0]['line']}, ", |
313 | 313 | E_USER_NOTICE); |
314 | 314 | return null; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | public function init($settings = array()) |
103 | 103 | { |
104 | 104 | parent::init($settings); |
105 | - $defaults = array( |
|
106 | - 'path' => XOOPS_VAR_PATH . '/caches/xoops_cache', |
|
105 | + $defaults = array( |
|
106 | + 'path' => XOOPS_VAR_PATH.'/caches/xoops_cache', |
|
107 | 107 | 'extension' => '.php', |
108 | 108 | 'prefix' => 'xoops_', |
109 | 109 | 'lock' => false, |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $this->settings = array_merge($defaults, $this->settings); |
113 | 113 | if (!isset($this->file)) { |
114 | 114 | XoopsLoad::load('XoopsFile'); |
115 | - $this->file = XoopsFile::getHandler('file', $this->settings['path'] . '/index.html', true); |
|
115 | + $this->file = XoopsFile::getHandler('file', $this->settings['path'].'/index.html', true); |
|
116 | 116 | } |
117 | 117 | $this->settings['path'] = $this->file->folder->cd($this->settings['path']); |
118 | 118 | if (empty($this->settings['path'])) { |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | } else { |
170 | 170 | $data = serialize($data); |
171 | 171 | } |
172 | - $contents = $expires . $lineBreak . $data . $lineBreak; |
|
172 | + $contents = $expires.$lineBreak.$data.$lineBreak; |
|
173 | 173 | } else { |
174 | - $contents = $expires . $lineBreak . 'return ' . var_export($data, true) . ';' . $lineBreak; |
|
174 | + $contents = $expires.$lineBreak.'return '.var_export($data, true).';'.$lineBreak; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | if ($this->settings['lock']) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if (!empty($data) && !empty($this->settings['serialize'])) { |
212 | 212 | $data = stripslashes($data); |
213 | 213 | // $data = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $data); |
214 | - $data = preg_replace_callback('!s:(\d+):"(.*?)";!s', function ($m) { return 's:' . strlen($m[2]) . ':"' . $m[2] . '";'; }, $data); |
|
214 | + $data = preg_replace_callback('!s:(\d+):"(.*?)";!s', function($m) { return 's:'.strlen($m[2]).':"'.$m[2].'";'; }, $data); |
|
215 | 215 | $data = unserialize($data); |
216 | 216 | if (is_array($data)) { |
217 | 217 | XoopsLoad::load('XoopsUtility'); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | private function setKey($key) |
294 | 294 | { |
295 | 295 | $this->file->folder->cd($this->settings['path']); |
296 | - $this->file->name = $this->settings['prefix'] . $key . $this->settings['extension']; |
|
296 | + $this->file->name = $this->settings['prefix'].$key.$this->settings['extension']; |
|
297 | 297 | $this->file->handle = null; |
298 | 298 | $this->file->info = null; |
299 | 299 | if (!$this->file->folder->inPath($this->file->pwd(), true)) { |
@@ -171,7 +171,7 @@ |
||
171 | 171 | if (!empty($value)) { |
172 | 172 | $backup[$key] = $value; |
173 | 173 | } |
174 | - $varName = '__' . $key; |
|
174 | + $varName = '__'.$key; |
|
175 | 175 | $_SERVER[$key] = $this->settings[$varName]; |
176 | 176 | } |
177 | 177 | } |
@@ -86,7 +86,7 @@ |
||
86 | 86 | return false; |
87 | 87 | } |
88 | 88 | parent::init($settings); |
89 | - $defaults = array( |
|
89 | + $defaults = array( |
|
90 | 90 | 'servers' => array( |
91 | 91 | '127.0.0.1'), |
92 | 92 | 'compress' => false); |