@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $pathLanguage = $path . $pathModuleAdmin; |
20 | 20 | |
21 | 21 | if (!file_exists($fileinc = $pathLanguage . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/' . 'main.php')) { |
22 | - $fileinc = $pathLanguage . '/language/english/main.php'; |
|
22 | + $fileinc = $pathLanguage . '/language/english/main.php'; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | include_once $fileinc; |
@@ -60,43 +60,43 @@ discard block |
||
60 | 60 | //--------------------------------- |
61 | 61 | |
62 | 62 | if (!defined('SMARTOBJECT_ROOT_PATH')) { |
63 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
|
63 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/functions.php'; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | $smartobjectConfig = smart_getModuleConfig('smartobject'); |
67 | 67 | |
68 | 68 | if (isset($smartobjectConfig['enable_currencyman']) && $smartobjectConfig['enable_currencyman'] == true) { |
69 | - ++$i; |
|
70 | - $adminmenu[$i]['title'] = _MI_SOBJECT_CURRENCIES; |
|
71 | - $adminmenu[$i]['link'] = 'admin/currency.php'; |
|
72 | - $adminmenu[$i]['icon'] = $pathIcon32 . '/cash_stack.png'; |
|
69 | + ++$i; |
|
70 | + $adminmenu[$i]['title'] = _MI_SOBJECT_CURRENCIES; |
|
71 | + $adminmenu[$i]['link'] = 'admin/currency.php'; |
|
72 | + $adminmenu[$i]['icon'] = $pathIcon32 . '/cash_stack.png'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | global $xoopsModule; |
76 | 76 | if (isset($xoopsModule)) { |
77 | - // $i = -1; |
|
78 | - |
|
79 | - // --- for XCL --- |
|
80 | - // $headermenu[$i]['link'] = '../../system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'); |
|
81 | - $mid = $xoopsModule->getVar('mid'); |
|
82 | - if (defined('XOOPS_CUBE_LEGACY')) { |
|
83 | - $link_pref = XOOPS_URL . '/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id=' . $mid; |
|
84 | - } else { |
|
85 | - $link_pref = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mid; |
|
86 | - } |
|
87 | - $headermenu[$i]['link'] = $link_pref; |
|
88 | - // ----- |
|
89 | - |
|
90 | - // --- for XCL --- |
|
91 | - // $headermenu[$i]['link'] = XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoopsModule->getVar('dirname'); |
|
92 | - $dirname = $xoopsModule->getVar('dirname'); |
|
93 | - if (defined('XOOPS_CUBE_LEGACY')) { |
|
94 | - $link_module = XOOPS_URL . '/modules/legacy/admin/index.php?action=ModuleUpdate&dirname=' . $dirname; |
|
95 | - } else { |
|
96 | - $link_module = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $dirname; |
|
97 | - } |
|
98 | - $headermenu[$i]['link'] = $link_module; |
|
99 | - // ----- |
|
100 | - |
|
101 | - ++$i; |
|
77 | + // $i = -1; |
|
78 | + |
|
79 | + // --- for XCL --- |
|
80 | + // $headermenu[$i]['link'] = '../../system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'); |
|
81 | + $mid = $xoopsModule->getVar('mid'); |
|
82 | + if (defined('XOOPS_CUBE_LEGACY')) { |
|
83 | + $link_pref = XOOPS_URL . '/modules/legacy/admin/index.php?action=PreferenceEdit&confmod_id=' . $mid; |
|
84 | + } else { |
|
85 | + $link_pref = XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $mid; |
|
86 | + } |
|
87 | + $headermenu[$i]['link'] = $link_pref; |
|
88 | + // ----- |
|
89 | + |
|
90 | + // --- for XCL --- |
|
91 | + // $headermenu[$i]['link'] = XOOPS_URL . "/modules/system/admin.php?fct=modulesadmin&op=update&module=" . $xoopsModule->getVar('dirname'); |
|
92 | + $dirname = $xoopsModule->getVar('dirname'); |
|
93 | + if (defined('XOOPS_CUBE_LEGACY')) { |
|
94 | + $link_module = XOOPS_URL . '/modules/legacy/admin/index.php?action=ModuleUpdate&dirname=' . $dirname; |
|
95 | + } else { |
|
96 | + $link_module = XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $dirname; |
|
97 | + } |
|
98 | + $headermenu[$i]['link'] = $link_module; |
|
99 | + // ----- |
|
100 | + |
|
101 | + ++$i; |
|
102 | 102 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | include_once $path . '/mainfile.php'; |
13 | 13 | |
14 | 14 | $dirname = basename(dirname(__DIR__)); |
15 | -$moduleHandler = xoops_getHandler('module'); |
|
15 | +$moduleHandler = xoops_getHandler('module'); |
|
16 | 16 | $module = $moduleHandler->getByDirname($dirname); |
17 | 17 | $pathIcon32 = $module->getInfo('icons32'); |
18 | 18 | $pathModuleAdmin = $module->getInfo('dirmoduleadmin'); |
@@ -10,29 +10,29 @@ discard block |
||
10 | 10 | |
11 | 11 | function editclass($showmenu = false, $currencyid = 0) |
12 | 12 | { |
13 | - global $smartobjectCurrencyHandler; |
|
14 | - |
|
15 | - $currencyObj = $smartobjectCurrencyHandler->get($currencyid); |
|
16 | - |
|
17 | - if (!$currencyObj->isNew()) { |
|
18 | - if ($showmenu) { |
|
19 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING); |
|
20 | - } |
|
21 | - smart_collapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO); |
|
22 | - |
|
23 | - $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency'); |
|
24 | - $sform->display(); |
|
25 | - smart_close_collapsable('currencyedit'); |
|
26 | - } else { |
|
27 | - if ($showmenu) { |
|
28 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
29 | - } |
|
30 | - |
|
31 | - smart_collapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO); |
|
32 | - $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency'); |
|
33 | - $sform->display(); |
|
34 | - smart_close_collapsable('currencycreate'); |
|
35 | - } |
|
13 | + global $smartobjectCurrencyHandler; |
|
14 | + |
|
15 | + $currencyObj = $smartobjectCurrencyHandler->get($currencyid); |
|
16 | + |
|
17 | + if (!$currencyObj->isNew()) { |
|
18 | + if ($showmenu) { |
|
19 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING); |
|
20 | + } |
|
21 | + smart_collapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO); |
|
22 | + |
|
23 | + $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency'); |
|
24 | + $sform->display(); |
|
25 | + smart_close_collapsable('currencyedit'); |
|
26 | + } else { |
|
27 | + if ($showmenu) { |
|
28 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW); |
|
29 | + } |
|
30 | + |
|
31 | + smart_collapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO); |
|
32 | + $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency'); |
|
33 | + $sform->display(); |
|
34 | + smart_close_collapsable('currencycreate'); |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | include_once __DIR__ . '/admin_header.php'; |
@@ -43,37 +43,37 @@ discard block |
||
43 | 43 | $op = ''; |
44 | 44 | |
45 | 45 | if (isset($_GET['op'])) { |
46 | - $op = $_GET['op']; |
|
46 | + $op = $_GET['op']; |
|
47 | 47 | } |
48 | 48 | if (isset($_POST['op'])) { |
49 | - $op = $_POST['op']; |
|
49 | + $op = $_POST['op']; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($op) { |
53 | - case 'mod': |
|
54 | - $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
53 | + case 'mod': |
|
54 | + $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
55 | 55 | |
56 | - smart_xoops_cp_header(); |
|
56 | + smart_xoops_cp_header(); |
|
57 | 57 | |
58 | - editclass(true, $currencyid); |
|
59 | - break; |
|
58 | + editclass(true, $currencyid); |
|
59 | + break; |
|
60 | 60 | |
61 | - case 'updateCurrencies': |
|
61 | + case 'updateCurrencies': |
|
62 | 62 | |
63 | - if (!isset($_POST['SmartobjectCurrency_objects']) || count($_POST['SmartobjectCurrency_objects']) == 0) { |
|
64 | - redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE); |
|
65 | - exit; |
|
66 | - } |
|
63 | + if (!isset($_POST['SmartobjectCurrency_objects']) || count($_POST['SmartobjectCurrency_objects']) == 0) { |
|
64 | + redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE); |
|
65 | + exit; |
|
66 | + } |
|
67 | 67 | |
68 | - if (isset($_POST['default_currency'])) { |
|
69 | - $newDefaultCurrency = $_POST['default_currency']; |
|
70 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
71 | - $smartobjectCurrencyHandler->query($sql); |
|
72 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
|
73 | - $smartobjectCurrencyHandler->query($sql); |
|
74 | - } |
|
68 | + if (isset($_POST['default_currency'])) { |
|
69 | + $newDefaultCurrency = $_POST['default_currency']; |
|
70 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
71 | + $smartobjectCurrencyHandler->query($sql); |
|
72 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
|
73 | + $smartobjectCurrencyHandler->query($sql); |
|
74 | + } |
|
75 | 75 | |
76 | - /* |
|
76 | + /* |
|
77 | 77 | $criteria = new CriteriaCompo(); |
78 | 78 | $criteria->add(new Criteria('currencyid', '(' . implode(', ', $_POST['SmartobjectCurrency_objects']) . ')', 'IN')); |
79 | 79 | $currenciesObj = $smartobjectCurrencyHandler->getObjects($criteria, true); |
@@ -83,51 +83,51 @@ discard block |
||
83 | 83 | $smartobjectCurrencyHandler->insert($currencyObj); |
84 | 84 | } |
85 | 85 | */ |
86 | - redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); |
|
87 | - exit; |
|
86 | + redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); |
|
87 | + exit; |
|
88 | 88 | |
89 | - break; |
|
89 | + break; |
|
90 | 90 | |
91 | - case 'addcurrency': |
|
92 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
93 | - $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
94 | - $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); |
|
91 | + case 'addcurrency': |
|
92 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
93 | + $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
94 | + $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); |
|
95 | 95 | |
96 | - break; |
|
96 | + break; |
|
97 | 97 | |
98 | - case 'del': |
|
99 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
100 | - $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
101 | - $controller->handleObjectDeletion(); |
|
98 | + case 'del': |
|
99 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
100 | + $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
101 | + $controller->handleObjectDeletion(); |
|
102 | 102 | |
103 | - break; |
|
103 | + break; |
|
104 | 104 | |
105 | - default: |
|
105 | + default: |
|
106 | 106 | |
107 | - smart_xoops_cp_header(); |
|
107 | + smart_xoops_cp_header(); |
|
108 | 108 | |
109 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); |
|
109 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); |
|
110 | 110 | |
111 | - smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); |
|
111 | + smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); |
|
112 | 112 | |
113 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
114 | - $objectTable = new SmartObjectTable($smartobjectCurrencyHandler); |
|
115 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); |
|
116 | - $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); |
|
117 | - $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); |
|
118 | - $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl')); |
|
113 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
114 | + $objectTable = new SmartObjectTable($smartobjectCurrencyHandler); |
|
115 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); |
|
116 | + $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); |
|
117 | + $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); |
|
118 | + $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl')); |
|
119 | 119 | |
120 | - $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); |
|
120 | + $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); |
|
121 | 121 | |
122 | - $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); |
|
122 | + $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); |
|
123 | 123 | |
124 | - $objectTable->render(); |
|
124 | + $objectTable->render(); |
|
125 | 125 | |
126 | - echo '<br />'; |
|
127 | - smart_close_collapsable('createdcurrencies'); |
|
128 | - echo '<br>'; |
|
126 | + echo '<br />'; |
|
127 | + smart_close_collapsable('createdcurrencies'); |
|
128 | + echo '<br>'; |
|
129 | 129 | |
130 | - break; |
|
130 | + break; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | //smart_modFooter(); |
@@ -50,30 +50,30 @@ discard block |
||
50 | 50 | } |
51 | 51 | |
52 | 52 | switch ($op) { |
53 | - case 'mod': |
|
54 | - $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
53 | + case 'mod': |
|
54 | + $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
55 | 55 | |
56 | - smart_xoops_cp_header(); |
|
56 | + smart_xoops_cp_header(); |
|
57 | 57 | |
58 | - editclass(true, $currencyid); |
|
59 | - break; |
|
58 | + editclass(true, $currencyid); |
|
59 | + break; |
|
60 | 60 | |
61 | - case 'updateCurrencies': |
|
61 | + case 'updateCurrencies': |
|
62 | 62 | |
63 | - if (!isset($_POST['SmartobjectCurrency_objects']) || count($_POST['SmartobjectCurrency_objects']) == 0) { |
|
64 | - redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE); |
|
65 | - exit; |
|
66 | - } |
|
63 | + if (!isset($_POST['SmartobjectCurrency_objects']) || count($_POST['SmartobjectCurrency_objects']) == 0) { |
|
64 | + redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE); |
|
65 | + exit; |
|
66 | + } |
|
67 | 67 | |
68 | - if (isset($_POST['default_currency'])) { |
|
69 | - $newDefaultCurrency = $_POST['default_currency']; |
|
70 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
71 | - $smartobjectCurrencyHandler->query($sql); |
|
72 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
|
73 | - $smartobjectCurrencyHandler->query($sql); |
|
74 | - } |
|
68 | + if (isset($_POST['default_currency'])) { |
|
69 | + $newDefaultCurrency = $_POST['default_currency']; |
|
70 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
71 | + $smartobjectCurrencyHandler->query($sql); |
|
72 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
|
73 | + $smartobjectCurrencyHandler->query($sql); |
|
74 | + } |
|
75 | 75 | |
76 | - /* |
|
76 | + /* |
|
77 | 77 | $criteria = new CriteriaCompo(); |
78 | 78 | $criteria->add(new Criteria('currencyid', '(' . implode(', ', $_POST['SmartobjectCurrency_objects']) . ')', 'IN')); |
79 | 79 | $currenciesObj = $smartobjectCurrencyHandler->getObjects($criteria, true); |
@@ -83,51 +83,51 @@ discard block |
||
83 | 83 | $smartobjectCurrencyHandler->insert($currencyObj); |
84 | 84 | } |
85 | 85 | */ |
86 | - redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); |
|
87 | - exit; |
|
86 | + redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED); |
|
87 | + exit; |
|
88 | 88 | |
89 | - break; |
|
89 | + break; |
|
90 | 90 | |
91 | - case 'addcurrency': |
|
92 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
93 | - $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
94 | - $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); |
|
91 | + case 'addcurrency': |
|
92 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
93 | + $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
94 | + $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php'); |
|
95 | 95 | |
96 | - break; |
|
96 | + break; |
|
97 | 97 | |
98 | - case 'del': |
|
99 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
100 | - $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
101 | - $controller->handleObjectDeletion(); |
|
98 | + case 'del': |
|
99 | + include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php'; |
|
100 | + $controller = new SmartObjectController($smartobjectCurrencyHandler); |
|
101 | + $controller->handleObjectDeletion(); |
|
102 | 102 | |
103 | - break; |
|
103 | + break; |
|
104 | 104 | |
105 | - default: |
|
105 | + default: |
|
106 | 106 | |
107 | - smart_xoops_cp_header(); |
|
107 | + smart_xoops_cp_header(); |
|
108 | 108 | |
109 | - //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); |
|
109 | + //smart_adminMenu(5, _AM_SOBJECT_CURRENCIES); |
|
110 | 110 | |
111 | - smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); |
|
111 | + smart_collapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC); |
|
112 | 112 | |
113 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
114 | - $objectTable = new SmartObjectTable($smartobjectCurrencyHandler); |
|
115 | - $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); |
|
116 | - $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); |
|
117 | - $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); |
|
118 | - $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl')); |
|
113 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php'; |
|
114 | + $objectTable = new SmartObjectTable($smartobjectCurrencyHandler); |
|
115 | + $objectTable->addColumn(new SmartObjectColumn('name', 'left', false, 'getCurrencyLink')); |
|
116 | + $objectTable->addColumn(new SmartObjectColumn('rate', 'center', 150)); |
|
117 | + $objectTable->addColumn(new SmartObjectColumn('iso4217', 'center', 150)); |
|
118 | + $objectTable->addColumn(new SmartObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl')); |
|
119 | 119 | |
120 | - $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); |
|
120 | + $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE); |
|
121 | 121 | |
122 | - $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); |
|
122 | + $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL); |
|
123 | 123 | |
124 | - $objectTable->render(); |
|
124 | + $objectTable->render(); |
|
125 | 125 | |
126 | - echo '<br />'; |
|
127 | - smart_close_collapsable('createdcurrencies'); |
|
128 | - echo '<br>'; |
|
126 | + echo '<br />'; |
|
127 | + smart_close_collapsable('createdcurrencies'); |
|
128 | + echo '<br>'; |
|
129 | 129 | |
130 | - break; |
|
130 | + break; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | //smart_modFooter(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | switch ($op) { |
53 | 53 | case 'mod': |
54 | - $currencyid = isset($_GET['currencyid']) ? (int)$_GET['currencyid'] : 0; |
|
54 | + $currencyid = isset($_GET['currencyid']) ? (int) $_GET['currencyid'] : 0; |
|
55 | 55 | |
56 | 56 | smart_xoops_cp_header(); |
57 | 57 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | if (isset($_POST['default_currency'])) { |
69 | 69 | $newDefaultCurrency = $_POST['default_currency']; |
70 | - $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
70 | + $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0'; |
|
71 | 71 | $smartobjectCurrencyHandler->query($sql); |
72 | 72 | $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency; |
73 | 73 | $smartobjectCurrencyHandler->query($sql); |
@@ -18,180 +18,180 @@ discard block |
||
18 | 18 | // ========================================================================================= |
19 | 19 | function update_tables_to_300() |
20 | 20 | { |
21 | - $dbupdater = new WfdownloadsDbupdater(); |
|
21 | + $dbupdater = new WfdownloadsDbupdater(); |
|
22 | 22 | |
23 | - if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
24 | - // Create table wfdownloads_meta |
|
25 | - $table = new WfdownloadsTable('wfdownloads_meta'); |
|
26 | - $table->setStructure("CREATE TABLE %s ( |
|
23 | + if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
24 | + // Create table wfdownloads_meta |
|
25 | + $table = new WfdownloadsTable('wfdownloads_meta'); |
|
26 | + $table->setStructure("CREATE TABLE %s ( |
|
27 | 27 | metakey varchar(50) NOT NULL default '', |
28 | 28 | metavalue varchar(255) NOT NULL default '', |
29 | 29 | PRIMARY KEY (metakey)) |
30 | 30 | ENGINE=MyISAM;"); |
31 | 31 | |
32 | - $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2))); |
|
33 | - if ($dbupdater->updateTable($table)) { |
|
34 | - echo 'wfdownloads_meta table created<br />'; |
|
35 | - } |
|
36 | - } |
|
32 | + $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2))); |
|
33 | + if ($dbupdater->updateTable($table)) { |
|
34 | + echo 'wfdownloads_meta table created<br />'; |
|
35 | + } |
|
36 | + } |
|
37 | 37 | |
38 | - $download_fields = array( |
|
39 | - 'lid' => array('Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false), |
|
40 | - 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
41 | - 'title' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
42 | - 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
43 | - 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
44 | - 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
45 | - 'homepage' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
46 | - 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
47 | - 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
48 | - 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
49 | - 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
50 | - 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
51 | - 'publisher' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
52 | - 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
53 | - 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
54 | - 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
55 | - 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
56 | - 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
57 | - 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
58 | - 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
59 | - 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
60 | - 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
61 | - 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
62 | - 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
63 | - 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
64 | - 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
65 | - 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
66 | - 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
67 | - 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
68 | - 'published' => array('Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true), |
|
69 | - 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
70 | - 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
71 | - 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
72 | - 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
73 | - 'ipaddress' => array('Type' => "varchar(120) NOT NULL default '0'", 'Default' => true), |
|
74 | - 'notifypub' => array('Type' => "int(1) NOT NULL default '0'", 'Default' => true), |
|
75 | - 'summary' => array('Type' => 'text NOT NULL', 'Default' => false) |
|
76 | - ); |
|
38 | + $download_fields = array( |
|
39 | + 'lid' => array('Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false), |
|
40 | + 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
41 | + 'title' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
42 | + 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
43 | + 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
44 | + 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
45 | + 'homepage' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
46 | + 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
47 | + 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
48 | + 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
49 | + 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
50 | + 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
51 | + 'publisher' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
52 | + 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
53 | + 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
54 | + 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
55 | + 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
56 | + 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
57 | + 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
58 | + 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
59 | + 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
60 | + 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
61 | + 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
62 | + 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
63 | + 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
64 | + 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
65 | + 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
66 | + 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
67 | + 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
68 | + 'published' => array('Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true), |
|
69 | + 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
70 | + 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
71 | + 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
72 | + 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
73 | + 'ipaddress' => array('Type' => "varchar(120) NOT NULL default '0'", 'Default' => true), |
|
74 | + 'notifypub' => array('Type' => "int(1) NOT NULL default '0'", 'Default' => true), |
|
75 | + 'summary' => array('Type' => 'text NOT NULL', 'Default' => false) |
|
76 | + ); |
|
77 | 77 | |
78 | - $renamed_fields = array( |
|
79 | - 'logourl' => 'screenshot' |
|
80 | - ); |
|
78 | + $renamed_fields = array( |
|
79 | + 'logourl' => 'screenshot' |
|
80 | + ); |
|
81 | 81 | |
82 | - echo '<br /><B>Checking Download table</B><br />'; |
|
83 | - $downloadHandler = xoops_getModuleHandler('download', 'wfdownloads'); |
|
84 | - $download_table = new WfdownloadsTable('wfdownloads_downloads'); |
|
85 | - $fields = get_table_info($downloadHandler->table, $download_fields); |
|
86 | - // Check for renamed fields |
|
87 | - rename_fields($download_table, $renamed_fields, $fields, $download_fields); |
|
88 | - update_table($download_fields, $fields, $download_table); |
|
89 | - if ($dbupdater->updateTable($download_table)) { |
|
90 | - echo 'Downloads table updated<br />'; |
|
91 | - } |
|
92 | - unset($fields); |
|
82 | + echo '<br /><B>Checking Download table</B><br />'; |
|
83 | + $downloadHandler = xoops_getModuleHandler('download', 'wfdownloads'); |
|
84 | + $download_table = new WfdownloadsTable('wfdownloads_downloads'); |
|
85 | + $fields = get_table_info($downloadHandler->table, $download_fields); |
|
86 | + // Check for renamed fields |
|
87 | + rename_fields($download_table, $renamed_fields, $fields, $download_fields); |
|
88 | + update_table($download_fields, $fields, $download_table); |
|
89 | + if ($dbupdater->updateTable($download_table)) { |
|
90 | + echo 'Downloads table updated<br />'; |
|
91 | + } |
|
92 | + unset($fields); |
|
93 | 93 | |
94 | - $mod_fields = array( |
|
95 | - 'requestid' => array('Type' => 'int(11) NOT NULL auto_increment', 'Default' => false), |
|
96 | - 'lid' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
97 | - 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
98 | - 'title' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
99 | - 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
100 | - 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
101 | - 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
102 | - 'homepage' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
103 | - 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
104 | - 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
105 | - 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
106 | - 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
107 | - 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
108 | - 'publisher' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
109 | - 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
110 | - 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
111 | - 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
112 | - 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
113 | - 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
114 | - 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
115 | - 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
116 | - 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
117 | - 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
118 | - 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
119 | - 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
120 | - 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
121 | - 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
122 | - 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
123 | - 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
124 | - 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
125 | - 'published' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
126 | - 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
127 | - 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
128 | - 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
129 | - 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
130 | - 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
131 | - 'modifysubmitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
132 | - 'requestdate' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
133 | - ); |
|
94 | + $mod_fields = array( |
|
95 | + 'requestid' => array('Type' => 'int(11) NOT NULL auto_increment', 'Default' => false), |
|
96 | + 'lid' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
97 | + 'cid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
98 | + 'title' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
99 | + 'url' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
100 | + 'filename' => array('Type' => "varchar(150) NOT NULL default ''", 'Default' => true), |
|
101 | + 'filetype' => array('Type' => "varchar(100) NOT NULL default ''", 'Default' => true), |
|
102 | + 'homepage' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
103 | + 'version' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
104 | + 'size' => array('Type' => "int(8) NOT NULL default '0'", 'Default' => true), |
|
105 | + 'platform' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
106 | + 'screenshot' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
107 | + 'submitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
108 | + 'publisher' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
109 | + 'status' => array('Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true), |
|
110 | + 'date' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
111 | + 'hits' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
112 | + 'rating' => array('Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true), |
|
113 | + 'votes' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
114 | + 'comments' => array('Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true), |
|
115 | + 'license' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
116 | + 'mirror' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
117 | + 'price' => array('Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true), |
|
118 | + 'paypalemail' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
119 | + 'features' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
120 | + 'requirements' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
121 | + 'homepagetitle' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
122 | + 'forumid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
123 | + 'limitations' => array('Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true), |
|
124 | + 'dhistory' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
125 | + 'published' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
126 | + 'expired' => array('Type' => "int(10) NOT NULL default '0'", 'Default' => true), |
|
127 | + 'updated' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
128 | + 'offline' => array('Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true), |
|
129 | + 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
130 | + 'description' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
131 | + 'modifysubmitter' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
132 | + 'requestdate' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
133 | + ); |
|
134 | 134 | |
135 | - $renamed_fields = array( |
|
136 | - 'logourl' => 'screenshot' |
|
137 | - ); |
|
135 | + $renamed_fields = array( |
|
136 | + 'logourl' => 'screenshot' |
|
137 | + ); |
|
138 | 138 | |
139 | - echo '<br /><B>Checking Modified Downloads table</B><br />'; |
|
140 | - $modHandler = xoops_getModuleHandler('modification', 'wfdownloads'); |
|
141 | - $mod_table = new WfdownloadsTable('wfdownloads_mod'); |
|
142 | - $fields = get_table_info($modHandler->table, $mod_fields); |
|
143 | - rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); |
|
144 | - update_table($mod_fields, $fields, $mod_table); |
|
145 | - if ($dbupdater->updateTable($mod_table)) { |
|
146 | - echo 'Modified Downloads table updated <br />'; |
|
147 | - } |
|
148 | - unset($fields); |
|
139 | + echo '<br /><B>Checking Modified Downloads table</B><br />'; |
|
140 | + $modHandler = xoops_getModuleHandler('modification', 'wfdownloads'); |
|
141 | + $mod_table = new WfdownloadsTable('wfdownloads_mod'); |
|
142 | + $fields = get_table_info($modHandler->table, $mod_fields); |
|
143 | + rename_fields($mod_table, $renamed_fields, $fields, $mod_fields); |
|
144 | + update_table($mod_fields, $fields, $mod_table); |
|
145 | + if ($dbupdater->updateTable($mod_table)) { |
|
146 | + echo 'Modified Downloads table updated <br />'; |
|
147 | + } |
|
148 | + unset($fields); |
|
149 | 149 | |
150 | - $cat_fields = array( |
|
151 | - 'cid' => array('Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false), |
|
152 | - 'pid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
153 | - 'title' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
154 | - 'imgurl' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
155 | - 'description' => array('Type' => "text NOT NULL default ''", 'Default' => true), |
|
156 | - 'total' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
157 | - 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
158 | - 'spotlighttop' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
159 | - 'spotlighthis' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
160 | - 'dohtml' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
161 | - 'dosmiley' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
162 | - 'doxcode' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
163 | - 'doimage' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
164 | - 'dobr' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
165 | - 'weight' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
166 | - ); |
|
167 | - echo '<br /><B>Checking Category table</B><br />'; |
|
168 | - $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
169 | - $cat_table = new WfdownloadsTable('wfdownloads_cat'); |
|
170 | - $fields = get_table_info($catHandler->table, $cat_fields); |
|
171 | - update_table($cat_fields, $fields, $cat_table); |
|
172 | - if ($dbupdater->updateTable($cat_table)) { |
|
173 | - echo 'Category table updated<br />'; |
|
174 | - } |
|
175 | - unset($fields); |
|
150 | + $cat_fields = array( |
|
151 | + 'cid' => array('Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false), |
|
152 | + 'pid' => array('Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true), |
|
153 | + 'title' => array('Type' => "varchar(50) NOT NULL default ''", 'Default' => true), |
|
154 | + 'imgurl' => array('Type' => "varchar(255) NOT NULL default ''", 'Default' => true), |
|
155 | + 'description' => array('Type' => "text NOT NULL default ''", 'Default' => true), |
|
156 | + 'total' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
157 | + 'summary' => array('Type' => 'text NOT NULL', 'Default' => false), |
|
158 | + 'spotlighttop' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
159 | + 'spotlighthis' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
160 | + 'dohtml' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
161 | + 'dosmiley' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
162 | + 'doxcode' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
163 | + 'doimage' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
164 | + 'dobr' => array('Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true), |
|
165 | + 'weight' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true) |
|
166 | + ); |
|
167 | + echo '<br /><B>Checking Category table</B><br />'; |
|
168 | + $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
169 | + $cat_table = new WfdownloadsTable('wfdownloads_cat'); |
|
170 | + $fields = get_table_info($catHandler->table, $cat_fields); |
|
171 | + update_table($cat_fields, $fields, $cat_table); |
|
172 | + if ($dbupdater->updateTable($cat_table)) { |
|
173 | + echo 'Category table updated<br />'; |
|
174 | + } |
|
175 | + unset($fields); |
|
176 | 176 | |
177 | - $broken_fields = array( |
|
178 | - 'reportid' => array('Type' => 'int(5) NOT NULL auto_increment', 'Default' => false), |
|
179 | - 'lid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
180 | - 'sender' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
181 | - 'ip' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
182 | - 'date' => array('Type' => "varchar(11) NOT NULL default '0'", 'Default' => true), |
|
183 | - 'confirmed' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true), |
|
184 | - 'acknowledged' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true) |
|
185 | - ); |
|
186 | - echo '<br /><B>Checking Broken Report table</B><br />'; |
|
187 | - $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads'); |
|
188 | - $broken_table = new WfdownloadsTable('wfdownloads_broken'); |
|
189 | - $fields = get_table_info($brokenHandler->table, $broken_fields); |
|
190 | - update_table($broken_fields, $fields, $broken_table); |
|
191 | - if ($dbupdater->updateTable($broken_table)) { |
|
192 | - echo 'Broken Reports table updated<br />'; |
|
193 | - } |
|
194 | - unset($fields); |
|
177 | + $broken_fields = array( |
|
178 | + 'reportid' => array('Type' => 'int(5) NOT NULL auto_increment', 'Default' => false), |
|
179 | + 'lid' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
180 | + 'sender' => array('Type' => "int(11) NOT NULL default '0'", 'Default' => true), |
|
181 | + 'ip' => array('Type' => "varchar(20) NOT NULL default ''", 'Default' => true), |
|
182 | + 'date' => array('Type' => "varchar(11) NOT NULL default '0'", 'Default' => true), |
|
183 | + 'confirmed' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true), |
|
184 | + 'acknowledged' => array('Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true) |
|
185 | + ); |
|
186 | + echo '<br /><B>Checking Broken Report table</B><br />'; |
|
187 | + $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads'); |
|
188 | + $broken_table = new WfdownloadsTable('wfdownloads_broken'); |
|
189 | + $fields = get_table_info($brokenHandler->table, $broken_fields); |
|
190 | + update_table($broken_fields, $fields, $broken_table); |
|
191 | + if ($dbupdater->updateTable($broken_table)) { |
|
192 | + echo 'Broken Reports table updated<br />'; |
|
193 | + } |
|
194 | + unset($fields); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | // ========================================================================================= |
@@ -204,48 +204,48 @@ discard block |
||
204 | 204 | */ |
205 | 205 | function invert_nohtm_dohtml_values() |
206 | 206 | { |
207 | - $ret = array(); |
|
208 | - global $xoopsDB; |
|
209 | - $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
210 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
211 | - while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
212 | - $fields[$existing_field['field']] = $existing_field['type']; |
|
213 | - } |
|
214 | - if (in_array('nohtml', array_keys($fields))) { |
|
215 | - $dbupdater = new WfdownloadsDbupdater(); |
|
216 | - //Invert column values |
|
217 | - // alter options in wfdownloads_cat |
|
218 | - $table = new WfdownloadsTable('wfdownloads_cat'); |
|
219 | - $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'"); |
|
220 | - $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'"); |
|
221 | - $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'"); |
|
222 | - $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'"); |
|
223 | - $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'"); |
|
207 | + $ret = array(); |
|
208 | + global $xoopsDB; |
|
209 | + $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
|
210 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
211 | + while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
212 | + $fields[$existing_field['field']] = $existing_field['type']; |
|
213 | + } |
|
214 | + if (in_array('nohtml', array_keys($fields))) { |
|
215 | + $dbupdater = new WfdownloadsDbupdater(); |
|
216 | + //Invert column values |
|
217 | + // alter options in wfdownloads_cat |
|
218 | + $table = new WfdownloadsTable('wfdownloads_cat'); |
|
219 | + $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'"); |
|
220 | + $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'"); |
|
221 | + $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'"); |
|
222 | + $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'"); |
|
223 | + $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'"); |
|
224 | 224 | |
225 | - //inverting values no=1 <=> do=0 |
|
226 | - // have to store teporarly as value = 2 to |
|
227 | - // avoid putting everithing to same value |
|
228 | - // if you change 1 to 0, then 0 to one, |
|
229 | - // every value will be 1, follow me? |
|
230 | - $table->addUpdatedWhere('dohtml', 2, '=1'); |
|
231 | - $table->addUpdatedWhere('dohtml', 1, '=0'); |
|
232 | - $table->addUpdatedWhere('dohtml', 0, '=2'); |
|
225 | + //inverting values no=1 <=> do=0 |
|
226 | + // have to store teporarly as value = 2 to |
|
227 | + // avoid putting everithing to same value |
|
228 | + // if you change 1 to 0, then 0 to one, |
|
229 | + // every value will be 1, follow me? |
|
230 | + $table->addUpdatedWhere('dohtml', 2, '=1'); |
|
231 | + $table->addUpdatedWhere('dohtml', 1, '=0'); |
|
232 | + $table->addUpdatedWhere('dohtml', 0, '=2'); |
|
233 | 233 | |
234 | - $table->addUpdatedWhere('dosmiley', 2, '=1'); |
|
235 | - $table->addUpdatedWhere('dosmiley', 1, '=0'); |
|
236 | - $table->addUpdatedWhere('dosmiley', 0, '=2'); |
|
234 | + $table->addUpdatedWhere('dosmiley', 2, '=1'); |
|
235 | + $table->addUpdatedWhere('dosmiley', 1, '=0'); |
|
236 | + $table->addUpdatedWhere('dosmiley', 0, '=2'); |
|
237 | 237 | |
238 | - $table->addUpdatedWhere('doxcode', 2, '=1'); |
|
239 | - $table->addUpdatedWhere('doxcode', 1, '=0'); |
|
240 | - $table->addUpdatedWhere('doxcode', 0, '=2'); |
|
238 | + $table->addUpdatedWhere('doxcode', 2, '=1'); |
|
239 | + $table->addUpdatedWhere('doxcode', 1, '=0'); |
|
240 | + $table->addUpdatedWhere('doxcode', 0, '=2'); |
|
241 | 241 | |
242 | - $table->addUpdatedWhere('doimage', 2, '=1'); |
|
243 | - $table->addUpdatedWhere('doimage', 1, '=0'); |
|
244 | - $table->addUpdatedWhere('doimage', 0, '=2'); |
|
245 | - $ret = $dbupdater->updateTable($table); |
|
246 | - } |
|
242 | + $table->addUpdatedWhere('doimage', 2, '=1'); |
|
243 | + $table->addUpdatedWhere('doimage', 1, '=0'); |
|
244 | + $table->addUpdatedWhere('doimage', 0, '=2'); |
|
245 | + $ret = $dbupdater->updateTable($table); |
|
246 | + } |
|
247 | 247 | |
248 | - return $ret; |
|
248 | + return $ret; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -258,22 +258,22 @@ discard block |
||
258 | 258 | */ |
259 | 259 | function update_table($new_fields, $existing_fields, &$table) |
260 | 260 | { |
261 | - foreach ($new_fields as $field => $fieldinfo) { |
|
262 | - $type = $fieldinfo['Type']; |
|
263 | - if (!in_array($field, array_keys($existing_fields))) { |
|
264 | - //Add field as it is missing |
|
265 | - $table->addNewField($field, $type); |
|
266 | - //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
|
267 | - //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br />"; |
|
268 | - } elseif ($existing_fields[$field] != $type) { |
|
269 | - $table->addAlteredField($field, $field . ' ' . $type); |
|
270 | - // check $fields[$field]['type'] for things like "int(10) unsigned" |
|
271 | - //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
|
272 | - //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br />"; |
|
273 | - } else { |
|
274 | - //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br />"; |
|
275 | - } |
|
276 | - } |
|
261 | + foreach ($new_fields as $field => $fieldinfo) { |
|
262 | + $type = $fieldinfo['Type']; |
|
263 | + if (!in_array($field, array_keys($existing_fields))) { |
|
264 | + //Add field as it is missing |
|
265 | + $table->addNewField($field, $type); |
|
266 | + //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type); |
|
267 | + //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br />"; |
|
268 | + } elseif ($existing_fields[$field] != $type) { |
|
269 | + $table->addAlteredField($field, $field . ' ' . $type); |
|
270 | + // check $fields[$field]['type'] for things like "int(10) unsigned" |
|
271 | + //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type); |
|
272 | + //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br />"; |
|
273 | + } else { |
|
274 | + //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br />"; |
|
275 | + } |
|
276 | + } |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
@@ -286,22 +286,22 @@ discard block |
||
286 | 286 | */ |
287 | 287 | function get_table_info($table, $default_fields) |
288 | 288 | { |
289 | - global $xoopsDB; |
|
290 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
291 | - while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
292 | - $fields[$existing_field['Field']] = $existing_field['Type']; |
|
293 | - if ($existing_field['Null'] !== 'YES') { |
|
294 | - $fields[$existing_field['Field']] .= ' NOT NULL'; |
|
295 | - } |
|
296 | - if ($existing_field['Extra']) { |
|
297 | - $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
298 | - } |
|
299 | - if ($default_fields[$existing_field['Field']]['Default']) { |
|
300 | - $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
301 | - } |
|
302 | - } |
|
289 | + global $xoopsDB; |
|
290 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table); |
|
291 | + while ($existing_field = $xoopsDB->fetchArray($result)) { |
|
292 | + $fields[$existing_field['Field']] = $existing_field['Type']; |
|
293 | + if ($existing_field['Null'] !== 'YES') { |
|
294 | + $fields[$existing_field['Field']] .= ' NOT NULL'; |
|
295 | + } |
|
296 | + if ($existing_field['Extra']) { |
|
297 | + $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra']; |
|
298 | + } |
|
299 | + if ($default_fields[$existing_field['Field']]['Default']) { |
|
300 | + $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'"; |
|
301 | + } |
|
302 | + } |
|
303 | 303 | |
304 | - return $fields; |
|
304 | + return $fields; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | /** |
@@ -315,59 +315,59 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function rename_fields(&$table, $renamed_fields, &$fields, $new_fields) |
317 | 317 | { |
318 | - foreach (array_keys($fields) as $field) { |
|
319 | - if (in_array($field, array_keys($renamed_fields))) { |
|
320 | - $new_field_name = $renamed_fields[$field]; |
|
321 | - $new_field_type = $new_fields[$new_field_name]['Type']; |
|
322 | - $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
323 | - //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
|
324 | - //echo $field." Renamed to ".$new_field_name."<br />"; |
|
325 | - $fields[$new_field_name] = $new_field_type; |
|
326 | - } |
|
327 | - } |
|
328 | - //return $fields; |
|
318 | + foreach (array_keys($fields) as $field) { |
|
319 | + if (in_array($field, array_keys($renamed_fields))) { |
|
320 | + $new_field_name = $renamed_fields[$field]; |
|
321 | + $new_field_type = $new_fields[$new_field_name]['Type']; |
|
322 | + $table->addAltered($field, $new_field_name . ' ' . $new_field_type); |
|
323 | + //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type); |
|
324 | + //echo $field." Renamed to ".$new_field_name."<br />"; |
|
325 | + $fields[$new_field_name] = $new_field_type; |
|
326 | + } |
|
327 | + } |
|
328 | + //return $fields; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | $op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0; |
332 | 332 | switch ($op) { |
333 | - case 1: |
|
334 | - // Make sure that nohtml is properly changed to dohtml |
|
335 | - invert_nohtm_dohtml_values(); |
|
336 | - // Ensure that the proper tables are present |
|
337 | - update_tables_to_300(); |
|
338 | - // Import data from MyDownloads |
|
339 | - import_mydownloads_to_wfdownloads(); |
|
340 | - break; |
|
333 | + case 1: |
|
334 | + // Make sure that nohtml is properly changed to dohtml |
|
335 | + invert_nohtm_dohtml_values(); |
|
336 | + // Ensure that the proper tables are present |
|
337 | + update_tables_to_300(); |
|
338 | + // Import data from MyDownloads |
|
339 | + import_mydownloads_to_wfdownloads(); |
|
340 | + break; |
|
341 | 341 | |
342 | - case 2: |
|
343 | - // Update WF-Downloads |
|
344 | - $log = invert_nohtm_dohtml_values(); |
|
345 | - update_tables_to_300(); |
|
346 | - break; |
|
342 | + case 2: |
|
343 | + // Update WF-Downloads |
|
344 | + $log = invert_nohtm_dohtml_values(); |
|
345 | + update_tables_to_300(); |
|
346 | + break; |
|
347 | 347 | |
348 | - default: |
|
349 | - //ask what to do |
|
350 | - include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
351 | - $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
|
348 | + default: |
|
349 | + //ask what to do |
|
350 | + include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
351 | + $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
|
352 | 352 | |
353 | - //Is MyDownloads installed? |
|
354 | - $moduleHandler = xoops_getHandler('module'); |
|
355 | - $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
|
356 | - if (is_object($mydownloadsModule)) { |
|
357 | - $mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
|
358 | - $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'"); |
|
359 | - $form->addElement($mydownloadsButton); |
|
360 | - } |
|
353 | + //Is MyDownloads installed? |
|
354 | + $moduleHandler = xoops_getHandler('module'); |
|
355 | + $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
|
356 | + if (is_object($mydownloadsModule)) { |
|
357 | + $mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
|
358 | + $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'"); |
|
359 | + $form->addElement($mydownloadsButton); |
|
360 | + } |
|
361 | 361 | |
362 | - if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
363 | - $updateButton = new XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit'); |
|
364 | - $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'"); |
|
365 | - $form->addElement($updateButton); |
|
366 | - } |
|
362 | + if (!wfdownloads_TableExists('wfdownloads_meta')) { |
|
363 | + $updateButton = new XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit'); |
|
364 | + $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'"); |
|
365 | + $form->addElement($updateButton); |
|
366 | + } |
|
367 | 367 | |
368 | - $form->addElement(new XoopsFormHidden('op', 0)); |
|
369 | - $form->display(); |
|
370 | - break; |
|
368 | + $form->addElement(new XoopsFormHidden('op', 0)); |
|
369 | + $form->display(); |
|
370 | + break; |
|
371 | 371 | } |
372 | 372 | //wfdownloads_modFooter(); |
373 | 373 | //xoops_cp_footer(); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $ret = array(); |
208 | 208 | global $xoopsDB; |
209 | 209 | $catHandler = xoops_getModuleHandler('category', 'wfdownloads'); |
210 | - $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
210 | + $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table); |
|
211 | 211 | while ($existing_field = $xoopsDB->fetchArray($result)) { |
212 | 212 | $fields[$existing_field['field']] = $existing_field['type']; |
213 | 213 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | //return $fields; |
329 | 329 | } |
330 | 330 | |
331 | -$op = isset($_REQUEST['op']) ? (int)$_REQUEST['op'] : 0; |
|
331 | +$op = isset($_REQUEST['op']) ? (int) $_REQUEST['op'] : 0; |
|
332 | 332 | switch ($op) { |
333 | 333 | case 1: |
334 | 334 | // Make sure that nohtml is properly changed to dohtml |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $form = new XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']); |
352 | 352 | |
353 | 353 | //Is MyDownloads installed? |
354 | - $moduleHandler = xoops_getHandler('module'); |
|
354 | + $moduleHandler = xoops_getHandler('module'); |
|
355 | 355 | $mydownloadsModule = $moduleHandler->getByDirname('mydownloads'); |
356 | 356 | if (is_object($mydownloadsModule)) { |
357 | 357 | $mydownloadsButton = new XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit'); |
@@ -37,6 +37,6 @@ |
||
37 | 37 | |
38 | 38 | $pathIcon16 = '../' . $xoopsModule->getInfo('icons16'); |
39 | 39 | $pathIcon32 = '../' . $xoopsModule->getInfo('icons32'); |
40 | -$pathModuleAdmin =& $xoopsModule->getInfo('dirmoduleadmin'); |
|
40 | +$pathModuleAdmin = & $xoopsModule->getInfo('dirmoduleadmin'); |
|
41 | 41 | |
42 | 42 | include_once $GLOBALS['xoops']->path($pathModuleAdmin . '/moduleadmin.php'); |
@@ -22,153 +22,153 @@ |
||
22 | 22 | */ |
23 | 23 | class SmartObjectTreeTable extends SmartObjectTable |
24 | 24 | { |
25 | - /** |
|
26 | - * SmartObjectTreeTable constructor. |
|
27 | - * @param object $objectHandler |
|
28 | - * @param bool $criteria |
|
29 | - * @param array $actions |
|
30 | - * @param bool $userSide |
|
31 | - */ |
|
32 | - public function __construct(&$objectHandler, $criteria = false, $actions = array('edit', 'delete'), $userSide = false) |
|
33 | - { |
|
34 | - $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide); |
|
35 | - $this->_isTree = true; |
|
36 | - } |
|
37 | - |
|
38 | - /** |
|
39 | - * Get children objects given a specific parentid |
|
40 | - * |
|
41 | - * @var int $parentid id of the parent which children we want to retreive |
|
42 | - * @return array of SmartObject |
|
43 | - */ |
|
44 | - public function getChildrenOf($parentid = 0) |
|
45 | - { |
|
46 | - return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @param $object |
|
51 | - * @param int $level |
|
52 | - */ |
|
53 | - public function createTableRow($object, $level = 0) |
|
54 | - { |
|
55 | - $aObject = array(); |
|
56 | - |
|
57 | - $i = 0; |
|
58 | - |
|
59 | - $aColumns = array(); |
|
60 | - $doWeHaveActions = false; |
|
61 | - |
|
62 | - foreach ($this->_columns as $column) { |
|
63 | - $aColumn = array(); |
|
64 | - |
|
65 | - if ($i == 0) { |
|
66 | - $class = 'head'; |
|
67 | - } elseif ($i % 2 == 0) { |
|
68 | - $class = 'even'; |
|
69 | - } else { |
|
70 | - $class = 'odd'; |
|
71 | - } |
|
72 | - |
|
73 | - if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
|
74 | - $method = $column->_customMethodForValue; |
|
75 | - $value = $object->$method(); |
|
76 | - } else { |
|
77 | - /** |
|
78 | - * If the column is the identifier, then put a link on it |
|
79 | - */ |
|
80 | - if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
81 | - $value = $object->getItemLink(); |
|
82 | - } else { |
|
83 | - $value = $object->getVar($column->getKeyName()); |
|
84 | - } |
|
85 | - } |
|
86 | - |
|
87 | - $space = ''; |
|
88 | - if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
89 | - for ($i = 0; $i < $level; ++$i) { |
|
90 | - $space = $space . '--'; |
|
91 | - } |
|
92 | - } |
|
93 | - |
|
94 | - if ($space != '') { |
|
95 | - $space .= ' '; |
|
96 | - } |
|
97 | - |
|
98 | - $aColumn['value'] = $space . $value; |
|
99 | - $aColumn['class'] = $class; |
|
100 | - $aColumn['width'] = $column->getWidth(); |
|
101 | - $aColumn['align'] = $column->getAlign(); |
|
102 | - $aColumn['key'] = $column->getKeyName(); |
|
103 | - |
|
104 | - $aColumns[] = $aColumn; |
|
105 | - ++$i; |
|
106 | - } |
|
107 | - |
|
108 | - $aObject['columns'] = $aColumns; |
|
109 | - |
|
110 | - $class = $class === 'even' ? 'odd' : 'even'; |
|
111 | - $aObject['class'] = $class; |
|
112 | - |
|
113 | - $actions = array(); |
|
114 | - |
|
115 | - // Adding the custom actions if any |
|
116 | - foreach ($this->_custom_actions as $action) { |
|
117 | - if (method_exists($object, $action)) { |
|
118 | - $actions[] = $object->$action(); |
|
119 | - } |
|
120 | - } |
|
121 | - |
|
122 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
123 | - $controller = new SmartObjectController($this->_objectHandler); |
|
124 | - |
|
125 | - if (in_array('edit', $this->_actions)) { |
|
126 | - $actions[] = $controller->getEditItemLink($object, false, true); |
|
127 | - } |
|
128 | - if (in_array('delete', $this->_actions)) { |
|
129 | - $actions[] = $controller->getDeleteItemLink($object, false, true); |
|
130 | - } |
|
131 | - $aObject['actions'] = $actions; |
|
132 | - |
|
133 | - $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); |
|
134 | - $aObject['id'] = $object->id(); |
|
135 | - $this->_aObjects[] = $aObject; |
|
136 | - |
|
137 | - $childrenObjects = $this->getChildrenOf($object->id()); |
|
138 | - |
|
139 | - $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; |
|
140 | - |
|
141 | - if ($childrenObjects) { |
|
142 | - ++$level; |
|
143 | - foreach ($childrenObjects as $subObject) { |
|
144 | - $this->createTableRow($subObject, $level); |
|
145 | - } |
|
146 | - } |
|
147 | - } |
|
148 | - |
|
149 | - public function createTableRows() |
|
150 | - { |
|
151 | - $this->_aObjects = array(); |
|
152 | - |
|
153 | - if (count($this->_objects) > 0) { |
|
154 | - foreach ($this->getChildrenOf() as $object) { |
|
155 | - $this->createTableRow($object); |
|
156 | - } |
|
157 | - |
|
158 | - $this->_tpl->assign('smartobject_objects', $this->_aObjects); |
|
159 | - } else { |
|
160 | - $colspan = count($this->_columns) + 1; |
|
161 | - $this->_tpl->assign('smartobject_colspan', $colspan); |
|
162 | - } |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * @return mixed |
|
167 | - */ |
|
168 | - public function fetchObjects() |
|
169 | - { |
|
170 | - $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid'); |
|
171 | - |
|
172 | - return $ret; |
|
173 | - } |
|
25 | + /** |
|
26 | + * SmartObjectTreeTable constructor. |
|
27 | + * @param object $objectHandler |
|
28 | + * @param bool $criteria |
|
29 | + * @param array $actions |
|
30 | + * @param bool $userSide |
|
31 | + */ |
|
32 | + public function __construct(&$objectHandler, $criteria = false, $actions = array('edit', 'delete'), $userSide = false) |
|
33 | + { |
|
34 | + $this->SmartObjectTable($objectHandler, $criteria, $actions, $userSide); |
|
35 | + $this->_isTree = true; |
|
36 | + } |
|
37 | + |
|
38 | + /** |
|
39 | + * Get children objects given a specific parentid |
|
40 | + * |
|
41 | + * @var int $parentid id of the parent which children we want to retreive |
|
42 | + * @return array of SmartObject |
|
43 | + */ |
|
44 | + public function getChildrenOf($parentid = 0) |
|
45 | + { |
|
46 | + return isset($this->_objects[$parentid]) ? $this->_objects[$parentid] : false; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @param $object |
|
51 | + * @param int $level |
|
52 | + */ |
|
53 | + public function createTableRow($object, $level = 0) |
|
54 | + { |
|
55 | + $aObject = array(); |
|
56 | + |
|
57 | + $i = 0; |
|
58 | + |
|
59 | + $aColumns = array(); |
|
60 | + $doWeHaveActions = false; |
|
61 | + |
|
62 | + foreach ($this->_columns as $column) { |
|
63 | + $aColumn = array(); |
|
64 | + |
|
65 | + if ($i == 0) { |
|
66 | + $class = 'head'; |
|
67 | + } elseif ($i % 2 == 0) { |
|
68 | + $class = 'even'; |
|
69 | + } else { |
|
70 | + $class = 'odd'; |
|
71 | + } |
|
72 | + |
|
73 | + if ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
|
74 | + $method = $column->_customMethodForValue; |
|
75 | + $value = $object->$method(); |
|
76 | + } else { |
|
77 | + /** |
|
78 | + * If the column is the identifier, then put a link on it |
|
79 | + */ |
|
80 | + if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
81 | + $value = $object->getItemLink(); |
|
82 | + } else { |
|
83 | + $value = $object->getVar($column->getKeyName()); |
|
84 | + } |
|
85 | + } |
|
86 | + |
|
87 | + $space = ''; |
|
88 | + if ($column->getKeyName() == $this->_objectHandler->identifierName) { |
|
89 | + for ($i = 0; $i < $level; ++$i) { |
|
90 | + $space = $space . '--'; |
|
91 | + } |
|
92 | + } |
|
93 | + |
|
94 | + if ($space != '') { |
|
95 | + $space .= ' '; |
|
96 | + } |
|
97 | + |
|
98 | + $aColumn['value'] = $space . $value; |
|
99 | + $aColumn['class'] = $class; |
|
100 | + $aColumn['width'] = $column->getWidth(); |
|
101 | + $aColumn['align'] = $column->getAlign(); |
|
102 | + $aColumn['key'] = $column->getKeyName(); |
|
103 | + |
|
104 | + $aColumns[] = $aColumn; |
|
105 | + ++$i; |
|
106 | + } |
|
107 | + |
|
108 | + $aObject['columns'] = $aColumns; |
|
109 | + |
|
110 | + $class = $class === 'even' ? 'odd' : 'even'; |
|
111 | + $aObject['class'] = $class; |
|
112 | + |
|
113 | + $actions = array(); |
|
114 | + |
|
115 | + // Adding the custom actions if any |
|
116 | + foreach ($this->_custom_actions as $action) { |
|
117 | + if (method_exists($object, $action)) { |
|
118 | + $actions[] = $object->$action(); |
|
119 | + } |
|
120 | + } |
|
121 | + |
|
122 | + include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
123 | + $controller = new SmartObjectController($this->_objectHandler); |
|
124 | + |
|
125 | + if (in_array('edit', $this->_actions)) { |
|
126 | + $actions[] = $controller->getEditItemLink($object, false, true); |
|
127 | + } |
|
128 | + if (in_array('delete', $this->_actions)) { |
|
129 | + $actions[] = $controller->getDeleteItemLink($object, false, true); |
|
130 | + } |
|
131 | + $aObject['actions'] = $actions; |
|
132 | + |
|
133 | + $this->_tpl->assign('smartobject_actions_column_width', count($actions) * 30); |
|
134 | + $aObject['id'] = $object->id(); |
|
135 | + $this->_aObjects[] = $aObject; |
|
136 | + |
|
137 | + $childrenObjects = $this->getChildrenOf($object->id()); |
|
138 | + |
|
139 | + $this->_hasActions = $this->_hasActions ? true : count($actions) > 0; |
|
140 | + |
|
141 | + if ($childrenObjects) { |
|
142 | + ++$level; |
|
143 | + foreach ($childrenObjects as $subObject) { |
|
144 | + $this->createTableRow($subObject, $level); |
|
145 | + } |
|
146 | + } |
|
147 | + } |
|
148 | + |
|
149 | + public function createTableRows() |
|
150 | + { |
|
151 | + $this->_aObjects = array(); |
|
152 | + |
|
153 | + if (count($this->_objects) > 0) { |
|
154 | + foreach ($this->getChildrenOf() as $object) { |
|
155 | + $this->createTableRow($object); |
|
156 | + } |
|
157 | + |
|
158 | + $this->_tpl->assign('smartobject_objects', $this->_aObjects); |
|
159 | + } else { |
|
160 | + $colspan = count($this->_columns) + 1; |
|
161 | + $this->_tpl->assign('smartobject_colspan', $colspan); |
|
162 | + } |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * @return mixed |
|
167 | + */ |
|
168 | + public function fetchObjects() |
|
169 | + { |
|
170 | + $ret = $this->_objectHandler->getObjects($this->_criteria, 'parentid'); |
|
171 | + |
|
172 | + return $ret; |
|
173 | + } |
|
174 | 174 | } |
@@ -37,125 +37,125 @@ discard block |
||
37 | 37 | */ |
38 | 38 | class SmartobjectRating extends SmartObject |
39 | 39 | { |
40 | - public $_modulePlugin = false; |
|
41 | - |
|
42 | - /** |
|
43 | - * SmartobjectRating constructor. |
|
44 | - */ |
|
45 | - public function __construct() |
|
46 | - { |
|
47 | - $this->quickInitVar('ratingid', XOBJ_DTYPE_INT, true); |
|
48 | - $this->quickInitVar('dirname', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME); |
|
49 | - $this->quickInitVar('item', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_ITEM); |
|
50 | - $this->quickInitVar('itemid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_ITEMID); |
|
51 | - $this->quickInitVar('uid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_UID); |
|
52 | - $this->quickInitVar('date', XOBJ_DTYPE_LTIME, true, _CO_SOBJECT_RATING_DATE); |
|
53 | - $this->quickInitVar('rate', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_RATE); |
|
54 | - |
|
55 | - $this->initNonPersistableVar('name', XOBJ_DTYPE_TXTBOX, 'user', _CO_SOBJECT_RATING_NAME); |
|
56 | - |
|
57 | - $this->setControl('dirname', array( |
|
58 | - 'handler' => 'rating', |
|
59 | - 'method' => 'getModuleList', |
|
60 | - 'onSelect' => 'submit' |
|
61 | - )); |
|
62 | - |
|
63 | - $this->setControl('item', array( |
|
64 | - 'object' => &$this, |
|
65 | - 'method' => 'getItemList' |
|
66 | - )); |
|
67 | - |
|
68 | - $this->setControl('uid', 'user'); |
|
69 | - |
|
70 | - $this->setControl('rate', array( |
|
71 | - 'handler' => 'rating', |
|
72 | - 'method' => 'getRateList' |
|
73 | - )); |
|
74 | - } |
|
75 | - |
|
76 | - /** |
|
77 | - * @param string $key |
|
78 | - * @param string $format |
|
79 | - * @return mixed |
|
80 | - */ |
|
81 | - public function getVar($key, $format = 's') |
|
82 | - { |
|
83 | - if ($format === 's' && in_array($key, array('name', 'dirname'))) { |
|
84 | - // return call_user_func(array($this, $key)); |
|
85 | - return $this->{$key}(); |
|
86 | - } |
|
87 | - |
|
88 | - return parent::getVar($key, $format); |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function name() |
|
95 | - { |
|
96 | - $ret = smart_getLinkedUnameFromId($this->getVar('uid', 'e'), true, array()); |
|
97 | - |
|
98 | - return $ret; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @return mixed |
|
103 | - */ |
|
104 | - public function dirname() |
|
105 | - { |
|
106 | - global $smartobjectRatingHandler; |
|
107 | - $moduleArray = $smartobjectRatingHandler->getModuleList(); |
|
108 | - |
|
109 | - return $moduleArray[$this->getVar('dirname', 'n')]; |
|
110 | - } |
|
111 | - |
|
112 | - /** |
|
113 | - * @return mixed |
|
114 | - */ |
|
115 | - public function getItemList() |
|
116 | - { |
|
117 | - $plugin = $this->getModulePlugin(); |
|
118 | - |
|
119 | - return $plugin->getItemList(); |
|
120 | - } |
|
121 | - |
|
122 | - /** |
|
123 | - * @return string |
|
124 | - */ |
|
125 | - public function getItemValue() |
|
126 | - { |
|
127 | - $moduleUrl = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/'; |
|
128 | - $plugin = $this->getModulePlugin(); |
|
129 | - $pluginItemInfo = $plugin->getItemInfo($this->getVar('item')); |
|
130 | - if (!$pluginItemInfo) { |
|
131 | - return ''; |
|
132 | - } |
|
133 | - $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid')); |
|
134 | - $ret = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>'; |
|
135 | - |
|
136 | - return $ret; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @return mixed |
|
141 | - */ |
|
142 | - public function getRateValue() |
|
143 | - { |
|
144 | - return $this->getVar('rate'); |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * @return bool |
|
149 | - */ |
|
150 | - public function getModulePlugin() |
|
151 | - { |
|
152 | - if (!$this->_modulePlugin) { |
|
153 | - global $smartobjectRatingHandler; |
|
154 | - $this->_modulePlugin = $smartobjectRatingHandler->pluginsObject->getPlugin($this->getVar('dirname', 'n')); |
|
155 | - } |
|
156 | - |
|
157 | - return $this->_modulePlugin; |
|
158 | - } |
|
40 | + public $_modulePlugin = false; |
|
41 | + |
|
42 | + /** |
|
43 | + * SmartobjectRating constructor. |
|
44 | + */ |
|
45 | + public function __construct() |
|
46 | + { |
|
47 | + $this->quickInitVar('ratingid', XOBJ_DTYPE_INT, true); |
|
48 | + $this->quickInitVar('dirname', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME); |
|
49 | + $this->quickInitVar('item', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_ITEM); |
|
50 | + $this->quickInitVar('itemid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_ITEMID); |
|
51 | + $this->quickInitVar('uid', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_UID); |
|
52 | + $this->quickInitVar('date', XOBJ_DTYPE_LTIME, true, _CO_SOBJECT_RATING_DATE); |
|
53 | + $this->quickInitVar('rate', XOBJ_DTYPE_INT, true, _CO_SOBJECT_RATING_RATE); |
|
54 | + |
|
55 | + $this->initNonPersistableVar('name', XOBJ_DTYPE_TXTBOX, 'user', _CO_SOBJECT_RATING_NAME); |
|
56 | + |
|
57 | + $this->setControl('dirname', array( |
|
58 | + 'handler' => 'rating', |
|
59 | + 'method' => 'getModuleList', |
|
60 | + 'onSelect' => 'submit' |
|
61 | + )); |
|
62 | + |
|
63 | + $this->setControl('item', array( |
|
64 | + 'object' => &$this, |
|
65 | + 'method' => 'getItemList' |
|
66 | + )); |
|
67 | + |
|
68 | + $this->setControl('uid', 'user'); |
|
69 | + |
|
70 | + $this->setControl('rate', array( |
|
71 | + 'handler' => 'rating', |
|
72 | + 'method' => 'getRateList' |
|
73 | + )); |
|
74 | + } |
|
75 | + |
|
76 | + /** |
|
77 | + * @param string $key |
|
78 | + * @param string $format |
|
79 | + * @return mixed |
|
80 | + */ |
|
81 | + public function getVar($key, $format = 's') |
|
82 | + { |
|
83 | + if ($format === 's' && in_array($key, array('name', 'dirname'))) { |
|
84 | + // return call_user_func(array($this, $key)); |
|
85 | + return $this->{$key}(); |
|
86 | + } |
|
87 | + |
|
88 | + return parent::getVar($key, $format); |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function name() |
|
95 | + { |
|
96 | + $ret = smart_getLinkedUnameFromId($this->getVar('uid', 'e'), true, array()); |
|
97 | + |
|
98 | + return $ret; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @return mixed |
|
103 | + */ |
|
104 | + public function dirname() |
|
105 | + { |
|
106 | + global $smartobjectRatingHandler; |
|
107 | + $moduleArray = $smartobjectRatingHandler->getModuleList(); |
|
108 | + |
|
109 | + return $moduleArray[$this->getVar('dirname', 'n')]; |
|
110 | + } |
|
111 | + |
|
112 | + /** |
|
113 | + * @return mixed |
|
114 | + */ |
|
115 | + public function getItemList() |
|
116 | + { |
|
117 | + $plugin = $this->getModulePlugin(); |
|
118 | + |
|
119 | + return $plugin->getItemList(); |
|
120 | + } |
|
121 | + |
|
122 | + /** |
|
123 | + * @return string |
|
124 | + */ |
|
125 | + public function getItemValue() |
|
126 | + { |
|
127 | + $moduleUrl = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/'; |
|
128 | + $plugin = $this->getModulePlugin(); |
|
129 | + $pluginItemInfo = $plugin->getItemInfo($this->getVar('item')); |
|
130 | + if (!$pluginItemInfo) { |
|
131 | + return ''; |
|
132 | + } |
|
133 | + $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid')); |
|
134 | + $ret = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>'; |
|
135 | + |
|
136 | + return $ret; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @return mixed |
|
141 | + */ |
|
142 | + public function getRateValue() |
|
143 | + { |
|
144 | + return $this->getVar('rate'); |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * @return bool |
|
149 | + */ |
|
150 | + public function getModulePlugin() |
|
151 | + { |
|
152 | + if (!$this->_modulePlugin) { |
|
153 | + global $smartobjectRatingHandler; |
|
154 | + $this->_modulePlugin = $smartobjectRatingHandler->pluginsObject->getPlugin($this->getVar('dirname', 'n')); |
|
155 | + } |
|
156 | + |
|
157 | + return $this->_modulePlugin; |
|
158 | + } |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -163,93 +163,93 @@ discard block |
||
163 | 163 | */ |
164 | 164 | class SmartobjectRatingHandler extends SmartPersistableObjectHandler |
165 | 165 | { |
166 | - public $_rateOptions = array(); |
|
167 | - public $_moduleList = false; |
|
168 | - public $pluginsObject; |
|
169 | - |
|
170 | - /** |
|
171 | - * SmartobjectRatingHandler constructor. |
|
172 | - * @param XoopsDatabase $db |
|
173 | - */ |
|
174 | - public function __construct($db) |
|
175 | - { |
|
176 | - parent::__construct($db, 'rating', 'ratingid', 'rate', '', 'smartobject'); |
|
177 | - $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid'; |
|
178 | - |
|
179 | - $this->_rateOptions[1] = 1; |
|
180 | - $this->_rateOptions[2] = 2; |
|
181 | - $this->_rateOptions[3] = 3; |
|
182 | - $this->_rateOptions[4] = 4; |
|
183 | - $this->_rateOptions[5] = 5; |
|
184 | - |
|
185 | - $this->pluginsObject = new SmartPluginHandler(); |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * @return bool |
|
190 | - */ |
|
191 | - public function getModuleList() |
|
192 | - { |
|
193 | - if (!$this->_moduleList) { |
|
194 | - $moduleArray = $this->pluginsObject->getPluginsArray(); |
|
195 | - $this->_moduleList[0] = _CO_SOBJECT_MAKE_SELECTION; |
|
196 | - foreach ($moduleArray as $k => $v) { |
|
197 | - $this->_moduleList[$k] = $v; |
|
198 | - } |
|
199 | - } |
|
200 | - |
|
201 | - return $this->_moduleList; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * @return array |
|
206 | - */ |
|
207 | - public function getRateList() |
|
208 | - { |
|
209 | - return $this->_rateOptions; |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * @param $itemid |
|
214 | - * @param $dirname |
|
215 | - * @param $item |
|
216 | - * @return int |
|
217 | - */ |
|
218 | - public function getRatingAverageByItemId($itemid, $dirname, $item) |
|
219 | - { |
|
220 | - $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
221 | - $result = $this->db->query($sql); |
|
222 | - if (!$result) { |
|
223 | - return 0; |
|
224 | - } |
|
225 | - list($average, $sum) = $this->db->fetchRow($result); |
|
226 | - $ret['average'] = isset($average) ? $average : 0; |
|
227 | - $ret['sum'] = isset($sum) ? $sum : 0; |
|
228 | - |
|
229 | - return $ret; |
|
230 | - } |
|
231 | - |
|
232 | - /** |
|
233 | - * @param $item |
|
234 | - * @param $itemid |
|
235 | - * @param $dirname |
|
236 | - * @param $uid |
|
237 | - * @return bool |
|
238 | - */ |
|
239 | - public function already_rated($item, $itemid, $dirname, $uid) |
|
240 | - { |
|
241 | - $criteria = new CriteriaCompo(); |
|
242 | - $criteria->add(new Criteria('item', $item)); |
|
243 | - $criteria->add(new Criteria('itemid', $itemid)); |
|
244 | - $criteria->add(new Criteria('dirname', $dirname)); |
|
245 | - $criteria->add(new Criteria('user.uid', $uid)); |
|
246 | - |
|
247 | - $ret = $this->getObjects($criteria); |
|
248 | - |
|
249 | - if (!$ret) { |
|
250 | - return false; |
|
251 | - } else { |
|
252 | - return $ret[0]; |
|
253 | - } |
|
254 | - } |
|
166 | + public $_rateOptions = array(); |
|
167 | + public $_moduleList = false; |
|
168 | + public $pluginsObject; |
|
169 | + |
|
170 | + /** |
|
171 | + * SmartobjectRatingHandler constructor. |
|
172 | + * @param XoopsDatabase $db |
|
173 | + */ |
|
174 | + public function __construct($db) |
|
175 | + { |
|
176 | + parent::__construct($db, 'rating', 'ratingid', 'rate', '', 'smartobject'); |
|
177 | + $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid'; |
|
178 | + |
|
179 | + $this->_rateOptions[1] = 1; |
|
180 | + $this->_rateOptions[2] = 2; |
|
181 | + $this->_rateOptions[3] = 3; |
|
182 | + $this->_rateOptions[4] = 4; |
|
183 | + $this->_rateOptions[5] = 5; |
|
184 | + |
|
185 | + $this->pluginsObject = new SmartPluginHandler(); |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * @return bool |
|
190 | + */ |
|
191 | + public function getModuleList() |
|
192 | + { |
|
193 | + if (!$this->_moduleList) { |
|
194 | + $moduleArray = $this->pluginsObject->getPluginsArray(); |
|
195 | + $this->_moduleList[0] = _CO_SOBJECT_MAKE_SELECTION; |
|
196 | + foreach ($moduleArray as $k => $v) { |
|
197 | + $this->_moduleList[$k] = $v; |
|
198 | + } |
|
199 | + } |
|
200 | + |
|
201 | + return $this->_moduleList; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * @return array |
|
206 | + */ |
|
207 | + public function getRateList() |
|
208 | + { |
|
209 | + return $this->_rateOptions; |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * @param $itemid |
|
214 | + * @param $dirname |
|
215 | + * @param $item |
|
216 | + * @return int |
|
217 | + */ |
|
218 | + public function getRatingAverageByItemId($itemid, $dirname, $item) |
|
219 | + { |
|
220 | + $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
221 | + $result = $this->db->query($sql); |
|
222 | + if (!$result) { |
|
223 | + return 0; |
|
224 | + } |
|
225 | + list($average, $sum) = $this->db->fetchRow($result); |
|
226 | + $ret['average'] = isset($average) ? $average : 0; |
|
227 | + $ret['sum'] = isset($sum) ? $sum : 0; |
|
228 | + |
|
229 | + return $ret; |
|
230 | + } |
|
231 | + |
|
232 | + /** |
|
233 | + * @param $item |
|
234 | + * @param $itemid |
|
235 | + * @param $dirname |
|
236 | + * @param $uid |
|
237 | + * @return bool |
|
238 | + */ |
|
239 | + public function already_rated($item, $itemid, $dirname, $uid) |
|
240 | + { |
|
241 | + $criteria = new CriteriaCompo(); |
|
242 | + $criteria->add(new Criteria('item', $item)); |
|
243 | + $criteria->add(new Criteria('itemid', $itemid)); |
|
244 | + $criteria->add(new Criteria('dirname', $dirname)); |
|
245 | + $criteria->add(new Criteria('user.uid', $uid)); |
|
246 | + |
|
247 | + $ret = $this->getObjects($criteria); |
|
248 | + |
|
249 | + if (!$ret) { |
|
250 | + return false; |
|
251 | + } else { |
|
252 | + return $ret[0]; |
|
253 | + } |
|
254 | + } |
|
255 | 255 | } |
@@ -9,66 +9,66 @@ |
||
9 | 9 | |
10 | 10 | class SmartAddto |
11 | 11 | { |
12 | - public $_layout; |
|
13 | - public $_method; |
|
12 | + public $_layout; |
|
13 | + public $_method; |
|
14 | 14 | |
15 | - /** |
|
16 | - * Constructor of SmartAddTo |
|
17 | - * |
|
18 | - * @param int $layout 0=Horizontal 1 row, 1=Horizontal 2 rows, 2=Vertical with icons, 3=Vertical no icons |
|
19 | - * @param int $method 0=directpage, 1=popup |
|
20 | - */ |
|
21 | - public function __construct($layout = 0, $method = 1) |
|
22 | - { |
|
23 | - $layout = (int)$layout; |
|
24 | - if ($layout < 0 || $layout > 3) { |
|
25 | - $layout = 0; |
|
26 | - } |
|
27 | - $this->_layout = $layout; |
|
15 | + /** |
|
16 | + * Constructor of SmartAddTo |
|
17 | + * |
|
18 | + * @param int $layout 0=Horizontal 1 row, 1=Horizontal 2 rows, 2=Vertical with icons, 3=Vertical no icons |
|
19 | + * @param int $method 0=directpage, 1=popup |
|
20 | + */ |
|
21 | + public function __construct($layout = 0, $method = 1) |
|
22 | + { |
|
23 | + $layout = (int)$layout; |
|
24 | + if ($layout < 0 || $layout > 3) { |
|
25 | + $layout = 0; |
|
26 | + } |
|
27 | + $this->_layout = $layout; |
|
28 | 28 | |
29 | - $method = (int)$method; |
|
30 | - if ($method < 0 || $method > 1) { |
|
31 | - $method = 1; |
|
32 | - } |
|
33 | - $this->_method = $method; |
|
34 | - } |
|
29 | + $method = (int)$method; |
|
30 | + if ($method < 0 || $method > 1) { |
|
31 | + $method = 1; |
|
32 | + } |
|
33 | + $this->_method = $method; |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param bool $fetchOnly |
|
38 | - * @return mixed|string|void |
|
39 | - */ |
|
40 | - public function render($fetchOnly = false) |
|
41 | - { |
|
42 | - global $xoTheme, $xoopsTpl; |
|
36 | + /** |
|
37 | + * @param bool $fetchOnly |
|
38 | + * @return mixed|string|void |
|
39 | + */ |
|
40 | + public function render($fetchOnly = false) |
|
41 | + { |
|
42 | + global $xoTheme, $xoopsTpl; |
|
43 | 43 | |
44 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
44 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
45 | 45 | |
46 | - $xoopsTpl->assign('smartobject_addto_method', $this->_method); |
|
47 | - $xoopsTpl->assign('smartobject_addto_layout', $this->_layout); |
|
46 | + $xoopsTpl->assign('smartobject_addto_method', $this->_method); |
|
47 | + $xoopsTpl->assign('smartobject_addto_layout', $this->_layout); |
|
48 | 48 | |
49 | - $xoopsTpl->assign('smartobject_addto_url', SMARTOBJECT_URL . 'include/addto/'); |
|
49 | + $xoopsTpl->assign('smartobject_addto_url', SMARTOBJECT_URL . 'include/addto/'); |
|
50 | 50 | |
51 | - if ($fetchOnly) { |
|
52 | - return $xoopsTpl->fetch('db:smartobject_addto.tpl'); |
|
53 | - } else { |
|
54 | - $xoopsTpl->display('db:smartobject_addto.tpl'); |
|
55 | - } |
|
56 | - } |
|
51 | + if ($fetchOnly) { |
|
52 | + return $xoopsTpl->fetch('db:smartobject_addto.tpl'); |
|
53 | + } else { |
|
54 | + $xoopsTpl->display('db:smartobject_addto.tpl'); |
|
55 | + } |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return array |
|
60 | - */ |
|
61 | - public function renderForBlock() |
|
62 | - { |
|
63 | - global $xoTheme; |
|
58 | + /** |
|
59 | + * @return array |
|
60 | + */ |
|
61 | + public function renderForBlock() |
|
62 | + { |
|
63 | + global $xoTheme; |
|
64 | 64 | |
65 | - $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
65 | + $xoTheme->addStylesheet(SMARTOBJECT_URL . 'include/addto/addto.css'); |
|
66 | 66 | |
67 | - $block = array(); |
|
68 | - $block['smartobject_addto_method'] = $this->_method; |
|
69 | - $block['smartobject_addto_layout'] = $this->_layout; |
|
70 | - $block['smartobject_addto_url'] = SMARTOBJECT_URL . 'include/addto/'; |
|
67 | + $block = array(); |
|
68 | + $block['smartobject_addto_method'] = $this->_method; |
|
69 | + $block['smartobject_addto_layout'] = $this->_layout; |
|
70 | + $block['smartobject_addto_url'] = SMARTOBJECT_URL . 'include/addto/'; |
|
71 | 71 | |
72 | - return $block; |
|
73 | - } |
|
72 | + return $block; |
|
73 | + } |
|
74 | 74 | } |
@@ -20,13 +20,13 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($layout = 0, $method = 1) |
22 | 22 | { |
23 | - $layout = (int)$layout; |
|
23 | + $layout = (int) $layout; |
|
24 | 24 | if ($layout < 0 || $layout > 3) { |
25 | 25 | $layout = 0; |
26 | 26 | } |
27 | 27 | $this->_layout = $layout; |
28 | 28 | |
29 | - $method = (int)$method; |
|
29 | + $method = (int) $method; |
|
30 | 30 | if ($method < 0 || $method > 1) { |
31 | 31 | $method = 1; |
32 | 32 | } |
@@ -8,14 +8,14 @@ discard block |
||
8 | 8 | */ |
9 | 9 | class SmartobjectFile extends SmartobjectBasedUrl |
10 | 10 | { |
11 | - /** |
|
12 | - * SmartobjectFile constructor. |
|
13 | - */ |
|
14 | - public function __construct() |
|
15 | - { |
|
16 | - parent::__construct(); |
|
17 | - $this->quickInitVar('fileid', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME); |
|
18 | - } |
|
11 | + /** |
|
12 | + * SmartobjectFile constructor. |
|
13 | + */ |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + parent::__construct(); |
|
17 | + $this->quickInitVar('fileid', XOBJ_DTYPE_TXTBOX, true, _CO_SOBJECT_RATING_DIRNAME); |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | class SmartobjectFileHandler extends SmartPersistableObjectHandler |
25 | 25 | { |
26 | - /** |
|
27 | - * SmartobjectFileHandler constructor. |
|
28 | - * @param object|XoopsDatabase $db |
|
29 | - */ |
|
30 | - public function __construct($db) |
|
31 | - { |
|
32 | - parent::__construct($db, 'file', 'fileid', 'caption', 'desc', 'smartobject'); |
|
33 | - } |
|
26 | + /** |
|
27 | + * SmartobjectFileHandler constructor. |
|
28 | + * @param object|XoopsDatabase $db |
|
29 | + */ |
|
30 | + public function __construct($db) |
|
31 | + { |
|
32 | + parent::__construct($db, 'file', 'fileid', 'caption', 'desc', 'smartobject'); |
|
33 | + } |
|
34 | 34 | } |
@@ -10,45 +10,45 @@ |
||
10 | 10 | |
11 | 11 | class SmartTip |
12 | 12 | { |
13 | - public $id; |
|
14 | - public $caption; |
|
15 | - public $message; |
|
16 | - public $visible; |
|
17 | - public $_tpl; |
|
13 | + public $id; |
|
14 | + public $caption; |
|
15 | + public $message; |
|
16 | + public $visible; |
|
17 | + public $_tpl; |
|
18 | 18 | |
19 | - /** |
|
20 | - * SmartTip constructor. |
|
21 | - * @param $id |
|
22 | - * @param $caption |
|
23 | - * @param $message |
|
24 | - * @param bool $visible |
|
25 | - */ |
|
26 | - public function __construct($id, $caption, $message, $visible = false) |
|
27 | - { |
|
28 | - $this->id = $id; |
|
29 | - $this->caption = $caption; |
|
30 | - $this->message = $message; |
|
31 | - $this->visible = $visible; |
|
32 | - $this->_tpl = new XoopsTpl(); |
|
33 | - } |
|
19 | + /** |
|
20 | + * SmartTip constructor. |
|
21 | + * @param $id |
|
22 | + * @param $caption |
|
23 | + * @param $message |
|
24 | + * @param bool $visible |
|
25 | + */ |
|
26 | + public function __construct($id, $caption, $message, $visible = false) |
|
27 | + { |
|
28 | + $this->id = $id; |
|
29 | + $this->caption = $caption; |
|
30 | + $this->message = $message; |
|
31 | + $this->visible = $visible; |
|
32 | + $this->_tpl = new XoopsTpl(); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param bool $outputNow |
|
37 | - * @return mixed|string|void |
|
38 | - */ |
|
39 | - public function render($outputNow = true) |
|
40 | - { |
|
41 | - $aTip = array( |
|
42 | - 'id' => $this->id, |
|
43 | - 'caption' => $this->caption, |
|
44 | - 'message' => $this->message, |
|
45 | - 'visible' => $this->visible ? 'block' : 'none' |
|
46 | - ); |
|
47 | - $this->_tpl->assign('tip', $aTip); |
|
48 | - if ($outputNow) { |
|
49 | - $this->_tpl->display('db:smartobject_tip.tpl'); |
|
50 | - } else { |
|
51 | - return $this->_tpl->fetch('db:smartobject_tip.tpl'); |
|
52 | - } |
|
53 | - } |
|
35 | + /** |
|
36 | + * @param bool $outputNow |
|
37 | + * @return mixed|string|void |
|
38 | + */ |
|
39 | + public function render($outputNow = true) |
|
40 | + { |
|
41 | + $aTip = array( |
|
42 | + 'id' => $this->id, |
|
43 | + 'caption' => $this->caption, |
|
44 | + 'message' => $this->message, |
|
45 | + 'visible' => $this->visible ? 'block' : 'none' |
|
46 | + ); |
|
47 | + $this->_tpl->assign('tip', $aTip); |
|
48 | + if ($outputNow) { |
|
49 | + $this->_tpl->display('db:smartobject_tip.tpl'); |
|
50 | + } else { |
|
51 | + return $this->_tpl->fetch('db:smartobject_tip.tpl'); |
|
52 | + } |
|
53 | + } |
|
54 | 54 | } |