@@ -41,90 +41,90 @@ |
||
41 | 41 | //$moddir = $xoopsModule->getvar("dirname"); |
42 | 42 | $couponid = isset($_GET['couponid']) ? (int)$_GET['couponid'] : 0; |
43 | 43 | if (isset($_POST['itemid'])) { |
44 | - $itemid = (int)$_POST['itemid']; |
|
44 | + $itemid = (int)$_POST['itemid']; |
|
45 | 45 | } elseif (isset($_GET['item'])) { |
46 | - $itemid = (int)$_GET['item']; |
|
46 | + $itemid = (int)$_GET['item']; |
|
47 | 47 | } else { |
48 | - $itemid = 0; |
|
48 | + $itemid = 0; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (empty($xoopsUser) || !$xoopsUser->isAdmin($xoopsModule->mid()) || ($itemid == 0 && empty($_POST['delete']))) { |
52 | - redirect_header('index.php', 3, _NOPERM); |
|
53 | - exit(); |
|
52 | + redirect_header('index.php', 3, _NOPERM); |
|
53 | + exit(); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | if (isset($_POST['lbr'])) { |
57 | - $lbr = (int)$_POST['lbr']; |
|
57 | + $lbr = (int)$_POST['lbr']; |
|
58 | 58 | } else { |
59 | - $lbr = 0; |
|
59 | + $lbr = 0; |
|
60 | 60 | } |
61 | 61 | if ($couponid > 0) { |
62 | - $coupon = new efqCouponHandler(); |
|
63 | - $coupon->get($couponid); |
|
64 | - //$couponid = $coupon->couponid; |
|
65 | - $myts = MyTextSanitizer::getInstance(); |
|
66 | - $lbr = $coupon->lbr; |
|
67 | - $description = $coupon->descr; |
|
68 | - $image = $coupon->image; |
|
69 | - $heading = $coupon->heading; |
|
70 | - $publish = $coupon->publish > 0 ? $coupon->publish : time(); |
|
71 | - $expire = $coupon->expire; |
|
72 | - $dohtml = 1; |
|
73 | - $dobr = $lbr; |
|
74 | - if ($expire > 0) { |
|
75 | - $setexpire = 1; |
|
76 | - } else { |
|
77 | - $setexpire = 0; |
|
78 | - $expire = time() + 3600 * 24 * 7; |
|
79 | - } |
|
62 | + $coupon = new efqCouponHandler(); |
|
63 | + $coupon->get($couponid); |
|
64 | + //$couponid = $coupon->couponid; |
|
65 | + $myts = MyTextSanitizer::getInstance(); |
|
66 | + $lbr = $coupon->lbr; |
|
67 | + $description = $coupon->descr; |
|
68 | + $image = $coupon->image; |
|
69 | + $heading = $coupon->heading; |
|
70 | + $publish = $coupon->publish > 0 ? $coupon->publish : time(); |
|
71 | + $expire = $coupon->expire; |
|
72 | + $dohtml = 1; |
|
73 | + $dobr = $lbr; |
|
74 | + if ($expire > 0) { |
|
75 | + $setexpire = 1; |
|
76 | + } else { |
|
77 | + $setexpire = 0; |
|
78 | + $expire = time() + 3600 * 24 * 7; |
|
79 | + } |
|
80 | 80 | } else { |
81 | - $itemid = isset($_POST['itemid']) ? (int)$_POST['itemid'] : (isset($_GET['item']) ? (int)$_GET['item'] : 0); |
|
82 | - $couponid = isset($_POST['couponid']) ? (int)$_POST['couponid'] : null; |
|
83 | - $description = isset($_POST['description']) ? $_POST['description'] : ''; |
|
84 | - $publish = isset($_POST['publish']) ? $_POST['publish'] : 0; |
|
85 | - $image = isset($_POST['image']) ? $_POST['image'] : ''; |
|
86 | - $expire = isset($_POST['expire']) ? $_POST['expire'] : 0; |
|
87 | - $heading = isset($_POST['heading']) ? $_POST['heading'] : ''; |
|
88 | - if ($expire > 0) { |
|
89 | - $setexpire = 1; |
|
90 | - } else { |
|
91 | - $setexpire = 0; |
|
92 | - $expire = time() + 3600 * 24 * 7; |
|
93 | - } |
|
81 | + $itemid = isset($_POST['itemid']) ? (int)$_POST['itemid'] : (isset($_GET['item']) ? (int)$_GET['item'] : 0); |
|
82 | + $couponid = isset($_POST['couponid']) ? (int)$_POST['couponid'] : null; |
|
83 | + $description = isset($_POST['description']) ? $_POST['description'] : ''; |
|
84 | + $publish = isset($_POST['publish']) ? $_POST['publish'] : 0; |
|
85 | + $image = isset($_POST['image']) ? $_POST['image'] : ''; |
|
86 | + $expire = isset($_POST['expire']) ? $_POST['expire'] : 0; |
|
87 | + $heading = isset($_POST['heading']) ? $_POST['heading'] : ''; |
|
88 | + if ($expire > 0) { |
|
89 | + $setexpire = 1; |
|
90 | + } else { |
|
91 | + $setexpire = 0; |
|
92 | + $expire = time() + 3600 * 24 * 7; |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | if (!empty($_POST['submit'])) { |
97 | - $coupon = new efqCouponHandler(); |
|
98 | - if (isset($_POST['couponid'])) { |
|
99 | - $couponid = (int)$_POST['couponid']; |
|
100 | - $message = _MD_COUPONEDITED; |
|
101 | - } else { |
|
102 | - $coupon->_new = true; |
|
103 | - $message = _MD_COUPONADDED; |
|
104 | - } |
|
105 | - if (!$coupon->create()) { |
|
106 | - $coupon->message = _MD_ERR_ADDCOUPON; |
|
107 | - } |
|
108 | - redirect_header('listing.php?item=' . $itemid, 2, $coupon->message); |
|
109 | - exit(); |
|
97 | + $coupon = new efqCouponHandler(); |
|
98 | + if (isset($_POST['couponid'])) { |
|
99 | + $couponid = (int)$_POST['couponid']; |
|
100 | + $message = _MD_COUPONEDITED; |
|
101 | + } else { |
|
102 | + $coupon->_new = true; |
|
103 | + $message = _MD_COUPONADDED; |
|
104 | + } |
|
105 | + if (!$coupon->create()) { |
|
106 | + $coupon->message = _MD_ERR_ADDCOUPON; |
|
107 | + } |
|
108 | + redirect_header('listing.php?item=' . $itemid, 2, $coupon->message); |
|
109 | + exit(); |
|
110 | 110 | } elseif (!empty($_POST['delete'])) { |
111 | - if (!empty($_POST['ok'])) { |
|
112 | - if (empty($_POST['couponid'])) { |
|
113 | - redirect_header('index.php', 2, _MD_ERR_COUPONIDMISSING); |
|
114 | - exit(); |
|
115 | - } |
|
116 | - $coupon = new efqCouponHandler(); |
|
117 | - $couponid = (int)$_POST['couponid']; |
|
118 | - if ($coupon->delete($couponid)) { |
|
119 | - redirect_header('listing.php?item=' . $itemid, 2, _MD_COUPONDELETED); |
|
120 | - exit(); |
|
121 | - } |
|
122 | - } else { |
|
123 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
124 | - xoops_confirm(array('delete' => 'yes', 'couponid' => $couponid, 'ok' => 1), 'addcoupon.php?item=' . $itemid . '', _MD_COUPONRUSURE); |
|
125 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
126 | - exit(); |
|
127 | - } |
|
111 | + if (!empty($_POST['ok'])) { |
|
112 | + if (empty($_POST['couponid'])) { |
|
113 | + redirect_header('index.php', 2, _MD_ERR_COUPONIDMISSING); |
|
114 | + exit(); |
|
115 | + } |
|
116 | + $coupon = new efqCouponHandler(); |
|
117 | + $couponid = (int)$_POST['couponid']; |
|
118 | + if ($coupon->delete($couponid)) { |
|
119 | + redirect_header('listing.php?item=' . $itemid, 2, _MD_COUPONDELETED); |
|
120 | + exit(); |
|
121 | + } |
|
122 | + } else { |
|
123 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
124 | + xoops_confirm(array('delete' => 'yes', 'couponid' => $couponid, 'ok' => 1), 'addcoupon.php?item=' . $itemid . '', _MD_COUPONRUSURE); |
|
125 | + require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
126 | + exit(); |
|
127 | + } |
|
128 | 128 | } |
129 | 129 | include XOOPS_ROOT_PATH . '/header.php'; |
130 | 130 | include __DIR__ . '/include/couponform.php'; |
@@ -23,27 +23,27 @@ discard block |
||
23 | 23 | * Accessible to listing owners and administrators only. |
24 | 24 | */ |
25 | 25 | |
26 | -include __DIR__ . '/header.php'; |
|
26 | +include __DIR__.'/header.php'; |
|
27 | 27 | $myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
28 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
29 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
30 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
31 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
32 | -require_once __DIR__ . '/class/class.formimage.php'; |
|
33 | -require_once __DIR__ . '/class/class.image.php'; |
|
34 | -require_once __DIR__ . '/class/class.couponhandler.php'; |
|
28 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
29 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
30 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
31 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
32 | +require_once __DIR__.'/class/class.formimage.php'; |
|
33 | +require_once __DIR__.'/class/class.image.php'; |
|
34 | +require_once __DIR__.'/class/class.couponhandler.php'; |
|
35 | 35 | |
36 | 36 | $eh = new ErrorHandler; //ErrorHandler object |
37 | 37 | |
38 | 38 | $moddir = $xoopsModule->getVar('dirname'); |
39 | -$mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
39 | +$mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
40 | 40 | |
41 | 41 | //$moddir = $xoopsModule->getvar("dirname"); |
42 | -$couponid = isset($_GET['couponid']) ? (int)$_GET['couponid'] : 0; |
|
42 | +$couponid = isset($_GET['couponid']) ? (int) $_GET['couponid'] : 0; |
|
43 | 43 | if (isset($_POST['itemid'])) { |
44 | - $itemid = (int)$_POST['itemid']; |
|
44 | + $itemid = (int) $_POST['itemid']; |
|
45 | 45 | } elseif (isset($_GET['item'])) { |
46 | - $itemid = (int)$_GET['item']; |
|
46 | + $itemid = (int) $_GET['item']; |
|
47 | 47 | } else { |
48 | 48 | $itemid = 0; |
49 | 49 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | if (isset($_POST['lbr'])) { |
57 | - $lbr = (int)$_POST['lbr']; |
|
57 | + $lbr = (int) $_POST['lbr']; |
|
58 | 58 | } else { |
59 | 59 | $lbr = 0; |
60 | 60 | } |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $expire = time() + 3600 * 24 * 7; |
79 | 79 | } |
80 | 80 | } else { |
81 | - $itemid = isset($_POST['itemid']) ? (int)$_POST['itemid'] : (isset($_GET['item']) ? (int)$_GET['item'] : 0); |
|
82 | - $couponid = isset($_POST['couponid']) ? (int)$_POST['couponid'] : null; |
|
81 | + $itemid = isset($_POST['itemid']) ? (int) $_POST['itemid'] : (isset($_GET['item']) ? (int) $_GET['item'] : 0); |
|
82 | + $couponid = isset($_POST['couponid']) ? (int) $_POST['couponid'] : null; |
|
83 | 83 | $description = isset($_POST['description']) ? $_POST['description'] : ''; |
84 | 84 | $publish = isset($_POST['publish']) ? $_POST['publish'] : 0; |
85 | 85 | $image = isset($_POST['image']) ? $_POST['image'] : ''; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if (!empty($_POST['submit'])) { |
97 | 97 | $coupon = new efqCouponHandler(); |
98 | 98 | if (isset($_POST['couponid'])) { |
99 | - $couponid = (int)$_POST['couponid']; |
|
99 | + $couponid = (int) $_POST['couponid']; |
|
100 | 100 | $message = _MD_COUPONEDITED; |
101 | 101 | } else { |
102 | 102 | $coupon->_new = true; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if (!$coupon->create()) { |
106 | 106 | $coupon->message = _MD_ERR_ADDCOUPON; |
107 | 107 | } |
108 | - redirect_header('listing.php?item=' . $itemid, 2, $coupon->message); |
|
108 | + redirect_header('listing.php?item='.$itemid, 2, $coupon->message); |
|
109 | 109 | exit(); |
110 | 110 | } elseif (!empty($_POST['delete'])) { |
111 | 111 | if (!empty($_POST['ok'])) { |
@@ -114,18 +114,18 @@ discard block |
||
114 | 114 | exit(); |
115 | 115 | } |
116 | 116 | $coupon = new efqCouponHandler(); |
117 | - $couponid = (int)$_POST['couponid']; |
|
117 | + $couponid = (int) $_POST['couponid']; |
|
118 | 118 | if ($coupon->delete($couponid)) { |
119 | - redirect_header('listing.php?item=' . $itemid, 2, _MD_COUPONDELETED); |
|
119 | + redirect_header('listing.php?item='.$itemid, 2, _MD_COUPONDELETED); |
|
120 | 120 | exit(); |
121 | 121 | } |
122 | 122 | } else { |
123 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
124 | - xoops_confirm(array('delete' => 'yes', 'couponid' => $couponid, 'ok' => 1), 'addcoupon.php?item=' . $itemid . '', _MD_COUPONRUSURE); |
|
125 | - require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
123 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
124 | + xoops_confirm(array('delete' => 'yes', 'couponid' => $couponid, 'ok' => 1), 'addcoupon.php?item='.$itemid.'', _MD_COUPONRUSURE); |
|
125 | + require_once XOOPS_ROOT_PATH.'/footer.php'; |
|
126 | 126 | exit(); |
127 | 127 | } |
128 | 128 | } |
129 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
130 | -include __DIR__ . '/include/couponform.php'; |
|
131 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
129 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
130 | +include __DIR__.'/include/couponform.php'; |
|
131 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
@@ -50,35 +50,35 @@ discard block |
||
50 | 50 | |
51 | 51 | // Tables created by sql file (without prefix!) |
52 | 52 | $modversion['tables'] = array( |
53 | - $moduleDirName . '_' . 'cat', |
|
54 | - $moduleDirName . '_' . 'cat_txt', |
|
55 | - $moduleDirName . '_' . 'data', |
|
56 | - $moduleDirName . '_' . 'dir', |
|
57 | - $moduleDirName . '_' . 'item_x_cat', |
|
58 | - $moduleDirName . '_' . 'item_x_loc', |
|
59 | - $moduleDirName . '_' . 'items', |
|
60 | - $moduleDirName . '_' . 'item_text', |
|
61 | - $moduleDirName . '_' . 'item_img', |
|
62 | - $moduleDirName . '_' . 'itemtypes', |
|
63 | - $moduleDirName . '_' . 'fieldtypes', |
|
64 | - $moduleDirName . '_' . 'dtypes', |
|
65 | - $moduleDirName . '_' . 'dtypes_x_cat', |
|
66 | - $moduleDirName . '_' . 'coupon', |
|
67 | - $moduleDirName . '_' . 'loc',//In case not used in combo with destinations mod. |
|
68 | - $moduleDirName . '_' . 'loc_types',//In case not used in combo with destinations mod. |
|
69 | - $moduleDirName . '_' . 'loc_x_loctype',//In case not used in combo with destinations mod. |
|
70 | - $moduleDirName . '_' . 'votedata', |
|
71 | - //$moduleDirName . '_' . = "loc_x_address_types", |
|
72 | - $moduleDirName . '_' . 'form_options', |
|
73 | - $moduleDirName . '_' . 'address_types', |
|
74 | - $moduleDirName . '_' . 'searchresults', |
|
75 | - $moduleDirName . '_' . 'subscr_offers', |
|
76 | - $moduleDirName . '_' . 'subscr_orders', |
|
77 | - $moduleDirName . '_' . 'subscr_payments', |
|
78 | - $moduleDirName . '_' . 'subscr_scheduler', |
|
79 | - $moduleDirName . '_' . 'subscr_notify', |
|
80 | - $moduleDirName . '_' . 'cat_tpl', |
|
81 | - $moduleDirName . '_' . 'tpl', |
|
53 | + $moduleDirName . '_' . 'cat', |
|
54 | + $moduleDirName . '_' . 'cat_txt', |
|
55 | + $moduleDirName . '_' . 'data', |
|
56 | + $moduleDirName . '_' . 'dir', |
|
57 | + $moduleDirName . '_' . 'item_x_cat', |
|
58 | + $moduleDirName . '_' . 'item_x_loc', |
|
59 | + $moduleDirName . '_' . 'items', |
|
60 | + $moduleDirName . '_' . 'item_text', |
|
61 | + $moduleDirName . '_' . 'item_img', |
|
62 | + $moduleDirName . '_' . 'itemtypes', |
|
63 | + $moduleDirName . '_' . 'fieldtypes', |
|
64 | + $moduleDirName . '_' . 'dtypes', |
|
65 | + $moduleDirName . '_' . 'dtypes_x_cat', |
|
66 | + $moduleDirName . '_' . 'coupon', |
|
67 | + $moduleDirName . '_' . 'loc',//In case not used in combo with destinations mod. |
|
68 | + $moduleDirName . '_' . 'loc_types',//In case not used in combo with destinations mod. |
|
69 | + $moduleDirName . '_' . 'loc_x_loctype',//In case not used in combo with destinations mod. |
|
70 | + $moduleDirName . '_' . 'votedata', |
|
71 | + //$moduleDirName . '_' . = "loc_x_address_types", |
|
72 | + $moduleDirName . '_' . 'form_options', |
|
73 | + $moduleDirName . '_' . 'address_types', |
|
74 | + $moduleDirName . '_' . 'searchresults', |
|
75 | + $moduleDirName . '_' . 'subscr_offers', |
|
76 | + $moduleDirName . '_' . 'subscr_orders', |
|
77 | + $moduleDirName . '_' . 'subscr_payments', |
|
78 | + $moduleDirName . '_' . 'subscr_scheduler', |
|
79 | + $moduleDirName . '_' . 'subscr_notify', |
|
80 | + $moduleDirName . '_' . 'cat_tpl', |
|
81 | + $moduleDirName . '_' . 'tpl', |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | // Admin things |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | |
90 | 90 | // ------------------- Help files ------------------- // |
91 | 91 | $modversion['helpsection'] = array( |
92 | - ['name' => _MI_EFQDIR_OVERVIEW, 'link' => 'page=help'], |
|
93 | - ['name' => _MI_EFQDIR_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
94 | - ['name' => _MI_EFQDIR_LICENSE, 'link' => 'page=license'], |
|
95 | - ['name' => _MI_EFQDIR_SUPPORT, 'link' => 'page=support'], |
|
92 | + ['name' => _MI_EFQDIR_OVERVIEW, 'link' => 'page=help'], |
|
93 | + ['name' => _MI_EFQDIR_DISCLAIMER, 'link' => 'page=disclaimer'], |
|
94 | + ['name' => _MI_EFQDIR_LICENSE, 'link' => 'page=license'], |
|
95 | + ['name' => _MI_EFQDIR_SUPPORT, 'link' => 'page=support'], |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | // Blocks |
@@ -50,35 +50,35 @@ |
||
50 | 50 | |
51 | 51 | // Tables created by sql file (without prefix!) |
52 | 52 | $modversion['tables'] = array( |
53 | - $moduleDirName . '_' . 'cat', |
|
54 | - $moduleDirName . '_' . 'cat_txt', |
|
55 | - $moduleDirName . '_' . 'data', |
|
56 | - $moduleDirName . '_' . 'dir', |
|
57 | - $moduleDirName . '_' . 'item_x_cat', |
|
58 | - $moduleDirName . '_' . 'item_x_loc', |
|
59 | - $moduleDirName . '_' . 'items', |
|
60 | - $moduleDirName . '_' . 'item_text', |
|
61 | - $moduleDirName . '_' . 'item_img', |
|
62 | - $moduleDirName . '_' . 'itemtypes', |
|
63 | - $moduleDirName . '_' . 'fieldtypes', |
|
64 | - $moduleDirName . '_' . 'dtypes', |
|
65 | - $moduleDirName . '_' . 'dtypes_x_cat', |
|
66 | - $moduleDirName . '_' . 'coupon', |
|
67 | - $moduleDirName . '_' . 'loc',//In case not used in combo with destinations mod. |
|
68 | - $moduleDirName . '_' . 'loc_types',//In case not used in combo with destinations mod. |
|
69 | - $moduleDirName . '_' . 'loc_x_loctype',//In case not used in combo with destinations mod. |
|
70 | - $moduleDirName . '_' . 'votedata', |
|
53 | + $moduleDirName.'_'.'cat', |
|
54 | + $moduleDirName.'_'.'cat_txt', |
|
55 | + $moduleDirName.'_'.'data', |
|
56 | + $moduleDirName.'_'.'dir', |
|
57 | + $moduleDirName.'_'.'item_x_cat', |
|
58 | + $moduleDirName.'_'.'item_x_loc', |
|
59 | + $moduleDirName.'_'.'items', |
|
60 | + $moduleDirName.'_'.'item_text', |
|
61 | + $moduleDirName.'_'.'item_img', |
|
62 | + $moduleDirName.'_'.'itemtypes', |
|
63 | + $moduleDirName.'_'.'fieldtypes', |
|
64 | + $moduleDirName.'_'.'dtypes', |
|
65 | + $moduleDirName.'_'.'dtypes_x_cat', |
|
66 | + $moduleDirName.'_'.'coupon', |
|
67 | + $moduleDirName.'_'.'loc', //In case not used in combo with destinations mod. |
|
68 | + $moduleDirName.'_'.'loc_types', //In case not used in combo with destinations mod. |
|
69 | + $moduleDirName.'_'.'loc_x_loctype', //In case not used in combo with destinations mod. |
|
70 | + $moduleDirName.'_'.'votedata', |
|
71 | 71 | //$moduleDirName . '_' . = "loc_x_address_types", |
72 | - $moduleDirName . '_' . 'form_options', |
|
73 | - $moduleDirName . '_' . 'address_types', |
|
74 | - $moduleDirName . '_' . 'searchresults', |
|
75 | - $moduleDirName . '_' . 'subscr_offers', |
|
76 | - $moduleDirName . '_' . 'subscr_orders', |
|
77 | - $moduleDirName . '_' . 'subscr_payments', |
|
78 | - $moduleDirName . '_' . 'subscr_scheduler', |
|
79 | - $moduleDirName . '_' . 'subscr_notify', |
|
80 | - $moduleDirName . '_' . 'cat_tpl', |
|
81 | - $moduleDirName . '_' . 'tpl', |
|
72 | + $moduleDirName.'_'.'form_options', |
|
73 | + $moduleDirName.'_'.'address_types', |
|
74 | + $moduleDirName.'_'.'searchresults', |
|
75 | + $moduleDirName.'_'.'subscr_offers', |
|
76 | + $moduleDirName.'_'.'subscr_orders', |
|
77 | + $moduleDirName.'_'.'subscr_payments', |
|
78 | + $moduleDirName.'_'.'subscr_scheduler', |
|
79 | + $moduleDirName.'_'.'subscr_notify', |
|
80 | + $moduleDirName.'_'.'cat_tpl', |
|
81 | + $moduleDirName.'_'.'tpl', |
|
82 | 82 | ); |
83 | 83 | |
84 | 84 | // Admin things |
@@ -24,108 +24,108 @@ |
||
24 | 24 | $moddir = $xoopsModule->getVar('dirname'); |
25 | 25 | |
26 | 26 | if (!empty($_POST['submit'])) { |
27 | - $eh = new ErrorHandler; //ErrorHandler object |
|
28 | - if (empty($xoopsUser)) { |
|
29 | - $ratinguser = 0; |
|
30 | - } else { |
|
31 | - $ratinguser = $xoopsUser->getVar('uid'); |
|
32 | - } |
|
27 | + $eh = new ErrorHandler; //ErrorHandler object |
|
28 | + if (empty($xoopsUser)) { |
|
29 | + $ratinguser = 0; |
|
30 | + } else { |
|
31 | + $ratinguser = $xoopsUser->getVar('uid'); |
|
32 | + } |
|
33 | 33 | |
34 | - //Make sure only 1 anonymous from an IP in a single day. |
|
35 | - $anonwaitdays = $xoopsModuleConfig['anonvotes_waitdays']; |
|
36 | - $ip = getenv('REMOTE_ADDR'); |
|
37 | - $p_itemid = (int)$_POST['item']; |
|
38 | - $p_catid = (int)$_POST['catid']; |
|
39 | - $p_rating = (int)$_POST['rating']; |
|
34 | + //Make sure only 1 anonymous from an IP in a single day. |
|
35 | + $anonwaitdays = $xoopsModuleConfig['anonvotes_waitdays']; |
|
36 | + $ip = getenv('REMOTE_ADDR'); |
|
37 | + $p_itemid = (int)$_POST['item']; |
|
38 | + $p_catid = (int)$_POST['catid']; |
|
39 | + $p_rating = (int)$_POST['rating']; |
|
40 | 40 | |
41 | - // Check if Rating is Null |
|
42 | - if ($p_rating == '--') { |
|
43 | - redirect_header('ratelisting.php?catid=' . $p_catid . '&item=' . $itemid . '', 2, _MD_NORATING); |
|
44 | - exit(); |
|
45 | - } |
|
41 | + // Check if Rating is Null |
|
42 | + if ($p_rating == '--') { |
|
43 | + redirect_header('ratelisting.php?catid=' . $p_catid . '&item=' . $itemid . '', 2, _MD_NORATING); |
|
44 | + exit(); |
|
45 | + } |
|
46 | 46 | |
47 | - // Check if Link POSTER is voting (UNLESS Anonymous users allowed to post) |
|
48 | - if ($ratinguser != 0) { |
|
49 | - $result = $xoopsDB->query('select submitter from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " where itemid=$p_itemid"); |
|
50 | - while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) { |
|
51 | - if ($ratinguserDB == $ratinguser) { |
|
52 | - redirect_header('index.php', 4, _MD_CANTVOTEOWN); |
|
53 | - exit(); |
|
54 | - } |
|
55 | - } |
|
47 | + // Check if Link POSTER is voting (UNLESS Anonymous users allowed to post) |
|
48 | + if ($ratinguser != 0) { |
|
49 | + $result = $xoopsDB->query('select submitter from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " where itemid=$p_itemid"); |
|
50 | + while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) { |
|
51 | + if ($ratinguserDB == $ratinguser) { |
|
52 | + redirect_header('index.php', 4, _MD_CANTVOTEOWN); |
|
53 | + exit(); |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - // Check if REG user is trying to vote twice. |
|
58 | - $result = $xoopsDB->query('select ratinguser from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . " where itemid=$p_itemid"); |
|
59 | - while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) { |
|
60 | - if ($ratinguserDB == $ratinguser) { |
|
61 | - redirect_header('index.php', 4, _MD_VOTEONCE2); |
|
62 | - exit(); |
|
63 | - } |
|
64 | - } |
|
65 | - } else { |
|
57 | + // Check if REG user is trying to vote twice. |
|
58 | + $result = $xoopsDB->query('select ratinguser from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . " where itemid=$p_itemid"); |
|
59 | + while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) { |
|
60 | + if ($ratinguserDB == $ratinguser) { |
|
61 | + redirect_header('index.php', 4, _MD_VOTEONCE2); |
|
62 | + exit(); |
|
63 | + } |
|
64 | + } |
|
65 | + } else { |
|
66 | 66 | |
67 | - // Check if ANONYMOUS user is trying to vote more than once per day. |
|
68 | - $yesterday = (time() - (86400 * $anonwaitdays)); |
|
69 | - $result = $xoopsDB->query('select count(*) FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . " WHERE itemid=$p_itemid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); |
|
70 | - list($anonvotecount) = $xoopsDB->fetchRow($result); |
|
71 | - if ($anonvotecount > 0) { |
|
72 | - redirect_header('index.php', 4, _MD_VOTEONCE2); |
|
73 | - exit(); |
|
74 | - } |
|
75 | - } |
|
76 | - if ($rating > 10) { |
|
77 | - $rating = 10; |
|
78 | - } |
|
67 | + // Check if ANONYMOUS user is trying to vote more than once per day. |
|
68 | + $yesterday = (time() - (86400 * $anonwaitdays)); |
|
69 | + $result = $xoopsDB->query('select count(*) FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . " WHERE itemid=$p_itemid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); |
|
70 | + list($anonvotecount) = $xoopsDB->fetchRow($result); |
|
71 | + if ($anonvotecount > 0) { |
|
72 | + redirect_header('index.php', 4, _MD_VOTEONCE2); |
|
73 | + exit(); |
|
74 | + } |
|
75 | + } |
|
76 | + if ($rating > 10) { |
|
77 | + $rating = 10; |
|
78 | + } |
|
79 | 79 | |
80 | - //Add to Line Item Rate to DB. |
|
81 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . '_ratingid_seq'); |
|
82 | - $datetime = time(); |
|
83 | - $sql = sprintf("INSERT INTO %s (ratingid, itemid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata'), $newid, $p_itemid, $ratinguser, $p_rating, $ip, $datetime); |
|
84 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
80 | + //Add to Line Item Rate to DB. |
|
81 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . '_ratingid_seq'); |
|
82 | + $datetime = time(); |
|
83 | + $sql = sprintf("INSERT INTO %s (ratingid, itemid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata'), $newid, $p_itemid, $ratinguser, $p_rating, $ip, $datetime); |
|
84 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
85 | 85 | |
86 | - //Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. |
|
87 | - updaterating($p_itemid); |
|
88 | - if (!empty($_POST['catid'])) { |
|
89 | - $p_catid = (int)$_POST['catid']; |
|
90 | - } else { |
|
91 | - $p_catid = 0; |
|
92 | - } |
|
93 | - if (!empty($_POST['dirid'])) { |
|
94 | - $p_dirid = (int)$_POST['dirid']; |
|
95 | - } else { |
|
96 | - $p_dirid = 0; |
|
97 | - } |
|
98 | - if ($p_dirid == 0) { |
|
99 | - $dirid = getDirIdFromItem($p_itemid); |
|
100 | - } else { |
|
101 | - $dirid = $p_dirid; |
|
102 | - } |
|
103 | - $ratemessage = _MD_VOTEAPPRE . '<br>' . sprintf(_MD_THANKURATE, $xoopsConfig['sitename']); |
|
104 | - redirect_header('index.php?dirid=' . $dirid . '', 2, $ratemessage); |
|
105 | - exit(); |
|
86 | + //Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. |
|
87 | + updaterating($p_itemid); |
|
88 | + if (!empty($_POST['catid'])) { |
|
89 | + $p_catid = (int)$_POST['catid']; |
|
90 | + } else { |
|
91 | + $p_catid = 0; |
|
92 | + } |
|
93 | + if (!empty($_POST['dirid'])) { |
|
94 | + $p_dirid = (int)$_POST['dirid']; |
|
95 | + } else { |
|
96 | + $p_dirid = 0; |
|
97 | + } |
|
98 | + if ($p_dirid == 0) { |
|
99 | + $dirid = getDirIdFromItem($p_itemid); |
|
100 | + } else { |
|
101 | + $dirid = $p_dirid; |
|
102 | + } |
|
103 | + $ratemessage = _MD_VOTEAPPRE . '<br>' . sprintf(_MD_THANKURATE, $xoopsConfig['sitename']); |
|
104 | + redirect_header('index.php?dirid=' . $dirid . '', 2, $ratemessage); |
|
105 | + exit(); |
|
106 | 106 | } else { |
107 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_ratelisting.tpl'; |
|
108 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
109 | - if (isset($_GET['item'])) { |
|
110 | - $get_itemid = (int)$_GET['item']; |
|
111 | - } else { |
|
112 | - $get_itemid = '0'; |
|
113 | - } |
|
114 | - if (isset($_GET['catid'])) { |
|
115 | - $get_catid = (int)$_GET['catid']; |
|
116 | - } else { |
|
117 | - $get_catid = '0'; |
|
118 | - } |
|
107 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_ratelisting.tpl'; |
|
108 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
109 | + if (isset($_GET['item'])) { |
|
110 | + $get_itemid = (int)$_GET['item']; |
|
111 | + } else { |
|
112 | + $get_itemid = '0'; |
|
113 | + } |
|
114 | + if (isset($_GET['catid'])) { |
|
115 | + $get_catid = (int)$_GET['catid']; |
|
116 | + } else { |
|
117 | + $get_catid = '0'; |
|
118 | + } |
|
119 | 119 | |
120 | - $result = $xoopsDB->query('select title from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_listings') . " where itemid=$get_itemid"); |
|
121 | - list($title) = $xoopsDB->fetchRow($result); |
|
122 | - $xoopsTpl->assign('listing', array('itemid' => $get_itemid, 'catid' => $get_catid, 'title' => $myts->htmlSpecialChars($title))); |
|
123 | - $xoopsTpl->assign('moddir', $moddir); |
|
124 | - $xoopsTpl->assign('lang_voteonce', _MD_VOTEONCE); |
|
125 | - $xoopsTpl->assign('lang_ratingscale', _MD_RATINGSCALE); |
|
126 | - $xoopsTpl->assign('lang_beobjective', _MD_BEOBJECTIVE); |
|
127 | - $xoopsTpl->assign('lang_donotvote', _MD_DONOTVOTE); |
|
128 | - $xoopsTpl->assign('lang_rateit', _MD_RATEIT); |
|
129 | - $xoopsTpl->assign('lang_cancel', _CANCEL); |
|
130 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
120 | + $result = $xoopsDB->query('select title from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_listings') . " where itemid=$get_itemid"); |
|
121 | + list($title) = $xoopsDB->fetchRow($result); |
|
122 | + $xoopsTpl->assign('listing', array('itemid' => $get_itemid, 'catid' => $get_catid, 'title' => $myts->htmlSpecialChars($title))); |
|
123 | + $xoopsTpl->assign('moddir', $moddir); |
|
124 | + $xoopsTpl->assign('lang_voteonce', _MD_VOTEONCE); |
|
125 | + $xoopsTpl->assign('lang_ratingscale', _MD_RATINGSCALE); |
|
126 | + $xoopsTpl->assign('lang_beobjective', _MD_BEOBJECTIVE); |
|
127 | + $xoopsTpl->assign('lang_donotvote', _MD_DONOTVOTE); |
|
128 | + $xoopsTpl->assign('lang_rateit', _MD_RATEIT); |
|
129 | + $xoopsTpl->assign('lang_cancel', _CANCEL); |
|
130 | + include XOOPS_ROOT_PATH . '/footer.php'; |
|
131 | 131 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | * @author XOOPS Development Team, |
19 | 19 | */ |
20 | 20 | |
21 | -include __DIR__ . '/header.php'; |
|
22 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
21 | +include __DIR__.'/header.php'; |
|
22 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
23 | 23 | $myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
24 | 24 | $moddir = $xoopsModule->getVar('dirname'); |
25 | 25 | |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | //Make sure only 1 anonymous from an IP in a single day. |
35 | 35 | $anonwaitdays = $xoopsModuleConfig['anonvotes_waitdays']; |
36 | 36 | $ip = getenv('REMOTE_ADDR'); |
37 | - $p_itemid = (int)$_POST['item']; |
|
38 | - $p_catid = (int)$_POST['catid']; |
|
39 | - $p_rating = (int)$_POST['rating']; |
|
37 | + $p_itemid = (int) $_POST['item']; |
|
38 | + $p_catid = (int) $_POST['catid']; |
|
39 | + $p_rating = (int) $_POST['rating']; |
|
40 | 40 | |
41 | 41 | // Check if Rating is Null |
42 | 42 | if ($p_rating == '--') { |
43 | - redirect_header('ratelisting.php?catid=' . $p_catid . '&item=' . $itemid . '', 2, _MD_NORATING); |
|
43 | + redirect_header('ratelisting.php?catid='.$p_catid.'&item='.$itemid.'', 2, _MD_NORATING); |
|
44 | 44 | exit(); |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Check if Link POSTER is voting (UNLESS Anonymous users allowed to post) |
48 | 48 | if ($ratinguser != 0) { |
49 | - $result = $xoopsDB->query('select submitter from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " where itemid=$p_itemid"); |
|
49 | + $result = $xoopsDB->query('select submitter from '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items')." where itemid=$p_itemid"); |
|
50 | 50 | while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) { |
51 | 51 | if ($ratinguserDB == $ratinguser) { |
52 | 52 | redirect_header('index.php', 4, _MD_CANTVOTEOWN); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | // Check if REG user is trying to vote twice. |
58 | - $result = $xoopsDB->query('select ratinguser from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . " where itemid=$p_itemid"); |
|
58 | + $result = $xoopsDB->query('select ratinguser from '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_votedata')." where itemid=$p_itemid"); |
|
59 | 59 | while (list($ratinguserDB) = $xoopsDB->fetchRow($result)) { |
60 | 60 | if ($ratinguserDB == $ratinguser) { |
61 | 61 | redirect_header('index.php', 4, _MD_VOTEONCE2); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | // Check if ANONYMOUS user is trying to vote more than once per day. |
68 | 68 | $yesterday = (time() - (86400 * $anonwaitdays)); |
69 | - $result = $xoopsDB->query('select count(*) FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . " WHERE itemid=$p_itemid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); |
|
69 | + $result = $xoopsDB->query('select count(*) FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_votedata')." WHERE itemid=$p_itemid AND ratinguser=0 AND ratinghostname = '$ip' AND ratingtimestamp > $yesterday"); |
|
70 | 70 | list($anonvotecount) = $xoopsDB->fetchRow($result); |
71 | 71 | if ($anonvotecount > 0) { |
72 | 72 | redirect_header('index.php', 4, _MD_VOTEONCE2); |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | //Add to Line Item Rate to DB. |
81 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . '_ratingid_seq'); |
|
81 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n').'_votedata').'_ratingid_seq'); |
|
82 | 82 | $datetime = time(); |
83 | - $sql = sprintf("INSERT INTO %s (ratingid, itemid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata'), $newid, $p_itemid, $ratinguser, $p_rating, $ip, $datetime); |
|
83 | + $sql = sprintf("INSERT INTO %s (ratingid, itemid, ratinguser, rating, ratinghostname, ratingtimestamp) VALUES (%u, %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n').'_votedata'), $newid, $p_itemid, $ratinguser, $p_rating, $ip, $datetime); |
|
84 | 84 | $xoopsDB->query($sql) or $eh->show('0013'); |
85 | 85 | |
86 | 86 | //Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. |
87 | 87 | updaterating($p_itemid); |
88 | 88 | if (!empty($_POST['catid'])) { |
89 | - $p_catid = (int)$_POST['catid']; |
|
89 | + $p_catid = (int) $_POST['catid']; |
|
90 | 90 | } else { |
91 | 91 | $p_catid = 0; |
92 | 92 | } |
93 | 93 | if (!empty($_POST['dirid'])) { |
94 | - $p_dirid = (int)$_POST['dirid']; |
|
94 | + $p_dirid = (int) $_POST['dirid']; |
|
95 | 95 | } else { |
96 | 96 | $p_dirid = 0; |
97 | 97 | } |
@@ -100,24 +100,24 @@ discard block |
||
100 | 100 | } else { |
101 | 101 | $dirid = $p_dirid; |
102 | 102 | } |
103 | - $ratemessage = _MD_VOTEAPPRE . '<br>' . sprintf(_MD_THANKURATE, $xoopsConfig['sitename']); |
|
104 | - redirect_header('index.php?dirid=' . $dirid . '', 2, $ratemessage); |
|
103 | + $ratemessage = _MD_VOTEAPPRE.'<br>'.sprintf(_MD_THANKURATE, $xoopsConfig['sitename']); |
|
104 | + redirect_header('index.php?dirid='.$dirid.'', 2, $ratemessage); |
|
105 | 105 | exit(); |
106 | 106 | } else { |
107 | 107 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_ratelisting.tpl'; |
108 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
108 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
109 | 109 | if (isset($_GET['item'])) { |
110 | - $get_itemid = (int)$_GET['item']; |
|
110 | + $get_itemid = (int) $_GET['item']; |
|
111 | 111 | } else { |
112 | 112 | $get_itemid = '0'; |
113 | 113 | } |
114 | 114 | if (isset($_GET['catid'])) { |
115 | - $get_catid = (int)$_GET['catid']; |
|
115 | + $get_catid = (int) $_GET['catid']; |
|
116 | 116 | } else { |
117 | 117 | $get_catid = '0'; |
118 | 118 | } |
119 | 119 | |
120 | - $result = $xoopsDB->query('select title from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_listings') . " where itemid=$get_itemid"); |
|
120 | + $result = $xoopsDB->query('select title from '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_listings')." where itemid=$get_itemid"); |
|
121 | 121 | list($title) = $xoopsDB->fetchRow($result); |
122 | 122 | $xoopsTpl->assign('listing', array('itemid' => $get_itemid, 'catid' => $get_catid, 'title' => $myts->htmlSpecialChars($title))); |
123 | 123 | $xoopsTpl->assign('moddir', $moddir); |
@@ -127,5 +127,5 @@ discard block |
||
127 | 127 | $xoopsTpl->assign('lang_donotvote', _MD_DONOTVOTE); |
128 | 128 | $xoopsTpl->assign('lang_rateit', _MD_RATEIT); |
129 | 129 | $xoopsTpl->assign('lang_cancel', _CANCEL); |
130 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
130 | + include XOOPS_ROOT_PATH.'/footer.php'; |
|
131 | 131 | } |
@@ -19,69 +19,69 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function create_local_variables() |
21 | 21 | { |
22 | - $array_name = array(); |
|
23 | - $variables = array( |
|
24 | - 'business', |
|
25 | - 'receiver_email', |
|
26 | - 'receiver_id', |
|
27 | - 'item_name', |
|
28 | - 'item_number', |
|
29 | - 'quantity', |
|
30 | - 'invoice', |
|
31 | - 'custom', |
|
32 | - 'memo', |
|
33 | - 'tax', |
|
34 | - 'option_selection1', |
|
35 | - 'option_name1', |
|
36 | - 'option_selection2', |
|
37 | - 'option_name2', |
|
38 | - 'num_cart_items', |
|
39 | - 'mc_gross', |
|
40 | - 'mc_fee', |
|
41 | - 'mc_currency', |
|
42 | - 'settle_amount', |
|
43 | - 'settle_currency', |
|
44 | - 'exchange_rate', |
|
45 | - 'payment_gross', |
|
46 | - 'payment_fee', |
|
47 | - 'payment_status', |
|
48 | - 'pending_reason', |
|
49 | - 'reason_code', |
|
50 | - 'payment_date', |
|
51 | - 'txn_id', |
|
52 | - 'txn_type', |
|
53 | - 'payment_type', |
|
54 | - 'for_auction', |
|
55 | - 'auction_buyer_id', |
|
56 | - 'auction_closing_date', |
|
57 | - 'auction_multi_item', |
|
58 | - 'first_name', |
|
59 | - 'last_name', |
|
60 | - 'payer_business_name', |
|
61 | - 'address_name', |
|
62 | - 'address_street', |
|
63 | - 'address_city', |
|
64 | - 'address_state', |
|
65 | - 'address_zip', |
|
66 | - 'address_country', |
|
67 | - 'address_status', |
|
68 | - 'payer_email', |
|
69 | - 'payer_id', |
|
70 | - 'payer_status', |
|
71 | - 'notify_version', |
|
72 | - 'verify_sign' |
|
73 | - ); |
|
74 | - |
|
75 | - foreach ($variables as $k => $v) { |
|
76 | - if (isset($_POST[$v])) { |
|
77 | - $array_name[$v] = "$_POST[$v]"; |
|
78 | - } else { |
|
79 | - $array_name[$v] = ''; |
|
80 | - } |
|
81 | - } |
|
82 | - |
|
83 | - //print_r($array_name); |
|
84 | - return $array_name; |
|
22 | + $array_name = array(); |
|
23 | + $variables = array( |
|
24 | + 'business', |
|
25 | + 'receiver_email', |
|
26 | + 'receiver_id', |
|
27 | + 'item_name', |
|
28 | + 'item_number', |
|
29 | + 'quantity', |
|
30 | + 'invoice', |
|
31 | + 'custom', |
|
32 | + 'memo', |
|
33 | + 'tax', |
|
34 | + 'option_selection1', |
|
35 | + 'option_name1', |
|
36 | + 'option_selection2', |
|
37 | + 'option_name2', |
|
38 | + 'num_cart_items', |
|
39 | + 'mc_gross', |
|
40 | + 'mc_fee', |
|
41 | + 'mc_currency', |
|
42 | + 'settle_amount', |
|
43 | + 'settle_currency', |
|
44 | + 'exchange_rate', |
|
45 | + 'payment_gross', |
|
46 | + 'payment_fee', |
|
47 | + 'payment_status', |
|
48 | + 'pending_reason', |
|
49 | + 'reason_code', |
|
50 | + 'payment_date', |
|
51 | + 'txn_id', |
|
52 | + 'txn_type', |
|
53 | + 'payment_type', |
|
54 | + 'for_auction', |
|
55 | + 'auction_buyer_id', |
|
56 | + 'auction_closing_date', |
|
57 | + 'auction_multi_item', |
|
58 | + 'first_name', |
|
59 | + 'last_name', |
|
60 | + 'payer_business_name', |
|
61 | + 'address_name', |
|
62 | + 'address_street', |
|
63 | + 'address_city', |
|
64 | + 'address_state', |
|
65 | + 'address_zip', |
|
66 | + 'address_country', |
|
67 | + 'address_status', |
|
68 | + 'payer_email', |
|
69 | + 'payer_id', |
|
70 | + 'payer_status', |
|
71 | + 'notify_version', |
|
72 | + 'verify_sign' |
|
73 | + ); |
|
74 | + |
|
75 | + foreach ($variables as $k => $v) { |
|
76 | + if (isset($_POST[$v])) { |
|
77 | + $array_name[$v] = "$_POST[$v]"; |
|
78 | + } else { |
|
79 | + $array_name[$v] = ''; |
|
80 | + } |
|
81 | + } |
|
82 | + |
|
83 | + //print_r($array_name); |
|
84 | + return $array_name; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | //post transaction data using curl |
@@ -93,23 +93,23 @@ discard block |
||
93 | 93 | */ |
94 | 94 | function curlPost($url, $data) |
95 | 95 | { |
96 | - global $paypal, $info; |
|
96 | + global $paypal, $info; |
|
97 | 97 | |
98 | - //build post string |
|
98 | + //build post string |
|
99 | 99 | |
100 | - foreach ($data as $i => $v) { |
|
101 | - $postdata .= $i . '=' . urlencode($v) . '&'; |
|
102 | - } |
|
100 | + foreach ($data as $i => $v) { |
|
101 | + $postdata .= $i . '=' . urlencode($v) . '&'; |
|
102 | + } |
|
103 | 103 | |
104 | - $postdata .= 'cmd=_notify-validate'; |
|
104 | + $postdata .= 'cmd=_notify-validate'; |
|
105 | 105 | |
106 | - //execute curl on the command line |
|
106 | + //execute curl on the command line |
|
107 | 107 | |
108 | - exec("$paypal[curl_location] -d \"$postdata\" $url", $info); |
|
108 | + exec("$paypal[curl_location] -d \"$postdata\" $url", $info); |
|
109 | 109 | |
110 | - $info = implode(',', $info); |
|
110 | + $info = implode(',', $info); |
|
111 | 111 | |
112 | - return $info; |
|
112 | + return $info; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | //posts transaction data using libCurl |
@@ -121,33 +121,33 @@ discard block |
||
121 | 121 | */ |
122 | 122 | function libCurlPost($url, $data) |
123 | 123 | { |
124 | - //build post string |
|
124 | + //build post string |
|
125 | 125 | |
126 | - foreach ($data as $i => $v) { |
|
127 | - $postdata .= $i . '=' . urlencode($v) . '&'; |
|
128 | - } |
|
126 | + foreach ($data as $i => $v) { |
|
127 | + $postdata .= $i . '=' . urlencode($v) . '&'; |
|
128 | + } |
|
129 | 129 | |
130 | - $postdata .= 'cmd=_notify-validate'; |
|
130 | + $postdata .= 'cmd=_notify-validate'; |
|
131 | 131 | |
132 | - $ch = curl_init(); |
|
132 | + $ch = curl_init(); |
|
133 | 133 | |
134 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
135 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
136 | - curl_setopt($ch, CURLOPT_POST, 1); |
|
137 | - curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); |
|
134 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
|
135 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
136 | + curl_setopt($ch, CURLOPT_POST, 1); |
|
137 | + curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); |
|
138 | 138 | |
139 | - //Start ob to prevent curl_exec from displaying stuff. |
|
140 | - ob_start(); |
|
141 | - curl_exec($ch); |
|
139 | + //Start ob to prevent curl_exec from displaying stuff. |
|
140 | + ob_start(); |
|
141 | + curl_exec($ch); |
|
142 | 142 | |
143 | - //Get contents of output buffer |
|
144 | - $info = ob_get_contents(); |
|
145 | - curl_close($ch); |
|
143 | + //Get contents of output buffer |
|
144 | + $info = ob_get_contents(); |
|
145 | + curl_close($ch); |
|
146 | 146 | |
147 | - //End ob and erase contents. |
|
148 | - ob_end_clean(); |
|
147 | + //End ob and erase contents. |
|
148 | + ob_end_clean(); |
|
149 | 149 | |
150 | - return $info; |
|
150 | + return $info; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | //posts transaction data using fsockopen. |
@@ -158,60 +158,60 @@ discard block |
||
158 | 158 | */ |
159 | 159 | function fsockPost($url, $data) |
160 | 160 | { |
161 | - //Parse url |
|
162 | - $web = parse_url($url); |
|
163 | - |
|
164 | - $postdata = ''; |
|
165 | - //build post string |
|
166 | - foreach ($data as $i => $v) { |
|
167 | - $postdata .= $i . '=' . urlencode($v) . '&'; |
|
168 | - } |
|
169 | - |
|
170 | - $postdata .= 'cmd=_notify-validate'; |
|
171 | - |
|
172 | - //Set the port number |
|
173 | - if ($web['scheme'] === 'https') { |
|
174 | - $web['port'] = '443'; |
|
175 | - $ssl = 'ssl://'; |
|
176 | - } else { |
|
177 | - $web['port'] = '80'; |
|
178 | - } |
|
179 | - |
|
180 | - //Create paypal connection |
|
181 | - $fp = @fsockopen($ssl . $web['host'], $web['port'], $errnum, $errstr, 30); |
|
182 | - |
|
183 | - //Error checking |
|
184 | - if (!$fp) { |
|
185 | - echo "$errnum: $errstr"; |
|
186 | - } //Post Data |
|
187 | - else { |
|
188 | - fwrite($fp, "POST $web[path] HTTP/1.1\r\n"); |
|
189 | - fwrite($fp, "Host: $web[host]\r\n"); |
|
190 | - fwrite($fp, "Content-type: application/x-www-form-urlencoded\r\n"); |
|
191 | - fwrite($fp, 'Content-length: ' . strlen($postdata) . "\r\n"); |
|
192 | - fwrite($fp, "Connection: close\r\n\r\n"); |
|
193 | - fwrite($fp, $postdata . "\r\n\r\n"); |
|
194 | - |
|
195 | - //loop through the response from the server |
|
196 | - while (!feof($fp)) { |
|
197 | - $info[] = @fgets($fp, 1024); |
|
198 | - } |
|
199 | - |
|
200 | - //close fp - we are done with it |
|
201 | - fclose($fp); |
|
202 | - |
|
203 | - //break up results into a string |
|
204 | - $info = implode(',', $info); |
|
205 | - } |
|
206 | - |
|
207 | - return $info; |
|
161 | + //Parse url |
|
162 | + $web = parse_url($url); |
|
163 | + |
|
164 | + $postdata = ''; |
|
165 | + //build post string |
|
166 | + foreach ($data as $i => $v) { |
|
167 | + $postdata .= $i . '=' . urlencode($v) . '&'; |
|
168 | + } |
|
169 | + |
|
170 | + $postdata .= 'cmd=_notify-validate'; |
|
171 | + |
|
172 | + //Set the port number |
|
173 | + if ($web['scheme'] === 'https') { |
|
174 | + $web['port'] = '443'; |
|
175 | + $ssl = 'ssl://'; |
|
176 | + } else { |
|
177 | + $web['port'] = '80'; |
|
178 | + } |
|
179 | + |
|
180 | + //Create paypal connection |
|
181 | + $fp = @fsockopen($ssl . $web['host'], $web['port'], $errnum, $errstr, 30); |
|
182 | + |
|
183 | + //Error checking |
|
184 | + if (!$fp) { |
|
185 | + echo "$errnum: $errstr"; |
|
186 | + } //Post Data |
|
187 | + else { |
|
188 | + fwrite($fp, "POST $web[path] HTTP/1.1\r\n"); |
|
189 | + fwrite($fp, "Host: $web[host]\r\n"); |
|
190 | + fwrite($fp, "Content-type: application/x-www-form-urlencoded\r\n"); |
|
191 | + fwrite($fp, 'Content-length: ' . strlen($postdata) . "\r\n"); |
|
192 | + fwrite($fp, "Connection: close\r\n\r\n"); |
|
193 | + fwrite($fp, $postdata . "\r\n\r\n"); |
|
194 | + |
|
195 | + //loop through the response from the server |
|
196 | + while (!feof($fp)) { |
|
197 | + $info[] = @fgets($fp, 1024); |
|
198 | + } |
|
199 | + |
|
200 | + //close fp - we are done with it |
|
201 | + fclose($fp); |
|
202 | + |
|
203 | + //break up results into a string |
|
204 | + $info = implode(',', $info); |
|
205 | + } |
|
206 | + |
|
207 | + return $info; |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | //Display Paypal Hidden Variables |
211 | 211 | |
212 | 212 | function showVariables() |
213 | 213 | { |
214 | - global $paypal; ?> |
|
214 | + global $paypal; ?> |
|
215 | 215 | |
216 | 216 | <!-- PayPal Configuration --> |
217 | 217 | <input type="hidden" name="business" value="<?= $paypal['business'] ?>"> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | //build post string |
99 | 99 | |
100 | 100 | foreach ($data as $i => $v) { |
101 | - $postdata .= $i . '=' . urlencode($v) . '&'; |
|
101 | + $postdata .= $i.'='.urlencode($v).'&'; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $postdata .= 'cmd=_notify-validate'; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | //build post string |
125 | 125 | |
126 | 126 | foreach ($data as $i => $v) { |
127 | - $postdata .= $i . '=' . urlencode($v) . '&'; |
|
127 | + $postdata .= $i.'='.urlencode($v).'&'; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | $postdata .= 'cmd=_notify-validate'; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $postdata = ''; |
165 | 165 | //build post string |
166 | 166 | foreach ($data as $i => $v) { |
167 | - $postdata .= $i . '=' . urlencode($v) . '&'; |
|
167 | + $postdata .= $i.'='.urlencode($v).'&'; |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | $postdata .= 'cmd=_notify-validate'; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | //Create paypal connection |
181 | - $fp = @fsockopen($ssl . $web['host'], $web['port'], $errnum, $errstr, 30); |
|
181 | + $fp = @fsockopen($ssl.$web['host'], $web['port'], $errnum, $errstr, 30); |
|
182 | 182 | |
183 | 183 | //Error checking |
184 | 184 | if (!$fp) { |
@@ -188,9 +188,9 @@ discard block |
||
188 | 188 | fwrite($fp, "POST $web[path] HTTP/1.1\r\n"); |
189 | 189 | fwrite($fp, "Host: $web[host]\r\n"); |
190 | 190 | fwrite($fp, "Content-type: application/x-www-form-urlencoded\r\n"); |
191 | - fwrite($fp, 'Content-length: ' . strlen($postdata) . "\r\n"); |
|
191 | + fwrite($fp, 'Content-length: '.strlen($postdata)."\r\n"); |
|
192 | 192 | fwrite($fp, "Connection: close\r\n\r\n"); |
193 | - fwrite($fp, $postdata . "\r\n\r\n"); |
|
193 | + fwrite($fp, $postdata."\r\n\r\n"); |
|
194 | 194 | |
195 | 195 | //loop through the response from the server |
196 | 196 | while (!feof($fp)) { |
@@ -13,41 +13,41 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | $vars = array( |
16 | - 'item_name', |
|
17 | - 'item_number', |
|
18 | - 'receiver_id', |
|
19 | - 'item_name', |
|
20 | - 'item_number', |
|
21 | - 'on1', |
|
22 | - 'os1', |
|
23 | - 'on0', |
|
24 | - 'on1', |
|
25 | - 'tax', |
|
26 | - 'quantity', |
|
27 | - 'invoice', |
|
28 | - 'firstname', |
|
29 | - 'lastname', |
|
30 | - 'address1', |
|
31 | - 'address2', |
|
32 | - 'city', |
|
33 | - 'state', |
|
34 | - 'zip', |
|
35 | - 'email', |
|
36 | - 'phone1', |
|
37 | - 'phone2', |
|
38 | - 'phone3', |
|
39 | - 'custom', |
|
40 | - 'amount' |
|
16 | + 'item_name', |
|
17 | + 'item_number', |
|
18 | + 'receiver_id', |
|
19 | + 'item_name', |
|
20 | + 'item_number', |
|
21 | + 'on1', |
|
22 | + 'os1', |
|
23 | + 'on0', |
|
24 | + 'on1', |
|
25 | + 'tax', |
|
26 | + 'quantity', |
|
27 | + 'invoice', |
|
28 | + 'firstname', |
|
29 | + 'lastname', |
|
30 | + 'address1', |
|
31 | + 'address2', |
|
32 | + 'city', |
|
33 | + 'state', |
|
34 | + 'zip', |
|
35 | + 'email', |
|
36 | + 'phone1', |
|
37 | + 'phone2', |
|
38 | + 'phone3', |
|
39 | + 'custom', |
|
40 | + 'amount' |
|
41 | 41 | ); |
42 | 42 | |
43 | 43 | $paypal = array(); |
44 | 44 | |
45 | 45 | foreach ($vars as $k => $v) { |
46 | - if (isset($_POST[$v])) { |
|
47 | - $paypal[$v] = "$_POST[$v]"; |
|
48 | - } else { |
|
49 | - $paypal[$v] = ''; |
|
50 | - } |
|
46 | + if (isset($_POST[$v])) { |
|
47 | + $paypal[$v] = "$_POST[$v]"; |
|
48 | + } else { |
|
49 | + $paypal[$v] = ''; |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | //Configuration Settings |
@@ -63,11 +63,11 @@ discard block |
||
63 | 63 | $paypal['lc'] = 'US'; |
64 | 64 | |
65 | 65 | if ($xoopsModuleConfig['paypal_test'] == '1') { |
66 | - $paypal['url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; |
|
66 | + $paypal['url'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; |
|
67 | 67 | } elseif ($xoopsModuleConfig['paypal_secure_yn'] == '0') { |
68 | - $paypal['url'] = 'http://www.paypal.com/cgi-bin/webscr'; |
|
68 | + $paypal['url'] = 'http://www.paypal.com/cgi-bin/webscr'; |
|
69 | 69 | } else { |
70 | - $paypal['url'] = 'https://www.paypal.com/cgi-bin/webscr'; |
|
70 | + $paypal['url'] = 'https://www.paypal.com/cgi-bin/webscr'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | $paypal['post_method'] = 'fso'; //fso=fsockopen(); curl=curl command line libCurl=php compiled with libCurl support |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | //Configuration Settings |
54 | 54 | $paypal['business'] = $xoopsModuleConfig['paypal_business_mail']; |
55 | -$paypal['site_url'] = '' . XOOPS_URL . '/modules/' . $moddir . '/'; |
|
55 | +$paypal['site_url'] = ''.XOOPS_URL.'/modules/'.$moddir.'/'; |
|
56 | 56 | $paypal['image_url'] = ''; |
57 | 57 | $paypal['success_url'] = 'ipn.php'; |
58 | 58 | //$paypal[success_url]="php_paypal/ipn/ipn.php"; |
@@ -27,67 +27,67 @@ discard block |
||
27 | 27 | |
28 | 28 | $moddir = $xoopsModule->getVar('dirname'); |
29 | 29 | if (isset($_POST['dirid'])) { |
30 | - $dirid = (int)$_POST['dirid']; |
|
30 | + $dirid = (int)$_POST['dirid']; |
|
31 | 31 | } elseif (isset($_GET['dirid'])) { |
32 | - $dirid = (int)$_GET['dirid']; |
|
32 | + $dirid = (int)$_GET['dirid']; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $eh = new ErrorHandler; //ErrorHandler object |
36 | 36 | |
37 | 37 | if (isset($_GET['op'])) { |
38 | - $op = $_GET['op']; |
|
38 | + $op = $_GET['op']; |
|
39 | 39 | } elseif (isset($_POST['op'])) { |
40 | - $op = $_POST['op']; |
|
40 | + $op = $_POST['op']; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | if (empty($xoopsUser) and !$xoopsModuleConfig['anonpost']) { |
44 | - redirect_header(XOOPS_URL . '/user.php', 2, _MD_MUSTREGFIRST); |
|
45 | - exit(); |
|
44 | + redirect_header(XOOPS_URL . '/user.php', 2, _MD_MUSTREGFIRST); |
|
45 | + exit(); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | if (!empty($_POST['submit'])) { |
49 | - //Get all selectable categories and put the prefix 'selectcat' in front of the catid. |
|
50 | - //With all results check if the result has a corresponding $_POST value. |
|
51 | - if ($_POST['title'] === '') { |
|
52 | - $eh->show('1001'); |
|
53 | - } |
|
54 | - $title = $myts->makeTboxData4Save($_POST['title']); |
|
55 | - $date = time(); |
|
56 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . '_itemid_seq'); |
|
57 | - if ($xoopsModuleConfig['autoapprove'] == 1) { |
|
58 | - $status = 1; |
|
59 | - } else { |
|
60 | - $status = 0; |
|
61 | - } |
|
62 | - //itemtype = bronze, silver, gold etc., start with 0 as default. |
|
63 | - $submitter = $xoopsUser->getVar('uid'); |
|
64 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . '_itemid_seq'); |
|
65 | - $sql = sprintf("INSERT INTO %s (itemid, uid, STATUS, created, title, hits, rating, votes, typeid, dirid) VALUES (%u, %u, %u, '%s', '%s', %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items'), $newid, $submitter, $status, time(), $title, 0, 0, 0, 0, $dirid); |
|
66 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
67 | - if ($newid == 0) { |
|
68 | - $itemid = $xoopsDB->getInsertId(); |
|
69 | - } |
|
70 | - $allcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $dirid . '\' AND active=\'1\''); |
|
71 | - $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
72 | - $count = 0; |
|
73 | - if ($numrows > 0) { |
|
74 | - while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
75 | - if (isset($_POST['selected' . $cid . ''])) { |
|
76 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $itemid, 1, time()); |
|
77 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
78 | - ++$count; |
|
79 | - } |
|
80 | - } |
|
81 | - if ($count == 0) { |
|
82 | - redirect_header(XOOPS_URL . "/modules/$moddir/submit.php?dirid=" . $post_dirid . '', 2, _MD_NOCATEGORYMATCH); |
|
83 | - exit(); |
|
84 | - } |
|
85 | - } else { |
|
86 | - redirect_header(XOOPS_URL . "/modules/$moddir/submit.php?dirid=" . $post_dirid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
87 | - exit(); |
|
88 | - } |
|
49 | + //Get all selectable categories and put the prefix 'selectcat' in front of the catid. |
|
50 | + //With all results check if the result has a corresponding $_POST value. |
|
51 | + if ($_POST['title'] === '') { |
|
52 | + $eh->show('1001'); |
|
53 | + } |
|
54 | + $title = $myts->makeTboxData4Save($_POST['title']); |
|
55 | + $date = time(); |
|
56 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . '_itemid_seq'); |
|
57 | + if ($xoopsModuleConfig['autoapprove'] == 1) { |
|
58 | + $status = 1; |
|
59 | + } else { |
|
60 | + $status = 0; |
|
61 | + } |
|
62 | + //itemtype = bronze, silver, gold etc., start with 0 as default. |
|
63 | + $submitter = $xoopsUser->getVar('uid'); |
|
64 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . '_itemid_seq'); |
|
65 | + $sql = sprintf("INSERT INTO %s (itemid, uid, STATUS, created, title, hits, rating, votes, typeid, dirid) VALUES (%u, %u, %u, '%s', '%s', %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items'), $newid, $submitter, $status, time(), $title, 0, 0, 0, 0, $dirid); |
|
66 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
67 | + if ($newid == 0) { |
|
68 | + $itemid = $xoopsDB->getInsertId(); |
|
69 | + } |
|
70 | + $allcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $dirid . '\' AND active=\'1\''); |
|
71 | + $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
72 | + $count = 0; |
|
73 | + if ($numrows > 0) { |
|
74 | + while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
75 | + if (isset($_POST['selected' . $cid . ''])) { |
|
76 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $itemid, 1, time()); |
|
77 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
78 | + ++$count; |
|
79 | + } |
|
80 | + } |
|
81 | + if ($count == 0) { |
|
82 | + redirect_header(XOOPS_URL . "/modules/$moddir/submit.php?dirid=" . $post_dirid . '', 2, _MD_NOCATEGORYMATCH); |
|
83 | + exit(); |
|
84 | + } |
|
85 | + } else { |
|
86 | + redirect_header(XOOPS_URL . "/modules/$moddir/submit.php?dirid=" . $post_dirid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
87 | + exit(); |
|
88 | + } |
|
89 | 89 | |
90 | - /* // RMV-NEW |
|
90 | + /* // RMV-NEW |
|
91 | 91 | // Notify of new listing (anywhere). To be completed. |
92 | 92 | $notificationHandler = xoops_getHandler('notification'); |
93 | 93 | $tags = array(); |
@@ -106,65 +106,65 @@ discard block |
||
106 | 106 | redirect_header(XOOPS_URL."/modules/$moddir/edit.php?item=".$itemid."",2,_MD_SAVED); |
107 | 107 | }*/ |
108 | 108 | |
109 | - redirect_header(XOOPS_URL . "/modules/$moddir/edit.php?item=" . $itemid . '', 2, _MD_SAVED); |
|
110 | - exit(); |
|
109 | + redirect_header(XOOPS_URL . "/modules/$moddir/edit.php?item=" . $itemid . '', 2, _MD_SAVED); |
|
110 | + exit(); |
|
111 | 111 | } else { |
112 | - if (isset($_GET['dirid'])) { |
|
113 | - $get_dirid = (int)$_GET['dirid']; |
|
114 | - } else { |
|
115 | - redirect_header(XOOPS_URL . "/modules/$moddir/index.php", 2, _MD_NODIRECTORYSELECTED); |
|
116 | - } |
|
117 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_submit.tpl'; |
|
118 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
119 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
120 | - //Query datatypes that match the categories selected. If not category selected. |
|
121 | - ob_start(); |
|
122 | - $form = new XoopsThemeForm(_MD_SUBMITLISTING_FORM, 'submitform', 'submit.php'); |
|
123 | - $form->setExtra('enctype="multipart/form-data"'); |
|
124 | - $editor = !empty($_REQUEST['editor']) ? $_REQUEST['editor'] : ''; |
|
125 | - if (!empty($editor)) { |
|
126 | - setcookie('editor', $editor); // save to cookie |
|
127 | - } else { |
|
128 | - // Or use user pre-selected editor through profile |
|
129 | - if (is_object($xoopsUser)) { |
|
130 | - $editor = @ $xoopsUser->getVar('editor'); // Need set through user profile |
|
131 | - } |
|
132 | - } |
|
133 | - $editor = 'koivi'; |
|
134 | - $options['name'] = 'link_description'; |
|
135 | - $options['value'] = empty($_REQUEST['message']) ? '' : $_REQUEST['message']; |
|
136 | - $options['value'] = ''; |
|
137 | - //optional configs |
|
138 | - $options['rows'] = 25; // default value = 5 |
|
139 | - $options['cols'] = 60; // default value = 50 |
|
140 | - $options['width'] = '100%'; // default value = 100% |
|
141 | - $options['height'] = '400px'; // default value = 400px |
|
142 | - $options['small'] = true; |
|
143 | - $options['smiles'] = false; |
|
112 | + if (isset($_GET['dirid'])) { |
|
113 | + $get_dirid = (int)$_GET['dirid']; |
|
114 | + } else { |
|
115 | + redirect_header(XOOPS_URL . "/modules/$moddir/index.php", 2, _MD_NODIRECTORYSELECTED); |
|
116 | + } |
|
117 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_submit.tpl'; |
|
118 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
119 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
120 | + //Query datatypes that match the categories selected. If not category selected. |
|
121 | + ob_start(); |
|
122 | + $form = new XoopsThemeForm(_MD_SUBMITLISTING_FORM, 'submitform', 'submit.php'); |
|
123 | + $form->setExtra('enctype="multipart/form-data"'); |
|
124 | + $editor = !empty($_REQUEST['editor']) ? $_REQUEST['editor'] : ''; |
|
125 | + if (!empty($editor)) { |
|
126 | + setcookie('editor', $editor); // save to cookie |
|
127 | + } else { |
|
128 | + // Or use user pre-selected editor through profile |
|
129 | + if (is_object($xoopsUser)) { |
|
130 | + $editor = @ $xoopsUser->getVar('editor'); // Need set through user profile |
|
131 | + } |
|
132 | + } |
|
133 | + $editor = 'koivi'; |
|
134 | + $options['name'] = 'link_description'; |
|
135 | + $options['value'] = empty($_REQUEST['message']) ? '' : $_REQUEST['message']; |
|
136 | + $options['value'] = ''; |
|
137 | + //optional configs |
|
138 | + $options['rows'] = 25; // default value = 5 |
|
139 | + $options['cols'] = 60; // default value = 50 |
|
140 | + $options['width'] = '100%'; // default value = 100% |
|
141 | + $options['height'] = '400px'; // default value = 400px |
|
142 | + $options['small'] = true; |
|
143 | + $options['smiles'] = false; |
|
144 | 144 | |
145 | - // "textarea": if the selected editor with name of $editor can not be created, the editor "textarea" will be used |
|
146 | - // if no $onFailure is set, then the first available editor will be used |
|
147 | - // If dohtml is disabled, set $noHtml to true |
|
148 | - $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 50, 250, ''), true); |
|
149 | - $category_tray = new XoopsFormElementTray(_MD_CATEGORIES, '', 'cid'); |
|
150 | - $catselarea = getCatSelectArea2(); |
|
151 | - $category_tray->addElement(new XoopsFormLabel('', $catselarea)); |
|
152 | - $form->addElement($category_tray, true); |
|
153 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
154 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
155 | - $form->addElement(new XoopsFormHidden('op', 'selectcat')); |
|
156 | - $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
157 | - $form->display(); |
|
158 | - $xoopsTpl->assign('submit_form', ob_get_contents()); |
|
159 | - ob_end_clean(); |
|
145 | + // "textarea": if the selected editor with name of $editor can not be created, the editor "textarea" will be used |
|
146 | + // if no $onFailure is set, then the first available editor will be used |
|
147 | + // If dohtml is disabled, set $noHtml to true |
|
148 | + $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 50, 250, ''), true); |
|
149 | + $category_tray = new XoopsFormElementTray(_MD_CATEGORIES, '', 'cid'); |
|
150 | + $catselarea = getCatSelectArea2(); |
|
151 | + $category_tray->addElement(new XoopsFormLabel('', $catselarea)); |
|
152 | + $form->addElement($category_tray, true); |
|
153 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
154 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
155 | + $form->addElement(new XoopsFormHidden('op', 'selectcat')); |
|
156 | + $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
157 | + $form->display(); |
|
158 | + $xoopsTpl->assign('submit_form', ob_get_contents()); |
|
159 | + ob_end_clean(); |
|
160 | 160 | |
161 | - $xoopsTpl->assign('notify_show', !empty($xoopsUser) && !$xoopsModuleConfig['autoapprove'] ? 1 : 0); |
|
162 | - $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE); |
|
163 | - $xoopsTpl->assign('lang_siteurl', _MD_SITEURL); |
|
164 | - $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|
165 | - $xoopsTpl->assign('lang_options', _MD_OPTIONS); |
|
166 | - $xoopsTpl->assign('lang_notify', _MD_NOTIFYAPPROVE); |
|
167 | - $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|
168 | - $xoopsTpl->assign('lang_cancel', _CANCEL); |
|
169 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
161 | + $xoopsTpl->assign('notify_show', !empty($xoopsUser) && !$xoopsModuleConfig['autoapprove'] ? 1 : 0); |
|
162 | + $xoopsTpl->assign('lang_sitetitle', _MD_SITETITLE); |
|
163 | + $xoopsTpl->assign('lang_siteurl', _MD_SITEURL); |
|
164 | + $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|
165 | + $xoopsTpl->assign('lang_options', _MD_OPTIONS); |
|
166 | + $xoopsTpl->assign('lang_notify', _MD_NOTIFYAPPROVE); |
|
167 | + $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|
168 | + $xoopsTpl->assign('lang_cancel', _CANCEL); |
|
169 | + include XOOPS_ROOT_PATH . '/footer.php'; |
|
170 | 170 | } |
@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | * @author XOOPS Development Team, |
19 | 19 | */ |
20 | 20 | |
21 | -include __DIR__ . '/header.php'; |
|
22 | -$myts = MyTextSanitizer::getInstance();// MyTextSanitizer object |
|
23 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
24 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
25 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
26 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
21 | +include __DIR__.'/header.php'; |
|
22 | +$myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
|
23 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
24 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
25 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
26 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
27 | 27 | |
28 | 28 | $moddir = $xoopsModule->getVar('dirname'); |
29 | 29 | if (isset($_POST['dirid'])) { |
30 | - $dirid = (int)$_POST['dirid']; |
|
30 | + $dirid = (int) $_POST['dirid']; |
|
31 | 31 | } elseif (isset($_GET['dirid'])) { |
32 | - $dirid = (int)$_GET['dirid']; |
|
32 | + $dirid = (int) $_GET['dirid']; |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | $eh = new ErrorHandler; //ErrorHandler object |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (empty($xoopsUser) and !$xoopsModuleConfig['anonpost']) { |
44 | - redirect_header(XOOPS_URL . '/user.php', 2, _MD_MUSTREGFIRST); |
|
44 | + redirect_header(XOOPS_URL.'/user.php', 2, _MD_MUSTREGFIRST); |
|
45 | 45 | exit(); |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | $title = $myts->makeTboxData4Save($_POST['title']); |
55 | 55 | $date = time(); |
56 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . '_itemid_seq'); |
|
56 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n').'_items').'_itemid_seq'); |
|
57 | 57 | if ($xoopsModuleConfig['autoapprove'] == 1) { |
58 | 58 | $status = 1; |
59 | 59 | } else { |
@@ -61,29 +61,29 @@ discard block |
||
61 | 61 | } |
62 | 62 | //itemtype = bronze, silver, gold etc., start with 0 as default. |
63 | 63 | $submitter = $xoopsUser->getVar('uid'); |
64 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . '_itemid_seq'); |
|
65 | - $sql = sprintf("INSERT INTO %s (itemid, uid, STATUS, created, title, hits, rating, votes, typeid, dirid) VALUES (%u, %u, %u, '%s', '%s', %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items'), $newid, $submitter, $status, time(), $title, 0, 0, 0, 0, $dirid); |
|
64 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n').'_items').'_itemid_seq'); |
|
65 | + $sql = sprintf("INSERT INTO %s (itemid, uid, STATUS, created, title, hits, rating, votes, typeid, dirid) VALUES (%u, %u, %u, '%s', '%s', %u, %u, %u, '%s', %u)", $xoopsDB->prefix($module->getVar('dirname', 'n').'_items'), $newid, $submitter, $status, time(), $title, 0, 0, 0, 0, $dirid); |
|
66 | 66 | $xoopsDB->query($sql) or $eh->show('0013'); |
67 | 67 | if ($newid == 0) { |
68 | 68 | $itemid = $xoopsDB->getInsertId(); |
69 | 69 | } |
70 | - $allcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $dirid . '\' AND active=\'1\''); |
|
70 | + $allcatsresult = $xoopsDB->query('SELECT cid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE dirid='".$dirid.'\' AND active=\'1\''); |
|
71 | 71 | $numrows = $xoopsDB->getRowsNum($allcatsresult); |
72 | 72 | $count = 0; |
73 | 73 | if ($numrows > 0) { |
74 | 74 | while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
75 | - if (isset($_POST['selected' . $cid . ''])) { |
|
76 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $itemid, 1, time()); |
|
75 | + if (isset($_POST['selected'.$cid.''])) { |
|
76 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat'), $newid, $cid, $itemid, 1, time()); |
|
77 | 77 | $xoopsDB->query($sql) or $eh->show('0013'); |
78 | 78 | ++$count; |
79 | 79 | } |
80 | 80 | } |
81 | 81 | if ($count == 0) { |
82 | - redirect_header(XOOPS_URL . "/modules/$moddir/submit.php?dirid=" . $post_dirid . '', 2, _MD_NOCATEGORYMATCH); |
|
82 | + redirect_header(XOOPS_URL."/modules/$moddir/submit.php?dirid=".$post_dirid.'', 2, _MD_NOCATEGORYMATCH); |
|
83 | 83 | exit(); |
84 | 84 | } |
85 | 85 | } else { |
86 | - redirect_header(XOOPS_URL . "/modules/$moddir/submit.php?dirid=" . $post_dirid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
86 | + redirect_header(XOOPS_URL."/modules/$moddir/submit.php?dirid=".$post_dirid.'', 2, _MD_NOCATEGORIESAVAILABLE); |
|
87 | 87 | exit(); |
88 | 88 | } |
89 | 89 | |
@@ -106,16 +106,16 @@ discard block |
||
106 | 106 | redirect_header(XOOPS_URL."/modules/$moddir/edit.php?item=".$itemid."",2,_MD_SAVED); |
107 | 107 | }*/ |
108 | 108 | |
109 | - redirect_header(XOOPS_URL . "/modules/$moddir/edit.php?item=" . $itemid . '', 2, _MD_SAVED); |
|
109 | + redirect_header(XOOPS_URL."/modules/$moddir/edit.php?item=".$itemid.'', 2, _MD_SAVED); |
|
110 | 110 | exit(); |
111 | 111 | } else { |
112 | 112 | if (isset($_GET['dirid'])) { |
113 | - $get_dirid = (int)$_GET['dirid']; |
|
113 | + $get_dirid = (int) $_GET['dirid']; |
|
114 | 114 | } else { |
115 | - redirect_header(XOOPS_URL . "/modules/$moddir/index.php", 2, _MD_NODIRECTORYSELECTED); |
|
115 | + redirect_header(XOOPS_URL."/modules/$moddir/index.php", 2, _MD_NODIRECTORYSELECTED); |
|
116 | 116 | } |
117 | 117 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_submit.tpl'; |
118 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
118 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
119 | 119 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
120 | 120 | //Query datatypes that match the categories selected. If not category selected. |
121 | 121 | ob_start(); |
@@ -166,5 +166,5 @@ discard block |
||
166 | 166 | $xoopsTpl->assign('lang_notify', _MD_NOTIFYAPPROVE); |
167 | 167 | $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
168 | 168 | $xoopsTpl->assign('lang_cancel', _CANCEL); |
169 | - include XOOPS_ROOT_PATH . '/footer.php'; |
|
169 | + include XOOPS_ROOT_PATH.'/footer.php'; |
|
170 | 170 | } |
@@ -18,23 +18,23 @@ |
||
18 | 18 | * @author XOOPS Development Team, |
19 | 19 | */ |
20 | 20 | |
21 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
22 | -require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
21 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
22 | +require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
23 | 23 | |
24 | 24 | $uploaddirectory = '/uploads/'; |
25 | 25 | |
26 | 26 | $coupform = new XoopsThemeForm(_MD_COUPONFORM, 'couponform', $_SERVER['PHP_SELF'], 'POST', true); |
27 | -$linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/uploads/'); |
|
27 | +$linkimg_array = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH.'/uploads/'); |
|
28 | 28 | $coupform->addElement(new XoopsFormHidden('itemid', $itemid)); |
29 | 29 | $coupform->addElement(new XoopsFormText(_MD_COUPONHEADER, 'heading', 25, 30, $heading), true); |
30 | 30 | $coupform->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTIONC, 'description', $description)); |
31 | -$image_option = new XoopsFormSelect(_MD_COUPONIMGMGR . '<br>' . _MD_COUPONIMG . '<br>', 'image', $image); |
|
31 | +$image_option = new XoopsFormSelect(_MD_COUPONIMGMGR.'<br>'._MD_COUPONIMG.'<br>', 'image', $image); |
|
32 | 32 | $image_option->addOptionArray($linkimg_array); |
33 | 33 | $imgtray = new XoopsFormElementTray(_MD_COUPSEL, '<br>'); |
34 | 34 | |
35 | -$image_option->setExtra("onchange='showImgSelected(\"imagex\", \"image\", \"" . $uploaddirectory . '", "", "' . XOOPS_URL . "\")'"); |
|
35 | +$image_option->setExtra("onchange='showImgSelected(\"imagex\", \"image\", \"".$uploaddirectory.'", "", "'.XOOPS_URL."\")'"); |
|
36 | 36 | $imgtray->addElement($image_option, false); |
37 | -$imgtray->addElement(new XoopsFormLabel('', "<br><img src='" . $uploaddirectory . '/' . $image . '\' name=\'imagex\' id=\'imagex\' alt=\'\'>')); |
|
37 | +$imgtray->addElement(new XoopsFormLabel('', "<br><img src='".$uploaddirectory.'/'.$image.'\' name=\'imagex\' id=\'imagex\' alt=\'\'>')); |
|
38 | 38 | $coupform->addElement($imgtray); |
39 | 39 | $coupform->addElement(new XoopsFormRadioYN(_MD_CONVERTLBR, 'lbr', $lbr)); |
40 | 40 | $coupform->addElement(new XoopsFormDateTime(_MD_PUBLISHCOUPON, 'publish', 25, $publish)); |
@@ -22,35 +22,35 @@ discard block |
||
22 | 22 | |
23 | 23 | function convertOrderByIn($orderby) |
24 | 24 | { |
25 | - switch (trim($orderby)) { |
|
26 | - case 'titleA': |
|
27 | - $orderby = 'title ASC'; |
|
28 | - break; |
|
29 | - case 'dateA': |
|
30 | - $orderby = 'created ASC'; |
|
31 | - break; |
|
32 | - case 'hitsA': |
|
33 | - $orderby = 'hits ASC'; |
|
34 | - break; |
|
35 | - case 'ratingA': |
|
36 | - $orderby = 'rating ASC'; |
|
37 | - break; |
|
38 | - case 'titleD': |
|
39 | - $orderby = 'title DESC'; |
|
40 | - break; |
|
41 | - case 'hitsD': |
|
42 | - $orderby = 'hits DESC'; |
|
43 | - break; |
|
44 | - case 'ratingD': |
|
45 | - $orderby = 'rating DESC'; |
|
46 | - break; |
|
47 | - case'dateD': |
|
48 | - default: |
|
49 | - $orderby = 'created DESC'; |
|
50 | - break; |
|
51 | - } |
|
52 | - |
|
53 | - return $orderby; |
|
25 | + switch (trim($orderby)) { |
|
26 | + case 'titleA': |
|
27 | + $orderby = 'title ASC'; |
|
28 | + break; |
|
29 | + case 'dateA': |
|
30 | + $orderby = 'created ASC'; |
|
31 | + break; |
|
32 | + case 'hitsA': |
|
33 | + $orderby = 'hits ASC'; |
|
34 | + break; |
|
35 | + case 'ratingA': |
|
36 | + $orderby = 'rating ASC'; |
|
37 | + break; |
|
38 | + case 'titleD': |
|
39 | + $orderby = 'title DESC'; |
|
40 | + break; |
|
41 | + case 'hitsD': |
|
42 | + $orderby = 'hits DESC'; |
|
43 | + break; |
|
44 | + case 'ratingD': |
|
45 | + $orderby = 'rating DESC'; |
|
46 | + break; |
|
47 | + case'dateD': |
|
48 | + default: |
|
49 | + $orderby = 'created DESC'; |
|
50 | + break; |
|
51 | + } |
|
52 | + |
|
53 | + return $orderby; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -59,33 +59,33 @@ discard block |
||
59 | 59 | */ |
60 | 60 | function convertorderbytrans($orderby) |
61 | 61 | { |
62 | - $orderbyTrans = ''; |
|
63 | - if ($orderby === 'hits ASC') { |
|
64 | - $orderbyTrans = '' . _MD_POPULARITYLTOM . ''; |
|
65 | - } |
|
66 | - if ($orderby === 'hits DESC') { |
|
67 | - $orderbyTrans = '' . _MD_POPULARITYMTOL . ''; |
|
68 | - } |
|
69 | - if ($orderby === 'title ASC') { |
|
70 | - $orderbyTrans = '' . _MD_TITLEATOZ . ''; |
|
71 | - } |
|
72 | - if ($orderby === 'title DESC') { |
|
73 | - $orderbyTrans = '' . _MD_TITLEZTOA . ''; |
|
74 | - } |
|
75 | - if ($orderby === 'date ASC') { |
|
76 | - $orderbyTrans = '' . _MD_DATEOLD . ''; |
|
77 | - } |
|
78 | - if ($orderby === 'date DESC') { |
|
79 | - $orderbyTrans = '' . _MD_DATENEW . ''; |
|
80 | - } |
|
81 | - if ($orderby === 'rating ASC') { |
|
82 | - $orderbyTrans = '' . _MD_RATINGLTOH . ''; |
|
83 | - } |
|
84 | - if ($orderby === 'rating DESC') { |
|
85 | - $orderbyTrans = '' . _MD_RATINGHTOL . ''; |
|
86 | - } |
|
87 | - |
|
88 | - return $orderbyTrans; |
|
62 | + $orderbyTrans = ''; |
|
63 | + if ($orderby === 'hits ASC') { |
|
64 | + $orderbyTrans = '' . _MD_POPULARITYLTOM . ''; |
|
65 | + } |
|
66 | + if ($orderby === 'hits DESC') { |
|
67 | + $orderbyTrans = '' . _MD_POPULARITYMTOL . ''; |
|
68 | + } |
|
69 | + if ($orderby === 'title ASC') { |
|
70 | + $orderbyTrans = '' . _MD_TITLEATOZ . ''; |
|
71 | + } |
|
72 | + if ($orderby === 'title DESC') { |
|
73 | + $orderbyTrans = '' . _MD_TITLEZTOA . ''; |
|
74 | + } |
|
75 | + if ($orderby === 'date ASC') { |
|
76 | + $orderbyTrans = '' . _MD_DATEOLD . ''; |
|
77 | + } |
|
78 | + if ($orderby === 'date DESC') { |
|
79 | + $orderbyTrans = '' . _MD_DATENEW . ''; |
|
80 | + } |
|
81 | + if ($orderby === 'rating ASC') { |
|
82 | + $orderbyTrans = '' . _MD_RATINGLTOH . ''; |
|
83 | + } |
|
84 | + if ($orderby === 'rating DESC') { |
|
85 | + $orderbyTrans = '' . _MD_RATINGHTOL . ''; |
|
86 | + } |
|
87 | + |
|
88 | + return $orderbyTrans; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -94,32 +94,32 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function convertorderbyout($orderby) |
96 | 96 | { |
97 | - if ($orderby === 'title ASC') { |
|
98 | - $orderby = 'titleA'; |
|
99 | - } |
|
100 | - if ($orderby === 'date ASC') { |
|
101 | - $orderby = 'dateA'; |
|
102 | - } |
|
103 | - if ($orderby === 'hits ASC') { |
|
104 | - $orderby = 'hitsA'; |
|
105 | - } |
|
106 | - if ($orderby === 'rating ASC') { |
|
107 | - $orderby = 'ratingA'; |
|
108 | - } |
|
109 | - if ($orderby === 'title DESC') { |
|
110 | - $orderby = 'titleD'; |
|
111 | - } |
|
112 | - if ($orderby === 'date DESC') { |
|
113 | - $orderby = 'dateD'; |
|
114 | - } |
|
115 | - if ($orderby === 'hits DESC') { |
|
116 | - $orderby = 'hitsD'; |
|
117 | - } |
|
118 | - if ($orderby === 'rating DESC') { |
|
119 | - $orderby = 'ratingD'; |
|
120 | - } |
|
121 | - |
|
122 | - return $orderby; |
|
97 | + if ($orderby === 'title ASC') { |
|
98 | + $orderby = 'titleA'; |
|
99 | + } |
|
100 | + if ($orderby === 'date ASC') { |
|
101 | + $orderby = 'dateA'; |
|
102 | + } |
|
103 | + if ($orderby === 'hits ASC') { |
|
104 | + $orderby = 'hitsA'; |
|
105 | + } |
|
106 | + if ($orderby === 'rating ASC') { |
|
107 | + $orderby = 'ratingA'; |
|
108 | + } |
|
109 | + if ($orderby === 'title DESC') { |
|
110 | + $orderby = 'titleD'; |
|
111 | + } |
|
112 | + if ($orderby === 'date DESC') { |
|
113 | + $orderby = 'dateD'; |
|
114 | + } |
|
115 | + if ($orderby === 'hits DESC') { |
|
116 | + $orderby = 'hitsD'; |
|
117 | + } |
|
118 | + if ($orderby === 'rating DESC') { |
|
119 | + $orderby = 'ratingD'; |
|
120 | + } |
|
121 | + |
|
122 | + return $orderby; |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | */ |
130 | 130 | function newlinkgraphic($time, $status) |
131 | 131 | { |
132 | - global $moddir; |
|
133 | - $count = 7; |
|
134 | - $new = ''; |
|
135 | - $startdate = (time() - (86400 * $count)); |
|
136 | - if ($startdate < $time) { |
|
137 | - if ($status == 2) { |
|
138 | - $new = ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/newred.gif\" alt=\"" . _MD_NEWTHISWEEK . '">'; |
|
139 | - } elseif ($status == 3) { |
|
140 | - $new = ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/update.gif\" alt=\"" . _MD_UPTHISWEEK . '">'; |
|
141 | - } |
|
142 | - } |
|
143 | - |
|
144 | - return $new; |
|
132 | + global $moddir; |
|
133 | + $count = 7; |
|
134 | + $new = ''; |
|
135 | + $startdate = (time() - (86400 * $count)); |
|
136 | + if ($startdate < $time) { |
|
137 | + if ($status == 2) { |
|
138 | + $new = ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/newred.gif\" alt=\"" . _MD_NEWTHISWEEK . '">'; |
|
139 | + } elseif ($status == 3) { |
|
140 | + $new = ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/update.gif\" alt=\"" . _MD_UPTHISWEEK . '">'; |
|
141 | + } |
|
142 | + } |
|
143 | + |
|
144 | + return $new; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | */ |
151 | 151 | function popgraphic($hits) |
152 | 152 | { |
153 | - global $xoopsModuleConfig, $moddir; |
|
154 | - if ($hits >= $xoopsModuleConfig['popular']) { |
|
155 | - return ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/pop.gif\" alt=\"" . _MD_POPULAR . '">'; |
|
156 | - } |
|
153 | + global $xoopsModuleConfig, $moddir; |
|
154 | + if ($hits >= $xoopsModuleConfig['popular']) { |
|
155 | + return ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/pop.gif\" alt=\"" . _MD_POPULAR . '">'; |
|
156 | + } |
|
157 | 157 | |
158 | - return ''; |
|
158 | + return ''; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -165,40 +165,40 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function getTotalItems($sel_id, $status = 0) |
167 | 167 | { |
168 | - global $xoopsDB, $mytree; |
|
169 | - $count = 0; |
|
170 | - $arr = array(); |
|
171 | - $query = 'SELECT DISTINCT l.itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' l, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' x WHERE x.itemid=l.itemid AND x.cid=' . $sel_id . ''; |
|
172 | - if ($status !== '') { |
|
173 | - $query .= " AND l.status>='$status'"; |
|
174 | - } else { |
|
175 | - $query .= ''; |
|
176 | - } |
|
177 | - $query .= " AND x.active >= '1'"; |
|
178 | - $result = $xoopsDB->query($query); |
|
179 | - //print_r($xoopsDB->fetchArray($result)); |
|
180 | - if (!$result) { |
|
181 | - $count = 0; |
|
182 | - } else { |
|
183 | - $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
184 | - $count = $num_results; |
|
185 | - } |
|
186 | - $arr = $mytree->getAllChildId($sel_id); |
|
187 | - $size = count($arr); |
|
188 | - for ($i = 0; $i < $size; ++$i) { |
|
189 | - $query2 = 'SELECT DISTINCT l.itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' l, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' x WHERE l.itemid=x.itemid AND x.cid=' . $arr[$i] . ''; |
|
190 | - if ($status !== '') { |
|
191 | - $query2 .= " AND l.status>='$status'"; |
|
192 | - } else { |
|
193 | - $query2 .= ''; |
|
194 | - } |
|
195 | - $query2 .= " AND x.active >= '1'"; |
|
196 | - $result2 = $xoopsDB->query($query2); |
|
197 | - $num_results2 = $GLOBALS['xoopsDB']->getRowsNum($result2); |
|
198 | - $count += $num_results2; |
|
199 | - } |
|
200 | - |
|
201 | - return $count; |
|
168 | + global $xoopsDB, $mytree; |
|
169 | + $count = 0; |
|
170 | + $arr = array(); |
|
171 | + $query = 'SELECT DISTINCT l.itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' l, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' x WHERE x.itemid=l.itemid AND x.cid=' . $sel_id . ''; |
|
172 | + if ($status !== '') { |
|
173 | + $query .= " AND l.status>='$status'"; |
|
174 | + } else { |
|
175 | + $query .= ''; |
|
176 | + } |
|
177 | + $query .= " AND x.active >= '1'"; |
|
178 | + $result = $xoopsDB->query($query); |
|
179 | + //print_r($xoopsDB->fetchArray($result)); |
|
180 | + if (!$result) { |
|
181 | + $count = 0; |
|
182 | + } else { |
|
183 | + $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
184 | + $count = $num_results; |
|
185 | + } |
|
186 | + $arr = $mytree->getAllChildId($sel_id); |
|
187 | + $size = count($arr); |
|
188 | + for ($i = 0; $i < $size; ++$i) { |
|
189 | + $query2 = 'SELECT DISTINCT l.itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' l, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' x WHERE l.itemid=x.itemid AND x.cid=' . $arr[$i] . ''; |
|
190 | + if ($status !== '') { |
|
191 | + $query2 .= " AND l.status>='$status'"; |
|
192 | + } else { |
|
193 | + $query2 .= ''; |
|
194 | + } |
|
195 | + $query2 .= " AND x.active >= '1'"; |
|
196 | + $result2 = $xoopsDB->query($query2); |
|
197 | + $num_results2 = $GLOBALS['xoopsDB']->getRowsNum($result2); |
|
198 | + $count += $num_results2; |
|
199 | + } |
|
200 | + |
|
201 | + return $count; |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -209,31 +209,31 @@ discard block |
||
209 | 209 | */ |
210 | 210 | function getTotalItems2($sel_id, $status = '', $locdestid) |
211 | 211 | { |
212 | - global $xoopsDB, $mytree; |
|
213 | - $count = 0; |
|
214 | - $arr = array(); |
|
215 | - $query = 'SELECT count(*) FROM ' . $xoopsDB->prefix('links_links') . ' t, ' . $xoopsDB->prefix('links_x_loc_dest') . ' x WHERE x.ldestid=t.lid AND x.locdestid=' . $locdestid . ' AND t.cid=' . $sel_id . ''; |
|
216 | - // $query = "select DISTINCT count(lid) from ".$xoopsDB->prefix("links_links")." t, ".$xoopsDB->prefix("links_x_loc_dest")." x where x.ldestid=t.lid AND x.locdestid=".$locdestid." AND t.cid=".$sel_id.""; |
|
217 | - // $query = "select count(*) from ".$xoopsDB->prefix("links_links")." where cid=".$sel_id.""; |
|
218 | - if ($status !== '') { |
|
219 | - $query .= " and status>=$status"; |
|
220 | - } |
|
221 | - $result = $xoopsDB->query($query); |
|
222 | - list($thing) = $xoopsDB->fetchRow($result); |
|
223 | - $count = $thing; |
|
224 | - $arr = $mytree->getAllChildId($sel_id); |
|
225 | - $size = count($arr); |
|
226 | - for ($i = 0; $i < $size; ++$i) { |
|
227 | - $query2 = 'select count(*) ' . $xoopsDB->prefix('links_links') . ' t, ' . $xoopsDB->prefix('links_x_loc_dest') . ' x where x.ldestid=t.lid AND x.locdestid=' . $locdestid . ' AND t.cid=' . $arr[$i] . ''; |
|
228 | - if ($status !== '') { |
|
229 | - $query2 .= " and status>=$status"; |
|
230 | - } |
|
231 | - $result2 = $xoopsDB->query($query2); |
|
232 | - list($thing) = $xoopsDB->fetchRow($result2); |
|
233 | - $count += $thing; |
|
234 | - } |
|
235 | - |
|
236 | - return $count; |
|
212 | + global $xoopsDB, $mytree; |
|
213 | + $count = 0; |
|
214 | + $arr = array(); |
|
215 | + $query = 'SELECT count(*) FROM ' . $xoopsDB->prefix('links_links') . ' t, ' . $xoopsDB->prefix('links_x_loc_dest') . ' x WHERE x.ldestid=t.lid AND x.locdestid=' . $locdestid . ' AND t.cid=' . $sel_id . ''; |
|
216 | + // $query = "select DISTINCT count(lid) from ".$xoopsDB->prefix("links_links")." t, ".$xoopsDB->prefix("links_x_loc_dest")." x where x.ldestid=t.lid AND x.locdestid=".$locdestid." AND t.cid=".$sel_id.""; |
|
217 | + // $query = "select count(*) from ".$xoopsDB->prefix("links_links")." where cid=".$sel_id.""; |
|
218 | + if ($status !== '') { |
|
219 | + $query .= " and status>=$status"; |
|
220 | + } |
|
221 | + $result = $xoopsDB->query($query); |
|
222 | + list($thing) = $xoopsDB->fetchRow($result); |
|
223 | + $count = $thing; |
|
224 | + $arr = $mytree->getAllChildId($sel_id); |
|
225 | + $size = count($arr); |
|
226 | + for ($i = 0; $i < $size; ++$i) { |
|
227 | + $query2 = 'select count(*) ' . $xoopsDB->prefix('links_links') . ' t, ' . $xoopsDB->prefix('links_x_loc_dest') . ' x where x.ldestid=t.lid AND x.locdestid=' . $locdestid . ' AND t.cid=' . $arr[$i] . ''; |
|
228 | + if ($status !== '') { |
|
229 | + $query2 .= " and status>=$status"; |
|
230 | + } |
|
231 | + $result2 = $xoopsDB->query($query2); |
|
232 | + list($thing) = $xoopsDB->fetchRow($result2); |
|
233 | + $count += $thing; |
|
234 | + } |
|
235 | + |
|
236 | + return $count; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -242,19 +242,19 @@ discard block |
||
242 | 242 | */ |
243 | 243 | function getDirNameFromId($dirid = 0) |
244 | 244 | { |
245 | - global $xoopsDB; |
|
246 | - $myts = MyTextSanitizer::getInstance(); |
|
247 | - $result = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE dirid = '" . $dirid . '\''); |
|
248 | - $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
249 | - if (!$result) { |
|
250 | - return 0; |
|
251 | - } |
|
252 | - for ($i = 0; $i < $num_results; ++$i) { |
|
253 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
254 | - $dirname = $row['name']; |
|
255 | - } |
|
256 | - |
|
257 | - return $dirname; |
|
245 | + global $xoopsDB; |
|
246 | + $myts = MyTextSanitizer::getInstance(); |
|
247 | + $result = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE dirid = '" . $dirid . '\''); |
|
248 | + $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
249 | + if (!$result) { |
|
250 | + return 0; |
|
251 | + } |
|
252 | + for ($i = 0; $i < $num_results; ++$i) { |
|
253 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
254 | + $dirname = $row['name']; |
|
255 | + } |
|
256 | + |
|
257 | + return $dirname; |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
@@ -263,20 +263,20 @@ discard block |
||
263 | 263 | */ |
264 | 264 | function getCatTitleFromId($cid = 0) |
265 | 265 | { |
266 | - global $xoopsDB; |
|
267 | - //$block = array(); |
|
268 | - $myts = MyTextSanitizer::getInstance(); |
|
269 | - $result = $xoopsDB->query('SELECT title FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE cid = '" . $cid . '\''); |
|
270 | - $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
271 | - if (!$result) { |
|
272 | - return 0; |
|
273 | - } |
|
274 | - for ($i = 0; $i < $num_results; ++$i) { |
|
275 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
276 | - $cattitle = $row['title']; |
|
277 | - } |
|
278 | - |
|
279 | - return $cattitle; |
|
266 | + global $xoopsDB; |
|
267 | + //$block = array(); |
|
268 | + $myts = MyTextSanitizer::getInstance(); |
|
269 | + $result = $xoopsDB->query('SELECT title FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE cid = '" . $cid . '\''); |
|
270 | + $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
271 | + if (!$result) { |
|
272 | + return 0; |
|
273 | + } |
|
274 | + for ($i = 0; $i < $num_results; ++$i) { |
|
275 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
276 | + $cattitle = $row['title']; |
|
277 | + } |
|
278 | + |
|
279 | + return $cattitle; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -285,32 +285,32 @@ discard block |
||
285 | 285 | */ |
286 | 286 | function getCategoriesPaths($get_itemid) |
287 | 287 | { |
288 | - global $efqtree, $xoopsDB, $get_itemid, $get_dirid, $xoopsUser, $xoopsModule; |
|
289 | - if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
290 | - $isadmin = true; |
|
291 | - } else { |
|
292 | - $isadmin = false; |
|
293 | - } |
|
294 | - $result = $xoopsDB->query('SELECT xid, cid, itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' WHERE itemid = ' . $get_itemid . " AND active='1'"); |
|
295 | - $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
296 | - if (!$result) { |
|
297 | - return 0; |
|
298 | - } |
|
299 | - $output = ''; |
|
300 | - for ($i = 0; $i < $num_results; ++$i) { |
|
301 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
302 | - $cid = $row['cid']; |
|
303 | - $path = ''; |
|
304 | - $path .= $efqtree->getUnformattedPathFromId($cid, 'title', $path); |
|
305 | - $path .= '<br>'; |
|
306 | - $output .= $path; |
|
307 | - } |
|
308 | - if ($isadmin) { |
|
309 | - $output .= '<br><a href="admin/categories.php?dirid=' . $get_dirid . '">' . _MD_EDITCATEGORIES . '</a>'; |
|
310 | - } |
|
311 | - |
|
312 | - //$output .= "<br><a href=\"editcategories.php?item=".$get_itemid."\">["._MD_EDIT_CATEGORIES."]</a>"; |
|
313 | - return $output; |
|
288 | + global $efqtree, $xoopsDB, $get_itemid, $get_dirid, $xoopsUser, $xoopsModule; |
|
289 | + if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
290 | + $isadmin = true; |
|
291 | + } else { |
|
292 | + $isadmin = false; |
|
293 | + } |
|
294 | + $result = $xoopsDB->query('SELECT xid, cid, itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' WHERE itemid = ' . $get_itemid . " AND active='1'"); |
|
295 | + $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
296 | + if (!$result) { |
|
297 | + return 0; |
|
298 | + } |
|
299 | + $output = ''; |
|
300 | + for ($i = 0; $i < $num_results; ++$i) { |
|
301 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
302 | + $cid = $row['cid']; |
|
303 | + $path = ''; |
|
304 | + $path .= $efqtree->getUnformattedPathFromId($cid, 'title', $path); |
|
305 | + $path .= '<br>'; |
|
306 | + $output .= $path; |
|
307 | + } |
|
308 | + if ($isadmin) { |
|
309 | + $output .= '<br><a href="admin/categories.php?dirid=' . $get_dirid . '">' . _MD_EDITCATEGORIES . '</a>'; |
|
310 | + } |
|
311 | + |
|
312 | + //$output .= "<br><a href=\"editcategories.php?item=".$get_itemid."\">["._MD_EDIT_CATEGORIES."]</a>"; |
|
313 | + return $output; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | /** |
@@ -319,41 +319,41 @@ discard block |
||
319 | 319 | */ |
320 | 320 | function adminmenu($currentoption = 0, $breadcrumb) |
321 | 321 | { |
322 | - global $xoopsModule, $xoopsConfig; |
|
323 | - $tblColors = array(); |
|
324 | - $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = '#DDE'; |
|
325 | - $tblColors[$currentoption] = 'white'; |
|
326 | - echo "<table width=100% class='outer'><tr><td align=right> |
|
322 | + global $xoopsModule, $xoopsConfig; |
|
323 | + $tblColors = array(); |
|
324 | + $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = '#DDE'; |
|
325 | + $tblColors[$currentoption] = 'white'; |
|
326 | + echo "<table width=100% class='outer'><tr><td align=right> |
|
327 | 327 | <font size=2>" . $xoopsModule->name() . ':' . $breadcrumb . '</font> |
328 | 328 | </td></tr></table><br>'; |
329 | - echo '<div id="navcontainer"><ul style="padding: 3px 0; margin-left: |
|
329 | + echo '<div id="navcontainer"><ul style="padding: 3px 0; margin-left: |
|
330 | 330 | 0;font: bold 12px Verdana, sans-serif; ">'; |
331 | - echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
331 | + echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
332 | 332 | <a href="index.php" style="padding: 3px 0.5em; |
333 | 333 | margin-left: 3px; |
334 | 334 | border: 1px solid #778; background: ' . $tblColors[0] . '; |
335 | 335 | text-decoration: none; ">' . _MD_A_MODADMIN_HOME . '</a></li>'; |
336 | - echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
336 | + echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
337 | 337 | <a href="directories.php" style="padding: 3px 0.5em; |
338 | 338 | margin-left: 3px; |
339 | 339 | border: 1px solid #778; background: ' . $tblColors[1] . '; |
340 | 340 | text-decoration: none; ">' . _MD_A_DIRADMIN . '</a></li>'; |
341 | - echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
341 | + echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
342 | 342 | <a href="fieldtypes.php" style="padding: 3px 0.5em; |
343 | 343 | margin-left: 3px; |
344 | 344 | border: 1px solid #778; background: ' . $tblColors[2] . '; |
345 | 345 | text-decoration: none; ">' . _MD_A_FTYPESADMIN . '</a></li>'; |
346 | - // echo "<li style=\"list-style: none; margin: 0; display: inline; \"> |
|
347 | - // <a href=\"addresstypes.php\" style=\"padding: 3px 0.5em; |
|
348 | - // margin-left: 3px; |
|
349 | - // border: 1px solid #778; background: ".$tblColors[3]."; |
|
350 | - // text-decoration: none; \">"._MD_A_ATYPESADMIN."</a></li>"; |
|
351 | - echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
346 | + // echo "<li style=\"list-style: none; margin: 0; display: inline; \"> |
|
347 | + // <a href=\"addresstypes.php\" style=\"padding: 3px 0.5em; |
|
348 | + // margin-left: 3px; |
|
349 | + // border: 1px solid #778; background: ".$tblColors[3]."; |
|
350 | + // text-decoration: none; \">"._MD_A_ATYPESADMIN."</a></li>"; |
|
351 | + echo '<li style="list-style: none; margin: 0; display: inline; "> |
|
352 | 352 | <a href="subscriptions.php" style="padding: 3px 0.5em; |
353 | 353 | margin-left: 3px; |
354 | 354 | border: 1px solid #778; background: ' . $tblColors[4] . '; |
355 | 355 | text-decoration: none; ">' . _MD_A_ASUBSCRIPTIONSADMIN . '</a></li>'; |
356 | - echo '</div></ul>'; |
|
356 | + echo '</div></ul>'; |
|
357 | 357 | } |
358 | 358 | |
359 | 359 | /** |
@@ -362,20 +362,20 @@ discard block |
||
362 | 362 | */ |
363 | 363 | function getTypeFromId($typeid = '0') |
364 | 364 | { |
365 | - global $xoopsDB; |
|
366 | - $myts = MyTextSanitizer::getInstance(); |
|
367 | - $result = $xoopsDB->query('SELECT typename FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') . " WHERE typeid = '" . $typeid . '\''); |
|
368 | - $num_results = $xoopsDB->getRowsNum($result); |
|
369 | - $typename = ''; |
|
370 | - if (!$result) { |
|
371 | - return 0; |
|
372 | - } |
|
373 | - for ($i = 0; $i < $num_results; ++$i) { |
|
374 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
375 | - $typename = $row['typename']; |
|
376 | - } |
|
377 | - |
|
378 | - return $typename; |
|
365 | + global $xoopsDB; |
|
366 | + $myts = MyTextSanitizer::getInstance(); |
|
367 | + $result = $xoopsDB->query('SELECT typename FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') . " WHERE typeid = '" . $typeid . '\''); |
|
368 | + $num_results = $xoopsDB->getRowsNum($result); |
|
369 | + $typename = ''; |
|
370 | + if (!$result) { |
|
371 | + return 0; |
|
372 | + } |
|
373 | + for ($i = 0; $i < $num_results; ++$i) { |
|
374 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
375 | + $typename = $row['typename']; |
|
376 | + } |
|
377 | + |
|
378 | + return $typename; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -384,20 +384,20 @@ discard block |
||
384 | 384 | */ |
385 | 385 | function getDirId($catid = '0') |
386 | 386 | { |
387 | - global $xoopsDB; |
|
388 | - $myts = MyTextSanitizer::getInstance(); |
|
389 | - $result = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE cid = '" . $catid . '\''); |
|
390 | - $num_results = $xoopsDB->getRowsNum($result); |
|
391 | - $dirid = 0; |
|
392 | - if (!$result) { |
|
393 | - return 0; |
|
394 | - } |
|
395 | - for ($i = 0; $i < $num_results; ++$i) { |
|
396 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
397 | - $dirid = $row['dirid']; |
|
398 | - } |
|
399 | - |
|
400 | - return $dirid; |
|
387 | + global $xoopsDB; |
|
388 | + $myts = MyTextSanitizer::getInstance(); |
|
389 | + $result = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE cid = '" . $catid . '\''); |
|
390 | + $num_results = $xoopsDB->getRowsNum($result); |
|
391 | + $dirid = 0; |
|
392 | + if (!$result) { |
|
393 | + return 0; |
|
394 | + } |
|
395 | + for ($i = 0; $i < $num_results; ++$i) { |
|
396 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
397 | + $dirid = $row['dirid']; |
|
398 | + } |
|
399 | + |
|
400 | + return $dirid; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | /** |
@@ -406,20 +406,20 @@ discard block |
||
406 | 406 | */ |
407 | 407 | function checkDescription($catid = '0') |
408 | 408 | { |
409 | - global $xoopsDB; |
|
410 | - $myts = MyTextSanitizer::getInstance(); |
|
411 | - $result = $xoopsDB->query('SELECT txtid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat_txt') . " WHERE cid = '" . $catid . '\''); |
|
412 | - $num_results = $xoopsDB->getRowsNum($result); |
|
413 | - $txtid = false; |
|
414 | - if (!$result) { |
|
415 | - return false; |
|
416 | - } |
|
417 | - for ($i = 0; $i < $num_results; ++$i) { |
|
418 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
419 | - $txtid = $row['txtid']; |
|
420 | - } |
|
421 | - |
|
422 | - return $txtid; |
|
409 | + global $xoopsDB; |
|
410 | + $myts = MyTextSanitizer::getInstance(); |
|
411 | + $result = $xoopsDB->query('SELECT txtid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat_txt') . " WHERE cid = '" . $catid . '\''); |
|
412 | + $num_results = $xoopsDB->getRowsNum($result); |
|
413 | + $txtid = false; |
|
414 | + if (!$result) { |
|
415 | + return false; |
|
416 | + } |
|
417 | + for ($i = 0; $i < $num_results; ++$i) { |
|
418 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
419 | + $txtid = $row['txtid']; |
|
420 | + } |
|
421 | + |
|
422 | + return $txtid; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
@@ -428,20 +428,20 @@ discard block |
||
428 | 428 | */ |
429 | 429 | function getTemplateFromCatid($get_catid = '0') |
430 | 430 | { |
431 | - global $xoopsDB; |
|
432 | - $myts = MyTextSanitizer::getInstance(); |
|
433 | - $result = $xoopsDB->query('SELECT c.tplid, t.name FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat_tpl') . ' c, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_tpl') . " t WHERE c.tplid=t.tplid AND c.catid = '" . $get_catid . '\''); |
|
434 | - $num_results = $xoopsDB->getRowsNum($result); |
|
435 | - $tplname = ''; |
|
436 | - if (!$result) { |
|
437 | - return 0; |
|
438 | - } |
|
439 | - for ($i = 0; $i < $num_results; ++$i) { |
|
440 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
441 | - $tplname = $row['name']; |
|
442 | - } |
|
443 | - |
|
444 | - return $tplname; |
|
431 | + global $xoopsDB; |
|
432 | + $myts = MyTextSanitizer::getInstance(); |
|
433 | + $result = $xoopsDB->query('SELECT c.tplid, t.name FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat_tpl') . ' c, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_tpl') . " t WHERE c.tplid=t.tplid AND c.catid = '" . $get_catid . '\''); |
|
434 | + $num_results = $xoopsDB->getRowsNum($result); |
|
435 | + $tplname = ''; |
|
436 | + if (!$result) { |
|
437 | + return 0; |
|
438 | + } |
|
439 | + for ($i = 0; $i < $num_results; ++$i) { |
|
440 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
441 | + $tplname = $row['name']; |
|
442 | + } |
|
443 | + |
|
444 | + return $tplname; |
|
445 | 445 | } |
446 | 446 | |
447 | 447 | /** |
@@ -451,45 +451,45 @@ discard block |
||
451 | 451 | */ |
452 | 452 | function getCatSelectArea($item = '0', $dirid = '0') |
453 | 453 | { |
454 | - global $xoopsDB, $myts, $eh, $mytree, $moddir, $get_itemid; |
|
455 | - $sql = 'SELECT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
456 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
457 | - . ' c LEFT JOIN ' |
|
458 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
459 | - . ' x ON (c.cid=x.cid AND x.itemid=' |
|
460 | - . $item |
|
461 | - . ") WHERE c.dirid='" |
|
462 | - . $dirid |
|
463 | - . '\' AND c.pid=\'0\' AND c.active=\'1\''; |
|
464 | - $mainresult = $xoopsDB->query($sql); |
|
465 | - $numrows = $xoopsDB->getRowsNum($mainresult); |
|
466 | - $output = '<table>'; |
|
467 | - if ($numrows > 0) { |
|
468 | - $cats = ''; |
|
469 | - $output .= '<tr><td class="categoryHeader" colspan="2"><strong>' . _MD_CATTITLE . '</strong></td><td class="categoryHeader"><strong>' . _MD_SELECT . "</strong></td></tr>\n"; |
|
470 | - $brench = 0; |
|
471 | - $tab = ''; |
|
472 | - while (list($cid, $title, $pid, $allowlist, $active) = $xoopsDB->fetchRow($mainresult)) { |
|
473 | - //For each cid, get all 'first children' using getFirstChildId() function |
|
474 | - if ($allowlist != '0') { |
|
475 | - if ($active == '1') { |
|
476 | - $checked = ' checked'; |
|
477 | - } else { |
|
478 | - $checked = ''; |
|
479 | - } |
|
480 | - $checkbox = '<input type="checkbox" name="selected' . $cid . "\"$checked"; |
|
481 | - } else { |
|
482 | - $checkbox = ' '; |
|
483 | - } |
|
484 | - $output .= '<tr><td><strong>' . $tab . '' . $title . "</strong></td><td> </td><td>$checkbox</td></tr>\n"; |
|
485 | - $output .= getCatSelectAreaChildren($cid, 0, $dirid); |
|
486 | - } |
|
487 | - } else { |
|
488 | - $output .= '<tr><td>' . _MD_NORESULTS . '</td></tr>'; |
|
489 | - } |
|
490 | - $output .= '</table>'; |
|
491 | - |
|
492 | - return $output; |
|
454 | + global $xoopsDB, $myts, $eh, $mytree, $moddir, $get_itemid; |
|
455 | + $sql = 'SELECT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
456 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
457 | + . ' c LEFT JOIN ' |
|
458 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
459 | + . ' x ON (c.cid=x.cid AND x.itemid=' |
|
460 | + . $item |
|
461 | + . ") WHERE c.dirid='" |
|
462 | + . $dirid |
|
463 | + . '\' AND c.pid=\'0\' AND c.active=\'1\''; |
|
464 | + $mainresult = $xoopsDB->query($sql); |
|
465 | + $numrows = $xoopsDB->getRowsNum($mainresult); |
|
466 | + $output = '<table>'; |
|
467 | + if ($numrows > 0) { |
|
468 | + $cats = ''; |
|
469 | + $output .= '<tr><td class="categoryHeader" colspan="2"><strong>' . _MD_CATTITLE . '</strong></td><td class="categoryHeader"><strong>' . _MD_SELECT . "</strong></td></tr>\n"; |
|
470 | + $brench = 0; |
|
471 | + $tab = ''; |
|
472 | + while (list($cid, $title, $pid, $allowlist, $active) = $xoopsDB->fetchRow($mainresult)) { |
|
473 | + //For each cid, get all 'first children' using getFirstChildId() function |
|
474 | + if ($allowlist != '0') { |
|
475 | + if ($active == '1') { |
|
476 | + $checked = ' checked'; |
|
477 | + } else { |
|
478 | + $checked = ''; |
|
479 | + } |
|
480 | + $checkbox = '<input type="checkbox" name="selected' . $cid . "\"$checked"; |
|
481 | + } else { |
|
482 | + $checkbox = ' '; |
|
483 | + } |
|
484 | + $output .= '<tr><td><strong>' . $tab . '' . $title . "</strong></td><td> </td><td>$checkbox</td></tr>\n"; |
|
485 | + $output .= getCatSelectAreaChildren($cid, 0, $dirid); |
|
486 | + } |
|
487 | + } else { |
|
488 | + $output .= '<tr><td>' . _MD_NORESULTS . '</td></tr>'; |
|
489 | + } |
|
490 | + $output .= '</table>'; |
|
491 | + |
|
492 | + return $output; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -499,46 +499,46 @@ discard block |
||
499 | 499 | */ |
500 | 500 | function getCatSelectAreaChildren($childid = '0', $level = '0') |
501 | 501 | { |
502 | - global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir, $get_itemid; |
|
503 | - $tab = ' '; |
|
504 | - $level = $level; |
|
505 | - $output = ''; |
|
506 | - $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
507 | - for ($i = 0; $i < $level; ++$i) { |
|
508 | - $tab .= ' '; |
|
509 | - } |
|
510 | - $sql = 'SELECT DISTINCT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
511 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
512 | - . ' c LEFT JOIN ' |
|
513 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
514 | - . " x ON (c.cid=x.cid AND x.itemid='" |
|
515 | - . $get_itemid |
|
516 | - . '\') WHERE c.dirid=\'' |
|
517 | - . $get_dirid |
|
518 | - . '\' AND c.pid=\'' |
|
519 | - . $childid |
|
520 | - . '\' AND c.active=\'1\''; |
|
521 | - $childresult = $xoopsDB->query($sql); |
|
522 | - $numrows = $xoopsDB->getRowsNum($childresult); |
|
523 | - if ($numrows > 0) { |
|
524 | - while (list($cid, $title, $pid, $allowlist, $active) = $xoopsDB->fetchRow($childresult)) { |
|
525 | - if ($allowlist != '0') { |
|
526 | - if ($active == '1') { |
|
527 | - $checked = ' checked'; |
|
528 | - } else { |
|
529 | - $checked = ''; |
|
530 | - } |
|
531 | - $checkbox = '<input type="checkbox" name="selected' . $cid . "\"$checked"; |
|
532 | - } else { |
|
533 | - $checkbox = ' '; |
|
534 | - } |
|
535 | - $output .= '<tr><td><strong>' . $tab . '' . $plus . ' ' . $title . "</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
536 | - $newlevel = $level + 1; |
|
537 | - $output .= getCatSelectAreaChildren($cid, $newlevel); |
|
538 | - } |
|
539 | - } |
|
540 | - |
|
541 | - return $output; |
|
502 | + global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir, $get_itemid; |
|
503 | + $tab = ' '; |
|
504 | + $level = $level; |
|
505 | + $output = ''; |
|
506 | + $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
507 | + for ($i = 0; $i < $level; ++$i) { |
|
508 | + $tab .= ' '; |
|
509 | + } |
|
510 | + $sql = 'SELECT DISTINCT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
511 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
512 | + . ' c LEFT JOIN ' |
|
513 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
514 | + . " x ON (c.cid=x.cid AND x.itemid='" |
|
515 | + . $get_itemid |
|
516 | + . '\') WHERE c.dirid=\'' |
|
517 | + . $get_dirid |
|
518 | + . '\' AND c.pid=\'' |
|
519 | + . $childid |
|
520 | + . '\' AND c.active=\'1\''; |
|
521 | + $childresult = $xoopsDB->query($sql); |
|
522 | + $numrows = $xoopsDB->getRowsNum($childresult); |
|
523 | + if ($numrows > 0) { |
|
524 | + while (list($cid, $title, $pid, $allowlist, $active) = $xoopsDB->fetchRow($childresult)) { |
|
525 | + if ($allowlist != '0') { |
|
526 | + if ($active == '1') { |
|
527 | + $checked = ' checked'; |
|
528 | + } else { |
|
529 | + $checked = ''; |
|
530 | + } |
|
531 | + $checkbox = '<input type="checkbox" name="selected' . $cid . "\"$checked"; |
|
532 | + } else { |
|
533 | + $checkbox = ' '; |
|
534 | + } |
|
535 | + $output .= '<tr><td><strong>' . $tab . '' . $plus . ' ' . $title . "</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
536 | + $newlevel = $level + 1; |
|
537 | + $output .= getCatSelectAreaChildren($cid, $newlevel); |
|
538 | + } |
|
539 | + } |
|
540 | + |
|
541 | + return $output; |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
@@ -547,21 +547,21 @@ discard block |
||
547 | 547 | */ |
548 | 548 | function getDirIdFromItem($item = 0) |
549 | 549 | { |
550 | - global $xoopsDB; |
|
551 | - $block = array(); |
|
552 | - $myts = MyTextSanitizer::getInstance(); |
|
553 | - $dirid = 0; |
|
554 | - $result = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid = ' . $item . ''); |
|
555 | - $num_results = $xoopsDB->getRowsNum($result); |
|
556 | - if (!$result) { |
|
557 | - return 0; |
|
558 | - } |
|
559 | - for ($i = 0; $i < $num_results; ++$i) { |
|
560 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
561 | - $dirid = $row['dirid']; |
|
562 | - } |
|
563 | - |
|
564 | - return $dirid; |
|
550 | + global $xoopsDB; |
|
551 | + $block = array(); |
|
552 | + $myts = MyTextSanitizer::getInstance(); |
|
553 | + $dirid = 0; |
|
554 | + $result = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid = ' . $item . ''); |
|
555 | + $num_results = $xoopsDB->getRowsNum($result); |
|
556 | + if (!$result) { |
|
557 | + return 0; |
|
558 | + } |
|
559 | + for ($i = 0; $i < $num_results; ++$i) { |
|
560 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
561 | + $dirid = $row['dirid']; |
|
562 | + } |
|
563 | + |
|
564 | + return $dirid; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | /** |
@@ -570,21 +570,21 @@ discard block |
||
570 | 570 | */ |
571 | 571 | function getUserIdFromItem($item = 0) |
572 | 572 | { |
573 | - global $xoopsDB; |
|
574 | - $block = array(); |
|
575 | - $myts = MyTextSanitizer::getInstance(); |
|
576 | - $userid = 0; |
|
577 | - $result = $xoopsDB->query('SELECT uid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid = ' . $item . ''); |
|
578 | - $num_results = $xoopsDB->getRowsNum($result); |
|
579 | - if (!$result) { |
|
580 | - return 0; |
|
581 | - } |
|
582 | - for ($i = 0; $i < $num_results; ++$i) { |
|
583 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
584 | - $userid = $row['uid']; |
|
585 | - } |
|
586 | - |
|
587 | - return $userid; |
|
573 | + global $xoopsDB; |
|
574 | + $block = array(); |
|
575 | + $myts = MyTextSanitizer::getInstance(); |
|
576 | + $userid = 0; |
|
577 | + $result = $xoopsDB->query('SELECT uid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid = ' . $item . ''); |
|
578 | + $num_results = $xoopsDB->getRowsNum($result); |
|
579 | + if (!$result) { |
|
580 | + return 0; |
|
581 | + } |
|
582 | + for ($i = 0; $i < $num_results; ++$i) { |
|
583 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
584 | + $userid = $row['uid']; |
|
585 | + } |
|
586 | + |
|
587 | + return $userid; |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | //updates rating data in itemtable for a given item |
@@ -593,18 +593,18 @@ discard block |
||
593 | 593 | */ |
594 | 594 | function updaterating($sel_id) |
595 | 595 | { |
596 | - global $xoopsDB; |
|
597 | - $query = 'SELECT rating FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . ' WHERE itemid = ' . $sel_id . ''; |
|
598 | - $voteresult = $xoopsDB->query($query); |
|
599 | - $votesDB = $xoopsDB->getRowsNum($voteresult); |
|
600 | - $totalrating = 0; |
|
601 | - while (list($rating) = $xoopsDB->fetchRow($voteresult)) { |
|
602 | - $totalrating += $rating; |
|
603 | - } |
|
604 | - $finalrating = $totalrating / $votesDB; |
|
605 | - $finalrating = number_format($finalrating, 4); |
|
606 | - $query = 'UPDATE ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " SET rating=$finalrating, votes=$votesDB WHERE itemid = $sel_id"; |
|
607 | - $xoopsDB->query($query) or exit(); |
|
596 | + global $xoopsDB; |
|
597 | + $query = 'SELECT rating FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . ' WHERE itemid = ' . $sel_id . ''; |
|
598 | + $voteresult = $xoopsDB->query($query); |
|
599 | + $votesDB = $xoopsDB->getRowsNum($voteresult); |
|
600 | + $totalrating = 0; |
|
601 | + while (list($rating) = $xoopsDB->fetchRow($voteresult)) { |
|
602 | + $totalrating += $rating; |
|
603 | + } |
|
604 | + $finalrating = $totalrating / $votesDB; |
|
605 | + $finalrating = number_format($finalrating, 4); |
|
606 | + $query = 'UPDATE ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " SET rating=$finalrating, votes=$votesDB WHERE itemid = $sel_id"; |
|
607 | + $xoopsDB->query($query) or exit(); |
|
608 | 608 | } |
609 | 609 | |
610 | 610 | /** |
@@ -613,42 +613,42 @@ discard block |
||
613 | 613 | */ |
614 | 614 | function getAddressFields($typeid = '0') |
615 | 615 | { |
616 | - global $xoopsDB; |
|
617 | - $block = array(); |
|
618 | - $myts = MyTextSanitizer::getInstance(); |
|
619 | - $dirid = 0; |
|
620 | - $addressarray = array(); |
|
621 | - if ($typeid == '0') { |
|
622 | - $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_address_types') . " WHERE defaultyn = '1'"); |
|
623 | - } else { |
|
624 | - $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_address_types') . " WHERE typeid = '$typeid'"); |
|
625 | - } |
|
626 | - $num_results = $xoopsDB->getRowsNum($result); |
|
627 | - if (!$result) { |
|
628 | - return 0; |
|
629 | - } |
|
630 | - while (list($typeid, $address, $address2, $zip, $postcode, $lat, $lon, $phone, $fax, $mobile, $city, $country, $typename, $uselocyn) = $xoopsDB->fetchRow($result)) { |
|
631 | - $addressarray = array( |
|
632 | - 'typeid' => $typeid, |
|
633 | - 'typename' => $typename, |
|
634 | - 'uselocyn' => $uselocyn, |
|
635 | - 'addressfields' => array( |
|
636 | - 'address' => $address, |
|
637 | - 'address2' => $address2, |
|
638 | - 'zip' => $zip, |
|
639 | - 'postcode' => $postcode, |
|
640 | - 'lat' => $lat, |
|
641 | - 'lon' => $lon, |
|
642 | - 'phone' => $phone, |
|
643 | - 'fax' => $fax, |
|
644 | - 'mobile' => $mobile, |
|
645 | - 'city' => $city, |
|
646 | - 'country' => $country |
|
647 | - ) |
|
648 | - ); |
|
649 | - } |
|
650 | - |
|
651 | - return $addressarray; |
|
616 | + global $xoopsDB; |
|
617 | + $block = array(); |
|
618 | + $myts = MyTextSanitizer::getInstance(); |
|
619 | + $dirid = 0; |
|
620 | + $addressarray = array(); |
|
621 | + if ($typeid == '0') { |
|
622 | + $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_address_types') . " WHERE defaultyn = '1'"); |
|
623 | + } else { |
|
624 | + $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_address_types') . " WHERE typeid = '$typeid'"); |
|
625 | + } |
|
626 | + $num_results = $xoopsDB->getRowsNum($result); |
|
627 | + if (!$result) { |
|
628 | + return 0; |
|
629 | + } |
|
630 | + while (list($typeid, $address, $address2, $zip, $postcode, $lat, $lon, $phone, $fax, $mobile, $city, $country, $typename, $uselocyn) = $xoopsDB->fetchRow($result)) { |
|
631 | + $addressarray = array( |
|
632 | + 'typeid' => $typeid, |
|
633 | + 'typename' => $typename, |
|
634 | + 'uselocyn' => $uselocyn, |
|
635 | + 'addressfields' => array( |
|
636 | + 'address' => $address, |
|
637 | + 'address2' => $address2, |
|
638 | + 'zip' => $zip, |
|
639 | + 'postcode' => $postcode, |
|
640 | + 'lat' => $lat, |
|
641 | + 'lon' => $lon, |
|
642 | + 'phone' => $phone, |
|
643 | + 'fax' => $fax, |
|
644 | + 'mobile' => $mobile, |
|
645 | + 'city' => $city, |
|
646 | + 'country' => $country |
|
647 | + ) |
|
648 | + ); |
|
649 | + } |
|
650 | + |
|
651 | + return $addressarray; |
|
652 | 652 | } |
653 | 653 | |
654 | 654 | /** |
@@ -657,31 +657,31 @@ discard block |
||
657 | 657 | */ |
658 | 658 | function getAddressValues($addrid = '0') |
659 | 659 | { |
660 | - global $xoopsDB; |
|
661 | - $myts = MyTextSanitizer::getInstance(); |
|
662 | - $addressarray = array(); |
|
663 | - $result = $xoopsDB->query('SELECT address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_addresses') . " WHERE addrid = '$addrid'"); |
|
664 | - $num_results = $xoopsDB->getRowsNum($result); |
|
665 | - if ($num_results == 0) { |
|
666 | - $addressarray = array('address' => '', 'address2' => '', 'zip' => '', 'postcode' => '', 'lat' => '', 'lon' => '', 'phone' => '', 'fax' => '', 'mobile' => '', 'city' => '', 'country' => ''); |
|
667 | - } |
|
668 | - while (list($address, $address2, $zip, $postcode, $lat, $lon, $phone, $fax, $mobile, $city, $country) = $xoopsDB->fetchRow($result)) { |
|
669 | - $addressarray = array( |
|
670 | - 'address' => $address, |
|
671 | - 'address2' => $address2, |
|
672 | - 'zip' => $zip, |
|
673 | - 'postcode' => $postcode, |
|
674 | - 'lat' => $lat, |
|
675 | - 'lon' => $lon, |
|
676 | - 'phone' => $phone, |
|
677 | - 'fax' => $fax, |
|
678 | - 'mobile' => $mobile, |
|
679 | - 'city' => $city, |
|
680 | - 'country' => $country |
|
681 | - ); |
|
682 | - } |
|
683 | - |
|
684 | - return $addressarray; |
|
660 | + global $xoopsDB; |
|
661 | + $myts = MyTextSanitizer::getInstance(); |
|
662 | + $addressarray = array(); |
|
663 | + $result = $xoopsDB->query('SELECT address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_addresses') . " WHERE addrid = '$addrid'"); |
|
664 | + $num_results = $xoopsDB->getRowsNum($result); |
|
665 | + if ($num_results == 0) { |
|
666 | + $addressarray = array('address' => '', 'address2' => '', 'zip' => '', 'postcode' => '', 'lat' => '', 'lon' => '', 'phone' => '', 'fax' => '', 'mobile' => '', 'city' => '', 'country' => ''); |
|
667 | + } |
|
668 | + while (list($address, $address2, $zip, $postcode, $lat, $lon, $phone, $fax, $mobile, $city, $country) = $xoopsDB->fetchRow($result)) { |
|
669 | + $addressarray = array( |
|
670 | + 'address' => $address, |
|
671 | + 'address2' => $address2, |
|
672 | + 'zip' => $zip, |
|
673 | + 'postcode' => $postcode, |
|
674 | + 'lat' => $lat, |
|
675 | + 'lon' => $lon, |
|
676 | + 'phone' => $phone, |
|
677 | + 'fax' => $fax, |
|
678 | + 'mobile' => $mobile, |
|
679 | + 'city' => $city, |
|
680 | + 'country' => $country |
|
681 | + ); |
|
682 | + } |
|
683 | + |
|
684 | + return $addressarray; |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | /** |
@@ -689,54 +689,54 @@ discard block |
||
689 | 689 | */ |
690 | 690 | function getCatSelectArea2() |
691 | 691 | { |
692 | - global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir, $xoopsUser, $xoopsModule; |
|
693 | - if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
694 | - $isadmin = true; |
|
695 | - } else { |
|
696 | - $isadmin = false; |
|
697 | - } |
|
698 | - $sql = 'SELECT cid, title, pid, allowlist FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\' AND active=\'1\''; |
|
699 | - $mainresult = $xoopsDB->query($sql); |
|
700 | - $numrows = $xoopsDB->getRowsNum($mainresult); |
|
701 | - $output = ''; |
|
702 | - if ($numrows > 0) { |
|
703 | - $cats = ''; |
|
704 | - $output = '<table class="categoryTable"><tr><td class="categoryHeader" colspan="2"><strong>' . _MD_CATTITLE . '</strong></td><td class="categoryHeader"><strong>' . _MD_SELECT . "</strong></td></tr>\n"; |
|
705 | - $brench = 0; |
|
706 | - $tab = ''; |
|
707 | - $selectablecat = false; |
|
708 | - while (list($cid, $title, $pid, $allowlist) = $xoopsDB->fetchRow($mainresult)) { |
|
709 | - //For each cid, get all 'first children' using getFirstChildId() function |
|
710 | - if ($allowlist != '0') { |
|
711 | - $checkbox = '<input type="checkbox" name="selected' . $cid . '"'; |
|
712 | - $selectablecat = true; |
|
713 | - //$checked = ""; |
|
714 | - } else { |
|
715 | - //$checked = " checked=checked"; |
|
716 | - $checkbox = ' '; |
|
717 | - } |
|
718 | - //$cats .= $cid."|"; |
|
719 | - $output .= '<tr><td><strong>' . $tab . '' . $title . "</strong></td><td> </td><td align=\"center\">$checkbox</td></tr>\n"; |
|
720 | - $output .= getCatSelectAreaChildren2($cid); |
|
721 | - if ($output !== '') { |
|
722 | - $selectablecat = true; |
|
723 | - } |
|
724 | - } |
|
725 | - } else { |
|
726 | - redirect_header(XOOPS_URL . "/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
727 | - exit(); |
|
728 | - //$output = ""._MD_NORESULTS.""; |
|
729 | - } |
|
730 | - if ($isadmin) { |
|
731 | - $output .= '<tr><td><br><a href="admin/categories.php?dirid=' . $get_dirid . '">' . _MD_EDITCATEGORIES . '</a></td></tr>'; |
|
732 | - } |
|
733 | - $output .= '</table>'; |
|
734 | - if ($selectablecat === false) { |
|
735 | - redirect_header(XOOPS_URL . "/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
736 | - exit(); |
|
737 | - } |
|
738 | - |
|
739 | - return $output; |
|
692 | + global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir, $xoopsUser, $xoopsModule; |
|
693 | + if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
694 | + $isadmin = true; |
|
695 | + } else { |
|
696 | + $isadmin = false; |
|
697 | + } |
|
698 | + $sql = 'SELECT cid, title, pid, allowlist FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\' AND active=\'1\''; |
|
699 | + $mainresult = $xoopsDB->query($sql); |
|
700 | + $numrows = $xoopsDB->getRowsNum($mainresult); |
|
701 | + $output = ''; |
|
702 | + if ($numrows > 0) { |
|
703 | + $cats = ''; |
|
704 | + $output = '<table class="categoryTable"><tr><td class="categoryHeader" colspan="2"><strong>' . _MD_CATTITLE . '</strong></td><td class="categoryHeader"><strong>' . _MD_SELECT . "</strong></td></tr>\n"; |
|
705 | + $brench = 0; |
|
706 | + $tab = ''; |
|
707 | + $selectablecat = false; |
|
708 | + while (list($cid, $title, $pid, $allowlist) = $xoopsDB->fetchRow($mainresult)) { |
|
709 | + //For each cid, get all 'first children' using getFirstChildId() function |
|
710 | + if ($allowlist != '0') { |
|
711 | + $checkbox = '<input type="checkbox" name="selected' . $cid . '"'; |
|
712 | + $selectablecat = true; |
|
713 | + //$checked = ""; |
|
714 | + } else { |
|
715 | + //$checked = " checked=checked"; |
|
716 | + $checkbox = ' '; |
|
717 | + } |
|
718 | + //$cats .= $cid."|"; |
|
719 | + $output .= '<tr><td><strong>' . $tab . '' . $title . "</strong></td><td> </td><td align=\"center\">$checkbox</td></tr>\n"; |
|
720 | + $output .= getCatSelectAreaChildren2($cid); |
|
721 | + if ($output !== '') { |
|
722 | + $selectablecat = true; |
|
723 | + } |
|
724 | + } |
|
725 | + } else { |
|
726 | + redirect_header(XOOPS_URL . "/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
727 | + exit(); |
|
728 | + //$output = ""._MD_NORESULTS.""; |
|
729 | + } |
|
730 | + if ($isadmin) { |
|
731 | + $output .= '<tr><td><br><a href="admin/categories.php?dirid=' . $get_dirid . '">' . _MD_EDITCATEGORIES . '</a></td></tr>'; |
|
732 | + } |
|
733 | + $output .= '</table>'; |
|
734 | + if ($selectablecat === false) { |
|
735 | + redirect_header(XOOPS_URL . "/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
736 | + exit(); |
|
737 | + } |
|
738 | + |
|
739 | + return $output; |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | /** |
@@ -746,29 +746,29 @@ discard block |
||
746 | 746 | */ |
747 | 747 | function getCatSelectAreaChildren2($childid = '0', $level = '0') |
748 | 748 | { |
749 | - global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
750 | - $tab = ' '; |
|
751 | - $level = $level; |
|
752 | - $output = ''; |
|
753 | - $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
754 | - for ($i = 0; $i < $level; ++$i) { |
|
755 | - $tab .= ' '; |
|
756 | - } |
|
757 | - $sql = 'SELECT cid, title, pid, allowlist FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . (int)$get_dirid . '\' AND pid=\'' . (int)$childid . '\' AND active=\'1\''; |
|
758 | - $childresult = $xoopsDB->query($sql); |
|
759 | - $numrows = $xoopsDB->getRowsNum($childresult); |
|
760 | - if ($numrows > 0) { |
|
761 | - while (list($cid, $title, $pid, $allowlist) = $xoopsDB->fetchRow($childresult)) { |
|
762 | - if ($allowlist != '0') { |
|
763 | - $checkbox = '<input type="checkbox" name="selected' . $cid . '"'; |
|
764 | - } else { |
|
765 | - $checkbox = ' '; |
|
766 | - } |
|
767 | - $output .= '<tr><td><strong>' . $tab . '' . $plus . ' ' . $title . "</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
768 | - $newlevel = $level + 1; |
|
769 | - $output .= getCatSelectAreaChildren($cid, $newlevel, $get_dirid); |
|
770 | - } |
|
771 | - } |
|
772 | - |
|
773 | - return $output; |
|
749 | + global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
750 | + $tab = ' '; |
|
751 | + $level = $level; |
|
752 | + $output = ''; |
|
753 | + $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
754 | + for ($i = 0; $i < $level; ++$i) { |
|
755 | + $tab .= ' '; |
|
756 | + } |
|
757 | + $sql = 'SELECT cid, title, pid, allowlist FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . (int)$get_dirid . '\' AND pid=\'' . (int)$childid . '\' AND active=\'1\''; |
|
758 | + $childresult = $xoopsDB->query($sql); |
|
759 | + $numrows = $xoopsDB->getRowsNum($childresult); |
|
760 | + if ($numrows > 0) { |
|
761 | + while (list($cid, $title, $pid, $allowlist) = $xoopsDB->fetchRow($childresult)) { |
|
762 | + if ($allowlist != '0') { |
|
763 | + $checkbox = '<input type="checkbox" name="selected' . $cid . '"'; |
|
764 | + } else { |
|
765 | + $checkbox = ' '; |
|
766 | + } |
|
767 | + $output .= '<tr><td><strong>' . $tab . '' . $plus . ' ' . $title . "</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
768 | + $newlevel = $level + 1; |
|
769 | + $output .= getCatSelectAreaChildren($cid, $newlevel, $get_dirid); |
|
770 | + } |
|
771 | + } |
|
772 | + |
|
773 | + return $output; |
|
774 | 774 | } |
@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | { |
62 | 62 | $orderbyTrans = ''; |
63 | 63 | if ($orderby === 'hits ASC') { |
64 | - $orderbyTrans = '' . _MD_POPULARITYLTOM . ''; |
|
64 | + $orderbyTrans = ''._MD_POPULARITYLTOM.''; |
|
65 | 65 | } |
66 | 66 | if ($orderby === 'hits DESC') { |
67 | - $orderbyTrans = '' . _MD_POPULARITYMTOL . ''; |
|
67 | + $orderbyTrans = ''._MD_POPULARITYMTOL.''; |
|
68 | 68 | } |
69 | 69 | if ($orderby === 'title ASC') { |
70 | - $orderbyTrans = '' . _MD_TITLEATOZ . ''; |
|
70 | + $orderbyTrans = ''._MD_TITLEATOZ.''; |
|
71 | 71 | } |
72 | 72 | if ($orderby === 'title DESC') { |
73 | - $orderbyTrans = '' . _MD_TITLEZTOA . ''; |
|
73 | + $orderbyTrans = ''._MD_TITLEZTOA.''; |
|
74 | 74 | } |
75 | 75 | if ($orderby === 'date ASC') { |
76 | - $orderbyTrans = '' . _MD_DATEOLD . ''; |
|
76 | + $orderbyTrans = ''._MD_DATEOLD.''; |
|
77 | 77 | } |
78 | 78 | if ($orderby === 'date DESC') { |
79 | - $orderbyTrans = '' . _MD_DATENEW . ''; |
|
79 | + $orderbyTrans = ''._MD_DATENEW.''; |
|
80 | 80 | } |
81 | 81 | if ($orderby === 'rating ASC') { |
82 | - $orderbyTrans = '' . _MD_RATINGLTOH . ''; |
|
82 | + $orderbyTrans = ''._MD_RATINGLTOH.''; |
|
83 | 83 | } |
84 | 84 | if ($orderby === 'rating DESC') { |
85 | - $orderbyTrans = '' . _MD_RATINGHTOL . ''; |
|
85 | + $orderbyTrans = ''._MD_RATINGHTOL.''; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | return $orderbyTrans; |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | $startdate = (time() - (86400 * $count)); |
136 | 136 | if ($startdate < $time) { |
137 | 137 | if ($status == 2) { |
138 | - $new = ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/newred.gif\" alt=\"" . _MD_NEWTHISWEEK . '">'; |
|
138 | + $new = ' <img src="'.XOOPS_URL."/modules/$moddir/assets/images/newred.gif\" alt=\""._MD_NEWTHISWEEK.'">'; |
|
139 | 139 | } elseif ($status == 3) { |
140 | - $new = ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/update.gif\" alt=\"" . _MD_UPTHISWEEK . '">'; |
|
140 | + $new = ' <img src="'.XOOPS_URL."/modules/$moddir/assets/images/update.gif\" alt=\""._MD_UPTHISWEEK.'">'; |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | { |
153 | 153 | global $xoopsModuleConfig, $moddir; |
154 | 154 | if ($hits >= $xoopsModuleConfig['popular']) { |
155 | - return ' <img src="' . XOOPS_URL . "/modules/$moddir/assets/images/pop.gif\" alt=\"" . _MD_POPULAR . '">'; |
|
155 | + return ' <img src="'.XOOPS_URL."/modules/$moddir/assets/images/pop.gif\" alt=\""._MD_POPULAR.'">'; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | return ''; |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | global $xoopsDB, $mytree; |
169 | 169 | $count = 0; |
170 | 170 | $arr = array(); |
171 | - $query = 'SELECT DISTINCT l.itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' l, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' x WHERE x.itemid=l.itemid AND x.cid=' . $sel_id . ''; |
|
171 | + $query = 'SELECT DISTINCT l.itemid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' l, '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat').' x WHERE x.itemid=l.itemid AND x.cid='.$sel_id.''; |
|
172 | 172 | if ($status !== '') { |
173 | 173 | $query .= " AND l.status>='$status'"; |
174 | 174 | } else { |
175 | 175 | $query .= ''; |
176 | 176 | } |
177 | - $query .= " AND x.active >= '1'"; |
|
177 | + $query .= " AND x.active >= '1'"; |
|
178 | 178 | $result = $xoopsDB->query($query); |
179 | 179 | //print_r($xoopsDB->fetchArray($result)); |
180 | 180 | if (!$result) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $arr = $mytree->getAllChildId($sel_id); |
187 | 187 | $size = count($arr); |
188 | 188 | for ($i = 0; $i < $size; ++$i) { |
189 | - $query2 = 'SELECT DISTINCT l.itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' l, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' x WHERE l.itemid=x.itemid AND x.cid=' . $arr[$i] . ''; |
|
189 | + $query2 = 'SELECT DISTINCT l.itemid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' l, '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat').' x WHERE l.itemid=x.itemid AND x.cid='.$arr[$i].''; |
|
190 | 190 | if ($status !== '') { |
191 | 191 | $query2 .= " AND l.status>='$status'"; |
192 | 192 | } else { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | global $xoopsDB, $mytree; |
213 | 213 | $count = 0; |
214 | 214 | $arr = array(); |
215 | - $query = 'SELECT count(*) FROM ' . $xoopsDB->prefix('links_links') . ' t, ' . $xoopsDB->prefix('links_x_loc_dest') . ' x WHERE x.ldestid=t.lid AND x.locdestid=' . $locdestid . ' AND t.cid=' . $sel_id . ''; |
|
215 | + $query = 'SELECT count(*) FROM '.$xoopsDB->prefix('links_links').' t, '.$xoopsDB->prefix('links_x_loc_dest').' x WHERE x.ldestid=t.lid AND x.locdestid='.$locdestid.' AND t.cid='.$sel_id.''; |
|
216 | 216 | // $query = "select DISTINCT count(lid) from ".$xoopsDB->prefix("links_links")." t, ".$xoopsDB->prefix("links_x_loc_dest")." x where x.ldestid=t.lid AND x.locdestid=".$locdestid." AND t.cid=".$sel_id.""; |
217 | 217 | // $query = "select count(*) from ".$xoopsDB->prefix("links_links")." where cid=".$sel_id.""; |
218 | 218 | if ($status !== '') { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $arr = $mytree->getAllChildId($sel_id); |
225 | 225 | $size = count($arr); |
226 | 226 | for ($i = 0; $i < $size; ++$i) { |
227 | - $query2 = 'select count(*) ' . $xoopsDB->prefix('links_links') . ' t, ' . $xoopsDB->prefix('links_x_loc_dest') . ' x where x.ldestid=t.lid AND x.locdestid=' . $locdestid . ' AND t.cid=' . $arr[$i] . ''; |
|
227 | + $query2 = 'select count(*) '.$xoopsDB->prefix('links_links').' t, '.$xoopsDB->prefix('links_x_loc_dest').' x where x.ldestid=t.lid AND x.locdestid='.$locdestid.' AND t.cid='.$arr[$i].''; |
|
228 | 228 | if ($status !== '') { |
229 | 229 | $query2 .= " and status>=$status"; |
230 | 230 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | global $xoopsDB; |
246 | 246 | $myts = MyTextSanitizer::getInstance(); |
247 | - $result = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE dirid = '" . $dirid . '\''); |
|
247 | + $result = $xoopsDB->query('SELECT name FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_dir')." WHERE dirid = '".$dirid.'\''); |
|
248 | 248 | $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
249 | 249 | if (!$result) { |
250 | 250 | return 0; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | global $xoopsDB; |
267 | 267 | //$block = array(); |
268 | 268 | $myts = MyTextSanitizer::getInstance(); |
269 | - $result = $xoopsDB->query('SELECT title FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE cid = '" . $cid . '\''); |
|
269 | + $result = $xoopsDB->query('SELECT title FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE cid = '".$cid.'\''); |
|
270 | 270 | $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
271 | 271 | if (!$result) { |
272 | 272 | return 0; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } else { |
292 | 292 | $isadmin = false; |
293 | 293 | } |
294 | - $result = $xoopsDB->query('SELECT xid, cid, itemid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . ' WHERE itemid = ' . $get_itemid . " AND active='1'"); |
|
294 | + $result = $xoopsDB->query('SELECT xid, cid, itemid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat').' WHERE itemid = '.$get_itemid." AND active='1'"); |
|
295 | 295 | $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
296 | 296 | if (!$result) { |
297 | 297 | return 0; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $output .= $path; |
307 | 307 | } |
308 | 308 | if ($isadmin) { |
309 | - $output .= '<br><a href="admin/categories.php?dirid=' . $get_dirid . '">' . _MD_EDITCATEGORIES . '</a>'; |
|
309 | + $output .= '<br><a href="admin/categories.php?dirid='.$get_dirid.'">'._MD_EDITCATEGORIES.'</a>'; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | //$output .= "<br><a href=\"editcategories.php?item=".$get_itemid."\">["._MD_EDIT_CATEGORIES."]</a>"; |
@@ -324,25 +324,25 @@ discard block |
||
324 | 324 | $tblColors[0] = $tblColors[1] = $tblColors[2] = $tblColors[3] = $tblColors[4] = $tblColors[5] = $tblColors[6] = $tblColors[7] = '#DDE'; |
325 | 325 | $tblColors[$currentoption] = 'white'; |
326 | 326 | echo "<table width=100% class='outer'><tr><td align=right> |
327 | - <font size=2>" . $xoopsModule->name() . ':' . $breadcrumb . '</font> |
|
327 | + <font size=2>" . $xoopsModule->name().':'.$breadcrumb.'</font> |
|
328 | 328 | </td></tr></table><br>'; |
329 | 329 | echo '<div id="navcontainer"><ul style="padding: 3px 0; margin-left: |
330 | 330 | 0;font: bold 12px Verdana, sans-serif; ">'; |
331 | 331 | echo '<li style="list-style: none; margin: 0; display: inline; "> |
332 | 332 | <a href="index.php" style="padding: 3px 0.5em; |
333 | 333 | margin-left: 3px; |
334 | - border: 1px solid #778; background: ' . $tblColors[0] . '; |
|
335 | - text-decoration: none; ">' . _MD_A_MODADMIN_HOME . '</a></li>'; |
|
334 | + border: 1px solid #778; background: ' . $tblColors[0].'; |
|
335 | + text-decoration: none; ">' . _MD_A_MODADMIN_HOME.'</a></li>'; |
|
336 | 336 | echo '<li style="list-style: none; margin: 0; display: inline; "> |
337 | 337 | <a href="directories.php" style="padding: 3px 0.5em; |
338 | 338 | margin-left: 3px; |
339 | - border: 1px solid #778; background: ' . $tblColors[1] . '; |
|
340 | - text-decoration: none; ">' . _MD_A_DIRADMIN . '</a></li>'; |
|
339 | + border: 1px solid #778; background: ' . $tblColors[1].'; |
|
340 | + text-decoration: none; ">' . _MD_A_DIRADMIN.'</a></li>'; |
|
341 | 341 | echo '<li style="list-style: none; margin: 0; display: inline; "> |
342 | 342 | <a href="fieldtypes.php" style="padding: 3px 0.5em; |
343 | 343 | margin-left: 3px; |
344 | - border: 1px solid #778; background: ' . $tblColors[2] . '; |
|
345 | - text-decoration: none; ">' . _MD_A_FTYPESADMIN . '</a></li>'; |
|
344 | + border: 1px solid #778; background: ' . $tblColors[2].'; |
|
345 | + text-decoration: none; ">' . _MD_A_FTYPESADMIN.'</a></li>'; |
|
346 | 346 | // echo "<li style=\"list-style: none; margin: 0; display: inline; \"> |
347 | 347 | // <a href=\"addresstypes.php\" style=\"padding: 3px 0.5em; |
348 | 348 | // margin-left: 3px; |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | echo '<li style="list-style: none; margin: 0; display: inline; "> |
352 | 352 | <a href="subscriptions.php" style="padding: 3px 0.5em; |
353 | 353 | margin-left: 3px; |
354 | - border: 1px solid #778; background: ' . $tblColors[4] . '; |
|
355 | - text-decoration: none; ">' . _MD_A_ASUBSCRIPTIONSADMIN . '</a></li>'; |
|
354 | + border: 1px solid #778; background: ' . $tblColors[4].'; |
|
355 | + text-decoration: none; ">' . _MD_A_ASUBSCRIPTIONSADMIN.'</a></li>'; |
|
356 | 356 | echo '</div></ul>'; |
357 | 357 | } |
358 | 358 | |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | { |
365 | 365 | global $xoopsDB; |
366 | 366 | $myts = MyTextSanitizer::getInstance(); |
367 | - $result = $xoopsDB->query('SELECT typename FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') . " WHERE typeid = '" . $typeid . '\''); |
|
367 | + $result = $xoopsDB->query('SELECT typename FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_itemtypes')." WHERE typeid = '".$typeid.'\''); |
|
368 | 368 | $num_results = $xoopsDB->getRowsNum($result); |
369 | 369 | $typename = ''; |
370 | 370 | if (!$result) { |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | { |
387 | 387 | global $xoopsDB; |
388 | 388 | $myts = MyTextSanitizer::getInstance(); |
389 | - $result = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE cid = '" . $catid . '\''); |
|
389 | + $result = $xoopsDB->query('SELECT dirid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE cid = '".$catid.'\''); |
|
390 | 390 | $num_results = $xoopsDB->getRowsNum($result); |
391 | 391 | $dirid = 0; |
392 | 392 | if (!$result) { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | { |
409 | 409 | global $xoopsDB; |
410 | 410 | $myts = MyTextSanitizer::getInstance(); |
411 | - $result = $xoopsDB->query('SELECT txtid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat_txt') . " WHERE cid = '" . $catid . '\''); |
|
411 | + $result = $xoopsDB->query('SELECT txtid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat_txt')." WHERE cid = '".$catid.'\''); |
|
412 | 412 | $num_results = $xoopsDB->getRowsNum($result); |
413 | 413 | $txtid = false; |
414 | 414 | if (!$result) { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | { |
431 | 431 | global $xoopsDB; |
432 | 432 | $myts = MyTextSanitizer::getInstance(); |
433 | - $result = $xoopsDB->query('SELECT c.tplid, t.name FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat_tpl') . ' c, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_tpl') . " t WHERE c.tplid=t.tplid AND c.catid = '" . $get_catid . '\''); |
|
433 | + $result = $xoopsDB->query('SELECT c.tplid, t.name FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat_tpl').' c, '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_tpl')." t WHERE c.tplid=t.tplid AND c.catid = '".$get_catid.'\''); |
|
434 | 434 | $num_results = $xoopsDB->getRowsNum($result); |
435 | 435 | $tplname = ''; |
436 | 436 | if (!$result) { |
@@ -452,10 +452,10 @@ discard block |
||
452 | 452 | function getCatSelectArea($item = '0', $dirid = '0') |
453 | 453 | { |
454 | 454 | global $xoopsDB, $myts, $eh, $mytree, $moddir, $get_itemid; |
455 | - $sql = 'SELECT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
456 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
455 | + $sql = 'SELECT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
456 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_cat') |
|
457 | 457 | . ' c LEFT JOIN ' |
458 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
458 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat') |
|
459 | 459 | . ' x ON (c.cid=x.cid AND x.itemid=' |
460 | 460 | . $item |
461 | 461 | . ") WHERE c.dirid='" |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $output = '<table>'; |
467 | 467 | if ($numrows > 0) { |
468 | 468 | $cats = ''; |
469 | - $output .= '<tr><td class="categoryHeader" colspan="2"><strong>' . _MD_CATTITLE . '</strong></td><td class="categoryHeader"><strong>' . _MD_SELECT . "</strong></td></tr>\n"; |
|
469 | + $output .= '<tr><td class="categoryHeader" colspan="2"><strong>'._MD_CATTITLE.'</strong></td><td class="categoryHeader"><strong>'._MD_SELECT."</strong></td></tr>\n"; |
|
470 | 470 | $brench = 0; |
471 | 471 | $tab = ''; |
472 | 472 | while (list($cid, $title, $pid, $allowlist, $active) = $xoopsDB->fetchRow($mainresult)) { |
@@ -477,15 +477,15 @@ discard block |
||
477 | 477 | } else { |
478 | 478 | $checked = ''; |
479 | 479 | } |
480 | - $checkbox = '<input type="checkbox" name="selected' . $cid . "\"$checked"; |
|
480 | + $checkbox = '<input type="checkbox" name="selected'.$cid."\"$checked"; |
|
481 | 481 | } else { |
482 | 482 | $checkbox = ' '; |
483 | 483 | } |
484 | - $output .= '<tr><td><strong>' . $tab . '' . $title . "</strong></td><td> </td><td>$checkbox</td></tr>\n"; |
|
484 | + $output .= '<tr><td><strong>'.$tab.''.$title."</strong></td><td> </td><td>$checkbox</td></tr>\n"; |
|
485 | 485 | $output .= getCatSelectAreaChildren($cid, 0, $dirid); |
486 | 486 | } |
487 | 487 | } else { |
488 | - $output .= '<tr><td>' . _MD_NORESULTS . '</td></tr>'; |
|
488 | + $output .= '<tr><td>'._MD_NORESULTS.'</td></tr>'; |
|
489 | 489 | } |
490 | 490 | $output .= '</table>'; |
491 | 491 | |
@@ -503,14 +503,14 @@ discard block |
||
503 | 503 | $tab = ' '; |
504 | 504 | $level = $level; |
505 | 505 | $output = ''; |
506 | - $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
506 | + $plus = '<img src="'.XOOPS_URL.'/images/arrow.gif">'; |
|
507 | 507 | for ($i = 0; $i < $level; ++$i) { |
508 | 508 | $tab .= ' '; |
509 | 509 | } |
510 | - $sql = 'SELECT DISTINCT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
511 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
510 | + $sql = 'SELECT DISTINCT c.cid, c.title, c.pid, c.allowlist, x.active FROM ' |
|
511 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_cat') |
|
512 | 512 | . ' c LEFT JOIN ' |
513 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
513 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat') |
|
514 | 514 | . " x ON (c.cid=x.cid AND x.itemid='" |
515 | 515 | . $get_itemid |
516 | 516 | . '\') WHERE c.dirid=\'' |
@@ -528,11 +528,11 @@ discard block |
||
528 | 528 | } else { |
529 | 529 | $checked = ''; |
530 | 530 | } |
531 | - $checkbox = '<input type="checkbox" name="selected' . $cid . "\"$checked"; |
|
531 | + $checkbox = '<input type="checkbox" name="selected'.$cid."\"$checked"; |
|
532 | 532 | } else { |
533 | 533 | $checkbox = ' '; |
534 | 534 | } |
535 | - $output .= '<tr><td><strong>' . $tab . '' . $plus . ' ' . $title . "</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
535 | + $output .= '<tr><td><strong>'.$tab.''.$plus.' '.$title."</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
536 | 536 | $newlevel = $level + 1; |
537 | 537 | $output .= getCatSelectAreaChildren($cid, $newlevel); |
538 | 538 | } |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | $block = array(); |
552 | 552 | $myts = MyTextSanitizer::getInstance(); |
553 | 553 | $dirid = 0; |
554 | - $result = $xoopsDB->query('SELECT dirid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid = ' . $item . ''); |
|
554 | + $result = $xoopsDB->query('SELECT dirid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' WHERE itemid = '.$item.''); |
|
555 | 555 | $num_results = $xoopsDB->getRowsNum($result); |
556 | 556 | if (!$result) { |
557 | 557 | return 0; |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | $block = array(); |
575 | 575 | $myts = MyTextSanitizer::getInstance(); |
576 | 576 | $userid = 0; |
577 | - $result = $xoopsDB->query('SELECT uid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid = ' . $item . ''); |
|
577 | + $result = $xoopsDB->query('SELECT uid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' WHERE itemid = '.$item.''); |
|
578 | 578 | $num_results = $xoopsDB->getRowsNum($result); |
579 | 579 | if (!$result) { |
580 | 580 | return 0; |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | function updaterating($sel_id) |
595 | 595 | { |
596 | 596 | global $xoopsDB; |
597 | - $query = 'SELECT rating FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_votedata') . ' WHERE itemid = ' . $sel_id . ''; |
|
597 | + $query = 'SELECT rating FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_votedata').' WHERE itemid = '.$sel_id.''; |
|
598 | 598 | $voteresult = $xoopsDB->query($query); |
599 | 599 | $votesDB = $xoopsDB->getRowsNum($voteresult); |
600 | 600 | $totalrating = 0; |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | } |
604 | 604 | $finalrating = $totalrating / $votesDB; |
605 | 605 | $finalrating = number_format($finalrating, 4); |
606 | - $query = 'UPDATE ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . " SET rating=$finalrating, votes=$votesDB WHERE itemid = $sel_id"; |
|
606 | + $query = 'UPDATE '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items')." SET rating=$finalrating, votes=$votesDB WHERE itemid = $sel_id"; |
|
607 | 607 | $xoopsDB->query($query) or exit(); |
608 | 608 | } |
609 | 609 | |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | $dirid = 0; |
620 | 620 | $addressarray = array(); |
621 | 621 | if ($typeid == '0') { |
622 | - $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_address_types') . " WHERE defaultyn = '1'"); |
|
622 | + $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_address_types')." WHERE defaultyn = '1'"); |
|
623 | 623 | } else { |
624 | - $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_address_types') . " WHERE typeid = '$typeid'"); |
|
624 | + $result = $xoopsDB->query('SELECT typeid, address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country, typename, uselocyn FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_address_types')." WHERE typeid = '$typeid'"); |
|
625 | 625 | } |
626 | 626 | $num_results = $xoopsDB->getRowsNum($result); |
627 | 627 | if (!$result) { |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | global $xoopsDB; |
661 | 661 | $myts = MyTextSanitizer::getInstance(); |
662 | 662 | $addressarray = array(); |
663 | - $result = $xoopsDB->query('SELECT address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_addresses') . " WHERE addrid = '$addrid'"); |
|
663 | + $result = $xoopsDB->query('SELECT address, address2, zip, postcode, lat, lon, phone, fax, mobile, city, country FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_addresses')." WHERE addrid = '$addrid'"); |
|
664 | 664 | $num_results = $xoopsDB->getRowsNum($result); |
665 | 665 | if ($num_results == 0) { |
666 | 666 | $addressarray = array('address' => '', 'address2' => '', 'zip' => '', 'postcode' => '', 'lat' => '', 'lon' => '', 'phone' => '', 'fax' => '', 'mobile' => '', 'city' => '', 'country' => ''); |
@@ -695,20 +695,20 @@ discard block |
||
695 | 695 | } else { |
696 | 696 | $isadmin = false; |
697 | 697 | } |
698 | - $sql = 'SELECT cid, title, pid, allowlist FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\' AND active=\'1\''; |
|
698 | + $sql = 'SELECT cid, title, pid, allowlist FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE dirid='".$get_dirid.'\' AND pid=\'0\' AND active=\'1\''; |
|
699 | 699 | $mainresult = $xoopsDB->query($sql); |
700 | 700 | $numrows = $xoopsDB->getRowsNum($mainresult); |
701 | 701 | $output = ''; |
702 | 702 | if ($numrows > 0) { |
703 | 703 | $cats = ''; |
704 | - $output = '<table class="categoryTable"><tr><td class="categoryHeader" colspan="2"><strong>' . _MD_CATTITLE . '</strong></td><td class="categoryHeader"><strong>' . _MD_SELECT . "</strong></td></tr>\n"; |
|
704 | + $output = '<table class="categoryTable"><tr><td class="categoryHeader" colspan="2"><strong>'._MD_CATTITLE.'</strong></td><td class="categoryHeader"><strong>'._MD_SELECT."</strong></td></tr>\n"; |
|
705 | 705 | $brench = 0; |
706 | 706 | $tab = ''; |
707 | 707 | $selectablecat = false; |
708 | 708 | while (list($cid, $title, $pid, $allowlist) = $xoopsDB->fetchRow($mainresult)) { |
709 | 709 | //For each cid, get all 'first children' using getFirstChildId() function |
710 | 710 | if ($allowlist != '0') { |
711 | - $checkbox = '<input type="checkbox" name="selected' . $cid . '"'; |
|
711 | + $checkbox = '<input type="checkbox" name="selected'.$cid.'"'; |
|
712 | 712 | $selectablecat = true; |
713 | 713 | //$checked = ""; |
714 | 714 | } else { |
@@ -716,23 +716,23 @@ discard block |
||
716 | 716 | $checkbox = ' '; |
717 | 717 | } |
718 | 718 | //$cats .= $cid."|"; |
719 | - $output .= '<tr><td><strong>' . $tab . '' . $title . "</strong></td><td> </td><td align=\"center\">$checkbox</td></tr>\n"; |
|
719 | + $output .= '<tr><td><strong>'.$tab.''.$title."</strong></td><td> </td><td align=\"center\">$checkbox</td></tr>\n"; |
|
720 | 720 | $output .= getCatSelectAreaChildren2($cid); |
721 | 721 | if ($output !== '') { |
722 | 722 | $selectablecat = true; |
723 | 723 | } |
724 | 724 | } |
725 | 725 | } else { |
726 | - redirect_header(XOOPS_URL . "/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
726 | + redirect_header(XOOPS_URL."/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
727 | 727 | exit(); |
728 | 728 | //$output = ""._MD_NORESULTS.""; |
729 | 729 | } |
730 | 730 | if ($isadmin) { |
731 | - $output .= '<tr><td><br><a href="admin/categories.php?dirid=' . $get_dirid . '">' . _MD_EDITCATEGORIES . '</a></td></tr>'; |
|
731 | + $output .= '<tr><td><br><a href="admin/categories.php?dirid='.$get_dirid.'">'._MD_EDITCATEGORIES.'</a></td></tr>'; |
|
732 | 732 | } |
733 | 733 | $output .= '</table>'; |
734 | 734 | if ($selectablecat === false) { |
735 | - redirect_header(XOOPS_URL . "/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
735 | + redirect_header(XOOPS_URL."/modules/$moddir/index.php?dirid=$get_dirid", 2, _MD_NOACTIVECATEGORIES); |
|
736 | 736 | exit(); |
737 | 737 | } |
738 | 738 | |
@@ -750,21 +750,21 @@ discard block |
||
750 | 750 | $tab = ' '; |
751 | 751 | $level = $level; |
752 | 752 | $output = ''; |
753 | - $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
753 | + $plus = '<img src="'.XOOPS_URL.'/images/arrow.gif">'; |
|
754 | 754 | for ($i = 0; $i < $level; ++$i) { |
755 | 755 | $tab .= ' '; |
756 | 756 | } |
757 | - $sql = 'SELECT cid, title, pid, allowlist FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . (int)$get_dirid . '\' AND pid=\'' . (int)$childid . '\' AND active=\'1\''; |
|
757 | + $sql = 'SELECT cid, title, pid, allowlist FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE dirid='".(int) $get_dirid.'\' AND pid=\''.(int) $childid.'\' AND active=\'1\''; |
|
758 | 758 | $childresult = $xoopsDB->query($sql); |
759 | 759 | $numrows = $xoopsDB->getRowsNum($childresult); |
760 | 760 | if ($numrows > 0) { |
761 | 761 | while (list($cid, $title, $pid, $allowlist) = $xoopsDB->fetchRow($childresult)) { |
762 | 762 | if ($allowlist != '0') { |
763 | - $checkbox = '<input type="checkbox" name="selected' . $cid . '"'; |
|
763 | + $checkbox = '<input type="checkbox" name="selected'.$cid.'"'; |
|
764 | 764 | } else { |
765 | 765 | $checkbox = ' '; |
766 | 766 | } |
767 | - $output .= '<tr><td><strong>' . $tab . '' . $plus . ' ' . $title . "</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
767 | + $output .= '<tr><td><strong>'.$tab.''.$plus.' '.$title."</td><td> </strong></td><td align=\"center\">$checkbox</td></tr>\n"; |
|
768 | 768 | $newlevel = $level + 1; |
769 | 769 | $output .= getCatSelectAreaChildren($cid, $newlevel, $get_dirid); |
770 | 770 | } |
@@ -34,310 +34,310 @@ |
||
34 | 34 | $moddir = $xoopsModule->getVar('dirname'); |
35 | 35 | |
36 | 36 | if (isset($_GET['dirid'])) { |
37 | - $get_dirid = (int)$_GET['dirid']; |
|
37 | + $get_dirid = (int)$_GET['dirid']; |
|
38 | 38 | } |
39 | 39 | if (isset($_GET['typeid'])) { |
40 | - $get_typeid = (int)$_GET['typeid']; |
|
40 | + $get_typeid = (int)$_GET['typeid']; |
|
41 | 41 | } |
42 | 42 | $fieldtypes = array( |
43 | - '0' => '---', |
|
44 | - 'textbox' => _MD_FIELDNAMES_TEXTBOX, |
|
45 | - 'textarea' => _MD_FIELDNAMES_TEXTAREA, |
|
46 | - 'dhtml' => _MD_FIELDNAMES_DHTMLTEXTAREA, |
|
47 | - 'select' => _MD_FIELDNAMES_SELECT, |
|
48 | - 'checkbox' => _MD_FIELDNAMES_CHECKBOX, |
|
49 | - 'radio' => _MD_FIELDNAMES_RADIO, |
|
50 | - 'yesno' => _MD_FIELDNAMES_YESNO, |
|
51 | - 'date' => _MD_FIELDNAMES_DATE, |
|
52 | - 'datetime' => _MD_FIELDNAMES_DATETIME, //'address' => _MD_FIELDNAMES_ADDRESS, //EDIT-RC10 |
|
53 | - //'locationmap' => _MD_FIELDNAMES_LOCATIONMAP, |
|
54 | - 'rating' => _MD_FIELDNAMES_RATING, |
|
55 | - 'url' => _MD_FIELDNAMES_URL |
|
56 | - //'gallery' => _MD_FIELDNAMES_GALLERY |
|
43 | + '0' => '---', |
|
44 | + 'textbox' => _MD_FIELDNAMES_TEXTBOX, |
|
45 | + 'textarea' => _MD_FIELDNAMES_TEXTAREA, |
|
46 | + 'dhtml' => _MD_FIELDNAMES_DHTMLTEXTAREA, |
|
47 | + 'select' => _MD_FIELDNAMES_SELECT, |
|
48 | + 'checkbox' => _MD_FIELDNAMES_CHECKBOX, |
|
49 | + 'radio' => _MD_FIELDNAMES_RADIO, |
|
50 | + 'yesno' => _MD_FIELDNAMES_YESNO, |
|
51 | + 'date' => _MD_FIELDNAMES_DATE, |
|
52 | + 'datetime' => _MD_FIELDNAMES_DATETIME, //'address' => _MD_FIELDNAMES_ADDRESS, //EDIT-RC10 |
|
53 | + //'locationmap' => _MD_FIELDNAMES_LOCATIONMAP, |
|
54 | + 'rating' => _MD_FIELDNAMES_RATING, |
|
55 | + 'url' => _MD_FIELDNAMES_URL |
|
56 | + //'gallery' => _MD_FIELDNAMES_GALLERY |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | function fieldtypesConfig() |
60 | 60 | { |
61 | - global $xoopsDB, $xoopsModule, $xoopsUser, $moddir, $myts, $eh, $fieldtypes; |
|
62 | - xoops_cp_header(); |
|
63 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
64 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
65 | - //adminmenu(2, _MD_A_FTYPESADMIN); |
|
66 | - echo '<h4>' . _MD_FTYPECONF . '</h4>'; |
|
67 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
68 | - $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . ' ORDER BY fieldtype ASC') or $eh->show('0013'); |
|
69 | - $numrows = $xoopsDB->getRowsNum($result); |
|
70 | - echo '<tr><th>' . _MD_TITLE . '</th><th>' . _MD_TYPE . '</th><th>' . _MD_EXT . '</th><th>' . _MD_ACTIVE . "</th></tr>\n"; |
|
71 | - if ($numrows > 0) { |
|
72 | - while (list($typeid, $title, $type, $descr, $ext, $status) = $xoopsDB->fetchRow($result)) { |
|
73 | - if ($status != '0') { |
|
74 | - $statusyn = '' . _MD_YES . ''; |
|
75 | - } else { |
|
76 | - $statusyn = '' . _MD_NO . ''; |
|
77 | - } |
|
78 | - echo '<tr><td class="even" valign="top"><a href="' |
|
79 | - . XOOPS_URL |
|
80 | - . '/modules/' |
|
81 | - . $moddir |
|
82 | - . "/admin/fieldtypes.php?op=view&typeid=$typeid\">$title</a></td><td class=\"even\" valign=\"top\">$type</td><td class=\"even\" valign=\"top\">$ext</td><td class=\"even\" valign=\"top\">$statusyn</td>"; |
|
83 | - echo "</td></tr>\n"; |
|
84 | - } |
|
85 | - } else { |
|
86 | - echo '<tr><td>' . _MD_NORESULTS . '</td></tr>'; |
|
87 | - } |
|
88 | - echo '</table>'; |
|
89 | - echo '<br>'; |
|
90 | - echo '<h4>' . _MD_CREATE_NEWFTYPE . '</h4>'; |
|
91 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
92 | - $form = new XoopsThemeForm(_MD_NEWFTYPEFORM, 'submitform', 'fieldtypes.php'); |
|
61 | + global $xoopsDB, $xoopsModule, $xoopsUser, $moddir, $myts, $eh, $fieldtypes; |
|
62 | + xoops_cp_header(); |
|
63 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
64 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
65 | + //adminmenu(2, _MD_A_FTYPESADMIN); |
|
66 | + echo '<h4>' . _MD_FTYPECONF . '</h4>'; |
|
67 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
68 | + $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . ' ORDER BY fieldtype ASC') or $eh->show('0013'); |
|
69 | + $numrows = $xoopsDB->getRowsNum($result); |
|
70 | + echo '<tr><th>' . _MD_TITLE . '</th><th>' . _MD_TYPE . '</th><th>' . _MD_EXT . '</th><th>' . _MD_ACTIVE . "</th></tr>\n"; |
|
71 | + if ($numrows > 0) { |
|
72 | + while (list($typeid, $title, $type, $descr, $ext, $status) = $xoopsDB->fetchRow($result)) { |
|
73 | + if ($status != '0') { |
|
74 | + $statusyn = '' . _MD_YES . ''; |
|
75 | + } else { |
|
76 | + $statusyn = '' . _MD_NO . ''; |
|
77 | + } |
|
78 | + echo '<tr><td class="even" valign="top"><a href="' |
|
79 | + . XOOPS_URL |
|
80 | + . '/modules/' |
|
81 | + . $moddir |
|
82 | + . "/admin/fieldtypes.php?op=view&typeid=$typeid\">$title</a></td><td class=\"even\" valign=\"top\">$type</td><td class=\"even\" valign=\"top\">$ext</td><td class=\"even\" valign=\"top\">$statusyn</td>"; |
|
83 | + echo "</td></tr>\n"; |
|
84 | + } |
|
85 | + } else { |
|
86 | + echo '<tr><td>' . _MD_NORESULTS . '</td></tr>'; |
|
87 | + } |
|
88 | + echo '</table>'; |
|
89 | + echo '<br>'; |
|
90 | + echo '<h4>' . _MD_CREATE_NEWFTYPE . '</h4>'; |
|
91 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
92 | + $form = new XoopsThemeForm(_MD_NEWFTYPEFORM, 'submitform', 'fieldtypes.php'); |
|
93 | 93 | |
94 | - $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 100, 150, ''), true); |
|
95 | - //TO DO: change type field to drop down field, based on available types. |
|
96 | - $element_select = new XoopsFormSelect(_MD_FIELDTYPE, 'field_type'); |
|
97 | - $element_select->addOptionArray($fieldtypes); |
|
98 | - //$form->addElement($type_select); |
|
99 | - $form->addElement($element_select); |
|
100 | - $ext_tray = new XoopsFormElementTray(_MD_EXT, ''); |
|
101 | - $ext_text = new XoopsFormText('', 'ext', 80, 150, ''); |
|
102 | - $ext_text->setExtra('disabled=true'); |
|
103 | - $ext_text->setExtra('style=\'background-color:lightgrey\''); |
|
104 | - $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_SET_EXT . "\", onClick=\"openExtManager('submitform','" . XOOPS_URL . '/modules/' . $moddir . "/admin/extensionmanager.php','field_type', '" . _MD_SELECT_FORMTYPE . '\')">'); |
|
105 | - $ext_tray->addElement($ext_text); |
|
106 | - $ext_tray->addElement($ext_button); |
|
107 | - $form->addElement($ext_tray); |
|
108 | - $form->addElement(new XoopsFormTextArea(_MD_DESCRIPTION, 'descr', '', 8, 50, ''), true); |
|
109 | - $form_txtactive = new XoopsFormCheckBox(_MD_ACTIVE, 'status', 0); |
|
110 | - $form_txtactive->addOption(1, _MD_YESNO); |
|
111 | - $form->addElement($form_txtactive); |
|
112 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
113 | - $form->addElement(new XoopsFormHidden('op', 'addFieldtype')); |
|
114 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
115 | - $form->display(); |
|
94 | + $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 100, 150, ''), true); |
|
95 | + //TO DO: change type field to drop down field, based on available types. |
|
96 | + $element_select = new XoopsFormSelect(_MD_FIELDTYPE, 'field_type'); |
|
97 | + $element_select->addOptionArray($fieldtypes); |
|
98 | + //$form->addElement($type_select); |
|
99 | + $form->addElement($element_select); |
|
100 | + $ext_tray = new XoopsFormElementTray(_MD_EXT, ''); |
|
101 | + $ext_text = new XoopsFormText('', 'ext', 80, 150, ''); |
|
102 | + $ext_text->setExtra('disabled=true'); |
|
103 | + $ext_text->setExtra('style=\'background-color:lightgrey\''); |
|
104 | + $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_SET_EXT . "\", onClick=\"openExtManager('submitform','" . XOOPS_URL . '/modules/' . $moddir . "/admin/extensionmanager.php','field_type', '" . _MD_SELECT_FORMTYPE . '\')">'); |
|
105 | + $ext_tray->addElement($ext_text); |
|
106 | + $ext_tray->addElement($ext_button); |
|
107 | + $form->addElement($ext_tray); |
|
108 | + $form->addElement(new XoopsFormTextArea(_MD_DESCRIPTION, 'descr', '', 8, 50, ''), true); |
|
109 | + $form_txtactive = new XoopsFormCheckBox(_MD_ACTIVE, 'status', 0); |
|
110 | + $form_txtactive->addOption(1, _MD_YESNO); |
|
111 | + $form->addElement($form_txtactive); |
|
112 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
113 | + $form->addElement(new XoopsFormHidden('op', 'addFieldtype')); |
|
114 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
115 | + $form->display(); |
|
116 | 116 | |
117 | - //Javascript function to check if field type is selected. If not, then warn the user. Otherwise |
|
118 | - //open the extension manager window. |
|
119 | - $js = ''; |
|
120 | - $js .= "\n<!-- Start Extension Manager JavaScript //-->\n<script type='text/javascript'>\n<!--//\n"; |
|
121 | - $js .= "function openExtManager(formname,url,ele,warning) {\n"; |
|
122 | - $js .= "myform = window.document.submitform;\n"; |
|
123 | - $js .= "var typeid = myform.field_type.value;\n"; |
|
124 | - $js .= "if (typeid == 0) { |
|
117 | + //Javascript function to check if field type is selected. If not, then warn the user. Otherwise |
|
118 | + //open the extension manager window. |
|
119 | + $js = ''; |
|
120 | + $js .= "\n<!-- Start Extension Manager JavaScript //-->\n<script type='text/javascript'>\n<!--//\n"; |
|
121 | + $js .= "function openExtManager(formname,url,ele,warning) {\n"; |
|
122 | + $js .= "myform = window.document.submitform;\n"; |
|
123 | + $js .= "var typeid = myform.field_type.value;\n"; |
|
124 | + $js .= "if (typeid == 0) { |
|
125 | 125 | alert([warning]); |
126 | 126 | } else { |
127 | 127 | window.open([url],'ext_window','width=600,height=450'); |
128 | 128 | }\n"; |
129 | - $js .= "}\n"; |
|
130 | - $js .= "//--></script>\n<!-- End Extension Manager JavaScript //-->\n"; |
|
131 | - echo $js; |
|
129 | + $js .= "}\n"; |
|
130 | + $js .= "//--></script>\n<!-- End Extension Manager JavaScript //-->\n"; |
|
131 | + echo $js; |
|
132 | 132 | |
133 | - echo '</td></tr></table>'; |
|
134 | - xoops_cp_footer(); |
|
133 | + echo '</td></tr></table>'; |
|
134 | + xoops_cp_footer(); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | function viewFieldtype() |
138 | 138 | { |
139 | - global $xoopsDB, $mytree, $mytree2, $xoopsUser, $get_typeid, $moddir, $eh, $fieldtypes; |
|
140 | - xoops_cp_header(); |
|
141 | - //adminmenu(2, _MD_A_FTYPESADMIN); |
|
142 | - echo '<h4>' . _MD_VIEW_FIELDTYPE . '</h4>'; |
|
143 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
144 | - $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . " WHERE typeid='" . $get_typeid . '\'') or $eh->show('0013'); |
|
145 | - $numrows = $xoopsDB->getRowsNum($result); |
|
146 | - if ($numrows > 0) { |
|
147 | - while (list($typeid, $title, $fieldtype, $descr, $ext, $activeyn) = $xoopsDB->fetchRow($result)) { |
|
148 | - $form = new XoopsThemeForm(_MD_EDITFTYPEFORM, 'submitform', 'fieldtypes.php'); |
|
149 | - $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 100, 150, "$title"), true); |
|
150 | - //TO DO: change type field to drop down field, based on available types. |
|
151 | - $element_select = new XoopsFormSelect(_MD_FIELDTYPE, 'field_type', $fieldtype); |
|
152 | - $element_select->addOptionArray($fieldtypes); |
|
139 | + global $xoopsDB, $mytree, $mytree2, $xoopsUser, $get_typeid, $moddir, $eh, $fieldtypes; |
|
140 | + xoops_cp_header(); |
|
141 | + //adminmenu(2, _MD_A_FTYPESADMIN); |
|
142 | + echo '<h4>' . _MD_VIEW_FIELDTYPE . '</h4>'; |
|
143 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
144 | + $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . " WHERE typeid='" . $get_typeid . '\'') or $eh->show('0013'); |
|
145 | + $numrows = $xoopsDB->getRowsNum($result); |
|
146 | + if ($numrows > 0) { |
|
147 | + while (list($typeid, $title, $fieldtype, $descr, $ext, $activeyn) = $xoopsDB->fetchRow($result)) { |
|
148 | + $form = new XoopsThemeForm(_MD_EDITFTYPEFORM, 'submitform', 'fieldtypes.php'); |
|
149 | + $form->addElement(new XoopsFormText(_MD_TITLE, 'title', 100, 150, "$title"), true); |
|
150 | + //TO DO: change type field to drop down field, based on available types. |
|
151 | + $element_select = new XoopsFormSelect(_MD_FIELDTYPE, 'field_type', $fieldtype); |
|
152 | + $element_select->addOptionArray($fieldtypes); |
|
153 | 153 | |
154 | - //$form->addElement($type_select); |
|
155 | - $form->addElement($element_select); |
|
156 | - $ext_tray = new XoopsFormElementTray(_MD_EXT, ''); |
|
157 | - $ext_text = new XoopsFormText('', 'ext', 80, 150, "$ext"); |
|
158 | - $ext_text->setExtra('style=\'background-color:lightgrey\''); |
|
159 | - $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_SET_EXT . "\", onClick=\"openExtManager('submitform','" . XOOPS_URL . '/modules/' . $moddir . "/admin/extensionmanager.php','field_type', '" . _MD_SELECT_FORMTYPE . '\')">'); |
|
160 | - $ext_tray->addElement($ext_text); |
|
161 | - $ext_tray->addElement($ext_button); |
|
162 | - $form->addElement($ext_tray); |
|
163 | - $form->addElement(new XoopsFormTextArea(_MD_DESCRIPTION, 'descr', "$descr", 8, 50, ''), true); |
|
164 | - $form_txtactive = new XoopsFormCheckBox(_MD_ACTIVE, 'status', $activeyn); |
|
165 | - $form_txtactive->addOption(1, _MD_YESNO); |
|
166 | - $form->addElement($form_txtactive); |
|
167 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
168 | - $form->addElement(new XoopsFormHidden('op', 'editFieldtype')); |
|
169 | - $form->addElement(new XoopsFormHidden('typeid', $get_typeid)); |
|
170 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
171 | - $form->display(); |
|
154 | + //$form->addElement($type_select); |
|
155 | + $form->addElement($element_select); |
|
156 | + $ext_tray = new XoopsFormElementTray(_MD_EXT, ''); |
|
157 | + $ext_text = new XoopsFormText('', 'ext', 80, 150, "$ext"); |
|
158 | + $ext_text->setExtra('style=\'background-color:lightgrey\''); |
|
159 | + $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_SET_EXT . "\", onClick=\"openExtManager('submitform','" . XOOPS_URL . '/modules/' . $moddir . "/admin/extensionmanager.php','field_type', '" . _MD_SELECT_FORMTYPE . '\')">'); |
|
160 | + $ext_tray->addElement($ext_text); |
|
161 | + $ext_tray->addElement($ext_button); |
|
162 | + $form->addElement($ext_tray); |
|
163 | + $form->addElement(new XoopsFormTextArea(_MD_DESCRIPTION, 'descr', "$descr", 8, 50, ''), true); |
|
164 | + $form_txtactive = new XoopsFormCheckBox(_MD_ACTIVE, 'status', $activeyn); |
|
165 | + $form_txtactive->addOption(1, _MD_YESNO); |
|
166 | + $form->addElement($form_txtactive); |
|
167 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
168 | + $form->addElement(new XoopsFormHidden('op', 'editFieldtype')); |
|
169 | + $form->addElement(new XoopsFormHidden('typeid', $get_typeid)); |
|
170 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
171 | + $form->display(); |
|
172 | 172 | |
173 | - //Javascript function to check if field type is selected. If not, then warn the user. Otherwise |
|
174 | - //open the extension manager window. |
|
175 | - $js = ''; |
|
176 | - $js .= "\n<!-- Start Extension Manager JavaScript //-->\n<script type='text/javascript'>\n<!--//\n"; |
|
177 | - $js .= "function openExtManager(formname,url,ele,warning) {\n"; |
|
178 | - $js .= "myform = window.document.submitform;\n"; |
|
179 | - $js .= "var typeid = myform.field_type.value;\n"; |
|
180 | - $js .= "if (typeid == 0) { |
|
173 | + //Javascript function to check if field type is selected. If not, then warn the user. Otherwise |
|
174 | + //open the extension manager window. |
|
175 | + $js = ''; |
|
176 | + $js .= "\n<!-- Start Extension Manager JavaScript //-->\n<script type='text/javascript'>\n<!--//\n"; |
|
177 | + $js .= "function openExtManager(formname,url,ele,warning) {\n"; |
|
178 | + $js .= "myform = window.document.submitform;\n"; |
|
179 | + $js .= "var typeid = myform.field_type.value;\n"; |
|
180 | + $js .= "if (typeid == 0) { |
|
181 | 181 | alert([warning]); |
182 | 182 | } else { |
183 | 183 | window.open([url],'ext_window','width=600,height=450'); |
184 | 184 | }\n"; |
185 | - $js .= "}\n"; |
|
186 | - $js .= "//--></script>\n<!-- End Extension Manager JavaScript //-->\n"; |
|
187 | - echo $js; |
|
188 | - } |
|
189 | - } |
|
190 | - echo '</td></tr></table>'; |
|
191 | - //echo "<form name=\"deleteFieldTypeForm\" action=\"\" |
|
192 | - xoops_cp_footer(); |
|
185 | + $js .= "}\n"; |
|
186 | + $js .= "//--></script>\n<!-- End Extension Manager JavaScript //-->\n"; |
|
187 | + echo $js; |
|
188 | + } |
|
189 | + } |
|
190 | + echo '</td></tr></table>'; |
|
191 | + //echo "<form name=\"deleteFieldTypeForm\" action=\"\" |
|
192 | + xoops_cp_footer(); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | function addFieldtype() |
196 | 196 | { |
197 | - global $xoopsDB, $_POST, $myts, $eh, $xoopsModule; |
|
198 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
199 | - $p_fieldtype = $_POST['field_type']; |
|
200 | - $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
201 | - if (isset($_POST['ext'])) { |
|
202 | - $p_ext = $_POST['ext']; |
|
203 | - } else { |
|
204 | - $p_ext = ''; |
|
205 | - } |
|
206 | - if (isset($_POST['status'])) { |
|
207 | - $p_status = (int)$_POST['status']; |
|
208 | - } else { |
|
209 | - $p_status = 0; |
|
210 | - } |
|
211 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . '_typeid_seq'); |
|
212 | - $sql = sprintf("INSERT INTO %s (typeid, title, fieldtype, descr, ext, activeyn) VALUES (%u, '%s', '%s', '%s', '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes'), $newid, $p_title, $p_fieldtype, $p_descr, $p_ext, $p_status); |
|
213 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
214 | - redirect_header('fieldtypes.php', 2, _MD_SAVED); |
|
215 | - exit(); |
|
197 | + global $xoopsDB, $_POST, $myts, $eh, $xoopsModule; |
|
198 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
199 | + $p_fieldtype = $_POST['field_type']; |
|
200 | + $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
201 | + if (isset($_POST['ext'])) { |
|
202 | + $p_ext = $_POST['ext']; |
|
203 | + } else { |
|
204 | + $p_ext = ''; |
|
205 | + } |
|
206 | + if (isset($_POST['status'])) { |
|
207 | + $p_status = (int)$_POST['status']; |
|
208 | + } else { |
|
209 | + $p_status = 0; |
|
210 | + } |
|
211 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . '_typeid_seq'); |
|
212 | + $sql = sprintf("INSERT INTO %s (typeid, title, fieldtype, descr, ext, activeyn) VALUES (%u, '%s', '%s', '%s', '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes'), $newid, $p_title, $p_fieldtype, $p_descr, $p_ext, $p_status); |
|
213 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
214 | + redirect_header('fieldtypes.php', 2, _MD_SAVED); |
|
215 | + exit(); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | function editFieldtype() |
219 | 219 | { |
220 | - global $xoopsDB, $_POST, $myts, $eh; |
|
221 | - if (isset($_POST['typeid'])) { |
|
222 | - $p_typeid = (int)$_POST['typeid']; |
|
223 | - } else { |
|
224 | - exit(); |
|
225 | - } |
|
226 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
227 | - $p_fieldtype = $_POST['field_type']; |
|
228 | - $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
229 | - if (isset($_POST['ext'])) { |
|
230 | - $p_ext = $_POST['ext']; |
|
231 | - } else { |
|
232 | - $p_ext = ''; |
|
233 | - } |
|
234 | - if (isset($_POST['status'])) { |
|
235 | - $p_status = (int)$_POST['status']; |
|
236 | - } else { |
|
237 | - $p_status = 0; |
|
238 | - } |
|
239 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . " SET title = '$p_title', fieldtype='$p_fieldtype', ext='$p_ext', activeyn='$p_status' WHERE typeid = $p_typeid"; |
|
240 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
241 | - redirect_header("fieldtypes.php?op=view&typeid=$p_typeid", 2, _MD_SAVED); |
|
242 | - exit(); |
|
220 | + global $xoopsDB, $_POST, $myts, $eh; |
|
221 | + if (isset($_POST['typeid'])) { |
|
222 | + $p_typeid = (int)$_POST['typeid']; |
|
223 | + } else { |
|
224 | + exit(); |
|
225 | + } |
|
226 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
227 | + $p_fieldtype = $_POST['field_type']; |
|
228 | + $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
229 | + if (isset($_POST['ext'])) { |
|
230 | + $p_ext = $_POST['ext']; |
|
231 | + } else { |
|
232 | + $p_ext = ''; |
|
233 | + } |
|
234 | + if (isset($_POST['status'])) { |
|
235 | + $p_status = (int)$_POST['status']; |
|
236 | + } else { |
|
237 | + $p_status = 0; |
|
238 | + } |
|
239 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . " SET title = '$p_title', fieldtype='$p_fieldtype', ext='$p_ext', activeyn='$p_status' WHERE typeid = $p_typeid"; |
|
240 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
241 | + redirect_header("fieldtypes.php?op=view&typeid=$p_typeid", 2, _MD_SAVED); |
|
242 | + exit(); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | function newCat() |
246 | 246 | { |
247 | - global $xoopsDB, $myts, $eh; |
|
248 | - if (isset($_POST['dirid'])) { |
|
249 | - $p_dirid = (int)$_POST['dirid']; |
|
250 | - } else { |
|
251 | - exit(); |
|
252 | - } |
|
253 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
254 | - $p_active = (int)$_POST['active']; |
|
255 | - $p_pid = (int)$_POST['pid']; |
|
256 | - $p_allowlist = (int)$_POST['allowlist']; |
|
257 | - $p_showpopular = (int)$_POST['showpopular']; |
|
258 | - if (isset($_POST['descr'])) { |
|
259 | - $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
260 | - } else { |
|
261 | - $p_descr = ''; |
|
262 | - } |
|
263 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
264 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid) VALUES (%u, %u, '%s', %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid); |
|
265 | - //echo $sql; |
|
266 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
267 | - if ($newid == 0) { |
|
268 | - $cid = $xoopsDB->getInsertId(); |
|
269 | - } |
|
270 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
271 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, '1', time()); |
|
272 | - //echo $sql2; |
|
273 | - $xoopsDB->query($sql2) or $eh->show('0013'); |
|
274 | - redirect_header("categories.php?op=edit&cid=$newid", 0, _MD_CAT_UPDATED); |
|
275 | - exit(); |
|
247 | + global $xoopsDB, $myts, $eh; |
|
248 | + if (isset($_POST['dirid'])) { |
|
249 | + $p_dirid = (int)$_POST['dirid']; |
|
250 | + } else { |
|
251 | + exit(); |
|
252 | + } |
|
253 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
254 | + $p_active = (int)$_POST['active']; |
|
255 | + $p_pid = (int)$_POST['pid']; |
|
256 | + $p_allowlist = (int)$_POST['allowlist']; |
|
257 | + $p_showpopular = (int)$_POST['showpopular']; |
|
258 | + if (isset($_POST['descr'])) { |
|
259 | + $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
260 | + } else { |
|
261 | + $p_descr = ''; |
|
262 | + } |
|
263 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
264 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid) VALUES (%u, %u, '%s', %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid); |
|
265 | + //echo $sql; |
|
266 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
267 | + if ($newid == 0) { |
|
268 | + $cid = $xoopsDB->getInsertId(); |
|
269 | + } |
|
270 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
271 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, '1', time()); |
|
272 | + //echo $sql2; |
|
273 | + $xoopsDB->query($sql2) or $eh->show('0013'); |
|
274 | + redirect_header("categories.php?op=edit&cid=$newid", 0, _MD_CAT_UPDATED); |
|
275 | + exit(); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | if (!isset($_POST['op'])) { |
279 | - $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
|
279 | + $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
|
280 | 280 | } else { |
281 | - $op = $_POST['op']; |
|
281 | + $op = $_POST['op']; |
|
282 | 282 | } |
283 | 283 | switch ($op) { |
284 | - case 'view': |
|
285 | - viewFieldtype(); |
|
286 | - break; |
|
287 | - case 'editFieldtype': |
|
288 | - editFieldtype(); |
|
289 | - break; |
|
290 | - case 'addFieldtype': |
|
291 | - addFieldtype(); |
|
292 | - break; |
|
293 | - default: |
|
294 | - fieldtypesConfig(); |
|
295 | - break; |
|
284 | + case 'view': |
|
285 | + viewFieldtype(); |
|
286 | + break; |
|
287 | + case 'editFieldtype': |
|
288 | + editFieldtype(); |
|
289 | + break; |
|
290 | + case 'addFieldtype': |
|
291 | + addFieldtype(); |
|
292 | + break; |
|
293 | + default: |
|
294 | + fieldtypesConfig(); |
|
295 | + break; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | function getCatOverview() |
299 | 299 | { |
300 | - global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
301 | - $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\''); |
|
302 | - $numrows = $xoopsDB->getRowsNum($mainresult); |
|
303 | - $output = ''; |
|
304 | - if ($numrows > 0) { |
|
305 | - $output = '<th>' . _MD_CATTITLE . '</th><th>' . _MD_ACTIVEYN . '</th><th>' . _MD_PARENTCAT . "</th>\n"; |
|
306 | - $brench = 0; |
|
307 | - $tab = ''; |
|
308 | - while (list($cid, $title, $activeyn, $pid) = $xoopsDB->fetchRow($mainresult)) { |
|
309 | - $output .= '<tr><td>' . $tab . '<a href="' . XOOPS_URL . "/modules/$moddir/admin/categories.php?op=edit&cid=$cid\">" . $title . '</a></td><td>' . $activeyn . "</td></tr>\n"; |
|
310 | - $output .= getChildrenCategories($cid); |
|
311 | - } |
|
312 | - } else { |
|
313 | - $output = '' . _MD_NORESULTS . ''; |
|
314 | - } |
|
300 | + global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
301 | + $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\''); |
|
302 | + $numrows = $xoopsDB->getRowsNum($mainresult); |
|
303 | + $output = ''; |
|
304 | + if ($numrows > 0) { |
|
305 | + $output = '<th>' . _MD_CATTITLE . '</th><th>' . _MD_ACTIVEYN . '</th><th>' . _MD_PARENTCAT . "</th>\n"; |
|
306 | + $brench = 0; |
|
307 | + $tab = ''; |
|
308 | + while (list($cid, $title, $activeyn, $pid) = $xoopsDB->fetchRow($mainresult)) { |
|
309 | + $output .= '<tr><td>' . $tab . '<a href="' . XOOPS_URL . "/modules/$moddir/admin/categories.php?op=edit&cid=$cid\">" . $title . '</a></td><td>' . $activeyn . "</td></tr>\n"; |
|
310 | + $output .= getChildrenCategories($cid); |
|
311 | + } |
|
312 | + } else { |
|
313 | + $output = '' . _MD_NORESULTS . ''; |
|
314 | + } |
|
315 | 315 | |
316 | - return $output; |
|
316 | + return $output; |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | function getChildrenCategories($childid = '0', $level = '1') |
320 | 320 | { |
321 | - global $xoopsDB, $myts, $eh, $mytree; |
|
322 | - $firstchildcats = $mytree->getFirstChildId($childid); |
|
323 | - $tab = ''; |
|
324 | - $output = ''; |
|
325 | - $plus = '<img src="' . XOOPS_URL . "\images\arrow.jpg\">"; |
|
326 | - for ($i = 0; $i < $level; ++$i) { |
|
327 | - $tab .= ' '; |
|
328 | - } |
|
329 | - foreach ($firstchildcats as $childid) { |
|
330 | - $childresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE pid='" . $childid . '\''); |
|
331 | - //$childresult = $xoopsDB->query("SELECT cid, title, active, pid FROM ".$xoopsDB->prefix("efqdiralpha1_cat")." WHERE dirid='".$dirid."' AND pid='".$childid."'"); |
|
332 | - $numrows = $xoopsDB->getRowsNum($childresult); |
|
333 | - if ($numrows > 0) { |
|
334 | - while (list($cid, $title, $activeyn, $pid) = $xoopsDB->fetchRow($childresult)) { |
|
335 | - $output .= '<tr><td>' . $tab . '' . $plus . '</td><td>' . $title . '</td><td>' . $activeyn . "</td></tr>\n"; |
|
336 | - $newlevel = ++$level; |
|
337 | - $output .= getChildrenCategories($cid, $newlevel); |
|
338 | - } |
|
339 | - } |
|
340 | - } |
|
321 | + global $xoopsDB, $myts, $eh, $mytree; |
|
322 | + $firstchildcats = $mytree->getFirstChildId($childid); |
|
323 | + $tab = ''; |
|
324 | + $output = ''; |
|
325 | + $plus = '<img src="' . XOOPS_URL . "\images\arrow.jpg\">"; |
|
326 | + for ($i = 0; $i < $level; ++$i) { |
|
327 | + $tab .= ' '; |
|
328 | + } |
|
329 | + foreach ($firstchildcats as $childid) { |
|
330 | + $childresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE pid='" . $childid . '\''); |
|
331 | + //$childresult = $xoopsDB->query("SELECT cid, title, active, pid FROM ".$xoopsDB->prefix("efqdiralpha1_cat")." WHERE dirid='".$dirid."' AND pid='".$childid."'"); |
|
332 | + $numrows = $xoopsDB->getRowsNum($childresult); |
|
333 | + if ($numrows > 0) { |
|
334 | + while (list($cid, $title, $activeyn, $pid) = $xoopsDB->fetchRow($childresult)) { |
|
335 | + $output .= '<tr><td>' . $tab . '' . $plus . '</td><td>' . $title . '</td><td>' . $activeyn . "</td></tr>\n"; |
|
336 | + $newlevel = ++$level; |
|
337 | + $output .= getChildrenCategories($cid, $newlevel); |
|
338 | + } |
|
339 | + } |
|
340 | + } |
|
341 | 341 | |
342 | - return $output; |
|
342 | + return $output; |
|
343 | 343 | } |
@@ -281,18 +281,18 @@ |
||
281 | 281 | $op = $_POST['op']; |
282 | 282 | } |
283 | 283 | switch ($op) { |
284 | - case 'view': |
|
285 | - viewFieldtype(); |
|
286 | - break; |
|
287 | - case 'editFieldtype': |
|
288 | - editFieldtype(); |
|
289 | - break; |
|
290 | - case 'addFieldtype': |
|
291 | - addFieldtype(); |
|
292 | - break; |
|
293 | - default: |
|
294 | - fieldtypesConfig(); |
|
295 | - break; |
|
284 | + case 'view': |
|
285 | + viewFieldtype(); |
|
286 | + break; |
|
287 | + case 'editFieldtype': |
|
288 | + editFieldtype(); |
|
289 | + break; |
|
290 | + case 'addFieldtype': |
|
291 | + addFieldtype(); |
|
292 | + break; |
|
293 | + default: |
|
294 | + fieldtypesConfig(); |
|
295 | + break; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | function getCatOverview() |
@@ -18,26 +18,26 @@ discard block |
||
18 | 18 | * @author XOOPS Development Team, |
19 | 19 | */ |
20 | 20 | |
21 | -require_once __DIR__ . '/admin_header.php'; |
|
21 | +require_once __DIR__.'/admin_header.php'; |
|
22 | 22 | //include __DIR__ . '/../../../include/cp_header.php'; |
23 | 23 | |
24 | -include __DIR__ . '/../include/functions.php'; |
|
25 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
26 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
27 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
28 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
24 | +include __DIR__.'/../include/functions.php'; |
|
25 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
26 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
27 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
28 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
29 | 29 | $myts = MyTextSanitizer::getInstance(); |
30 | 30 | $eh = new ErrorHandler; |
31 | -$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
32 | -$mytree2 = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes'), 'typeid', 0); |
|
31 | +$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
32 | +$mytree2 = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes'), 'typeid', 0); |
|
33 | 33 | |
34 | 34 | $moddir = $xoopsModule->getVar('dirname'); |
35 | 35 | |
36 | 36 | if (isset($_GET['dirid'])) { |
37 | - $get_dirid = (int)$_GET['dirid']; |
|
37 | + $get_dirid = (int) $_GET['dirid']; |
|
38 | 38 | } |
39 | 39 | if (isset($_GET['typeid'])) { |
40 | - $get_typeid = (int)$_GET['typeid']; |
|
40 | + $get_typeid = (int) $_GET['typeid']; |
|
41 | 41 | } |
42 | 42 | $fieldtypes = array( |
43 | 43 | '0' => '---', |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | $adminObject = \Xmf\Module\Admin::getInstance(); |
64 | 64 | $adminObject->displayNavigation(basename(__FILE__)); |
65 | 65 | //adminmenu(2, _MD_A_FTYPESADMIN); |
66 | - echo '<h4>' . _MD_FTYPECONF . '</h4>'; |
|
66 | + echo '<h4>'._MD_FTYPECONF.'</h4>'; |
|
67 | 67 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
68 | - $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . ' ORDER BY fieldtype ASC') or $eh->show('0013'); |
|
68 | + $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes').' ORDER BY fieldtype ASC') or $eh->show('0013'); |
|
69 | 69 | $numrows = $xoopsDB->getRowsNum($result); |
70 | - echo '<tr><th>' . _MD_TITLE . '</th><th>' . _MD_TYPE . '</th><th>' . _MD_EXT . '</th><th>' . _MD_ACTIVE . "</th></tr>\n"; |
|
70 | + echo '<tr><th>'._MD_TITLE.'</th><th>'._MD_TYPE.'</th><th>'._MD_EXT.'</th><th>'._MD_ACTIVE."</th></tr>\n"; |
|
71 | 71 | if ($numrows > 0) { |
72 | 72 | while (list($typeid, $title, $type, $descr, $ext, $status) = $xoopsDB->fetchRow($result)) { |
73 | 73 | if ($status != '0') { |
74 | - $statusyn = '' . _MD_YES . ''; |
|
74 | + $statusyn = ''._MD_YES.''; |
|
75 | 75 | } else { |
76 | - $statusyn = '' . _MD_NO . ''; |
|
76 | + $statusyn = ''._MD_NO.''; |
|
77 | 77 | } |
78 | 78 | echo '<tr><td class="even" valign="top"><a href="' |
79 | 79 | . XOOPS_URL |
@@ -83,11 +83,11 @@ discard block |
||
83 | 83 | echo "</td></tr>\n"; |
84 | 84 | } |
85 | 85 | } else { |
86 | - echo '<tr><td>' . _MD_NORESULTS . '</td></tr>'; |
|
86 | + echo '<tr><td>'._MD_NORESULTS.'</td></tr>'; |
|
87 | 87 | } |
88 | 88 | echo '</table>'; |
89 | 89 | echo '<br>'; |
90 | - echo '<h4>' . _MD_CREATE_NEWFTYPE . '</h4>'; |
|
90 | + echo '<h4>'._MD_CREATE_NEWFTYPE.'</h4>'; |
|
91 | 91 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
92 | 92 | $form = new XoopsThemeForm(_MD_NEWFTYPEFORM, 'submitform', 'fieldtypes.php'); |
93 | 93 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $ext_text = new XoopsFormText('', 'ext', 80, 150, ''); |
102 | 102 | $ext_text->setExtra('disabled=true'); |
103 | 103 | $ext_text->setExtra('style=\'background-color:lightgrey\''); |
104 | - $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_SET_EXT . "\", onClick=\"openExtManager('submitform','" . XOOPS_URL . '/modules/' . $moddir . "/admin/extensionmanager.php','field_type', '" . _MD_SELECT_FORMTYPE . '\')">'); |
|
104 | + $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="'._MD_SET_EXT."\", onClick=\"openExtManager('submitform','".XOOPS_URL.'/modules/'.$moddir."/admin/extensionmanager.php','field_type', '"._MD_SELECT_FORMTYPE.'\')">'); |
|
105 | 105 | $ext_tray->addElement($ext_text); |
106 | 106 | $ext_tray->addElement($ext_button); |
107 | 107 | $form->addElement($ext_tray); |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | global $xoopsDB, $mytree, $mytree2, $xoopsUser, $get_typeid, $moddir, $eh, $fieldtypes; |
140 | 140 | xoops_cp_header(); |
141 | 141 | //adminmenu(2, _MD_A_FTYPESADMIN); |
142 | - echo '<h4>' . _MD_VIEW_FIELDTYPE . '</h4>'; |
|
142 | + echo '<h4>'._MD_VIEW_FIELDTYPE.'</h4>'; |
|
143 | 143 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
144 | - $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . " WHERE typeid='" . $get_typeid . '\'') or $eh->show('0013'); |
|
144 | + $result = $xoopsDB->query('SELECT typeid, title, fieldtype, descr, ext, activeyn FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes')." WHERE typeid='".$get_typeid.'\'') or $eh->show('0013'); |
|
145 | 145 | $numrows = $xoopsDB->getRowsNum($result); |
146 | 146 | if ($numrows > 0) { |
147 | 147 | while (list($typeid, $title, $fieldtype, $descr, $ext, $activeyn) = $xoopsDB->fetchRow($result)) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $ext_tray = new XoopsFormElementTray(_MD_EXT, ''); |
157 | 157 | $ext_text = new XoopsFormText('', 'ext', 80, 150, "$ext"); |
158 | 158 | $ext_text->setExtra('style=\'background-color:lightgrey\''); |
159 | - $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_SET_EXT . "\", onClick=\"openExtManager('submitform','" . XOOPS_URL . '/modules/' . $moddir . "/admin/extensionmanager.php','field_type', '" . _MD_SELECT_FORMTYPE . '\')">'); |
|
159 | + $ext_button = new XoopsFormLabel('', '<INPUT type="button" value="'._MD_SET_EXT."\", onClick=\"openExtManager('submitform','".XOOPS_URL.'/modules/'.$moddir."/admin/extensionmanager.php','field_type', '"._MD_SELECT_FORMTYPE.'\')">'); |
|
160 | 160 | $ext_tray->addElement($ext_text); |
161 | 161 | $ext_tray->addElement($ext_button); |
162 | 162 | $form->addElement($ext_tray); |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | $p_ext = ''; |
205 | 205 | } |
206 | 206 | if (isset($_POST['status'])) { |
207 | - $p_status = (int)$_POST['status']; |
|
207 | + $p_status = (int) $_POST['status']; |
|
208 | 208 | } else { |
209 | 209 | $p_status = 0; |
210 | 210 | } |
211 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . '_typeid_seq'); |
|
212 | - $sql = sprintf("INSERT INTO %s (typeid, title, fieldtype, descr, ext, activeyn) VALUES (%u, '%s', '%s', '%s', '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes'), $newid, $p_title, $p_fieldtype, $p_descr, $p_ext, $p_status); |
|
211 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes').'_typeid_seq'); |
|
212 | + $sql = sprintf("INSERT INTO %s (typeid, title, fieldtype, descr, ext, activeyn) VALUES (%u, '%s', '%s', '%s', '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes'), $newid, $p_title, $p_fieldtype, $p_descr, $p_ext, $p_status); |
|
213 | 213 | $xoopsDB->query($sql) or $eh->show('0013'); |
214 | 214 | redirect_header('fieldtypes.php', 2, _MD_SAVED); |
215 | 215 | exit(); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | { |
220 | 220 | global $xoopsDB, $_POST, $myts, $eh; |
221 | 221 | if (isset($_POST['typeid'])) { |
222 | - $p_typeid = (int)$_POST['typeid']; |
|
222 | + $p_typeid = (int) $_POST['typeid']; |
|
223 | 223 | } else { |
224 | 224 | exit(); |
225 | 225 | } |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | $p_ext = ''; |
233 | 233 | } |
234 | 234 | if (isset($_POST['status'])) { |
235 | - $p_status = (int)$_POST['status']; |
|
235 | + $p_status = (int) $_POST['status']; |
|
236 | 236 | } else { |
237 | 237 | $p_status = 0; |
238 | 238 | } |
239 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') . " SET title = '$p_title', fieldtype='$p_fieldtype', ext='$p_ext', activeyn='$p_status' WHERE typeid = $p_typeid"; |
|
239 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes')." SET title = '$p_title', fieldtype='$p_fieldtype', ext='$p_ext', activeyn='$p_status' WHERE typeid = $p_typeid"; |
|
240 | 240 | $xoopsDB->query($sql) or $eh->show('0013'); |
241 | 241 | redirect_header("fieldtypes.php?op=view&typeid=$p_typeid", 2, _MD_SAVED); |
242 | 242 | exit(); |
@@ -246,29 +246,29 @@ discard block |
||
246 | 246 | { |
247 | 247 | global $xoopsDB, $myts, $eh; |
248 | 248 | if (isset($_POST['dirid'])) { |
249 | - $p_dirid = (int)$_POST['dirid']; |
|
249 | + $p_dirid = (int) $_POST['dirid']; |
|
250 | 250 | } else { |
251 | 251 | exit(); |
252 | 252 | } |
253 | 253 | $p_title = $myts->makeTboxData4Save($_POST['title']); |
254 | - $p_active = (int)$_POST['active']; |
|
255 | - $p_pid = (int)$_POST['pid']; |
|
256 | - $p_allowlist = (int)$_POST['allowlist']; |
|
257 | - $p_showpopular = (int)$_POST['showpopular']; |
|
254 | + $p_active = (int) $_POST['active']; |
|
255 | + $p_pid = (int) $_POST['pid']; |
|
256 | + $p_allowlist = (int) $_POST['allowlist']; |
|
257 | + $p_showpopular = (int) $_POST['showpopular']; |
|
258 | 258 | if (isset($_POST['descr'])) { |
259 | 259 | $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
260 | 260 | } else { |
261 | 261 | $p_descr = ''; |
262 | 262 | } |
263 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
264 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid) VALUES (%u, %u, '%s', %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid); |
|
263 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat').'_cid_seq'); |
|
264 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid) VALUES (%u, %u, '%s', %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid); |
|
265 | 265 | //echo $sql; |
266 | 266 | $xoopsDB->query($sql) or $eh->show('0013'); |
267 | 267 | if ($newid == 0) { |
268 | 268 | $cid = $xoopsDB->getInsertId(); |
269 | 269 | } |
270 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
271 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, '1', time()); |
|
270 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt').'_txtid_seq'); |
|
271 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $newid, $cid, $p_descr, '1', time()); |
|
272 | 272 | //echo $sql2; |
273 | 273 | $xoopsDB->query($sql2) or $eh->show('0013'); |
274 | 274 | redirect_header("categories.php?op=edit&cid=$newid", 0, _MD_CAT_UPDATED); |
@@ -298,19 +298,19 @@ discard block |
||
298 | 298 | function getCatOverview() |
299 | 299 | { |
300 | 300 | global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
301 | - $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\''); |
|
301 | + $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." WHERE dirid='".$get_dirid.'\' AND pid=\'0\''); |
|
302 | 302 | $numrows = $xoopsDB->getRowsNum($mainresult); |
303 | 303 | $output = ''; |
304 | 304 | if ($numrows > 0) { |
305 | - $output = '<th>' . _MD_CATTITLE . '</th><th>' . _MD_ACTIVEYN . '</th><th>' . _MD_PARENTCAT . "</th>\n"; |
|
305 | + $output = '<th>'._MD_CATTITLE.'</th><th>'._MD_ACTIVEYN.'</th><th>'._MD_PARENTCAT."</th>\n"; |
|
306 | 306 | $brench = 0; |
307 | 307 | $tab = ''; |
308 | 308 | while (list($cid, $title, $activeyn, $pid) = $xoopsDB->fetchRow($mainresult)) { |
309 | - $output .= '<tr><td>' . $tab . '<a href="' . XOOPS_URL . "/modules/$moddir/admin/categories.php?op=edit&cid=$cid\">" . $title . '</a></td><td>' . $activeyn . "</td></tr>\n"; |
|
309 | + $output .= '<tr><td>'.$tab.'<a href="'.XOOPS_URL."/modules/$moddir/admin/categories.php?op=edit&cid=$cid\">".$title.'</a></td><td>'.$activeyn."</td></tr>\n"; |
|
310 | 310 | $output .= getChildrenCategories($cid); |
311 | 311 | } |
312 | 312 | } else { |
313 | - $output = '' . _MD_NORESULTS . ''; |
|
313 | + $output = ''._MD_NORESULTS.''; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | return $output; |
@@ -322,17 +322,17 @@ discard block |
||
322 | 322 | $firstchildcats = $mytree->getFirstChildId($childid); |
323 | 323 | $tab = ''; |
324 | 324 | $output = ''; |
325 | - $plus = '<img src="' . XOOPS_URL . "\images\arrow.jpg\">"; |
|
325 | + $plus = '<img src="'.XOOPS_URL."\images\arrow.jpg\">"; |
|
326 | 326 | for ($i = 0; $i < $level; ++$i) { |
327 | 327 | $tab .= ' '; |
328 | 328 | } |
329 | 329 | foreach ($firstchildcats as $childid) { |
330 | - $childresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE pid='" . $childid . '\''); |
|
330 | + $childresult = $xoopsDB->query('SELECT cid, title, active, pid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." WHERE pid='".$childid.'\''); |
|
331 | 331 | //$childresult = $xoopsDB->query("SELECT cid, title, active, pid FROM ".$xoopsDB->prefix("efqdiralpha1_cat")." WHERE dirid='".$dirid."' AND pid='".$childid."'"); |
332 | 332 | $numrows = $xoopsDB->getRowsNum($childresult); |
333 | 333 | if ($numrows > 0) { |
334 | 334 | while (list($cid, $title, $activeyn, $pid) = $xoopsDB->fetchRow($childresult)) { |
335 | - $output .= '<tr><td>' . $tab . '' . $plus . '</td><td>' . $title . '</td><td>' . $activeyn . "</td></tr>\n"; |
|
335 | + $output .= '<tr><td>'.$tab.''.$plus.'</td><td>'.$title.'</td><td>'.$activeyn."</td></tr>\n"; |
|
336 | 336 | $newlevel = ++$level; |
337 | 337 | $output .= getChildrenCategories($cid, $newlevel); |
338 | 338 | } |