@@ -51,7 +51,7 @@ |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * @param $id |
|
| 54 | + * @param integer $id |
|
| 55 | 55 | */ |
| 56 | 56 | public function load($id) |
| 57 | 57 | { |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (!defined('XOOPS_ROOT_PATH')) { |
| 10 | - die('XOOPS root path not defined'); |
|
| 10 | + die('XOOPS root path not defined'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | include_once XOOPS_ROOT_PATH . '/kernel/object.php'; |
@@ -18,51 +18,51 @@ discard block |
||
| 18 | 18 | class Myiframe extends XoopsObject |
| 19 | 19 | { |
| 20 | 20 | // /** @var \XoopsMySQLDatabase $db */ |
| 21 | - public $db; |
|
| 21 | + public $db; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * myiframe constructor. |
|
| 25 | - * @param null $id |
|
| 26 | - */ |
|
| 27 | - public function __construct($id = null) |
|
| 28 | - { |
|
| 29 | - $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 30 | - $this->initVar('frame_frameid', XOBJ_DTYPE_INT, null, false, 10); |
|
| 31 | - $this->initVar('frame_created', XOBJ_DTYPE_INT, null, false, 10); |
|
| 32 | - $this->initVar('frame_uid', XOBJ_DTYPE_INT, null, false, 10); |
|
| 33 | - $this->initVar('frame_description', XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
| 34 | - $this->initVar('frame_width', XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
| 35 | - $this->initVar('frame_height', XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
| 36 | - $this->initVar('frame_align', XOBJ_DTYPE_INT, null, false, 10); |
|
| 37 | - $this->initVar('frame_frameborder', XOBJ_DTYPE_INT, null, false, 10); |
|
| 38 | - $this->initVar('frame_marginwidth', XOBJ_DTYPE_INT, null, false, 10); |
|
| 39 | - $this->initVar('frame_marginheight', XOBJ_DTYPE_INT, null, false, 10); |
|
| 40 | - $this->initVar('frame_scrolling', XOBJ_DTYPE_INT, null, false, 10); |
|
| 41 | - $this->initVar('frame_hits', XOBJ_DTYPE_INT, null, false, 10); |
|
| 42 | - $this->initVar('frame_url', XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
| 43 | - if (!empty($id)) { |
|
| 44 | - if (is_array($id)) { |
|
| 45 | - $this->assignVars($id); |
|
| 46 | - } else { |
|
| 47 | - $this->load((int)$id); |
|
| 48 | - } |
|
| 49 | - } else { |
|
| 50 | - $this->setNew(); |
|
| 51 | - } |
|
| 52 | - } |
|
| 23 | + /** |
|
| 24 | + * myiframe constructor. |
|
| 25 | + * @param null $id |
|
| 26 | + */ |
|
| 27 | + public function __construct($id = null) |
|
| 28 | + { |
|
| 29 | + $this->db = XoopsDatabaseFactory::getDatabaseConnection(); |
|
| 30 | + $this->initVar('frame_frameid', XOBJ_DTYPE_INT, null, false, 10); |
|
| 31 | + $this->initVar('frame_created', XOBJ_DTYPE_INT, null, false, 10); |
|
| 32 | + $this->initVar('frame_uid', XOBJ_DTYPE_INT, null, false, 10); |
|
| 33 | + $this->initVar('frame_description', XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
| 34 | + $this->initVar('frame_width', XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
| 35 | + $this->initVar('frame_height', XOBJ_DTYPE_TXTBOX, null, false, 15); |
|
| 36 | + $this->initVar('frame_align', XOBJ_DTYPE_INT, null, false, 10); |
|
| 37 | + $this->initVar('frame_frameborder', XOBJ_DTYPE_INT, null, false, 10); |
|
| 38 | + $this->initVar('frame_marginwidth', XOBJ_DTYPE_INT, null, false, 10); |
|
| 39 | + $this->initVar('frame_marginheight', XOBJ_DTYPE_INT, null, false, 10); |
|
| 40 | + $this->initVar('frame_scrolling', XOBJ_DTYPE_INT, null, false, 10); |
|
| 41 | + $this->initVar('frame_hits', XOBJ_DTYPE_INT, null, false, 10); |
|
| 42 | + $this->initVar('frame_url', XOBJ_DTYPE_TXTBOX, null, false, 255); |
|
| 43 | + if (!empty($id)) { |
|
| 44 | + if (is_array($id)) { |
|
| 45 | + $this->assignVars($id); |
|
| 46 | + } else { |
|
| 47 | + $this->load((int)$id); |
|
| 48 | + } |
|
| 49 | + } else { |
|
| 50 | + $this->setNew(); |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @param $id |
|
| 56 | - */ |
|
| 57 | - public function load($id) |
|
| 58 | - { |
|
| 59 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
| 60 | - $myrow = $this->db->fetchArray($this->db->query($sql)); |
|
| 61 | - $this->assignVars($myrow); |
|
| 62 | - if (!$myrow) { |
|
| 63 | - $this->setNew(); |
|
| 64 | - } |
|
| 65 | - } |
|
| 54 | + /** |
|
| 55 | + * @param $id |
|
| 56 | + */ |
|
| 57 | + public function load($id) |
|
| 58 | + { |
|
| 59 | + $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
| 60 | + $myrow = $this->db->fetchArray($this->db->query($sql)); |
|
| 61 | + $this->assignVars($myrow); |
|
| 62 | + if (!$myrow) { |
|
| 63 | + $this->setNew(); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -70,215 +70,215 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | class MyiframeMyiframeHandler extends XoopsObjectHandler |
| 72 | 72 | { |
| 73 | - /** |
|
| 74 | - * @param bool $isNew |
|
| 75 | - * @return myiframe |
|
| 76 | - */ |
|
| 77 | - public function create($isNew = true) |
|
| 78 | - { |
|
| 79 | - $object = new Myiframe(); |
|
| 80 | - if ($isNew) { |
|
| 81 | - $object->setNew(); |
|
| 82 | - } |
|
| 73 | + /** |
|
| 74 | + * @param bool $isNew |
|
| 75 | + * @return myiframe |
|
| 76 | + */ |
|
| 77 | + public function create($isNew = true) |
|
| 78 | + { |
|
| 79 | + $object = new Myiframe(); |
|
| 80 | + if ($isNew) { |
|
| 81 | + $object->setNew(); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - return $object; |
|
| 85 | - } |
|
| 84 | + return $object; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * @param int $id |
|
| 89 | - * @return myiframe|null |
|
| 90 | - */ |
|
| 91 | - public function get($id) |
|
| 92 | - { |
|
| 93 | - $ret = null; |
|
| 94 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
| 95 | - if (!$result = $this->db->query($sql)) { |
|
| 96 | - return $ret; |
|
| 97 | - } |
|
| 98 | - $numrows = $this->db->getRowsNum($result); |
|
| 99 | - if ($numrows == 1) { |
|
| 100 | - $object = new Myiframe(); |
|
| 101 | - $object->assignVars($this->db->fetchArray($result)); |
|
| 102 | - return $object; |
|
| 103 | - } |
|
| 87 | + /** |
|
| 88 | + * @param int $id |
|
| 89 | + * @return myiframe|null |
|
| 90 | + */ |
|
| 91 | + public function get($id) |
|
| 92 | + { |
|
| 93 | + $ret = null; |
|
| 94 | + $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe') . ' WHERE frame_frameid=' . (int)$id; |
|
| 95 | + if (!$result = $this->db->query($sql)) { |
|
| 96 | + return $ret; |
|
| 97 | + } |
|
| 98 | + $numrows = $this->db->getRowsNum($result); |
|
| 99 | + if ($numrows == 1) { |
|
| 100 | + $object = new Myiframe(); |
|
| 101 | + $object->assignVars($this->db->fetchArray($result)); |
|
| 102 | + return $object; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - return $ret; |
|
| 106 | - } |
|
| 105 | + return $ret; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * @param XoopsObject $object |
|
| 110 | - * @param bool $force |
|
| 111 | - * @return bool |
|
| 112 | - */ |
|
| 113 | - public function insert(XoopsObject $object, $force = false) |
|
| 114 | - { |
|
| 115 | - if (get_class($object) !== 'Myiframe') { |
|
| 116 | - return false; |
|
| 117 | - } |
|
| 118 | - if (!$object->isDirty()) { |
|
| 119 | - return true; |
|
| 120 | - } |
|
| 121 | - if (!$object->cleanVars()) { |
|
| 122 | - foreach ($object->getErrors() as $oneerror) { |
|
| 123 | - trigger_error($oneerror); |
|
| 124 | - } |
|
| 125 | - return false; |
|
| 126 | - } |
|
| 127 | - foreach ($object->cleanVars as $k => $v) { |
|
| 128 | - ${$k} = $v; |
|
| 129 | - } |
|
| 108 | + /** |
|
| 109 | + * @param XoopsObject $object |
|
| 110 | + * @param bool $force |
|
| 111 | + * @return bool |
|
| 112 | + */ |
|
| 113 | + public function insert(XoopsObject $object, $force = false) |
|
| 114 | + { |
|
| 115 | + if (get_class($object) !== 'Myiframe') { |
|
| 116 | + return false; |
|
| 117 | + } |
|
| 118 | + if (!$object->isDirty()) { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 121 | + if (!$object->cleanVars()) { |
|
| 122 | + foreach ($object->getErrors() as $oneerror) { |
|
| 123 | + trigger_error($oneerror); |
|
| 124 | + } |
|
| 125 | + return false; |
|
| 126 | + } |
|
| 127 | + foreach ($object->cleanVars as $k => $v) { |
|
| 128 | + ${$k} = $v; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - if ($object->isNew()) { |
|
| 132 | - $format = 'INSERT INTO "%s" (frame_created, frame_uid, frame_description, frame_width, frame_height, frame_align, frame_frameborder, frame_marginwidth, frame_marginheight, frame_scrolling, frame_hits, frame_url) VALUES (%u, %u, %s, %s, %s, %d, %d, %d, %d, %d, %u, %s)'; |
|
| 133 | - $sql = sprintf( |
|
| 134 | - $format, |
|
| 135 | - $this->db->prefix('myiframe'), |
|
| 136 | - $frame_created, |
|
| 137 | - $frame_uid, |
|
| 138 | - $this->db->quoteString($frame_description), |
|
| 139 | - $this->db->quoteString($frame_width), |
|
| 140 | - $this->db->quoteString($frame_height), |
|
| 141 | - $frame_align, |
|
| 142 | - $frame_frameborder, |
|
| 143 | - $frame_marginwidth, |
|
| 144 | - $frame_marginheight, |
|
| 145 | - $frame_scrolling, |
|
| 146 | - $frame_hits, |
|
| 147 | - $this->db->quoteString($frame_url) |
|
| 148 | - ); |
|
| 149 | - $force = true; |
|
| 150 | - } else { |
|
| 151 | - $format = 'UPDATE "%s" SET frame_description="%s", frame_width="%s", frame_height="%s", frame_align="%d", frame_frameborder="%d", frame_marginwidth="%d", frame_marginheight="%d", frame_scrolling="%d", frame_hits="%u", frame_url="%s" WHERE frame_frameid="%u"'; |
|
| 152 | - $sql = sprintf( |
|
| 153 | - $format, |
|
| 154 | - $this->db->prefix('myiframe'), |
|
| 155 | - $this->db->quoteString($frame_description), |
|
| 156 | - $this->db->quoteString($frame_width), |
|
| 157 | - $this->db->quoteString($frame_height), |
|
| 158 | - $frame_align, |
|
| 159 | - $frame_frameborder, |
|
| 160 | - $frame_marginwidth, |
|
| 161 | - $frame_marginheight, |
|
| 162 | - $frame_scrolling, |
|
| 163 | - $frame_hits, |
|
| 164 | - $this->db->quoteString($frame_url), |
|
| 165 | - $frame_frameid |
|
| 166 | - ); |
|
| 167 | - } |
|
| 168 | - if (false !== $force) { |
|
| 169 | - $result = $this->db->queryF($sql); |
|
| 170 | - } else { |
|
| 171 | - $result = $this->db->query($sql); |
|
| 172 | - } |
|
| 173 | - if (!$result) { |
|
| 174 | - return false; |
|
| 175 | - } |
|
| 176 | - if (empty($frame_frameid)) { |
|
| 177 | - $frame_frameid = $this->db->getInsertId(); |
|
| 178 | - } |
|
| 179 | - $object->assignVar('frame_frameid', $frame_frameid); |
|
| 131 | + if ($object->isNew()) { |
|
| 132 | + $format = 'INSERT INTO "%s" (frame_created, frame_uid, frame_description, frame_width, frame_height, frame_align, frame_frameborder, frame_marginwidth, frame_marginheight, frame_scrolling, frame_hits, frame_url) VALUES (%u, %u, %s, %s, %s, %d, %d, %d, %d, %d, %u, %s)'; |
|
| 133 | + $sql = sprintf( |
|
| 134 | + $format, |
|
| 135 | + $this->db->prefix('myiframe'), |
|
| 136 | + $frame_created, |
|
| 137 | + $frame_uid, |
|
| 138 | + $this->db->quoteString($frame_description), |
|
| 139 | + $this->db->quoteString($frame_width), |
|
| 140 | + $this->db->quoteString($frame_height), |
|
| 141 | + $frame_align, |
|
| 142 | + $frame_frameborder, |
|
| 143 | + $frame_marginwidth, |
|
| 144 | + $frame_marginheight, |
|
| 145 | + $frame_scrolling, |
|
| 146 | + $frame_hits, |
|
| 147 | + $this->db->quoteString($frame_url) |
|
| 148 | + ); |
|
| 149 | + $force = true; |
|
| 150 | + } else { |
|
| 151 | + $format = 'UPDATE "%s" SET frame_description="%s", frame_width="%s", frame_height="%s", frame_align="%d", frame_frameborder="%d", frame_marginwidth="%d", frame_marginheight="%d", frame_scrolling="%d", frame_hits="%u", frame_url="%s" WHERE frame_frameid="%u"'; |
|
| 152 | + $sql = sprintf( |
|
| 153 | + $format, |
|
| 154 | + $this->db->prefix('myiframe'), |
|
| 155 | + $this->db->quoteString($frame_description), |
|
| 156 | + $this->db->quoteString($frame_width), |
|
| 157 | + $this->db->quoteString($frame_height), |
|
| 158 | + $frame_align, |
|
| 159 | + $frame_frameborder, |
|
| 160 | + $frame_marginwidth, |
|
| 161 | + $frame_marginheight, |
|
| 162 | + $frame_scrolling, |
|
| 163 | + $frame_hits, |
|
| 164 | + $this->db->quoteString($frame_url), |
|
| 165 | + $frame_frameid |
|
| 166 | + ); |
|
| 167 | + } |
|
| 168 | + if (false !== $force) { |
|
| 169 | + $result = $this->db->queryF($sql); |
|
| 170 | + } else { |
|
| 171 | + $result = $this->db->query($sql); |
|
| 172 | + } |
|
| 173 | + if (!$result) { |
|
| 174 | + return false; |
|
| 175 | + } |
|
| 176 | + if (empty($frame_frameid)) { |
|
| 177 | + $frame_frameid = $this->db->getInsertId(); |
|
| 178 | + } |
|
| 179 | + $object->assignVar('frame_frameid', $frame_frameid); |
|
| 180 | 180 | |
| 181 | - return $frame_frameid; |
|
| 182 | - } |
|
| 181 | + return $frame_frameid; |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - /** |
|
| 185 | - * @param XoopsObject $object |
|
| 186 | - * @param bool $force |
|
| 187 | - * @return bool |
|
| 188 | - */ |
|
| 189 | - public function delete(XoopsObject $object, $force = false) |
|
| 190 | - { |
|
| 191 | - if (get_class($object) !== 'myiframe') { |
|
| 192 | - return false; |
|
| 193 | - } |
|
| 194 | - $sql = sprintf('DELETE FROM "%s" WHERE frame_frameid = "%u"', $this->db->prefix('myiframe'), $object->getVar('frame_frameid')); |
|
| 195 | - if (false !== $force) { |
|
| 196 | - $result = $this->db->queryF($sql); |
|
| 197 | - } else { |
|
| 198 | - $result = $this->db->query($sql); |
|
| 199 | - } |
|
| 200 | - if (!$result) { |
|
| 201 | - return false; |
|
| 202 | - } |
|
| 184 | + /** |
|
| 185 | + * @param XoopsObject $object |
|
| 186 | + * @param bool $force |
|
| 187 | + * @return bool |
|
| 188 | + */ |
|
| 189 | + public function delete(XoopsObject $object, $force = false) |
|
| 190 | + { |
|
| 191 | + if (get_class($object) !== 'myiframe') { |
|
| 192 | + return false; |
|
| 193 | + } |
|
| 194 | + $sql = sprintf('DELETE FROM "%s" WHERE frame_frameid = "%u"', $this->db->prefix('myiframe'), $object->getVar('frame_frameid')); |
|
| 195 | + if (false !== $force) { |
|
| 196 | + $result = $this->db->queryF($sql); |
|
| 197 | + } else { |
|
| 198 | + $result = $this->db->query($sql); |
|
| 199 | + } |
|
| 200 | + if (!$result) { |
|
| 201 | + return false; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - return true; |
|
| 205 | - } |
|
| 204 | + return true; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - /** |
|
| 208 | - * @param null|\Criteria $criteria |
|
| 209 | - * @param bool $id_as_key |
|
| 210 | - * @return array |
|
| 211 | - */ |
|
| 212 | - public function &getObjects(Criteria $criteria = null, $id_as_key = false) |
|
| 213 | - { |
|
| 214 | - $ret = []; |
|
| 215 | - $limit = $start = 0; |
|
| 216 | - $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe'); |
|
| 217 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 218 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 219 | - if ($criteria->getSort() !== '') { |
|
| 220 | - $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 221 | - } |
|
| 222 | - $limit = $criteria->getLimit(); |
|
| 223 | - $start = $criteria->getStart(); |
|
| 224 | - } |
|
| 225 | - $result = $this->db->query($sql, $limit, $start); |
|
| 226 | - if (!$result) { |
|
| 227 | - return $ret; |
|
| 228 | - } |
|
| 229 | - while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
| 230 | - if (!$id_as_key) { |
|
| 231 | - $ret[] = new Myiframe($myrow); |
|
| 232 | - } else { |
|
| 233 | - $ret[$myrow['frame_frameid']] = new Myiframe($myrow); |
|
| 234 | - } |
|
| 235 | - } |
|
| 207 | + /** |
|
| 208 | + * @param null|\Criteria $criteria |
|
| 209 | + * @param bool $id_as_key |
|
| 210 | + * @return array |
|
| 211 | + */ |
|
| 212 | + public function &getObjects(Criteria $criteria = null, $id_as_key = false) |
|
| 213 | + { |
|
| 214 | + $ret = []; |
|
| 215 | + $limit = $start = 0; |
|
| 216 | + $sql = 'SELECT * FROM ' . $this->db->prefix('myiframe'); |
|
| 217 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 218 | + $sql .= ' ' . $criteria->renderWhere(); |
|
| 219 | + if ($criteria->getSort() !== '') { |
|
| 220 | + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); |
|
| 221 | + } |
|
| 222 | + $limit = $criteria->getLimit(); |
|
| 223 | + $start = $criteria->getStart(); |
|
| 224 | + } |
|
| 225 | + $result = $this->db->query($sql, $limit, $start); |
|
| 226 | + if (!$result) { |
|
| 227 | + return $ret; |
|
| 228 | + } |
|
| 229 | + while (false !== ($myrow = $this->db->fetchArray($result))) { |
|
| 230 | + if (!$id_as_key) { |
|
| 231 | + $ret[] = new Myiframe($myrow); |
|
| 232 | + } else { |
|
| 233 | + $ret[$myrow['frame_frameid']] = new Myiframe($myrow); |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | 236 | |
| 237 | - return $ret; |
|
| 238 | - } |
|
| 237 | + return $ret; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * @param null|CriteriaCompo $criteria |
|
| 242 | - * @return int |
|
| 243 | - */ |
|
| 244 | - public function getCount(CriteriaCompo $criteria = null) |
|
| 245 | - { |
|
| 246 | - $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('myiframe'); |
|
| 247 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 248 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 249 | - } |
|
| 250 | - $result = $this->db->query($sql); |
|
| 251 | - if (!$result) { |
|
| 252 | - return 0; |
|
| 253 | - } |
|
| 254 | - list($count) = $this->db->fetchRow($result); |
|
| 240 | + /** |
|
| 241 | + * @param null|CriteriaCompo $criteria |
|
| 242 | + * @return int |
|
| 243 | + */ |
|
| 244 | + public function getCount(CriteriaCompo $criteria = null) |
|
| 245 | + { |
|
| 246 | + $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('myiframe'); |
|
| 247 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 248 | + $sql .= ' ' . $criteria->renderWhere(); |
|
| 249 | + } |
|
| 250 | + $result = $this->db->query($sql); |
|
| 251 | + if (!$result) { |
|
| 252 | + return 0; |
|
| 253 | + } |
|
| 254 | + list($count) = $this->db->fetchRow($result); |
|
| 255 | 255 | |
| 256 | - return $count; |
|
| 257 | - } |
|
| 256 | + return $count; |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * @param null|CriteriaCompo $criteria |
|
| 261 | - * @return bool |
|
| 262 | - */ |
|
| 263 | - public function deleteAll(CriteriaCompo $criteria = null) |
|
| 264 | - { |
|
| 265 | - $sql = 'DELETE FROM ' . $this->db->prefix('myiframe'); |
|
| 266 | - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 267 | - $sql .= ' ' . $criteria->renderWhere(); |
|
| 268 | - } |
|
| 269 | - if (!$result = $this->db->query($sql)) { |
|
| 270 | - return false; |
|
| 271 | - } |
|
| 259 | + /** |
|
| 260 | + * @param null|CriteriaCompo $criteria |
|
| 261 | + * @return bool |
|
| 262 | + */ |
|
| 263 | + public function deleteAll(CriteriaCompo $criteria = null) |
|
| 264 | + { |
|
| 265 | + $sql = 'DELETE FROM ' . $this->db->prefix('myiframe'); |
|
| 266 | + if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { |
|
| 267 | + $sql .= ' ' . $criteria->renderWhere(); |
|
| 268 | + } |
|
| 269 | + if (!$result = $this->db->query($sql)) { |
|
| 270 | + return false; |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | - return true; |
|
| 274 | - } |
|
| 273 | + return true; |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - /** |
|
| 277 | - * @param $frame_id |
|
| 278 | - */ |
|
| 279 | - public function updatehits($frame_id) |
|
| 280 | - { |
|
| 281 | - $sql = sprintf('UPDATE "%s" SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int)$frame_id); |
|
| 282 | - $this->db->queryF($sql); |
|
| 283 | - } |
|
| 276 | + /** |
|
| 277 | + * @param $frame_id |
|
| 278 | + */ |
|
| 279 | + public function updatehits($frame_id) |
|
| 280 | + { |
|
| 281 | + $sql = sprintf('UPDATE "%s" SET frame_hits = frame_hits+1 WHERE frame_frameid="%u"', $this->db->prefix('myiframe'), (int)$frame_id); |
|
| 282 | + $this->db->queryF($sql); |
|
| 283 | + } |
|
| 284 | 284 | } |
@@ -4,12 +4,12 @@ |
||
| 4 | 4 | include_once XOOPS_ROOT_PATH . '/kernel/module.php'; |
| 5 | 5 | include __DIR__ . '/../../../include/cp_header.php'; |
| 6 | 6 | if ($xoopsUser) { |
| 7 | - $xoopsModule = XoopsModule::getByDirname('myiframe'); |
|
| 8 | - if (!$xoopsUser->isAdmin($xoopsModule->mid())) { |
|
| 9 | - redirect_header(XOOPS_URL . '/', 3, _NOPERM); |
|
| 10 | - } |
|
| 7 | + $xoopsModule = XoopsModule::getByDirname('myiframe'); |
|
| 8 | + if (!$xoopsUser->isAdmin($xoopsModule->mid())) { |
|
| 9 | + redirect_header(XOOPS_URL . '/', 3, _NOPERM); |
|
| 10 | + } |
|
| 11 | 11 | } else { |
| 12 | - redirect_header(XOOPS_URL . '/', 3, _NOPERM); |
|
| 12 | + redirect_header(XOOPS_URL . '/', 3, _NOPERM); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | $myts = MyTextSanitizer::getInstance(); |
@@ -13,81 +13,81 @@ |
||
| 13 | 13 | |
| 14 | 14 | $suplparam = ''; |
| 15 | 15 | if (isset($_GET)) { |
| 16 | - foreach ($_GET as $k => $v) { |
|
| 17 | - if (strtoupper(trim($k)) !== 'IFRAMEID') { |
|
| 18 | - $suplparam .= $k . '=' . $v . '&'; |
|
| 19 | - } |
|
| 20 | - } |
|
| 16 | + foreach ($_GET as $k => $v) { |
|
| 17 | + if (strtoupper(trim($k)) !== 'IFRAMEID') { |
|
| 18 | + $suplparam .= $k . '=' . $v . '&'; |
|
| 19 | + } |
|
| 20 | + } |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (strlen(xoops_trim($suplparam)) > 0) { |
| 24 | - $suplparam = substr($suplparam, 0, strlen($suplparam) - 1); |
|
| 24 | + $suplparam = substr($suplparam, 0, strlen($suplparam) - 1); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** @var \MyiframeMyiframeHandler $iframeHandler */ |
| 28 | 28 | $iframeHandler = xoops_getModuleHandler('myiframe', 'myiframe'); |
| 29 | 29 | |
| 30 | 30 | if (isset($_GET['iframeid'])) { |
| 31 | - $tblalign = [ |
|
| 32 | - 'top', |
|
| 33 | - 'middle', |
|
| 34 | - 'bottom', |
|
| 35 | - 'left', |
|
| 36 | - 'rigth' |
|
| 37 | - ]; |
|
| 38 | - $tblscrolling = [ |
|
| 39 | - 'yes', |
|
| 40 | - 'no', |
|
| 41 | - 'auto' |
|
| 42 | - ]; |
|
| 43 | - $frameid = (int)$_GET['iframeid']; |
|
| 31 | + $tblalign = [ |
|
| 32 | + 'top', |
|
| 33 | + 'middle', |
|
| 34 | + 'bottom', |
|
| 35 | + 'left', |
|
| 36 | + 'rigth' |
|
| 37 | + ]; |
|
| 38 | + $tblscrolling = [ |
|
| 39 | + 'yes', |
|
| 40 | + 'no', |
|
| 41 | + 'auto' |
|
| 42 | + ]; |
|
| 43 | + $frameid = (int)$_GET['iframeid']; |
|
| 44 | 44 | |
| 45 | - $frame = $iframeHandler->get($frameid); |
|
| 45 | + $frame = $iframeHandler->get($frameid); |
|
| 46 | 46 | |
| 47 | - if (is_object($frame)) { |
|
| 48 | - $iframeHandler->updatehits($frameid); |
|
| 49 | - $xoopsTpl->assign('frameok', true); |
|
| 50 | - $xoopsTpl->assign('longdesc', $frame->getVar('frame_description')); |
|
| 51 | - $xoopsTpl->assign('width', $frame->getVar('frame_width')); |
|
| 52 | - $xoopsTpl->assign('height', $frame->getVar('frame_height')); |
|
| 53 | - $xoopsTpl->assign('align', $tblalign[$frame->getVar('frame_align') - 1]); |
|
| 54 | - $xoopsTpl->assign('frameborder', $frame->getVar('frame_frameborder')); |
|
| 55 | - $xoopsTpl->assign('marginwidth', $frame->getVar('frame_marginwidth')); |
|
| 56 | - $xoopsTpl->assign('marginheight', $frame->getVar('frame_marginheight')); |
|
| 57 | - $xoopsTpl->assign('scrolling', $tblscrolling[$frame->getVar('frame_scrolling') - 1]); |
|
| 58 | - if (xoops_trim($suplparam) !== '') { |
|
| 59 | - $xoopsTpl->assign('url', $frame->getVar('frame_url') . '?' . $suplparam); |
|
| 60 | - } else { |
|
| 61 | - $xoopsTpl->assign('url', $frame->getVar('frame_url')); |
|
| 62 | - } |
|
| 63 | - $title = $frame->getVar('frame_description'); |
|
| 64 | - myiframe_set_metas($title, $title); |
|
| 65 | - } else { |
|
| 66 | - $xoopsTpl->assign('frameok', false); |
|
| 67 | - $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR); |
|
| 68 | - } |
|
| 47 | + if (is_object($frame)) { |
|
| 48 | + $iframeHandler->updatehits($frameid); |
|
| 49 | + $xoopsTpl->assign('frameok', true); |
|
| 50 | + $xoopsTpl->assign('longdesc', $frame->getVar('frame_description')); |
|
| 51 | + $xoopsTpl->assign('width', $frame->getVar('frame_width')); |
|
| 52 | + $xoopsTpl->assign('height', $frame->getVar('frame_height')); |
|
| 53 | + $xoopsTpl->assign('align', $tblalign[$frame->getVar('frame_align') - 1]); |
|
| 54 | + $xoopsTpl->assign('frameborder', $frame->getVar('frame_frameborder')); |
|
| 55 | + $xoopsTpl->assign('marginwidth', $frame->getVar('frame_marginwidth')); |
|
| 56 | + $xoopsTpl->assign('marginheight', $frame->getVar('frame_marginheight')); |
|
| 57 | + $xoopsTpl->assign('scrolling', $tblscrolling[$frame->getVar('frame_scrolling') - 1]); |
|
| 58 | + if (xoops_trim($suplparam) !== '') { |
|
| 59 | + $xoopsTpl->assign('url', $frame->getVar('frame_url') . '?' . $suplparam); |
|
| 60 | + } else { |
|
| 61 | + $xoopsTpl->assign('url', $frame->getVar('frame_url')); |
|
| 62 | + } |
|
| 63 | + $title = $frame->getVar('frame_description'); |
|
| 64 | + myiframe_set_metas($title, $title); |
|
| 65 | + } else { |
|
| 66 | + $xoopsTpl->assign('frameok', false); |
|
| 67 | + $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR); |
|
| 68 | + } |
|
| 69 | 69 | } else { |
| 70 | - if (myiframe_getmoduleoption('showlist')) { |
|
| 71 | - $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php'; |
|
| 72 | - $frarray = []; |
|
| 73 | - $critere = new Criteria('1', '1', '='); |
|
| 74 | - $critere->setSort('frame_description'); |
|
| 75 | - $frarray = $iframeHandler->getObjects($critere); |
|
| 76 | - if (count($frarray) > 0) { |
|
| 77 | - foreach ($frarray as $frame) { |
|
| 78 | - /** @var Myiframe $frame */ |
|
| 79 | - if (xoops_trim($frame->getVar('frame_description')) === '') { |
|
| 80 | - $liendesc = $frame->getVar('frame_url'); |
|
| 81 | - } else { |
|
| 82 | - $liendesc = "<a href='" . $baseurl . '?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>'; |
|
| 83 | - } |
|
| 84 | - $iframe['list'] = $liendesc; |
|
| 85 | - $xoopsTpl->append('iframes', $iframe); |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - } else { |
|
| 89 | - $xoopsTpl->assign('frameok', false); |
|
| 90 | - $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR); |
|
| 91 | - } |
|
| 70 | + if (myiframe_getmoduleoption('showlist')) { |
|
| 71 | + $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php'; |
|
| 72 | + $frarray = []; |
|
| 73 | + $critere = new Criteria('1', '1', '='); |
|
| 74 | + $critere->setSort('frame_description'); |
|
| 75 | + $frarray = $iframeHandler->getObjects($critere); |
|
| 76 | + if (count($frarray) > 0) { |
|
| 77 | + foreach ($frarray as $frame) { |
|
| 78 | + /** @var Myiframe $frame */ |
|
| 79 | + if (xoops_trim($frame->getVar('frame_description')) === '') { |
|
| 80 | + $liendesc = $frame->getVar('frame_url'); |
|
| 81 | + } else { |
|
| 82 | + $liendesc = "<a href='" . $baseurl . '?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>'; |
|
| 83 | + } |
|
| 84 | + $iframe['list'] = $liendesc; |
|
| 85 | + $xoopsTpl->append('iframes', $iframe); |
|
| 86 | + } |
|
| 87 | + } |
|
| 88 | + } else { |
|
| 89 | + $xoopsTpl->assign('frameok', false); |
|
| 90 | + $xoopsTpl->assign('frame_error', _MYIFRAME_FRAME_ERROR); |
|
| 91 | + } |
|
| 92 | 92 | } |
| 93 | 93 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -14,35 +14,35 @@ discard block |
||
| 14 | 14 | */ |
| 15 | 15 | function b_myiframe_iframe_show($options) |
| 16 | 16 | { |
| 17 | - $block = []; |
|
| 18 | - $tblalign = [ |
|
| 19 | - 'top', |
|
| 20 | - 'middle', |
|
| 21 | - 'bottom', |
|
| 22 | - 'left', |
|
| 23 | - 'rigth' |
|
| 24 | - ]; |
|
| 25 | - $tblscrolling = [ |
|
| 26 | - 'yes', |
|
| 27 | - 'no', |
|
| 28 | - 'auto' |
|
| 29 | - ]; |
|
| 30 | - $iframeHandler = xoops_getModuleHandler('myiframe', 'myiframe'); |
|
| 31 | - $frame = null; |
|
| 32 | - $frame = $iframeHandler->get($options[0]); |
|
| 17 | + $block = []; |
|
| 18 | + $tblalign = [ |
|
| 19 | + 'top', |
|
| 20 | + 'middle', |
|
| 21 | + 'bottom', |
|
| 22 | + 'left', |
|
| 23 | + 'rigth' |
|
| 24 | + ]; |
|
| 25 | + $tblscrolling = [ |
|
| 26 | + 'yes', |
|
| 27 | + 'no', |
|
| 28 | + 'auto' |
|
| 29 | + ]; |
|
| 30 | + $iframeHandler = xoops_getModuleHandler('myiframe', 'myiframe'); |
|
| 31 | + $frame = null; |
|
| 32 | + $frame = $iframeHandler->get($options[0]); |
|
| 33 | 33 | |
| 34 | - if (is_object($frame)) { |
|
| 35 | - $block['longdesc'] = $frame->getVar('frame_description'); |
|
| 36 | - $block['width'] = $frame->getVar('frame_width'); |
|
| 37 | - $block['height'] = $frame->getVar('frame_height'); |
|
| 38 | - $block['align'] = $tblalign[$frame->getVar('frame_align') - 1]; |
|
| 39 | - $block['frameborder'] = $frame->getVar('frame_frameborder'); |
|
| 40 | - $block['marginwidth'] = $frame->getVar('frame_marginwidth'); |
|
| 41 | - $block['marginheight'] = $frame->getVar('frame_marginheight'); |
|
| 42 | - $block['scrolling'] = $tblscrolling[$frame->getVar('frame_scrolling') - 1]; |
|
| 43 | - $block['url'] = $frame->getVar('frame_url'); |
|
| 44 | - } |
|
| 45 | - return $block; |
|
| 34 | + if (is_object($frame)) { |
|
| 35 | + $block['longdesc'] = $frame->getVar('frame_description'); |
|
| 36 | + $block['width'] = $frame->getVar('frame_width'); |
|
| 37 | + $block['height'] = $frame->getVar('frame_height'); |
|
| 38 | + $block['align'] = $tblalign[$frame->getVar('frame_align') - 1]; |
|
| 39 | + $block['frameborder'] = $frame->getVar('frame_frameborder'); |
|
| 40 | + $block['marginwidth'] = $frame->getVar('frame_marginwidth'); |
|
| 41 | + $block['marginheight'] = $frame->getVar('frame_marginheight'); |
|
| 42 | + $block['scrolling'] = $tblscrolling[$frame->getVar('frame_scrolling') - 1]; |
|
| 43 | + $block['url'] = $frame->getVar('frame_url'); |
|
| 44 | + } |
|
| 45 | + return $block; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -51,24 +51,24 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function b_myiframe_iframe_edit($options) |
| 53 | 53 | { |
| 54 | - /** @var \MyiframeMyiframeHandler $iframeHandler */ |
|
| 55 | - $iframeHandler = xoops_getModuleHandler('myiframe', 'myiframe'); |
|
| 56 | - $frarray = []; |
|
| 57 | - $critere = new Criteria('1', '1', '='); |
|
| 58 | - $critere->setSort('frame_description'); |
|
| 59 | - $frarray = $iframeHandler->getObjects($critere); |
|
| 54 | + /** @var \MyiframeMyiframeHandler $iframeHandler */ |
|
| 55 | + $iframeHandler = xoops_getModuleHandler('myiframe', 'myiframe'); |
|
| 56 | + $frarray = []; |
|
| 57 | + $critere = new Criteria('1', '1', '='); |
|
| 58 | + $critere->setSort('frame_description'); |
|
| 59 | + $frarray = $iframeHandler->getObjects($critere); |
|
| 60 | 60 | |
| 61 | - $form = '' . _MB_MYIFRAME_IFRAME . " <select name='options[0]'>"; |
|
| 62 | - /** @var Myiframe $oneframe */ |
|
| 63 | - foreach ($frarray as $oneframe) { |
|
| 64 | - $form .= "<option value='" . $oneframe->getVar('frame_frameid') . "'"; |
|
| 65 | - if ($options[0] == $oneframe->getVar('frame_frameid')) { |
|
| 66 | - $form .= " selected='selected'"; |
|
| 67 | - } |
|
| 68 | - $form .= '>' . $oneframe->getVar('frame_description') . '</option>'; |
|
| 69 | - } |
|
| 70 | - $form .= "</select>\n"; |
|
| 71 | - return $form; |
|
| 61 | + $form = '' . _MB_MYIFRAME_IFRAME . " <select name='options[0]'>"; |
|
| 62 | + /** @var Myiframe $oneframe */ |
|
| 63 | + foreach ($frarray as $oneframe) { |
|
| 64 | + $form .= "<option value='" . $oneframe->getVar('frame_frameid') . "'"; |
|
| 65 | + if ($options[0] == $oneframe->getVar('frame_frameid')) { |
|
| 66 | + $form .= " selected='selected'"; |
|
| 67 | + } |
|
| 68 | + $form .= '>' . $oneframe->getVar('frame_description') . '</option>'; |
|
| 69 | + } |
|
| 70 | + $form .= "</select>\n"; |
|
| 71 | + return $form; |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | function b_myiframe_iframe_onthefly($options) |
| 78 | 78 | { |
| 79 | - $options = explode('|', $options); |
|
| 80 | - $block = &b_myiframe_iframe_show($options); |
|
| 79 | + $options = explode('|', $options); |
|
| 80 | + $block = &b_myiframe_iframe_show($options); |
|
| 81 | 81 | |
| 82 | - $tpl = new XoopsTpl(); |
|
| 83 | - $tpl->assign('block', $block); |
|
| 84 | - $tpl->display('db:myiframe_block_show.tpl'); |
|
| 82 | + $tpl = new XoopsTpl(); |
|
| 83 | + $tpl->assign('block', $block); |
|
| 84 | + $tpl->display('db:myiframe_block_show.tpl'); |
|
| 85 | 85 | } |
@@ -6,12 +6,12 @@ discard block |
||
| 6 | 6 | * **************************************************************************** |
| 7 | 7 | */ |
| 8 | 8 | if (!isset($moduleDirName)) { |
| 9 | - $moduleDirName = basename(dirname(__DIR__)); |
|
| 9 | + $moduleDirName = basename(dirname(__DIR__)); |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
| 13 | 13 | } else { |
| 14 | - $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
| 14 | + $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
| 15 | 15 | } |
| 16 | 16 | $adminObject = \Xmf\Module\Admin::getInstance(); |
| 17 | 17 | $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | $moduleHelper->loadLanguage('admin'); |
| 21 | 21 | |
| 22 | 22 | $adminmenu = [ |
| 23 | - [ |
|
| 24 | - 'title' => _MI_MYIFRAME_NAME, |
|
| 25 | - 'link' => 'admin/index.php', |
|
| 26 | - 'icon' => $pathIcon32 . '/home.png' |
|
| 27 | - ], |
|
| 23 | + [ |
|
| 24 | + 'title' => _MI_MYIFRAME_NAME, |
|
| 25 | + 'link' => 'admin/index.php', |
|
| 26 | + 'icon' => $pathIcon32 . '/home.png' |
|
| 27 | + ], |
|
| 28 | 28 | |
| 29 | - [ |
|
| 30 | - 'title' => _MI_MYIFRAME_ADMENU1, |
|
| 31 | - 'link' => 'admin/manage.php', |
|
| 32 | - 'icon' => $pathIcon32 . '/manage.png' |
|
| 33 | - ], |
|
| 29 | + [ |
|
| 30 | + 'title' => _MI_MYIFRAME_ADMENU1, |
|
| 31 | + 'link' => 'admin/manage.php', |
|
| 32 | + 'icon' => $pathIcon32 . '/manage.png' |
|
| 33 | + ], |
|
| 34 | 34 | |
| 35 | - // Category |
|
| 36 | - [ |
|
| 37 | - 'title' => _MI_MYIFRAME_ADMENU2, |
|
| 38 | - 'link' => 'admin/about.php', |
|
| 39 | - 'icon' => $pathIcon32 . '/about.png' |
|
| 40 | - ], |
|
| 35 | + // Category |
|
| 36 | + [ |
|
| 37 | + 'title' => _MI_MYIFRAME_ADMENU2, |
|
| 38 | + 'link' => 'admin/about.php', |
|
| 39 | + 'icon' => $pathIcon32 . '/about.png' |
|
| 40 | + ], |
|
| 41 | 41 | ]; |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // Verify if the table is up to date |
| 14 | 14 | if (!myiframe_FieldExists('frame_frameid', $GLOBALS['xoopsDB']->prefix('myiframe'))) { |
| 15 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `frameid` `frame_frameid` INT( 8 ) NOT NULL AUTO_INCREMENT'); |
|
| 16 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `created` `frame_created` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 17 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `uid` `frame_uid` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 18 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `longdesc` `frame_description` VARCHAR( 255 ) NOT NULL'); |
|
| 19 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `width` `frame_width` VARCHAR( 15 ) NOT NULL'); |
|
| 20 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `height` `frame_height` VARCHAR( 15 ) NOT NULL'); |
|
| 21 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `align` `frame_align` SMALLINT( 2 ) NOT NULL DEFAULT '0'"); |
|
| 22 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `frameborder` `frame_frameborder` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 23 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginwidth` `frame_marginwidth` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 24 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginheight` `frame_marginheight` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 25 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `scrolling` `frame_scrolling` SMALLINT( 1 ) NOT NULL DEFAULT '0'"); |
|
| 26 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `hits` `frame_hits` INT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 27 | - $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `url` `frame_url` VARCHAR( 255 ) NOT NULL'); |
|
| 28 | - header('Location : ' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=myiframe'); |
|
| 15 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `frameid` `frame_frameid` INT( 8 ) NOT NULL AUTO_INCREMENT'); |
|
| 16 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `created` `frame_created` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 17 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `uid` `frame_uid` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 18 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `longdesc` `frame_description` VARCHAR( 255 ) NOT NULL'); |
|
| 19 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `width` `frame_width` VARCHAR( 15 ) NOT NULL'); |
|
| 20 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `height` `frame_height` VARCHAR( 15 ) NOT NULL'); |
|
| 21 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `align` `frame_align` SMALLINT( 2 ) NOT NULL DEFAULT '0'"); |
|
| 22 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `frameborder` `frame_frameborder` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 23 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginwidth` `frame_marginwidth` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 24 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `marginheight` `frame_marginheight` SMALLINT( 3 ) NOT NULL DEFAULT '0'"); |
|
| 25 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `scrolling` `frame_scrolling` SMALLINT( 1 ) NOT NULL DEFAULT '0'"); |
|
| 26 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . " CHANGE `hits` `frame_hits` INT( 8 ) UNSIGNED NOT NULL DEFAULT '0'"); |
|
| 27 | + $result = $GLOBALS['xoopsDB']->queryF('ALTER TABLE ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' CHANGE `url` `frame_url` VARCHAR( 255 ) NOT NULL'); |
|
| 28 | + header('Location : ' . XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=myiframe'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $module_id = $xoopsModule->getVar('mid'); |
@@ -50,48 +50,48 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function addEditForm($frameid, $Action, $FormTitle, $longdesc, $width, $height, $align, $frameborder, $marginwidth, $marginheight, $scrolling, $url, $LabelSubmitButton) |
| 52 | 52 | { |
| 53 | - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 54 | - global $xoopsModule; |
|
| 53 | + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 54 | + global $xoopsModule; |
|
| 55 | 55 | |
| 56 | - $sform = new XoopsThemeForm($FormTitle, 'indexform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'); |
|
| 57 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_DESC, 'longdesc', 50, 255, $longdesc), false); |
|
| 58 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_WIDTH, 'width', 10, 15, $width), false); |
|
| 59 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_HEIGHT, 'height', 10, 15, $height), false); |
|
| 56 | + $sform = new XoopsThemeForm($FormTitle, 'indexform', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'); |
|
| 57 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_DESC, 'longdesc', 50, 255, $longdesc), false); |
|
| 58 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_WIDTH, 'width', 10, 15, $width), false); |
|
| 59 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_HEIGHT, 'height', 10, 15, $height), false); |
|
| 60 | 60 | |
| 61 | - $selalign = new XoopsFormSelect(_AM_MYIFRAME_ALIGN, 'align', $align); |
|
| 62 | - $selalign->addOption(1, _AM_MYIFRAME_ALIGN_TOP); |
|
| 63 | - $selalign->addOption(2, _AM_MYIFRAME_ALIGN_MIDDLE); |
|
| 64 | - $selalign->addOption(3, _AM_MYIFRAME_ALIGN_BOTTOM); |
|
| 65 | - $selalign->addOption(4, _AM_MYIFRAME_ALIGN_LEFT); |
|
| 66 | - $selalign->addOption(5, _AM_MYIFRAME_ALIGN_RIGHT); |
|
| 67 | - $selalign->setValue($align); |
|
| 68 | - $sform->addElement($selalign); |
|
| 61 | + $selalign = new XoopsFormSelect(_AM_MYIFRAME_ALIGN, 'align', $align); |
|
| 62 | + $selalign->addOption(1, _AM_MYIFRAME_ALIGN_TOP); |
|
| 63 | + $selalign->addOption(2, _AM_MYIFRAME_ALIGN_MIDDLE); |
|
| 64 | + $selalign->addOption(3, _AM_MYIFRAME_ALIGN_BOTTOM); |
|
| 65 | + $selalign->addOption(4, _AM_MYIFRAME_ALIGN_LEFT); |
|
| 66 | + $selalign->addOption(5, _AM_MYIFRAME_ALIGN_RIGHT); |
|
| 67 | + $selalign->setValue($align); |
|
| 68 | + $sform->addElement($selalign); |
|
| 69 | 69 | |
| 70 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_FRAMEBORDER, 'frameborder', 3, 3, $frameborder), false); |
|
| 71 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_MARGINWIDTH, 'marginwidth', 3, 3, $marginwidth), false); |
|
| 72 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_MARGINHEIGHT, 'marginheight', 3, 3, $marginheight), false); |
|
| 70 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_FRAMEBORDER, 'frameborder', 3, 3, $frameborder), false); |
|
| 71 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_MARGINWIDTH, 'marginwidth', 3, 3, $marginwidth), false); |
|
| 72 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_MARGINHEIGHT, 'marginheight', 3, 3, $marginheight), false); |
|
| 73 | 73 | |
| 74 | - $selscroll = new XoopsFormSelect(_AM_MYIFRAME_SCROLLING, 'scrolling', $scrolling); |
|
| 75 | - $selscroll->addOption(1, _YES); |
|
| 76 | - $selscroll->addOption(2, _NO); |
|
| 77 | - $selscroll->addOption(3, _AM_MYIFRAME_AUTO); |
|
| 78 | - $selscroll->setValue($scrolling); |
|
| 79 | - $sform->addElement($selscroll); |
|
| 74 | + $selscroll = new XoopsFormSelect(_AM_MYIFRAME_SCROLLING, 'scrolling', $scrolling); |
|
| 75 | + $selscroll->addOption(1, _YES); |
|
| 76 | + $selscroll->addOption(2, _NO); |
|
| 77 | + $selscroll->addOption(3, _AM_MYIFRAME_AUTO); |
|
| 78 | + $selscroll->setValue($scrolling); |
|
| 79 | + $sform->addElement($selscroll); |
|
| 80 | 80 | |
| 81 | - $sform->addElement(new XoopsFormText(_AM_MYIFRAME_URL, 'url', 50, 255, $url), true); |
|
| 82 | - $sform->addElement(new XoopsFormHidden('op', $Action), false); |
|
| 83 | - if (!empty($frameid)) { |
|
| 84 | - $sform->addElement(new XoopsFormHidden('frameid', $frameid), false); |
|
| 85 | - } |
|
| 81 | + $sform->addElement(new XoopsFormText(_AM_MYIFRAME_URL, 'url', 50, 255, $url), true); |
|
| 82 | + $sform->addElement(new XoopsFormHidden('op', $Action), false); |
|
| 83 | + if (!empty($frameid)) { |
|
| 84 | + $sform->addElement(new XoopsFormHidden('frameid', $frameid), false); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - $button_tray = new XoopsFormElementTray('', ''); |
|
| 88 | - $submit_btn = new XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit'); |
|
| 89 | - $button_tray->addElement($submit_btn); |
|
| 90 | - $cancel_btn = new XoopsFormButton('', 'reset', _AM_MYIFRAME_RESETBUTTON, 'reset'); |
|
| 91 | - $button_tray->addElement($cancel_btn); |
|
| 92 | - $sform->addElement($button_tray); |
|
| 93 | - $sform->display(); |
|
| 94 | - include_once __DIR__ . '/admin_footer.php'; |
|
| 87 | + $button_tray = new XoopsFormElementTray('', ''); |
|
| 88 | + $submit_btn = new XoopsFormButton('', 'submit', $LabelSubmitButton, 'submit'); |
|
| 89 | + $button_tray->addElement($submit_btn); |
|
| 90 | + $cancel_btn = new XoopsFormButton('', 'reset', _AM_MYIFRAME_RESETBUTTON, 'reset'); |
|
| 91 | + $button_tray->addElement($cancel_btn); |
|
| 92 | + $sform->addElement($button_tray); |
|
| 93 | + $sform->display(); |
|
| 94 | + include_once __DIR__ . '/admin_footer.php'; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // ****************************************************************************************************************************************** |
@@ -99,198 +99,198 @@ discard block |
||
| 99 | 99 | // ****************************************************************************************************************************************** |
| 100 | 100 | |
| 101 | 101 | if (isset($_POST['op'])) { |
| 102 | - $op = $_POST['op']; |
|
| 102 | + $op = $_POST['op']; |
|
| 103 | 103 | } elseif (isset($_GET['op'])) { |
| 104 | - $op = $_GET['op']; |
|
| 104 | + $op = $_GET['op']; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | switch ($op) { |
| 108 | - case 'verifybeforeedit': |
|
| 109 | - if (isset($_POST['submit']) && $_POST['submit'] !== '') { |
|
| 110 | - if ($_POST['longdesc'] === '') { |
|
| 111 | - xoops_cp_header(); |
|
| 112 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 113 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 114 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 115 | - echo '<tr><td class="odd">'; |
|
| 116 | - echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 117 | - echo _AM_MYIFRAME_ERROR_ADD_INDEX; |
|
| 118 | - echo '</td></tr></table>'; |
|
| 119 | - include_once __DIR__ . '/admin_footer.php'; |
|
| 120 | - xoops_cp_footer(); |
|
| 121 | - exit(); |
|
| 122 | - } |
|
| 108 | + case 'verifybeforeedit': |
|
| 109 | + if (isset($_POST['submit']) && $_POST['submit'] !== '') { |
|
| 110 | + if ($_POST['longdesc'] === '') { |
|
| 111 | + xoops_cp_header(); |
|
| 112 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 113 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 114 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 115 | + echo '<tr><td class="odd">'; |
|
| 116 | + echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 117 | + echo _AM_MYIFRAME_ERROR_ADD_INDEX; |
|
| 118 | + echo '</td></tr></table>'; |
|
| 119 | + include_once __DIR__ . '/admin_footer.php'; |
|
| 120 | + xoops_cp_footer(); |
|
| 121 | + exit(); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - $frameid = $_POST['frameid']; |
|
| 125 | - $frame = $iframeHandler->get($frameid); |
|
| 126 | - $frame->unsetNew(); |
|
| 127 | - $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 128 | - $frame->setVar('frame_width', $_POST['width']); |
|
| 129 | - $frame->setVar('frame_height', $_POST['height']); |
|
| 130 | - $frame->setVar('frame_align', $_POST['align']); |
|
| 131 | - $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 132 | - $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 133 | - $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 134 | - $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 135 | - $frame->setVar('frame_url', $_POST['url']); |
|
| 136 | - $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 137 | - $res = $iframeHandler->insert($frame); |
|
| 138 | - if (!$res) { |
|
| 139 | - redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_MODIFY_DB); |
|
| 140 | - } |
|
| 141 | - redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 142 | - } |
|
| 143 | - break; |
|
| 124 | + $frameid = $_POST['frameid']; |
|
| 125 | + $frame = $iframeHandler->get($frameid); |
|
| 126 | + $frame->unsetNew(); |
|
| 127 | + $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 128 | + $frame->setVar('frame_width', $_POST['width']); |
|
| 129 | + $frame->setVar('frame_height', $_POST['height']); |
|
| 130 | + $frame->setVar('frame_align', $_POST['align']); |
|
| 131 | + $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 132 | + $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 133 | + $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 134 | + $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 135 | + $frame->setVar('frame_url', $_POST['url']); |
|
| 136 | + $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 137 | + $res = $iframeHandler->insert($frame); |
|
| 138 | + if (!$res) { |
|
| 139 | + redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_MODIFY_DB); |
|
| 140 | + } |
|
| 141 | + redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 142 | + } |
|
| 143 | + break; |
|
| 144 | 144 | |
| 145 | - case 'edit': |
|
| 146 | - xoops_cp_header(); |
|
| 147 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 148 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 149 | - if (isset($_GET['frameid'])) { |
|
| 150 | - $frameid = (int)$_GET['frameid']; |
|
| 151 | - $frame = $iframeHandler->get($frameid); |
|
| 152 | - addEditForm( |
|
| 153 | - $frameid, |
|
| 154 | - 'verifybeforeedit', |
|
| 155 | - _AM_MYIFRAME_CONFIG, |
|
| 156 | - $frame->getVar('frame_description', 'e'), |
|
| 157 | - $frame->getVar('frame_width', 'e'), |
|
| 158 | - $frame->getVar('frame_height', 'e'), |
|
| 159 | - $frame->getVar('frame_align', 'e'), |
|
| 160 | - $frame->getVar('frame_frameborder', 'e'), |
|
| 161 | - $frame->getVar('frame_marginwidth', 'e'), |
|
| 162 | - $frame->getVar('frame_marginheight', 'e'), |
|
| 163 | - $frame->getVar('frame_scrolling', 'e'), |
|
| 164 | - $frame->getVar('frame_url', 'e'), |
|
| 165 | - _AM_MYIFRAME_UPDATE |
|
| 166 | - ); |
|
| 167 | - } else { |
|
| 168 | - xoops_cp_header(); |
|
| 169 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 170 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 171 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 172 | - echo '<tr><td class="odd">'; |
|
| 173 | - echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 174 | - echo _AM_MYIFRAME_ERROR_ADD_INDEX; |
|
| 175 | - echo "</td></tr></table>\n"; |
|
| 176 | - include_once __DIR__ . '/admin_footer.php'; |
|
| 177 | - xoops_cp_footer(); |
|
| 178 | - exit(); |
|
| 179 | - } |
|
| 180 | - break; |
|
| 145 | + case 'edit': |
|
| 146 | + xoops_cp_header(); |
|
| 147 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 148 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 149 | + if (isset($_GET['frameid'])) { |
|
| 150 | + $frameid = (int)$_GET['frameid']; |
|
| 151 | + $frame = $iframeHandler->get($frameid); |
|
| 152 | + addEditForm( |
|
| 153 | + $frameid, |
|
| 154 | + 'verifybeforeedit', |
|
| 155 | + _AM_MYIFRAME_CONFIG, |
|
| 156 | + $frame->getVar('frame_description', 'e'), |
|
| 157 | + $frame->getVar('frame_width', 'e'), |
|
| 158 | + $frame->getVar('frame_height', 'e'), |
|
| 159 | + $frame->getVar('frame_align', 'e'), |
|
| 160 | + $frame->getVar('frame_frameborder', 'e'), |
|
| 161 | + $frame->getVar('frame_marginwidth', 'e'), |
|
| 162 | + $frame->getVar('frame_marginheight', 'e'), |
|
| 163 | + $frame->getVar('frame_scrolling', 'e'), |
|
| 164 | + $frame->getVar('frame_url', 'e'), |
|
| 165 | + _AM_MYIFRAME_UPDATE |
|
| 166 | + ); |
|
| 167 | + } else { |
|
| 168 | + xoops_cp_header(); |
|
| 169 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 170 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 171 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 172 | + echo '<tr><td class="odd">'; |
|
| 173 | + echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 174 | + echo _AM_MYIFRAME_ERROR_ADD_INDEX; |
|
| 175 | + echo "</td></tr></table>\n"; |
|
| 176 | + include_once __DIR__ . '/admin_footer.php'; |
|
| 177 | + xoops_cp_footer(); |
|
| 178 | + exit(); |
|
| 179 | + } |
|
| 180 | + break; |
|
| 181 | 181 | |
| 182 | - case 'delete': |
|
| 183 | - if (!isset($_POST['ok'])) { |
|
| 184 | - xoops_cp_header(); |
|
| 185 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 186 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 187 | - echo '<h4>' . _AM_MYIFRAME_CONFIG . '</h4>'; |
|
| 188 | - xoops_confirm([ |
|
| 189 | - 'op' => 'delete', |
|
| 190 | - 'frameid' => (int)$_GET['frameid'], |
|
| 191 | - 'ok' => 1 |
|
| 192 | - ], 'manage.php', _AM_MYIFRAME_RUSUREDEL); |
|
| 193 | - include_once __DIR__ . '/admin_footer.php'; |
|
| 194 | - } else { |
|
| 195 | - if (empty($_POST['frameid'])) { |
|
| 196 | - redirect_header('manage.php', 2, _AM_MYIFRAME_ERROR_ADD_INDEX); |
|
| 197 | - } |
|
| 198 | - $frameid = (int)$_POST['frameid']; |
|
| 199 | - $critere = new Criteria('frame_frameid', $frameid, '='); |
|
| 200 | - $iframeHandler->deleteAll($critere); |
|
| 201 | - redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 202 | - } |
|
| 203 | - break; |
|
| 182 | + case 'delete': |
|
| 183 | + if (!isset($_POST['ok'])) { |
|
| 184 | + xoops_cp_header(); |
|
| 185 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 186 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 187 | + echo '<h4>' . _AM_MYIFRAME_CONFIG . '</h4>'; |
|
| 188 | + xoops_confirm([ |
|
| 189 | + 'op' => 'delete', |
|
| 190 | + 'frameid' => (int)$_GET['frameid'], |
|
| 191 | + 'ok' => 1 |
|
| 192 | + ], 'manage.php', _AM_MYIFRAME_RUSUREDEL); |
|
| 193 | + include_once __DIR__ . '/admin_footer.php'; |
|
| 194 | + } else { |
|
| 195 | + if (empty($_POST['frameid'])) { |
|
| 196 | + redirect_header('manage.php', 2, _AM_MYIFRAME_ERROR_ADD_INDEX); |
|
| 197 | + } |
|
| 198 | + $frameid = (int)$_POST['frameid']; |
|
| 199 | + $critere = new Criteria('frame_frameid', $frameid, '='); |
|
| 200 | + $iframeHandler->deleteAll($critere); |
|
| 201 | + redirect_header('manage.php', 1, _AM_MYIFRAME_DBUPDATED); |
|
| 202 | + } |
|
| 203 | + break; |
|
| 204 | 204 | |
| 205 | - case 'verifytoadd': |
|
| 206 | - if (isset($_POST['submit']) && $_POST['submit'] !== '') { |
|
| 207 | - if ($_POST['url'] === '') { |
|
| 208 | - xoops_cp_header(); |
|
| 209 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 210 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 211 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 212 | - echo '<tr><td class="odd">'; |
|
| 213 | - echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 214 | - echo _AM_MYIFRAME_ERROR_ADD_INDEX; |
|
| 215 | - echo "</td></tr></table>\n"; |
|
| 216 | - include_once __DIR__ . '/admin_footer.php'; |
|
| 217 | - xoops_cp_footer(); |
|
| 218 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 219 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 220 | - exit(); |
|
| 221 | - } |
|
| 222 | - $frame = $iframeHandler->create(true); |
|
| 223 | - $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 224 | - $frame->setVar('frame_width', $_POST['width']); |
|
| 225 | - $frame->setVar('frame_height', $_POST['height']); |
|
| 226 | - $frame->setVar('frame_align', $_POST['align']); |
|
| 227 | - $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 228 | - $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 229 | - $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 230 | - $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 231 | - $frame->setVar('frame_url', $_POST['url']); |
|
| 232 | - $frame->setVar('frame_created', time()); |
|
| 233 | - $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 234 | - $res = $iframeHandler->insert($frame); |
|
| 235 | - if (!$res) { |
|
| 236 | - redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_ADD_INDEX); |
|
| 237 | - } |
|
| 238 | - redirect_header('manage.php', 1, _AM_MYIFRAME_ADDED_OK); |
|
| 239 | - } |
|
| 240 | - break; |
|
| 205 | + case 'verifytoadd': |
|
| 206 | + if (isset($_POST['submit']) && $_POST['submit'] !== '') { |
|
| 207 | + if ($_POST['url'] === '') { |
|
| 208 | + xoops_cp_header(); |
|
| 209 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 210 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 211 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 212 | + echo '<tr><td class="odd">'; |
|
| 213 | + echo "<a href='manage.php'><h4>" . _AM_MYIFRAME_CONFIG . '</h4></a>'; |
|
| 214 | + echo _AM_MYIFRAME_ERROR_ADD_INDEX; |
|
| 215 | + echo "</td></tr></table>\n"; |
|
| 216 | + include_once __DIR__ . '/admin_footer.php'; |
|
| 217 | + xoops_cp_footer(); |
|
| 218 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 219 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 220 | + exit(); |
|
| 221 | + } |
|
| 222 | + $frame = $iframeHandler->create(true); |
|
| 223 | + $frame->setVar('frame_description', $_POST['longdesc']); |
|
| 224 | + $frame->setVar('frame_width', $_POST['width']); |
|
| 225 | + $frame->setVar('frame_height', $_POST['height']); |
|
| 226 | + $frame->setVar('frame_align', $_POST['align']); |
|
| 227 | + $frame->setVar('frame_frameborder', $_POST['frameborder']); |
|
| 228 | + $frame->setVar('frame_marginwidth', $_POST['marginwidth']); |
|
| 229 | + $frame->setVar('frame_marginheight', $_POST['marginheight']); |
|
| 230 | + $frame->setVar('frame_scrolling', $_POST['scrolling']); |
|
| 231 | + $frame->setVar('frame_url', $_POST['url']); |
|
| 232 | + $frame->setVar('frame_created', time()); |
|
| 233 | + $frame->setVar('frame_uid', $xoopsUser->getVar('uid')); |
|
| 234 | + $res = $iframeHandler->insert($frame); |
|
| 235 | + if (!$res) { |
|
| 236 | + redirect_header('manage.php', 1, _AM_MYIFRAME_ERROR_ADD_INDEX); |
|
| 237 | + } |
|
| 238 | + redirect_header('manage.php', 1, _AM_MYIFRAME_ADDED_OK); |
|
| 239 | + } |
|
| 240 | + break; |
|
| 241 | 241 | |
| 242 | - case 'addframe': |
|
| 243 | - xoops_cp_header(); |
|
| 244 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 245 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 246 | - addEditForm(0, 'verifytoadd', _AM_MYIFRAME_CONFIG, '', '100%', '', '', '0', '0', '0', 1, '', _AM_MYIFRAME_ADDBUTTON); |
|
| 247 | - break; |
|
| 242 | + case 'addframe': |
|
| 243 | + xoops_cp_header(); |
|
| 244 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 245 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 246 | + addEditForm(0, 'verifytoadd', _AM_MYIFRAME_CONFIG, '', '100%', '', '', '0', '0', '0', 1, '', _AM_MYIFRAME_ADDBUTTON); |
|
| 247 | + break; |
|
| 248 | 248 | |
| 249 | - case 'default': |
|
| 250 | - default: |
|
| 251 | - xoops_cp_header(); |
|
| 252 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 253 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 254 | - echo '<h4>' . _AM_MYIFRAME_CONFIG . "</h4><br />\n"; |
|
| 255 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 256 | - echo "<tr><th align='center'>" . _AM_MYIFRAME_ID . "</th><th align='center'>" . _AM_MYIFRAME_DESC . "</th><th align='center'>" . _AM_MYIFRAME_CREATED . "</th><th align='center'>" . _AM_MYIFRAME_HITS . "</th><th align='center'>" . _AM_MYIFRAME_ACTION . "</th></tr>\n"; |
|
| 257 | - $critere = new Criteria('1', '1', '='); |
|
| 258 | - $critere->setSort('frame_description'); |
|
| 259 | - $frarray = $iframeHandler->getObjects($critere); |
|
| 260 | - $class = 'even'; |
|
| 261 | - $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'; |
|
| 262 | - if (count($frarray) > 0) { |
|
| 263 | - /** @var Myiframe $frame */ |
|
| 264 | - foreach ($frarray as $frame) { |
|
| 265 | - $action_edit = "<a href='" . $baseurl . '?op=edit&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/edit.png' alt='" . _AM_MYIFRAME_EDIT . "'></a>"; |
|
| 266 | - $action_delete = "<a href='" . $baseurl . '?op=delete&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/delete.png' alt='" . _AM_MYIFRAME_DELETE . "'></a>"; |
|
| 267 | - if (xoops_trim($frame->getVar('frame_description')) === '') { |
|
| 268 | - $liendesc = $frame->getVar('frame_url'); |
|
| 269 | - } else { |
|
| 270 | - $liendesc = "<a href='" . XOOPS_URL . '/modules/myiframe/index.php?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>'; |
|
| 271 | - } |
|
| 272 | - echo "<tr class='" |
|
| 273 | - . $class |
|
| 274 | - . "'><td align='center'>" |
|
| 275 | - . $frame->getVar('frame_frameid') |
|
| 276 | - . "</td><td align='center'>" |
|
| 277 | - . $liendesc |
|
| 278 | - . "</td><td align='center'>" |
|
| 279 | - . formatTimestamp($frame->getVar('frame_created')) |
|
| 280 | - . "</td><td align='center'>" |
|
| 281 | - . $frame->getVar('frame_hits') |
|
| 282 | - . "</td><td align='center'>" |
|
| 283 | - . $action_edit |
|
| 284 | - . ' - ' |
|
| 285 | - . $action_delete |
|
| 286 | - . "</td></tr>\n"; |
|
| 287 | - $class = ($class === 'even') ? 'odd' : 'even'; |
|
| 288 | - } |
|
| 289 | - } |
|
| 290 | - echo "<tr class='" . $class . "'><td colspan='5' align='center'><form name='faddframe' method='post' action='manage.php'><input type='hidden' name='op' value='addframe'><input type='submit' name='submit' value='" . _AM_MYIFRAME_ADD . "'></td></tr>"; |
|
| 291 | - echo '</table>'; |
|
| 292 | - include_once __DIR__ . '/admin_footer.php'; |
|
| 293 | - break; |
|
| 249 | + case 'default': |
|
| 250 | + default: |
|
| 251 | + xoops_cp_header(); |
|
| 252 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 253 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 254 | + echo '<h4>' . _AM_MYIFRAME_CONFIG . "</h4><br />\n"; |
|
| 255 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>\n"; |
|
| 256 | + echo "<tr><th align='center'>" . _AM_MYIFRAME_ID . "</th><th align='center'>" . _AM_MYIFRAME_DESC . "</th><th align='center'>" . _AM_MYIFRAME_CREATED . "</th><th align='center'>" . _AM_MYIFRAME_HITS . "</th><th align='center'>" . _AM_MYIFRAME_ACTION . "</th></tr>\n"; |
|
| 257 | + $critere = new Criteria('1', '1', '='); |
|
| 258 | + $critere->setSort('frame_description'); |
|
| 259 | + $frarray = $iframeHandler->getObjects($critere); |
|
| 260 | + $class = 'even'; |
|
| 261 | + $baseurl = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/manage.php'; |
|
| 262 | + if (count($frarray) > 0) { |
|
| 263 | + /** @var Myiframe $frame */ |
|
| 264 | + foreach ($frarray as $frame) { |
|
| 265 | + $action_edit = "<a href='" . $baseurl . '?op=edit&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/edit.png' alt='" . _AM_MYIFRAME_EDIT . "'></a>"; |
|
| 266 | + $action_delete = "<a href='" . $baseurl . '?op=delete&frameid=' . $frame->getVar('frame_frameid') . "'><img src='../assets/images/delete.png' alt='" . _AM_MYIFRAME_DELETE . "'></a>"; |
|
| 267 | + if (xoops_trim($frame->getVar('frame_description')) === '') { |
|
| 268 | + $liendesc = $frame->getVar('frame_url'); |
|
| 269 | + } else { |
|
| 270 | + $liendesc = "<a href='" . XOOPS_URL . '/modules/myiframe/index.php?iframeid=' . $frame->getVar('frame_frameid') . "'>" . $frame->getVar('frame_description') . '</a>'; |
|
| 271 | + } |
|
| 272 | + echo "<tr class='" |
|
| 273 | + . $class |
|
| 274 | + . "'><td align='center'>" |
|
| 275 | + . $frame->getVar('frame_frameid') |
|
| 276 | + . "</td><td align='center'>" |
|
| 277 | + . $liendesc |
|
| 278 | + . "</td><td align='center'>" |
|
| 279 | + . formatTimestamp($frame->getVar('frame_created')) |
|
| 280 | + . "</td><td align='center'>" |
|
| 281 | + . $frame->getVar('frame_hits') |
|
| 282 | + . "</td><td align='center'>" |
|
| 283 | + . $action_edit |
|
| 284 | + . ' - ' |
|
| 285 | + . $action_delete |
|
| 286 | + . "</td></tr>\n"; |
|
| 287 | + $class = ($class === 'even') ? 'odd' : 'even'; |
|
| 288 | + } |
|
| 289 | + } |
|
| 290 | + echo "<tr class='" . $class . "'><td colspan='5' align='center'><form name='faddframe' method='post' action='manage.php'><input type='hidden' name='op' value='addframe'><input type='submit' name='submit' value='" . _AM_MYIFRAME_ADD . "'></td></tr>"; |
|
| 291 | + echo '</table>'; |
|
| 292 | + include_once __DIR__ . '/admin_footer.php'; |
|
| 293 | + break; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | xoops_cp_footer(); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | if (!defined('XOOPS_ROOT_PATH')) { |
| 10 | - die('XOOPS root path not defined'); |
|
| 10 | + die('XOOPS root path not defined'); |
|
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -24,32 +24,32 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | function myiframe_getmoduleoption($option, $repmodule = 'myiframe') |
| 26 | 26 | { |
| 27 | - global $xoopsModuleConfig, $xoopsModule; |
|
| 28 | - static $tbloptions = []; |
|
| 29 | - if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) { |
|
| 30 | - return $tbloptions[$option]; |
|
| 31 | - } |
|
| 27 | + global $xoopsModuleConfig, $xoopsModule; |
|
| 28 | + static $tbloptions = []; |
|
| 29 | + if (is_array($tbloptions) && array_key_exists($option, $tbloptions)) { |
|
| 30 | + return $tbloptions[$option]; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $retval = false; |
|
| 34 | - if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { |
|
| 35 | - if (isset($xoopsModuleConfig[$option])) { |
|
| 36 | - $retval = $xoopsModuleConfig[$option]; |
|
| 37 | - } |
|
| 38 | - } else { |
|
| 39 | - /** @var \XoopsModuleHandler $moduleHandler */ |
|
| 40 | - $moduleHandler = xoops_getHandler('module'); |
|
| 41 | - $module = $moduleHandler->getByDirname($repmodule); |
|
| 42 | - /** @var \XoopsConfigHandler $configHandler */ |
|
| 43 | - $configHandler = xoops_getHandler('config'); |
|
| 44 | - if ($module) { |
|
| 45 | - $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
| 46 | - if (isset($moduleConfig[$option])) { |
|
| 47 | - $retval = $moduleConfig[$option]; |
|
| 48 | - } |
|
| 49 | - } |
|
| 50 | - } |
|
| 51 | - $tbloptions[$option] = $retval; |
|
| 52 | - return $retval; |
|
| 33 | + $retval = false; |
|
| 34 | + if (isset($xoopsModuleConfig) && (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $repmodule && $xoopsModule->getVar('isactive'))) { |
|
| 35 | + if (isset($xoopsModuleConfig[$option])) { |
|
| 36 | + $retval = $xoopsModuleConfig[$option]; |
|
| 37 | + } |
|
| 38 | + } else { |
|
| 39 | + /** @var \XoopsModuleHandler $moduleHandler */ |
|
| 40 | + $moduleHandler = xoops_getHandler('module'); |
|
| 41 | + $module = $moduleHandler->getByDirname($repmodule); |
|
| 42 | + /** @var \XoopsConfigHandler $configHandler */ |
|
| 43 | + $configHandler = xoops_getHandler('config'); |
|
| 44 | + if ($module) { |
|
| 45 | + $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
|
| 46 | + if (isset($moduleConfig[$option])) { |
|
| 47 | + $retval = $moduleConfig[$option]; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | + } |
|
| 51 | + $tbloptions[$option] = $retval; |
|
| 52 | + return $retval; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | function myiframe_FieldExists($fieldname, $table) |
| 66 | 66 | { |
| 67 | - $result = $GLOBALS['xoopsDB']->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
|
| 68 | - return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); |
|
| 67 | + $result = $GLOBALS['xoopsDB']->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); |
|
| 68 | + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function myiframe_set_metas($page_title = '', $meta_description = '', $meta_keywords = '') |
| 85 | 85 | { |
| 86 | - global $xoTheme, $xoTheme, $xoopsTpl; |
|
| 87 | - $xoopsTpl->assign('xoops_pagetitle', $page_title); |
|
| 88 | - if (isset($xoTheme) && is_object($xoTheme)) { |
|
| 89 | - if (!empty($meta_keywords)) { |
|
| 90 | - $xoTheme->addMeta('meta', 'keywords', $meta_keywords); |
|
| 91 | - } |
|
| 92 | - if (!empty($meta_description)) { |
|
| 93 | - $xoTheme->addMeta('meta', 'description', $meta_description); |
|
| 94 | - } |
|
| 95 | - } elseif (isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions |
|
| 96 | - if (!empty($meta_keywords)) { |
|
| 97 | - $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); |
|
| 98 | - } |
|
| 99 | - if (!empty($meta_description)) { |
|
| 100 | - $xoopsTpl->assign('xoops_meta_description', $meta_description); |
|
| 101 | - } |
|
| 102 | - } |
|
| 86 | + global $xoTheme, $xoTheme, $xoopsTpl; |
|
| 87 | + $xoopsTpl->assign('xoops_pagetitle', $page_title); |
|
| 88 | + if (isset($xoTheme) && is_object($xoTheme)) { |
|
| 89 | + if (!empty($meta_keywords)) { |
|
| 90 | + $xoTheme->addMeta('meta', 'keywords', $meta_keywords); |
|
| 91 | + } |
|
| 92 | + if (!empty($meta_description)) { |
|
| 93 | + $xoTheme->addMeta('meta', 'description', $meta_description); |
|
| 94 | + } |
|
| 95 | + } elseif (isset($xoopsTpl) && is_object($xoopsTpl)) { // Compatibility for old Xoops versions |
|
| 96 | + if (!empty($meta_keywords)) { |
|
| 97 | + $xoopsTpl->assign('xoops_meta_keywords', $meta_keywords); |
|
| 98 | + } |
|
| 99 | + if (!empty($meta_description)) { |
|
| 100 | + $xoopsTpl->assign('xoops_meta_description', $meta_description); |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | 103 | } |
@@ -9,93 +9,93 @@ |
||
| 9 | 9 | use Xmf\Request; |
| 10 | 10 | |
| 11 | 11 | if (!defined('XOOPS_ROOT_PATH')) { |
| 12 | - die('XOOPS root path not defined'); |
|
| 12 | + die('XOOPS root path not defined'); |
|
| 13 | 13 | } |
| 14 | 14 | $modversion = [ |
| 15 | - 'version' => 1.66, |
|
| 16 | - 'module_status' => 'Beta 1', |
|
| 17 | - 'release_date' => '2017/08/04', |
|
| 18 | - 'name' => _MI_MYIFRAME_NAME, |
|
| 19 | - 'description' => _MI_MYIFRAME_DESC, |
|
| 20 | - 'credits' => '', |
|
| 21 | - 'author' => 'Instant Zero - http://xoops.instant-zero.com', |
|
| 22 | - 'help' => '', |
|
| 23 | - 'license' => 'GPL see LICENSE', |
|
| 24 | - 'official' => 0, |
|
| 25 | - 'image' => 'assets/images/logoModule.png', |
|
| 26 | - 'dirname' => basename(__DIR__), |
|
| 27 | - 'min_php' => '5.5', |
|
| 28 | - 'min_db' => ['mysql' => '5.5'], |
|
| 29 | - 'min_xoops' => '2.5.8+', |
|
| 30 | - 'min_admin' => '1.2', |
|
| 31 | - 'module_website_url' => 'www.xoops.org', |
|
| 32 | - 'module_website_name' => 'XOOPS', |
|
| 33 | - 'module_release' => '05/07/2017', |
|
| 34 | - 'system_menu' => 1, |
|
| 35 | - //sql tables |
|
| 36 | - 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
|
| 37 | - 'tables' => [ |
|
| 38 | - 'myiframe' |
|
| 39 | - ], |
|
| 40 | - // Admin |
|
| 41 | - 'hasAdmin' => 1, |
|
| 42 | - 'adminindex' => 'admin/index.php', |
|
| 43 | - 'adminmenu' => 'admin/menu.php', |
|
| 44 | - // Menu |
|
| 45 | - 'hasMain' => 1 |
|
| 15 | + 'version' => 1.66, |
|
| 16 | + 'module_status' => 'Beta 1', |
|
| 17 | + 'release_date' => '2017/08/04', |
|
| 18 | + 'name' => _MI_MYIFRAME_NAME, |
|
| 19 | + 'description' => _MI_MYIFRAME_DESC, |
|
| 20 | + 'credits' => '', |
|
| 21 | + 'author' => 'Instant Zero - http://xoops.instant-zero.com', |
|
| 22 | + 'help' => '', |
|
| 23 | + 'license' => 'GPL see LICENSE', |
|
| 24 | + 'official' => 0, |
|
| 25 | + 'image' => 'assets/images/logoModule.png', |
|
| 26 | + 'dirname' => basename(__DIR__), |
|
| 27 | + 'min_php' => '5.5', |
|
| 28 | + 'min_db' => ['mysql' => '5.5'], |
|
| 29 | + 'min_xoops' => '2.5.8+', |
|
| 30 | + 'min_admin' => '1.2', |
|
| 31 | + 'module_website_url' => 'www.xoops.org', |
|
| 32 | + 'module_website_name' => 'XOOPS', |
|
| 33 | + 'module_release' => '05/07/2017', |
|
| 34 | + 'system_menu' => 1, |
|
| 35 | + //sql tables |
|
| 36 | + 'sqlfile' => ['mysql' => 'sql/mysql.sql'], |
|
| 37 | + 'tables' => [ |
|
| 38 | + 'myiframe' |
|
| 39 | + ], |
|
| 40 | + // Admin |
|
| 41 | + 'hasAdmin' => 1, |
|
| 42 | + 'adminindex' => 'admin/index.php', |
|
| 43 | + 'adminmenu' => 'admin/menu.php', |
|
| 44 | + // Menu |
|
| 45 | + 'hasMain' => 1 |
|
| 46 | 46 | ]; |
| 47 | 47 | // Templates |
| 48 | 48 | $modversion['templates'] = [ |
| 49 | - [ |
|
| 50 | - 'file' => 'myiframe.tpl', |
|
| 51 | - 'description' => 'Default template' |
|
| 52 | - ], |
|
| 49 | + [ |
|
| 50 | + 'file' => 'myiframe.tpl', |
|
| 51 | + 'description' => 'Default template' |
|
| 52 | + ], |
|
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | 55 | //Blocks |
| 56 | 56 | $modversion['blocks'][] = [ |
| 57 | - 'file' => 'myiframe_iframe.php', |
|
| 58 | - 'name' => _MI_MYIFAME_BNAME1, |
|
| 59 | - 'description' => 'Shows an iframe in a block', |
|
| 60 | - 'show_func' => 'b_myiframe_iframe_show', |
|
| 61 | - 'edit_func' => 'b_myiframe_iframe_edit', |
|
| 62 | - 'options' => '0', |
|
| 63 | - 'template' => 'myiframe_block_show.tpl' |
|
| 57 | + 'file' => 'myiframe_iframe.php', |
|
| 58 | + 'name' => _MI_MYIFAME_BNAME1, |
|
| 59 | + 'description' => 'Shows an iframe in a block', |
|
| 60 | + 'show_func' => 'b_myiframe_iframe_show', |
|
| 61 | + 'edit_func' => 'b_myiframe_iframe_edit', |
|
| 62 | + 'options' => '0', |
|
| 63 | + 'template' => 'myiframe_block_show.tpl' |
|
| 64 | 64 | ]; |
| 65 | 65 | global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsModuleConfig; |
| 66 | 66 | |
| 67 | 67 | if (is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $modversion['dirname'] && $xoopsModule->getVar('isactive')) { |
| 68 | - $i = 0; |
|
| 69 | - include_once XOOPS_ROOT_PATH . '/modules/myiframe/include/functions.php'; |
|
| 70 | - $myts = MyTextSanitizer::getInstance(); |
|
| 71 | - if (myiframe_getmoduleoption('showinmenu')) { |
|
| 72 | - $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' ORDER BY frame_description'; |
|
| 73 | - $result = $GLOBALS['xoopsDB']->query($sql); |
|
| 74 | - while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 75 | - if (xoops_trim($myrow['frame_description']) !== '') { |
|
| 76 | - $modversion['sub'][$i]['name'] = $myts->htmlSpecialChars($myrow['frame_description']); |
|
| 77 | - $modversion['sub'][$i]['url'] = 'index.php?iframeid=' . (int)$myrow['frame_frameid']; |
|
| 78 | - $i++; |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 68 | + $i = 0; |
|
| 69 | + include_once XOOPS_ROOT_PATH . '/modules/myiframe/include/functions.php'; |
|
| 70 | + $myts = MyTextSanitizer::getInstance(); |
|
| 71 | + if (myiframe_getmoduleoption('showinmenu')) { |
|
| 72 | + $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('myiframe') . ' ORDER BY frame_description'; |
|
| 73 | + $result = $GLOBALS['xoopsDB']->query($sql); |
|
| 74 | + while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
| 75 | + if (xoops_trim($myrow['frame_description']) !== '') { |
|
| 76 | + $modversion['sub'][$i]['name'] = $myts->htmlSpecialChars($myrow['frame_description']); |
|
| 77 | + $modversion['sub'][$i]['url'] = 'index.php?iframeid=' . (int)$myrow['frame_frameid']; |
|
| 78 | + $i++; |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | } |
| 83 | 83 | // Options |
| 84 | 84 | $modversion['config'][] = [ |
| 85 | - 'name' => 'showinmenu', |
|
| 86 | - 'title' => '_MI_MYIFRAME_OPT0', |
|
| 87 | - 'description' => '_MI_MYIFRAME_OPT0_DSC', |
|
| 88 | - 'formtype' => 'yesno', |
|
| 89 | - 'valuetype' => 'int', |
|
| 90 | - 'default' => 0, |
|
| 85 | + 'name' => 'showinmenu', |
|
| 86 | + 'title' => '_MI_MYIFRAME_OPT0', |
|
| 87 | + 'description' => '_MI_MYIFRAME_OPT0_DSC', |
|
| 88 | + 'formtype' => 'yesno', |
|
| 89 | + 'valuetype' => 'int', |
|
| 90 | + 'default' => 0, |
|
| 91 | 91 | ]; |
| 92 | 92 | $modversion['config'][] = [ |
| 93 | - 'name' => 'showlist', |
|
| 94 | - 'title' => '_MI_MYIFRAME_OPT1', |
|
| 95 | - 'description' => '_MI_MYIFRAME_OPT1_DSC', |
|
| 96 | - 'formtype' => 'yesno', |
|
| 97 | - 'valuetype' => 'int', |
|
| 98 | - 'default' => 1, |
|
| 93 | + 'name' => 'showlist', |
|
| 94 | + 'title' => '_MI_MYIFRAME_OPT1', |
|
| 95 | + 'description' => '_MI_MYIFRAME_OPT1_DSC', |
|
| 96 | + 'formtype' => 'yesno', |
|
| 97 | + 'valuetype' => 'int', |
|
| 98 | + 'default' => 1, |
|
| 99 | 99 | ]; |
| 100 | 100 | // Search |
| 101 | 101 | $modversion['hasSearch'] = 0; |