Passed
Push — master ( 4eb8b5...c6e41d )
by Michael
07:19 queued 04:35
created
include/ratings_linear.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -47,22 +47,22 @@  discard block
 block discarded – undo
47 47
  */
48 48
 function chess_ratings_adj_linear($white_rating, $white_games, $black_rating, $black_games, $pgn_result)
49 49
 {
50
-    // compute score: +1 for win, 0 for draw, -1 for loss
50
+	// compute score: +1 for win, 0 for draw, -1 for loss
51 51
 
52
-    switch ($pgn_result) {
53
-        case '1-0':
54
-            $S = 1;
55
-            break;
56
-        case '1/2-1/2':
57
-        default: // should not occur
58
-            $S = 0;
59
-            break;
60
-        case '0-1':
61
-            $S = -1;
62
-            break;
63
-    }
52
+	switch ($pgn_result) {
53
+		case '1-0':
54
+			$S = 1;
55
+			break;
56
+		case '1/2-1/2':
57
+		default: // should not occur
58
+			$S = 0;
59
+			break;
60
+		case '0-1':
61
+			$S = -1;
62
+			break;
63
+	}
64 64
 
65
-    return [$white_rating + $S * 10, $black_rating - $S * 10];
65
+	return [$white_rating + $S * 10, $black_rating - $S * 10];
66 66
 }
67 67
 
68 68
 /**
@@ -72,5 +72,5 @@  discard block
 block discarded – undo
72 72
  */
73 73
 function chess_ratings_num_provisional_games_linear()
74 74
 {
75
-    return 2;
75
+	return 2;
76 76
 }
Please login to merge, or discard this patch.
include/common.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -42,47 +42,47 @@  discard block
 block discarded – undo
42 42
 $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16);
43 43
 $pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32);
44 44
 if (is_object($helper->getModule())) {
45
-    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
45
+	$pathModIcon16 = $helper->getModule()->getInfo('modicons16');
46 46
 
47
-    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
47
+	$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
48 48
 }
49 49
 
50 50
 if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) {
51
-    define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
51
+	define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
52 52
 
53
-    define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
53
+	define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
54 54
 
55
-    define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
55
+	define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
56 56
 
57
-    define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
57
+	define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
58 58
 
59
-    define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
59
+	define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
60 60
 
61
-    define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
61
+	define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
62 62
 
63
-    define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
63
+	define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
64 64
 
65
-    define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
65
+	define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
66 66
 
67
-    define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
68
-    //    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
69
-    define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
70
-    define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
71
-    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif');
67
+	define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
68
+	//    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
69
+	define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
70
+	define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
71
+	define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif');
72 72
 
73
-    define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
73
+	define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
74 74
 }
75 75
 
76 76
 $icons = [
77
-    'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
78
-    'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
79
-    'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
80
-    'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
81
-    'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
82
-    'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
83
-    'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
84
-    '0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
85
-    '1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
77
+	'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
78
+	'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
79
+	'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
80
+	'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
81
+	'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
82
+	'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
83
+	'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
84
+	'0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
85
+	'1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
86 86
 ];
87 87
 
88 88
 $debug = false;
@@ -91,19 +91,19 @@  discard block
 block discarded – undo
91 91
 $myts = \MyTextSanitizer::getInstance();
92 92
 
93 93
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
94
-    require_once $GLOBALS['xoops']->path('class/template.php');
94
+	require_once $GLOBALS['xoops']->path('class/template.php');
95 95
 
96
-    $GLOBALS['xoopsTpl'] = new \XoopsTpl();
96
+	$GLOBALS['xoopsTpl'] = new \XoopsTpl();
97 97
 }
98 98
 
99 99
 $GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName);
100 100
 // Local icons path
101 101
 if (is_object($helper->getModule())) {
102
-    $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
102
+	$pathModIcon16 = $helper->getModule()->getInfo('modicons16');
103 103
 
104
-    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
104
+	$pathModIcon32 = $helper->getModule()->getInfo('modicons32');
105 105
 
106
-    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
106
+	$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
107 107
 
108
-    $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
108
+	$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
109 109
 }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 use XoopsModules\Chess;
22 22
 
23
-include dirname(__DIR__) . '/preloads/autoloader.php';
23
+include dirname(__DIR__).'/preloads/autoloader.php';
24 24
 
25 25
 $moduleDirName      = basename(dirname(__DIR__));
26 26
 $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName
@@ -47,42 +47,42 @@  discard block
 block discarded – undo
47 47
     $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
48 48
 }
49 49
 
50
-if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) {
51
-    define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__)));
50
+if (!defined($moduleDirNameUpper.'_CONSTANTS_DEFINED')) {
51
+    define($moduleDirNameUpper.'_DIRNAME', basename(dirname(__DIR__)));
52 52
 
53
-    define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
53
+    define($moduleDirNameUpper.'_ROOT_PATH', XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/');
54 54
 
55
-    define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/');
55
+    define($moduleDirNameUpper.'_PATH', XOOPS_ROOT_PATH.'/modules/'.$moduleDirName.'/');
56 56
 
57
-    define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/');
57
+    define($moduleDirNameUpper.'_URL', XOOPS_URL.'/modules/'.$moduleDirName.'/');
58 58
 
59
-    define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/');
59
+    define($moduleDirNameUpper.'_IMAGE_URL', constant($moduleDirNameUpper.'_URL').'/assets/images/');
60 60
 
61
-    define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images');
61
+    define($moduleDirNameUpper.'_IMAGE_PATH', constant($moduleDirNameUpper.'_ROOT_PATH').'/assets/images');
62 62
 
63
-    define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/');
63
+    define($moduleDirNameUpper.'_ADMIN_URL', constant($moduleDirNameUpper.'_URL').'/admin/');
64 64
 
65
-    define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/');
65
+    define($moduleDirNameUpper.'_ADMIN_PATH', constant($moduleDirNameUpper.'_ROOT_PATH').'/admin/');
66 66
 
67
-    define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php');
67
+    define($moduleDirNameUpper.'_ADMIN', constant($moduleDirNameUpper.'_URL').'/admin/index.php');
68 68
     //    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png');
69
-    define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
70
-    define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
71
-    define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif');
69
+    define($moduleDirNameUpper.'_UPLOAD_URL', XOOPS_UPLOAD_URL.'/'.$moduleDirName); // WITHOUT Trailing slash
70
+    define($moduleDirNameUpper.'_UPLOAD_PATH', XOOPS_UPLOAD_PATH.'/'.$moduleDirName); // WITHOUT Trailing slash
71
+    define($moduleDirNameUpper.'_AUTHOR_LOGOIMG', $pathIcon32.'/xoopsmicrobutton.gif');
72 72
 
73
-    define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1);
73
+    define($moduleDirNameUpper.'_CONSTANTS_DEFINED', 1);
74 74
 }
