Completed
Pull Request — master (#9)
by Michael
01:20
created

include/action.module.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * XOOPS XoopsPartners module
14
 *
15
 * @package      module\xoopspartners\include
16
 * @author       Taiwen Jiang <[email protected]>
17
 * @author       zyspec <[email protected]>
18
 * @author       XOOPS Module Development Team
19
 * @copyright    {@link https://xoops.org 2001-2016 XOOPS Project}
20
 * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
21
 * @link         https://xoops.org XOOPS
22
 */
23
24
/**
25
 * @internal {Make sure you PROTECT THIS FILE}
26
 */
27
28
if ((!defined('XOOPS_ROOT_PATH'))
29
    || !isset($GLOBALS['xoopsUser'])
30
    || !($GLOBALS['xoopsUser'] instanceof XoopsUser)
31
    || !$GLOBALS['xoopsUser']->isAdmin()
32
) {
33
    exit('Restricted access' . PHP_EOL);
34
}
35
36
/**
37
 *
38
 * Prepares system prior to attempting to install module
39
 * @param XoopsModule $module {@link XoopsModule}
0 ignored issues
show
There is no parameter named $module. Did you maybe mean $xoopsModule?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
40
 *
41
 * @return bool true if ready to install, false if not
42
 */
43 View Code Duplication
function xoops_module_pre_install_xoopspartners(XoopsModule $xoopsModule)
44
{
45
    if (!class_exists('XoopspartnersUtilities')) {
46
        xoops_load('utilities', 'xoopspartners');
47
    }
48
49
    //check for minimum XOOPS version
50
    if (!XoopspartnersUtilities::checkXoopsVer($xoopsModule)) {
51
        return false;
52
    }
53
    // check for minimum PHP version
54
    if (!XoopspartnersUtilities::checkPHPVer($xoopsModule)) {
55
        return false;
56
    }
57
58
    return true;
59
}
60
61
/**
62
 *
63
 * Performs tasks required during installation of the module
64
 * @param XoopsModule $module {@link XoopsModule}
65
 *
66
 * @return bool true if installation successful, false if not
67
 */
68
function xoops_module_install_xoopspartners(XoopsModule $module)
69
{
70
71
    $indexFile = $GLOBALS['xoops']->path('/modules/' . $module->dirname() . '/include/index.html');
72
73
    //Create the "uploads" directory for the module
74
    $module_uploads = $GLOBALS['xoops']->path('/uploads/' . $module->dirname());
75
    if (!is_dir($module_uploads)) {
76
        mkdir($module_uploads, 0777);
77
    }
78
    chmod($module_uploads, 0777);
79
    //now copy the index file to help prevent 'browsing' the directory
80
    copy($indexFile, $GLOBALS['xoops']->path('/uploads/' . $module->dirname() . '/index.html'));
81
82
    return true;
83
}
84
85
/**
86
 *
87
 * Prepares system prior to attempting to update module
88
 * @param XoopsModule $module {@link XoopsModule}
89
 *
90
 * @return bool true if successfully ready to update module, false if not
91
 */
92 View Code Duplication
function xoops_module_pre_update_xoopspartners(XoopsModule $module)
93
{
94
    if (!class_exists('XoopspartnersUtilities')) {
95
        xoops_load('utilities', 'xoopspartners');
96
    }
97
98
    //check for minimum XOOPS version
99
    if (!XoopspartnersUtilities::checkXoopsVer($xoopsModule)) {
100
        return false;
101
    }
102
    // check for minimum PHP version
103
    if (!XoopspartnersUtilities::checkPHPVer($xoopsModule)) {
104
        return false;
105
    }
106
107
    return true;
108
}
109
110
/**
111
 *
112
 * Functions to upgrade from previous version of the module
113
 *
114
 * @param XoopsModule $module       {@link XoopsModule}
115
 * @param int         $curr_version version number of module currently installed
116
 *
117
 * @return bool true if successfully updated module, false if not
118
 */
119
function xoops_module_update_xoopspartners(XoopsModule $module, $curr_version = null)
120
{
121
    return true;
122
}
123
124
/**
125
 *
126
 * Function to perform before module uninstall
127
 * @param XoopsModule $module {@link XoopsModule}
128
 *
129
 * @return bool true if successfully executed, false if not
130
 */
131
function xoops_module_pre_uninstall_xoopspartners(XoopsModule $module)
132
{
133
    return true;
134
}
135
136
/**
137
 *
138
 * Function to complete upon module uninstall
139
 * @param XoopsModule $module {@link XoopsModule}
140
 *
141
 * @return bool true if successfully executed uninstall of module, false if not
142
 */
143
function xoops_module_uninstall_xoopspartners(XoopsModule $module)
0 ignored issues
show
The parameter $module is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
144
{
145
    return true;
146
}
147