Passed
Pull Request — master (#2)
by Michael
07:10 queued 03:28
created
class/Utf8mapHandler.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -17,98 +17,98 @@
 block discarded – undo
17 17
  */
18 18
 class Utf8mapHandler extends XoopsPersistableObjectHandler
19 19
 {
20
-    /**
21
-     * Utf8mapHandler constructor.
22
-     * @param \XoopsDatabase $db
23
-     */
24
-    public function __construct(XoopsDatabase $db)
25
-    {
26
-        parent::__construct($db, 'songlist_utf8map', Utf8map::class, 'utfid', 'from');
27
-    }
20
+	/**
21
+	 * Utf8mapHandler constructor.
22
+	 * @param \XoopsDatabase $db
23
+	 */
24
+	public function __construct(XoopsDatabase $db)
25
+	{
26
+		parent::__construct($db, 'songlist_utf8map', Utf8map::class, 'utfid', 'from');
27
+	}
28 28
 
29
-    /**
30
-     * @return array
31
-     */
32
-    public function filterFields(): array
33
-    {
34
-        return ['utfid', 'from', 'to', 'created', 'updated'];
35
-    }
29
+	/**
30
+	 * @return array
31
+	 */
32
+	public function filterFields(): array
33
+	{
34
+		return ['utfid', 'from', 'to', 'created', 'updated'];
35
+	}
36 36
 
37
-    /**
38
-     * @param $filter
39
-     * @return \CriteriaCompo
40
-     */
41
-    public function getFilterCriteria($filter): CriteriaCompo
42
-    {
43
-        $parts    = \explode('|', $filter);
44
-        $criteria = new CriteriaCompo();
45
-        foreach ($parts as $part) {
46
-            $var = \explode(',', $part);
47
-            if (!empty($var[1]) && !\is_numeric($var[0])) {
48
-                $object = $this->create();
49
-                if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
50
-                    || \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
51
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
52
-                } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
53
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
54
-                } elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
55
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
56
-                } elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
57
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
58
-                }
59
-            } elseif (!empty($var[1]) && \is_numeric($var[0])) {
60
-                $criteria->add(new Criteria($var[0], $var[1]));
61
-            }
62
-        }
37
+	/**
38
+	 * @param $filter
39
+	 * @return \CriteriaCompo
40
+	 */
41
+	public function getFilterCriteria($filter): CriteriaCompo
42
+	{
43
+		$parts    = \explode('|', $filter);
44
+		$criteria = new CriteriaCompo();
45
+		foreach ($parts as $part) {
46
+			$var = \explode(',', $part);
47
+			if (!empty($var[1]) && !\is_numeric($var[0])) {
48
+				$object = $this->create();
49
+				if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
50
+					|| \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
51
+					$criteria->add(new Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
52
+				} elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
53
+					$criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
54
+				} elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
55
+					$criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
56
+				} elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
57
+					$criteria->add(new Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
58
+				}
59
+			} elseif (!empty($var[1]) && \is_numeric($var[0])) {
60
+				$criteria->add(new Criteria($var[0], $var[1]));
61
+			}
62
+		}
63 63
 
64
-        return $criteria;
65
-    }
64
+		return $criteria;
65
+	}
66 66
 
67
-    /**
68
-     * @param        $filter
69
-     * @param        $field
70
-     * @param string $sort
71
-     * @param string $op
72
-     * @param string $fct
73
-     * @return string
74
-     */
75
-    public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
76
-    {
77
-        $ele = Utility::getFilterElement($filter, $field, $sort, $op, $fct);
78
-        if (\is_object($ele)) {
79
-            return $ele->render();
80
-        }
67
+	/**
68
+	 * @param        $filter
69
+	 * @param        $field
70
+	 * @param string $sort
71
+	 * @param string $op
72
+	 * @param string $fct
73
+	 * @return string
74
+	 */
75
+	public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
76
+	{
77
+		$ele = Utility::getFilterElement($filter, $field, $sort, $op, $fct);
78
+		if (\is_object($ele)) {
79
+			return $ele->render();
80
+		}
81 81
 
82
-        return ' ';
83
-    }
82
+		return ' ';
83
+	}
84 84
 
85
-    /**
86
-     * @param bool $force
87
-     * @return mixed
88
-     */
89
-    public function insert(XoopsObject $obj, $force = true)
90
-    {
91
-        if ($obj->isNew()) {
92
-            $obj->setVar('created', \time());
93
-        } else {
94
-            $obj->setVar('updated', \time());
95
-        }
85
+	/**
86
+	 * @param bool $force
87
+	 * @return mixed
88
+	 */
89
+	public function insert(XoopsObject $obj, $force = true)
90
+	{
91
+		if ($obj->isNew()) {
92
+			$obj->setVar('created', \time());
93
+		} else {
94
+			$obj->setVar('updated', \time());
95
+		}
96 96
 
97
-        return parent::insert($obj, $force);
98
-    }
97
+		return parent::insert($obj, $force);
98
+	}
99 99
 
100
-    /**
101
-     * @param string $phrase
102
-     * @param null   $criteria
103
-     * @return string|string[]
104
-     */
105
-    public function convert($phrase = '', $criteria = null)
106
-    {
107
-        foreach ($this->getObjects($criteria, true) as $utfid => $utf8) {
108
-            $phrase = \str_replace(mb_strtolower($utf8->getVar('from')), \mb_strtolower($utf8->getVar('to')), $phrase);
109
-            $phrase = \str_replace(mb_strtoupper($utf8->getVar('from')), \mb_strtoupper($utf8->getVar('to')), $phrase);
110
-        }
100
+	/**
101
+	 * @param string $phrase
102
+	 * @param null   $criteria
103
+	 * @return string|string[]
104
+	 */
105
+	public function convert($phrase = '', $criteria = null)
106
+	{
107
+		foreach ($this->getObjects($criteria, true) as $utfid => $utf8) {
108
+			$phrase = \str_replace(mb_strtolower($utf8->getVar('from')), \mb_strtolower($utf8->getVar('to')), $phrase);
109
+			$phrase = \str_replace(mb_strtoupper($utf8->getVar('from')), \mb_strtoupper($utf8->getVar('to')), $phrase);
110
+		}
111 111
 
112
-        return $phrase;
113
-    }
112
+		return $phrase;
113
+	}
114 114
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use XoopsObject;
9 9
 use XoopsPersistableObjectHandler;
10 10
 
11
-require_once \dirname(__DIR__) . '/include/songlist.object.php';
11
+require_once \dirname(__DIR__).'/include/songlist.object.php';
12 12
 // require_once \dirname(__DIR__) . '/include/songlist.form.php';
13 13
 use  XoopsModules\Songlist\Form\FormController;
14 14
 
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
             $var = \explode(',', $part);
47 47
             if (!empty($var[1]) && !\is_numeric($var[0])) {
48 48
                 $object = $this->create();
49
-                if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
50
-                    || \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
51
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
49
+                if (\XOBJ_DTYPE_TXTBOX==$object->vars[$var[0]]['data_type']
50
+                    || \XOBJ_DTYPE_TXTAREA==$object->vars[$var[0]]['data_type']) {
51
+                    $criteria->add(new Criteria('`'.$var[0].'`', '%'.$var[1].'%', ($var[2] ?? 'LIKE')));
52 52
                 } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
53
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
54
-                } elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
55
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
56
-                } elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
57
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
53
+                    $criteria->add(new Criteria('`'.$var[0].'`', $var[1], ($var[2] ?? '=')));
54
+                } elseif (\XOBJ_DTYPE_ENUM==$object->vars[$var[0]]['data_type']) {
55
+                    $criteria->add(new Criteria('`'.$var[0].'`', $var[1], ($var[2] ?? '=')));
56
+                } elseif (\XOBJ_DTYPE_ARRAY==$object->vars[$var[0]]['data_type']) {
57
+                    $criteria->add(new Criteria('`'.$var[0].'`', '%"'.$var[1].'";%', ($var[2] ?? 'LIKE')));
58 58
                 }
59 59
             } elseif (!empty($var[1]) && \is_numeric($var[0])) {
60 60
                 $criteria->add(new Criteria($var[0], $var[1]));
Please login to merge, or discard this patch.
class/Genre.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace XoopsModules\Songlist;
4 4
 
5
-require_once \dirname(__DIR__) . '/include/songlist.object.php';
5
+require_once \dirname(__DIR__).'/include/songlist.object.php';
6 6
 // require_once \dirname(__DIR__) . '/include/songlist.form.php';
7 7
 use  XoopsModules\Songlist\Form\FormController;
8 8
 
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
             $ret['form'][$key] = $element->render();
50 50
         }
51 51
         foreach (['created', 'updated'] as $key) {
52
-            if ($this->getVar($key) > 0) {
52
+            if ($this->getVar($key)>0) {
53 53
                 $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
54 54
                 $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
55 55
             }
56 56
         }
57
-        $ret['rank'] = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
57
+        $ret['rank'] = \number_format(($this->getVar('rank')>0 && $this->getVar('votes')>0 ? $this->getVar('rank')/$this->getVar('votes') : 0), 2).\_MI_SONGLIST_OFTEN;
58 58
 
59 59
         return $ret;
60 60
     }
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
                    . $GLOBALS['songlistModuleConfig']['endofurl'];
89 89
         }
90 90
 
91
-        return XOOPS_URL . '/modules/songlist/' . $file . '.php?op=' . $op . '&fct=' . $fct . '&id=' . $this->getVar('gid') . '&value=' . \urlencode($value ?? '') . '&gid=' . $gid . '&cid=' . $cid;
91
+        return XOOPS_URL.'/modules/songlist/'.$file.'.php?op='.$op.'&fct='.$fct.'&id='.$this->getVar('gid').'&value='.\urlencode($value ?? '').'&gid='.$gid.'&cid='.$cid;
92 92
     }
93 93
 }
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -12,94 +12,94 @@
 block discarded – undo
12 12
  */
13 13
 class Genre extends \XoopsObject
14 14
 {
15
-    public $gid;
16
-    public $name;
17
-    public $artists;
18
-    public $albums;
19
-    public $songs;
20
-    public $hits;
21
-    public $rank;
22
-    public $votes;
23
-    public $created;
24
-    public $updated;
15
+	public $gid;
16
+	public $name;
17
+	public $artists;
18
+	public $albums;
19
+	public $songs;
20
+	public $hits;
21
+	public $rank;
22
+	public $votes;
23
+	public $created;
24
+	public $updated;
25 25
 
26
-    /**
27
-     * Genre constructor.
28
-     * @param null $fid
29
-     */
30
-    public function __construct($fid = null)
31
-    {
32
-        $this->initVar('gid', \XOBJ_DTYPE_INT, 0, false);
33
-        $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
34
-        $this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
35
-        $this->initVar('albums', \XOBJ_DTYPE_INT, 0, false);
36
-        $this->initVar('songs', \XOBJ_DTYPE_INT, 0, false);
37
-        $this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
38
-        $this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
39
-        $this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
40
-        $this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
41
-        $this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
42
-    }
26
+	/**
27
+	 * Genre constructor.
28
+	 * @param null $fid
29
+	 */
30
+	public function __construct($fid = null)
31
+	{
32
+		$this->initVar('gid', \XOBJ_DTYPE_INT, 0, false);
33
+		$this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
34
+		$this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
35
+		$this->initVar('albums', \XOBJ_DTYPE_INT, 0, false);
36
+		$this->initVar('songs', \XOBJ_DTYPE_INT, 0, false);
37
+		$this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
38
+		$this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
39
+		$this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
40
+		$this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
41
+		$this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
42
+	}
43 43
 
44
-    /**
45
-     * @param bool $as_array
46
-     * @return array|string
47
-     */
48
-    public function getForm($as_array = false)
49
-    {
50
-        return FormController::getFormGenre($this, $as_array);
51
-    }
44
+	/**
45
+	 * @param bool $as_array
46
+	 * @return array|string
47
+	 */
48
+	public function getForm($as_array = false)
49
+	{
50
+		return FormController::getFormGenre($this, $as_array);
51
+	}
52 52
 
53
-    /**
54
-     * @return array
55
-     */
56
-    public function toArray(): array
57
-    {
58
-        $ret  = parent::toArray();
59
-        $form = $this->getForm(true);
60
-        foreach ($form as $key => $element) {
61
-            $ret['form'][$key] = $element->render();
62
-        }
63
-        foreach (['created', 'updated'] as $key) {
64
-            if ($this->getVar($key) > 0) {
65
-                $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
66
-                $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
67
-            }
68
-        }
69
-        $ret['rank'] = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
53
+	/**
54
+	 * @return array
55
+	 */
56
+	public function toArray(): array
57
+	{
58
+		$ret  = parent::toArray();
59
+		$form = $this->getForm(true);
60
+		foreach ($form as $key => $element) {
61
+			$ret['form'][$key] = $element->render();
62
+		}
63
+		foreach (['created', 'updated'] as $key) {
64
+			if ($this->getVar($key) > 0) {
65
+				$ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
66
+				$ret[$key]         = \date(_DATESTRING, $this->getVar($key));
67
+			}
68
+		}
69
+		$ret['rank'] = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
70 70
 
71
-        return $ret;
72
-    }
71
+		return $ret;
72
+	}
73 73
 
74
-    /**
75
-     * @return string
76
-     */
77
-    public function getURL(): string
78
-    {
79
-        global $file, $op, $fct, $id, $value, $gid, $cid, $start, $limit;
80
-        if ($GLOBALS['songlistModuleConfig']['htaccess']) {
81
-            return XOOPS_URL
82
-                   . '/'
83
-                   . $GLOBALS['songlistModuleConfig']['baseurl']
84
-                   . '/'
85
-                   . $file
86
-                   . '/'
87
-                   . \urlencode(\str_replace([' ', \chr(9)], '-', $this->getVar('name')))
88
-                   . '/'
89
-                   . $op
90
-                   . '-'
91
-                   . $fct
92
-                   . '-'
93
-                   . $this->getVar('gid')
94
-                   . '-'
95
-                   . \urlencode($value)
96
-                   . '-'
97
-                   . $gid
98
-                   . '-'
99
-                   . $cid
100
-                   . $GLOBALS['songlistModuleConfig']['endofurl'];
101
-        }
74
+	/**
75
+	 * @return string
76
+	 */
77
+	public function getURL(): string
78
+	{
79
+		global $file, $op, $fct, $id, $value, $gid, $cid, $start, $limit;
80
+		if ($GLOBALS['songlistModuleConfig']['htaccess']) {
81
+			return XOOPS_URL
82
+				   . '/'
83
+				   . $GLOBALS['songlistModuleConfig']['baseurl']
84
+				   . '/'
85
+				   . $file
86
+				   . '/'
87
+				   . \urlencode(\str_replace([' ', \chr(9)], '-', $this->getVar('name')))
88
+				   . '/'
89
+				   . $op
90
+				   . '-'
91
+				   . $fct
92
+				   . '-'
93
+				   . $this->getVar('gid')
94
+				   . '-'
95
+				   . \urlencode($value)
96
+				   . '-'
97
+				   . $gid
98
+				   . '-'
99
+				   . $cid
100
+				   . $GLOBALS['songlistModuleConfig']['endofurl'];
101
+		}
102 102
 
103
-        return XOOPS_URL . '/modules/songlist/' . $file . '.php?op=' . $op . '&fct=' . $fct . '&id=' . $this->getVar('gid') . '&value=' . \urlencode($value ?? '') . '&gid=' . $gid . '&cid=' . $cid;
104
-    }
103
+		return XOOPS_URL . '/modules/songlist/' . $file . '.php?op=' . $op . '&fct=' . $fct . '&id=' . $this->getVar('gid') . '&value=' . \urlencode($value ?? '') . '&gid=' . $gid . '&cid=' . $cid;
104
+	}
105 105
 }
Please login to merge, or discard this patch.
class/ExtrasHandler.php 2 patches
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -11,213 +11,213 @@
 block discarded – undo
11 11
  */
12 12
 class ExtrasHandler extends XoopsPersistableObjectHandler
