Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates #2

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
62f476e
Karioki Songlist Manifest (Backup Only - Incomplete) - Still to do, t…
Mar 20, 2012
206c00f
Karioki Songlist Manifest (Backup Only - Incomplete) - Still to do, u…
Mar 21, 2012
43e0eea
Karioki Song List 1.07 - complete first release final
Mar 25, 2012
ff67191
Karioki Song List 1.07 - complete first release final (sql/mysql.sql …
Mar 26, 2012
b537c65
Karioki Song List 1.07 - complete first release final (sql/mysql.sql …
Mar 26, 2012
8bbd9c1
Karioki Song List 1.07 - complete first release final (Admin Warning/…
Mar 26, 2012
afb6b49
Karioki Song List 1.07 - complete first release final (Admin about.php)
Mar 26, 2012
9933e54
Karioki Song List 1.07 - complete first release final (final fixes)
Mar 26, 2012
d11839a
Karioki Song List 1.09 - complete second release - final - DB Optimiz…
Mar 26, 2012
cadd15f
Karioki Song List 1.09 - complete second release - final - DB Optimiz…
Mar 26, 2012
1cd9083
Karioki Song List 1.09 - complete second release - production - Form …
Mar 27, 2012
a34ff4c
Karioki Song List 1.10 - complete third release - production - All Li…
Mar 30, 2012
b7e280f
Karioki Song List 1.10 - complete third release - production - All Li…
Apr 4, 2012
93426c2
Karioki Song List 1.10 - complete third release - production - All Li…
Apr 4, 2012
1bbaa7f
Karioki Song List 1.10 - complete third release - production - All Li…
Apr 5, 2012
b681636
Song List 1.11 - Hymn or Karaoke Song List for XOOPS 2.5 (Production)
Apr 29, 2012
70cd626
Songlist 1.13 - Major Bug Fixes (See changelog.txt)
Aug 7, 2012
cd9b905
Removing space from "define (", which is required for Transifex
Aug 11, 2012
732b993
Removing spaces from "define", which is required for Transifex per DC…
Aug 11, 2012
139679d
Songlist 1.14 - MP3 Playback and Upload/Import
Aug 15, 2012
857b137
Update
mambax7 Sep 23, 2015
0c46455
updates
mambax7 Jan 18, 2016
27f1249
Remove pass-by-reference instances
mambax7 May 24, 2017
ed55b2a
Merge pull request #1 from mambax7/master
mambax7 May 24, 2017
84c1d99
Merge branch 'master' of https://github.com/mambax7/songlist into mas…
mambax7 Jul 3, 2022
34d995e
Testdata
mambax7 Jul 4, 2022
b2d4289
Array access can be replaced with 'foreach' value
mambax7 Jul 4, 2022
417f779
delete obsolete files
mambax7 Jul 4, 2022
ac0f12e
rename folder to EXTRA
mambax7 Jul 4, 2022
7d6f3b9
cleanup
mambax7 Jul 4, 2022
7161f50
rename set_ini to ini_set
mambax7 Jul 4, 2022
1b450eb
Xmf\Request
mambax7 Jul 4, 2022
b290eb3
undefined variable
mambax7 Jul 4, 2022
19bf897
namespaces
mambax7 Jul 4, 2022
ebd5565
Scrutinizer
mambax7 Jul 4, 2022
096cd43
Xmf\Request
mambax7 Jul 4, 2022
52b990a
Short form of type keywords
mambax7 Jul 4, 2022
9bddff1
Case mismatch in method call or class usage
mambax7 Jul 4, 2022
3955d8a
Traditional syntax array
mambax7 Jul 4, 2022
2807522
Unnecessary double quotes
mambax7 Jul 4, 2022
955b7d3
'if' with common parts
mambax7 Jul 4, 2022
f0ad54e
Unreachable statement
mambax7 Jul 4, 2022
415d364
PhpDoc
mambax7 Jul 4, 2022
a555e2e
Type casting
mambax7 Jul 4, 2022
3d40b21
Unqualified function/constant reference
mambax7 Jul 4, 2022
1da332b
Duplication
mambax7 Jul 4, 2022
ebc72f9
English
mambax7 Jul 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions EXTRA/modules/tag/plugin/songlist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
if (!defined('XOOPS_ROOT_PATH')) { exit(); }

/**
* @param $items
*
* @return false|void
*/
function songlist_tag_iteminfo(&$items)
{
if (empty($items) || !is_array($items)) {
return false;
}

$items_id = [];
foreach (array_keys($items) as $cat_id) {
// Some handling here to build the link upon catid
// catid is not used in songlist, so just skip it
foreach (array_keys($items[$cat_id]) as $item_id) {
// In songlist, the item_id is "topic_id"
$items_id[] = (int)$item_id;
}
}
$item_handler =& xoops_getModuleHandler('songs', 'songlist');
$items_obj = $item_handler->getObjects(new Criteria('sid', '(' . implode(', ', $items_id) . ')', 'IN'), true);
$myts = MyTextSanitizer::getInstance();
foreach (array_keys($items) as $cat_id) {
foreach (array_keys($items[$cat_id]) as $item_id) {
$item_obj =& $items_obj[$item_id];
if (is_object($item_obj))
$items[$cat_id][$item_id] = [
'title' => $item_obj->getVar('title'),
'uid' => $item_obj->getVar('uid'),
'link' => 'index.php?op=item&fct=item&id=' . $item_obj->getVar('sid') . '&cid=' . $item_obj->getVar('cid'),
'time' => $item_obj->getVar('date'),
'tags' => tag_parse_tag($item_obj->getVar('tags', 'n')),
'content' => $myts->displayTarea($item_obj->getVar('lyrics'), true, true, true, true, true, true)
];
}
}
unset($items_obj);
}

/**
* Remove orphan tag-item links
*
* @return bool
*
*/
function songlist_tag_synchronization($mid)
{
$item_handler =& xoops_getModuleHandler('songs', 'songlist');
$link_handler =& xoops_getModuleHandler('link', 'tag');

/* clear tag-item links */
if (version_compare(mysql_get_server_info(), '4.1.0', 'ge')):
$sql = " DELETE FROM {$link_handler->table}" .
' WHERE ' .
" tag_modid = {$mid}" .
' AND ' .
' ( tag_itemid NOT IN ' .
" ( SELECT DISTINCT {$item_handler->keyName} " .
" FROM {$item_handler->table} " .
" WHERE {$item_handler->table}.approved > 0" .
' ) ' .
' )';
else:
$sql = " DELETE {$link_handler->table} FROM {$link_handler->table}" .
" LEFT JOIN {$item_handler->table} AS aa ON {$link_handler->table}.tag_itemid = aa.{$item_handler->keyName} " .
' WHERE ' .
" tag_modid = {$mid}" .
' AND ' .
" ( aa.{$item_handler->keyName} IS NULL" .
' OR aa.approved < 1' .
' )';
endif;
if (!$result = $link_handler->db->queryF($sql)) {
//xoops_error($link_handler->db->error());
}
}
?>
31 changes: 16 additions & 15 deletions admin/albums.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@

use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\Helper;
use XoopsModules\Songlist\Uploader;
use XoopsModules\Songlist\AlbumsHandler;
use XoopsModules\Songlist\Form\FormController;
use XoopsModules\Songlist\{
Form\FormController,
Helper,
Uploader,
Albums,
AlbumsHandler
};

/** @var Albums $album */

require __DIR__ . '/header.php';

xoops_loadLanguage('admin', 'songlist');

xoops_cp_header();

$op = $_REQUEST['op'] ?? 'albums';
$fct = $_REQUEST['fct'] ?? 'list';
$op = Request::getString('op', 'albums', 'REQUEST');
$fct = Request::getString('fct', 'list', 'REQUEST');
$limit = Request::getInt('limit', 30, 'REQUEST');
$start = Request::getInt('start', 0, 'REQUEST');
$order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
$order = Request::getString('order', 'DESC', 'REQUEST');
$sort = Request::getString('sort', 'created', 'REQUEST');
$filter = Request::getString('filter', '1,1', 'REQUEST');

switch ($op) {
default:
Expand All @@ -35,7 +40,7 @@

$criteria = $albumsHandler->getFilterCriteria($GLOBALS['filter']);
$ttl = $albumsHandler->getCount($criteria);
$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');

$pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
Expand Down Expand Up @@ -76,7 +81,7 @@
$criteria->setSort('`' . $GLOBALS['sort'] . '`');
$criteria->setOrder($GLOBALS['order']);

$albumsArray = $albumsHandler->getObjects($criteria, true);
$albumsArray = $albumsHandler->getObjects($criteria, true);
foreach ($albumsArray as $cid => $album) {
if (is_object($album)) {
$GLOBALS['xoopsTpl']->append('albums', $album->toArray());
Expand Down Expand Up @@ -178,8 +183,6 @@
redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_ALBUMS_SAVEDOKEY);
}
exit(0);

break;
case 'savelist':
$albumsHandler = Helper::getInstance()->getHandler('Albums');
foreach ($_REQUEST['id'] as $id) {
Expand All @@ -196,7 +199,6 @@
}
redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_ALBUMS_SAVEDOKEY);
exit(0);
break;
case 'delete':
$albumsHandler = Helper::getInstance()->getHandler('Albums');
$id = 0;
Expand All @@ -222,7 +224,6 @@

break;
}
break;
}

xoops_cp_footer();
27 changes: 14 additions & 13 deletions admin/artists.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@

use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\Helper;
use XoopsModules\Songlist\ArtistsHandler;
use XoopsModules\Songlist\Form\FormController;
use XoopsModules\Songlist\{
Form\FormController,
Helper,
Artists,
ArtistsHandler
};

/** @var Artists $artist */

require __DIR__ . '/header.php';

xoops_loadLanguage('admin', 'songlist');

xoops_cp_header();

$op = $_REQUEST['op'] ?? 'artists';
$fct = $_REQUEST['fct'] ?? 'list';
$op = Request::getString('op', 'artists', 'REQUEST');
$fct = Request::getString('fct', 'list', 'REQUEST');
$limit = Request::getInt('limit', 30, 'REQUEST');
$start = Request::getInt('start', 0, 'REQUEST');
$order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
$order = Request::getString('order', 'DESC', 'REQUEST');
$sort = Request::getString('sort', 'created', 'REQUEST');
$filter = Request::getString('filter', '1,1', 'REQUEST');

switch ($op) {
default:
Expand All @@ -34,7 +39,7 @@

$criteria = $artistsHandler->getFilterCriteria($GLOBALS['filter']);
$ttl = $artistsHandler->getCount($criteria);
$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');;

$pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
Expand Down Expand Up @@ -126,8 +131,6 @@
redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_ARTISTS_SAVEDOKEY);
}
exit(0);