75 75
 
76 76
 $icons = [
77
-    'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
78
-    'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
79
-    'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
80
-    'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
81
-    'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
82
-    'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
83
-    'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
84
-    '0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
85
-    '1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
77
+    'edit'    => "<img src='".$pathIcon16."/edit.png'  alt="._EDIT."' align='middle'>",
78
+    'delete'  => "<img src='".$pathIcon16."/delete.png' alt='"._DELETE."' align='middle'>",
79
+    'clone'   => "<img src='".$pathIcon16."/editcopy.png' alt='"._CLONE."' align='middle'>",
80
+    'preview' => "<img src='".$pathIcon16."/view.png' alt='"._PREVIEW."' align='middle'>",
81
+    'print'   => "<img src='".$pathIcon16."/printer.png' alt='"._CLONE."' align='middle'>",
82
+    'pdf'     => "<img src='".$pathIcon16."/pdf.png' alt='"._CLONE."' align='middle'>",
83
+    'add'     => "<img src='".$pathIcon16."/add.png' alt='"._ADD."' align='middle'>",
84
+    '0'       => "<img src='".$pathIcon16."/0.png' alt='".0."' align='middle'>",
85
+    '1'       => "<img src='".$pathIcon16."/1.png' alt='".1."' align='middle'>",
86 86
 ];
87 87
 
88 88
 $debug = false;
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
     $GLOBALS['xoopsTpl'] = new \XoopsTpl();
97 97
 }
98 98
 
99
-$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName);
99
+$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL.'/modules/'.$moduleDirName);
100 100
 // Local icons path
101 101
 if (is_object($helper->getModule())) {
102 102
     $pathModIcon16 = $helper->getModule()->getInfo('modicons16');
103 103
 
104 104
     $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
105 105
 
106
-    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16);
106
+    $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL.'/modules/'.$moduleDirName.'/'.$pathModIcon16);
107 107
 
108 108
     $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32);
109 109
 }
Please login to merge, or discard this patch.
include/install.inc.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
     if ($oldversion < 102) { // old version < 1.02: direct update not supported.
58 58
 
59
-        $docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT';
60
-        chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true);
59
+        $docfile = XOOPS_ROOT_PATH.'/modules/chess/docs/INSTALL.TXT';
60
+        chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string) $oldversion, $docfile), true);
61 61
         return false;
62 62
     } elseif ($oldversion >= 107) { // old version >= 1.07:  no action needed.
63 63
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     if (!$result) {
77 77
         $mysql_errno = $xoopsDB->errno();
78 78
         $mysql_error = $xoopsDB->error();
79
-        chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true);
79
+        chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string) $mysql_errno, $mysql_error), true);
80 80
         return false;
81 81
     }
82 82
     if ($xoopsDB->getRowsNum($result) > 0) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     if (!$result) {
105 105
         $mysql_errno = $xoopsDB->errno();
106 106
         $mysql_error = $xoopsDB->error();
107
-        chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true);
107
+        chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string) $mysql_errno, $mysql_error), true);
108 108
         return false;
109 109
     }