13 13
 {
14
-    /**
15
-     * holds reference to {@link ObjectsFieldHandler} object
16
-     */
17
-    public $_fHandler;
18
-    /**
19
-     * Array of {@link XoopsObjectsField} objects
20
-     * @var array
21
-     */
22
-    public $_fields = [];
23
-
24
-    /**
25
-     * ExtrasHandler constructor.
26
-     * @param \XoopsDatabase $db
27
-     */
28
-    public function __construct(XoopsDatabase $db)
29
-    {
30
-        parent::__construct($db, 'songlist_extra', Extras::class, 'sid');
31
-        $this->_fHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Field');
32
-    }
33
-
34
-    /**
35
-     * create a new {@link Extras}
36
-     *
37
-     * @param bool $isNew Flag the new objects as "new"?
38
-     *
39
-     * @return object {@link Extras}
40
-     */
41
-    public function &create($isNew = true): object
42
-    {
43
-        $obj          = new $this->className($this->loadFields());
44
-        $obj->handler = $this;
45
-        $obj->setNew();
46
-
47
-        return $obj;
48
-    }
49
-
50
-    /**
51
-     * Get a {@link Extras}
52
-     *
53
-     * @param null $id
54
-     * @param null $fields
55
-     * @return object <a href='psi_element://Extras'>Extras</a>
56
-     */
57
-    public function get($id = null, $fields = null): object //get($uid, $createOnFailure = true)
58
-    {
59
-        if (null === $fields) {
60
-            $fields = true;
61
-        }
62
-        $obj = parent::get($id);
63
-        if (!\is_object($obj) && $fields) {
64
-            $obj = $this->create();
65
-        }
66
-
67
-        return $obj;
68
-    }
69
-
70
-    /**
71
-     * Create new {@link ObjectsField} object
72
-     *
73
-     * @param bool $isNew
74
-     *
75
-     * @return object
76
-     */
77
-    public function &createField($isNew = true): object
78
-    {
79
-        $return = $this->_fHandler->create($isNew);
80
-
81
-        return $return;
82
-    }
83
-
84
-    /**
85
-     * Load field information
86
-     *
87
-     * @return array|false
88
-     */
89
-    public function loadFields()
90
-    {
91
-        if (0 == \count($this->_fields)) {
92
-            $this->_fields = $this->_fHandler->loadFields();
93
-        }
94
-
95
-        return (0 == $this->_fields || empty($this->_fields) ? false : $this->_fields);
96
-    }
97
-
98
-    /**
99
-     * @return array
100
-     */
101
-    public function getPostVars(): array
102
-    {
103
-        return ['sid', 'cid', 'gid', 'aids', 'abid', 'songid', 'title', 'lyrics', 'hits', 'rank', 'votes', 'tags', 'created', 'updated'];
104
-    }
105
-
106
-    /**
107
-     * @param      $criteria
108
-     * @param bool $id_as_key
109
-     * @param bool $as_object
110
-     * @return array
111
-     */
112
-    public function getFields($criteria, $id_as_key = true, $as_object = true): array
113
-    {
114
-        return $this->_fHandler->getObjects($criteria, $id_as_key, $as_object);
115
-    }
116
-
117
-    /**
118
-     * Insert a field in the database
119
-     *
120
-     * @param XoopsObject $field
121
-     * @param bool   $force
122
-     * @return mixed|void
123
-     */
124
-    public function insertField($field, $force = false)
125
-    {
126
-        return $this->_fHandler->insert($field, $force);
127
-    }
128
-
129
-    /**
130
-     * Delete a field from the database
131
-     *
132
-     * @param XoopsObject $field
133
-     * @param bool   $force
134
-     * @return bool
135
-     */
136
-    public function deleteField($field, $force = false)
137
-    {
138
-        return $this->_fHandler->delete($field, $force);
139
-    }
140
-
141
-    /**
142
-     * Save a new field in the database
143
-     *
144
-     * @param array $vars array of variables, taken from $module->loadInfo('Extras')['field']
145
-     * @param int   $weight
146
-     * @return string
147
-     * @internal param int $categoryid ID of the category to add it to
148
-     * @internal param int $type valuetype of the field
149
-     * @internal param int $moduleid ID of the module, this field belongs to
150
-     */
151
-    public function saveField($vars, $weight = 0): string
152
-    {
153
-        $field = $this->createField();
154
-        $field->setVar('field_name', $vars['name']);
155
-        $field->setVar('field_valuetype', $vars['valuetype']);
156
-        $field->setVar('field_type', $vars['type']);
157
-        $field->setVar('field_weight', $weight);
158
-        if (isset($vars['title'])) {
159
-            $field->setVar('field_title', $vars['title']);
160
-        }
161
-        if (isset($vars['description'])) {
162
-            $field->setVar('field_description', $vars['description']);
163
-        }
164
-        if (isset($vars['required'])) {
165
-            $field->setVar('field_required', $vars['required']); //0 = no, 1 = yes
166
-        }
167
-        if (isset($vars['maxlength'])) {
168
-            $field->setVar('field_maxlength', $vars['maxlength']);
169
-        }
170
-        if (isset($vars['default'])) {
171
-            $field->setVar('field_default', $vars['default']);
172
-        }
173
-        if (isset($vars['notnull'])) {
174
-            $field->setVar('field_notnull', $vars['notnull']);
175
-        }
176
-        if (isset($vars['show'])) {
177
-            $field->setVar('field_show', $vars['show']);
178
-        }
179
-        if (isset($vars['edit'])) {
180
-            $field->setVar('field_edit', $vars['edit']);
181
-        }
182
-        if (isset($vars['config'])) {
183
-            $field->setVar('field_config', $vars['config']);
184
-        }
185
-        if (isset($vars['options'])) {
186
-            $field->setVar('field_options', $vars['options']);
187
-        } else {
188
-            $field->setVar('field_options', []);
189
-        }
190
-        if ($this->insertField($field)) {
191
-            $msg = '&nbsp;&nbsp;Field <b>' . $vars['name'] . '</b> added to the database';
192
-        } else {
193
-            $msg = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not insert field <b>' . $vars['name'] . '</b> into the database. ' . \implode(' ', $field->getErrors()) . $this->db->error() . '</span>';
194
-        }
195
-        unset($field);
196
-
197
-        return $msg;
198
-    }
199
-
200
-    /**
201
-     * insert a new object in the database
202
-     *
203
-     * @param \XoopsObject $obj         reference to the object
204
-     * @param bool         $force       whether to force the query execution despite security settings
205
-     * @param bool         $checkObject check if the object is dirty and clean the attributes
206
-     *
207
-     * @return bool FALSE if failed, TRUE if already present and unchanged or successful
208
-     */
209
-    public function insert(XoopsObject $obj, $force = false, $checkObject = true): bool
210
-    {
211
-        $uservars = $this->getPostVars();
212
-        foreach ($uservars as $var) {
213
-            if ('sid' != $var) {
214
-                unset($obj->vars[$var]);
215
-            }
216
-        }
217
-        if (0 == \count($obj->vars)) {
218
-            return true;
219
-        }
220
-
221
-        return (bool)parent::insert($obj, $force, $checkObject);
222
-    }
14
+	/**
15
+	 * holds reference to {@link ObjectsFieldHandler} object
16
+	 */
17
+	public $_fHandler;
18
+	/**
19
+	 * Array of {@link XoopsObjectsField} objects
20
+	 * @var array
21
+	 */
22
+	public $_fields = [];
23
+
24
+	/**
25
+	 * ExtrasHandler constructor.
26
+	 * @param \XoopsDatabase $db
27
+	 */
28
+	public function __construct(XoopsDatabase $db)
29
+	{
30
+		parent::__construct($db, 'songlist_extra', Extras::class, 'sid');
31
+		$this->_fHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Field');
32
+	}
33
+
34
+	/**
35
+	 * create a new {@link Extras}
36
+	 *
37
+	 * @param bool $isNew Flag the new objects as "new"?
38
+	 *
39
+	 * @return object {@link Extras}
40
+	 */
41
+	public function &create($isNew = true): object
42
+	{
43
+		$obj          = new $this->className($this->loadFields());
44
+		$obj->handler = $this;
45
+		$obj->setNew();
46
+
47
+		return $obj;
48
+	}
49
+
50
+	/**
51
+	 * Get a {@link Extras}
52
+	 *
53
+	 * @param null $id
54
+	 * @param null $fields
55
+	 * @return object <a href='psi_element://Extras'>Extras</a>
56
+	 */
57
+	public function get($id = null, $fields = null): object //get($uid, $createOnFailure = true)
58
+	{
59
+		if (null === $fields) {
60
+			$fields = true;
61
+		}
62
+		$obj = parent::get($id);
63
+		if (!\is_object($obj) && $fields) {
64
+			$obj = $this->create();
65
+		}
66
+
67
+		return $obj;
68
+	}
69
+
70
+	/**
71
+	 * Create new {@link ObjectsField} object
72
+	 *
73
+	 * @param bool $isNew
74
+	 *
75
+	 * @return object
76
+	 */
77
+	public function &createField($isNew = true): object
78
+	{
79
+		$return = $this->_fHandler->create($isNew);
80
+
81
+		return $return;
82
+	}
83
+
84
+	/**
85
+	 * Load field information
86
+	 *
87
+	 * @return array|false
88
+	 */
89
+	public function loadFields()
90
+	{
91
+		if (0 == \count($this->_fields)) {
92
+			$this->_fields = $this->_fHandler->loadFields();
93
+		}
94
+
95
+		return (0 == $this->_fields || empty($this->_fields) ? false : $this->_fields);
96
+	}
97
+
98
+	/**
99
+	 * @return array
100
+	 */
101
+	public function getPostVars(): array
102
+	{
103
+		return ['sid', 'cid', 'gid', 'aids', 'abid', 'songid', 'title', 'lyrics', 'hits', 'rank', 'votes', 'tags', 'created', 'updated'];
104
+	}
105
+
106
+	/**
107
+	 * @param      $criteria
108
+	 * @param bool $id_as_key
109
+	 * @param bool $as_object
110
+	 * @return array
111
+	 */
112
+	public function getFields($criteria, $id_as_key = true, $as_object = true): array
113
+	{
114
+		return $this->_fHandler->getObjects($criteria, $id_as_key, $as_object);
115
+	}
116
+
117
+	/**
118
+	 * Insert a field in the database
119
+	 *
120
+	 * @param XoopsObject $field
121
+	 * @param bool   $force
122
+	 * @return mixed|void
123
+	 */
124
+	public function insertField($field, $force = false)
125
+	{
126
+		return $this->_fHandler->insert($field, $force);
127
+	}
128
+
129
+	/**
130
+	 * Delete a field from the database
131
+	 *
132
+	 * @param XoopsObject $field
133
+	 * @param bool   $force
134
+	 * @return bool
135
+	 */
136
+	public function deleteField($field, $force = false)
137
+	{
138
+		return $this->_fHandler->delete($field, $force);
139
+	}
140
+
141
+	/**
142
+	 * Save a new field in the database
143
+	 *
144
+	 * @param array $vars array of variables, taken from $module->loadInfo('Extras')['field']
145
+	 * @param int   $weight
146
+	 * @return string
147
+	 * @internal param int $categoryid ID of the category to add it to
148
+	 * @internal param int $type valuetype of the field
149
+	 * @internal param int $moduleid ID of the module, this field belongs to
150
+	 */
151
+	public function saveField($vars, $weight = 0): string
152
+	{
153
+		$field = $this->createField();
154
+		$field->setVar('field_name', $vars['name']);
155
+		$field->setVar('field_valuetype', $vars['valuetype']);
156
+		$field->setVar('field_type', $vars['type']);
157
+		$field->setVar('field_weight', $weight);
158
+		if (isset($vars['title'])) {
159
+			$field->setVar('field_title', $vars['title']);
160
+		}
161
+		if (isset($vars['description'])) {
162
+			$field->setVar('field_description', $vars['description']);
163
+		}
164
+		if (isset($vars['required'])) {
165
+			$field->setVar('field_required', $vars['required']); //0 = no, 1 = yes
166
+		}
167
+		if (isset($vars['maxlength'])) {
168
+			$field->setVar('field_maxlength', $vars['maxlength']);
169
+		}
170
+		if (isset($vars['default'])) {
171
+			$field->setVar('field_default', $vars['default']);
172
+		}
173
+		if (isset($vars['notnull'])) {
174
+			$field->setVar('field_notnull', $vars['notnull']);
175
+		}
176
+		if (isset($vars['show'])) {
177
+			$field->setVar('field_show', $vars['show']);
178
+		}
179
+		if (isset($vars['edit'])) {
180
+			$field->setVar('field_edit', $vars['edit']);
181
+		}
182
+		if (isset($vars['config'])) {
183
+			$field->setVar('field_config', $vars['config']);
184
+		}
185
+		if (isset($vars['options'])) {
186
+			$field->setVar('field_options', $vars['options']);
187
+		} else {
188
+			$field->setVar('field_options', []);
189
+		}
190
+		if ($this->insertField($field)) {
191
+			$msg = '&nbsp;&nbsp;Field <b>' . $vars['name'] . '</b> added to the database';
192
+		} else {
193
+			$msg = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not insert field <b>' . $vars['name'] . '</b> into the database. ' . \implode(' ', $field->getErrors()) . $this->db->error() . '</span>';
194
+		}
195
+		unset($field);
196
+
197
+		return $msg;
198
+	}
199
+
200
+	/**
201
+	 * insert a new object in the database
202
+	 *
203
+	 * @param \XoopsObject $obj         reference to the object
204
+	 * @param bool         $force       whether to force the query execution despite security settings
205
+	 * @param bool         $checkObject check if the object is dirty and clean the attributes
206
+	 *
207
+	 * @return bool FALSE if failed, TRUE if already present and unchanged or successful
208
+	 */
209
+	public function insert(XoopsObject $obj, $force = false, $checkObject = true): bool
210
+	{
211
+		$uservars = $this->getPostVars();
212
+		foreach ($uservars as $var) {
213
+			if ('sid' != $var) {
214
+				unset($obj->vars[$var]);
215
+			}
216
+		}
217
+		if (0 == \count($obj->vars)) {
218
+			return true;
219
+		}
220
+
221
+		return (bool)parent::insert($obj, $force, $checkObject);
222
+	}
223 223
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     public function get($id = null, $fields = null): object //get($uid, $createOnFailure = true)
58 58
     {
59
-        if (null === $fields) {
59
+        if (null===$fields) {
60 60
             $fields = true;
61 61
         }
62 62
         $obj = parent::get($id);
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function loadFields()
90 90
     {
91
-        if (0 == \count($this->_fields)) {
91
+        if (0==\count($this->_fields)) {
92 92
             $this->_fields = $this->_fHandler->loadFields();
93 93
         }
94 94
 
95
-        return (0 == $this->_fields || empty($this->_fields) ? false : $this->_fields);
95
+        return (0==$this->_fields || empty($this->_fields) ? false : $this->_fields);
96 96
     }
97 97
 
98 98
     /**
@@ -188,9 +188,9 @@  discard block
 block discarded – undo
188 188
             $field->setVar('field_options', []);
189 189
         }
190 190
         if ($this->insertField($field)) {
191
-            $msg = '&nbsp;&nbsp;Field <b>' . $vars['name'] . '</b> added to the database';
191
+            $msg = '&nbsp;&nbsp;Field <b>'.$vars['name'].'</b> added to the database';
192 192
         } else {
193
-            $msg = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not insert field <b>' . $vars['name'] . '</b> into the database. ' . \implode(' ', $field->getErrors()) . $this->db->error() . '</span>';
193
+            $msg = '&nbsp;&nbsp;<span style="color:#ff0000;">ERROR: Could not insert field <b>'.$vars['name'].'</b> into the database. '.\implode(' ', $field->getErrors()).$this->db->error().'</span>';
194 194
         }
195 195
         unset($field);
196 196
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
     {
211 211
         $uservars = $this->getPostVars();
212 212
         foreach ($uservars as $var) {
213
-            if ('sid' != $var) {
213
+            if ('sid'!=$var) {
214 214
                 unset($obj->vars[$var]);
215 215
             }
216 216
         }
217
-        if (0 == \count($obj->vars)) {
217
+        if (0==\count($obj->vars)) {
218 218
             return true;
219 219
         }
220 220
 
221
-        return (bool)parent::insert($obj, $force, $checkObject);
221
+        return (bool) parent::insert($obj, $force, $checkObject);
222 222
     }
223 223
 }
Please login to merge, or discard this patch.
class/CategoryHandler.php 2 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -7,165 +7,165 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class CategoryHandler extends \XoopsPersistableObjectHandler
9 9
 {
10
-    /**
11
-     * CategoryHandler constructor.
12
-     * @param \XoopsDatabase $db
13
-     */
14
-    public function __construct(\XoopsDatabase $db)
15
-    {
16
-        parent::__construct($db, 'songlist_category', Category::class, 'cid', 'name');
17
-    }
18
-
19
-    /**
20
-     * @return array
21
-     */
22
-    public function filterFields(): array
23
-    {
24
-        return ['cid', 'pid', 'weight', 'name', 'image', 'path', 'artists', 'albums', 'songs', 'hits', 'rank', 'votes', 'created', 'updated'];
25
-    }
26
-
27
-    /**
28
-     * @param $filter
29
-     * @return \CriteriaCompo
30
-     */
31
-    public function getFilterCriteria($filter): \CriteriaCompo
32
-    {
33
-        $parts    = \explode('|', $filter);
34
-        $criteria = new \CriteriaCompo();
35
-        foreach ($parts as $part) {
36
-            $var = \explode(',', $part);
37
-            if (!empty($var[1]) && !\is_numeric($var[0])) {
38
-                $object = $this->create();
39
-                if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
40
-                    || \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
41
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
42
-                } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
43
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
44
-                } elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
45
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
46
-                } elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
47
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
48
-                }
49
-            } elseif (!empty($var[1]) && \is_numeric($var[0])) {
50
-                $criteria->add(new \Criteria($var[0], $var[1]));
51
-            }
52
-        }
53
-
54
-        return $criteria;
55
-    }
56
-
57
-    /**
58
-     * @param        $filter
59
-     * @param        $field
60
-     * @param string $sort
61
-     * @param string $op
62
-     * @param string $fct
63
-     * @return string
64
-     */
65
-    public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
66
-    {
67
-        $ele = Utility::getFilterElement($filter, $field, $sort, $op, $fct);
68
-        if (\is_object($ele)) {
69
-            return $ele->render();
70
-        }
71
-
72
-        return '&nbsp;';
73
-    }
74
-
75
-    /**
76
-     * @param int $pid
77
-     * @return mixed
78
-     */
79
-    public function GetCatAndSubCat($pid = 0)
80
-    {
81
-        $categories  = $this->getObjects(new \Criteria('pid', $pid), true);
82
-        $langs_array = $this->TreeIDs([], $categories, -1);
83
-
84
-        return $langs_array;
85
-    }
86
-
87
-    /**
88
-     * @param $langs_array
89
-     * @param $categories
90
-     * @param $level
91
-     * @return mixed
92
-     */
93
-    private function TreeIDs($langs_array, $categories, $level)
94
-    {
95
-        foreach ($categories as $catid => $category) {
96
-            $langs_array[$catid] = $catid;
97
-            $categoriesb         = $this->getObjects(new \Criteria('pid', $catid), true);
98
-            if ($categoriesb) {
99
-                $langs_array = $this->TreeIDs($langs_array, $categoriesb, $level);
100
-            }
101
-        }
102
-
103
-        return $langs_array;
104
-    }
105
-
106
-    /**
107
-     * @param bool $force
108
-     * @return bool|mixed
109
-     */
110
-    public function insert(\XoopsObject $obj, $force = true)
111
-    {
112
-        if ($obj->isNew()) {
113
-            $obj->setVar('created', \time());
114
-        } else {
115
-            $obj->setVar('updated', \time());
116
-        }
117
-        if ('' == $obj->getVar('name')) {
118
-            return false;
119
-        }
120
-
121
-        return parent::insert($obj, $force);
122
-    }
123
-
124
-    public $_objects = ['object' => [], 'array' => []];
125
-
126
-    /**
127
-     * @param null $id
128
-     * @param null $fields
129
-     * @return \XoopsObject
130
-     */
131
-    public function get($id = null, $fields = null): \XoopsObject//get($id, $fields = '*')
132
-    {
133
-        $fields = $fields ?: '*';
134
-        if (!isset($this->_objects['object'][$id])) {
135
-            $this->_objects['object'][$id] = parent::get($id, $fields);
136
-            if (!isset($GLOBALS['songlistAdmin'])) {
137
-                $sql = 'UPDATE `' . $this->table . '` set hits=hits+1 where `' . $this->keyName . '` = ' . $id;
138
-                $GLOBALS['xoopsDB']->queryF($sql);
139
-            }
140
-        }
141
-
142
-        return $this->_objects['object'][$id];
143
-    }
144
-
145
-    /**
146
-     * @param \XoopsObject $object
147
-     * @param bool         $force
148
-     * @return bool
149
-     */
150
-    public function delete(\XoopsObject $object, $force = true): bool
151
-    {
152
-        parent::delete($object, $force);
153
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . ' SET `cid` = 0 WHERE `cid` = ' . $object->getVar('cid');
154
-
155
-        return $GLOBALS['xoopsDB']->queryF($sql);
156
-    }
157
-
158
-    /**
159
-     * @param \CriteriaElement|\CriteriaCompo $criteria
160
-     * @param bool $id_as_key
161
-     * @param bool $as_object
162
-     * @return array
163
-     */
164
-    public function &getObjects($criteria = null, $id_as_key = false, $as_object = true): array
165
-    {
166
-        $ret = parent::getObjects($criteria, $id_as_key, $as_object);
167
-
168
-        /*if (!isset($GLOBALS['songlistAdmin'])) {
10
+	/**
11
+	 * CategoryHandler constructor.
12
+	 * @param \XoopsDatabase $db
13
+	 */
14
+	public function __construct(\XoopsDatabase $db)
15
+	{
16
+		parent::__construct($db, 'songlist_category', Category::class, 'cid', 'name');
17
+	}
18
+
19
+	/**
20
+	 * @return array
21
+	 */
22
+	public function filterFields(): array
23
+	{
24
+		return ['cid', 'pid', 'weight', 'name', 'image', 'path', 'artists', 'albums', 'songs', 'hits', 'rank', 'votes', 'created', 'updated'];
25
+	}
26
+
27
+	/**
28
+	 * @param $filter
29
+	 * @return \CriteriaCompo
30
+	 */
31
+	public function getFilterCriteria($filter): \CriteriaCompo
32
+	{
33
+		$parts    = \explode('|', $filter);
34
+		$criteria = new \CriteriaCompo();
35
+		foreach ($parts as $part) {
36
+			$var = \explode(',', $part);
37
+			if (!empty($var[1]) && !\is_numeric($var[0])) {
38
+				$object = $this->create();
39
+				if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
40
+					|| \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
41
+					$criteria->add(new \Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
42
+				} elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
43
+					$criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
44
+				} elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
45
+					$criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
46
+				} elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
47
+					$criteria->add(new \Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
48
+				}
49
+			} elseif (!empty($var[1]) && \is_numeric($var[0])) {
50
+				$criteria->add(new \Criteria($var[0], $var[1]));
51
+			}
52
+		}
53
+
54
+		return $criteria;
55
+	}
56
+
57
+	/**
58
+	 * @param        $filter
59
+	 * @param        $field
60
+	 * @param string $sort
61
+	 * @param string $op
62
+	 * @param string $fct
63
+	 * @return string
64
+	 */
65
+	public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
66
+	{
67
+		$ele = Utility::getFilterElement($filter, $field, $sort, $op, $fct);
68
+		if (\is_object($ele)) {
69
+			return $ele->render();
70
+		}
71
+
72
+		return '&nbsp;';
73
+	}
74
+
75
+	/**
76
+	 * @param int $pid
77
+	 * @return mixed
78
+	 */
79
+	public function GetCatAndSubCat($pid = 0)
80
+	{
81
+		$categories  = $this->getObjects(new \Criteria('pid', $pid), true);
82
+		$langs_array = $this->TreeIDs([], $categories, -1);
83
+
84
+		return $langs_array;
85
+	}
86
+
87
+	/**
88
+	 * @param $langs_array
89
+	 * @param $categories
90
+	 * @param $level
91
+	 * @return mixed
92
+	 */
93
+	private function TreeIDs($langs_array, $categories, $level)
94
+	{
95
+		foreach ($categories as $catid => $category) {
96
+			$langs_array[$catid] = $catid;
97
+			$categoriesb         = $this->getObjects(new \Criteria('pid', $catid), true);
98
+			if ($categoriesb) {
99
+				$langs_array = $this->TreeIDs($langs_array, $categoriesb, $level);
100
+			}
101
+		}
102
+
103
+		return $langs_array;
104
+	}
105
+
106
+	/**
107
+	 * @param bool $force
108
+	 * @return bool|mixed
109
+	 */
110
+	public function insert(\XoopsObject $obj, $force = true)
111
+	{
112
+		if ($obj->isNew()) {
113
+			$obj->setVar('created', \time());
114
+		} else {
115
+			$obj->setVar('updated', \time());
116
+		}
117
+		if ('' == $obj->getVar('name')) {
118
+			return false;
119
+		}
120
+
121
+		return parent::insert($obj, $force);
122
+	}
123
+
124
+	public $_objects = ['object' => [], 'array' => []];
125
+
126
+	/**
127
+	 * @param null $id
128
+	 * @param null $fields
129
+	 * @return \XoopsObject
130
+	 */
131
+	public function get($id = null, $fields = null): \XoopsObject//get($id, $fields = '*')
132
+	{
133
+		$fields = $fields ?: '*';
134
+		if (!isset($this->_objects['object'][$id])) {
135
+			$this->_objects['object'][$id] = parent::get($id, $fields);
136
+			if (!isset($GLOBALS['songlistAdmin'])) {
137
+				$sql = 'UPDATE `' . $this->table . '` set hits=hits+1 where `' . $this->keyName . '` = ' . $id;
138
+				$GLOBALS['xoopsDB']->queryF($sql);
139
+			}
140
+		}
141
+
142
+		return $this->_objects['object'][$id];
143
+	}
144
+
145
+	/**
146
+	 * @param \XoopsObject $object
147
+	 * @param bool         $force
148
+	 * @return bool
149
+	 */
150
+	public function delete(\XoopsObject $object, $force = true): bool
151
+	{
152
+		parent::delete($object, $force);
153
+		$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . ' SET `cid` = 0 WHERE `cid` = ' . $object->getVar('cid');
154
+
155
+		return $GLOBALS['xoopsDB']->queryF($sql);
156
+	}
157
+
158
+	/**
159
+	 * @param \CriteriaElement|\CriteriaCompo $criteria
160
+	 * @param bool $id_as_key
161
+	 * @param bool $as_object
162
+	 * @return array
163
+	 */
164
+	public function &getObjects($criteria = null, $id_as_key = false, $as_object = true): array
165
+	{
166
+		$ret = parent::getObjects($criteria, $id_as_key, $as_object);
167
+
168
+		/*if (!isset($GLOBALS['songlistAdmin'])) {
169 169
             $id = [];
170 170
             foreach($ret as $data) {
171 171
                 if ($as_object==true) {
@@ -186,25 +186,25 @@  discard block
 block discarded – undo
186 186
             $GLOBALS['xoopsDB']->queryF($sql);
187 187
         }*/
188 188
 
189
-        return $ret;
190
-    }
191
-
192
-    /**
193
-     * @param int $limit
194
-     * @return array
195
-     */
196
-    public function getTop($limit = 1): array
197
-    {
198
-        $sql     = 'SELECT * FROM `' . $this->table . '` WHERE `rank`>=0 ORDER BY (`rank`/`votes`) DESC LIMIT ' . $limit;
199
-        $results = $GLOBALS['xoopsDB']->queryF($sql);
200
-        $ret     = [];
201
-        $i       = 0;
202
-        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($results))) {
203
-            $ret[$i] = $this->create();
204
-            $ret[$i]->assignVars($row);
205
-            ++$i;
206
-        }
207
-
208
-        return $ret;
209
-    }
189
+		return $ret;
190
+	}
191
+
192
+	/**
193
+	 * @param int $limit
194
+	 * @return array
195
+	 */
196
+	public function getTop($limit = 1): array
197
+	{
198
+		$sql     = 'SELECT * FROM `' . $this->table . '` WHERE `rank`>=0 ORDER BY (`rank`/`votes`) DESC LIMIT ' . $limit;
199
+		$results = $GLOBALS['xoopsDB']->queryF($sql);
200
+		$ret     = [];
201
+		$i       = 0;
202
+		while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($results))) {
203
+			$ret[$i] = $this->create();
204
+			$ret[$i]->assignVars($row);
205
+			++$i;
206
+		}
207
+
208
+		return $ret;
209
+	}
210 210
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
             $var = \explode(',', $part);
