Completed
Push — master ( f5725e...47133a )
by Michael
02:14
created
admin/index.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 
12 12
 $configurator = include __DIR__ . '/../include/config.php';
13 13
 foreach (array_keys($configurator->uploadFolders) as $i) {
14
-    $utility::createFolder($configurator->uploadFolders[$i]);
15
-    $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder');
14
+	$utility::createFolder($configurator->uploadFolders[$i]);
15
+	$adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder');
16 16
 }
17 17
 
18 18
 //$instructionHandler = xoops_getModuleHandler('instruction', 'instruction');
Please login to merge, or discard this patch.
admin/menu.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Xoopsmodules\instruction;
4 4
 
5 5
 if (!isset($moduleDirName)) {
6
-    $moduleDirName = basename(dirname(__DIR__));
6
+	$moduleDirName = basename(dirname(__DIR__));
7 7
 }
8 8
 
9 9
 /** @var Xmf\Module\Helper $moduleHelper */
@@ -17,34 +17,34 @@  discard block
 block discarded – undo
17 17
 
18 18
 // Административное меню
19 19
 $adminmenu = [
20
-    [
21
-        'title' => _MI_INSTRUCTION_ADMIN_HOME,
22
-        'link'  => 'admin/index.php',
23
-        'desc'  => _MI_INSTRUCTION_ADMIN_HOME_DESC,
24
-        'icon'  => $pathIcon32 . '/home.png'
25
-    ],
26
-    [
27
-        'title' => _MI_INSTRUCTION_ADMIN_CAT,
28
-        'link'  => 'admin/cat.php',
29
-        'desc'  => _MI_INSTRUCTION_ADMIN_CAT_DESC,
30
-        'icon'  => $pathIcon32 . '/category.png'
31
-    ],
32
-    [
33
-        'title' => _MI_INSTRUCTION_ADMIN_INSTR,
34
-        'link'  => 'admin/instr.php',
35
-        'desc'  => _MI_INSTRUCTION_ADMIN_INSTR_DESC,
36
-        'icon'  => $pathModIcon32 . '/nav_book.png'
37
-    ],
38
-    [
39
-        'title' => _MI_INSTRUCTION_ADMIN_PERM,
40
-        'link'  => 'admin/perm.php',
41
-        'desc'  => _MI_INSTRUCTION_ADMIN_PERM_DESC,
42
-        'icon'  => $pathIcon32 . '/permissions.png'
43
-    ],
44
-    [
45
-        'title' => _MI_INSTRUCTION_ADMIN_ABOUT,
46
-        'link'  => 'admin/about.php',
47
-        'desc'  => _MI_INSTRUCTION_ADMIN_ABOUT_DESC,
48
-        'icon'  => $pathIcon32 . '/about.png'
49
-    ]
20
+	[
21
+		'title' => _MI_INSTRUCTION_ADMIN_HOME,
22
+		'link'  => 'admin/index.php',
23
+		'desc'  => _MI_INSTRUCTION_ADMIN_HOME_DESC,
24
+		'icon'  => $pathIcon32 . '/home.png'
25
+	],
26
+	[
27
+		'title' => _MI_INSTRUCTION_ADMIN_CAT,
28
+		'link'  => 'admin/cat.php',
29
+		'desc'  => _MI_INSTRUCTION_ADMIN_CAT_DESC,
30
+		'icon'  => $pathIcon32 . '/category.png'
31
+	],
32
+	[
33
+		'title' => _MI_INSTRUCTION_ADMIN_INSTR,
34
+		'link'  => 'admin/instr.php',
35
+		'desc'  => _MI_INSTRUCTION_ADMIN_INSTR_DESC,
36
+		'icon'  => $pathModIcon32 . '/nav_book.png'
37
+	],
38
+	[
39
+		'title' => _MI_INSTRUCTION_ADMIN_PERM,
40
+		'link'  => 'admin/perm.php',
41
+		'desc'  => _MI_INSTRUCTION_ADMIN_PERM_DESC,
42
+		'icon'  => $pathIcon32 . '/permissions.png'
43
+	],
44
+	[
45
+		'title' => _MI_INSTRUCTION_ADMIN_ABOUT,
46
+		'link'  => 'admin/about.php',
47
+		'desc'  => _MI_INSTRUCTION_ADMIN_ABOUT_DESC,
48
+		'icon'  => $pathIcon32 . '/about.png'
49
+	]
50 50
 ];
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 use Xoopsmodules\instruction;
4 4
 
