@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
| 16 | 16 | |
| 17 | 17 | switch($op) { |
| 18 | - default: |
|
| 19 | - case "artists": |
|
| 20 | - switch ($fct) |
|
| 21 | - { |
|
| 18 | + default: |
|
| 19 | + case "artists": |
|
| 20 | + switch ($fct) |
|
| 21 | + { |
|
| 22 | 22 | default: |
| 23 | 23 | case "list": |
| 24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_ARTISTS_DELETE, $artists->getVar('name'))); |
| 132 | 132 | } |
| 133 | 133 | break; |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | break; |
| 136 | 136 | |
| 137 | 137 | } |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | xoops_cp_header(); |
| 8 | 8 | |
| 9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"artists"; |
|
| 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'] : "artists"; |
|
| 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 "artists": |
| 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 | - $artists_handler =& xoops_getmodulehandler('artists', 'songlist'); |
|
| 27 | + $artists_handler = & xoops_getmodulehandler('artists', 'songlist'); |
|
| 28 | 28 | |
| 29 | 29 | $criteria = $artists_handler->getFilterCriteria($GLOBALS['filter']); |
| 30 | 30 | $ttl = $artists_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 ($artists_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', $artists_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', $artists_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 | $artists = $artists_handler->getObjects($criteria, true); |
| 54 | - foreach($artists as $cid => $artist) { |
|
| 54 | + foreach ($artists as $cid => $artist) { |
|
| 55 | 55 | if (is_object($artist)) |
| 56 | 56 | $GLOBALS['xoopsTpl']->append('artists', $artist->toArray()); |
| 57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $indexAdmin = new ModuleAdmin(); |
| 67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 68 | 68 | |
| 69 | - $artists_handler =& xoops_getmodulehandler('artists', 'songlist'); |
|
| 69 | + $artists_handler = & xoops_getmodulehandler('artists', 'songlist'); |
|
| 70 | 70 | if (isset($_REQUEST['id'])) { |
| 71 | 71 | $artists = $artists_handler->get(intval($_REQUEST['id'])); |
| 72 | 72 | } else { |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | break; |
| 80 | 80 | case "save": |
| 81 | 81 | |
| 82 | - $artists_handler =& xoops_getmodulehandler('artists', 'songlist'); |
|
| 83 | - $id=0; |
|
| 84 | - if ($id=intval($_REQUEST['id'])) { |
|
| 82 | + $artists_handler = & xoops_getmodulehandler('artists', 'songlist'); |
|
| 83 | + $id = 0; |
|
| 84 | + if ($id = intval($_REQUEST['id'])) { |
|
| 85 | 85 | $artists = $artists_handler->get($id); |
| 86 | 86 | } else { |
| 87 | 87 | $artists = $artists_handler->create(); |
| 88 | 88 | } |
| 89 | 89 | $artists->setVars($_POST[$id]); |
| 90 | 90 | |
| 91 | - if (!$id=$artists_handler->insert($artists)) { |
|
| 91 | + if (!$id = $artists_handler->insert($artists)) { |
|
| 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_ARTISTS_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_ARTISTS_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_ARTISTS_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_ARTISTS_SAVEDOKEY); |
| 99 | 99 | exit(0); |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | break; |
| 102 | 102 | case "savelist": |
| 103 | 103 | |
| 104 | - $artists_handler =& xoops_getmodulehandler('artists', 'songlist'); |
|
| 105 | - foreach($_REQUEST['id'] as $id) { |
|
| 104 | + $artists_handler = & xoops_getmodulehandler('artists', 'songlist'); |
|
| 105 | + foreach ($_REQUEST['id'] as $id) { |
|
| 106 | 106 | $artists = $artists_handler->get($id); |
| 107 | 107 | $artists->setVars($_POST[$id]); |
| 108 | 108 | if (!$artists_handler->insert($artists)) { |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | break; |
| 116 | 116 | case "delete": |
| 117 | 117 | |
| 118 | - $artists_handler =& xoops_getmodulehandler('artists', 'songlist'); |
|
| 119 | - $id=0; |
|
| 120 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
| 118 | + $artists_handler = & xoops_getmodulehandler('artists', 'songlist'); |
|
| 119 | + $id = 0; |
|
| 120 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
| 121 | 121 | $artists = $artists_handler->get($id); |
| 122 | 122 | if (!$artists_handler->delete($artists)) { |
| 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_ARTISTS_FAILEDTODELETE); |
@@ -52,8 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $artists = $artists_handler->getObjects($criteria, true); |
| 54 | 54 | foreach($artists as $cid => $artist) { |
| 55 | - if (is_object($artist)) |
|
| 56 | - $GLOBALS['xoopsTpl']->append('artists', $artist->toArray()); |
|
| 55 | + if (is_object($artist)) { |
|
| 56 | + $GLOBALS['xoopsTpl']->append('artists', $artist->toArray()); |
|
| 57 | + } |
|
| 57 | 58 | } |
| 58 | 59 | $GLOBALS['xoopsTpl']->assign('form', songlist_artists_get_form(false)); |
| 59 | 60 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']); |
@@ -92,10 +93,11 @@ discard block |
||
| 92 | 93 | 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_ARTISTS_FAILEDTOSAVE); |
| 93 | 94 | exit(0); |
| 94 | 95 | } else { |
| 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_ARTISTS_SAVEDOKEY); |
|
| 97 | - else |
|
| 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_ARTISTS_SAVEDOKEY); |
|
| 96 | + if ($_REQUEST['state'][$_REQUEST['id']]=='new') { |
|
| 97 | + 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_ARTISTS_SAVEDOKEY); |
|
| 98 | + } else { |
|
| 99 | + 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_ARTISTS_SAVEDOKEY); |
|
| 100 | + } |
|
| 99 | 101 | exit(0); |
| 100 | 102 | } |
| 101 | 103 | break; |
@@ -111,26 +111,26 @@ |
||
| 111 | 111 | if ($uploader->fetchMedia('image')) { |
| 112 | 112 | if (!$uploader->upload()) { |
| 113 | 113 | |
| 114 | - songlist_adminMenu(1); |
|
| 115 | - echo $uploader->getErrors(); |
|
| 114 | + songlist_adminMenu(1); |
|
| 115 | + echo $uploader->getErrors(); |
|
| 116 | 116 | songlist_footer_adminMenu(); |
| 117 | 117 | xoops_cp_footer(); |
| 118 | 118 | exit(0); |
| 119 | - } else { |
|
| 119 | + } else { |
|
| 120 | 120 | |
| 121 | - if (strlen($category->getVar('image'))) |
|
| 122 | - unlink($GLOBALS['xoops']->path($category->getVar('path')).$category->getVar('image')); |
|
| 121 | + if (strlen($category->getVar('image'))) |
|
| 122 | + unlink($GLOBALS['xoops']->path($category->getVar('path')).$category->getVar('image')); |
|
| 123 | 123 | |
| 124 | - $category->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
|
| 125 | - $category->setVar('image', $uploader->getSavedFileName()); |
|
| 126 | - @$category_handler->insert($category); |
|
| 124 | + $category->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
|
| 125 | + $category->setVar('image', $uploader->getSavedFileName()); |
|
| 126 | + @$category_handler->insert($category); |
|
| 127 | 127 | |
| 128 | - } |
|
| 128 | + } |
|
| 129 | 129 | } else { |
| 130 | 130 | |
| 131 | 131 | $indexAdmin = new ModuleAdmin(); |
| 132 | 132 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 133 | - echo $uploader->getErrors(); |
|
| 133 | + echo $uploader->getErrors(); |
|
| 134 | 134 | songlist_footer_adminMenu(); |
| 135 | 135 | xoops_cp_footer(); |
| 136 | 136 | exit(0); |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
| 16 | 16 | |
| 17 | 17 | switch($op) { |
| 18 | - default: |
|
| 19 | - case "category": |
|
| 20 | - switch ($fct) |
|
| 21 | - { |
|
| 18 | + default: |
|
| 19 | + case "category": |
|
| 20 | + switch ($fct) |
|
| 21 | + { |
|
| 22 | 22 | default: |
| 23 | 23 | case "list": |
| 24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_CATEGORY_DELETE, $category->getVar('name'))); |
| 177 | 177 | } |
| 178 | 178 | break; |
| 179 | - } |
|
| 179 | + } |
|
| 180 | 180 | break; |
| 181 | 181 | |
| 182 | 182 | } |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | xoops_cp_header(); |
| 8 | 8 | |
| 9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"category"; |
|
| 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'] : "category"; |
|
| 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 "category": |
| 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 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
| 27 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
| 28 | 28 | |
| 29 | 29 | $criteria = $category_handler->getFilterCriteria($GLOBALS['filter']); |
| 30 | 30 | $ttl = $category_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 ($category_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', $category_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', $category_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 | $categorys = $category_handler->getObjects($criteria, true); |
| 54 | - foreach($categorys as $cid => $category) { |
|
| 54 | + foreach ($categorys as $cid => $category) { |
|
| 55 | 55 | if (is_object($category)) |
| 56 | 56 | $GLOBALS['xoopsTpl']->append('categories', $category->toArray()); |
| 57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $indexAdmin = new ModuleAdmin(); |
| 67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 68 | 68 | |
| 69 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
| 69 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
| 70 | 70 | if (isset($_REQUEST['id'])) { |
| 71 | 71 | $category = $category_handler->get(intval($_REQUEST['id'])); |
| 72 | 72 | } else { |
@@ -79,26 +79,26 @@ discard block |
||
| 79 | 79 | break; |
| 80 | 80 | case "save": |
| 81 | 81 | |
| 82 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
| 83 | - $id=0; |
|
| 84 | - if ($id=intval($_REQUEST['id'])) { |
|
| 82 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
| 83 | + $id = 0; |
|
| 84 | + if ($id = intval($_REQUEST['id'])) { |
|
| 85 | 85 | $category = $category_handler->get($id); |
| 86 | 86 | } else { |
| 87 | 87 | $category = $category_handler->create(); |
| 88 | 88 | } |
| 89 | 89 | $category->setVars($_POST[$id]); |
| 90 | 90 | |
| 91 | - if (!$id=$category_handler->insert($category)) { |
|
| 91 | + if (!$id = $category_handler->insert($category)) { |
|
| 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_CATEGORY_FAILEDTOSAVE); |
| 93 | 93 | exit(0); |
| 94 | 94 | } else { |
| 95 | 95 | |
| 96 | - if (isset($_FILES['image'])&&!empty($_FILES['image']['name'])) { |
|
| 96 | + if (isset($_FILES['image']) && !empty($_FILES['image']['name'])) { |
|
| 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 | $category = $category_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()) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | if ($_REQUEST['state'][$_REQUEST['id']]=='new') |
| 141 | - 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_CATEGORY_SAVEDOKEY); |
|
| 141 | + 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_CATEGORY_SAVEDOKEY); |
|
| 142 | 142 | else |
| 143 | 143 | 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_CATEGORY_SAVEDOKEY); |
| 144 | 144 | exit(0); |
@@ -146,8 +146,8 @@ discard block |
||
| 146 | 146 | break; |
| 147 | 147 | case "savelist": |
| 148 | 148 | |
| 149 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
| 150 | - foreach($_REQUEST['id'] as $id) { |
|
| 149 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
| 150 | + foreach ($_REQUEST['id'] as $id) { |
|
| 151 | 151 | $category = $category_handler->get($id); |
| 152 | 152 | $category->setVars($_POST[$id]); |
| 153 | 153 | if (!$category_handler->insert($category)) { |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | break; |
| 161 | 161 | case "delete": |
| 162 | 162 | |
| 163 | - $category_handler =& xoops_getmodulehandler('category', 'songlist'); |
|
| 164 | - $id=0; |
|
| 165 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
| 163 | + $category_handler = & xoops_getmodulehandler('category', 'songlist'); |
|
| 164 | + $id = 0; |
|
| 165 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
| 166 | 166 | $category = $category_handler->get($id); |
| 167 | 167 | if (!$category_handler->delete($category)) { |
| 168 | 168 | 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_CATEGORY_FAILEDTODELETE); |
@@ -52,8 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $categorys = $category_handler->getObjects($criteria, true); |
| 54 | 54 | foreach($categorys as $cid => $category) { |
| 55 | - if (is_object($category)) |
|
| 56 | - $GLOBALS['xoopsTpl']->append('categories', $category->toArray()); |
|
| 55 | + if (is_object($category)) { |
|
| 56 | + $GLOBALS['xoopsTpl']->append('categories', $category->toArray()); |
|
| 57 | + } |
|
| 57 | 58 | } |
| 58 | 59 | $GLOBALS['xoopsTpl']->assign('form', songlist_category_get_form(false)); |
| 59 | 60 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']); |
@@ -96,9 +97,10 @@ discard block |
||
| 96 | 97 | if (isset($_FILES['image'])&&!empty($_FILES['image']['name'])) { |
| 97 | 98 | |
| 98 | 99 | 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) { |
|
| 100 | + foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
|
| 101 | + foreach(explode('/', $folders) as $folder) { |
|
| 101 | 102 | $path .= DS . $folder; |
| 103 | + } |
|
| 102 | 104 | mkdir($path, 0777); |
| 103 | 105 | } |
| 104 | 106 | } |
@@ -118,8 +120,9 @@ discard block |
||
| 118 | 120 | exit(0); |
| 119 | 121 | } else { |
| 120 | 122 | |
| 121 | - if (strlen($category->getVar('image'))) |
|
| 122 | - unlink($GLOBALS['xoops']->path($category->getVar('path')).$category->getVar('image')); |
|
| 123 | + if (strlen($category->getVar('image'))) { |
|
| 124 | + unlink($GLOBALS['xoops']->path($category->getVar('path')).$category->getVar('image')); |
|
| 125 | + } |
|
| 123 | 126 | |
| 124 | 127 | $category->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
| 125 | 128 | $category->setVar('image', $uploader->getSavedFileName()); |
@@ -137,10 +140,11 @@ discard block |
||
| 137 | 140 | } |
| 138 | 141 | } |
| 139 | 142 | |
| 140 | - if ($_REQUEST['state'][$_REQUEST['id']]=='new') |
|
| 141 | - 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_CATEGORY_SAVEDOKEY); |
|
| 142 | - else |
|
| 143 | - 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_CATEGORY_SAVEDOKEY); |
|
| 143 | + if ($_REQUEST['state'][$_REQUEST['id']]=='new') { |
|
| 144 | + 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_CATEGORY_SAVEDOKEY); |
|
| 145 | + } else { |
|
| 146 | + 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_CATEGORY_SAVEDOKEY); |
|
| 147 | + } |
|
| 144 | 148 | exit(0); |
| 145 | 149 | } |
| 146 | 150 | break; |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | $indexAdmin = new ModuleAdmin(); |
| 38 | 38 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 39 | 39 | $aboutAdmin = new ModuleAdmin(); |
| 40 | - $paypalitemno='SONGLIST'; |
|
| 40 | + $paypalitemno = 'SONGLIST'; |
|
| 41 | 41 | $aboutAdmin = new ModuleAdmin(); |
| 42 | 42 | $about = $aboutAdmin->renderabout($paypalitemno, false); |
| 43 | - $donationform = array( 0 => '<form name="donation" id="donation" action="http://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
|
| 43 | + $donationform = array(0 => '<form name="donation" id="donation" action="http://www.chronolabs.coop/modules/xpayment/" method="post" onsubmit="return xoopsFormValidate_donation();">', |
|
| 44 | 44 | 1 => '<table class="outer" cellspacing="1" width="100%"><tbody><tr><th colspan="2">'.constant('_AM_SONGLIST_ABOUT_MAKEDONATE').'</th></tr><tr align="left" valign="top"><td class="head"><div class="xoops-form-element-caption-required"><span class="caption-text">Donation Amount</span><span class="caption-marker">*</span></div></td><td class="even"><select size="1" name="item[A][amount]" id="item[A][amount]" title="Donation Amount"><option value="5">5.00 AUD</option><option value="10">10.00 AUD</option><option value="20">20.00 AUD</option><option value="40">40.00 AUD</option><option value="60">60.00 AUD</option><option value="80">80.00 AUD</option><option value="90">90.00 AUD</option><option value="100">100.00 AUD</option><option value="200">200.00 AUD</option></select></td></tr><tr align="left" valign="top"><td class="head"></td><td class="even"><input class="formButton" name="submit" id="submit" value="'._SUBMIT.'" title="'._SUBMIT.'" type="submit"></td></tr></tbody></table>', |
| 45 | - 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="http://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="http://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', 'D'=>'', |
|
| 45 | + 2 => '<input name="op" id="op" value="createinvoice" type="hidden"><input name="plugin" id="plugin" value="donations" type="hidden"><input name="donation" id="donation" value="1" type="hidden"><input name="drawfor" id="drawfor" value="Chronolabs Co-Operative" type="hidden"><input name="drawto" id="drawto" value="%s" type="hidden"><input name="drawto_email" id="drawto_email" value="%s" type="hidden"><input name="key" id="key" value="%s" type="hidden"><input name="currency" id="currency" value="AUD" type="hidden"><input name="weight_unit" id="weight_unit" value="kgs" type="hidden"><input name="item[A][cat]" id="item[A][cat]" value="XDN%s" type="hidden"><input name="item[A][name]" id="item[A][name]" value="Donation for %s" type="hidden"><input name="item[A][quantity]" id="item[A][quantity]" value="1" type="hidden"><input name="item[A][shipping]" id="item[A][shipping]" value="0" type="hidden"><input name="item[A][handling]" id="item[A][handling]" value="0" type="hidden"><input name="item[A][weight]" id="item[A][weight]" value="0" type="hidden"><input name="item[A][tax]" id="item[A][tax]" value="0" type="hidden"><input name="return" id="return" value="http://www.chronolabs.coop/modules/donations/success.php" type="hidden"><input name="cancel" id="cancel" value="http://www.chronolabs.coop/modules/donations/success.php" type="hidden"></form>', 'D'=>'', |
|
| 46 | 46 | 3 => '', |
| 47 | 47 | 4 => '<!-- Start Form Validation JavaScript //--> |
| 48 | 48 | <script type="text/javascript"> |
@@ -52,16 +52,16 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | //--></script> |
| 54 | 54 | <!-- End Form Validation JavaScript //-->'); |
| 55 | - $paypalform = array( 0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
|
| 55 | + $paypalform = array(0 => '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">', |
|
| 56 | 56 | 1 => '<input name="cmd" value="_s-xclick" type="hidden">', |
| 57 | 57 | 2 => '<input name="hosted_button_id" value="%s" type="hidden">', |
| 58 | 58 | 3 => '<img alt="" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" height="1" border="0" width="1">', |
| 59 | 59 | 4 => '<input src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" name="submit" alt="PayPal - The safer, easier way to pay online!" border="0" type="image">', |
| 60 | 60 | 5 => '</form>'); |
| 61 | - for($key=0;$key<=4;$key++) { |
|
| 61 | + for ($key = 0; $key<=4; $key++) { |
|
| 62 | 62 | switch ($key) { |
| 63 | 63 | case 2: |
| 64 | - $donationform[$key] = sprintf($donationform[$key], $GLOBALS['xoopsConfig']['sitename'] . ' - ' . (strlen($GLOBALS['xoopsUser']->getVar('name'))>0?$GLOBALS['xoopsUser']->getVar('name'). ' ['.$GLOBALS['xoopsUser']->getVar('uname').']':$GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), XOOPS_LICENSE_KEY, strtoupper($GLOBALS['songlistModule']->getVar('dirname')), strtoupper($GLOBALS['songlistModule']->getVar('dirname')). ' '.$GLOBALS['songlistModule']->getVar('name')); |
|
| 64 | + $donationform[$key] = sprintf($donationform[$key], $GLOBALS['xoopsConfig']['sitename'].' - '.(strlen($GLOBALS['xoopsUser']->getVar('name'))>0 ? $GLOBALS['xoopsUser']->getVar('name').' ['.$GLOBALS['xoopsUser']->getVar('uname').']' : $GLOBALS['xoopsUser']->getVar('uname')), $GLOBALS['xoopsUser']->getVar('email'), XOOPS_LICENSE_KEY, strtoupper($GLOBALS['songlistModule']->getVar('dirname')), strtoupper($GLOBALS['songlistModule']->getVar('dirname')).' '.$GLOBALS['songlistModule']->getVar('name')); |
|
| 65 | 65 | break; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -111,25 +111,25 @@ |
||
| 111 | 111 | if ($uploader->fetchMedia('image')) { |
| 112 | 112 | if (!$uploader->upload()) { |
| 113 | 113 | |
| 114 | - songlist_adminMenu(1); |
|
| 115 | - echo $uploader->getErrors(); |
|
| 114 | + songlist_adminMenu(1); |
|
| 115 | + echo $uploader->getErrors(); |
|
| 116 | 116 | songlist_footer_adminMenu(); |
| 117 | 117 | xoops_cp_footer(); |
| 118 | 118 | exit(0); |
| 119 | - } else { |
|
| 119 | + } else { |
|
| 120 | 120 | |
| 121 | - if (strlen($votes->getVar('image'))) |
|
| 122 | - unlink($GLOBALS['xoops']->path($votes->getVar('path')).$votes->getVar('image')); |
|
| 121 | + if (strlen($votes->getVar('image'))) |
|
| 122 | + unlink($GLOBALS['xoops']->path($votes->getVar('path')).$votes->getVar('image')); |
|
| 123 | 123 | |
| 124 | - $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
|
| 125 | - $votes->setVar('image', $uploader->getSavedFileName()); |
|
| 126 | - @$votes_handler->insert($votes); |
|
| 124 | + $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
|
| 125 | + $votes->setVar('image', $uploader->getSavedFileName()); |
|
| 126 | + @$votes_handler->insert($votes); |
|
| 127 | 127 | |
| 128 | - } |
|
| 128 | + } |
|
| 129 | 129 | } else { |
| 130 | 130 | |
| 131 | 131 | songlist_adminMenu(1); |
| 132 | - echo $uploader->getErrors(); |
|
| 132 | + echo $uploader->getErrors(); |
|
| 133 | 133 | songlist_footer_adminMenu(); |
| 134 | 134 | xoops_cp_footer(); |
| 135 | 135 | exit(0); |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
| 16 | 16 | |
| 17 | 17 | switch($op) { |
| 18 | - default: |
|
| 19 | - case "votes": |
|
| 20 | - switch ($fct) |
|
| 21 | - { |
|
| 18 | + default: |
|
| 19 | + case "votes": |
|
| 20 | + switch ($fct) |
|
| 21 | + { |
|
| 22 | 22 | default: |
| 23 | 23 | case "list": |
| 24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_VOTES_DELETE, $votes->getVar('name'))); |
| 176 | 176 | } |
| 177 | 177 | break; |
| 178 | - } |
|
| 178 | + } |
|
| 179 | 179 | break; |
| 180 | 180 | |
| 181 | 181 | } |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | xoops_cp_header(); |
| 8 | 8 | |
| 9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"votes"; |
|
| 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'] : "votes"; |
|
| 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 | default: |
| 19 | 19 | case "votes": |
| 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 | - $votes_handler =& xoops_getmodulehandler('votes', 'songlist'); |
|
| 27 | + $votes_handler = & xoops_getmodulehandler('votes', 'songlist'); |
|
| 28 | 28 | |
| 29 | 29 | $criteria = $votes_handler->getFilterCriteria($GLOBALS['filter']); |
| 30 | 30 | $ttl = $votes_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 ($votes_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', $votes_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', $votes_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 | $votess = $votes_handler->getObjects($criteria, true); |
| 54 | - foreach($votess as $cid => $votes) { |
|
| 54 | + foreach ($votess as $cid => $votes) { |
|
| 55 | 55 | if (is_object($votes)) |
| 56 | 56 | $GLOBALS['xoopsTpl']->append('categories', $votes->toArray()); |
| 57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $indexAdmin = new ModuleAdmin(); |
| 67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 68 | 68 | |
| 69 | - $votes_handler =& xoops_getmodulehandler('votes', 'songlist'); |
|
| 69 | + $votes_handler = & xoops_getmodulehandler('votes', 'songlist'); |
|
| 70 | 70 | if (isset($_REQUEST['id'])) { |
| 71 | 71 | $votes = $votes_handler->get(intval($_REQUEST['id'])); |
| 72 | 72 | } else { |
@@ -79,26 +79,26 @@ discard block |
||
| 79 | 79 | break; |
| 80 | 80 | case "save": |
| 81 | 81 | |
| 82 | - $votes_handler =& xoops_getmodulehandler('votes', 'songlist'); |
|
| 83 | - $id=0; |
|
| 84 | - if ($id=intval($_REQUEST['id'])) { |
|
| 82 | + $votes_handler = & xoops_getmodulehandler('votes', 'songlist'); |
|
| 83 | + $id = 0; |
|
| 84 | + if ($id = intval($_REQUEST['id'])) { |
|
| 85 | 85 | $votes = $votes_handler->get($id); |
| 86 | 86 | } else { |
| 87 | 87 | $votes = $votes_handler->create(); |
| 88 | 88 | } |
| 89 | 89 | $votes->setVars($_POST[$id]); |
| 90 | 90 | |
| 91 | - if (!$id=$votes_handler->insert($votes)) { |
|
| 91 | + if (!$id = $votes_handler->insert($votes)) { |
|
| 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_VOTES_FAILEDTOSAVE); |
| 93 | 93 | exit(0); |
| 94 | 94 | } else { |
| 95 | 95 | |
| 96 | - if (isset($_FILES['image'])&&!empty($_FILES['image']['name'])) { |
|
| 96 | + if (isset($_FILES['image']) && !empty($_FILES['image']['name'])) { |
|
| 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 | $votes = $votes_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_VOTES_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_VOTES_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_VOTES_SAVEDOKEY); |
| 143 | 143 | exit(0); |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | break; |
| 146 | 146 | case "savelist": |
| 147 | 147 | |
| 148 | - $votes_handler =& xoops_getmodulehandler('votes', 'songlist'); |
|
| 149 | - foreach($_REQUEST['id'] as $id) { |
|
| 148 | + $votes_handler = & xoops_getmodulehandler('votes', 'songlist'); |
|
| 149 | + foreach ($_REQUEST['id'] as $id) { |
|
| 150 | 150 | $votes = $votes_handler->get($id); |
| 151 | 151 | $votes->setVars($_POST[$id]); |
| 152 | 152 | if (!$votes_handler->insert($votes)) { |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | break; |
| 160 | 160 | case "delete": |
| 161 | 161 | |
| 162 | - $votes_handler =& xoops_getmodulehandler('votes', 'songlist'); |
|
| 163 | - $id=0; |
|
| 164 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
| 162 | + $votes_handler = & xoops_getmodulehandler('votes', 'songlist'); |
|
| 163 | + $id = 0; |
|
| 164 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
| 165 | 165 | $votes = $votes_handler->get($id); |
| 166 | 166 | if (!$votes_handler->delete($votes)) { |
| 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_VOTES_FAILEDTODELETE); |
@@ -52,8 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $votess = $votes_handler->getObjects($criteria, true); |
| 54 | 54 | foreach($votess as $cid => $votes) { |
| 55 | - if (is_object($votes)) |
|
| 56 | - $GLOBALS['xoopsTpl']->append('categories', $votes->toArray()); |
|
| 55 | + if (is_object($votes)) { |
|
| 56 | + $GLOBALS['xoopsTpl']->append('categories', $votes->toArray()); |
|
| 57 | + } |
|
| 57 | 58 | } |
| 58 | 59 | //$GLOBALS['xoopsTpl']->assign('form', songlist_votes_get_form(false)); |
| 59 | 60 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']); |
@@ -96,9 +97,10 @@ discard block |
||
| 96 | 97 | if (isset($_FILES['image'])&&!empty($_FILES['image']['name'])) { |
| 97 | 98 | |
| 98 | 99 | 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) { |
|
| 100 | + foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
|
| 101 | + foreach(explode('/', $folders) as $folder) { |
|
| 101 | 102 | $path .= DS . $folder; |
| 103 | + } |
|
| 102 | 104 | mkdir($path, 0777); |
| 103 | 105 | } |
| 104 | 106 | } |
@@ -118,8 +120,9 @@ discard block |
||
| 118 | 120 | exit(0); |
| 119 | 121 | } else { |
| 120 | 122 | |
| 121 | - if (strlen($votes->getVar('image'))) |
|
| 122 | - unlink($GLOBALS['xoops']->path($votes->getVar('path')).$votes->getVar('image')); |
|
| 123 | + if (strlen($votes->getVar('image'))) { |
|
| 124 | + unlink($GLOBALS['xoops']->path($votes->getVar('path')).$votes->getVar('image')); |
|
| 125 | + } |
|
| 123 | 126 | |
| 124 | 127 | $votes->setVar('path', $GLOBALS['songlistModuleConfig']['upload_areas']); |
| 125 | 128 | $votes->setVar('image', $uploader->getSavedFileName()); |
@@ -136,10 +139,11 @@ discard block |
||
| 136 | 139 | } |
| 137 | 140 | } |
| 138 | 141 | |
| 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_VOTES_SAVEDOKEY); |
|
| 141 | - else |
|
| 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_VOTES_SAVEDOKEY); |
|
| 142 | + if ($_REQUEST['state'][$_REQUEST['id']]=='new') { |
|
| 143 | + 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_VOTES_SAVEDOKEY); |
|
| 144 | + } else { |
|
| 145 | + 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_VOTES_SAVEDOKEY); |
|
| 146 | + } |
|
| 143 | 147 | exit(0); |
| 144 | 148 | } |
| 145 | 149 | break; |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | case "actiona": |
| 24 | 24 | |
| 25 | 25 | if (isset($_SESSION['xmlfile'])) { |
| 26 | - redirect_header($_SERVER['PHP_SELF'].'?file='.$_SESSION['xmlfile'].'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
| 27 | - exit; |
|
| 26 | + redirect_header($_SERVER['PHP_SELF'].'?file='.$_SESSION['xmlfile'].'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
| 27 | + exit; |
|
| 28 | 28 | } |
| 29 | 29 | $indexAdmin = new ModuleAdmin(); |
| 30 | 30 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | if ($_POST['file']!='') { |
| 39 | 39 | $file = substr(md5(microtime(true)), mt_rand(0,20), 13).'.xml'; |
| 40 | 40 | copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$file); |
| 41 | - $_SESSION['xmlfile'] = $file; |
|
| 42 | - redirect_header($_SERVER['PHP_SELF'].'?file='.$file.'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
| 43 | - exit; |
|
| 41 | + $_SESSION['xmlfile'] = $file; |
|
| 42 | + redirect_header($_SERVER['PHP_SELF'].'?file='.$file.'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
|
| 43 | + exit; |
|
| 44 | 44 | } elseif (isset($_FILES['xmlfile'])&&strlen($_FILES['xmlfile']['name'])) { |
| 45 | 45 | |
| 46 | 46 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
@@ -59,25 +59,25 @@ discard block |
||
| 59 | 59 | if (!$uploader->upload()) { |
| 60 | 60 | $indexAdmin = new ModuleAdmin(); |
| 61 | 61 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 62 | - echo $uploader->getErrors(); |
|
| 62 | + echo $uploader->getErrors(); |
|
| 63 | 63 | xoops_cp_footer(); |
| 64 | 64 | exit(0); |
| 65 | - } else { |
|
| 66 | - $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
|
| 67 | - redirect_header($_SERVER['PHP_SELF'].'?file='.$uploader->getSavedFileName().'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
| 68 | - exit; |
|
| 69 | - } |
|
| 65 | + } else { |
|
| 66 | + $_SESSION['xmlfile'] = $uploader->getSavedFileName(); |
|
| 67 | + redirect_header($_SERVER['PHP_SELF'].'?file='.$uploader->getSavedFileName().'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_UPLOADED); |
|
| 68 | + exit; |
|
| 69 | + } |
|
| 70 | 70 | } else { |
| 71 | 71 | $indexAdmin = new ModuleAdmin(); |
| 72 | 72 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 73 | - echo $uploader->getErrors(); |
|
| 73 | + echo $uploader->getErrors(); |
|
| 74 | 74 | xoops_cp_footer(); |
| 75 | 75 | exit(0); |
| 76 | 76 | } |
| 77 | 77 | } else { |
| 78 | 78 | $indexAdmin = new ModuleAdmin(); |
| 79 | 79 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 80 | - echo _AM_SONGLIST_IMPORT_NOFILE; |
|
| 80 | + echo _AM_SONGLIST_IMPORT_NOFILE; |
|
| 81 | 81 | xoops_cp_footer(); |
| 82 | 82 | exit(0); |
| 83 | 83 | } |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | $filter = isset($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
| 16 | 16 | |
| 17 | 17 | switch($op) { |
| 18 | - default: |
|
| 19 | - case "import": |
|
| 20 | - switch ($fct) |
|
| 21 | - { |
|
| 18 | + default: |
|
| 19 | + case "import": |
|
| 20 | + switch ($fct) |
|
| 21 | + { |
|
| 22 | 22 | default: |
| 23 | 23 | case "actiona": |
| 24 | 24 | |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | unset($_SESSION['xmlfile']); |
| 579 | 579 | redirect_header($_SERVER['PHP_SELF'].'?op=import&fct=actiona', 10, _AM_SONGLIST_XMLFILE_COMPLETE); |
| 580 | 580 | break; |
| 581 | - } |
|
| 581 | + } |
|
| 582 | 582 | break; |
| 583 | 583 | |
| 584 | 584 | } |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | xoops_cp_header(); |
| 8 | 8 | |
| 9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"import"; |
|
| 10 | - $fct = isset($_REQUEST['fct'])?$_REQUEST['fct']:"actiona"; |
|
| 11 | - $limit = isset($_REQUEST['limit'])?intval($_REQUEST['limit']):30; |
|
| 12 | - $start = isset($_REQUEST['start'])?intval($_REQUEST['start']):0; |
|
| 13 | - $order = isset($_REQUEST['order'])?$_REQUEST['order']:'DESC'; |
|
| 14 | - $sort = isset($_REQUEST['sort'])?''.$_REQUEST['sort'].'':'created'; |
|
| 15 | - $filter = isset($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
|
| 9 | + $op = isset($_REQUEST['op']) ? $_REQUEST['op'] : "import"; |
|
| 10 | + $fct = isset($_REQUEST['fct']) ? $_REQUEST['fct'] : "actiona"; |
|
| 11 | + $limit = isset($_REQUEST['limit']) ?intval($_REQUEST['limit']) : 30; |
|
| 12 | + $start = isset($_REQUEST['start']) ?intval($_REQUEST['start']) : 0; |
|
| 13 | + $order = isset($_REQUEST['order']) ? $_REQUEST['order'] : 'DESC'; |
|
| 14 | + $sort = isset($_REQUEST['sort']) ? ''.$_REQUEST['sort'].'' : 'created'; |
|
| 15 | + $filter = isset($_REQUEST['filter']) ? ''.$_REQUEST['filter'].'' : '1,1'; |
|
| 16 | 16 | |
| 17 | - switch($op) { |
|
| 17 | + switch ($op) { |
|
| 18 | 18 | default: |
| 19 | 19 | case "import": |
| 20 | 20 | switch ($fct) |
@@ -36,24 +36,24 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | case "upload": |
| 38 | 38 | if ($_POST['file']!='') { |
| 39 | - $file = substr(md5(microtime(true)), mt_rand(0,20), 13).'.xml'; |
|
| 39 | + $file = substr(md5(microtime(true)), mt_rand(0, 20), 13).'.xml'; |
|
| 40 | 40 | copy($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$_POST['file'], $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']).$file); |
| 41 | 41 | $_SESSION['xmlfile'] = $file; |
| 42 | 42 | redirect_header($_SERVER['PHP_SELF'].'?file='.$file.'&op=import&fct=actionb', 10, _AM_SONGLIST_XMLFILE_COPIED); |
| 43 | 43 | exit; |
| 44 | - } elseif (isset($_FILES['xmlfile'])&&strlen($_FILES['xmlfile']['name'])) { |
|
| 44 | + } elseif (isset($_FILES['xmlfile']) && strlen($_FILES['xmlfile']['name'])) { |
|
| 45 | 45 | |
| 46 | 46 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
| 47 | - foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
| 48 | - foreach(explode('/', $folders) as $folder) { |
|
| 49 | - $path .= DS . $folder; |
|
| 47 | + foreach (explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
| 48 | + foreach (explode('/', $folders) as $folder) { |
|
| 49 | + $path .= DS.$folder; |
|
| 50 | 50 | mkdir($path, 0777); |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | include_once($GLOBALS['xoops']->path('modules/songlist/include/uploader.php')); |
| 55 | 55 | $uploader = new SonglistMediaUploader($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']), array('application/xml', 'text/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity', 'text/xml xml xsl', 'text/xml-external-parsed-entity'), 1024*1024*1024*32, 0, 0, array('xml')); |
| 56 | - $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0,20), 13)); |
|
| 56 | + $uploader->setPrefix(substr(md5(microtime(true)), mt_rand(0, 20), 13)); |
|
| 57 | 57 | |
| 58 | 58 | if ($uploader->fetchMedia('xmlfile')) { |
| 59 | 59 | if (!$uploader->upload()) { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | $filesize = filesize($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])); |
| 106 | - $mb = floor($filesize / 1024 / 1024); |
|
| 106 | + $mb = floor($filesize/1024/1024); |
|
| 107 | 107 | if ($mb>32) { |
| 108 | 108 | set_ini('memory_limit', ($mb+128).'M'); |
| 109 | 109 | } |
@@ -114,15 +114,15 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | $xmlarray = songlist_xml2array(file_get_contents($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'].$_SESSION['xmlfile'])), false, 'tag'); |
| 116 | 116 | |
| 117 | - if (!empty($_POST['collection'])&&strlen($_POST['collection'])>0) { |
|
| 118 | - if (!empty($_POST['record'])&&strlen($_POST['record'])>0) { |
|
| 119 | - foreach($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
|
| 117 | + if (!empty($_POST['collection']) && strlen($_POST['collection'])>0) { |
|
| 118 | + if (!empty($_POST['record']) && strlen($_POST['record'])>0) { |
|
| 119 | + foreach ($xmlarray[$_POST['collection']][$_POST['record']] as $recid => $data) { |
|
| 120 | 120 | if (isset($_POST['limiting'])) { |
| 121 | 121 | if (intval($_POST['limiting'])==true) { |
| 122 | 122 | $record++; |
| 123 | 123 | if ($record>intval($_POST['records'])) { |
| 124 | 124 | $start = time(); |
| 125 | - while(time()-$start<intval($_POST['wait'])) { |
|
| 125 | + while (time()-$start<intval($_POST['wait'])) { |
|
| 126 | 126 | |
| 127 | 127 | } |
| 128 | 128 | $records = 0; |
@@ -131,10 +131,10 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | $gid = 0; |
| 133 | 133 | $gids = array(); |
| 134 | - if (!empty($_POST['genre'])&&strlen($_POST['genre'])>1) { |
|
| 135 | - if (isset($data[$_POST['genre']])&&trim($_POST['genre'])!='') { |
|
| 136 | - foreach(explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
| 137 | - $criteria = new Criteria('`name`', trim($genre)); |
|
| 134 | + if (!empty($_POST['genre']) && strlen($_POST['genre'])>1) { |
|
| 135 | + if (isset($data[$_POST['genre']]) && trim($_POST['genre'])!='') { |
|
| 136 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
| 137 | + $criteria = new Criteria('`name`', trim($genre)); |
|
| 138 | 138 | if ($genre_handler->getCount($criteria)>0) { |
| 139 | 139 | $objects = $genre_handler->getObjects($criteria, false); |
| 140 | 140 | $gid = $objects[0]->getVar('gid'); |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | } |
| 150 | 150 | $vcid = 0; |
| 151 | - if (!empty($_POST['voice'])&&strlen($_POST['voice'])>1) { |
|
| 152 | - if (isset($data[$_POST['voice']])&&trim($_POST['voice'])!='') { |
|
| 153 | - $criteria = new Criteria('`name`', trim($data[$_POST['voice']])); |
|
| 151 | + if (!empty($_POST['voice']) && strlen($_POST['voice'])>1) { |
|
| 152 | + if (isset($data[$_POST['voice']]) && trim($_POST['voice'])!='') { |
|
| 153 | + $criteria = new Criteria('`name`', trim($data[$_POST['voice']])); |
|
| 154 | 154 | if ($voice_handler->getCount($criteria)>0) { |
| 155 | 155 | $objects = $voice_handler->getObjects($criteria, false); |
| 156 | 156 | $vcid = $objects[0]->getVar('vcid'); |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $cid = 0; |
| 166 | - if (!empty($_POST['category'])&&strlen($_POST['category'])>1) { |
|
| 167 | - if (isset($data[$_POST['category']])&&trim($_POST['category'])!='') { |
|
| 168 | - $criteria = new Criteria('`name`', trim($data[$_POST['category']])); |
|
| 166 | + if (!empty($_POST['category']) && strlen($_POST['category'])>1) { |
|
| 167 | + if (isset($data[$_POST['category']]) && trim($_POST['category'])!='') { |
|
| 168 | + $criteria = new Criteria('`name`', trim($data[$_POST['category']])); |
|
| 169 | 169 | if ($category_handler->getCount($criteria)>0) { |
| 170 | 170 | $objects = $category_handler->getObjects($criteria, false); |
| 171 | 171 | $cid = $objects[0]->getVar('cid'); |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | $aids = array(); |
| 180 | - if (!empty($_POST['artist'])&&strlen($_POST['artist'])>1) { |
|
| 181 | - if (isset($data[$_POST['artist']])&&$_POST['artist']!='') { |
|
| 182 | - foreach(explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
| 183 | - $criteria = new Criteria('`name`', trim($artist)); |
|
| 180 | + if (!empty($_POST['artist']) && strlen($_POST['artist'])>1) { |
|
| 181 | + if (isset($data[$_POST['artist']]) && $_POST['artist']!='') { |
|
| 182 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
| 183 | + $criteria = new Criteria('`name`', trim($artist)); |
|
| 184 | 184 | if ($artists_handler->getCount($criteria)>0) { |
| 185 | 185 | $objects = $artists_handler->getObjects($criteria, false); |
| 186 | 186 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
@@ -194,9 +194,9 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | $abid = 0; |
| 197 | - if (!empty($_POST['album'])&&strlen($_POST['album'])>1) { |
|
| 198 | - if (isset($data[$_POST['album']])&&trim($_POST['album'])!='') { |
|
| 199 | - $criteria = new Criteria('`title`', trim($data[$_POST['album']])); |
|
| 197 | + if (!empty($_POST['album']) && strlen($_POST['album'])>1) { |
|
| 198 | + if (isset($data[$_POST['album']]) && trim($_POST['album'])!='') { |
|
| 199 | + $criteria = new Criteria('`title`', trim($data[$_POST['album']])); |
|
| 200 | 200 | if ($albums_handler->getCount($criteria)>0) { |
| 201 | 201 | $objects = $albums_handler->getObjects($criteria, false); |
| 202 | 202 | $abid = $objects[0]->getVar('abid'); |
@@ -210,13 +210,13 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | 212 | $sid = 0; |
| 213 | - if ((!empty($_POST['songid'])&&strlen($_POST['songid'])>1)||(!empty($_POST['title'])&&strlen($_POST['title'])>1)) { |
|
| 214 | - if ((isset($data[$_POST['songid']])&&$_POST['songid']!='')||(isset($data[$_POST['title']])&&$_POST['title']!='')) { |
|
| 213 | + if ((!empty($_POST['songid']) && strlen($_POST['songid'])>1) || (!empty($_POST['title']) && strlen($_POST['title'])>1)) { |
|
| 214 | + if ((isset($data[$_POST['songid']]) && $_POST['songid']!='') || (isset($data[$_POST['title']]) && $_POST['title']!='')) { |
|
| 215 | 215 | $criteria = new CriteriaCompo(); |
| 216 | 216 | if (trim($data[$_POST['songid']])!='') |
| 217 | - $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 217 | + $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 218 | 218 | if (trim($data[$_POST['title']])!='') |
| 219 | - $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 219 | + $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 220 | 220 | if ($songs_handler->getCount($criteria)>0) { |
| 221 | 221 | $objects = $songs_handler->getObjects($criteria, false); |
| 222 | 222 | $object = $objects[0]; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $object->setVar('lyrics', str_replace("\n", "<br/>\n", trim($data[$_POST['lyrics']]))); |
| 237 | 237 | $sid = $songs_handler->insert($object); |
| 238 | 238 | |
| 239 | - if ($GLOBALS['songlistModuleConfig']['tags']&&file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
| 239 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
| 240 | 240 | $tag_handler = xoops_getmodulehandler('tag', 'tag'); |
| 241 | 241 | $tag_handler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar("dirname"), $cid); |
| 242 | 242 | } |
@@ -251,14 +251,14 @@ discard block |
||
| 251 | 251 | $extra = $extras_handler->create(); |
| 252 | 252 | } |
| 253 | 253 | $extra->setVar('sid', $sid); |
| 254 | - foreach($fields as $field) { |
|
| 255 | - if (!empty($_POST[$field->getVar('field_name')])&&strlen($_POST[$field->getVar('field_name')])>1) { |
|
| 256 | - if (isset($data[$_POST[$field->getVar('field_name')]])&&trim($_POST[$field->getVar('field_name')])!='') { |
|
| 254 | + foreach ($fields as $field) { |
|
| 255 | + if (!empty($_POST[$field->getVar('field_name')]) && strlen($_POST[$field->getVar('field_name')])>1) { |
|
| 256 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && trim($_POST[$field->getVar('field_name')])!='') { |
|
| 257 | 257 | $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | - foreach($artists_handler->getObjects(new Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
| 261 | + foreach ($artists_handler->getObjects(new Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
| 262 | 262 | $artist->setVar('sids', array_merge($artist->getVar('sids'), array($sid=>$sid))); |
| 263 | 263 | $artists_handler->insert($artist, true); |
| 264 | 264 | } |
@@ -266,13 +266,13 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | } else { |
| 269 | - foreach($xmlarray[$_POST['collection']] as $id => $records) { |
|
| 269 | + foreach ($xmlarray[$_POST['collection']] as $id => $records) { |
|
| 270 | 270 | if (isset($_POST['limiting'])) { |
| 271 | 271 | if (intval($_POST['limiting'])==true) { |
| 272 | 272 | $record++; |
| 273 | 273 | if ($record>intval($_POST['records'])) { |
| 274 | 274 | $start = time(); |
| 275 | - while(time()-$start<intval($_POST['wait'])) { |
|
| 275 | + while (time()-$start<intval($_POST['wait'])) { |
|
| 276 | 276 | |
| 277 | 277 | } |
| 278 | 278 | $records = 0; |
@@ -281,10 +281,10 @@ discard block |
||
| 281 | 281 | } |
| 282 | 282 | $gid = 0; |
| 283 | 283 | $gids = array(); |
| 284 | - if (!empty($_POST['genre'])&&strlen($_POST['genre'])>1) { |
|
| 285 | - if (isset($data[$_POST['genre']])&&trim($_POST['genre'])!='') { |
|
| 286 | - foreach(explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
| 287 | - $criteria = new Criteria('`name`', trim($genre)); |
|
| 284 | + if (!empty($_POST['genre']) && strlen($_POST['genre'])>1) { |
|
| 285 | + if (isset($data[$_POST['genre']]) && trim($_POST['genre'])!='') { |
|
| 286 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
| 287 | + $criteria = new Criteria('`name`', trim($genre)); |
|
| 288 | 288 | if ($genre_handler->getCount($criteria)>0) { |
| 289 | 289 | $objects = $genre_handler->getObjects($criteria, false); |
| 290 | 290 | $gid = $objects[0]->getVar('gid'); |
@@ -297,9 +297,9 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | - if (!empty($_POST['voice'])&&strlen($_POST['voice'])>1) { |
|
| 301 | - if (isset($data[$_POST['voice']])&&trim($_POST['voice'])!='') { |
|
| 302 | - $criteria = new Criteria('`name`', trim($data[$_POST['voice']])); |
|
| 300 | + if (!empty($_POST['voice']) && strlen($_POST['voice'])>1) { |
|
| 301 | + if (isset($data[$_POST['voice']]) && trim($_POST['voice'])!='') { |
|
| 302 | + $criteria = new Criteria('`name`', trim($data[$_POST['voice']])); |
|
| 303 | 303 | if ($voice_handler->getCount($criteria)>0) { |
| 304 | 304 | $objects = $voice_handler->getObjects($criteria, false); |
| 305 | 305 | $vcid = $objects[0]->getVar('vcid'); |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | $cid = 0; |
| 314 | - if (!empty($_POST['category'])&&strlen($_POST['category'])>1) { |
|
| 315 | - if (isset($data[$_POST['category']])&&trim($_POST['category'])!='') { |
|
| 316 | - $criteria = new Criteria('`name`', trim($data[$_POST['category']])); |
|
| 314 | + if (!empty($_POST['category']) && strlen($_POST['category'])>1) { |
|
| 315 | + if (isset($data[$_POST['category']]) && trim($_POST['category'])!='') { |
|
| 316 | + $criteria = new Criteria('`name`', trim($data[$_POST['category']])); |
|
| 317 | 317 | if ($category_handler->getCount($criteria)>0) { |
| 318 | 318 | $objects = $category_handler->getObjects($criteria, false); |
| 319 | 319 | $cid = $objects[0]->getVar('cid'); |
@@ -325,10 +325,10 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | $aids = array(); |
| 328 | - if (!empty($_POST['artist'])&&strlen($_POST['artist'])>1) { |
|
| 329 | - if (isset($data[$_POST['artist']])&&$_POST['artist']!='') { |
|
| 330 | - foreach(explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
| 331 | - $criteria = new Criteria('`name`', trim($artist)); |
|
| 328 | + if (!empty($_POST['artist']) && strlen($_POST['artist'])>1) { |
|
| 329 | + if (isset($data[$_POST['artist']]) && $_POST['artist']!='') { |
|
| 330 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
| 331 | + $criteria = new Criteria('`name`', trim($artist)); |
|
| 332 | 332 | if ($artists_handler->getCount($criteria)>0) { |
| 333 | 333 | $objects = $artists_handler->getObjects($criteria, false); |
| 334 | 334 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | $abid = 0; |
| 346 | - if (!empty($_POST['album'])&&strlen($_POST['album'])>1) { |
|
| 347 | - if (isset($data[$_POST['album']])&&trim($_POST['album'])!='') { |
|
| 348 | - $criteria = new Criteria('`title`', trim($data[$_POST['album']])); |
|
| 346 | + if (!empty($_POST['album']) && strlen($_POST['album'])>1) { |
|
| 347 | + if (isset($data[$_POST['album']]) && trim($_POST['album'])!='') { |
|
| 348 | + $criteria = new Criteria('`title`', trim($data[$_POST['album']])); |
|
| 349 | 349 | if ($albums_handler->getCount($criteria)>0) { |
| 350 | 350 | $objects = $albums_handler->getObjects($criteria, false); |
| 351 | 351 | $abid = $objects[0]->getVar('abid'); |
@@ -359,13 +359,13 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | $sid = 0; |
| 362 | - if ((!empty($_POST['songid'])&&strlen($_POST['songid'])>1)||(!empty($_POST['title'])&&strlen($_POST['title'])>1)) { |
|
| 363 | - if ((isset($data[$_POST['songid']])&&$_POST['songid']!='')||(isset($data[$_POST['title']])&&$_POST['title']!='')) { |
|
| 362 | + if ((!empty($_POST['songid']) && strlen($_POST['songid'])>1) || (!empty($_POST['title']) && strlen($_POST['title'])>1)) { |
|
| 363 | + if ((isset($data[$_POST['songid']]) && $_POST['songid']!='') || (isset($data[$_POST['title']]) && $_POST['title']!='')) { |
|
| 364 | 364 | $criteria = new CriteriaCompo(); |
| 365 | 365 | if (trim($data[$_POST['songid']])!='') |
| 366 | - $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 366 | + $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 367 | 367 | if (trim($data[$_POST['title']])!='') |
| 368 | - $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 368 | + $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 369 | 369 | if ($songs_handler->getCount($criteria)>0) { |
| 370 | 370 | $objects = $songs_handler->getObjects($criteria, false); |
| 371 | 371 | $object = $objects[0]; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | $object->setVar('lyrics', str_replace("\n", "<br/>\n", trim($data[$_POST['lyrics']]))); |
| 386 | 386 | $sid = $songs_handler->insert($object); |
| 387 | 387 | |
| 388 | - if ($GLOBALS['songlistModuleConfig']['tags']&&file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
| 388 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
| 389 | 389 | $tag_handler = xoops_getmodulehandler('tag', 'tag'); |
| 390 | 390 | $tag_handler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar("dirname"), $cid); |
| 391 | 391 | } |
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | $extra = $extras_handler->create(); |
| 401 | 401 | } |
| 402 | 402 | $extra->setVar('sid', $sid); |
| 403 | - foreach($fields as $field) { |
|
| 404 | - if (!empty($_POST[$field->getVar('field_name')])&&strlen($_POST[$field->getVar('field_name')])>1) { |
|
| 405 | - if (isset($data[$_POST[$field->getVar('field_name')]])&&trim($_POST[$field->getVar('field_name')])!='') { |
|
| 403 | + foreach ($fields as $field) { |
|
| 404 | + if (!empty($_POST[$field->getVar('field_name')]) && strlen($_POST[$field->getVar('field_name')])>1) { |
|
| 405 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && trim($_POST[$field->getVar('field_name')])!='') { |
|
| 406 | 406 | $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | $extras_handler->insert($extra, true); |
| 411 | - foreach($artists_handler->getObjects(new Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
| 411 | + foreach ($artists_handler->getObjects(new Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
| 412 | 412 | $artist->setVar('sids', array_merge($artist->getVar('sids'), array($sid=>$sid))); |
| 413 | 413 | $artists_handler->insert($artist, true); |
| 414 | 414 | } |
@@ -419,17 +419,17 @@ discard block |
||
| 419 | 419 | } else { |
| 420 | 420 | |
| 421 | 421 | foreach ($xmlarray as $recid => $data) { |
| 422 | - $cid=0; |
|
| 423 | - $gid=0; |
|
| 424 | - $vcid=0; |
|
| 425 | - $aids=array(); |
|
| 426 | - $abid=array(); |
|
| 422 | + $cid = 0; |
|
| 423 | + $gid = 0; |
|
| 424 | + $vcid = 0; |
|
| 425 | + $aids = array(); |
|
| 426 | + $abid = array(); |
|
| 427 | 427 | if (isset($_POST['limiting'])) { |
| 428 | 428 | if (intval($_POST['limiting'])==true) { |
| 429 | 429 | $record++; |
| 430 | 430 | if ($record>intval($_POST['records'])) { |
| 431 | 431 | $start = time(); |
| 432 | - while(time()-$start<intval($_POST['wait'])) { |
|
| 432 | + while (time()-$start<intval($_POST['wait'])) { |
|
| 433 | 433 | |
| 434 | 434 | } |
| 435 | 435 | $records = 0; |
@@ -438,10 +438,10 @@ discard block |
||
| 438 | 438 | } |
| 439 | 439 | $gid = 0; |
| 440 | 440 | $gids = array(); |
| 441 | - if (!empty($_POST['genre'])&&strlen($_POST['genre'])>1) { |
|
| 442 | - if (isset($data[$_POST['genre']])&&trim($_POST['genre'])!='') { |
|
| 443 | - foreach(explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
| 444 | - $criteria = new Criteria('`name`', trim($genre)); |
|
| 441 | + if (!empty($_POST['genre']) && strlen($_POST['genre'])>1) { |
|
| 442 | + if (isset($data[$_POST['genre']]) && trim($_POST['genre'])!='') { |
|
| 443 | + foreach (explode(',', trim($data[$_POST['genre']])) as $genre) { |
|
| 444 | + $criteria = new Criteria('`name`', trim($genre)); |
|
| 445 | 445 | if ($genre_handler->getCount($criteria)>0) { |
| 446 | 446 | $objects = $genre_handler->getObjects($criteria, false); |
| 447 | 447 | $gid = $objects[0]->getVar('gid'); |
@@ -456,9 +456,9 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | $vcid = 0; |
| 459 | - if (!empty($_POST['voice'])&&strlen($_POST['voice'])>1) { |
|
| 460 | - if (isset($data[$_POST['voice']])&&trim($_POST['voice'])!='') { |
|
| 461 | - $criteria = new Criteria('`name`', trim($data[$_POST['voice']])); |
|
| 459 | + if (!empty($_POST['voice']) && strlen($_POST['voice'])>1) { |
|
| 460 | + if (isset($data[$_POST['voice']]) && trim($_POST['voice'])!='') { |
|
| 461 | + $criteria = new Criteria('`name`', trim($data[$_POST['voice']])); |
|
| 462 | 462 | if ($voice_handler->getCount($criteria)>0) { |
| 463 | 463 | $objects = $voice_handler->getObjects($criteria, false); |
| 464 | 464 | $vcid = $objects[0]->getVar('vcid'); |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | $cid = 0; |
| 473 | - if (!empty($_POST['category'])&&strlen($_POST['category'])>1) { |
|
| 474 | - if (isset($data[$_POST['category']])&&trim($_POST['category'])!='') { |
|
| 475 | - $criteria = new Criteria('`name`', trim($data[$_POST['category']])); |
|
| 473 | + if (!empty($_POST['category']) && strlen($_POST['category'])>1) { |
|
| 474 | + if (isset($data[$_POST['category']]) && trim($_POST['category'])!='') { |
|
| 475 | + $criteria = new Criteria('`name`', trim($data[$_POST['category']])); |
|
| 476 | 476 | if ($category_handler->getCount($criteria)>0) { |
| 477 | 477 | $objects = $category_handler->getObjects($criteria, false); |
| 478 | 478 | $cid = $objects[0]->getVar('cid'); |
@@ -484,10 +484,10 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | $aids = array(); |
| 487 | - if (!empty($_POST['artist'])&&strlen($_POST['artist'])>1) { |
|
| 488 | - if (isset($data[$_POST['artist']])&&$_POST['artist']!='') { |
|
| 489 | - foreach(explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
| 490 | - $criteria = new Criteria('`name`', trim($artist)); |
|
| 487 | + if (!empty($_POST['artist']) && strlen($_POST['artist'])>1) { |
|
| 488 | + if (isset($data[$_POST['artist']]) && $_POST['artist']!='') { |
|
| 489 | + foreach (explode(',', trim($data[$_POST['artist']])) as $artist) { |
|
| 490 | + $criteria = new Criteria('`name`', trim($artist)); |
|
| 491 | 491 | if ($artists_handler->getCount($criteria)>0) { |
| 492 | 492 | $objects = $artists_handler->getObjects($criteria, false); |
| 493 | 493 | $aids[$objects[0]->getVar('aid')] = $objects[0]->getVar('aid'); |
@@ -502,9 +502,9 @@ discard block |
||
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | $abid = 0; |
| 505 | - if (!empty($_POST['album'])&&strlen($_POST['album'])>1) { |
|
| 506 | - if (isset($data[$_POST['album']])&&trim($_POST['album'])!='') { |
|
| 507 | - $criteria = new Criteria('`title`', trim($data[$_POST['album']])); |
|
| 505 | + if (!empty($_POST['album']) && strlen($_POST['album'])>1) { |
|
| 506 | + if (isset($data[$_POST['album']]) && trim($_POST['album'])!='') { |
|
| 507 | + $criteria = new Criteria('`title`', trim($data[$_POST['album']])); |
|
| 508 | 508 | if ($albums_handler->getCount($criteria)>0) { |
| 509 | 509 | $objects = $albums_handler->getObjects($criteria, false); |
| 510 | 510 | $abid = $objects[0]->getVar('abid'); |
@@ -518,13 +518,13 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | } |
| 520 | 520 | $sid = 0; |
| 521 | - if ((!empty($_POST['songid'])&&strlen($_POST['songid'])>1)||(!empty($_POST['title'])&&strlen($_POST['title'])>1)) { |
|
| 522 | - if ((isset($data[$_POST['songid']])&&$_POST['songid']!='')||(isset($data[$_POST['title']])&&$_POST['title']!='')) { |
|
| 521 | + if ((!empty($_POST['songid']) && strlen($_POST['songid'])>1) || (!empty($_POST['title']) && strlen($_POST['title'])>1)) { |
|
| 522 | + if ((isset($data[$_POST['songid']]) && $_POST['songid']!='') || (isset($data[$_POST['title']]) && $_POST['title']!='')) { |
|
| 523 | 523 | $criteria = new CriteriaCompo(); |
| 524 | 524 | if (trim($data[$_POST['songid']])!='') |
| 525 | - $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 525 | + $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 526 | 526 | if (trim($data[$_POST['title']])!='') |
| 527 | - $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 527 | + $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 528 | 528 | if ($songs_handler->getCount($criteria)>0) { |
| 529 | 529 | $objects = $songs_handler->getObjects($criteria, false); |
| 530 | 530 | $object = $objects[0]; |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | $object->setVar('lyrics', str_replace("\n", "<br/>\n", trim($data[$_POST['lyrics']]))); |
| 545 | 545 | $sid = $songs_handler->insert($object); |
| 546 | 546 | |
| 547 | - if ($GLOBALS['songlistModuleConfig']['tags']&&file_exists(XOOPS_ROOT_PATH . '/modules/tag/class/tag.php')) { |
|
| 547 | + if ($GLOBALS['songlistModuleConfig']['tags'] && file_exists(XOOPS_ROOT_PATH.'/modules/tag/class/tag.php')) { |
|
| 548 | 548 | $tag_handler = xoops_getmodulehandler('tag', 'tag'); |
| 549 | 549 | $tag_handler->updateByItem(trim($data[$_POST['tags']]), $sid, $GLOBALS['songlistModule']->getVar("dirname"), $cid); |
| 550 | 550 | } |
@@ -559,14 +559,14 @@ discard block |
||
| 559 | 559 | $extra = $extras_handler->create(); |
| 560 | 560 | } |
| 561 | 561 | $extra->setVar('sid', $sid); |
| 562 | - foreach($fields as $field) { |
|
| 563 | - if (!empty($_POST[$field->getVar('field_name')])&&strlen($_POST[$field->getVar('field_name')])>1) { |
|
| 564 | - if (isset($data[$_POST[$field->getVar('field_name')]])&&trim($_POST[$field->getVar('field_name')])!='') { |
|
| 562 | + foreach ($fields as $field) { |
|
| 563 | + if (!empty($_POST[$field->getVar('field_name')]) && strlen($_POST[$field->getVar('field_name')])>1) { |
|
| 564 | + if (isset($data[$_POST[$field->getVar('field_name')]]) && trim($_POST[$field->getVar('field_name')])!='') { |
|
| 565 | 565 | $extra->setVar($field->getVar('field_name'), trim($data[$_POST[$field->getVar('field_name')]])); |
| 566 | 566 | } |
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | - foreach($artists_handler->getObjects(new Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
| 569 | + foreach ($artists_handler->getObjects(new Criteria('aid', '('.implode(',', $aids).')', 'IN'), true) as $aid => $artist) { |
|
| 570 | 570 | $artist->setVar('sids', array_merge($artist->getVar('sids'), array($sid=>$sid))); |
| 571 | 571 | $artists_handler->insert($artist, true); |
| 572 | 572 | } |
@@ -44,9 +44,10 @@ discard block |
||
| 44 | 44 | } elseif (isset($_FILES['xmlfile'])&&strlen($_FILES['xmlfile']['name'])) { |
| 45 | 45 | |
| 46 | 46 | if (!is_dir($GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas']))) { |
| 47 | - foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) |
|
| 48 | - foreach(explode('/', $folders) as $folder) { |
|
| 47 | + foreach(explode('\\', $GLOBALS['xoops']->path($GLOBALS['songlistModuleConfig']['upload_areas'])) as $folders) { |
|
| 48 | + foreach(explode('/', $folders) as $folder) { |
|
| 49 | 49 | $path .= DS . $folder; |
| 50 | + } |
|
| 50 | 51 | mkdir($path, 0777); |
| 51 | 52 | } |
| 52 | 53 | } |
@@ -213,10 +214,12 @@ discard block |
||
| 213 | 214 | if ((!empty($_POST['songid'])&&strlen($_POST['songid'])>1)||(!empty($_POST['title'])&&strlen($_POST['title'])>1)) { |
| 214 | 215 | if ((isset($data[$_POST['songid']])&&$_POST['songid']!='')||(isset($data[$_POST['title']])&&$_POST['title']!='')) { |
| 215 | 216 | $criteria = new CriteriaCompo(); |
| 216 | - if (trim($data[$_POST['songid']])!='') |
|
| 217 | - $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 218 | - if (trim($data[$_POST['title']])!='') |
|
| 219 | - $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 217 | + if (trim($data[$_POST['songid']])!='') { |
|
| 218 | + $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 219 | + } |
|
| 220 | + if (trim($data[$_POST['title']])!='') { |
|
| 221 | + $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 222 | + } |
|
| 220 | 223 | if ($songs_handler->getCount($criteria)>0) { |
| 221 | 224 | $objects = $songs_handler->getObjects($criteria, false); |
| 222 | 225 | $object = $objects[0]; |
@@ -362,10 +365,12 @@ discard block |
||
| 362 | 365 | if ((!empty($_POST['songid'])&&strlen($_POST['songid'])>1)||(!empty($_POST['title'])&&strlen($_POST['title'])>1)) { |
| 363 | 366 | if ((isset($data[$_POST['songid']])&&$_POST['songid']!='')||(isset($data[$_POST['title']])&&$_POST['title']!='')) { |
| 364 | 367 | $criteria = new CriteriaCompo(); |
| 365 | - if (trim($data[$_POST['songid']])!='') |
|
| 366 | - $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 367 | - if (trim($data[$_POST['title']])!='') |
|
| 368 | - $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 368 | + if (trim($data[$_POST['songid']])!='') { |
|
| 369 | + $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 370 | + } |
|
| 371 | + if (trim($data[$_POST['title']])!='') { |
|
| 372 | + $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 373 | + } |
|
| 369 | 374 | if ($songs_handler->getCount($criteria)>0) { |
| 370 | 375 | $objects = $songs_handler->getObjects($criteria, false); |
| 371 | 376 | $object = $objects[0]; |
@@ -521,10 +526,12 @@ discard block |
||
| 521 | 526 | if ((!empty($_POST['songid'])&&strlen($_POST['songid'])>1)||(!empty($_POST['title'])&&strlen($_POST['title'])>1)) { |
| 522 | 527 | if ((isset($data[$_POST['songid']])&&$_POST['songid']!='')||(isset($data[$_POST['title']])&&$_POST['title']!='')) { |
| 523 | 528 | $criteria = new CriteriaCompo(); |
| 524 | - if (trim($data[$_POST['songid']])!='') |
|
| 525 | - $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 526 | - if (trim($data[$_POST['title']])!='') |
|
| 527 | - $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 529 | + if (trim($data[$_POST['songid']])!='') { |
|
| 530 | + $criteria->add(new Criteria('`songid`', trim($data[$_POST['songid']]))); |
|
| 531 | + } |
|
| 532 | + if (trim($data[$_POST['title']])!='') { |
|
| 533 | + $criteria->add(new Criteria('`title`', trim($data[$_POST['title']]))); |
|
| 534 | + } |
|
| 528 | 535 | if ($songs_handler->getCount($criteria)>0) { |
| 529 | 536 | $objects = $songs_handler->getObjects($criteria, false); |
| 530 | 537 | $object = $objects[0]; |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : "default")); |
| 38 | 38 | |
| 39 | 39 | switch ($op) { |
| 40 | - case "default": |
|
| 41 | - default: |
|
| 40 | + case "default": |
|
| 41 | + default: |
|
| 42 | 42 | |
| 43 | 43 | $indexAdmin = new ModuleAdmin(); |
| 44 | 44 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
@@ -54,19 +54,19 @@ discard block |
||
| 54 | 54 | $requests_handler = xoops_getmodulehandler('requests', 'songlist'); |
| 55 | 55 | $votes_handler = xoops_getmodulehandler('votes', 'songlist'); |
| 56 | 56 | |
| 57 | - $indexAdmin->addInfoBox(_AM_SONGLIST_COUNT); |
|
| 58 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_CATEGORY."</label>", $category_handler->getCount(NULL, true), 'green'); |
|
| 59 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_ARTISTS."</label>", $artists_handler->getCount(NULL, true), 'green'); |
|
| 60 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_ALBUMS."</label>", $albums_handler->getCount(NULL, true), 'green'); |
|
| 61 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_GENRE."</label>", $genre_handler->getCount(NULL, true), 'green'); |
|
| 57 | + $indexAdmin->addInfoBox(_AM_SONGLIST_COUNT); |
|
| 58 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_CATEGORY."</label>", $category_handler->getCount(NULL, true), 'green'); |
|
| 59 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_ARTISTS."</label>", $artists_handler->getCount(NULL, true), 'green'); |
|
| 60 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_ALBUMS."</label>", $albums_handler->getCount(NULL, true), 'green'); |
|
| 61 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_GENRE."</label>", $genre_handler->getCount(NULL, true), 'green'); |
|
| 62 | 62 | $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_VOICE."</label>", $voice_handler->getCount(NULL, true), 'green'); |
| 63 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_SONGS."</label>", $songs_handler->getCount(NULL, true), 'green'); |
|
| 64 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_REQUESTS."</label>", $requests_handler->getCount(NULL, true), 'green'); |
|
| 65 | - $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_VOTES."</label>", $votes_handler->getCount(NULL, true), 'green'); |
|
| 66 | - echo $indexAdmin->renderIndex(); |
|
| 63 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_SONGS."</label>", $songs_handler->getCount(NULL, true), 'green'); |
|
| 64 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_REQUESTS."</label>", $requests_handler->getCount(NULL, true), 'green'); |
|
| 65 | + $indexAdmin->addInfoBoxLine(_AM_SONGLIST_COUNT, "<label>"._AM_SONGLIST_NUMBER_OF_VOTES."</label>", $votes_handler->getCount(NULL, true), 'green'); |
|
| 66 | + echo $indexAdmin->renderIndex(); |
|
| 67 | 67 | |
| 68 | - xoops_cp_footer(); |
|
| 69 | - break; |
|
| 68 | + xoops_cp_footer(); |
|
| 69 | + break; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | ?> |
| 73 | 73 | \ No newline at end of file |
@@ -45,71 +45,71 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | class forum_XoopsGroupPermForm extends XoopsGroupPermForm |
| 47 | 47 | { |
| 48 | - function forum_XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url = "") |
|
| 49 | - { |
|
| 50 | - $this->XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); |
|
| 51 | - } |
|
| 48 | + function forum_XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url = "") |
|
| 49 | + { |
|
| 50 | + $this->XoopsGroupPermForm($title, $modid, $permname, $permdesc, $url); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - function render() |
|
| 54 | - { |
|
| 55 | - // load all child ids for javascript codes |
|
| 56 | - foreach (array_keys($this->_itemTree)as $item_id) { |
|
| 57 | - $this->_itemTree[$item_id]['allchild'] = array(); |
|
| 58 | - $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); |
|
| 59 | - } |
|
| 60 | - $gperm_handler = xoops_gethandler('groupperm'); |
|
| 61 | - $member_handler = xoops_gethandler('member'); |
|
| 62 | - $glist = $member_handler->getGroupList(); |
|
| 63 | - foreach (array_keys($glist) as $i) { |
|
| 64 | - // get selected item id(s) for each group |
|
| 65 | - $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid); |
|
| 66 | - $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
| 67 | - $ele->setOptionTree($this->_itemTree); |
|
| 68 | - $this->addElement($ele); |
|
| 69 | - unset($ele); |
|
| 70 | - } |
|
| 71 | - $tray = new XoopsFormElementTray(''); |
|
| 72 | - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
| 73 | - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
| 74 | - $this->addElement($tray); |
|
| 75 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br />'; |
|
| 76 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
| 77 | - $elements = $this->getElements(); |
|
| 78 | - $hidden = ''; |
|
| 79 | - foreach (array_keys($elements) as $i) { |
|
| 80 | - if (!is_object($elements[$i])) { |
|
| 81 | - $ret .= $elements[$i]; |
|
| 82 | - } elseif (!$elements[$i]->isHidden()) { |
|
| 83 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
| 84 | - if ($elements[$i]->getDescription() != '') { |
|
| 85 | - $ret .= '<br /><br /><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
| 86 | - } |
|
| 87 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
| 88 | - } else { |
|
| 89 | - $hidden .= $elements[$i]->render(); |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - $ret .= "</table>$hidden</form>"; |
|
| 93 | - $ret .= $this->renderValidationJS( true ); |
|
| 94 | - return $ret; |
|
| 95 | - } |
|
| 53 | + function render() |
|
| 54 | + { |
|
| 55 | + // load all child ids for javascript codes |
|
| 56 | + foreach (array_keys($this->_itemTree)as $item_id) { |
|
| 57 | + $this->_itemTree[$item_id]['allchild'] = array(); |
|
| 58 | + $this->_loadAllChildItemIds($item_id, $this->_itemTree[$item_id]['allchild']); |
|
| 59 | + } |
|
| 60 | + $gperm_handler = xoops_gethandler('groupperm'); |
|
| 61 | + $member_handler = xoops_gethandler('member'); |
|
| 62 | + $glist = $member_handler->getGroupList(); |
|
| 63 | + foreach (array_keys($glist) as $i) { |
|
| 64 | + // get selected item id(s) for each group |
|
| 65 | + $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid); |
|
| 66 | + $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
| 67 | + $ele->setOptionTree($this->_itemTree); |
|
| 68 | + $this->addElement($ele); |
|
| 69 | + unset($ele); |
|
| 70 | + } |
|
| 71 | + $tray = new XoopsFormElementTray(''); |
|
| 72 | + $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
| 73 | + $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
| 74 | + $this->addElement($tray); |
|
| 75 | + $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br />'; |
|
| 76 | + $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
| 77 | + $elements = $this->getElements(); |
|
| 78 | + $hidden = ''; |
|
| 79 | + foreach (array_keys($elements) as $i) { |
|
| 80 | + if (!is_object($elements[$i])) { |
|
| 81 | + $ret .= $elements[$i]; |
|
| 82 | + } elseif (!$elements[$i]->isHidden()) { |
|
| 83 | + $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
| 84 | + if ($elements[$i]->getDescription() != '') { |
|
| 85 | + $ret .= '<br /><br /><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
| 86 | + } |
|
| 87 | + $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
| 88 | + } else { |
|
| 89 | + $hidden .= $elements[$i]->render(); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + $ret .= "</table>$hidden</form>"; |
|
| 93 | + $ret .= $this->renderValidationJS( true ); |
|
| 94 | + return $ret; |
|
| 95 | + } |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | class forum_XoopsGroupFormCheckBox extends XoopsGroupFormCheckBox |
| 99 | 99 | { |
| 100 | - function forum_XoopsGroupFormCheckBox($caption, $name, $groupId, $values = null) |
|
| 101 | - { |
|
| 102 | - $this->XoopsGroupFormCheckBox($caption, $name, $groupId, $values); |
|
| 103 | - } |
|
| 100 | + function forum_XoopsGroupFormCheckBox($caption, $name, $groupId, $values = null) |
|
| 101 | + { |
|
| 102 | + $this->XoopsGroupFormCheckBox($caption, $name, $groupId, $values); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * Renders checkbox options for this group |
|
| 107 | - * |
|
| 108 | - * @return string |
|
| 109 | - * @access public |
|
| 110 | - */ |
|
| 111 | - function render() |
|
| 112 | - { |
|
| 105 | + /** |
|
| 106 | + * Renders checkbox options for this group |
|
| 107 | + * |
|
| 108 | + * @return string |
|
| 109 | + * @access public |
|
| 110 | + */ |
|
| 111 | + function render() |
|
| 112 | + { |
|
| 113 | 113 | $ret = '<table class="outer"><tr><td class="odd"><table><tr>'; |
| 114 | 114 | $cols = 1; |
| 115 | 115 | foreach ($this->_optionTree[0]['children'] as $topitem) { |
@@ -134,38 +134,38 @@ discard block |
||
| 134 | 134 | $ret .= _ALL." <input id=\"".$checkallbtn_id."\" type=\"checkbox\" value=\"\" onclick=\"var optionids = new Array(".$option_ids_str."); xoopsCheckAllElements(optionids, '".$checkallbtn_id."');\" />"; |
| 135 | 135 | $ret .= '</td></tr></table>'; |
| 136 | 136 | return $ret; |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
|
| 140 | - { |
|
| 141 | - if($option['id'] > 0): |
|
| 142 | - $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; |
|
| 143 | - foreach ($parentIds as $pid) { |
|
| 144 | - if($pid <= 0) continue; |
|
| 145 | - $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
| 146 | - $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}"; |
|
| 147 | - } |
|
| 148 | - foreach ($option['allchild'] as $cid) { |
|
| 149 | - $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
| 150 | - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}"; |
|
| 151 | - } |
|
| 152 | - $tree .= '" value="1"'; |
|
| 153 | - if (in_array($option['id'], $this->_value)) { |
|
| 154 | - $tree .= ' checked="checked"'; |
|
| 155 | - } |
|
| 156 | - $tree .= " />" . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . "[parents][" . $option['id'] . "]\" value=\"" . implode(':', $parentIds). "\" /><input type=\"hidden\" name=\"" . $this->getName() . "[itemname][" . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']). "\" /><br />\n"; |
|
| 157 | - else: |
|
| 158 | - $tree .= $prefix . $option['name'] . "<input type=\"hidden\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" /><br />\n"; |
|
| 159 | - endif; |
|
| 160 | - if (isset($option['children'])) { |
|
| 161 | - foreach ($option['children'] as $child) { |
|
| 162 | - if($option['id'] > 0){ |
|
| 163 | - array_push($parentIds, $option['id']); |
|
| 164 | - } |
|
| 165 | - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - } |
|
| 139 | + function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
|
| 140 | + { |
|
| 141 | + if($option['id'] > 0): |
|
| 142 | + $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; |
|
| 143 | + foreach ($parentIds as $pid) { |
|
| 144 | + if($pid <= 0) continue; |
|
| 145 | + $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
| 146 | + $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}"; |
|
| 147 | + } |
|
| 148 | + foreach ($option['allchild'] as $cid) { |
|
| 149 | + $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
| 150 | + $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}"; |
|
| 151 | + } |
|
| 152 | + $tree .= '" value="1"'; |
|
| 153 | + if (in_array($option['id'], $this->_value)) { |
|
| 154 | + $tree .= ' checked="checked"'; |
|
| 155 | + } |
|
| 156 | + $tree .= " />" . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . "[parents][" . $option['id'] . "]\" value=\"" . implode(':', $parentIds). "\" /><input type=\"hidden\" name=\"" . $this->getName() . "[itemname][" . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']). "\" /><br />\n"; |
|
| 157 | + else: |
|
| 158 | + $tree .= $prefix . $option['name'] . "<input type=\"hidden\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" /><br />\n"; |
|
| 159 | + endif; |
|
| 160 | + if (isset($option['children'])) { |
|
| 161 | + foreach ($option['children'] as $child) { |
|
| 162 | + if($option['id'] > 0){ |
|
| 163 | + array_push($parentIds, $option['id']); |
|
| 164 | + } |
|
| 165 | + $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | xoops_cp_header(); |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | $opform->addElement($op_select); |
| 191 | 191 | $opform->display(); |
| 192 | 192 | |
| 193 | - $member_handler = xoops_gethandler('member'); |
|
| 194 | - $glist = $member_handler->getGroupList(); |
|
| 195 | - $elements = array(); |
|
| 196 | - $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 197 | - $perm_template = $songlistperm_handler->getTemplate($groupid = 0); |
|
| 198 | - foreach (array_keys($glist) as $i) { |
|
| 199 | - $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : array(); |
|
| 200 | - $ret_ele = '<tr align="left" valign="top"><td class="head">'.$glist[$i].'</td>'; |
|
| 193 | + $member_handler = xoops_gethandler('member'); |
|
| 194 | + $glist = $member_handler->getGroupList(); |
|
| 195 | + $elements = array(); |
|
| 196 | + $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 197 | + $perm_template = $songlistperm_handler->getTemplate($groupid = 0); |
|
| 198 | + foreach (array_keys($glist) as $i) { |
|
| 199 | + $selected = !empty($perm_template[$i]) ? array_keys($perm_template[$i]) : array(); |
|
| 200 | + $ret_ele = '<tr align="left" valign="top"><td class="head">'.$glist[$i].'</td>'; |
|
| 201 | 201 | $ret_ele .= '<td class="even">'; |
| 202 | 202 | $ret_ele .= '<table class="outer"><tr><td class="odd"><table><tr>'; |
| 203 | 203 | $ii = 0; |
@@ -216,37 +216,37 @@ discard block |
||
| 216 | 216 | $ret_ele .= _ALL.' <input id="checkall['.$i.']" type="checkbox" value="" onclick="var optionids = new Array('.implode(", ", $option_ids).'); xoopsCheckAllElements(optionids, \'checkall['.$i.']\')" />'; |
| 217 | 217 | $ret_ele .= '</td></tr></table>'; |
| 218 | 218 | $ret_ele .= '</td></tr>'; |
| 219 | - $elements[] = $ret_ele; |
|
| 220 | - } |
|
| 221 | - $tray = new XoopsFormElementTray(''); |
|
| 222 | - $tray->addElement(new XoopsFormHidden('action', 'template_save')); |
|
| 223 | - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
| 224 | - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
| 225 | - $ret = '<h4>' . _AM_SONGLIST_PERM_TEMPLATE . '</h4>' . _AM_SONGLIST_PERM_TEMPLATE_DESC . '<br /><br /><br />'; |
|
| 226 | - $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
| 227 | - $ret .= implode("\n",$elements); |
|
| 219 | + $elements[] = $ret_ele; |
|
| 220 | + } |
|
| 221 | + $tray = new XoopsFormElementTray(''); |
|
| 222 | + $tray->addElement(new XoopsFormHidden('action', 'template_save')); |
|
| 223 | + $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
| 224 | + $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
| 225 | + $ret = '<h4>' . _AM_SONGLIST_PERM_TEMPLATE . '</h4>' . _AM_SONGLIST_PERM_TEMPLATE_DESC . '<br /><br /><br />'; |
|
| 226 | + $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n"; |
|
| 227 | + $ret .= implode("\n",$elements); |
|
| 228 | 228 | $ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even">'; |
| 229 | - $ret .= $tray->render(); |
|
| 229 | + $ret .= $tray->render(); |
|
| 230 | 230 | $ret .= '</td></tr>'; |
| 231 | - $ret .= '</table></form>'; |
|
| 232 | - echo $ret; |
|
| 233 | - break; |
|
| 231 | + $ret .= '</table></form>'; |
|
| 232 | + echo $ret; |
|
| 233 | + break; |
|
| 234 | 234 | |
| 235 | 235 | case "template_save": |
| 236 | - $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 237 | - $res = $songlistperm_handler->setTemplate($_POST['perms'], $groupid = 0); |
|
| 238 | - if($res){ |
|
| 239 | - redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_CREATED); |
|
| 240 | - }else{ |
|
| 241 | - redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_ERROR); |
|
| 242 | - } |
|
| 236 | + $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 237 | + $res = $songlistperm_handler->setTemplate($_POST['perms'], $groupid = 0); |
|
| 238 | + if($res){ |
|
| 239 | + redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_CREATED); |
|
| 240 | + }else{ |
|
| 241 | + redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_ERROR); |
|
| 242 | + } |
|
| 243 | 243 | break; |
| 244 | 244 | |
| 245 | 245 | case "apply": |
| 246 | - $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 247 | - $perm_template = $songlistperm_handler->getTemplate(); |
|
| 246 | + $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 247 | + $perm_template = $songlistperm_handler->getTemplate(); |
|
| 248 | 248 | if($perm_template===null){ |
| 249 | - redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE); |
|
| 249 | + redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | $opform = new XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', "get"); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $fm_options[-1*$c] = "[".$categories[$c]->getVar('cat_title')."]"; |
| 267 | 267 | foreach(array_keys($songlists[$c]) as $f){ |
| 268 | 268 | $fm_options[$f] = $songlists[$c][$f]["title"]; |
| 269 | - if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 269 | + if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 270 | 270 | foreach(array_keys($songlists[$c][$f]["sub"]) as $s){ |
| 271 | 271 | $fm_options[$s] = "-- ".$songlists[$c][$f]["sub"][$s]["title"]; |
| 272 | 272 | } |
@@ -277,22 +277,22 @@ discard block |
||
| 277 | 277 | $fm_select = new XoopsFormSelect(_AM_SONGLIST_PERM_FORUMS, 'forums', null, 10, true); |
| 278 | 278 | $fm_select->addOptionArray($fm_options); |
| 279 | 279 | $fmform->addElement($fm_select); |
| 280 | - $tray = new XoopsFormElementTray(''); |
|
| 281 | - $tray->addElement(new XoopsFormHidden('action', 'apply_save')); |
|
| 282 | - $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
| 283 | - $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
| 280 | + $tray = new XoopsFormElementTray(''); |
|
| 281 | + $tray->addElement(new XoopsFormHidden('action', 'apply_save')); |
|
| 282 | + $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
| 283 | + $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
| 284 | 284 | $fmform->addElement($tray); |
| 285 | 285 | $fmform->display(); |
| 286 | 286 | break; |
| 287 | 287 | |
| 288 | 288 | case "apply_save": |
| 289 | 289 | if(empty($_POST["forums"])) break; |
| 290 | - $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 290 | + $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
|
| 291 | 291 | foreach($_POST["forums"] as $songlist){ |
| 292 | 292 | if($songlist < 1) continue; |
| 293 | 293 | $songlistperm_handler->applyTemplate($songlist, $module_id); |
| 294 | 294 | } |
| 295 | - redirect_header("permissions.php", 2, _AM_SONGLIST_PERM_TEMPLATE_APPLIED); |
|
| 295 | + redirect_header("permissions.php", 2, _AM_SONGLIST_PERM_TEMPLATE_APPLIED); |
|
| 296 | 296 | break; |
| 297 | 297 | |
| 298 | 298 | default: |
@@ -353,10 +353,10 @@ discard block |
||
| 353 | 353 | $key_c = -1 * $c; |
| 354 | 354 | $form->addItem($key_c, "<strong>[".$categories[$c]->getVar('cat_title')."]</strong>"); |
| 355 | 355 | foreach(array_keys($songlists[$c]) as $f){ |
| 356 | - $form->addItem($f, $songlists[$c][$f]["title"], $key_c); |
|
| 357 | - if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 356 | + $form->addItem($f, $songlists[$c][$f]["title"], $key_c); |
|
| 357 | + if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 358 | 358 | foreach(array_keys($songlists[$c][$f]["sub"]) as $s){ |
| 359 | - $form->addItem($s, "→".$songlists[$c][$f]["sub"][$s]["title"], $f); |
|
| 359 | + $form->addItem($s, "→".$songlists[$c][$f]["sub"][$s]["title"], $f); |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | // ------------------------------------------------------------------------- // |
| 32 | 32 | include 'header.php'; |
| 33 | 33 | include_once XOOPS_ROOT_PATH."/modules/".$GLOBALS['songlistModule']->getVar("dirname")."/class/xoopsformloader.php"; |
| 34 | -include_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
|
| 34 | +include_once XOOPS_ROOT_PATH.'/class/xoopsform/grouppermform.php'; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Add category navigation to forum casscade structure |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | foreach (array_keys($glist) as $i) { |
| 64 | 64 | // get selected item id(s) for each group |
| 65 | 65 | $selected = $gperm_handler->getItemIds($this->_permName, $i, $this->_modid); |
| 66 | - $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms[' . $this->_permName . ']', $i, $selected); |
|
| 66 | + $ele = new forum_XoopsGroupFormCheckBox($glist[$i], 'perms['.$this->_permName.']', $i, $selected); |
|
| 67 | 67 | $ele->setOptionTree($this->_itemTree); |
| 68 | 68 | $this->addElement($ele); |
| 69 | 69 | unset($ele); |
@@ -72,25 +72,25 @@ discard block |
||
| 72 | 72 | $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
| 73 | 73 | $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
| 74 | 74 | $this->addElement($tray); |
| 75 | - $ret = '<h4>' . $this->getTitle() . '</h4>' . $this->_permDesc . '<br />'; |
|
| 76 | - $ret .= "<form name='" . $this->getName() . "' id='" . $this->getName() . "' action='" . $this->getAction() . "' method='" . $this->getMethod() . "'" . $this->getExtra() . ">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
| 75 | + $ret = '<h4>'.$this->getTitle().'</h4>'.$this->_permDesc.'<br />'; |
|
| 76 | + $ret .= "<form name='".$this->getName()."' id='".$this->getName()."' action='".$this->getAction()."' method='".$this->getMethod()."'".$this->getExtra().">\n<table width='100%' class='outer' cellspacing='1' valign='top'>\n"; |
|
| 77 | 77 | $elements = $this->getElements(); |
| 78 | 78 | $hidden = ''; |
| 79 | 79 | foreach (array_keys($elements) as $i) { |
| 80 | 80 | if (!is_object($elements[$i])) { |
| 81 | 81 | $ret .= $elements[$i]; |
| 82 | 82 | } elseif (!$elements[$i]->isHidden()) { |
| 83 | - $ret .= "<tr valign='top' align='left'><td class='head'>" . $elements[$i]->getCaption(); |
|
| 84 | - if ($elements[$i]->getDescription() != '') { |
|
| 85 | - $ret .= '<br /><br /><span style="font-weight: normal;">' . $elements[$i]->getDescription() . '</span>'; |
|
| 83 | + $ret .= "<tr valign='top' align='left'><td class='head'>".$elements[$i]->getCaption(); |
|
| 84 | + if ($elements[$i]->getDescription()!='') { |
|
| 85 | + $ret .= '<br /><br /><span style="font-weight: normal;">'.$elements[$i]->getDescription().'</span>'; |
|
| 86 | 86 | } |
| 87 | - $ret .= "</td>\n<td class='even'>\n" . $elements[$i]->render() . "\n</td></tr>\n"; |
|
| 87 | + $ret .= "</td>\n<td class='even'>\n".$elements[$i]->render()."\n</td></tr>\n"; |
|
| 88 | 88 | } else { |
| 89 | 89 | $hidden .= $elements[$i]->render(); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | $ret .= "</table>$hidden</form>"; |
| 93 | - $ret .= $this->renderValidationJS( true ); |
|
| 93 | + $ret .= $this->renderValidationJS(true); |
|
| 94 | 94 | return $ret; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $ret = '<table class="outer"><tr><td class="odd"><table><tr>'; |
| 114 | 114 | $cols = 1; |
| 115 | 115 | foreach ($this->_optionTree[0]['children'] as $topitem) { |
| 116 | - if ($cols > 4) { |
|
| 116 | + if ($cols>4) { |
|
| 117 | 117 | $ret .= '</tr><tr>'; |
| 118 | 118 | $cols = 1; |
| 119 | 119 | } |
@@ -138,31 +138,31 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | function _renderOptionTree(&$tree, $option, $prefix, $parentIds = array()) |
| 140 | 140 | { |
| 141 | - if($option['id'] > 0): |
|
| 142 | - $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; |
|
| 141 | + if ($option['id']>0): |
|
| 142 | + $tree .= $prefix."<input type=\"checkbox\" name=\"".$this->getName()."[groups][".$this->_groupId."][".$option['id']."]\" id=\"".$this->getName()."[groups][".$this->_groupId."][".$option['id']."]\" onclick=\""; |
|
| 143 | 143 | foreach ($parentIds as $pid) { |
| 144 | - if($pid <= 0) continue; |
|
| 145 | - $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
|
| 146 | - $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}"; |
|
| 144 | + if ($pid<=0) continue; |
|
| 145 | + $parent_ele = $this->getName().'[groups]['.$this->_groupId.']['.$pid.']'; |
|
| 146 | + $tree .= "var ele = xoopsGetElementById('".$parent_ele."'); if(ele.checked != true) {ele.checked = this.checked;}"; |
|
| 147 | 147 | } |
| 148 | 148 | foreach ($option['allchild'] as $cid) { |
| 149 | - $child_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $cid . ']'; |
|
| 150 | - $tree .= "var ele = xoopsGetElementById('" . $child_ele . "'); if(this.checked != true) {ele.checked = false;}"; |
|
| 149 | + $child_ele = $this->getName().'[groups]['.$this->_groupId.']['.$cid.']'; |
|
| 150 | + $tree .= "var ele = xoopsGetElementById('".$child_ele."'); if(this.checked != true) {ele.checked = false;}"; |
|
| 151 | 151 | } |
| 152 | 152 | $tree .= '" value="1"'; |
| 153 | 153 | if (in_array($option['id'], $this->_value)) { |
| 154 | 154 | $tree .= ' checked="checked"'; |
| 155 | 155 | } |
| 156 | - $tree .= " />" . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . "[parents][" . $option['id'] . "]\" value=\"" . implode(':', $parentIds). "\" /><input type=\"hidden\" name=\"" . $this->getName() . "[itemname][" . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']). "\" /><br />\n"; |
|
| 156 | + $tree .= " />".$option['name']."<input type=\"hidden\" name=\"".$this->getName()."[parents][".$option['id']."]\" value=\"".implode(':', $parentIds)."\" /><input type=\"hidden\" name=\"".$this->getName()."[itemname][".$option['id']."]\" value=\"".htmlspecialchars($option['name'])."\" /><br />\n"; |
|
| 157 | 157 | else: |
| 158 | - $tree .= $prefix . $option['name'] . "<input type=\"hidden\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" /><br />\n"; |
|
| 158 | + $tree .= $prefix.$option['name']."<input type=\"hidden\" id=\"".$this->getName()."[groups][".$this->_groupId."][".$option['id']."]\" /><br />\n"; |
|
| 159 | 159 | endif; |
| 160 | 160 | if (isset($option['children'])) { |
| 161 | 161 | foreach ($option['children'] as $child) { |
| 162 | - if($option['id'] > 0){ |
|
| 162 | + if ($option['id']>0) { |
|
| 163 | 163 | array_push($parentIds, $option['id']); |
| 164 | 164 | } |
| 165 | - $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix . ' -', $parentIds); |
|
| 165 | + $this->_renderOptionTree($tree, $this->_optionTree[$child], $prefix.' -', $parentIds); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -174,9 +174,9 @@ discard block |
||
| 174 | 174 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 175 | 175 | $action = isset($_REQUEST['action']) ? strtolower($_REQUEST['action']) : ""; |
| 176 | 176 | $module_id = $GLOBALS['songlistModule']->getVar('mid'); |
| 177 | -$perms = array_map("trim",explode(',', FORUM_PERM_ITEMS)); |
|
| 177 | +$perms = array_map("trim", explode(',', FORUM_PERM_ITEMS)); |
|
| 178 | 178 | |
| 179 | -switch($action){ |
|
| 179 | +switch ($action) { |
|
| 180 | 180 | case "template": |
| 181 | 181 | $opform = new XoopsSimpleForm(_AM_SONGLIST_PERM_ACTION, 'actionform', 'permissions.php', "get"); |
| 182 | 182 | $op_select = new XoopsFormSelect("", 'action'); |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | $option_ids = array(); |
| 205 | 205 | foreach ($perms as $perm) { |
| 206 | 206 | $ii++; |
| 207 | - if($ii % 5 ==0 ){ |
|
| 207 | + if ($ii%5==0) { |
|
| 208 | 208 | $ret_ele .= '</tr><tr>'; |
| 209 | 209 | } |
| 210 | - $checked = in_array("forum_".$perm, $selected)?" checked='checked'":""; |
|
| 210 | + $checked = in_array("forum_".$perm, $selected) ? " checked='checked'" : ""; |
|
| 211 | 211 | $option_id = $perm.'_'.$i; |
| 212 | 212 | $option_ids[] = $option_id; |
| 213 | - $ret_ele .='<td><input name="perms['.$i.']['."forum_".$perm.']" id="'.$option_id.'" onclick="" value="1" type="checkbox"'.$checked.'>'.CONSTANT("_AM_SONGLIST_CAN_".strtoupper($perm)).'<br></td>'; |
|
| 213 | + $ret_ele .= '<td><input name="perms['.$i.']['."forum_".$perm.']" id="'.$option_id.'" onclick="" value="1" type="checkbox"'.$checked.'>'.CONSTANT("_AM_SONGLIST_CAN_".strtoupper($perm)).'<br></td>'; |
|
| 214 | 214 | } |
| 215 | 215 | $ret_ele .= '</tr></table></td><td class="even">'; |
| 216 | 216 | $ret_ele .= _ALL.' <input id="checkall['.$i.']" type="checkbox" value="" onclick="var optionids = new Array('.implode(", ", $option_ids).'); xoopsCheckAllElements(optionids, \'checkall['.$i.']\')" />'; |
@@ -222,9 +222,9 @@ discard block |
||
| 222 | 222 | $tray->addElement(new XoopsFormHidden('action', 'template_save')); |
| 223 | 223 | $tray->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
| 224 | 224 | $tray->addElement(new XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
| 225 | - $ret = '<h4>' . _AM_SONGLIST_PERM_TEMPLATE . '</h4>' . _AM_SONGLIST_PERM_TEMPLATE_DESC . '<br /><br /><br />'; |
|
| 225 | + $ret = '<h4>'._AM_SONGLIST_PERM_TEMPLATE.'</h4>'._AM_SONGLIST_PERM_TEMPLATE_DESC.'<br /><br /><br />'; |
|
| 226 | 226 | $ret .= "<form name='template' id='template' method='post'>\n<table width='100%' class='outer' cellspacing='1'>\n"; |
| 227 | - $ret .= implode("\n",$elements); |
|
| 227 | + $ret .= implode("\n", $elements); |
|
| 228 | 228 | $ret .= '<tr align="left" valign="top"><td class="head"></td><td class="even">'; |
| 229 | 229 | $ret .= $tray->render(); |
| 230 | 230 | $ret .= '</td></tr>'; |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | case "template_save": |
| 236 | 236 | $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
| 237 | 237 | $res = $songlistperm_handler->setTemplate($_POST['perms'], $groupid = 0); |
| 238 | - if($res){ |
|
| 238 | + if ($res) { |
|
| 239 | 239 | redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_CREATED); |
| 240 | - }else{ |
|
| 240 | + } else { |
|
| 241 | 241 | redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_ERROR); |
| 242 | 242 | } |
| 243 | 243 | break; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | case "apply": |
| 246 | 246 | $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
| 247 | 247 | $perm_template = $songlistperm_handler->getTemplate(); |
| 248 | - if($perm_template===null){ |
|
| 248 | + if ($perm_template===null) { |
|
| 249 | 249 | redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | $fm_options = array(); |
| 265 | 265 | foreach (array_keys($categories) as $c) { |
| 266 | 266 | $fm_options[-1*$c] = "[".$categories[$c]->getVar('cat_title')."]"; |
| 267 | - foreach(array_keys($songlists[$c]) as $f){ |
|
| 267 | + foreach (array_keys($songlists[$c]) as $f) { |
|
| 268 | 268 | $fm_options[$f] = $songlists[$c][$f]["title"]; |
| 269 | - if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 270 | - foreach(array_keys($songlists[$c][$f]["sub"]) as $s){ |
|
| 269 | + if (!isset($songlists[$c][$f]["sub"])) continue; |
|
| 270 | + foreach (array_keys($songlists[$c][$f]["sub"]) as $s) { |
|
| 271 | 271 | $fm_options[$s] = "-- ".$songlists[$c][$f]["sub"][$s]["title"]; |
| 272 | 272 | } |
| 273 | 273 | } |
@@ -286,10 +286,10 @@ discard block |
||
| 286 | 286 | break; |
| 287 | 287 | |
| 288 | 288 | case "apply_save": |
| 289 | - if(empty($_POST["forums"])) break; |
|
| 289 | + if (empty($_POST["forums"])) break; |
|
| 290 | 290 | $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
| 291 | - foreach($_POST["forums"] as $songlist){ |
|
| 292 | - if($songlist < 1) continue; |
|
| 291 | + foreach ($_POST["forums"] as $songlist) { |
|
| 292 | + if ($songlist<1) continue; |
|
| 293 | 293 | $songlistperm_handler->applyTemplate($songlist, $module_id); |
| 294 | 294 | } |
| 295 | 295 | redirect_header("permissions.php", 2, _AM_SONGLIST_PERM_TEMPLATE_APPLIED); |
@@ -313,21 +313,21 @@ discard block |
||
| 313 | 313 | $songlists = $GLOBALS['forum_handler']->getForumsByCategory(0, '', false, false, true); |
| 314 | 314 | $op_options = array("category"=>_AM_SONGLIST_CAT_ACCESS); |
| 315 | 315 | $fm_options = array("category"=>array("title"=>_AM_SONGLIST_CAT_ACCESS, "item"=>"category_access", "desc"=>"", "anonymous"=>true)); |
| 316 | - foreach($perms as $perm){ |
|
| 316 | + foreach ($perms as $perm) { |
|
| 317 | 317 | $op_options[$perm] = CONSTANT("_AM_SONGLIST_CAN_".strtoupper($perm)); |
| 318 | 318 | $fm_options[$perm] = array("title"=>CONSTANT("_AM_SONGLIST_CAN_".strtoupper($perm)), "item"=>"forum_".$perm, "desc"=>"", "anonymous"=>true); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $op_keys = array_keys($op_options); |
| 322 | - $op = isset($_GET['op']) ? strtolower($_GET['op']) : (isset($_COOKIE['op']) ? strtolower($_COOKIE['op']):""); |
|
| 323 | - if(empty($op)){ |
|
| 322 | + $op = isset($_GET['op']) ? strtolower($_GET['op']) : (isset($_COOKIE['op']) ? strtolower($_COOKIE['op']) : ""); |
|
| 323 | + if (empty($op)) { |
|
| 324 | 324 | $op = $op_keys[0]; |
| 325 | - setCookie("op", isset($op_keys[1])?$op_keys[1]:""); |
|
| 326 | - }else{ |
|
| 327 | - for($i=0;$i<count($op_keys);$i++){ |
|
| 328 | - if($op_keys[$i]==$op) break; |
|
| 325 | + setCookie("op", isset($op_keys[1]) ? $op_keys[1] : ""); |
|
| 326 | + } else { |
|
| 327 | + for ($i = 0; $i<count($op_keys); $i++) { |
|
| 328 | + if ($op_keys[$i]==$op) break; |
|
| 329 | 329 | } |
| 330 | - setCookie("op", isset($op_keys[$i+1])?$op_keys[$i+1]:""); |
|
| 330 | + setCookie("op", isset($op_keys[$i+1]) ? $op_keys[$i+1] : ""); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | $opform = new XoopsSimpleForm('', 'opform', 'permissions.php', "get"); |
@@ -343,19 +343,19 @@ discard block |
||
| 343 | 343 | |
| 344 | 344 | $category_handler = xoops_getmodulehandler('category', 'songlist'); |
| 345 | 345 | $categories = $category_handler->getObjects(NULL, true); |
| 346 | - if($op=="category"){ |
|
| 346 | + if ($op=="category") { |
|
| 347 | 347 | foreach (array_keys($categories) as $c) { |
| 348 | 348 | $form->addItem($c, $categories[$c]->getVar('cat_title')); |
| 349 | 349 | } |
| 350 | 350 | unset($categories); |
| 351 | - }else{ |
|
| 351 | + } else { |
|
| 352 | 352 | foreach (array_keys($categories) as $c) { |
| 353 | - $key_c = -1 * $c; |
|
| 353 | + $key_c = -1*$c; |
|
| 354 | 354 | $form->addItem($key_c, "<strong>[".$categories[$c]->getVar('cat_title')."]</strong>"); |
| 355 | - foreach(array_keys($songlists[$c]) as $f){ |
|
| 355 | + foreach (array_keys($songlists[$c]) as $f) { |
|
| 356 | 356 | $form->addItem($f, $songlists[$c][$f]["title"], $key_c); |
| 357 | - if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 358 | - foreach(array_keys($songlists[$c][$f]["sub"]) as $s){ |
|
| 357 | + if (!isset($songlists[$c][$f]["sub"])) continue; |
|
| 358 | + foreach (array_keys($songlists[$c][$f]["sub"]) as $s) { |
|
| 359 | 359 | $form->addItem($s, "→".$songlists[$c][$f]["sub"][$s]["title"], $f); |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -141,7 +141,9 @@ discard block |
||
| 141 | 141 | if($option['id'] > 0): |
| 142 | 142 | $tree .= $prefix . "<input type=\"checkbox\" name=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" onclick=\""; |
| 143 | 143 | foreach ($parentIds as $pid) { |
| 144 | - if($pid <= 0) continue; |
|
| 144 | + if($pid <= 0) { |
|
| 145 | + continue; |
|
| 146 | + } |
|
| 145 | 147 | $parent_ele = $this->getName() . '[groups][' . $this->_groupId . '][' . $pid . ']'; |
| 146 | 148 | $tree .= "var ele = xoopsGetElementById('" . $parent_ele . "'); if(ele.checked != true) {ele.checked = this.checked;}"; |
| 147 | 149 | } |
@@ -154,8 +156,10 @@ discard block |
||
| 154 | 156 | $tree .= ' checked="checked"'; |
| 155 | 157 | } |
| 156 | 158 | $tree .= " />" . $option['name'] . "<input type=\"hidden\" name=\"" . $this->getName() . "[parents][" . $option['id'] . "]\" value=\"" . implode(':', $parentIds). "\" /><input type=\"hidden\" name=\"" . $this->getName() . "[itemname][" . $option['id'] . "]\" value=\"" . htmlspecialchars($option['name']). "\" /><br />\n"; |
| 157 | - else: |
|
| 159 | + else { |
|
| 160 | + : |
|
| 158 | 161 | $tree .= $prefix . $option['name'] . "<input type=\"hidden\" id=\"" . $this->getName() . "[groups][" . $this->_groupId . "][" . $option['id'] . "]\" /><br />\n"; |
| 162 | + } |
|
| 159 | 163 | endif; |
| 160 | 164 | if (isset($option['children'])) { |
| 161 | 165 | foreach ($option['children'] as $child) { |
@@ -237,7 +241,7 @@ discard block |
||
| 237 | 241 | $res = $songlistperm_handler->setTemplate($_POST['perms'], $groupid = 0); |
| 238 | 242 | if($res){ |
| 239 | 243 | redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_CREATED); |
| 240 | - }else{ |
|
| 244 | + } else{ |
|
| 241 | 245 | redirect_header("permissions.php?action=template", 2, _AM_SONGLIST_PERM_TEMPLATE_ERROR); |
| 242 | 246 | } |
| 243 | 247 | break; |
@@ -266,7 +270,9 @@ discard block |
||
| 266 | 270 | $fm_options[-1*$c] = "[".$categories[$c]->getVar('cat_title')."]"; |
| 267 | 271 | foreach(array_keys($songlists[$c]) as $f){ |
| 268 | 272 | $fm_options[$f] = $songlists[$c][$f]["title"]; |
| 269 | - if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 273 | + if(!isset($songlists[$c][$f]["sub"])) { |
|
| 274 | + continue; |
|
| 275 | + } |
|
| 270 | 276 | foreach(array_keys($songlists[$c][$f]["sub"]) as $s){ |
| 271 | 277 | $fm_options[$s] = "-- ".$songlists[$c][$f]["sub"][$s]["title"]; |
| 272 | 278 | } |
@@ -286,10 +292,14 @@ discard block |
||
| 286 | 292 | break; |
| 287 | 293 | |
| 288 | 294 | case "apply_save": |
| 289 | - if(empty($_POST["forums"])) break; |
|
| 295 | + if(empty($_POST["forums"])) { |
|
| 296 | + break; |
|
| 297 | + } |
|
| 290 | 298 | $songlistperm_handler = xoops_getmodulehandler('permission', 'songlist'); |
| 291 | 299 | foreach($_POST["forums"] as $songlist){ |
| 292 | - if($songlist < 1) continue; |
|
| 300 | + if($songlist < 1) { |
|
| 301 | + continue; |
|
| 302 | + } |
|
| 293 | 303 | $songlistperm_handler->applyTemplate($songlist, $module_id); |
| 294 | 304 | } |
| 295 | 305 | redirect_header("permissions.php", 2, _AM_SONGLIST_PERM_TEMPLATE_APPLIED); |
@@ -323,9 +333,11 @@ discard block |
||
| 323 | 333 | if(empty($op)){ |
| 324 | 334 | $op = $op_keys[0]; |
| 325 | 335 | setCookie("op", isset($op_keys[1])?$op_keys[1]:""); |
| 326 | - }else{ |
|
| 336 | + } else{ |
|
| 327 | 337 | for($i=0;$i<count($op_keys);$i++){ |
| 328 | - if($op_keys[$i]==$op) break; |
|
| 338 | + if($op_keys[$i]==$op) { |
|
| 339 | + break; |
|
| 340 | + } |
|
| 329 | 341 | } |
| 330 | 342 | setCookie("op", isset($op_keys[$i+1])?$op_keys[$i+1]:""); |
| 331 | 343 | } |
@@ -348,13 +360,15 @@ discard block |
||
| 348 | 360 | $form->addItem($c, $categories[$c]->getVar('cat_title')); |
| 349 | 361 | } |
| 350 | 362 | unset($categories); |
| 351 | - }else{ |
|
| 363 | + } else{ |
|
| 352 | 364 | foreach (array_keys($categories) as $c) { |
| 353 | 365 | $key_c = -1 * $c; |
| 354 | 366 | $form->addItem($key_c, "<strong>[".$categories[$c]->getVar('cat_title')."]</strong>"); |
| 355 | 367 | foreach(array_keys($songlists[$c]) as $f){ |
| 356 | 368 | $form->addItem($f, $songlists[$c][$f]["title"], $key_c); |
| 357 | - if(!isset($songlists[$c][$f]["sub"])) continue; |
|
| 369 | + if(!isset($songlists[$c][$f]["sub"])) { |
|
| 370 | + continue; |
|
| 371 | + } |
|
| 358 | 372 | foreach(array_keys($songlists[$c][$f]["sub"]) as $s){ |
| 359 | 373 | $form->addItem($s, "→".$songlists[$c][$f]["sub"][$s]["title"], $f); |
| 360 | 374 | } |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | $filter = !empty($_REQUEST['filter'])?''.$_REQUEST['filter'].'':'1,1'; |
| 16 | 16 | |
| 17 | 17 | switch($op) { |
| 18 | - default: |
|
| 19 | - case "utf8map": |
|
| 20 | - switch ($fct) |
|
| 21 | - { |
|
| 18 | + default: |
|
| 19 | + case "utf8map": |
|
| 20 | + switch ($fct) |
|
| 21 | + { |
|
| 22 | 22 | default: |
| 23 | 23 | case "list": |
| 24 | 24 | $indexAdmin = new ModuleAdmin(); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | xoops_confirm(array('id'=>$_REQUEST['id'], 'op'=>$_REQUEST['op'], 'fct'=>$_REQUEST['fct'], 'limit'=>$_REQUEST['limit'], 'start'=>$_REQUEST['start'], 'order'=>$_REQUEST['order'], 'sort'=>$_REQUEST['sort'], 'filter'=>$_REQUEST['filter']), $_SERVER['PHP_SELF'], sprintf(_AM_SONGLIST_MSG_UTF8MAP_DELETE, $utf8map->getVar('from'), $utf8map->getVar('to'))); |
| 132 | 132 | } |
| 133 | 133 | break; |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | break; |
| 136 | 136 | |
| 137 | 137 | } |
@@ -6,15 +6,15 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | xoops_cp_header(); |
| 8 | 8 | |
| 9 | - $op = isset($_REQUEST['op'])?$_REQUEST['op']:"utf8map"; |
|
| 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'] : "utf8map"; |
|
| 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 "utf8map": |
| 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 | - $utf8map_handler =& xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 27 | + $utf8map_handler = & xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 28 | 28 | |
| 29 | 29 | $criteria = $utf8map_handler->getFilterCriteria($GLOBALS['filter']); |
| 30 | 30 | $ttl = $utf8map_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 ($utf8map_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', $utf8map_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', $utf8map_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 | $utf8maps = $utf8map_handler->getObjects($criteria, true); |
| 54 | - foreach($utf8maps as $cid => $utf8map) { |
|
| 54 | + foreach ($utf8maps as $cid => $utf8map) { |
|
| 55 | 55 | if (is_object($utf8map)) |
| 56 | 56 | $GLOBALS['xoopsTpl']->append('utf8map', $utf8map->toArray()); |
| 57 | 57 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $indexAdmin = new ModuleAdmin(); |
| 67 | 67 | echo $indexAdmin->addNavigation(basename(__FILE__)); |
| 68 | 68 | |
| 69 | - $utf8map_handler =& xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 69 | + $utf8map_handler = & xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 70 | 70 | if (isset($_REQUEST['id'])) { |
| 71 | 71 | $utf8map = $utf8map_handler->get(intval($_REQUEST['id'])); |
| 72 | 72 | } else { |
@@ -79,21 +79,21 @@ discard block |
||
| 79 | 79 | break; |
| 80 | 80 | case "save": |
| 81 | 81 | |
| 82 | - $utf8map_handler =& xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 83 | - $id=0; |
|
| 84 | - if ($id=intval($_REQUEST['id'])) { |
|
| 82 | + $utf8map_handler = & xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 83 | + $id = 0; |
|
| 84 | + if ($id = intval($_REQUEST['id'])) { |
|
| 85 | 85 | $utf8map = $utf8map_handler->get($id); |
| 86 | 86 | } else { |
| 87 | 87 | $utf8map = $utf8map_handler->create(); |
| 88 | 88 | } |
| 89 | 89 | $utf8map->setVars($_POST[$id]); |
| 90 | 90 | |
| 91 | - if (!$id=$utf8map_handler->insert($utf8map)) { |
|
| 91 | + if (!$id = $utf8map_handler->insert($utf8map)) { |
|
| 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_UTF8MAP_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_UTF8MAP_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_UTF8MAP_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_UTF8MAP_SAVEDOKEY); |
| 99 | 99 | exit(0); |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | break; |
| 102 | 102 | case "savelist": |
| 103 | 103 | |
| 104 | - $utf8map_handler =& xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 105 | - foreach($_REQUEST['id'] as $id) { |
|
| 104 | + $utf8map_handler = & xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 105 | + foreach ($_REQUEST['id'] as $id) { |
|
| 106 | 106 | $utf8map = $utf8map_handler->get($id); |
| 107 | 107 | $utf8map->setVars($_POST[$id]); |
| 108 | 108 | if (!$utf8map_handler->insert($utf8map)) { |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | break; |
| 116 | 116 | case "delete": |
| 117 | 117 | |
| 118 | - $utf8map_handler =& xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 119 | - $id=0; |
|
| 120 | - if (isset($_POST['id'])&&$id=intval($_POST['id'])) { |
|
| 118 | + $utf8map_handler = & xoops_getmodulehandler('utf8map', 'songlist'); |
|
| 119 | + $id = 0; |
|
| 120 | + if (isset($_POST['id']) && $id = intval($_POST['id'])) { |
|
| 121 | 121 | $utf8map = $utf8map_handler->get($id); |
| 122 | 122 | if (!$utf8map_handler->delete($utf8map)) { |
| 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_UTF8MAP_FAILEDTODELETE); |
@@ -52,8 +52,9 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $utf8maps = $utf8map_handler->getObjects($criteria, true); |
| 54 | 54 | foreach($utf8maps as $cid => $utf8map) { |
| 55 | - if (is_object($utf8map)) |
|
| 56 | - $GLOBALS['xoopsTpl']->append('utf8map', $utf8map->toArray()); |
|
| 55 | + if (is_object($utf8map)) { |
|
| 56 | + $GLOBALS['xoopsTpl']->append('utf8map', $utf8map->toArray()); |
|
| 57 | + } |
|
| 57 | 58 | } |
| 58 | 59 | $GLOBALS['xoopsTpl']->assign('form', songlist_utf8map_get_form(false)); |
| 59 | 60 | $GLOBALS['xoopsTpl']->assign('php_self', $_SERVER['PHP_SELF']); |
@@ -92,10 +93,11 @@ discard block |
||
| 92 | 93 | 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_UTF8MAP_FAILEDTOSAVE); |
| 93 | 94 | exit(0); |
| 94 | 95 | } else { |
| 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_UTF8MAP_SAVEDOKEY); |
|
| 97 | - else |
|
| 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_UTF8MAP_SAVEDOKEY); |
|
| 96 | + if ($_REQUEST['state'][$_REQUEST['id']]=='new') { |
|
| 97 | + 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_UTF8MAP_SAVEDOKEY); |
|
| 98 | + } else { |
|
| 99 | + 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_UTF8MAP_SAVEDOKEY); |
|
| 100 | + } |
|
| 99 | 101 | exit(0); |
| 100 | 102 | } |
| 101 | 103 | break; |
@@ -17,9 +17,9 @@ discard block |
||
| 17 | 17 | include 'header.php'; |
| 18 | 18 | xoops_cp_header(); |
| 19 | 19 | |
| 20 | - $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : "visibility")); |
|
| 20 | + $op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : "visibility")); |
|
| 21 | 21 | |
| 22 | -include_once $GLOBALS['xoops']->path( "/class/xoopsformloader.php" ); |
|
| 22 | +include_once $GLOBALS['xoops']->path("/class/xoopsformloader.php"); |
|
| 23 | 23 | $opform = new XoopsSimpleForm('', 'opform', 'field_permissions.php', "post"); |
| 24 | 24 | $op_select = new XoopsFormSelect("", 'op', $op); |
| 25 | 25 | $op_select->setExtra('onchange="document.forms.opform.submit()"'); |
@@ -34,19 +34,19 @@ discard block |
||
| 34 | 34 | $field_handler = xoops_getmodulehandler('field'); |
| 35 | 35 | $fields = $field_handler->getList(); |
| 36 | 36 | |
| 37 | -if ( isset($_REQUEST['submit']) ) { |
|
| 37 | +if (isset($_REQUEST['submit'])) { |
|
| 38 | 38 | $visibility = $visibility_handler->create(); |
| 39 | 39 | $visibility->setVar('field_id', $_REQUEST['field_id']); |
| 40 | 40 | $visibility->setVar('user_group', $_REQUEST['ug']); |
| 41 | 41 | $visibility->setVar('profile_group', $_REQUEST['pg']); |
| 42 | 42 | $visibility_handler->insert($visibility, true); |
| 43 | 43 | } |
| 44 | -if ( $op == "del" ) { |
|
| 45 | - $criteria = new CriteriaCompo(new Criteria('field_id', intval($_REQUEST['field_id']) )); |
|
| 46 | - $criteria->add(new Criteria('user_group', intval($_REQUEST['ug']) )); |
|
| 47 | - $criteria->add(new Criteria('profile_group', intval($_REQUEST['pg']) )); |
|
| 44 | +if ($op=="del") { |
|
| 45 | + $criteria = new CriteriaCompo(new Criteria('field_id', intval($_REQUEST['field_id']))); |
|
| 46 | + $criteria->add(new Criteria('user_group', intval($_REQUEST['ug']))); |
|
| 47 | + $criteria->add(new Criteria('profile_group', intval($_REQUEST['pg']))); |
|
| 48 | 48 | $visibility_handler->deleteAll($criteria, true); |
| 49 | - redirect_header("field_visibility.php", 2, sprintf(_AM_SONGLIST_DELETEDSUCCESS, _AM_SONGLIST_PROF_VISIBLE) ); |
|
| 49 | + redirect_header("field_visibility.php", 2, sprintf(_AM_SONGLIST_DELETEDSUCCESS, _AM_SONGLIST_PROF_VISIBLE)); |
|
| 50 | 50 | exit(); |
| 51 | 51 | } |
| 52 | 52 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $sel_pg->addOptionArray($groups); |
| 80 | 80 | $add_form->addElement($sel_pg); |
| 81 | 81 | |
| 82 | -$add_form->addElement(new XoopsFormButton('', 'submit', _ADD, 'submit') ); |
|
| 82 | +$add_form->addElement(new XoopsFormButton('', 'submit', _ADD, 'submit')); |
|
| 83 | 83 | $add_form->assign($GLOBALS['xoopsTpl']); |
| 84 | 84 | |
| 85 | 85 | $GLOBALS['xoopsTpl']->display("db:songlist_cpanel_visibility.html"); |