Completed
Push — master ( 22f988...f05393 )
by Michael
01:55
created
class/common/VersionChecks.php 1 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_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
64
-        }
62
+		if (false === $success) {
63
+			$module->setErrors(sprintf(_AM_WFL_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_WFL_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_WFL_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/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/CategoryHandler.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,28 +16,28 @@
 block discarded – undo
16 16
  */
17 17
 class CategoryHandler extends \XoopsPersistableObjectHandler
18 18
 {
19
-    /**
20
-     * @param null|mixed $db
21
-     */
22
-    public function __construct(\XoopsDatabase $db = null)
23
-    {
24
-        parent::__construct($db, 'instruction_cat', Category::class, 'cid', 'title');
25
-    }
19
+	/**
20
+	 * @param null|mixed $db
21
+	 */
22
+	public function __construct(\XoopsDatabase $db = null)
23
+	{
24
+		parent::__construct($db, 'instruction_cat', Category::class, 'cid', 'title');
25
+	}
26 26
 
27
-    // Обновление даты обновления категории
27
+	// Обновление даты обновления категории
28 28
 
29
-    /**
30
-     * @param int  $cid
31
-     * @param null|int $time
32
-     * @return mixed
33
-     */
34
-    public function updateDateupdated($cid = 0, $time = null)
35
-    {
36
-        // Если не передали время
37
-        $time = null === $time ? time() : (int)$time;
38
-        //
39
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
40
-        //
41
-        return $this->db->query($sql);
42
-    }
29
+	/**
30
+	 * @param int  $cid
31
+	 * @param null|int $time
32
+	 * @return mixed
33
+	 */
34
+	public function updateDateupdated($cid = 0, $time = null)
35
+	{
36
+		// Если не передали время
37
+		$time = null === $time ? time() : (int)$time;
38
+		//
39
+		$sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
40
+		//
41
+		return $this->db->query($sql);
42
+	}
43 43
 }
Please login to merge, or discard this patch.
class/InstructionHandler.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -14,51 +14,51 @@
 block discarded – undo
14 14
  */
15 15
 class InstructionHandler extends \XoopsPersistableObjectHandler
16 16
 {
17
-    /**
18
-     * @param null|mixed $db
19
-     */
20
-    public function __construct(\XoopsDatabase $db = null)
21
-    {
22
-        parent::__construct($db, 'instruction_instr', Instruction::class, 'instrid', 'title');
23
-    }
17
+	/**
18
+	 * @param null|mixed $db
19
+	 */
20
+	public function __construct(\XoopsDatabase $db = null)
21
+	{
22
+		parent::__construct($db, 'instruction_instr', Instruction::class, 'instrid', 'title');
23
+	}
24 24
 
25
-    // Обновление даты обновления инструкций
25
+	// Обновление даты обновления инструкций
26 26
 
27
-    /**
28
-     * @param int  $instrid
29
-     * @param bool|int $time
30
-     * @return mixed
31
-     */
32
-    public function updateDateupdated($instrid = 0, $time = null)
33
-    {
34
-        // Если не передали время
35
-        $time = null === $time ? time() : (int)$time;
36
-        //
37
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
38
-        //
39
-        return $this->db->query($sql);
40
-    }
27
+	/**
28
+	 * @param int  $instrid
29
+	 * @param bool|int $time
30
+	 * @return mixed
31
+	 */
32
+	public function updateDateupdated($instrid = 0, $time = null)
33
+	{
34
+		// Если не передали время
35
+		$time = null === $time ? time() : (int)$time;
36
+		//
37
+		$sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
38
+		//
39
+		return $this->db->query($sql);
40
+	}
41 41
 
42
-    // Обновление числа страниц
42
+	// Обновление числа страниц
43 43
 
44
-    /**
45
-     * @param int $instrid
46
-     * @return mixed
47
-     */
48
-    public function updatePages($instrid = 0)
49
-    {
50
-        //        $pageHandler = xoops_getModuleHandler('page', 'instruction');
51
-        // Находим число активных страниц
52
-        $criteria = new \CriteriaCompo();
53
-        $criteria->add(new \Criteria('instrid', $instrid, '='));
54
-        $criteria->add(new \Criteria('status ', '0', '>'));
55
-        // Число страниц
56
-        $pages = $pageHandler->getCount($criteria);
57
-        unset($criteria);
44
+	/**
45
+	 * @param int $instrid
46
+	 * @return mixed
47
+	 */
48
+	public function updatePages($instrid = 0)
49
+	{
50
+		//        $pageHandler = xoops_getModuleHandler('page', 'instruction');
51
+		// Находим число активных страниц
52
+		$criteria = new \CriteriaCompo();
53
+		$criteria->add(new \Criteria('instrid', $instrid, '='));
54
+		$criteria->add(new \Criteria('status ', '0', '>'));
55
+		// Число страниц
56
+		$pages = $pageHandler->getCount($criteria);
57
+		unset($criteria);
58 58
 
59
-        // Сохраняем это число
60
-        $sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid);
61
-        //
62
-        return $this->db->query($sql);
63
-    }
59
+		// Сохраняем это число
60
+		$sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid);
61
+		//
62
+		return $this->db->query($sql);
63
+	}
64 64
 }
Please login to merge, or discard this patch.
include/comment_functions.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function instruction_com_update($pageid, $total_num)
11 11
 {
12
-    $db  = XoopsDatabaseFactory::getDatabaseConnection();
13
-    $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid  = ' . $pageid;
14
-    $db->query($sql);
12
+	$db  = XoopsDatabaseFactory::getDatabaseConnection();
13
+	$sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid  = ' . $pageid;
14
+	$db->query($sql);
15 15
 }
16 16
 
17 17
 /**
@@ -19,5 +19,5 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function instruction_com_approve(&$comment)
21 21
 {
22
-    // notification mail here
22
+	// notification mail here
23 23
 }
Please login to merge, or discard this patch.
include/config.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -23,57 +23,57 @@
 block discarded – undo
23 23
 $capsDirName   = strtoupper($moduleDirName);
24 24
 
25 25
 if (!defined($capsDirName . '_DIRNAME')) {
26
-    //if (!defined(constant($capsDirName . '_DIRNAME'))) {
27
-    define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname());
28
-    define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
29
-    define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME'));
30
-    define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php');
31
-    define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
32
-    define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png');
33
-    define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
34
-    define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
26
+	//if (!defined(constant($capsDirName . '_DIRNAME'))) {
27
+	define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname());
28
+	define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
29
+	define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME'));
30
+	define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php');
31
+	define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME'));
32
+	define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png');
33
+	define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash
34
+	define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash
35 35
 }
36 36
 
37 37
 //Configurator
38 38
 return (object)[
39
-    'name'          => strtoupper($moduleDirName) . ' Module Configurator',
40
-    'paths'         => [
41
-        'dirname'    => $moduleDirName,
42
-        'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
43
-        //        'path'       => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
44
-        //        'url'        => XOOPS_URL . '/modules/' . $moduleDirName,
45
-        'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
46
-        'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
47
-    ],
48
-    'uploadFolders' => [
49
-        constant($capsDirName . '_UPLOAD_PATH'),
50
-        //constant($capsDirName . '_UPLOAD_PATH') . '/category',
51
-        //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
52
-        //XOOPS_UPLOAD_PATH . '/flags'
53
-    ],
54
-    'blankFiles'    => [
55
-        constant($capsDirName . '_UPLOAD_PATH'),
56
-        //constant($capsDirName . '_UPLOAD_PATH') . '/category',
57
-        //constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
58
-        //XOOPS_UPLOAD_PATH . '/flags'
59
-    ],
39
+	'name'          => strtoupper($moduleDirName) . ' Module Configurator',
40
+	'paths'         => [
41
+		'dirname'    => $moduleDirName,
42
+		'admin'      => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin',
43
+		//        'path'       => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName,
44
+		//        'url'        => XOOPS_URL . '/modules/' . $moduleDirName,
45
+		'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName,
46
+		'uploadUrl'  => XOOPS_UPLOAD_URL . '/' . $moduleDirName,
47
+	],
48
+	'uploadFolders' => [
49
+		constant($capsDirName . '_UPLOAD_PATH'),
50
+		//constant($capsDirName . '_UPLOAD_PATH') . '/category',
51
+		//constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
52
+		//XOOPS_UPLOAD_PATH . '/flags'
53
+	],
54
+	'blankFiles'    => [
55
+		constant($capsDirName . '_UPLOAD_PATH'),
56
+		//constant($capsDirName . '_UPLOAD_PATH') . '/category',
57
+		//constant($capsDirName . '_UPLOAD_PATH') . '/screenshots',
58
+		//XOOPS_UPLOAD_PATH . '/flags'
59
+	],
60 60
 
61
-    'templateFolders' => [
62
-        '/templates/',
63
-        '/templates/blocks/',
64
-        '/templates/admin/'
61
+	'templateFolders' => [
62
+		'/templates/',
63
+		'/templates/blocks/',
64
+		'/templates/admin/'
65 65
 
66
-    ],
67
-    'oldFiles'        => [//        '/sql/mysql.sql',
68
-    ],
69
-    'oldFolders'      => [
70
-        '/images',
71
-        '/css',
72
-        '/js',
73
-        '/tree',
74
-        '/images/icons/16',
75
-        '/images/icons/32',
76
-    ],
77
-    'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
66
+	],
67
+	'oldFiles'        => [//        '/sql/mysql.sql',
68
+	],
69
+	'oldFolders'      => [
70
+		'/images',
71
+		'/css',
72
+		'/js',
73
+		'/tree',
74
+		'/images/icons/16',
75
+		'/images/icons/32',
76
+	],
77
+	'modCopyright'    => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'>
78 78
                      <img src='" . $capsDirName . '_AUTHOR_LOGOIMG' . '\' alt=\'XOOPS Project\' /></a>',
79 79
 ];
Please login to merge, or discard this patch.
class/Instruction.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -12,115 +12,115 @@
 block discarded – undo
12 12
  */
13 13
 class Instruction extends \XoopsObject
14 14
 {
15
-    // constructor
16
-    public function __construct()
17
-    {
18
-        //		$this->XoopsObject();
19
-        $this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11);
20
-        $this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5);
21
-        $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
22
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
23
-        $this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1);
24
-        $this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11);
25
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
26
-        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
27
-        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
28
-        $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
29
-        $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
30
-
31
-        // Нет в таблице
32
-        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
33
-        $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false);
34
-    }
35
-
36
-    /**
37
-     * @return mixed
38
-     */
39
-    public function getNewInstertId()
40
-    {
41
-        $newEnreg = $GLOBALS['xoopsDB']->getInsertId();
42
-        return $newEnreg;
43
-    }
44
-
45
-    // Получаем форму
46
-
47
-    /**
48
-     * @param bool|null|string $action
49
-     * @return \XoopsThemeForm
50
-     */
51
-    public function getForm($action = false)
52
-    {
53
-        global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
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_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR);
63
-
64
-        // Форма
65
-        $form = new \XoopsThemeForm($title, 'forminstr', $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
-        $categoryHandler = new CategoryHandler;
71
-        $criteria        = new \CriteriaCompo();
72
-        $criteria->setSort('weight ASC, title');
73
-        $criteria->setOrder('ASC');
74
-        $instructioncat_arr = $categoryHandler->getall($criteria);
75
-        unset($criteria);
76
-        // Подключаем трей
77
-        include_once $GLOBALS['xoops']->path('class/tree.php');
78
-        $mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
79
-
80
-        // $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
81
-        $helper = Helper::getInstance();
82
-        $module = $helper->getModule();
83
-
84
-        if (Utility::checkVerXoops($module, '2.5.9')) {
85
-            $mytree_select = $mytree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', _AM_INSTRUCTION_CATC);
86
-            $form->addElement($mytree_select);
87
-        } else {
88
-            $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
89
-        }
90
-
91
-        // Описание
92
-        $form->addElement(Utility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true);
93
-        // Статус
94
-        $form->addElement(new \XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
95
-
96
-        // Теги
97
-        $dir_tag_ok = false;
98
-        if (is_dir('../../tag') || is_dir('../tag')) {
99
-            $dir_tag_ok = true;
100
-        }
101
-        // Если влючена поддержка тегов и есть модуль tag
102
-        if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) {
103
-            $itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid');
104
-            // Подключаем форму тегов
105
-            include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
106
-            // Добавляем элемент в форму
107
-            $form->addElement(new \XoopsFormTag('tag', 60, 255, $itemIdForTag, 0));
108
-        }
109
-
110
-        // Мета-теги ключевых слов
111
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
112
-        // Мета-теги описания
113
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
114
-
115
-        // Если мы редактируем категорию
116
-        if (!$this->isNew()) {
117
-            $form->addElement(new \XoopsFormHidden('instrid', $this->getVar('instrid')));
118
-        }
119
-        //
120
-        $form->addElement(new \XoopsFormHidden('op', 'saveinstr'));
121
-        // Кнопка
122
-        $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
123
-        return $form;
124
-    }
15
+	// constructor
16
+	public function __construct()
17
+	{
18
+		//		$this->XoopsObject();
19
+		$this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11);
20
+		$this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5);
21
+		$this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
22
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
23
+		$this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1);
24
+		$this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11);
25
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
26
+		$this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
27
+		$this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
28
+		$this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
29
+		$this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
30
+
31
+		// Нет в таблице
32
+		$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
33
+		$this->initVar('dobr', XOBJ_DTYPE_INT, 0, false);
34
+	}
35
+
36
+	/**
37
+	 * @return mixed
38
+	 */
39
+	public function getNewInstertId()
40
+	{
41
+		$newEnreg = $GLOBALS['xoopsDB']->getInsertId();
42
+		return $newEnreg;
43
+	}
44
+
45
+	// Получаем форму
46
+
47
+	/**
48
+	 * @param bool|null|string $action
49
+	 * @return \XoopsThemeForm
50
+	 */
51
+	public function getForm($action = false)
52
+	{
53
+		global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
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_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR);
63
+
64
+		// Форма
65
+		$form = new \XoopsThemeForm($title, 'forminstr', $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
+		$categoryHandler = new CategoryHandler;
71
+		$criteria        = new \CriteriaCompo();
72
+		$criteria->setSort('weight ASC, title');
73
+		$criteria->setOrder('ASC');
74
+		$instructioncat_arr = $categoryHandler->getall($criteria);
75
+		unset($criteria);
76
+		// Подключаем трей
77
+		include_once $GLOBALS['xoops']->path('class/tree.php');
78
+		$mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
79
+
80
+		// $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
81
+		$helper = Helper::getInstance();
82
+		$module = $helper->getModule();
83
+
84
+		if (Utility::checkVerXoops($module, '2.5.9')) {
85
+			$mytree_select = $mytree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', _AM_INSTRUCTION_CATC);
86
+			$form->addElement($mytree_select);
87
+		} else {
88
+			$form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
89
+		}
90
+
91
+		// Описание
92
+		$form->addElement(Utility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true);
93
+		// Статус
94
+		$form->addElement(new \XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
95
+
96
+		// Теги
97
+		$dir_tag_ok = false;
98
+		if (is_dir('../../tag') || is_dir('../tag')) {
99
+			$dir_tag_ok = true;
100
+		}
101
+		// Если влючена поддержка тегов и есть модуль tag
102
+		if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) {
103
+			$itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid');
104
+			// Подключаем форму тегов
105
+			include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
106
+			// Добавляем элемент в форму
107
+			$form->addElement(new \XoopsFormTag('tag', 60, 255, $itemIdForTag, 0));
108
+		}
109
+
110
+		// Мета-теги ключевых слов
111
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
112
+		// Мета-теги описания
113
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
114
+
115
+		// Если мы редактируем категорию
116
+		if (!$this->isNew()) {
117
+			$form->addElement(new \XoopsFormHidden('instrid', $this->getVar('instrid')));
118
+		}
119
+		//
120
+		$form->addElement(new \XoopsFormHidden('op', 'saveinstr'));
121
+		// Кнопка
122
+		$form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
123
+		return $form;
124
+	}
125 125
 }
126 126
 
Please login to merge, or discard this patch.
include/common.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@
 block discarded – undo
70 70
 $debug = false;
71 71
 
72 72
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
73
-    require_once $GLOBALS['xoops']->path('class/template.php');
74
-    $xoopsTpl = new \XoopsTpl();
73
+	require_once $GLOBALS['xoops']->path('class/template.php');
74
+	$xoopsTpl = new \XoopsTpl();
75 75
 }
76 76
 
77 77
 $moduleDirName = basename(dirname(__DIR__));
Please login to merge, or discard this patch.