@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | $op = $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : "edit")); |
23 | 23 | |
24 | -include_once $GLOBALS['xoops']->path( "/class/xoopsformloader.php" ); |
|
24 | +include_once $GLOBALS['xoops']->path("/class/xoopsformloader.php"); |
|
25 | 25 | $opform = new XoopsSimpleForm('', 'opform', 'field_permissions.php', "post"); |
26 | 26 | $op_select = new XoopsFormSelect("", 'op', $op); |
27 | 27 | $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $opform->display(); |
34 | 34 | |
35 | 35 | $perm_desc = ""; |
36 | -switch ($op ) { |
|
36 | +switch ($op) { |
|
37 | 37 | case "visibility": |
38 | 38 | redirect_header("field_visibility.php", 0, _AM_SONGLIST_PROF_VISIBLE); |
39 | 39 | //header("Location: visibility.php"); |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | $module_id = $GLOBALS['songlistModule']->getVar('mid'); |
65 | -include_once $GLOBALS['xoops']->path( '/class/xoopsform/grouppermform.php' ); |
|
65 | +include_once $GLOBALS['xoops']->path('/class/xoopsform/grouppermform.php'); |
|
66 | 66 | $form = new XoopsGroupPermForm($title_of_form, $module_id, $perm_name, $perm_desc, 'admin/field_permissions.php', $anonymous); |
67 | 67 | |
68 | -if ( $op == "access" ) { |
|
68 | +if ($op=="access") { |
|
69 | 69 | $member_handler = xoops_gethandler('member'); |
70 | 70 | $glist = $member_handler->getGroupList(); |
71 | - foreach (array_keys($glist) as $i ) { |
|
72 | - if ( $i != XOOPS_GROUP_ANONYMOUS ) { |
|
71 | + foreach (array_keys($glist) as $i) { |
|
72 | + if ($i!=XOOPS_GROUP_ANONYMOUS) { |
|
73 | 73 | $form->addItem($i, $glist[$i]); |
74 | 74 | } |
75 | 75 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | $extras_handler = xoops_getmodulehandler('extras'); |
79 | 79 | $fields = array_merge(array(), $extras_handler->loadFields()); |
80 | 80 | |
81 | - if ( $op != "search" ) { |
|
82 | - if (is_array($fields)&&count($fields)>0) |
|
83 | - foreach (array_keys($fields) as $i ) { |
|
84 | - if ( $restriction == "" || $fields[$i]->getVar($restriction) ) { |
|
85 | - $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25) ); |
|
81 | + if ($op!="search") { |
|
82 | + if (is_array($fields) && count($fields)>0) |
|
83 | + foreach (array_keys($fields) as $i) { |
|
84 | + if ($restriction=="" || $fields[$i]->getVar($restriction)) { |
|
85 | + $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25)); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | } else { |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | 'datetime', |
95 | 95 | 'timezone', |
96 | 96 | 'language'); |
97 | - if (is_array($fields)&&count($fields)>0) |
|
98 | - foreach (array_keys($fields) as $i ) { |
|
99 | - if ( in_array($fields[$i]->getVar('field_type'), $searchable_types) ) { |
|
100 | - $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25) ); |
|
97 | + if (is_array($fields) && count($fields)>0) |
|
98 | + foreach (array_keys($fields) as $i) { |
|
99 | + if (in_array($fields[$i]->getVar('field_type'), $searchable_types)) { |
|
100 | + $form->addItem($fields[$i]->getVar('field_id'), xoops_substr($fields[$i]->getVar('field_title'), 0, 25)); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | xoops_cp_header(); |
8 | 8 | |
9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"genre"; |
|
10 | - $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:"list"; |
|
11 | - $limit = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
12 | - $start = !empty($_REQUEST['start'])?intval($_REQUEST['start']):0; |
|
13 | - $order = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
14 | - $sort = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
15 | - $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
|
9 | + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "genre"; |
|
10 | + $fct = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : "list"; |
|
11 | + $limit = !empty($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
12 | + $start = !empty($_REQUEST['start']) ?intval($_REQUEST['start']) : 0; |
|
13 | + $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
14 | + $sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
15 | + $filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
16 | 16 | |
17 | - switch($op) { |
|
17 | + switch ($op) { |
|
18 | 18 | default: |
19 | 19 | case "genre": |
20 | 20 | switch ($fct) |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | $indexAdmin = new ModuleAdmin(); |
25 | 25 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
26 | 26 | |
27 | - $genre_handler =& xoops_getmodulehandler('genre', 'songlist'); |
|
27 | + $genre_handler = & xoops_getmodulehandler('genre', 'songlist'); |
|
28 | 28 | |
29 | 29 | $criteria = $genre_handler->getFilterCriteria($GLOBALS['filter']); |
30 | 30 | $ttl = $genre_handler->getCount($criteria); |
31 | - $GLOBALS['sort'] = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
31 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
32 | 32 | |
33 | 33 | $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']); |
34 | 34 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
35 | 35 | |
36 | 36 | foreach ($genre_handler->filterFields() as $id => $key) { |
37 | - $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-','_',$key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort'])?($GLOBALS['order']=='DESC'?'ASC':'DESC'):$GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key)))?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))):'_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))).'</a>'); |
|
38 | - $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-','_',$key)).'_th', $genre_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
37 | + $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-', '_', $key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort']) ? ($GLOBALS['order']=='DESC' ? 'ASC' : 'DESC') : $GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) ?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))).'</a>'); |
|
38 | + $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-', '_', $key)).'_th', $genre_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $criteria->setOrder($GLOBALS['order']); |
52 | 52 | |
53 | 53 | $genres = $genre_handler->getObjects($criteria, true); |
54 | - foreach($genres as $cid => $genre) { |
|
54 | + foreach ($genres as $cid => $genre) { |
|
55 | 55 | if (is_object($genre)) |
56 | 56 | $GLOBALS['xoopsTpl']->append('genre', $genre->toArray()); |
57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $indexAdmin = new ModuleAdmin(); |
67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
68 | 68 | |
69 | - $genre_handler =& xoops_getmodulehandler('genre', 'songlist'); |
|
69 | + $genre_handler = & xoops_getmodulehandler('genre', 'songlist'); |
|
70 | 70 | if (isset($_REQUEST['id'])) { |
71 | 71 | $genre = $genre_handler->get(intval($_REQUEST['id'])); |
72 | 72 | } else { |
@@ -79,21 +79,21 @@ discard block |
||
79 | 79 | break; |
80 | 80 | case "save": |
81 | 81 | |
82 | - $genre_handler =& xoops_getmodulehandler('genre', 'songlist'); |
|
83 | - $id=0; |
|
84 | - if ($id=intval($_REQUEST['id'])) { |
|
82 | + $genre_handler = & xoops_getmodulehandler('genre', 'songlist'); |
|
83 | + $id = 0; |
|
84 | + if ($id = intval($_REQUEST['id'])) { |
|
85 | 85 | $genre = $genre_handler->get($id); |
86 | 86 | } else { |
87 | 87 | $genre = $genre_handler->create(); |
88 | 88 | } |
89 | 89 | $genre->setVars($_POST[$id]); |
90 | 90 | |
91 | - if (!$id=$genre_handler->insert($genre)) { |
|
91 | + if (!$id = $genre_handler->insert($genre)) { |
|
92 | 92 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTOSAVE); |
93 | 93 | exit(0); |
94 | 94 | } else { |
95 | 95 | if ($_REQUEST['state'][$_REQUEST['id']]=='new') |
96 | - redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'] . '&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
96 | + redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'].'&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
|
97 | 97 | else |
98 | 98 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_SAVEDOKEY); |
99 | 99 | exit(0); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | break; |
102 | 102 | case "savelist": |
103 | 103 | |
104 | - $genre_handler =& xoops_getmodulehandler('genre', 'songlist'); |
|
105 | - foreach($_REQUEST['id'] as $id) { |
|
104 | + $genre_handler = & xoops_getmodulehandler('genre', 'songlist'); |
|
105 | + foreach ($_REQUEST['id'] as $id) { |
|
106 | 106 | $genre = $genre_handler->get($id); |
107 | 107 | $genre->setVars($_POST[$id]); |
108 | 108 | if (!$genre_handler->insert($genre)) { |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | break; |
116 | 116 | case "delete": |
117 | 117 | |
118 | - $genre_handler =& xoops_getmodulehandler('genre', 'songlist'); |
|
119 | - $id=0; |
|
120 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
118 | + $genre_handler = & xoops_getmodulehandler('genre', 'songlist'); |
|
119 | + $id = 0; |
|
120 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
121 | 121 | $genre = $genre_handler->get($id); |
122 | 122 | if (!$genre_handler->delete($genre)) { |
123 | 123 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_GENRE_FAILEDTODELETE); |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | require_once (dirname(dirname(dirname(dirname(__FILE__)))).'/include/cp_header.php'); |
34 | 34 | |
35 | 35 | if (!defined('_CHARSET')) |
36 | - define ("_CHARSET","UTF-8"); |
|
36 | + define("_CHARSET", "UTF-8"); |
|
37 | 37 | if (!defined('_CHARSET_ISO')) |
38 | - define ("_CHARSET_ISO","ISO-8859-1"); |
|
38 | + define("_CHARSET_ISO", "ISO-8859-1"); |
|
39 | 39 | |
40 | 40 | $GLOBALS['songlistAdmin'] = true; |
41 | 41 | |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | |
56 | 56 | include_once $GLOBALS['xoops']->path('class'.DS.'xoopsmailer.php'); |
57 | 57 | |
58 | - if ( file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))){ |
|
58 | + if (file_exists($GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'))) { |
|
59 | 59 | include_once $GLOBALS['xoops']->path('/Frameworks/moduleclasses/moduleadmin/moduleadmin.php'); |
60 | - }else{ |
|
60 | + } else { |
|
61 | 61 | echo xoops_error("Error: You don't use the Frameworks \"admin module\". Please install this Frameworks"); |
62 | 62 | } |
63 | 63 | |
64 | - $GLOBALS['songlistImageIcon'] = XOOPS_URL .'/'. $GLOBALS['songlistModule']->getInfo('icons16'); |
|
65 | - $GLOBALS['songlistImageAdmin'] = XOOPS_URL .'/'. $GLOBALS['songlistModule']->getInfo('icons32'); |
|
64 | + $GLOBALS['songlistImageIcon'] = XOOPS_URL.'/'.$GLOBALS['songlistModule']->getInfo('icons16'); |
|
65 | + $GLOBALS['songlistImageAdmin'] = XOOPS_URL.'/'.$GLOBALS['songlistModule']->getInfo('icons32'); |
|
66 | 66 | |
67 | 67 | if ($GLOBALS['xoopsUser']) { |
68 | 68 | $moduleperm_handler = xoops_gethandler('groupperm'); |
69 | - if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['songlistModule']->getVar( 'mid' ), $GLOBALS['xoopsUser']->getGroups())) { |
|
69 | + if (!$moduleperm_handler->checkRight('module_admin', $GLOBALS['songlistModule']->getVar('mid'), $GLOBALS['xoopsUser']->getGroups())) { |
|
70 | 70 | redirect_header(XOOPS_URL, 1, _NOPERM); |
71 | 71 | exit(); |
72 | 72 | } |
73 | 73 | } else { |
74 | - redirect_header(XOOPS_URL . "/user.php", 1, _NOPERM); |
|
74 | + redirect_header(XOOPS_URL."/user.php", 1, _NOPERM); |
|
75 | 75 | exit(); |
76 | 76 | } |
77 | 77 |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | xoops_cp_header(); |
8 | 8 | |
9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"albums"; |
|
10 | - $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:"list"; |
|
11 | - $limit = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
12 | - $start = !empty($_REQUEST['start'])?intval($_REQUEST['start']):0; |
|
13 | - $order = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
14 | - $sort = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
15 | - $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
|
9 | + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "albums"; |
|
10 | + $fct = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : "list"; |
|
11 | + $limit = !empty($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
12 | + $start = !empty($_REQUEST['start']) ?intval($_REQUEST['start']) : 0; |
|
13 | + $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
14 | + $sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
15 | + $filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
16 | 16 | |
17 | - switch($op) { |
|
17 | + switch ($op) { |
|
18 | 18 | default: |
19 | 19 | case "albums": |
20 | 20 | switch ($fct) |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | $indexAdmin = new ModuleAdmin(); |
25 | 25 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
26 | 26 | |
27 | - $albums_handler =& xoops_getmodulehandler('albums', 'songlist'); |
|
27 | + $albums_handler = & xoops_getmodulehandler('albums', 'songlist'); |
|
28 | 28 | |
29 | 29 | $criteria = $albums_handler->getFilterCriteria($GLOBALS['filter']); |
30 | 30 | $ttl = $albums_handler->getCount($criteria); |
31 | - $GLOBALS['sort'] = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
31 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
32 | 32 | |
33 | 33 | $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']); |
34 | 34 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
35 | 35 | |
36 | 36 | foreach ($albums_handler->filterFields() as $id => $key) { |
37 | - $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-','_',$key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort'])?($GLOBALS['order']=='DESC'?'ASC':'DESC'):$GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key)))?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))):'_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))).'</a>'); |
|
38 | - $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-','_',$key)).'_th', $albums_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
37 | + $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-', '_', $key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort']) ? ($GLOBALS['order']=='DESC' ? 'ASC' : 'DESC') : $GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) ?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))).'</a>'); |
|
38 | + $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-', '_', $key)).'_th', $albums_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $criteria->setOrder($GLOBALS['order']); |
52 | 52 | |
53 | 53 | $albumss = $albums_handler->getObjects($criteria, true); |
54 | - foreach($albumss as $cid => $albums) { |
|
54 | + foreach ($albumss as $cid => $albums) { |
|
55 | 55 | if (is_object($albums)) |
56 | 56 | $GLOBALS['xoopsTpl']->append('albums', $albums->toArray()); |
57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $indexAdmin = new ModuleAdmin(); |
67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
68 | 68 | |
69 | - $albums_handler =& xoops_getmodulehandler('albums', 'songlist'); |
|
69 | + $albums_handler = & xoops_getmodulehandler('albums', 'songlist'); |
|
70 | 70 | if (isset($_REQUEST['id'])) { |
71 | 71 | $albums = $albums_handler->get(intval($_REQUEST['id'])); |
72 | 72 | } else { |
@@ -79,26 +79,26 @@ discard block |
||
79 | 79 | break; |
80 | 80 | case "save": |
81 | 81 | |
82 | - $albums_handler =& xoops_getmodulehandler('albums', 'songlist'); |
|
83 | - $id=0; |
|
84 | - if ($id=intval($_REQUEST['id'])) { |
|
82 | + $albums_handler = & xoops_getmodulehandler('albums', 'songlist'); |
|
83 | + $id = 0; |
|
84 | + if ($id = intval($_REQUEST['id'])) { |
|
85 | 85 | $albums = $albums_handler->get($id); |
86 | 86 | } else { |
87 | 87 | $albums = $albums_handler->create(); |
88 | 88 | } |
89 | 89 | $albums->setVars($_POST[$id]); |
90 | 90 | |
91 | - if (!$id=$albums_handler->insert($albums)) { |
|
91 | + if (!$id = $albums_handler->insert($albums)) { |
|
92 | 92 | redirect_header($_SERVER['PHP_SELF'].'?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_FAILEDTOSAVE); |
93 | 93 | exit(0); |
94 | 94 | } else { |
95 | 95 | |
96 | - if (isset($_FILES['image'])&&!empty($_FILES['image']['title'])) { |
|
96 | + if (isset($_FILES['image']) && !empty($_FILES['image']['title'])) { |
|
97 | 97 | |
98 | 98 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
99 | - foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
100 | - foreach(explode('/', $folders) as $folder) { |
|
101 | - $path .= DS . $folder; |
|
99 | + foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
100 | + foreach (explode('/', $folders) as $folder) { |
|
101 | + $path .= DS.$folder; |
|
102 | 102 | mkdir($path, 0777); |
103 | 103 | } |
104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | include_once($GLOBALS['xoops']->path('modules/songlist/include/uploader.php')); |
107 | 107 | $albums = $albums_handler->get($id); |
108 | 108 | $uploader = new SonglistMediaUploader($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), explode('|', $GLOBALS['songlistModuleConfig']['allowed_mimetype']), $GLOBALS['songlistModuleConfig']['filesize_upload'], 0, 0, explode('|', $GLOBALS['songlistModuleConfig']['allowed_extensions'])); |
109 | - $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0,20), 13)); |
|
109 | + $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0, 20), 13)); |
|
110 | 110 | |
111 | 111 | if ($uploader->fetchMedia('image')) { |
112 | 112 | if (!$uploader->upload()) { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | if ($_REQUEST['state'][$_REQUEST['id']]=='new') |
140 | - redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'] . '&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_ALBUMS_SAVEDOKEY); |
|
140 | + redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'].'&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_ALBUMS_SAVEDOKEY); |
|
141 | 141 | else |
142 | 142 | redirect_header($_SERVER['PHP_SELF'].'?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); |
143 | 143 | exit(0); |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | break; |
146 | 146 | case "savelist": |
147 | 147 | |
148 | - $albums_handler =& xoops_getmodulehandler('albums', 'songlist'); |
|
149 | - foreach($_REQUEST['id'] as $id) { |
|
148 | + $albums_handler = & xoops_getmodulehandler('albums', 'songlist'); |
|
149 | + foreach ($_REQUEST['id'] as $id) { |
|
150 | 150 | $albums = $albums_handler->get($id); |
151 | 151 | $albums->setVars($_POST[$id]); |
152 | 152 | if (!$albums_handler->insert($albums)) { |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | break; |
160 | 160 | case "delete": |
161 | 161 | |
162 | - $albums_handler =& xoops_getmodulehandler('albums', 'songlist'); |
|
163 | - $id=0; |
|
164 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
162 | + $albums_handler = & xoops_getmodulehandler('albums', 'songlist'); |
|
163 | + $id = 0; |
|
164 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
165 | 165 | $albums = $albums_handler->get($id); |
166 | 166 | if (!$albums_handler->delete($albums)) { |
167 | 167 | redirect_header($_SERVER['PHP_SELF'].'?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_FAILEDTODELETE); |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | xoops_cp_header(); |
8 | 8 | |
9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"dashboard"; |
|
10 | - $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:""; |
|
11 | - $limit = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
12 | - $start = !empty($_REQUEST['start'])?intval($_REQUEST['start']):0; |
|
13 | - $order = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
14 | - $sort = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
15 | - $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
|
9 | + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "dashboard"; |
|
10 | + $fct = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : ""; |
|
11 | + $limit = !empty($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
12 | + $start = !empty($_REQUEST['start']) ?intval($_REQUEST['start']) : 0; |
|
13 | + $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
14 | + $sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
15 | + $filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
16 | 16 | |
17 | - switch($op) { |
|
17 | + switch ($op) { |
|
18 | 18 | case "import": |
19 | 19 | switch ($fct) |
20 | 20 | { |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | |
36 | 36 | case "upload": |
37 | 37 | |
38 | - if (isset($_FILES['xmlfile'])&&!empty($_FILES['xmlfile']['title'])) { |
|
38 | + if (isset($_FILES['xmlfile']) && !empty($_FILES['xmlfile']['title'])) { |
|
39 | 39 | |
40 | 40 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
41 | - foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
42 | - foreach(explode('/', $folders) as $folder) { |
|
43 | - $path .= DS . $folder; |
|
41 | + foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
42 | + foreach (explode('/', $folders) as $folder) { |
|
43 | + $path .= DS.$folder; |
|
44 | 44 | mkdir($path, 0777); |
45 | 45 | } |
46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | include_once($GLOBALS['xoops']->path('modules/songlist/include/uploader.php')); |
49 | 49 | $albums = $albums_handler->get($id); |
50 | 50 | $uploader = new SonglistMediaUploader($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'), 1024*1024*32, 0, 0, array('xml')); |
51 | - $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0,20), 13)); |
|
51 | + $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0, 20), 13)); |
|
52 | 52 | |
53 | 53 | if ($uploader->fetchMedia('xmlfile')) { |
54 | 54 | if (!$uploader->upload()) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $category_handler = xoops_getmodulehandler('category', 'songlist'); |
92 | 92 | |
93 | 93 | $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])); |
94 | - $mb = floor($filesize / 1024 / 1024); |
|
94 | + $mb = floor($filesize/1024/1024); |
|
95 | 95 | if ($mb>32) { |
96 | 96 | set_ini('memory_limit', ($mb+128).'M'); |
97 | 97 | } |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | $xmlarray = songlist_xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])), false, 'tag'); |
101 | 101 | |
102 | 102 | if (strlen($_POST['collection'])>0) { |
103 | - foreach($xmlarray[$_POST['collection']] as $id => $record) { |
|
103 | + foreach ($xmlarray[$_POST['collection']] as $id => $record) { |
|
104 | 104 | foreach ($record as $recid => $data) { |
105 | 105 | $gid = 0; |
106 | - if (strlen($_POST['genre'])>0&&!empty($data[$_POST['genre']])) { |
|
107 | - $criteria = new Criteria('`name`', $data[$_POST['genre']]); |
|
106 | + if (strlen($_POST['genre'])>0 && !empty($data[$_POST['genre']])) { |
|
107 | + $criteria = new Criteria('`name`', $data[$_POST['genre']]); |
|
108 | 108 | if ($genre_handler->getCount($criteria)>0) { |
109 | 109 | $objects = $genre_handler->getObjects($criteria, false); |
110 | 110 | $gid = $objects[0]->getVar('gid'); |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | $vid = 0; |
119 | - if (strlen($_POST['voice'])>0&&!empty($data[$_POST['voice']])) { |
|
120 | - $criteria = new Criteria('`name`', $data[$_POST['voice']]); |
|
119 | + if (strlen($_POST['voice'])>0 && !empty($data[$_POST['voice']])) { |
|
120 | + $criteria = new Criteria('`name`', $data[$_POST['voice']]); |
|
121 | 121 | if ($voice_handler->getCount($criteria)>0) { |
122 | 122 | $objects = $voice_handler->getObjects($criteria, false); |
123 | 123 | $gid = $objects[0]->getVar('vid'); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $cid = 0; |
132 | - if (strlen($_POST['category'])>0&&!empty($data[$_POST['category']])) { |
|
133 | - $criteria = new Criteria('`name`', $data[$_POST['category']]); |
|
132 | + if (strlen($_POST['category'])>0 && !empty($data[$_POST['category']])) { |
|
133 | + $criteria = new Criteria('`name`', $data[$_POST['category']]); |
|
134 | 134 | if ($category_handler->getCount($criteria)>0) { |
135 | 135 | $objects = $category_handler->getObjects($criteria, false); |
136 | 136 | $cid = $objects[0]->getVar('cid'); |
@@ -141,16 +141,16 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | $aids = array(); |
144 | - if (strlen($_POST['artist'])>0&&!empty($data[$_POST['artist']])) { |
|
145 | - foreach(explode(',', $data[$_POST['artist']]) as $artist) { |
|
146 | - $criteria = new Criteria('`name`', $artist); |
|
144 | + if (strlen($_POST['artist'])>0 && !empty($data[$_POST['artist']])) { |
|
145 | + foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
|
146 | + $criteria = new Criteria('`name`', $artist); |
|
147 | 147 | if ($artists_handler->getCount($criteria)>0) { |
148 | 148 | $objects = $artists_handler->getObjects($criteria, false); |
149 | 149 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
150 | 150 | } else { |
151 | 151 | $object = $artists_handler->create(); |
152 | 152 | $object->setVar('cid', $cid); |
153 | - switch($data[$_POST['singer']]) { |
|
153 | + switch ($data[$_POST['singer']]) { |
|
154 | 154 | case $_POST['duet']: |
155 | 155 | $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
156 | 156 | break; |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | $abid = 0; |
168 | - if (strlen($_POST['album'])>0&&!empty($data[$_POST['album']])) { |
|
169 | - $criteria = new Criteria('`name`', $data[$_POST['album']]); |
|
168 | + if (strlen($_POST['album'])>0 && !empty($data[$_POST['album']])) { |
|
169 | + $criteria = new Criteria('`name`', $data[$_POST['album']]); |
|
170 | 170 | if ($albums_handler->getCount($criteria)>0) { |
171 | 171 | $objects = $albums_handler->getObjects($criteria, false); |
172 | 172 | $abid = $objects[0]->getVar('aid'); |
@@ -179,18 +179,18 @@ discard block |
||
179 | 179 | } |
180 | 180 | } |
181 | 181 | $sid = 0; |
182 | - if (strlen($_POST['songid'])>0&&!empty($data[$_POST['songid']])) { |
|
183 | - $criteria = new Criteria('`songid`', $data[$_POST['songid']]); |
|
182 | + if (strlen($_POST['songid'])>0 && !empty($data[$_POST['songid']])) { |
|
183 | + $criteria = new Criteria('`songid`', $data[$_POST['songid']]); |
|
184 | 184 | if ($songs_handler->getCount($criteria)>0) { |
185 | 185 | $objects = $songs_handler->getObjects($criteria, false); |
186 | 186 | $object = $objects[0]->getVar('sid'); |
187 | 187 | } else { |
188 | 188 | $object = $songs_handler->create(); |
189 | 189 | } |
190 | - if ($object->getVar('cid')>0&&$cid>0) { $object->setVar('cid', $cid); } else { $object->setVar('cid', $cid); } |
|
191 | - if ($object->getVar('gid')>0&&$gid>0) { $object->setVar('gid', $gid); } else { $object->setVar('gid', $gid); } |
|
192 | - if (count($object->getVar('aids'))>0&&count($aids)>0) { $object->setVar('aids', $aids); } else { $object->setVar('aids', $aids); } |
|
193 | - if ($object->getVar('abid')>0&&$abid>0) { $object->setVar('abid', $abid); } else { $object->setVar('abid', $abid); } |
|
190 | + if ($object->getVar('cid')>0 && $cid>0) { $object->setVar('cid', $cid); } else { $object->setVar('cid', $cid); } |
|
191 | + if ($object->getVar('gid')>0 && $gid>0) { $object->setVar('gid', $gid); } else { $object->setVar('gid', $gid); } |
|
192 | + if (count($object->getVar('aids'))>0 && count($aids)>0) { $object->setVar('aids', $aids); } else { $object->setVar('aids', $aids); } |
|
193 | + if ($object->getVar('abid')>0 && $abid>0) { $object->setVar('abid', $abid); } else { $object->setVar('abid', $abid); } |
|
194 | 194 | $object->setVar('songid', $data[$_POST['songid']]); |
195 | 195 | $object->setVar('title', $data[$_POST['title']]); |
196 | 196 | $object->setVar('lyrics', str_replace("\n", "<br/>\n", $data[$_POST['lyrics']])); |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | } else { |
202 | 202 | foreach ($xmlarray as $recid => $data) { |
203 | 203 | $gid = 0; |
204 | - if (strlen($_POST['genre'])>0&&!empty($data[$_POST['genre']])) { |
|
205 | - $criteria = new Criteria('`name`', $data[$_POST['genre']]); |
|
204 | + if (strlen($_POST['genre'])>0 && !empty($data[$_POST['genre']])) { |
|
205 | + $criteria = new Criteria('`name`', $data[$_POST['genre']]); |
|
206 | 206 | if ($genre_handler->getCount($criteria)>0) { |
207 | 207 | $objects = $genre_handler->getObjects($criteria, false); |
208 | 208 | $gid = $objects[0]->getVar('gid'); |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | } |
214 | 214 | } |
215 | 215 | $vid = 0; |
216 | - if (strlen($_POST['voice'])>0&&!empty($data[$_POST['voice']])) { |
|
217 | - $criteria = new Criteria('`name`', $data[$_POST['voice']]); |
|
216 | + if (strlen($_POST['voice'])>0 && !empty($data[$_POST['voice']])) { |
|
217 | + $criteria = new Criteria('`name`', $data[$_POST['voice']]); |
|
218 | 218 | if ($voice_handler->getCount($criteria)>0) { |
219 | 219 | $objects = $voice_handler->getObjects($criteria, false); |
220 | 220 | $gid = $objects[0]->getVar('vid'); |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | } |
226 | 226 | } |
227 | 227 | $cid = 0; |
228 | - if (strlen($_POST['category'])>0&&!empty($data[$_POST['category']])) { |
|
229 | - $criteria = new Criteria('`name`', $data[$_POST['category']]); |
|
228 | + if (strlen($_POST['category'])>0 && !empty($data[$_POST['category']])) { |
|
229 | + $criteria = new Criteria('`name`', $data[$_POST['category']]); |
|
230 | 230 | if ($category_handler->getCount($criteria)>0) { |
231 | 231 | $objects = $category_handler->getObjects($criteria, false); |
232 | 232 | $cid = $objects[0]->getVar('cid'); |
@@ -237,15 +237,15 @@ discard block |
||
237 | 237 | } |
238 | 238 | } |
239 | 239 | $aids = array(); |
240 | - if (strlen($_POST['artist'])>0&&!empty($data[$_POST['artist']])) { |
|
241 | - foreach(explode(',', $data[$_POST['artist']]) as $artist) { |
|
242 | - $criteria = new Criteria('`name`', $artist); |
|
240 | + if (strlen($_POST['artist'])>0 && !empty($data[$_POST['artist']])) { |
|
241 | + foreach (explode(',', $data[$_POST['artist']]) as $artist) { |
|
242 | + $criteria = new Criteria('`name`', $artist); |
|
243 | 243 | if ($artists_handler->getCount($criteria)>0) { |
244 | 244 | $objects = $artists_handler->getObjects($criteria, false); |
245 | 245 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
246 | 246 | } else { |
247 | 247 | $object = $artists_handler->create(); |
248 | - switch($data[$_POST['singer']]) { |
|
248 | + switch ($data[$_POST['singer']]) { |
|
249 | 249 | case $_POST['duet']: |
250 | 250 | $object->setVar('singer', '_ENUM_SONGLIST_DUET'); |
251 | 251 | break; |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | } |
262 | 262 | } |
263 | 263 | $abid = 0; |
264 | - if (strlen($_POST['album'])>0&&!empty($data[$_POST['album']])) { |
|
265 | - $criteria = new Criteria('`name`', $data[$_POST['album']]); |
|
264 | + if (strlen($_POST['album'])>0 && !empty($data[$_POST['album']])) { |
|
265 | + $criteria = new Criteria('`name`', $data[$_POST['album']]); |
|
266 | 266 | if ($albums_handler->getCount($criteria)>0) { |
267 | 267 | $objects = $albums_handler->getObjects($criteria, false); |
268 | 268 | $abid = $objects[0]->getVar('aid'); |
@@ -275,18 +275,18 @@ discard block |
||
275 | 275 | } |
276 | 276 | } |
277 | 277 | $sid = 0; |
278 | - if (strlen($_POST['songid'])>0&&!empty($data[$_POST['songid']])) { |
|
279 | - $criteria = new Criteria('`songid`', $data[$_POST['songid']]); |
|
278 | + if (strlen($_POST['songid'])>0 && !empty($data[$_POST['songid']])) { |
|
279 | + $criteria = new Criteria('`songid`', $data[$_POST['songid']]); |
|
280 | 280 | if ($songs_handler->getCount($criteria)>0) { |
281 | 281 | $objects = $songs_handler->getObjects($criteria, false); |
282 | 282 | $object = $objects[0]->getVar('sid'); |
283 | 283 | } else { |
284 | 284 | $object = $songs_handler->create(); |
285 | 285 | } |
286 | - if ($object->getVar('cid')>0&&$cid>0) { $object->setVar('cid', $cid); } else { $object->setVar('cid', $cid); } |
|
287 | - if ($object->getVar('gid')>0&&$gid>0) { $object->setVar('gid', $gid); } else { $object->setVar('gid', $gid); } |
|
288 | - if (count($object->getVar('aids'))>0&&count($aids)>0) { $object->setVar('aids', $aids); } else { $object->setVar('aids', $aids); } |
|
289 | - if ($object->getVar('abid')>0&&$abid>0) { $object->setVar('abid', $abid); } else { $object->setVar('abid', $abid); } |
|
286 | + if ($object->getVar('cid')>0 && $cid>0) { $object->setVar('cid', $cid); } else { $object->setVar('cid', $cid); } |
|
287 | + if ($object->getVar('gid')>0 && $gid>0) { $object->setVar('gid', $gid); } else { $object->setVar('gid', $gid); } |
|
288 | + if (count($object->getVar('aids'))>0 && count($aids)>0) { $object->setVar('aids', $aids); } else { $object->setVar('aids', $aids); } |
|
289 | + if ($object->getVar('abid')>0 && $abid>0) { $object->setVar('abid', $abid); } else { $object->setVar('abid', $abid); } |
|
290 | 290 | $object->setVar('songid', $data[$_POST['songid']]); |
291 | 291 | $object->setVar('title', $data[$_POST['title']]); |
292 | 292 | $object->setVar('lyrics', str_replace("\n", "<br/>\n", $data[$_POST['lyrics']])); |
@@ -4,7 +4,7 @@ |
||
4 | 4 | $GLOBALS['songlistModule'] = $module_handler->getByDirname('songlist'); |
5 | 5 | $GLOBALS['songlistModuleConfig'] = $config_handler->getConfigList($GLOBALS['songlistModule']->getVar('mid')); |
6 | 6 | |
7 | -$i=0; |
|
7 | +$i = 0; |
|
8 | 8 | $adminmenu[$i]['title'] = _MI_SONGLIST_ADMENU_DASHBOARD; |
9 | 9 | $adminmenu[$i]['icon'] = '../../'.$GLOBALS['songlistModule']->getInfo('icons32').'/home.png'; |
10 | 10 | $adminmenu[$i]['image'] = '../../'.$GLOBALS['songlistModule']->getInfo('icons32').'/home.png'; |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | xoops_cp_header(); |
8 | 8 | |
9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"songs"; |
|
10 | - $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:"list"; |
|
11 | - $limit = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
12 | - $start = !empty($_REQUEST['start'])?intval($_REQUEST['start']):0; |
|
13 | - $order = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
14 | - $sort = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
15 | - $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
|
9 | + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "songs"; |
|
10 | + $fct = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : "list"; |
|
11 | + $limit = !empty($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
12 | + $start = !empty($_REQUEST['start']) ?intval($_REQUEST['start']) : 0; |
|
13 | + $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
14 | + $sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
15 | + $filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
16 | 16 | |
17 | - switch($op) { |
|
17 | + switch ($op) { |
|
18 | 18 | default: |
19 | 19 | case "songs": |
20 | 20 | switch ($fct) |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | $indexAdmin = new ModuleAdmin(); |
25 | 25 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
26 | 26 | |
27 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
27 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
28 | 28 | |
29 | 29 | $criteria = $songs_handler->getFilterCriteria($GLOBALS['filter']); |
30 | 30 | $ttl = $songs_handler->getCount($criteria); |
31 | - $GLOBALS['sort'] = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
31 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
32 | 32 | |
33 | 33 | $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']); |
34 | 34 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
35 | 35 | |
36 | 36 | foreach ($songs_handler->filterFields() as $id => $key) { |
37 | - $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-','_',$key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort'])?($GLOBALS['order']=='DESC'?'ASC':'DESC'):$GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key)))?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))):'_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))).'</a>'); |
|
38 | - $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-','_',$key)).'_th', $songs_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
37 | + $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-', '_', $key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort']) ? ($GLOBALS['order']=='DESC' ? 'ASC' : 'DESC') : $GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) ?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))).'</a>'); |
|
38 | + $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-', '_', $key)).'_th', $songs_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $criteria->setOrder($GLOBALS['order']); |
52 | 52 | |
53 | 53 | $songss = $songs_handler->getObjects($criteria, true); |
54 | - foreach($songss as $cid => $songs) { |
|
54 | + foreach ($songss as $cid => $songs) { |
|
55 | 55 | if (is_object($songs)) |
56 | 56 | $GLOBALS['xoopsTpl']->append('songs', $songs->toArray()); |
57 | 57 | } |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | $indexAdmin = new ModuleAdmin(); |
67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
68 | 68 | |
69 | - include_once $GLOBALS['xoops']->path( "/class/pagenav.php" ); |
|
69 | + include_once $GLOBALS['xoops']->path("/class/pagenav.php"); |
|
70 | 70 | |
71 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
71 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
72 | 72 | if (isset($_REQUEST['id'])) { |
73 | 73 | $songs = $songs_handler->get(intval($_REQUEST['id'])); |
74 | 74 | } else { |
@@ -81,29 +81,29 @@ discard block |
||
81 | 81 | break; |
82 | 82 | case "save": |
83 | 83 | |
84 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
84 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
85 | 85 | $extras_handler = xoops_getmodulehandler('extras', 'songlist'); |
86 | - $id=0; |
|
87 | - if ($id=intval($_REQUEST['id'])) { |
|
86 | + $id = 0; |
|
87 | + if ($id = intval($_REQUEST['id'])) { |
|
88 | 88 | $songs = $songs_handler->get($id); |
89 | 89 | } else { |
90 | 90 | $songs = $songs_handler->create(); |
91 | 91 | } |
92 | 92 | $songs->setVars($_POST[$id]); |
93 | 93 | |
94 | - if (isset($_FILES['mp3'.$id])&&!empty($_FILES['mp3'.$id]['title'])) { |
|
94 | + if (isset($_FILES['mp3'.$id]) && !empty($_FILES['mp3'.$id]['title'])) { |
|
95 | 95 | |
96 | 96 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
97 | - foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
98 | - foreach(explode('/', $folders) as $folder) { |
|
99 | - $path .= DS . $folder; |
|
97 | + foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
98 | + foreach (explode('/', $folders) as $folder) { |
|
99 | + $path .= DS.$folder; |
|
100 | 100 | mkdir($path, 0777); |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | 104 | include_once($GLOBALS['xoops']->path('modules/songlist/include/uploader.php')); |
105 | 105 | $uploader = new SonglistMediaUploader($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), $GLOBALS['songlistModuleConfig']['mp3_filesize'], 0, 0, explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions'])); |
106 | - $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0,20), 13)); |
|
106 | + $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0, 20), 13)); |
|
107 | 107 | |
108 | 108 | if ($uploader->fetchMedia('mp3'.$id)) { |
109 | 109 | if (!$uploader->upload()) { |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | exit(0); |
131 | 131 | } |
132 | 132 | } |
133 | - if (!$id=$songs_handler->insert($songs)) { |
|
133 | + if (!$id = $songs_handler->insert($songs)) { |
|
134 | 134 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_FAILEDTOSAVE); |
135 | 135 | exit(0); |
136 | 136 | } else { |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | $extra->setVar('sid', $id); |
140 | 140 | $extras_handler->insert($extra); |
141 | 141 | |
142 | - if ($GLOBALS['songlistModuleConfig']['tags']&&file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
142 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
143 | 143 | $tag_handler = xoops_getmodulehandler('tag', 'tag'); |
144 | 144 | $tag_handler->updateByItem($_POST['tags'], $id, $GLOBALS['songlistModule']->getVar("dirname"), $songs->getVar('cid')); |
145 | 145 | } |
146 | 146 | |
147 | 147 | |
148 | 148 | if ($_REQUEST['state'][$_REQUEST['id']]=='new') |
149 | - redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'] . '&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_SAVEDOKEY); |
|
149 | + redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'].'&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_SAVEDOKEY); |
|
150 | 150 | else |
151 | 151 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_SAVEDOKEY); |
152 | 152 | exit(0); |
@@ -155,23 +155,23 @@ discard block |
||
155 | 155 | case "savelist": |
156 | 156 | print_r($_FILES); |
157 | 157 | exit; |
158 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
159 | - foreach($_REQUEST['id'] as $id) { |
|
158 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
159 | + foreach ($_REQUEST['id'] as $id) { |
|
160 | 160 | $songs = $songs_handler->get($id); |
161 | 161 | $songs->setVars($_POST[$id]); |
162 | - if (isset($_FILES['mp3'.$id])&&!empty($_FILES['mp3'.$id]['title'])) { |
|
162 | + if (isset($_FILES['mp3'.$id]) && !empty($_FILES['mp3'.$id]['title'])) { |
|
163 | 163 | |
164 | 164 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
165 | - foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
166 | - foreach(explode('/', $folders) as $folder) { |
|
167 | - $path .= DS . $folder; |
|
165 | + foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
166 | + foreach (explode('/', $folders) as $folder) { |
|
167 | + $path .= DS.$folder; |
|
168 | 168 | mkdir($path, 0777); |
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | 172 | include_once($GLOBALS['xoops']->path('modules/songlist/include/uploader.php')); |
173 | 173 | $uploader = new SonglistMediaUploader($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), explode('|', $GLOBALS['songlistModuleConfig']['mp3_mimetype']), $GLOBALS['songlistModuleConfig']['mp3_filesize'], 0, 0, explode('|', $GLOBALS['songlistModuleConfig']['mp3_extensions'])); |
174 | - $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0,20), 13)); |
|
174 | + $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0, 20), 13)); |
|
175 | 175 | |
176 | 176 | if ($uploader->fetchMedia('mp3'.$id)) { |
177 | 177 | if (!$uploader->upload()) { |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | break; |
209 | 209 | case "delete": |
210 | 210 | |
211 | - $songs_handler =& xoops_getmodulehandler('songs', 'songlist'); |
|
212 | - $id=0; |
|
213 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
211 | + $songs_handler = & xoops_getmodulehandler('songs', 'songlist'); |
|
212 | + $id = 0; |
|
213 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
214 | 214 | $songs = $songs_handler->get($id); |
215 | 215 | if (!$songs_handler->delete($songs)) { |
216 | 216 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_SONGS_FAILEDTODELETE); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : (!empty($_REQUEST['id']) ? "edit" : 'list'))); |
9 | 9 | $field_handler = xoops_getmodulehandler('field', 'songlist'); |
10 | -switch( $op ) { |
|
10 | +switch ($op) { |
|
11 | 11 | default: |
12 | 12 | case "list": |
13 | 13 | $indexAdmin = new ModuleAdmin(); |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | unset($criteria); |
29 | 29 | |
30 | 30 | $categories[0] = array('cid' => 0, 'name' => _AM_SONGLIST_FIELDS_DEFAULT); |
31 | - if ( count($categorys) > 0 ) { |
|
32 | - foreach (array_keys($categorys) as $i ) { |
|
31 | + if (count($categorys)>0) { |
|
32 | + foreach (array_keys($categorys) as $i) { |
|
33 | 33 | $categories[$categorys[$i]->getVar('cid')] = array('cid' => $categorys[$i]->getVar('cid'), 'name' => $categorys[$i]->getVar('name')); |
34 | 34 | } |
35 | 35 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'autotext' => _AM_SONGLIST_FIELDS_AUTOTEXT, |
66 | 66 | 'rank' => _AM_SONGLIST_FIELDS_RANK); |
67 | 67 | |
68 | - foreach (array_keys($fields) as $i ) { |
|
68 | + foreach (array_keys($fields) as $i) { |
|
69 | 69 | $fields[$i]['canEdit'] = $fields[$i]['field_config'] || $fields[$i]['field_show'] || $fields[$i]['field_edit']; |
70 | 70 | $fields[$i]['canDelete'] = $fields[$i]['field_config']; |
71 | 71 | $fields[$i]['fieldtype'] = $fieldtypes[$fields[$i]['field_type']]; |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $weights[$i] = $fields[$i]['field_weight']; |
75 | 75 | } |
76 | 76 | //sort fields order in categories |
77 | - foreach (array_keys($fields) as $i ) { |
|
77 | + foreach (array_keys($fields) as $i) { |
|
78 | 78 | array_multisort($weights[$i], SORT_ASC, array_keys($fieldcategories[$i]), SORT_ASC, $categories[$i]); |
79 | 79 | } |
80 | 80 | ksort($categories); |
81 | 81 | $GLOBALS['xoopsTpl']->assign('fieldcategories', $fieldcategories); |
82 | - $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML() ); |
|
82 | + $GLOBALS['xoopsTpl']->assign('token', $GLOBALS['xoopsSecurity']->getTokenHTML()); |
|
83 | 83 | $template_main = "songlist_cpanel_fieldlist.html"; |
84 | 84 | break; |
85 | 85 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $indexAdmin = new ModuleAdmin(); |
98 | 98 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
99 | 99 | $obj = $field_handler->get($_REQUEST['id']); |
100 | - if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist |
|
100 | + if (!$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit')) { //If no configs exist |
|
101 | 101 | redirect_header('field.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
102 | 102 | } |
103 | 103 | $form = songlist_getFieldForm($obj); |
@@ -106,60 +106,60 @@ discard block |
||
106 | 106 | |
107 | 107 | case "reorder": |
108 | 108 | |
109 | - if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
110 | - redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
109 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
110 | + redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
111 | 111 | } |
112 | 112 | |
113 | - if ( isset($_POST['field_ids']) && count($_POST['field_ids']) > 0 ) { |
|
113 | + if (isset($_POST['field_ids']) && count($_POST['field_ids'])>0) { |
|
114 | 114 | $oldweight = $_POST['oldweight']; |
115 | 115 | $oldcat = $_POST['oldcat']; |
116 | 116 | $oldcategories = $_POST['oldcategories']; |
117 | 117 | $categories = $_POST['categories']; |
118 | 118 | $weight = $_POST['weight']; |
119 | 119 | $ids = array(); |
120 | - foreach ($_POST['field_ids'] as $field_id ) { |
|
121 | - if ( $oldweight[$field_id] != $weight[$field_id] || $oldcat[$field_id] != $category[$field_id] || count($oldcategories[$field_id]) != count(array_unique(array_merge($categories[$field_id], $oldcategories[$field_id]))) ) { |
|
120 | + foreach ($_POST['field_ids'] as $field_id) { |
|
121 | + if ($oldweight[$field_id]!=$weight[$field_id] || $oldcat[$field_id]!=$category[$field_id] || count($oldcategories[$field_id])!=count(array_unique(array_merge($categories[$field_id], $oldcategories[$field_id])))) { |
|
122 | 122 | //if field has changed |
123 | 123 | $ids[] = intval($field_id); |
124 | 124 | } |
125 | 125 | } |
126 | - if ( count($ids) > 0 ) { |
|
126 | + if (count($ids)>0) { |
|
127 | 127 | $errors = array(); |
128 | 128 | //if there are changed fields, fetch the fieldcategory objects |
129 | 129 | $field_handler = xoops_getmodulehandler('field'); |
130 | - $fields = $field_handler->getObjects(new Criteria('field_id', "(" . implode(',', $ids) . ")", "IN"), true); |
|
131 | - foreach ($ids as $i ) { |
|
132 | - $fields[$i]->setVar('field_weight', intval($weight[$i]) ); |
|
133 | - $fields[$i]->setVar('cids', $categories[$i] ); |
|
134 | - if ( !$field_handler->insert($fields[$i]) ) { |
|
135 | - $errors = array_merge($errors, $fields[$i]->getErrors() ); |
|
130 | + $fields = $field_handler->getObjects(new Criteria('field_id', "(".implode(',', $ids).")", "IN"), true); |
|
131 | + foreach ($ids as $i) { |
|
132 | + $fields[$i]->setVar('field_weight', intval($weight[$i])); |
|
133 | + $fields[$i]->setVar('cids', $categories[$i]); |
|
134 | + if (!$field_handler->insert($fields[$i])) { |
|
135 | + $errors = array_merge($errors, $fields[$i]->getErrors()); |
|
136 | 136 | } |
137 | 137 | } |
138 | - if ( count($errors) == 0 ) { |
|
138 | + if (count($errors)==0) { |
|
139 | 139 | //no errors |
140 | - redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS) ); |
|
140 | + redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS)); |
|
141 | 141 | } else { |
142 | - redirect_header('field.php', 3, implode('<br />', $errors) ); |
|
142 | + redirect_header('field.php', 3, implode('<br />', $errors)); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
146 | - redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS) ); |
|
146 | + redirect_header('field.php', 2, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELDS)); |
|
147 | 147 | break; |
148 | 148 | |
149 | 149 | case "save": |
150 | - if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
151 | - redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
150 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
151 | + redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
152 | 152 | } |
153 | 153 | $redirect_to_edit = false; |
154 | - if ( isset($_REQUEST['id']) ) { |
|
154 | + if (isset($_REQUEST['id'])) { |
|
155 | 155 | $obj = $field_handler->get($_REQUEST['id']); |
156 | - if ( !$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit') ) { //If no configs exist |
|
156 | + if (!$obj->getVar('field_config') && !$obj->getVar('field_show') && !$obj->getVar('field_edit')) { //If no configs exist |
|
157 | 157 | redirect_header('fields.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
158 | 158 | } |
159 | 159 | } else { |
160 | 160 | $obj = $field_handler->create(); |
161 | 161 | $obj->setVar('field_name', $_REQUEST['field_name']); |
162 | - $obj->setVar('field_moduleid', $GLOBALS['songlistModule']->getVar('mid') ); |
|
162 | + $obj->setVar('field_moduleid', $GLOBALS['songlistModule']->getVar('mid')); |
|
163 | 163 | $obj->setVar('field_show', 1); |
164 | 164 | $obj->setVar('field_edit', 1); |
165 | 165 | $obj->setVar('field_config', 1); |
@@ -167,40 +167,40 @@ discard block |
||
167 | 167 | } |
168 | 168 | $obj->setVar('field_title', $_REQUEST['field_title']); |
169 | 169 | $obj->setVar('field_description', $_REQUEST['field_description']); |
170 | - if ( $obj->getVar('field_config') ) { |
|
170 | + if ($obj->getVar('field_config')) { |
|
171 | 171 | $obj->setVar('field_type', $_REQUEST['field_type']); |
172 | - if ( isset($_REQUEST['field_valuetype']) ) { |
|
172 | + if (isset($_REQUEST['field_valuetype'])) { |
|
173 | 173 | $obj->setVar('field_valuetype', $_REQUEST['field_valuetype']); |
174 | 174 | } |
175 | 175 | $options = $obj->getVar('field_options'); |
176 | 176 | |
177 | - if ( isset($_REQUEST['removeOptions']) && is_array($_REQUEST['removeOptions']) ) { |
|
178 | - foreach ($_REQUEST['removeOptions'] as $index ) { |
|
177 | + if (isset($_REQUEST['removeOptions']) && is_array($_REQUEST['removeOptions'])) { |
|
178 | + foreach ($_REQUEST['removeOptions'] as $index) { |
|
179 | 179 | unset($options[$index]); |
180 | 180 | } |
181 | 181 | $redirect_to_edit = true; |
182 | 182 | } |
183 | 183 | |
184 | - if ( !empty($_REQUEST['addOption']) ) { |
|
185 | - foreach ($_REQUEST['addOption'] as $option ) { |
|
186 | - if ( empty($option['value']) ) continue; |
|
184 | + if (!empty($_REQUEST['addOption'])) { |
|
185 | + foreach ($_REQUEST['addOption'] as $option) { |
|
186 | + if (empty($option['value'])) continue; |
|
187 | 187 | $options[$option['key']] = $option['value']; |
188 | 188 | $redirect_to_edit = true; |
189 | 189 | } |
190 | 190 | } |
191 | 191 | $obj->setVar('field_options', $options); |
192 | 192 | } |
193 | - if ( $obj->getVar('field_edit') ) { |
|
193 | + if ($obj->getVar('field_edit')) { |
|
194 | 194 | $required = isset($_REQUEST['field_required']) ? $_REQUEST['field_required'] : 0; |
195 | 195 | $obj->setVar('field_required', $required); //0 = no, 1 = yes |
196 | - if ( isset($_REQUEST['field_maxlength']) ) { |
|
196 | + if (isset($_REQUEST['field_maxlength'])) { |
|
197 | 197 | $obj->setVar('field_maxlength', $_REQUEST['field_maxlength']); |
198 | 198 | } |
199 | - if ( isset($_REQUEST['field_default']) ) { |
|
199 | + if (isset($_REQUEST['field_default'])) { |
|
200 | 200 | $field_default = $obj->getValueForSave($_REQUEST['field_default']); |
201 | 201 | //Check for multiple selections |
202 | - if ( is_array($field_default) ) { |
|
203 | - $obj->setVar('field_default', serialize($field_default) ); |
|
202 | + if (is_array($field_default)) { |
|
203 | + $obj->setVar('field_default', serialize($field_default)); |
|
204 | 204 | } else { |
205 | 205 | $obj->setVar('field_default', $field_default); |
206 | 206 | } |
@@ -210,50 +210,50 @@ discard block |
||
210 | 210 | $obj->setVar('field_weight', $_REQUEST['field_weight']); |
211 | 211 | $obj->setVar('cids', $_REQUEST['cids']); |
212 | 212 | |
213 | - if ( $field_handler->insert($obj) ) { |
|
213 | + if ($field_handler->insert($obj)) { |
|
214 | 214 | |
215 | 215 | $groupperm_handler = xoops_gethandler('groupperm'); |
216 | 216 | |
217 | 217 | $perm_arr = array(); |
218 | - if ( $obj->getVar('field_show') ) { |
|
218 | + if ($obj->getVar('field_show')) { |
|
219 | 219 | $perm_arr[] = 'songlist_show'; |
220 | 220 | $perm_arr[] = 'songlist_visible'; |
221 | 221 | } |
222 | - if ( $obj->getVar('field_edit') ) { |
|
222 | + if ($obj->getVar('field_edit')) { |
|
223 | 223 | $perm_arr[] = 'songlist_edit'; |
224 | 224 | } |
225 | - if ( $obj->getVar('field_edit') || $obj->getVar('field_show') ) { |
|
225 | + if ($obj->getVar('field_edit') || $obj->getVar('field_show')) { |
|
226 | 226 | $perm_arr[] = 'songlist_search'; |
227 | 227 | } |
228 | - if ( count($perm_arr) > 0 ) { |
|
229 | - foreach ($perm_arr as $perm ) { |
|
230 | - $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm) ); |
|
231 | - $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id') )) ); |
|
232 | - $criteria->add(new Criteria('gperm_modid', intval($GLOBALS['songlistModule']->getVar('mid') )) ); |
|
233 | - if ( isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm]) ) { |
|
228 | + if (count($perm_arr)>0) { |
|
229 | + foreach ($perm_arr as $perm) { |
|
230 | + $criteria = new CriteriaCompo(new Criteria('gperm_name', $perm)); |
|
231 | + $criteria->add(new Criteria('gperm_itemid', intval($obj->getVar('field_id')))); |
|
232 | + $criteria->add(new Criteria('gperm_modid', intval($GLOBALS['songlistModule']->getVar('mid')))); |
|
233 | + if (isset($_REQUEST[$perm]) && is_array($_REQUEST[$perm])) { |
|
234 | 234 | $perms = $groupperm_handler->getObjects($criteria); |
235 | - if ( count($perms) > 0 ) { |
|
236 | - foreach (array_keys($perms) as $i ) { |
|
235 | + if (count($perms)>0) { |
|
236 | + foreach (array_keys($perms) as $i) { |
|
237 | 237 | $groups[$perms[$i]->getVar('gperm_groupid')] = $perms[$i]; |
238 | 238 | } |
239 | 239 | } else { |
240 | 240 | $groups = array(); |
241 | 241 | } |
242 | - foreach ($_REQUEST[$perm] as $grouoid ) { |
|
242 | + foreach ($_REQUEST[$perm] as $grouoid) { |
|
243 | 243 | $grouoid = intval($grouoid); |
244 | - if ( !isset($groups[$grouoid]) ) { |
|
244 | + if (!isset($groups[$grouoid])) { |
|
245 | 245 | $perm_obj = $groupperm_handler->create(); |
246 | 246 | $perm_obj->setVar('gperm_name', $perm); |
247 | - $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id') )); |
|
248 | - $perm_obj->setVar('gperm_modid', $GLOBALS['songlistModule']->getVar('mid') ); |
|
247 | + $perm_obj->setVar('gperm_itemid', intval($obj->getVar('field_id'))); |
|
248 | + $perm_obj->setVar('gperm_modid', $GLOBALS['songlistModule']->getVar('mid')); |
|
249 | 249 | $perm_obj->setVar('gperm_groupid', $grouoid); |
250 | 250 | $groupperm_handler->insert($perm_obj); |
251 | 251 | unset($perm_obj); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | $removed_groups = array_diff(array_keys($groups), $_REQUEST[$perm]); |
255 | - if ( count($removed_groups) > 0 ) { |
|
256 | - $criteria->add(new Criteria('gperm_groupid', "(".implode(',', $removed_groups).")", "IN") ); |
|
255 | + if (count($removed_groups)>0) { |
|
256 | + $criteria->add(new Criteria('gperm_groupid', "(".implode(',', $removed_groups).")", "IN")); |
|
257 | 257 | $groupperm_handler->deleteAll($criteria); |
258 | 258 | } |
259 | 259 | unset($groups); |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | unset($criteria); |
265 | 265 | } |
266 | 266 | } |
267 | - $url = $redirect_to_edit ? 'field.php?op=edit&id=' . $obj->getVar('field_id') : 'field.php'; |
|
268 | - redirect_header($url, 3, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD) ); |
|
267 | + $url = $redirect_to_edit ? 'field.php?op=edit&id='.$obj->getVar('field_id') : 'field.php'; |
|
268 | + redirect_header($url, 3, sprintf(_AM_SONGLIST_FIELDS_SAVEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | echo $obj->getHtmlErrors(); |
@@ -275,25 +275,25 @@ discard block |
||
275 | 275 | |
276 | 276 | case "delete": |
277 | 277 | $obj = $field_handler->get($_REQUEST['id']); |
278 | - if ( !$obj->getVar('field_config') ) { |
|
278 | + if (!$obj->getVar('field_config')) { |
|
279 | 279 | redirect_header('index.php', 2, _AM_SONGLIST_FIELDS_FIELDNOTCONFIGURABLE); |
280 | 280 | } |
281 | - if ( isset($_REQUEST['ok']) && $_REQUEST['ok'] == 1 ) { |
|
282 | - if ( !$GLOBALS['xoopsSecurity']->check() ) { |
|
283 | - redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors() )); |
|
281 | + if (isset($_REQUEST['ok']) && $_REQUEST['ok']==1) { |
|
282 | + if (!$GLOBALS['xoopsSecurity']->check()) { |
|
283 | + redirect_header('field.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
|
284 | 284 | } |
285 | - if ( $field_handler->delete($obj) ) { |
|
286 | - redirect_header('field.php', 3, sprintf(_AM_SONGLIST_FIELDS_DELETEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD) ); |
|
285 | + if ($field_handler->delete($obj)) { |
|
286 | + redirect_header('field.php', 3, sprintf(_AM_SONGLIST_FIELDS_DELETEDSUCCESS, _AM_SONGLIST_FIELDS_FIELD)); |
|
287 | 287 | } else { |
288 | 288 | echo $obj->getHtmlErrors(); |
289 | 289 | } |
290 | 290 | } else { |
291 | - xoops_confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_SONGLIST_FIELDS_RUSUREDEL, $obj->getVar('field_title') )); |
|
291 | + xoops_confirm(array('ok' => 1, 'id' => $_REQUEST['id'], 'op' => 'delete'), $_SERVER['REQUEST_URI'], sprintf(_AM_SONGLIST_FIELDS_RUSUREDEL, $obj->getVar('field_title'))); |
|
292 | 292 | } |
293 | 293 | break; |
294 | 294 | } |
295 | 295 | |
296 | -if ( isset($template_main) ) { |
|
296 | +if (isset($template_main)) { |
|
297 | 297 | $GLOBALS['xoopsTpl']->display("db:{$template_main}"); |
298 | 298 | } |
299 | 299 |
@@ -6,15 +6,15 @@ discard block |
||
6 | 6 | |
7 | 7 | xoops_cp_header(); |
8 | 8 | |
9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"voice"; |
|
10 | - $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:"list"; |
|
11 | - $limit = !empty($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
12 | - $start = !empty($_REQUEST['start'])?intval($_REQUEST['start']):0; |
|
13 | - $order = !empty($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
14 | - $sort = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
15 | - $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
|
9 | + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "voice"; |
|
10 | + $fct = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : "list"; |
|
11 | + $limit = !empty($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
12 | + $start = !empty($_REQUEST['start']) ?intval($_REQUEST['start']) : 0; |
|
13 | + $order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
14 | + $sort = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
15 | + $filter = !empty($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
16 | 16 | |
17 | - switch($op) { |
|
17 | + switch ($op) { |
|
18 | 18 | default: |
19 | 19 | case "voice": |
20 | 20 | switch ($fct) |
@@ -24,18 +24,18 @@ discard block |
||
24 | 24 | $indexAdmin = new ModuleAdmin(); |
25 | 25 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
26 | 26 | |
27 | - $voice_handler =& xoops_getmodulehandler('voice', 'songlist'); |
|
27 | + $voice_handler = & xoops_getmodulehandler('voice', 'songlist'); |
|
28 | 28 | |
29 | 29 | $criteria = $voice_handler->getFilterCriteria($GLOBALS['filter']); |
30 | 30 | $ttl = $voice_handler->getCount($criteria); |
31 | - $GLOBALS['sort'] = !empty($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
31 | + $GLOBALS['sort'] = !empty($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
32 | 32 | |
33 | 33 | $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']); |
34 | 34 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav()); |
35 | 35 | |
36 | 36 | foreach ($voice_handler->filterFields() as $id => $key) { |
37 | - $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-','_',$key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort'])?($GLOBALS['order']=='DESC'?'ASC':'DESC'):$GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key)))?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))):'_AM_SONGLIST_TH_'.strtoupper(str_replace('-','_',$key))).'</a>'); |
|
38 | - $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-','_',$key)).'_th', $voice_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
37 | + $GLOBALS['xoopsTpl']->assign(strtolower(str_replace('-', '_', $key).'_th'), '<a href="'.$_SERVER['PHP_SELF'].'?start='.$GLOBALS['start'].'&limit='.$GLOBALS['limit'].'&sort='.$key.'&order='.(($key==$GLOBALS['sort']) ? ($GLOBALS['order']=='DESC' ? 'ASC' : 'DESC') : $GLOBALS['order']).'&op='.$GLOBALS['op'].'&filter='.$GLOBALS['filter'].'">'.(defined('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) ?constant('_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))) : '_AM_SONGLIST_TH_'.strtoupper(str_replace('-', '_', $key))).'</a>'); |
|
38 | + $GLOBALS['xoopsTpl']->assign('filter_'.strtolower(str_replace('-', '_', $key)).'_th', $voice_handler->getFilterForm($GLOBALS['filter'], $key, $GLOBALS['sort'], $GLOBALS['op'], $GLOBALS['fct'])); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $GLOBALS['xoopsTpl']->assign('limit', $GLOBALS['limit']); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $criteria->setOrder($GLOBALS['order']); |
52 | 52 | |
53 | 53 | $voices = $voice_handler->getObjects($criteria, true); |
54 | - foreach($voices as $cid => $voice) { |
|
54 | + foreach ($voices as $cid => $voice) { |
|
55 | 55 | if (is_object($voice)) |
56 | 56 | $GLOBALS['xoopsTpl']->append('voice', $voice->toArray()); |
57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $indexAdmin = new ModuleAdmin(); |
67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
68 | 68 | |
69 | - $voice_handler =& xoops_getmodulehandler('voice', 'songlist'); |
|
69 | + $voice_handler = & xoops_getmodulehandler('voice', 'songlist'); |
|
70 | 70 | if (isset($_REQUEST['id'])) { |
71 | 71 | $voice = $voice_handler->get(intval($_REQUEST['id'])); |
72 | 72 | } else { |
@@ -79,21 +79,21 @@ discard block |
||
79 | 79 | break; |
80 | 80 | case "save": |
81 | 81 | |
82 | - $voice_handler =& xoops_getmodulehandler('voice', 'songlist'); |
|
83 | - $id=0; |
|
84 | - if ($id=intval($_REQUEST['id'])) { |
|
82 | + $voice_handler = & xoops_getmodulehandler('voice', 'songlist'); |
|
83 | + $id = 0; |
|
84 | + if ($id = intval($_REQUEST['id'])) { |
|
85 | 85 | $voice = $voice_handler->get($id); |
86 | 86 | } else { |
87 | 87 | $voice = $voice_handler->create(); |
88 | 88 | } |
89 | 89 | $voice->setVars($_POST[$id]); |
90 | 90 | |
91 | - if (!$id=$voice_handler->insert($voice)) { |
|
91 | + if (!$id = $voice_handler->insert($voice)) { |
|
92 | 92 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_FAILEDTOSAVE); |
93 | 93 | exit(0); |
94 | 94 | } else { |
95 | 95 | if ($_REQUEST['state'][$_REQUEST['id']]=='new') |
96 | - redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'] . '&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
96 | + redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=edit&id='.$_REQUEST['id'].'&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
|
97 | 97 | else |
98 | 98 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_SAVEDOKEY); |
99 | 99 | exit(0); |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | break; |
102 | 102 | case "savelist": |
103 | 103 | |
104 | - $voice_handler =& xoops_getmodulehandler('voice', 'songlist'); |
|
105 | - foreach($_REQUEST['id'] as $id) { |
|
104 | + $voice_handler = & xoops_getmodulehandler('voice', 'songlist'); |
|
105 | + foreach ($_REQUEST['id'] as $id) { |
|
106 | 106 | $voice = $voice_handler->get($id); |
107 | 107 | $voice->setVars($_POST[$id]); |
108 | 108 | if (!$voice_handler->insert($voice)) { |
@@ -115,9 +115,9 @@ discard block |
||
115 | 115 | break; |
116 | 116 | case "delete": |
117 | 117 | |
118 | - $voice_handler =& xoops_getmodulehandler('voice', 'songlist'); |
|
119 | - $id=0; |
|
120 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
118 | + $voice_handler = & xoops_getmodulehandler('voice', 'songlist'); |
|
119 | + $id = 0; |
|
120 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
121 | 121 | $voice = $voice_handler->get($id); |
122 | 122 | if (!$voice_handler->delete($voice)) { |
123 | 123 | redirect_header($_SERVER['PHP_SELF'].'?op='.$GLOBALS['op'].'&fct=list&limit='.$GLOBALS['limit'].'&start='.$GLOBALS['start'].'&order='.$GLOBALS['order'].'&sort='.$GLOBALS['sort'].'&filter='.$GLOBALS['filter'], 10, _AM_SONGLIST_MSG_VOICE_FAILEDTODELETE); |