110 110
     [$count] = $xoopsDB->fetchRow($result);
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 function chess_load_lang_file($filename, $module = '', $default = 'english')
261 261
 {
262 262
     $lang = $GLOBALS['xoopsConfig']['language'];
263
-    $path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language';
263
+    $path = XOOPS_ROOT_PATH.(empty($module) ? '/' : "/modules/$module/").'language';
264 264
     if (!($ret = @include_once("$path/$lang/$filename.php"))) {
265 265
         $ret = include_once("$path/$default/$filename.php");
266 266
     }
Please login to merge, or discard this patch.
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -49,74 +49,74 @@  discard block
 block discarded – undo
49 49
  */
50 50
 function xoops_module_pre_update_chess($module, $oldversion)
51 51
 {
52
-    global $xoopsDB;
53
-
54
-    // For downward-compatiblity, in case this function doesn't get called by the module handler.
55
-    $GLOBALS['chess_module_pre_update_called'] = true;
56
-
57
-    if ($oldversion < 102) { // old version < 1.02: direct update not supported.
58
-
59
-        $docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT';
60
-        chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true);
61
-        return false;
62
-    } elseif ($oldversion >= 107) { // old version >= 1.07:  no action needed.
63
-
64
-        return true;
65
-    }
66
-
67
-    // 1.02 <= old version < 1.07: perform update.
68
-
69
-    $ratings_table    = $xoopsDB->prefix('chess_ratings');
70
-    $challenges_table = $xoopsDB->prefix('chess_challenges');
71
-    $games_table      = $xoopsDB->prefix('chess_games');
72
-
73
-    // Check that ratings table does not already exist.
74
-    chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_1, $ratings_table));
75
-    $result = $xoopsDB->query("SHOW TABLES LIKE '$ratings_table'");
76
-    if (!$result) {
77
-        $mysql_errno = $xoopsDB->errno();
78
-        $mysql_error = $xoopsDB->error();
79
-        chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true);
80
-        return false;
81
-    }
82
-    if ($xoopsDB->getRowsNum($result) > 0) {
83
-        chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_3, $ratings_table), true);
84
-        return false;
85
-    }
86
-    $xoopsDB->freeRecordSet($result);
87
-    chess_set_message($module, _MI_CHESS_OK);
88
-
89
-    // Check database tables.
90
-    chess_set_message($module, _MI_CHESS_CHK_DB_TABLES);
91
-    $table_check_messages = chess_check_tables([$challenges_table, $games_table]);
92
-    if (!empty($table_check_messages)) {
93
-        foreach ($table_check_messages as $message) {
94
-            chess_set_message($module, $message, true);
95
-        }
96
-        return false;
97
-    }
98
-    chess_set_message($module, _MI_CHESS_OK);
99
-
100
-    // Check that values in column pgn_result of games table are in range.
101
-    $pgn_result_values = "'*','1-0','0-1','1/2-1/2'";
102
-    chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_1, $games_table));
103
-    $result = $xoopsDB->query("SELECT COUNT(*) FROM `$games_table` WHERE `pgn_result` NOT IN ($pgn_result_values)");
104
-    if (!$result) {
105
-        $mysql_errno = $xoopsDB->errno();
106
-        $mysql_error = $xoopsDB->error();
107
-        chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true);
108
-        return false;
109
-    }
110
-    [$count] = $xoopsDB->fetchRow($result);
111
-    if ($count > 0) {
112
-        chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_3, 'pgn_result', $games_table, $pgn_result_values), true);
113
-        chess_set_message($module, _MI_CHESS_GAMES_TABLE_4, true);
114
-        return false;
115
-    }
116
-    $xoopsDB->freeRecordSet($result);
117
-    chess_set_message($module, _MI_CHESS_OK);
118
-
119
-    return true; // successful
52
+	global $xoopsDB;
53
+
54
+	// For downward-compatiblity, in case this function doesn't get called by the module handler.
55
+	$GLOBALS['chess_module_pre_update_called'] = true;
56
+
57
+	if ($oldversion < 102) { // old version < 1.02: direct update not supported.
58
+
59
+		$docfile = XOOPS_ROOT_PATH . '/modules/chess/docs/INSTALL.TXT';
60
+		chess_set_message($module, sprintf(_MI_CHESS_OLD_VERSION, (string)$oldversion, $docfile), true);
61
+		return false;
62
+	} elseif ($oldversion >= 107) { // old version >= 1.07:  no action needed.
63
+
64
+		return true;
65
+	}
66
+
67
+	// 1.02 <= old version < 1.07: perform update.
68
+
69
+	$ratings_table    = $xoopsDB->prefix('chess_ratings');
70
+	$challenges_table = $xoopsDB->prefix('chess_challenges');
71
+	$games_table      = $xoopsDB->prefix('chess_games');
72
+
73
+	// Check that ratings table does not already exist.
74
+	chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_1, $ratings_table));
75
+	$result = $xoopsDB->query("SHOW TABLES LIKE '$ratings_table'");
76
+	if (!$result) {
77
+		$mysql_errno = $xoopsDB->errno();
78
+		$mysql_error = $xoopsDB->error();
79
+		chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_2, $ratings_table, (string)$mysql_errno, $mysql_error), true);
80
+		return false;
81
+	}
82
+	if ($xoopsDB->getRowsNum($result) > 0) {
83
+		chess_set_message($module, sprintf(_MI_CHESS_RATINGS_TABLE_3, $ratings_table), true);
84
+		return false;
85
+	}
86
+	$xoopsDB->freeRecordSet($result);
87
+	chess_set_message($module, _MI_CHESS_OK);
88
+
89
+	// Check database tables.
90
+	chess_set_message($module, _MI_CHESS_CHK_DB_TABLES);
91
+	$table_check_messages = chess_check_tables([$challenges_table, $games_table]);
92
+	if (!empty($table_check_messages)) {
93
+		foreach ($table_check_messages as $message) {
94
+			chess_set_message($module, $message, true);
95
+		}
96
+		return false;
97
+	}
98
+	chess_set_message($module, _MI_CHESS_OK);
99
+
100
+	// Check that values in column pgn_result of games table are in range.
101
+	$pgn_result_values = "'*','1-0','0-1','1/2-1/2'";
102
+	chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_1, $games_table));
103
+	$result = $xoopsDB->query("SELECT COUNT(*) FROM `$games_table` WHERE `pgn_result` NOT IN ($pgn_result_values)");
104
+	if (!$result) {
105
+		$mysql_errno = $xoopsDB->errno();
106
+		$mysql_error = $xoopsDB->error();
107
+		chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_2, $games_table, (string)$mysql_errno, $mysql_error), true);
108
+		return false;
109
+	}
110
+	[$count] = $xoopsDB->fetchRow($result);
111
+	if ($count > 0) {
112
+		chess_set_message($module, sprintf(_MI_CHESS_GAMES_TABLE_3, 'pgn_result', $games_table, $pgn_result_values), true);
113
+		chess_set_message($module, _MI_CHESS_GAMES_TABLE_4, true);
114
+		return false;
115
+	}
116
+	$xoopsDB->freeRecordSet($result);
117
+	chess_set_message($module, _MI_CHESS_OK);
118
+
119
+	return true; // successful
120 120
 }
121 121
 
122 122
 /**
@@ -128,25 +128,25 @@  discard block
 block discarded – undo
128 128
  */
129 129
 function xoops_module_update_chess($module, $oldversion)
