1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* tools Module for XOOPS |
4
|
|
|
* |
5
|
|
|
* You may not change or alter any portion of this comment or credits |
6
|
|
|
* of supporting developers from this source code or any supporting source code |
7
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
8
|
|
|
* This program is distributed in the hope that it will be useful, |
9
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
10
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
11
|
|
|
* |
12
|
|
|
* @copyright XOOPS Project (http://xoops.org) |
13
|
|
|
* @license http://www.fsf.org/copyleft/gpl.html GNU public license |
14
|
|
|
* @package tools |
15
|
|
|
* @since 2.00 |
16
|
|
|
* @author Susheng Yang <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class ToolsXoopsBlock |
23
|
|
|
*/ |
24
|
|
|
class ToolsXoopsBlock extends XoopsObject |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* ToolsXoopsBlock constructor. |
28
|
|
|
*/ |
29
|
|
|
public function __construct() |
30
|
|
|
{ |
31
|
|
|
$this->initVar('bid', XOBJ_DTYPE_INT, null, false); |
32
|
|
|
$this->initVar('mid', XOBJ_DTYPE_INT, 0, false); |
33
|
|
|
$this->initVar('func_num', XOBJ_DTYPE_INT, 0, false); |
34
|
|
|
$this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255); |
35
|
|
|
$this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150); |
36
|
|
|
//$this->initVar('position', XOBJ_DTYPE_INT, 0, false); |
|
|
|
|
37
|
|
|
$this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150); |
38
|
|
|
$this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false); |
39
|
|
|
$this->initVar('side', XOBJ_DTYPE_INT, 0, false); |
40
|
|
|
$this->initVar('weight', XOBJ_DTYPE_INT, 0, false); |
41
|
|
|
$this->initVar('visible', XOBJ_DTYPE_INT, 0, false); |
42
|
|
|
// The block_type is in a mess, let's say: |
43
|
|
|
// S - generated by system module |
44
|
|
|
// M - generated by a non-system module |
45
|
|
|
// C - Custom block |
46
|
|
|
// D - cloned system/module block |
47
|
|
|
// E - cloned custom block, DON'T use it |
48
|
|
|
$this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false); |
49
|
|
|
$this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false); |
50
|
|
|
$this->initVar('isactive', XOBJ_DTYPE_INT, null, false); |
51
|
|
|
|
52
|
|
|
$this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50); |
53
|
|
|
$this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50); |
54
|
|
|
$this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50); |
55
|
|
|
$this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50); |
56
|
|
|
|
57
|
|
|
$this->initVar('template', XOBJ_DTYPE_OTHER, null, false); |
58
|
|
|
$this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false); |
59
|
|
|
$this->initVar('last_modified', XOBJ_DTYPE_INT, 0, false); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Class ToolsXoopsBlockHandler |
65
|
|
|
*/ |
66
|
|
|
class ToolsXoopsBlockHandler extends XoopsPersistableObjectHandler |
67
|
|
|
{ |
68
|
|
|
/** |
69
|
|
|
* ToolsXoopsBlockHandler constructor. |
70
|
|
|
* @param null|\XoopsDatabase $db |
71
|
|
|
*/ |
72
|
|
|
public function __construct($db) |
73
|
|
|
{ |
74
|
|
|
parent::__construct($db, 'newblocks', 'ToolsXoopsBlock', 'bid', 'name'); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.