5
-if (!isset($moduleDirName)) {
5
+if ( ! isset($moduleDirName)) {
6 6
     $moduleDirName = basename(dirname(__DIR__));
7 7
 }
8 8
 
Please login to merge, or discard this patch.
preloads/core.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
  */
23 23
 class InstructionCorePreload extends XoopsPreloadItem
24 24
 {
25
-    // to add PSR-4 autoloader
26
-    /**
27
-     * @param $args
28
-     */
29
-    public static function eventCoreIncludeCommonEnd($args)
30
-    {
31
-        include __DIR__ . '/autoloader.php';
32
-    }
25
+	// to add PSR-4 autoloader
26
+	/**
27
+	 * @param $args
28
+	 */
29
+	public static function eventCoreIncludeCommonEnd($args)
30
+	{
31
+		include __DIR__ . '/autoloader.php';
32
+	}
33 33
 }
Please login to merge, or discard this patch.
preloads/autoloader.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -4,29 +4,29 @@
 block discarded – undo
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6 6
 spl_autoload_register(function ($class) {
7
-    // project-specific namespace prefix
8
-    $prefix = 'Xoopsmodules\\instruction\\';
7
+	// project-specific namespace prefix
8
+	$prefix = 'Xoopsmodules\\instruction\\';
9 9
 
10
-    // base directory for the namespace prefix
11
-    $base_dir = __DIR__ . '/../class/';
10
+	// base directory for the namespace prefix
11
+	$base_dir = __DIR__ . '/../class/';
12 12
 
13
-    // does the class use the namespace prefix?
14
-    $len = strlen($prefix);
13
+	// does the class use the namespace prefix?
14
+	$len = strlen($prefix);
15 15
 
16
-    if (0 !== strncmp($prefix, $class, $len)) {
17
-        return;
18
-    }
16
+	if (0 !== strncmp($prefix, $class, $len)) {
17
+		return;
18
+	}
19 19
 
20
-    // get the relative class name
21
-    $relative_class = substr($class, $len);
20
+	// get the relative class name
21
+	$relative_class = substr($class, $len);
22 22
 
23
-    // replace the namespace prefix with the base directory, replace namespace
24
-    // separators with directory separators in the relative class name, append
25
-    // with .php
26
-    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
23
+	// replace the namespace prefix with the base directory, replace namespace
24
+	// separators with directory separators in the relative class name, append
25
+	// with .php
26
+	$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
27 27
 
28
-    // if the file exists, require it
29
-    if (file_exists($file)) {
30
-        require $file;
31
-    }
28
+	// if the file exists, require it
29
+	if (file_exists($file)) {
30
+		require $file;
31
+	}
32 32
 });
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 /**
4 4
  * @see http://www.php-fig.org/psr/psr-4/examples/
5 5
  */
6
-spl_autoload_register(function ($class) {
6
+spl_autoload_register(function($class) {
7 7
     // project-specific namespace prefix
8 8
     $prefix = 'Xoopsmodules\\instruction\\';
9 9
 
Please login to merge, or discard this patch.
class/common/VersionChecks.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
                     break;
52 52
                 }
53 53
             } else {
54
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
54
+                if ((int) $v > 0) { // handles versions like x.x.x.0_RC2
55 55
                     $success = false;
56 56
                     break;
57 57
                 }
Please login to merge, or discard this patch.
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -17,77 +17,77 @@
 block discarded – undo
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|null $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
-        //check for minimum XOOPS version
37
-        $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
38
-        $currArray  = explode('.', $currentVer);
39
-        if (null === $requiredVer) {
40
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
41
-        }
42
-        $reqArray = explode('.', $requiredVer);
43
-        $success  = true;
44
-        foreach ($reqArray as $k => $v) {
45
-            if (isset($currArray[$k])) {
46
-                if ($currArray[$k] > $v) {
47
-                    break;
48
-                } elseif ($currArray[$k] == $v) {
49
-                    continue;
50
-                } else {
51
-                    $success = false;
52
-                    break;
53
-                }
54
-            } else {
55
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
56
-                    $success = false;
57
-                    break;
58
-                }
59
-            }
60
-        }
20
+	/**
21
+	 *
22
+	 * Verifies XOOPS version meets minimum requirements for this module
23
+	 * @static
24
+	 * @param \XoopsModule|null $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
+		//check for minimum XOOPS version
37
+		$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
38
+		$currArray  = explode('.', $currentVer);
39
+		if (null === $requiredVer) {
40
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
41
+		}
42
+		$reqArray = explode('.', $requiredVer);
43
+		$success  = true;
44
+		foreach ($reqArray as $k => $v) {
45
+			if (isset($currArray[$k])) {
46
+				if ($currArray[$k] > $v) {
47
+					break;
48
+				} elseif ($currArray[$k] == $v) {
49
+					continue;
50
+				} else {
51
+					$success = false;
52
+					break;
53
+				}
54
+			} else {
55
+				if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
56
+					$success = false;
57
+					break;
58
+				}
59
+			}
60
+		}
61 61
 
62
-        if (false === $success) {
63
-            $module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
64
-        }
62
+		if (false === $success) {
63
+			$module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
64
+		}
65 65
 
66
-        return $success;
67
-    }
66
+		return $success;
67
+	}
68 68
 
69
-    /**
70
-     *
71
-     * Verifies PHP version meets minimum requirements for this module
72
-     * @static
73
-     * @param \XoopsModule $module
74
-     *
75
-     * @return bool true if meets requirements, false if not
76
-     */
77
-    public static function checkVerPhp(\XoopsModule $module)
78
-    {
79
-        xoops_loadLanguage('admin', $module->dirname());
80
-        // check for minimum PHP version
81
-        $success = true;
82
-        $verNum  = PHP_VERSION;
83
-        $reqVer  = $module->getInfo('min_php');
84
-        if (false !== $reqVer && '' !== $reqVer) {
85
-            if (version_compare($verNum, $reqVer, '<')) {
86
-                $module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_PHP, $reqVer, $verNum));
87
-                $success = false;
88
-            }
89
-        }
69
+	/**
70
+	 *
71
+	 * Verifies PHP version meets minimum requirements for this module
72
+	 * @static
73
+	 * @param \XoopsModule $module
74
+	 *
75
+	 * @return bool true if meets requirements, false if not
76
+	 */
77
+	public static function checkVerPhp(\XoopsModule $module)
78
+	{
79
+		xoops_loadLanguage('admin', $module->dirname());
80
+		// check for minimum PHP version
81
+		$success = true;
82
+		$verNum  = PHP_VERSION;
83
+		$reqVer  = $module->getInfo('min_php');
84
+		if (false !== $reqVer && '' !== $reqVer) {
85
+			if (version_compare($verNum, $reqVer, '<')) {
86
+				$module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_PHP, $reqVer, $verNum));
87
+				$success = false;
88
+			}
89
+		}
90 90
 
91
-        return $success;
92
-    }
91
+		return $success;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
class/common/Breadcrumb.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
      */