130 130
 {
131
-    global $xoopsDB;
131
+	global $xoopsDB;
132 132
 
133
-    // Before proceeding, ensure that pre-update processing has been done, and that all the checks pass.
134
-    // For downward-compatiblity, in case the "pre_update" function doesn't get called by the module handler.
135
-    if (!@$GLOBALS['chess_module_pre_update_called'] && !xoops_module_pre_update_chess($module, $oldversion)) {
136
-        return false;
137
-    }
133
+	// Before proceeding, ensure that pre-update processing has been done, and that all the checks pass.
134
+	// For downward-compatiblity, in case the "pre_update" function doesn't get called by the module handler.
135
+	if (!@$GLOBALS['chess_module_pre_update_called'] && !xoops_module_pre_update_chess($module, $oldversion)) {
136
+		return false;
137
+	}
138 138
 
139
-    if ($oldversion >= 107) { // old version >= 1.07:  no action needed.
140
-        return true;
141
-    }
139
+	if ($oldversion >= 107) { // old version >= 1.07:  no action needed.
140
+		return true;
141
+	}
142 142
 
143
-    $ratings_table    = $xoopsDB->prefix('chess_ratings');
144
-    $challenges_table = $xoopsDB->prefix('chess_challenges');
145
-    $games_table      = $xoopsDB->prefix('chess_games');
143
+	$ratings_table    = $xoopsDB->prefix('chess_ratings');
144
+	$challenges_table = $xoopsDB->prefix('chess_challenges');
145
+	$games_table      = $xoopsDB->prefix('chess_games');
146 146
 
147
-    $queries = [
147
+	$queries = [
148 148
 
149
-        "CREATE TABLE `$ratings_table` (
149
+		"CREATE TABLE `$ratings_table` (
150 150
             `player_uid` mediumint(8) unsigned NOT NULL default '0',
151 151
             `rating` smallint(6) unsigned NOT NULL default '1200',
152 152
             `games_won` smallint(6) unsigned NOT NULL default '0',
@@ -157,40 +157,40 @@  discard block
 block discarded – undo
157 157
             KEY `games` (`games_won`,`games_lost`,`games_drawn`)
158 158
             ) TYPE=MyISAM",
159 159
 
160
-        "ALTER TABLE `$challenges_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL",
161
-        "ALTER TABLE `$challenges_table` ADD INDEX `game_type` (`game_type`)",
162
-        "ALTER TABLE `$challenges_table` ADD INDEX `player1_uid` (`player1_uid`)",
163
-        "ALTER TABLE `$challenges_table` ADD INDEX `player2_uid` (`player2_uid`)",
164
-        "ALTER TABLE `$challenges_table` ADD INDEX `create_date` (`create_date`)",
165
-        "ALTER TABLE `$challenges_table` ADD INDEX `is_rated` (`is_rated`)",
166
-
167
-        "ALTER TABLE `$games_table` CHANGE `pgn_result` `pgn_result` ENUM('*','0-1','1-0','1/2-1/2') DEFAULT '*' NOT NULL",
168
-        "ALTER TABLE `$games_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL",
169
-        "ALTER TABLE `$games_table` ADD INDEX `white_uid` (`white_uid`)",
170
-        "ALTER TABLE `$games_table` ADD INDEX `black_uid` (`black_uid`)",
171
-        "ALTER TABLE `$games_table` ADD INDEX `date` (`create_date`,`start_date`,`last_date`)",
172
-        "ALTER TABLE `$games_table` ADD INDEX `pgn_result` (`pgn_result`)",
173
-        "ALTER TABLE `$games_table` ADD INDEX `suspended_date` (`suspended`(19))",
174
-        "ALTER TABLE `$games_table` ADD INDEX `is_rated` (`is_rated`)",
175
-
176
-        "UPDATE `$games_table` SET `is_rated` = '0' WHERE `white_uid` = `black_uid`",
177
-    ];
178
-
179
-    // Update database tables.
180
-    chess_set_message($module, _MI_CHESS_UPDATING_DATABASE);
181
-    foreach ($queries as $query) {
182
-        chess_set_message($module, "> $query");
183
-        $result = $xoopsDB->query($query);
184
-        if (!$result) {
185
-            $mysql_errno = $xoopsDB->errno();
186
-            $mysql_error = $xoopsDB->error();
187
-            chess_set_message($module, " ... ($mysql_errno) $mysql_error");
188
-            return false;
189
-        }
190
-        chess_set_message($module, _MI_CHESS_OK);
191
-    }
192
-
193
-    /***
160
+		"ALTER TABLE `$challenges_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL",
161
+		"ALTER TABLE `$challenges_table` ADD INDEX `game_type` (`game_type`)",
162
+		"ALTER TABLE `$challenges_table` ADD INDEX `player1_uid` (`player1_uid`)",
163
+		"ALTER TABLE `$challenges_table` ADD INDEX `player2_uid` (`player2_uid`)",
164
+		"ALTER TABLE `$challenges_table` ADD INDEX `create_date` (`create_date`)",
165
+		"ALTER TABLE `$challenges_table` ADD INDEX `is_rated` (`is_rated`)",
166
+
167
+		"ALTER TABLE `$games_table` CHANGE `pgn_result` `pgn_result` ENUM('*','0-1','1-0','1/2-1/2') DEFAULT '*' NOT NULL",
168
+		"ALTER TABLE `$games_table` ADD `is_rated` ENUM('1','0') DEFAULT '1' NOT NULL",
169
+		"ALTER TABLE `$games_table` ADD INDEX `white_uid` (`white_uid`)",
170
+		"ALTER TABLE `$games_table` ADD INDEX `black_uid` (`black_uid`)",
171
+		"ALTER TABLE `$games_table` ADD INDEX `date` (`create_date`,`start_date`,`last_date`)",
172
+		"ALTER TABLE `$games_table` ADD INDEX `pgn_result` (`pgn_result`)",
173
+		"ALTER TABLE `$games_table` ADD INDEX `suspended_date` (`suspended`(19))",
174
+		"ALTER TABLE `$games_table` ADD INDEX `is_rated` (`is_rated`)",
175
+
176
+		"UPDATE `$games_table` SET `is_rated` = '0' WHERE `white_uid` = `black_uid`",
177
+	];
178
+
179
+	// Update database tables.
180
+	chess_set_message($module, _MI_CHESS_UPDATING_DATABASE);
181
+	foreach ($queries as $query) {
182
+		chess_set_message($module, "> $query");
183
+		$result = $xoopsDB->query($query);
184
+		if (!$result) {
185
+			$mysql_errno = $xoopsDB->errno();
186
+			$mysql_error = $xoopsDB->error();
187
+			chess_set_message($module, " ... ($mysql_errno) $mysql_error");
188
+			return false;
189
+		}
190
+		chess_set_message($module, _MI_CHESS_OK);
191
+	}
192
+
193
+	/***
194 194
      * #*#TODO# - Leave this here for now, in case I think of a way to get it to work.
195 195
      * # This causes an error about the rating_system module configuration parameter not being defined,
196 196
      * # so I added a note in INSTALL.TXT about manually recalculating the ratings after install.
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
      * chess_recalc_ratings();
202 202
      ***/
203 203
 
204
-    chess_set_message($module, _MI_CHESS_UPDATE_SUCCESSFUL);
204
+	chess_set_message($module, _MI_CHESS_UPDATE_SUCCESSFUL);
205 205
 
206
-    return true; // successful
206
+	return true; // successful
207 207
 }
