1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* **************************************************************************** |
4
|
|
|
* xsitemap - MODULE FOR XOOPS CMS |
5
|
|
|
* Copyright (c) Urbanspaceman (http://www.takeaweb.it) |
6
|
|
|
* |
7
|
|
|
* You may not change or alter any portion of this comment or credits |
8
|
|
|
* of supporting developers from this source code or any supporting source code |
9
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
10
|
|
|
* This program is distributed in the hope that it will be useful, |
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
* |
14
|
|
|
* @copyright Urbanspaceman (http://www.takeaweb.it) |
15
|
|
|
* @license GPL |
16
|
|
|
* @package xsitemap |
17
|
|
|
* @author Urbanspaceman (http://www.takeaweb.it) |
18
|
|
|
* |
19
|
|
|
* Version : 1.00: |
20
|
|
|
* **************************************************************************** |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @internal {Make sure you PROTECT THIS FILE} |
25
|
|
|
*/ |
26
|
|
|
|
27
|
|
|
use XoopsModules\Xsitemap\{ |
28
|
|
|
Utility |
29
|
|
|
}; |
30
|
|
|
/** @var Utility $utility */ |
31
|
|
|
|
32
|
|
|
if ((!defined('XOOPS_ROOT_PATH')) |
33
|
|
|
|| !($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
34
|
|
|
|| !$GLOBALS['xoopsUser']->isAdmin()) { |
35
|
|
|
exit('Restricted access' . PHP_EOL); |
36
|
|
|
} |
37
|
|
|
/** |
38
|
|
|
* Prepares system prior to attempting to install module |
39
|
|
|
* |
40
|
|
|
* @param \XoopsModule $module |
41
|
|
|
* |
42
|
|
|
* @return bool true if ready to install, false if not |
43
|
|
|
*/ |
44
|
|
|
function xoops_module_pre_install_xsitemap(\XoopsModule $module) |
45
|
|
|
{ |
46
|
|
|
$moduleDirName = \basename(\dirname(__DIR__)); |
|
|
|
|
47
|
|
|
require_once \dirname(__DIR__) . '/preloads/autoloader.php'; |
48
|
|
|
$utility = new Utility(); |
49
|
|
|
$xoopsSuccess = $utility::checkVerXoops($module); |
50
|
|
|
$phpSuccess = $utility::checkVerPhp($module); |
51
|
|
|
if (false !== $xoopsSuccess && false !== $phpSuccess) { |
52
|
|
|
$moduleTables = &$module->getInfo('tables'); |
53
|
|
|
foreach ($moduleTables as $table) { |
54
|
|
|
$GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
return $xoopsSuccess && $phpSuccess; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Performs tasks required during installation of the module |
62
|
|
|
* |
63
|
|
|
* @param \XoopsModule $module |
64
|
|
|
* |
65
|
|
|
* @return bool true if installation successful, false if not |
66
|
|
|
*/ |
67
|
|
|
function xoops_module_install_xsitemap(\XoopsModule $module) |
|
|
|
|
68
|
|
|
{ |
69
|
|
|
// $configuratorArray = require_once __DIR__ . '/config.php'; |
70
|
|
|
// require_once __DIR__ . '/../class/configurator.php'; |
71
|
|
|
// $configuratorClass = new XsitemapConfigurator(); |
72
|
|
|
return true; |
73
|
|
|
/** @internal following code removed, it will fail because module not fully loaded/available until |
74
|
|
|
* after install, module now uses XOOPS preload instead */ |
75
|
|
|
/* |
76
|
|
|
//28/08/2009 by urbanspaceman |
77
|
|
|
require_once $GLOBALS['xoops']->path("class/tree.php"); |
78
|
|
|
|
79
|
|
|
//Create the xsitemap.xml file in the site root |
80
|
|
|
$xsitemap_show = Utility::generateSitemap(); |
81
|
|
|
return Utility::saveSitemap($xsitemap_show) ? true : false; |
82
|
|
|
*/ |
83
|
|
|
} |
84
|
|
|
|