64 64
     public function render()
65 65
     {
66
-        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
66
+        if ( ! isset($GLOBALS['xoTheme']) || ! is_object($GLOBALS['xoTheme'])) {
67 67
             require_once $GLOBALS['xoops']->path('class/theme.php');
68 68
             $GLOBALS['xoTheme'] = new xos_opal_Theme();
69 69
         }
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,48 +33,48 @@
 block discarded – undo
33 33
  */
34 34
 class Breadcrumb
35 35
 {
36
-    public $dirname;
37
-    private $bread = [];
36
+	public $dirname;
37
+	private $bread = [];
38 38
 
39
-    /**
40
-     *
41
-     */
42
-    public function __construct()
43
-    {
44
-        $this->dirname = basename(dirname(dirname(__DIR__)));
45
-    }
39
+	/**
40
+	 *
41
+	 */
42
+	public function __construct()
43
+	{
44
+		$this->dirname = basename(dirname(dirname(__DIR__)));
45
+	}
46 46
 
47
-    /**
48
-     * Add link to breadcrumb
49
-     *
50
-     * @param string $title
51
-     * @param string $link
52
-     */
53
-    public function addLink($title = '', $link = '')
54
-    {
55
-        $this->bread[] = [
56
-            'link'  => $link,
57
-            'title' => $title
58
-        ];
59
-    }
47
+	/**
48
+	 * Add link to breadcrumb
49
+	 *
50
+	 * @param string $title
51
+	 * @param string $link
52
+	 */
53
+	public function addLink($title = '', $link = '')
54
+	{
55
+		$this->bread[] = [
56
+			'link'  => $link,
57
+			'title' => $title
58
+		];
59
+	}
60 60
 
61
-    /**
62
-     * Render BreadCrumb
63
-     *
64
-     */
65
-    public function render()
66
-    {
67
-        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
68
-            require_once $GLOBALS['xoops']->path('class/theme.php');
69
-            $GLOBALS['xoTheme'] = new xos_opal_Theme();
70
-        }
61
+	/**
62
+	 * Render BreadCrumb
63
+	 *
64
+	 */
65
+	public function render()
66
+	{
67
+		if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
68
+			require_once $GLOBALS['xoops']->path('class/theme.php');
69
+			$GLOBALS['xoTheme'] = new xos_opal_Theme();
70
+		}
71 71
 
72
-        require_once $GLOBALS['xoops']->path('class/template.php');
73
-        $breadcrumbTpl = new \XoopsTpl();
74
-        $breadcrumbTpl->assign('breadcrumb', $this->bread);
75
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
76
-        unset($breadcrumbTpl);
72
+		require_once $GLOBALS['xoops']->path('class/template.php');
73
+		$breadcrumbTpl = new \XoopsTpl();
74
+		$breadcrumbTpl->assign('breadcrumb', $this->bread);
75
+		$html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
76
+		unset($breadcrumbTpl);
77 77
 
78
-        return $html;
79
-    }
78
+		return $html;
79
+	}
80 80
 }