208 208
 
209 209
 /**
@@ -214,37 +214,37 @@  discard block
 block discarded – undo
214 214
  */
215 215
 function chess_check_tables($table_names)
216 216
 {
217
-    global $xoopsDB;
217
+	global $xoopsDB;
218 218
 
219
-    $messages = [];
219
+	$messages = [];
220 220
 
221
-    foreach ($table_names as $table_name) {
222
-        $query  = "CHECK TABLE `$table_name`";
223
-        $result = $xoopsDB->query($query);
224
-        if (!$result) {
225
-            $mysql_errno = $xoopsDB->errno();
226
-            $mysql_error = $xoopsDB->error();
227
-            $messages[]  = $query;
228
-            $messages[]  = " ... ($mysql_errno) $mysql_error";
229
-            continue;
230
-        }
221
+	foreach ($table_names as $table_name) {
222
+		$query  = "CHECK TABLE `$table_name`";
223
+		$result = $xoopsDB->query($query);
224
+		if (!$result) {
225
+			$mysql_errno = $xoopsDB->errno();
226
+			$mysql_error = $xoopsDB->error();
227
+			$messages[]  = $query;
228
+			$messages[]  = " ... ($mysql_errno) $mysql_error";
229
+			continue;
230
+		}
231 231
 
232
-        // Initialize, in case the real table status fails to get retrieved.
233
-        $table_status = '*** STATUS UNKNOWN ***';
232
+		// Initialize, in case the real table status fails to get retrieved.
233
+		$table_status = '*** STATUS UNKNOWN ***';
234 234
 
235
-        // The query may return multiple rows.  Only the last row is normally of interest, so only that row is saved.
236
-        while ($row = $xoopsDB->fetchArray($result)) {
237
-            $table_status = $row['Msg_text'];
238
-        }
235
+		// The query may return multiple rows.  Only the last row is normally of interest, so only that row is saved.
236
+		while ($row = $xoopsDB->fetchArray($result)) {
237
+			$table_status = $row['Msg_text'];
238
+		}
239 239
 
240
-        $xoopsDB->freeRecordSet($result);
240
+		$xoopsDB->freeRecordSet($result);
241 241
 
242
-        if ('OK' != $table_status) {
243
-            $messages[] = " ... $table_name: $table_status";
244
-        }
245
-    }
242
+		if ('OK' != $table_status) {
243
+			$messages[] = " ... $table_name: $table_status";
244
+		}
245
+	}
246 246
 
247
-    return $messages;
247
+	return $messages;
248 248
 }
249 249
 
250 250
 /**
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
  */
260 260
 function chess_load_lang_file($filename, $module = '', $default = 'english')
261 261
 {
262
-    $lang = $GLOBALS['xoopsConfig']['language'];
263
-    $path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language';
264
-    if (!($ret = @include_once("$path/$lang/$filename.php"))) {
265
-        $ret = include_once("$path/$default/$filename.php");
266
-    }
267
-    return $ret;
262
+	$lang = $GLOBALS['xoopsConfig']['language'];
263
+	$path = XOOPS_ROOT_PATH . (empty($module) ? '/' : "/modules/$module/") . 'language';
264
+	if (!($ret = @include_once("$path/$lang/$filename.php"))) {
265
+		$ret = include_once("$path/$default/$filename.php");
266
+	}
267
+	return $ret;
268 268
 }
269 269
 
270 270
 /**
@@ -276,14 +276,14 @@  discard block
 block discarded – undo
276 276
  */
277 277
 function chess_set_message($module, $text = '', $error = false)
278 278
 {
279
-    $text = $error ? "<span style='color:#ff0000;background-color:#ffffff;font-weight:bold;'>$text</span>" : $text;
280
-
281
-    // For downward compatibility with XOOPS versions that don't have the method XoopsModule::setMessage.
282
-    if (is_object($module) && method_exists($module, 'setMessage')) {
283
-        $module->setMessage($text);
284
-    } else {
285
-        echo "<code>$text</code><br />\n";
286
-    }
279
+	$text = $error ? "<span style='color:#ff0000;background-color:#ffffff;font-weight:bold;'>$text</span>" : $text;
280
+
281
+	// For downward compatibility with XOOPS versions that don't have the method XoopsModule::setMessage.
282
+	if (is_object($module) && method_exists($module, 'setMessage')) {
283
+		$module->setMessage($text);
284
+	} else {
285
+		echo "<code>$text</code><br />\n";
286
+	}
287 287
 }
288 288
 
289 289
 ?>
Please login to merge, or discard this patch.
config/icons.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@
 block discarded – undo
4 4
 $moduleDirName = basename(dirname(__DIR__));
5 5
 
6 6
 return (object)[
7
-    'name'  => mb_strtoupper($moduleDirName) . ' IconConfigurator',
8
-    'icons' => [
9
-        'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
10
-        'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
11
-        'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
12
-        'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
13
-        'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
14
-        'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
15
-        'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
16
-        '0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
17
-        '1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
18
-    ],
7
+	'name'  => mb_strtoupper($moduleDirName) . ' IconConfigurator',
8
+	'icons' => [
9
+		'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
10
+		'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
11
+		'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
12
+		'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
13
+		'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
14
+		'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
15
+		'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
16
+		'0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
17
+		'1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
18
+	],
19 19
 ];
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@
 block discarded – undo
3 3
 $pathIcon16    = \Xmf\Module\Admin::iconUrl('', 16);
4 4
 $moduleDirName = basename(dirname(__DIR__));
5 5
 