37 37
             if (!empty($var[1]) && !\is_numeric($var[0])) {
38 38
                 $object = $this->create();
39
-                if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
40
-                    || \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
41
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
39
+                if (\XOBJ_DTYPE_TXTBOX==$object->vars[$var[0]]['data_type']
40
+                    || \XOBJ_DTYPE_TXTAREA==$object->vars[$var[0]]['data_type']) {
41
+                    $criteria->add(new \Criteria('`'.$var[0].'`', '%'.$var[1].'%', ($var[2] ?? 'LIKE')));
42 42
                 } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
43
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
44
-                } elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
45
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
46
-                } elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
47
-                    $criteria->add(new \Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
43
+                    $criteria->add(new \Criteria('`'.$var[0].'`', $var[1], ($var[2] ?? '=')));
44
+                } elseif (\XOBJ_DTYPE_ENUM==$object->vars[$var[0]]['data_type']) {
45
+                    $criteria->add(new \Criteria('`'.$var[0].'`', $var[1], ($var[2] ?? '=')));
46
+                } elseif (\XOBJ_DTYPE_ARRAY==$object->vars[$var[0]]['data_type']) {
47
+                    $criteria->add(new \Criteria('`'.$var[0].'`', '%"'.$var[1].'";%', ($var[2] ?? 'LIKE')));
48 48
                 }
49 49
             } elseif (!empty($var[1]) && \is_numeric($var[0])) {
50 50
                 $criteria->add(new \Criteria($var[0], $var[1]));
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         } else {
115 115
             $obj->setVar('updated', \time());
116 116
         }