break;
case 'savelist':
$artistsHandler = Helper::getInstance()->getHandler('Artists');
foreach ($_REQUEST['id'] as $id) {
Expand All @@ -144,7 +147,6 @@
}
redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_ARTISTS_SAVEDOKEY);
exit(0);
break;
case 'delete':
$artistsHandler = Helper::getInstance()->getHandler('Artists');
$id = 0;
Expand All @@ -170,7 +172,6 @@

break;
}
break;
}

xoops_cp_footer();
29 changes: 15 additions & 14 deletions admin/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@

use Xmf\Module\Admin;
use Xmf\Request;
use XoopsModules\Songlist\Helper;
use XoopsModules\Songlist\Uploader;
use XoopsModules\Songlist\CategoryHandler;
use XoopsModules\Songlist\Form\FormController;
use XoopsModules\Songlist\{
Form\FormController,
Helper,
Category,
CategoryHandler,
Uploader
};

/** @var Category $category */

require __DIR__ . '/header.php';

xoops_loadLanguage('admin', 'songlist');

xoops_cp_header();

$op = $_REQUEST['op'] ?? 'category';
$fct = $_REQUEST['fct'] ?? 'list';
$op = Request::getString('op', 'category', 'REQUEST');
$fct = Request::getString('fct', 'list', 'REQUEST');
$limit = Request::getInt('limit', 30, 'REQUEST');
$start = Request::getInt('start', 0, 'REQUEST');
$order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
$order = Request::getString('order', 'DESC', 'REQUEST');
$sort = Request::getString('sort', 'created', 'REQUEST');
$filter = Request::getString('filter', '1,1', 'REQUEST');

