@@ -17,60 +17,60 @@ |
||
17 | 17 | */ |
18 | 18 | trait ServerStats |
19 | 19 | { |
20 | - /** |
|
21 | - * serverStats() |
|
22 | - * |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public static function getServerStats() |
|
26 | - { |
|
27 | - //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); |
|
28 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
29 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
30 | - xoops_loadLanguage('common', $moduleDirName); |
|
31 | - $html = ''; |
|
32 | - // $sql = 'SELECT metavalue'; |
|
33 | - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); |
|
34 | - // $sql .= " WHERE metakey='version' LIMIT 1"; |
|
35 | - // $query = $GLOBALS['xoopsDB']->query($sql); |
|
36 | - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
|
37 | - $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
38 | - $html .= "<div style='padding: 8px;'>\n"; |
|
39 | - // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
|
40 | - // $html .= "<br>\n"; |
|
41 | - // $html .= "<br>\n"; |
|
42 | - $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
43 | - $html .= "<ul>\n"; |
|
44 | - // |
|
45 | - $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
46 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
47 | - if (function_exists('gd_info')) { |
|
48 | - if (true === ($gdlib = gd_info())) { |
|
49 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
50 | - } |
|
51 | - } |
|
52 | - // |
|
53 | - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); |
|
54 | - // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; |
|
55 | - // |
|
56 | - // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
|
57 | - // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
|
58 | - // |
|
59 | - $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
60 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
61 | - // |
|
62 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
63 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
64 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
65 | - $html .= "</ul>\n"; |
|
66 | - $html .= "<ul>\n"; |
|
67 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
68 | - $html .= "</ul>\n"; |
|
69 | - $html .= "<br>\n"; |
|
70 | - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
71 | - $html .= '</div>'; |
|
72 | - $html .= '</fieldset><br>'; |
|
20 | + /** |
|
21 | + * serverStats() |
|
22 | + * |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public static function getServerStats() |
|
26 | + { |
|
27 | + //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); |
|
28 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
29 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
30 | + xoops_loadLanguage('common', $moduleDirName); |
|
31 | + $html = ''; |
|
32 | + // $sql = 'SELECT metavalue'; |
|
33 | + // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); |
|
34 | + // $sql .= " WHERE metakey='version' LIMIT 1"; |
|
35 | + // $query = $GLOBALS['xoopsDB']->query($sql); |
|
36 | + // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
|
37 | + $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
38 | + $html .= "<div style='padding: 8px;'>\n"; |
|
39 | + // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
|
40 | + // $html .= "<br>\n"; |
|
41 | + // $html .= "<br>\n"; |
|
42 | + $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
43 | + $html .= "<ul>\n"; |
|
44 | + // |
|
45 | + $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
46 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
47 | + if (function_exists('gd_info')) { |
|
48 | + if (true === ($gdlib = gd_info())) { |
|
49 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
50 | + } |
|
51 | + } |
|
52 | + // |
|
53 | + // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); |
|
54 | + // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; |
|
55 | + // |
|
56 | + // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
|
57 | + // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
|
58 | + // |
|
59 | + $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
60 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
61 | + // |
|
62 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
63 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
64 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
65 | + $html .= "</ul>\n"; |
|
66 | + $html .= "<ul>\n"; |
|
67 | + $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
68 | + $html .= "</ul>\n"; |
|
69 | + $html .= "<br>\n"; |
|
70 | + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
71 | + $html .= '</div>'; |
|
72 | + $html .= '</fieldset><br>'; |
|
73 | 73 | |
74 | - return $html; |
|
75 | - } |
|
74 | + return $html; |
|
75 | + } |
|
76 | 76 | } |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | // $sql .= " WHERE metakey='version' LIMIT 1"; |
35 | 35 | // $query = $GLOBALS['xoopsDB']->query($sql); |
36 | 36 | // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); |
37 | - $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n"; |
|
37 | + $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n"; |
|
38 | 38 | $html .= "<div style='padding: 8px;'>\n"; |
39 | 39 | // $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n"; |
40 | 40 | // $html .= "<br>\n"; |
41 | 41 | // $html .= "<br>\n"; |
42 | - $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n"; |
|
42 | + $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n"; |
|
43 | 43 | $html .= "<ul>\n"; |
44 | 44 | // |
45 | - $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>'; |
|
46 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; |
|
45 | + $gdlib = function_exists('gd_info') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>'; |
|
46 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib; |
|
47 | 47 | if (function_exists('gd_info')) { |
48 | 48 | if (true === ($gdlib = gd_info())) { |
49 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>'; |
|
49 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | // |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | // $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>'; |
57 | 57 | // $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; |
58 | 58 | // |
59 | - $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>'; |
|
60 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; |
|
59 | + $downloads = ini_get('file_uploads') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>'; |
|
60 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads; |
|
61 | 61 | // |
62 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n"; |
|
63 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n"; |
|
64 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n"; |
|
62 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.ini_get('upload_max_filesize')."</span></b>\n"; |
|
63 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.ini_get('post_max_size')."</span></b>\n"; |
|
64 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.ini_get('memory_limit')."</span></b>\n"; |
|
65 | 65 | $html .= "</ul>\n"; |
66 | 66 | $html .= "<ul>\n"; |
67 | - $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n"; |
|
67 | + $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n"; |
|
68 | 68 | $html .= "</ul>\n"; |
69 | 69 | $html .= "<br>\n"; |
70 | - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; |
|
70 | + $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n"; |
|
71 | 71 | $html .= '</div>'; |
72 | 72 | $html .= '</fieldset><br>'; |
73 | 73 |
@@ -17,60 +17,60 @@ |
||
17 | 17 | */ |
18 | 18 | trait VersionChecks |
19 | 19 | { |
20 | - /** |
|
21 | - * |
|
22 | - * Verifies XOOPS version meets minimum requirements for this module |
|
23 | - * @static |
|
24 | - * @param \XoopsModule $module |
|
25 | - * |
|
26 | - * @param null|string $requiredVer |
|
27 | - * @return bool true if meets requirements, false if not |
|
28 | - */ |
|
29 | - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
|
30 | - { |
|
31 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
32 | - if (null === $module) { |
|
33 | - $module = \XoopsModule::getByDirname($moduleDirName); |
|
34 | - } |
|
35 | - xoops_loadLanguage('admin', $moduleDirName); |
|
20 | + /** |
|
21 | + * |
|
22 | + * Verifies XOOPS version meets minimum requirements for this module |
|
23 | + * @static |
|
24 | + * @param \XoopsModule $module |
|
25 | + * |
|
26 | + * @param null|string $requiredVer |
|
27 | + * @return bool true if meets requirements, false if not |
|
28 | + */ |
|
29 | + public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
|
30 | + { |
|
31 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
32 | + if (null === $module) { |
|
33 | + $module = \XoopsModule::getByDirname($moduleDirName); |
|
34 | + } |
|
35 | + xoops_loadLanguage('admin', $moduleDirName); |
|
36 | 36 | |
37 | - //check for minimum XOOPS version |
|
38 | - $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
39 | - if (null === $requiredVer) { |
|
40 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
41 | - } |
|
42 | - $success = true; |
|
37 | + //check for minimum XOOPS version |
|
38 | + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
39 | + if (null === $requiredVer) { |
|
40 | + $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
41 | + } |
|
42 | + $success = true; |
|
43 | 43 | |
44 | - if (version_compare($currentVer, $requiredVer, '<')) { |
|
45 | - $success = false; |
|
46 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
47 | - } |
|
44 | + if (version_compare($currentVer, $requiredVer, '<')) { |
|
45 | + $success = false; |
|
46 | + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
47 | + } |
|
48 | 48 | |
49 | - return $success; |
|
50 | - } |
|
49 | + return $success; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * |
|
54 | - * Verifies PHP version meets minimum requirements for this module |
|
55 | - * @static |
|
56 | - * @param \XoopsModule $module |
|
57 | - * |
|
58 | - * @return bool true if meets requirements, false if not |
|
59 | - */ |
|
60 | - public static function checkVerPhp(\XoopsModule $module) |
|
61 | - { |
|
62 | - xoops_loadLanguage('admin', $module->dirname()); |
|
63 | - // check for minimum PHP version |
|
64 | - $success = true; |
|
65 | - $verNum = PHP_VERSION; |
|
66 | - $reqVer =& $module->getInfo('min_php'); |
|
67 | - if (false !== $reqVer && '' !== $reqVer) { |
|
68 | - if (version_compare($verNum, $reqVer, '<')) { |
|
69 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
70 | - $success = false; |
|
71 | - } |
|
72 | - } |
|
52 | + /** |
|
53 | + * |
|
54 | + * Verifies PHP version meets minimum requirements for this module |
|
55 | + * @static |
|
56 | + * @param \XoopsModule $module |
|
57 | + * |
|
58 | + * @return bool true if meets requirements, false if not |
|
59 | + */ |
|
60 | + public static function checkVerPhp(\XoopsModule $module) |
|
61 | + { |
|
62 | + xoops_loadLanguage('admin', $module->dirname()); |
|
63 | + // check for minimum PHP version |
|
64 | + $success = true; |
|
65 | + $verNum = PHP_VERSION; |
|
66 | + $reqVer =& $module->getInfo('min_php'); |
|
67 | + if (false !== $reqVer && '' !== $reqVer) { |
|
68 | + if (version_compare($verNum, $reqVer, '<')) { |
|
69 | + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
70 | + $success = false; |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | - return $success; |
|
75 | - } |
|
74 | + return $success; |
|
75 | + } |
|
76 | 76 | } |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | //check for minimum XOOPS version |
38 | 38 | $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
39 | 39 | if (null === $requiredVer) { |
40 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
40 | + $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string |
|
41 | 41 | } |
42 | - $success = true; |
|
42 | + $success = true; |
|
43 | 43 | |
44 | 44 | if (version_compare($currentVer, $requiredVer, '<')) { |
45 | - $success = false; |
|
46 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
45 | + $success = false; |
|
46 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | return $success; |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | // check for minimum PHP version |
64 | 64 | $success = true; |
65 | 65 | $verNum = PHP_VERSION; |
66 | - $reqVer =& $module->getInfo('min_php'); |
|
66 | + $reqVer = & $module->getInfo('min_php'); |
|
67 | 67 | if (false !== $reqVer && '' !== $reqVer) { |
68 | 68 | if (version_compare($verNum, $reqVer, '<')) { |
69 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
69 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
70 | 70 | $success = false; |
71 | 71 | } |
72 | 72 | } |
@@ -31,48 +31,48 @@ |
||
31 | 31 | */ |
32 | 32 | class Breadcrumb |
33 | 33 | { |
34 | - public $dirname; |
|
35 | - private $bread = []; |
|
34 | + public $dirname; |
|
35 | + private $bread = []; |
|
36 | 36 | |
37 | - /** |
|
38 | - * |
|
39 | - */ |
|
40 | - public function __construct() |
|
41 | - { |
|
42 | - $this->dirname = basename(dirname(__DIR__)); |
|
43 | - } |
|
37 | + /** |
|
38 | + * |
|
39 | + */ |
|
40 | + public function __construct() |
|
41 | + { |
|
42 | + $this->dirname = basename(dirname(__DIR__)); |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * Add link to breadcrumb |
|
47 | - * |
|
48 | - * @param string $title |
|
49 | - * @param string $link |
|
50 | - */ |
|
51 | - public function addLink($title = '', $link = '') |
|
52 | - { |
|
53 | - $this->bread[] = [ |
|
54 | - 'link' => $link, |
|
55 | - 'title' => $title |
|
56 | - ]; |
|
57 | - } |
|
45 | + /** |
|
46 | + * Add link to breadcrumb |
|
47 | + * |
|
48 | + * @param string $title |
|
49 | + * @param string $link |
|
50 | + */ |
|
51 | + public function addLink($title = '', $link = '') |
|
52 | + { |
|
53 | + $this->bread[] = [ |
|
54 | + 'link' => $link, |
|
55 | + 'title' => $title |
|
56 | + ]; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Render Pedigree BreadCrumb |
|
61 | - * |
|
62 | - */ |
|
63 | - public function render() |
|
64 | - { |
|
65 | - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
66 | - require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
67 | - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
|
68 | - } |
|
59 | + /** |
|
60 | + * Render Pedigree BreadCrumb |
|
61 | + * |
|
62 | + */ |
|
63 | + public function render() |
|
64 | + { |
|
65 | + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { |
|
66 | + require_once $GLOBALS['xoops']->path('class/theme.php'); |
|
67 | + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); |
|
68 | + } |
|
69 | 69 | |
70 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
71 | - $breadcrumbTpl = new \XoopsTpl(); |
|
72 | - $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
73 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
74 | - unset($breadcrumbTpl); |
|
70 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
71 | + $breadcrumbTpl = new \XoopsTpl(); |
|
72 | + $breadcrumbTpl->assign('breadcrumb', $this->bread); |
|
73 | + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
74 | + unset($breadcrumbTpl); |
|
75 | 75 | |
76 | - return $html; |
|
77 | - } |
|
76 | + return $html; |
|
77 | + } |
|
78 | 78 | } |
@@ -70,7 +70,7 @@ |
||
70 | 70 | require_once $GLOBALS['xoops']->path('class/template.php'); |
71 | 71 | $breadcrumbTpl = new \XoopsTpl(); |
72 | 72 | $breadcrumbTpl->assign('breadcrumb', $this->bread); |
73 | - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); |
|
73 | + $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl'); |
|
74 | 74 | unset($breadcrumbTpl); |
75 | 75 | |
76 | 76 | return $html; |
@@ -17,229 +17,229 @@ |
||
17 | 17 | */ |
18 | 18 | trait FilesManagement |
19 | 19 | { |
20 | - /** |
|
21 | - * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
22 | - * |
|
23 | - * @param string $folder The full path of the directory to check |
|
24 | - * |
|
25 | - * @return void |
|
26 | - * @throws \RuntimeException |
|
27 | - */ |
|
28 | - public static function createFolder($folder) |
|
29 | - { |
|
30 | - try { |
|
31 | - if (!file_exists($folder)) { |
|
32 | - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { |
|
33 | - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
34 | - } |
|
35 | - |
|
36 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
37 | - } |
|
38 | - } catch (\Exception $e) { |
|
39 | - echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
40 | - } |
|
41 | - } |
|
42 | - |
|
43 | - /** |
|
44 | - * @param $file |
|
45 | - * @param $folder |
|
46 | - * @return bool |
|
47 | - */ |
|
48 | - public static function copyFile($file, $folder) |
|
49 | - { |
|
50 | - return copy($file, $folder); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * @param $src |
|
55 | - * @param $dst |
|
56 | - */ |
|
57 | - public static function recurseCopy($src, $dst) |
|
58 | - { |
|
59 | - $dir = opendir($src); |
|
60 | - // @mkdir($dst); |
|
61 | - if (!mkdir($dst) && !is_dir($dst)) { |
|
62 | - while (false !== ($file = readdir($dir))) { |
|
63 | - if (('.' !== $file) && ('..' !== $file)) { |
|
64 | - if (is_dir($src . '/' . $file)) { |
|
65 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
66 | - } else { |
|
67 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
68 | - } |
|
69 | - } |
|
70 | - } |
|
71 | - } |
|
72 | - closedir($dir); |
|
73 | - } |
|
74 | - |
|
75 | - /** |
|
76 | - * |
|
77 | - * Remove files and (sub)directories |
|
78 | - * |
|
79 | - * @param string $src source directory to delete |
|
80 | - * |
|
81 | - * @uses \Xmf\Module\Helper::getHelper() |
|
82 | - * @uses \Xmf\Module\Helper::isUserAdmin() |
|
83 | - * |
|
84 | - * @return bool true on success |
|
85 | - */ |
|
86 | - public static function deleteDirectory($src) |
|
87 | - { |
|
88 | - // Only continue if user is a 'global' Admin |
|
89 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
90 | - return false; |
|
91 | - } |
|
92 | - |
|
93 | - $success = true; |
|
94 | - // remove old files |
|
95 | - $dirInfo = new \SplFileInfo($src); |
|
96 | - // validate is a directory |
|
97 | - if ($dirInfo->isDir()) { |
|
98 | - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); |
|
99 | - foreach ($fileList as $k => $v) { |
|
100 | - $fileInfo = new \SplFileInfo("{$src}/{$v}"); |
|
101 | - if ($fileInfo->isDir()) { |
|
102 | - // recursively handle subdirectories |
|
103 | - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
104 | - break; |
|
105 | - } |
|
106 | - } else { |
|
107 | - // delete the file |
|
108 | - if (!($success = unlink($fileInfo->getRealPath()))) { |
|
109 | - break; |
|
110 | - } |
|
111 | - } |
|
112 | - } |
|
113 | - // now delete this (sub)directory if all the files are gone |
|
114 | - if ($success) { |
|
115 | - $success = rmdir($dirInfo->getRealPath()); |
|
116 | - } |
|
117 | - } else { |
|
118 | - // input is not a valid directory |
|
119 | - $success = false; |
|
120 | - } |
|
121 | - return $success; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * |
|
126 | - * Recursively remove directory |
|
127 | - * |
|
128 | - * @todo currently won't remove directories with hidden files, should it? |
|
129 | - * |
|
130 | - * @param string $src directory to remove (delete) |
|
131 | - * |
|
132 | - * @return bool true on success |
|
133 | - */ |
|
134 | - public static function rrmdir($src) |
|
135 | - { |
|
136 | - // Only continue if user is a 'global' Admin |
|
137 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
138 | - return false; |
|
139 | - } |
|
140 | - |
|
141 | - // If source is not a directory stop processing |
|
142 | - if (!is_dir($src)) { |
|
143 | - return false; |
|
144 | - } |
|
145 | - |
|
146 | - $success = true; |
|
147 | - |
|
148 | - // Open the source directory to read in files |
|
149 | - $iterator = new \DirectoryIterator($src); |
|
150 | - foreach ($iterator as $fObj) { |
|
151 | - if ($fObj->isFile()) { |
|
152 | - $filename = $fObj->getPathname(); |
|
153 | - $fObj = null; // clear this iterator object to close the file |
|
154 | - if (!unlink($filename)) { |
|
155 | - return false; // couldn't delete the file |
|
156 | - } |
|
157 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
158 | - // Try recursively on directory |
|
159 | - self::rrmdir($fObj->getPathname()); |
|
160 | - } |
|
161 | - } |
|
162 | - $iterator = null; // clear iterator Obj to close file/directory |
|
163 | - return rmdir($src); // remove the directory & return results |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * Recursively move files from one directory to another |
|
168 | - * |
|
169 | - * @param string $src - Source of files being moved |
|
170 | - * @param string $dest - Destination of files being moved |
|
171 | - * |
|
172 | - * @return bool true on success |
|
173 | - */ |
|
174 | - public static function rmove($src, $dest) |
|
175 | - { |
|
176 | - // Only continue if user is a 'global' Admin |
|
177 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
178 | - return false; |
|
179 | - } |
|
180 | - |
|
181 | - // If source is not a directory stop processing |
|
182 | - if (!is_dir($src)) { |
|
183 | - return false; |
|
184 | - } |
|
185 | - |
|
186 | - // If the destination directory does not exist and could not be created stop processing |
|
187 | - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { |
|
188 | - return false; |
|
189 | - } |
|
190 | - |
|
191 | - // Open the source directory to read in files |
|
192 | - $iterator = new \DirectoryIterator($src); |
|
193 | - foreach ($iterator as $fObj) { |
|
194 | - if ($fObj->isFile()) { |
|
195 | - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
196 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
197 | - // Try recursively on directory |
|
198 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
199 | - // rmdir($fObj->getPath()); // now delete the directory |
|
200 | - } |
|
201 | - } |
|
202 | - $iterator = null; // clear iterator Obj to close file/directory |
|
203 | - return rmdir($src); // remove the directory & return results |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * Recursively copy directories and files from one directory to another |
|
208 | - * |
|
209 | - * @param string $src - Source of files being moved |
|
210 | - * @param string $dest - Destination of files being moved |
|
211 | - * |
|
212 | - * @uses \Xmf\Module\Helper::getHelper() |
|
213 | - * @uses \Xmf\Module\Helper::isUserAdmin() |
|
214 | - * |
|
215 | - * @return bool true on success |
|
216 | - */ |
|
217 | - public static function rcopy($src, $dest) |
|
218 | - { |
|
219 | - // Only continue if user is a 'global' Admin |
|
220 | - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
221 | - return false; |
|
222 | - } |
|
223 | - |
|
224 | - // If source is not a directory stop processing |
|
225 | - if (!is_dir($src)) { |
|
226 | - return false; |
|
227 | - } |
|
228 | - |
|
229 | - // If the destination directory does not exist and could not be created stop processing |
|
230 | - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { |
|
231 | - return false; |
|
232 | - } |
|
233 | - |
|
234 | - // Open the source directory to read in files |
|
235 | - $iterator = new \DirectoryIterator($src); |
|
236 | - foreach ($iterator as $fObj) { |
|
237 | - if ($fObj->isFile()) { |
|
238 | - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
239 | - } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
240 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
241 | - } |
|
242 | - } |
|
243 | - return true; |
|
244 | - } |
|
20 | + /** |
|
21 | + * Function responsible for checking if a directory exists, we can also write in and create an index.html file |
|
22 | + * |
|
23 | + * @param string $folder The full path of the directory to check |
|
24 | + * |
|
25 | + * @return void |
|
26 | + * @throws \RuntimeException |
|
27 | + */ |
|
28 | + public static function createFolder($folder) |
|
29 | + { |
|
30 | + try { |
|
31 | + if (!file_exists($folder)) { |
|
32 | + if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { |
|
33 | + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
|
34 | + } |
|
35 | + |
|
36 | + file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
37 | + } |
|
38 | + } catch (\Exception $e) { |
|
39 | + echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
|
40 | + } |
|
41 | + } |
|
42 | + |
|
43 | + /** |
|
44 | + * @param $file |
|
45 | + * @param $folder |
|
46 | + * @return bool |
|
47 | + */ |
|
48 | + public static function copyFile($file, $folder) |
|
49 | + { |
|
50 | + return copy($file, $folder); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * @param $src |
|
55 | + * @param $dst |
|
56 | + */ |
|
57 | + public static function recurseCopy($src, $dst) |
|
58 | + { |
|
59 | + $dir = opendir($src); |
|
60 | + // @mkdir($dst); |
|
61 | + if (!mkdir($dst) && !is_dir($dst)) { |
|
62 | + while (false !== ($file = readdir($dir))) { |
|
63 | + if (('.' !== $file) && ('..' !== $file)) { |
|
64 | + if (is_dir($src . '/' . $file)) { |
|
65 | + self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
66 | + } else { |
|
67 | + copy($src . '/' . $file, $dst . '/' . $file); |
|
68 | + } |
|
69 | + } |
|
70 | + } |
|
71 | + } |
|
72 | + closedir($dir); |
|
73 | + } |
|
74 | + |
|
75 | + /** |
|
76 | + * |
|
77 | + * Remove files and (sub)directories |
|
78 | + * |
|
79 | + * @param string $src source directory to delete |
|
80 | + * |
|
81 | + * @uses \Xmf\Module\Helper::getHelper() |
|
82 | + * @uses \Xmf\Module\Helper::isUserAdmin() |
|
83 | + * |
|
84 | + * @return bool true on success |
|
85 | + */ |
|
86 | + public static function deleteDirectory($src) |
|
87 | + { |
|
88 | + // Only continue if user is a 'global' Admin |
|
89 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
90 | + return false; |
|
91 | + } |
|
92 | + |
|
93 | + $success = true; |
|
94 | + // remove old files |
|
95 | + $dirInfo = new \SplFileInfo($src); |
|
96 | + // validate is a directory |
|
97 | + if ($dirInfo->isDir()) { |
|
98 | + $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); |
|
99 | + foreach ($fileList as $k => $v) { |
|
100 | + $fileInfo = new \SplFileInfo("{$src}/{$v}"); |
|
101 | + if ($fileInfo->isDir()) { |
|
102 | + // recursively handle subdirectories |
|
103 | + if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { |
|
104 | + break; |
|
105 | + } |
|
106 | + } else { |
|
107 | + // delete the file |
|
108 | + if (!($success = unlink($fileInfo->getRealPath()))) { |
|
109 | + break; |
|
110 | + } |
|
111 | + } |
|
112 | + } |
|
113 | + // now delete this (sub)directory if all the files are gone |
|
114 | + if ($success) { |
|
115 | + $success = rmdir($dirInfo->getRealPath()); |
|
116 | + } |
|
117 | + } else { |
|
118 | + // input is not a valid directory |
|
119 | + $success = false; |
|
120 | + } |
|
121 | + return $success; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * |
|
126 | + * Recursively remove directory |
|
127 | + * |
|
128 | + * @todo currently won't remove directories with hidden files, should it? |
|
129 | + * |
|
130 | + * @param string $src directory to remove (delete) |
|
131 | + * |
|
132 | + * @return bool true on success |
|
133 | + */ |
|
134 | + public static function rrmdir($src) |
|
135 | + { |
|
136 | + // Only continue if user is a 'global' Admin |
|
137 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
138 | + return false; |
|
139 | + } |
|
140 | + |
|
141 | + // If source is not a directory stop processing |
|
142 | + if (!is_dir($src)) { |
|
143 | + return false; |
|
144 | + } |
|
145 | + |
|
146 | + $success = true; |
|
147 | + |
|
148 | + // Open the source directory to read in files |
|
149 | + $iterator = new \DirectoryIterator($src); |
|
150 | + foreach ($iterator as $fObj) { |
|
151 | + if ($fObj->isFile()) { |
|
152 | + $filename = $fObj->getPathname(); |
|
153 | + $fObj = null; // clear this iterator object to close the file |
|
154 | + if (!unlink($filename)) { |
|
155 | + return false; // couldn't delete the file |
|
156 | + } |
|
157 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
158 | + // Try recursively on directory |
|
159 | + self::rrmdir($fObj->getPathname()); |
|
160 | + } |
|
161 | + } |
|
162 | + $iterator = null; // clear iterator Obj to close file/directory |
|
163 | + return rmdir($src); // remove the directory & return results |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * Recursively move files from one directory to another |
|
168 | + * |
|
169 | + * @param string $src - Source of files being moved |
|
170 | + * @param string $dest - Destination of files being moved |
|
171 | + * |
|
172 | + * @return bool true on success |
|
173 | + */ |
|
174 | + public static function rmove($src, $dest) |
|
175 | + { |
|
176 | + // Only continue if user is a 'global' Admin |
|
177 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
178 | + return false; |
|
179 | + } |
|
180 | + |
|
181 | + // If source is not a directory stop processing |
|
182 | + if (!is_dir($src)) { |
|
183 | + return false; |
|
184 | + } |
|
185 | + |
|
186 | + // If the destination directory does not exist and could not be created stop processing |
|
187 | + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { |
|
188 | + return false; |
|
189 | + } |
|
190 | + |
|
191 | + // Open the source directory to read in files |
|
192 | + $iterator = new \DirectoryIterator($src); |
|
193 | + foreach ($iterator as $fObj) { |
|
194 | + if ($fObj->isFile()) { |
|
195 | + rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
196 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
197 | + // Try recursively on directory |
|
198 | + self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
199 | + // rmdir($fObj->getPath()); // now delete the directory |
|
200 | + } |
|
201 | + } |
|
202 | + $iterator = null; // clear iterator Obj to close file/directory |
|
203 | + return rmdir($src); // remove the directory & return results |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * Recursively copy directories and files from one directory to another |
|
208 | + * |
|
209 | + * @param string $src - Source of files being moved |
|
210 | + * @param string $dest - Destination of files being moved |
|
211 | + * |
|
212 | + * @uses \Xmf\Module\Helper::getHelper() |
|
213 | + * @uses \Xmf\Module\Helper::isUserAdmin() |
|
214 | + * |
|
215 | + * @return bool true on success |
|
216 | + */ |
|
217 | + public static function rcopy($src, $dest) |
|
218 | + { |
|
219 | + // Only continue if user is a 'global' Admin |
|
220 | + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { |
|
221 | + return false; |
|
222 | + } |
|
223 | + |
|
224 | + // If source is not a directory stop processing |
|
225 | + if (!is_dir($src)) { |
|
226 | + return false; |
|
227 | + } |
|
228 | + |
|
229 | + // If the destination directory does not exist and could not be created stop processing |
|
230 | + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { |
|
231 | + return false; |
|
232 | + } |
|
233 | + |
|
234 | + // Open the source directory to read in files |
|
235 | + $iterator = new \DirectoryIterator($src); |
|
236 | + foreach ($iterator as $fObj) { |
|
237 | + if ($fObj->isFile()) { |
|
238 | + copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
239 | + } elseif (!$fObj->isDot() && $fObj->isDir()) { |
|
240 | + self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
241 | + } |
|
242 | + } |
|
243 | + return true; |
|
244 | + } |
|
245 | 245 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
34 | 34 | } |
35 | 35 | |
36 | - file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
|
36 | + file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>'); |
|
37 | 37 | } |
38 | 38 | } catch (\Exception $e) { |
39 | 39 | echo 'Caught exception: ', $e->getMessage(), "\n", '<br>'; |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | if (!mkdir($dst) && !is_dir($dst)) { |
62 | 62 | while (false !== ($file = readdir($dir))) { |
63 | 63 | if (('.' !== $file) && ('..' !== $file)) { |
64 | - if (is_dir($src . '/' . $file)) { |
|
65 | - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
|
64 | + if (is_dir($src.'/'.$file)) { |
|
65 | + self::recurseCopy($src.'/'.$file, $dst.'/'.$file); |
|
66 | 66 | } else { |
67 | - copy($src . '/' . $file, $dst . '/' . $file); |
|
67 | + copy($src.'/'.$file, $dst.'/'.$file); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | self::rrmdir($fObj->getPathname()); |
160 | 160 | } |
161 | 161 | } |
162 | - $iterator = null; // clear iterator Obj to close file/directory |
|
162 | + $iterator = null; // clear iterator Obj to close file/directory |
|
163 | 163 | return rmdir($src); // remove the directory & return results |
164 | 164 | } |
165 | 165 | |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $iterator = new \DirectoryIterator($src); |
193 | 193 | foreach ($iterator as $fObj) { |
194 | 194 | if ($fObj->isFile()) { |
195 | - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
195 | + rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
196 | 196 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
197 | 197 | // Try recursively on directory |
198 | - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
198 | + self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
199 | 199 | // rmdir($fObj->getPath()); // now delete the directory |
200 | 200 | } |
201 | 201 | } |
202 | - $iterator = null; // clear iterator Obj to close file/directory |
|
202 | + $iterator = null; // clear iterator Obj to close file/directory |
|
203 | 203 | return rmdir($src); // remove the directory & return results |
204 | 204 | } |
205 | 205 | |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | $iterator = new \DirectoryIterator($src); |
236 | 236 | foreach ($iterator as $fObj) { |
237 | 237 | if ($fObj->isFile()) { |
238 | - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
238 | + copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
239 | 239 | } elseif (!$fObj->isDot() && $fObj->isDir()) { |
240 | - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); |
|
240 | + self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename()); |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | return true; |
@@ -6,9 +6,9 @@ |
||
6 | 6 | * Licence: GNU |
7 | 7 | */ |
8 | 8 | |
9 | -require_once __DIR__ . '/header.php'; |
|
10 | -require_once SMARTOBJECT_ROOT_PATH . 'class/smartloader.php'; |
|
11 | -require_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
9 | +require_once __DIR__.'/header.php'; |
|
10 | +require_once SMARTOBJECT_ROOT_PATH.'class/smartloader.php'; |
|
11 | +require_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
12 | 12 | |
13 | 13 | $xoopsTpl = new \XoopsTpl(); |
14 | 14 | $myts = \MyTextSanitizer::getInstance(); |
@@ -13,253 +13,253 @@ |
||
13 | 13 | */ |
14 | 14 | class XoopsCaptcha |
15 | 15 | { |
16 | - public $active = true; |
|
17 | - public $mode = 'text'; // potential values: image, text |
|
18 | - public $config = []; |
|
19 | - |
|
20 | - public $message = []; // Logging error messages |
|
21 | - |
|
22 | - /** |
|
23 | - * XoopsCaptcha constructor. |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - // Loading default preferences |
|
28 | - $this->config = @include __DIR__ . '/config.php'; |
|
29 | - |
|
30 | - $this->setMode($this->config['mode']); |
|
31 | - } |
|
32 | - |
|
33 | - /** |
|
34 | - * @return XoopsCaptcha |
|
35 | - */ |
|
36 | - public static function getInstance() |
|
37 | - { |
|
38 | - static $instance; |
|
39 | - if (null === $instance) { |
|
40 | - $instance = new static(); |
|
41 | - } |
|
42 | - |
|
43 | - return $instance; |
|
44 | - } |
|
45 | - |
|
46 | - /** |
|
47 | - * @param $name |
|
48 | - * @param $val |
|
49 | - * @return bool |
|
50 | - */ |
|
51 | - public function setConfig($name, $val) |
|
52 | - { |
|
53 | - if ('mode' === $name) { |
|
54 | - $this->setMode($val); |
|
55 | - } elseif (isset($this->$name)) { |
|
56 | - $this->$name = $val; |
|
57 | - } else { |
|
58 | - $this->config[$name] = $val; |
|
59 | - } |
|
60 | - |
|
61 | - return true; |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * Set CAPTCHA mode |
|
66 | - * |
|
67 | - * For future possible modes, right now force to use text or image |
|
68 | - * |
|
69 | - * @param string $mode if no mode is set, just verify current mode |
|
70 | - */ |
|
71 | - public function setMode($mode = null) |
|
72 | - { |
|
73 | - if (!empty($mode) && in_array($mode, ['text', 'image'])) { |
|
74 | - $this->mode = $mode; |
|
75 | - |
|
76 | - if ('image' !== $this->mode) { |
|
77 | - return; |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - // Disable image mode |
|
82 | - if (!extension_loaded('gd')) { |
|
83 | - $this->mode = 'text'; |
|
84 | - } else { |
|
85 | - $required_functions = [ |
|
86 | - 'imagecreatetruecolor', |
|
87 | - 'imagecolorallocate', |
|
88 | - 'imagefilledrectangle', |
|
89 | - 'imagejpeg', |
|
90 | - 'imagedestroy', |
|
91 | - 'imageftbbox' |
|
92 | - ]; |
|
93 | - foreach ($required_functions as $func) { |
|
94 | - if (!function_exists($func)) { |
|
95 | - $this->mode = 'text'; |
|
96 | - break; |
|
97 | - } |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Initializing the CAPTCHA class |
|
104 | - * @param string $name |
|
105 | - * @param null $skipmember |
|
106 | - * @param null $num_chars |
|
107 | - * @param null $fontsize_min |
|
108 | - * @param null $fontsize_max |
|
109 | - * @param null $background_type |
|
110 | - * @param null $background_num |
|
111 | - */ |
|
112 | - public function init( |
|
113 | - $name = 'xoopscaptcha', |
|
114 | - $skipmember = null, |
|
115 | - $num_chars = null, |
|
116 | - $fontsize_min = null, |
|
117 | - $fontsize_max = null, |
|
118 | - $background_type = null, |
|
119 | - $background_num = null |
|
120 | - ) { |
|
121 | - // Loading RUN-TIME settings |
|
122 | - foreach (array_keys($this->config) as $key) { |
|
123 | - if (isset(${$key}) && null !== ${$key}) { |
|
124 | - $this->config[$key] = ${$key}; |
|
125 | - } |
|
126 | - } |
|
127 | - $this->config['name'] = $name; |
|
128 | - |
|
129 | - // Skip CAPTCHA for member if set |
|
130 | - if ($this->config['skipmember'] && is_object($GLOBALS['xoopsUser'])) { |
|
131 | - $this->active = false; |
|
132 | - } |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * Verify user submission |
|
137 | - * @param null $skipMember |
|
138 | - * @return bool |
|
139 | - */ |
|
140 | - public function verify($skipMember = null) |
|
141 | - { |
|
142 | - $sessionName = @$_SESSION['XoopsCaptcha_name']; |
|
143 | - $skipMember = (null === $skipMember) ? @$_SESSION['XoopsCaptcha_skipmember'] : $skipMember; |
|
144 | - $maxAttempts = (int)(@$_SESSION['XoopsCaptcha_maxattempts']); |
|
145 | - |
|
146 | - $is_valid = false; |
|
147 | - |
|
148 | - // Skip CAPTCHA for member if set |
|
149 | - if (is_object($GLOBALS['xoopsUser']) && !empty($skipMember)) { |
|
150 | - $is_valid = true; |
|
151 | - // Kill too many attempts |
|
152 | - } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_' . $sessionName] > $maxAttempts) { |
|
153 | - $this->message[] = XOOPS_CAPTCHA_TOOMANYATTEMPTS; |
|
154 | - |
|
155 | - // Verify the code |
|
156 | - } elseif (!empty($_SESSION['XoopsCaptcha_sessioncode'])) { |
|
157 | - $func = $this->config['casesensitive'] ? 'strcmp' : 'strcasecmp'; |
|
158 | - $is_valid = !$func(trim(@$_POST[$sessionName]), $_SESSION['XoopsCaptcha_sessioncode']); |
|
159 | - } |
|
160 | - |
|
161 | - if (!empty($maxAttempts)) { |
|
162 | - if (!$is_valid) { |
|
163 | - // Increase the attempt records on failure |
|
164 | - $_SESSION['XoopsCaptcha_attempt_' . $sessionName]++; |
|
165 | - // Log the error message |
|
166 | - $this->message[] = XOOPS_CAPTCHA_INVALID_CODE; |
|
167 | - } else { |
|
168 | - |
|
169 | - // reset attempt records on success |
|
170 | - $_SESSION['XoopsCaptcha_attempt_' . $sessionName] = null; |
|
171 | - } |
|
172 | - } |
|
173 | - $this->destroyGarbage(true); |
|
174 | - |
|
175 | - return $is_valid; |
|
176 | - } |
|
177 | - |
|
178 | - /** |
|
179 | - * @return mixed|string |
|
180 | - */ |
|
181 | - public function getCaption() |
|
182 | - { |
|
183 | - return defined('XOOPS_CAPTCHA_CAPTION') ? constant('XOOPS_CAPTCHA_CAPTION') : ''; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * @return string |
|
188 | - */ |
|
189 | - public function getMessage() |
|
190 | - { |
|
191 | - return implode('<br>', $this->message); |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Destory historical stuff |
|
196 | - * @param bool $clearSession |
|
197 | - * @return bool |
|
198 | - */ |
|
199 | - public function destroyGarbage($clearSession = false) |
|
200 | - { |
|
201 | - require_once __DIR__ . '/' . $this->mode . '.php'; |
|
202 | - $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
203 | - $captchaHandler = new $class(); |
|
204 | - if (method_exists($captchaHandler, 'destroyGarbage')) { |
|
205 | - $captchaHandler->loadConfig($this->config); |
|
206 | - $captchaHandler->destroyGarbage(); |
|
207 | - } |
|
208 | - |
|
209 | - if ($clearSession) { |
|
210 | - $_SESSION['XoopsCaptcha_name'] = null; |
|
211 | - $_SESSION['XoopsCaptcha_skipmember'] = null; |
|
212 | - $_SESSION['XoopsCaptcha_sessioncode'] = null; |
|
213 | - $_SESSION['XoopsCaptcha_maxattempts'] = null; |
|
214 | - } |
|
215 | - |
|
216 | - return true; |
|
217 | - } |
|
218 | - |
|
219 | - /** |
|
220 | - * @return mixed|string |
|
221 | - */ |
|
222 | - public function render() |
|
223 | - { |
|
224 | - $form = ''; |
|
225 | - |
|
226 | - if (!$this->active || empty($this->config['name'])) { |
|
227 | - return $form; |
|
228 | - } |
|
229 | - |
|
230 | - $_SESSION['XoopsCaptcha_name'] = $this->config['name']; |
|
231 | - $_SESSION['XoopsCaptcha_skipmember'] = $this->config['skipmember']; |
|
232 | - $maxAttempts = $this->config['maxattempt']; |
|
233 | - $_SESSION['XoopsCaptcha_maxattempts'] = $maxAttempts; |
|
234 | - /* |
|
16 | + public $active = true; |
|
17 | + public $mode = 'text'; // potential values: image, text |
|
18 | + public $config = []; |
|
19 | + |
|
20 | + public $message = []; // Logging error messages |
|
21 | + |
|
22 | + /** |
|
23 | + * XoopsCaptcha constructor. |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + // Loading default preferences |
|
28 | + $this->config = @include __DIR__ . '/config.php'; |
|
29 | + |
|
30 | + $this->setMode($this->config['mode']); |
|
31 | + } |
|
32 | + |
|
33 | + /** |
|
34 | + * @return XoopsCaptcha |
|
35 | + */ |
|
36 | + public static function getInstance() |
|
37 | + { |
|
38 | + static $instance; |
|
39 | + if (null === $instance) { |
|
40 | + $instance = new static(); |
|
41 | + } |
|
42 | + |
|
43 | + return $instance; |
|
44 | + } |
|
45 | + |
|
46 | + /** |
|
47 | + * @param $name |
|
48 | + * @param $val |
|
49 | + * @return bool |
|
50 | + */ |
|
51 | + public function setConfig($name, $val) |
|
52 | + { |
|
53 | + if ('mode' === $name) { |
|
54 | + $this->setMode($val); |
|
55 | + } elseif (isset($this->$name)) { |
|
56 | + $this->$name = $val; |
|
57 | + } else { |
|
58 | + $this->config[$name] = $val; |
|
59 | + } |
|
60 | + |
|
61 | + return true; |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * Set CAPTCHA mode |
|
66 | + * |
|
67 | + * For future possible modes, right now force to use text or image |
|
68 | + * |
|
69 | + * @param string $mode if no mode is set, just verify current mode |
|
70 | + */ |
|
71 | + public function setMode($mode = null) |
|
72 | + { |
|
73 | + if (!empty($mode) && in_array($mode, ['text', 'image'])) { |
|
74 | + $this->mode = $mode; |
|
75 | + |
|
76 | + if ('image' !== $this->mode) { |
|
77 | + return; |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + // Disable image mode |
|
82 | + if (!extension_loaded('gd')) { |
|
83 | + $this->mode = 'text'; |
|
84 | + } else { |
|
85 | + $required_functions = [ |
|
86 | + 'imagecreatetruecolor', |
|
87 | + 'imagecolorallocate', |
|
88 | + 'imagefilledrectangle', |
|
89 | + 'imagejpeg', |
|
90 | + 'imagedestroy', |
|
91 | + 'imageftbbox' |
|
92 | + ]; |
|
93 | + foreach ($required_functions as $func) { |
|
94 | + if (!function_exists($func)) { |
|
95 | + $this->mode = 'text'; |
|
96 | + break; |
|
97 | + } |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Initializing the CAPTCHA class |
|
104 | + * @param string $name |
|
105 | + * @param null $skipmember |
|
106 | + * @param null $num_chars |
|
107 | + * @param null $fontsize_min |
|
108 | + * @param null $fontsize_max |
|
109 | + * @param null $background_type |
|
110 | + * @param null $background_num |
|
111 | + */ |
|
112 | + public function init( |
|
113 | + $name = 'xoopscaptcha', |
|
114 | + $skipmember = null, |
|
115 | + $num_chars = null, |
|
116 | + $fontsize_min = null, |
|
117 | + $fontsize_max = null, |
|
118 | + $background_type = null, |
|
119 | + $background_num = null |
|
120 | + ) { |
|
121 | + // Loading RUN-TIME settings |
|
122 | + foreach (array_keys($this->config) as $key) { |
|
123 | + if (isset(${$key}) && null !== ${$key}) { |
|
124 | + $this->config[$key] = ${$key}; |
|
125 | + } |
|
126 | + } |
|
127 | + $this->config['name'] = $name; |
|
128 | + |
|
129 | + // Skip CAPTCHA for member if set |
|
130 | + if ($this->config['skipmember'] && is_object($GLOBALS['xoopsUser'])) { |
|
131 | + $this->active = false; |
|
132 | + } |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * Verify user submission |
|
137 | + * @param null $skipMember |
|
138 | + * @return bool |
|
139 | + */ |
|
140 | + public function verify($skipMember = null) |
|
141 | + { |
|
142 | + $sessionName = @$_SESSION['XoopsCaptcha_name']; |
|
143 | + $skipMember = (null === $skipMember) ? @$_SESSION['XoopsCaptcha_skipmember'] : $skipMember; |
|
144 | + $maxAttempts = (int)(@$_SESSION['XoopsCaptcha_maxattempts']); |
|
145 | + |
|
146 | + $is_valid = false; |
|
147 | + |
|
148 | + // Skip CAPTCHA for member if set |
|
149 | + if (is_object($GLOBALS['xoopsUser']) && !empty($skipMember)) { |
|
150 | + $is_valid = true; |
|
151 | + // Kill too many attempts |
|
152 | + } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_' . $sessionName] > $maxAttempts) { |
|
153 | + $this->message[] = XOOPS_CAPTCHA_TOOMANYATTEMPTS; |
|
154 | + |
|
155 | + // Verify the code |
|
156 | + } elseif (!empty($_SESSION['XoopsCaptcha_sessioncode'])) { |
|
157 | + $func = $this->config['casesensitive'] ? 'strcmp' : 'strcasecmp'; |
|
158 | + $is_valid = !$func(trim(@$_POST[$sessionName]), $_SESSION['XoopsCaptcha_sessioncode']); |
|
159 | + } |
|
160 | + |
|
161 | + if (!empty($maxAttempts)) { |
|
162 | + if (!$is_valid) { |
|
163 | + // Increase the attempt records on failure |
|
164 | + $_SESSION['XoopsCaptcha_attempt_' . $sessionName]++; |
|
165 | + // Log the error message |
|
166 | + $this->message[] = XOOPS_CAPTCHA_INVALID_CODE; |
|
167 | + } else { |
|
168 | + |
|
169 | + // reset attempt records on success |
|
170 | + $_SESSION['XoopsCaptcha_attempt_' . $sessionName] = null; |
|
171 | + } |
|
172 | + } |
|
173 | + $this->destroyGarbage(true); |
|
174 | + |
|
175 | + return $is_valid; |
|
176 | + } |
|
177 | + |
|
178 | + /** |
|
179 | + * @return mixed|string |
|
180 | + */ |
|
181 | + public function getCaption() |
|
182 | + { |
|
183 | + return defined('XOOPS_CAPTCHA_CAPTION') ? constant('XOOPS_CAPTCHA_CAPTION') : ''; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * @return string |
|
188 | + */ |
|
189 | + public function getMessage() |
|
190 | + { |
|
191 | + return implode('<br>', $this->message); |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Destory historical stuff |
|
196 | + * @param bool $clearSession |
|
197 | + * @return bool |
|
198 | + */ |
|
199 | + public function destroyGarbage($clearSession = false) |
|
200 | + { |
|
201 | + require_once __DIR__ . '/' . $this->mode . '.php'; |
|
202 | + $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
203 | + $captchaHandler = new $class(); |
|
204 | + if (method_exists($captchaHandler, 'destroyGarbage')) { |
|
205 | + $captchaHandler->loadConfig($this->config); |
|
206 | + $captchaHandler->destroyGarbage(); |
|
207 | + } |
|
208 | + |
|
209 | + if ($clearSession) { |
|
210 | + $_SESSION['XoopsCaptcha_name'] = null; |
|
211 | + $_SESSION['XoopsCaptcha_skipmember'] = null; |
|
212 | + $_SESSION['XoopsCaptcha_sessioncode'] = null; |
|
213 | + $_SESSION['XoopsCaptcha_maxattempts'] = null; |
|
214 | + } |
|
215 | + |
|
216 | + return true; |
|
217 | + } |
|
218 | + |
|
219 | + /** |
|
220 | + * @return mixed|string |
|
221 | + */ |
|
222 | + public function render() |
|
223 | + { |
|
224 | + $form = ''; |
|
225 | + |
|
226 | + if (!$this->active || empty($this->config['name'])) { |
|
227 | + return $form; |
|
228 | + } |
|
229 | + |
|
230 | + $_SESSION['XoopsCaptcha_name'] = $this->config['name']; |
|
231 | + $_SESSION['XoopsCaptcha_skipmember'] = $this->config['skipmember']; |
|
232 | + $maxAttempts = $this->config['maxattempt']; |
|
233 | + $_SESSION['XoopsCaptcha_maxattempts'] = $maxAttempts; |
|
234 | + /* |
|
235 | 235 | if (!empty($maxAttempts)) { |
236 | 236 | $_SESSION['XoopsCaptcha_maxattempts_'.$_SESSION['XoopsCaptcha_name']] = $maxAttempts; |
237 | 237 | } |
238 | 238 | */ |
239 | 239 | |
240 | - // Fail on too many attempts |
|
241 | - if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_' . $this->config['name']] > $maxAttempts) { |
|
242 | - $form = XOOPS_CAPTCHA_TOOMANYATTEMPTS; |
|
243 | - // Load the form element |
|
244 | - } else { |
|
245 | - $form = $this->loadForm(); |
|
246 | - } |
|
247 | - |
|
248 | - return $form; |
|
249 | - } |
|
250 | - |
|
251 | - /** |
|
252 | - * @return mixed |
|
253 | - */ |
|
254 | - public function loadForm() |
|
255 | - { |
|
256 | - require_once __DIR__ . '/' . $this->mode . '.php'; |
|
257 | - $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
258 | - $captchaHandler = new $class(); |
|
259 | - $captchaHandler->loadConfig($this->config); |
|
260 | - |
|
261 | - $form = $captchaHandler->render(); |
|
262 | - |
|
263 | - return $form; |
|
264 | - } |
|
240 | + // Fail on too many attempts |
|
241 | + if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_' . $this->config['name']] > $maxAttempts) { |
|
242 | + $form = XOOPS_CAPTCHA_TOOMANYATTEMPTS; |
|
243 | + // Load the form element |
|
244 | + } else { |
|
245 | + $form = $this->loadForm(); |
|
246 | + } |
|
247 | + |
|
248 | + return $form; |
|
249 | + } |
|
250 | + |
|
251 | + /** |
|
252 | + * @return mixed |
|
253 | + */ |
|
254 | + public function loadForm() |
|
255 | + { |
|
256 | + require_once __DIR__ . '/' . $this->mode . '.php'; |
|
257 | + $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
258 | + $captchaHandler = new $class(); |
|
259 | + $captchaHandler->loadConfig($this->config); |
|
260 | + |
|
261 | + $form = $captchaHandler->render(); |
|
262 | + |
|
263 | + return $form; |
|
264 | + } |
|
265 | 265 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | class XoopsCaptcha |
15 | 15 | { |
16 | 16 | public $active = true; |
17 | - public $mode = 'text'; // potential values: image, text |
|
17 | + public $mode = 'text'; // potential values: image, text |
|
18 | 18 | public $config = []; |
19 | 19 | |
20 | 20 | public $message = []; // Logging error messages |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public function __construct() |
26 | 26 | { |
27 | 27 | // Loading default preferences |
28 | - $this->config = @include __DIR__ . '/config.php'; |
|
28 | + $this->config = @include __DIR__.'/config.php'; |
|
29 | 29 | |
30 | 30 | $this->setMode($this->config['mode']); |
31 | 31 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | { |
142 | 142 | $sessionName = @$_SESSION['XoopsCaptcha_name']; |
143 | 143 | $skipMember = (null === $skipMember) ? @$_SESSION['XoopsCaptcha_skipmember'] : $skipMember; |
144 | - $maxAttempts = (int)(@$_SESSION['XoopsCaptcha_maxattempts']); |
|
144 | + $maxAttempts = (int) (@$_SESSION['XoopsCaptcha_maxattempts']); |
|
145 | 145 | |
146 | 146 | $is_valid = false; |
147 | 147 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | if (is_object($GLOBALS['xoopsUser']) && !empty($skipMember)) { |
150 | 150 | $is_valid = true; |
151 | 151 | // Kill too many attempts |
152 | - } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_' . $sessionName] > $maxAttempts) { |
|
152 | + } elseif (!empty($maxAttempts) && $_SESSION['XoopsCaptcha_attempt_'.$sessionName] > $maxAttempts) { |
|
153 | 153 | $this->message[] = XOOPS_CAPTCHA_TOOMANYATTEMPTS; |
154 | 154 | |
155 | 155 | // Verify the code |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | if (!empty($maxAttempts)) { |
162 | 162 | if (!$is_valid) { |
163 | 163 | // Increase the attempt records on failure |
164 | - $_SESSION['XoopsCaptcha_attempt_' . $sessionName]++; |
|
164 | + $_SESSION['XoopsCaptcha_attempt_'.$sessionName]++; |
|
165 | 165 | // Log the error message |
166 | 166 | $this->message[] = XOOPS_CAPTCHA_INVALID_CODE; |
167 | 167 | } else { |
168 | 168 | |
169 | 169 | // reset attempt records on success |
170 | - $_SESSION['XoopsCaptcha_attempt_' . $sessionName] = null; |
|
170 | + $_SESSION['XoopsCaptcha_attempt_'.$sessionName] = null; |
|
171 | 171 | } |
172 | 172 | } |
173 | 173 | $this->destroyGarbage(true); |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function destroyGarbage($clearSession = false) |
200 | 200 | { |
201 | - require_once __DIR__ . '/' . $this->mode . '.php'; |
|
202 | - $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
201 | + require_once __DIR__.'/'.$this->mode.'.php'; |
|
202 | + $class = 'XoopsCaptcha'.ucfirst($this->mode); |
|
203 | 203 | $captchaHandler = new $class(); |
204 | 204 | if (method_exists($captchaHandler, 'destroyGarbage')) { |
205 | 205 | $captchaHandler->loadConfig($this->config); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | |
240 | 240 | // Fail on too many attempts |
241 | - if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_' . $this->config['name']] > $maxAttempts) { |
|
241 | + if (!empty($maxAttempts) && @$_SESSION['XoopsCaptcha_attempt_'.$this->config['name']] > $maxAttempts) { |
|
242 | 242 | $form = XOOPS_CAPTCHA_TOOMANYATTEMPTS; |
243 | 243 | // Load the form element |
244 | 244 | } else { |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function loadForm() |
255 | 255 | { |
256 | - require_once __DIR__ . '/' . $this->mode . '.php'; |
|
257 | - $class = 'XoopsCaptcha' . ucfirst($this->mode); |
|
256 | + require_once __DIR__.'/'.$this->mode.'.php'; |
|
257 | + $class = 'XoopsCaptcha'.ucfirst($this->mode); |
|
258 | 258 | $captchaHandler = new $class(); |
259 | 259 | $captchaHandler->loadConfig($this->config); |
260 | 260 |
@@ -38,60 +38,60 @@ |
||
38 | 38 | */ |
39 | 39 | class XoopsFormCaptcha extends \XoopsFormElement |
40 | 40 | { |
41 | - public $_captchaHandler; |
|
41 | + public $_captchaHandler; |
|
42 | 42 | |
43 | - /** |
|
44 | - * @param string $caption Caption of the form element, default value is defined in captcha/language/ |
|
45 | - * @param string $name Name for the input box |
|
46 | - * @param boolean $skipmember Skip CAPTCHA check for members |
|
47 | - * @param int $numchar Number of characters in image mode, and input box size for text mode |
|
48 | - * @param int $minfontsize Minimum font-size of characters in image mode |
|
49 | - * @param int $maxfontsize Maximum font-size of characters in image mode |
|
50 | - * @param int $backgroundtype Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files |
|
51 | - * @param int $backgroundnum Number of background images in image mode |
|
52 | - * |
|
53 | - */ |
|
54 | - public function __construct( |
|
55 | - $caption = '', |
|
56 | - $name = 'xoopscaptcha', |
|
57 | - $skipmember = null, |
|
58 | - $numchar = null, |
|
59 | - $minfontsize = null, |
|
60 | - $maxfontsize = null, |
|
61 | - $backgroundtype = null, |
|
62 | - $backgroundnum = null |
|
63 | - ) { |
|
64 | - if (!class_exists('XoopsCaptcaha')) { |
|
65 | - require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php'; |
|
66 | - } |
|
43 | + /** |
|
44 | + * @param string $caption Caption of the form element, default value is defined in captcha/language/ |
|
45 | + * @param string $name Name for the input box |
|
46 | + * @param boolean $skipmember Skip CAPTCHA check for members |
|
47 | + * @param int $numchar Number of characters in image mode, and input box size for text mode |
|
48 | + * @param int $minfontsize Minimum font-size of characters in image mode |
|
49 | + * @param int $maxfontsize Maximum font-size of characters in image mode |
|
50 | + * @param int $backgroundtype Background type in image mode: 0 - bar; 1 - circle; 2 - line; 3 - rectangle; 4 - ellipse; 5 - polygon; 100 - generated from files |
|
51 | + * @param int $backgroundnum Number of background images in image mode |
|
52 | + * |
|
53 | + */ |
|
54 | + public function __construct( |
|
55 | + $caption = '', |
|
56 | + $name = 'xoopscaptcha', |
|
57 | + $skipmember = null, |
|
58 | + $numchar = null, |
|
59 | + $minfontsize = null, |
|
60 | + $maxfontsize = null, |
|
61 | + $backgroundtype = null, |
|
62 | + $backgroundnum = null |
|
63 | + ) { |
|
64 | + if (!class_exists('XoopsCaptcaha')) { |
|
65 | + require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php'; |
|
66 | + } |
|
67 | 67 | |
68 | - $this->_captchaHandler = XoopsCaptcha::getInstance(); |
|
69 | - $this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum); |
|
70 | - if (!$this->_captchaHandler->active) { |
|
71 | - $this->setHidden(); |
|
72 | - } else { |
|
73 | - $caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption(); |
|
74 | - $this->setCaption($caption); |
|
75 | - } |
|
76 | - } |
|
68 | + $this->_captchaHandler = XoopsCaptcha::getInstance(); |
|
69 | + $this->_captchaHandler->init($name, $skipmember, $numchar, $minfontsize, $maxfontsize, $backgroundtype, $backgroundnum); |
|
70 | + if (!$this->_captchaHandler->active) { |
|
71 | + $this->setHidden(); |
|
72 | + } else { |
|
73 | + $caption = !empty($caption) ? $caption : $this->_captchaHandler->getCaption(); |
|
74 | + $this->setCaption($caption); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | - /** |
|
79 | - * @param $name |
|
80 | - * @param $val |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function setConfig($name, $val) |
|
84 | - { |
|
85 | - return $this->_captchaHandler->setConfig($name, $val); |
|
86 | - } |
|
78 | + /** |
|
79 | + * @param $name |
|
80 | + * @param $val |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function setConfig($name, $val) |
|
84 | + { |
|
85 | + return $this->_captchaHandler->setConfig($name, $val); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * @return mixed|string |
|
90 | - */ |
|
91 | - public function render() |
|
92 | - { |
|
93 | - if (!$this->isHidden()) { |
|
94 | - return $this->_captchaHandler->render(); |
|
95 | - } |
|
96 | - } |
|
88 | + /** |
|
89 | + * @return mixed|string |
|
90 | + */ |
|
91 | + public function render() |
|
92 | + { |
|
93 | + if (!$this->isHidden()) { |
|
94 | + return $this->_captchaHandler->render(); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | // defined('XOOPS_ROOT_PATH') || die('Restricted access'); |
15 | 15 | |
16 | -require_once XOOPS_ROOT_PATH . '/class/xoopsform/formelement.php'; |
|
16 | +require_once XOOPS_ROOT_PATH.'/class/xoopsform/formelement.php'; |
|
17 | 17 | |
18 | 18 | /* |
19 | 19 | * Usage |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $backgroundnum = null |
63 | 63 | ) { |
64 | 64 | if (!class_exists('XoopsCaptcaha')) { |
65 | - require_once SMARTOBJECT_ROOT_PATH . '/include/captcha/captcha.php'; |
|
65 | + require_once SMARTOBJECT_ROOT_PATH.'/include/captcha/captcha.php'; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | $this->_captchaHandler = XoopsCaptcha::getInstance(); |
@@ -19,62 +19,62 @@ |
||
19 | 19 | |
20 | 20 | function getConfig() |
21 | 21 | { |
22 | - $moduleDirName = basename(dirname(__DIR__)); |
|
23 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
24 | - return (object)[ |
|
25 | - 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
26 | - 'paths' => [ |
|
27 | - 'dirname' => $moduleDirName, |
|
28 | - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
29 | - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
30 | - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
31 | - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
32 | - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
33 | - ], |
|
34 | - 'uploadFolders' => [ |
|
35 | - constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
36 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', |
|
37 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', |
|
38 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
39 | - ], |
|
40 | - 'copyBlankFiles' => [ |
|
41 | - constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
42 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', |
|
43 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', |
|
44 | - //XOOPS_UPLOAD_PATH . '/flags' |
|
45 | - ], |
|
22 | + $moduleDirName = basename(dirname(__DIR__)); |
|
23 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
24 | + return (object)[ |
|
25 | + 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
26 | + 'paths' => [ |
|
27 | + 'dirname' => $moduleDirName, |
|
28 | + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
29 | + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
30 | + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
31 | + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
32 | + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
33 | + ], |
|
34 | + 'uploadFolders' => [ |
|
35 | + constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
36 | + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', |
|
37 | + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', |
|
38 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
39 | + ], |
|
40 | + 'copyBlankFiles' => [ |
|
41 | + constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
42 | + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', |
|
43 | + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', |
|
44 | + //XOOPS_UPLOAD_PATH . '/flags' |
|
45 | + ], |
|
46 | 46 | |
47 | - 'copyTestFolders' => [ |
|
48 | - // constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
49 | - //[ |
|
50 | - // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', |
|
51 | - // constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images', |
|
52 | - //] |
|
53 | - ], |
|
47 | + 'copyTestFolders' => [ |
|
48 | + // constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
49 | + //[ |
|
50 | + // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', |
|
51 | + // constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images', |
|
52 | + //] |
|
53 | + ], |
|
54 | 54 | |
55 | - 'templateFolders' => [ |
|
56 | - '/templates/', |
|
57 | - '/templates/blocks/', |
|
58 | - '/templates/admin/' |
|
55 | + 'templateFolders' => [ |
|
56 | + '/templates/', |
|
57 | + '/templates/blocks/', |
|
58 | + '/templates/admin/' |
|
59 | 59 | |
60 | - ], |
|
61 | - 'oldFiles' => [ |
|
62 | - '/class/request.php', |
|
63 | - '/class/registry.php', |
|
64 | - '/class/utilities.php', |
|
65 | - '/class/util.php', |
|
66 | - '/include/constants.php', |
|
67 | - '/include/functions.php', |
|
68 | - '/ajaxrating.txt', |
|
69 | - ], |
|
70 | - 'oldFolders' => [ |
|
71 | - '/images', |
|
72 | - '/css', |
|
73 | - '/js', |
|
74 | - '/tcpdf', |
|
75 | - '/images', |
|
76 | - ], |
|
77 | - 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
60 | + ], |
|
61 | + 'oldFiles' => [ |
|
62 | + '/class/request.php', |
|
63 | + '/class/registry.php', |
|
64 | + '/class/utilities.php', |
|
65 | + '/class/util.php', |
|
66 | + '/include/constants.php', |
|
67 | + '/include/functions.php', |
|
68 | + '/ajaxrating.txt', |
|
69 | + ], |
|
70 | + 'oldFolders' => [ |
|
71 | + '/images', |
|
72 | + '/css', |
|
73 | + '/js', |
|
74 | + '/tcpdf', |
|
75 | + '/images', |
|
76 | + ], |
|
77 | + 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
|
78 | 78 | <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>', |
79 | - ]; |
|
79 | + ]; |
|
80 | 80 | } |
@@ -21,26 +21,26 @@ discard block |
||
21 | 21 | { |
22 | 22 | $moduleDirName = basename(dirname(__DIR__)); |
23 | 23 | $moduleDirNameUpper = strtoupper($moduleDirName); |
24 | - return (object)[ |
|
25 | - 'name' => strtoupper($moduleDirName) . ' Module Configurator', |
|
24 | + return (object) [ |
|
25 | + 'name' => strtoupper($moduleDirName).' Module Configurator', |
|
26 | 26 | 'paths' => [ |
27 | 27 | 'dirname' => $moduleDirName, |
28 | - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
|
29 | - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
|
30 | - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
|
31 | - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
|
32 | - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
|
28 | + 'admin' => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/admin', |
|
29 | + 'modPath' => XOOPS_ROOT_PATH.'/modules/'.$moduleDirName, |
|
30 | + 'modUrl' => XOOPS_URL.'/modules/'.$moduleDirName, |
|
31 | + 'uploadPath' => XOOPS_UPLOAD_PATH.'/'.$moduleDirName, |
|
32 | + 'uploadUrl' => XOOPS_UPLOAD_URL.'/'.$moduleDirName, |
|
33 | 33 | ], |
34 | 34 | 'uploadFolders' => [ |
35 | - constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
36 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', |
|
37 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', |
|
35 | + constant($moduleDirNameUpper.'_UPLOAD_PATH'), |
|
36 | + constant($moduleDirNameUpper.'_UPLOAD_PATH').'/category', |
|
37 | + constant($moduleDirNameUpper.'_UPLOAD_PATH').'/screenshots', |
|
38 | 38 | //XOOPS_UPLOAD_PATH . '/flags' |
39 | 39 | ], |
40 | 40 | 'copyBlankFiles' => [ |
41 | - constant($moduleDirNameUpper . '_UPLOAD_PATH'), |
|
42 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', |
|
43 | - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', |
|
41 | + constant($moduleDirNameUpper.'_UPLOAD_PATH'), |
|
42 | + constant($moduleDirNameUpper.'_UPLOAD_PATH').'/category', |
|
43 | + constant($moduleDirNameUpper.'_UPLOAD_PATH').'/screenshots', |
|
44 | 44 | //XOOPS_UPLOAD_PATH . '/flags' |
45 | 45 | ], |
46 | 46 | |
@@ -75,6 +75,6 @@ discard block |
||
75 | 75 | '/images', |
76 | 76 | ], |
77 | 77 | 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
78 | - <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>', |
|
78 | + <img src='" . constant($moduleDirNameUpper.'_AUTHOR_LOGOIMG').'\' alt=\'XOOPS Project\' /></a>', |
|
79 | 79 | ]; |
80 | 80 | } |
@@ -8,7 +8,6 @@ |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | use XoopsModules\Wfdownloads; |
11 | -use XoopsModules\Smartobject; |
|
12 | 11 | |
13 | 12 | require_once __DIR__ . '/admin_header.php'; |
14 | 13 | require_once SMARTCONTENT_ROOT_PATH . 'class/dbupdater.php'; |
@@ -21,188 +21,188 @@ discard block |
||
21 | 21 | // ========================================================================================= |
22 | 22 | function update_tables_to_300() |
23 | 23 | { |
24 | - $dbupdater = new Wfdownloads\Dbupdater(); |
|
24 | + $dbupdater = new Wfdownloads\Dbupdater(); |
|
25 | 25 | |
26 | - if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
27 | - // Create table wfdownloads_meta |
|
28 | - $table = new Wfdownloads\DbupdaterTable('wfdownloads_meta'); |
|
29 | - $table->setStructure("CREATE TABLE `%s` ( |
|
26 | + if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
27 | + // Create table wfdownloads_meta |
|
28 | + $table = new Wfdownloads\DbupdaterTable('wfdownloads_meta'); |
|
29 | + $table->setStructure("CREATE TABLE `%s` ( |
|
30 | 30 | metakey varchar(50) NOT NULL default '', |
31 | 31 | metavalue varchar(255) NOT NULL default '', |
32 | 32 | PRIMARY KEY (metakey)) |
33 | 33 | ENGINE=MyISAM;"); |
34 | 34 | |
35 | - $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2))); |
|
36 | - if ($dbupdater->updateTable($table)) { |
|
37 | - echo 'wfdownloads_meta table created<br>'; |
|
38 | - } |
|
39 | - } |
|
40 | - |
|
41 | - $download_fields = [ |
|
42 | - 'lid' => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false], |
|
43 | - 'cid' => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true], |
|
44 | - 'title' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
45 | - 'url' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
46 | - 'filename' => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true], |
|
47 | - 'filetype' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
48 | - 'homepage' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
49 | - 'version' => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true], |
|
50 | - 'size' => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true], |
|
51 | - 'platform' => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true], |
|
52 | - 'screenshot' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
53 | - 'submitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
54 | - 'publisher' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
55 | - 'status' => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true], |
|
56 | - 'date' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
57 | - 'hits' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
58 | - 'rating' => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true], |
|
59 | - 'votes' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
60 | - 'comments' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
61 | - 'license' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
62 | - 'mirror' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
63 | - 'price' => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true], |
|
64 | - 'paypalemail' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
65 | - 'features' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
66 | - 'requirements' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
67 | - 'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
68 | - 'forumid' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
69 | - 'limitations' => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true], |
|
70 | - 'dhistory' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
71 | - 'published' => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true], |
|
72 | - 'expired' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
73 | - 'updated' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
74 | - 'offline' => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true], |
|
75 | - 'description' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
76 | - 'ipaddress' => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true], |
|
77 | - 'notifypub' => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true], |
|
78 | - 'summary' => ['Type' => 'text NOT NULL', 'Default' => false] |
|
79 | - ]; |
|
80 | - |
|
81 | - $renamed_fields = [ |
|
82 | - 'logourl' => 'screenshot' |
|
83 | - ]; |
|
84 | - |
|
85 | - echo '<br><b>Checking Download table</b><br>'; |
|
86 | - $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
87 | - $downloadHandler = $helperWfdownloads->getHandler('Download'); |
|
88 | - $download_table = new Wfdownloads\DbupdaterTable('wfdownloads_downloads'); |
|
89 | - $fields = get_table_info($downloadHandler->table, $download_fields); |
|
90 | - // Check for renamed fields |
|
91 | - rename_fields($download_table, $renamed_fields, $fields, $download_fields); |
|
92 | - update_table($download_fields, $fields, $download_table); |
|
93 | - if ($dbupdater->updateTable($download_table)) { |
|
94 | - echo 'Downloads table updated<br>'; |
|
95 | - } |
|
96 | - unset($fields); |
|
97 | - |
|
98 | - $mod_fields = [ |
|
99 | - 'requestid' => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false], |
|
100 | - 'lid' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
101 | - 'cid' => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true], |
|
102 | - 'title' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
103 | - 'url' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
104 | - 'filename' => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true], |
|
105 | - 'filetype' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
106 | - 'homepage' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
107 | - 'version' => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true], |
|
108 | - 'size' => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true], |
|
109 | - 'platform' => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true], |
|
110 | - 'screenshot' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
111 | - 'submitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
112 | - 'publisher' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
113 | - 'status' => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true], |
|
114 | - 'date' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
115 | - 'hits' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
116 | - 'rating' => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true], |
|
117 | - 'votes' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
118 | - 'comments' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
119 | - 'license' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
120 | - 'mirror' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
121 | - 'price' => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true], |
|
122 | - 'paypalemail' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
123 | - 'features' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
124 | - 'requirements' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
125 | - 'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
126 | - 'forumid' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
127 | - 'limitations' => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true], |
|
128 | - 'dhistory' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
129 | - 'published' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
130 | - 'expired' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
131 | - 'updated' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
132 | - 'offline' => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true], |
|
133 | - 'summary' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
134 | - 'description' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
135 | - 'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
136 | - 'requestdate' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true] |
|
137 | - ]; |
|
138 | - |
|
139 | - $renamed_fields = [ |
|
140 | - 'logourl' => 'screenshot' |
|
141 | - ]; |
|
142 | - |
|
143 | - echo '<br><b>Checking Modified Downloads table</b><br>'; |
|
35 | + $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2))); |
|
36 | + if ($dbupdater->updateTable($table)) { |
|
37 | + echo 'wfdownloads_meta table created<br>'; |
|
38 | + } |
|
39 | + } |
|
40 | + |
|
41 | + $download_fields = [ |
|
42 | + 'lid' => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false], |
|
43 | + 'cid' => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true], |
|
44 | + 'title' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
45 | + 'url' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
46 | + 'filename' => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true], |
|
47 | + 'filetype' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
48 | + 'homepage' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
49 | + 'version' => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true], |
|
50 | + 'size' => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true], |
|
51 | + 'platform' => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true], |
|
52 | + 'screenshot' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
53 | + 'submitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
54 | + 'publisher' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
55 | + 'status' => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true], |
|
56 | + 'date' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
57 | + 'hits' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
58 | + 'rating' => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true], |
|
59 | + 'votes' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
60 | + 'comments' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
61 | + 'license' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
62 | + 'mirror' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
63 | + 'price' => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true], |
|
64 | + 'paypalemail' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
65 | + 'features' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
66 | + 'requirements' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
67 | + 'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
68 | + 'forumid' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
69 | + 'limitations' => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true], |
|
70 | + 'dhistory' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
71 | + 'published' => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true], |
|
72 | + 'expired' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
73 | + 'updated' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
74 | + 'offline' => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true], |
|
75 | + 'description' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
76 | + 'ipaddress' => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true], |
|
77 | + 'notifypub' => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true], |
|
78 | + 'summary' => ['Type' => 'text NOT NULL', 'Default' => false] |
|
79 | + ]; |
|
80 | + |
|
81 | + $renamed_fields = [ |
|
82 | + 'logourl' => 'screenshot' |
|
83 | + ]; |
|
84 | + |
|
85 | + echo '<br><b>Checking Download table</b><br>'; |
|
86 | + $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
87 | + $downloadHandler = $helperWfdownloads->getHandler('Download'); |
|
88 | + $download_table = new Wfdownloads\DbupdaterTable('wfdownloads_downloads'); |
|
89 | + $fields = get_table_info($downloadHandler->table, $download_fields); |
|
90 | + // Check for renamed fields |
|
91 | + rename_fields($download_table, $renamed_fields, $fields, $download_fields); |
|
92 | + update_table($download_fields, $fields, $download_table); |
|
93 | + if ($dbupdater->updateTable($download_table)) { |
|
94 | + echo 'Downloads table updated<br>'; |
|
95 | + } |
|
96 | + unset($fields); |
|
97 | + |
|
98 | + $mod_fields = [ |
|
99 | + 'requestid' => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false], |
|
100 | + 'lid' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
101 | + 'cid' => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true], |
|
102 | + 'title' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
103 | + 'url' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
104 | + 'filename' => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true], |
|
105 | + 'filetype' => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true], |
|
106 | + 'homepage' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
107 | + 'version' => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true], |
|
108 | + 'size' => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true], |
|
109 | + 'platform' => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true], |
|
110 | + 'screenshot' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
111 | + 'submitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
112 | + 'publisher' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
113 | + 'status' => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true], |
|
114 | + 'date' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
115 | + 'hits' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
116 | + 'rating' => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true], |
|
117 | + 'votes' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
118 | + 'comments' => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true], |
|
119 | + 'license' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
120 | + 'mirror' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
121 | + 'price' => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true], |
|
122 | + 'paypalemail' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
123 | + 'features' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
124 | + 'requirements' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
125 | + 'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
126 | + 'forumid' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
127 | + 'limitations' => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true], |
|
128 | + 'dhistory' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
129 | + 'published' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
130 | + 'expired' => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true], |
|
131 | + 'updated' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
132 | + 'offline' => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true], |
|
133 | + 'summary' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
134 | + 'description' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
135 | + 'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
136 | + 'requestdate' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true] |
|
137 | + ]; |
|
138 | + |
|
139 | + $renamed_fields = [ |
|
140 | + 'logourl' => 'screenshot' |
|
141 | + ]; |
|
142 | + |
|
143 | + echo '<br><b>Checking Modified Downloads table</b><br>'; |
|
144 | 144 | // $moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads'); |
145 | - $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
146 | - $moduleHandler = $helperWfdownloads->getHandler('Modification'); |
|
147 | - $mod_table = new Wfdownloads\DbupdaterTable('wfdownloads_mod'); |
|
148 | - $fields = get_table_info($moduleHandler->table, $mod_fields); |
|
149 | - rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); |
|
150 | - update_table($mod_fields, $fields, $mod_table); |
|
151 | - if ($dbupdater->updateTable($mod_table)) { |
|
152 | - echo 'Modified Downloads table updated <br>'; |
|
153 | - } |
|
154 | - unset($fields); |
|
155 | - |
|
156 | - $cat_fields = [ |
|
157 | - 'cid' => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false], |
|
158 | - 'pid' => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true], |
|
159 | - 'title' => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true], |
|
160 | - 'imgurl' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
161 | - 'description' => ['Type' => 'text NULL', 'Default' => true], |
|
162 | - 'total' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
163 | - 'summary' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
164 | - 'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
165 | - 'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
166 | - 'dohtml' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
167 | - 'dosmiley' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
168 | - 'doxcode' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
169 | - 'doimage' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
170 | - 'dobr' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
171 | - 'weight' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true] |
|
172 | - ]; |
|
173 | - echo '<br><b>Checking Category table</b><br>'; |
|
145 | + $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
146 | + $moduleHandler = $helperWfdownloads->getHandler('Modification'); |
|
147 | + $mod_table = new Wfdownloads\DbupdaterTable('wfdownloads_mod'); |
|
148 | + $fields = get_table_info($moduleHandler->table, $mod_fields); |
|
149 | + rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); |
|
150 | + update_table($mod_fields, $fields, $mod_table); |
|
151 | + if ($dbupdater->updateTable($mod_table)) { |
|
152 | + echo 'Modified Downloads table updated <br>'; |
|
153 | + } |
|
154 | + unset($fields); |
|
155 | + |
|
156 | + $cat_fields = [ |
|
157 | + 'cid' => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false], |
|
158 | + 'pid' => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true], |
|
159 | + 'title' => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true], |
|
160 | + 'imgurl' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true], |
|
161 | + 'description' => ['Type' => 'text NULL', 'Default' => true], |
|
162 | + 'total' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
163 | + 'summary' => ['Type' => 'text NOT NULL', 'Default' => false], |
|
164 | + 'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
165 | + 'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
166 | + 'dohtml' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
167 | + 'dosmiley' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
168 | + 'doxcode' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
169 | + 'doimage' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
170 | + 'dobr' => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true], |
|
171 | + 'weight' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true] |
|
172 | + ]; |
|
173 | + echo '<br><b>Checking Category table</b><br>'; |
|
174 | 174 | // $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
175 | - $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
176 | - $catHandler = $helperWfdownloads->getHandler('Report'); |
|
177 | - |
|
178 | - $cat_table = new Wfdownloads\DbupdaterTable('wfdownloads_cat'); |
|
179 | - $fields = get_table_info($catHandler->table, $cat_fields); |
|
180 | - update_table($cat_fields, $fields, $cat_table); |
|
181 | - if ($dbupdater->updateTable($cat_table)) { |
|
182 | - echo 'Category table updated<br>'; |
|
183 | - } |
|
184 | - unset($fields); |
|
185 | - |
|
186 | - $broken_fields = [ |
|
187 | - 'reportid' => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false], |
|
188 | - 'lid' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
189 | - 'sender' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
190 | - 'ip' => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true], |
|
191 | - 'date' => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true], |
|
192 | - 'confirmed' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true], |
|
193 | - 'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true] |
|
194 | - ]; |
|
195 | - echo '<br><b>Checking Broken Report table</b><br>'; |
|
196 | - $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
197 | - $brokenHandler = $helperWfdownloads->getHandler('Report'); |
|
175 | + $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
176 | + $catHandler = $helperWfdownloads->getHandler('Report'); |
|
177 | + |
|
178 | + $cat_table = new Wfdownloads\DbupdaterTable('wfdownloads_cat'); |
|
179 | + $fields = get_table_info($catHandler->table, $cat_fields); |
|
180 | + update_table($cat_fields, $fields, $cat_table); |
|
181 | + if ($dbupdater->updateTable($cat_table)) { |
|
182 | + echo 'Category table updated<br>'; |
|
183 | + } |
|
184 | + unset($fields); |
|
185 | + |
|
186 | + $broken_fields = [ |
|
187 | + 'reportid' => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false], |
|
188 | + 'lid' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
189 | + 'sender' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true], |
|
190 | + 'ip' => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true], |
|
191 | + 'date' => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true], |
|
192 | + 'confirmed' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true], |
|
193 | + 'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true] |
|
194 | + ]; |
|
195 | + echo '<br><b>Checking Broken Report table</b><br>'; |
|
196 | + $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
197 | + $brokenHandler = $helperWfdownloads->getHandler('Report'); |
|
198 | 198 | // $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads'); |
199 | - $broken_table = new Wfdownloads\DbupdaterTable('wfdownloads_broken'); |
|
200 | - $fields = get_table_info($brokenHandler->table, $broken_fields); |
|
201 | - update_table($broken_fields, $fields, $broken_table); |
|
202 | - if ($dbupdater->updateTable($broken_table)) { |
|
203 | - echo 'Broken Reports table updated<br>'; |
|
204 | - } |
|
205 | - unset($fields); |
|
199 | + $broken_table = new Wfdownloads\DbupdaterTable('wfdownloads_broken'); |
|
200 | + $fields = get_table_info($brokenHandler->table, $broken_fields); |
|
201 | + update_table($broken_fields, $fields, $broken_table); |
|
202 | + if ($dbupdater->updateTable($broken_table)) { |
|
203 | + echo 'Broken Reports table updated<br>'; |
|
204 | + } |
|
205 | + unset($fields); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // ========================================================================================= |
@@ -215,49 +215,49 @@ discard block |
||
215 | 215 | */ |
216 | 216 | function invert_nohtm_dohtml_values() |
217 | 217 | { |
218 | - $ret = []; |
|
219 | - global $xoopsDB; |
|
220 | - $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
221 | - $catHandler = $helperWfdownloads->getHandler('Category'); |
|
222 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
223 | - while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
|
224 | - $fields[$existing_field['field']] = $existing_field['type']; |
|
225 | - } |
|
226 | - if (in_array('nohtml', array_keys($fields))) { |
|
227 | - $dbupdater = new Wfdownloads\Dbupdater(); |
|
228 | - //Invert column values |
|
229 | - // alter options in wfdownloads_cat |
|
230 | - $table = new Wfdownloads\DbupdaterTable('wfdownloads_cat'); |
|
231 | - $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'"); |
|
232 | - $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'"); |
|
233 | - $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'"); |
|
234 | - $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'"); |
|
235 | - $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'"); |
|
236 | - |
|
237 | - //inverting values no=1 <=> do=0 |
|
238 | - // have to store teporarly as value = 2 to |
|
239 | - // avoid putting everithing to same value |
|
240 | - // if you change 1 to 0, then 0 to one, |
|
241 | - // every value will be 1, follow me? |
|
242 | - $table->addUpdatedWhere('dohtml', 2, '=1'); |
|
243 | - $table->addUpdatedWhere('dohtml', 1, '=0'); |
|
244 | - $table->addUpdatedWhere('dohtml', 0, '=2'); |
|
245 | - |
|
246 | - $table->addUpdatedWhere('dosmiley', 2, '=1'); |
|
247 | - $table->addUpdatedWhere('dosmiley', 1, '=0'); |
|
248 | - $table->addUpdatedWhere('dosmiley', 0, '=2'); |
|
249 | - |
|
250 | - $table->addUpdatedWhere('doxcode', 2, '=1'); |
|
251 | - $table->addUpdatedWhere('doxcode', 1, '=0'); |
|
252 | - $table->addUpdatedWhere('doxcode', 0, '=2'); |
|
253 | - |
|
254 | - $table->addUpdatedWhere('doimage', 2, '=1'); |
|
255 | - $table->addUpdatedWhere('doimage', 1, '=0'); |
|
256 | - $table->addUpdatedWhere('doimage', 0, '=2'); |
|
257 | - $ret = $dbupdater->updateTable($table); |
|
258 | - } |
|
259 | - |
|
260 | - return $ret; |
|
218 | + $ret = []; |
|
219 | + global $xoopsDB; |
|
220 | + $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
|
221 | + $catHandler = $helperWfdownloads->getHandler('Category'); |
|
222 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
223 | + while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
|
224 | + $fields[$existing_field['field']] = $existing_field['type']; |
|
225 | + } |
|
226 | + if (in_array('nohtml', array_keys($fields))) { |
|
227 | + $dbupdater = new Wfdownloads\Dbupdater(); |
|
228 | + //Invert column values |
|
229 | + // alter options in wfdownloads_cat |
|
230 | + $table = new Wfdownloads\DbupdaterTable('wfdownloads_cat'); |
|
231 | + $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'"); |
|
232 | + $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'"); |
|
233 | + $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'"); |
|
234 | + $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'"); |
|
235 | + $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'"); |
|
236 | + |
|
237 | + //inverting values no=1 <=> do=0 |
|
238 | + // have to store teporarly as value = 2 to |
|
239 | + // avoid putting everithing to same value |
|
240 | + // if you change 1 to 0, then 0 to one, |
|
241 | + // every value will be 1, follow me? |
|
242 | + $table->addUpdatedWhere('dohtml', 2, '=1'); |
|
243 | + $table->addUpdatedWhere('dohtml', 1, '=0'); |
|
244 | + $table->addUpdatedWhere('dohtml', 0, '=2'); |
|
245 | + |
|
246 | + $table->addUpdatedWhere('dosmiley', 2, '=1'); |
|
247 | + $table->addUpdatedWhere('dosmiley', 1, '=0'); |
|
248 | + $table->addUpdatedWhere('dosmiley', 0, '=2'); |
|
249 | + |
|
250 | + $table->addUpdatedWhere('doxcode', 2, '=1'); |
|
251 | + $table->addUpdatedWhere('doxcode', 1, '=0'); |
|
252 | + $table->addUpdatedWhere('doxcode', 0, '=2'); |
|
253 | + |
|
254 | + $table->addUpdatedWhere('doimage', 2, '=1'); |
|
255 | + $table->addUpdatedWhere('doimage', 1, '=0'); |
|
256 | + $table->addUpdatedWhere('doimage', 0, '=2'); |
|
257 | + $ret = $dbupdater->updateTable($table); |
|
258 | + } |
|
259 | + |
|
260 | + return $ret; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -270,22 +270,22 @@ discard block |
||
270 | 270 | */ |
271 | 271 | function update_table($new_fields, $existing_fields, &$table) |
272 | 272 | { |
273 | - foreach ($new_fields as $field => $fieldinfo) { |
|
274 | - $type = $fieldinfo['Type']; |
|
275 | - if (!in_array($field, array_keys($existing_fields))) { |
|
276 | - //Add field as it is missing |
|
277 | - $table->addNewField($field, $type); |
|
278 | - //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
|
279 | - //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>"; |
|
280 | - } elseif ($existing_fields[$field] != $type) { |
|
281 | - $table->addAlteredField($field, $field . ' ' . $type); |
|
282 | - // check $fields[$field]['type'] for things like "int(10) unsigned" |
|
283 | - //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
|
284 | - //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>"; |
|
285 | - } else { |
|
286 | - //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>"; |
|
287 | - } |
|
288 | - } |
|
273 | + foreach ($new_fields as $field => $fieldinfo) { |
|
274 | + $type = $fieldinfo['Type']; |
|
275 | + if (!in_array($field, array_keys($existing_fields))) { |
|
276 | + //Add field as it is missing |
|
277 | + $table->addNewField($field, $type); |
|
278 | + //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
|
279 | + //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>"; |
|
280 | + } elseif ($existing_fields[$field] != $type) { |
|
281 | + $table->addAlteredField($field, $field . ' ' . $type); |
|
282 | + // check $fields[$field]['type'] for things like "int(10) unsigned" |
|
283 | + //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
|
284 | + //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>"; |
|
285 | + } else { |
|
286 | + //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>"; |
|
287 | + } |
|
288 | + } |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | /** |
@@ -298,22 +298,22 @@ discard block |
||
298 | 298 | */ |
299 | 299 | function get_table_info($table, $default_fields) |
300 | 300 | { |
301 | - global $xoopsDB; |
|
302 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
303 | - while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
|
304 | - $fields[$existing_field['Field']] = $existing_field['Type']; |
|
305 | - if ('YES' !== $existing_field['Null']) { |
|
306 | - $fields[$existing_field['Field']] .= ' NOT NULL'; |
|
307 | - } |
|
308 | - if ($existing_field['Extra']) { |
|
309 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
310 | - } |
|
311 | - if ($default_fields[$existing_field['Field']]['Default']) { |
|
312 | - $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
313 | - } |
|
314 | - } |
|
315 | - |
|
316 | - return $fields; |
|
301 | + global $xoopsDB; |
|
302 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
303 | + while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
|
304 | + $fields[$existing_field['Field']] = $existing_field['Type']; |
|
305 | + if ('YES' !== $existing_field['Null']) { |
|
306 | + $fields[$existing_field['Field']] .= ' NOT NULL'; |
|
307 | + } |
|
308 | + if ($existing_field['Extra']) { |
|
309 | + $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
310 | + } |
|
311 | + if ($default_fields[$existing_field['Field']]['Default']) { |
|
312 | + $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
313 | + } |
|
314 | + } |
|
315 | + |
|
316 | + return $fields; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
@@ -327,60 +327,60 @@ discard block |
||
327 | 327 | */ |
328 | 328 | function rename_fields(&$table, $renamed_fields, &$fields, $new_fields) |
329 | 329 | { |
330 | - foreach (array_keys($fields) as $field) { |
|
331 | - if (in_array($field, array_keys($renamed_fields))) { |
|
332 | - $new_field_name = $renamed_fields[$field]; |
|
333 | - $new_field_type = $new_fields[$new_field_name]['Type']; |
|
334 | - $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
335 | - //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
|
336 | - //echo $field." Renamed to ".$new_field_name."<br>"; |
|
337 | - $fields[$new_field_name] = $new_field_type; |
|
338 | - } |
|
339 | - } |
|
340 | - //return $fields; |
|
330 | + foreach (array_keys($fields) as $field) { |
|
331 | + if (in_array($field, array_keys($renamed_fields))) { |
|
332 | + $new_field_name = $renamed_fields[$field]; |
|
333 | + $new_field_type = $new_fields[$new_field_name]['Type']; |
|
334 | + $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
335 | + //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
|
336 | + //echo $field." Renamed to ".$new_field_name."<br>"; |
|
337 | + $fields[$new_field_name] = $new_field_type; |
|
338 | + } |
|
339 | + } |
|
340 | + //return $fields; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | $op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0; |
344 | 344 | switch ($op) { |
345 | - case 1: |
|
346 | - // Make sure that nohtml is properly changed to dohtml |
|
347 | - invert_nohtm_dohtml_values(); |
|
348 | - // Ensure that the proper tables are present |
|
349 | - update_tables_to_300(); |
|
350 | - // Import data from MyDownloads |
|
351 | - import_mydownloads_to_wfdownloads(); |
|
352 | - break; |
|
353 | - |
|
354 | - case 2: |
|
355 | - // Update WF-Downloads |
|
356 | - $log = invert_nohtm_dohtml_values(); |
|
357 | - update_tables_to_300(); |
|
358 | - break; |
|
359 | - |
|
360 | - default: |
|
361 | - //ask what to do |
|
362 | - include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
363 | - $form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
|
364 | - |
|
365 | - //Is MyDownloads installed? |
|
366 | - /** @var XoopsModuleHandler $moduleHandler */ |
|
367 | - $moduleHandler = xoops_getHandler('module'); |
|
368 | - $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
|
369 | - if (is_object($mydownloadsModule)) { |
|
370 | - $mydownloadsButton = new \XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
|
371 | - $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'"); |
|
372 | - $form->addElement($mydownloadsButton); |
|
373 | - } |
|
374 | - |
|
375 | - if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
376 | - $updateButton = new \XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit'); |
|
377 | - $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'"); |
|
378 | - $form->addElement($updateButton); |
|
379 | - } |
|
380 | - |
|
381 | - $form->addElement(new \XoopsFormHidden('op', 0)); |
|
382 | - $form->display(); |
|
383 | - break; |
|
345 | + case 1: |
|
346 | + // Make sure that nohtml is properly changed to dohtml |
|
347 | + invert_nohtm_dohtml_values(); |
|
348 | + // Ensure that the proper tables are present |
|
349 | + update_tables_to_300(); |
|
350 | + // Import data from MyDownloads |
|
351 | + import_mydownloads_to_wfdownloads(); |
|
352 | + break; |
|
353 | + |
|
354 | + case 2: |
|
355 | + // Update WF-Downloads |
|
356 | + $log = invert_nohtm_dohtml_values(); |
|
357 | + update_tables_to_300(); |
|
358 | + break; |
|
359 | + |
|
360 | + default: |
|
361 | + //ask what to do |
|
362 | + include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
363 | + $form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
|
364 | + |
|
365 | + //Is MyDownloads installed? |
|
366 | + /** @var XoopsModuleHandler $moduleHandler */ |
|
367 | + $moduleHandler = xoops_getHandler('module'); |
|
368 | + $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
|
369 | + if (is_object($mydownloadsModule)) { |
|
370 | + $mydownloadsButton = new \XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
|
371 | + $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'"); |
|
372 | + $form->addElement($mydownloadsButton); |
|
373 | + } |
|
374 | + |
|
375 | + if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
376 | + $updateButton = new \XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit'); |
|
377 | + $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'"); |
|
378 | + $form->addElement($updateButton); |
|
379 | + } |
|
380 | + |
|
381 | + $form->addElement(new \XoopsFormHidden('op', 0)); |
|
382 | + $form->display(); |
|
383 | + break; |
|
384 | 384 | } |
385 | 385 | //wfdownloads_modFooter(); |
386 | 386 | //xoops_cp_footer(); |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | use XoopsModules\Wfdownloads; |
11 | 11 | use XoopsModules\Smartobject; |
12 | 12 | |
13 | -require_once __DIR__ . '/admin_header.php'; |
|
14 | -require_once SMARTCONTENT_ROOT_PATH . 'class/dbupdater.php'; |
|
13 | +require_once __DIR__.'/admin_header.php'; |
|
14 | +require_once SMARTCONTENT_ROOT_PATH.'class/dbupdater.php'; |
|
15 | 15 | |
16 | 16 | smartcontent_xoops_cp_header(); |
17 | 17 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | global $xoopsDB; |
220 | 220 | $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads'); |
221 | 221 | $catHandler = $helperWfdownloads->getHandler('Category'); |
222 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
222 | + $result = $xoopsDB->query('SHOW COLUMNS FROM '.$catHandler->table); |
|
223 | 223 | while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
224 | 224 | $fields[$existing_field['field']] = $existing_field['type']; |
225 | 225 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
279 | 279 | //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>"; |
280 | 280 | } elseif ($existing_fields[$field] != $type) { |
281 | - $table->addAlteredField($field, $field . ' ' . $type); |
|
281 | + $table->addAlteredField($field, $field.' '.$type); |
|
282 | 282 | // check $fields[$field]['type'] for things like "int(10) unsigned" |
283 | 283 | //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
284 | 284 | //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>"; |
@@ -299,17 +299,17 @@ discard block |
||
299 | 299 | function get_table_info($table, $default_fields) |
300 | 300 | { |
301 | 301 | global $xoopsDB; |
302 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
302 | + $result = $xoopsDB->query('SHOW COLUMNS FROM '.$table); |
|
303 | 303 | while (false !== ($existing_field = $xoopsDB->fetchArray($result))) { |
304 | 304 | $fields[$existing_field['Field']] = $existing_field['Type']; |
305 | 305 | if ('YES' !== $existing_field['Null']) { |
306 | 306 | $fields[$existing_field['Field']] .= ' NOT NULL'; |
307 | 307 | } |
308 | 308 | if ($existing_field['Extra']) { |
309 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
309 | + $fields[$existing_field['Field']] .= ' '.$existing_field['Extra']; |
|
310 | 310 | } |
311 | 311 | if ($default_fields[$existing_field['Field']]['Default']) { |
312 | - $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
312 | + $fields[$existing_field['Field']] .= " default '".$existing_field['Default']."'"; |
|
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | if (in_array($field, array_keys($renamed_fields))) { |
332 | 332 | $new_field_name = $renamed_fields[$field]; |
333 | 333 | $new_field_type = $new_fields[$new_field_name]['Type']; |
334 | - $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
334 | + $table->addAltered($field, $new_field_name.' '.$new_field_type); |
|
335 | 335 | //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
336 | 336 | //echo $field." Renamed to ".$new_field_name."<br>"; |
337 | 337 | $fields[$new_field_name] = $new_field_type; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | //return $fields; |
341 | 341 | } |
342 | 342 | |
343 | -$op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0; |
|
343 | +$op = isset($_REQUEST['op']) ? (int) $_REQUEST['op'] : 0; |
|
344 | 344 | switch ($op) { |
345 | 345 | case 1: |
346 | 346 | // Make sure that nohtml is properly changed to dohtml |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | default: |
361 | 361 | //ask what to do |
362 | - include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
362 | + include XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
363 | 363 | $form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
364 | 364 | |
365 | 365 | //Is MyDownloads installed? |
@@ -384,4 +384,4 @@ discard block |
||
384 | 384 | } |
385 | 385 | //wfdownloads_modFooter(); |
386 | 386 | //xoops_cp_footer(); |
387 | -require_once __DIR__ . '/admin_footer.php'; |
|
387 | +require_once __DIR__.'/admin_footer.php'; |