117
-        if ('' == $obj->getVar('name')) {
117
+        if (''==$obj->getVar('name')) {
118 118
             return false;
119 119
         }
120 120
 
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         if (!isset($this->_objects['object'][$id])) {
135 135
             $this->_objects['object'][$id] = parent::get($id, $fields);
136 136
             if (!isset($GLOBALS['songlistAdmin'])) {
137
-                $sql = 'UPDATE `' . $this->table . '` set hits=hits+1 where `' . $this->keyName . '` = ' . $id;
137
+                $sql = 'UPDATE `'.$this->table.'` set hits=hits+1 where `'.$this->keyName.'` = '.$id;
138 138
                 $GLOBALS['xoopsDB']->queryF($sql);
139 139
             }
140 140
         }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     public function delete(\XoopsObject $object, $force = true): bool
151 151
     {
152 152
         parent::delete($object, $force);
153
-        $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('songlist_songs') . ' SET `cid` = 0 WHERE `cid` = ' . $object->getVar('cid');
153
+        $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('songlist_songs').' SET `cid` = 0 WHERE `cid` = '.$object->getVar('cid');
154 154
 
155 155
         return $GLOBALS['xoopsDB']->queryF($sql);
156 156
     }
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function getTop($limit = 1): array
197 197
     {
198
-        $sql     = 'SELECT * FROM `' . $this->table . '` WHERE `rank`>=0 ORDER BY (`rank`/`votes`) DESC LIMIT ' . $limit;
198
+        $sql     = 'SELECT * FROM `'.$this->table.'` WHERE `rank`>=0 ORDER BY (`rank`/`votes`) DESC LIMIT '.$limit;
199 199
         $results = $GLOBALS['xoopsDB']->queryF($sql);
200 200
         $ret     = [];
201 201
         $i       = 0;
202
-        while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($results))) {
202
+        while (false!==($row = $GLOBALS['xoopsDB']->fetchArray($results))) {
203 203
             $ret[$i] = $this->create();
204 204
             $ret[$i]->assignVars($row);
205 205
             ++$i;
Please login to merge, or discard this patch.
class/Requests.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use XoopsFormText;
6 6
 use XoopsObject;
7 7
 
8
-require_once \dirname(__DIR__) . '/include/songlist.object.php';
8
+require_once \dirname(__DIR__).'/include/songlist.object.php';
9 9
 // require_once \dirname(__DIR__) . '/include/songlist.form.php';
10 10
 use  XoopsModules\Songlist\Form\FormController;
11 11
 
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $ret            = parent::toArray();
53 53
         $form           = $this->getForm(true);
54
-        $form['songid'] = new XoopsFormText('', $this->getVar('rid') . '[songid]', 11, 32);
54
+        $form['songid'] = new XoopsFormText('', $this->getVar('rid').'[songid]', 11, 32);
55 55
         foreach ($form as $key => $element) {
56 56
             $ret['form'][$key] = $element->render();
57 57
         }
58 58
         foreach (['created', 'updated'] as $key) {
59
-            if ($this->getVar($key) > 0) {
59
+            if ($this->getVar($key)>0) {
60 60
                 $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
61 61
                 $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
62 62
             }
Please login to merge, or discard this patch.
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -15,68 +15,68 @@
 block discarded – undo
15 15
  */
16 16
 class Requests extends XoopsObject
17 17
 {
18
-    public $rid;
19
-    public $aid;
20
-    public $artist;
21
-    public $album;
22
-    public $title;
23
-    public $lyrics;
24
-    public $uid;
25
-    public $name;
26
-    public $email;
27
-    public $songid;
28
-    public $sid;
29
-    public $created;
30
-    public $updated;
18
+	public $rid;
19
+	public $aid;
20
+	public $artist;
21
+	public $album;
22
+	public $title;
23
+	public $lyrics;
24
+	public $uid;
25
+	public $name;
26
+	public $email;
27
+	public $songid;
28
+	public $sid;
29
+	public $created;
30
+	public $updated;
31 31
 
32
-    /**
33
-     * Requests constructor.
34
-     * @param null $fid
35
-     */
36
-    public function __construct($fid = null)
37
-    {
38
-        $this->initVar('rid', \XOBJ_DTYPE_INT, 0, false);
39
-        $this->initVar('aid', \XOBJ_DTYPE_INT, 0, false);
40
-        $this->initVar('artist', \XOBJ_DTYPE_TXTBOX, null, false, 128);
41
-        $this->initVar('album', \XOBJ_DTYPE_TXTBOX, null, false, 128);
42
-        $this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false, 128);
43
-        $this->initVar('lyrics', \XOBJ_DTYPE_OTHER, null, false);
44
-        $this->initVar('uid', \XOBJ_DTYPE_INT, 0, false);
45
-        $this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
46
-        $this->initVar('email', \XOBJ_DTYPE_TXTBOX, null, false, 255);
47
-        $this->initVar('songid', \XOBJ_DTYPE_TXTBOX, null, false, 32);
48
-        $this->initVar('sid', \XOBJ_DTYPE_INT, 0, false);
49
-        $this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
50
-        $this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
51
-    }
32
+	/**
33
+	 * Requests constructor.
34
+	 * @param null $fid
35
+	 */
36
+	public function __construct($fid = null)
37
+	{
38
+		$this->initVar('rid', \XOBJ_DTYPE_INT, 0, false);
39
+		$this->initVar('aid', \XOBJ_DTYPE_INT, 0, false);
40
+		$this->initVar('artist', \XOBJ_DTYPE_TXTBOX, null, false, 128);
41
+		$this->initVar('album', \XOBJ_DTYPE_TXTBOX, null, false, 128);
42
+		$this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false, 128);
43
+		$this->initVar('lyrics', \XOBJ_DTYPE_OTHER, null, false);
44
+		$this->initVar('uid', \XOBJ_DTYPE_INT, 0, false);
45
+		$this->initVar('name', \XOBJ_DTYPE_TXTBOX, null, false, 128);
46
+		$this->initVar('email', \XOBJ_DTYPE_TXTBOX, null, false, 255);
47
+		$this->initVar('songid', \XOBJ_DTYPE_TXTBOX, null, false, 32);
48
+		$this->initVar('sid', \XOBJ_DTYPE_INT, 0, false);
49
+		$this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
50
+		$this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
51
+	}
52 52
 
53
-    /**
54
-     * @param bool $as_array
55
-     * @return array|string
56
-     */
57
-    public function getForm($as_array = false)
58
-    {
59
-        return FormController::getFormRequests($this, $as_array);
60
-    }
53
+	/**
54
+	 * @param bool $as_array
55
+	 * @return array|string
56
+	 */
57
+	public function getForm($as_array = false)
58
+	{
59
+		return FormController::getFormRequests($this, $as_array);
60
+	}
61 61
 
62
-    /**
63
-     * @return array
64
-     */
65
-    public function toArray(): array
66
-    {
67
-        $ret            = parent::toArray();
68
-        $form           = $this->getForm(true);
69
-        $form['songid'] = new XoopsFormText('', $this->getVar('rid') . '[songid]', 11, 32);
70
-        foreach ($form as $key => $element) {
71
-            $ret['form'][$key] = $element->render();
72
-        }
73
-        foreach (['created', 'updated'] as $key) {
74
-            if ($this->getVar($key) > 0) {
75
-                $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
76
-                $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
77
-            }
78
-        }
62
+	/**
63
+	 * @return array
64
+	 */
65
+	public function toArray(): array
66
+	{
67
+		$ret            = parent::toArray();
68
+		$form           = $this->getForm(true);
69
+		$form['songid'] = new XoopsFormText('', $this->getVar('rid') . '[songid]', 11, 32);
70
+		foreach ($form as $key => $element) {
71
+			$ret['form'][$key] = $element->render();
72
+		}
73
+		foreach (['created', 'updated'] as $key) {
74
+			if ($this->getVar($key) > 0) {
75
+				$ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
76
+				$ret[$key]         = \date(_DATESTRING, $this->getVar($key));
77
+			}
78
+		}
79 79
 
80
-        return $ret;
81
-    }
80
+		return $ret;
81
+	}
82 82
 }
Please login to merge, or discard this patch.
class/VisibilityHandler.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -27,81 +27,81 @@
 block discarded – undo
27 27
  */
28 28
 class VisibilityHandler extends XoopsPersistableObjectHandler
29 29
 {
30
-    /**
31
-     * VisibilityHandler constructor.
32
-     * @param \XoopsDatabase $db
33
-     */
34
-    public function __construct(XoopsDatabase $db)
35
-    {
36
-        parent::__construct($db, 'songlist_visibility', Visibility::class, 'field_id');
37
-    }
30
+	/**
31
+	 * VisibilityHandler constructor.
32
+	 * @param \XoopsDatabase $db
33
+	 */
34
+	public function __construct(XoopsDatabase $db)
35
+	{
36
+		parent::__construct($db, 'songlist_visibility', Visibility::class, 'field_id');
37
+	}
38 38
 
39
-    /**
40
-     * get all objects matching a condition
41
-     *
42
-     * @param \CriteriaElement|null $criteria {@link \CriteriaElement} to match
43
-     * @param null                  $fields
44
-     * @param bool                  $asObject
45
-     * @param bool                  $id_as_key
46
-     * @return array of objects/array <a href='psi_element://XoopsObject'>XoopsObject</a>
47
-     * @internal param array $fields variables to fetch
48
-     * @internal param bool $asObject flag indicating as object, otherwise as array
49
-     * @internal param bool $id_as_key use the ID as key for the array
50
-     */
51
-    public function &getAll(CriteriaElement $criteria = null, $fields = null, $asObject = true, $id_as_key = true): array //getAll($criteria = null)
52
-    {
53
-        $limit            = null;
54
-        $GLOBALS['start'] = null;
55
-        $sql              = "SELECT * FROM `{$this->table}`";
56
-        if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
57
-            $sql     .= ' ' . $criteria->renderWhere();
58
-            $groupby = $criteria->getGroupby();
59
-            if ($groupby) {
60
-                $sql .= ' ' . $groupby;
61
-            }
62
-            $sort = $criteria->getSort();
63
-            if ($sort) {
64
-                $sql      .= " ORDER BY {$sort} " . $criteria->getOrder();
65
-                $orderSet = true;
66
-            }
67
-            $limit            = $criteria->getLimit();
68
-            $GLOBALS['start'] = $criteria->getStart();
69
-        }
70
-        if (empty($orderSet)) {
71
-            $sql .= " ORDER BY `{$this->keyName}` DESC";
72
-        }
73
-        $result = $this->db->query($sql, $limit, $GLOBALS['start']);
74
-        $ret    = [];
75
-        while (false !== ($row = $this->db->fetchArray($result))) {
76
-            $ret[$row['field_id']][] = $row;
77
-        }
39
+	/**
40
+	 * get all objects matching a condition
41
+	 *
42
+	 * @param \CriteriaElement|null $criteria {@link \CriteriaElement} to match
43
+	 * @param null                  $fields
44
+	 * @param bool                  $asObject
45
+	 * @param bool                  $id_as_key
46
+	 * @return array of objects/array <a href='psi_element://XoopsObject'>XoopsObject</a>
47
+	 * @internal param array $fields variables to fetch
48
+	 * @internal param bool $asObject flag indicating as object, otherwise as array
49
+	 * @internal param bool $id_as_key use the ID as key for the array
50
+	 */
51
+	public function &getAll(CriteriaElement $criteria = null, $fields = null, $asObject = true, $id_as_key = true): array //getAll($criteria = null)
52
+	{
53
+		$limit            = null;
54
+		$GLOBALS['start'] = null;
55
+		$sql              = "SELECT * FROM `{$this->table}`";
56
+		if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
57
+			$sql     .= ' ' . $criteria->renderWhere();
58
+			$groupby = $criteria->getGroupby();
59
+			if ($groupby) {
60
+				$sql .= ' ' . $groupby;
61
+			}
62
+			$sort = $criteria->getSort();
63
+			if ($sort) {
64
+				$sql      .= " ORDER BY {$sort} " . $criteria->getOrder();
65
+				$orderSet = true;
66
+			}
67
+			$limit            = $criteria->getLimit();
68
+			$GLOBALS['start'] = $criteria->getStart();
69
+		}
70
+		if (empty($orderSet)) {
71
+			$sql .= " ORDER BY `{$this->keyName}` DESC";
72
+		}
73
+		$result = $this->db->query($sql, $limit, $GLOBALS['start']);
74
+		$ret    = [];
75
+		while (false !== ($row = $this->db->fetchArray($result))) {
76
+			$ret[$row['field_id']][] = $row;
77
+		}
78 78
 
79
-        return $ret;
80
-    }
79
+		return $ret;
80
+	}
81 81
 
82
-    /**
83
-     * Get fields visible to the $user_groups on a $profile_groups profile
84
-     *
85
-     * @param array $profile_groups groups of the user to be accessed
86
-     * @param array $user_groups    groups of the visitor, default as $GLOBALS['xoopsUser']
87
-     *
88
-     * @return array
89
-     */
90
-    public function getVisibleFields($profile_groups, $user_groups = []): array
91
-    {
92
-        $profile_groups[] = '0';
93
-        $user_groups[]    = '0';
94
-        $profile_groups[] = $user_groups[] = 0;
95
-        $sql              = "SELECT field_id FROM {$this->table} WHERE profile_group IN (" . \implode(',', $profile_groups) . ')';
96
-        $sql              .= ' AND user_group IN (' . \implode(',', $user_groups) . ')';
97
-        $field_ids        = [];
98
-        $result           = $this->db->query($sql);
99
-        if ($result) {
100
-            while ([$field_id] = $this->db->fetchRow($result)) {
101
-                $field_ids[] = $field_id;
102
-            }
103
-        }
82
+	/**
83
+	 * Get fields visible to the $user_groups on a $profile_groups profile
84
+	 *
85
+	 * @param array $profile_groups groups of the user to be accessed
86
+	 * @param array $user_groups    groups of the visitor, default as $GLOBALS['xoopsUser']
87
+	 *
88
+	 * @return array
89
+	 */
90
+	public function getVisibleFields($profile_groups, $user_groups = []): array
91
+	{
92
+		$profile_groups[] = '0';
93
+		$user_groups[]    = '0';
94
+		$profile_groups[] = $user_groups[] = 0;
95
+		$sql              = "SELECT field_id FROM {$this->table} WHERE profile_group IN (" . \implode(',', $profile_groups) . ')';
96
+		$sql              .= ' AND user_group IN (' . \implode(',', $user_groups) . ')';
97
+		$field_ids        = [];
98
+		$result           = $this->db->query($sql);
99
+		if ($result) {
100
+			while ([$field_id] = $this->db->fetchRow($result)) {
101
+				$field_ids[] = $field_id;
102
+			}
103
+		}
104 104
 
105
-        return $field_ids;
106
-    }
105
+		return $field_ids;
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
         $GLOBALS['start'] = null;
55 55
         $sql              = "SELECT * FROM `{$this->table}`";
56 56
         if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) {
57
-            $sql     .= ' ' . $criteria->renderWhere();
57
+            $sql     .= ' '.$criteria->renderWhere();
58 58
             $groupby = $criteria->getGroupby();
59 59
             if ($groupby) {
60
-                $sql .= ' ' . $groupby;
60
+                $sql .= ' '.$groupby;
61 61
             }
62 62
             $sort = $criteria->getSort();
63 63
             if ($sort) {
64
-                $sql      .= " ORDER BY {$sort} " . $criteria->getOrder();
64
+                $sql .= " ORDER BY {$sort} ".$criteria->getOrder();
65 65
                 $orderSet = true;
66 66
             }
67 67
             $limit            = $criteria->getLimit();
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         }
73 73
         $result = $this->db->query($sql, $limit, $GLOBALS['start']);
74 74
         $ret    = [];
75
-        while (false !== ($row = $this->db->fetchArray($result))) {
75
+        while (false!==($row = $this->db->fetchArray($result))) {
76 76
             $ret[$row['field_id']][] = $row;
77 77
         }
78 78
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
         $profile_groups[] = '0';
93 93
         $user_groups[]    = '0';
94 94
         $profile_groups[] = $user_groups[] = 0;
95
-        $sql              = "SELECT field_id FROM {$this->table} WHERE profile_group IN (" . \implode(',', $profile_groups) . ')';
96
-        $sql              .= ' AND user_group IN (' . \implode(',', $user_groups) . ')';
95
+        $sql              = "SELECT field_id FROM {$this->table} WHERE profile_group IN (".\implode(',', $profile_groups).')';
96
+        $sql .= ' AND user_group IN ('.\implode(',', $user_groups).')';
97 97
         $field_ids        = [];
98 98
         $result           = $this->db->query($sql);
99 99
         if ($result) {
Please login to merge, or discard this patch.
class/VotesHandler.php 2 patches
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,140 +17,140 @@
 block discarded – undo
17 17
  */
18 18
 class VotesHandler extends XoopsPersistableObjectHandler
19 19
 {
20
-    /**
21
-     * VotesHandler constructor.
22
-     * @param \XoopsDatabase $db
23
-     */
24
-    public function __construct(XoopsDatabase $db)
25
-    {
26
-        parent::__construct($db, 'songlist_votes', Votes::class, 'vid', 'ip');
27
-    }
28
-
29
-    /**
30
-     * @return array
31
-     */
32
-    public function filterFields(): array
33
-    {
34
-        return ['vid', 'sid', 'uid', 'ip', 'netaddy', 'rank'];
35
-    }
36
-
37
-    /**
38
-     * @param string $filter
39
-     * @return \CriteriaCompo
40
-     */
41
-    public function getFilterCriteria($filter): CriteriaCompo
42
-    {
43
-        $parts    = \explode('|', $filter);
44
-        $criteria = new CriteriaCompo();
45
-        foreach ($parts as $part) {
46
-            $var = \explode(',', $part);
47
-            if (!empty($var[1]) && !\is_numeric($var[0])) {
48
-                $object = $this->create();
49
-                if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
50
-                    || \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
51
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
52
-                } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
53
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
54
-                } elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
55
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
56
-                } elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
57
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
58
-                }
59
-            } elseif (!empty($var[1]) && \is_numeric($var[0])) {
60
-                $criteria->add(new Criteria($var[0], $var[1]));
61
-            }
62
-        }
63
-
64
-        return $criteria;
65
-    }
66
-
67
-    /**
68
-     * @param string $filter
69
-     * @param string $field
70
-     * @param string $sort
71
-     * @param string $op
72
-     * @param string $fct
73
-     * @return string
74
-     */
75
-    public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
76
-    {
77
-        $ele = Utility::getFilterElement($filter, $field, $sort, $op, $fct);
78
-        if (\is_object($ele)) {
79
-            return $ele->render();
80
-        }
81
-
82
-        return '&nbsp;';
83
-    }
84
-
85
-    /**
86
-     * @param bool $force
87
-     * @return mixed
88
-     */
89
-    public function insert(XoopsObject $obj, $force = true)
90
-    {
91
-        if ($obj->isNew()) {
92
-            $obj->setVar('created', \time());
93
-        } else {
94
-            $obj->setVar('updated', \time());
95
-        }
96
-
97
-        return parent::insert($obj, $force);
98
-    }
99
-
100
-    /**
101
-     * @param int $sid
102
-     * @param string$value
103
-     * @return bool
104
-     */
105
-    public function addVote($sid, $value): bool
106
-    {
107
-        $criteria = new CriteriaCompo(new Criteria('sid', $sid));
108
-
109
-        $ip = Utility::getIPData(false);
110
-        if ($ip['uid'] > 0) {
111
-            $criteria->add(new Criteria('uid', $ip['uid']));
112
-        } else {
113
-            $criteria->add(new Criteria('ip', $ip['ip']));
114
-            $criteria->add(new Criteria('netaddy', $ip['network-addy']));
115
-        }
116
-
117
-        if (0 == $this->getCount($criteria) && $sid > 0 && $value > 0) {
118
-            $vote = $this->create();
119
-            $vote->setVar('sid', $sid);
120
-            $vote->setVar('uid', $ip['uid']);
121
-            $vote->setVar('ip', $ip['ip']);
122
-            $vote->setVar('netaddy', $ip['network-addy']);
123
-            $vote->setVar('rank', $value);
124
-            if ($this->insert($vote)) {
125
-                $songsHandler    = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Songs');
126
-                $albumsHandler   = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
127
-                $artistsHandler  = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
128
-                $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
129
-                $genreHandler    = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Genre');
130
-                $voiceHandler    = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Voice');
131
-
132
-                $song  = $songsHandler->get($sid);
133
-                $sql   = [];
134
-                $sql[] = 'UPDATE `' . $songsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $songsHandler->keyName . '` = ' . $sid;
135
-                $sql[] = 'UPDATE `' . $categoryHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $categoryHandler->keyName . '` = ' . $song->getVar($categoryHandler->keyName);
136
-                $sql[] = 'UPDATE `' . $genreHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $genreHandler->keyName . '` = ' . $song->getVar($genreHandler->keyName);
137
-                $sql[] = 'UPDATE `' . $voiceHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $voiceHandler->keyName . '` = ' . $song->getVar($voiceHandler->keyName);
138
-                $sql[] = 'UPDATE `' . $albumsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $albumsHandler->keyName . '` = ' . $song->getVar($albumsHandler->keyName);
139
-                foreach ($song->getVar('aids') as $aid) {
140
-                    $sql[] = 'UPDATE `' . $artistsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $artistsHandler->keyName . '` = ' . $aid;
141
-                }
142
-                foreach ($sql as $question) {
143
-                    $GLOBALS['xoopsDB']->queryF($question);
144
-                }
145
-                \redirect_header($_POST['uri'], 10, \_MD_SONGLIST_MSG_VOTED_FINISHED);
146
-                exit(0);
147
-            }
148
-            \redirect_header($_POST['uri'], 10, \_MD_SONGLIST_MSG_VOTED_ALREADY);
149
-            exit(0);
150
-        }
151
-        \redirect_header($_POST['uri'], 10, \_MD_SONGLIST_MSG_VOTED_SOMETHINGWRONG);
152
-        exit(0);
153
-
154
-        return false;
155
-    }
20
+	/**
21
+	 * VotesHandler constructor.
22
+	 * @param \XoopsDatabase $db
23
+	 */
24
+	public function __construct(XoopsDatabase $db)
25
+	{
26
+		parent::__construct($db, 'songlist_votes', Votes::class, 'vid', 'ip');
27
+	}
28
+
29
+	/**
30
+	 * @return array
31
+	 */
32
+	public function filterFields(): array
33
+	{
34
+		return ['vid', 'sid', 'uid', 'ip', 'netaddy', 'rank'];
35
+	}
36
+
37
+	/**
38
+	 * @param string $filter
39
+	 * @return \CriteriaCompo
40
+	 */
41
+	public function getFilterCriteria($filter): CriteriaCompo
42
+	{
43
+		$parts    = \explode('|', $filter);
44
+		$criteria = new CriteriaCompo();
45
+		foreach ($parts as $part) {
46
+			$var = \explode(',', $part);
47
+			if (!empty($var[1]) && !\is_numeric($var[0])) {
48
+				$object = $this->create();
49
+				if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
50
+					|| \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
51
+					$criteria->add(new Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
52
+				} elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
53
+					$criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
54
+				} elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
55
+					$criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
56
+				} elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
57
+					$criteria->add(new Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
58
+				}
59
+			} elseif (!empty($var[1]) && \is_numeric($var[0])) {
60
+				$criteria->add(new Criteria($var[0], $var[1]));
61
+			}
62
+		}
63
+
64
+		return $criteria;
65
+	}
66
+
67
+	/**
68
+	 * @param string $filter
69
+	 * @param string $field
70
+	 * @param string $sort
71
+	 * @param string $op
72
+	 * @param string $fct
73
+	 * @return string
74
+	 */
75
+	public function getFilterForm($filter, $field, $sort = 'created', $op = 'dashboard', $fct = 'list'): string
76
+	{
77
+		$ele = Utility::getFilterElement($filter, $field, $sort, $op, $fct);
78
+		if (\is_object($ele)) {
79
+			return $ele->render();
80
+		}
81
+
82
+		return '&nbsp;';
83
+	}
84
+
85
+	/**
86
+	 * @param bool $force
87
+	 * @return mixed
88
+	 */
89
+	public function insert(XoopsObject $obj, $force = true)
90
+	{
91
+		if ($obj->isNew()) {
92
+			$obj->setVar('created', \time());
93
+		} else {
94
+			$obj->setVar('updated', \time());
95
+		}
96
+
97
+		return parent::insert($obj, $force);
98
+	}
99
+
100
+	/**
101
+	 * @param int $sid
102
+	 * @param string$value
103
+	 * @return bool
104
+	 */
105
+	public function addVote($sid, $value): bool
106
+	{
107
+		$criteria = new CriteriaCompo(new Criteria('sid', $sid));
108
+
109
+		$ip = Utility::getIPData(false);
110
+		if ($ip['uid'] > 0) {
111
+			$criteria->add(new Criteria('uid', $ip['uid']));
112
+		} else {
113
+			$criteria->add(new Criteria('ip', $ip['ip']));
114
+			$criteria->add(new Criteria('netaddy', $ip['network-addy']));
115
+		}
116
+
117
+		if (0 == $this->getCount($criteria) && $sid > 0 && $value > 0) {
118
+			$vote = $this->create();
119
+			$vote->setVar('sid', $sid);
120
+			$vote->setVar('uid', $ip['uid']);
121
+			$vote->setVar('ip', $ip['ip']);
122
+			$vote->setVar('netaddy', $ip['network-addy']);
123
+			$vote->setVar('rank', $value);
124
+			if ($this->insert($vote)) {
125
+				$songsHandler    = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Songs');
126
+				$albumsHandler   = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
127
+				$artistsHandler  = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
128
+				$categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
129
+				$genreHandler    = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Genre');
130
+				$voiceHandler    = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Voice');
131
+
132
+				$song  = $songsHandler->get($sid);
133
+				$sql   = [];
134
+				$sql[] = 'UPDATE `' . $songsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $songsHandler->keyName . '` = ' . $sid;
135
+				$sql[] = 'UPDATE `' . $categoryHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $categoryHandler->keyName . '` = ' . $song->getVar($categoryHandler->keyName);
136
+				$sql[] = 'UPDATE `' . $genreHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $genreHandler->keyName . '` = ' . $song->getVar($genreHandler->keyName);
137
+				$sql[] = 'UPDATE `' . $voiceHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $voiceHandler->keyName . '` = ' . $song->getVar($voiceHandler->keyName);
138
+				$sql[] = 'UPDATE `' . $albumsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $albumsHandler->keyName . '` = ' . $song->getVar($albumsHandler->keyName);
139
+				foreach ($song->getVar('aids') as $aid) {
140
+					$sql[] = 'UPDATE `' . $artistsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $artistsHandler->keyName . '` = ' . $aid;
141
+				}
142
+				foreach ($sql as $question) {
143
+					$GLOBALS['xoopsDB']->queryF($question);
144
+				}
145
+				\redirect_header($_POST['uri'], 10, \_MD_SONGLIST_MSG_VOTED_FINISHED);
146
+				exit(0);
147
+			}
148
+			\redirect_header($_POST['uri'], 10, \_MD_SONGLIST_MSG_VOTED_ALREADY);
149
+			exit(0);
150
+		}
151
+		\redirect_header($_POST['uri'], 10, \_MD_SONGLIST_MSG_VOTED_SOMETHINGWRONG);
152
+		exit(0);
153
+
154
+		return false;
155
+	}
156 156
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 use XoopsObject;
9 9
 use XoopsPersistableObjectHandler;