switch ($op) {
default:
Expand All @@ -35,7 +40,7 @@

$criteria = $categoryHandler->getFilterCriteria($GLOBALS['filter']);
$ttl = $categoryHandler->getCount($criteria);
$GLOBALS['sort'] = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$GLOBALS['sort'] = Request::getString('sort', 'created', 'REQUEST');;

$pagenav = new \XoopsPageNav($ttl, $GLOBALS['limit'], $GLOBALS['start'], 'start', 'limit=' . $GLOBALS['limit'] . '&sort=' . $GLOBALS['sort'] . '&order=' . $GLOBALS['order'] . '&op=' . $GLOBALS['op'] . '&fct=' . $GLOBALS['fct'] . '&filter=' . $GLOBALS['filter']);
$GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav());
Expand Down Expand Up @@ -178,8 +183,6 @@
redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_CATEGORY_SAVEDOKEY);
}
exit(0);

break;
case 'savelist':
$categoryHandler = Helper::getInstance()->getHandler('Category');
foreach ($_REQUEST['id'] as $id) {
Expand All @@ -196,7 +199,6 @@
}
redirect_header($_SERVER['SCRIPT_NAME'] . '?op=' . $GLOBALS['op'] . '&fct=list&limit=' . $GLOBALS['limit'] . '&start=' . $GLOBALS['start'] . '&order=' . $GLOBALS['order'] . '&sort=' . $GLOBALS['sort'] . '&filter=' . $GLOBALS['filter'], 10, _AM_SONGLIST_MSG_CATEGORY_SAVEDOKEY);
exit(0);
break;
case 'delete':
$categoryHandler = Helper::getInstance()->getHandler('Category');
$id = 0;
Expand All @@ -222,7 +224,6 @@