6
-return (object)[
7
-    'name'  => mb_strtoupper($moduleDirName) . ' IconConfigurator',
6
+return (object) [
7
+    'name'  => mb_strtoupper($moduleDirName).' IconConfigurator',
8 8
     'icons' => [
9
-        'edit'    => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _EDIT . "' align='middle'>",
10
-        'delete'  => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _DELETE . "' align='middle'>",
11
-        'clone'   => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _CLONE . "' align='middle'>",
12
-        'preview' => "<img src='" . $pathIcon16 . "/view.png' alt='" . _PREVIEW . "' align='middle'>",
13
-        'print'   => "<img src='" . $pathIcon16 . "/printer.png' alt='" . _CLONE . "' align='middle'>",
14
-        'pdf'     => "<img src='" . $pathIcon16 . "/pdf.png' alt='" . _CLONE . "' align='middle'>",
15
-        'add'     => "<img src='" . $pathIcon16 . "/add.png' alt='" . _ADD . "' align='middle'>",
16
-        '0'       => "<img src='" . $pathIcon16 . "/0.png' alt='" . 0 . "' align='middle'>",
17
-        '1'       => "<img src='" . $pathIcon16 . "/1.png' alt='" . 1 . "' align='middle'>",
9
+        'edit'    => "<img src='".$pathIcon16."/edit.png'  alt="._EDIT."' align='middle'>",
10
+        'delete'  => "<img src='".$pathIcon16."/delete.png' alt='"._DELETE."' align='middle'>",
11
+        'clone'   => "<img src='".$pathIcon16."/editcopy.png' alt='"._CLONE."' align='middle'>",
12
+        'preview' => "<img src='".$pathIcon16."/view.png' alt='"._PREVIEW."' align='middle'>",
13
+        'print'   => "<img src='".$pathIcon16."/printer.png' alt='"._CLONE."' align='middle'>",
14
+        'pdf'     => "<img src='".$pathIcon16."/pdf.png' alt='"._CLONE."' align='middle'>",
15
+        'add'     => "<img src='".$pathIcon16."/add.png' alt='"._ADD."' align='middle'>",
16
+        '0'       => "<img src='".$pathIcon16."/0.png' alt='".0."' align='middle'>",
17
+        '1'       => "<img src='".$pathIcon16."/1.png' alt='".1."' align='middle'>",
18 18
     ],
19 19
 ];
Please login to merge, or discard this patch.
admin/index.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -42,31 +42,31 @@  discard block
 block discarded – undo
42 42
 //------------- Test Data ----------------------------
43 43
 
44 44
 if ($helper->getConfig('displaySampleButton')) {
45
-    $yamlFile = dirname(__DIR__) . '/config/admin.yml';
45
+	$yamlFile = dirname(__DIR__) . '/config/admin.yml';
46 46
 
47
-    $config = loadAdminConfig($yamlFile);
47
+	$config = loadAdminConfig($yamlFile);
48 48
 
49
-    $displaySampleButton = $config['displaySampleButton'];
49
+	$displaySampleButton = $config['displaySampleButton'];
50 50
 
51
-    if (1 == $displaySampleButton) {
52
-        xoops_loadLanguage('admin/modulesadmin', 'system');
51
+	if (1 == $displaySampleButton) {
52
+		xoops_loadLanguage('admin/modulesadmin', 'system');
53 53
 
54
-        require_once dirname(__DIR__) . '/testdata/index.php';
54
+		require_once dirname(__DIR__) . '/testdata/index.php';
55 55
 
56
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add');
56
+		$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add');
57 57
 
58
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add');
58
+		$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add');
59 59
 
60
-        //    $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add');
60
+		//    $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add');
61 61
 
62
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
63
-    } else {
64
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
62
+		$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
63
+	} else {
64
+		$adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
65 65
 
66
-        $displaySampleButton = $config['displaySampleButton'];
67
-    }
66
+		$displaySampleButton = $config['displaySampleButton'];
67
+	}
68 68
 
69
-    $adminObject->displayButton('left', '');
69
+	$adminObject->displayButton('left', '');
70 70
 }
71 71
 
72 72
 //------------- End Test Data ----------------------------
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
  */
80 80
 function loadAdminConfig($yamlFile)
81 81
 {
82
-    return \Xmf\Yaml::readWrapped($yamlFile);
82
+	return \Xmf\Yaml::readWrapped($yamlFile);
83 83
 }
84 84
 
85 85
 /**
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
  */
88 88
 function hideButtons($yamlFile)
89 89
 {
90
-    $app['displaySampleButton'] = 0;
90
+	$app['displaySampleButton'] = 0;
91 91
 
92
-    \Xmf\Yaml::save($app, $yamlFile);
92
+	\Xmf\Yaml::save($app, $yamlFile);
93 93
 
94
-    redirect_header('index.php', 0, '');
94
+	redirect_header('index.php', 0, '');
95 95
 }
96 96
 
97 97
 /**
@@ -99,22 +99,22 @@  discard block
 block discarded – undo
99 99
  */
100 100
 function showButtons($yamlFile)
101 101
 {
102
-    $app['displaySampleButton'] = 1;
102
+	$app['displaySampleButton'] = 1;
103 103
 
104
-    \Xmf\Yaml::save($app, $yamlFile);
104
+	\Xmf\Yaml::save($app, $yamlFile);
105 105
 
106
-    redirect_header('index.php', 0, '');
106
+	redirect_header('index.php', 0, '');
107 107
 }
108 108
 
109 109
 $op = \Xmf\Request::getString('op', 0, 'GET');
110 110
 
111 111
 switch ($op) {
112
-    case 'hide_buttons':
113
-        hideButtons($yamlFile);
114
-        break;
115
-    case 'show_buttons':
116
-        showButtons($yamlFile);
117
-        break;
112
+	case 'hide_buttons':
113
+		hideButtons($yamlFile);
114
+		break;
115
+	case 'show_buttons':
116
+		showButtons($yamlFile);
117
+		break;
118 118
 }
119 119
 
120 120
 echo $utility::getServerStats();
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
 use XoopsModules\Chess\Common;
21 21
 
22
-require __DIR__ . '/admin_header.php';
22
+require __DIR__.'/admin_header.php';
23 23
 // Display Admin header
24 24
 xoops_cp_header();
25 25
 $adminObject = \Xmf\Module\Admin::getInstance();
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 //------------- Test Data ----------------------------
43 43
 
44 44
 if ($helper->getConfig('displaySampleButton')) {
45
-    $yamlFile = dirname(__DIR__) . '/config/admin.yml';
45
+    $yamlFile = dirname(__DIR__).'/config/admin.yml';
46 46
 
47 47
     $config = loadAdminConfig($yamlFile);
48 48
 
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
     if (1 == $displaySampleButton) {
52 52
         xoops_loadLanguage('admin/modulesadmin', 'system');
53 53
 
54
-        require_once dirname(__DIR__) . '/testdata/index.php';
54
+        require_once dirname(__DIR__).'/testdata/index.php';
55 55
 
56
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add');
56
+        $adminObject->addItemButton(constant('CO_'.$moduleDirNameUpper.'_'.'ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add');
57 57
 
58
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add');
58
+        $adminObject->addItemButton(constant('CO_'.$moduleDirNameUpper.'_'.'SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add');
59 59
 
60 60
         //    $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add');
61 61
 
62
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
62
+        $adminObject->addItemButton(constant('CO_'.$moduleDirNameUpper.'_'.'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete');
63 63
     } else {
64
-        $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
64
+        $adminObject->addItemButton(constant('CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add');
65 65
 
66 66
         $displaySampleButton = $config['displaySampleButton'];
67 67
     }
@@ -119,4 +119,4 @@  discard block
 block discarded – undo
119 119
 
120 120
 echo $utility::getServerStats();
121 121
 
122
-require __DIR__ . '/admin_footer.php';
122
+require __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/menu.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -34,45 +34,45 @@
 block discarded – undo
34 34
 
35 35
 $pathIcon32 = \Xmf\Module\Admin::menuIconPath('');
36 36
 if (is_object($helper->getModule())) {
37
-    //    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
37
+	//    $pathModIcon32 = $helper->getModule()->getInfo('modicons32');
38 38
 
39
-    $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32'));
39
+	$pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32'));
40 40
 }
41 41
 
42 42
 $adminmenu[] = [
43
-    'title' => _MI_CHESS_MENU_HOME,
44
-    'link'  => 'admin/index.php',
45
-    'icon'  => $pathIcon32 . '/home.png',
43
+	'title' => _MI_CHESS_MENU_HOME,
44
+	'link'  => 'admin/index.php',
45
+	'icon'  => $pathIcon32 . '/home.png',
46 46
 ];
47 47
 
48 48
 $adminmenu[] = [
49
-    'title' => _MI_CHESS_ADMENU1,
50
-    'link'  => 'admin/main.php?op=suspended_games',
51
-    'icon'  => $pathIcon32 . '/alert.png',
49
+	'title' => _MI_CHESS_ADMENU1,
50
+	'link'  => 'admin/main.php?op=suspended_games',
51
+	'icon'  => $pathIcon32 . '/alert.png',
52 52
 ];
53 53
 
54 54
 $adminmenu[] = [
55
-    'title' => _MI_CHESS_ADMENU2,
56
-    'link'  => 'admin/main.php?op=active_games',
57
-    'icon'  => $pathIcon32 . '/button_ok.png',
55
+	'title' => _MI_CHESS_ADMENU2,
56
+	'link'  => 'admin/main.php?op=active_games',
57
+	'icon'  => $pathIcon32 . '/button_ok.png',
58 58
 ];
59 59
 
60 60
 $adminmenu[] = [
61
-    'title' => _MI_CHESS_ADMENU3,
62
-    'link'  => 'admin/main.php?op=challenges',
63
-    'icon'  => $pathIcon32 . '/cash_stack.png',
61
+	'title' => _MI_CHESS_ADMENU3,
62
+	'link'  => 'admin/main.php?op=challenges',
63
+	'icon'  => $pathIcon32 . '/cash_stack.png',
64 64
 ];
65 65
 
66 66
 if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) {
67
-    $adminmenu[] = [
68
-        'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'),
69
-        'link'  => 'admin/migrate.php',
70
-        'icon'  => $pathIcon32 . '/database_go.png',
71
-    ];
67
+	$adminmenu[] = [
68
+		'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'),
69
+		'link'  => 'admin/migrate.php',
70
+		'icon'  => $pathIcon32 . '/database_go.png',
71
+	];
72 72
 }
73 73
 
74 74
 $adminmenu[] = [
75
-    'title' => _MI_CHESS_MENU_ABOUT,
76
-    'link'  => 'admin/about.php',
77
-    'icon'  => $pathIcon32 . '/about.png',
75
+	'title' => _MI_CHESS_MENU_ABOUT,
76
+	'link'  => 'admin/about.php',
77
+	'icon'  => $pathIcon32 . '/about.png',
78 78
 ];
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26 26
 //  ------------------------------------------------------------------------ //
27 27
 
28
-include dirname(__DIR__) . '/preloads/autoloader.php';
28
+include dirname(__DIR__).'/preloads/autoloader.php';
29 29
 
30 30
 $moduleDirName      = basename(dirname(__DIR__));
31 31
 $moduleDirNameUpper = mb_strtoupper($moduleDirName);
@@ -42,37 +42,37 @@  discard block
 block discarded – undo
42 42
 $adminmenu[] = [
43 43
     'title' => _MI_CHESS_MENU_HOME,
44 44
     'link'  => 'admin/index.php',
45
-    'icon'  => $pathIcon32 . '/home.png',
45
+    'icon'  => $pathIcon32.'/home.png',
46 46
 ];
47 47
 
48 48
 $adminmenu[] = [
49 49
     'title' => _MI_CHESS_ADMENU1,
50 50
     'link'  => 'admin/main.php?op=suspended_games',
51
-    'icon'  => $pathIcon32 . '/alert.png',
51
+    'icon'  => $pathIcon32.'/alert.png',
52 52
 ];
53 53
 
54 54
 $adminmenu[] = [
55 55
     'title' => _MI_CHESS_ADMENU2,
56 56
     'link'  => 'admin/main.php?op=active_games',
57
-    'icon'  => $pathIcon32 . '/button_ok.png',
57
+    'icon'  => $pathIcon32.'/button_ok.png',
58 58
 ];
59 59
 
60 60
 $adminmenu[] = [
61 61
     'title' => _MI_CHESS_ADMENU3,
62 62
     'link'  => 'admin/main.php?op=challenges',
63
-    'icon'  => $pathIcon32 . '/cash_stack.png',
63
+    'icon'  => $pathIcon32.'/cash_stack.png',
64 64
 ];
65 65
 
66 66
 if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) {
67 67
     $adminmenu[] = [
68
-        'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'),
68
+        'title' => constant('CO_'.$moduleDirNameUpper.'_'.'ADMENU_MIGRATE'),
69 69
         'link'  => 'admin/migrate.php',
70
-        'icon'  => $pathIcon32 . '/database_go.png',
70
+        'icon'  => $pathIcon32.'/database_go.png',
71 71
     ];
72 72
 }
73 73
 
74 74
 $adminmenu[] = [
75 75
     'title' => _MI_CHESS_MENU_ABOUT,
76 76
     'link'  => 'admin/about.php',
77
-    'icon'  => $pathIcon32 . '/about.png',
77
+    'icon'  => $pathIcon32.'/about.png',
78 78
 ];
Please login to merge, or discard this patch.
admin/admin_footer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,6 +19,6 @@
 block discarded – undo
19 19
  */
20 20
 $pathIcon32 = Xmf\Module\Admin::iconUrl('', 32);
21 21
 
22
-echo "<div class='adminfooter'>\n" . "  <div style='text-align: center;'>\n" . "    <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . "  </div>\n" . '  ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>';
22
+echo "<div class='adminfooter'>\n"."  <div style='text-align: center;'>\n"."    <a href='https://xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"."  </div>\n".'  '._AM_MODULEADMIN_ADMIN_FOOTER."\n".'</div>';
23 23
 
24 24
 xoops_cp_footer();
Please login to merge, or discard this patch.
class/Helper.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -26,72 +26,72 @@
 block discarded – undo
26 26
  */
27 27
 class Helper extends \Xmf\Module\Helper
28 28
 {
29
-    public $debug;
29
+	public $debug;
30 30
 
31
-    /**
32
-     * @param bool $debug
33
-     */
34
-    public function __construct($debug = false)
35
-    {
36
-        $this->debug = $debug;
31
+	/**
32
+	 * @param bool $debug
33
+	 */
34
+	public function __construct($debug = false)
35
+	{
36
+		$this->debug = $debug;
37 37
 
38
-        $moduleDirName = \basename(\dirname(__DIR__));
38
+		$moduleDirName = \basename(\dirname(__DIR__));
39 39
 
40
-        parent::__construct($moduleDirName);
41
-    }
40
+		parent::__construct($moduleDirName);
41
+	}
42 42
 
43
-    /**
44
-     * @param bool $debug
45
-     *
46
-     * @return \XoopsModules\Chess\Helper
47
-     */
48
-    public static function getInstance($debug = false)
49
-    {
50
-        static $instance;
43
+	/**
44
+	 * @param bool $debug
45
+	 *
46
+	 * @return \XoopsModules\Chess\Helper
47
+	 */
48
+	public static function getInstance($debug = false)
49
+	{
50
+		static $instance;
51 51
 
52
-        if (null === $instance) {
53
-            $instance = new static($debug);
54
-        }
52
+		if (null === $instance) {
53
+			$instance = new static($debug);
54
+		}
55 55
 
56
-        return $instance;
57
-    }
56
+		return $instance;
57
+	}
58 58
 
59
-    /**
60
-     * @return string
61
-     */
62
-    public function getDirname()
63
-    {
64
-        return $this->dirname;
65
-    }
59
+	/**
60
+	 * @return string
61
+	 */
62
+	public function getDirname()
63
+	{
64
+		return $this->dirname;
65
+	}
66 66
 
67
-    /**
68
-     * Get an Object Handler
69
-     *
70
-     * @param string $name name of handler to load
71
-     *
72
-     * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler
73
-     */
74
-    public function getHandler($name)
75
-    {
76
-        $ret = false;
67
+	/**
68
+	 * Get an Object Handler
69
+	 *
70
+	 * @param string $name name of handler to load
71
+	 *
72
+	 * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler
73
+	 */
74
+	public function getHandler($name)
75
+	{
76
+		$ret = false;
77 77
 
78
-        $class = __NAMESPACE__ . '\\' . $name . 'Handler';
78
+		$class = __NAMESPACE__ . '\\' . $name . 'Handler';
79 79
 
80
-        if (!\class_exists($class)) {
81
-            throw new \RuntimeException("Class '$class' not found");
82
-        }
80
+		if (!\class_exists($class)) {
81
+			throw new \RuntimeException("Class '$class' not found");
82
+		}
83 83
 
84
-        /** @var \XoopsMySQLDatabase $db */
84
+		/** @var \XoopsMySQLDatabase $db */
85 85
 
86
-        $db = \XoopsDatabaseFactory::getDatabaseConnection();
86
+		$db = \XoopsDatabaseFactory::getDatabaseConnection();
87 87
 
88
-        $helper = self::getInstance();
88
+		$helper = self::getInstance();
89 89
 
90
-        $ret = new $class($db, $helper);
90
+		$ret = new $class($db, $helper);
91 91
 
92
-        $this->addLog("Getting handler '{$name}'");
92
+		$this->addLog("Getting handler '{$name}'");
93 93
 
94
-        return $ret;
95
-    }
94
+		return $ret;
95
+	}
96 96
 }
97 97
 //require  dirname(dirname(__DIR__)) . '/mainfile.php';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     {
76 76
         $ret = false;
77 77
 
78
-        $class = __NAMESPACE__ . '\\' . $name . 'Handler';
78
+        $class = __NAMESPACE__.'\\'.$name.'Handler';
79 79
 
80 80
         if (!\class_exists($class)) {
81 81
             throw new \RuntimeException("Class '$class' not found");
Please login to merge, or discard this patch.
class/Utility.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,5 +27,5 @@
 block discarded – undo
27 27
  */
28 28
 class Utility extends Common\SysUtility
29 29
 {
30
-    //--------------- Custom module methods -----------------------------
30
+	//--------------- Custom module methods -----------------------------
31 31
 }
Please login to merge, or discard this patch.