10 10
 
11
-require_once \dirname(__DIR__) . '/include/songlist.object.php';
11
+require_once \dirname(__DIR__).'/include/songlist.object.php';
12 12
 // require_once \dirname(__DIR__) . '/include/songlist.form.php';
13 13
 use  XoopsModules\Songlist\Form\FormController;
14 14
 
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
             $var = \explode(',', $part);
47 47
             if (!empty($var[1]) && !\is_numeric($var[0])) {
48 48
                 $object = $this->create();
49
-                if (\XOBJ_DTYPE_TXTBOX == $object->vars[$var[0]]['data_type']
50
-                    || \XOBJ_DTYPE_TXTAREA == $object->vars[$var[0]]['data_type']) {
51
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%' . $var[1] . '%', ($var[2] ?? 'LIKE')));
49
+                if (\XOBJ_DTYPE_TXTBOX==$object->vars[$var[0]]['data_type']
50
+                    || \XOBJ_DTYPE_TXTAREA==$object->vars[$var[0]]['data_type']) {
51
+                    $criteria->add(new Criteria('`'.$var[0].'`', '%'.$var[1].'%', ($var[2] ?? 'LIKE')));
52 52
                 } elseif (in_array($object->vars[$var[0]]['data_type'], [XOBJ_DTYPE_INT, XOBJ_DTYPE_DECIMAL, XOBJ_DTYPE_FLOAT])) {
53
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
54
-                } elseif (\XOBJ_DTYPE_ENUM == $object->vars[$var[0]]['data_type']) {
55
-                    $criteria->add(new Criteria('`' . $var[0] . '`', $var[1], ($var[2] ?? '=')));
56
-                } elseif (\XOBJ_DTYPE_ARRAY == $object->vars[$var[0]]['data_type']) {
57
-                    $criteria->add(new Criteria('`' . $var[0] . '`', '%"' . $var[1] . '";%', ($var[2] ?? 'LIKE')));
53
+                    $criteria->add(new Criteria('`'.$var[0].'`', $var[1], ($var[2] ?? '=')));
54
+                } elseif (\XOBJ_DTYPE_ENUM==$object->vars[$var[0]]['data_type']) {
55
+                    $criteria->add(new Criteria('`'.$var[0].'`', $var[1], ($var[2] ?? '=')));
56
+                } elseif (\XOBJ_DTYPE_ARRAY==$object->vars[$var[0]]['data_type']) {
57
+                    $criteria->add(new Criteria('`'.$var[0].'`', '%"'.$var[1].'";%', ($var[2] ?? 'LIKE')));
58 58
                 }
59 59
             } elseif (!empty($var[1]) && \is_numeric($var[0])) {
60 60
                 $criteria->add(new Criteria($var[0], $var[1]));
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
         $criteria = new CriteriaCompo(new Criteria('sid', $sid));
108 108
 
109 109
         $ip = Utility::getIPData(false);
110
-        if ($ip['uid'] > 0) {
110
+        if ($ip['uid']>0) {
111 111
             $criteria->add(new Criteria('uid', $ip['uid']));
112 112
         } else {
113 113
             $criteria->add(new Criteria('ip', $ip['ip']));
114 114
             $criteria->add(new Criteria('netaddy', $ip['network-addy']));
115 115
         }
116 116
 
117
-        if (0 == $this->getCount($criteria) && $sid > 0 && $value > 0) {
117
+        if (0==$this->getCount($criteria) && $sid>0 && $value>0) {
118 118
             $vote = $this->create();
119 119
             $vote->setVar('sid', $sid);
120 120
             $vote->setVar('uid', $ip['uid']);
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 
132 132
                 $song  = $songsHandler->get($sid);
133 133
                 $sql   = [];
134
-                $sql[] = 'UPDATE `' . $songsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $songsHandler->keyName . '` = ' . $sid;
135
-                $sql[] = 'UPDATE `' . $categoryHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $categoryHandler->keyName . '` = ' . $song->getVar($categoryHandler->keyName);
136
-                $sql[] = 'UPDATE `' . $genreHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $genreHandler->keyName . '` = ' . $song->getVar($genreHandler->keyName);
137
-                $sql[] = 'UPDATE `' . $voiceHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $voiceHandler->keyName . '` = ' . $song->getVar($voiceHandler->keyName);
138
-                $sql[] = 'UPDATE `' . $albumsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $albumsHandler->keyName . '` = ' . $song->getVar($albumsHandler->keyName);
134
+                $sql[] = 'UPDATE `'.$songsHandler->table.'` SET `rank` = `rank` + '.$value.', `votes` = `votes` + 1 WHERE `'.$songsHandler->keyName.'` = '.$sid;
135
+                $sql[] = 'UPDATE `'.$categoryHandler->table.'` SET `rank` = `rank` + '.$value.', `votes` = `votes` + 1 WHERE `'.$categoryHandler->keyName.'` = '.$song->getVar($categoryHandler->keyName);
136
+                $sql[] = 'UPDATE `'.$genreHandler->table.'` SET `rank` = `rank` + '.$value.', `votes` = `votes` + 1 WHERE `'.$genreHandler->keyName.'` = '.$song->getVar($genreHandler->keyName);
137
+                $sql[] = 'UPDATE `'.$voiceHandler->table.'` SET `rank` = `rank` + '.$value.', `votes` = `votes` + 1 WHERE `'.$voiceHandler->keyName.'` = '.$song->getVar($voiceHandler->keyName);
138
+                $sql[] = 'UPDATE `'.$albumsHandler->table.'` SET `rank` = `rank` + '.$value.', `votes` = `votes` + 1 WHERE `'.$albumsHandler->keyName.'` = '.$song->getVar($albumsHandler->keyName);
139 139
                 foreach ($song->getVar('aids') as $aid) {
140
-                    $sql[] = 'UPDATE `' . $artistsHandler->table . '` SET `rank` = `rank` + ' . $value . ', `votes` = `votes` + 1 WHERE `' . $artistsHandler->keyName . '` = ' . $aid;
140
+                    $sql[] = 'UPDATE `'.$artistsHandler->table.'` SET `rank` = `rank` + '.$value.', `votes` = `votes` + 1 WHERE `'.$artistsHandler->keyName.'` = '.$aid;
141 141
                 }
142 142
                 foreach ($sql as $question) {
143 143
                     $GLOBALS['xoopsDB']->queryF($question);
Please login to merge, or discard this patch.
class/Albums.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace XoopsModules\Songlist;
4 4
 
5
-require_once \dirname(__DIR__) . '/include/songlist.object.php';
5
+require_once \dirname(__DIR__).'/include/songlist.object.php';
6 6
 // require_once \dirname(__DIR__) . '/include/songlist.form.php';
7 7
 use  XoopsModules\Songlist\Form\FormController;
8 8
 
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
             $ret['form'][$key] = $element->render();
55 55
         }
56 56
         foreach (['created', 'updated'] as $key) {
57
-            if ($this->getVar($key) > 0) {
57
+            if ($this->getVar($key)>0) {
58 58
                 $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
59 59
                 $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
60 60
             }
61 61
         }
62 62
         $ret['picture'] = $this->getImage('image', false);
63
-        $ret['rank']    = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
63
+        $ret['rank']    = \number_format(($this->getVar('rank')>0 && $this->getVar('votes')>0 ? $this->getVar('rank')/$this->getVar('votes') : 0), 2).\_MI_SONGLIST_OFTEN;
64 64
         $ret['url']     = $this->getURL(true);
65 65
 
66 66
         if (!$extra) {
67 67
             return $ret;
68 68
         }
69 69
 
70
-        if (0 != $this->getVar('cid')) {
70
+        if (0!=$this->getVar('cid')) {
71 71
             $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
72 72
             $category        = $categoryHandler->get($this->getVar('cid'));
73 73
             if (\is_object($category)) {
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
             }
76 76
         }
77 77
 
78
-        if (0 != \count($this->getVar('aids'))) {
78
+        if (0!=\count($this->getVar('aids'))) {
79 79
             $artistsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
80 80
             foreach ($this->getVar('aids') as $aid) {
81 81
                 $artist = $artistsHandler->get($aid);
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
             }
86 86
         }
87 87
 
88
-        if (0 != \count($this->getVar('sids'))) {
88
+        if (0!=\count($this->getVar('sids'))) {
89 89
             $songsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Songs');
90
-            $criteria     = new \Criteria('sid', '(' . \implode(',', $this->getVar('sids')) . ')', 'IN');
90
+            $criteria     = new \Criteria('sid', '('.\implode(',', $this->getVar('sids')).')', 'IN');
91 91
             $criteria->setSort('traxid');
92 92
             $criteria->setOrder('ASC');
93 93
             foreach ($songsHandler->getObjects($criteria, true) as $sid => $song) {
@@ -107,17 +107,17 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function getImage($field = 'image', $local = false)
109 109
     {
110
-        if ('' == $this->getVar($field)) {
110
+        if (''==$this->getVar($field)) {
111 111
             return false;
112 112
         }
113
-        if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path') . $this->getVar($field)))) {
113
+        if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path').$this->getVar($field)))) {
114 114
             return false;
115 115
         }
116 116
         if (!$local) {
117
-            return XOOPS_URL . '/' . \str_replace(DS, '/', $this->getVar('path')) . $this->getVar($field);
117
+            return XOOPS_URL.'/'.\str_replace(DS, '/', $this->getVar('path')).$this->getVar($field);
118 118
         }
119 119
 
120
-        return XOOPS_ROOT_PATH . DS . $this->getVar('path') . $this->getVar($field);
120
+        return XOOPS_ROOT_PATH.DS.$this->getVar('path').$this->getVar($field);
121 121
     }
122 122
 
123 123
     /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         global $file, $op, $fct, $id, $value, $gid, $vid, $vcid, $cid, $start, $limit;
129 129
         if ($GLOBALS['songlistModuleConfig']['htaccess']) {
130
-            if (0 != $id) {
130
+            if (0!=$id) {
131 131
                 $artistHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
132 132
                 $artist        = $artistHandler->get($id);
133 133
                 if (\is_object($artist) && !$artist->isNew()) {
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
                            . $GLOBALS['songlistModuleConfig']['endofurl'];
154 154
                 }
155 155
 
156
-                return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/albums/' . $start . '-' . $id . '-' . $op . '-' . $fct . '-' . $gid . '-' . $cid . '/' . \urlencode($value) . $GLOBALS['songlistModuleConfig']['endofurl'];
156
+                return XOOPS_URL.'/'.$GLOBALS['songlistModuleConfig']['baseofurl'].'/albums/'.$start.'-'.$id.'-'.$op.'-'.$fct.'-'.$gid.'-'.$cid.'/'.\urlencode($value).$GLOBALS['songlistModuleConfig']['endofurl'];
157 157
             }
158 158
 
159
-            return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/albums/' . $start . '-' . $id . '-' . $op . '-' . $fct . '-' . $gid . '-' . $cid . '/' . \urlencode($value) . $GLOBALS['songlistModuleConfig']['endofurl'];
159
+            return XOOPS_URL.'/'.$GLOBALS['songlistModuleConfig']['baseofurl'].'/albums/'.$start.'-'.$id.'-'.$op.'-'.$fct.'-'.$gid.'-'.$cid.'/'.\urlencode($value).$GLOBALS['songlistModuleConfig']['endofurl'];
160 160
         }
161 161
 
162
-        return XOOPS_URL . '/modules/songlist/albums.php?op=' . $op . '&fct=' . $fct . '&id=' . $id . '&value=' . \urlencode($value ?? '') . '&gid=' . $gid . '&vid=' . $vid . '&cid=' . $cid . '&start=' . $start;
162
+        return XOOPS_URL.'/modules/songlist/albums.php?op='.$op.'&fct='.$fct.'&id='.$id.'&value='.\urlencode($value ?? '').'&gid='.$gid.'&vid='.$vid.'&cid='.$cid.'&start='.$start;
163 163
     }
164 164
 }
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -12,169 +12,169 @@
 block discarded – undo
12 12
  */
13 13
 class Albums extends \XoopsObject
14 14
 {
15
-    public $abid;
16
-    public $cid;
17
-    public $aids;
18
-    public $sids;
19
-    public $title;
20
-    public $image;
21
-    public $path;
22
-    public $artists;
23
-    public $songs;
24
-    public $hits;
25
-    public $rank;
26
-    public $votes;
27
-    public $created;
28
-    public $updated;
29
-
30
-    /**
31
-     * Albums constructor.
32
-     * @param null $fid
33
-     */
34
-    public function __construct($fid = null)
35
-    {
36
-        $this->initVar('abid', \XOBJ_DTYPE_INT, 0, false);
37
-        $this->initVar('cid', \XOBJ_DTYPE_INT, 0, false);
38
-        $this->initVar('aids', \XOBJ_DTYPE_ARRAY, [], false);
39
-        $this->initVar('sids', \XOBJ_DTYPE_ARRAY, [], false);
40
-        $this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false, 128);
41
-        $this->initVar('image', \XOBJ_DTYPE_TXTBOX, null, false, 255);
42
-        $this->initVar('path', \XOBJ_DTYPE_TXTBOX, null, false, 255);
43
-        $this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
44
-        $this->initVar('songs', \XOBJ_DTYPE_INT, 0, false);
45
-        $this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
46
-        $this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
47
-        $this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
48
-        $this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
49
-        $this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
50
-    }
51
-
52
-    /**
53
-     * @param bool $as_array
54
-     * @return array|string
55
-     */
56
-    public function getForm($as_array = false)
57
-    {
58
-        return FormController::getFormAlbums($this, $as_array);
59
-    }
60
-
61
-    /**
62
-     * @param bool $extra
63
-     * @return array
64
-     */
65
-    public function toArray($extra = true): array
66
-    {
67
-        $ret  = parent::toArray();
68
-        $form = $this->getForm(true);
69
-        foreach ($form as $key => $element) {
70
-            $ret['form'][$key] = $element->render();
71
-        }
72
-        foreach (['created', 'updated'] as $key) {
73
-            if ($this->getVar($key) > 0) {
74
-                $ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
75
-                $ret[$key]         = \date(_DATESTRING, $this->getVar($key));
76
-            }
77
-        }
78
-        $ret['picture'] = $this->getImage('image', false);
79
-        $ret['rank']    = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
80
-        $ret['url']     = $this->getURL(true);
81
-
82
-        if (!$extra) {
83
-            return $ret;
84
-        }
85
-
86
-        if (0 != $this->getVar('cid')) {
87
-            $categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
88
-            $category        = $categoryHandler->get($this->getVar('cid'));
89
-            if (\is_object($category)) {
90
-                $ret['category'] = $category->toArray(false);
91
-            }
92
-        }
93
-
94
-        if (0 != \count($this->getVar('aids'))) {
95
-            $artistsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
96
-            foreach ($this->getVar('aids') as $aid) {
97
-                $artist = $artistsHandler->get($aid);
98
-                if (\is_object($artist)) {
99
-                    $ret['artists_array'][$aid] = $artist->toArray(false);
100
-                }
101
-            }
102
-        }
103
-
104
-        if (0 != \count($this->getVar('sids'))) {
105
-            $songsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Songs');
106
-            $criteria     = new \Criteria('sid', '(' . \implode(',', $this->getVar('sids')) . ')', 'IN');
107
-            $criteria->setSort('traxid');
108
-            $criteria->setOrder('ASC');
109
-            foreach ($songsHandler->getObjects($criteria, true) as $sid => $song) {
110
-                if (\is_object($song)) {
111
-                    $ret['songs_array'][$sid] = $song->toArray(false);
112
-                }
113
-            }
114
-        }
115
-
116
-        return $ret;
117
-    }
118
-
119
-    /**
120
-     * @param string $field
121
-     * @param bool   $local
122
-     * @return bool|string
123
-     */
124
-    public function getImage($field = 'image', $local = false)
125
-    {
126
-        if ('' == $this->getVar($field)) {
127
-            return false;
128
-        }
129
-        if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path') . $this->getVar($field)))) {
130
-            return false;
131
-        }
132
-        if (!$local) {
133
-            return XOOPS_URL . '/' . \str_replace(DS, '/', $this->getVar('path')) . $this->getVar($field);
134
-        }
135
-
136
-        return XOOPS_ROOT_PATH . DS . $this->getVar('path') . $this->getVar($field);
137
-    }
138
-
139
-    /**
140
-     * @return string
141
-     */
142
-    public function getURL(): string
143
-    {
144
-        global $file, $op, $fct, $id, $value, $gid, $vid, $vcid, $cid, $start, $limit;
145
-        if ($GLOBALS['songlistModuleConfig']['htaccess']) {
146
-            if (0 != $id) {
147
-                $artistHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
148
-                $artist        = $artistHandler->get($id);
149
-                if (\is_object($artist) && !$artist->isNew()) {
150
-                    return XOOPS_URL
151
-                           . '/'
152
-                           . $GLOBALS['songlistModuleConfig']['baseofurl']
153
-                           . '/albums/'
154
-                           . \urlencode(\str_replace([' ', \chr(9)], '-', $artist->getVar('title')))
155
-                           . '/'
156
-                           . $start
157
-                           . '-'
158
-                           . $id
159
-                           . '-'
160
-                           . $op
161
-                           . '-'
162
-                           . $fct
163
-                           . '-'
164
-                           . $gid
165
-                           . '-'
166
-                           . $cid
167
-                           . '/'
168
-                           . \urlencode($value)
169
-                           . $GLOBALS['songlistModuleConfig']['endofurl'];
170
-                }
171
-
172
-                return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/albums/' . $start . '-' . $id . '-' . $op . '-' . $fct . '-' . $gid . '-' . $cid . '/' . \urlencode($value) . $GLOBALS['songlistModuleConfig']['endofurl'];
173
-            }
174
-
175
-            return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/albums/' . $start . '-' . $id . '-' . $op . '-' . $fct . '-' . $gid . '-' . $cid . '/' . \urlencode($value) . $GLOBALS['songlistModuleConfig']['endofurl'];
176
-        }
177
-
178
-        return XOOPS_URL . '/modules/songlist/albums.php?op=' . $op . '&fct=' . $fct . '&id=' . $id . '&value=' . \urlencode($value ?? '') . '&gid=' . $gid . '&vid=' . $vid . '&cid=' . $cid . '&start=' . $start;
179
-    }
15
+	public $abid;
16
+	public $cid;
17
+	public $aids;
18
+	public $sids;
19
+	public $title;
20
+	public $image;
21
+	public $path;
22
+	public $artists;
23
+	public $songs;
24
+	public $hits;
25
+	public $rank;
26
+	public $votes;
27
+	public $created;
28
+	public $updated;
29
+
30
+	/**
31
+	 * Albums constructor.
32
+	 * @param null $fid
33
+	 */
34
+	public function __construct($fid = null)
35
+	{
36
+		$this->initVar('abid', \XOBJ_DTYPE_INT, 0, false);
37
+		$this->initVar('cid', \XOBJ_DTYPE_INT, 0, false);
38
+		$this->initVar('aids', \XOBJ_DTYPE_ARRAY, [], false);
39
+		$this->initVar('sids', \XOBJ_DTYPE_ARRAY, [], false);
40
+		$this->initVar('title', \XOBJ_DTYPE_TXTBOX, null, false, 128);
41
+		$this->initVar('image', \XOBJ_DTYPE_TXTBOX, null, false, 255);
42
+		$this->initVar('path', \XOBJ_DTYPE_TXTBOX, null, false, 255);
43
+		$this->initVar('artists', \XOBJ_DTYPE_INT, 0, false);
44
+		$this->initVar('songs', \XOBJ_DTYPE_INT, 0, false);
45
+		$this->initVar('hits', \XOBJ_DTYPE_INT, 0, false);
46
+		$this->initVar('rank', \XOBJ_DTYPE_DECIMAL, 0, false);
47
+		$this->initVar('votes', \XOBJ_DTYPE_INT, 0, false);
48
+		$this->initVar('created', \XOBJ_DTYPE_INT, 0, false);
49
+		$this->initVar('updated', \XOBJ_DTYPE_INT, 0, false);
50
+	}
51
+
52
+	/**
53
+	 * @param bool $as_array
54
+	 * @return array|string
55
+	 */
56
+	public function getForm($as_array = false)
57
+	{
58
+		return FormController::getFormAlbums($this, $as_array);
59
+	}
60
+
61
+	/**
62
+	 * @param bool $extra
63
+	 * @return array
64
+	 */
65
+	public function toArray($extra = true): array
66
+	{
67
+		$ret  = parent::toArray();
68
+		$form = $this->getForm(true);
69
+		foreach ($form as $key => $element) {
70
+			$ret['form'][$key] = $element->render();
71
+		}
72
+		foreach (['created', 'updated'] as $key) {
73
+			if ($this->getVar($key) > 0) {
74
+				$ret['form'][$key] = \date(_DATESTRING, $this->getVar($key));
75
+				$ret[$key]         = \date(_DATESTRING, $this->getVar($key));
76
+			}
77
+		}
78
+		$ret['picture'] = $this->getImage('image', false);
79
+		$ret['rank']    = \number_format(($this->getVar('rank') > 0 && $this->getVar('votes') > 0 ? $this->getVar('rank') / $this->getVar('votes') : 0), 2) . \_MI_SONGLIST_OFTEN;
80
+		$ret['url']     = $this->getURL(true);
81
+
82
+		if (!$extra) {
83
+			return $ret;
84
+		}
85
+
86
+		if (0 != $this->getVar('cid')) {
87
+			$categoryHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Category');
88
+			$category        = $categoryHandler->get($this->getVar('cid'));
89
+			if (\is_object($category)) {
90
+				$ret['category'] = $category->toArray(false);
91
+			}
92
+		}
93
+
94
+		if (0 != \count($this->getVar('aids'))) {
95
+			$artistsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Artists');
96
+			foreach ($this->getVar('aids') as $aid) {
97
+				$artist = $artistsHandler->get($aid);
98
+				if (\is_object($artist)) {
99
+					$ret['artists_array'][$aid] = $artist->toArray(false);
100
+				}
101
+			}
102
+		}
103
+
104
+		if (0 != \count($this->getVar('sids'))) {
105
+			$songsHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Songs');
106
+			$criteria     = new \Criteria('sid', '(' . \implode(',', $this->getVar('sids')) . ')', 'IN');
107
+			$criteria->setSort('traxid');
108
+			$criteria->setOrder('ASC');
109
+			foreach ($songsHandler->getObjects($criteria, true) as $sid => $song) {
110
+				if (\is_object($song)) {
111
+					$ret['songs_array'][$sid] = $song->toArray(false);
112
+				}
113
+			}
114
+		}
115
+
116
+		return $ret;
117
+	}
118
+
119
+	/**
120
+	 * @param string $field
121
+	 * @param bool   $local
122
+	 * @return bool|string
123
+	 */
124
+	public function getImage($field = 'image', $local = false)
125
+	{
126
+		if ('' == $this->getVar($field)) {
127
+			return false;
128
+		}
129
+		if (!\file_exists($GLOBALS['xoops']->path($this->getVar('path') . $this->getVar($field)))) {
130
+			return false;
131
+		}
132
+		if (!$local) {
133
+			return XOOPS_URL . '/' . \str_replace(DS, '/', $this->getVar('path')) . $this->getVar($field);
134
+		}
135
+
136
+		return XOOPS_ROOT_PATH . DS . $this->getVar('path') . $this->getVar($field);
137
+	}
138
+
139
+	/**
140
+	 * @return string
141
+	 */
142
+	public function getURL(): string
143
+	{
144
+		global $file, $op, $fct, $id, $value, $gid, $vid, $vcid, $cid, $start, $limit;
145
+		if ($GLOBALS['songlistModuleConfig']['htaccess']) {
146
+			if (0 != $id) {
147
+				$artistHandler = \XoopsModules\Songlist\Helper::getInstance()->getHandler('Albums');
148
+				$artist        = $artistHandler->get($id);
149
+				if (\is_object($artist) && !$artist->isNew()) {
150
+					return XOOPS_URL
151
+						   . '/'
152
+						   . $GLOBALS['songlistModuleConfig']['baseofurl']
153
+						   . '/albums/'
154
+						   . \urlencode(\str_replace([' ', \chr(9)], '-', $artist->getVar('title')))
155
+						   . '/'
156
+						   . $start
157
+						   . '-'
158
+						   . $id
159
+						   . '-'
160
+						   . $op
161
+						   . '-'
162
+						   . $fct
163
+						   . '-'
164
+						   . $gid
165
+						   . '-'
166
+						   . $cid
167
+						   . '/'
168
+						   . \urlencode($value)
169
+						   . $GLOBALS['songlistModuleConfig']['endofurl'];
170
+				}
171
+
172
+				return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/albums/' . $start . '-' . $id . '-' . $op . '-' . $fct . '-' . $gid . '-' . $cid . '/' . \urlencode($value) . $GLOBALS['songlistModuleConfig']['endofurl'];
173
+			}
174
+
175
+			return XOOPS_URL . '/' . $GLOBALS['songlistModuleConfig']['baseofurl'] . '/albums/' . $start . '-' . $id . '-' . $op . '-' . $fct . '-' . $gid . '-' . $cid . '/' . \urlencode($value) . $GLOBALS['songlistModuleConfig']['endofurl'];
176
+		}
177
+
178
+		return XOOPS_URL . '/modules/songlist/albums.php?op=' . $op . '&fct=' . $fct . '&id=' . $id . '&value=' . \urlencode($value ?? '') . '&gid=' . $gid . '&vid=' . $vid . '&cid=' . $cid . '&start=' . $start;
179
+	}
180 180
 }
Please login to merge, or discard this patch.
xoops_version.php 2 patches
Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $configHandler             = xoops_getHandler('config');
13 13
 $GLOBALS['songlistModule'] = $moduleHandler->getByDirname('songlist');
14 14
 if (is_object($GLOBALS['songlistModule'])) {
15
-    $GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid'));
15
+	$GLOBALS['songlistModuleConfig'] = $configHandler->getConfigList($GLOBALS['songlistModule']->getVar('mid'));
16 16
 }
17 17
 
18 18
 $modversion['version']             = '2.0.0';
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 
53 53
 // ------------------- Tables ------------------ //
54 54
 $modversion['tables'] = [
55
-    $moduleDirName . '_' . 'albums',
56
-    $moduleDirName . '_' . 'artists',
57
-    $moduleDirName . '_' . 'category',
58
-    $moduleDirName . '_' . 'extra',
59
-    $moduleDirName . '_' . 'field',
60
-    $moduleDirName . '_' . 'genre',
61
-    $moduleDirName . '_' . 'voice',
62
-    $moduleDirName . '_' . 'requests',
63
-    $moduleDirName . '_' . 'songs',
64
-    $moduleDirName . '_' . 'utf8map',
65
-    $moduleDirName . '_' . 'visibility',
66
-    $moduleDirName . '_' . 'votes',
55
+	$moduleDirName . '_' . 'albums',
56
+	$moduleDirName . '_' . 'artists',
57
+	$moduleDirName . '_' . 'category',
58
+	$moduleDirName . '_' . 'extra',
59
+	$moduleDirName . '_' . 'field',
60
+	$moduleDirName . '_' . 'genre',
61
+	$moduleDirName . '_' . 'voice',
62
+	$moduleDirName . '_' . 'requests',
63
+	$moduleDirName . '_' . 'songs',
64
+	$moduleDirName . '_' . 'utf8map',
65
+	$moduleDirName . '_' . 'visibility',
66
+	$moduleDirName . '_' . 'votes',
67 67
 ];
68 68
 
69 69
 // Admin things
@@ -95,52 +95,52 @@  discard block
 block discarded – undo
95 95
 
96 96
 // ------------------- Help files ------------------- //
97 97
 $modversion['helpsection'] = [
98
-    ['name' => _MI_SONGLIST_OVERVIEW, 'link' => 'page=help'],
99
-    ['name' => _MI_SONGLIST_DISCLAIMER, 'link' => 'page=disclaimer'],
100
-    ['name' => _MI_SONGLIST_LICENSE, 'link' => 'page=license'],
101
-    ['name' => _MI_SONGLIST_SUPPORT, 'link' => 'page=support'],
98
+	['name' => _MI_SONGLIST_OVERVIEW, 'link' => 'page=help'],
99
+	['name' => _MI_SONGLIST_DISCLAIMER, 'link' => 'page=disclaimer'],
100
+	['name' => _MI_SONGLIST_LICENSE, 'link' => 'page=license'],
101
+	['name' => _MI_SONGLIST_SUPPORT, 'link' => 'page=support'],
102 102
 ];
103 103
 
104 104
 // ------------------- Templates ------------------- //
105 105
 $modversion['templates'] = [
106
-    ['file' => 'songlist_albums_index.tpl', 'description' => ''],
107
-    ['file' => 'songlist_albums_item.tpl', 'description' => ''],
108
-    ['file' => 'songlist_albums_list.tpl', 'description' => ''],
109
-    ['file' => 'songlist_alpha_browse.tpl', 'description' => ''],
110
-    ['file' => 'songlist_artists_index.tpl', 'description' => ''],
111
-    ['file' => 'songlist_artists_item.tpl', 'description' => ''],
112
-    ['file' => 'songlist_artists_list.tpl', 'description' => ''],
113
-    ['file' => 'songlist_category_item.tpl', 'description' => ''],
114
-    ['file' => 'songlist_category_list.tpl', 'description' => ''],
115
-    ['file' => 'songlist_cpanel_albums_edit.tpl', 'description' => ''],
116
-    ['file' => 'songlist_cpanel_albums_list.tpl', 'description' => ''],
117
-    ['file' => 'songlist_cpanel_artists_edit.tpl', 'description' => ''],
118
-    ['file' => 'songlist_cpanel_artists_list.tpl', 'description' => ''],
119
-    ['file' => 'songlist_cpanel_category_edit.tpl', 'description' => ''],
120
-    ['file' => 'songlist_cpanel_category_list.tpl', 'description' => ''],
121
-    ['file' => 'songlist_cpanel_fieldlist.tpl', 'description' => ''],
122
-    ['file' => 'songlist_cpanel_genre_edit.tpl', 'description' => ''],
123
-    ['file' => 'songlist_cpanel_genre_list.tpl', 'description' => ''],
124
-    ['file' => 'songlist_cpanel_import_actiona.tpl', 'description' => ''],
125
-    ['file' => 'songlist_cpanel_import_actionb.tpl', 'description' => ''],
126
-    ['file' => 'songlist_cpanel_requests_edit.tpl', 'description' => ''],
127
-    ['file' => 'songlist_cpanel_requests_list.tpl', 'description' => ''],
128
-    ['file' => 'songlist_cpanel_songs_edit.tpl', 'description' => ''],
129
-    ['file' => 'songlist_cpanel_songs_list.tpl', 'description' => ''],
130
-    ['file' => 'songlist_cpanel_utf8map_edit.tpl', 'description' => ''],
131
-    ['file' => 'songlist_cpanel_utf8map_list.tpl', 'description' => ''],
132
-    ['file' => 'songlist_cpanel_visibility.tpl', 'description' => ''],
133
-    ['file' => 'songlist_cpanel_voice_edit.tpl', 'description' => ''],
134
-    ['file' => 'songlist_cpanel_voice_list.tpl', 'description' => ''],
135
-    ['file' => 'songlist_cpanel_votes_edit.tpl', 'description' => ''],
136
-    ['file' => 'songlist_cpanel_votes_list.tpl', 'description' => ''],
137
-    ['file' => 'songlist_requests_index.tpl', 'description' => ''],
138
-    ['file' => 'songlist_search_index.tpl', 'description' => ''],
139
-    ['file' => 'songlist_search_results.tpl', 'description' => ''],
140
-    ['file' => 'songlist_search_search.tpl', 'description' => ''],
141
-    ['file' => 'songlist_songs_index.tpl', 'description' => ''],
142
-    ['file' => 'songlist_songs_item.tpl', 'description' => ''],
143
-    ['file' => 'songlist_songs_list.tpl', 'description' => ''],
106
+	['file' => 'songlist_albums_index.tpl', 'description' => ''],
107
+	['file' => 'songlist_albums_item.tpl', 'description' => ''],
108
+	['file' => 'songlist_albums_list.tpl', 'description' => ''],
109
+	['file' => 'songlist_alpha_browse.tpl', 'description' => ''],
110
+	['file' => 'songlist_artists_index.tpl', 'description' => ''],
111
+	['file' => 'songlist_artists_item.tpl', 'description' => ''],
112
+	['file' => 'songlist_artists_list.tpl', 'description' => ''],
113
+	['file' => 'songlist_category_item.tpl', 'description' => ''],
114
+	['file' => 'songlist_category_list.tpl', 'description' => ''],
115
+	['file' => 'songlist_cpanel_albums_edit.tpl', 'description' => ''],
116
+	['file' => 'songlist_cpanel_albums_list.tpl', 'description' => ''],
117
+	['file' => 'songlist_cpanel_artists_edit.tpl', 'description' => ''],
118
+	['file' => 'songlist_cpanel_artists_list.tpl', 'description' => ''],
119
+	['file' => 'songlist_cpanel_category_edit.tpl', 'description' => ''],
120
+	['file' => 'songlist_cpanel_category_list.tpl', 'description' => ''],
121
+	['file' => 'songlist_cpanel_fieldlist.tpl', 'description' => ''],
122
+	['file' => 'songlist_cpanel_genre_edit.tpl', 'description' => ''],
123
+	['file' => 'songlist_cpanel_genre_list.tpl', 'description' => ''],
124
+	['file' => 'songlist_cpanel_import_actiona.tpl', 'description' => ''],
125
+	['file' => 'songlist_cpanel_import_actionb.tpl', 'description' => ''],
126
+	['file' => 'songlist_cpanel_requests_edit.tpl', 'description' => ''],
127
+	['file' => 'songlist_cpanel_requests_list.tpl', 'description' => ''],
128
+	['file' => 'songlist_cpanel_songs_edit.tpl', 'description' => ''],
129
+	['file' => 'songlist_cpanel_songs_list.tpl', 'description' => ''],
130
+	['file' => 'songlist_cpanel_utf8map_edit.tpl', 'description' => ''],
131
+	['file' => 'songlist_cpanel_utf8map_list.tpl', 'description' => ''],
132
+	['file' => 'songlist_cpanel_visibility.tpl', 'description' => ''],
133
+	['file' => 'songlist_cpanel_voice_edit.tpl', 'description' => ''],
134
+	['file' => 'songlist_cpanel_voice_list.tpl', 'description' => ''],
135
+	['file' => 'songlist_cpanel_votes_edit.tpl', 'description' => ''],
136
+	['file' => 'songlist_cpanel_votes_list.tpl', 'description' => ''],
137
+	['file' => 'songlist_requests_index.tpl', 'description' => ''],
138
+	['file' => 'songlist_search_index.tpl', 'description' => ''],
139
+	['file' => 'songlist_search_results.tpl', 'description' => ''],
140
+	['file' => 'songlist_search_search.tpl', 'description' => ''],
141
+	['file' => 'songlist_songs_index.tpl', 'description' => ''],
142
+	['file' => 'songlist_songs_item.tpl', 'description' => ''],
143
+	['file' => 'songlist_songs_list.tpl', 'description' => ''],
144 144
 ];
145 145
 
146 146
 // Submenus
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 $modversion['sub'][$i]['url']  = 'artists.php';
150 150
 ++$i;
151 151
 if (isset($GLOBALS['songlistModuleConfig']['album'])) {
152
-    if ($GLOBALS['songlistModuleConfig']['album']) {
153
-        $modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_ALBUMS;
154
-        $modversion['sub'][$i]['url']  = 'albums.php';
155
-        ++$i;
156
-    }
152
+	if ($GLOBALS['songlistModuleConfig']['album']) {
153
+		$modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_ALBUMS;
154
+		$modversion['sub'][$i]['url']  = 'albums.php';
155
+		++$i;
156
+	}
157 157
 }
158 158
 $modversion['sub'][$i]['name'] = _MI_SONGLIST_MENU_SEARCH;
159 159
 $modversion['sub'][$i]['url']  = 'search.php';
@@ -165,90 +165,90 @@  discard block
 block discarded – undo
165 165
 $i = 0;
166 166
 // ------------------- Blocks ------------------- //
167 167
 $modversion['blocks'][$i] = [
168
-    'file'        => 'songlist_popular_artist.php',
169
-    'name'        => _MI_SONGLIST_BLOCK_TOP_ARTIST,
170
-    'description' => 'Shows top artist',
171
-    'show_func'   => 'b_songlist_popular_artist_show',
172
-    'options'     => '',
173
-    'edit_func'   => 'b_songlist_popular_artist_edit',
174
-    'template'    => 'songlist_popular_artist.tpl',
168
+	'file'        => 'songlist_popular_artist.php',
169
+	'name'        => _MI_SONGLIST_BLOCK_TOP_ARTIST,
170
+	'description' => 'Shows top artist',
171
+	'show_func'   => 'b_songlist_popular_artist_show',
172
+	'options'     => '',
173
+	'edit_func'   => 'b_songlist_popular_artist_edit',
174
+	'template'    => 'songlist_popular_artist.tpl',
175 175
 ];
176 176
 
177 177
 ++$i;
178 178
 $modversion['blocks'][$i] = [
179
-    'file'        => 'songlist_popular_artists.php',
180
-    'name'        => _MI_SONGLIST_BLOCK_POPULAR_ARTISTS,
181
-    'description' => 'Shows popular artists',
182
-    'show_func'   => 'b_songlist_popular_artists_show',
183
-    'options'     => '6',
184
-    'edit_func'   => 'b_songlist_popular_artists_edit',
185
-    'template'    => 'songlist_popular_artists.tpl',
179
+	'file'        => 'songlist_popular_artists.php',
180
+	'name'        => _MI_SONGLIST_BLOCK_POPULAR_ARTISTS,
181
+	'description' => 'Shows popular artists',
182
+	'show_func'   => 'b_songlist_popular_artists_show',
183
+	'options'     => '6',
184
+	'edit_func'   => 'b_songlist_popular_artists_edit',
185
+	'template'    => 'songlist_popular_artists.tpl',
186 186
 ];
187 187
 
188 188
 ++$i;
189 189
 $modversion['blocks'][$i] = [
190
-    'file'        => 'songlist_popular_album.php',
191
-    'name'        => _MI_SONGLIST_BLOCK_TOP_ALBUM,
192
-    'description' => 'Shows top album',
193
-    'show_func'   => 'b_songlist_popular_album_show',
194
-    'options'     => '',
195
-    'edit_func'   => 'b_songlist_popular_album_edit',
196
-    'template'    => 'songlist_popular_album.tpl',
190
+	'file'        => 'songlist_popular_album.php',
191
+	'name'        => _MI_SONGLIST_BLOCK_TOP_ALBUM,
192
+	'description' => 'Shows top album',
193
+	'show_func'   => 'b_songlist_popular_album_show',
194
+	'options'     => '',
195
+	'edit_func'   => 'b_songlist_popular_album_edit',
196
+	'template'    => 'songlist_popular_album.tpl',
197 197
 ];
198 198
 
199 199
 ++$i;
200 200
 $modversion['blocks'][$i] = [
201
-    'file'        => 'songlist_popular_albums.php',
202
-    'name'        => _MI_SONGLIST_BLOCK_POPULAR_ALBUMS,
203
-    'description' => 'Shows popular albums',
204
-    'show_func'   => 'b_songlist_popular_albums_show',
205
-    'options'     => '6',
206
-    'edit_func'   => 'b_songlist_popular_albums_edit',
207
-    'template'    => 'songlist_popular_albums.tpl',
201
+	'file'        => 'songlist_popular_albums.php',
202
+	'name'        => _MI_SONGLIST_BLOCK_POPULAR_ALBUMS,
203
+	'description' => 'Shows popular albums',
204
+	'show_func'   => 'b_songlist_popular_albums_show',
205
+	'options'     => '6',
206
+	'edit_func'   => 'b_songlist_popular_albums_edit',
207
+	'template'    => 'songlist_popular_albums.tpl',
208 208
 ];
209 209
 
210 210
 ++$i;
211 211
 $modversion['blocks'][$i] = [
212
-    'file'        => 'songlist_popular_genre.php',
213
-    'name'        => _MI_SONGLIST_BLOCK_TOP_GENRE,
214
-    'description' => 'Shows top genre',
215
-    'show_func'   => 'b_songlist_popular_genre_show',
216
-    'options'     => '',
217
-    'edit_func'   => 'b_songlist_popular_genre_edit',
218
-    'template'    => 'songlist_popular_genre.tpl',
212
+	'file'        => 'songlist_popular_genre.php',
213
+	'name'        => _MI_SONGLIST_BLOCK_TOP_GENRE,
214
+	'description' => 'Shows top genre',
215
+	'show_func'   => 'b_songlist_popular_genre_show',
216
+	'options'     => '',
217
+	'edit_func'   => 'b_songlist_popular_genre_edit',
218
+	'template'    => 'songlist_popular_genre.tpl',
219 219
 ];
220 220
 
221 221
 ++$i;
222 222
 $modversion['blocks'][$i] = [
223
-    'file'        => 'songlist_popular_genres.php',
224
-    'name'        => _MI_SONGLIST_BLOCK_POPULAR_GENRES,
225
-    'description' => 'Shows popular genres',
226
-    'show_func'   => 'b_songlist_popular_genres_show',
227
-    'options'     => '6',
228
-    'edit_func'   => 'b_songlist_popular_genres_edit',
229
-    'template'    => 'songlist_popular_genres.tpl',
223
+	'file'        => 'songlist_popular_genres.php',
224
+	'name'        => _MI_SONGLIST_BLOCK_POPULAR_GENRES,
225
+	'description' => 'Shows popular genres',
226
+	'show_func'   => 'b_songlist_popular_genres_show',
227
+	'options'     => '6',
228
+	'edit_func'   => 'b_songlist_popular_genres_edit',
229
+	'template'    => 'songlist_popular_genres.tpl',
230 230
 ];
231 231
 
232 232
 ++$i;
233 233
 $modversion['blocks'][$i] = [
234
-    'file'        => 'songlist_popular_song.php',
235
-    'name'        => _MI_SONGLIST_BLOCK_TOP_SONG,
236
-    'description' => 'Shows top song',
237
-    'show_func'   => 'b_songlist_popular_song_show',
238
-    'options'     => '',
239
-    'edit_func'   => 'b_songlist_popular_song_edit',
240
-    'template'    => 'songlist_popular_song.tpl',
234
+	'file'        => 'songlist_popular_song.php',
235
+	'name'        => _MI_SONGLIST_BLOCK_TOP_SONG,
236
+	'description' => 'Shows top song',
237
+	'show_func'   => 'b_songlist_popular_song_show',
238
+	'options'     => '',
239
+	'edit_func'   => 'b_songlist_popular_song_edit',
240
+	'template'    => 'songlist_popular_song.tpl',
241 241
 ];
242 242
 
243 243
 ++$i;
244 244
 $modversion['blocks'][$i] = [
245
-    'file'        => 'songlist_popular_songs.php',
246
-    'name'        => _MI_SONGLIST_BLOCK_POPULAR_SONGS,
247
-    'description' => 'Shows popular songs',
248
-    'show_func'   => 'b_songlist_popular_songs_show',
249
-    'options'     => '6',
250
-    'edit_func'   => 'b_songlist_popular_songs_edit',
251
-    'template'    => 'songlist_popular_songs.tpl',
245
+	'file'        => 'songlist_popular_songs.php',
246
+	'name'        => _MI_SONGLIST_BLOCK_POPULAR_SONGS,
247
+	'description' => 'Shows popular songs',
248
+	'show_func'   => 'b_songlist_popular_songs_show',
249
+	'options'     => '6',
250
+	'edit_func'   => 'b_songlist_popular_songs_edit',
251
+	'template'    => 'songlist_popular_songs.tpl',
252 252
 ];
253 253
 
254 254
 // default admin editor
@@ -257,127 +257,127 @@  discard block
 block discarded – undo
257 257
 $editorList    = array_flip($editorHandler->getList());
258 258
 
259 259
 $modversion['config'][] = [
260
-    'name'        => 'editor',
261
-    'title'       => '_MI_SONGLIST_EDITORS',
262
-    'description' => '_MI_SONGLIST_EDITORS_DESC',
263
-    'formtype'    => 'select',
264
-    'valuetype'   => 'text',
265
-    'default'     => 'tinymce',
266
-    'options'     => $editorList,
260
+	'name'        => 'editor',
261
+	'title'       => '_MI_SONGLIST_EDITORS',
262
+	'description' => '_MI_SONGLIST_EDITORS_DESC',
263
+	'formtype'    => 'select',
264
+	'valuetype'   => 'text',
265
+	'default'     => 'tinymce',
266
+	'options'     => $editorList,
267 267
 ];
268 268
 
269 269
 $modversion['config'][] = [
270
-    'name'        => 'salt',
271
-    'title'       => '_MI_SONGLIST_SALT',
272
-    'description' => '_MI_SONGLIST_SALT_DESC',
273
-    'formtype'    => 'text',
274
-    'valuetype'   => 'text',
275
-    'default'     => (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
276
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
277
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
278
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
279
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
280
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
281
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
282
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
283
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
284
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
285
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
286
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
287
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
288
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : ''),
289
-
290
-    'options' => [],
270
+	'name'        => 'salt',
271
+	'title'       => '_MI_SONGLIST_SALT',
272
+	'description' => '_MI_SONGLIST_SALT_DESC',
273
+	'formtype'    => 'text',
274
+	'valuetype'   => 'text',
275
+	'default'     => (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
276
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
277
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
278
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
279
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
280
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
281
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
282
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
283
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
284
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
285
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
286
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
287
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
288
+					 . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : ''),
289
+
290
+	'options' => [],
291 291
 ];
292 292
 
293 293
 $modversion['config'][] = [
294
-    'name'        => 'cols',
295
-    'title'       => '_MI_SONGLIST_COLS',
296
-    'description' => '_MI_SONGLIST_COLS_DESC',
297
-    'formtype'    => 'text',
298
-    'valuetype'   => 'int',
299
-    'default'     => 4,
300
-    'options'     => [],
294
+	'name'        => 'cols',
295
+	'title'       => '_MI_SONGLIST_COLS',
296
+	'description' => '_MI_SONGLIST_COLS_DESC',
297
+	'formtype'    => 'text',
298
+	'valuetype'   => 'int',
299
+	'default'     => 4,
300
+	'options'     => [],
301 301
 ];
302 302
 
303 303
 $modversion['config'][] = [
304
-    'name'        => 'rows',
305
-    'title'       => '_MI_SONGLIST_ROWS',
306
-    'description' => '_MI_SONGLIST_ROWS_DESC',
307
-    'formtype'    => 'text',
308
-    'valuetype'   => 'int',
309
-    'default'     => 4,
310
-    'options'     => [],
304
+	'name'        => 'rows',
305
+	'title'       => '_MI_SONGLIST_ROWS',
306
+	'description' => '_MI_SONGLIST_ROWS_DESC',
307
+	'formtype'    => 'text',
308
+	'valuetype'   => 'int',
309
+	'default'     => 4,
310
+	'options'     => [],
311 311
 ];
312 312
 
313 313
 $modversion['config'][] = [
314
-    'name'        => 'email',
315
-    'title'       => '_MI_SONGLIST_EMAIL',
316
-    'description' => '_MI_SONGLIST_EMAIL_DESC',
317
-    'formtype'    => 'textarea',
318
-    'valuetype'   => 'text',
319
-    'default'     => $GLOBALS['xoopsConfig']['adminmail'],
320
-    'options'     => [],
314
+	'name'        => 'email',
315
+	'title'       => '_MI_SONGLIST_EMAIL',
316
+	'description' => '_MI_SONGLIST_EMAIL_DESC',
317
+	'formtype'    => 'textarea',
318
+	'valuetype'   => 'text',
319
+	'default'     => $GLOBALS['xoopsConfig']['adminmail'],
320
+	'options'     => [],
321 321
 ];
322 322
 
323 323
 $modversion['config'][] = [
324
-    'name'        => 'mp3_filesize',
325
-    'title'       => '_MI_SONGLIST_MP3FILESIZE',
326
-    'description' => '_MI_SONGLIST_MP3FILESIZE_DESC',
327
-    'formtype'    => 'textbox',
328
-    'valuetype'   => 'int',
329
-    'default'     => '195035100',
324
+	'name'        => 'mp3_filesize',
325
+	'title'       => '_MI_SONGLIST_MP3FILESIZE',
326
+	'description' => '_MI_SONGLIST_MP3FILESIZE_DESC',
327
+	'formtype'    => 'textbox',
328
+	'valuetype'   => 'int',
329
+	'default'     => '195035100',
330 330
 ];
331 331
 
332 332
 $modversion['config'][] = [
333
-    'name'        => 'mp3_mimetype',
334
-    'title'       => '_MI_SONGLIST_MP3MIMETYPE',
335
-    'description' => '_MI_SONGLIST_MP3MIMETYPE_DESC',
336
-    'formtype'    => 'textarea',
337
-    'valuetype'   => 'text',
338
-    'default'     => 'audio/mpeg|audio/x-mpeg|audio/mp3|audio/x-mp3|audio/mpeg3|audio/x-mpeg3|audio/mpg|audio/x-mpg|audio/x-mpegaudio',
333
+	'name'        => 'mp3_mimetype',
334
+	'title'       => '_MI_SONGLIST_MP3MIMETYPE',
335
+	'description' => '_MI_SONGLIST_MP3MIMETYPE_DESC',
336
+	'formtype'    => 'textarea',
337
+	'valuetype'   => 'text',
338
+	'default'     => 'audio/mpeg|audio/x-mpeg|audio/mp3|audio/x-mp3|audio/mpeg3|audio/x-mpeg3|audio/mpg|audio/x-mpg|audio/x-mpegaudio',
339 339
 ];
340 340
 
341 341
 $modversion['config'][] = [
342
-    'name'        => 'mp3_extensions',
343
-    'title'       => '_MI_SONGLIST_MP3EXTENSIONS',
344
-    'description' => '_MI_SONGLIST_MP3EXTENSIONS_DESC',
345
-    'formtype'    => 'textarea',
346
-    'valuetype'   => 'text',
347
-    'default'     => 'mp3',
342
+	'name'        => 'mp3_extensions',
343
+	'title'       => '_MI_SONGLIST_MP3EXTENSIONS',
344
+	'description' => '_MI_SONGLIST_MP3EXTENSIONS_DESC',
345
+	'formtype'    => 'textarea',
346
+	'valuetype'   => 'text',
347
+	'default'     => 'mp3',
348 348
 ];
349 349
 
350 350
 $modversion['config'][] = [
351
-    'name'        => 'filesize_upload',
352
-    'title'       => '_MI_SONGLIST_FILESIZEUPLD',
353
-    'description' => '_MI_SONGLIST_FILESIZEUPLD_DESC',
354
-    'formtype'    => 'textbox',
355
-    'valuetype'   => 'int',
356
-    'default'     => '1950351',
351
+	'name'        => 'filesize_upload',
352
+	'title'       => '_MI_SONGLIST_FILESIZEUPLD',
353
+	'description' => '_MI_SONGLIST_FILESIZEUPLD_DESC',
354
+	'formtype'    => 'textbox',
355
+	'valuetype'   => 'int',
356
+	'default'     => '1950351',
357 357
 ];
358 358
 
359 359
 $modversion['config'][] = [
360
-    'name'        => 'allowed_mimetype',
361
-    'title'       => '_MI_SONGLIST_ALLOWEDMIMETYPE',
362
-    'description' => '_MI_SONGLIST_ALLOWEDMIMETYPE_DESC',
363
-    'formtype'    => 'textarea',
364
-    'valuetype'   => 'text',
365
-    'default'     => 'image/gif|image/pjpeg|image/jpeg|image/x-png|image/png',
360
+	'name'        => 'allowed_mimetype',
361
+	'title'       => '_MI_SONGLIST_ALLOWEDMIMETYPE',
362
+	'description' => '_MI_SONGLIST_ALLOWEDMIMETYPE_DESC',
363
+	'formtype'    => 'textarea',
364
+	'valuetype'   => 'text',
365
+	'default'     => 'image/gif|image/pjpeg|image/jpeg|image/x-png|image/png',
366 366
 ];
367 367
 
368 368
 $modversion['config'][] = [
369
-    'name'        => 'allowed_extensions',
370
-    'title'       => '_MI_SONGLIST_ALLOWEDEXTENSIONS',
371
-    'description' => '_MI_SONGLIST_ALLOWEDEXTENSIONS_DESC',
372
-    'formtype'    => 'textarea',
373
-    'valuetype'   => 'text',
374
-    'default'     => 'gif|pjpeg|jpeg|jpg|png',
369
+	'name'        => 'allowed_extensions',
370
+	'title'       => '_MI_SONGLIST_ALLOWEDEXTENSIONS',
371
+	'description' => '_MI_SONGLIST_ALLOWEDEXTENSIONS_DESC',
372
+	'formtype'    => 'textarea',
373
+	'valuetype'   => 'text',
374
+	'default'     => 'gif|pjpeg|jpeg|jpg|png',
375 375
 ];
376 376
 
377 377
 $modversion['config'][] = [
378
-    'name'        => 'upload_areas',
379
-    'title'       => '_MI_SONGLIST_UPLOADAREAS',
380
-    'description' => '_MI_SONGLIST_UPLOADAREAS_DESC',
378
+	'name'        => 'upload_areas',
379
+	'title'       => '_MI_SONGLIST_UPLOADAREAS',
380
+	'description' => '_MI_SONGLIST_UPLOADAREAS_DESC',
381 381
 //    'formtype'    => 'select',
382 382
 //    'valuetype'   => 'text',
383 383
 //    'default'     => 'uploads' . DS . 'songlist' . DS,
@@ -385,45 +385,45 @@  discard block
 block discarded – undo
385 385
 //        'uploads' . DS                   => 'uploads' . DS,
386 386
 //        'uploads' . DS . 'songlist' . DS => 'uploads' . DS . 'songlist' . DS,
387 387
 //],
388
-    'formtype'    => 'textbox',
389
-    'valuetype'   => 'text',
390
-    'default'     => '/uploads/songlist/',
388
+	'formtype'    => 'textbox',
389
+	'valuetype'   => 'text',
390
+	'default'     => '/uploads/songlist/',
391 391
 ];
392 392
 
393 393
 $modversion['config'][] = [
394
-    'name'        => 'album',
395
-    'title'       => '_MI_SONGLIST_ALBUM',
396
-    'description' => '_MI_SONGLIST_ALBUM_DESC',
397
-    'formtype'    => 'yesno',
398
-    'valuetype'   => 'int',
399
-    'default'     => '0',
394
+	'name'        => 'album',
395
+	'title'       => '_MI_SONGLIST_ALBUM',
396
+	'description' => '_MI_SONGLIST_ALBUM_DESC',
397
+	'formtype'    => 'yesno',
398
+	'valuetype'   => 'int',
399
+	'default'     => '0',
400 400
 ];
401 401
 
402 402
 $modversion['config'][] = [
403
-    'name'        => 'genre',
404
-    'title'       => '_MI_SONGLIST_GENRE',
405
-    'description' => '_MI_SONGLIST_GENRE_DESC',
406
-    'formtype'    => 'yesno',
407
-    'valuetype'   => 'int',
408
-    'default'     => '0',
403
+	'name'        => 'genre',
404
+	'title'       => '_MI_SONGLIST_GENRE',
405
+	'description' => '_MI_SONGLIST_GENRE_DESC',
406
+	'formtype'    => 'yesno',
407
+	'valuetype'   => 'int',
408
+	'default'     => '0',
409 409
 ];
410 410
 
411 411
 $modversion['config'][] = [
412
-    'name'        => 'voice',
413
-    'title'       => '_MI_SONGLIST_VOICE',
414
-    'description' => '_MI_SONGLIST_VOICE_DESC',
415
-    'formtype'    => 'yesno',
416
-    'valuetype'   => 'int',
417
-    'default'     => '0',
412
+	'name'        => 'voice',
413
+	'title'       => '_MI_SONGLIST_VOICE',
414
+	'description' => '_MI_SONGLIST_VOICE_DESC',
415
+	'formtype'    => 'yesno',
416
+	'valuetype'   => 'int',
417
+	'default'     => '0',
418 418
 ];
419 419
 
420 420
 $modversion['config'][] = [
421
-    'name'        => 'lyrics',
422
-    'title'       => '_MI_SONGLIST_LYRICS',
423
-    'description' => '_MI_SONGLIST_LYRICS_DESC',
424
-    'formtype'    => 'yesno',
425
-    'valuetype'   => 'int',
426
-    'default'     => '0',
421
+	'name'        => 'lyrics',
422
+	'title'       => '_MI_SONGLIST_LYRICS',
423
+	'description' => '_MI_SONGLIST_LYRICS_DESC',
424
+	'formtype'    => 'yesno',
425
+	'valuetype'   => 'int',
426
+	'default'     => '0',
427 427
 ];
428 428
 
429 429
 /*
@@ -438,110 +438,110 @@  discard block
 block discarded – undo
438 438
 */
439 439
 
440 440
 $modversion['config'][] = [
441
-    'name'        => 'htaccess',
442
-    'title'       => '_MI_SONGLIST_HTACCESS',
443
-    'description' => '_MI_SONGLIST_HTACCESS_DESC',
444
-    'formtype'    => 'yesno',
445
-    'valuetype'   => 'int',
446
-    'default'     => '0',
441
+	'name'        => 'htaccess',
442
+	'title'       => '_MI_SONGLIST_HTACCESS',
443
+	'description' => '_MI_SONGLIST_HTACCESS_DESC',
444
+	'formtype'    => 'yesno',
445
+	'valuetype'   => 'int',
446
+	'default'     => '0',
447 447
 ];
448 448
 
449 449
 $modversion['config'][] = [
450
-    'name'        => 'baseofurl',
451
-    'title'       => '_MI_SONGLIST_HTACCESS_BASEOFURL',
452
-    'description' => '_MI_SONGLIST_HTACCESS_BASEOFURL_DESC',
453
-    'formtype'    => 'text',
454
-    'valuetype'   => 'text',
455
-    'default'     => 'songlist',
450
+	'name'        => 'baseofurl',
451
+	'title'       => '_MI_SONGLIST_HTACCESS_BASEOFURL',
452
+	'description' => '_MI_SONGLIST_HTACCESS_BASEOFURL_DESC',
453
+	'formtype'    => 'text',
454
+	'valuetype'   => 'text',
455
+	'default'     => 'songlist',
456 456
 ];
457 457
 
458 458
 $modversion['config'][] = [
459
-    'name'        => 'endofurl',
460
-    'title'       => '_MI_SONGLIST_HTACCESS_ENDOFURL',
461
-    'description' => '_MI_SONGLIST_HTACCESS_ENDOFURL_DESC',
462
-    'formtype'    => 'text',
463
-    'valuetype'   => 'text',
464
-    'default'     => '.tpl',
459
+	'name'        => 'endofurl',
460
+	'title'       => '_MI_SONGLIST_HTACCESS_ENDOFURL',
461
+	'description' => '_MI_SONGLIST_HTACCESS_ENDOFURL_DESC',
462
+	'formtype'    => 'text',
463
+	'valuetype'   => 'text',
464
+	'default'     => '.tpl',
465 465
 ];
466 466
 
467 467
 $modversion['config'][] = [
468
-    'name'        => 'tags',
469
-    'title'       => '_MI_SONGLIST_TAGS',
470
-    'description' => '_MI_SONGLIST_TAGS_DESC',
471
-    'formtype'    => 'yesno',
472
-    'valuetype'   => 'int',
473
-    'default'     => '0',
468
+	'name'        => 'tags',
469
+	'title'       => '_MI_SONGLIST_TAGS',
470
+	'description' => '_MI_SONGLIST_TAGS_DESC',
471
+	'formtype'    => 'yesno',
472
+	'valuetype'   => 'int',
473
+	'default'     => '0',
474 474
 ];
475 475
 
476 476
 $modversion['config'][] = [
477
-    'name'        => 'force_jquery',
478
-    'title'       => '_MI_SONGLIST_FORCE_JQUERY',
479
-    'description' => '_MI_SONGLIST_FORCE_JQUERY_DESC',
480
-    'formtype'    => 'yesno',
481
-    'valuetype'   => 'int',
482
-    'default'     => true,
477
+	'name'        => 'force_jquery',
478
+	'title'       => '_MI_SONGLIST_FORCE_JQUERY',
479
+	'description' => '_MI_SONGLIST_FORCE_JQUERY_DESC',
480
+	'formtype'    => 'yesno',
481
+	'valuetype'   => 'int',
482
+	'default'     => true,
483 483
 ];
484 484
 
485 485
 $modversion['config'][] = [
486
-    'name'        => 'memory_admin',
487
-    'title'       => '_MI_SONGLIST_MEMORY_ADMIN',
488
-    'description' => '_MI_SONGLIST_MEMORY_ADMIN_DESC',
489
-    'formtype'    => 'text',
490
-    'valuetype'   => 'int',
491
-    'default'     => 128,
492
-    'options'     => [],
486
+	'name'        => 'memory_admin',
487
+	'title'       => '_MI_SONGLIST_MEMORY_ADMIN',
488
+	'description' => '_MI_SONGLIST_MEMORY_ADMIN_DESC',
489
+	'formtype'    => 'text',
490
+	'valuetype'   => 'int',
491
+	'default'     => 128,
492
+	'options'     => [],
493 493
 ];
494 494
 
495 495
 $modversion['config'][] = [
496
-    'name'        => 'memory_user',
497
-    'title'       => '_MI_SONGLIST_MEMORY_USER',
498
-    'description' => '_MI_SONGLIST_MEMORY_USER_DESC',
499
-    'formtype'    => 'text',
500
-    'valuetype'   => 'int',
501
-    'default'     => 128,
502
-    'options'     => [],
496
+	'name'        => 'memory_user',
497
+	'title'       => '_MI_SONGLIST_MEMORY_USER',
498
+	'description' => '_MI_SONGLIST_MEMORY_USER_DESC',
499
+	'formtype'    => 'text',
500
+	'valuetype'   => 'int',
501
+	'default'     => 128,
502
+	'options'     => [],
503 503
 ];
504 504
 
505 505
 $modversion['config'][] = [
506
-    'name'        => 'time_admin',
507
-    'title'       => '_MI_SONGLIST_TIME_ADMIN',
508
-    'description' => '_MI_SONGLIST_TIME_ADMIN_DESC',
509
-    'formtype'    => 'text',
510
-    'valuetype'   => 'int',
511
-    'default'     => 360,
512
-    'options'     => [],
506
+	'name'        => 'time_admin',
507
+	'title'       => '_MI_SONGLIST_TIME_ADMIN',
508
+	'description' => '_MI_SONGLIST_TIME_ADMIN_DESC',
509
+	'formtype'    => 'text',
510
+	'valuetype'   => 'int',
511
+	'default'     => 360,
512
+	'options'     => [],
513 513
 ];
514 514
 
515 515
 $modversion['config'][] = [
516
-    'name'        => 'time_user',
517
-    'title'       => '_MI_SONGLIST_TIME_USER',
518
-    'description' => '_MI_SONGLIST_TIME_USER_DESC',
519
-    'formtype'    => 'text',
520
-    'valuetype'   => 'int',
521
-    'default'     => 360,
522
-    'options'     => [],
516
+	'name'        => 'time_user',
517
+	'title'       => '_MI_SONGLIST_TIME_USER',
518
+	'description' => '_MI_SONGLIST_TIME_USER_DESC',
519
+	'formtype'    => 'text',
520
+	'valuetype'   => 'int',
521
+	'default'     => 360,
522
+	'options'     => [],
523 523
 ];
524 524
 
525 525
 /**
526 526
  * Make Sample button visible?
527 527
  */
528 528
 $modversion['config'][] = [
529
-    'name'        => 'displaySampleButton',
530
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
531
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
532
-    'formtype'    => 'yesno',
533
-    'valuetype'   => 'int',
534
-    'default'     => 1,
529
+	'name'        => 'displaySampleButton',
530
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
531
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
532
+	'formtype'    => 'yesno',
533
+	'valuetype'   => 'int',
534
+	'default'     => 1,
535 535
 ];
536 536
 
537 537
 /**
538 538
  * Show Developer Tools?
539 539
  */
540 540
 $modversion['config'][] = [
541
-    'name'        => 'displayDeveloperTools',
542
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS',
543
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC',
544
-    'formtype'    => 'yesno',
545
-    'valuetype'   => 'int',
546
-    'default'     => 0,
541
+	'name'        => 'displayDeveloperTools',
542
+	'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS',
543
+	'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC',
544
+	'formtype'    => 'yesno',
545
+	'valuetype'   => 'int',
546
+	'default'     => 0,
547 547
 ];
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php declare(strict_types=1);
2 2
 
3
-require_once __DIR__ . '/preloads/autoloader.php';
3
+require_once __DIR__.'/preloads/autoloader.php';
4 4
 
5 5
 error_reporting(E_ALL);
6 6
 $moduleDirName      = basename(__DIR__);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 $modversion['releasedate']         = 'Thursday, 03rd July, 2022';
30 30
 $modversion['website']             = 'www.chronolabs.coop';
31 31
 $modversion['release_info']        = 'Stable 2012/08/16';
32
-$modversion['release_file']        = XOOPS_URL . '/modules/songlist/docs/changelog.txt';
32
+$modversion['release_file']        = XOOPS_URL.'/modules/songlist/docs/changelog.txt';
33 33
 $modversion['author_realname']     = 'Wishcraft';
34 34
 $modversion['author_website_url']  = 'https://www.chronolabs.coop';
35 35
 $modversion['author_website_name'] = 'Chronolabs';
@@ -52,18 +52,18 @@  discard block
 block discarded – undo
52 52
 
53 53
 // ------------------- Tables ------------------ //
54 54
 $modversion['tables'] = [
55
-    $moduleDirName . '_' . 'albums',
56
-    $moduleDirName . '_' . 'artists',
57
-    $moduleDirName . '_' . 'category',
58
-    $moduleDirName . '_' . 'extra',
59
-    $moduleDirName . '_' . 'field',
60
-    $moduleDirName . '_' . 'genre',
61
-    $moduleDirName . '_' . 'voice',
62
-    $moduleDirName . '_' . 'requests',
63
-    $moduleDirName . '_' . 'songs',
64
-    $moduleDirName . '_' . 'utf8map',
65
-    $moduleDirName . '_' . 'visibility',
66
-    $moduleDirName . '_' . 'votes',
55
+    $moduleDirName.'_'.'albums',
56
+    $moduleDirName.'_'.'artists',
57
+    $moduleDirName.'_'.'category',
58
+    $moduleDirName.'_'.'extra',
59
+    $moduleDirName.'_'.'field',
60
+    $moduleDirName.'_'.'genre',
61
+    $moduleDirName.'_'.'voice',
62
+    $moduleDirName.'_'.'requests',
63
+    $moduleDirName.'_'.'songs',
64
+    $moduleDirName.'_'.'utf8map',
65
+    $moduleDirName.'_'.'visibility',
66
+    $moduleDirName.'_'.'votes',
67 67
 ];
68 68
 
69 69
 // Admin things
@@ -272,20 +272,20 @@  discard block
 block discarded – undo
272 272
     'description' => '_MI_SONGLIST_SALT_DESC',
273 273
     'formtype'    => 'text',
274 274
     'valuetype'   => 'text',
275
-    'default'     => (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
276
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
277
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
278
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
279
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
280
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
281
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
282
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
283
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
284
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
285
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
286
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
287
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : '')
288
-                     . (2 != random_int(0, 4) ? chr(random_int(32, 190)) : ''),
275
+    'default'     => (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
276
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
277
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
278
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
279
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
280
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
281
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
282
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
283
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
284
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
285
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
286
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
287
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : '')
288
+                     . (2!=random_int(0, 4) ? chr(random_int(32, 190)) : ''),
289 289
 
290 290
     'options' => [],
291 291
 ];
@@ -527,8 +527,8 @@  discard block
 block discarded – undo
527 527
  */
528 528
 $modversion['config'][] = [
529 529
     'name'        => 'displaySampleButton',
530
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON',
531
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC',
530
+    'title'       => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON',
531
+    'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_SAMPLE_BUTTON_DESC',
532 532
     'formtype'    => 'yesno',
533 533
     'valuetype'   => 'int',
534 534
     'default'     => 1,
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
  */
540 540
 $modversion['config'][] = [
541 541
     'name'        => 'displayDeveloperTools',
542
-    'title'       => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS',
543
-    'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC',
542
+    'title'       => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_DEV_TOOLS',
543
+    'description' => 'CO_'.$moduleDirNameUpper.'_'.'SHOW_DEV_TOOLS_DESC',
544 544
     'formtype'    => 'yesno',
545 545
     'valuetype'   => 'int',
546 546
     'default'     => 0,
Please login to merge, or discard this patch.