Please login to merge, or discard this patch.
class/Helper.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -24,38 +24,38 @@
 block discarded – undo
24 24
  */
25 25
 class Helper extends \Xmf\Module\Helper
26 26
 {
27
-    public $debug;
27
+	public $debug;
28 28
 
29
-    /**
30
-     * @internal param $debug
31
-     * @param bool $debug
32
-     */
33
-    protected function __construct($debug = false)
34
-    {
35
-        $this->debug   = $debug;
36
-        $this->dirname = basename(dirname(__DIR__));
37
-    }
29
+	/**
30
+	 * @internal param $debug
31
+	 * @param bool $debug
32
+	 */
33
+	protected function __construct($debug = false)
34
+	{
35
+		$this->debug   = $debug;
36
+		$this->dirname = basename(dirname(__DIR__));
37
+	}
38 38
 
39
-    /**
40
-     * @param bool $debug
41
-     *
42
-     * @return \Xoopsmodules\instruction\Helper
43
-     */
44
-    public static function getInstance($debug = false)
45
-    {
46
-        static $instance;
47
-        if (null === $instance) {
48
-            $instance = new static($debug);
49
-        }
39
+	/**
40
+	 * @param bool $debug
41
+	 *
42
+	 * @return \Xoopsmodules\instruction\Helper
43
+	 */
44
+	public static function getInstance($debug = false)
45
+	{
46
+		static $instance;
47
+		if (null === $instance) {
48
+			$instance = new static($debug);
49
+		}
50 50
 
51
-        return $instance;
52
-    }
51
+		return $instance;
52
+	}
53 53
 
54
-    /**
55
-     * @return string
56
-     */
57
-    public function getDirname()
58
-    {
59
-        return $this->dirname;
60
-    }
54
+	/**
55
+	 * @return string
56
+	 */
57
+	public function getDirname()
58
+	{
59
+		return $this->dirname;
60
+	}
61 61
 }
Please login to merge, or discard this patch.
class/PageHandler.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -12,60 +12,60 @@
 block discarded – undo
12 12
  */
13 13
 class PageHandler extends \XoopsPersistableObjectHandler