break;
}
break;
}

xoops_cp_footer();
60 changes: 14 additions & 46 deletions admin/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

xoops_cp_header();

$op = $_REQUEST['op'] ?? 'index';
$op = Request::getString('op', 'index', 'REQUEST');
$fct = Request::getString('fct', '', 'REQUEST');
$limit = Request::getInt('limit', 30, 'REQUEST');
$start = Request::getInt('start', 0, 'REQUEST');
$order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC';
$sort = !empty($_REQUEST['sort']) ? '' . $_REQUEST['sort'] . '' : 'created';
$filter = !empty($_REQUEST['filter']) ? '' . $_REQUEST['filter'] . '' : '1,1';
$order = Request::getString('order', 'DESC', 'REQUEST');
$sort = Request::getString('sort', 'created', 'REQUEST');
$filter = Request::getString('filter', '1,1', 'REQUEST');

$albumsHandler = Helper::getInstance()->getHandler('Albums');
$albumsHandler = Helper::getInstance()->getHandler('Albums');
$songsHandler = Helper::getInstance()->getHandler('Songs');
$artistsHandler = Helper::getInstance()->getHandler('Artists');
$genreHandler = Helper::getInstance()->getHandler('Genre');
Expand Down Expand Up @@ -99,7 +99,7 @@
$filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'] . $_SESSION['xmlfile']));
$mb = floor($filesize / 1024 / 1024);
if ($mb > 32) {
set_ini('memory_limit', ($mb + 128) . 'M');
ini_set('memory_limit', ($mb + 128) . 'M');
}
set_time_limit(3600);

Expand Down Expand Up @@ -193,26 +193,10 @@
} else {
$object = $songsHandler->create();
}
if ($object->getVar('cid') > 0 && $cid > 0) {
$object->setVar('cid', $cid);
} else {
$object->setVar('cid', $cid);
}
if ($object->getVar('gid') > 0 && $gid > 0) {
$object->setVar('gid', $gid);
} else {
$object->setVar('gid', $gid);
}
if (count($object->getVar('aids')) > 0 && count($aids) > 0) {
$object->setVar('aids', $aids);
} else {
$object->setVar('aids', $aids);
}
if ($object->getVar('abid') > 0 && $abid > 0) {
$object->setVar('abid', $abid);
} else {
$object->setVar('abid', $abid);
}
$object->setVar('cid', $cid);
$object->setVar('gid', $gid);
$object->setVar('aids', $aids);
$object->setVar('abid', $abid);
$object->setVar('songid', $data[$_POST['songid']]);
$object->setVar('title', $data[$_POST['title']]);
$object->setVar('lyrics', str_replace("\n", "<br>\n", $data[$_POST['lyrics']]));
Expand Down Expand Up @@ -305,26 +289,10 @@
} else {
$object = $songsHandler->create();
}
if ($object->getVar('cid') > 0 && $cid > 0) {
$object->setVar('cid', $cid);
} else {
$object->setVar('cid', $cid);
}
if ($object->getVar('gid') > 0 && $gid > 0) {
$object->setVar('gid', $gid);
} else {
$object->setVar('gid', $gid);
}
if (count($object->getVar('aids')) > 0 && count($aids) > 0) {
$object->setVar('aids', $aids);
} else {
$object->setVar('aids', $aids);
}
if ($object->getVar('abid') > 0 && $abid > 0) {
$object->setVar('abid', $abid);
} else {
$object->setVar('abid', $abid);
}
$object->setVar('cid', $cid);
$object->setVar('gid', $gid);
$object->setVar('aids', $aids);
$object->setVar('abid', $abid);
$object->setVar('songid', $data[$_POST['songid']]);
$object->setVar('title', $data[$_POST['title']]);
$object->setVar('lyrics', str_replace("\n", "<br>\n", $data[$_POST['lyrics']]));
Expand Down
Loading