@@ -31,12 +31,12 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | class efqCategory extends XoopsObject |
| 33 | 33 | { |
| 34 | - /** |
|
| 35 | - * efqCategory constructor. |
|
| 36 | - */ |
|
| 37 | - public function __construct() |
|
| 38 | - { |
|
| 39 | - } |
|
| 34 | + /** |
|
| 35 | + * efqCategory constructor. |
|
| 36 | + */ |
|
| 37 | + public function __construct() |
|
| 38 | + { |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | class efqCategoryHandler extends XoopsObjectHandler |
| 52 | 52 | { |
| 53 | - /** |
|
| 54 | - * efqCategoryHandler constructor. |
|
| 55 | - */ |
|
| 56 | - public function __construct() |
|
| 57 | - { |
|
| 58 | - } |
|
| 53 | + /** |
|
| 54 | + * efqCategoryHandler constructor. |
|
| 55 | + */ |
|
| 56 | + public function __construct() |
|
| 57 | + { |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -19,135 +19,135 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | if (!class_exists('Coupon')) { |
| 22 | - class Coupon extends XoopsObject |
|
| 23 | - { |
|
| 24 | - //Constructor |
|
| 25 | - /** |
|
| 26 | - * @param mixed $coupid int for coupon id or array with name->value pairs of properties |
|
| 27 | - */ |
|
| 28 | - public function __construct($coupid = false) |
|
| 29 | - { |
|
| 30 | - global $moddir; |
|
| 31 | - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 32 | - $this->initVar('couponid', XOBJ_DTYPE_INT, null, false); |
|
| 33 | - $this->initVar('itemid', XOBJ_DTYPE_INT, null, true); |
|
| 34 | - $this->initVar('description', XOBJ_DTYPE_TXTAREA); |
|
| 35 | - $this->initVar('image', XOBJ_DTYPE_TXTBOX); |
|
| 36 | - $this->initVar('publish', XOBJ_DTYPE_INT, 0, false); |
|
| 37 | - $this->initVar('expire', XOBJ_DTYPE_INT, 0, false); |
|
| 38 | - $this->initVar('heading', XOBJ_DTYPE_TXTBOX); |
|
| 39 | - $this->initVar('counter', XOBJ_DTYPE_INT, 0, false); |
|
| 40 | - $this->initVar('lbr', XOBJ_DTYPE_INT, 0, false); |
|
| 41 | - if ($coupid !== false) { |
|
| 42 | - if (is_array($coupid)) { |
|
| 43 | - $this->assignVars($coupid); |
|
| 44 | - } else { |
|
| 45 | - $couponHandler = xoops_getModuleHandler('coupon', $moddir); |
|
| 46 | - $coupon = $couponHandler->get($coupid); |
|
| 47 | - foreach ($coupon->vars as $k => $v) { |
|
| 48 | - $this->assignVar($k, $v['value']); |
|
| 49 | - } |
|
| 50 | - unset($coupon); |
|
| 51 | - } |
|
| 52 | - } |
|
| 53 | - } |
|
| 22 | + class Coupon extends XoopsObject |
|
| 23 | + { |
|
| 24 | + //Constructor |
|
| 25 | + /** |
|
| 26 | + * @param mixed $coupid int for coupon id or array with name->value pairs of properties |
|
| 27 | + */ |
|
| 28 | + public function __construct($coupid = false) |
|
| 29 | + { |
|
| 30 | + global $moddir; |
|
| 31 | + $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 32 | + $this->initVar('couponid', XOBJ_DTYPE_INT, null, false); |
|
| 33 | + $this->initVar('itemid', XOBJ_DTYPE_INT, null, true); |
|
| 34 | + $this->initVar('description', XOBJ_DTYPE_TXTAREA); |
|
| 35 | + $this->initVar('image', XOBJ_DTYPE_TXTBOX); |
|
| 36 | + $this->initVar('publish', XOBJ_DTYPE_INT, 0, false); |
|
| 37 | + $this->initVar('expire', XOBJ_DTYPE_INT, 0, false); |
|
| 38 | + $this->initVar('heading', XOBJ_DTYPE_TXTBOX); |
|
| 39 | + $this->initVar('counter', XOBJ_DTYPE_INT, 0, false); |
|
| 40 | + $this->initVar('lbr', XOBJ_DTYPE_INT, 0, false); |
|
| 41 | + if ($coupid !== false) { |
|
| 42 | + if (is_array($coupid)) { |
|
| 43 | + $this->assignVars($coupid); |
|
| 44 | + } else { |
|
| 45 | + $couponHandler = xoops_getModuleHandler('coupon', $moddir); |
|
| 46 | + $coupon = $couponHandler->get($coupid); |
|
| 47 | + foreach ($coupon->vars as $k => $v) { |
|
| 48 | + $this->assignVar($k, $v['value']); |
|
| 49 | + } |
|
| 50 | + unset($coupon); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - public function toArray() |
|
| 56 | - { |
|
| 57 | - $ret = array(); |
|
| 58 | - foreach ($this->vars as $k => $v) { |
|
| 59 | - $ret[$k] = $v['value']; |
|
| 60 | - } |
|
| 55 | + public function toArray() |
|
| 56 | + { |
|
| 57 | + $ret = array(); |
|
| 58 | + foreach ($this->vars as $k => $v) { |
|
| 59 | + $ret[$k] = $v['value']; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - return $ret; |
|
| 63 | - } |
|
| 64 | - } |
|
| 62 | + return $ret; |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // Change the class name below to enable custom directory (Capitolize first letter YourdirectoryCouponHandler) |
| 68 | 68 | class efqdirectoryCouponHandler extends XoopsObjectHandler |
| 69 | 69 | { |
| 70 | - /** |
|
| 71 | - * create a new coupon object |
|
| 72 | - * |
|
| 73 | - * @param bool $isNew flag the new objects as "new"? |
|
| 74 | - * @return object {@link Coupon} |
|
| 75 | - */ |
|
| 76 | - //var $coupon; |
|
| 77 | - //var $db; |
|
| 70 | + /** |
|
| 71 | + * create a new coupon object |
|
| 72 | + * |
|
| 73 | + * @param bool $isNew flag the new objects as "new"? |
|
| 74 | + * @return object {@link Coupon} |
|
| 75 | + */ |
|
| 76 | + //var $coupon; |
|
| 77 | + //var $db; |
|
| 78 | 78 | |
| 79 | - public function &create($isNew = true) |
|
| 80 | - { |
|
| 81 | - //$this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 82 | - $coupon = new Coupon(); |
|
| 83 | - if ($isNew) { |
|
| 84 | - $coupon->setNew(); |
|
| 85 | - } |
|
| 79 | + public function &create($isNew = true) |
|
| 80 | + { |
|
| 81 | + //$this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 82 | + $coupon = new Coupon(); |
|
| 83 | + if ($isNew) { |
|
| 84 | + $coupon->setNew(); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - return $coupon; |
|
| 88 | - } |
|
| 87 | + return $coupon; |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * retrieve a coupon |
|
| 92 | - * |
|
| 93 | - * @param bool|int $coupid ID of the coupon |
|
| 94 | - * @return mixed reference to the <a href='psi_element://Coupon'>Coupon</a> object, FALSE if failed |
|
| 95 | - * object, FALSE if failed |
|
| 96 | - */ |
|
| 97 | - public function &get($coupid = false) |
|
| 98 | - { |
|
| 99 | - if ($coupid === false) { |
|
| 100 | - return false; |
|
| 101 | - } |
|
| 102 | - $coupid = (int)$coupid; |
|
| 103 | - if ($coupid > 0) { |
|
| 104 | - $sql = 'SELECT * FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid=' . $coupid; |
|
| 105 | - if (!$result = $this->db->query($sql)) { |
|
| 106 | - return false; |
|
| 107 | - } |
|
| 108 | - $coupon =& $this->create(false); |
|
| 109 | - $coupon->assignVars($this->db->fetchArray($result)); |
|
| 90 | + /** |
|
| 91 | + * retrieve a coupon |
|
| 92 | + * |
|
| 93 | + * @param bool|int $coupid ID of the coupon |
|
| 94 | + * @return mixed reference to the <a href='psi_element://Coupon'>Coupon</a> object, FALSE if failed |
|
| 95 | + * object, FALSE if failed |
|
| 96 | + */ |
|
| 97 | + public function &get($coupid = false) |
|
| 98 | + { |
|
| 99 | + if ($coupid === false) { |
|
| 100 | + return false; |
|
| 101 | + } |
|
| 102 | + $coupid = (int)$coupid; |
|
| 103 | + if ($coupid > 0) { |
|
| 104 | + $sql = 'SELECT * FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid=' . $coupid; |
|
| 105 | + if (!$result = $this->db->query($sql)) { |
|
| 106 | + return false; |
|
| 107 | + } |
|
| 108 | + $coupon =& $this->create(false); |
|
| 109 | + $coupon->assignVars($this->db->fetchArray($result)); |
|
| 110 | 110 | |
| 111 | - return $coupon; |
|
| 112 | - } |
|
| 111 | + return $coupon; |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | - return false; |
|
| 115 | - } |
|
| 114 | + return false; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Save coupon in database |
|
| 119 | - * @param object|XoopsObject $coupon reference to the {@link Coupon} |
|
| 120 | - * object |
|
| 121 | - * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
|
| 122 | - * @internal param bool $force |
|
| 123 | - */ |
|
| 124 | - public function insert(XoopsObject $coupon) |
|
| 125 | - { |
|
| 126 | - global $eh, $xoopsDB, $description, $image, $heading, $couponid; |
|
| 127 | - if (get_class($coupon) != 'Coupon') { |
|
| 128 | - echo ' class not coupon '; |
|
| 117 | + /** |
|
| 118 | + * Save coupon in database |
|
| 119 | + * @param object|XoopsObject $coupon reference to the {@link Coupon} |
|
| 120 | + * object |
|
| 121 | + * @return bool FALSE if failed, TRUE if already present and unchanged or successful |
|
| 122 | + * @internal param bool $force |
|
| 123 | + */ |
|
| 124 | + public function insert(XoopsObject $coupon) |
|
| 125 | + { |
|
| 126 | + global $eh, $xoopsDB, $description, $image, $heading, $couponid; |
|
| 127 | + if (get_class($coupon) != 'Coupon') { |
|
| 128 | + echo ' class not coupon '; |
|
| 129 | 129 | |
| 130 | - return false; |
|
| 131 | - } |
|
| 132 | - if (!$coupon->isDirty()) { |
|
| 133 | - echo ' coupon not dirty '; |
|
| 130 | + return false; |
|
| 131 | + } |
|
| 132 | + if (!$coupon->isDirty()) { |
|
| 133 | + echo ' coupon not dirty '; |
|
| 134 | 134 | |
| 135 | - return true; |
|
| 136 | - } |
|
| 137 | - if (!$coupon->cleanVars()) { |
|
| 138 | - echo ' coupon not cleanvars '; |
|
| 135 | + return true; |
|
| 136 | + } |
|
| 137 | + if (!$coupon->cleanVars()) { |
|
| 138 | + echo ' coupon not cleanvars '; |
|
| 139 | 139 | |
| 140 | - return false; |
|
| 141 | - } |
|
| 142 | - foreach ($coupon->cleanVars as $k => $v) { |
|
| 143 | - ${$k} = $v; |
|
| 144 | - } |
|
| 145 | - if ($coupon->_isNew) { |
|
| 146 | - $sql = 'INSERT INTO ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . " |
|
| 140 | + return false; |
|
| 141 | + } |
|
| 142 | + foreach ($coupon->cleanVars as $k => $v) { |
|
| 143 | + ${$k} = $v; |
|
| 144 | + } |
|
| 145 | + if ($coupon->_isNew) { |
|
| 146 | + $sql = 'INSERT INTO ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . " |
|
| 147 | 147 | (itemid, description, image, publish, expire, heading, lbr) VALUES |
| 148 | 148 | ($itemid, " . $this->db->quoteString($description) . ', ' . $this->db->quoteString($image) . ", $publish, $expire, " . $this->db->quoteString($heading) . ", $lbr)"; |
| 149 | - } else { |
|
| 150 | - $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . " SET |
|
| 149 | + } else { |
|
| 150 | + $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . " SET |
|
| 151 | 151 | itemid = $itemid, |
| 152 | 152 | description = " . $this->db->quoteString($description) . ', |
| 153 | 153 | image = ' . $this->db->quoteString($image) . ", |
@@ -155,200 +155,200 @@ discard block |
||
| 155 | 155 | lbr = $lbr, |
| 156 | 156 | heading = " . $this->db->quoteString($heading) . ", |
| 157 | 157 | expire = $expire WHERE couponid = " . $couponid; |
| 158 | - } |
|
| 159 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 160 | - if ($coupon->_isNew) { |
|
| 161 | - $coupon->setVar('couponid', $this->db->getInsertId()); |
|
| 162 | - $coupon->_isNew = false; |
|
| 163 | - } |
|
| 158 | + } |
|
| 159 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 160 | + if ($coupon->_isNew) { |
|
| 161 | + $coupon->setVar('couponid', $this->db->getInsertId()); |
|
| 162 | + $coupon->_isNew = false; |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - return true; |
|
| 166 | - } |
|
| 165 | + return true; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * delete a coupon from the database |
|
| 170 | - * |
|
| 171 | - * @param object|XoopsObject $coupon reference to the {@link Coupon} |
|
| 172 | - * to delete |
|
| 173 | - * @return bool FALSE if failed. |
|
| 174 | - * @internal param bool $force |
|
| 175 | - */ |
|
| 176 | - public function delete(XoopsObject $coupon) |
|
| 177 | - { |
|
| 178 | - $sql = 'DELETE FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid = ' . (int)$coupon->getVar('couponid'); |
|
| 179 | - if (!$this->db->query($sql)) { |
|
| 180 | - return false; |
|
| 181 | - } |
|
| 168 | + /** |
|
| 169 | + * delete a coupon from the database |
|
| 170 | + * |
|
| 171 | + * @param object|XoopsObject $coupon reference to the {@link Coupon} |
|
| 172 | + * to delete |
|
| 173 | + * @return bool FALSE if failed. |
|
| 174 | + * @internal param bool $force |
|
| 175 | + */ |
|
| 176 | + public function delete(XoopsObject $coupon) |
|
| 177 | + { |
|
| 178 | + $sql = 'DELETE FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid = ' . (int)$coupon->getVar('couponid'); |
|
| 179 | + if (!$this->db->query($sql)) { |
|
| 180 | + return false; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - return true; |
|
| 184 | - } |
|
| 183 | + return true; |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * get {@link Coupon} objects from criteria |
|
| 188 | - * |
|
| 189 | - * @param object $criteria reference to a {@link Criteria} or {@link CriteriaCompo} object |
|
| 190 | - * @param bool $as_objects if true, the returned array will be {@link Coupon} objects |
|
| 191 | - * @param bool $id_as_key if true, the returned array will have the coupon ids as key |
|
| 192 | - * |
|
| 193 | - * @return array array of {@link Coupon} objects |
|
| 194 | - */ |
|
| 195 | - public function &getObjects($criteria = null, $as_objects = true, $id_as_key = false) |
|
| 196 | - { |
|
| 197 | - $ret = array(); |
|
| 198 | - $limit = $start = 0; |
|
| 199 | - $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
|
| 186 | + /** |
|
| 187 | + * get {@link Coupon} objects from criteria |
|
| 188 | + * |
|
| 189 | + * @param object $criteria reference to a {@link Criteria} or {@link CriteriaCompo} object |
|
| 190 | + * @param bool $as_objects if true, the returned array will be {@link Coupon} objects |
|
| 191 | + * @param bool $id_as_key if true, the returned array will have the coupon ids as key |
|
| 192 | + * |
|
| 193 | + * @return array array of {@link Coupon} objects |
|
| 194 | + */ |
|
| 195 | + public function &getObjects($criteria = null, $as_objects = true, $id_as_key = false) |
|
| 196 | + { |
|
| 197 | + $ret = array(); |
|
| 198 | + $limit = $start = 0; |
|
| 199 | + $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
|
| 200 | 200 | FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' coup, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' l |
| 201 | 201 | WHERE coup.itemid=l.itemid AND '; |
| 202 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 203 | - $sql .= ' ' . $criteria->render(); |
|
| 204 | - if ($criteria->getSort() != '') { |
|
| 205 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 206 | - } |
|
| 207 | - $limit = $criteria->getLimit(); |
|
| 208 | - $start = $criteria->getStart(); |
|
| 209 | - } |
|
| 210 | - $result = $this->db->query($sql, $limit, $start); |
|
| 211 | - if (!$result) { |
|
| 212 | - return $ret; |
|
| 213 | - } |
|
| 214 | - while ($myrow = $this->db->fetchArray($result)) { |
|
| 215 | - if ($as_objects) { |
|
| 216 | - $coupon = new Coupon(); |
|
| 217 | - $coupon->assignVars($myrow); |
|
| 218 | - if (!$id_as_key) { |
|
| 219 | - $ret[] =& $coupon; |
|
| 220 | - } else { |
|
| 221 | - $ret[$myrow['couponid']] =& $coupon; |
|
| 222 | - } |
|
| 223 | - unset($coupon); |
|
| 224 | - } else { |
|
| 225 | - $ret[] = $myrow; |
|
| 226 | - } |
|
| 227 | - } |
|
| 202 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 203 | + $sql .= ' ' . $criteria->render(); |
|
| 204 | + if ($criteria->getSort() != '') { |
|
| 205 | + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 206 | + } |
|
| 207 | + $limit = $criteria->getLimit(); |
|
| 208 | + $start = $criteria->getStart(); |
|
| 209 | + } |
|
| 210 | + $result = $this->db->query($sql, $limit, $start); |
|
| 211 | + if (!$result) { |
|
| 212 | + return $ret; |
|
| 213 | + } |
|
| 214 | + while ($myrow = $this->db->fetchArray($result)) { |
|
| 215 | + if ($as_objects) { |
|
| 216 | + $coupon = new Coupon(); |
|
| 217 | + $coupon->assignVars($myrow); |
|
| 218 | + if (!$id_as_key) { |
|
| 219 | + $ret[] =& $coupon; |
|
| 220 | + } else { |
|
| 221 | + $ret[$myrow['couponid']] =& $coupon; |
|
| 222 | + } |
|
| 223 | + unset($coupon); |
|
| 224 | + } else { |
|
| 225 | + $ret[] = $myrow; |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - return $ret; |
|
| 230 | - } |
|
| 229 | + return $ret; |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - /** |
|
| 233 | - * get {@link Coupon} objects by listing |
|
| 234 | - * |
|
| 235 | - * @param int $itemid listing id |
|
| 236 | - * |
|
| 237 | - * @return array array of {@link Coupon} objects |
|
| 238 | - */ |
|
| 239 | - public function &getByLink($itemid) |
|
| 240 | - { |
|
| 241 | - global $eh; |
|
| 242 | - $ret = array(); |
|
| 243 | - $limit = $start = 0; |
|
| 244 | - $now = time(); |
|
| 245 | - $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
|
| 232 | + /** |
|
| 233 | + * get {@link Coupon} objects by listing |
|
| 234 | + * |
|
| 235 | + * @param int $itemid listing id |
|
| 236 | + * |
|
| 237 | + * @return array array of {@link Coupon} objects |
|
| 238 | + */ |
|
| 239 | + public function &getByLink($itemid) |
|
| 240 | + { |
|
| 241 | + global $eh; |
|
| 242 | + $ret = array(); |
|
| 243 | + $limit = $start = 0; |
|
| 244 | + $now = time(); |
|
| 245 | + $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
|
| 246 | 246 | FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' coup, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' l'; |
| 247 | - $sql .= ' WHERE coup.itemid = l.itemid AND coup.itemid=' . (int)$itemid . ' AND coup.publish < ' . $now . ' AND (coup.expire = 0 OR coup.expire > ' . $now . ')'; |
|
| 248 | - $sql .= ' ORDER BY listingTitle ASC'; |
|
| 249 | - $result = $this->db->query($sql, $limit, $start) or $eh->show('0013'); |
|
| 247 | + $sql .= ' WHERE coup.itemid = l.itemid AND coup.itemid=' . (int)$itemid . ' AND coup.publish < ' . $now . ' AND (coup.expire = 0 OR coup.expire > ' . $now . ')'; |
|
| 248 | + $sql .= ' ORDER BY listingTitle ASC'; |
|
| 249 | + $result = $this->db->query($sql, $limit, $start) or $eh->show('0013'); |
|
| 250 | 250 | |
| 251 | - if (!$result) { |
|
| 252 | - return $ret; |
|
| 253 | - } |
|
| 254 | - while ($myrow = $this->db->fetchArray($result)) { |
|
| 255 | - $ret[] = $myrow; |
|
| 256 | - } |
|
| 251 | + if (!$result) { |
|
| 252 | + return $ret; |
|
| 253 | + } |
|
| 254 | + while ($myrow = $this->db->fetchArray($result)) { |
|
| 255 | + $ret[] = $myrow; |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - return $ret; |
|
| 259 | - } |
|
| 258 | + return $ret; |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * Returns number of coupons for a listing |
|
| 263 | - * |
|
| 264 | - * @param int $itemid listing id |
|
| 265 | - * @return bool|int |
|
| 266 | - */ |
|
| 267 | - public function getCountByLink($itemid) |
|
| 268 | - { |
|
| 269 | - $ret = 0; |
|
| 270 | - $now = time(); |
|
| 271 | - $sql = 'SELECT count(*) FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE itemid=' . (int)$itemid . ' AND publish < ' . $now . ' AND (expire = 0 OR expire > ' . $now . ')'; |
|
| 272 | - if (!$result = $this->db->query($sql)) { |
|
| 273 | - return false; |
|
| 274 | - } |
|
| 275 | - list($ret) = $this->db->fetchRow($result); |
|
| 261 | + /** |
|
| 262 | + * Returns number of coupons for a listing |
|
| 263 | + * |
|
| 264 | + * @param int $itemid listing id |
|
| 265 | + * @return bool|int |
|
| 266 | + */ |
|
| 267 | + public function getCountByLink($itemid) |
|
| 268 | + { |
|
| 269 | + $ret = 0; |
|
| 270 | + $now = time(); |
|
| 271 | + $sql = 'SELECT count(*) FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE itemid=' . (int)$itemid . ' AND publish < ' . $now . ' AND (expire = 0 OR expire > ' . $now . ')'; |
|
| 272 | + if (!$result = $this->db->query($sql)) { |
|
| 273 | + return false; |
|
| 274 | + } |
|
| 275 | + list($ret) = $this->db->fetchRow($result); |
|
| 276 | 276 | |
| 277 | - return $ret; |
|
| 278 | - } |
|
| 277 | + return $ret; |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - /** |
|
| 281 | - * get {@link Coupon} object with listing info |
|
| 282 | - * |
|
| 283 | - * @param int $coupid Coupon ID |
|
| 284 | - * |
|
| 285 | - * @return array|object |
|
| 286 | - */ |
|
| 287 | - public function &getLinkedCoupon($coupid) |
|
| 288 | - { |
|
| 289 | - $ret = array(); |
|
| 290 | - $limit = $start = 0; |
|
| 291 | - $now = time(); |
|
| 292 | - $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
|
| 280 | + /** |
|
| 281 | + * get {@link Coupon} object with listing info |
|
| 282 | + * |
|
| 283 | + * @param int $coupid Coupon ID |
|
| 284 | + * |
|
| 285 | + * @return array|object |
|
| 286 | + */ |
|
| 287 | + public function &getLinkedCoupon($coupid) |
|
| 288 | + { |
|
| 289 | + $ret = array(); |
|
| 290 | + $limit = $start = 0; |
|
| 291 | + $now = time(); |
|
| 292 | + $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
|
| 293 | 293 | FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' coup, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' l'; |
| 294 | - $sql .= ' WHERE coup.itemid = l.itemid AND coup.couponid=' . (int)$coupid; |
|
| 295 | - $result = $this->db->query($sql, $limit, $start); |
|
| 296 | - if (!$result) { |
|
| 297 | - return $ret; |
|
| 298 | - } |
|
| 299 | - while ($myrow = $this->db->fetchArray($result)) { |
|
| 300 | - $ret[] = $myrow; |
|
| 301 | - } |
|
| 294 | + $sql .= ' WHERE coup.itemid = l.itemid AND coup.couponid=' . (int)$coupid; |
|
| 295 | + $result = $this->db->query($sql, $limit, $start); |
|
| 296 | + if (!$result) { |
|
| 297 | + return $ret; |
|
| 298 | + } |
|
| 299 | + while ($myrow = $this->db->fetchArray($result)) { |
|
| 300 | + $ret[] = $myrow; |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - return $ret; |
|
| 304 | - } |
|
| 303 | + return $ret; |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | - /** |
|
| 307 | - * Prepares rows from getByLink and getByCategory to be displayed |
|
| 308 | - * |
|
| 309 | - * @param array $array rows to be prepared |
|
| 310 | - * |
|
| 311 | - * @return array |
|
| 312 | - */ |
|
| 313 | - public function prepare2show($array) |
|
| 314 | - { |
|
| 315 | - $myts = MyTextSanitizer::getInstance(); |
|
| 316 | - $ret = array(); |
|
| 317 | - foreach ($array as $key => $myrow) { |
|
| 318 | - $description = $myts->displayTarea($myrow['description'], 1, 1, 1, 1, $myrow['lbr']); |
|
| 319 | - if ($myrow['expire'] > 0) { |
|
| 320 | - $expire = formatTimestamp($myrow['expire'], 's'); |
|
| 321 | - } else { |
|
| 322 | - $expire = 0; |
|
| 323 | - } |
|
| 324 | - $ret ['items']['coupons'][] = array( |
|
| 325 | - 'itemid' => $myrow['itemid'], |
|
| 326 | - 'couponid' => $myrow['couponid'], |
|
| 327 | - 'heading' => $myts->htmlSpecialChars($myrow['heading']), |
|
| 328 | - 'description' => $description, |
|
| 329 | - 'logourl' => $myts->displayTarea($myrow['logourl']), |
|
| 330 | - 'publish' => formatTimestamp($myrow['publish'], 's'), |
|
| 331 | - 'expire' => $expire, |
|
| 332 | - 'counter' => (int)$myrow['counter'] |
|
| 333 | - ); |
|
| 334 | - $ret ['items']['listingTitle'] = $myts->displayTarea($myrow['listingTitle']); |
|
| 335 | - $ret ['items']['itemid'] = $myrow['itemid']; |
|
| 336 | - } |
|
| 306 | + /** |
|
| 307 | + * Prepares rows from getByLink and getByCategory to be displayed |
|
| 308 | + * |
|
| 309 | + * @param array $array rows to be prepared |
|
| 310 | + * |
|
| 311 | + * @return array |
|
| 312 | + */ |
|
| 313 | + public function prepare2show($array) |
|
| 314 | + { |
|
| 315 | + $myts = MyTextSanitizer::getInstance(); |
|
| 316 | + $ret = array(); |
|
| 317 | + foreach ($array as $key => $myrow) { |
|
| 318 | + $description = $myts->displayTarea($myrow['description'], 1, 1, 1, 1, $myrow['lbr']); |
|
| 319 | + if ($myrow['expire'] > 0) { |
|
| 320 | + $expire = formatTimestamp($myrow['expire'], 's'); |
|
| 321 | + } else { |
|
| 322 | + $expire = 0; |
|
| 323 | + } |
|
| 324 | + $ret ['items']['coupons'][] = array( |
|
| 325 | + 'itemid' => $myrow['itemid'], |
|
| 326 | + 'couponid' => $myrow['couponid'], |
|
| 327 | + 'heading' => $myts->htmlSpecialChars($myrow['heading']), |
|
| 328 | + 'description' => $description, |
|
| 329 | + 'logourl' => $myts->displayTarea($myrow['logourl']), |
|
| 330 | + 'publish' => formatTimestamp($myrow['publish'], 's'), |
|
| 331 | + 'expire' => $expire, |
|
| 332 | + 'counter' => (int)$myrow['counter'] |
|
| 333 | + ); |
|
| 334 | + $ret ['items']['listingTitle'] = $myts->displayTarea($myrow['listingTitle']); |
|
| 335 | + $ret ['items']['itemid'] = $myrow['itemid']; |
|
| 336 | + } |
|
| 337 | 337 | |
| 338 | - return $ret; |
|
| 339 | - } |
|
| 338 | + return $ret; |
|
| 339 | + } |
|
| 340 | 340 | |
| 341 | - /** |
|
| 342 | - * Increment coupon counter |
|
| 343 | - * |
|
| 344 | - * @param int $couponid |
|
| 345 | - * |
|
| 346 | - * @return bool |
|
| 347 | - */ |
|
| 348 | - public function increment($couponid) |
|
| 349 | - { |
|
| 350 | - $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' SET counter=counter+1 WHERE couponid=' . (int)$couponid; |
|
| 341 | + /** |
|
| 342 | + * Increment coupon counter |
|
| 343 | + * |
|
| 344 | + * @param int $couponid |
|
| 345 | + * |
|
| 346 | + * @return bool |
|
| 347 | + */ |
|
| 348 | + public function increment($couponid) |
|
| 349 | + { |
|
| 350 | + $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' SET counter=counter+1 WHERE couponid=' . (int)$couponid; |
|
| 351 | 351 | |
| 352 | - return $this->db->queryF($sql); |
|
| 353 | - } |
|
| 352 | + return $this->db->queryF($sql); |
|
| 353 | + } |
|
| 354 | 354 | } |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | if ($coupid === false) { |
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | - $coupid = (int)$coupid; |
|
| 102 | + $coupid = (int) $coupid; |
|
| 103 | 103 | if ($coupid > 0) { |
| 104 | - $sql = 'SELECT * FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid=' . $coupid; |
|
| 104 | + $sql = 'SELECT * FROM '.$this->db->prefix($module->getVar('dirname', 'n').'_coupon').' WHERE couponid='.$coupid; |
|
| 105 | 105 | if (!$result = $this->db->query($sql)) { |
| 106 | 106 | return false; |
| 107 | 107 | } |
| 108 | - $coupon =& $this->create(false); |
|
| 108 | + $coupon = & $this->create(false); |
|
| 109 | 109 | $coupon->assignVars($this->db->fetchArray($result)); |
| 110 | 110 | |
| 111 | 111 | return $coupon; |
@@ -143,18 +143,18 @@ discard block |
||
| 143 | 143 | ${$k} = $v; |
| 144 | 144 | } |
| 145 | 145 | if ($coupon->_isNew) { |
| 146 | - $sql = 'INSERT INTO ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . " |
|
| 146 | + $sql = 'INSERT INTO '.$this->db->prefix($module->getVar('dirname', 'n').'_coupon')." |
|
| 147 | 147 | (itemid, description, image, publish, expire, heading, lbr) VALUES |
| 148 | - ($itemid, " . $this->db->quoteString($description) . ', ' . $this->db->quoteString($image) . ", $publish, $expire, " . $this->db->quoteString($heading) . ", $lbr)"; |
|
| 148 | + ($itemid, ".$this->db->quoteString($description).', '.$this->db->quoteString($image).", $publish, $expire, ".$this->db->quoteString($heading).", $lbr)"; |
|
| 149 | 149 | } else { |
| 150 | - $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . " SET |
|
| 150 | + $sql = 'UPDATE '.$this->db->prefix($module->getVar('dirname', 'n').'_coupon')." SET |
|
| 151 | 151 | itemid = $itemid, |
| 152 | - description = " . $this->db->quoteString($description) . ', |
|
| 153 | - image = ' . $this->db->quoteString($image) . ", |
|
| 152 | + description = ".$this->db->quoteString($description).', |
|
| 153 | + image = ' . $this->db->quoteString($image).", |
|
| 154 | 154 | publish = $publish, |
| 155 | 155 | lbr = $lbr, |
| 156 | - heading = " . $this->db->quoteString($heading) . ", |
|
| 157 | - expire = $expire WHERE couponid = " . $couponid; |
|
| 156 | + heading = ".$this->db->quoteString($heading).", |
|
| 157 | + expire = $expire WHERE couponid = ".$couponid; |
|
| 158 | 158 | } |
| 159 | 159 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 160 | 160 | if ($coupon->_isNew) { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | public function delete(XoopsObject $coupon) |
| 177 | 177 | { |
| 178 | - $sql = 'DELETE FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE couponid = ' . (int)$coupon->getVar('couponid'); |
|
| 178 | + $sql = 'DELETE FROM '.$this->db->prefix($module->getVar('dirname', 'n').'_coupon').' WHERE couponid = '.(int) $coupon->getVar('couponid'); |
|
| 179 | 179 | if (!$this->db->query($sql)) { |
| 180 | 180 | return false; |
| 181 | 181 | } |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | $ret = array(); |
| 198 | 198 | $limit = $start = 0; |
| 199 | 199 | $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
| 200 | - FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' coup, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' l |
|
| 200 | + FROM ' . $this->db->prefix($module->getVar('dirname', 'n').'_coupon').' coup, '.$this->db->prefix($module->getVar('dirname', 'n').'_items').' l |
|
| 201 | 201 | WHERE coup.itemid=l.itemid AND '; |
| 202 | 202 | if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
| 203 | - $sql .= ' ' . $criteria->render(); |
|
| 203 | + $sql .= ' '.$criteria->render(); |
|
| 204 | 204 | if ($criteria->getSort() != '') { |
| 205 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 205 | + $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); |
|
| 206 | 206 | } |
| 207 | 207 | $limit = $criteria->getLimit(); |
| 208 | 208 | $start = $criteria->getStart(); |
@@ -216,9 +216,9 @@ discard block |
||
| 216 | 216 | $coupon = new Coupon(); |
| 217 | 217 | $coupon->assignVars($myrow); |
| 218 | 218 | if (!$id_as_key) { |
| 219 | - $ret[] =& $coupon; |
|
| 219 | + $ret[] = & $coupon; |
|
| 220 | 220 | } else { |
| 221 | - $ret[$myrow['couponid']] =& $coupon; |
|
| 221 | + $ret[$myrow['couponid']] = & $coupon; |
|
| 222 | 222 | } |
| 223 | 223 | unset($coupon); |
| 224 | 224 | } else { |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | $limit = $start = 0; |
| 244 | 244 | $now = time(); |
| 245 | 245 | $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
| 246 | - FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' coup, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' l'; |
|
| 247 | - $sql .= ' WHERE coup.itemid = l.itemid AND coup.itemid=' . (int)$itemid . ' AND coup.publish < ' . $now . ' AND (coup.expire = 0 OR coup.expire > ' . $now . ')'; |
|
| 246 | + FROM ' . $this->db->prefix($module->getVar('dirname', 'n').'_coupon').' coup, '.$this->db->prefix($module->getVar('dirname', 'n').'_items').' l'; |
|
| 247 | + $sql .= ' WHERE coup.itemid = l.itemid AND coup.itemid='.(int) $itemid.' AND coup.publish < '.$now.' AND (coup.expire = 0 OR coup.expire > '.$now.')'; |
|
| 248 | 248 | $sql .= ' ORDER BY listingTitle ASC'; |
| 249 | 249 | $result = $this->db->query($sql, $limit, $start) or $eh->show('0013'); |
| 250 | 250 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | { |
| 269 | 269 | $ret = 0; |
| 270 | 270 | $now = time(); |
| 271 | - $sql = 'SELECT count(*) FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' WHERE itemid=' . (int)$itemid . ' AND publish < ' . $now . ' AND (expire = 0 OR expire > ' . $now . ')'; |
|
| 271 | + $sql = 'SELECT count(*) FROM '.$this->db->prefix($module->getVar('dirname', 'n').'_coupon').' WHERE itemid='.(int) $itemid.' AND publish < '.$now.' AND (expire = 0 OR expire > '.$now.')'; |
|
| 272 | 272 | if (!$result = $this->db->query($sql)) { |
| 273 | 273 | return false; |
| 274 | 274 | } |
@@ -290,8 +290,8 @@ discard block |
||
| 290 | 290 | $limit = $start = 0; |
| 291 | 291 | $now = time(); |
| 292 | 292 | $sql = 'SELECT l.title AS listingTitle, coup.couponid, coup.heading, coup.counter, l.itemid, l.logourl, coup.description, coup.image, coup.lbr, coup.publish, coup.expire |
| 293 | - FROM ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' coup, ' . $this->db->prefix($module->getVar('dirname', 'n') . '_items') . ' l'; |
|
| 294 | - $sql .= ' WHERE coup.itemid = l.itemid AND coup.couponid=' . (int)$coupid; |
|
| 293 | + FROM ' . $this->db->prefix($module->getVar('dirname', 'n').'_coupon').' coup, '.$this->db->prefix($module->getVar('dirname', 'n').'_items').' l'; |
|
| 294 | + $sql .= ' WHERE coup.itemid = l.itemid AND coup.couponid='.(int) $coupid; |
|
| 295 | 295 | $result = $this->db->query($sql, $limit, $start); |
| 296 | 296 | if (!$result) { |
| 297 | 297 | return $ret; |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | } else { |
| 322 | 322 | $expire = 0; |
| 323 | 323 | } |
| 324 | - $ret ['items']['coupons'][] = array( |
|
| 324 | + $ret ['items']['coupons'][] = array( |
|
| 325 | 325 | 'itemid' => $myrow['itemid'], |
| 326 | 326 | 'couponid' => $myrow['couponid'], |
| 327 | 327 | 'heading' => $myts->htmlSpecialChars($myrow['heading']), |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | 'logourl' => $myts->displayTarea($myrow['logourl']), |
| 330 | 330 | 'publish' => formatTimestamp($myrow['publish'], 's'), |
| 331 | 331 | 'expire' => $expire, |
| 332 | - 'counter' => (int)$myrow['counter'] |
|
| 332 | + 'counter' => (int) $myrow['counter'] |
|
| 333 | 333 | ); |
| 334 | 334 | $ret ['items']['listingTitle'] = $myts->displayTarea($myrow['listingTitle']); |
| 335 | 335 | $ret ['items']['itemid'] = $myrow['itemid']; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | public function increment($couponid) |
| 349 | 349 | { |
| 350 | - $sql = 'UPDATE ' . $this->db->prefix($module->getVar('dirname', 'n') . '_coupon') . ' SET counter=counter+1 WHERE couponid=' . (int)$couponid; |
|
| 350 | + $sql = 'UPDATE '.$this->db->prefix($module->getVar('dirname', 'n').'_coupon').' SET counter=counter+1 WHERE couponid='.(int) $couponid; |
|
| 351 | 351 | |
| 352 | 352 | return $this->db->queryF($sql); |
| 353 | 353 | } |
@@ -44,29 +44,29 @@ discard block |
||
| 44 | 44 | class efqDataType extends XoopsObject |
| 45 | 45 | { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * efqSubscriptionOffer::efqSubscriptionOffer() |
|
| 49 | - * |
|
| 50 | - * @param bool $offer |
|
| 51 | - * @internal param bool $itemtype |
|
| 52 | - */ |
|
| 53 | - public function __construct($offer = false) |
|
| 54 | - { |
|
| 55 | - global $moddir; |
|
| 56 | - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 57 | - $this->initVar('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
| 58 | - $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
| 59 | - $this->initVar('section', XOBJ_DTYPE_INT, 0, false); |
|
| 60 | - $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, 0, false); |
|
| 61 | - $this->initVar('uid', XOBJ_DTYPE_INT, 0, true, 5); |
|
| 62 | - $this->initVar('defaultyn', XOBJ_DTYPE_INT, 0, true, 2); |
|
| 63 | - $this->initVar('created', XOBJ_DTYPE_INT, 0, true, 10); |
|
| 64 | - $this->initVar('seq', XOBJ_DTYPE_INT, 0, true, 5); |
|
| 65 | - $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
| 66 | - $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2); |
|
| 67 | - $this->initVar('custom', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
| 68 | - $this->initVar('icons', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
| 69 | - } |
|
| 47 | + /** |
|
| 48 | + * efqSubscriptionOffer::efqSubscriptionOffer() |
|
| 49 | + * |
|
| 50 | + * @param bool $offer |
|
| 51 | + * @internal param bool $itemtype |
|
| 52 | + */ |
|
| 53 | + public function __construct($offer = false) |
|
| 54 | + { |
|
| 55 | + global $moddir; |
|
| 56 | + $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 57 | + $this->initVar('dtypeid', XOBJ_DTYPE_INT, 0, false); |
|
| 58 | + $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, true, 255); |
|
| 59 | + $this->initVar('section', XOBJ_DTYPE_INT, 0, false); |
|
| 60 | + $this->initVar('fieldtypeid', XOBJ_DTYPE_INT, 0, false); |
|
| 61 | + $this->initVar('uid', XOBJ_DTYPE_INT, 0, true, 5); |
|
| 62 | + $this->initVar('defaultyn', XOBJ_DTYPE_INT, 0, true, 2); |
|
| 63 | + $this->initVar('created', XOBJ_DTYPE_INT, 0, true, 10); |
|
| 64 | + $this->initVar('seq', XOBJ_DTYPE_INT, 0, true, 5); |
|
| 65 | + $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
| 66 | + $this->initVar('activeyn', XOBJ_DTYPE_INT, 0, true, 2); |
|
| 67 | + $this->initVar('custom', XOBJ_DTYPE_TXTBOX, null, false, 10); |
|
| 68 | + $this->initVar('icons', XOBJ_DTYPE_TXTBOX, null, false, 50); |
|
| 69 | + } |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | /** |
@@ -81,174 +81,174 @@ discard block |
||
| 81 | 81 | class efqDataTypeHandler extends XoopsObjectHandler |
| 82 | 82 | { |
| 83 | 83 | // public $db; //Database reference |
| 84 | - public $objDataType; // reference to object |
|
| 84 | + public $objDataType; // reference to object |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * efqSubscriptionOfferHandler::efqItemTypeHandler() |
|
| 88 | - * |
|
| 89 | - * @param bool $obj |
|
| 90 | - */ |
|
| 91 | - public function __construct($obj = false) |
|
| 92 | - { |
|
| 93 | - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 94 | - $this->objDataType = $obj; |
|
| 95 | - } |
|
| 86 | + /** |
|
| 87 | + * efqSubscriptionOfferHandler::efqItemTypeHandler() |
|
| 88 | + * |
|
| 89 | + * @param bool $obj |
|
| 90 | + */ |
|
| 91 | + public function __construct($obj = false) |
|
| 92 | + { |
|
| 93 | + $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 94 | + $this->objDataType = $obj; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Function insertOffer inserts record into DB |
|
| 99 | - * @author EFQ Consultancy <[email protected]> |
|
| 100 | - * @copyright EFQ Consultancy (c) 2008 |
|
| 101 | - * @version 1.0.0 |
|
| 102 | - * |
|
| 103 | - * @param efqDataType $obj object |
|
| 104 | - * |
|
| 105 | - * @param bool $forceQuery |
|
| 106 | - * @return bool true if insertion is succesful, false if unsuccesful |
|
| 107 | - */ |
|
| 108 | - public function insertDataType($obj, $forceQuery = false) |
|
| 109 | - { |
|
| 110 | - $tablename = 'efqdiralpha1_dtypes'; |
|
| 111 | - $keyName = 'dtypeid'; |
|
| 112 | - $excludedVars = array(); |
|
| 113 | - if ($obj instanceof efqDataType) { |
|
| 114 | - // Variable part of this function ends. From this line you can copy |
|
| 115 | - // this function for similar object handling functions. |
|
| 116 | - $obj->cleanVars(); |
|
| 117 | - $cleanvars = $obj->cleanVars; |
|
| 118 | - } else { |
|
| 119 | - return false; |
|
| 120 | - } |
|
| 121 | - $countVars = count($cleanvars); |
|
| 122 | - $i = 1; |
|
| 123 | - $strFields = ''; |
|
| 124 | - $strValues = ''; |
|
| 125 | - foreach ($cleanvars as $k => $v) { |
|
| 126 | - if (!in_array($k, $excludedVars)) { |
|
| 127 | - $strFields .= $k; |
|
| 128 | - $strValues .= "'" . $v . "'"; |
|
| 129 | - if ($i < $countVars) { |
|
| 130 | - $strFields .= ', '; |
|
| 131 | - $strValues .= ', '; |
|
| 132 | - } |
|
| 133 | - $i++; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues); |
|
| 137 | - if ($forceQuery) { |
|
| 138 | - if ($this->db->queryF($sql)) { |
|
| 139 | - $itemid = $this->db->getInsertId(); |
|
| 140 | - $obj->setVar($keyName, $itemid); |
|
| 97 | + /** |
|
| 98 | + * Function insertOffer inserts record into DB |
|
| 99 | + * @author EFQ Consultancy <[email protected]> |
|
| 100 | + * @copyright EFQ Consultancy (c) 2008 |
|
| 101 | + * @version 1.0.0 |
|
| 102 | + * |
|
| 103 | + * @param efqDataType $obj object |
|
| 104 | + * |
|
| 105 | + * @param bool $forceQuery |
|
| 106 | + * @return bool true if insertion is succesful, false if unsuccesful |
|
| 107 | + */ |
|
| 108 | + public function insertDataType($obj, $forceQuery = false) |
|
| 109 | + { |
|
| 110 | + $tablename = 'efqdiralpha1_dtypes'; |
|
| 111 | + $keyName = 'dtypeid'; |
|
| 112 | + $excludedVars = array(); |
|
| 113 | + if ($obj instanceof efqDataType) { |
|
| 114 | + // Variable part of this function ends. From this line you can copy |
|
| 115 | + // this function for similar object handling functions. |
|
| 116 | + $obj->cleanVars(); |
|
| 117 | + $cleanvars = $obj->cleanVars; |
|
| 118 | + } else { |
|
| 119 | + return false; |
|
| 120 | + } |
|
| 121 | + $countVars = count($cleanvars); |
|
| 122 | + $i = 1; |
|
| 123 | + $strFields = ''; |
|
| 124 | + $strValues = ''; |
|
| 125 | + foreach ($cleanvars as $k => $v) { |
|
| 126 | + if (!in_array($k, $excludedVars)) { |
|
| 127 | + $strFields .= $k; |
|
| 128 | + $strValues .= "'" . $v . "'"; |
|
| 129 | + if ($i < $countVars) { |
|
| 130 | + $strFields .= ', '; |
|
| 131 | + $strValues .= ', '; |
|
| 132 | + } |
|
| 133 | + $i++; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + $sql = sprintf('INSERT INTO %s (%s) VALUES (%s)', $this->db->prefix($tablename), $strFields, $strValues); |
|
| 137 | + if ($forceQuery) { |
|
| 138 | + if ($this->db->queryF($sql)) { |
|
| 139 | + $itemid = $this->db->getInsertId(); |
|
| 140 | + $obj->setVar($keyName, $itemid); |
|
| 141 | 141 | |
| 142 | - return true; |
|
| 143 | - } |
|
| 144 | - } else { |
|
| 145 | - if ($this->db->query($sql)) { |
|
| 146 | - $itemid = $this->db->getInsertId(); |
|
| 147 | - $obj->setVar($keyName, $itemid); |
|
| 142 | + return true; |
|
| 143 | + } |
|
| 144 | + } else { |
|
| 145 | + if ($this->db->query($sql)) { |
|
| 146 | + $itemid = $this->db->getInsertId(); |
|
| 147 | + $obj->setVar($keyName, $itemid); |
|
| 148 | 148 | |
| 149 | - return true; |
|
| 150 | - } |
|
| 151 | - } |
|
| 149 | + return true; |
|
| 150 | + } |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - return false; |
|
| 154 | - } |
|
| 153 | + return false; |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Function updateOffer updates subscription offer |
|
| 158 | - * @author EFQ Consultancy <[email protected]> |
|
| 159 | - * @copyright EFQ Consultancy (c) 2008 |
|
| 160 | - * @version 1.0.0 |
|
| 161 | - * |
|
| 162 | - * @param $obj |
|
| 163 | - * @param bool $forceQuery |
|
| 164 | - * @return bool true if update is succesful, false if unsuccesful |
|
| 165 | - * @internal param $object |
|
| 166 | - * |
|
| 167 | - */ |
|
| 168 | - public function updateDataType($obj, $forceQuery = false) |
|
| 169 | - { |
|
| 170 | - $tablename = 'efqdiralpha1_dtypes'; |
|
| 171 | - $keyName = 'dtypeid'; |
|
| 172 | - $excludedVars = array(); |
|
| 173 | - if ($obj instanceof efqDataType) { |
|
| 174 | - // Variable part of this function ends. From this line you can copy |
|
| 175 | - // this function for similar object handling functions. |
|
| 176 | - $obj->cleanVars(); |
|
| 177 | - $cleanvars = $obj->cleanVars; |
|
| 178 | - $keyValue = $obj->getVar($keyName); |
|
| 179 | - } else { |
|
| 180 | - return false; |
|
| 181 | - } |
|
| 182 | - $countVars = count($cleanvars); |
|
| 183 | - $i = 1; |
|
| 184 | - $strSet = ''; |
|
| 185 | - $strValues = ''; |
|
| 186 | - foreach ($cleanvars as $k => $v) { |
|
| 187 | - if (!in_array($k, $excludedVars)) { |
|
| 188 | - if ($i < $countVars and $i > 1) { |
|
| 189 | - $strSet .= ', '; |
|
| 190 | - } |
|
| 191 | - $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 192 | - } |
|
| 193 | - $i++; |
|
| 194 | - } |
|
| 195 | - $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 196 | - if ($forceQuery) { |
|
| 197 | - if ($this->db->queryF($sql)) { |
|
| 198 | - return true; |
|
| 199 | - } |
|
| 200 | - } else { |
|
| 201 | - if ($this->db->query($sql)) { |
|
| 202 | - return true; |
|
| 203 | - } |
|
| 204 | - } |
|
| 156 | + /** |
|
| 157 | + * Function updateOffer updates subscription offer |
|
| 158 | + * @author EFQ Consultancy <[email protected]> |
|
| 159 | + * @copyright EFQ Consultancy (c) 2008 |
|
| 160 | + * @version 1.0.0 |
|
| 161 | + * |
|
| 162 | + * @param $obj |
|
| 163 | + * @param bool $forceQuery |
|
| 164 | + * @return bool true if update is succesful, false if unsuccesful |
|
| 165 | + * @internal param $object |
|
| 166 | + * |
|
| 167 | + */ |
|
| 168 | + public function updateDataType($obj, $forceQuery = false) |
|
| 169 | + { |
|
| 170 | + $tablename = 'efqdiralpha1_dtypes'; |
|
| 171 | + $keyName = 'dtypeid'; |
|
| 172 | + $excludedVars = array(); |
|
| 173 | + if ($obj instanceof efqDataType) { |
|
| 174 | + // Variable part of this function ends. From this line you can copy |
|
| 175 | + // this function for similar object handling functions. |
|
| 176 | + $obj->cleanVars(); |
|
| 177 | + $cleanvars = $obj->cleanVars; |
|
| 178 | + $keyValue = $obj->getVar($keyName); |
|
| 179 | + } else { |
|
| 180 | + return false; |
|
| 181 | + } |
|
| 182 | + $countVars = count($cleanvars); |
|
| 183 | + $i = 1; |
|
| 184 | + $strSet = ''; |
|
| 185 | + $strValues = ''; |
|
| 186 | + foreach ($cleanvars as $k => $v) { |
|
| 187 | + if (!in_array($k, $excludedVars)) { |
|
| 188 | + if ($i < $countVars and $i > 1) { |
|
| 189 | + $strSet .= ', '; |
|
| 190 | + } |
|
| 191 | + $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 192 | + } |
|
| 193 | + $i++; |
|
| 194 | + } |
|
| 195 | + $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 196 | + if ($forceQuery) { |
|
| 197 | + if ($this->db->queryF($sql)) { |
|
| 198 | + return true; |
|
| 199 | + } |
|
| 200 | + } else { |
|
| 201 | + if ($this->db->query($sql)) { |
|
| 202 | + return true; |
|
| 203 | + } |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - return false; |
|
| 207 | - } |
|
| 206 | + return false; |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * function setDataType() |
|
| 211 | - * |
|
| 212 | - * Sets the object created by class efqDataType with data from query |
|
| 213 | - * |
|
| 214 | - * @param int $gpc_dtypeid |
|
| 215 | - * @return bool true or false |
|
| 216 | - */ |
|
| 217 | - public function setDataType($gpc_dtypeid = 0) |
|
| 218 | - { |
|
| 219 | - $sql = 'SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=' . (int)$gpc_dtypeid; |
|
| 220 | - $result = $this->db->query($sql); |
|
| 221 | - $numrows = $this->db->getRowsNum($result); |
|
| 222 | - if ($numrows > 0) { |
|
| 223 | - while (list($dtypeid, $title, $section, $fieldtypeid, $uid, $defaultyn, $activeyn, $options, $custom, $icon) = $this->db->fetchRow($result)) { |
|
| 224 | - if (!$this->objDataType) { |
|
| 225 | - $this->objDataType = new efqDataType(); |
|
| 226 | - } |
|
| 227 | - $this->objDataType->setVar('dtypeid', $dtypeid); |
|
| 228 | - $this->objDataType->setVar('title', $title); |
|
| 229 | - $this->objDataType->setVar('section', $section); |
|
| 230 | - $this->objDataType->setVar('fieldtypeid', $fieldtypeid); |
|
| 231 | - $this->objDataType->setVar('uid', $uid); |
|
| 232 | - $this->objDataType->setVar('defaultyn', $defaultyn); |
|
| 233 | - $this->objDataType->setVar('created', $created); |
|
| 234 | - $this->objDataType->setVar('seq', $seq); |
|
| 235 | - $this->objDataType->setVar('options', $options); |
|
| 236 | - $this->objDataType->setVar('activeyn', $activeyn); |
|
| 237 | - $this->objDataType->setVar('custom', $custom); |
|
| 238 | - $this->objDataType->setVar('icon', $icon); |
|
| 239 | - } |
|
| 240 | - } else { |
|
| 241 | - return false; |
|
| 242 | - } |
|
| 209 | + /** |
|
| 210 | + * function setDataType() |
|
| 211 | + * |
|
| 212 | + * Sets the object created by class efqDataType with data from query |
|
| 213 | + * |
|
| 214 | + * @param int $gpc_dtypeid |
|
| 215 | + * @return bool true or false |
|
| 216 | + */ |
|
| 217 | + public function setDataType($gpc_dtypeid = 0) |
|
| 218 | + { |
|
| 219 | + $sql = 'SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=' . (int)$gpc_dtypeid; |
|
| 220 | + $result = $this->db->query($sql); |
|
| 221 | + $numrows = $this->db->getRowsNum($result); |
|
| 222 | + if ($numrows > 0) { |
|
| 223 | + while (list($dtypeid, $title, $section, $fieldtypeid, $uid, $defaultyn, $activeyn, $options, $custom, $icon) = $this->db->fetchRow($result)) { |
|
| 224 | + if (!$this->objDataType) { |
|
| 225 | + $this->objDataType = new efqDataType(); |
|
| 226 | + } |
|
| 227 | + $this->objDataType->setVar('dtypeid', $dtypeid); |
|
| 228 | + $this->objDataType->setVar('title', $title); |
|
| 229 | + $this->objDataType->setVar('section', $section); |
|
| 230 | + $this->objDataType->setVar('fieldtypeid', $fieldtypeid); |
|
| 231 | + $this->objDataType->setVar('uid', $uid); |
|
| 232 | + $this->objDataType->setVar('defaultyn', $defaultyn); |
|
| 233 | + $this->objDataType->setVar('created', $created); |
|
| 234 | + $this->objDataType->setVar('seq', $seq); |
|
| 235 | + $this->objDataType->setVar('options', $options); |
|
| 236 | + $this->objDataType->setVar('activeyn', $activeyn); |
|
| 237 | + $this->objDataType->setVar('custom', $custom); |
|
| 238 | + $this->objDataType->setVar('icon', $icon); |
|
| 239 | + } |
|
| 240 | + } else { |
|
| 241 | + return false; |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - return true; |
|
| 245 | - } |
|
| 244 | + return true; |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - /** |
|
| 248 | - * @return bool |
|
| 249 | - */ |
|
| 250 | - public function getDataType() |
|
| 251 | - { |
|
| 252 | - return $this->objDataType; |
|
| 253 | - } |
|
| 247 | + /** |
|
| 248 | + * @return bool |
|
| 249 | + */ |
|
| 250 | + public function getDataType() |
|
| 251 | + { |
|
| 252 | + return $this->objDataType; |
|
| 253 | + } |
|
| 254 | 254 | } |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | foreach ($cleanvars as $k => $v) { |
| 126 | 126 | if (!in_array($k, $excludedVars)) { |
| 127 | 127 | $strFields .= $k; |
| 128 | - $strValues .= "'" . $v . "'"; |
|
| 128 | + $strValues .= "'".$v."'"; |
|
| 129 | 129 | if ($i < $countVars) { |
| 130 | 130 | $strFields .= ', '; |
| 131 | 131 | $strValues .= ', '; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | if ($i < $countVars and $i > 1) { |
| 189 | 189 | $strSet .= ', '; |
| 190 | 190 | } |
| 191 | - $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 191 | + $strSet .= $k.'='."'".$v."'"; |
|
| 192 | 192 | } |
| 193 | 193 | $i++; |
| 194 | 194 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | public function setDataType($gpc_dtypeid = 0) |
| 218 | 218 | { |
| 219 | - $sql = 'SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid=' . (int)$gpc_dtypeid; |
|
| 219 | + $sql = 'SELECT dtypeid,title,section,fieldtypeid,uid,defaultyn,created,seq,activeyn,options,custom,icon WHERE dtypeid='.(int) $gpc_dtypeid; |
|
| 220 | 220 | $result = $this->db->query($sql); |
| 221 | 221 | $numrows = $this->db->getRowsNum($result); |
| 222 | 222 | if ($numrows > 0) { |
@@ -36,21 +36,21 @@ discard block |
||
| 36 | 36 | include XOOPS_ROOT_PATH . '/header.php'; |
| 37 | 37 | |
| 38 | 38 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
| 39 | - $isadmin = true; |
|
| 39 | + $isadmin = true; |
|
| 40 | 40 | } else { |
| 41 | - $isadmin = false; |
|
| 41 | + $isadmin = false; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (isset($_GET['catid'])) { |
| 45 | - $get_catid = (int)$_GET['catid']; |
|
| 45 | + $get_catid = (int)$_GET['catid']; |
|
| 46 | 46 | } else { |
| 47 | - $get_catid = 0; |
|
| 47 | + $get_catid = 0; |
|
| 48 | 48 | } |
| 49 | 49 | if (!empty($_GET['item'])) { |
| 50 | - $get_itemid = (int)$_GET['item']; |
|
| 50 | + $get_itemid = (int)$_GET['item']; |
|
| 51 | 51 | } else { |
| 52 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 53 | - exit(); |
|
| 52 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 53 | + exit(); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $moddir = $xoopsModule->getVar('dirname'); |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 61 | 61 | if ($isadmin) { |
| 62 | - $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon2.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
|
| 62 | + $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon2.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
|
| 63 | 63 | } else { |
| 64 | - $adminlink = ''; |
|
| 64 | + $adminlink = ''; |
|
| 65 | 65 | } |
| 66 | 66 | $xoopsTpl->assign('adminlink', $adminlink); |
| 67 | 67 | |
@@ -77,28 +77,28 @@ discard block |
||
| 77 | 77 | $editlink = '<a href="edit.php?item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-edit.gif" alt="' . _MD_EDIT_LISTING . '" title="' . _MD_EDIT_LISTING . '"></a>'; |
| 78 | 78 | |
| 79 | 79 | if (isset($xoopsUser) && $xoopsUser != null) { |
| 80 | - if ($xoopsUser->getVar('uid') == $listing->getVar('uid')) { |
|
| 81 | - $islistingowner = true; |
|
| 82 | - $xoopsTpl->assign('listingowner', '1'); |
|
| 83 | - if ($listing->getVar('status') == '2' and $xoopsModuleConfig['autoapprove'] == 1) { |
|
| 84 | - $editrights = '1'; |
|
| 85 | - } else { |
|
| 86 | - $editrights = '0'; |
|
| 87 | - } |
|
| 88 | - } else { |
|
| 89 | - $editrights = '0'; |
|
| 90 | - } |
|
| 80 | + if ($xoopsUser->getVar('uid') == $listing->getVar('uid')) { |
|
| 81 | + $islistingowner = true; |
|
| 82 | + $xoopsTpl->assign('listingowner', '1'); |
|
| 83 | + if ($listing->getVar('status') == '2' and $xoopsModuleConfig['autoapprove'] == 1) { |
|
| 84 | + $editrights = '1'; |
|
| 85 | + } else { |
|
| 86 | + $editrights = '0'; |
|
| 87 | + } |
|
| 88 | + } else { |
|
| 89 | + $editrights = '0'; |
|
| 90 | + } |
|
| 91 | 91 | } |
| 92 | 92 | if (!$islistingowner and !$isadmin) { |
| 93 | - $listinghandler->incrementHits($get_itemid); |
|
| 93 | + $listinghandler->incrementHits($get_itemid); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $type = getTypeFromId($listing->getVar('typeid')); |
| 97 | 97 | $template = getTemplateFromCatid($get_catid); |
| 98 | 98 | if ($listing->getVar('logourl') !== '') { |
| 99 | - $logourl = '<img src="' . XOOPS_URL . '/modules/' . $moddir . '/uploads/' . $listing->getVar('logourl') . '">'; |
|
| 99 | + $logourl = '<img src="' . XOOPS_URL . '/modules/' . $moddir . '/uploads/' . $listing->getVar('logourl') . '">'; |
|
| 100 | 100 | } else { |
| 101 | - $logourl = ''; |
|
| 101 | + $logourl = ''; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $myts = MyTextSanitizer::getInstance(); |
@@ -126,25 +126,25 @@ discard block |
||
| 126 | 126 | $listing->setDataTypes($listinghandler->getDataTypes($get_itemid)); |
| 127 | 127 | |
| 128 | 128 | if (count($listing->_datatypes) > 0) { |
| 129 | - xoops_debug('o, o'); |
|
| 130 | - $xoopsTpl->assign('datatypes', true); |
|
| 131 | - foreach ($listing->_datatypes as $datatype) { |
|
| 132 | - $xoopsTpl->append('section' . $datatype['section'] . '', array('icon' => $datatype['icon'], 'label' => $datatype['title'], 'value' => $datatype['value'], 'fieldtype' => $datatype['fieldtype'])); |
|
| 133 | - } |
|
| 129 | + xoops_debug('o, o'); |
|
| 130 | + $xoopsTpl->assign('datatypes', true); |
|
| 131 | + foreach ($listing->_datatypes as $datatype) { |
|
| 132 | + $xoopsTpl->append('section' . $datatype['section'] . '', array('icon' => $datatype['icon'], 'label' => $datatype['title'], 'value' => $datatype['value'], 'fieldtype' => $datatype['fieldtype'])); |
|
| 133 | + } |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | if ($xoopsModuleConfig['allowcoupons'] == '0') { |
| 137 | - $xoopsTpl->assign('couponsallowed', '0'); |
|
| 137 | + $xoopsTpl->assign('couponsallowed', '0'); |
|
| 138 | 138 | } else { |
| 139 | - $xoopsTpl->assign('couponsallowed', '1'); |
|
| 140 | - $xoopsTpl->assign('lang_addcoupon', _MD_ADDCOUPON); |
|
| 141 | - $xoopsTpl->assign('coupons', $coupon->getCountByLink($get_itemid)); |
|
| 139 | + $xoopsTpl->assign('couponsallowed', '1'); |
|
| 140 | + $xoopsTpl->assign('lang_addcoupon', _MD_ADDCOUPON); |
|
| 141 | + $xoopsTpl->assign('coupons', $coupon->getCountByLink($get_itemid)); |
|
| 142 | 142 | } |
| 143 | 143 | if ($xoopsModuleConfig['allowsubscr'] == '0') { |
| 144 | - $xoopsTpl->assign('subscrallowed', '0'); |
|
| 144 | + $xoopsTpl->assign('subscrallowed', '0'); |
|
| 145 | 145 | } else { |
| 146 | - $xoopsTpl->assign('subscrallowed', '1'); |
|
| 147 | - $xoopsTpl->assign('lang_viewsubscription', _MD_VIEWSUBSCRIPTIONS); |
|
| 146 | + $xoopsTpl->assign('subscrallowed', '1'); |
|
| 147 | + $xoopsTpl->assign('lang_viewsubscription', _MD_VIEWSUBSCRIPTIONS); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -18,22 +18,22 @@ 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'; |
|
| 27 | -require_once __DIR__ . '/class/class.listing.php'; |
|
| 28 | -require_once __DIR__ . '/class/class.datafieldmanager.php'; |
|
| 29 | -require_once __DIR__ . '/class/class.couponhandler.php'; |
|
| 30 | - |
|
| 31 | -$mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 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 | +require_once __DIR__.'/class/class.listing.php'; |
|
| 28 | +require_once __DIR__.'/class/class.datafieldmanager.php'; |
|
| 29 | +require_once __DIR__.'/class/class.couponhandler.php'; |
|
| 30 | + |
|
| 31 | +$mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 32 | 32 | $datafieldmanager = new efqDataFieldManager(); |
| 33 | 33 | $eh = new ErrorHandler; |
| 34 | 34 | |
| 35 | 35 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_listing.tpl'; |
| 36 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
| 36 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
| 37 | 37 | |
| 38 | 38 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
| 39 | 39 | $isadmin = true; |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (isset($_GET['catid'])) { |
| 45 | - $get_catid = (int)$_GET['catid']; |
|
| 45 | + $get_catid = (int) $_GET['catid']; |
|
| 46 | 46 | } else { |
| 47 | 47 | $get_catid = 0; |
| 48 | 48 | } |
| 49 | 49 | if (!empty($_GET['item'])) { |
| 50 | - $get_itemid = (int)$_GET['item']; |
|
| 50 | + $get_itemid = (int) $_GET['item']; |
|
| 51 | 51 | } else { |
| 52 | 52 | redirect_header('index.php', 2, _MD_NOVALIDITEM); |
| 53 | 53 | exit(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 61 | 61 | if ($isadmin) { |
| 62 | - $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon2.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
|
| 62 | + $adminlink = '<a href="'.XOOPS_URL.'/modules/'.$moddir.'/admin/index.php?op=edit&item='.$get_itemid.'"><img src="'.XOOPS_URL.'/modules/'.$moddir.'/assets/images/editicon2.gif" border="0" alt="'._MD_EDITTHISLISTING.'"></a>'; |
|
| 63 | 63 | } else { |
| 64 | 64 | $adminlink = ''; |
| 65 | 65 | } |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $listing->setVars($listinghandler->getListing($get_itemid)); |
| 73 | 73 | |
| 74 | -$pathstring = "<a href='index.php?dirid=" . $dirid . '\'>' . _MD_MAIN . '</a> : '; |
|
| 75 | -$pathstring .= $mytree->getNicePathFromId($get_catid, 'title', 'index.php?dirid=' . $dirid . ''); |
|
| 74 | +$pathstring = "<a href='index.php?dirid=".$dirid.'\'>'._MD_MAIN.'</a> : '; |
|
| 75 | +$pathstring .= $mytree->getNicePathFromId($get_catid, 'title', 'index.php?dirid='.$dirid.''); |
|
| 76 | 76 | |
| 77 | -$editlink = '<a href="edit.php?item=' . $get_itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-edit.gif" alt="' . _MD_EDIT_LISTING . '" title="' . _MD_EDIT_LISTING . '"></a>'; |
|
| 77 | +$editlink = '<a href="edit.php?item='.$get_itemid.'"><img src="'.XOOPS_URL.'/modules/'.$moddir.'/assets/images/'.$xoopsConfig['language'].'/listing-edit.gif" alt="'._MD_EDIT_LISTING.'" title="'._MD_EDIT_LISTING.'"></a>'; |
|
| 78 | 78 | |
| 79 | 79 | if (isset($xoopsUser) && $xoopsUser != null) { |
| 80 | 80 | if ($xoopsUser->getVar('uid') == $listing->getVar('uid')) { |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $type = getTypeFromId($listing->getVar('typeid')); |
| 97 | 97 | $template = getTemplateFromCatid($get_catid); |
| 98 | 98 | if ($listing->getVar('logourl') !== '') { |
| 99 | - $logourl = '<img src="' . XOOPS_URL . '/modules/' . $moddir . '/uploads/' . $listing->getVar('logourl') . '">'; |
|
| 99 | + $logourl = '<img src="'.XOOPS_URL.'/modules/'.$moddir.'/uploads/'.$listing->getVar('logourl').'">'; |
|
| 100 | 100 | } else { |
| 101 | 101 | $logourl = ''; |
| 102 | 102 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | xoops_debug('o, o'); |
| 130 | 130 | $xoopsTpl->assign('datatypes', true); |
| 131 | 131 | foreach ($listing->_datatypes as $datatype) { |
| 132 | - $xoopsTpl->append('section' . $datatype['section'] . '', array('icon' => $datatype['icon'], 'label' => $datatype['title'], 'value' => $datatype['value'], 'fieldtype' => $datatype['fieldtype'])); |
|
| 132 | + $xoopsTpl->append('section'.$datatype['section'].'', array('icon' => $datatype['icon'], 'label' => $datatype['title'], 'value' => $datatype['value'], 'fieldtype' => $datatype['fieldtype'])); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -147,4 +147,4 @@ discard block |
||
| 147 | 147 | $xoopsTpl->assign('lang_viewsubscription', _MD_VIEWSUBSCRIPTIONS); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 150 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | <form method="post" name="paypal_form" action="<?= $paypal['url'] ?>"> |
| 27 | 27 | |
| 28 | 28 | <?php |
| 29 | - //show paypal hidden variables |
|
| 29 | + //show paypal hidden variables |
|
| 30 | 30 | |
| 31 | - showVariables(); |
|
| 31 | + showVariables(); |
|
| 32 | 32 | |
| 33 | - ?> |
|
| 33 | + ?> |
|
| 34 | 34 | |
| 35 | 35 | <div style="text-align: center;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: 333333; ">Processing Transaction . . . </span></div> |
| 36 | 36 | |
@@ -13,10 +13,10 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | //Configuration File |
| 16 | -require_once __DIR__ . '/../paypal_includes/config.inc.php'; |
|
| 16 | +require_once __DIR__.'/../paypal_includes/config.inc.php'; |
|
| 17 | 17 | |
| 18 | 18 | //Global Configuration File |
| 19 | -require_once __DIR__ . '/../paypal_includes/global_config.inc.php'; |
|
| 19 | +require_once __DIR__.'/../paypal_includes/global_config.inc.php'; |
|
| 20 | 20 | |
| 21 | 21 | ?> |
| 22 | 22 | |
@@ -36,24 +36,24 @@ discard block |
||
| 36 | 36 | $moddir = $xoopsModule->getVar('dirname'); |
| 37 | 37 | |
| 38 | 38 | if (isset($_GET['catid'])) { |
| 39 | - $get_cid = (int)$_GET['cid']; |
|
| 39 | + $get_cid = (int)$_GET['cid']; |
|
| 40 | 40 | } else { |
| 41 | - $get_cid = '1'; |
|
| 41 | + $get_cid = '1'; |
|
| 42 | 42 | } |
| 43 | 43 | if (isset($_GET['dirid'])) { |
| 44 | - $get_dirid = (int)$_GET['dirid']; |
|
| 44 | + $get_dirid = (int)$_GET['dirid']; |
|
| 45 | 45 | } elseif (isset($_POST['dirid'])) { |
| 46 | - $get_dirid = (int)$_POST['dirid']; |
|
| 46 | + $get_dirid = (int)$_POST['dirid']; |
|
| 47 | 47 | } |
| 48 | 48 | if (isset($_GET['orderby'])) { |
| 49 | - $orderby = convertOrderByIn($_GET['orderby']); |
|
| 49 | + $orderby = convertOrderByIn($_GET['orderby']); |
|
| 50 | 50 | } else { |
| 51 | - $orderby = 'title ASC'; |
|
| 51 | + $orderby = 'title ASC'; |
|
| 52 | 52 | } |
| 53 | 53 | if (isset($_GET['page'])) { |
| 54 | - $get_page = (int)$_GET['page']; |
|
| 54 | + $get_page = (int)$_GET['page']; |
|
| 55 | 55 | } else { |
| 56 | - $get_page = 1; |
|
| 56 | + $get_page = 1; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_search.tpl'; |
@@ -62,280 +62,280 @@ discard block |
||
| 62 | 62 | //The advanced search is within a directory |
| 63 | 63 | //First get an array of all datatypes within a directory that has listings linked to them |
| 64 | 64 | if (isset($_POST['submit'])) { |
| 65 | - $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 66 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 67 | - . ' ft, ' |
|
| 68 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 69 | - . ' dt, ' |
|
| 70 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') |
|
| 71 | - . '_dtypes_x_cat') |
|
| 72 | - . ' dxc, ' |
|
| 73 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 74 | - . " c WHERE c.cid=dxc.cid AND dt.dtypeid=dxc.dtypeid AND dt.fieldtypeid=ft.typeid AND c.dirid='$get_dirid' AND dt.activeyn='1'"; |
|
| 75 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 76 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 77 | - $filter_arr = array(); |
|
| 78 | - while (list($dtypeid, $dtypetitle, $dtypeoptions, $fieldtype) = $xoopsDB->fetchRow($result)) { |
|
| 79 | - switch ($fieldtype) { |
|
| 80 | - case 'textbox': |
|
| 81 | - $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 82 | - break; |
|
| 83 | - case 'textarea': |
|
| 84 | - $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 85 | - break; |
|
| 86 | - case 'yesno': |
|
| 87 | - $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 88 | - break; |
|
| 89 | - case 'radio': |
|
| 90 | - $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 91 | - break; |
|
| 92 | - case 'select': |
|
| 93 | - $selectarr = getPostedValue_array($dtypeid); |
|
| 94 | - $count_arr = count($selectarr); |
|
| 95 | - |
|
| 96 | - if ($count_arr >= 1) { |
|
| 97 | - foreach ($selectarr as $arr) { |
|
| 98 | - $selectarray[] = $arr['postvalue']; |
|
| 99 | - } |
|
| 100 | - $filter_arr[] = array('dtypeid' => $dtypeid, 'constr' => 'equal', 'postvalue' => $selectarr['postvalue'], 'selectfields' => $selectarray, 'addressfields' => 0); |
|
| 101 | - } |
|
| 102 | - break; |
|
| 103 | - case 'dhtml': |
|
| 104 | - $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 105 | - break; |
|
| 106 | - case 'address': |
|
| 107 | - $addressarr = getPostedValue_address($dtypeid); |
|
| 108 | - $addressarray = array(); |
|
| 109 | - //$countarr = count($address |
|
| 110 | - if (is_array($addressarray) && count($addressarray) >= 1) { |
|
| 111 | - foreach ($addressarr as $arr) { |
|
| 112 | - $addressarray[] = array($arr['field'] => $arr['postvalue']); |
|
| 113 | - } |
|
| 114 | - $filter_arr[] = array('dtypeid' => $dtypeid, 'constr' => 'equal', 'postvalue' => $arr['postvalue'], 'selectfields' => 0, 'addressfields' => $addressarray); |
|
| 115 | - } |
|
| 116 | - break; |
|
| 117 | - case 'rating': |
|
| 118 | - $selectarr = getPostedValue_array($dtypeid); |
|
| 119 | - //$selectarr = getPostedValue_text($dtypeid); |
|
| 120 | - $count_arr = count($selectarr); |
|
| 121 | - |
|
| 122 | - if ($count_arr >= 1) { |
|
| 123 | - foreach ($selectarr as $arr) { |
|
| 124 | - $selectarray[] = $arr; |
|
| 125 | - } |
|
| 126 | - //echo $selectarr['postvalue']; |
|
| 127 | - $filter_arr[] = array('dtypeid' => $dtypeid, 'constr' => $selectarr['constr'], 'postvalue' => $selectarr['postvalue'], 'selectfields' => '', 'addressfields' => 0); |
|
| 128 | - } |
|
| 129 | - break; |
|
| 130 | - case 'date': |
|
| 131 | - $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 132 | - break; |
|
| 133 | - default: |
|
| 134 | - break; |
|
| 135 | - } |
|
| 136 | - } |
|
| 137 | - if (isset($_POST['q'])) { |
|
| 138 | - $querystring = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_POST['q'])); |
|
| 139 | - } else { |
|
| 140 | - $querystring = ''; |
|
| 141 | - } |
|
| 142 | - $poscount = substr_count($querystring, '"') / 2; |
|
| 143 | - $specialarr = array(); |
|
| 144 | - for ($i = 0; $i < $poscount; ++$i) { |
|
| 145 | - $start = strpos($querystring, '"', 0); |
|
| 146 | - $end = strpos($querystring, '"', $start + 1); |
|
| 147 | - if ($end !== false) { |
|
| 148 | - $specialstring = ltrim(substr($querystring, $start, $end - $start), '"'); |
|
| 149 | - $specialarr[] = $specialstring; |
|
| 150 | - $querystring = ltrim(substr_replace($querystring, '', $start, $end - $start + 1)); |
|
| 151 | - } else { |
|
| 152 | - $querystring = ltrim(substr_replace($querystring, '', $start, 1)); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - $queryarr = explode(' ', $querystring); |
|
| 156 | - $queryarr = array_merge($specialarr, $queryarr); |
|
| 157 | - $emptyarr[] = ''; |
|
| 158 | - $querydiff = array_diff($queryarr, $emptyarr); |
|
| 159 | - |
|
| 160 | - $limit = $xoopsModuleConfig['searchresults_perpage']; |
|
| 161 | - $offset = ($get_page - 1) * $limit; |
|
| 162 | - |
|
| 163 | - $andor = 'AND'; |
|
| 164 | - $searchresults = mod_search($querydiff, $andor, $limit, $offset, $filter_arr); |
|
| 165 | - |
|
| 166 | - $maxpages = 10; |
|
| 167 | - $maxcount = 30; |
|
| 168 | - $count_results = count($searchresults); |
|
| 169 | - $count_pages = 0; |
|
| 170 | - |
|
| 171 | - $items_arr_text = ''; |
|
| 172 | - //Calculate the number of result pages. |
|
| 173 | - if ($count_results > $limit) { |
|
| 174 | - $count_pages = ceil($count_results / $limit); |
|
| 175 | - } else { |
|
| 176 | - $count_pages = 1; |
|
| 177 | - } |
|
| 178 | - $pages_text = sprintf(_MD_LISTINGS_FOUND_ADV, $count_results); |
|
| 179 | - |
|
| 180 | - if ($count_pages >= 2) { |
|
| 181 | - $searchnum = uniqid(mt_rand(), 1); |
|
| 182 | - $pages_text .= '' . _MD_PAGES . '<a href="advancedsearch.php?ref=' . $searchnum . '&page=1&dirid=' . $get_dirid . '">1</a>'; |
|
| 183 | - } |
|
| 184 | - for ($i = 1; $i < $count_pages; ++$i) { |
|
| 185 | - $page = $i + 1; |
|
| 186 | - $pages_text .= ' - <a href="advancedsearch.php?ref=' . $searchnum . '&page=' . $page . '&dirid=' . $get_dirid . '">' . $page . '</a>'; |
|
| 187 | - } |
|
| 188 | - $pages_text .= sprintf(_MD_NEW_SEARCH_ADV, $get_dirid); |
|
| 189 | - $pages_top_text = sprintf(_MD_PAGE_OF_PAGES, $get_page, $count_pages) . '<br><br>'; |
|
| 190 | - |
|
| 191 | - ob_start(); |
|
| 192 | - echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 193 | - echo $pages_top_text; |
|
| 194 | - if ($searchresults == 0) { |
|
| 195 | - echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 196 | - } else { |
|
| 197 | - $y = 0; |
|
| 198 | - $page = 1; |
|
| 199 | - foreach ($searchresults as $result) { |
|
| 200 | - if ($y < $limit && $page == 1) { |
|
| 201 | - echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 202 | - if ($y < $limit && $y > 0) { |
|
| 203 | - $items_arr_text .= ',' . $result['itemid'] . ''; |
|
| 204 | - } else { |
|
| 205 | - $items_arr_text = $result['itemid']; |
|
| 206 | - } |
|
| 207 | - ++$y; |
|
| 208 | - } elseif ($y < $limit && $y > 0) { |
|
| 209 | - $items_arr_text .= ',' . $result['itemid'] . ''; |
|
| 210 | - ++$y; |
|
| 211 | - } elseif ($y < $limit && $y == 0) { |
|
| 212 | - $items_arr_text = $result['itemid']; |
|
| 213 | - ++$y; |
|
| 214 | - } elseif ($y == $limit) { |
|
| 215 | - //Save $items_arr_text and $page into DB |
|
| 216 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . '_searchid_seq'); |
|
| 217 | - $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 218 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 219 | - if ($newid == 0) { |
|
| 220 | - $itemid = $xoopsDB->getInsertId(); |
|
| 221 | - } |
|
| 222 | - $items_arr_text = $result['itemid']; |
|
| 223 | - $y = 1; |
|
| 224 | - ++$page; |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - if ($y != 0 && $page > 1) { |
|
| 228 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . '_searchid_seq'); |
|
| 229 | - $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 230 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 231 | - if ($newid == 0) { |
|
| 232 | - $itemid = $xoopsDB->getInsertId(); |
|
| 233 | - } |
|
| 234 | - } |
|
| 235 | - } |
|
| 236 | - echo '<br>'; |
|
| 237 | - echo $pages_text; |
|
| 238 | - |
|
| 239 | - $xoopsTpl->assign('search_page', ob_get_contents()); |
|
| 240 | - ob_end_clean(); |
|
| 65 | + $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 66 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 67 | + . ' ft, ' |
|
| 68 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 69 | + . ' dt, ' |
|
| 70 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') |
|
| 71 | + . '_dtypes_x_cat') |
|
| 72 | + . ' dxc, ' |
|
| 73 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 74 | + . " c WHERE c.cid=dxc.cid AND dt.dtypeid=dxc.dtypeid AND dt.fieldtypeid=ft.typeid AND c.dirid='$get_dirid' AND dt.activeyn='1'"; |
|
| 75 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 76 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 77 | + $filter_arr = array(); |
|
| 78 | + while (list($dtypeid, $dtypetitle, $dtypeoptions, $fieldtype) = $xoopsDB->fetchRow($result)) { |
|
| 79 | + switch ($fieldtype) { |
|
| 80 | + case 'textbox': |
|
| 81 | + $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 82 | + break; |
|
| 83 | + case 'textarea': |
|
| 84 | + $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 85 | + break; |
|
| 86 | + case 'yesno': |
|
| 87 | + $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 88 | + break; |
|
| 89 | + case 'radio': |
|
| 90 | + $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 91 | + break; |
|
| 92 | + case 'select': |
|
| 93 | + $selectarr = getPostedValue_array($dtypeid); |
|
| 94 | + $count_arr = count($selectarr); |
|
| 95 | + |
|
| 96 | + if ($count_arr >= 1) { |
|
| 97 | + foreach ($selectarr as $arr) { |
|
| 98 | + $selectarray[] = $arr['postvalue']; |
|
| 99 | + } |
|
| 100 | + $filter_arr[] = array('dtypeid' => $dtypeid, 'constr' => 'equal', 'postvalue' => $selectarr['postvalue'], 'selectfields' => $selectarray, 'addressfields' => 0); |
|
| 101 | + } |
|
| 102 | + break; |
|
| 103 | + case 'dhtml': |
|
| 104 | + $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 105 | + break; |
|
| 106 | + case 'address': |
|
| 107 | + $addressarr = getPostedValue_address($dtypeid); |
|
| 108 | + $addressarray = array(); |
|
| 109 | + //$countarr = count($address |
|
| 110 | + if (is_array($addressarray) && count($addressarray) >= 1) { |
|
| 111 | + foreach ($addressarr as $arr) { |
|
| 112 | + $addressarray[] = array($arr['field'] => $arr['postvalue']); |
|
| 113 | + } |
|
| 114 | + $filter_arr[] = array('dtypeid' => $dtypeid, 'constr' => 'equal', 'postvalue' => $arr['postvalue'], 'selectfields' => 0, 'addressfields' => $addressarray); |
|
| 115 | + } |
|
| 116 | + break; |
|
| 117 | + case 'rating': |
|
| 118 | + $selectarr = getPostedValue_array($dtypeid); |
|
| 119 | + //$selectarr = getPostedValue_text($dtypeid); |
|
| 120 | + $count_arr = count($selectarr); |
|
| 121 | + |
|
| 122 | + if ($count_arr >= 1) { |
|
| 123 | + foreach ($selectarr as $arr) { |
|
| 124 | + $selectarray[] = $arr; |
|
| 125 | + } |
|
| 126 | + //echo $selectarr['postvalue']; |
|
| 127 | + $filter_arr[] = array('dtypeid' => $dtypeid, 'constr' => $selectarr['constr'], 'postvalue' => $selectarr['postvalue'], 'selectfields' => '', 'addressfields' => 0); |
|
| 128 | + } |
|
| 129 | + break; |
|
| 130 | + case 'date': |
|
| 131 | + $filter_arr[] = getPostedValue_text($dtypeid); |
|
| 132 | + break; |
|
| 133 | + default: |
|
| 134 | + break; |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | + if (isset($_POST['q'])) { |
|
| 138 | + $querystring = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_POST['q'])); |
|
| 139 | + } else { |
|
| 140 | + $querystring = ''; |
|
| 141 | + } |
|
| 142 | + $poscount = substr_count($querystring, '"') / 2; |
|
| 143 | + $specialarr = array(); |
|
| 144 | + for ($i = 0; $i < $poscount; ++$i) { |
|
| 145 | + $start = strpos($querystring, '"', 0); |
|
| 146 | + $end = strpos($querystring, '"', $start + 1); |
|
| 147 | + if ($end !== false) { |
|
| 148 | + $specialstring = ltrim(substr($querystring, $start, $end - $start), '"'); |
|
| 149 | + $specialarr[] = $specialstring; |
|
| 150 | + $querystring = ltrim(substr_replace($querystring, '', $start, $end - $start + 1)); |
|
| 151 | + } else { |
|
| 152 | + $querystring = ltrim(substr_replace($querystring, '', $start, 1)); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + $queryarr = explode(' ', $querystring); |
|
| 156 | + $queryarr = array_merge($specialarr, $queryarr); |
|
| 157 | + $emptyarr[] = ''; |
|
| 158 | + $querydiff = array_diff($queryarr, $emptyarr); |
|
| 159 | + |
|
| 160 | + $limit = $xoopsModuleConfig['searchresults_perpage']; |
|
| 161 | + $offset = ($get_page - 1) * $limit; |
|
| 162 | + |
|
| 163 | + $andor = 'AND'; |
|
| 164 | + $searchresults = mod_search($querydiff, $andor, $limit, $offset, $filter_arr); |
|
| 165 | + |
|
| 166 | + $maxpages = 10; |
|
| 167 | + $maxcount = 30; |
|
| 168 | + $count_results = count($searchresults); |
|
| 169 | + $count_pages = 0; |
|
| 170 | + |
|
| 171 | + $items_arr_text = ''; |
|
| 172 | + //Calculate the number of result pages. |
|
| 173 | + if ($count_results > $limit) { |
|
| 174 | + $count_pages = ceil($count_results / $limit); |
|
| 175 | + } else { |
|
| 176 | + $count_pages = 1; |
|
| 177 | + } |
|
| 178 | + $pages_text = sprintf(_MD_LISTINGS_FOUND_ADV, $count_results); |
|
| 179 | + |
|
| 180 | + if ($count_pages >= 2) { |
|
| 181 | + $searchnum = uniqid(mt_rand(), 1); |
|
| 182 | + $pages_text .= '' . _MD_PAGES . '<a href="advancedsearch.php?ref=' . $searchnum . '&page=1&dirid=' . $get_dirid . '">1</a>'; |
|
| 183 | + } |
|
| 184 | + for ($i = 1; $i < $count_pages; ++$i) { |
|
| 185 | + $page = $i + 1; |
|
| 186 | + $pages_text .= ' - <a href="advancedsearch.php?ref=' . $searchnum . '&page=' . $page . '&dirid=' . $get_dirid . '">' . $page . '</a>'; |
|
| 187 | + } |
|
| 188 | + $pages_text .= sprintf(_MD_NEW_SEARCH_ADV, $get_dirid); |
|
| 189 | + $pages_top_text = sprintf(_MD_PAGE_OF_PAGES, $get_page, $count_pages) . '<br><br>'; |
|
| 190 | + |
|
| 191 | + ob_start(); |
|
| 192 | + echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 193 | + echo $pages_top_text; |
|
| 194 | + if ($searchresults == 0) { |
|
| 195 | + echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 196 | + } else { |
|
| 197 | + $y = 0; |
|
| 198 | + $page = 1; |
|
| 199 | + foreach ($searchresults as $result) { |
|
| 200 | + if ($y < $limit && $page == 1) { |
|
| 201 | + echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 202 | + if ($y < $limit && $y > 0) { |
|
| 203 | + $items_arr_text .= ',' . $result['itemid'] . ''; |
|
| 204 | + } else { |
|
| 205 | + $items_arr_text = $result['itemid']; |
|
| 206 | + } |
|
| 207 | + ++$y; |
|
| 208 | + } elseif ($y < $limit && $y > 0) { |
|
| 209 | + $items_arr_text .= ',' . $result['itemid'] . ''; |
|
| 210 | + ++$y; |
|
| 211 | + } elseif ($y < $limit && $y == 0) { |
|
| 212 | + $items_arr_text = $result['itemid']; |
|
| 213 | + ++$y; |
|
| 214 | + } elseif ($y == $limit) { |
|
| 215 | + //Save $items_arr_text and $page into DB |
|
| 216 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . '_searchid_seq'); |
|
| 217 | + $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 218 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 219 | + if ($newid == 0) { |
|
| 220 | + $itemid = $xoopsDB->getInsertId(); |
|
| 221 | + } |
|
| 222 | + $items_arr_text = $result['itemid']; |
|
| 223 | + $y = 1; |
|
| 224 | + ++$page; |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + if ($y != 0 && $page > 1) { |
|
| 228 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . '_searchid_seq'); |
|
| 229 | + $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 230 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 231 | + if ($newid == 0) { |
|
| 232 | + $itemid = $xoopsDB->getInsertId(); |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + echo '<br>'; |
|
| 237 | + echo $pages_text; |
|
| 238 | + |
|
| 239 | + $xoopsTpl->assign('search_page', ob_get_contents()); |
|
| 240 | + ob_end_clean(); |
|
| 241 | 241 | } elseif (isset($_GET['ref']) && isset($_GET['page'])) { |
| 242 | - $get_searchnum = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_GET['ref'])); |
|
| 243 | - $get_page = (int)$_GET['page']; |
|
| 244 | - |
|
| 245 | - //Query the saved results from the DB. |
|
| 246 | - $sql = 'SELECT searchid, searchnum, created, page, items, dirid, catid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . " WHERE searchnum='$get_searchnum' AND page='$get_page'"; |
|
| 247 | - |
|
| 248 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 249 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 250 | - while (list($searchid, $searchnum, $created, $page, $items, $dirid, $catid) = $xoopsDB->fetchRow($result)) { |
|
| 251 | - //Split items and for each item, get item data. |
|
| 252 | - if ($items !== '') { |
|
| 253 | - $searchresults = get_search_results($items); |
|
| 254 | - } else { |
|
| 255 | - $searchresults = 0; |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - $maxpages = 10; |
|
| 259 | - $maxcount = 30; |
|
| 260 | - $limit = $xoopsModuleConfig['searchresults_perpage']; |
|
| 261 | - $count_results = getNumberOfResults($get_searchnum, $limit); |
|
| 262 | - $count_pages = 0; |
|
| 263 | - |
|
| 264 | - $items_arr_text = ''; |
|
| 265 | - |
|
| 266 | - $offset = ($get_page - 1) * $limit; |
|
| 267 | - //Calculate the number of result pages. |
|
| 268 | - if ($count_results > $limit) { |
|
| 269 | - $count_pages = ceil($count_results / $limit); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - ob_start(); |
|
| 273 | - printf(_MD_LISTINGS_FOUND_ADV, $count_results); |
|
| 274 | - $pages_text = ob_get_contents(); |
|
| 275 | - ob_end_clean(); |
|
| 276 | - |
|
| 277 | - ob_start(); |
|
| 278 | - printf(_MD_PAGE_OF_PAGES, $get_page, $count_pages) . '<br><br>'; |
|
| 279 | - $pages_top_text = ob_get_contents(); |
|
| 280 | - ob_end_clean(); |
|
| 281 | - |
|
| 282 | - if ($count_pages >= 2) { |
|
| 283 | - $pages_text .= '' . _MD_PAGES . '<a href="advancedsearch.php?ref=' . $get_searchnum . '&page=1&dirid=' . $get_dirid . '">1</a>'; |
|
| 284 | - } |
|
| 285 | - for ($i = 1; $i < $count_pages; ++$i) { |
|
| 286 | - $page = $i + 1; |
|
| 287 | - $pages_text .= ' - <a href="advancedsearch.php?ref=' . $get_searchnum . '&page=' . $page . '&dirid=' . $get_dirid . '">' . $page . '</a><br>'; |
|
| 288 | - } |
|
| 289 | - ob_start(); |
|
| 290 | - printf(_MD_NEW_SEARCH_ADV, $get_dirid); |
|
| 291 | - $pages_text .= ob_get_contents(); |
|
| 292 | - ob_end_clean(); |
|
| 293 | - |
|
| 294 | - ob_start(); |
|
| 295 | - echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 296 | - echo $pages_top_text; |
|
| 297 | - if ($searchresults == 0) { |
|
| 298 | - echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 299 | - } else { |
|
| 300 | - $y = 0; |
|
| 301 | - $page = 1; |
|
| 302 | - foreach ($searchresults as $result) { |
|
| 303 | - echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 304 | - } |
|
| 305 | - } |
|
| 306 | - echo $pages_text; |
|
| 307 | - $xoopsTpl->assign('search_page', ob_get_contents()); |
|
| 308 | - ob_end_clean(); |
|
| 242 | + $get_searchnum = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_GET['ref'])); |
|
| 243 | + $get_page = (int)$_GET['page']; |
|
| 244 | + |
|
| 245 | + //Query the saved results from the DB. |
|
| 246 | + $sql = 'SELECT searchid, searchnum, created, page, items, dirid, catid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . " WHERE searchnum='$get_searchnum' AND page='$get_page'"; |
|
| 247 | + |
|
| 248 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 249 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 250 | + while (list($searchid, $searchnum, $created, $page, $items, $dirid, $catid) = $xoopsDB->fetchRow($result)) { |
|
| 251 | + //Split items and for each item, get item data. |
|
| 252 | + if ($items !== '') { |
|
| 253 | + $searchresults = get_search_results($items); |
|
| 254 | + } else { |
|
| 255 | + $searchresults = 0; |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + $maxpages = 10; |
|
| 259 | + $maxcount = 30; |
|
| 260 | + $limit = $xoopsModuleConfig['searchresults_perpage']; |
|
| 261 | + $count_results = getNumberOfResults($get_searchnum, $limit); |
|
| 262 | + $count_pages = 0; |
|
| 263 | + |
|
| 264 | + $items_arr_text = ''; |
|
| 265 | + |
|
| 266 | + $offset = ($get_page - 1) * $limit; |
|
| 267 | + //Calculate the number of result pages. |
|
| 268 | + if ($count_results > $limit) { |
|
| 269 | + $count_pages = ceil($count_results / $limit); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + ob_start(); |
|
| 273 | + printf(_MD_LISTINGS_FOUND_ADV, $count_results); |
|
| 274 | + $pages_text = ob_get_contents(); |
|
| 275 | + ob_end_clean(); |
|
| 276 | + |
|
| 277 | + ob_start(); |
|
| 278 | + printf(_MD_PAGE_OF_PAGES, $get_page, $count_pages) . '<br><br>'; |
|
| 279 | + $pages_top_text = ob_get_contents(); |
|
| 280 | + ob_end_clean(); |
|
| 281 | + |
|
| 282 | + if ($count_pages >= 2) { |
|
| 283 | + $pages_text .= '' . _MD_PAGES . '<a href="advancedsearch.php?ref=' . $get_searchnum . '&page=1&dirid=' . $get_dirid . '">1</a>'; |
|
| 284 | + } |
|
| 285 | + for ($i = 1; $i < $count_pages; ++$i) { |
|
| 286 | + $page = $i + 1; |
|
| 287 | + $pages_text .= ' - <a href="advancedsearch.php?ref=' . $get_searchnum . '&page=' . $page . '&dirid=' . $get_dirid . '">' . $page . '</a><br>'; |
|
| 288 | + } |
|
| 289 | + ob_start(); |
|
| 290 | + printf(_MD_NEW_SEARCH_ADV, $get_dirid); |
|
| 291 | + $pages_text .= ob_get_contents(); |
|
| 292 | + ob_end_clean(); |
|
| 293 | + |
|
| 294 | + ob_start(); |
|
| 295 | + echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 296 | + echo $pages_top_text; |
|
| 297 | + if ($searchresults == 0) { |
|
| 298 | + echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 299 | + } else { |
|
| 300 | + $y = 0; |
|
| 301 | + $page = 1; |
|
| 302 | + foreach ($searchresults as $result) { |
|
| 303 | + echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | + echo $pages_text; |
|
| 307 | + $xoopsTpl->assign('search_page', ob_get_contents()); |
|
| 308 | + ob_end_clean(); |
|
| 309 | 309 | } else { |
| 310 | - //No search was posted nor was a search page requested. |
|
| 311 | - //A search form is generated from the datatype fields in the chosen directory. |
|
| 312 | - $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 313 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 314 | - . ' ft, ' |
|
| 315 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 316 | - . ' dt, ' |
|
| 317 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') |
|
| 318 | - . '_dtypes_x_cat') |
|
| 319 | - . ' dxc, ' |
|
| 320 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 321 | - . " c WHERE c.cid=dxc.cid AND dt.dtypeid=dxc.dtypeid AND dt.fieldtypeid=ft.typeid AND c.dirid='$get_dirid' AND dt.activeyn='1'"; |
|
| 322 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 323 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 324 | - |
|
| 325 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 326 | - ob_start(); |
|
| 327 | - $form = new XoopsThemeForm(_MD_ADVSEARCH_FORM, 'advsearchform', 'advancedsearch.php'); |
|
| 328 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 329 | - while (list($dtypeid, $dtypetitle, $dtypeoptions, $fieldtype) = $xoopsDB->fetchRow($result)) { |
|
| 330 | - $field = $datafieldmanager->createSearchField($dtypetitle, $dtypeid, $fieldtype, '', $dtypeoptions); |
|
| 331 | - } |
|
| 332 | - $form->addElement(new XoopsFormText(_MD_SEARCHSTRING, 'q', 50, 250, '')); |
|
| 333 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SEARCH, 'submit')); |
|
| 334 | - $form->addElement(new XoopsFormHidden('op', 'search')); |
|
| 335 | - $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 336 | - $form->display(); |
|
| 337 | - $xoopsTpl->assign('search_page', ob_get_contents()); |
|
| 338 | - ob_end_clean(); |
|
| 310 | + //No search was posted nor was a search page requested. |
|
| 311 | + //A search form is generated from the datatype fields in the chosen directory. |
|
| 312 | + $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 313 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 314 | + . ' ft, ' |
|
| 315 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 316 | + . ' dt, ' |
|
| 317 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') |
|
| 318 | + . '_dtypes_x_cat') |
|
| 319 | + . ' dxc, ' |
|
| 320 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 321 | + . " c WHERE c.cid=dxc.cid AND dt.dtypeid=dxc.dtypeid AND dt.fieldtypeid=ft.typeid AND c.dirid='$get_dirid' AND dt.activeyn='1'"; |
|
| 322 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 323 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 324 | + |
|
| 325 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 326 | + ob_start(); |
|
| 327 | + $form = new XoopsThemeForm(_MD_ADVSEARCH_FORM, 'advsearchform', 'advancedsearch.php'); |
|
| 328 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 329 | + while (list($dtypeid, $dtypetitle, $dtypeoptions, $fieldtype) = $xoopsDB->fetchRow($result)) { |
|
| 330 | + $field = $datafieldmanager->createSearchField($dtypetitle, $dtypeid, $fieldtype, '', $dtypeoptions); |
|
| 331 | + } |
|
| 332 | + $form->addElement(new XoopsFormText(_MD_SEARCHSTRING, 'q', 50, 250, '')); |
|
| 333 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SEARCH, 'submit')); |
|
| 334 | + $form->addElement(new XoopsFormHidden('op', 'search')); |
|
| 335 | + $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 336 | + $form->display(); |
|
| 337 | + $xoopsTpl->assign('search_page', ob_get_contents()); |
|
| 338 | + ob_end_clean(); |
|
| 339 | 339 | } |
| 340 | 340 | include XOOPS_ROOT_PATH . '/footer.php'; |
| 341 | 341 | |
@@ -349,203 +349,203 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | function mod_search($queryarray, $andor, $limit, $offset, $filter_arr) |
| 351 | 351 | { |
| 352 | - global $xoopsDB, $eh; |
|
| 353 | - // because count() returns 1 even if a supplied variable |
|
| 354 | - // is not an array, we must check if $queryarray is really an array |
|
| 355 | - $n = 0; |
|
| 356 | - ${'sql' . $n} = ''; |
|
| 357 | - $items = ''; |
|
| 358 | - if (is_array($queryarray) && count($queryarray) >= 1) { |
|
| 359 | - $count = count($queryarray); |
|
| 360 | - ${'sql' . $n} = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 361 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 362 | - . ' d RIGHT JOIN ' |
|
| 363 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 364 | - . ' i ON (d.itemid=i.itemid) LEFT JOIN ' |
|
| 365 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 366 | - . " t ON (t.itemid=i.itemid) WHERE i.status='2'"; |
|
| 367 | - ${'sql' . $n} .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 368 | - for ($i = 1; $i < $count; ++$i) { |
|
| 369 | - ${'sql' . $n} .= " $andor "; |
|
| 370 | - ${'sql' . $n} .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 371 | - } |
|
| 372 | - ${'sql' . $n} .= ') '; |
|
| 373 | - ${'sql' . $n} .= ' ORDER BY i.created DESC'; |
|
| 374 | - ++$n; |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - $andor = ' AND'; |
|
| 378 | - foreach ($filter_arr as $filter) { |
|
| 379 | - ${'sql' . $n} = ''; |
|
| 380 | - $dtypeid = $filter['dtypeid']; |
|
| 381 | - $constr = $filter['constr']; |
|
| 382 | - $postvalue = $filter['postvalue']; |
|
| 383 | - $selectfields = $filter['selectfields']; |
|
| 384 | - $addressfields = $filter['addressfields']; |
|
| 385 | - if (is_array($selectfields)) { |
|
| 386 | - if (count($selectfields) >= 1) { |
|
| 387 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 388 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 389 | - . ' d, ' |
|
| 390 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 391 | - . ' i LEFT JOIN ' |
|
| 392 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 393 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 394 | - $select = ''; |
|
| 395 | - ${'sql' . $n} .= ' ' . $andor . " (d.dtypeid = $dtypeid AND d.value IN ("; |
|
| 396 | - $count_selectfields = count($selectfields); |
|
| 397 | - $i = 1; |
|
| 398 | - foreach ($selectfields as $selectfield) { |
|
| 399 | - ${'sql' . $n} .= '\'' . $selectfield . '\''; |
|
| 400 | - if ($i != $count_selectfields) { |
|
| 401 | - ${'sql' . $n} .= ', '; |
|
| 402 | - } |
|
| 403 | - ++$i; |
|
| 404 | - } |
|
| 405 | - ${'sql' . $n} .= '))'; |
|
| 406 | - ++$n; |
|
| 407 | - $postvalue = ''; |
|
| 408 | - } |
|
| 409 | - } else { |
|
| 410 | - $select = '0'; |
|
| 411 | - } |
|
| 412 | - |
|
| 413 | - if ($postvalue !== '') { |
|
| 414 | - ${'sql' . $n} = ''; |
|
| 415 | - //$zero_allowed = '1'; |
|
| 416 | - switch ($constr) { |
|
| 417 | - case 'equal': |
|
| 418 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 419 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 420 | - . ' d, ' |
|
| 421 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 422 | - . ' i LEFT JOIN ' |
|
| 423 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 424 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 425 | - $constraint = " = '" . $postvalue . '\''; |
|
| 426 | - break; |
|
| 427 | - case 'notequal': |
|
| 428 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 429 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 430 | - . ' d, ' |
|
| 431 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 432 | - . ' i LEFT JOIN ' |
|
| 433 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 434 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 435 | - $constraint = " <> '" . $postvalue . '\''; |
|
| 436 | - break; |
|
| 437 | - case 'contains': |
|
| 438 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 439 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 440 | - . ' d, ' |
|
| 441 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 442 | - . ' i LEFT JOIN ' |
|
| 443 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 444 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 445 | - $constraint = " LIKE '%" . $postvalue . "%'"; |
|
| 446 | - break; |
|
| 447 | - case 'notcontain': |
|
| 448 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 449 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 450 | - . ' d, ' |
|
| 451 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 452 | - . ' i LEFT JOIN ' |
|
| 453 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 454 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 455 | - $constraint = " NOT LIKE '%" . $postvalue . "%'"; |
|
| 456 | - break; |
|
| 457 | - case 'begins': |
|
| 458 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 459 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 460 | - . ' d, ' |
|
| 461 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 462 | - . ' i LEFT JOIN ' |
|
| 463 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 464 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 465 | - $constraint = " LIKE '" . $postvalue . "%'"; |
|
| 466 | - break; |
|
| 467 | - case 'ends': |
|
| 468 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 469 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 470 | - . ' d, ' |
|
| 471 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 472 | - . ' i LEFT JOIN ' |
|
| 473 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 474 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 475 | - $constraint = " LIKE '%" . $postvalue . '\''; |
|
| 476 | - break; |
|
| 477 | - case 'bigger': |
|
| 478 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 479 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 480 | - . ' d, ' |
|
| 481 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 482 | - . ' i LEFT JOIN ' |
|
| 483 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 484 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 485 | - $constraint = ' > ' . (int)$postvalue . ''; |
|
| 486 | - break; |
|
| 487 | - case 'smaller': |
|
| 488 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 489 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 490 | - . ' d, ' |
|
| 491 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 492 | - . ' i LEFT JOIN ' |
|
| 493 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 494 | - . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 495 | - $constraint = ' < ' . (int)$postvalue . ''; |
|
| 496 | - break; |
|
| 497 | - default: |
|
| 498 | - break; |
|
| 499 | - } |
|
| 500 | - if ($postvalue != '0') { |
|
| 501 | - ${'sql' . $n} .= $andor . ' (d.dtypeid = ' . $dtypeid . ' AND d.value ' . $constraint . ')'; |
|
| 502 | - } |
|
| 503 | - ${'sql' . $n} .= ' ORDER BY i.created DESC'; |
|
| 504 | - ++$n; |
|
| 505 | - } |
|
| 506 | - } |
|
| 507 | - |
|
| 508 | - //Getting the results into an array. |
|
| 509 | - $z = 0; |
|
| 510 | - |
|
| 511 | - $ret = array(); |
|
| 512 | - $items = array(); |
|
| 513 | - $intersection = array(); |
|
| 514 | - for ($i = 0; $i < $n; ++$i) { |
|
| 515 | - $result = $xoopsDB->query(${'sql' . $i}) or $eh->show('0013'); |
|
| 516 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 517 | - |
|
| 518 | - if (!$result) { |
|
| 519 | - $num_results = 0; |
|
| 520 | - } elseif ($num_results == 0) { |
|
| 521 | - $num_results = 0; |
|
| 522 | - } else { |
|
| 523 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 524 | - $items[] = $myrow['itemid']; |
|
| 525 | - if ($i == 0) { |
|
| 526 | - $ret[$z]['itemid'] = $myrow['itemid']; |
|
| 527 | - $ret[$z]['image'] = 'images/home.gif'; |
|
| 528 | - $ret[$z]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 529 | - $ret[$z]['title'] = $myrow['title']; |
|
| 530 | - $ret[$z]['description'] = $myrow['description']; |
|
| 531 | - $ret[$z]['time'] = $myrow['created']; |
|
| 532 | - $ret[$z]['uid'] = $myrow['uid']; |
|
| 533 | - $intersection = $items; |
|
| 534 | - } |
|
| 535 | - ++$z; |
|
| 536 | - } |
|
| 537 | - $intersection = array_intersect($intersection, $items); |
|
| 538 | - } |
|
| 539 | - } |
|
| 540 | - |
|
| 541 | - $i = 0; |
|
| 542 | - $item_arr = array(); |
|
| 543 | - foreach ($intersection as $value) { |
|
| 544 | - $item_arr[$i] = $ret['' . findKeyValuePair($ret, 'itemid', $value, false) . '']; |
|
| 545 | - ++$i; |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - return $item_arr; |
|
| 352 | + global $xoopsDB, $eh; |
|
| 353 | + // because count() returns 1 even if a supplied variable |
|
| 354 | + // is not an array, we must check if $queryarray is really an array |
|
| 355 | + $n = 0; |
|
| 356 | + ${'sql' . $n} = ''; |
|
| 357 | + $items = ''; |
|
| 358 | + if (is_array($queryarray) && count($queryarray) >= 1) { |
|
| 359 | + $count = count($queryarray); |
|
| 360 | + ${'sql' . $n} = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 361 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 362 | + . ' d RIGHT JOIN ' |
|
| 363 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 364 | + . ' i ON (d.itemid=i.itemid) LEFT JOIN ' |
|
| 365 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 366 | + . " t ON (t.itemid=i.itemid) WHERE i.status='2'"; |
|
| 367 | + ${'sql' . $n} .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 368 | + for ($i = 1; $i < $count; ++$i) { |
|
| 369 | + ${'sql' . $n} .= " $andor "; |
|
| 370 | + ${'sql' . $n} .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 371 | + } |
|
| 372 | + ${'sql' . $n} .= ') '; |
|
| 373 | + ${'sql' . $n} .= ' ORDER BY i.created DESC'; |
|
| 374 | + ++$n; |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + $andor = ' AND'; |
|
| 378 | + foreach ($filter_arr as $filter) { |
|
| 379 | + ${'sql' . $n} = ''; |
|
| 380 | + $dtypeid = $filter['dtypeid']; |
|
| 381 | + $constr = $filter['constr']; |
|
| 382 | + $postvalue = $filter['postvalue']; |
|
| 383 | + $selectfields = $filter['selectfields']; |
|
| 384 | + $addressfields = $filter['addressfields']; |
|
| 385 | + if (is_array($selectfields)) { |
|
| 386 | + if (count($selectfields) >= 1) { |
|
| 387 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 388 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 389 | + . ' d, ' |
|
| 390 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 391 | + . ' i LEFT JOIN ' |
|
| 392 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 393 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 394 | + $select = ''; |
|
| 395 | + ${'sql' . $n} .= ' ' . $andor . " (d.dtypeid = $dtypeid AND d.value IN ("; |
|
| 396 | + $count_selectfields = count($selectfields); |
|
| 397 | + $i = 1; |
|
| 398 | + foreach ($selectfields as $selectfield) { |
|
| 399 | + ${'sql' . $n} .= '\'' . $selectfield . '\''; |
|
| 400 | + if ($i != $count_selectfields) { |
|
| 401 | + ${'sql' . $n} .= ', '; |
|
| 402 | + } |
|
| 403 | + ++$i; |
|
| 404 | + } |
|
| 405 | + ${'sql' . $n} .= '))'; |
|
| 406 | + ++$n; |
|
| 407 | + $postvalue = ''; |
|
| 408 | + } |
|
| 409 | + } else { |
|
| 410 | + $select = '0'; |
|
| 411 | + } |
|
| 412 | + |
|
| 413 | + if ($postvalue !== '') { |
|
| 414 | + ${'sql' . $n} = ''; |
|
| 415 | + //$zero_allowed = '1'; |
|
| 416 | + switch ($constr) { |
|
| 417 | + case 'equal': |
|
| 418 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 419 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 420 | + . ' d, ' |
|
| 421 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 422 | + . ' i LEFT JOIN ' |
|
| 423 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 424 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 425 | + $constraint = " = '" . $postvalue . '\''; |
|
| 426 | + break; |
|
| 427 | + case 'notequal': |
|
| 428 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 429 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 430 | + . ' d, ' |
|
| 431 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 432 | + . ' i LEFT JOIN ' |
|
| 433 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 434 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 435 | + $constraint = " <> '" . $postvalue . '\''; |
|
| 436 | + break; |
|
| 437 | + case 'contains': |
|
| 438 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 439 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 440 | + . ' d, ' |
|
| 441 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 442 | + . ' i LEFT JOIN ' |
|
| 443 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 444 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 445 | + $constraint = " LIKE '%" . $postvalue . "%'"; |
|
| 446 | + break; |
|
| 447 | + case 'notcontain': |
|
| 448 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 449 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 450 | + . ' d, ' |
|
| 451 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 452 | + . ' i LEFT JOIN ' |
|
| 453 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 454 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 455 | + $constraint = " NOT LIKE '%" . $postvalue . "%'"; |
|
| 456 | + break; |
|
| 457 | + case 'begins': |
|
| 458 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 459 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 460 | + . ' d, ' |
|
| 461 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 462 | + . ' i LEFT JOIN ' |
|
| 463 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 464 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 465 | + $constraint = " LIKE '" . $postvalue . "%'"; |
|
| 466 | + break; |
|
| 467 | + case 'ends': |
|
| 468 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 469 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 470 | + . ' d, ' |
|
| 471 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 472 | + . ' i LEFT JOIN ' |
|
| 473 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 474 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 475 | + $constraint = " LIKE '%" . $postvalue . '\''; |
|
| 476 | + break; |
|
| 477 | + case 'bigger': |
|
| 478 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 479 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 480 | + . ' d, ' |
|
| 481 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 482 | + . ' i LEFT JOIN ' |
|
| 483 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 484 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 485 | + $constraint = ' > ' . (int)$postvalue . ''; |
|
| 486 | + break; |
|
| 487 | + case 'smaller': |
|
| 488 | + ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 489 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 490 | + . ' d, ' |
|
| 491 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 492 | + . ' i LEFT JOIN ' |
|
| 493 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 494 | + . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 495 | + $constraint = ' < ' . (int)$postvalue . ''; |
|
| 496 | + break; |
|
| 497 | + default: |
|
| 498 | + break; |
|
| 499 | + } |
|
| 500 | + if ($postvalue != '0') { |
|
| 501 | + ${'sql' . $n} .= $andor . ' (d.dtypeid = ' . $dtypeid . ' AND d.value ' . $constraint . ')'; |
|
| 502 | + } |
|
| 503 | + ${'sql' . $n} .= ' ORDER BY i.created DESC'; |
|
| 504 | + ++$n; |
|
| 505 | + } |
|
| 506 | + } |
|
| 507 | + |
|
| 508 | + //Getting the results into an array. |
|
| 509 | + $z = 0; |
|
| 510 | + |
|
| 511 | + $ret = array(); |
|
| 512 | + $items = array(); |
|
| 513 | + $intersection = array(); |
|
| 514 | + for ($i = 0; $i < $n; ++$i) { |
|
| 515 | + $result = $xoopsDB->query(${'sql' . $i}) or $eh->show('0013'); |
|
| 516 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 517 | + |
|
| 518 | + if (!$result) { |
|
| 519 | + $num_results = 0; |
|
| 520 | + } elseif ($num_results == 0) { |
|
| 521 | + $num_results = 0; |
|
| 522 | + } else { |
|
| 523 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 524 | + $items[] = $myrow['itemid']; |
|
| 525 | + if ($i == 0) { |
|
| 526 | + $ret[$z]['itemid'] = $myrow['itemid']; |
|
| 527 | + $ret[$z]['image'] = 'images/home.gif'; |
|
| 528 | + $ret[$z]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 529 | + $ret[$z]['title'] = $myrow['title']; |
|
| 530 | + $ret[$z]['description'] = $myrow['description']; |
|
| 531 | + $ret[$z]['time'] = $myrow['created']; |
|
| 532 | + $ret[$z]['uid'] = $myrow['uid']; |
|
| 533 | + $intersection = $items; |
|
| 534 | + } |
|
| 535 | + ++$z; |
|
| 536 | + } |
|
| 537 | + $intersection = array_intersect($intersection, $items); |
|
| 538 | + } |
|
| 539 | + } |
|
| 540 | + |
|
| 541 | + $i = 0; |
|
| 542 | + $item_arr = array(); |
|
| 543 | + foreach ($intersection as $value) { |
|
| 544 | + $item_arr[$i] = $ret['' . findKeyValuePair($ret, 'itemid', $value, false) . '']; |
|
| 545 | + ++$i; |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + return $item_arr; |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | /** |
@@ -554,31 +554,31 @@ discard block |
||
| 554 | 554 | */ |
| 555 | 555 | function get_search_results($items = '') |
| 556 | 556 | { |
| 557 | - global $xoopsDB, $eh; |
|
| 558 | - if ($items !== '') { |
|
| 559 | - $z = 0; |
|
| 560 | - $ret = array(); |
|
| 561 | - $split_items = explode(',', $items); |
|
| 562 | - foreach ($split_items as $item) { |
|
| 563 | - $sql = 'SELECT i.itemid, i.title, i.uid, i.created, t.description FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') . " t WHERE i.itemid=t.itemid AND i.itemid='$item'"; |
|
| 564 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 565 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 566 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 567 | - $ret[$z]['itemid'] = $myrow['itemid']; |
|
| 568 | - $ret[$z]['image'] = 'images/home.gif'; |
|
| 569 | - $ret[$z]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 570 | - $ret[$z]['title'] = $myrow['title']; |
|
| 571 | - $ret[$z]['description'] = $myrow['description']; |
|
| 572 | - $ret[$z]['time'] = $myrow['created']; |
|
| 573 | - $ret[$z]['uid'] = $myrow['uid']; |
|
| 574 | - ++$z; |
|
| 575 | - } |
|
| 576 | - } |
|
| 577 | - |
|
| 578 | - return $ret; |
|
| 579 | - } else { |
|
| 580 | - return false; |
|
| 581 | - } |
|
| 557 | + global $xoopsDB, $eh; |
|
| 558 | + if ($items !== '') { |
|
| 559 | + $z = 0; |
|
| 560 | + $ret = array(); |
|
| 561 | + $split_items = explode(',', $items); |
|
| 562 | + foreach ($split_items as $item) { |
|
| 563 | + $sql = 'SELECT i.itemid, i.title, i.uid, i.created, t.description FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') . " t WHERE i.itemid=t.itemid AND i.itemid='$item'"; |
|
| 564 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 565 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 566 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 567 | + $ret[$z]['itemid'] = $myrow['itemid']; |
|
| 568 | + $ret[$z]['image'] = 'images/home.gif'; |
|
| 569 | + $ret[$z]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 570 | + $ret[$z]['title'] = $myrow['title']; |
|
| 571 | + $ret[$z]['description'] = $myrow['description']; |
|
| 572 | + $ret[$z]['time'] = $myrow['created']; |
|
| 573 | + $ret[$z]['uid'] = $myrow['uid']; |
|
| 574 | + ++$z; |
|
| 575 | + } |
|
| 576 | + } |
|
| 577 | + |
|
| 578 | + return $ret; |
|
| 579 | + } else { |
|
| 580 | + return false; |
|
| 581 | + } |
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | /** |
@@ -588,24 +588,24 @@ discard block |
||
| 588 | 588 | */ |
| 589 | 589 | function getNumberOfResults($searchnum = 0, $limit = 10) |
| 590 | 590 | { |
| 591 | - global $xoopsDB, $eh; |
|
| 592 | - $block = array(); |
|
| 593 | - $sql = 'SELECT MAX(page), items FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . " WHERE searchnum = '" . $searchnum . '\' GROUP BY page'; |
|
| 594 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 595 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 596 | - if (!$result) { |
|
| 597 | - return 0; |
|
| 598 | - } |
|
| 599 | - for ($i = 0; $i < $num_results; ++$i) { |
|
| 600 | - $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
| 601 | - $page = $row['MAX(page)']; |
|
| 602 | - $items = $row['items']; |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - $count_lastpage = substr_count($items, ',') + 1; |
|
| 606 | - $count = ($page * $limit) - ($limit - $count_lastpage); |
|
| 607 | - |
|
| 608 | - return $count; |
|
| 591 | + global $xoopsDB, $eh; |
|
| 592 | + $block = array(); |
|
| 593 | + $sql = 'SELECT MAX(page), items FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . " WHERE searchnum = '" . $searchnum . '\' GROUP BY page'; |
|
| 594 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 595 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 596 | + if (!$result) { |
|
| 597 | + return 0; |
|
| 598 | + } |
|
| 599 | + for ($i = 0; $i < $num_results; ++$i) { |
|
| 600 | + $row = $GLOBALS['xoopsDB']->fetchBoth($result); |
|
| 601 | + $page = $row['MAX(page)']; |
|
| 602 | + $items = $row['items']; |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + $count_lastpage = substr_count($items, ',') + 1; |
|
| 606 | + $count = ($page * $limit) - ($limit - $count_lastpage); |
|
| 607 | + |
|
| 608 | + return $count; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -618,30 +618,30 @@ discard block |
||
| 618 | 618 | */ |
| 619 | 619 | function mod_search_count($queryarray, $andor, $limit, $offset = 0, $filter_arr) |
| 620 | 620 | { |
| 621 | - global $xoopsDB, $eh; |
|
| 622 | - $count = 0; |
|
| 623 | - |
|
| 624 | - $sql = 'SELECT COUNT(DISTINCT i.itemid) FROM ' |
|
| 625 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 626 | - . ' d, ' |
|
| 627 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 628 | - . ' i LEFT JOIN ' |
|
| 629 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 630 | - . " t ON (i.itemid=t.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 631 | - // because count() returns 1 even if a supplied variable |
|
| 632 | - // is not an array, we must check if $queryarray is really an array |
|
| 633 | - if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 634 | - $sql .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 635 | - for ($i = 1; $i < $count; ++$i) { |
|
| 636 | - $sql .= " $andor "; |
|
| 637 | - $sql .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 638 | - } |
|
| 639 | - $sql .= ') '; |
|
| 640 | - } |
|
| 641 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 642 | - list($count) = $xoopsDB->fetchRow($result); |
|
| 643 | - |
|
| 644 | - return $count; |
|
| 621 | + global $xoopsDB, $eh; |
|
| 622 | + $count = 0; |
|
| 623 | + |
|
| 624 | + $sql = 'SELECT COUNT(DISTINCT i.itemid) FROM ' |
|
| 625 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 626 | + . ' d, ' |
|
| 627 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 628 | + . ' i LEFT JOIN ' |
|
| 629 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 630 | + . " t ON (i.itemid=t.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 631 | + // because count() returns 1 even if a supplied variable |
|
| 632 | + // is not an array, we must check if $queryarray is really an array |
|
| 633 | + if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 634 | + $sql .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 635 | + for ($i = 1; $i < $count; ++$i) { |
|
| 636 | + $sql .= " $andor "; |
|
| 637 | + $sql .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 638 | + } |
|
| 639 | + $sql .= ') '; |
|
| 640 | + } |
|
| 641 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 642 | + list($count) = $xoopsDB->fetchRow($result); |
|
| 643 | + |
|
| 644 | + return $count; |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | /** |
@@ -650,19 +650,19 @@ discard block |
||
| 650 | 650 | */ |
| 651 | 651 | function getPostedValue_text($dtypeid = 0) |
| 652 | 652 | { |
| 653 | - global $_POST; |
|
| 654 | - $postedvalues = array(); |
|
| 655 | - if (isset($_POST["$dtypeid"])) { |
|
| 656 | - if (isset($_POST['' . $dtypeid . 'constr'])) { |
|
| 657 | - $constrvalue = $_POST['' . $dtypeid . 'constr']; |
|
| 658 | - } else { |
|
| 659 | - $constrvalue = ''; |
|
| 660 | - } |
|
| 661 | - $postvalue = $_POST["$dtypeid"]; |
|
| 662 | - $postedvalues = array('dtypeid' => $dtypeid, 'constr' => $constrvalue, 'postvalue' => $postvalue, 'selectfields' => 0, 'addressfields' => 0); |
|
| 663 | - } |
|
| 664 | - |
|
| 665 | - return $postedvalues; |
|
| 653 | + global $_POST; |
|
| 654 | + $postedvalues = array(); |
|
| 655 | + if (isset($_POST["$dtypeid"])) { |
|
| 656 | + if (isset($_POST['' . $dtypeid . 'constr'])) { |
|
| 657 | + $constrvalue = $_POST['' . $dtypeid . 'constr']; |
|
| 658 | + } else { |
|
| 659 | + $constrvalue = ''; |
|
| 660 | + } |
|
| 661 | + $postvalue = $_POST["$dtypeid"]; |
|
| 662 | + $postedvalues = array('dtypeid' => $dtypeid, 'constr' => $constrvalue, 'postvalue' => $postvalue, 'selectfields' => 0, 'addressfields' => 0); |
|
| 663 | + } |
|
| 664 | + |
|
| 665 | + return $postedvalues; |
|
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | /** |
@@ -671,19 +671,19 @@ discard block |
||
| 671 | 671 | */ |
| 672 | 672 | function getPostedValue_address($dtypeid = 0) |
| 673 | 673 | { |
| 674 | - global $_POST; |
|
| 675 | - $addressfields = getAddressFields('0'); |
|
| 676 | - $postedvalues = array(); |
|
| 677 | - foreach ($addressfields['addressfields'] as $field => $fieldvalue) { |
|
| 678 | - if (isset($_POST["$dtypeid$field"])) { |
|
| 679 | - $addressfield = $_POST["$dtypeid$field"]; |
|
| 680 | - if ($addressfield !== '') { |
|
| 681 | - $postedvalues[] = array('field' => $field, 'postvalue' => $addressfield); |
|
| 682 | - } |
|
| 683 | - } |
|
| 684 | - } |
|
| 685 | - |
|
| 686 | - return $postedvalues; |
|
| 674 | + global $_POST; |
|
| 675 | + $addressfields = getAddressFields('0'); |
|
| 676 | + $postedvalues = array(); |
|
| 677 | + foreach ($addressfields['addressfields'] as $field => $fieldvalue) { |
|
| 678 | + if (isset($_POST["$dtypeid$field"])) { |
|
| 679 | + $addressfield = $_POST["$dtypeid$field"]; |
|
| 680 | + if ($addressfield !== '') { |
|
| 681 | + $postedvalues[] = array('field' => $field, 'postvalue' => $addressfield); |
|
| 682 | + } |
|
| 683 | + } |
|
| 684 | + } |
|
| 685 | + |
|
| 686 | + return $postedvalues; |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | 689 | /** |
@@ -692,22 +692,22 @@ discard block |
||
| 692 | 692 | */ |
| 693 | 693 | function getPostedValue_array($dtypeid = 0) |
| 694 | 694 | { |
| 695 | - global $_POST; |
|
| 696 | - $postvalues_arr = array(); |
|
| 697 | - if (isset($_POST["$dtypeid"])) { |
|
| 698 | - if (isset($_POST['' . $dtypeid . 'constr'])) { |
|
| 699 | - $constrvalue = $_POST['' . $dtypeid . 'constr']; |
|
| 700 | - } else { |
|
| 701 | - $constrvalue = ''; |
|
| 702 | - } |
|
| 703 | - $postvalue = $_POST["$dtypeid"]; |
|
| 704 | - $postedvalues = array('dtypeid' => $dtypeid, 'constr' => $constrvalue, 'postvalue' => $postvalue, 'selectfields' => 0, 'addressfields' => 0); |
|
| 705 | - } |
|
| 706 | - |
|
| 707 | - //print_r($postedvalues); |
|
| 708 | - return $postedvalues; |
|
| 709 | - |
|
| 710 | - /* if ( isset($_POST["$dtypeid"]) ) { |
|
| 695 | + global $_POST; |
|
| 696 | + $postvalues_arr = array(); |
|
| 697 | + if (isset($_POST["$dtypeid"])) { |
|
| 698 | + if (isset($_POST['' . $dtypeid . 'constr'])) { |
|
| 699 | + $constrvalue = $_POST['' . $dtypeid . 'constr']; |
|
| 700 | + } else { |
|
| 701 | + $constrvalue = ''; |
|
| 702 | + } |
|
| 703 | + $postvalue = $_POST["$dtypeid"]; |
|
| 704 | + $postedvalues = array('dtypeid' => $dtypeid, 'constr' => $constrvalue, 'postvalue' => $postvalue, 'selectfields' => 0, 'addressfields' => 0); |
|
| 705 | + } |
|
| 706 | + |
|
| 707 | + //print_r($postedvalues); |
|
| 708 | + return $postedvalues; |
|
| 709 | + |
|
| 710 | + /* if ( isset($_POST["$dtypeid"]) ) { |
|
| 711 | 711 | $postvalues_arr[] = $_POST["$dtypeid"]; |
| 712 | 712 | } else { |
| 713 | 713 | $postvalues_arr[] = ""; |
@@ -728,23 +728,23 @@ discard block |
||
| 728 | 728 | */ |
| 729 | 729 | function findKeyValuePair($multiArray, $keyName, $value, $strict = false) |
| 730 | 730 | { |
| 731 | - /* Doing this test here makes for a bit of redundant code, but |
|
| 731 | + /* Doing this test here makes for a bit of redundant code, but |
|
| 732 | 732 | * improves the speed greatly, as it is not being preformed on every |
| 733 | 733 | * iteration of the loop. |
| 734 | 734 | */ |
| 735 | - if (!$strict) { |
|
| 736 | - foreach ($multiArray as $multiArrayKey => $childArray) { |
|
| 737 | - if (array_key_exists($keyName, $childArray) && $childArray[$keyName] == $value) { |
|
| 738 | - return $multiArrayKey; |
|
| 739 | - } |
|
| 740 | - } |
|
| 741 | - } else { |
|
| 742 | - foreach ($multiArray as $multiArrayKey => $childArray) { |
|
| 743 | - if (array_key_exists($keyName, $childArray) && $childArray[$keyName] === $value) { |
|
| 744 | - return $multiArrayKey; |
|
| 745 | - } |
|
| 746 | - } |
|
| 747 | - } |
|
| 748 | - |
|
| 749 | - return false; |
|
| 735 | + if (!$strict) { |
|
| 736 | + foreach ($multiArray as $multiArrayKey => $childArray) { |
|
| 737 | + if (array_key_exists($keyName, $childArray) && $childArray[$keyName] == $value) { |
|
| 738 | + return $multiArrayKey; |
|
| 739 | + } |
|
| 740 | + } |
|
| 741 | + } else { |
|
| 742 | + foreach ($multiArray as $multiArrayKey => $childArray) { |
|
| 743 | + if (array_key_exists($keyName, $childArray) && $childArray[$keyName] === $value) { |
|
| 744 | + return $multiArrayKey; |
|
| 745 | + } |
|
| 746 | + } |
|
| 747 | + } |
|
| 748 | + |
|
| 749 | + return false; |
|
| 750 | 750 | } |
@@ -18,16 +18,16 @@ discard block |
||
| 18 | 18 | * @author XOOPS Development Team, |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -include __DIR__ . '/header.php'; |
|
| 21 | +include __DIR__.'/header.php'; |
|
| 22 | 22 | //Include XOOPS classes |
| 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 . '/class/xoopsformloader.php'; |
|
| 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.'/class/xoopsformloader.php'; |
|
| 26 | 26 | //Include module classes |
| 27 | -require_once __DIR__ . '/class/class.formimage.php'; |
|
| 28 | -require_once __DIR__ . '/class/class.image.php'; |
|
| 29 | -require_once __DIR__ . '/class/class.efqtree.php'; |
|
| 30 | -require_once __DIR__ . '/class/class.datafieldmanager.php'; |
|
| 27 | +require_once __DIR__.'/class/class.formimage.php'; |
|
| 28 | +require_once __DIR__.'/class/class.image.php'; |
|
| 29 | +require_once __DIR__.'/class/class.efqtree.php'; |
|
| 30 | +require_once __DIR__.'/class/class.datafieldmanager.php'; |
|
| 31 | 31 | |
| 32 | 32 | $myts = MyTextSanitizer::getInstance(); |
| 33 | 33 | $eh = new ErrorHandler; |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | $moddir = $xoopsModule->getVar('dirname'); |
| 37 | 37 | |
| 38 | 38 | if (isset($_GET['catid'])) { |
| 39 | - $get_cid = (int)$_GET['cid']; |
|
| 39 | + $get_cid = (int) $_GET['cid']; |
|
| 40 | 40 | } else { |
| 41 | 41 | $get_cid = '1'; |
| 42 | 42 | } |
| 43 | 43 | if (isset($_GET['dirid'])) { |
| 44 | - $get_dirid = (int)$_GET['dirid']; |
|
| 44 | + $get_dirid = (int) $_GET['dirid']; |
|
| 45 | 45 | } elseif (isset($_POST['dirid'])) { |
| 46 | - $get_dirid = (int)$_POST['dirid']; |
|
| 46 | + $get_dirid = (int) $_POST['dirid']; |
|
| 47 | 47 | } |
| 48 | 48 | if (isset($_GET['orderby'])) { |
| 49 | 49 | $orderby = convertOrderByIn($_GET['orderby']); |
@@ -51,26 +51,26 @@ discard block |
||
| 51 | 51 | $orderby = 'title ASC'; |
| 52 | 52 | } |
| 53 | 53 | if (isset($_GET['page'])) { |
| 54 | - $get_page = (int)$_GET['page']; |
|
| 54 | + $get_page = (int) $_GET['page']; |
|
| 55 | 55 | } else { |
| 56 | 56 | $get_page = 1; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_search.tpl'; |
| 60 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
| 60 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
| 61 | 61 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 62 | 62 | //The advanced search is within a directory |
| 63 | 63 | //First get an array of all datatypes within a directory that has listings linked to them |
| 64 | 64 | if (isset($_POST['submit'])) { |
| 65 | - $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 66 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 65 | + $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 66 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_fieldtypes') |
|
| 67 | 67 | . ' ft, ' |
| 68 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 68 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_dtypes') |
|
| 69 | 69 | . ' dt, ' |
| 70 | 70 | . $xoopsDB->prefix($module->getVar('dirname', 'n') |
| 71 | 71 | . '_dtypes_x_cat') |
| 72 | 72 | . ' dxc, ' |
| 73 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 73 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_cat') |
|
| 74 | 74 | . " c WHERE c.cid=dxc.cid AND dt.dtypeid=dxc.dtypeid AND dt.fieldtypeid=ft.typeid AND c.dirid='$get_dirid' AND dt.activeyn='1'"; |
| 75 | 75 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 76 | 76 | $num_results = $xoopsDB->getRowsNum($result); |
@@ -178,43 +178,43 @@ discard block |
||
| 178 | 178 | $pages_text = sprintf(_MD_LISTINGS_FOUND_ADV, $count_results); |
| 179 | 179 | |
| 180 | 180 | if ($count_pages >= 2) { |
| 181 | - $searchnum = uniqid(mt_rand(), 1); |
|
| 182 | - $pages_text .= '' . _MD_PAGES . '<a href="advancedsearch.php?ref=' . $searchnum . '&page=1&dirid=' . $get_dirid . '">1</a>'; |
|
| 181 | + $searchnum = uniqid(mt_rand(), 1); |
|
| 182 | + $pages_text .= ''._MD_PAGES.'<a href="advancedsearch.php?ref='.$searchnum.'&page=1&dirid='.$get_dirid.'">1</a>'; |
|
| 183 | 183 | } |
| 184 | 184 | for ($i = 1; $i < $count_pages; ++$i) { |
| 185 | - $page = $i + 1; |
|
| 186 | - $pages_text .= ' - <a href="advancedsearch.php?ref=' . $searchnum . '&page=' . $page . '&dirid=' . $get_dirid . '">' . $page . '</a>'; |
|
| 185 | + $page = $i + 1; |
|
| 186 | + $pages_text .= ' - <a href="advancedsearch.php?ref='.$searchnum.'&page='.$page.'&dirid='.$get_dirid.'">'.$page.'</a>'; |
|
| 187 | 187 | } |
| 188 | 188 | $pages_text .= sprintf(_MD_NEW_SEARCH_ADV, $get_dirid); |
| 189 | - $pages_top_text = sprintf(_MD_PAGE_OF_PAGES, $get_page, $count_pages) . '<br><br>'; |
|
| 189 | + $pages_top_text = sprintf(_MD_PAGE_OF_PAGES, $get_page, $count_pages).'<br><br>'; |
|
| 190 | 190 | |
| 191 | 191 | ob_start(); |
| 192 | - echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 192 | + echo '<div class="itemTitleLarge">'._MD_SEARCHRESULTS_TITLE.'</div><br>'; |
|
| 193 | 193 | echo $pages_top_text; |
| 194 | 194 | if ($searchresults == 0) { |
| 195 | - echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 195 | + echo '<div class="itemTitle">'._MD_NORESULTS.'</div>'; |
|
| 196 | 196 | } else { |
| 197 | 197 | $y = 0; |
| 198 | 198 | $page = 1; |
| 199 | 199 | foreach ($searchresults as $result) { |
| 200 | 200 | if ($y < $limit && $page == 1) { |
| 201 | - echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 201 | + echo '<div class="itemTitle"><a href="'.$result['link'].'">'.$result['title'].'</a></div><div class="itemText">'.$result['description'].'</div><hr>'; |
|
| 202 | 202 | if ($y < $limit && $y > 0) { |
| 203 | - $items_arr_text .= ',' . $result['itemid'] . ''; |
|
| 203 | + $items_arr_text .= ','.$result['itemid'].''; |
|
| 204 | 204 | } else { |
| 205 | 205 | $items_arr_text = $result['itemid']; |
| 206 | 206 | } |
| 207 | 207 | ++$y; |
| 208 | 208 | } elseif ($y < $limit && $y > 0) { |
| 209 | - $items_arr_text .= ',' . $result['itemid'] . ''; |
|
| 209 | + $items_arr_text .= ','.$result['itemid'].''; |
|
| 210 | 210 | ++$y; |
| 211 | 211 | } elseif ($y < $limit && $y == 0) { |
| 212 | 212 | $items_arr_text = $result['itemid']; |
| 213 | 213 | ++$y; |
| 214 | 214 | } elseif ($y == $limit) { |
| 215 | 215 | //Save $items_arr_text and $page into DB |
| 216 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . '_searchid_seq'); |
|
| 217 | - $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 216 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n').'_searchresults').'_searchid_seq'); |
|
| 217 | + $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n').'_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 218 | 218 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 219 | 219 | if ($newid == 0) { |
| 220 | 220 | $itemid = $xoopsDB->getInsertId(); |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | if ($y != 0 && $page > 1) { |
| 228 | - $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . '_searchid_seq'); |
|
| 229 | - $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 228 | + $newid = $xoopsDB->genId($xoopsDB->prefix($module->getVar('dirname', 'n').'_searchresults').'_searchid_seq'); |
|
| 229 | + $sql = sprintf("INSERT INTO %s (searchid, searchnum, created, PAGE, items, dirid, catid) VALUES (%u, '%s', '%s', %u, '%s', %u, %u)", $xoopsDB->prefix($module->getVar('dirname', 'n').'_searchresults'), $newid, $searchnum, time(), $page, $items_arr_text, $get_dirid, $get_cid); |
|
| 230 | 230 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 231 | 231 | if ($newid == 0) { |
| 232 | 232 | $itemid = $xoopsDB->getInsertId(); |
@@ -240,10 +240,10 @@ discard block |
||
| 240 | 240 | ob_end_clean(); |
| 241 | 241 | } elseif (isset($_GET['ref']) && isset($_GET['page'])) { |
| 242 | 242 | $get_searchnum = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_GET['ref'])); |
| 243 | - $get_page = (int)$_GET['page']; |
|
| 243 | + $get_page = (int) $_GET['page']; |
|
| 244 | 244 | |
| 245 | 245 | //Query the saved results from the DB. |
| 246 | - $sql = 'SELECT searchid, searchnum, created, page, items, dirid, catid FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . " WHERE searchnum='$get_searchnum' AND page='$get_page'"; |
|
| 246 | + $sql = 'SELECT searchid, searchnum, created, page, items, dirid, catid FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_searchresults')." WHERE searchnum='$get_searchnum' AND page='$get_page'"; |
|
| 247 | 247 | |
| 248 | 248 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 249 | 249 | $num_results = $xoopsDB->getRowsNum($result); |
@@ -275,16 +275,16 @@ discard block |
||
| 275 | 275 | ob_end_clean(); |
| 276 | 276 | |
| 277 | 277 | ob_start(); |
| 278 | - printf(_MD_PAGE_OF_PAGES, $get_page, $count_pages) . '<br><br>'; |
|
| 278 | + printf(_MD_PAGE_OF_PAGES, $get_page, $count_pages).'<br><br>'; |
|
| 279 | 279 | $pages_top_text = ob_get_contents(); |
| 280 | 280 | ob_end_clean(); |
| 281 | 281 | |
| 282 | 282 | if ($count_pages >= 2) { |
| 283 | - $pages_text .= '' . _MD_PAGES . '<a href="advancedsearch.php?ref=' . $get_searchnum . '&page=1&dirid=' . $get_dirid . '">1</a>'; |
|
| 283 | + $pages_text .= ''._MD_PAGES.'<a href="advancedsearch.php?ref='.$get_searchnum.'&page=1&dirid='.$get_dirid.'">1</a>'; |
|
| 284 | 284 | } |
| 285 | 285 | for ($i = 1; $i < $count_pages; ++$i) { |
| 286 | - $page = $i + 1; |
|
| 287 | - $pages_text .= ' - <a href="advancedsearch.php?ref=' . $get_searchnum . '&page=' . $page . '&dirid=' . $get_dirid . '">' . $page . '</a><br>'; |
|
| 286 | + $page = $i + 1; |
|
| 287 | + $pages_text .= ' - <a href="advancedsearch.php?ref='.$get_searchnum.'&page='.$page.'&dirid='.$get_dirid.'">'.$page.'</a><br>'; |
|
| 288 | 288 | } |
| 289 | 289 | ob_start(); |
| 290 | 290 | printf(_MD_NEW_SEARCH_ADV, $get_dirid); |
@@ -292,15 +292,15 @@ discard block |
||
| 292 | 292 | ob_end_clean(); |
| 293 | 293 | |
| 294 | 294 | ob_start(); |
| 295 | - echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 295 | + echo '<div class="itemTitleLarge">'._MD_SEARCHRESULTS_TITLE.'</div><br>'; |
|
| 296 | 296 | echo $pages_top_text; |
| 297 | 297 | if ($searchresults == 0) { |
| 298 | - echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 298 | + echo '<div class="itemTitle">'._MD_NORESULTS.'</div>'; |
|
| 299 | 299 | } else { |
| 300 | 300 | $y = 0; |
| 301 | 301 | $page = 1; |
| 302 | 302 | foreach ($searchresults as $result) { |
| 303 | - echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 303 | + echo '<div class="itemTitle"><a href="'.$result['link'].'">'.$result['title'].'</a></div><div class="itemText">'.$result['description'].'</div><hr>'; |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | echo $pages_text; |
@@ -309,15 +309,15 @@ discard block |
||
| 309 | 309 | } else { |
| 310 | 310 | //No search was posted nor was a search page requested. |
| 311 | 311 | //A search form is generated from the datatype fields in the chosen directory. |
| 312 | - $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 313 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 312 | + $sql = 'SELECT DISTINCT dt.dtypeid, dt.title, dt.options, ft.fieldtype FROM ' |
|
| 313 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_fieldtypes') |
|
| 314 | 314 | . ' ft, ' |
| 315 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 315 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_dtypes') |
|
| 316 | 316 | . ' dt, ' |
| 317 | 317 | . $xoopsDB->prefix($module->getVar('dirname', 'n') |
| 318 | 318 | . '_dtypes_x_cat') |
| 319 | 319 | . ' dxc, ' |
| 320 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 320 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_cat') |
|
| 321 | 321 | . " c WHERE c.cid=dxc.cid AND dt.dtypeid=dxc.dtypeid AND dt.fieldtypeid=ft.typeid AND c.dirid='$get_dirid' AND dt.activeyn='1'"; |
| 322 | 322 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 323 | 323 | $num_results = $xoopsDB->getRowsNum($result); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $xoopsTpl->assign('search_page', ob_get_contents()); |
| 338 | 338 | ob_end_clean(); |
| 339 | 339 | } |
| 340 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 340 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
| 341 | 341 | |
| 342 | 342 | /** |
| 343 | 343 | * @param $queryarray |
@@ -353,30 +353,30 @@ discard block |
||
| 353 | 353 | // because count() returns 1 even if a supplied variable |
| 354 | 354 | // is not an array, we must check if $queryarray is really an array |
| 355 | 355 | $n = 0; |
| 356 | - ${'sql' . $n} = ''; |
|
| 356 | + ${'sql'.$n} = ''; |
|
| 357 | 357 | $items = ''; |
| 358 | 358 | if (is_array($queryarray) && count($queryarray) >= 1) { |
| 359 | 359 | $count = count($queryarray); |
| 360 | - ${'sql' . $n} = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 361 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 360 | + ${'sql'.$n} = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 361 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 362 | 362 | . ' d RIGHT JOIN ' |
| 363 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 363 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 364 | 364 | . ' i ON (d.itemid=i.itemid) LEFT JOIN ' |
| 365 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 365 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 366 | 366 | . " t ON (t.itemid=i.itemid) WHERE i.status='2'"; |
| 367 | - ${'sql' . $n} .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 367 | + ${'sql'.$n} .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 368 | 368 | for ($i = 1; $i < $count; ++$i) { |
| 369 | - ${'sql' . $n} .= " $andor "; |
|
| 370 | - ${'sql' . $n} .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 369 | + ${'sql'.$n} .= " $andor "; |
|
| 370 | + ${'sql'.$n} .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 371 | 371 | } |
| 372 | - ${'sql' . $n} .= ') '; |
|
| 373 | - ${'sql' . $n} .= ' ORDER BY i.created DESC'; |
|
| 372 | + ${'sql'.$n} .= ') '; |
|
| 373 | + ${'sql'.$n} .= ' ORDER BY i.created DESC'; |
|
| 374 | 374 | ++$n; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | $andor = ' AND'; |
| 378 | 378 | foreach ($filter_arr as $filter) { |
| 379 | - ${'sql' . $n} = ''; |
|
| 379 | + ${'sql'.$n} = ''; |
|
| 380 | 380 | $dtypeid = $filter['dtypeid']; |
| 381 | 381 | $constr = $filter['constr']; |
| 382 | 382 | $postvalue = $filter['postvalue']; |
@@ -384,25 +384,25 @@ discard block |
||
| 384 | 384 | $addressfields = $filter['addressfields']; |
| 385 | 385 | if (is_array($selectfields)) { |
| 386 | 386 | if (count($selectfields) >= 1) { |
| 387 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 388 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 387 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 388 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 389 | 389 | . ' d, ' |
| 390 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 390 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 391 | 391 | . ' i LEFT JOIN ' |
| 392 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 392 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 393 | 393 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 394 | 394 | $select = ''; |
| 395 | - ${'sql' . $n} .= ' ' . $andor . " (d.dtypeid = $dtypeid AND d.value IN ("; |
|
| 395 | + ${'sql'.$n} .= ' '.$andor." (d.dtypeid = $dtypeid AND d.value IN ("; |
|
| 396 | 396 | $count_selectfields = count($selectfields); |
| 397 | 397 | $i = 1; |
| 398 | 398 | foreach ($selectfields as $selectfield) { |
| 399 | - ${'sql' . $n} .= '\'' . $selectfield . '\''; |
|
| 399 | + ${'sql'.$n} .= '\''.$selectfield.'\''; |
|
| 400 | 400 | if ($i != $count_selectfields) { |
| 401 | - ${'sql' . $n} .= ', '; |
|
| 401 | + ${'sql'.$n} .= ', '; |
|
| 402 | 402 | } |
| 403 | 403 | ++$i; |
| 404 | 404 | } |
| 405 | - ${'sql' . $n} .= '))'; |
|
| 405 | + ${'sql'.$n} .= '))'; |
|
| 406 | 406 | ++$n; |
| 407 | 407 | $postvalue = ''; |
| 408 | 408 | } |
@@ -411,96 +411,96 @@ discard block |
||
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | if ($postvalue !== '') { |
| 414 | - ${'sql' . $n} = ''; |
|
| 414 | + ${'sql'.$n} = ''; |
|
| 415 | 415 | //$zero_allowed = '1'; |
| 416 | 416 | switch ($constr) { |
| 417 | 417 | case 'equal': |
| 418 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 419 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 418 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 419 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 420 | 420 | . ' d, ' |
| 421 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 421 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 422 | 422 | . ' i LEFT JOIN ' |
| 423 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 423 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 424 | 424 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 425 | - $constraint = " = '" . $postvalue . '\''; |
|
| 425 | + $constraint = " = '".$postvalue.'\''; |
|
| 426 | 426 | break; |
| 427 | 427 | case 'notequal': |
| 428 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 429 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 428 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 429 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 430 | 430 | . ' d, ' |
| 431 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 431 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 432 | 432 | . ' i LEFT JOIN ' |
| 433 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 433 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 434 | 434 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 435 | - $constraint = " <> '" . $postvalue . '\''; |
|
| 435 | + $constraint = " <> '".$postvalue.'\''; |
|
| 436 | 436 | break; |
| 437 | 437 | case 'contains': |
| 438 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 439 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 438 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 439 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 440 | 440 | . ' d, ' |
| 441 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 441 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 442 | 442 | . ' i LEFT JOIN ' |
| 443 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 443 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 444 | 444 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 445 | - $constraint = " LIKE '%" . $postvalue . "%'"; |
|
| 445 | + $constraint = " LIKE '%".$postvalue."%'"; |
|
| 446 | 446 | break; |
| 447 | 447 | case 'notcontain': |
| 448 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 449 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 448 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 449 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 450 | 450 | . ' d, ' |
| 451 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 451 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 452 | 452 | . ' i LEFT JOIN ' |
| 453 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 453 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 454 | 454 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 455 | - $constraint = " NOT LIKE '%" . $postvalue . "%'"; |
|
| 455 | + $constraint = " NOT LIKE '%".$postvalue."%'"; |
|
| 456 | 456 | break; |
| 457 | 457 | case 'begins': |
| 458 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 459 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 458 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 459 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 460 | 460 | . ' d, ' |
| 461 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 461 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 462 | 462 | . ' i LEFT JOIN ' |
| 463 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 463 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 464 | 464 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 465 | - $constraint = " LIKE '" . $postvalue . "%'"; |
|
| 465 | + $constraint = " LIKE '".$postvalue."%'"; |
|
| 466 | 466 | break; |
| 467 | 467 | case 'ends': |
| 468 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 469 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 468 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 469 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 470 | 470 | . ' d, ' |
| 471 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 471 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 472 | 472 | . ' i LEFT JOIN ' |
| 473 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 473 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 474 | 474 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 475 | - $constraint = " LIKE '%" . $postvalue . '\''; |
|
| 475 | + $constraint = " LIKE '%".$postvalue.'\''; |
|
| 476 | 476 | break; |
| 477 | 477 | case 'bigger': |
| 478 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 479 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 478 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 479 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 480 | 480 | . ' d, ' |
| 481 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 481 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 482 | 482 | . ' i LEFT JOIN ' |
| 483 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 483 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 484 | 484 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 485 | - $constraint = ' > ' . (int)$postvalue . ''; |
|
| 485 | + $constraint = ' > '.(int) $postvalue.''; |
|
| 486 | 486 | break; |
| 487 | 487 | case 'smaller': |
| 488 | - ${'sql' . $n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 489 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 488 | + ${'sql'.$n} .= 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 489 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 490 | 490 | . ' d, ' |
| 491 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 491 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 492 | 492 | . ' i LEFT JOIN ' |
| 493 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 493 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 494 | 494 | . " t ON (t.itemid=i.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 495 | - $constraint = ' < ' . (int)$postvalue . ''; |
|
| 495 | + $constraint = ' < '.(int) $postvalue.''; |
|
| 496 | 496 | break; |
| 497 | 497 | default: |
| 498 | 498 | break; |
| 499 | 499 | } |
| 500 | 500 | if ($postvalue != '0') { |
| 501 | - ${'sql' . $n} .= $andor . ' (d.dtypeid = ' . $dtypeid . ' AND d.value ' . $constraint . ')'; |
|
| 501 | + ${'sql'.$n} .= $andor.' (d.dtypeid = '.$dtypeid.' AND d.value '.$constraint.')'; |
|
| 502 | 502 | } |
| 503 | - ${'sql' . $n} .= ' ORDER BY i.created DESC'; |
|
| 503 | + ${'sql'.$n} .= ' ORDER BY i.created DESC'; |
|
| 504 | 504 | ++$n; |
| 505 | 505 | } |
| 506 | 506 | } |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $items = array(); |
| 513 | 513 | $intersection = array(); |
| 514 | 514 | for ($i = 0; $i < $n; ++$i) { |
| 515 | - $result = $xoopsDB->query(${'sql' . $i}) or $eh->show('0013'); |
|
| 515 | + $result = $xoopsDB->query(${'sql'.$i}) or $eh->show('0013'); |
|
| 516 | 516 | $num_results = $xoopsDB->getRowsNum($result); |
| 517 | 517 | |
| 518 | 518 | if (!$result) { |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | if ($i == 0) { |
| 526 | 526 | $ret[$z]['itemid'] = $myrow['itemid']; |
| 527 | 527 | $ret[$z]['image'] = 'images/home.gif'; |
| 528 | - $ret[$z]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 528 | + $ret[$z]['link'] = 'listing.php?item='.$myrow['itemid'].''; |
|
| 529 | 529 | $ret[$z]['title'] = $myrow['title']; |
| 530 | 530 | $ret[$z]['description'] = $myrow['description']; |
| 531 | 531 | $ret[$z]['time'] = $myrow['created']; |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | $i = 0; |
| 542 | 542 | $item_arr = array(); |
| 543 | 543 | foreach ($intersection as $value) { |
| 544 | - $item_arr[$i] = $ret['' . findKeyValuePair($ret, 'itemid', $value, false) . '']; |
|
| 544 | + $item_arr[$i] = $ret[''.findKeyValuePair($ret, 'itemid', $value, false).'']; |
|
| 545 | 545 | ++$i; |
| 546 | 546 | } |
| 547 | 547 | |
@@ -560,13 +560,13 @@ discard block |
||
| 560 | 560 | $ret = array(); |
| 561 | 561 | $split_items = explode(',', $items); |
| 562 | 562 | foreach ($split_items as $item) { |
| 563 | - $sql = 'SELECT i.itemid, i.title, i.uid, i.created, t.description FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') . " t WHERE i.itemid=t.itemid AND i.itemid='$item'"; |
|
| 563 | + $sql = 'SELECT i.itemid, i.title, i.uid, i.created, t.description FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' i, '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text')." t WHERE i.itemid=t.itemid AND i.itemid='$item'"; |
|
| 564 | 564 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 565 | 565 | $num_results = $xoopsDB->getRowsNum($result); |
| 566 | 566 | while ($myrow = $xoopsDB->fetchArray($result)) { |
| 567 | 567 | $ret[$z]['itemid'] = $myrow['itemid']; |
| 568 | 568 | $ret[$z]['image'] = 'images/home.gif'; |
| 569 | - $ret[$z]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 569 | + $ret[$z]['link'] = 'listing.php?item='.$myrow['itemid'].''; |
|
| 570 | 570 | $ret[$z]['title'] = $myrow['title']; |
| 571 | 571 | $ret[$z]['description'] = $myrow['description']; |
| 572 | 572 | $ret[$z]['time'] = $myrow['created']; |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | { |
| 591 | 591 | global $xoopsDB, $eh; |
| 592 | 592 | $block = array(); |
| 593 | - $sql = 'SELECT MAX(page), items FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_searchresults') . " WHERE searchnum = '" . $searchnum . '\' GROUP BY page'; |
|
| 593 | + $sql = 'SELECT MAX(page), items FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_searchresults')." WHERE searchnum = '".$searchnum.'\' GROUP BY page'; |
|
| 594 | 594 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 595 | 595 | $num_results = $xoopsDB->getRowsNum($result); |
| 596 | 596 | if (!$result) { |
@@ -622,11 +622,11 @@ discard block |
||
| 622 | 622 | $count = 0; |
| 623 | 623 | |
| 624 | 624 | $sql = 'SELECT COUNT(DISTINCT i.itemid) FROM ' |
| 625 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 625 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 626 | 626 | . ' d, ' |
| 627 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 627 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 628 | 628 | . ' i LEFT JOIN ' |
| 629 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 629 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 630 | 630 | . " t ON (i.itemid=t.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 631 | 631 | // because count() returns 1 even if a supplied variable |
| 632 | 632 | // is not an array, we must check if $queryarray is really an array |
@@ -653,8 +653,8 @@ discard block |
||
| 653 | 653 | global $_POST; |
| 654 | 654 | $postedvalues = array(); |
| 655 | 655 | if (isset($_POST["$dtypeid"])) { |
| 656 | - if (isset($_POST['' . $dtypeid . 'constr'])) { |
|
| 657 | - $constrvalue = $_POST['' . $dtypeid . 'constr']; |
|
| 656 | + if (isset($_POST[''.$dtypeid.'constr'])) { |
|
| 657 | + $constrvalue = $_POST[''.$dtypeid.'constr']; |
|
| 658 | 658 | } else { |
| 659 | 659 | $constrvalue = ''; |
| 660 | 660 | } |
@@ -695,8 +695,8 @@ discard block |
||
| 695 | 695 | global $_POST; |
| 696 | 696 | $postvalues_arr = array(); |
| 697 | 697 | if (isset($_POST["$dtypeid"])) { |
| 698 | - if (isset($_POST['' . $dtypeid . 'constr'])) { |
|
| 699 | - $constrvalue = $_POST['' . $dtypeid . 'constr']; |
|
| 698 | + if (isset($_POST[''.$dtypeid.'constr'])) { |
|
| 699 | + $constrvalue = $_POST[''.$dtypeid.'constr']; |
|
| 700 | 700 | } else { |
| 701 | 701 | $constrvalue = ''; |
| 702 | 702 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $moduleDirName = basename(__DIR__); |
| 24 | 24 | $coupid = isset($_GET['coupid']) ? (int)$_GET['coupid'] : 0; |
| 25 | 25 | if (!($coupid > 0)) { |
| 26 | - redirect_header('index.php'); |
|
| 26 | + redirect_header('index.php'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -31,15 +31,15 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function PrintPage($coupid) |
| 33 | 33 | { |
| 34 | - global $xoopsModule, $xoopsTpl, $xoopsModuleConfig, $moduleDirName; |
|
| 35 | - $couponHandler = xoops_getModuleHandler('coupon', $moduleDirName); |
|
| 36 | - $couponHandler->increment($coupid); |
|
| 37 | - $coupon = $couponHandler->getLinkedCoupon($coupid); |
|
| 38 | - $coupon_arr = $couponHandler->prepare2show($coupon); |
|
| 39 | - //$xoopsTpl->assign('coupon_footer', $xoopsModuleConfig['coupon_footer']); |
|
| 40 | - $xoopsTpl->assign('coupon', $coupon_arr['items']['coupons'][0]); |
|
| 41 | - $xoopsTpl->template_dir = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname(); |
|
| 42 | - $xoopsTpl->display('db:efqdiralpha1_print_savings.tpl'); |
|
| 34 | + global $xoopsModule, $xoopsTpl, $xoopsModuleConfig, $moduleDirName; |
|
| 35 | + $couponHandler = xoops_getModuleHandler('coupon', $moduleDirName); |
|
| 36 | + $couponHandler->increment($coupid); |
|
| 37 | + $coupon = $couponHandler->getLinkedCoupon($coupid); |
|
| 38 | + $coupon_arr = $couponHandler->prepare2show($coupon); |
|
| 39 | + //$xoopsTpl->assign('coupon_footer', $xoopsModuleConfig['coupon_footer']); |
|
| 40 | + $xoopsTpl->assign('coupon', $coupon_arr['items']['coupons'][0]); |
|
| 41 | + $xoopsTpl->template_dir = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname(); |
|
| 42 | + $xoopsTpl->display('db:efqdiralpha1_print_savings.tpl'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | //Smarty directory autodetect |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | * @author XOOPS Development Team, |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -include __DIR__ . '/../../mainfile.php'; |
|
| 22 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
| 21 | +include __DIR__.'/../../mainfile.php'; |
|
| 22 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
| 23 | 23 | $moduleDirName = basename(__DIR__); |
| 24 | -$coupid = isset($_GET['coupid']) ? (int)$_GET['coupid'] : 0; |
|
| 24 | +$coupid = isset($_GET['coupid']) ? (int) $_GET['coupid'] : 0; |
|
| 25 | 25 | if (!($coupid > 0)) { |
| 26 | 26 | redirect_header('index.php'); |
| 27 | 27 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $coupon_arr = $couponHandler->prepare2show($coupon); |
| 39 | 39 | //$xoopsTpl->assign('coupon_footer', $xoopsModuleConfig['coupon_footer']); |
| 40 | 40 | $xoopsTpl->assign('coupon', $coupon_arr['items']['coupons'][0]); |
| 41 | - $xoopsTpl->template_dir = XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname(); |
|
| 41 | + $xoopsTpl->template_dir = XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->dirname(); |
|
| 42 | 42 | $xoopsTpl->display('db:efqdiralpha1_print_savings.tpl'); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | // called directly |
| 17 | 17 | |
| 18 | 18 | if (isset($paypal['business'])) { |
| 19 | - //log error to file or database |
|
| 20 | - echo 'some kind of error occurred.'; |
|
| 19 | + //log error to file or database |
|
| 20 | + echo 'some kind of error occurred.'; |
|
| 21 | 21 | } else { |
| 22 | - die('This page is not directly accessible'); |
|
| 22 | + die('This page is not directly accessible'); |
|
| 23 | 23 | } |
@@ -24,36 +24,36 @@ |
||
| 24 | 24 | //decide which post method to use |
| 25 | 25 | switch ($paypal['post_method']) { |
| 26 | 26 | |
| 27 | - case 'libCurl': //php compiled with libCurl support |
|
| 27 | + case 'libCurl': //php compiled with libCurl support |
|
| 28 | 28 | |
| 29 | - $result = libCurlPost($paypal['url'], $_POST); |
|
| 29 | + $result = libCurlPost($paypal['url'], $_POST); |
|
| 30 | 30 | |
| 31 | - break; |
|
| 31 | + break; |
|
| 32 | 32 | |
| 33 | - case 'curl': //cURL via command line |
|
| 33 | + case 'curl': //cURL via command line |
|
| 34 | 34 | |
| 35 | - $result = curlPost($paypal['url'], $_POST); |
|
| 36 | - //print_r($result); |
|
| 37 | - break; |
|
| 35 | + $result = curlPost($paypal['url'], $_POST); |
|
| 36 | + //print_r($result); |
|
| 37 | + break; |
|
| 38 | 38 | |
| 39 | - case 'fso': //php fsockopen(); |
|
| 39 | + case 'fso': //php fsockopen(); |
|
| 40 | 40 | |
| 41 | - $result = fsockPost($paypal['url'], $_POST); |
|
| 42 | - //print_r($result); |
|
| 43 | - break; |
|
| 41 | + $result = fsockPost($paypal['url'], $_POST); |
|
| 42 | + //print_r($result); |
|
| 43 | + break; |
|
| 44 | 44 | |
| 45 | - default: //use the fsockopen method as default post method |
|
| 45 | + default: //use the fsockopen method as default post method |
|
| 46 | 46 | |
| 47 | - $result = fsockPost($paypal['url'], $_POST); |
|
| 48 | - //print_r($result); |
|
| 49 | - break; |
|
| 47 | + $result = fsockPost($paypal['url'], $_POST); |
|
| 48 | + //print_r($result); |
|
| 49 | + break; |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | //check the ipn result received back from paypal |
| 54 | 54 | |
| 55 | 55 | if (eregi('VERIFIED', $result)) { |
| 56 | - require_once __DIR__ . '/ipn_success.php'; |
|
| 56 | + require_once __DIR__ . '/ipn_success.php'; |
|
| 57 | 57 | } else { |
| 58 | - require_once __DIR__ . '/ipn_error.php'; |
|
| 58 | + require_once __DIR__ . '/ipn_error.php'; |
|
| 59 | 59 | } |
@@ -11,15 +11,15 @@ discard block |
||
| 11 | 11 | * http://opensource.org/licenses/cpl.php |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -include __DIR__ . '/../header.php'; |
|
| 15 | -$myts = MyTextSanitizer::getInstance();// MyTextSanitizer object |
|
| 14 | +include __DIR__.'/../header.php'; |
|
| 15 | +$myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
|
| 16 | 16 | |
| 17 | 17 | $eh = new ErrorHandler; |
| 18 | 18 | //get global configuration information |
| 19 | -require_once __DIR__ . '/../paypal_includes/global_config.inc.php'; |
|
| 19 | +require_once __DIR__.'/../paypal_includes/global_config.inc.php'; |
|
| 20 | 20 | |
| 21 | 21 | //get pay pal configuration file |
| 22 | -require_once __DIR__ . '/../paypal_includes/config.inc.php'; |
|
| 22 | +require_once __DIR__.'/../paypal_includes/config.inc.php'; |
|
| 23 | 23 | |
| 24 | 24 | //decide which post method to use |
| 25 | 25 | switch ($paypal['post_method']) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | //check the ipn result received back from paypal |
| 54 | 54 | |
| 55 | 55 | if (eregi('VERIFIED', $result)) { |
| 56 | - require_once __DIR__ . '/ipn_success.php'; |
|
| 56 | + require_once __DIR__.'/ipn_success.php'; |
|
| 57 | 57 | } else { |
| 58 | - require_once __DIR__ . '/ipn_error.php'; |
|
| 58 | + require_once __DIR__.'/ipn_error.php'; |
|
| 59 | 59 | } |