14 14
 {
15
-    /**
16
-     * @param null|mixed $db
17
-     */
18
-    public function __construct(\XoopsDatabase $db = null)
19
-    {
20
-        parent::__construct($db, 'instruction_page', Page::class, 'pageid', 'title');
21
-    }
15
+	/**
16
+	 * @param null|mixed $db
17
+	 */
18
+	public function __construct(\XoopsDatabase $db = null)
19
+	{
20
+		parent::__construct($db, 'instruction_page', Page::class, 'pageid', 'title');
21
+	}
22 22
 
23
-    /**
24
-     * Generate function for update user post
25
-     *
26
-     * @ Update user post count after send approve content
27
-     * @ Update user post count after change status content
28
-     * @ Update user post count after delete content
29
-     * @param $uid
30
-     * @param $status
31
-     * @param $action
32
-     */
33
-    public function updateposts($uid, $status, $action)
34
-    {
35
-        //
36
-        switch ($action) {
37
-            // Добавление страницы
38
-            case 'add':
39
-                if ($uid && $status) {
40
-                    $user          = new \XoopsUser($uid);
41
-                    $memberHandler = xoops_getHandler('member');
42
-                    // Добавялем +1 к комментам
43
-                    $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
44
-                }
45
-                break;
46
-            // Удаление страницы
47
-            case 'delete':
48
-                if ($uid && $status) {
49
-                    $user          = new \XoopsUser($uid);
50
-                    $memberHandler = xoops_getHandler('member');
51
-                    // Декримент комментов
52
-                    //$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 );
53
-                    // Сохраняем
54
-                    $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
55
-                }
56
-                break;
23
+	/**
24
+	 * Generate function for update user post
25
+	 *
26
+	 * @ Update user post count after send approve content
27
+	 * @ Update user post count after change status content
28
+	 * @ Update user post count after delete content
29
+	 * @param $uid
30
+	 * @param $status
31
+	 * @param $action
32
+	 */
33
+	public function updateposts($uid, $status, $action)
34
+	{
35
+		//
36
+		switch ($action) {
37
+			// Добавление страницы
38
+			case 'add':
39
+				if ($uid && $status) {
40
+					$user          = new \XoopsUser($uid);
41
+					$memberHandler = xoops_getHandler('member');
42
+					// Добавялем +1 к комментам
43
+					$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
44
+				}
45
+				break;
46
+			// Удаление страницы
47
+			case 'delete':
48
+				if ($uid && $status) {
49
+					$user          = new \XoopsUser($uid);
50
+					$memberHandler = xoops_getHandler('member');
51
+					// Декримент комментов
52
+					//$user->setVar( 'posts', $user->getVar( 'posts' ) - 1 );
53
+					// Сохраняем
54
+					$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
55
+				}
56
+				break;
57 57
 
58
-            case 'status':
59
-                if ($uid) {
60
-                    $user          = new \XoopsUser($uid);
61
-                    $memberHandler = xoops_getHandler('member');
62
-                    if ($status) {
63
-                        $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
64
-                    } else {
65
-                        $memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
66
-                    }
67
-                }
68
-                break;
69
-        }
70
-    }
58
+			case 'status':
59
+				if ($uid) {
60
+					$user          = new \XoopsUser($uid);
61
+					$memberHandler = xoops_getHandler('member');
62
+					if ($status) {
63
+						$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') - 1);
64
+					} else {
65
+						$memberHandler->updateUserByField($user, 'posts', $user->getVar('posts') + 1);
66
+					}
67
+				}
68
+				break;
69
+		}
70
+	}
71 71
 }
Please login to merge, or discard this patch.
class/Category.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         //        $categoryHandler = xoops_getModuleHandler('category', 'instruction');
93 93
         $criteria = new \CriteriaCompo();
94 94
         // Если мы редактируем, то убрать текущую категорию из списка выбора родительской
