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
|
|
|
* wgSitenotice module for xoops |
13
|
|
|
* |
14
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
15
|
|
|
* @license GPL 2.0 or later |
16
|
|
|
* @package wgsitenotice |
17
|
|
|
* @since 1.0 |
18
|
|
|
* @min_xoops 2.5.11 |
19
|
|
|
* @author Goffy (xoops.wedega.com) - Email:<[email protected]> - Website:<https://xoops.wedega.com> |
20
|
|
|
*/ |
21
|
|
|
// |
22
|
|
|
|
23
|
|
|
use XoopsModules\Wgsitenotice; |
24
|
|
|
use XoopsModules\Wgsitenotice\Common; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @param \XoopsModule $module |
28
|
|
|
* @return bool |
29
|
|
|
*/ |
30
|
|
|
function xoops_module_pre_install_wgsitenotice(\XoopsModule $module) |
31
|
|
|
{ |
32
|
|
|
require \dirname(__DIR__) . '/preloads/autoloader.php'; |
33
|
|
|
|
34
|
|
|
$utility = new Wgsitenotice\Utility(); |
35
|
|
|
|
36
|
|
|
//check for minimum XOOPS version |
37
|
|
|
$xoopsSuccess = $utility::checkVerXoops($module); |
38
|
|
|
|
39
|
|
|
// check for minimum PHP version |
40
|
|
|
$phpSuccess = $utility::checkVerPhp($module); |
41
|
|
|
|
42
|
|
|
if ($xoopsSuccess && $phpSuccess) { |
43
|
|
|
$moduleTables = &$module->getInfo('tables'); |
44
|
|
|
foreach ($moduleTables as $table) { |
45
|
|
|
$GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
return $xoopsSuccess && $phpSuccess; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param \XoopsModule $module |
54
|
|
|
* @return bool |
55
|
|
|
*/ |
56
|
|
|
function xoops_module_install_wgsitenotice(\XoopsModule $module) |
57
|
|
|
{ |
58
|
|
|
require \dirname(__DIR__) . '/preloads/autoloader.php'; |
59
|
|
|
|
60
|
|
|
$helper = Wgsitenotice\Helper::getInstance(); |
61
|
|
|
$utility = new Wgsitenotice\Utility(); |
62
|
|
|
$configurator = new Common\Configurator(); |
63
|
|
|
|
64
|
|
|
// Load language files |
65
|
|
|
$helper->loadLanguage('admin'); |
66
|
|
|
$helper->loadLanguage('modinfo'); |
67
|
|
|
$helper->loadLanguage('common'); |
68
|
|
|
|
69
|
|
|
// --- CREATE FOLDERS --------------- |
70
|
|
|
if ($configurator->uploadFolders && \is_array($configurator->uploadFolders)) { |
71
|
|
|
foreach (\array_keys($configurator->uploadFolders) as $i) { |
72
|
|
|
$utility::createFolder($configurator->uploadFolders[$i]); |
73
|
|
|
chmod($configurator->uploadFolders[$i], 0777); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
// --- COPY blank.gif FILES --------------- |
78
|
|
|
if ($configurator->copyBlankFiles && \is_array($configurator->copyBlankFiles)) { |
79
|
|
|
$file = \dirname(__DIR__) . '/assets/images/blank.gif'; |
80
|
|
|
foreach (\array_keys($configurator->copyBlankFiles) as $i) { |
81
|
|
|
$dest = $configurator->copyBlankFiles[$i] . '/blank.gif'; |
82
|
|
|
$utility::copyFile($file, $dest); |
83
|
|
|
} |
84
|
|
|
$file = \dirname(__DIR__) . '/assets/images/blank.png'; |
85
|
|
|
foreach (\array_keys($configurator->copyBlankFiles) as $i) { |
86
|
|
|
$dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
87
|
|
|
$utility::copyFile($file, $dest); |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
return true; |
92
|
|
|
} |
93
|
|
|
|