95
-        if (!$this->isNew()) {
95
+        if ( ! $this->isNew()) {
96 96
             $criteria->add(new \Criteria('cid', $this->getVar('cid'), '<>'));
97 97
         }
98 98
         $criteria->setSort('weight ASC, title');
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         // Права на просмотр
139 139
         $groups_ids = [];
140 140
         // Если мы редактируем
141
-        if (!$this->isNew()) {
141
+        if ( ! $this->isNew()) {
142 142
             $groups_ids        = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
143 143
             $groups_ids        = array_values($groups_ids);
144 144
             $groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 
151 151
         // Права на отправку
152 152
         $groups_ids = [];
153
-        if (!$this->isNew()) {
153
+        if ( ! $this->isNew()) {
154 154
             $groups_ids          = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
155 155
             $groups_ids          = array_values($groups_ids);
156 156
             $groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
         // Права на редактирование
164 164
         $groups_ids = [];
165
-        if (!$this->isNew()) {
165
+        if ( ! $this->isNew()) {
166 166
             $groups_ids        = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
167 167
             $groups_ids        = array_values($groups_ids);
168 168
             $groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         // ==========================================================
177 177
 
178 178
         // Если мы редактируем категорию
179
-        if (!$this->isNew()) {
179
+        if ( ! $this->isNew()) {
180 180
             $form->addElement(new \XoopsFormHidden('cid', $this->getVar('cid')));
181 181
             //$form->addElement( new \XoopsFormHidden( 'catmodify', true));
182 182
         }
Please login to merge, or discard this patch.
Indentation   +157 added lines, -157 removed lines patch added patch discarded remove patch
@@ -16,60 +16,60 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class Category extends \XoopsObject
18 18
 {
19
-    // constructor
20
-    public function __construct()
21
-    {
22
-        //		$this->XoopsObject();
23
-        $this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5);
24
-        $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5);
25
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
26
-        $this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false);
27
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
28
-        $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
29
-        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
30
-        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
31
-        $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
32
-        $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
33
-    }
34
-
35
-    /**
36
-     * @return mixed
37
-     */
38
-    public function getNewInstertId()
39
-    {
40
-        $newEnreg = $GLOBALS['xoopsDB']->getInsertId();
41
-        return $newEnreg;
42
-    }
43
-
44
-    // Получаем форму
45
-
46
-    /**
47
-     * @param bool|null|string $action
48
-     * @return \XoopsThemeForm
49
-     */
50
-    public function getForm($action = false)
51
-    {
52
-        //global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
53
-        require_once __DIR__ . '/../include/common.php';
54
-        // Если нет $action
55
-        if (false === $action) {
56
-            $action = xoops_getenv('REQUEST_URI');
57
-        }
58
-        // Подключаем формы
59
-        include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
60
-
61
-        // Название формы
62
-        $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT);
63
-
64
-        // Форма
65
-        $form = new \XoopsThemeForm($title, 'formcat', $action, 'post', true);
66
-        //$form->setExtra('enctype="multipart/form-data"');
67
-        // Название категории
68
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
69
-        // Редактор
70
-        $form->addElement(new \XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true);
71
-        //image
72
-        /*
19
+	// constructor
20
+	public function __construct()
21
+	{
22
+		//		$this->XoopsObject();
23
+		$this->initVar('cid', XOBJ_DTYPE_INT, null, false, 5);
24
+		$this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 5);
25
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
26
+		$this->initVar('imgurl', XOBJ_DTYPE_TXTBOX, '', false);
27
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
28
+		$this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
29
+		$this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
30
+		$this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
31
+		$this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
32
+		$this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
33
+	}
34
+
35
+	/**
36
+	 * @return mixed
37
+	 */
38
+	public function getNewInstertId()
39
+	{
40
+		$newEnreg = $GLOBALS['xoopsDB']->getInsertId();
41
+		return $newEnreg;
42
+	}
43
+
44
+	// Получаем форму
45
+
46
+	/**
47
+	 * @param bool|null|string $action
48
+	 * @return \XoopsThemeForm
49
+	 */
50
+	public function getForm($action = false)
51
+	{
52
+		//global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
53
+		require_once __DIR__ . '/../include/common.php';
54
+		// Если нет $action
55
+		if (false === $action) {
56
+			$action = xoops_getenv('REQUEST_URI');
57
+		}
58
+		// Подключаем формы
59
+		include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
60
+
61
+		// Название формы
62
+		$title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDCAT) : sprintf(_AM_INSTRUCTION_FORMEDITCAT);
63
+
64
+		// Форма
65
+		$form = new \XoopsThemeForm($title, 'formcat', $action, 'post', true);
66
+		//$form->setExtra('enctype="multipart/form-data"');
67
+		// Название категории
68
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
69
+		// Редактор
70
+		$form->addElement(new \XoopsFormTextArea(_AM_INSTRUCTION_DSCC, 'description', $this->getVar('description', 'e')), true);
71
+		//image
72
+		/*
73 73
         $downloadscat_img = $this->getVar('imgurl') ? $this->getVar('imgurl') : 'blank.gif';
74 74
         $uploadirectory='/uploads/tdmdownloads/images/cats';
75 75
         $imgtray = new \XoopsFormElementTray(_AM_TDMDOWNLOADS_FORMIMG,'<br>');
@@ -88,107 +88,107 @@  discard block
 block discarded – undo
88 88
         $imgtray->addElement($fileseltray);
89 89
         $form->addElement($imgtray);
90 90
         */
91
-        // Родительская категория
92
-        //        $categoryHandler = xoops_getModuleHandler('category', 'instruction');
93
-        $criteria = new \CriteriaCompo();
94
-        // Если мы редактируем, то убрать текущую категорию из списка выбора родительской
95
-        if (!$this->isNew()) {
96
-            $criteria->add(new \Criteria('cid', $this->getVar('cid'), '<>'));
97
-        }
98
-        $criteria->setSort('weight ASC, title');
99
-        $criteria->setOrder('ASC');
100
-
101
-        $categoryHandler    = new CategoryHandler;
102
-        $instructioncat_arr = $categoryHandler->getall($criteria);
103
-        unset($criteria);
104
-        // Подключаем трей
105
-        include_once $GLOBALS['xoops']->path('class/tree.php');
106
-        $mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
107
-
108
-        // $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
109
-
110
-        $helper = Helper::getInstance();
111
-        $module = $helper->getModule();
112
-
113
-        if (Utility::checkVerXoops($module, '2.5.9')) {
114
-            $mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC);
115
-            $form->addElement($mytree_select);
116
-        } else {
117
-            $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
118
-        }
119
-
120
-        // Вес
121
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
122
-        // Мета-теги ключевых слов
123
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
124
-        // Мета-теги описания
125
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
126
-
127
-        // ==========================================================
128
-        // ==========================================================
129
-
130
-        // Права
131
-        $memberHandler = xoops_getHandler('member');
132
-        $group_list    = $memberHandler->getGroupList();
133
-        $gpermHandler  = xoops_getHandler('groupperm');
134
-        $full_list     = array_keys($group_list);
135
-
136
-        // Права на просмотр
137
-        $groups_ids = [];
138
-        // Если мы редактируем
139
-        if (!$this->isNew()) {
140
-            $groups_ids        = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
141
-            $groups_ids        = array_values($groups_ids);
142
-            $groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids);
143
-        } else {
144
-            $groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list);
145
-        }
146
-        $groups_instr_view->addOptionArray($group_list);
147
-        $form->addElement($groups_instr_view);
148
-
149
-        // Права на отправку
150
-        $groups_ids = [];
151
-        if (!$this->isNew()) {
152
-            $groups_ids          = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
153
-            $groups_ids          = array_values($groups_ids);
154
-            $groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids);
155
-        } else {
156
-            $groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list);
157
-        }
158
-        $groups_instr_submit->addOptionArray($group_list);
159
-        $form->addElement($groups_instr_submit);
160
-
161
-        // Права на редактирование
162
-        $groups_ids = [];
163
-        if (!$this->isNew()) {
164
-            $groups_ids        = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
165
-            $groups_ids        = array_values($groups_ids);
166
-            $groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids);
167
-        } else {
168
-            $groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list);
169
-        }
170
-        $groups_instr_edit->addOptionArray($group_list);
171
-        $form->addElement($groups_instr_edit);
172
-
173
-        // ==========================================================
174
-        // ==========================================================
175
-
176
-        // Если мы редактируем категорию
177
-        if (!$this->isNew()) {
178
-            $form->addElement(new \XoopsFormHidden('cid', $this->getVar('cid')));
179
-            //$form->addElement( new \XoopsFormHidden( 'catmodify', true));
180
-        }
181
-        //
182
-        $form->addElement(new \XoopsFormHidden('op', 'savecat'));
183
-        // Кнопка
184
-        $button_tray = new \XoopsFormElementTray('', '');
185
-        $submit_btn  = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
186
-        $button_tray->addElement($submit_btn);
187
-        $cancel_btn = new \XoopsFormButton('', 'cancel', _CANCEL, 'cancel');
188
-        $cancel_btn->setExtra('onclick="javascript:history.go(-1);"');
189
-        $button_tray->addElement($cancel_btn);
190
-        $form->addElement($button_tray);
191
-
192
-        return $form;
193
-    }
91
+		// Родительская категория
92
+		//        $categoryHandler = xoops_getModuleHandler('category', 'instruction');
93
+		$criteria = new \CriteriaCompo();
94
+		// Если мы редактируем, то убрать текущую категорию из списка выбора родительской
95
+		if (!$this->isNew()) {
96
+			$criteria->add(new \Criteria('cid', $this->getVar('cid'), '<>'));
97
+		}
98
+		$criteria->setSort('weight ASC, title');
99
+		$criteria->setOrder('ASC');
100
+
101
+		$categoryHandler    = new CategoryHandler;
102
+		$instructioncat_arr = $categoryHandler->getall($criteria);
103
+		unset($criteria);
104
+		// Подключаем трей
105
+		include_once $GLOBALS['xoops']->path('class/tree.php');
106
+		$mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
107
+
108
+		// $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
109
+
110
+		$helper = Helper::getInstance();
111
+		$module = $helper->getModule();
112
+
113
+		if (Utility::checkVerXoops($module, '2.5.9')) {
114
+			$mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PCATC);
115
+			$form->addElement($mytree_select);
116
+		} else {
117
+			$form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PCATC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
118
+		}
119
+
120
+		// Вес
121
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
122
+		// Мета-теги ключевых слов
123
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
124
+		// Мета-теги описания
125
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
126
+
127
+		// ==========================================================
128
+		// ==========================================================
129
+
130
+		// Права
131
+		$memberHandler = xoops_getHandler('member');
132
+		$group_list    = $memberHandler->getGroupList();
133
+		$gpermHandler  = xoops_getHandler('groupperm');
134
+		$full_list     = array_keys($group_list);
135
+
136
+		// Права на просмотр
137
+		$groups_ids = [];
138
+		// Если мы редактируем
139
+		if (!$this->isNew()) {
140
+			$groups_ids        = $gpermHandler->getGroupIds('instruction_view', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
141
+			$groups_ids        = array_values($groups_ids);
142
+			$groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $groups_ids);
143
+		} else {
144
+			$groups_instr_view = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_VIEW, 'groups_instr_view', $full_list);
145
+		}
146
+		$groups_instr_view->addOptionArray($group_list);
147
+		$form->addElement($groups_instr_view);
148
+
149
+		// Права на отправку
150
+		$groups_ids = [];
151
+		if (!$this->isNew()) {
152
+			$groups_ids          = $gpermHandler->getGroupIds('instruction_submit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
153
+			$groups_ids          = array_values($groups_ids);
154
+			$groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $groups_ids);
155
+		} else {
156
+			$groups_instr_submit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_SUBMIT, 'groups_instr_submit', $full_list);
157
+		}
158
+		$groups_instr_submit->addOptionArray($group_list);
159
+		$form->addElement($groups_instr_submit);
160
+
161
+		// Права на редактирование
162
+		$groups_ids = [];
163
+		if (!$this->isNew()) {
164
+			$groups_ids        = $gpermHandler->getGroupIds('instruction_edit', $this->getVar('cid'), $GLOBALS['xoopsModule']->getVar('mid'));
165
+			$groups_ids        = array_values($groups_ids);
166
+			$groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $groups_ids);
167
+		} else {
168
+			$groups_instr_edit = new \XoopsFormCheckBox(_AM_INSTRUCTION_PERM_EDIT, 'groups_instr_edit', $full_list);
169
+		}
170
+		$groups_instr_edit->addOptionArray($group_list);
171
+		$form->addElement($groups_instr_edit);
172
+
173
+		// ==========================================================
174
+		// ==========================================================
175
+
176
+		// Если мы редактируем категорию
177
+		if (!$this->isNew()) {
178
+			$form->addElement(new \XoopsFormHidden('cid', $this->getVar('cid')));
179
+			//$form->addElement( new \XoopsFormHidden( 'catmodify', true));
180
+		}
181
+		//
182
+		$form->addElement(new \XoopsFormHidden('op', 'savecat'));
183
+		// Кнопка
184
+		$button_tray = new \XoopsFormElementTray('', '');
185
+		$submit_btn  = new \XoopsFormButton('', 'submit', _SUBMIT, 'submit');
186
+		$button_tray->addElement($submit_btn);
187
+		$cancel_btn = new \XoopsFormButton('', 'cancel', _CANCEL, 'cancel');
188
+		$cancel_btn->setExtra('onclick="javascript:history.go(-1);"');
189
+		$button_tray->addElement($cancel_btn);
190
+		$form->addElement($button_tray);
191
+
192
+		return $form;
193
+	}
194 194
 }
Please login to merge, or discard this patch.