@@ -37,1043 +37,1043 @@ |
||
| 37 | 37 | |
| 38 | 38 | $moddir = $xoopsModule->getVar('dirname'); |
| 39 | 39 | if (isset($_GET['dirid'])) { |
| 40 | - $get_dirid = (int)$_GET['dirid']; |
|
| 40 | + $get_dirid = (int)$_GET['dirid']; |
|
| 41 | 41 | } else { |
| 42 | - $get_dirid = 0; |
|
| 42 | + $get_dirid = 0; |
|
| 43 | 43 | } |
| 44 | 44 | if (isset($_GET['dtypeid'])) { |
| 45 | - $get_dtypeid = (int)$_GET['dtypeid']; |
|
| 45 | + $get_dtypeid = (int)$_GET['dtypeid']; |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($_GET['catid'])) { |
| 48 | - $get_catid = (int)$_GET['catid']; |
|
| 48 | + $get_catid = (int)$_GET['catid']; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function catConfig($dirid = '0') |
| 52 | 52 | { |
| 53 | - global $xoopsDB, $xoopsModule, $xoopsUser, $mytree, $efqtree; |
|
| 54 | - if ($dirid == '0') { |
|
| 55 | - redirect_header('directories.php', 2, _MD_NOVALIDDIR); |
|
| 56 | - exit(); |
|
| 57 | - } |
|
| 58 | - xoops_cp_header(); |
|
| 59 | - //adminmenu(-1, _MD_MANAGE_CATS); |
|
| 60 | - $dirname = getDirNameFromId($dirid); |
|
| 61 | - echo '<h4>' . _MD_CATCONF . ' - ' . $dirname . '</h4>'; |
|
| 62 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 63 | - //Get all main categories for this directory. |
|
| 64 | - $cats = getCatOverview(); |
|
| 65 | - echo $cats; |
|
| 66 | - echo '</table>'; |
|
| 67 | - echo '<br>'; |
|
| 68 | - echo '<h4>' . _MD_CREATE_NEWCAT . '</h4>'; |
|
| 69 | - echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 70 | - $form = new XoopsThemeForm(_MD_NEWCATFORM, 'submitform', 'categories.php'); |
|
| 71 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 72 | - $form->addElement(new XoopsFormText(_MD_CATTITLE, 'title', 50, 100, ''), true); |
|
| 73 | - $form_active = new XoopsFormCheckBox(_MD_ACTIVEYN, 'active', ''); |
|
| 74 | - $form_active->addOption(1, _MD_YESNO); |
|
| 75 | - $form->addElement($form_active); |
|
| 76 | - $form_importdtypes = new XoopsFormCheckBox(_MD_IMPORT_DTYPES_YN, 'importdtypes', ''); |
|
| 77 | - $form_importdtypes->addOption(1, _MD_YESNO); |
|
| 78 | - $form->addElement($form_importdtypes); |
|
| 79 | - $form_allowlist = new XoopsFormCheckBox(_MD_ALLOWLISTYN, 'allowlist', ''); |
|
| 80 | - $form_allowlist->addOption(1, _MD_YESNO); |
|
| 81 | - $form->addElement($form_allowlist); |
|
| 82 | - $form_showpopular = new XoopsFormCheckBox(_MD_SHOWPOPULARYN, 'showpopular', ''); |
|
| 83 | - $form_showpopular->addOption(1, _MD_YESNO); |
|
| 84 | - $form->addElement($form_showpopular); |
|
| 85 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'descr', '', 5, 50)); |
|
| 86 | - //Add parent category select box. |
|
| 87 | - ob_start(); |
|
| 88 | - $efqtree->setDir($dirid); |
|
| 89 | - $pcat_selbox = $efqtree->makeMySelBox('title', 'title', '', 1, 'pid'); |
|
| 90 | - $selbox = ob_get_contents(); |
|
| 91 | - ob_end_clean(); |
|
| 92 | - $pcat_tray = new XoopsFormElementTray(_MD_PARENTCAT, '<br>'); |
|
| 93 | - $pcat_tray->addElement(new XoopsFormLabel('', $selbox)); |
|
| 94 | - $form->addElement($pcat_tray); |
|
| 95 | - $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
|
| 96 | - $form_txtactive = new XoopsFormCheckBox(_MD_CATTEXT_ACTIVE_YN, 'open', 0); |
|
| 97 | - $form_txtactive->addOption(1, _MD_YESNO); |
|
| 98 | - $form->addElement($form_txtactive); |
|
| 99 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 100 | - $form->addElement(new XoopsFormHidden('op', 'newcat')); |
|
| 101 | - $form->addElement(new XoopsFormHidden('dirid', $dirid)); |
|
| 102 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 103 | - $form->display(); |
|
| 104 | - echo '</td></tr></table>'; |
|
| 105 | - xoops_cp_footer(); |
|
| 53 | + global $xoopsDB, $xoopsModule, $xoopsUser, $mytree, $efqtree; |
|
| 54 | + if ($dirid == '0') { |
|
| 55 | + redirect_header('directories.php', 2, _MD_NOVALIDDIR); |
|
| 56 | + exit(); |
|
| 57 | + } |
|
| 58 | + xoops_cp_header(); |
|
| 59 | + //adminmenu(-1, _MD_MANAGE_CATS); |
|
| 60 | + $dirname = getDirNameFromId($dirid); |
|
| 61 | + echo '<h4>' . _MD_CATCONF . ' - ' . $dirname . '</h4>'; |
|
| 62 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 63 | + //Get all main categories for this directory. |
|
| 64 | + $cats = getCatOverview(); |
|
| 65 | + echo $cats; |
|
| 66 | + echo '</table>'; |
|
| 67 | + echo '<br>'; |
|
| 68 | + echo '<h4>' . _MD_CREATE_NEWCAT . '</h4>'; |
|
| 69 | + echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 70 | + $form = new XoopsThemeForm(_MD_NEWCATFORM, 'submitform', 'categories.php'); |
|
| 71 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 72 | + $form->addElement(new XoopsFormText(_MD_CATTITLE, 'title', 50, 100, ''), true); |
|
| 73 | + $form_active = new XoopsFormCheckBox(_MD_ACTIVEYN, 'active', ''); |
|
| 74 | + $form_active->addOption(1, _MD_YESNO); |
|
| 75 | + $form->addElement($form_active); |
|
| 76 | + $form_importdtypes = new XoopsFormCheckBox(_MD_IMPORT_DTYPES_YN, 'importdtypes', ''); |
|
| 77 | + $form_importdtypes->addOption(1, _MD_YESNO); |
|
| 78 | + $form->addElement($form_importdtypes); |
|
| 79 | + $form_allowlist = new XoopsFormCheckBox(_MD_ALLOWLISTYN, 'allowlist', ''); |
|
| 80 | + $form_allowlist->addOption(1, _MD_YESNO); |
|
| 81 | + $form->addElement($form_allowlist); |
|
| 82 | + $form_showpopular = new XoopsFormCheckBox(_MD_SHOWPOPULARYN, 'showpopular', ''); |
|
| 83 | + $form_showpopular->addOption(1, _MD_YESNO); |
|
| 84 | + $form->addElement($form_showpopular); |
|
| 85 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'descr', '', 5, 50)); |
|
| 86 | + //Add parent category select box. |
|
| 87 | + ob_start(); |
|
| 88 | + $efqtree->setDir($dirid); |
|
| 89 | + $pcat_selbox = $efqtree->makeMySelBox('title', 'title', '', 1, 'pid'); |
|
| 90 | + $selbox = ob_get_contents(); |
|
| 91 | + ob_end_clean(); |
|
| 92 | + $pcat_tray = new XoopsFormElementTray(_MD_PARENTCAT, '<br>'); |
|
| 93 | + $pcat_tray->addElement(new XoopsFormLabel('', $selbox)); |
|
| 94 | + $form->addElement($pcat_tray); |
|
| 95 | + $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
|
| 96 | + $form_txtactive = new XoopsFormCheckBox(_MD_CATTEXT_ACTIVE_YN, 'open', 0); |
|
| 97 | + $form_txtactive->addOption(1, _MD_YESNO); |
|
| 98 | + $form->addElement($form_txtactive); |
|
| 99 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 100 | + $form->addElement(new XoopsFormHidden('op', 'newcat')); |
|
| 101 | + $form->addElement(new XoopsFormHidden('dirid', $dirid)); |
|
| 102 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 103 | + $form->display(); |
|
| 104 | + echo '</td></tr></table>'; |
|
| 105 | + xoops_cp_footer(); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | function editCat($catid = '0') |
| 109 | 109 | { |
| 110 | - global $xoopsDB, $efqtree, $mytree, $mytree2, $xoopsUser, $get_catid, $eh, $myts; |
|
| 111 | - xoops_cp_header(); |
|
| 112 | - $diridfromcatid = getDirId($get_catid); |
|
| 113 | - //adminmenu(-1, _MD_EDITCAT); |
|
| 114 | - echo '<h4>' . _MD_EDITCAT . '</h4>'; |
|
| 115 | - $pathstring = "<a href='categories.php?dirid=$diridfromcatid'>" . _MD_MAIN . '</a> : '; |
|
| 116 | - $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'categories.php?op=edit'); |
|
| 117 | - echo $pathstring . '<br><br>'; |
|
| 110 | + global $xoopsDB, $efqtree, $mytree, $mytree2, $xoopsUser, $get_catid, $eh, $myts; |
|
| 111 | + xoops_cp_header(); |
|
| 112 | + $diridfromcatid = getDirId($get_catid); |
|
| 113 | + //adminmenu(-1, _MD_EDITCAT); |
|
| 114 | + echo '<h4>' . _MD_EDITCAT . '</h4>'; |
|
| 115 | + $pathstring = "<a href='categories.php?dirid=$diridfromcatid'>" . _MD_MAIN . '</a> : '; |
|
| 116 | + $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'categories.php?op=edit'); |
|
| 117 | + echo $pathstring . '<br><br>'; |
|
| 118 | 118 | |
| 119 | - $catchildren = $mytree->getFirstChild($get_catid); |
|
| 120 | - $count_subcats = count($catchildren); |
|
| 121 | - if ($count_subcats != 0) { |
|
| 122 | - $subcategories = ''; |
|
| 123 | - echo '<strong>' . _MD_SUBCATEGORIES . '</strong>:<br>'; |
|
| 124 | - for ($i = 0; $i < $count_subcats; ++$i) { |
|
| 125 | - $subcategories .= "<a href='categories.php?op=edit&catid=" . $catchildren[$i]['cid'] . '\'>' . $catchildren[$i]['title'] . '</a>'; |
|
| 126 | - if ($i + 1 != $count_subcats) { |
|
| 127 | - $subcategories .= ', '; |
|
| 128 | - } |
|
| 129 | - } |
|
| 130 | - echo $subcategories . '<br><br>'; |
|
| 131 | - } |
|
| 119 | + $catchildren = $mytree->getFirstChild($get_catid); |
|
| 120 | + $count_subcats = count($catchildren); |
|
| 121 | + if ($count_subcats != 0) { |
|
| 122 | + $subcategories = ''; |
|
| 123 | + echo '<strong>' . _MD_SUBCATEGORIES . '</strong>:<br>'; |
|
| 124 | + for ($i = 0; $i < $count_subcats; ++$i) { |
|
| 125 | + $subcategories .= "<a href='categories.php?op=edit&catid=" . $catchildren[$i]['cid'] . '\'>' . $catchildren[$i]['title'] . '</a>'; |
|
| 126 | + if ($i + 1 != $count_subcats) { |
|
| 127 | + $subcategories .= ', '; |
|
| 128 | + } |
|
| 129 | + } |
|
| 130 | + echo $subcategories . '<br><br>'; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 134 | - $result = $xoopsDB->query('SELECT c.cid, c.dirid, c.title, c.active, c.pid, c.img, c.allowlist, c.showpopular, c.height, c.width, t.text FROM ' |
|
| 135 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') |
|
| 136 | - . ' c LEFT JOIN ' |
|
| 137 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 138 | - . '_cat_txt') |
|
| 139 | - . " t ON (c.cid=t.cid) WHERE c.cid='" |
|
| 140 | - . $catid |
|
| 141 | - . '\''); |
|
| 142 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 143 | - if ($numrows > 0) { |
|
| 144 | - while (list($cid, $dirid, $title, $active, $pid, $img, $allowlist, $showpopular, $imgheight, $imgwidth, $descr) = $xoopsDB->fetchRow($result)) { |
|
| 145 | - $title = $myts->htmlSpecialChars($title); |
|
| 146 | - $parentcat = $pid; |
|
| 147 | - if ($img != '') { |
|
| 148 | - $picture = "../uploads/$img"; |
|
| 149 | - } else { |
|
| 150 | - $picture = '../uploads/dummy.png'; |
|
| 151 | - } |
|
| 152 | - $form = new XoopsThemeForm(_MD_EDITCATFORM, 'editform', 'categories.php'); |
|
| 153 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 154 | - $form->addElement(new XoopsFormText(_MD_CATTITLE, 'title', 50, 100, "$title"), true); |
|
| 155 | - $form_active = new XoopsFormCheckBox(_MD_ACTIVEYN, 'active', $active); |
|
| 156 | - $form_active->addOption(1, _MD_YESNO); |
|
| 157 | - $form->addElement($form_active); |
|
| 158 | - $form_allowlist = new XoopsFormCheckBox(_MD_ALLOWLISTYN, 'allowlist', $allowlist); |
|
| 159 | - $form_allowlist->addOption(1, _MD_YESNO); |
|
| 160 | - $form->addElement($form_allowlist); |
|
| 161 | - $form_showpopular = new XoopsFormCheckBox(_MD_SHOWPOPULARYN, 'showpopular', $showpopular); |
|
| 162 | - $form_showpopular->addOption(1, _MD_YESNO); |
|
| 163 | - $form->addElement($form_showpopular); |
|
| 164 | - //Add parent category select box. |
|
| 165 | - ob_start(); |
|
| 166 | - $pcat_selbox = $mytree->makeMySelBox('title', 'title', $pid, 1, 'pid'); |
|
| 167 | - $selbox = ob_get_contents(); |
|
| 168 | - ob_end_clean(); |
|
| 169 | - $pcat_tray = new XoopsFormElementTray(_MD_PARENTCAT, '<br>'); |
|
| 170 | - $pcat_tray->addElement(new XoopsFormLabel('', $selbox)); |
|
| 171 | - $form->addElement($pcat_tray); |
|
| 133 | + echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 134 | + $result = $xoopsDB->query('SELECT c.cid, c.dirid, c.title, c.active, c.pid, c.img, c.allowlist, c.showpopular, c.height, c.width, t.text FROM ' |
|
| 135 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') |
|
| 136 | + . ' c LEFT JOIN ' |
|
| 137 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 138 | + . '_cat_txt') |
|
| 139 | + . " t ON (c.cid=t.cid) WHERE c.cid='" |
|
| 140 | + . $catid |
|
| 141 | + . '\''); |
|
| 142 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 143 | + if ($numrows > 0) { |
|
| 144 | + while (list($cid, $dirid, $title, $active, $pid, $img, $allowlist, $showpopular, $imgheight, $imgwidth, $descr) = $xoopsDB->fetchRow($result)) { |
|
| 145 | + $title = $myts->htmlSpecialChars($title); |
|
| 146 | + $parentcat = $pid; |
|
| 147 | + if ($img != '') { |
|
| 148 | + $picture = "../uploads/$img"; |
|
| 149 | + } else { |
|
| 150 | + $picture = '../uploads/dummy.png'; |
|
| 151 | + } |
|
| 152 | + $form = new XoopsThemeForm(_MD_EDITCATFORM, 'editform', 'categories.php'); |
|
| 153 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 154 | + $form->addElement(new XoopsFormText(_MD_CATTITLE, 'title', 50, 100, "$title"), true); |
|
| 155 | + $form_active = new XoopsFormCheckBox(_MD_ACTIVEYN, 'active', $active); |
|
| 156 | + $form_active->addOption(1, _MD_YESNO); |
|
| 157 | + $form->addElement($form_active); |
|
| 158 | + $form_allowlist = new XoopsFormCheckBox(_MD_ALLOWLISTYN, 'allowlist', $allowlist); |
|
| 159 | + $form_allowlist->addOption(1, _MD_YESNO); |
|
| 160 | + $form->addElement($form_allowlist); |
|
| 161 | + $form_showpopular = new XoopsFormCheckBox(_MD_SHOWPOPULARYN, 'showpopular', $showpopular); |
|
| 162 | + $form_showpopular->addOption(1, _MD_YESNO); |
|
| 163 | + $form->addElement($form_showpopular); |
|
| 164 | + //Add parent category select box. |
|
| 165 | + ob_start(); |
|
| 166 | + $pcat_selbox = $mytree->makeMySelBox('title', 'title', $pid, 1, 'pid'); |
|
| 167 | + $selbox = ob_get_contents(); |
|
| 168 | + ob_end_clean(); |
|
| 169 | + $pcat_tray = new XoopsFormElementTray(_MD_PARENTCAT, '<br>'); |
|
| 170 | + $pcat_tray->addElement(new XoopsFormLabel('', $selbox)); |
|
| 171 | + $form->addElement($pcat_tray); |
|
| 172 | 172 | |
| 173 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'descr', "$descr", 5, 50)); |
|
| 174 | - $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
|
| 175 | - $form->addElement(new XoopsFormImage(_MD_CURRENT_PIC, 'current_image', null, "$picture", $imgheight, $imgwidth)); |
|
| 176 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_UPDATE, 'submit')); |
|
| 177 | - $form->addElement(new XoopsFormHidden('op', 'update')); |
|
| 178 | - $form->addElement(new XoopsFormHidden('catid', $cid)); |
|
| 179 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 180 | - $form->display(); |
|
| 181 | - } |
|
| 182 | - } |
|
| 183 | - echo '</td></tr></table>'; |
|
| 184 | - $dellink = "<align=\"right\"><a href=\"categories.php?op=deleteCatConfirm&catid=$get_catid\"><img src=\"" . XOOPS_URL . '/images/drop.png">' . _MD_DELETE_CAT . '</a></align>'; |
|
| 185 | - echo $dellink; |
|
| 186 | - echo '<h4>' . _MD_EDITDTYPES . '</h4>'; |
|
| 187 | - echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 188 | - echo '<form name="editdtypes" id="editdtypes" action="categories.php" method="post">'; |
|
| 189 | - echo '<table width="100%" class="outer" cellspacing="1">'; |
|
| 190 | - $result = $xoopsDB->query('SELECT d.dtypeid, x.cid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 191 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 192 | - . ' d, ' |
|
| 193 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 194 | - . '_fieldtypes') |
|
| 195 | - . ' f, ' |
|
| 196 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 197 | - . " x WHERE d.fieldtypeid=f.typeid AND d.dtypeid=x.dtypeid AND x.cid='" |
|
| 198 | - . $catid |
|
| 199 | - . '\' ORDER BY d.section ASC, d.seq ASC') |
|
| 200 | - || $eh->show('0013'); |
|
| 201 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 202 | - echo '<tr><th>' . _MD_DTYPE_ICON . '</th><th>' . _MD_DTYPE_TITLE . '</th><th>' . _MD_FTYPE_NAME . '</th><th>' . _MD_OPTIONS . '</th><th>' . _MD_CUSTOM . '</th><th>' . _MD_ACTIVE . '</th><th>' . _MD_DEFAULT . '</th><th>' . _MD_DTYPE_SEQ . '</th><th>' . _MD_SECTION . '</th></tr>'; |
|
| 203 | - if ($numrows > 0) { |
|
| 204 | - $dtypes = ''; |
|
| 205 | - $count = 1; |
|
| 206 | - while (list($dtypeid, $cid, $dtypetitle, $section, $dseq, $picture, $ftypename, $ftypeid, $defaultyn, $activeyn, $options, $dcustom) = $xoopsDB->fetchRow($result)) { |
|
| 207 | - if ($defaultyn == '1') { |
|
| 208 | - $default = _MD_YES; |
|
| 209 | - $checked = ' checked'; |
|
| 210 | - } else { |
|
| 211 | - $default = _MD_NO; |
|
| 212 | - $checked = ''; |
|
| 213 | - } |
|
| 214 | - if ($activeyn == '1') { |
|
| 215 | - $default = _MD_YES; |
|
| 216 | - $activechecked = ' checked'; |
|
| 217 | - } else { |
|
| 218 | - $default = _MD_NO; |
|
| 219 | - $activechecked = ''; |
|
| 220 | - } |
|
| 221 | - if ($picture != '') { |
|
| 222 | - $iconurl = "../uploads/$picture"; |
|
| 223 | - } else { |
|
| 224 | - $iconurl = ''; |
|
| 225 | - } |
|
| 226 | - if ($dcustom == '1') { |
|
| 227 | - $custom = _MD_YES; |
|
| 228 | - } else { |
|
| 229 | - $custom = _MD_NO; |
|
| 230 | - } |
|
| 231 | - //Get the existing fields for this category. |
|
| 232 | - ob_start(); |
|
| 233 | - $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype' . $dtypeid . ''); |
|
| 234 | - $ftypebox = ob_get_contents(); |
|
| 235 | - ob_end_clean(); |
|
| 173 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'descr', "$descr", 5, 50)); |
|
| 174 | + $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
|
| 175 | + $form->addElement(new XoopsFormImage(_MD_CURRENT_PIC, 'current_image', null, "$picture", $imgheight, $imgwidth)); |
|
| 176 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_UPDATE, 'submit')); |
|
| 177 | + $form->addElement(new XoopsFormHidden('op', 'update')); |
|
| 178 | + $form->addElement(new XoopsFormHidden('catid', $cid)); |
|
| 179 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 180 | + $form->display(); |
|
| 181 | + } |
|
| 182 | + } |
|
| 183 | + echo '</td></tr></table>'; |
|
| 184 | + $dellink = "<align=\"right\"><a href=\"categories.php?op=deleteCatConfirm&catid=$get_catid\"><img src=\"" . XOOPS_URL . '/images/drop.png">' . _MD_DELETE_CAT . '</a></align>'; |
|
| 185 | + echo $dellink; |
|
| 186 | + echo '<h4>' . _MD_EDITDTYPES . '</h4>'; |
|
| 187 | + echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 188 | + echo '<form name="editdtypes" id="editdtypes" action="categories.php" method="post">'; |
|
| 189 | + echo '<table width="100%" class="outer" cellspacing="1">'; |
|
| 190 | + $result = $xoopsDB->query('SELECT d.dtypeid, x.cid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 191 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 192 | + . ' d, ' |
|
| 193 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 194 | + . '_fieldtypes') |
|
| 195 | + . ' f, ' |
|
| 196 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 197 | + . " x WHERE d.fieldtypeid=f.typeid AND d.dtypeid=x.dtypeid AND x.cid='" |
|
| 198 | + . $catid |
|
| 199 | + . '\' ORDER BY d.section ASC, d.seq ASC') |
|
| 200 | + || $eh->show('0013'); |
|
| 201 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 202 | + echo '<tr><th>' . _MD_DTYPE_ICON . '</th><th>' . _MD_DTYPE_TITLE . '</th><th>' . _MD_FTYPE_NAME . '</th><th>' . _MD_OPTIONS . '</th><th>' . _MD_CUSTOM . '</th><th>' . _MD_ACTIVE . '</th><th>' . _MD_DEFAULT . '</th><th>' . _MD_DTYPE_SEQ . '</th><th>' . _MD_SECTION . '</th></tr>'; |
|
| 203 | + if ($numrows > 0) { |
|
| 204 | + $dtypes = ''; |
|
| 205 | + $count = 1; |
|
| 206 | + while (list($dtypeid, $cid, $dtypetitle, $section, $dseq, $picture, $ftypename, $ftypeid, $defaultyn, $activeyn, $options, $dcustom) = $xoopsDB->fetchRow($result)) { |
|
| 207 | + if ($defaultyn == '1') { |
|
| 208 | + $default = _MD_YES; |
|
| 209 | + $checked = ' checked'; |
|
| 210 | + } else { |
|
| 211 | + $default = _MD_NO; |
|
| 212 | + $checked = ''; |
|
| 213 | + } |
|
| 214 | + if ($activeyn == '1') { |
|
| 215 | + $default = _MD_YES; |
|
| 216 | + $activechecked = ' checked'; |
|
| 217 | + } else { |
|
| 218 | + $default = _MD_NO; |
|
| 219 | + $activechecked = ''; |
|
| 220 | + } |
|
| 221 | + if ($picture != '') { |
|
| 222 | + $iconurl = "../uploads/$picture"; |
|
| 223 | + } else { |
|
| 224 | + $iconurl = ''; |
|
| 225 | + } |
|
| 226 | + if ($dcustom == '1') { |
|
| 227 | + $custom = _MD_YES; |
|
| 228 | + } else { |
|
| 229 | + $custom = _MD_NO; |
|
| 230 | + } |
|
| 231 | + //Get the existing fields for this category. |
|
| 232 | + ob_start(); |
|
| 233 | + $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype' . $dtypeid . ''); |
|
| 234 | + $ftypebox = ob_get_contents(); |
|
| 235 | + ob_end_clean(); |
|
| 236 | 236 | |
| 237 | - if ($count != 1) { |
|
| 238 | - $dtypes .= '|' . $dtypeid; |
|
| 239 | - } else { |
|
| 240 | - $dtypes = $dtypeid; |
|
| 241 | - } |
|
| 242 | - ++$count; |
|
| 243 | - echo "<tr><td class=\"even\"><img src=\"$iconurl\"></td><td class=\"even\"><a href=\"categories.php?op=editdtype&dtypeid=$dtypeid&catid=$get_catid\">$dtypetitle</a></td><td class=\"even\">" |
|
| 244 | - . $ftypename |
|
| 245 | - . "</td><td class=\"even\">$options</td><td class=\"even\">$custom</td><td class=\"even\"><input type=\"checkbox\" name=\"activeyn" |
|
| 246 | - . $dtypeid |
|
| 247 | - . "\"$activechecked></input></td><td class=\"even\"><input type=\"checkbox\" name=\"defaultyn" |
|
| 248 | - . $dtypeid |
|
| 249 | - . "\"$checked></input></td><td class=\"even\"><input type=\"text\" size=\"5\" maxsize=\"10\" name=\"seq" |
|
| 250 | - . $dtypeid |
|
| 251 | - . '" value="' |
|
| 252 | - . $dseq |
|
| 253 | - . '"></input></td><td class="even"><input type="text" size="5" maxsize="10" name="section' |
|
| 254 | - . $dtypeid |
|
| 255 | - . '" value="' |
|
| 256 | - . $section |
|
| 257 | - . '"></input></td></tr>'; |
|
| 258 | - } |
|
| 259 | - echo '<tr><td class="even"> </td><td class="even" colspan="8"><input type="hidden" name="op" value="editdtypes"><input type="hidden" name="catid" value="' |
|
| 260 | - . $get_catid |
|
| 261 | - . '"><input type="hidden" name="dtypes" value="' |
|
| 262 | - . $dtypes |
|
| 263 | - . '"><input type="submit" class="formButton" name="submit" id="submit" value="' |
|
| 264 | - . _MD_UPDATE |
|
| 265 | - . '" ></td></tr>'; |
|
| 266 | - } else { |
|
| 267 | - echo '<tr><td colspan="7">' . _MD_NORECORDS . ' '; |
|
| 268 | - if ($parentcat != '0') { |
|
| 269 | - echo '<input type="hidden" name="op" value="importdtypes"><input type="hidden" name="catid" value="' |
|
| 270 | - . $get_catid |
|
| 271 | - . '"><input type="hidden" name="pid" value="' |
|
| 272 | - . $parentcat |
|
| 273 | - . '"><input type="submit" class="formButton" name="submit" id="submit" value="' |
|
| 274 | - . _MD_IMPORT_DTYPES_FROM_PARENTCAT |
|
| 275 | - . '" >'; |
|
| 276 | - } |
|
| 277 | - echo '</td></tr>'; |
|
| 278 | - } |
|
| 279 | - echo '</table></form></td></tr></table>'; |
|
| 280 | - echo '<h4>' . _MD_ADDDTYPE . '</h4>'; |
|
| 281 | - echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 237 | + if ($count != 1) { |
|
| 238 | + $dtypes .= '|' . $dtypeid; |
|
| 239 | + } else { |
|
| 240 | + $dtypes = $dtypeid; |
|
| 241 | + } |
|
| 242 | + ++$count; |
|
| 243 | + echo "<tr><td class=\"even\"><img src=\"$iconurl\"></td><td class=\"even\"><a href=\"categories.php?op=editdtype&dtypeid=$dtypeid&catid=$get_catid\">$dtypetitle</a></td><td class=\"even\">" |
|
| 244 | + . $ftypename |
|
| 245 | + . "</td><td class=\"even\">$options</td><td class=\"even\">$custom</td><td class=\"even\"><input type=\"checkbox\" name=\"activeyn" |
|
| 246 | + . $dtypeid |
|
| 247 | + . "\"$activechecked></input></td><td class=\"even\"><input type=\"checkbox\" name=\"defaultyn" |
|
| 248 | + . $dtypeid |
|
| 249 | + . "\"$checked></input></td><td class=\"even\"><input type=\"text\" size=\"5\" maxsize=\"10\" name=\"seq" |
|
| 250 | + . $dtypeid |
|
| 251 | + . '" value="' |
|
| 252 | + . $dseq |
|
| 253 | + . '"></input></td><td class="even"><input type="text" size="5" maxsize="10" name="section' |
|
| 254 | + . $dtypeid |
|
| 255 | + . '" value="' |
|
| 256 | + . $section |
|
| 257 | + . '"></input></td></tr>'; |
|
| 258 | + } |
|
| 259 | + echo '<tr><td class="even"> </td><td class="even" colspan="8"><input type="hidden" name="op" value="editdtypes"><input type="hidden" name="catid" value="' |
|
| 260 | + . $get_catid |
|
| 261 | + . '"><input type="hidden" name="dtypes" value="' |
|
| 262 | + . $dtypes |
|
| 263 | + . '"><input type="submit" class="formButton" name="submit" id="submit" value="' |
|
| 264 | + . _MD_UPDATE |
|
| 265 | + . '" ></td></tr>'; |
|
| 266 | + } else { |
|
| 267 | + echo '<tr><td colspan="7">' . _MD_NORECORDS . ' '; |
|
| 268 | + if ($parentcat != '0') { |
|
| 269 | + echo '<input type="hidden" name="op" value="importdtypes"><input type="hidden" name="catid" value="' |
|
| 270 | + . $get_catid |
|
| 271 | + . '"><input type="hidden" name="pid" value="' |
|
| 272 | + . $parentcat |
|
| 273 | + . '"><input type="submit" class="formButton" name="submit" id="submit" value="' |
|
| 274 | + . _MD_IMPORT_DTYPES_FROM_PARENTCAT |
|
| 275 | + . '" >'; |
|
| 276 | + } |
|
| 277 | + echo '</td></tr>'; |
|
| 278 | + } |
|
| 279 | + echo '</table></form></td></tr></table>'; |
|
| 280 | + echo '<h4>' . _MD_ADDDTYPE . '</h4>'; |
|
| 281 | + echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 282 | 282 | |
| 283 | - $form = new XoopsThemeForm(_MD_ADD_DTYPE_FORM, 'newdatatypeform', 'categories.php'); |
|
| 284 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 285 | - $form->addElement(new XoopsFormText(_MD_DTYPE_TITLE, 'title', 50, 100, ''), true); |
|
| 286 | - $form->addElement(new XoopsFormFile(_MD_SELECT_ICON, 'image', 30000)); |
|
| 287 | - $fieldtype_tray = new XoopsFormElementTray(_MD_FTYPE_NAME, '', 'typeid'); |
|
| 288 | - ob_start(); |
|
| 289 | - $mytree2->makeMySelBox('title', 'title', 0, 1); |
|
| 290 | - $selbox = ob_get_contents(); |
|
| 291 | - ob_end_clean(); |
|
| 292 | - $options_tray = new XoopsFormElementTray(_MD_OPTIONS, ''); |
|
| 293 | - $options_text = new XoopsFormLabel('', '<br>' . _MD_OPTIONS_EXPL); |
|
| 294 | - $options_textarea = new XoopsFormTextArea('', 'options', '', 6, 50); |
|
| 295 | - $options_tray->addElement($options_textarea); |
|
| 296 | - $options_tray->addElement($options_text); |
|
| 297 | - $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox . ' <a href="fieldtypes.php">' . _MD_EDIT . '')); |
|
| 298 | - $form->addElement($fieldtype_tray, true); |
|
| 299 | - $form->addElement($options_tray); |
|
| 300 | - $form_active = new XoopsFormCheckBox(_MD_DTYPE_ACTIVEYN, 'activeyn', 0); |
|
| 301 | - $form_active->addOption(1, _MD_YESNO); |
|
| 302 | - $form->addElement($form_active); |
|
| 303 | - $form_default = new XoopsFormCheckBox(_MD_DTYPE_DEFAULTYN, 'defaultyn', 0); |
|
| 304 | - $form_default->addOption(1, _MD_YESNO); |
|
| 305 | - $form->addElement($form_default); |
|
| 306 | - $form->addElement(new XoopsFormText(_MD_DTYPE_SEQ, 'seq', 5, 10, 0), true); |
|
| 307 | - $form->addElement(new XoopsFormText(_MD_SECTION, 'section', 5, 10, 0), true); |
|
| 308 | - //$form_custom = new XoopsFormCheckBox(_MD_DTYPE_CUSTOM, "custom", ""); |
|
| 309 | - //$form_custom->addOption(1, _MD_YESNO); |
|
| 310 | - //$form->addElement($form_custom); |
|
| 311 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 312 | - $form->addElement(new XoopsFormHidden('op', 'newdatatype')); |
|
| 313 | - $form->addElement(new XoopsFormHidden('catid', $get_catid)); |
|
| 314 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 315 | - $form->display(); |
|
| 316 | - echo '</td></tr></table>'; |
|
| 317 | - echo '<br>'; |
|
| 318 | - echo '<h4>' . _MD_CREATE_NEWSUBCAT . '</h4>'; |
|
| 319 | - echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 320 | - $form = new XoopsThemeForm(_MD_NEWCATFORM, 'submitform', 'categories.php'); |
|
| 321 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 322 | - $form->addElement(new XoopsFormText(_MD_CATTITLE, 'title', 50, 100, "$title"), true); |
|
| 323 | - $form_active = new XoopsFormCheckBox(_MD_ACTIVEYN, 'active', ''); |
|
| 324 | - $form_active->addOption(1, _MD_YESNO); |
|
| 325 | - $form->addElement($form_active); |
|
| 326 | - $form_importdtypes = new XoopsFormCheckBox(_MD_IMPORT_DTYPES_YN, 'importdtypes', 1); |
|
| 327 | - $form_importdtypes->addOption(1, _MD_YESNO); |
|
| 328 | - $form->addElement($form_importdtypes); |
|
| 329 | - $form_allowlist = new XoopsFormCheckBox(_MD_ALLOWLISTYN, 'allowlist', ''); |
|
| 330 | - $form_allowlist->addOption(1, _MD_YESNO); |
|
| 331 | - $form->addElement($form_allowlist); |
|
| 332 | - $form_showpopular = new XoopsFormCheckBox(_MD_SHOWPOPULARYN, 'showpopular', ''); |
|
| 333 | - $form_showpopular->addOption(1, _MD_YESNO); |
|
| 334 | - $form->addElement($form_showpopular); |
|
| 335 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'descr', '', 5, 50)); |
|
| 336 | - ob_start(); |
|
| 337 | - $pcat_selbox = $mytree->makeMySelBox('title', 'title', "$get_catid", 0, 'pid'); |
|
| 338 | - $selbox = ob_get_contents(); |
|
| 339 | - ob_end_clean(); |
|
| 340 | - $pcat_tray = new XoopsFormElementTray(_MD_PARENTCAT, '<br>'); |
|
| 341 | - $pcat_tray->addElement(new XoopsFormLabel('', $selbox)); |
|
| 342 | - $form->addElement($pcat_tray); |
|
| 343 | - $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
|
| 344 | - $form_txtactive = new XoopsFormCheckBox(_MD_CATTEXT_ACTIVE_YN, 'open', 0); |
|
| 345 | - $form_txtactive->addOption(1, _MD_YESNO); |
|
| 346 | - $form->addElement($form_txtactive); |
|
| 347 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 348 | - $form->addElement(new XoopsFormHidden('op', 'newcat')); |
|
| 349 | - $form->addElement(new XoopsFormHidden('dirid', $diridfromcatid)); |
|
| 350 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 351 | - $form->display(); |
|
| 352 | - echo '</td></tr></table>'; |
|
| 353 | - xoops_cp_footer(); |
|
| 283 | + $form = new XoopsThemeForm(_MD_ADD_DTYPE_FORM, 'newdatatypeform', 'categories.php'); |
|
| 284 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 285 | + $form->addElement(new XoopsFormText(_MD_DTYPE_TITLE, 'title', 50, 100, ''), true); |
|
| 286 | + $form->addElement(new XoopsFormFile(_MD_SELECT_ICON, 'image', 30000)); |
|
| 287 | + $fieldtype_tray = new XoopsFormElementTray(_MD_FTYPE_NAME, '', 'typeid'); |
|
| 288 | + ob_start(); |
|
| 289 | + $mytree2->makeMySelBox('title', 'title', 0, 1); |
|
| 290 | + $selbox = ob_get_contents(); |
|
| 291 | + ob_end_clean(); |
|
| 292 | + $options_tray = new XoopsFormElementTray(_MD_OPTIONS, ''); |
|
| 293 | + $options_text = new XoopsFormLabel('', '<br>' . _MD_OPTIONS_EXPL); |
|
| 294 | + $options_textarea = new XoopsFormTextArea('', 'options', '', 6, 50); |
|
| 295 | + $options_tray->addElement($options_textarea); |
|
| 296 | + $options_tray->addElement($options_text); |
|
| 297 | + $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox . ' <a href="fieldtypes.php">' . _MD_EDIT . '')); |
|
| 298 | + $form->addElement($fieldtype_tray, true); |
|
| 299 | + $form->addElement($options_tray); |
|
| 300 | + $form_active = new XoopsFormCheckBox(_MD_DTYPE_ACTIVEYN, 'activeyn', 0); |
|
| 301 | + $form_active->addOption(1, _MD_YESNO); |
|
| 302 | + $form->addElement($form_active); |
|
| 303 | + $form_default = new XoopsFormCheckBox(_MD_DTYPE_DEFAULTYN, 'defaultyn', 0); |
|
| 304 | + $form_default->addOption(1, _MD_YESNO); |
|
| 305 | + $form->addElement($form_default); |
|
| 306 | + $form->addElement(new XoopsFormText(_MD_DTYPE_SEQ, 'seq', 5, 10, 0), true); |
|
| 307 | + $form->addElement(new XoopsFormText(_MD_SECTION, 'section', 5, 10, 0), true); |
|
| 308 | + //$form_custom = new XoopsFormCheckBox(_MD_DTYPE_CUSTOM, "custom", ""); |
|
| 309 | + //$form_custom->addOption(1, _MD_YESNO); |
|
| 310 | + //$form->addElement($form_custom); |
|
| 311 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 312 | + $form->addElement(new XoopsFormHidden('op', 'newdatatype')); |
|
| 313 | + $form->addElement(new XoopsFormHidden('catid', $get_catid)); |
|
| 314 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 315 | + $form->display(); |
|
| 316 | + echo '</td></tr></table>'; |
|
| 317 | + echo '<br>'; |
|
| 318 | + echo '<h4>' . _MD_CREATE_NEWSUBCAT . '</h4>'; |
|
| 319 | + echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
|
| 320 | + $form = new XoopsThemeForm(_MD_NEWCATFORM, 'submitform', 'categories.php'); |
|
| 321 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 322 | + $form->addElement(new XoopsFormText(_MD_CATTITLE, 'title', 50, 100, "$title"), true); |
|
| 323 | + $form_active = new XoopsFormCheckBox(_MD_ACTIVEYN, 'active', ''); |
|
| 324 | + $form_active->addOption(1, _MD_YESNO); |
|
| 325 | + $form->addElement($form_active); |
|
| 326 | + $form_importdtypes = new XoopsFormCheckBox(_MD_IMPORT_DTYPES_YN, 'importdtypes', 1); |
|
| 327 | + $form_importdtypes->addOption(1, _MD_YESNO); |
|
| 328 | + $form->addElement($form_importdtypes); |
|
| 329 | + $form_allowlist = new XoopsFormCheckBox(_MD_ALLOWLISTYN, 'allowlist', ''); |
|
| 330 | + $form_allowlist->addOption(1, _MD_YESNO); |
|
| 331 | + $form->addElement($form_allowlist); |
|
| 332 | + $form_showpopular = new XoopsFormCheckBox(_MD_SHOWPOPULARYN, 'showpopular', ''); |
|
| 333 | + $form_showpopular->addOption(1, _MD_YESNO); |
|
| 334 | + $form->addElement($form_showpopular); |
|
| 335 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'descr', '', 5, 50)); |
|
| 336 | + ob_start(); |
|
| 337 | + $pcat_selbox = $mytree->makeMySelBox('title', 'title', "$get_catid", 0, 'pid'); |
|
| 338 | + $selbox = ob_get_contents(); |
|
| 339 | + ob_end_clean(); |
|
| 340 | + $pcat_tray = new XoopsFormElementTray(_MD_PARENTCAT, '<br>'); |
|
| 341 | + $pcat_tray->addElement(new XoopsFormLabel('', $selbox)); |
|
| 342 | + $form->addElement($pcat_tray); |
|
| 343 | + $form->addElement(new XoopsFormFile(_MD_SELECT_PIC, 'img', 30000)); |
|
| 344 | + $form_txtactive = new XoopsFormCheckBox(_MD_CATTEXT_ACTIVE_YN, 'open', 0); |
|
| 345 | + $form_txtactive->addOption(1, _MD_YESNO); |
|
| 346 | + $form->addElement($form_txtactive); |
|
| 347 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 348 | + $form->addElement(new XoopsFormHidden('op', 'newcat')); |
|
| 349 | + $form->addElement(new XoopsFormHidden('dirid', $diridfromcatid)); |
|
| 350 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 351 | + $form->display(); |
|
| 352 | + echo '</td></tr></table>'; |
|
| 353 | + xoops_cp_footer(); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | function editDatatype($dtypeid = '0') |
| 357 | 357 | { |
| 358 | - global $xoopsDB, $mytree, $mytree2, $xoopsUser, $get_catid, $eh; |
|
| 359 | - xoops_cp_header(); |
|
| 360 | - //adminmenu(-1, _MD_EDITCAT); |
|
| 361 | - echo '<h4>' . _MD_EDITDTYPE . '</h4>'; |
|
| 362 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 358 | + global $xoopsDB, $mytree, $mytree2, $xoopsUser, $get_catid, $eh; |
|
| 359 | + xoops_cp_header(); |
|
| 360 | + //adminmenu(-1, _MD_EDITCAT); |
|
| 361 | + echo '<h4>' . _MD_EDITDTYPE . '</h4>'; |
|
| 362 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 363 | 363 | |
| 364 | - $result = $xoopsDB->query('SELECT d.dtypeid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 365 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 366 | - . ' d, ' |
|
| 367 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 368 | - . '_fieldtypes') |
|
| 369 | - . " f WHERE d.fieldtypeid=f.typeid AND d.dtypeid='" |
|
| 370 | - . $dtypeid |
|
| 371 | - . '\' ORDER BY d.seq ASC') |
|
| 372 | - || $eh->show('0013'); |
|
| 373 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 374 | - if ($numrows > 0) { |
|
| 375 | - while (list($dtypeid, $dtypetitle, $section, $dseq, $picture, $ftypename, $ftypeid, $defaultyn, $activeyn, $options, $dcustom) = $xoopsDB->fetchRow($result)) { |
|
| 376 | - if ($defaultyn == '1') { |
|
| 377 | - $default = _MD_YES; |
|
| 378 | - $checked = ' checked'; |
|
| 379 | - } else { |
|
| 380 | - $default = _MD_NO; |
|
| 381 | - $checked = ''; |
|
| 382 | - } |
|
| 383 | - if ($activeyn == '1') { |
|
| 384 | - $default = _MD_YES; |
|
| 385 | - $activechecked = ' checked'; |
|
| 386 | - } else { |
|
| 387 | - $default = _MD_NO; |
|
| 388 | - $activechecked = ''; |
|
| 389 | - } |
|
| 390 | - if ($picture != '') { |
|
| 391 | - $iconurl = "../uploads/$picture"; |
|
| 392 | - } else { |
|
| 393 | - $iconurl = ''; |
|
| 394 | - } |
|
| 395 | - if ($dcustom == '1') { |
|
| 396 | - $custom = '1'; |
|
| 397 | - } else { |
|
| 398 | - $custom = '0'; |
|
| 399 | - } |
|
| 400 | - ob_start(); |
|
| 401 | - $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype' . $dtypeid . ''); |
|
| 402 | - $ftypebox = ob_get_contents(); |
|
| 403 | - ob_end_clean(); |
|
| 364 | + $result = $xoopsDB->query('SELECT d.dtypeid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 365 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 366 | + . ' d, ' |
|
| 367 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 368 | + . '_fieldtypes') |
|
| 369 | + . " f WHERE d.fieldtypeid=f.typeid AND d.dtypeid='" |
|
| 370 | + . $dtypeid |
|
| 371 | + . '\' ORDER BY d.seq ASC') |
|
| 372 | + || $eh->show('0013'); |
|
| 373 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 374 | + if ($numrows > 0) { |
|
| 375 | + while (list($dtypeid, $dtypetitle, $section, $dseq, $picture, $ftypename, $ftypeid, $defaultyn, $activeyn, $options, $dcustom) = $xoopsDB->fetchRow($result)) { |
|
| 376 | + if ($defaultyn == '1') { |
|
| 377 | + $default = _MD_YES; |
|
| 378 | + $checked = ' checked'; |
|
| 379 | + } else { |
|
| 380 | + $default = _MD_NO; |
|
| 381 | + $checked = ''; |
|
| 382 | + } |
|
| 383 | + if ($activeyn == '1') { |
|
| 384 | + $default = _MD_YES; |
|
| 385 | + $activechecked = ' checked'; |
|
| 386 | + } else { |
|
| 387 | + $default = _MD_NO; |
|
| 388 | + $activechecked = ''; |
|
| 389 | + } |
|
| 390 | + if ($picture != '') { |
|
| 391 | + $iconurl = "../uploads/$picture"; |
|
| 392 | + } else { |
|
| 393 | + $iconurl = ''; |
|
| 394 | + } |
|
| 395 | + if ($dcustom == '1') { |
|
| 396 | + $custom = '1'; |
|
| 397 | + } else { |
|
| 398 | + $custom = '0'; |
|
| 399 | + } |
|
| 400 | + ob_start(); |
|
| 401 | + $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype' . $dtypeid . ''); |
|
| 402 | + $ftypebox = ob_get_contents(); |
|
| 403 | + ob_end_clean(); |
|
| 404 | 404 | |
| 405 | - $form = new XoopsThemeForm(_MD_EDIT_DTYPE_FORM, 'editdatatypeform', 'categories.php'); |
|
| 406 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 407 | - //$form_custom = new XoopsFormCheckBox(_MD_DTYPE_CUSTOM, "custom", $custom); |
|
| 408 | - //$form_custom->addOption(1, _MD_YESNO); |
|
| 409 | - //$form->addElement($form_custom); |
|
| 410 | - $form->addElement(new XoopsFormText(_MD_DTYPE_TITLE, 'title', 50, 100, $dtypetitle), true); |
|
| 411 | - $form->addElement(new XoopsFormFile(_MD_SELECT_ICON, 'image', 30000)); |
|
| 412 | - $form->addElement(new XoopsFormImage(_MD_CURRENT_ICON, 'current_image', null, $iconurl, '', '')); |
|
| 413 | - $fieldtype_tray = new XoopsFormElementTray(_MD_FTYPE_NAME, '', 'typeid'); |
|
| 414 | - ob_start(); |
|
| 415 | - $mytree2->makeMySelBox('title', 'title', $ftypeid, 1); |
|
| 416 | - $selbox = ob_get_contents(); |
|
| 417 | - ob_end_clean(); |
|
| 418 | - $options_tray = new XoopsFormElementTray(_MD_OPTIONS, ''); |
|
| 419 | - $options_text = new XoopsFormLabel('', '<br>' . _MD_OPTIONS_EXPL); |
|
| 420 | - $options_textarea = new XoopsFormTextArea('', 'options', $options, 6, 5); |
|
| 421 | - $options_tray->addElement($options_textarea); |
|
| 422 | - $options_tray->addElement($options_text); |
|
| 423 | - $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox . ' <a href="fieldtypes.php">' . _MD_EDIT . '')); |
|
| 424 | - $form->addElement($fieldtype_tray, true); |
|
| 425 | - $form->addElement($options_tray); |
|
| 426 | - $form_active = new XoopsFormCheckBox(_MD_DTYPE_ACTIVEYN, 'activeyn', $activeyn); |
|
| 427 | - $form_active->addOption(1, _MD_YESNO); |
|
| 428 | - $form->addElement($form_active); |
|
| 429 | - $form_default = new XoopsFormCheckBox(_MD_DTYPE_DEFAULTYN, 'defaultyn', $defaultyn); |
|
| 430 | - $form_default->addOption(1, _MD_YESNO); |
|
| 431 | - $form->addElement($form_default); |
|
| 432 | - $form->addElement(new XoopsFormText(_MD_DTYPE_SEQ, 'seq', 5, 10, $dseq), true); |
|
| 433 | - $form->addElement(new XoopsFormText(_MD_SECTION, 'section', 5, 10, $section), true); |
|
| 434 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 435 | - $form->addElement(new XoopsFormHidden('op', 'savedtype')); |
|
| 436 | - $form->addElement(new XoopsFormHidden('catid', $get_catid)); |
|
| 437 | - $form->addElement(new XoopsFormHidden('dtypeid', $dtypeid)); |
|
| 438 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 439 | - $form->display(); |
|
| 440 | - } |
|
| 441 | - } else { |
|
| 442 | - echo '<table><tr><td colspan="7">' . _MD_NORECORDS . ' '; |
|
| 443 | - // if ($parentcat != '0') { |
|
| 444 | - // echo "<input type=\"hidden\" name=\"op\" value=\"importdtypes\"><input type=\"hidden\" name=\"catid\" value=\"".$get_catid."\"><input type=\"hidden\" name=\"pid\" value=\"".$parentcat."\"><input type=\"submit\" class=\"formButton\" name=\"submit\" id=\"submit\" value=\""._MD_IMPORT_DTYPES_FROM_PARENTCAT."\" >"; |
|
| 445 | - // } |
|
| 446 | - echo '</td></tr></table>'; |
|
| 447 | - } |
|
| 448 | - echo '</td></tr></table>'; |
|
| 449 | - xoops_cp_footer(); |
|
| 405 | + $form = new XoopsThemeForm(_MD_EDIT_DTYPE_FORM, 'editdatatypeform', 'categories.php'); |
|
| 406 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 407 | + //$form_custom = new XoopsFormCheckBox(_MD_DTYPE_CUSTOM, "custom", $custom); |
|
| 408 | + //$form_custom->addOption(1, _MD_YESNO); |
|
| 409 | + //$form->addElement($form_custom); |
|
| 410 | + $form->addElement(new XoopsFormText(_MD_DTYPE_TITLE, 'title', 50, 100, $dtypetitle), true); |
|
| 411 | + $form->addElement(new XoopsFormFile(_MD_SELECT_ICON, 'image', 30000)); |
|
| 412 | + $form->addElement(new XoopsFormImage(_MD_CURRENT_ICON, 'current_image', null, $iconurl, '', '')); |
|
| 413 | + $fieldtype_tray = new XoopsFormElementTray(_MD_FTYPE_NAME, '', 'typeid'); |
|
| 414 | + ob_start(); |
|
| 415 | + $mytree2->makeMySelBox('title', 'title', $ftypeid, 1); |
|
| 416 | + $selbox = ob_get_contents(); |
|
| 417 | + ob_end_clean(); |
|
| 418 | + $options_tray = new XoopsFormElementTray(_MD_OPTIONS, ''); |
|
| 419 | + $options_text = new XoopsFormLabel('', '<br>' . _MD_OPTIONS_EXPL); |
|
| 420 | + $options_textarea = new XoopsFormTextArea('', 'options', $options, 6, 5); |
|
| 421 | + $options_tray->addElement($options_textarea); |
|
| 422 | + $options_tray->addElement($options_text); |
|
| 423 | + $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox . ' <a href="fieldtypes.php">' . _MD_EDIT . '')); |
|
| 424 | + $form->addElement($fieldtype_tray, true); |
|
| 425 | + $form->addElement($options_tray); |
|
| 426 | + $form_active = new XoopsFormCheckBox(_MD_DTYPE_ACTIVEYN, 'activeyn', $activeyn); |
|
| 427 | + $form_active->addOption(1, _MD_YESNO); |
|
| 428 | + $form->addElement($form_active); |
|
| 429 | + $form_default = new XoopsFormCheckBox(_MD_DTYPE_DEFAULTYN, 'defaultyn', $defaultyn); |
|
| 430 | + $form_default->addOption(1, _MD_YESNO); |
|
| 431 | + $form->addElement($form_default); |
|
| 432 | + $form->addElement(new XoopsFormText(_MD_DTYPE_SEQ, 'seq', 5, 10, $dseq), true); |
|
| 433 | + $form->addElement(new XoopsFormText(_MD_SECTION, 'section', 5, 10, $section), true); |
|
| 434 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 435 | + $form->addElement(new XoopsFormHidden('op', 'savedtype')); |
|
| 436 | + $form->addElement(new XoopsFormHidden('catid', $get_catid)); |
|
| 437 | + $form->addElement(new XoopsFormHidden('dtypeid', $dtypeid)); |
|
| 438 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 439 | + $form->display(); |
|
| 440 | + } |
|
| 441 | + } else { |
|
| 442 | + echo '<table><tr><td colspan="7">' . _MD_NORECORDS . ' '; |
|
| 443 | + // if ($parentcat != '0') { |
|
| 444 | + // echo "<input type=\"hidden\" name=\"op\" value=\"importdtypes\"><input type=\"hidden\" name=\"catid\" value=\"".$get_catid."\"><input type=\"hidden\" name=\"pid\" value=\"".$parentcat."\"><input type=\"submit\" class=\"formButton\" name=\"submit\" id=\"submit\" value=\""._MD_IMPORT_DTYPES_FROM_PARENTCAT."\" >"; |
|
| 445 | + // } |
|
| 446 | + echo '</td></tr></table>'; |
|
| 447 | + } |
|
| 448 | + echo '</td></tr></table>'; |
|
| 449 | + xoops_cp_footer(); |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | function saveDatatype() |
| 453 | 453 | { |
| 454 | - global $xoopsDB, $_POST, $myts, $eh, $moddir, $xoopsUser; |
|
| 455 | - $count = 1; |
|
| 456 | - $return = ''; |
|
| 457 | - $p_dtypeid = $_POST['dtypeid']; |
|
| 458 | - $p_catid = $_POST['catid']; |
|
| 459 | - if (isset($_POST['title'])) { |
|
| 460 | - if (isset($_POST['custom'])) { |
|
| 461 | - $p_custom = $_POST['custom']; |
|
| 462 | - } else { |
|
| 463 | - $p_custom = '0'; |
|
| 464 | - } |
|
| 465 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 466 | - $p_fieldtype = $_POST['typeid']; |
|
| 467 | - $p_section = $myts->makeTboxData4Save($_POST['section']); |
|
| 468 | - if (isset($_POST['defaultyn'])) { |
|
| 469 | - $p_default = $_POST['defaultyn']; |
|
| 470 | - } else { |
|
| 471 | - $p_default = '0'; |
|
| 472 | - } |
|
| 473 | - if (isset($_POST['activeyn'])) { |
|
| 474 | - $p_active = $_POST['activeyn']; |
|
| 475 | - } else { |
|
| 476 | - $p_active = '0'; |
|
| 477 | - } |
|
| 478 | - if (isset($_POST['options'])) { |
|
| 479 | - $p_options = $myts->makeTareaData4Save($_POST['options']); |
|
| 480 | - } else { |
|
| 481 | - $p_options = ''; |
|
| 482 | - } |
|
| 483 | - $p_fieldtype = $_POST['typeid']; |
|
| 484 | - $p_seq = $myts->makeTboxData4Save($_POST['seq']); |
|
| 454 | + global $xoopsDB, $_POST, $myts, $eh, $moddir, $xoopsUser; |
|
| 455 | + $count = 1; |
|
| 456 | + $return = ''; |
|
| 457 | + $p_dtypeid = $_POST['dtypeid']; |
|
| 458 | + $p_catid = $_POST['catid']; |
|
| 459 | + if (isset($_POST['title'])) { |
|
| 460 | + if (isset($_POST['custom'])) { |
|
| 461 | + $p_custom = $_POST['custom']; |
|
| 462 | + } else { |
|
| 463 | + $p_custom = '0'; |
|
| 464 | + } |
|
| 465 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 466 | + $p_fieldtype = $_POST['typeid']; |
|
| 467 | + $p_section = $myts->makeTboxData4Save($_POST['section']); |
|
| 468 | + if (isset($_POST['defaultyn'])) { |
|
| 469 | + $p_default = $_POST['defaultyn']; |
|
| 470 | + } else { |
|
| 471 | + $p_default = '0'; |
|
| 472 | + } |
|
| 473 | + if (isset($_POST['activeyn'])) { |
|
| 474 | + $p_active = $_POST['activeyn']; |
|
| 475 | + } else { |
|
| 476 | + $p_active = '0'; |
|
| 477 | + } |
|
| 478 | + if (isset($_POST['options'])) { |
|
| 479 | + $p_options = $myts->makeTareaData4Save($_POST['options']); |
|
| 480 | + } else { |
|
| 481 | + $p_options = ''; |
|
| 482 | + } |
|
| 483 | + $p_fieldtype = $_POST['typeid']; |
|
| 484 | + $p_seq = $myts->makeTboxData4Save($_POST['seq']); |
|
| 485 | 485 | |
| 486 | - require_once XOOPS_ROOT_PATH . '/class/class.uploader.php'; |
|
| 487 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 488 | - $uploader->setPrefix('icon'); |
|
| 489 | - $err = array(); |
|
| 490 | - $ucount = count($_POST['xoops_upload_file']); |
|
| 491 | - if ($ucount != 0) { |
|
| 492 | - for ($i = 0; $i < $ucount; ++$i) { |
|
| 493 | - if ($_POST['xoops_upload_file'][$i] != '') { |
|
| 494 | - $medianame = $_POST['xoops_upload_file'][$i]; |
|
| 495 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
|
| 496 | - if (!$uploader->upload()) { |
|
| 497 | - $err[] = $uploader->getErrors(); |
|
| 498 | - } else { |
|
| 499 | - $savedfilename = $uploader->getSavedFileName(); |
|
| 500 | - $ticket = uniqid(mt_rand(), 1); |
|
| 501 | - //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
|
| 502 | - rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . ''); |
|
| 503 | - //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 504 | - if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) { |
|
| 505 | - unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . ''); |
|
| 506 | - } |
|
| 507 | - $sql = 'UPDATE ' |
|
| 508 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 509 | - . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom', icon='$savedfilename' WHERE dtypeid = $p_dtypeid"; |
|
| 510 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 511 | - } |
|
| 512 | - } else { |
|
| 513 | - $sql = 'UPDATE ' |
|
| 514 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 515 | - . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
|
| 516 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 517 | - } |
|
| 518 | - } else { |
|
| 519 | - $sql = 'UPDATE ' |
|
| 520 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 521 | - . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
|
| 522 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 523 | - } |
|
| 524 | - } |
|
| 525 | - } else { |
|
| 526 | - $sql = 'UPDATE ' |
|
| 527 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 528 | - . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
|
| 529 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 530 | - } |
|
| 531 | - } |
|
| 532 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_DTYPE_UPDATED); |
|
| 533 | - exit(); |
|
| 486 | + require_once XOOPS_ROOT_PATH . '/class/class.uploader.php'; |
|
| 487 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 488 | + $uploader->setPrefix('icon'); |
|
| 489 | + $err = array(); |
|
| 490 | + $ucount = count($_POST['xoops_upload_file']); |
|
| 491 | + if ($ucount != 0) { |
|
| 492 | + for ($i = 0; $i < $ucount; ++$i) { |
|
| 493 | + if ($_POST['xoops_upload_file'][$i] != '') { |
|
| 494 | + $medianame = $_POST['xoops_upload_file'][$i]; |
|
| 495 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
|
| 496 | + if (!$uploader->upload()) { |
|
| 497 | + $err[] = $uploader->getErrors(); |
|
| 498 | + } else { |
|
| 499 | + $savedfilename = $uploader->getSavedFileName(); |
|
| 500 | + $ticket = uniqid(mt_rand(), 1); |
|
| 501 | + //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
|
| 502 | + rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . ''); |
|
| 503 | + //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 504 | + if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) { |
|
| 505 | + unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . ''); |
|
| 506 | + } |
|
| 507 | + $sql = 'UPDATE ' |
|
| 508 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 509 | + . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom', icon='$savedfilename' WHERE dtypeid = $p_dtypeid"; |
|
| 510 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 511 | + } |
|
| 512 | + } else { |
|
| 513 | + $sql = 'UPDATE ' |
|
| 514 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 515 | + . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
|
| 516 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 517 | + } |
|
| 518 | + } else { |
|
| 519 | + $sql = 'UPDATE ' |
|
| 520 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 521 | + . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
|
| 522 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 523 | + } |
|
| 524 | + } |
|
| 525 | + } else { |
|
| 526 | + $sql = 'UPDATE ' |
|
| 527 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 528 | + . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
|
| 529 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 530 | + } |
|
| 531 | + } |
|
| 532 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_DTYPE_UPDATED); |
|
| 533 | + exit(); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | function addDatatype() |
| 537 | 537 | { |
| 538 | - global $xoopsDB, $_POST, $myts, $eh, $xoopsUser, $moddir; |
|
| 539 | - if (isset($_POST['catid'])) { |
|
| 540 | - $p_catid = $_POST['catid']; |
|
| 541 | - } else { |
|
| 542 | - exit(); |
|
| 543 | - } |
|
| 544 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 545 | - if (isset($_POST['defaultyn'])) { |
|
| 546 | - $p_default = $_POST['defaultyn']; |
|
| 547 | - } else { |
|
| 548 | - $p_default = '0'; |
|
| 549 | - } |
|
| 550 | - if (isset($_POST['activeyn'])) { |
|
| 551 | - $p_active = $_POST['activeyn']; |
|
| 552 | - } else { |
|
| 553 | - $p_active = '0'; |
|
| 554 | - } |
|
| 555 | - if (isset($_POST['custom'])) { |
|
| 556 | - $p_custom = $_POST['custom']; |
|
| 557 | - } else { |
|
| 558 | - $p_custom = '0'; |
|
| 559 | - } |
|
| 560 | - if (isset($_POST['options'])) { |
|
| 561 | - $p_options = $myts->makeTareaData4Save($_POST['options']); |
|
| 562 | - } else { |
|
| 563 | - $p_options = ''; |
|
| 564 | - } |
|
| 565 | - $p_fieldtype = (int)$_POST['typeid']; |
|
| 566 | - if ($p_fieldtype == '') { |
|
| 567 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_NOFIELDTYPE_SELECTED); |
|
| 568 | - exit(); |
|
| 569 | - } |
|
| 570 | - $p_section = $myts->makeTboxData4Save($_POST['section']); |
|
| 571 | - $uid = $xoopsUser->getVar('uid'); |
|
| 538 | + global $xoopsDB, $_POST, $myts, $eh, $xoopsUser, $moddir; |
|
| 539 | + if (isset($_POST['catid'])) { |
|
| 540 | + $p_catid = $_POST['catid']; |
|
| 541 | + } else { |
|
| 542 | + exit(); |
|
| 543 | + } |
|
| 544 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 545 | + if (isset($_POST['defaultyn'])) { |
|
| 546 | + $p_default = $_POST['defaultyn']; |
|
| 547 | + } else { |
|
| 548 | + $p_default = '0'; |
|
| 549 | + } |
|
| 550 | + if (isset($_POST['activeyn'])) { |
|
| 551 | + $p_active = $_POST['activeyn']; |
|
| 552 | + } else { |
|
| 553 | + $p_active = '0'; |
|
| 554 | + } |
|
| 555 | + if (isset($_POST['custom'])) { |
|
| 556 | + $p_custom = $_POST['custom']; |
|
| 557 | + } else { |
|
| 558 | + $p_custom = '0'; |
|
| 559 | + } |
|
| 560 | + if (isset($_POST['options'])) { |
|
| 561 | + $p_options = $myts->makeTareaData4Save($_POST['options']); |
|
| 562 | + } else { |
|
| 563 | + $p_options = ''; |
|
| 564 | + } |
|
| 565 | + $p_fieldtype = (int)$_POST['typeid']; |
|
| 566 | + if ($p_fieldtype == '') { |
|
| 567 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_NOFIELDTYPE_SELECTED); |
|
| 568 | + exit(); |
|
| 569 | + } |
|
| 570 | + $p_section = $myts->makeTboxData4Save($_POST['section']); |
|
| 571 | + $uid = $xoopsUser->getVar('uid'); |
|
| 572 | 572 | |
| 573 | - require_once XOOPS_ROOT_PATH . '/class/class.uploader.php'; |
|
| 574 | - //$uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 575 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 576 | - $uploader->setPrefix('icon'); |
|
| 577 | - $err = array(); |
|
| 578 | - $ucount = count($_POST['xoops_upload_file']); |
|
| 579 | - $savedfilename = ''; |
|
| 580 | - for ($i = 0; $i < $ucount; ++$i) { |
|
| 581 | - if ($_POST['xoops_upload_file'][$i] != '') { |
|
| 582 | - $medianame = $_POST['xoops_upload_file'][$i]; |
|
| 583 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
|
| 584 | - if (!$uploader->upload()) { |
|
| 585 | - $err[] = $uploader->getErrors(); |
|
| 586 | - } else { |
|
| 587 | - $savedfilename = $uploader->getSavedFileName(); |
|
| 588 | - $ticket = uniqid(mt_rand(), 1); |
|
| 589 | - //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
|
| 590 | - rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . ''); |
|
| 591 | - //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 592 | - if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) { |
|
| 593 | - unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . ''); |
|
| 594 | - } |
|
| 595 | - } |
|
| 596 | - } |
|
| 597 | - } |
|
| 598 | - } |
|
| 599 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . '_dtypeid_seq'); |
|
| 600 | - $sql = sprintf("INSERT INTO %s (dtypeid, title, section, fieldtypeid, uid, defaultyn, created, seq, activeyn, OPTIONS, custom, icon) VALUES (%u, '%s', %u, %u, %u, %u, '%s', '%s', %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes'), $newid, $p_title, |
|
| 601 | - $p_section, $p_fieldtype, $uid, $p_default, time(), 0, $p_active, $p_options, $p_custom, $savedfilename); |
|
| 602 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 603 | - $dtypeid = $xoopsDB->getInsertId(); |
|
| 604 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') . '_xid_seq'); |
|
| 605 | - $sql = sprintf('INSERT INTO %s (xid, cid, dtypeid) VALUES (%u, %u, %u)', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat'), $newid, $p_catid, $dtypeid); |
|
| 606 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 607 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 608 | - exit(); |
|
| 573 | + require_once XOOPS_ROOT_PATH . '/class/class.uploader.php'; |
|
| 574 | + //$uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 575 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 576 | + $uploader->setPrefix('icon'); |
|
| 577 | + $err = array(); |
|
| 578 | + $ucount = count($_POST['xoops_upload_file']); |
|
| 579 | + $savedfilename = ''; |
|
| 580 | + for ($i = 0; $i < $ucount; ++$i) { |
|
| 581 | + if ($_POST['xoops_upload_file'][$i] != '') { |
|
| 582 | + $medianame = $_POST['xoops_upload_file'][$i]; |
|
| 583 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][$i])) { |
|
| 584 | + if (!$uploader->upload()) { |
|
| 585 | + $err[] = $uploader->getErrors(); |
|
| 586 | + } else { |
|
| 587 | + $savedfilename = $uploader->getSavedFileName(); |
|
| 588 | + $ticket = uniqid(mt_rand(), 1); |
|
| 589 | + //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
|
| 590 | + rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . ''); |
|
| 591 | + //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 592 | + if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) { |
|
| 593 | + unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . ''); |
|
| 594 | + } |
|
| 595 | + } |
|
| 596 | + } |
|
| 597 | + } |
|
| 598 | + } |
|
| 599 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . '_dtypeid_seq'); |
|
| 600 | + $sql = sprintf("INSERT INTO %s (dtypeid, title, section, fieldtypeid, uid, defaultyn, created, seq, activeyn, OPTIONS, custom, icon) VALUES (%u, '%s', %u, %u, %u, %u, '%s', '%s', %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes'), $newid, $p_title, |
|
| 601 | + $p_section, $p_fieldtype, $uid, $p_default, time(), 0, $p_active, $p_options, $p_custom, $savedfilename); |
|
| 602 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 603 | + $dtypeid = $xoopsDB->getInsertId(); |
|
| 604 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') . '_xid_seq'); |
|
| 605 | + $sql = sprintf('INSERT INTO %s (xid, cid, dtypeid) VALUES (%u, %u, %u)', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat'), $newid, $p_catid, $dtypeid); |
|
| 606 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 607 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 608 | + exit(); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | function editDatatypes() |
| 612 | 612 | { |
| 613 | - global $xoopsDB, $_POST, $myts, $eh, $moddir, $xoopsUser; |
|
| 614 | - $count = 1; |
|
| 615 | - $return = ''; |
|
| 616 | - $dtypes = $_POST['dtypes']; |
|
| 617 | - $p_catid = $_POST['catid']; |
|
| 618 | - $dtypes_arr = explode('[|]', $dtypes); |
|
| 619 | - foreach ($dtypes_arr as $dtype) { |
|
| 620 | - $p_section = $myts->makeTboxData4Save($_POST['section' . $dtype . '']); |
|
| 621 | - if (isset($_POST['defaultyn' . $dtype . ''])) { |
|
| 622 | - $p_defaultyn = '1'; |
|
| 623 | - } else { |
|
| 624 | - $p_defaultyn = '0'; |
|
| 625 | - } |
|
| 626 | - $p_seq = $myts->makeTboxData4Save($_POST['seq' . $dtype . '']); |
|
| 627 | - if (isset($_POST['activeyn' . $dtype . ''])) { |
|
| 628 | - $p_activeyn = '1'; |
|
| 629 | - } else { |
|
| 630 | - $p_activeyn = '0'; |
|
| 631 | - } |
|
| 632 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . " SET section = '$p_section', defaultyn = '$p_defaultyn', activeyn='$p_activeyn', seq='$p_seq' WHERE dtypeid = $dtype"; |
|
| 633 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 634 | - } |
|
| 635 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 636 | - exit(); |
|
| 613 | + global $xoopsDB, $_POST, $myts, $eh, $moddir, $xoopsUser; |
|
| 614 | + $count = 1; |
|
| 615 | + $return = ''; |
|
| 616 | + $dtypes = $_POST['dtypes']; |
|
| 617 | + $p_catid = $_POST['catid']; |
|
| 618 | + $dtypes_arr = explode('[|]', $dtypes); |
|
| 619 | + foreach ($dtypes_arr as $dtype) { |
|
| 620 | + $p_section = $myts->makeTboxData4Save($_POST['section' . $dtype . '']); |
|
| 621 | + if (isset($_POST['defaultyn' . $dtype . ''])) { |
|
| 622 | + $p_defaultyn = '1'; |
|
| 623 | + } else { |
|
| 624 | + $p_defaultyn = '0'; |
|
| 625 | + } |
|
| 626 | + $p_seq = $myts->makeTboxData4Save($_POST['seq' . $dtype . '']); |
|
| 627 | + if (isset($_POST['activeyn' . $dtype . ''])) { |
|
| 628 | + $p_activeyn = '1'; |
|
| 629 | + } else { |
|
| 630 | + $p_activeyn = '0'; |
|
| 631 | + } |
|
| 632 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . " SET section = '$p_section', defaultyn = '$p_defaultyn', activeyn='$p_activeyn', seq='$p_seq' WHERE dtypeid = $dtype"; |
|
| 633 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 634 | + } |
|
| 635 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 636 | + exit(); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | function importDatatypes() |
| 640 | 640 | { |
| 641 | - global $xoopsDB, $_POST, $myts, $eh, $moddir, $xoopsUser; |
|
| 642 | - if (isset($_POST['pid'])) { |
|
| 643 | - $p_pid = $_POST['pid']; |
|
| 644 | - } else { |
|
| 645 | - exit(); |
|
| 646 | - } |
|
| 647 | - if (isset($_POST['catid'])) { |
|
| 648 | - $p_catid = $_POST['catid']; |
|
| 649 | - } else { |
|
| 650 | - exit(); |
|
| 651 | - } |
|
| 652 | - if ($p_pid != 0) { |
|
| 653 | - $sql = 'INSERT INTO ' |
|
| 654 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 655 | - . ' (cid, dtypeid) SELECT ' |
|
| 656 | - . $p_catid |
|
| 657 | - . ', d.dtypeid FROM ' |
|
| 658 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 659 | - . ' d, ' |
|
| 660 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 661 | - . '_dtypes_x_cat') |
|
| 662 | - . ' x WHERE d.dtypeid=x.dtypeid AND x.cid = ' |
|
| 663 | - . $p_pid |
|
| 664 | - . " AND d.defaultyn = '1'"; |
|
| 665 | - } |
|
| 666 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 667 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 668 | - exit(); |
|
| 641 | + global $xoopsDB, $_POST, $myts, $eh, $moddir, $xoopsUser; |
|
| 642 | + if (isset($_POST['pid'])) { |
|
| 643 | + $p_pid = $_POST['pid']; |
|
| 644 | + } else { |
|
| 645 | + exit(); |
|
| 646 | + } |
|
| 647 | + if (isset($_POST['catid'])) { |
|
| 648 | + $p_catid = $_POST['catid']; |
|
| 649 | + } else { |
|
| 650 | + exit(); |
|
| 651 | + } |
|
| 652 | + if ($p_pid != 0) { |
|
| 653 | + $sql = 'INSERT INTO ' |
|
| 654 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 655 | + . ' (cid, dtypeid) SELECT ' |
|
| 656 | + . $p_catid |
|
| 657 | + . ', d.dtypeid FROM ' |
|
| 658 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 659 | + . ' d, ' |
|
| 660 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 661 | + . '_dtypes_x_cat') |
|
| 662 | + . ' x WHERE d.dtypeid=x.dtypeid AND x.cid = ' |
|
| 663 | + . $p_pid |
|
| 664 | + . " AND d.defaultyn = '1'"; |
|
| 665 | + } |
|
| 666 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 667 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 668 | + exit(); |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | function updateCat() |
| 672 | 672 | { |
| 673 | - global $xoopsDB, $_POST, $myts, $eh, $moddir; |
|
| 674 | - if (isset($_POST['catid'])) { |
|
| 675 | - $p_catid = $_POST['catid']; |
|
| 676 | - } else { |
|
| 677 | - exit(); |
|
| 678 | - } |
|
| 679 | - $descr_exists = checkDescription($p_catid); |
|
| 673 | + global $xoopsDB, $_POST, $myts, $eh, $moddir; |
|
| 674 | + if (isset($_POST['catid'])) { |
|
| 675 | + $p_catid = $_POST['catid']; |
|
| 676 | + } else { |
|
| 677 | + exit(); |
|
| 678 | + } |
|
| 679 | + $descr_exists = checkDescription($p_catid); |
|
| 680 | 680 | |
| 681 | - if (isset($_POST['pid'])) { |
|
| 682 | - $p_pid = $_POST['pid']; |
|
| 683 | - } else { |
|
| 684 | - $p_pid = '0'; |
|
| 685 | - } |
|
| 686 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 687 | - if (isset($_POST['active'])) { |
|
| 688 | - $p_active = $_POST['active']; |
|
| 689 | - } else { |
|
| 690 | - $p_active = 0; |
|
| 691 | - } |
|
| 692 | - if (isset($_POST['allowlist'])) { |
|
| 693 | - $p_allowlist = $_POST['allowlist']; |
|
| 694 | - } else { |
|
| 695 | - $p_allowlist = 0; |
|
| 696 | - } |
|
| 697 | - if (isset($_POST['showpopular'])) { |
|
| 698 | - $p_showpopular = $_POST['showpopular']; |
|
| 699 | - } else { |
|
| 700 | - $p_showpopular = 0; |
|
| 701 | - } |
|
| 702 | - if (isset($_POST['descr'])) { |
|
| 703 | - $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
| 704 | - } else { |
|
| 705 | - $p_descr = false; |
|
| 706 | - } |
|
| 707 | - if ($_POST['xoops_upload_file'][0] != '') { |
|
| 708 | - require_once XOOPS_ROOT_PATH . "/modules/$moddir/class/class.uploader.php"; |
|
| 709 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 710 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 711 | - $filename = $uploader->getMediaName(); |
|
| 712 | - } else { |
|
| 713 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 714 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 681 | + if (isset($_POST['pid'])) { |
|
| 682 | + $p_pid = $_POST['pid']; |
|
| 683 | + } else { |
|
| 684 | + $p_pid = '0'; |
|
| 685 | + } |
|
| 686 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 687 | + if (isset($_POST['active'])) { |
|
| 688 | + $p_active = $_POST['active']; |
|
| 689 | + } else { |
|
| 690 | + $p_active = 0; |
|
| 691 | + } |
|
| 692 | + if (isset($_POST['allowlist'])) { |
|
| 693 | + $p_allowlist = $_POST['allowlist']; |
|
| 694 | + } else { |
|
| 695 | + $p_allowlist = 0; |
|
| 696 | + } |
|
| 697 | + if (isset($_POST['showpopular'])) { |
|
| 698 | + $p_showpopular = $_POST['showpopular']; |
|
| 699 | + } else { |
|
| 700 | + $p_showpopular = 0; |
|
| 701 | + } |
|
| 702 | + if (isset($_POST['descr'])) { |
|
| 703 | + $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
| 704 | + } else { |
|
| 705 | + $p_descr = false; |
|
| 706 | + } |
|
| 707 | + if ($_POST['xoops_upload_file'][0] != '') { |
|
| 708 | + require_once XOOPS_ROOT_PATH . "/modules/$moddir/class/class.uploader.php"; |
|
| 709 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 710 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 711 | + $filename = $uploader->getMediaName(); |
|
| 712 | + } else { |
|
| 713 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 714 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 715 | 715 | |
| 716 | - if ($p_descr) { |
|
| 717 | - if ($descr_exists === true) { |
|
| 718 | - $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 719 | - } else { |
|
| 720 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 721 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 722 | - } |
|
| 723 | - $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 724 | - } |
|
| 725 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 726 | - exit(); |
|
| 727 | - } |
|
| 728 | - $uploader->setPrefix('efqdir'); |
|
| 729 | - if ($uploader->upload()) { |
|
| 730 | - $savedfilename = $uploader->getSavedFileName(); |
|
| 731 | - $width = $uploader->getWidth(); |
|
| 732 | - $height = $uploader->getHeight(); |
|
| 733 | - $imagelocation = $uploader->uploadDir; |
|
| 734 | - echo $uploader->getErrors(); |
|
| 716 | + if ($p_descr) { |
|
| 717 | + if ($descr_exists === true) { |
|
| 718 | + $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 719 | + } else { |
|
| 720 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 721 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 722 | + } |
|
| 723 | + $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 724 | + } |
|
| 725 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 726 | + exit(); |
|
| 727 | + } |
|
| 728 | + $uploader->setPrefix('efqdir'); |
|
| 729 | + if ($uploader->upload()) { |
|
| 730 | + $savedfilename = $uploader->getSavedFileName(); |
|
| 731 | + $width = $uploader->getWidth(); |
|
| 732 | + $height = $uploader->getHeight(); |
|
| 733 | + $imagelocation = $uploader->uploadDir; |
|
| 734 | + echo $uploader->getErrors(); |
|
| 735 | 735 | |
| 736 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET img = '$savedfilename', width = '$width', height = '$height' WHERE cid = $p_catid"; |
|
| 737 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 738 | - rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
|
| 739 | - //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 740 | - if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|
| 741 | - unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
|
| 742 | - } |
|
| 743 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 744 | - exit(); |
|
| 745 | - } else { |
|
| 746 | - echo $uploader->getErrors(); |
|
| 747 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 748 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 749 | - if ($p_descr) { |
|
| 750 | - if ($descr_exists === true) { |
|
| 751 | - $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 752 | - } else { |
|
| 753 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 754 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 755 | - } |
|
| 756 | - $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 757 | - } |
|
| 758 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 759 | - exit(); |
|
| 760 | - } |
|
| 761 | - } |
|
| 762 | - redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_NOT_UPDATED); |
|
| 763 | - exit(); |
|
| 736 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET img = '$savedfilename', width = '$width', height = '$height' WHERE cid = $p_catid"; |
|
| 737 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 738 | + rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
|
| 739 | + //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 740 | + if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|
| 741 | + unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
|
| 742 | + } |
|
| 743 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 744 | + exit(); |
|
| 745 | + } else { |
|
| 746 | + echo $uploader->getErrors(); |
|
| 747 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 748 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 749 | + if ($p_descr) { |
|
| 750 | + if ($descr_exists === true) { |
|
| 751 | + $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 752 | + } else { |
|
| 753 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 754 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 755 | + } |
|
| 756 | + $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 757 | + } |
|
| 758 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
|
| 759 | + exit(); |
|
| 760 | + } |
|
| 761 | + } |
|
| 762 | + redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_NOT_UPDATED); |
|
| 763 | + exit(); |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | function newCat() |
| 767 | 767 | { |
| 768 | - global $xoopsDB, $_POST, $myts, $eh, $moddir; |
|
| 769 | - if (isset($_POST['dirid'])) { |
|
| 770 | - $p_dirid = $_POST['dirid']; |
|
| 771 | - } else { |
|
| 772 | - exit(); |
|
| 773 | - } |
|
| 774 | - if (isset($_POST['pid'])) { |
|
| 775 | - $p_pid = $_POST['pid']; |
|
| 776 | - } else { |
|
| 777 | - $p_pid = '0'; |
|
| 778 | - } |
|
| 779 | - $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 780 | - if (isset($_POST['active'])) { |
|
| 781 | - $p_active = $_POST['active']; |
|
| 782 | - } else { |
|
| 783 | - $p_active = 0; |
|
| 784 | - } |
|
| 785 | - if (isset($_POST['importdtypes'])) { |
|
| 786 | - if ($p_pid != 0) { |
|
| 787 | - $p_import = $_POST['importdtypes']; |
|
| 788 | - } else { |
|
| 789 | - $p_import = 0; |
|
| 790 | - } |
|
| 791 | - } else { |
|
| 792 | - $p_import = 0; |
|
| 793 | - } |
|
| 794 | - if (isset($_POST['txtactive'])) { |
|
| 795 | - $p_txtactive = $_POST['txtactive']; |
|
| 796 | - } else { |
|
| 797 | - $p_txtactive = 0; |
|
| 798 | - } |
|
| 799 | - if (isset($_POST['allowlist'])) { |
|
| 800 | - $p_allowlist = $_POST['allowlist']; |
|
| 801 | - } else { |
|
| 802 | - $p_allowlist = 0; |
|
| 803 | - } |
|
| 804 | - if (isset($_POST['showpopular'])) { |
|
| 805 | - $p_showpopular = $_POST['showpopular']; |
|
| 806 | - } else { |
|
| 807 | - $p_showpopular = 0; |
|
| 808 | - } |
|
| 809 | - if (isset($_POST['descr'])) { |
|
| 810 | - $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
| 811 | - } else { |
|
| 812 | - $p_descr = ''; |
|
| 813 | - } |
|
| 768 | + global $xoopsDB, $_POST, $myts, $eh, $moddir; |
|
| 769 | + if (isset($_POST['dirid'])) { |
|
| 770 | + $p_dirid = $_POST['dirid']; |
|
| 771 | + } else { |
|
| 772 | + exit(); |
|
| 773 | + } |
|
| 774 | + if (isset($_POST['pid'])) { |
|
| 775 | + $p_pid = $_POST['pid']; |
|
| 776 | + } else { |
|
| 777 | + $p_pid = '0'; |
|
| 778 | + } |
|
| 779 | + $p_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 780 | + if (isset($_POST['active'])) { |
|
| 781 | + $p_active = $_POST['active']; |
|
| 782 | + } else { |
|
| 783 | + $p_active = 0; |
|
| 784 | + } |
|
| 785 | + if (isset($_POST['importdtypes'])) { |
|
| 786 | + if ($p_pid != 0) { |
|
| 787 | + $p_import = $_POST['importdtypes']; |
|
| 788 | + } else { |
|
| 789 | + $p_import = 0; |
|
| 790 | + } |
|
| 791 | + } else { |
|
| 792 | + $p_import = 0; |
|
| 793 | + } |
|
| 794 | + if (isset($_POST['txtactive'])) { |
|
| 795 | + $p_txtactive = $_POST['txtactive']; |
|
| 796 | + } else { |
|
| 797 | + $p_txtactive = 0; |
|
| 798 | + } |
|
| 799 | + if (isset($_POST['allowlist'])) { |
|
| 800 | + $p_allowlist = $_POST['allowlist']; |
|
| 801 | + } else { |
|
| 802 | + $p_allowlist = 0; |
|
| 803 | + } |
|
| 804 | + if (isset($_POST['showpopular'])) { |
|
| 805 | + $p_showpopular = $_POST['showpopular']; |
|
| 806 | + } else { |
|
| 807 | + $p_showpopular = 0; |
|
| 808 | + } |
|
| 809 | + if (isset($_POST['descr'])) { |
|
| 810 | + $p_descr = $myts->makeTareaData4Save($_POST['descr']); |
|
| 811 | + } else { |
|
| 812 | + $p_descr = ''; |
|
| 813 | + } |
|
| 814 | 814 | |
| 815 | - if ($_POST['xoops_upload_file'][0] != '') { |
|
| 816 | - require_once XOOPS_ROOT_PATH . "/modules/$moddir/class/class.uploader.php"; |
|
| 817 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 818 | - if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 819 | - $filename = $uploader->getMediaName(); |
|
| 820 | - } else { |
|
| 821 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 822 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, allowlist, showpopular) VALUES (%u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, $p_allowlist, $p_showpopular); |
|
| 823 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 824 | - if ($newid == 0) { |
|
| 825 | - $cid = $xoopsDB->getInsertId(); |
|
| 826 | - } |
|
| 827 | - if ($p_descr != '') { |
|
| 828 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 829 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 830 | - $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 831 | - } |
|
| 832 | - if ($p_import == '1') { |
|
| 833 | - importDtypes($p_pid, $cid); |
|
| 834 | - } |
|
| 835 | - redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 836 | - exit(); |
|
| 837 | - } |
|
| 838 | - $uploader->setPrefix('efqdir'); |
|
| 839 | - if ($uploader->upload()) { |
|
| 840 | - $savedfilename = $uploader->getSavedFileName(); |
|
| 841 | - //echo $savedfilename; |
|
| 842 | - $width = $uploader->getWidth(); |
|
| 843 | - $height = $uploader->getHeight(); |
|
| 844 | - $imagelocation = $uploader->uploadDir; |
|
| 845 | - echo $uploader->getErrors(); |
|
| 846 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 847 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, |
|
| 848 | - $savedfilename, $p_allowlist, $p_showpopular, $width, $height); |
|
| 849 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 850 | - if ($newid == 0) { |
|
| 851 | - $cid = $xoopsDB->getInsertId(); |
|
| 852 | - } |
|
| 853 | - if ($p_descr != '') { |
|
| 854 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 855 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 856 | - $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 857 | - } |
|
| 858 | - if ($p_import == '1') { |
|
| 859 | - importDtypes($p_pid, $cid); |
|
| 860 | - } |
|
| 861 | - rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
|
| 862 | - //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 863 | - if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|
| 864 | - unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
|
| 865 | - } |
|
| 866 | - redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 867 | - exit(); |
|
| 868 | - } else { |
|
| 869 | - echo $uploader->getErrors(); |
|
| 870 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 871 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, '', |
|
| 872 | - $p_allowlist, $p_showpopular, '', ''); |
|
| 873 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 874 | - if ($newid == 0) { |
|
| 875 | - $cid = $xoopsDB->getInsertId(); |
|
| 876 | - } |
|
| 877 | - if ($p_descr != '') { |
|
| 878 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 879 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 880 | - $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 881 | - } |
|
| 882 | - if ($p_import == '1') { |
|
| 883 | - importDtypes($p_pid, $cid); |
|
| 884 | - } |
|
| 885 | - redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 886 | - exit(); |
|
| 887 | - } |
|
| 888 | - } |
|
| 815 | + if ($_POST['xoops_upload_file'][0] != '') { |
|
| 816 | + require_once XOOPS_ROOT_PATH . "/modules/$moddir/class/class.uploader.php"; |
|
| 817 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 818 | + if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
|
| 819 | + $filename = $uploader->getMediaName(); |
|
| 820 | + } else { |
|
| 821 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 822 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, allowlist, showpopular) VALUES (%u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, $p_allowlist, $p_showpopular); |
|
| 823 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 824 | + if ($newid == 0) { |
|
| 825 | + $cid = $xoopsDB->getInsertId(); |
|
| 826 | + } |
|
| 827 | + if ($p_descr != '') { |
|
| 828 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 829 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 830 | + $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 831 | + } |
|
| 832 | + if ($p_import == '1') { |
|
| 833 | + importDtypes($p_pid, $cid); |
|
| 834 | + } |
|
| 835 | + redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 836 | + exit(); |
|
| 837 | + } |
|
| 838 | + $uploader->setPrefix('efqdir'); |
|
| 839 | + if ($uploader->upload()) { |
|
| 840 | + $savedfilename = $uploader->getSavedFileName(); |
|
| 841 | + //echo $savedfilename; |
|
| 842 | + $width = $uploader->getWidth(); |
|
| 843 | + $height = $uploader->getHeight(); |
|
| 844 | + $imagelocation = $uploader->uploadDir; |
|
| 845 | + echo $uploader->getErrors(); |
|
| 846 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 847 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, |
|
| 848 | + $savedfilename, $p_allowlist, $p_showpopular, $width, $height); |
|
| 849 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 850 | + if ($newid == 0) { |
|
| 851 | + $cid = $xoopsDB->getInsertId(); |
|
| 852 | + } |
|
| 853 | + if ($p_descr != '') { |
|
| 854 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 855 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 856 | + $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 857 | + } |
|
| 858 | + if ($p_import == '1') { |
|
| 859 | + importDtypes($p_pid, $cid); |
|
| 860 | + } |
|
| 861 | + rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
|
| 862 | + //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
|
| 863 | + if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|
| 864 | + unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
|
| 865 | + } |
|
| 866 | + redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 867 | + exit(); |
|
| 868 | + } else { |
|
| 869 | + echo $uploader->getErrors(); |
|
| 870 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 871 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, '', |
|
| 872 | + $p_allowlist, $p_showpopular, '', ''); |
|
| 873 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 874 | + if ($newid == 0) { |
|
| 875 | + $cid = $xoopsDB->getInsertId(); |
|
| 876 | + } |
|
| 877 | + if ($p_descr != '') { |
|
| 878 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 879 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 880 | + $xoopsDB->query($sql2) or $eh->show('0013'); |
|
| 881 | + } |
|
| 882 | + if ($p_import == '1') { |
|
| 883 | + importDtypes($p_pid, $cid); |
|
| 884 | + } |
|
| 885 | + redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 886 | + exit(); |
|
| 887 | + } |
|
| 888 | + } |
|
| 889 | 889 | |
| 890 | - redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 891 | - exit(); |
|
| 890 | + redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
|
| 891 | + exit(); |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | function deleteCatConfirm() |
| 895 | 895 | { |
| 896 | - global $xoopsDB, $_POST, $eh, $xoopsModule, $get_catid; |
|
| 897 | - xoops_cp_header(); |
|
| 898 | - $form = new XoopsThemeForm(_MD_CONFIRM_DELETECAT_FORM, 'confirmform', 'categories.php'); |
|
| 899 | - $submit_tray = new XoopsFormElementTray(_MD_DELETE_CAT_YN, '', 'cid'); |
|
| 900 | - $submit_tray->addElement(new XoopsFormButton('', 'submit', _MD_DELETE, 'submit')); |
|
| 901 | - $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="' . _MD_CANCEL . "\" onclick=\"location='categories.php?op=edit&catid=$get_catid'\"")); |
|
| 902 | - $form->addElement($submit_tray, true); |
|
| 903 | - //'$form->addElement($form_submit); |
|
| 904 | - $form->addElement(new XoopsFormHidden('op', 'deleteCat')); |
|
| 905 | - $form->addElement(new XoopsFormHidden('catid', $get_catid)); |
|
| 906 | - $form->display(); |
|
| 907 | - xoops_cp_footer(); |
|
| 896 | + global $xoopsDB, $_POST, $eh, $xoopsModule, $get_catid; |
|
| 897 | + xoops_cp_header(); |
|
| 898 | + $form = new XoopsThemeForm(_MD_CONFIRM_DELETECAT_FORM, 'confirmform', 'categories.php'); |
|
| 899 | + $submit_tray = new XoopsFormElementTray(_MD_DELETE_CAT_YN, '', 'cid'); |
|
| 900 | + $submit_tray->addElement(new XoopsFormButton('', 'submit', _MD_DELETE, 'submit')); |
|
| 901 | + $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="' . _MD_CANCEL . "\" onclick=\"location='categories.php?op=edit&catid=$get_catid'\"")); |
|
| 902 | + $form->addElement($submit_tray, true); |
|
| 903 | + //'$form->addElement($form_submit); |
|
| 904 | + $form->addElement(new XoopsFormHidden('op', 'deleteCat')); |
|
| 905 | + $form->addElement(new XoopsFormHidden('catid', $get_catid)); |
|
| 906 | + $form->display(); |
|
| 907 | + xoops_cp_footer(); |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | function deleteCat() |
| 911 | 911 | { |
| 912 | - global $xoopsDB, $_POST, $eh, $xoopsModule; |
|
| 913 | - if (isset($_POST['catid'])) { |
|
| 914 | - $p_catid = (int)$_POST['catid']; |
|
| 915 | - } else { |
|
| 916 | - redirect_header('directories.php', 2, _MD_INVALID_DIR); |
|
| 917 | - exit(); |
|
| 918 | - } |
|
| 919 | - $dirid = getDirId($p_catid); |
|
| 920 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $p_catid); |
|
| 921 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 922 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $p_catid); |
|
| 923 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 924 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $p_catid); |
|
| 925 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 926 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat'), $p_catid); |
|
| 927 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 928 | - redirect_header('categories.php?dirid=' . $dirid, 2, _MD_CAT_DELETED); |
|
| 929 | - exit(); |
|
| 912 | + global $xoopsDB, $_POST, $eh, $xoopsModule; |
|
| 913 | + if (isset($_POST['catid'])) { |
|
| 914 | + $p_catid = (int)$_POST['catid']; |
|
| 915 | + } else { |
|
| 916 | + redirect_header('directories.php', 2, _MD_INVALID_DIR); |
|
| 917 | + exit(); |
|
| 918 | + } |
|
| 919 | + $dirid = getDirId($p_catid); |
|
| 920 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $p_catid); |
|
| 921 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 922 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $p_catid); |
|
| 923 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 924 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $p_catid); |
|
| 925 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 926 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat'), $p_catid); |
|
| 927 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 928 | + redirect_header('categories.php?dirid=' . $dirid, 2, _MD_CAT_DELETED); |
|
| 929 | + exit(); |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | if (!isset($_POST['op'])) { |
| 933 | - $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
|
| 933 | + $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
|
| 934 | 934 | } else { |
| 935 | - $op = $_POST['op']; |
|
| 935 | + $op = $_POST['op']; |
|
| 936 | 936 | } |
| 937 | 937 | switch ($op) { |
| 938 | - case 'newdatatype': |
|
| 939 | - addDatatype(); |
|
| 940 | - break; |
|
| 941 | - case 'editdtypes': |
|
| 942 | - editDatatypes(); |
|
| 943 | - break; |
|
| 944 | - case 'editdtype': |
|
| 945 | - editDatatype($get_dtypeid); |
|
| 946 | - break; |
|
| 947 | - case 'savedtype': |
|
| 948 | - saveDatatype(); |
|
| 949 | - break; |
|
| 950 | - case 'importdtypes': |
|
| 951 | - importDatatypes(); |
|
| 952 | - break; |
|
| 953 | - case 'edit': |
|
| 954 | - editCat($get_catid); |
|
| 955 | - break; |
|
| 956 | - case 'update': |
|
| 957 | - updateCat(); |
|
| 958 | - break; |
|
| 959 | - case 'newcat': |
|
| 960 | - newCat(); |
|
| 961 | - break; |
|
| 962 | - case 'deleteCat': |
|
| 963 | - deleteCat(); |
|
| 964 | - break; |
|
| 965 | - case 'deleteCatConfirm': |
|
| 966 | - deleteCatConfirm(); |
|
| 967 | - break; |
|
| 968 | - default: |
|
| 969 | - catConfig($get_dirid); |
|
| 970 | - break; |
|
| 938 | + case 'newdatatype': |
|
| 939 | + addDatatype(); |
|
| 940 | + break; |
|
| 941 | + case 'editdtypes': |
|
| 942 | + editDatatypes(); |
|
| 943 | + break; |
|
| 944 | + case 'editdtype': |
|
| 945 | + editDatatype($get_dtypeid); |
|
| 946 | + break; |
|
| 947 | + case 'savedtype': |
|
| 948 | + saveDatatype(); |
|
| 949 | + break; |
|
| 950 | + case 'importdtypes': |
|
| 951 | + importDatatypes(); |
|
| 952 | + break; |
|
| 953 | + case 'edit': |
|
| 954 | + editCat($get_catid); |
|
| 955 | + break; |
|
| 956 | + case 'update': |
|
| 957 | + updateCat(); |
|
| 958 | + break; |
|
| 959 | + case 'newcat': |
|
| 960 | + newCat(); |
|
| 961 | + break; |
|
| 962 | + case 'deleteCat': |
|
| 963 | + deleteCat(); |
|
| 964 | + break; |
|
| 965 | + case 'deleteCatConfirm': |
|
| 966 | + deleteCatConfirm(); |
|
| 967 | + break; |
|
| 968 | + default: |
|
| 969 | + catConfig($get_dirid); |
|
| 970 | + break; |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | function getCatOverview() |
| 974 | 974 | { |
| 975 | - global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
| 976 | - $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\''); |
|
| 977 | - $numrows = $xoopsDB->getRowsNum($mainresult); |
|
| 978 | - $output = ''; |
|
| 979 | - if ($numrows > 0) { |
|
| 980 | - $output = '<th>' . _MD_CATTITLE . '</th><th>' . _MD_ACTIVE . '</th><th>' . _MD_ACTION . "</th>\n"; |
|
| 981 | - $brench = 0; |
|
| 982 | - $tab = ''; |
|
| 983 | - while (list($cid, $title, $active, $pid) = $xoopsDB->fetchRow($mainresult)) { |
|
| 984 | - //For each cid, get all 'first children' using getFirstChildId() function |
|
| 985 | - if ($active != '0') { |
|
| 986 | - $activeyn = '' . _MD_YES . ''; |
|
| 987 | - } else { |
|
| 988 | - $activeyn = '' . _MD_NO . ''; |
|
| 989 | - } |
|
| 990 | - $output .= '<tr><td>' |
|
| 991 | - . $tab |
|
| 992 | - . '' |
|
| 993 | - . $title |
|
| 994 | - . '</td><td>' |
|
| 995 | - . $activeyn |
|
| 996 | - . '</td><td><a href="' |
|
| 997 | - . XOOPS_URL |
|
| 998 | - . "/modules/$moddir/admin/categories.php?op=edit&catid=$cid\"><img src=\"" |
|
| 999 | - . XOOPS_URL |
|
| 1000 | - . '/modules/' |
|
| 1001 | - . $moddir |
|
| 1002 | - . '/assets/images/accessories-text-editor.png" title="' |
|
| 1003 | - . _MD_MANAGE_CAT |
|
| 1004 | - . '" alt="' |
|
| 1005 | - . _MD_MANAGE_CAT |
|
| 1006 | - . "\"></a></td></tr>\n"; |
|
| 1007 | - $output .= getChildrenCategories($cid); |
|
| 1008 | - } |
|
| 1009 | - } else { |
|
| 1010 | - $output = '<p><span style="background-color: #E6E6E6; padding: 5px; border: 1px solid #000000;">' . _MD_NORESULTS_PLEASE_CREATE_CATEGORY . '</span></p>'; |
|
| 1011 | - } |
|
| 975 | + global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
| 976 | + $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\''); |
|
| 977 | + $numrows = $xoopsDB->getRowsNum($mainresult); |
|
| 978 | + $output = ''; |
|
| 979 | + if ($numrows > 0) { |
|
| 980 | + $output = '<th>' . _MD_CATTITLE . '</th><th>' . _MD_ACTIVE . '</th><th>' . _MD_ACTION . "</th>\n"; |
|
| 981 | + $brench = 0; |
|
| 982 | + $tab = ''; |
|
| 983 | + while (list($cid, $title, $active, $pid) = $xoopsDB->fetchRow($mainresult)) { |
|
| 984 | + //For each cid, get all 'first children' using getFirstChildId() function |
|
| 985 | + if ($active != '0') { |
|
| 986 | + $activeyn = '' . _MD_YES . ''; |
|
| 987 | + } else { |
|
| 988 | + $activeyn = '' . _MD_NO . ''; |
|
| 989 | + } |
|
| 990 | + $output .= '<tr><td>' |
|
| 991 | + . $tab |
|
| 992 | + . '' |
|
| 993 | + . $title |
|
| 994 | + . '</td><td>' |
|
| 995 | + . $activeyn |
|
| 996 | + . '</td><td><a href="' |
|
| 997 | + . XOOPS_URL |
|
| 998 | + . "/modules/$moddir/admin/categories.php?op=edit&catid=$cid\"><img src=\"" |
|
| 999 | + . XOOPS_URL |
|
| 1000 | + . '/modules/' |
|
| 1001 | + . $moddir |
|
| 1002 | + . '/assets/images/accessories-text-editor.png" title="' |
|
| 1003 | + . _MD_MANAGE_CAT |
|
| 1004 | + . '" alt="' |
|
| 1005 | + . _MD_MANAGE_CAT |
|
| 1006 | + . "\"></a></td></tr>\n"; |
|
| 1007 | + $output .= getChildrenCategories($cid); |
|
| 1008 | + } |
|
| 1009 | + } else { |
|
| 1010 | + $output = '<p><span style="background-color: #E6E6E6; padding: 5px; border: 1px solid #000000;">' . _MD_NORESULTS_PLEASE_CREATE_CATEGORY . '</span></p>'; |
|
| 1011 | + } |
|
| 1012 | 1012 | |
| 1013 | - return $output; |
|
| 1013 | + return $output; |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | function getChildrenCategories($childid = '0', $level = '0') |
| 1017 | 1017 | { |
| 1018 | - global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
| 1019 | - $tab = ' '; |
|
| 1020 | - $level = $level; |
|
| 1021 | - $output = ''; |
|
| 1022 | - $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
| 1023 | - for ($i = 0; $i < $level; ++$i) { |
|
| 1024 | - $tab .= ' '; |
|
| 1025 | - } |
|
| 1026 | - $sql = 'SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'' . $childid . '\''; |
|
| 1027 | - $childresult = $xoopsDB->query($sql); |
|
| 1028 | - $numrows = $xoopsDB->getRowsNum($childresult); |
|
| 1029 | - if ($numrows > 0) { |
|
| 1030 | - while (list($cid, $title, $active, $pid) = $xoopsDB->fetchRow($childresult)) { |
|
| 1031 | - if ($active != '0') { |
|
| 1032 | - $activeyn = '' . _MD_YES . ''; |
|
| 1033 | - } else { |
|
| 1034 | - $activeyn = '' . _MD_NO . ''; |
|
| 1035 | - } |
|
| 1036 | - $output .= '<tr><td>' |
|
| 1037 | - . $tab |
|
| 1038 | - . $plus |
|
| 1039 | - . $title |
|
| 1040 | - . ' </td><td>' |
|
| 1041 | - . $activeyn |
|
| 1042 | - . '</td><td><a href="' |
|
| 1043 | - . XOOPS_URL |
|
| 1044 | - . "/modules/$moddir/admin/categories.php?op=edit&catid=$cid\"><img src=\"" |
|
| 1045 | - . XOOPS_URL |
|
| 1046 | - . '/modules/' |
|
| 1047 | - . $moddir |
|
| 1048 | - . '/assets/images/accessories-text-editor.png" title="' |
|
| 1049 | - . _MD_MANAGE_CAT |
|
| 1050 | - . '" alt="' |
|
| 1051 | - . _MD_MANAGE_CAT |
|
| 1052 | - . "\"></a></td></tr>\n"; |
|
| 1053 | - $newlevel = $level + 1; |
|
| 1054 | - $output .= getChildrenCategories($cid, $newlevel); |
|
| 1055 | - } |
|
| 1056 | - } |
|
| 1018 | + global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
|
| 1019 | + $tab = ' '; |
|
| 1020 | + $level = $level; |
|
| 1021 | + $output = ''; |
|
| 1022 | + $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
| 1023 | + for ($i = 0; $i < $level; ++$i) { |
|
| 1024 | + $tab .= ' '; |
|
| 1025 | + } |
|
| 1026 | + $sql = 'SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'' . $childid . '\''; |
|
| 1027 | + $childresult = $xoopsDB->query($sql); |
|
| 1028 | + $numrows = $xoopsDB->getRowsNum($childresult); |
|
| 1029 | + if ($numrows > 0) { |
|
| 1030 | + while (list($cid, $title, $active, $pid) = $xoopsDB->fetchRow($childresult)) { |
|
| 1031 | + if ($active != '0') { |
|
| 1032 | + $activeyn = '' . _MD_YES . ''; |
|
| 1033 | + } else { |
|
| 1034 | + $activeyn = '' . _MD_NO . ''; |
|
| 1035 | + } |
|
| 1036 | + $output .= '<tr><td>' |
|
| 1037 | + . $tab |
|
| 1038 | + . $plus |
|
| 1039 | + . $title |
|
| 1040 | + . ' </td><td>' |
|
| 1041 | + . $activeyn |
|
| 1042 | + . '</td><td><a href="' |
|
| 1043 | + . XOOPS_URL |
|
| 1044 | + . "/modules/$moddir/admin/categories.php?op=edit&catid=$cid\"><img src=\"" |
|
| 1045 | + . XOOPS_URL |
|
| 1046 | + . '/modules/' |
|
| 1047 | + . $moddir |
|
| 1048 | + . '/assets/images/accessories-text-editor.png" title="' |
|
| 1049 | + . _MD_MANAGE_CAT |
|
| 1050 | + . '" alt="' |
|
| 1051 | + . _MD_MANAGE_CAT |
|
| 1052 | + . "\"></a></td></tr>\n"; |
|
| 1053 | + $newlevel = $level + 1; |
|
| 1054 | + $output .= getChildrenCategories($cid, $newlevel); |
|
| 1055 | + } |
|
| 1056 | + } |
|
| 1057 | 1057 | |
| 1058 | - return $output; |
|
| 1058 | + return $output; |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | function importDtypes($pid = '0', $catid = '0') |
| 1062 | 1062 | { |
| 1063 | - global $xoopsDB, $_POST, $eh; |
|
| 1064 | - if ($pid != 0) { |
|
| 1065 | - $sql = 'INSERT INTO ' |
|
| 1066 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 1067 | - . ' (cid, dtypeid) SELECT ' |
|
| 1068 | - . $catid |
|
| 1069 | - . ', d.dtypeid FROM ' |
|
| 1070 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 1071 | - . ' d, ' |
|
| 1072 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 1073 | - . '_dtypes_x_cat') |
|
| 1074 | - . ' x WHERE d.dtypeid=x.dtypeid AND x.cid = ' |
|
| 1075 | - . $pid |
|
| 1076 | - . " AND d.defaultyn = '1'"; |
|
| 1077 | - } |
|
| 1078 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 1063 | + global $xoopsDB, $_POST, $eh; |
|
| 1064 | + if ($pid != 0) { |
|
| 1065 | + $sql = 'INSERT INTO ' |
|
| 1066 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 1067 | + . ' (cid, dtypeid) SELECT ' |
|
| 1068 | + . $catid |
|
| 1069 | + . ', d.dtypeid FROM ' |
|
| 1070 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 1071 | + . ' d, ' |
|
| 1072 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
|
| 1073 | + . '_dtypes_x_cat') |
|
| 1074 | + . ' x WHERE d.dtypeid=x.dtypeid AND x.cid = ' |
|
| 1075 | + . $pid |
|
| 1076 | + . " AND d.defaultyn = '1'"; |
|
| 1077 | + } |
|
| 1078 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 1079 | 1079 | } |
@@ -935,39 +935,39 @@ |
||
| 935 | 935 | $op = $_POST['op']; |
| 936 | 936 | } |
| 937 | 937 | switch ($op) { |
| 938 | - case 'newdatatype': |
|
| 939 | - addDatatype(); |
|
| 940 | - break; |
|
| 941 | - case 'editdtypes': |
|
| 942 | - editDatatypes(); |
|
| 943 | - break; |
|
| 944 | - case 'editdtype': |
|
| 945 | - editDatatype($get_dtypeid); |
|
| 946 | - break; |
|
| 947 | - case 'savedtype': |
|
| 948 | - saveDatatype(); |
|
| 949 | - break; |
|
| 950 | - case 'importdtypes': |
|
| 951 | - importDatatypes(); |
|
| 952 | - break; |
|
| 953 | - case 'edit': |
|
| 954 | - editCat($get_catid); |
|
| 955 | - break; |
|
| 956 | - case 'update': |
|
| 957 | - updateCat(); |
|
| 958 | - break; |
|
| 959 | - case 'newcat': |
|
| 960 | - newCat(); |
|
| 961 | - break; |
|
| 962 | - case 'deleteCat': |
|
| 963 | - deleteCat(); |
|
| 964 | - break; |
|
| 965 | - case 'deleteCatConfirm': |
|
| 966 | - deleteCatConfirm(); |
|
| 967 | - break; |
|
| 968 | - default: |
|
| 969 | - catConfig($get_dirid); |
|
| 970 | - break; |
|
| 938 | + case 'newdatatype': |
|
| 939 | + addDatatype(); |
|
| 940 | + break; |
|
| 941 | + case 'editdtypes': |
|
| 942 | + editDatatypes(); |
|
| 943 | + break; |
|
| 944 | + case 'editdtype': |
|
| 945 | + editDatatype($get_dtypeid); |
|
| 946 | + break; |
|
| 947 | + case 'savedtype': |
|
| 948 | + saveDatatype(); |
|
| 949 | + break; |
|
| 950 | + case 'importdtypes': |
|
| 951 | + importDatatypes(); |
|
| 952 | + break; |
|
| 953 | + case 'edit': |
|
| 954 | + editCat($get_catid); |
|
| 955 | + break; |
|
| 956 | + case 'update': |
|
| 957 | + updateCat(); |
|
| 958 | + break; |
|
| 959 | + case 'newcat': |
|
| 960 | + newCat(); |
|
| 961 | + break; |
|
| 962 | + case 'deleteCat': |
|
| 963 | + deleteCat(); |
|
| 964 | + break; |
|
| 965 | + case 'deleteCatConfirm': |
|
| 966 | + deleteCatConfirm(); |
|
| 967 | + break; |
|
| 968 | + default: |
|
| 969 | + catConfig($get_dirid); |
|
| 970 | + break; |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | function getCatOverview() |
@@ -18,34 +18,34 @@ discard block |
||
| 18 | 18 | * @author XOOPS Development Team, |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -require_once __DIR__ . '/admin_header.php'; |
|
| 21 | +require_once __DIR__.'/admin_header.php'; |
|
| 22 | 22 | //include __DIR__ . '/../../../include/cp_header.php'; |
| 23 | 23 | |
| 24 | -include __DIR__ . '/../include/functions.php'; |
|
| 25 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
| 26 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
| 27 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 28 | -require_once __DIR__ . '/../class/class.formimage.php'; |
|
| 29 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 30 | -require_once __DIR__ . '/../class/class.efqtree.php'; |
|
| 31 | -$efqtree = new EfqTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 24 | +include __DIR__.'/../include/functions.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 27 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 28 | +require_once __DIR__.'/../class/class.formimage.php'; |
|
| 29 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 30 | +require_once __DIR__.'/../class/class.efqtree.php'; |
|
| 31 | +$efqtree = new EfqTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 32 | 32 | $myts = MyTextSanitizer::getInstance(); |
| 33 | 33 | $eh = new ErrorHandler; |
| 34 | -$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 35 | -$mytree2 = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes'), 'typeid', 0); |
|
| 36 | -$efqtree = new EfqTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 34 | +$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 35 | +$mytree2 = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes'), 'typeid', 0); |
|
| 36 | +$efqtree = new EfqTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 37 | 37 | |
| 38 | 38 | $moddir = $xoopsModule->getVar('dirname'); |
| 39 | 39 | if (isset($_GET['dirid'])) { |
| 40 | - $get_dirid = (int)$_GET['dirid']; |
|
| 40 | + $get_dirid = (int) $_GET['dirid']; |
|
| 41 | 41 | } else { |
| 42 | 42 | $get_dirid = 0; |
| 43 | 43 | } |
| 44 | 44 | if (isset($_GET['dtypeid'])) { |
| 45 | - $get_dtypeid = (int)$_GET['dtypeid']; |
|
| 45 | + $get_dtypeid = (int) $_GET['dtypeid']; |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($_GET['catid'])) { |
| 48 | - $get_catid = (int)$_GET['catid']; |
|
| 48 | + $get_catid = (int) $_GET['catid']; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | function catConfig($dirid = '0') |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | xoops_cp_header(); |
| 59 | 59 | //adminmenu(-1, _MD_MANAGE_CATS); |
| 60 | 60 | $dirname = getDirNameFromId($dirid); |
| 61 | - echo '<h4>' . _MD_CATCONF . ' - ' . $dirname . '</h4>'; |
|
| 61 | + echo '<h4>'._MD_CATCONF.' - '.$dirname.'</h4>'; |
|
| 62 | 62 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
| 63 | 63 | //Get all main categories for this directory. |
| 64 | 64 | $cats = getCatOverview(); |
| 65 | 65 | echo $cats; |
| 66 | 66 | echo '</table>'; |
| 67 | 67 | echo '<br>'; |
| 68 | - echo '<h4>' . _MD_CREATE_NEWCAT . '</h4>'; |
|
| 68 | + echo '<h4>'._MD_CREATE_NEWCAT.'</h4>'; |
|
| 69 | 69 | echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
| 70 | 70 | $form = new XoopsThemeForm(_MD_NEWCATFORM, 'submitform', 'categories.php'); |
| 71 | 71 | $form->setExtra('enctype="multipart/form-data"'); |
@@ -111,28 +111,28 @@ discard block |
||
| 111 | 111 | xoops_cp_header(); |
| 112 | 112 | $diridfromcatid = getDirId($get_catid); |
| 113 | 113 | //adminmenu(-1, _MD_EDITCAT); |
| 114 | - echo '<h4>' . _MD_EDITCAT . '</h4>'; |
|
| 115 | - $pathstring = "<a href='categories.php?dirid=$diridfromcatid'>" . _MD_MAIN . '</a> : '; |
|
| 114 | + echo '<h4>'._MD_EDITCAT.'</h4>'; |
|
| 115 | + $pathstring = "<a href='categories.php?dirid=$diridfromcatid'>"._MD_MAIN.'</a> : '; |
|
| 116 | 116 | $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'categories.php?op=edit'); |
| 117 | - echo $pathstring . '<br><br>'; |
|
| 117 | + echo $pathstring.'<br><br>'; |
|
| 118 | 118 | |
| 119 | 119 | $catchildren = $mytree->getFirstChild($get_catid); |
| 120 | 120 | $count_subcats = count($catchildren); |
| 121 | 121 | if ($count_subcats != 0) { |
| 122 | 122 | $subcategories = ''; |
| 123 | - echo '<strong>' . _MD_SUBCATEGORIES . '</strong>:<br>'; |
|
| 123 | + echo '<strong>'._MD_SUBCATEGORIES.'</strong>:<br>'; |
|
| 124 | 124 | for ($i = 0; $i < $count_subcats; ++$i) { |
| 125 | - $subcategories .= "<a href='categories.php?op=edit&catid=" . $catchildren[$i]['cid'] . '\'>' . $catchildren[$i]['title'] . '</a>'; |
|
| 125 | + $subcategories .= "<a href='categories.php?op=edit&catid=".$catchildren[$i]['cid'].'\'>'.$catchildren[$i]['title'].'</a>'; |
|
| 126 | 126 | if ($i + 1 != $count_subcats) { |
| 127 | 127 | $subcategories .= ', '; |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - echo $subcategories . '<br><br>'; |
|
| 130 | + echo $subcategories.'<br><br>'; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
| 134 | - $result = $xoopsDB->query('SELECT c.cid, c.dirid, c.title, c.active, c.pid, c.img, c.allowlist, c.showpopular, c.height, c.width, t.text FROM ' |
|
| 135 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') |
|
| 134 | + $result = $xoopsDB->query('SELECT c.cid, c.dirid, c.title, c.active, c.pid, c.img, c.allowlist, c.showpopular, c.height, c.width, t.text FROM ' |
|
| 135 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat') |
|
| 136 | 136 | . ' c LEFT JOIN ' |
| 137 | 137 | . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
| 138 | 138 | . '_cat_txt') |
@@ -181,25 +181,25 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | echo '</td></tr></table>'; |
| 184 | - $dellink = "<align=\"right\"><a href=\"categories.php?op=deleteCatConfirm&catid=$get_catid\"><img src=\"" . XOOPS_URL . '/images/drop.png">' . _MD_DELETE_CAT . '</a></align>'; |
|
| 184 | + $dellink = "<align=\"right\"><a href=\"categories.php?op=deleteCatConfirm&catid=$get_catid\"><img src=\"".XOOPS_URL.'/images/drop.png">'._MD_DELETE_CAT.'</a></align>'; |
|
| 185 | 185 | echo $dellink; |
| 186 | - echo '<h4>' . _MD_EDITDTYPES . '</h4>'; |
|
| 186 | + echo '<h4>'._MD_EDITDTYPES.'</h4>'; |
|
| 187 | 187 | echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
| 188 | 188 | echo '<form name="editdtypes" id="editdtypes" action="categories.php" method="post">'; |
| 189 | 189 | echo '<table width="100%" class="outer" cellspacing="1">'; |
| 190 | - $result = $xoopsDB->query('SELECT d.dtypeid, x.cid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 191 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 190 | + $result = $xoopsDB->query('SELECT d.dtypeid, x.cid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 191 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 192 | 192 | . ' d, ' |
| 193 | 193 | . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
| 194 | 194 | . '_fieldtypes') |
| 195 | 195 | . ' f, ' |
| 196 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 196 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 197 | 197 | . " x WHERE d.fieldtypeid=f.typeid AND d.dtypeid=x.dtypeid AND x.cid='" |
| 198 | 198 | . $catid |
| 199 | 199 | . '\' ORDER BY d.section ASC, d.seq ASC') |
| 200 | 200 | || $eh->show('0013'); |
| 201 | 201 | $numrows = $xoopsDB->getRowsNum($result); |
| 202 | - echo '<tr><th>' . _MD_DTYPE_ICON . '</th><th>' . _MD_DTYPE_TITLE . '</th><th>' . _MD_FTYPE_NAME . '</th><th>' . _MD_OPTIONS . '</th><th>' . _MD_CUSTOM . '</th><th>' . _MD_ACTIVE . '</th><th>' . _MD_DEFAULT . '</th><th>' . _MD_DTYPE_SEQ . '</th><th>' . _MD_SECTION . '</th></tr>'; |
|
| 202 | + echo '<tr><th>'._MD_DTYPE_ICON.'</th><th>'._MD_DTYPE_TITLE.'</th><th>'._MD_FTYPE_NAME.'</th><th>'._MD_OPTIONS.'</th><th>'._MD_CUSTOM.'</th><th>'._MD_ACTIVE.'</th><th>'._MD_DEFAULT.'</th><th>'._MD_DTYPE_SEQ.'</th><th>'._MD_SECTION.'</th></tr>'; |
|
| 203 | 203 | if ($numrows > 0) { |
| 204 | 204 | $dtypes = ''; |
| 205 | 205 | $count = 1; |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | //Get the existing fields for this category. |
| 232 | 232 | ob_start(); |
| 233 | - $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype' . $dtypeid . ''); |
|
| 233 | + $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype'.$dtypeid.''); |
|
| 234 | 234 | $ftypebox = ob_get_contents(); |
| 235 | 235 | ob_end_clean(); |
| 236 | 236 | |
| 237 | 237 | if ($count != 1) { |
| 238 | - $dtypes .= '|' . $dtypeid; |
|
| 238 | + $dtypes .= '|'.$dtypeid; |
|
| 239 | 239 | } else { |
| 240 | 240 | $dtypes = $dtypeid; |
| 241 | 241 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | . _MD_UPDATE |
| 265 | 265 | . '" ></td></tr>'; |
| 266 | 266 | } else { |
| 267 | - echo '<tr><td colspan="7">' . _MD_NORECORDS . ' '; |
|
| 267 | + echo '<tr><td colspan="7">'._MD_NORECORDS.' '; |
|
| 268 | 268 | if ($parentcat != '0') { |
| 269 | 269 | echo '<input type="hidden" name="op" value="importdtypes"><input type="hidden" name="catid" value="' |
| 270 | 270 | . $get_catid |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | echo '</td></tr>'; |
| 278 | 278 | } |
| 279 | 279 | echo '</table></form></td></tr></table>'; |
| 280 | - echo '<h4>' . _MD_ADDDTYPE . '</h4>'; |
|
| 280 | + echo '<h4>'._MD_ADDDTYPE.'</h4>'; |
|
| 281 | 281 | echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
| 282 | 282 | |
| 283 | 283 | $form = new XoopsThemeForm(_MD_ADD_DTYPE_FORM, 'newdatatypeform', 'categories.php'); |
@@ -290,11 +290,11 @@ discard block |
||
| 290 | 290 | $selbox = ob_get_contents(); |
| 291 | 291 | ob_end_clean(); |
| 292 | 292 | $options_tray = new XoopsFormElementTray(_MD_OPTIONS, ''); |
| 293 | - $options_text = new XoopsFormLabel('', '<br>' . _MD_OPTIONS_EXPL); |
|
| 293 | + $options_text = new XoopsFormLabel('', '<br>'._MD_OPTIONS_EXPL); |
|
| 294 | 294 | $options_textarea = new XoopsFormTextArea('', 'options', '', 6, 50); |
| 295 | 295 | $options_tray->addElement($options_textarea); |
| 296 | 296 | $options_tray->addElement($options_text); |
| 297 | - $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox . ' <a href="fieldtypes.php">' . _MD_EDIT . '')); |
|
| 297 | + $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox.' <a href="fieldtypes.php">'._MD_EDIT.'')); |
|
| 298 | 298 | $form->addElement($fieldtype_tray, true); |
| 299 | 299 | $form->addElement($options_tray); |
| 300 | 300 | $form_active = new XoopsFormCheckBox(_MD_DTYPE_ACTIVEYN, 'activeyn', 0); |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | $form->display(); |
| 316 | 316 | echo '</td></tr></table>'; |
| 317 | 317 | echo '<br>'; |
| 318 | - echo '<h4>' . _MD_CREATE_NEWSUBCAT . '</h4>'; |
|
| 318 | + echo '<h4>'._MD_CREATE_NEWSUBCAT.'</h4>'; |
|
| 319 | 319 | echo "<table width='100%' border='0' cellspacing='1'><tr><td>"; |
| 320 | 320 | $form = new XoopsThemeForm(_MD_NEWCATFORM, 'submitform', 'categories.php'); |
| 321 | 321 | $form->setExtra('enctype="multipart/form-data"'); |
@@ -358,11 +358,11 @@ discard block |
||
| 358 | 358 | global $xoopsDB, $mytree, $mytree2, $xoopsUser, $get_catid, $eh; |
| 359 | 359 | xoops_cp_header(); |
| 360 | 360 | //adminmenu(-1, _MD_EDITCAT); |
| 361 | - echo '<h4>' . _MD_EDITDTYPE . '</h4>'; |
|
| 361 | + echo '<h4>'._MD_EDITDTYPE.'</h4>'; |
|
| 362 | 362 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
| 363 | 363 | |
| 364 | - $result = $xoopsDB->query('SELECT d.dtypeid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 365 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 364 | + $result = $xoopsDB->query('SELECT d.dtypeid, d.title, d.section, d.seq, d.icon, f.title, f.typeid, d.defaultyn, d.activeyn, d.options, d.custom FROM ' |
|
| 365 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 366 | 366 | . ' d, ' |
| 367 | 367 | . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
| 368 | 368 | . '_fieldtypes') |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $custom = '0'; |
| 399 | 399 | } |
| 400 | 400 | ob_start(); |
| 401 | - $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype' . $dtypeid . ''); |
|
| 401 | + $mytree2->makeMySelBox('title', 'title', $ftypeid, 1, 'fieldtype'.$dtypeid.''); |
|
| 402 | 402 | $ftypebox = ob_get_contents(); |
| 403 | 403 | ob_end_clean(); |
| 404 | 404 | |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | $selbox = ob_get_contents(); |
| 417 | 417 | ob_end_clean(); |
| 418 | 418 | $options_tray = new XoopsFormElementTray(_MD_OPTIONS, ''); |
| 419 | - $options_text = new XoopsFormLabel('', '<br>' . _MD_OPTIONS_EXPL); |
|
| 419 | + $options_text = new XoopsFormLabel('', '<br>'._MD_OPTIONS_EXPL); |
|
| 420 | 420 | $options_textarea = new XoopsFormTextArea('', 'options', $options, 6, 5); |
| 421 | 421 | $options_tray->addElement($options_textarea); |
| 422 | 422 | $options_tray->addElement($options_text); |
| 423 | - $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox . ' <a href="fieldtypes.php">' . _MD_EDIT . '')); |
|
| 423 | + $fieldtype_tray->addElement(new XoopsFormLabel('', $selbox.' <a href="fieldtypes.php">'._MD_EDIT.'')); |
|
| 424 | 424 | $form->addElement($fieldtype_tray, true); |
| 425 | 425 | $form->addElement($options_tray); |
| 426 | 426 | $form_active = new XoopsFormCheckBox(_MD_DTYPE_ACTIVEYN, 'activeyn', $activeyn); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $form->display(); |
| 440 | 440 | } |
| 441 | 441 | } else { |
| 442 | - echo '<table><tr><td colspan="7">' . _MD_NORECORDS . ' '; |
|
| 442 | + echo '<table><tr><td colspan="7">'._MD_NORECORDS.' '; |
|
| 443 | 443 | // if ($parentcat != '0') { |
| 444 | 444 | // echo "<input type=\"hidden\" name=\"op\" value=\"importdtypes\"><input type=\"hidden\" name=\"catid\" value=\"".$get_catid."\"><input type=\"hidden\" name=\"pid\" value=\"".$parentcat."\"><input type=\"submit\" class=\"formButton\" name=\"submit\" id=\"submit\" value=\""._MD_IMPORT_DTYPES_FROM_PARENTCAT."\" >"; |
| 445 | 445 | // } |
@@ -483,8 +483,8 @@ discard block |
||
| 483 | 483 | $p_fieldtype = $_POST['typeid']; |
| 484 | 484 | $p_seq = $myts->makeTboxData4Save($_POST['seq']); |
| 485 | 485 | |
| 486 | - require_once XOOPS_ROOT_PATH . '/class/class.uploader.php'; |
|
| 487 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 486 | + require_once XOOPS_ROOT_PATH.'/class/class.uploader.php'; |
|
| 487 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH."/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 488 | 488 | $uploader->setPrefix('icon'); |
| 489 | 489 | $err = array(); |
| 490 | 490 | $ucount = count($_POST['xoops_upload_file']); |
@@ -499,32 +499,32 @@ discard block |
||
| 499 | 499 | $savedfilename = $uploader->getSavedFileName(); |
| 500 | 500 | $ticket = uniqid(mt_rand(), 1); |
| 501 | 501 | //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
| 502 | - rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . ''); |
|
| 502 | + rename(''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads/'.$savedfilename.'', ''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/uploads/'.$savedfilename.''); |
|
| 503 | 503 | //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
| 504 | - if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) { |
|
| 505 | - unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . ''); |
|
| 504 | + if (file_exists(''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads/'.$savedfilename.'')) { |
|
| 505 | + unlink(''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads/'.$savedfilename.''); |
|
| 506 | 506 | } |
| 507 | 507 | $sql = 'UPDATE ' |
| 508 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 508 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 509 | 509 | . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom', icon='$savedfilename' WHERE dtypeid = $p_dtypeid"; |
| 510 | 510 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 511 | 511 | } |
| 512 | 512 | } else { |
| 513 | 513 | $sql = 'UPDATE ' |
| 514 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 514 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 515 | 515 | . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
| 516 | 516 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 517 | 517 | } |
| 518 | 518 | } else { |
| 519 | 519 | $sql = 'UPDATE ' |
| 520 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 520 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 521 | 521 | . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
| 522 | 522 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | } else { |
| 526 | 526 | $sql = 'UPDATE ' |
| 527 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 527 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 528 | 528 | . " SET title = '$p_title', section = '$p_section', fieldtypeid = '$p_fieldtype', defaultyn = '$p_default', activeyn='$p_active', seq='$p_seq', options='$p_options', custom='$p_custom' WHERE dtypeid = $p_dtypeid"; |
| 529 | 529 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 530 | 530 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | } else { |
| 563 | 563 | $p_options = ''; |
| 564 | 564 | } |
| 565 | - $p_fieldtype = (int)$_POST['typeid']; |
|
| 565 | + $p_fieldtype = (int) $_POST['typeid']; |
|
| 566 | 566 | if ($p_fieldtype == '') { |
| 567 | 567 | redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_NOFIELDTYPE_SELECTED); |
| 568 | 568 | exit(); |
@@ -570,9 +570,9 @@ discard block |
||
| 570 | 570 | $p_section = $myts->makeTboxData4Save($_POST['section']); |
| 571 | 571 | $uid = $xoopsUser->getVar('uid'); |
| 572 | 572 | |
| 573 | - require_once XOOPS_ROOT_PATH . '/class/class.uploader.php'; |
|
| 573 | + require_once XOOPS_ROOT_PATH.'/class/class.uploader.php'; |
|
| 574 | 574 | //$uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads', array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
| 575 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 575 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH."/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 50, 50); |
|
| 576 | 576 | $uploader->setPrefix('icon'); |
| 577 | 577 | $err = array(); |
| 578 | 578 | $ucount = count($_POST['xoops_upload_file']); |
@@ -587,22 +587,22 @@ discard block |
||
| 587 | 587 | $savedfilename = $uploader->getSavedFileName(); |
| 588 | 588 | $ticket = uniqid(mt_rand(), 1); |
| 589 | 589 | //Rename the uploaded file to the same name in a different location that does not have 777 rights or 755. |
| 590 | - rename('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '', '' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/uploads/' . $savedfilename . ''); |
|
| 590 | + rename(''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads/'.$savedfilename.'', ''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/uploads/'.$savedfilename.''); |
|
| 591 | 591 | //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
| 592 | - if (file_exists('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . '')) { |
|
| 593 | - unlink('' . XOOPS_ROOT_PATH . '/modules/' . $moddir . '/init_uploads/' . $savedfilename . ''); |
|
| 592 | + if (file_exists(''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads/'.$savedfilename.'')) { |
|
| 593 | + unlink(''.XOOPS_ROOT_PATH.'/modules/'.$moddir.'/init_uploads/'.$savedfilename.''); |
|
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | } |
| 598 | 598 | } |
| 599 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . '_dtypeid_seq'); |
|
| 600 | - $sql = sprintf("INSERT INTO %s (dtypeid, title, section, fieldtypeid, uid, defaultyn, created, seq, activeyn, OPTIONS, custom, icon) VALUES (%u, '%s', %u, %u, %u, %u, '%s', '%s', %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes'), $newid, $p_title, |
|
| 599 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes').'_dtypeid_seq'); |
|
| 600 | + $sql = sprintf("INSERT INTO %s (dtypeid, title, section, fieldtypeid, uid, defaultyn, created, seq, activeyn, OPTIONS, custom, icon) VALUES (%u, '%s', %u, %u, %u, %u, '%s', '%s', %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes'), $newid, $p_title, |
|
| 601 | 601 | $p_section, $p_fieldtype, $uid, $p_default, time(), 0, $p_active, $p_options, $p_custom, $savedfilename); |
| 602 | 602 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 603 | 603 | $dtypeid = $xoopsDB->getInsertId(); |
| 604 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') . '_xid_seq'); |
|
| 605 | - $sql = sprintf('INSERT INTO %s (xid, cid, dtypeid) VALUES (%u, %u, %u)', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat'), $newid, $p_catid, $dtypeid); |
|
| 604 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat').'_xid_seq'); |
|
| 605 | + $sql = sprintf('INSERT INTO %s (xid, cid, dtypeid) VALUES (%u, %u, %u)', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat'), $newid, $p_catid, $dtypeid); |
|
| 606 | 606 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 607 | 607 | redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
| 608 | 608 | exit(); |
@@ -617,19 +617,19 @@ discard block |
||
| 617 | 617 | $p_catid = $_POST['catid']; |
| 618 | 618 | $dtypes_arr = explode('[|]', $dtypes); |
| 619 | 619 | foreach ($dtypes_arr as $dtype) { |
| 620 | - $p_section = $myts->makeTboxData4Save($_POST['section' . $dtype . '']); |
|
| 621 | - if (isset($_POST['defaultyn' . $dtype . ''])) { |
|
| 620 | + $p_section = $myts->makeTboxData4Save($_POST['section'.$dtype.'']); |
|
| 621 | + if (isset($_POST['defaultyn'.$dtype.''])) { |
|
| 622 | 622 | $p_defaultyn = '1'; |
| 623 | 623 | } else { |
| 624 | 624 | $p_defaultyn = '0'; |
| 625 | 625 | } |
| 626 | - $p_seq = $myts->makeTboxData4Save($_POST['seq' . $dtype . '']); |
|
| 627 | - if (isset($_POST['activeyn' . $dtype . ''])) { |
|
| 626 | + $p_seq = $myts->makeTboxData4Save($_POST['seq'.$dtype.'']); |
|
| 627 | + if (isset($_POST['activeyn'.$dtype.''])) { |
|
| 628 | 628 | $p_activeyn = '1'; |
| 629 | 629 | } else { |
| 630 | 630 | $p_activeyn = '0'; |
| 631 | 631 | } |
| 632 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . " SET section = '$p_section', defaultyn = '$p_defaultyn', activeyn='$p_activeyn', seq='$p_seq' WHERE dtypeid = $dtype"; |
|
| 632 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes')." SET section = '$p_section', defaultyn = '$p_defaultyn', activeyn='$p_activeyn', seq='$p_seq' WHERE dtypeid = $dtype"; |
|
| 633 | 633 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 634 | 634 | } |
| 635 | 635 | redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
@@ -651,11 +651,11 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | if ($p_pid != 0) { |
| 653 | 653 | $sql = 'INSERT INTO ' |
| 654 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 654 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 655 | 655 | . ' (cid, dtypeid) SELECT ' |
| 656 | 656 | . $p_catid |
| 657 | 657 | . ', d.dtypeid FROM ' |
| 658 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 658 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 659 | 659 | . ' d, ' |
| 660 | 660 | . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
| 661 | 661 | . '_dtypes_x_cat') |
@@ -705,20 +705,20 @@ discard block |
||
| 705 | 705 | $p_descr = false; |
| 706 | 706 | } |
| 707 | 707 | if ($_POST['xoops_upload_file'][0] != '') { |
| 708 | - require_once XOOPS_ROOT_PATH . "/modules/$moddir/class/class.uploader.php"; |
|
| 709 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 708 | + require_once XOOPS_ROOT_PATH."/modules/$moddir/class/class.uploader.php"; |
|
| 709 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH."/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 710 | 710 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
| 711 | 711 | $filename = $uploader->getMediaName(); |
| 712 | 712 | } else { |
| 713 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 713 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 714 | 714 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 715 | 715 | |
| 716 | 716 | if ($p_descr) { |
| 717 | 717 | if ($descr_exists === true) { |
| 718 | - $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 718 | + $sql2 = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt')." SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 719 | 719 | } else { |
| 720 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 721 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 720 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt').'_txtid_seq'); |
|
| 721 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 722 | 722 | } |
| 723 | 723 | $xoopsDB->query($sql2) or $eh->show('0013'); |
| 724 | 724 | } |
@@ -733,25 +733,25 @@ discard block |
||
| 733 | 733 | $imagelocation = $uploader->uploadDir; |
| 734 | 734 | echo $uploader->getErrors(); |
| 735 | 735 | |
| 736 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET img = '$savedfilename', width = '$width', height = '$height' WHERE cid = $p_catid"; |
|
| 736 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." SET img = '$savedfilename', width = '$width', height = '$height' WHERE cid = $p_catid"; |
|
| 737 | 737 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 738 | - rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
|
| 738 | + rename(''.XOOPS_ROOT_PATH."/modules/$moddir/init_uploads/".$savedfilename.'', ''.XOOPS_ROOT_PATH."/modules/$moddir/uploads/".$savedfilename.''); |
|
| 739 | 739 | //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
| 740 | - if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|
| 741 | - unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
|
| 740 | + if (file_exists(''.XOOPS_ROOT_PATH."/modules/$moddir/init_uploads/".$savedfilename.'')) { |
|
| 741 | + unlink(''.XOOPS_ROOT_PATH."/modules/$moddir/init_uploads/".$savedfilename.''); |
|
| 742 | 742 | } |
| 743 | 743 | redirect_header("categories.php?op=edit&catid=$p_catid", 2, _MD_CAT_UPDATED); |
| 744 | 744 | exit(); |
| 745 | 745 | } else { |
| 746 | 746 | echo $uploader->getErrors(); |
| 747 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 747 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." SET title = '$p_title', active='$p_active', pid='$p_pid', allowlist='$p_allowlist', showpopular='$p_showpopular' WHERE cid = $p_catid"; |
|
| 748 | 748 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 749 | 749 | if ($p_descr) { |
| 750 | 750 | if ($descr_exists === true) { |
| 751 | - $sql2 = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . " SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 751 | + $sql2 = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt')." SET text='$p_descr' WHERE cid = $p_catid"; |
|
| 752 | 752 | } else { |
| 753 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 754 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 753 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt').'_txtid_seq'); |
|
| 754 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $newid, $p_catid, $p_descr, '1', time()); |
|
| 755 | 755 | } |
| 756 | 756 | $xoopsDB->query($sql2) or $eh->show('0013'); |
| 757 | 757 | } |
@@ -813,20 +813,20 @@ discard block |
||
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | if ($_POST['xoops_upload_file'][0] != '') { |
| 816 | - require_once XOOPS_ROOT_PATH . "/modules/$moddir/class/class.uploader.php"; |
|
| 817 | - $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 816 | + require_once XOOPS_ROOT_PATH."/modules/$moddir/class/class.uploader.php"; |
|
| 817 | + $uploader = new XoopsMediaUploader(XOOPS_ROOT_PATH."/modules/$moddir/init_uploads", array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/jpg'), 30000, 250, 250); |
|
| 818 | 818 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
| 819 | 819 | $filename = $uploader->getMediaName(); |
| 820 | 820 | } else { |
| 821 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 822 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, allowlist, showpopular) VALUES (%u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, $p_allowlist, $p_showpopular); |
|
| 821 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat').'_cid_seq'); |
|
| 822 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, allowlist, showpopular) VALUES (%u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, $p_allowlist, $p_showpopular); |
|
| 823 | 823 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 824 | 824 | if ($newid == 0) { |
| 825 | 825 | $cid = $xoopsDB->getInsertId(); |
| 826 | 826 | } |
| 827 | 827 | if ($p_descr != '') { |
| 828 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 829 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 828 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt').'_txtid_seq'); |
|
| 829 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 830 | 830 | $xoopsDB->query($sql2) or $eh->show('0013'); |
| 831 | 831 | } |
| 832 | 832 | if ($p_import == '1') { |
@@ -843,40 +843,40 @@ discard block |
||
| 843 | 843 | $height = $uploader->getHeight(); |
| 844 | 844 | $imagelocation = $uploader->uploadDir; |
| 845 | 845 | echo $uploader->getErrors(); |
| 846 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 847 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, |
|
| 846 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat').'_cid_seq'); |
|
| 847 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, '%s', %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, |
|
| 848 | 848 | $savedfilename, $p_allowlist, $p_showpopular, $width, $height); |
| 849 | 849 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 850 | 850 | if ($newid == 0) { |
| 851 | 851 | $cid = $xoopsDB->getInsertId(); |
| 852 | 852 | } |
| 853 | 853 | if ($p_descr != '') { |
| 854 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 855 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 854 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt').'_txtid_seq'); |
|
| 855 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 856 | 856 | $xoopsDB->query($sql2) or $eh->show('0013'); |
| 857 | 857 | } |
| 858 | 858 | if ($p_import == '1') { |
| 859 | 859 | importDtypes($p_pid, $cid); |
| 860 | 860 | } |
| 861 | - rename('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '', '' . XOOPS_ROOT_PATH . "/modules/$moddir/uploads/" . $savedfilename . ''); |
|
| 861 | + rename(''.XOOPS_ROOT_PATH."/modules/$moddir/init_uploads/".$savedfilename.'', ''.XOOPS_ROOT_PATH."/modules/$moddir/uploads/".$savedfilename.''); |
|
| 862 | 862 | //Delete the uploaded file from the initial upload folder if it is still present in that folder. |
| 863 | - if (file_exists('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . '')) { |
|
| 864 | - unlink('' . XOOPS_ROOT_PATH . "/modules/$moddir/init_uploads/" . $savedfilename . ''); |
|
| 863 | + if (file_exists(''.XOOPS_ROOT_PATH."/modules/$moddir/init_uploads/".$savedfilename.'')) { |
|
| 864 | + unlink(''.XOOPS_ROOT_PATH."/modules/$moddir/init_uploads/".$savedfilename.''); |
|
| 865 | 865 | } |
| 866 | 866 | redirect_header("categories.php?op=edit&catid=$cid", 2, _MD_CAT_SAVED); |
| 867 | 867 | exit(); |
| 868 | 868 | } else { |
| 869 | 869 | echo $uploader->getErrors(); |
| 870 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . '_cid_seq'); |
|
| 871 | - $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, '', |
|
| 870 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat').'_cid_seq'); |
|
| 871 | + $sql = sprintf("INSERT INTO %s (cid, dirid, title, active, pid, img, allowlist, showpopular, width, height) VALUES (%u, %u, '%s', %u, %u, %u, %u, %u, %u, %u)", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), $newid, $p_dirid, $p_title, $p_active, $p_pid, '', |
|
| 872 | 872 | $p_allowlist, $p_showpopular, '', ''); |
| 873 | 873 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 874 | 874 | if ($newid == 0) { |
| 875 | 875 | $cid = $xoopsDB->getInsertId(); |
| 876 | 876 | } |
| 877 | 877 | if ($p_descr != '') { |
| 878 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt') . '_txtid_seq'); |
|
| 879 | - $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 878 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt').'_txtid_seq'); |
|
| 879 | + $sql2 = sprintf("INSERT INTO %s (txtid, cid, TEXT, active, created) VALUES (%u, %u, '%s', %u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $newid, $cid, $p_descr, $p_txtactive, time()); |
|
| 880 | 880 | $xoopsDB->query($sql2) or $eh->show('0013'); |
| 881 | 881 | } |
| 882 | 882 | if ($p_import == '1') { |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | $form = new XoopsThemeForm(_MD_CONFIRM_DELETECAT_FORM, 'confirmform', 'categories.php'); |
| 899 | 899 | $submit_tray = new XoopsFormElementTray(_MD_DELETE_CAT_YN, '', 'cid'); |
| 900 | 900 | $submit_tray->addElement(new XoopsFormButton('', 'submit', _MD_DELETE, 'submit')); |
| 901 | - $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="' . _MD_CANCEL . "\" onclick=\"location='categories.php?op=edit&catid=$get_catid'\"")); |
|
| 901 | + $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="'._MD_CANCEL."\" onclick=\"location='categories.php?op=edit&catid=$get_catid'\"")); |
|
| 902 | 902 | $form->addElement($submit_tray, true); |
| 903 | 903 | //'$form->addElement($form_submit); |
| 904 | 904 | $form->addElement(new XoopsFormHidden('op', 'deleteCat')); |
@@ -911,21 +911,21 @@ discard block |
||
| 911 | 911 | { |
| 912 | 912 | global $xoopsDB, $_POST, $eh, $xoopsModule; |
| 913 | 913 | if (isset($_POST['catid'])) { |
| 914 | - $p_catid = (int)$_POST['catid']; |
|
| 914 | + $p_catid = (int) $_POST['catid']; |
|
| 915 | 915 | } else { |
| 916 | 916 | redirect_header('directories.php', 2, _MD_INVALID_DIR); |
| 917 | 917 | exit(); |
| 918 | 918 | } |
| 919 | 919 | $dirid = getDirId($p_catid); |
| 920 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $p_catid); |
|
| 920 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat'), $p_catid); |
|
| 921 | 921 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 922 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), $p_catid); |
|
| 922 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), $p_catid); |
|
| 923 | 923 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 924 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat_txt'), $p_catid); |
|
| 924 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat_txt'), $p_catid); |
|
| 925 | 925 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 926 | - $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat'), $p_catid); |
|
| 926 | + $sql = sprintf('DELETE FROM %s WHERE cid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat'), $p_catid); |
|
| 927 | 927 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 928 | - redirect_header('categories.php?dirid=' . $dirid, 2, _MD_CAT_DELETED); |
|
| 928 | + redirect_header('categories.php?dirid='.$dirid, 2, _MD_CAT_DELETED); |
|
| 929 | 929 | exit(); |
| 930 | 930 | } |
| 931 | 931 | |
@@ -973,19 +973,19 @@ discard block |
||
| 973 | 973 | function getCatOverview() |
| 974 | 974 | { |
| 975 | 975 | global $xoopsDB, $myts, $eh, $mytree, $get_dirid, $moddir; |
| 976 | - $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'0\''); |
|
| 976 | + $mainresult = $xoopsDB->query('SELECT cid, title, active, pid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." WHERE dirid='".$get_dirid.'\' AND pid=\'0\''); |
|
| 977 | 977 | $numrows = $xoopsDB->getRowsNum($mainresult); |
| 978 | 978 | $output = ''; |
| 979 | 979 | if ($numrows > 0) { |
| 980 | - $output = '<th>' . _MD_CATTITLE . '</th><th>' . _MD_ACTIVE . '</th><th>' . _MD_ACTION . "</th>\n"; |
|
| 980 | + $output = '<th>'._MD_CATTITLE.'</th><th>'._MD_ACTIVE.'</th><th>'._MD_ACTION."</th>\n"; |
|
| 981 | 981 | $brench = 0; |
| 982 | 982 | $tab = ''; |
| 983 | 983 | while (list($cid, $title, $active, $pid) = $xoopsDB->fetchRow($mainresult)) { |
| 984 | 984 | //For each cid, get all 'first children' using getFirstChildId() function |
| 985 | 985 | if ($active != '0') { |
| 986 | - $activeyn = '' . _MD_YES . ''; |
|
| 986 | + $activeyn = ''._MD_YES.''; |
|
| 987 | 987 | } else { |
| 988 | - $activeyn = '' . _MD_NO . ''; |
|
| 988 | + $activeyn = ''._MD_NO.''; |
|
| 989 | 989 | } |
| 990 | 990 | $output .= '<tr><td>' |
| 991 | 991 | . $tab |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | $output .= getChildrenCategories($cid); |
| 1008 | 1008 | } |
| 1009 | 1009 | } else { |
| 1010 | - $output = '<p><span style="background-color: #E6E6E6; padding: 5px; border: 1px solid #000000;">' . _MD_NORESULTS_PLEASE_CREATE_CATEGORY . '</span></p>'; |
|
| 1010 | + $output = '<p><span style="background-color: #E6E6E6; padding: 5px; border: 1px solid #000000;">'._MD_NORESULTS_PLEASE_CREATE_CATEGORY.'</span></p>'; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | |
| 1013 | 1013 | return $output; |
@@ -1019,21 +1019,21 @@ discard block |
||
| 1019 | 1019 | $tab = ' '; |
| 1020 | 1020 | $level = $level; |
| 1021 | 1021 | $output = ''; |
| 1022 | - $plus = '<img src="' . XOOPS_URL . '/images/arrow.gif">'; |
|
| 1022 | + $plus = '<img src="'.XOOPS_URL.'/images/arrow.gif">'; |
|
| 1023 | 1023 | for ($i = 0; $i < $level; ++$i) { |
| 1024 | 1024 | $tab .= ' '; |
| 1025 | 1025 | } |
| 1026 | - $sql = 'SELECT cid, title, active, pid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $get_dirid . '\' AND pid=\'' . $childid . '\''; |
|
| 1026 | + $sql = 'SELECT cid, title, active, pid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." WHERE dirid='".$get_dirid.'\' AND pid=\''.$childid.'\''; |
|
| 1027 | 1027 | $childresult = $xoopsDB->query($sql); |
| 1028 | 1028 | $numrows = $xoopsDB->getRowsNum($childresult); |
| 1029 | 1029 | if ($numrows > 0) { |
| 1030 | 1030 | while (list($cid, $title, $active, $pid) = $xoopsDB->fetchRow($childresult)) { |
| 1031 | 1031 | if ($active != '0') { |
| 1032 | - $activeyn = '' . _MD_YES . ''; |
|
| 1032 | + $activeyn = ''._MD_YES.''; |
|
| 1033 | 1033 | } else { |
| 1034 | - $activeyn = '' . _MD_NO . ''; |
|
| 1034 | + $activeyn = ''._MD_NO.''; |
|
| 1035 | 1035 | } |
| 1036 | - $output .= '<tr><td>' |
|
| 1036 | + $output .= '<tr><td>' |
|
| 1037 | 1037 | . $tab |
| 1038 | 1038 | . $plus |
| 1039 | 1039 | . $title |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | . _MD_MANAGE_CAT |
| 1052 | 1052 | . "\"></a></td></tr>\n"; |
| 1053 | 1053 | $newlevel = $level + 1; |
| 1054 | - $output .= getChildrenCategories($cid, $newlevel); |
|
| 1054 | + $output .= getChildrenCategories($cid, $newlevel); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | } |
| 1057 | 1057 | |
@@ -1063,11 +1063,11 @@ discard block |
||
| 1063 | 1063 | global $xoopsDB, $_POST, $eh; |
| 1064 | 1064 | if ($pid != 0) { |
| 1065 | 1065 | $sql = 'INSERT INTO ' |
| 1066 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 1066 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 1067 | 1067 | . ' (cid, dtypeid) SELECT ' |
| 1068 | 1068 | . $catid |
| 1069 | 1069 | . ', d.dtypeid FROM ' |
| 1070 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 1070 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 1071 | 1071 | . ' d, ' |
| 1072 | 1072 | . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') |
| 1073 | 1073 | . '_dtypes_x_cat') |
@@ -30,19 +30,19 @@ discard block |
||
| 30 | 30 | $myts = MyTextSanitizer::getInstance(); |
| 31 | 31 | $eh = new ErrorHandler; |
| 32 | 32 | if (isset($_GET['op'])) { |
| 33 | - $op = $_GET['op']; |
|
| 33 | + $op = $_GET['op']; |
|
| 34 | 34 | } else { |
| 35 | - $op = 'showExtFields'; |
|
| 35 | + $op = 'showExtFields'; |
|
| 36 | 36 | } |
| 37 | 37 | if (isset($_GET['type'])) { |
| 38 | - $type = $_GET['type']; |
|
| 38 | + $type = $_GET['type']; |
|
| 39 | 39 | } else { |
| 40 | - $type = 'text'; |
|
| 40 | + $type = 'text'; |
|
| 41 | 41 | } |
| 42 | 42 | if (isset($_GET['ext'])) { |
| 43 | - $ext = $_GET['ext']; |
|
| 43 | + $ext = $_GET['ext']; |
|
| 44 | 44 | } else { |
| 45 | - $ext = ''; |
|
| 45 | + $ext = ''; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -51,28 +51,28 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function showExtFields($type = 'text', $ext = '') |
| 53 | 53 | { |
| 54 | - global $xoopsConfig, $xoopsDB, $_POST, $myts, $eh, $xoopsUser; |
|
| 54 | + global $xoopsConfig, $xoopsDB, $_POST, $myts, $eh, $xoopsUser; |
|
| 55 | 55 | |
| 56 | - //MHE - This is added code for the listings module, handling the extension manager. |
|
| 57 | - if (!headers_sent()) { |
|
| 58 | - header('Content-Type:text/html; charset=' . _CHARSET); |
|
| 59 | - header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
| 60 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 61 | - header('Cache-Control: no-store, no-cache, must-revalidate'); |
|
| 62 | - header('Cache-Control: post-check=0, pre-check=0', false); |
|
| 63 | - header('Pragma: no-cache'); |
|
| 64 | - } |
|
| 65 | - echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"\n'; |
|
| 66 | - echo '"http://www.w3.org/TR/html4/strict.dtd">'; |
|
| 67 | - echo "<html lang=\"en\" dir=\"ltr\">\n"; |
|
| 68 | - echo "<head>\n"; |
|
| 69 | - echo '<meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '">'; |
|
| 70 | - echo '<meta http-equiv="content-language" content="' . _LANGCODE . '">'; |
|
| 71 | - echo '<title>Extension Manager</title>'; |
|
| 72 | - echo '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/xoops.css">'; |
|
| 73 | - echo '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/modules/system/style.css">'; |
|
| 74 | - echo '<script type="text/javascript"><!--'; |
|
| 75 | - echo ' |
|
| 56 | + //MHE - This is added code for the listings module, handling the extension manager. |
|
| 57 | + if (!headers_sent()) { |
|
| 58 | + header('Content-Type:text/html; charset=' . _CHARSET); |
|
| 59 | + header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
|
| 60 | + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 61 | + header('Cache-Control: no-store, no-cache, must-revalidate'); |
|
| 62 | + header('Cache-Control: post-check=0, pre-check=0', false); |
|
| 63 | + header('Pragma: no-cache'); |
|
| 64 | + } |
|
| 65 | + echo '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"\n'; |
|
| 66 | + echo '"http://www.w3.org/TR/html4/strict.dtd">'; |
|
| 67 | + echo "<html lang=\"en\" dir=\"ltr\">\n"; |
|
| 68 | + echo "<head>\n"; |
|
| 69 | + echo '<meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '">'; |
|
| 70 | + echo '<meta http-equiv="content-language" content="' . _LANGCODE . '">'; |
|
| 71 | + echo '<title>Extension Manager</title>'; |
|
| 72 | + echo '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/xoops.css">'; |
|
| 73 | + echo '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/modules/system/style.css">'; |
|
| 74 | + echo '<script type="text/javascript"><!--'; |
|
| 75 | + echo ' |
|
| 76 | 76 | function ext_initial_adv(formName, obj, type) |
| 77 | 77 | { |
| 78 | 78 | typeid = opener.document.forms[formName].elements[type].value; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | i ++; |
| 216 | 216 | } |
| 217 | 217 | }\n"; |
| 218 | - echo " |
|
| 218 | + echo " |
|
| 219 | 219 | function makeArray(n) |
| 220 | 220 | { |
| 221 | 221 | this.length = n; |
@@ -225,12 +225,12 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | return this; |
| 227 | 227 | }\n"; |
| 228 | - echo " |
|
| 228 | + echo " |
|
| 229 | 229 | function updatefield(formname, fieldname, fieldvalue) |
| 230 | 230 | { |
| 231 | 231 | myform.elements[fieldname].value = [fieldvalue]; |
| 232 | 232 | }\n"; |
| 233 | - echo " |
|
| 233 | + echo " |
|
| 234 | 234 | function ext_input(formName, obj) |
| 235 | 235 | { |
| 236 | 236 | reg_checkboxes = /multiple|checked/gi; |
@@ -273,80 +273,80 @@ discard block |
||
| 273 | 273 | opener.document.forms[formName].elements[obj].disabled = false; |
| 274 | 274 | self.close(); |
| 275 | 275 | }\n"; |
| 276 | - echo " |
|
| 276 | + echo " |
|
| 277 | 277 | function ext_select(formName, obj, idx) |
| 278 | 278 | { |
| 279 | 279 | opener.document.forms[formName].elements[obj].selectedIndex = idx; |
| 280 | 280 | self.close(); |
| 281 | 281 | }\n"; |
| 282 | - echo " |
|
| 282 | + echo " |
|
| 283 | 283 | function self_checkRadio(formName, obj, choice) |
| 284 | 284 | { |
| 285 | 285 | ext_manager.elements[obj][choice].checked = true; |
| 286 | 286 | }\n"; |
| 287 | - echo " |
|
| 287 | + echo " |
|
| 288 | 288 | function ext_checkRadio(formName, obj, choice) |
| 289 | 289 | { |
| 290 | 290 | opener.document.forms[formName].elements[obj][choice].checked = true; |
| 291 | 291 | self.close(); |
| 292 | 292 | }\n"; |
| 293 | - echo " |
|
| 293 | + echo " |
|
| 294 | 294 | function self_check(formName, obj, choice) |
| 295 | 295 | { |
| 296 | 296 | ext_manager.elements[obj].checked = choice; |
| 297 | 297 | }\n"; |
| 298 | - echo "//--></script>\n"; |
|
| 299 | - echo "</head>\n"; |
|
| 300 | - echo '<body onload="ext_initial_adv(\'submitform\', \'ext\', \'field_type\')">'; |
|
| 301 | - echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'> |
|
| 298 | + echo "//--></script>\n"; |
|
| 299 | + echo "</head>\n"; |
|
| 300 | + echo '<body onload="ext_initial_adv(\'submitform\', \'ext\', \'field_type\')">'; |
|
| 301 | + echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'> |
|
| 302 | 302 | <tr> |
| 303 | 303 | <td bgcolor='#2F5376'><a href='http://www.xoops.org/' target='_blank'><img src='" . XOOPS_URL . "/images/logo.gif' alt='" . $GLOBALS['xoopsConfig']['sitename'] . "'></a></td> |
| 304 | 304 | <td align='right' bgcolor='#2F5376'><img src='" . XOOPS_URL . "/images/logo.gif' alt=''></td> |
| 305 | 305 | </tr><tr><td colspan='2'><div class='content'><br>"; |
| 306 | - $form = new XoopsThemeForm(_MD_EXTMANAGER, 'ext_manager', 'fieldtypes.php'); |
|
| 306 | + $form = new XoopsThemeForm(_MD_EXTMANAGER, 'ext_manager', 'fieldtypes.php'); |
|
| 307 | 307 | |
| 308 | - //TO DO: change type field to drop down field, based on available types. |
|
| 309 | - $fieldtypes = array( |
|
| 310 | - '0' => '---', |
|
| 311 | - 'checkbox' => _MD_FIELDNAMES_CHECKBOX, |
|
| 312 | - 'date' => _MD_FIELDNAMES_DATE, |
|
| 313 | - 'datetime' => _MD_FIELDNAMES_DATETIME, |
|
| 314 | - 'radio' => _MD_FIELDNAMES_RADIO, |
|
| 315 | - 'select' => _MD_FIELDNAMES_SELECT, |
|
| 316 | - 'select_multi' => _MD_FIELDNAMES_SELECTMULTI, |
|
| 317 | - 'textarea' => _MD_FIELDNAMES_TEXTAREA, |
|
| 318 | - 'dhtml' => _MD_FIELDNAMES_DHTMLTEXTAREA, |
|
| 319 | - 'textbox' => _MD_FIELDNAMES_TEXTBOX, |
|
| 320 | - 'yesno' => _MD_FIELDNAMES_YESNO |
|
| 321 | - ); |
|
| 308 | + //TO DO: change type field to drop down field, based on available types. |
|
| 309 | + $fieldtypes = array( |
|
| 310 | + '0' => '---', |
|
| 311 | + 'checkbox' => _MD_FIELDNAMES_CHECKBOX, |
|
| 312 | + 'date' => _MD_FIELDNAMES_DATE, |
|
| 313 | + 'datetime' => _MD_FIELDNAMES_DATETIME, |
|
| 314 | + 'radio' => _MD_FIELDNAMES_RADIO, |
|
| 315 | + 'select' => _MD_FIELDNAMES_SELECT, |
|
| 316 | + 'select_multi' => _MD_FIELDNAMES_SELECTMULTI, |
|
| 317 | + 'textarea' => _MD_FIELDNAMES_TEXTAREA, |
|
| 318 | + 'dhtml' => _MD_FIELDNAMES_DHTMLTEXTAREA, |
|
| 319 | + 'textbox' => _MD_FIELDNAMES_TEXTBOX, |
|
| 320 | + 'yesno' => _MD_FIELDNAMES_YESNO |
|
| 321 | + ); |
|
| 322 | 322 | |
| 323 | - $form->addElement(new XoopsFormText(_MD_WIDTH, 'width', 10, 20, '')); |
|
| 324 | - $form->addElement(new XoopsFormText(_MD_HEIGHT, 'height', 10, 20, '')); |
|
| 325 | - $form->addElement(new XoopsFormText(_MD_ROWS, 'rows', 10, 20, '')); |
|
| 326 | - $form->addElement(new XoopsFormText(_MD_COLS, 'cols', 10, 20, '')); |
|
| 327 | - $form->addElement(new XoopsFormText(_MD_SIZE, 'size', 10, 20, '')); |
|
| 328 | - $form->addElement(new XoopsFormText(_MD_MAXSIZE, 'maxsize', 10, 20, '')); |
|
| 329 | - $form->addElement(new XoopsFormText(_MD_DEFAULTVALUE, 'value', 50, 100, '')); |
|
| 330 | - $form_multiple = new XoopsFormCheckBox(_MD_MULTIPLE, 'multiple', 0); |
|
| 331 | - $form_multiple->addOption(1, _MD_YESNO); |
|
| 332 | - $form_checked = new XoopsFormCheckBox(_MD_CHECKED, 'checked', 0); |
|
| 333 | - $form_checked->addOption(1, _MD_YESNO); |
|
| 334 | - $form->addElement($form_multiple); |
|
| 335 | - $form->addElement($form_checked); |
|
| 336 | - $ext_update = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_UPDATE . "\" onClick=\"ext_input('submitform','ext')\" value=\"Update\">"); |
|
| 337 | - $ext_cancel = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_CANCEL . '" onClick="self.close()" value="Cancel">'); |
|
| 338 | - $ext_tray = new XoopsFormElementTray('', ''); |
|
| 339 | - $ext_tray->addElement($ext_update); |
|
| 340 | - $ext_tray->addElement($ext_cancel); |
|
| 341 | - $form->addElement($ext_tray); |
|
| 342 | - $form->display(); |
|
| 343 | - echo '</div>'; |
|
| 344 | - echo '</td></tr></table>'; |
|
| 345 | - echo '</body>'; |
|
| 323 | + $form->addElement(new XoopsFormText(_MD_WIDTH, 'width', 10, 20, '')); |
|
| 324 | + $form->addElement(new XoopsFormText(_MD_HEIGHT, 'height', 10, 20, '')); |
|
| 325 | + $form->addElement(new XoopsFormText(_MD_ROWS, 'rows', 10, 20, '')); |
|
| 326 | + $form->addElement(new XoopsFormText(_MD_COLS, 'cols', 10, 20, '')); |
|
| 327 | + $form->addElement(new XoopsFormText(_MD_SIZE, 'size', 10, 20, '')); |
|
| 328 | + $form->addElement(new XoopsFormText(_MD_MAXSIZE, 'maxsize', 10, 20, '')); |
|
| 329 | + $form->addElement(new XoopsFormText(_MD_DEFAULTVALUE, 'value', 50, 100, '')); |
|
| 330 | + $form_multiple = new XoopsFormCheckBox(_MD_MULTIPLE, 'multiple', 0); |
|
| 331 | + $form_multiple->addOption(1, _MD_YESNO); |
|
| 332 | + $form_checked = new XoopsFormCheckBox(_MD_CHECKED, 'checked', 0); |
|
| 333 | + $form_checked->addOption(1, _MD_YESNO); |
|
| 334 | + $form->addElement($form_multiple); |
|
| 335 | + $form->addElement($form_checked); |
|
| 336 | + $ext_update = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_UPDATE . "\" onClick=\"ext_input('submitform','ext')\" value=\"Update\">"); |
|
| 337 | + $ext_cancel = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_CANCEL . '" onClick="self.close()" value="Cancel">'); |
|
| 338 | + $ext_tray = new XoopsFormElementTray('', ''); |
|
| 339 | + $ext_tray->addElement($ext_update); |
|
| 340 | + $ext_tray->addElement($ext_cancel); |
|
| 341 | + $form->addElement($ext_tray); |
|
| 342 | + $form->display(); |
|
| 343 | + echo '</div>'; |
|
| 344 | + echo '</td></tr></table>'; |
|
| 345 | + echo '</body>'; |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | switch ($op) { |
| 349 | - /*case "listNewLinks": |
|
| 349 | + /*case "listNewLinks": |
|
| 350 | 350 | listNewLinks(); |
| 351 | 351 | break; |
| 352 | 352 | case "delLocs": |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | case "delLocs2": |
| 356 | 356 | delLocationsToLink(); |
| 357 | 357 | break;*/ |
| 358 | - default: |
|
| 359 | - showExtFields($type, $ext); |
|
| 360 | - break; |
|
| 358 | + default: |
|
| 359 | + showExtFields($type, $ext); |
|
| 360 | + break; |
|
| 361 | 361 | } |
@@ -355,7 +355,7 @@ |
||
| 355 | 355 | case "delLocs2": |
| 356 | 356 | delLocationsToLink(); |
| 357 | 357 | break;*/ |
| 358 | - default: |
|
| 359 | - showExtFields($type, $ext); |
|
| 360 | - break; |
|
| 358 | + default: |
|
| 359 | + showExtFields($type, $ext); |
|
| 360 | + break; |
|
| 361 | 361 | } |
@@ -18,15 +18,15 @@ discard block |
||
| 18 | 18 | * @author XOOPS Development Team, |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -require_once __DIR__ . '/admin_header.php'; |
|
| 21 | +require_once __DIR__.'/admin_header.php'; |
|
| 22 | 22 | //include __DIR__ . '/../../../include/cp_header.php'; |
| 23 | 23 | |
| 24 | -include __DIR__ . '/../include/functions.php'; |
|
| 25 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
| 26 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 27 | -require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
|
| 28 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
| 29 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 24 | +include __DIR__.'/../include/functions.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 27 | +require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 28 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 29 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 30 | 30 | $myts = MyTextSanitizer::getInstance(); |
| 31 | 31 | $eh = new ErrorHandler; |
| 32 | 32 | if (isset($_GET['op'])) { |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | //MHE - This is added code for the listings module, handling the extension manager. |
| 57 | 57 | if (!headers_sent()) { |
| 58 | - header('Content-Type:text/html; charset=' . _CHARSET); |
|
| 58 | + header('Content-Type:text/html; charset='._CHARSET); |
|
| 59 | 59 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
| 60 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 60 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 61 | 61 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
| 62 | 62 | header('Cache-Control: post-check=0, pre-check=0', false); |
| 63 | 63 | header('Pragma: no-cache'); |
@@ -66,18 +66,18 @@ discard block |
||
| 66 | 66 | echo '"http://www.w3.org/TR/html4/strict.dtd">'; |
| 67 | 67 | echo "<html lang=\"en\" dir=\"ltr\">\n"; |
| 68 | 68 | echo "<head>\n"; |
| 69 | - echo '<meta http-equiv="content-type" content="text/html; charset=' . _CHARSET . '">'; |
|
| 70 | - echo '<meta http-equiv="content-language" content="' . _LANGCODE . '">'; |
|
| 69 | + echo '<meta http-equiv="content-type" content="text/html; charset='._CHARSET.'">'; |
|
| 70 | + echo '<meta http-equiv="content-language" content="'._LANGCODE.'">'; |
|
| 71 | 71 | echo '<title>Extension Manager</title>'; |
| 72 | - echo '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/xoops.css">'; |
|
| 73 | - echo '<link rel="stylesheet" type="text/css" media="all" href="' . XOOPS_URL . '/modules/system/style.css">'; |
|
| 72 | + echo '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/xoops.css">'; |
|
| 73 | + echo '<link rel="stylesheet" type="text/css" media="all" href="'.XOOPS_URL.'/modules/system/style.css">'; |
|
| 74 | 74 | echo '<script type="text/javascript"><!--'; |
| 75 | 75 | echo ' |
| 76 | 76 | function ext_initial_adv(formName, obj, type) |
| 77 | 77 | { |
| 78 | 78 | typeid = opener.document.forms[formName].elements[type].value; |
| 79 | 79 | if (typeid == 0) { |
| 80 | - alert("' . _MD_SELECT_FORMTYPE . "\"); |
|
| 80 | + alert("' . _MD_SELECT_FORMTYPE."\"); |
|
| 81 | 81 | self.close(); |
| 82 | 82 | } |
| 83 | 83 | var arr_fields = new makeArray(9); |
@@ -300,8 +300,8 @@ discard block |
||
| 300 | 300 | echo '<body onload="ext_initial_adv(\'submitform\', \'ext\', \'field_type\')">'; |
| 301 | 301 | echo "<table border='0' width='100%' cellspacing='0' cellpadding='0'> |
| 302 | 302 | <tr> |
| 303 | - <td bgcolor='#2F5376'><a href='http://www.xoops.org/' target='_blank'><img src='" . XOOPS_URL . "/images/logo.gif' alt='" . $GLOBALS['xoopsConfig']['sitename'] . "'></a></td> |
|
| 304 | - <td align='right' bgcolor='#2F5376'><img src='" . XOOPS_URL . "/images/logo.gif' alt=''></td> |
|
| 303 | + <td bgcolor='#2F5376'><a href='http://www.xoops.org/' target='_blank'><img src='" . XOOPS_URL."/images/logo.gif' alt='".$GLOBALS['xoopsConfig']['sitename']."'></a></td> |
|
| 304 | + <td align='right' bgcolor='#2F5376'><img src='" . XOOPS_URL."/images/logo.gif' alt=''></td> |
|
| 305 | 305 | </tr><tr><td colspan='2'><div class='content'><br>"; |
| 306 | 306 | $form = new XoopsThemeForm(_MD_EXTMANAGER, 'ext_manager', 'fieldtypes.php'); |
| 307 | 307 | |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | $form_checked->addOption(1, _MD_YESNO); |
| 334 | 334 | $form->addElement($form_multiple); |
| 335 | 335 | $form->addElement($form_checked); |
| 336 | - $ext_update = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_UPDATE . "\" onClick=\"ext_input('submitform','ext')\" value=\"Update\">"); |
|
| 337 | - $ext_cancel = new XoopsFormLabel('', '<INPUT type="button" value="' . _MD_CANCEL . '" onClick="self.close()" value="Cancel">'); |
|
| 336 | + $ext_update = new XoopsFormLabel('', '<INPUT type="button" value="'._MD_UPDATE."\" onClick=\"ext_input('submitform','ext')\" value=\"Update\">"); |
|
| 337 | + $ext_cancel = new XoopsFormLabel('', '<INPUT type="button" value="'._MD_CANCEL.'" onClick="self.close()" value="Cancel">'); |
|
| 338 | 338 | $ext_tray = new XoopsFormElementTray('', ''); |
| 339 | 339 | $ext_tray->addElement($ext_update); |
| 340 | 340 | $ext_tray->addElement($ext_cancel); |
@@ -30,24 +30,24 @@ discard block |
||
| 30 | 30 | include XOOPS_ROOT_PATH . '/header.php'; |
| 31 | 31 | |
| 32 | 32 | if (isset($_GET['catid'])) { |
| 33 | - $get_cid = (int)$_GET['cid']; |
|
| 33 | + $get_cid = (int)$_GET['cid']; |
|
| 34 | 34 | } else { |
| 35 | - $get_cid = '1'; |
|
| 35 | + $get_cid = '1'; |
|
| 36 | 36 | } |
| 37 | 37 | if (isset($_GET['dirid'])) { |
| 38 | - $get_dirid = (int)$_GET['dirid']; |
|
| 38 | + $get_dirid = (int)$_GET['dirid']; |
|
| 39 | 39 | } else { |
| 40 | - $get_dirid = '1'; |
|
| 40 | + $get_dirid = '1'; |
|
| 41 | 41 | } |
| 42 | 42 | if (isset($_GET['orderby'])) { |
| 43 | - $orderby = convertOrderByIn($_GET['orderby']); |
|
| 43 | + $orderby = convertOrderByIn($_GET['orderby']); |
|
| 44 | 44 | } else { |
| 45 | - $orderby = 'title ASC'; |
|
| 45 | + $orderby = 'title ASC'; |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($_GET['page'])) { |
| 48 | - $get_page = (int)$_GET['page']; |
|
| 48 | + $get_page = (int)$_GET['page']; |
|
| 49 | 49 | } else { |
| 50 | - $get_page = 1; |
|
| 50 | + $get_page = 1; |
|
| 51 | 51 | } |
| 52 | 52 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_search.tpl'; |
| 53 | 53 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
@@ -58,66 +58,66 @@ discard block |
||
| 58 | 58 | $searchform .= '<input type="hidden" name="dirid" value="' . $get_dirid . '"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" id="submit" value="' . _MD_SEARCH . '">' . $lang_adv_search . '</form>'; |
| 59 | 59 | echo $searchform; |
| 60 | 60 | if (!empty($_GET['q'])) { |
| 61 | - //get search results from query |
|
| 62 | - if (isset($_GET['q'])) { |
|
| 63 | - $querystring = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_GET['q'])); |
|
| 64 | - //echo $querystring."<br>"; |
|
| 65 | - } else { |
|
| 66 | - redirect_header(XOOPS_URL . "/modules/$moddir/search.php", 2, _MD_NO_SEARCH_STRING_SELECTED); |
|
| 67 | - } |
|
| 68 | - $poscount = substr_count($querystring, '"') / 2; |
|
| 69 | - $specialarr = array(); |
|
| 70 | - for ($i = 0; $i < $poscount; ++$i) { |
|
| 71 | - $start = strpos($querystring, '"', 0); |
|
| 72 | - $end = strpos($querystring, '"', $start + 1); |
|
| 73 | - if ($end !== false) { |
|
| 74 | - $specialstring = ltrim(substr($querystring, $start, $end - $start), '"'); |
|
| 75 | - $specialarr[] = $specialstring; |
|
| 76 | - $querystring = ltrim(substr_replace($querystring, '', $start, $end - $start + 1)); |
|
| 77 | - } else { |
|
| 78 | - $querystring = ltrim(substr_replace($querystring, '', $start, 1)); |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - $queryarr = explode(' ', $querystring); |
|
| 82 | - $queryarr = array_merge($specialarr, $queryarr); |
|
| 83 | - $emptyarr[] = ''; |
|
| 84 | - $querydiff = array_diff($queryarr, $emptyarr); |
|
| 85 | - |
|
| 86 | - $limit = $xoopsModuleConfig['searchresults_perpage']; |
|
| 87 | - $offset = ($get_page - 1) * $limit; |
|
| 88 | - |
|
| 89 | - $andor = 'AND'; |
|
| 90 | - $searchresults = mod_search($querydiff, $andor, $limit, $offset); |
|
| 91 | - $maxpages = 10; |
|
| 92 | - $maxcount = 30; |
|
| 93 | - |
|
| 94 | - $count_results = mod_search_count($querydiff, $andor, $maxcount, 0); |
|
| 95 | - $count_pages = 0; |
|
| 96 | - //Calculate the number of result pages. |
|
| 97 | - if ($count_results > $limit) { |
|
| 98 | - $count_pages = ceil($count_results / $limit); |
|
| 99 | - } |
|
| 100 | - $pages_text = ''; |
|
| 101 | - $pages_text .= $count_results . ' ' . _MD_LISTINGS_FOUND . '<br>'; |
|
| 102 | - |
|
| 103 | - if ($count_pages >= 2) { |
|
| 104 | - $pages_text .= '<a href="search.php?q=' . $querystring . '&page=1">1</a>'; |
|
| 105 | - } |
|
| 106 | - for ($i = 1; $i < $count_pages; ++$i) { |
|
| 107 | - $page = $i + 1; |
|
| 108 | - $pages_text .= ' - <a href="search.php?q=' . $querystring . '&page=' . $page . '">' . $page . '</a>'; |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 112 | - if ($searchresults == 0) { |
|
| 113 | - echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 114 | - } else { |
|
| 115 | - foreach ($searchresults as $result) { |
|
| 116 | - echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - echo '<br>'; |
|
| 120 | - echo $pages_text; |
|
| 61 | + //get search results from query |
|
| 62 | + if (isset($_GET['q'])) { |
|
| 63 | + $querystring = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_GET['q'])); |
|
| 64 | + //echo $querystring."<br>"; |
|
| 65 | + } else { |
|
| 66 | + redirect_header(XOOPS_URL . "/modules/$moddir/search.php", 2, _MD_NO_SEARCH_STRING_SELECTED); |
|
| 67 | + } |
|
| 68 | + $poscount = substr_count($querystring, '"') / 2; |
|
| 69 | + $specialarr = array(); |
|
| 70 | + for ($i = 0; $i < $poscount; ++$i) { |
|
| 71 | + $start = strpos($querystring, '"', 0); |
|
| 72 | + $end = strpos($querystring, '"', $start + 1); |
|
| 73 | + if ($end !== false) { |
|
| 74 | + $specialstring = ltrim(substr($querystring, $start, $end - $start), '"'); |
|
| 75 | + $specialarr[] = $specialstring; |
|
| 76 | + $querystring = ltrim(substr_replace($querystring, '', $start, $end - $start + 1)); |
|
| 77 | + } else { |
|
| 78 | + $querystring = ltrim(substr_replace($querystring, '', $start, 1)); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + $queryarr = explode(' ', $querystring); |
|
| 82 | + $queryarr = array_merge($specialarr, $queryarr); |
|
| 83 | + $emptyarr[] = ''; |
|
| 84 | + $querydiff = array_diff($queryarr, $emptyarr); |
|
| 85 | + |
|
| 86 | + $limit = $xoopsModuleConfig['searchresults_perpage']; |
|
| 87 | + $offset = ($get_page - 1) * $limit; |
|
| 88 | + |
|
| 89 | + $andor = 'AND'; |
|
| 90 | + $searchresults = mod_search($querydiff, $andor, $limit, $offset); |
|
| 91 | + $maxpages = 10; |
|
| 92 | + $maxcount = 30; |
|
| 93 | + |
|
| 94 | + $count_results = mod_search_count($querydiff, $andor, $maxcount, 0); |
|
| 95 | + $count_pages = 0; |
|
| 96 | + //Calculate the number of result pages. |
|
| 97 | + if ($count_results > $limit) { |
|
| 98 | + $count_pages = ceil($count_results / $limit); |
|
| 99 | + } |
|
| 100 | + $pages_text = ''; |
|
| 101 | + $pages_text .= $count_results . ' ' . _MD_LISTINGS_FOUND . '<br>'; |
|
| 102 | + |
|
| 103 | + if ($count_pages >= 2) { |
|
| 104 | + $pages_text .= '<a href="search.php?q=' . $querystring . '&page=1">1</a>'; |
|
| 105 | + } |
|
| 106 | + for ($i = 1; $i < $count_pages; ++$i) { |
|
| 107 | + $page = $i + 1; |
|
| 108 | + $pages_text .= ' - <a href="search.php?q=' . $querystring . '&page=' . $page . '">' . $page . '</a>'; |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 112 | + if ($searchresults == 0) { |
|
| 113 | + echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 114 | + } else { |
|
| 115 | + foreach ($searchresults as $result) { |
|
| 116 | + echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + echo '<br>'; |
|
| 120 | + echo $pages_text; |
|
| 121 | 121 | } |
| 122 | 122 | $xoopsTpl->assign('search_page', ob_get_contents()); |
| 123 | 123 | ob_end_clean(); |
@@ -133,47 +133,47 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function mod_search($queryarray, $andor, $limit, $offset) |
| 135 | 135 | { |
| 136 | - global $xoopsDB, $eh; |
|
| 137 | - $sql = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 138 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 139 | - . ' d RIGHT JOIN ' |
|
| 140 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 141 | - . ' i ON (d.itemid=i.itemid) LEFT JOIN ' |
|
| 142 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 143 | - . " t ON (i.itemid=t.itemid) WHERE i.status='2'"; |
|
| 144 | - // because count() returns 1 even if a supplied variable |
|
| 145 | - // is not an array, we must check if $queryarray is really an array |
|
| 146 | - if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 147 | - $sql .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 148 | - for ($i = 1; $i < $count; ++$i) { |
|
| 149 | - $sql .= " $andor "; |
|
| 150 | - $sql .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 151 | - } |
|
| 152 | - $sql .= ') '; |
|
| 153 | - } |
|
| 154 | - $sql .= 'ORDER BY i.created DESC'; |
|
| 155 | - |
|
| 156 | - $result = $xoopsDB->query($sql, $limit, $offset) or $eh->show('0013'); |
|
| 157 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 158 | - if (!$result) { |
|
| 159 | - return 0; |
|
| 160 | - } elseif ($num_results == 0) { |
|
| 161 | - return 0; |
|
| 162 | - } else { |
|
| 163 | - $ret = array(); |
|
| 164 | - $i = 0; |
|
| 165 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 166 | - $ret[$i]['image'] = 'images/home.gif'; |
|
| 167 | - $ret[$i]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 168 | - $ret[$i]['title'] = $myrow['title']; |
|
| 169 | - $ret[$i]['description'] = $myrow['description']; |
|
| 170 | - $ret[$i]['time'] = $myrow['created']; |
|
| 171 | - $ret[$i]['uid'] = $myrow['uid']; |
|
| 172 | - ++$i; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - return $ret; |
|
| 176 | - } |
|
| 136 | + global $xoopsDB, $eh; |
|
| 137 | + $sql = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
|
| 138 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 139 | + . ' d RIGHT JOIN ' |
|
| 140 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 141 | + . ' i ON (d.itemid=i.itemid) LEFT JOIN ' |
|
| 142 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 143 | + . " t ON (i.itemid=t.itemid) WHERE i.status='2'"; |
|
| 144 | + // because count() returns 1 even if a supplied variable |
|
| 145 | + // is not an array, we must check if $queryarray is really an array |
|
| 146 | + if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 147 | + $sql .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 148 | + for ($i = 1; $i < $count; ++$i) { |
|
| 149 | + $sql .= " $andor "; |
|
| 150 | + $sql .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 151 | + } |
|
| 152 | + $sql .= ') '; |
|
| 153 | + } |
|
| 154 | + $sql .= 'ORDER BY i.created DESC'; |
|
| 155 | + |
|
| 156 | + $result = $xoopsDB->query($sql, $limit, $offset) or $eh->show('0013'); |
|
| 157 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 158 | + if (!$result) { |
|
| 159 | + return 0; |
|
| 160 | + } elseif ($num_results == 0) { |
|
| 161 | + return 0; |
|
| 162 | + } else { |
|
| 163 | + $ret = array(); |
|
| 164 | + $i = 0; |
|
| 165 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 166 | + $ret[$i]['image'] = 'images/home.gif'; |
|
| 167 | + $ret[$i]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 168 | + $ret[$i]['title'] = $myrow['title']; |
|
| 169 | + $ret[$i]['description'] = $myrow['description']; |
|
| 170 | + $ret[$i]['time'] = $myrow['created']; |
|
| 171 | + $ret[$i]['uid'] = $myrow['uid']; |
|
| 172 | + ++$i; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + return $ret; |
|
| 176 | + } |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -185,27 +185,27 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | function mod_search_count($queryarray, $andor, $limit, $offset = 0) |
| 187 | 187 | { |
| 188 | - global $xoopsDB, $eh; |
|
| 189 | - $count = 0; |
|
| 190 | - $sql = 'SELECT COUNT(DISTINCT i.itemid) FROM ' |
|
| 191 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 192 | - . ' d, ' |
|
| 193 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 194 | - . ' i LEFT JOIN ' |
|
| 195 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 196 | - . " t ON (i.itemid=t.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 197 | - // because count() returns 1 even if a supplied variable |
|
| 198 | - // is not an array, we must check if $queryarray is really an array |
|
| 199 | - if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 200 | - $sql .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 201 | - for ($i = 1; $i < $count; ++$i) { |
|
| 202 | - $sql .= " $andor "; |
|
| 203 | - $sql .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 204 | - } |
|
| 205 | - $sql .= ') '; |
|
| 206 | - } |
|
| 207 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 208 | - list($count) = $xoopsDB->fetchRow($result); |
|
| 209 | - |
|
| 210 | - return $count; |
|
| 188 | + global $xoopsDB, $eh; |
|
| 189 | + $count = 0; |
|
| 190 | + $sql = 'SELECT COUNT(DISTINCT i.itemid) FROM ' |
|
| 191 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 192 | + . ' d, ' |
|
| 193 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 194 | + . ' i LEFT JOIN ' |
|
| 195 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 196 | + . " t ON (i.itemid=t.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
|
| 197 | + // because count() returns 1 even if a supplied variable |
|
| 198 | + // is not an array, we must check if $queryarray is really an array |
|
| 199 | + if (is_array($queryarray) && $count = count($queryarray)) { |
|
| 200 | + $sql .= " AND ((d.value LIKE '%$queryarray[0]%' OR i.title LIKE '%$queryarray[0]%' OR t.description LIKE '%$queryarray[0]%')"; |
|
| 201 | + for ($i = 1; $i < $count; ++$i) { |
|
| 202 | + $sql .= " $andor "; |
|
| 203 | + $sql .= "(d.value LIKE '%$queryarray[$i]%' OR i.title LIKE '%$queryarray[$i]%' OR t.description LIKE '%$queryarray[$i]%')"; |
|
| 204 | + } |
|
| 205 | + $sql .= ') '; |
|
| 206 | + } |
|
| 207 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 208 | + list($count) = $xoopsDB->fetchRow($result); |
|
| 209 | + |
|
| 210 | + return $count; |
|
| 211 | 211 | } |
@@ -18,24 +18,24 @@ discard block |
||
| 18 | 18 | * @author XOOPS Development Team, |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -include __DIR__ . '/header.php'; |
|
| 21 | +include __DIR__.'/header.php'; |
|
| 22 | 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'; |
|
| 23 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 24 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 25 | 25 | $myts = MyTextSanitizer::getInstance(); |
| 26 | 26 | $mytree = new XoopsTree($xoopsDB->prefix('links_cat'), 'cid', 'pid'); |
| 27 | 27 | $eh = new ErrorHandler; |
| 28 | 28 | |
| 29 | 29 | $moddir = $xoopsModule->getVar('dirname'); |
| 30 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
| 30 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
| 31 | 31 | |
| 32 | 32 | if (isset($_GET['catid'])) { |
| 33 | - $get_cid = (int)$_GET['cid']; |
|
| 33 | + $get_cid = (int) $_GET['cid']; |
|
| 34 | 34 | } else { |
| 35 | 35 | $get_cid = '1'; |
| 36 | 36 | } |
| 37 | 37 | if (isset($_GET['dirid'])) { |
| 38 | - $get_dirid = (int)$_GET['dirid']; |
|
| 38 | + $get_dirid = (int) $_GET['dirid']; |
|
| 39 | 39 | } else { |
| 40 | 40 | $get_dirid = '1'; |
| 41 | 41 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $orderby = 'title ASC'; |
| 46 | 46 | } |
| 47 | 47 | if (isset($_GET['page'])) { |
| 48 | - $get_page = (int)$_GET['page']; |
|
| 48 | + $get_page = (int) $_GET['page']; |
|
| 49 | 49 | } else { |
| 50 | 50 | $get_page = 1; |
| 51 | 51 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | ob_start(); |
| 57 | 57 | $searchform = '<form action="search.php" name="search" id="search" method="get">'; |
| 58 | -$searchform .= '<input type="hidden" name="dirid" value="' . $get_dirid . '"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" id="submit" value="' . _MD_SEARCH . '">' . $lang_adv_search . '</form>'; |
|
| 58 | +$searchform .= '<input type="hidden" name="dirid" value="'.$get_dirid.'"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" id="submit" value="'._MD_SEARCH.'">'.$lang_adv_search.'</form>'; |
|
| 59 | 59 | echo $searchform; |
| 60 | 60 | if (!empty($_GET['q'])) { |
| 61 | 61 | //get search results from query |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $querystring = $GLOBALS['xoopsDB']->escape($myts->stripSlashesGPC($_GET['q'])); |
| 64 | 64 | //echo $querystring."<br>"; |
| 65 | 65 | } else { |
| 66 | - redirect_header(XOOPS_URL . "/modules/$moddir/search.php", 2, _MD_NO_SEARCH_STRING_SELECTED); |
|
| 66 | + redirect_header(XOOPS_URL."/modules/$moddir/search.php", 2, _MD_NO_SEARCH_STRING_SELECTED); |
|
| 67 | 67 | } |
| 68 | 68 | $poscount = substr_count($querystring, '"') / 2; |
| 69 | 69 | $specialarr = array(); |
@@ -98,22 +98,22 @@ discard block |
||
| 98 | 98 | $count_pages = ceil($count_results / $limit); |
| 99 | 99 | } |
| 100 | 100 | $pages_text = ''; |
| 101 | - $pages_text .= $count_results . ' ' . _MD_LISTINGS_FOUND . '<br>'; |
|
| 101 | + $pages_text .= $count_results.' '._MD_LISTINGS_FOUND.'<br>'; |
|
| 102 | 102 | |
| 103 | 103 | if ($count_pages >= 2) { |
| 104 | - $pages_text .= '<a href="search.php?q=' . $querystring . '&page=1">1</a>'; |
|
| 104 | + $pages_text .= '<a href="search.php?q='.$querystring.'&page=1">1</a>'; |
|
| 105 | 105 | } |
| 106 | 106 | for ($i = 1; $i < $count_pages; ++$i) { |
| 107 | - $page = $i + 1; |
|
| 108 | - $pages_text .= ' - <a href="search.php?q=' . $querystring . '&page=' . $page . '">' . $page . '</a>'; |
|
| 107 | + $page = $i + 1; |
|
| 108 | + $pages_text .= ' - <a href="search.php?q='.$querystring.'&page='.$page.'">'.$page.'</a>'; |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - echo '<div class="itemTitleLarge">' . _MD_SEARCHRESULTS_TITLE . '</div><br>'; |
|
| 111 | + echo '<div class="itemTitleLarge">'._MD_SEARCHRESULTS_TITLE.'</div><br>'; |
|
| 112 | 112 | if ($searchresults == 0) { |
| 113 | - echo '<div class="itemTitle">' . _MD_NORESULTS . '</div>'; |
|
| 113 | + echo '<div class="itemTitle">'._MD_NORESULTS.'</div>'; |
|
| 114 | 114 | } else { |
| 115 | 115 | foreach ($searchresults as $result) { |
| 116 | - echo '<div class="itemTitle"><a href="' . $result['link'] . '">' . $result['title'] . '</a></div><div class="itemText">' . $result['description'] . '</div><hr>'; |
|
| 116 | + echo '<div class="itemTitle"><a href="'.$result['link'].'">'.$result['title'].'</a></div><div class="itemText">'.$result['description'].'</div><hr>'; |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | echo '<br>'; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $xoopsTpl->assign('search_page', ob_get_contents()); |
| 123 | 123 | ob_end_clean(); |
| 124 | 124 | |
| 125 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 125 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * @param $queryarray |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | global $xoopsDB, $eh; |
| 137 | 137 | $sql = 'SELECT DISTINCT i.itemid, i.title, i.uid, i.created, t.description FROM ' |
| 138 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 138 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 139 | 139 | . ' d RIGHT JOIN ' |
| 140 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 140 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 141 | 141 | . ' i ON (d.itemid=i.itemid) LEFT JOIN ' |
| 142 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 142 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 143 | 143 | . " t ON (i.itemid=t.itemid) WHERE i.status='2'"; |
| 144 | 144 | // because count() returns 1 even if a supplied variable |
| 145 | 145 | // is not an array, we must check if $queryarray is really an array |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | $i = 0; |
| 165 | 165 | while ($myrow = $xoopsDB->fetchArray($result)) { |
| 166 | 166 | $ret[$i]['image'] = 'images/home.gif'; |
| 167 | - $ret[$i]['link'] = 'listing.php?item=' . $myrow['itemid'] . ''; |
|
| 167 | + $ret[$i]['link'] = 'listing.php?item='.$myrow['itemid'].''; |
|
| 168 | 168 | $ret[$i]['title'] = $myrow['title']; |
| 169 | 169 | $ret[$i]['description'] = $myrow['description']; |
| 170 | 170 | $ret[$i]['time'] = $myrow['created']; |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | global $xoopsDB, $eh; |
| 189 | 189 | $count = 0; |
| 190 | 190 | $sql = 'SELECT COUNT(DISTINCT i.itemid) FROM ' |
| 191 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') |
|
| 191 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_data') |
|
| 192 | 192 | . ' d, ' |
| 193 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 193 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 194 | 194 | . ' i LEFT JOIN ' |
| 195 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 195 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 196 | 196 | . " t ON (i.itemid=t.itemid) WHERE d.itemid=i.itemid AND i.status='2'"; |
| 197 | 197 | // because count() returns 1 even if a supplied variable |
| 198 | 198 | // is not an array, we must check if $queryarray is really an array |
@@ -35,34 +35,34 @@ |
||
| 35 | 35 | |
| 36 | 36 | $coupon = new efqCouponHandler(); |
| 37 | 37 | if ($itemid) { |
| 38 | - $coupons = $coupon->getByItem($itemid); |
|
| 38 | + $coupons = $coupon->getByItem($itemid); |
|
| 39 | 39 | } |
| 40 | 40 | $sql = 'SELECT itemid, title FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid=' . $itemid . ''; |
| 41 | 41 | $item_result = $xoopsDB->query($sql); |
| 42 | 42 | $numrows = $xoopsDB->getRowsNum($item_result); |
| 43 | 43 | //echo $numrows; |
| 44 | 44 | while (list($itemid, $itemtitle) = $xoopsDB->fetchRow($item_result)) { |
| 45 | - $title = $myts->htmlSpecialChars($itemtitle); |
|
| 46 | - $item = $itemid; |
|
| 45 | + $title = $myts->htmlSpecialChars($itemtitle); |
|
| 46 | + $item = $itemid; |
|
| 47 | 47 | } |
| 48 | 48 | $xoopsTpl->assign('itemtitle', $title); |
| 49 | 49 | $xoopsTpl->assign('itemid', $item); |
| 50 | 50 | |
| 51 | 51 | foreach ($coupons as $coup) { |
| 52 | - //echo $coup['descr']; |
|
| 53 | - $xoopsTpl->append('coupons', array( |
|
| 54 | - 'couponid' => $coup['couponid'], |
|
| 55 | - 'itemid' => $coup['itemid'], |
|
| 56 | - 'descr' => $myts->displayTarea($coup['descr']), |
|
| 57 | - 'image' => $coup['image'], |
|
| 58 | - 'publish' => $coup['publish'], |
|
| 59 | - 'expire' => $coup['expire'], |
|
| 60 | - 'heading' => $coup['heading'], |
|
| 61 | - 'lbr' => $coup['lbr'] |
|
| 62 | - )); |
|
| 52 | + //echo $coup['descr']; |
|
| 53 | + $xoopsTpl->append('coupons', array( |
|
| 54 | + 'couponid' => $coup['couponid'], |
|
| 55 | + 'itemid' => $coup['itemid'], |
|
| 56 | + 'descr' => $myts->displayTarea($coup['descr']), |
|
| 57 | + 'image' => $coup['image'], |
|
| 58 | + 'publish' => $coup['publish'], |
|
| 59 | + 'expire' => $coup['expire'], |
|
| 60 | + 'heading' => $coup['heading'], |
|
| 61 | + 'lbr' => $coup['lbr'] |
|
| 62 | + )); |
|
| 63 | 63 | } |
| 64 | 64 | if ($xoopsUser) { |
| 65 | - $xoopsTpl->assign('admin', $xoopsUser->isAdmin($xoopsModule->mid())); |
|
| 65 | + $xoopsTpl->assign('admin', $xoopsUser->isAdmin($xoopsModule->mid())); |
|
| 66 | 66 | } |
| 67 | 67 | $xoopsTpl->assign('moddir', $moddir); |
| 68 | 68 | |
@@ -18,26 +18,26 @@ 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/module.errorhandler.php'; |
|
| 24 | -require_once __DIR__ . '/class/class.couponhandler.php'; |
|
| 21 | +include __DIR__.'/header.php'; |
|
| 22 | +$myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
|
| 23 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 24 | +require_once __DIR__.'/class/class.couponhandler.php'; |
|
| 25 | 25 | |
| 26 | 26 | $eh = new ErrorHandler; |
| 27 | 27 | $moddir = $xoopsModule->getVar('dirname'); |
| 28 | 28 | |
| 29 | -$itemid = isset($_GET['itemid']) ? (int)$_GET['itemid'] : 0; |
|
| 30 | -$catid = isset($_GET['catid']) ? (int)$_GET['catid'] : 0; |
|
| 29 | +$itemid = isset($_GET['itemid']) ? (int) $_GET['itemid'] : 0; |
|
| 30 | +$catid = isset($_GET['catid']) ? (int) $_GET['catid'] : 0; |
|
| 31 | 31 | |
| 32 | 32 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_savings.tpl'; |
| 33 | -include XOOPS_ROOT_PATH . '/header.php'; |
|
| 33 | +include XOOPS_ROOT_PATH.'/header.php'; |
|
| 34 | 34 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 35 | 35 | |
| 36 | 36 | $coupon = new efqCouponHandler(); |
| 37 | 37 | if ($itemid) { |
| 38 | 38 | $coupons = $coupon->getByItem($itemid); |
| 39 | 39 | } |
| 40 | -$sql = 'SELECT itemid, title FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' WHERE itemid=' . $itemid . ''; |
|
| 40 | +$sql = 'SELECT itemid, title FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' WHERE itemid='.$itemid.''; |
|
| 41 | 41 | $item_result = $xoopsDB->query($sql); |
| 42 | 42 | $numrows = $xoopsDB->getRowsNum($item_result); |
| 43 | 43 | //echo $numrows; |
@@ -66,4 +66,4 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | $xoopsTpl->assign('moddir', $moddir); |
| 68 | 68 | |
| 69 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 69 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
@@ -27,11 +27,11 @@ |
||
| 27 | 27 | <form method="post" name="paypal_form" action="<?= $paypal['url'] ?>"> |
| 28 | 28 | |
| 29 | 29 | <?php |
| 30 | - //show paypal hidden variables |
|
| 30 | + //show paypal hidden variables |
|
| 31 | 31 | |
| 32 | - showVariables(); |
|
| 32 | + showVariables(); |
|
| 33 | 33 | |
| 34 | - ?> |
|
| 34 | + ?> |
|
| 35 | 35 | |
| 36 | 36 | <div style="text-align: center;"><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: 333333; ">Processing Transaction . . . </span></div> |
| 37 | 37 | |
@@ -13,11 +13,11 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | 15 | //Configuration File |
| 16 | -include __DIR__ . '/header.php'; |
|
| 17 | -require_once __DIR__ . '/paypal_includes/config.inc.php'; |
|
| 16 | +include __DIR__.'/header.php'; |
|
| 17 | +require_once __DIR__.'/paypal_includes/config.inc.php'; |
|
| 18 | 18 | |
| 19 | 19 | //Global Configuration File |
| 20 | -require_once __DIR__ . '/paypal_includes/global_config.inc.php'; |
|
| 20 | +require_once __DIR__.'/paypal_includes/global_config.inc.php'; |
|
| 21 | 21 | |
| 22 | 22 | ?> |
| 23 | 23 | |
@@ -38,447 +38,447 @@ |
||
| 38 | 38 | |
| 39 | 39 | //Check if any option in URL |
| 40 | 40 | if (!empty($_GET['op'])) { |
| 41 | - $op = $_GET['op']; |
|
| 41 | + $op = $_GET['op']; |
|
| 42 | 42 | } else { |
| 43 | - $op = 0; |
|
| 43 | + $op = 0; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | //Check if a category is selected. |
| 47 | 47 | if (!empty($_GET['catid'])) { |
| 48 | - $get_catid = (int)$_GET['catid']; |
|
| 48 | + $get_catid = (int)$_GET['catid']; |
|
| 49 | 49 | } else { |
| 50 | - $get_catid = '0'; |
|
| 50 | + $get_catid = '0'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | //Check if a directory is selected. |
| 54 | 54 | if (!empty($_GET['dirid'])) { |
| 55 | - $get_dirid = (int)$_GET['dirid']; |
|
| 55 | + $get_dirid = (int)$_GET['dirid']; |
|
| 56 | 56 | } else { |
| 57 | - $get_dirid = '0'; |
|
| 57 | + $get_dirid = '0'; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($get_dirid == '0' && $get_catid == '0') { |
| 61 | - //Show an overview of directories with directory title, image and description for each directory. |
|
| 62 | - $result = $xoopsDB->query('SELECT dirid, name, descr, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE open = '1' ORDER BY name") or $eh->show('0013'); |
|
| 63 | - $num_results = $xoopsDB->getRowsNum($result); |
|
| 64 | - if ($num_results == 1) { |
|
| 65 | - if ($xoopsModuleConfig['autoshowonedir'] == 1) { |
|
| 66 | - while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
|
| 67 | - $get_dirid = $dirid; |
|
| 68 | - } |
|
| 69 | - } else { |
|
| 70 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
|
| 71 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 72 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 73 | - $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
|
| 74 | - $xoopsTpl->assign('moddir', $moddir); |
|
| 75 | - while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
|
| 76 | - if ($img != '') { |
|
| 77 | - $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
|
| 78 | - } else { |
|
| 79 | - $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
|
| 80 | - } |
|
| 81 | - $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - } elseif ($num_results >= 2) { |
|
| 85 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
|
| 86 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 87 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 88 | - $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
|
| 89 | - $xoopsTpl->assign('moddir', $moddir); |
|
| 90 | - while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
|
| 91 | - if ($img != '') { |
|
| 92 | - $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
|
| 93 | - } else { |
|
| 94 | - $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
|
| 95 | - } |
|
| 96 | - $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
|
| 97 | - } |
|
| 98 | - } else { |
|
| 99 | - redirect_header(XOOPS_URL, 2, _MD_NOACTIVEDIRECTORIES); |
|
| 100 | - exit(); |
|
| 101 | - } |
|
| 61 | + //Show an overview of directories with directory title, image and description for each directory. |
|
| 62 | + $result = $xoopsDB->query('SELECT dirid, name, descr, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE open = '1' ORDER BY name") or $eh->show('0013'); |
|
| 63 | + $num_results = $xoopsDB->getRowsNum($result); |
|
| 64 | + if ($num_results == 1) { |
|
| 65 | + if ($xoopsModuleConfig['autoshowonedir'] == 1) { |
|
| 66 | + while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
|
| 67 | + $get_dirid = $dirid; |
|
| 68 | + } |
|
| 69 | + } else { |
|
| 70 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
|
| 71 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 72 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 73 | + $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
|
| 74 | + $xoopsTpl->assign('moddir', $moddir); |
|
| 75 | + while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
|
| 76 | + if ($img != '') { |
|
| 77 | + $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
|
| 78 | + } else { |
|
| 79 | + $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
|
| 80 | + } |
|
| 81 | + $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + } elseif ($num_results >= 2) { |
|
| 85 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
|
| 86 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 87 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 88 | + $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
|
| 89 | + $xoopsTpl->assign('moddir', $moddir); |
|
| 90 | + while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
|
| 91 | + if ($img != '') { |
|
| 92 | + $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
|
| 93 | + } else { |
|
| 94 | + $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
|
| 95 | + } |
|
| 96 | + $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
|
| 97 | + } |
|
| 98 | + } else { |
|
| 99 | + redirect_header(XOOPS_URL, 2, _MD_NOACTIVEDIRECTORIES); |
|
| 100 | + exit(); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | if ($get_dirid != 0 || $get_catid != 0) { |
| 104 | - //Get all categories and child categories for selected category |
|
| 105 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_index.tpl'; |
|
| 106 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 107 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 108 | - $xoopsTpl->assign('moddir', $moddir); |
|
| 109 | - if ($get_dirid == '0') { |
|
| 110 | - $dirid = getDirId($get_catid); |
|
| 111 | - } else { |
|
| 112 | - $dirid = $get_dirid; |
|
| 113 | - } |
|
| 114 | - ob_start(); |
|
| 115 | - printf(_MD_SEARCH_ADV, $dirid); |
|
| 116 | - $lang_adv_search = ob_get_contents(); |
|
| 117 | - ob_end_clean(); |
|
| 118 | - $searchform = '<form action="search.php" name="search" id="search" method="get">'; |
|
| 119 | - $searchform .= '<input type="hidden" name="dirid" value="' . $dirid . '"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" class="formButton" name="submit" value="' . _MD_SEARCH . '">' . $lang_adv_search . '</form>'; |
|
| 120 | - $xoopsTpl->assign('searchform', $searchform); |
|
| 121 | - $pathstring = "<a href='index.php?dirid=" . $dirid . '\'>' . _MD_MAIN . '</a> : '; |
|
| 122 | - $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'index.php?dirid=' . $dirid . '&op='); |
|
| 123 | - $xoopsTpl->assign('category_path', $pathstring); |
|
| 104 | + //Get all categories and child categories for selected category |
|
| 105 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_index.tpl'; |
|
| 106 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 107 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 108 | + $xoopsTpl->assign('moddir', $moddir); |
|
| 109 | + if ($get_dirid == '0') { |
|
| 110 | + $dirid = getDirId($get_catid); |
|
| 111 | + } else { |
|
| 112 | + $dirid = $get_dirid; |
|
| 113 | + } |
|
| 114 | + ob_start(); |
|
| 115 | + printf(_MD_SEARCH_ADV, $dirid); |
|
| 116 | + $lang_adv_search = ob_get_contents(); |
|
| 117 | + ob_end_clean(); |
|
| 118 | + $searchform = '<form action="search.php" name="search" id="search" method="get">'; |
|
| 119 | + $searchform .= '<input type="hidden" name="dirid" value="' . $dirid . '"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" class="formButton" name="submit" value="' . _MD_SEARCH . '">' . $lang_adv_search . '</form>'; |
|
| 120 | + $xoopsTpl->assign('searchform', $searchform); |
|
| 121 | + $pathstring = "<a href='index.php?dirid=" . $dirid . '\'>' . _MD_MAIN . '</a> : '; |
|
| 122 | + $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'index.php?dirid=' . $dirid . '&op='); |
|
| 123 | + $xoopsTpl->assign('category_path', $pathstring); |
|
| 124 | 124 | |
| 125 | - if (isset($xoopsUser) && $xoopsUser != null) { |
|
| 126 | - $submitlink = '<a href="submit.php?dirid=' . $dirid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-new.gif" alt="' . _MD_SUBMITLISTING . '" title="' . _MD_SUBMITLISTING . '"></a>'; |
|
| 127 | - $xoopsTpl->assign('submit_link', $submitlink); |
|
| 128 | - } |
|
| 125 | + if (isset($xoopsUser) && $xoopsUser != null) { |
|
| 126 | + $submitlink = '<a href="submit.php?dirid=' . $dirid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-new.gif" alt="' . _MD_SUBMITLISTING . '" title="' . _MD_SUBMITLISTING . '"></a>'; |
|
| 127 | + $xoopsTpl->assign('submit_link', $submitlink); |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - if ($get_catid == 0) { |
|
| 131 | - $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '0' AND dirid = '" . $get_dirid . '\' ORDER BY title') or $eh->show('0013'); |
|
| 132 | - } else { |
|
| 133 | - $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '" . $get_catid . '\' ORDER BY title') or $eh->show('0013'); |
|
| 134 | - } |
|
| 135 | - $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
| 136 | - if ($num_results == 0 && isset($_GET['dirid'])) { |
|
| 137 | - $xoopsTpl->assign('lang_noresults', _MD_NORESULTS); |
|
| 138 | - } else { |
|
| 139 | - $count = 1; |
|
| 140 | - while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 141 | - $totallisting = getTotalItems($myrow['cid'], 2); |
|
| 142 | - $img = ''; |
|
| 143 | - if ($myrow['img'] && $myrow['img'] != '') { |
|
| 144 | - $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($myrow['img']); |
|
| 145 | - } |
|
| 146 | - $arr = array(); |
|
| 147 | - $arr = $efqtree->getFirstChild($myrow['cid'], 'title'); |
|
| 148 | - $space = 0; |
|
| 149 | - $chcount = 0; |
|
| 150 | - $subcategories = ''; |
|
| 151 | - foreach ($arr as $ele) { |
|
| 152 | - $chtitle = $myts->htmlSpecialChars($ele['title']); |
|
| 153 | - if ($chcount > 5) { |
|
| 154 | - $subcategories .= '...'; |
|
| 155 | - break; |
|
| 156 | - } |
|
| 157 | - if ($space > 0) { |
|
| 158 | - $subcategories .= ', '; |
|
| 159 | - } |
|
| 160 | - $subcategories .= '<a class="subcategory" href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $ele['cid'] . '">' . $chtitle . '</a>'; |
|
| 161 | - ++$space; |
|
| 162 | - ++$chcount; |
|
| 163 | - } |
|
| 164 | - $cattitle = '<a href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $myrow['cid'] . '">' . $myrow['title'] . '</a>'; |
|
| 165 | - $xoopsTpl->append('categories', array('image' => $img, 'id' => $myrow['cid'], 'title' => $cattitle, 'subcategories' => $subcategories, 'totallisting' => $totallisting, 'count' => $count)); |
|
| 166 | - ++$count; |
|
| 167 | - } |
|
| 130 | + if ($get_catid == 0) { |
|
| 131 | + $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '0' AND dirid = '" . $get_dirid . '\' ORDER BY title') or $eh->show('0013'); |
|
| 132 | + } else { |
|
| 133 | + $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '" . $get_catid . '\' ORDER BY title') or $eh->show('0013'); |
|
| 134 | + } |
|
| 135 | + $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
|
| 136 | + if ($num_results == 0 && isset($_GET['dirid'])) { |
|
| 137 | + $xoopsTpl->assign('lang_noresults', _MD_NORESULTS); |
|
| 138 | + } else { |
|
| 139 | + $count = 1; |
|
| 140 | + while ($myrow = $xoopsDB->fetchArray($result)) { |
|
| 141 | + $totallisting = getTotalItems($myrow['cid'], 2); |
|
| 142 | + $img = ''; |
|
| 143 | + if ($myrow['img'] && $myrow['img'] != '') { |
|
| 144 | + $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($myrow['img']); |
|
| 145 | + } |
|
| 146 | + $arr = array(); |
|
| 147 | + $arr = $efqtree->getFirstChild($myrow['cid'], 'title'); |
|
| 148 | + $space = 0; |
|
| 149 | + $chcount = 0; |
|
| 150 | + $subcategories = ''; |
|
| 151 | + foreach ($arr as $ele) { |
|
| 152 | + $chtitle = $myts->htmlSpecialChars($ele['title']); |
|
| 153 | + if ($chcount > 5) { |
|
| 154 | + $subcategories .= '...'; |
|
| 155 | + break; |
|
| 156 | + } |
|
| 157 | + if ($space > 0) { |
|
| 158 | + $subcategories .= ', '; |
|
| 159 | + } |
|
| 160 | + $subcategories .= '<a class="subcategory" href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $ele['cid'] . '">' . $chtitle . '</a>'; |
|
| 161 | + ++$space; |
|
| 162 | + ++$chcount; |
|
| 163 | + } |
|
| 164 | + $cattitle = '<a href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $myrow['cid'] . '">' . $myrow['title'] . '</a>'; |
|
| 165 | + $xoopsTpl->append('categories', array('image' => $img, 'id' => $myrow['cid'], 'title' => $cattitle, 'subcategories' => $subcategories, 'totallisting' => $totallisting, 'count' => $count)); |
|
| 166 | + ++$count; |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
| 170 | - $isadmin = true; |
|
| 171 | - } else { |
|
| 172 | - $isadmin = false; |
|
| 173 | - } |
|
| 174 | - /*if ($xoopsModuleConfig['allowcomments'] == 1) { |
|
| 169 | + if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
|
| 170 | + $isadmin = true; |
|
| 171 | + } else { |
|
| 172 | + $isadmin = false; |
|
| 173 | + } |
|
| 174 | + /*if ($xoopsModuleConfig['allowcomments'] == 1) { |
|
| 175 | 175 | $xoopsTpl->assign('allowcomments', true); |
| 176 | 176 | $xoopsTpl->assign('lang_comments' , _COMMENTS); |
| 177 | 177 | } |
| 178 | 178 | if ($xoopsModuleConfig['allowreviews'] == 1) { |
| 179 | 179 | $xoopsTpl->assign('allowreviews', true); |
| 180 | 180 | }*/ |
| 181 | - if ($xoopsModuleConfig['allowtellafriend'] == 1) { |
|
| 182 | - $xoopsTpl->assign('allowtellafriend', true); |
|
| 183 | - $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); |
|
| 184 | - } |
|
| 185 | - if ($xoopsModuleConfig['allowrating'] == 1) { |
|
| 186 | - $xoopsTpl->assign('allowrating', true); |
|
| 187 | - $xoopsTpl->assign('lang_rating', _MD_RATINGC); |
|
| 188 | - $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE); |
|
| 189 | - } |
|
| 190 | - $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|
| 191 | - $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); |
|
| 192 | - $xoopsTpl->assign('lang_hits', _MD_HITSC); |
|
| 193 | - $xoopsTpl->assign('lang_modify', _MD_MODIFY); |
|
| 194 | - $xoopsTpl->assign('lang_listings', _MD_LATESTLIST); |
|
| 195 | - $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|
| 196 | - $xoopsTpl->assign('lang_visit', _MD_VISIT); |
|
| 197 | - $sections = array(); |
|
| 198 | - if ($get_catid == 0) { |
|
| 199 | - $sql = 'SELECT l.itemid, l.logourl, l.uid, l.status, l.created, l.title, l.hits, l.rating, l.votes, l.typeid, l.dirid, t.description FROM ' |
|
| 200 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 201 | - . ' c, ' |
|
| 202 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 203 | - . ' x, ' |
|
| 204 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 205 | - . ' l LEFT JOIN ' |
|
| 206 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 207 | - . " t ON (l.itemid=t.itemid) WHERE x.cid=c.cid AND l.itemid=x.itemid AND c.showpopular=1 AND l.status='2' AND l.dirid = '" |
|
| 208 | - . $get_dirid |
|
| 209 | - . '\' ORDER BY l.created DESC'; |
|
| 210 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 181 | + if ($xoopsModuleConfig['allowtellafriend'] == 1) { |
|
| 182 | + $xoopsTpl->assign('allowtellafriend', true); |
|
| 183 | + $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); |
|
| 184 | + } |
|
| 185 | + if ($xoopsModuleConfig['allowrating'] == 1) { |
|
| 186 | + $xoopsTpl->assign('allowrating', true); |
|
| 187 | + $xoopsTpl->assign('lang_rating', _MD_RATINGC); |
|
| 188 | + $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE); |
|
| 189 | + } |
|
| 190 | + $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|
| 191 | + $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); |
|
| 192 | + $xoopsTpl->assign('lang_hits', _MD_HITSC); |
|
| 193 | + $xoopsTpl->assign('lang_modify', _MD_MODIFY); |
|
| 194 | + $xoopsTpl->assign('lang_listings', _MD_LATESTLIST); |
|
| 195 | + $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|
| 196 | + $xoopsTpl->assign('lang_visit', _MD_VISIT); |
|
| 197 | + $sections = array(); |
|
| 198 | + if ($get_catid == 0) { |
|
| 199 | + $sql = 'SELECT l.itemid, l.logourl, l.uid, l.status, l.created, l.title, l.hits, l.rating, l.votes, l.typeid, l.dirid, t.description FROM ' |
|
| 200 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 201 | + . ' c, ' |
|
| 202 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 203 | + . ' x, ' |
|
| 204 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 205 | + . ' l LEFT JOIN ' |
|
| 206 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 207 | + . " t ON (l.itemid=t.itemid) WHERE x.cid=c.cid AND l.itemid=x.itemid AND c.showpopular=1 AND l.status='2' AND l.dirid = '" |
|
| 208 | + . $get_dirid |
|
| 209 | + . '\' ORDER BY l.created DESC'; |
|
| 210 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 211 | 211 | |
| 212 | - while (list($itemid, $logourl, $uid, $status, $created, $ltitle, $hits, $rating, $votes, $type, $dirid, $description) = $xoopsDB->fetchRow($result)) { |
|
| 213 | - if ($isadmin) { |
|
| 214 | - $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLINK . '"></a>'; |
|
| 215 | - } else { |
|
| 216 | - $adminlink = ''; |
|
| 217 | - } |
|
| 218 | - if ($votes == 1) { |
|
| 219 | - $votestring = _MD_ONEVOTE; |
|
| 220 | - } else { |
|
| 221 | - $votestring = sprintf(_MD_NUMVOTES, $votes); |
|
| 222 | - } |
|
| 212 | + while (list($itemid, $logourl, $uid, $status, $created, $ltitle, $hits, $rating, $votes, $type, $dirid, $description) = $xoopsDB->fetchRow($result)) { |
|
| 213 | + if ($isadmin) { |
|
| 214 | + $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLINK . '"></a>'; |
|
| 215 | + } else { |
|
| 216 | + $adminlink = ''; |
|
| 217 | + } |
|
| 218 | + if ($votes == 1) { |
|
| 219 | + $votestring = _MD_ONEVOTE; |
|
| 220 | + } else { |
|
| 221 | + $votestring = sprintf(_MD_NUMVOTES, $votes); |
|
| 222 | + } |
|
| 223 | 223 | |
| 224 | - if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
|
| 225 | - $xoopsTpl->assign('showdatafieldsincat', true); |
|
| 226 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 227 | - $sql .= 'FROM ' |
|
| 228 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 229 | - . ' ic, ' |
|
| 230 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 231 | - . ' xc, ' |
|
| 232 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 233 | - . ' f, ' |
|
| 234 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 235 | - . ' t '; |
|
| 236 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
|
| 237 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
|
| 238 | - $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 239 | - $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 240 | - if ($numrows > 0) { |
|
| 241 | - $xoopsTpl->assign('datatypes', true); |
|
| 242 | - } |
|
| 243 | - $sections = array(); |
|
| 244 | - while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $ditemid, $value, $customtitle) = $xoopsDB->fetchRow($data_result)) { |
|
| 245 | - $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value); |
|
| 246 | - if ($icon != '') { |
|
| 247 | - $iconurl = "<img src=\"uploads/$icon\">"; |
|
| 248 | - } else { |
|
| 249 | - $iconurl = ''; |
|
| 250 | - } |
|
| 251 | - if ($custom != '0' && $customtitle != '') { |
|
| 252 | - $title = $customtitle; |
|
| 253 | - } |
|
| 254 | - if ($section == '0' or '1') { |
|
| 255 | - $sections[] = array('icon' => $iconurl, 'label' => $title, 'value' => $fieldvalue, 'fieldtype' => $fieldtype); |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 224 | + if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
|
| 225 | + $xoopsTpl->assign('showdatafieldsincat', true); |
|
| 226 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 227 | + $sql .= 'FROM ' |
|
| 228 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 229 | + . ' ic, ' |
|
| 230 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 231 | + . ' xc, ' |
|
| 232 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 233 | + . ' f, ' |
|
| 234 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 235 | + . ' t '; |
|
| 236 | + $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
|
| 237 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
|
| 238 | + $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 239 | + $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 240 | + if ($numrows > 0) { |
|
| 241 | + $xoopsTpl->assign('datatypes', true); |
|
| 242 | + } |
|
| 243 | + $sections = array(); |
|
| 244 | + while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $ditemid, $value, $customtitle) = $xoopsDB->fetchRow($data_result)) { |
|
| 245 | + $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value); |
|
| 246 | + if ($icon != '') { |
|
| 247 | + $iconurl = "<img src=\"uploads/$icon\">"; |
|
| 248 | + } else { |
|
| 249 | + $iconurl = ''; |
|
| 250 | + } |
|
| 251 | + if ($custom != '0' && $customtitle != '') { |
|
| 252 | + $title = $customtitle; |
|
| 253 | + } |
|
| 254 | + if ($section == '0' or '1') { |
|
| 255 | + $sections[] = array('icon' => $iconurl, 'label' => $title, 'value' => $fieldvalue, 'fieldtype' => $fieldtype); |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | 259 | |
| 260 | - $couponHandler = new efqCouponHandler(); |
|
| 261 | - $coupons = $couponHandler->getCountByLink($itemid); |
|
| 262 | - $path = $efqtree->getPathFromId($get_catid, 'title'); |
|
| 263 | - $path = substr($path, 1); |
|
| 264 | - $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 265 | - $new = newlinkgraphic($created, $status); |
|
| 266 | - $pop = popgraphic($hits); |
|
| 267 | - $xoopsTpl->append('listings', array( |
|
| 268 | - 'fields' => $sections, |
|
| 269 | - 'coupons' => $coupons, |
|
| 270 | - 'catid' => $get_catid, |
|
| 271 | - 'id' => $itemid, |
|
| 272 | - 'rating' => number_format($rating, 2), |
|
| 273 | - 'title' => $myts->htmlSpecialChars($ltitle) . $pop, |
|
| 274 | - 'type' => $type, |
|
| 275 | - 'logourl' => $myts->htmlSpecialChars($logourl), |
|
| 276 | - 'description' => $myts->displayTarea($description, 0), |
|
| 277 | - 'adminlink' => $adminlink, |
|
| 278 | - 'hits' => $hits, |
|
| 279 | - 'votes' => $votestring, |
|
| 280 | - 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
|
| 281 | - 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/singleitem.php?cid=' . $get_catid . '&item=' . $itemid) |
|
| 282 | - )); |
|
| 283 | - } |
|
| 284 | - } else { |
|
| 285 | - if (isset($_GET['show'])) { |
|
| 286 | - $show = (int)$_GET['show']; |
|
| 287 | - } else { |
|
| 288 | - $show = $xoopsModuleConfig['perpage']; |
|
| 289 | - } |
|
| 290 | - $min = isset($_GET['min']) ? (int)$_GET['min'] : 0; |
|
| 291 | - if (!isset($max)) { |
|
| 292 | - $max = $min + $show; |
|
| 293 | - } |
|
| 294 | - if (isset($_GET['orderby'])) { |
|
| 295 | - $orderby = convertOrderByIn($_GET['orderby']); |
|
| 296 | - } else { |
|
| 297 | - $orderby = 'typelevel DESC'; |
|
| 298 | - } |
|
| 299 | - $fullcountresult = $xoopsDB->query('select count(*) from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . " x WHERE i.itemid=x.itemid AND x.cid=$get_catid AND i.status='2'"); |
|
| 300 | - list($numrows) = $xoopsDB->fetchRow($fullcountresult); |
|
| 301 | - $totalcount = $numrows; |
|
| 302 | - $page_nav = ''; |
|
| 303 | - if ($numrows > 0) { |
|
| 304 | - /*if ($xoopsModuleConfig['allowcomments'] == 1) { |
|
| 260 | + $couponHandler = new efqCouponHandler(); |
|
| 261 | + $coupons = $couponHandler->getCountByLink($itemid); |
|
| 262 | + $path = $efqtree->getPathFromId($get_catid, 'title'); |
|
| 263 | + $path = substr($path, 1); |
|
| 264 | + $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 265 | + $new = newlinkgraphic($created, $status); |
|
| 266 | + $pop = popgraphic($hits); |
|
| 267 | + $xoopsTpl->append('listings', array( |
|
| 268 | + 'fields' => $sections, |
|
| 269 | + 'coupons' => $coupons, |
|
| 270 | + 'catid' => $get_catid, |
|
| 271 | + 'id' => $itemid, |
|
| 272 | + 'rating' => number_format($rating, 2), |
|
| 273 | + 'title' => $myts->htmlSpecialChars($ltitle) . $pop, |
|
| 274 | + 'type' => $type, |
|
| 275 | + 'logourl' => $myts->htmlSpecialChars($logourl), |
|
| 276 | + 'description' => $myts->displayTarea($description, 0), |
|
| 277 | + 'adminlink' => $adminlink, |
|
| 278 | + 'hits' => $hits, |
|
| 279 | + 'votes' => $votestring, |
|
| 280 | + 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
|
| 281 | + 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/singleitem.php?cid=' . $get_catid . '&item=' . $itemid) |
|
| 282 | + )); |
|
| 283 | + } |
|
| 284 | + } else { |
|
| 285 | + if (isset($_GET['show'])) { |
|
| 286 | + $show = (int)$_GET['show']; |
|
| 287 | + } else { |
|
| 288 | + $show = $xoopsModuleConfig['perpage']; |
|
| 289 | + } |
|
| 290 | + $min = isset($_GET['min']) ? (int)$_GET['min'] : 0; |
|
| 291 | + if (!isset($max)) { |
|
| 292 | + $max = $min + $show; |
|
| 293 | + } |
|
| 294 | + if (isset($_GET['orderby'])) { |
|
| 295 | + $orderby = convertOrderByIn($_GET['orderby']); |
|
| 296 | + } else { |
|
| 297 | + $orderby = 'typelevel DESC'; |
|
| 298 | + } |
|
| 299 | + $fullcountresult = $xoopsDB->query('select count(*) from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . " x WHERE i.itemid=x.itemid AND x.cid=$get_catid AND i.status='2'"); |
|
| 300 | + list($numrows) = $xoopsDB->fetchRow($fullcountresult); |
|
| 301 | + $totalcount = $numrows; |
|
| 302 | + $page_nav = ''; |
|
| 303 | + if ($numrows > 0) { |
|
| 304 | + /*if ($xoopsModuleConfig['allowcomments'] == 1) { |
|
| 305 | 305 | $xoopsTpl->assign('allowcomments', true); |
| 306 | 306 | $xoopsTpl->assign('lang_comments' , _COMMENTS); |
| 307 | 307 | }*/ |
| 308 | - /*if ($xoopsModuleConfig['allowreviews'] == 1) { |
|
| 308 | + /*if ($xoopsModuleConfig['allowreviews'] == 1) { |
|
| 309 | 309 | $xoopsTpl->assign('allowreviews', true); |
| 310 | 310 | }*/ |
| 311 | - if ($xoopsModuleConfig['allowtellafriend'] == 1) { |
|
| 312 | - $xoopsTpl->assign('allowtellafriend', true); |
|
| 313 | - $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); |
|
| 314 | - } |
|
| 315 | - if ($xoopsModuleConfig['allowrating'] == 1) { |
|
| 316 | - $xoopsTpl->assign('allowrating', true); |
|
| 317 | - $xoopsTpl->assign('lang_rating', _MD_RATINGC); |
|
| 318 | - $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE); |
|
| 319 | - } |
|
| 320 | - $xoopsTpl->assign('lang_listings', _MD_LISTINGS); |
|
| 321 | - $xoopsTpl->assign('category_id', $get_catid); |
|
| 322 | - $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|
| 323 | - $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); |
|
| 324 | - $xoopsTpl->assign('lang_hits', _MD_HITSC); |
|
| 325 | - $xoopsTpl->assign('lang_modify', _MD_MODIFY); |
|
| 326 | - $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|
| 327 | - $xoopsTpl->assign('lang_visit', _MD_VISIT); |
|
| 328 | - $xoopsTpl->assign('show_listings', true); |
|
| 329 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.hits, i.rating, i.votes, i.typeid, i.dirid, t.typelevel, txt.description, x.cid FROM ' |
|
| 330 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 331 | - . ' x, ' |
|
| 332 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') |
|
| 333 | - . '_items') |
|
| 334 | - . ' i LEFT JOIN ' |
|
| 335 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
|
| 336 | - . ' t ON (t.typeid=i.typeid) LEFT JOIN ' |
|
| 337 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 338 | - . " txt ON (txt.itemid=i.itemid) WHERE i.itemid=x.itemid AND x.cid=$get_catid AND x.active='1' AND i.status='2' ORDER BY $orderby"; |
|
| 339 | - $result = $xoopsDB->query($sql, $show, $min) or $eh->show('0013'); |
|
| 340 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 311 | + if ($xoopsModuleConfig['allowtellafriend'] == 1) { |
|
| 312 | + $xoopsTpl->assign('allowtellafriend', true); |
|
| 313 | + $xoopsTpl->assign('lang_tellafriend', _MD_TELLAFRIEND); |
|
| 314 | + } |
|
| 315 | + if ($xoopsModuleConfig['allowrating'] == 1) { |
|
| 316 | + $xoopsTpl->assign('allowrating', true); |
|
| 317 | + $xoopsTpl->assign('lang_rating', _MD_RATINGC); |
|
| 318 | + $xoopsTpl->assign('lang_ratethissite', _MD_RATETHISSITE); |
|
| 319 | + } |
|
| 320 | + $xoopsTpl->assign('lang_listings', _MD_LISTINGS); |
|
| 321 | + $xoopsTpl->assign('category_id', $get_catid); |
|
| 322 | + $xoopsTpl->assign('lang_description', _MD_DESCRIPTIONC); |
|
| 323 | + $xoopsTpl->assign('lang_lastupdate', _MD_LASTUPDATEC); |
|
| 324 | + $xoopsTpl->assign('lang_hits', _MD_HITSC); |
|
| 325 | + $xoopsTpl->assign('lang_modify', _MD_MODIFY); |
|
| 326 | + $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
|
| 327 | + $xoopsTpl->assign('lang_visit', _MD_VISIT); |
|
| 328 | + $xoopsTpl->assign('show_listings', true); |
|
| 329 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.hits, i.rating, i.votes, i.typeid, i.dirid, t.typelevel, txt.description, x.cid FROM ' |
|
| 330 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 331 | + . ' x, ' |
|
| 332 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') |
|
| 333 | + . '_items') |
|
| 334 | + . ' i LEFT JOIN ' |
|
| 335 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
|
| 336 | + . ' t ON (t.typeid=i.typeid) LEFT JOIN ' |
|
| 337 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 338 | + . " txt ON (txt.itemid=i.itemid) WHERE i.itemid=x.itemid AND x.cid=$get_catid AND x.active='1' AND i.status='2' ORDER BY $orderby"; |
|
| 339 | + $result = $xoopsDB->query($sql, $show, $min) or $eh->show('0013'); |
|
| 340 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 341 | 341 | |
| 342 | - //if 2 or more items in result, show the sort menu |
|
| 343 | - if ($numrows > 1) { |
|
| 344 | - $xoopsTpl->assign('show_nav', true); |
|
| 345 | - $orderbyTrans = convertorderbytrans($orderby); |
|
| 346 | - $xoopsTpl->assign('lang_sortby', _MD_SORTBY); |
|
| 347 | - $xoopsTpl->assign('lang_title', _MD_TITLE); |
|
| 348 | - $xoopsTpl->assign('lang_date', _MD_DATE); |
|
| 349 | - $xoopsTpl->assign('lang_rating', _MD_RATING); |
|
| 350 | - $xoopsTpl->assign('lang_popularity', _MD_POPULARITY); |
|
| 351 | - if ($orderby != 'typelevel DESC') { |
|
| 352 | - $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_CURSORTEDBY, convertorderbytrans($orderby))); |
|
| 353 | - } |
|
| 354 | - } |
|
| 355 | - if ($xoopsModuleConfig['showlinkimages'] == 1) { |
|
| 356 | - $xoopsTpl->assign('showlinkimages', 1); |
|
| 357 | - } |
|
| 358 | - while (list($itemid, $logourl, $uid, $status, $created, $itemtitle, $hits, $rating, $votes, $typeid, $dirid, $level, $description, $cid) = $xoopsDB->fetchRow($result)) { |
|
| 359 | - if ($isadmin) { |
|
| 360 | - if ($xoopsModuleConfig['showlinkimages'] == 1) { |
|
| 361 | - $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
|
| 362 | - } else { |
|
| 363 | - $adminlink = ''; |
|
| 364 | - } |
|
| 365 | - } else { |
|
| 366 | - $adminlink = ''; |
|
| 367 | - } |
|
| 368 | - if ($votes == 1) { |
|
| 369 | - $votestring = _MD_ONEVOTE; |
|
| 370 | - } else { |
|
| 371 | - $votestring = sprintf(_MD_NUMVOTES, $votes); |
|
| 372 | - } |
|
| 342 | + //if 2 or more items in result, show the sort menu |
|
| 343 | + if ($numrows > 1) { |
|
| 344 | + $xoopsTpl->assign('show_nav', true); |
|
| 345 | + $orderbyTrans = convertorderbytrans($orderby); |
|
| 346 | + $xoopsTpl->assign('lang_sortby', _MD_SORTBY); |
|
| 347 | + $xoopsTpl->assign('lang_title', _MD_TITLE); |
|
| 348 | + $xoopsTpl->assign('lang_date', _MD_DATE); |
|
| 349 | + $xoopsTpl->assign('lang_rating', _MD_RATING); |
|
| 350 | + $xoopsTpl->assign('lang_popularity', _MD_POPULARITY); |
|
| 351 | + if ($orderby != 'typelevel DESC') { |
|
| 352 | + $xoopsTpl->assign('lang_cursortedby', sprintf(_MD_CURSORTEDBY, convertorderbytrans($orderby))); |
|
| 353 | + } |
|
| 354 | + } |
|
| 355 | + if ($xoopsModuleConfig['showlinkimages'] == 1) { |
|
| 356 | + $xoopsTpl->assign('showlinkimages', 1); |
|
| 357 | + } |
|
| 358 | + while (list($itemid, $logourl, $uid, $status, $created, $itemtitle, $hits, $rating, $votes, $typeid, $dirid, $level, $description, $cid) = $xoopsDB->fetchRow($result)) { |
|
| 359 | + if ($isadmin) { |
|
| 360 | + if ($xoopsModuleConfig['showlinkimages'] == 1) { |
|
| 361 | + $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
|
| 362 | + } else { |
|
| 363 | + $adminlink = ''; |
|
| 364 | + } |
|
| 365 | + } else { |
|
| 366 | + $adminlink = ''; |
|
| 367 | + } |
|
| 368 | + if ($votes == 1) { |
|
| 369 | + $votestring = _MD_ONEVOTE; |
|
| 370 | + } else { |
|
| 371 | + $votestring = sprintf(_MD_NUMVOTES, $votes); |
|
| 372 | + } |
|
| 373 | 373 | |
| 374 | - if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
|
| 375 | - $xoopsTpl->assign('showdatafieldsincat', true); |
|
| 376 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 377 | - $sql .= 'FROM ' |
|
| 378 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 379 | - . ' ic, ' |
|
| 380 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 381 | - . ' xc, ' |
|
| 382 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 383 | - . ' f, ' |
|
| 384 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 385 | - . ' t '; |
|
| 386 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
|
| 387 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
|
| 388 | - $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 389 | - $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 390 | - if ($numrows > 0) { |
|
| 391 | - $xoopsTpl->assign('datatypes', true); |
|
| 392 | - } |
|
| 393 | - $sections = array(); |
|
| 394 | - while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $ditemid, $value, $customtitle) = $xoopsDB->fetchRow($data_result)) { |
|
| 395 | - $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value); |
|
| 396 | - if ($icon != '') { |
|
| 397 | - $iconurl = "<img src=\"uploads/$icon\">"; |
|
| 398 | - } else { |
|
| 399 | - $iconurl = ''; |
|
| 400 | - } |
|
| 401 | - if ($custom != '0' && $customtitle != '') { |
|
| 402 | - $title = $customtitle; |
|
| 403 | - } |
|
| 404 | - if ($section == '1' or '1') { |
|
| 405 | - $sections[] = array('icon' => $iconurl, 'label' => $title, 'value' => $fieldvalue, 'fieldtype' => $fieldtype); |
|
| 406 | - } |
|
| 407 | - } |
|
| 408 | - } |
|
| 374 | + if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
|
| 375 | + $xoopsTpl->assign('showdatafieldsincat', true); |
|
| 376 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 377 | + $sql .= 'FROM ' |
|
| 378 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 379 | + . ' ic, ' |
|
| 380 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 381 | + . ' xc, ' |
|
| 382 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 383 | + . ' f, ' |
|
| 384 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 385 | + . ' t '; |
|
| 386 | + $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
|
| 387 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
|
| 388 | + $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 389 | + $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 390 | + if ($numrows > 0) { |
|
| 391 | + $xoopsTpl->assign('datatypes', true); |
|
| 392 | + } |
|
| 393 | + $sections = array(); |
|
| 394 | + while (list($dtypeid, $title, $section, $icon, $ftypeid, $fieldtype, $ext, $options, $custom, $ditemid, $value, $customtitle) = $xoopsDB->fetchRow($data_result)) { |
|
| 395 | + $fieldvalue = $datafieldmanager->getFieldValue($fieldtype, $options, $value); |
|
| 396 | + if ($icon != '') { |
|
| 397 | + $iconurl = "<img src=\"uploads/$icon\">"; |
|
| 398 | + } else { |
|
| 399 | + $iconurl = ''; |
|
| 400 | + } |
|
| 401 | + if ($custom != '0' && $customtitle != '') { |
|
| 402 | + $title = $customtitle; |
|
| 403 | + } |
|
| 404 | + if ($section == '1' or '1') { |
|
| 405 | + $sections[] = array('icon' => $iconurl, 'label' => $title, 'value' => $fieldvalue, 'fieldtype' => $fieldtype); |
|
| 406 | + } |
|
| 407 | + } |
|
| 408 | + } |
|
| 409 | 409 | |
| 410 | - $path = $efqtree->getPathFromId($get_catid, 'title'); |
|
| 411 | - $path = substr($path, 1); |
|
| 412 | - $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 413 | - $new = newlinkgraphic($created, $status); |
|
| 414 | - $pop = popgraphic($hits); |
|
| 415 | - if ($level == null) { |
|
| 416 | - $level = '0'; |
|
| 417 | - } |
|
| 418 | - switch ($level) { |
|
| 419 | - case '0': |
|
| 420 | - $class = 'itemTableLevel0'; |
|
| 421 | - break; |
|
| 422 | - case '1': |
|
| 423 | - $class = 'itemTableLevel1'; |
|
| 424 | - break; |
|
| 425 | - case '2': |
|
| 426 | - $class = 'itemTableLevel2'; |
|
| 427 | - break; |
|
| 428 | - case '3': |
|
| 429 | - $class = 'itemTableLevel3'; |
|
| 430 | - break; |
|
| 431 | - } |
|
| 432 | - $xoopsTpl->append('listings', array( |
|
| 433 | - 'fields' => $sections, |
|
| 434 | - 'id' => $itemid, |
|
| 435 | - 'catid' => $get_catid, |
|
| 436 | - 'logourl' => $myts->htmlSpecialChars($logourl), |
|
| 437 | - 'title' => $myts->htmlSpecialChars($itemtitle) . $new . $pop, |
|
| 438 | - 'status' => $status, |
|
| 439 | - 'created' => formatTimestamp($created, 'm'), |
|
| 440 | - 'rating' => number_format($rating, 2), |
|
| 441 | - 'category' => $path, |
|
| 442 | - 'description' => $myts->displayTarea($description, 0), |
|
| 443 | - 'adminlink' => $adminlink, |
|
| 444 | - 'hits' => $hits, |
|
| 445 | - 'rating' => $rating, |
|
| 446 | - 'votes' => $votestring, |
|
| 447 | - 'class' => $class, |
|
| 448 | - 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
|
| 449 | - 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/listing.php?catid=' . $get_catid . '&item=' . $itemid) |
|
| 450 | - )); |
|
| 451 | - } |
|
| 452 | - $orderby = convertorderbyout($orderby); |
|
| 453 | - //Calculates how many pages exist. Which page one should be on, etc... |
|
| 454 | - $listingpages = ceil($totalcount / $show); |
|
| 410 | + $path = $efqtree->getPathFromId($get_catid, 'title'); |
|
| 411 | + $path = substr($path, 1); |
|
| 412 | + $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 413 | + $new = newlinkgraphic($created, $status); |
|
| 414 | + $pop = popgraphic($hits); |
|
| 415 | + if ($level == null) { |
|
| 416 | + $level = '0'; |
|
| 417 | + } |
|
| 418 | + switch ($level) { |
|
| 419 | + case '0': |
|
| 420 | + $class = 'itemTableLevel0'; |
|
| 421 | + break; |
|
| 422 | + case '1': |
|
| 423 | + $class = 'itemTableLevel1'; |
|
| 424 | + break; |
|
| 425 | + case '2': |
|
| 426 | + $class = 'itemTableLevel2'; |
|
| 427 | + break; |
|
| 428 | + case '3': |
|
| 429 | + $class = 'itemTableLevel3'; |
|
| 430 | + break; |
|
| 431 | + } |
|
| 432 | + $xoopsTpl->append('listings', array( |
|
| 433 | + 'fields' => $sections, |
|
| 434 | + 'id' => $itemid, |
|
| 435 | + 'catid' => $get_catid, |
|
| 436 | + 'logourl' => $myts->htmlSpecialChars($logourl), |
|
| 437 | + 'title' => $myts->htmlSpecialChars($itemtitle) . $new . $pop, |
|
| 438 | + 'status' => $status, |
|
| 439 | + 'created' => formatTimestamp($created, 'm'), |
|
| 440 | + 'rating' => number_format($rating, 2), |
|
| 441 | + 'category' => $path, |
|
| 442 | + 'description' => $myts->displayTarea($description, 0), |
|
| 443 | + 'adminlink' => $adminlink, |
|
| 444 | + 'hits' => $hits, |
|
| 445 | + 'rating' => $rating, |
|
| 446 | + 'votes' => $votestring, |
|
| 447 | + 'class' => $class, |
|
| 448 | + 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
|
| 449 | + 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/listing.php?catid=' . $get_catid . '&item=' . $itemid) |
|
| 450 | + )); |
|
| 451 | + } |
|
| 452 | + $orderby = convertorderbyout($orderby); |
|
| 453 | + //Calculates how many pages exist. Which page one should be on, etc... |
|
| 454 | + $listingpages = ceil($totalcount / $show); |
|
| 455 | 455 | |
| 456 | - //Page Numbering |
|
| 457 | - if ($listingpages != 1 && $listingpages != 0) { |
|
| 458 | - $get_catid = (int)$_GET['catid']; |
|
| 459 | - $prev = $min - $show; |
|
| 460 | - if ($prev >= 0) { |
|
| 461 | - $page_nav .= "<a href='index.php?catid=" . $get_catid . "&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; |
|
| 462 | - } |
|
| 463 | - $counter = 1; |
|
| 464 | - $currentpage = ($max / $show); |
|
| 465 | - while ($counter <= $listingpages) { |
|
| 466 | - $mintemp = ($show * $counter) - $show; |
|
| 467 | - if ($counter == $currentpage) { |
|
| 468 | - $page_nav .= '<strong>(' . $counter . ')</strong> '; |
|
| 469 | - } else { |
|
| 470 | - $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $mintemp . '&orderby=' . $orderby . '&show=' . $show . '\'>' . $counter . '</a> '; |
|
| 471 | - } |
|
| 472 | - ++$counter; |
|
| 473 | - } |
|
| 474 | - if ($numrows > $max) { |
|
| 475 | - $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $max . '&orderby=' . $orderby . '&show=' . $show . '\'>'; |
|
| 476 | - $page_nav .= '<strong><u>»</u></strong></a>'; |
|
| 477 | - } |
|
| 478 | - $xoopsTpl->assign('page_nav', $page_nav); |
|
| 479 | - } |
|
| 480 | - } |
|
| 481 | - } |
|
| 482 | - } |
|
| 456 | + //Page Numbering |
|
| 457 | + if ($listingpages != 1 && $listingpages != 0) { |
|
| 458 | + $get_catid = (int)$_GET['catid']; |
|
| 459 | + $prev = $min - $show; |
|
| 460 | + if ($prev >= 0) { |
|
| 461 | + $page_nav .= "<a href='index.php?catid=" . $get_catid . "&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; |
|
| 462 | + } |
|
| 463 | + $counter = 1; |
|
| 464 | + $currentpage = ($max / $show); |
|
| 465 | + while ($counter <= $listingpages) { |
|
| 466 | + $mintemp = ($show * $counter) - $show; |
|
| 467 | + if ($counter == $currentpage) { |
|
| 468 | + $page_nav .= '<strong>(' . $counter . ')</strong> '; |
|
| 469 | + } else { |
|
| 470 | + $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $mintemp . '&orderby=' . $orderby . '&show=' . $show . '\'>' . $counter . '</a> '; |
|
| 471 | + } |
|
| 472 | + ++$counter; |
|
| 473 | + } |
|
| 474 | + if ($numrows > $max) { |
|
| 475 | + $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $max . '&orderby=' . $orderby . '&show=' . $show . '\'>'; |
|
| 476 | + $page_nav .= '<strong><u>»</u></strong></a>'; |
|
| 477 | + } |
|
| 478 | + $xoopsTpl->assign('page_nav', $page_nav); |
|
| 479 | + } |
|
| 480 | + } |
|
| 481 | + } |
|
| 482 | + } |
|
| 483 | 483 | } |
| 484 | 484 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -18,23 +18,23 @@ discard block |
||
| 18 | 18 | * @author XOOPS Development Team, |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -include __DIR__ . '/header.php'; |
|
| 21 | +include __DIR__.'/header.php'; |
|
| 22 | 22 | $myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
| 23 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
| 24 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
| 25 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 26 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 27 | -require_once __DIR__ . '/class/class.datafieldmanager.php'; |
|
| 28 | -require_once __DIR__ . '/class/class.couponhandler.php'; |
|
| 29 | -require_once __DIR__ . '/class/class.efqtree.php'; |
|
| 23 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 24 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 27 | +require_once __DIR__.'/class/class.datafieldmanager.php'; |
|
| 28 | +require_once __DIR__.'/class/class.couponhandler.php'; |
|
| 29 | +require_once __DIR__.'/class/class.efqtree.php'; |
|
| 30 | 30 | |
| 31 | 31 | $datafieldmanager = new efqDataFieldManager(); |
| 32 | 32 | $moddir = $xoopsModule->getVar('dirname'); |
| 33 | 33 | |
| 34 | 34 | $eh = new ErrorHandler; |
| 35 | 35 | |
| 36 | -$mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 37 | -$efqtree = new efqTree($xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 36 | +$mytree = new XoopsTree($xoopsDB->prefix($module->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 37 | +$efqtree = new efqTree($xoopsDB->prefix($module->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 38 | 38 | |
| 39 | 39 | //Check if any option in URL |
| 40 | 40 | if (!empty($_GET['op'])) { |
@@ -45,21 +45,21 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | //Check if a category is selected. |
| 47 | 47 | if (!empty($_GET['catid'])) { |
| 48 | - $get_catid = (int)$_GET['catid']; |
|
| 48 | + $get_catid = (int) $_GET['catid']; |
|
| 49 | 49 | } else { |
| 50 | 50 | $get_catid = '0'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | //Check if a directory is selected. |
| 54 | 54 | if (!empty($_GET['dirid'])) { |
| 55 | - $get_dirid = (int)$_GET['dirid']; |
|
| 55 | + $get_dirid = (int) $_GET['dirid']; |
|
| 56 | 56 | } else { |
| 57 | 57 | $get_dirid = '0'; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | if ($get_dirid == '0' && $get_catid == '0') { |
| 61 | 61 | //Show an overview of directories with directory title, image and description for each directory. |
| 62 | - $result = $xoopsDB->query('SELECT dirid, name, descr, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dir') . " WHERE open = '1' ORDER BY name") or $eh->show('0013'); |
|
| 62 | + $result = $xoopsDB->query('SELECT dirid, name, descr, img FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_dir')." WHERE open = '1' ORDER BY name") or $eh->show('0013'); |
|
| 63 | 63 | $num_results = $xoopsDB->getRowsNum($result); |
| 64 | 64 | if ($num_results == 1) { |
| 65 | 65 | if ($xoopsModuleConfig['autoshowonedir'] == 1) { |
@@ -68,30 +68,30 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | 70 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
| 71 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 71 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 72 | 72 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 73 | 73 | $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
| 74 | 74 | $xoopsTpl->assign('moddir', $moddir); |
| 75 | 75 | while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
| 76 | 76 | if ($img != '') { |
| 77 | - $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
|
| 77 | + $img = XOOPS_URL."/modules/$moddir/uploads/".$myts->htmlSpecialChars($img); |
|
| 78 | 78 | } else { |
| 79 | - $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
|
| 79 | + $img = XOOPS_URL."/modules/$moddir/assets/images/nopicture.gif"; |
|
| 80 | 80 | } |
| 81 | 81 | $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } elseif ($num_results >= 2) { |
| 85 | 85 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_directories.tpl'; |
| 86 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 86 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 87 | 87 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 88 | 88 | $xoopsTpl->assign('lang_directories', _MD_DIRECTORIES_HEADER); |
| 89 | 89 | $xoopsTpl->assign('moddir', $moddir); |
| 90 | 90 | while (list($dirid, $name, $descr, $img) = $xoopsDB->fetchRow($result)) { |
| 91 | 91 | if ($img != '') { |
| 92 | - $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($img); |
|
| 92 | + $img = XOOPS_URL."/modules/$moddir/uploads/".$myts->htmlSpecialChars($img); |
|
| 93 | 93 | } else { |
| 94 | - $img = XOOPS_URL . "/modules/$moddir/assets/images/nopicture.gif"; |
|
| 94 | + $img = XOOPS_URL."/modules/$moddir/assets/images/nopicture.gif"; |
|
| 95 | 95 | } |
| 96 | 96 | $xoopsTpl->append('directories', array('image' => $img, 'id' => $dirid, 'title' => $name, 'descr' => $descr)); |
| 97 | 97 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if ($get_dirid != 0 || $get_catid != 0) { |
| 104 | 104 | //Get all categories and child categories for selected category |
| 105 | 105 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_index.tpl'; |
| 106 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 106 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 107 | 107 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 108 | 108 | $xoopsTpl->assign('moddir', $moddir); |
| 109 | 109 | if ($get_dirid == '0') { |
@@ -116,21 +116,21 @@ discard block |
||
| 116 | 116 | $lang_adv_search = ob_get_contents(); |
| 117 | 117 | ob_end_clean(); |
| 118 | 118 | $searchform = '<form action="search.php" name="search" id="search" method="get">'; |
| 119 | - $searchform .= '<input type="hidden" name="dirid" value="' . $dirid . '"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" class="formButton" name="submit" value="' . _MD_SEARCH . '">' . $lang_adv_search . '</form>'; |
|
| 119 | + $searchform .= '<input type="hidden" name="dirid" value="'.$dirid.'"><input type="text" name="q" size="40" maxsize="150" value=""><input type="submit" class="formButton" name="submit" value="'._MD_SEARCH.'">'.$lang_adv_search.'</form>'; |
|
| 120 | 120 | $xoopsTpl->assign('searchform', $searchform); |
| 121 | - $pathstring = "<a href='index.php?dirid=" . $dirid . '\'>' . _MD_MAIN . '</a> : '; |
|
| 122 | - $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'index.php?dirid=' . $dirid . '&op='); |
|
| 121 | + $pathstring = "<a href='index.php?dirid=".$dirid.'\'>'._MD_MAIN.'</a> : '; |
|
| 122 | + $pathstring .= $efqtree->getNicePathFromId($get_catid, 'title', 'index.php?dirid='.$dirid.'&op='); |
|
| 123 | 123 | $xoopsTpl->assign('category_path', $pathstring); |
| 124 | 124 | |
| 125 | 125 | if (isset($xoopsUser) && $xoopsUser != null) { |
| 126 | - $submitlink = '<a href="submit.php?dirid=' . $dirid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/' . $xoopsConfig['language'] . '/listing-new.gif" alt="' . _MD_SUBMITLISTING . '" title="' . _MD_SUBMITLISTING . '"></a>'; |
|
| 126 | + $submitlink = '<a href="submit.php?dirid='.$dirid.'"><img src="'.XOOPS_URL.'/modules/'.$moddir.'/assets/images/'.$xoopsConfig['language'].'/listing-new.gif" alt="'._MD_SUBMITLISTING.'" title="'._MD_SUBMITLISTING.'"></a>'; |
|
| 127 | 127 | $xoopsTpl->assign('submit_link', $submitlink); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | if ($get_catid == 0) { |
| 131 | - $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '0' AND dirid = '" . $get_dirid . '\' ORDER BY title') or $eh->show('0013'); |
|
| 131 | + $result = $xoopsDB->query('SELECT cid, title, img FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE pid = '0' AND dirid = '".$get_dirid.'\' ORDER BY title') or $eh->show('0013'); |
|
| 132 | 132 | } else { |
| 133 | - $result = $xoopsDB->query('SELECT cid, title, img FROM ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') . " WHERE pid = '" . $get_catid . '\' ORDER BY title') or $eh->show('0013'); |
|
| 133 | + $result = $xoopsDB->query('SELECT cid, title, img FROM '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_cat')." WHERE pid = '".$get_catid.'\' ORDER BY title') or $eh->show('0013'); |
|
| 134 | 134 | } |
| 135 | 135 | $num_results = $GLOBALS['xoopsDB']->getRowsNum($result); |
| 136 | 136 | if ($num_results == 0 && isset($_GET['dirid'])) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $totallisting = getTotalItems($myrow['cid'], 2); |
| 142 | 142 | $img = ''; |
| 143 | 143 | if ($myrow['img'] && $myrow['img'] != '') { |
| 144 | - $img = XOOPS_URL . "/modules/$moddir/uploads/" . $myts->htmlSpecialChars($myrow['img']); |
|
| 144 | + $img = XOOPS_URL."/modules/$moddir/uploads/".$myts->htmlSpecialChars($myrow['img']); |
|
| 145 | 145 | } |
| 146 | 146 | $arr = array(); |
| 147 | 147 | $arr = $efqtree->getFirstChild($myrow['cid'], 'title'); |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | if ($space > 0) { |
| 158 | 158 | $subcategories .= ', '; |
| 159 | 159 | } |
| 160 | - $subcategories .= '<a class="subcategory" href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $ele['cid'] . '">' . $chtitle . '</a>'; |
|
| 160 | + $subcategories .= '<a class="subcategory" href="'.XOOPS_URL."/modules/$moddir/index.php?catid=".$ele['cid'].'">'.$chtitle.'</a>'; |
|
| 161 | 161 | ++$space; |
| 162 | 162 | ++$chcount; |
| 163 | 163 | } |
| 164 | - $cattitle = '<a href="' . XOOPS_URL . "/modules/$moddir/index.php?catid=" . $myrow['cid'] . '">' . $myrow['title'] . '</a>'; |
|
| 164 | + $cattitle = '<a href="'.XOOPS_URL."/modules/$moddir/index.php?catid=".$myrow['cid'].'">'.$myrow['title'].'</a>'; |
|
| 165 | 165 | $xoopsTpl->append('categories', array('image' => $img, 'id' => $myrow['cid'], 'title' => $cattitle, 'subcategories' => $subcategories, 'totallisting' => $totallisting, 'count' => $count)); |
| 166 | 166 | ++$count; |
| 167 | 167 | } |
@@ -196,14 +196,14 @@ discard block |
||
| 196 | 196 | $xoopsTpl->assign('lang_visit', _MD_VISIT); |
| 197 | 197 | $sections = array(); |
| 198 | 198 | if ($get_catid == 0) { |
| 199 | - $sql = 'SELECT l.itemid, l.logourl, l.uid, l.status, l.created, l.title, l.hits, l.rating, l.votes, l.typeid, l.dirid, t.description FROM ' |
|
| 200 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_cat') |
|
| 199 | + $sql = 'SELECT l.itemid, l.logourl, l.uid, l.status, l.created, l.title, l.hits, l.rating, l.votes, l.typeid, l.dirid, t.description FROM ' |
|
| 200 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_cat') |
|
| 201 | 201 | . ' c, ' |
| 202 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 202 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat') |
|
| 203 | 203 | . ' x, ' |
| 204 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 204 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 205 | 205 | . ' l LEFT JOIN ' |
| 206 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 206 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 207 | 207 | . " t ON (l.itemid=t.itemid) WHERE x.cid=c.cid AND l.itemid=x.itemid AND c.showpopular=1 AND l.status='2' AND l.dirid = '" |
| 208 | 208 | . $get_dirid |
| 209 | 209 | . '\' ORDER BY l.created DESC'; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | while (list($itemid, $logourl, $uid, $status, $created, $ltitle, $hits, $rating, $votes, $type, $dirid, $description) = $xoopsDB->fetchRow($result)) { |
| 213 | 213 | if ($isadmin) { |
| 214 | - $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLINK . '"></a>'; |
|
| 214 | + $adminlink = '<a href="'.XOOPS_URL.'/modules/'.$moddir.'/admin/index.php?op=edit&item='.$itemid.'"><img src="'.XOOPS_URL.'/modules/'.$moddir.'/assets/images/editicon.gif" border="0" alt="'._MD_EDITTHISLINK.'"></a>'; |
|
| 215 | 215 | } else { |
| 216 | 216 | $adminlink = ''; |
| 217 | 217 | } |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
| 225 | 225 | $xoopsTpl->assign('showdatafieldsincat', true); |
| 226 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 227 | - $sql .= 'FROM ' |
|
| 228 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 226 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 227 | + $sql .= 'FROM ' |
|
| 228 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat') |
|
| 229 | 229 | . ' ic, ' |
| 230 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 230 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 231 | 231 | . ' xc, ' |
| 232 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 232 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_fieldtypes') |
|
| 233 | 233 | . ' f, ' |
| 234 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 234 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_dtypes') |
|
| 235 | 235 | . ' t '; |
| 236 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
|
| 237 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
|
| 236 | + $sql .= 'LEFT JOIN '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_data').' d ON (t.dtypeid=d.dtypeid AND d.itemid='.$itemid.') '; |
|
| 237 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=".$itemid.' ORDER BY t.seq ASC'; |
|
| 238 | 238 | $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 239 | 239 | $numrows = $xoopsDB->getRowsNum($data_result); |
| 240 | 240 | if ($numrows > 0) { |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $coupons = $couponHandler->getCountByLink($itemid); |
| 262 | 262 | $path = $efqtree->getPathFromId($get_catid, 'title'); |
| 263 | 263 | $path = substr($path, 1); |
| 264 | - $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 264 | + $path = str_replace('/', " <img src='".XOOPS_URL.'/modules/'.$moddir."/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 265 | 265 | $new = newlinkgraphic($created, $status); |
| 266 | 266 | $pop = popgraphic($hits); |
| 267 | 267 | $xoopsTpl->append('listings', array( |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | 'catid' => $get_catid, |
| 271 | 271 | 'id' => $itemid, |
| 272 | 272 | 'rating' => number_format($rating, 2), |
| 273 | - 'title' => $myts->htmlSpecialChars($ltitle) . $pop, |
|
| 273 | + 'title' => $myts->htmlSpecialChars($ltitle).$pop, |
|
| 274 | 274 | 'type' => $type, |
| 275 | 275 | 'logourl' => $myts->htmlSpecialChars($logourl), |
| 276 | 276 | 'description' => $myts->displayTarea($description, 0), |
@@ -278,16 +278,16 @@ discard block |
||
| 278 | 278 | 'hits' => $hits, |
| 279 | 279 | 'votes' => $votestring, |
| 280 | 280 | 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
| 281 | - 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/singleitem.php?cid=' . $get_catid . '&item=' . $itemid) |
|
| 281 | + 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/'.$moddir.'/singleitem.php?cid='.$get_catid.'&item='.$itemid) |
|
| 282 | 282 | )); |
| 283 | 283 | } |
| 284 | 284 | } else { |
| 285 | 285 | if (isset($_GET['show'])) { |
| 286 | - $show = (int)$_GET['show']; |
|
| 286 | + $show = (int) $_GET['show']; |
|
| 287 | 287 | } else { |
| 288 | 288 | $show = $xoopsModuleConfig['perpage']; |
| 289 | 289 | } |
| 290 | - $min = isset($_GET['min']) ? (int)$_GET['min'] : 0; |
|
| 290 | + $min = isset($_GET['min']) ? (int) $_GET['min'] : 0; |
|
| 291 | 291 | if (!isset($max)) { |
| 292 | 292 | $max = $min + $show; |
| 293 | 293 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | } else { |
| 297 | 297 | $orderby = 'typelevel DESC'; |
| 298 | 298 | } |
| 299 | - $fullcountresult = $xoopsDB->query('select count(*) from ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') . ' i, ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') . " x WHERE i.itemid=x.itemid AND x.cid=$get_catid AND i.status='2'"); |
|
| 299 | + $fullcountresult = $xoopsDB->query('select count(*) from '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_items').' i, '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat')." x WHERE i.itemid=x.itemid AND x.cid=$get_catid AND i.status='2'"); |
|
| 300 | 300 | list($numrows) = $xoopsDB->fetchRow($fullcountresult); |
| 301 | 301 | $totalcount = $numrows; |
| 302 | 302 | $page_nav = ''; |
@@ -326,15 +326,15 @@ discard block |
||
| 326 | 326 | $xoopsTpl->assign('lang_category', _MD_CATEGORYC); |
| 327 | 327 | $xoopsTpl->assign('lang_visit', _MD_VISIT); |
| 328 | 328 | $xoopsTpl->assign('show_listings', true); |
| 329 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.hits, i.rating, i.votes, i.typeid, i.dirid, t.typelevel, txt.description, x.cid FROM ' |
|
| 330 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 329 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.hits, i.rating, i.votes, i.typeid, i.dirid, t.typelevel, txt.description, x.cid FROM ' |
|
| 330 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat') |
|
| 331 | 331 | . ' x, ' |
| 332 | 332 | . $xoopsDB->prefix($module->getVar('dirname', 'n') |
| 333 | 333 | . '_items') |
| 334 | 334 | . ' i LEFT JOIN ' |
| 335 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
|
| 335 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_itemtypes') |
|
| 336 | 336 | . ' t ON (t.typeid=i.typeid) LEFT JOIN ' |
| 337 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_text') |
|
| 337 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_text') |
|
| 338 | 338 | . " txt ON (txt.itemid=i.itemid) WHERE i.itemid=x.itemid AND x.cid=$get_catid AND x.active='1' AND i.status='2' ORDER BY $orderby"; |
| 339 | 339 | $result = $xoopsDB->query($sql, $show, $min) or $eh->show('0013'); |
| 340 | 340 | $numrows = $xoopsDB->getRowsNum($result); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | while (list($itemid, $logourl, $uid, $status, $created, $itemtitle, $hits, $rating, $votes, $typeid, $dirid, $level, $description, $cid) = $xoopsDB->fetchRow($result)) { |
| 359 | 359 | if ($isadmin) { |
| 360 | 360 | if ($xoopsModuleConfig['showlinkimages'] == 1) { |
| 361 | - $adminlink = '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/admin/index.php?op=edit&item=' . $itemid . '"><img src="' . XOOPS_URL . '/modules/' . $moddir . '/assets/images/editicon.gif" border="0" alt="' . _MD_EDITTHISLISTING . '"></a>'; |
|
| 361 | + $adminlink = '<a href="'.XOOPS_URL.'/modules/'.$moddir.'/admin/index.php?op=edit&item='.$itemid.'"><img src="'.XOOPS_URL.'/modules/'.$moddir.'/assets/images/editicon.gif" border="0" alt="'._MD_EDITTHISLISTING.'"></a>'; |
|
| 362 | 362 | } else { |
| 363 | 363 | $adminlink = ''; |
| 364 | 364 | } |
@@ -373,18 +373,18 @@ discard block |
||
| 373 | 373 | |
| 374 | 374 | if ($xoopsModuleConfig['showdatafieldsincat'] == '1') { |
| 375 | 375 | $xoopsTpl->assign('showdatafieldsincat', true); |
| 376 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 377 | - $sql .= 'FROM ' |
|
| 378 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_item_x_cat') |
|
| 376 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, t.icon, f.typeid, f.fieldtype, f.ext, t.options, t.custom, d.itemid, d.value, d.customtitle '; |
|
| 377 | + $sql .= 'FROM ' |
|
| 378 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_item_x_cat') |
|
| 379 | 379 | . ' ic, ' |
| 380 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 380 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 381 | 381 | . ' xc, ' |
| 382 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_fieldtypes') |
|
| 382 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_fieldtypes') |
|
| 383 | 383 | . ' f, ' |
| 384 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_dtypes') |
|
| 384 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_dtypes') |
|
| 385 | 385 | . ' t '; |
| 386 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $itemid . ') '; |
|
| 387 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=" . $itemid . ' ORDER BY t.seq ASC'; |
|
| 386 | + $sql .= 'LEFT JOIN '.$xoopsDB->prefix($module->getVar('dirname', 'n').'_data').' d ON (t.dtypeid=d.dtypeid AND d.itemid='.$itemid.') '; |
|
| 387 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND t.activeyn='1' AND ic.itemid=".$itemid.' ORDER BY t.seq ASC'; |
|
| 388 | 388 | $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 389 | 389 | $numrows = $xoopsDB->getRowsNum($data_result); |
| 390 | 390 | if ($numrows > 0) { |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | |
| 410 | 410 | $path = $efqtree->getPathFromId($get_catid, 'title'); |
| 411 | 411 | $path = substr($path, 1); |
| 412 | - $path = str_replace('/', " <img src='" . XOOPS_URL . '/modules/' . $moddir . "/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 412 | + $path = str_replace('/', " <img src='".XOOPS_URL.'/modules/'.$moddir."/assets/images/arrow.gif' board='0' alt=''> ", $path); |
|
| 413 | 413 | $new = newlinkgraphic($created, $status); |
| 414 | 414 | $pop = popgraphic($hits); |
| 415 | 415 | if ($level == null) { |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | 'id' => $itemid, |
| 435 | 435 | 'catid' => $get_catid, |
| 436 | 436 | 'logourl' => $myts->htmlSpecialChars($logourl), |
| 437 | - 'title' => $myts->htmlSpecialChars($itemtitle) . $new . $pop, |
|
| 437 | + 'title' => $myts->htmlSpecialChars($itemtitle).$new.$pop, |
|
| 438 | 438 | 'status' => $status, |
| 439 | 439 | 'created' => formatTimestamp($created, 'm'), |
| 440 | 440 | 'rating' => number_format($rating, 2), |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | 'votes' => $votestring, |
| 447 | 447 | 'class' => $class, |
| 448 | 448 | 'mail_subject' => rawurlencode(sprintf(_MD_INTERESTING_LISTING, $xoopsConfig['sitename'])), |
| 449 | - 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']) . ': ' . XOOPS_URL . '/modules/' . $moddir . '/listing.php?catid=' . $get_catid . '&item=' . $itemid) |
|
| 449 | + 'mail_body' => rawurlencode(sprintf(_MD_INTERESTING_LISTING_FOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/'.$moddir.'/listing.php?catid='.$get_catid.'&item='.$itemid) |
|
| 450 | 450 | )); |
| 451 | 451 | } |
| 452 | 452 | $orderby = convertorderbyout($orderby); |
@@ -455,24 +455,24 @@ discard block |
||
| 455 | 455 | |
| 456 | 456 | //Page Numbering |
| 457 | 457 | if ($listingpages != 1 && $listingpages != 0) { |
| 458 | - $get_catid = (int)$_GET['catid']; |
|
| 458 | + $get_catid = (int) $_GET['catid']; |
|
| 459 | 459 | $prev = $min - $show; |
| 460 | 460 | if ($prev >= 0) { |
| 461 | - $page_nav .= "<a href='index.php?catid=" . $get_catid . "&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; |
|
| 461 | + $page_nav .= "<a href='index.php?catid=".$get_catid."&min=$prev&orderby=$orderby&show=$show'><b><u>«</u></b></a> "; |
|
| 462 | 462 | } |
| 463 | 463 | $counter = 1; |
| 464 | 464 | $currentpage = ($max / $show); |
| 465 | 465 | while ($counter <= $listingpages) { |
| 466 | 466 | $mintemp = ($show * $counter) - $show; |
| 467 | 467 | if ($counter == $currentpage) { |
| 468 | - $page_nav .= '<strong>(' . $counter . ')</strong> '; |
|
| 468 | + $page_nav .= '<strong>('.$counter.')</strong> '; |
|
| 469 | 469 | } else { |
| 470 | - $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $mintemp . '&orderby=' . $orderby . '&show=' . $show . '\'>' . $counter . '</a> '; |
|
| 470 | + $page_nav .= "<a href='index.php?catid=".$get_catid.'&min='.$mintemp.'&orderby='.$orderby.'&show='.$show.'\'>'.$counter.'</a> '; |
|
| 471 | 471 | } |
| 472 | 472 | ++$counter; |
| 473 | 473 | } |
| 474 | 474 | if ($numrows > $max) { |
| 475 | - $page_nav .= "<a href='index.php?catid=" . $get_catid . '&min=' . $max . '&orderby=' . $orderby . '&show=' . $show . '\'>'; |
|
| 475 | + $page_nav .= "<a href='index.php?catid=".$get_catid.'&min='.$max.'&orderby='.$orderby.'&show='.$show.'\'>'; |
|
| 476 | 476 | $page_nav .= '<strong><u>»</u></strong></a>'; |
| 477 | 477 | } |
| 478 | 478 | $xoopsTpl->assign('page_nav', $page_nav); |
@@ -481,4 +481,4 @@ discard block |
||
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 484 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
@@ -31,326 +31,326 @@ |
||
| 31 | 31 | $subscription = new efqSubscription(); |
| 32 | 32 | |
| 33 | 33 | if (isset($_GET['op'])) { |
| 34 | - $op = $_GET['op']; |
|
| 34 | + $op = $_GET['op']; |
|
| 35 | 35 | } elseif (isset($_POST['op'])) { |
| 36 | - $op = $_POST['op']; |
|
| 36 | + $op = $_POST['op']; |
|
| 37 | 37 | } else { |
| 38 | - $op = ''; |
|
| 38 | + $op = ''; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $moddir = $xoopsModule->getVar('dirname'); |
| 42 | 42 | |
| 43 | 43 | if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
| 44 | - $isadmin = true; |
|
| 44 | + $isadmin = true; |
|
| 45 | 45 | } else { |
| 46 | - $isadmin = false; |
|
| 46 | + $isadmin = false; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (!empty($_GET['item'])) { |
| 50 | - $get_itemid = (int)$_GET['item']; |
|
| 50 | + $get_itemid = (int)$_GET['item']; |
|
| 51 | 51 | } else { |
| 52 | - $get_itemid = '0'; |
|
| 52 | + $get_itemid = '0'; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $owner = getUserIdFromItem($get_itemid); |
| 56 | 56 | |
| 57 | 57 | if ($xoopsUser->getVar('uid') == $owner) { |
| 58 | - $editrights = '1'; |
|
| 58 | + $editrights = '1'; |
|
| 59 | 59 | } else { |
| 60 | - $editrights = '0'; |
|
| 61 | - redirect_header("listing.php?itemid=$get_itemid", 2, _MD_EDITRIGHTS); |
|
| 62 | - exit(); |
|
| 60 | + $editrights = '0'; |
|
| 61 | + redirect_header("listing.php?itemid=$get_itemid", 2, _MD_EDITRIGHTS); |
|
| 62 | + exit(); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | function showsubscription() |
| 66 | 66 | { |
| 67 | - global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $owner, $xoopsOption, $xoopsTpl, $subscription, $xoopsUser; |
|
| 68 | - //Check if item selected. |
|
| 69 | - if ($get_itemid == '0') { |
|
| 70 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 71 | - exit(); |
|
| 72 | - } |
|
| 67 | + global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $owner, $xoopsOption, $xoopsTpl, $subscription, $xoopsUser; |
|
| 68 | + //Check if item selected. |
|
| 69 | + if ($get_itemid == '0') { |
|
| 70 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 71 | + exit(); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - //Default function (if listing type is normal) would be to view the possible subscriptions. |
|
| 74 | + //Default function (if listing type is normal) would be to view the possible subscriptions. |
|
| 75 | 75 | |
| 76 | - //Show current subscription order for listing |
|
| 77 | - $defaultstartdate = time(); |
|
| 78 | - $sql = 'SELECT i.title, i.typeid, o.orderid, o.offerid, o.startdate, o.enddate, o.billto, o.status, o.itemid, o.autorenew, t.typename, p.ref, p.payment_status FROM ' |
|
| 79 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
|
| 80 | - . ' t, ' |
|
| 81 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 82 | - . ' i, ' |
|
| 83 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_orders') |
|
| 84 | - . ' o LEFT JOIN ' |
|
| 85 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_payments') |
|
| 86 | - . ' p ON (o.orderid=p.orderid) WHERE o.typeid = t.typeid AND o.itemid=p.ref AND o.itemid=i.itemid AND i.itemid=' |
|
| 87 | - . $get_itemid |
|
| 88 | - . ' ORDER BY t.typelevel ASC'; |
|
| 89 | - $item_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 90 | - $numrows = $xoopsDB->getRowsNum($item_result); |
|
| 91 | - $order_exists = false; |
|
| 92 | - if ($numrows > 0) { |
|
| 93 | - $xoopsTpl->assign('order_table', true); |
|
| 94 | - while (list($title, $typeid, $orderid, $offerid, $startdate, $enddate, $billto, $orderstatus, $itemid, $autorenew, $typename, $ref, $paymentstatus) = $xoopsDB->fetchRow($item_result)) { |
|
| 95 | - //Assign the text of the label for subscription type. |
|
| 96 | - $ordername = $subscription->getOrderItemName($offerid); |
|
| 76 | + //Show current subscription order for listing |
|
| 77 | + $defaultstartdate = time(); |
|
| 78 | + $sql = 'SELECT i.title, i.typeid, o.orderid, o.offerid, o.startdate, o.enddate, o.billto, o.status, o.itemid, o.autorenew, t.typename, p.ref, p.payment_status FROM ' |
|
| 79 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
|
| 80 | + . ' t, ' |
|
| 81 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 82 | + . ' i, ' |
|
| 83 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_orders') |
|
| 84 | + . ' o LEFT JOIN ' |
|
| 85 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_payments') |
|
| 86 | + . ' p ON (o.orderid=p.orderid) WHERE o.typeid = t.typeid AND o.itemid=p.ref AND o.itemid=i.itemid AND i.itemid=' |
|
| 87 | + . $get_itemid |
|
| 88 | + . ' ORDER BY t.typelevel ASC'; |
|
| 89 | + $item_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 90 | + $numrows = $xoopsDB->getRowsNum($item_result); |
|
| 91 | + $order_exists = false; |
|
| 92 | + if ($numrows > 0) { |
|
| 93 | + $xoopsTpl->assign('order_table', true); |
|
| 94 | + while (list($title, $typeid, $orderid, $offerid, $startdate, $enddate, $billto, $orderstatus, $itemid, $autorenew, $typename, $ref, $paymentstatus) = $xoopsDB->fetchRow($item_result)) { |
|
| 95 | + //Assign the text of the label for subscription type. |
|
| 96 | + $ordername = $subscription->getOrderItemName($offerid); |
|
| 97 | 97 | |
| 98 | - if ($paymentstatus == '') { |
|
| 99 | - $paymentstatus = _MD_LANG_INCOMPLETE; |
|
| 100 | - $terminate_on = '1'; |
|
| 101 | - } else { |
|
| 102 | - $terminate_on = null; |
|
| 103 | - $order_exists = true; |
|
| 104 | - } |
|
| 105 | - if ($orderstatus == '1') { |
|
| 106 | - $defaultstartdate = $billto; |
|
| 107 | - } |
|
| 108 | - if ($billto != '') { |
|
| 109 | - $billto = date('d-M-Y', $billto); |
|
| 110 | - } |
|
| 111 | - if ($enddate != '') { |
|
| 112 | - $enddate = date('d-M-Y', $enddate); |
|
| 113 | - } |
|
| 114 | - if ($startdate != '') { |
|
| 115 | - $startdate = date('d-M-Y', $startdate); |
|
| 116 | - } |
|
| 117 | - $xoopsTpl->assign('lang_subscr_offers_header', _MD_LANG_SUBSCR_ACTIVE_ORDERS_HEADER); |
|
| 118 | - $xoopsTpl->append('active_orders', array( |
|
| 119 | - 'orderid' => $orderid, |
|
| 120 | - 'ordername' => $ordername, |
|
| 121 | - 'offerid' => $offerid, |
|
| 122 | - 'startdate' => $startdate, |
|
| 123 | - 'enddate' => $enddate, |
|
| 124 | - 'billto' => $billto, |
|
| 125 | - 'orderstatus' => $orderstatus, |
|
| 126 | - 'itemid' => $itemid, |
|
| 127 | - 'autorenew' => $autorenew, |
|
| 128 | - 'typename' => $myts->htmlSpecialChars($typename), |
|
| 129 | - 'ref' => $ref, |
|
| 130 | - 'paymentstatus' => $paymentstatus, |
|
| 131 | - 'renewal_url' => "subscriptions.php?op=renew&order=$orderid&item=$get_itemid", |
|
| 132 | - 'terminate_url' => "subscriptions.php?op=terminate&order=$orderid&item=$get_itemid", |
|
| 133 | - 'terminate_on' => $terminate_on |
|
| 134 | - )); |
|
| 135 | - $xoopsTpl->assign('lang_current_subscr', _MD_LANG_CURRENT_SUBSCR); |
|
| 136 | - $xoopsTpl->assign('current_subscr', $typename); |
|
| 137 | - $xoopsTpl->assign('lang_terminate_order', _MD_LANG_TERMINATE_ORDER); |
|
| 138 | - $xoopsTpl->assign('lang_terminate_order_alt', _MD_LANG_TERMINATE_ORDER_ALT); |
|
| 139 | - $xoopsTpl->assign('lang_renew_subscription', _MD_LANG_RENEW_SUBSCRIPTION); |
|
| 140 | - $xoopsTpl->assign('lang_renew_subscription_alt', _MD_LANG_RENEW_SUBSCRIPTION_ALT); |
|
| 141 | - //$xoopsTpl->assign('renewal_url', "subscriptions.php?op=renew"); |
|
| 98 | + if ($paymentstatus == '') { |
|
| 99 | + $paymentstatus = _MD_LANG_INCOMPLETE; |
|
| 100 | + $terminate_on = '1'; |
|
| 101 | + } else { |
|
| 102 | + $terminate_on = null; |
|
| 103 | + $order_exists = true; |
|
| 104 | + } |
|
| 105 | + if ($orderstatus == '1') { |
|
| 106 | + $defaultstartdate = $billto; |
|
| 107 | + } |
|
| 108 | + if ($billto != '') { |
|
| 109 | + $billto = date('d-M-Y', $billto); |
|
| 110 | + } |
|
| 111 | + if ($enddate != '') { |
|
| 112 | + $enddate = date('d-M-Y', $enddate); |
|
| 113 | + } |
|
| 114 | + if ($startdate != '') { |
|
| 115 | + $startdate = date('d-M-Y', $startdate); |
|
| 116 | + } |
|
| 117 | + $xoopsTpl->assign('lang_subscr_offers_header', _MD_LANG_SUBSCR_ACTIVE_ORDERS_HEADER); |
|
| 118 | + $xoopsTpl->append('active_orders', array( |
|
| 119 | + 'orderid' => $orderid, |
|
| 120 | + 'ordername' => $ordername, |
|
| 121 | + 'offerid' => $offerid, |
|
| 122 | + 'startdate' => $startdate, |
|
| 123 | + 'enddate' => $enddate, |
|
| 124 | + 'billto' => $billto, |
|
| 125 | + 'orderstatus' => $orderstatus, |
|
| 126 | + 'itemid' => $itemid, |
|
| 127 | + 'autorenew' => $autorenew, |
|
| 128 | + 'typename' => $myts->htmlSpecialChars($typename), |
|
| 129 | + 'ref' => $ref, |
|
| 130 | + 'paymentstatus' => $paymentstatus, |
|
| 131 | + 'renewal_url' => "subscriptions.php?op=renew&order=$orderid&item=$get_itemid", |
|
| 132 | + 'terminate_url' => "subscriptions.php?op=terminate&order=$orderid&item=$get_itemid", |
|
| 133 | + 'terminate_on' => $terminate_on |
|
| 134 | + )); |
|
| 135 | + $xoopsTpl->assign('lang_current_subscr', _MD_LANG_CURRENT_SUBSCR); |
|
| 136 | + $xoopsTpl->assign('current_subscr', $typename); |
|
| 137 | + $xoopsTpl->assign('lang_terminate_order', _MD_LANG_TERMINATE_ORDER); |
|
| 138 | + $xoopsTpl->assign('lang_terminate_order_alt', _MD_LANG_TERMINATE_ORDER_ALT); |
|
| 139 | + $xoopsTpl->assign('lang_renew_subscription', _MD_LANG_RENEW_SUBSCRIPTION); |
|
| 140 | + $xoopsTpl->assign('lang_renew_subscription_alt', _MD_LANG_RENEW_SUBSCRIPTION_ALT); |
|
| 141 | + //$xoopsTpl->assign('renewal_url', "subscriptions.php?op=renew"); |
|
| 142 | 142 | |
| 143 | - $xoopsTpl->assign('lang_ordername', _MD_LANG_ORDERNAME); |
|
| 144 | - $xoopsTpl->assign('lang_startdate', _MD_LANG_STARTDATE); |
|
| 145 | - $xoopsTpl->assign('lang_billtodate', _MD_LANG_BILLTO); |
|
| 146 | - $xoopsTpl->assign('lang_enddate', _MD_LANG_ENDDATE); |
|
| 147 | - $xoopsTpl->assign('lang_paymentstatus', _MD_LANG_PAYMENTSTATUS); |
|
| 148 | - $xoopsTpl->assign('lang_actions', _MD_LANG_ACTIONS); |
|
| 149 | - $xoopsTpl->assign('moddir', $moddir); |
|
| 150 | - $listingtitle = $myts->htmlSpecialChars($title); |
|
| 151 | - } |
|
| 152 | - } else { |
|
| 153 | - $xoopsTpl->assign('lang_no_subscr_moment', _MD_LANG_NO_SUBSCR_MOMENT); |
|
| 154 | - } |
|
| 155 | - ob_start(); |
|
| 156 | - if ($order_exists) { |
|
| 157 | - $order_form_title = _MD_UPDATE_SUBSCR_FORM; |
|
| 158 | - } else { |
|
| 159 | - $order_form_title = _MD_SUBSCR_FORM; |
|
| 160 | - } |
|
| 161 | - $form = new XoopsThemeForm($order_form_title, 'subscribeform', 'subscriptions.php?item=' . $get_itemid . ''); |
|
| 162 | - $duration_arr = $subscription->durationPriceArray('1'); |
|
| 163 | - $itemtype_select = new efqFormRadio(_MD_SUBSCR_TYPE, 'typeofferid', null, '<br>'); |
|
| 164 | - $itemtype_select->addOptionArray($duration_arr); |
|
| 165 | - $form->addElement($itemtype_select, true); |
|
| 166 | - //TO DO: Add Auto Renew functionality |
|
| 167 | - //$form->addElement(new XoopsFormRadioYN(_MD_AUTORENEWYN, 'autorenewal', '1'),true); |
|
| 168 | - $form->addElement(new XoopsFormTextDateSelect(_MD_SELECT_STARTDATE, 'startdate', 15, $defaultstartdate), true); |
|
| 169 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
| 170 | - $form->addElement(new XoopsFormHidden('op', 'orderselect')); |
|
| 171 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 172 | - $form->display(); |
|
| 173 | - $orderform = ob_get_contents(); |
|
| 174 | - ob_end_clean(); |
|
| 175 | - $xoopsTpl->assign('orderform', $orderform); |
|
| 143 | + $xoopsTpl->assign('lang_ordername', _MD_LANG_ORDERNAME); |
|
| 144 | + $xoopsTpl->assign('lang_startdate', _MD_LANG_STARTDATE); |
|
| 145 | + $xoopsTpl->assign('lang_billtodate', _MD_LANG_BILLTO); |
|
| 146 | + $xoopsTpl->assign('lang_enddate', _MD_LANG_ENDDATE); |
|
| 147 | + $xoopsTpl->assign('lang_paymentstatus', _MD_LANG_PAYMENTSTATUS); |
|
| 148 | + $xoopsTpl->assign('lang_actions', _MD_LANG_ACTIONS); |
|
| 149 | + $xoopsTpl->assign('moddir', $moddir); |
|
| 150 | + $listingtitle = $myts->htmlSpecialChars($title); |
|
| 151 | + } |
|
| 152 | + } else { |
|
| 153 | + $xoopsTpl->assign('lang_no_subscr_moment', _MD_LANG_NO_SUBSCR_MOMENT); |
|
| 154 | + } |
|
| 155 | + ob_start(); |
|
| 156 | + if ($order_exists) { |
|
| 157 | + $order_form_title = _MD_UPDATE_SUBSCR_FORM; |
|
| 158 | + } else { |
|
| 159 | + $order_form_title = _MD_SUBSCR_FORM; |
|
| 160 | + } |
|
| 161 | + $form = new XoopsThemeForm($order_form_title, 'subscribeform', 'subscriptions.php?item=' . $get_itemid . ''); |
|
| 162 | + $duration_arr = $subscription->durationPriceArray('1'); |
|
| 163 | + $itemtype_select = new efqFormRadio(_MD_SUBSCR_TYPE, 'typeofferid', null, '<br>'); |
|
| 164 | + $itemtype_select->addOptionArray($duration_arr); |
|
| 165 | + $form->addElement($itemtype_select, true); |
|
| 166 | + //TO DO: Add Auto Renew functionality |
|
| 167 | + //$form->addElement(new XoopsFormRadioYN(_MD_AUTORENEWYN, 'autorenewal', '1'),true); |
|
| 168 | + $form->addElement(new XoopsFormTextDateSelect(_MD_SELECT_STARTDATE, 'startdate', 15, $defaultstartdate), true); |
|
| 169 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
| 170 | + $form->addElement(new XoopsFormHidden('op', 'orderselect')); |
|
| 171 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 172 | + $form->display(); |
|
| 173 | + $orderform = ob_get_contents(); |
|
| 174 | + ob_end_clean(); |
|
| 175 | + $xoopsTpl->assign('orderform', $orderform); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | function orderselect() |
| 179 | 179 | { |
| 180 | - //function to update subscription by creating an order or updating an order. |
|
| 181 | - global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $owner, $xoopsOption, $xoopsTpl, $subscription, $xoopsUser; |
|
| 182 | - if ($get_itemid == '0') { |
|
| 183 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 184 | - exit(); |
|
| 185 | - } |
|
| 186 | - $orderid = $subscription->createOrder($get_itemid); |
|
| 187 | - if ($orderid === false) { |
|
| 188 | - redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_SUBSCR_TYPE_NOTSELECTED); |
|
| 189 | - exit(); |
|
| 190 | - } |
|
| 191 | - if ($orderid != 0) { |
|
| 192 | - redirect_header("subscriptions.php?item=$get_itemid&op=orderpayment&orderid=$orderid", 2, _MD_SAVED); |
|
| 193 | - exit(); |
|
| 194 | - } else { |
|
| 195 | - redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_ITEM_NOT_EXIST); |
|
| 196 | - exit(); |
|
| 197 | - } |
|
| 180 | + //function to update subscription by creating an order or updating an order. |
|
| 181 | + global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $owner, $xoopsOption, $xoopsTpl, $subscription, $xoopsUser; |
|
| 182 | + if ($get_itemid == '0') { |
|
| 183 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 184 | + exit(); |
|
| 185 | + } |
|
| 186 | + $orderid = $subscription->createOrder($get_itemid); |
|
| 187 | + if ($orderid === false) { |
|
| 188 | + redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_SUBSCR_TYPE_NOTSELECTED); |
|
| 189 | + exit(); |
|
| 190 | + } |
|
| 191 | + if ($orderid != 0) { |
|
| 192 | + redirect_header("subscriptions.php?item=$get_itemid&op=orderpayment&orderid=$orderid", 2, _MD_SAVED); |
|
| 193 | + exit(); |
|
| 194 | + } else { |
|
| 195 | + redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_ITEM_NOT_EXIST); |
|
| 196 | + exit(); |
|
| 197 | + } |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | function orderpayment() |
| 201 | 201 | { |
| 202 | - global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $owner, $xoopsOption, $xoopsTpl, $subscription, $xoopsUser; |
|
| 203 | - //Default function (if listing type is normal) would be to view the possible subscriptions. |
|
| 202 | + global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $owner, $xoopsOption, $xoopsTpl, $subscription, $xoopsUser; |
|
| 203 | + //Default function (if listing type is normal) would be to view the possible subscriptions. |
|
| 204 | 204 | |
| 205 | - //Show current subscription for listing |
|
| 206 | - //If standard subscription: Show subcription offers plus link to upgrade |
|
| 207 | - if (!empty($_GET['orderid'])) { |
|
| 208 | - $get_orderid = (int)$_GET['orderid']; |
|
| 209 | - } else { |
|
| 210 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 211 | - exit(); |
|
| 212 | - } |
|
| 213 | - $sql = 'SELECT o.orderid, o.uid, o.offerid, o.typeid, o.startdate, o.billto, o.status, o.itemid, o.autorenew, f.price, f.currency FROM ' |
|
| 214 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_orders') |
|
| 215 | - . ' o, ' |
|
| 216 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_offers') |
|
| 217 | - . ' f WHERE o.offerid=f.offerid AND o.orderid=' |
|
| 218 | - . $get_orderid |
|
| 219 | - . ''; |
|
| 220 | - $order_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 221 | - $numrows = $xoopsDB->getRowsNum($order_result); |
|
| 222 | - if ($numrows > 0) { |
|
| 223 | - while (list($orderid, $uid, $offerid, $typeid, $startdate, $billto, $status, $itemid, $autorenew, $price, $currency) = $xoopsDB->fetchRow($order_result)) { |
|
| 224 | - ob_start(); |
|
| 225 | - $itemname = $subscription->getOrderItemName($offerid); |
|
| 226 | - $form = new XoopsThemeForm(_MD_ORDER_PAYMENT_FORM, 'orderpaymentform', 'process.php'); |
|
| 227 | - $form->addElement(new XoopsFormText(_MD_PAY_FIRSTNAME, 'firstname', 50, 150, '')); |
|
| 228 | - $form->addElement(new XoopsFormText(_MD_PAY_LASTNAME, 'lastname', 50, 150, '')); |
|
| 229 | - $form->addElement(new XoopsFormText(_MD_PAY_ADDRESS1, 'address1', 50, 150, '')); |
|
| 230 | - $form->addElement(new XoopsFormText(_MD_PAY_ADDRESS2, 'address2', 50, 150, '')); |
|
| 231 | - $form->addElement(new XoopsFormText(_MD_PAY_CITY, 'city', 50, 150, '')); |
|
| 232 | - $form->addElement(new XoopsFormText(_MD_PAY_STATE, 'state', 50, 150, '')); |
|
| 233 | - $form->addElement(new XoopsFormText(_MD_PAY_ZIP, 'zip', 15, 50, '')); |
|
| 234 | - $form->addElement(new XoopsFormText(_MD_PAY_EMAIL, 'email', 30, 150, '')); |
|
| 235 | - $form->addElement(new XoopsFormText(_MD_PAY_PHONE1, 'phone1', 30, 150, '')); |
|
| 236 | - $form->addElement(new XoopsFormLabel(_MD_PAY_WITH, '<img src="images/visa_mastercard.gif">')); |
|
| 237 | - $form->addElement(new XoopsFormHidden('phone2', '')); |
|
| 238 | - $form->addElement(new XoopsFormHidden('on0', '')); |
|
| 239 | - $form->addElement(new XoopsFormHidden('os0', '')); |
|
| 240 | - $form->addElement(new XoopsFormHidden('on1', '')); |
|
| 241 | - $form->addElement(new XoopsFormHidden('os1', '')); |
|
| 242 | - $form->addElement(new XoopsFormHidden('custom', $itemid)); |
|
| 205 | + //Show current subscription for listing |
|
| 206 | + //If standard subscription: Show subcription offers plus link to upgrade |
|
| 207 | + if (!empty($_GET['orderid'])) { |
|
| 208 | + $get_orderid = (int)$_GET['orderid']; |
|
| 209 | + } else { |
|
| 210 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 211 | + exit(); |
|
| 212 | + } |
|
| 213 | + $sql = 'SELECT o.orderid, o.uid, o.offerid, o.typeid, o.startdate, o.billto, o.status, o.itemid, o.autorenew, f.price, f.currency FROM ' |
|
| 214 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_orders') |
|
| 215 | + . ' o, ' |
|
| 216 | + . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_offers') |
|
| 217 | + . ' f WHERE o.offerid=f.offerid AND o.orderid=' |
|
| 218 | + . $get_orderid |
|
| 219 | + . ''; |
|
| 220 | + $order_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 221 | + $numrows = $xoopsDB->getRowsNum($order_result); |
|
| 222 | + if ($numrows > 0) { |
|
| 223 | + while (list($orderid, $uid, $offerid, $typeid, $startdate, $billto, $status, $itemid, $autorenew, $price, $currency) = $xoopsDB->fetchRow($order_result)) { |
|
| 224 | + ob_start(); |
|
| 225 | + $itemname = $subscription->getOrderItemName($offerid); |
|
| 226 | + $form = new XoopsThemeForm(_MD_ORDER_PAYMENT_FORM, 'orderpaymentform', 'process.php'); |
|
| 227 | + $form->addElement(new XoopsFormText(_MD_PAY_FIRSTNAME, 'firstname', 50, 150, '')); |
|
| 228 | + $form->addElement(new XoopsFormText(_MD_PAY_LASTNAME, 'lastname', 50, 150, '')); |
|
| 229 | + $form->addElement(new XoopsFormText(_MD_PAY_ADDRESS1, 'address1', 50, 150, '')); |
|
| 230 | + $form->addElement(new XoopsFormText(_MD_PAY_ADDRESS2, 'address2', 50, 150, '')); |
|
| 231 | + $form->addElement(new XoopsFormText(_MD_PAY_CITY, 'city', 50, 150, '')); |
|
| 232 | + $form->addElement(new XoopsFormText(_MD_PAY_STATE, 'state', 50, 150, '')); |
|
| 233 | + $form->addElement(new XoopsFormText(_MD_PAY_ZIP, 'zip', 15, 50, '')); |
|
| 234 | + $form->addElement(new XoopsFormText(_MD_PAY_EMAIL, 'email', 30, 150, '')); |
|
| 235 | + $form->addElement(new XoopsFormText(_MD_PAY_PHONE1, 'phone1', 30, 150, '')); |
|
| 236 | + $form->addElement(new XoopsFormLabel(_MD_PAY_WITH, '<img src="images/visa_mastercard.gif">')); |
|
| 237 | + $form->addElement(new XoopsFormHidden('phone2', '')); |
|
| 238 | + $form->addElement(new XoopsFormHidden('on0', '')); |
|
| 239 | + $form->addElement(new XoopsFormHidden('os0', '')); |
|
| 240 | + $form->addElement(new XoopsFormHidden('on1', '')); |
|
| 241 | + $form->addElement(new XoopsFormHidden('os1', '')); |
|
| 242 | + $form->addElement(new XoopsFormHidden('custom', $itemid)); |
|
| 243 | 243 | |
| 244 | - $form->addElement(new XoopsFormHidden('item_name', $itemname)); |
|
| 245 | - $form->addElement(new XoopsFormHidden('item_number', $orderid)); |
|
| 246 | - $form->addElement(new XoopsFormHidden('amount', $price)); |
|
| 247 | - $form->addElement(new XoopsFormHidden('quantity', 1)); |
|
| 248 | - $form->addElement(new XoopsFormHidden('shipping_amount', '0')); |
|
| 249 | - $form->addElement(new XoopsFormHidden('tax', '0')); |
|
| 244 | + $form->addElement(new XoopsFormHidden('item_name', $itemname)); |
|
| 245 | + $form->addElement(new XoopsFormHidden('item_number', $orderid)); |
|
| 246 | + $form->addElement(new XoopsFormHidden('amount', $price)); |
|
| 247 | + $form->addElement(new XoopsFormHidden('quantity', 1)); |
|
| 248 | + $form->addElement(new XoopsFormHidden('shipping_amount', '0')); |
|
| 249 | + $form->addElement(new XoopsFormHidden('tax', '0')); |
|
| 250 | 250 | |
| 251 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
| 252 | - $form->display(); |
|
| 253 | - $paymentform = ob_get_contents(); |
|
| 254 | - ob_end_clean(); |
|
| 255 | - $xoopsTpl->assign('paymentform', $paymentform); |
|
| 256 | - } |
|
| 251 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
| 252 | + $form->display(); |
|
| 253 | + $paymentform = ob_get_contents(); |
|
| 254 | + ob_end_clean(); |
|
| 255 | + $xoopsTpl->assign('paymentform', $paymentform); |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | - $xoopsTpl->assign('lang_subscribe', _MD_LANG_SUBSCRIBE); |
|
| 259 | - $xoopsTpl->assign('lang_subscr_payment', _MD_LANG_SUBSCR_PAYMENT); |
|
| 260 | - $xoopsTpl->assign('lang_subscribe', _MD_LANG_SUBSCRIBE); |
|
| 261 | - $xoopsTpl->assign('moddir', $moddir); |
|
| 262 | - } else { |
|
| 263 | - //Else this item cannot be found in the database. |
|
| 264 | - redirect_header("listing.php?itemid=$get_itemid", 2, _MD_ITEM_NOT_EXIST); |
|
| 265 | - exit(); |
|
| 266 | - } |
|
| 258 | + $xoopsTpl->assign('lang_subscribe', _MD_LANG_SUBSCRIBE); |
|
| 259 | + $xoopsTpl->assign('lang_subscr_payment', _MD_LANG_SUBSCR_PAYMENT); |
|
| 260 | + $xoopsTpl->assign('lang_subscribe', _MD_LANG_SUBSCRIBE); |
|
| 261 | + $xoopsTpl->assign('moddir', $moddir); |
|
| 262 | + } else { |
|
| 263 | + //Else this item cannot be found in the database. |
|
| 264 | + redirect_header("listing.php?itemid=$get_itemid", 2, _MD_ITEM_NOT_EXIST); |
|
| 265 | + exit(); |
|
| 266 | + } |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | function terminate() |
| 270 | 270 | { |
| 271 | - global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $editrights; |
|
| 272 | - if (!empty($_GET['order'])) { |
|
| 273 | - $get_orderid = (int)$_GET['order']; |
|
| 274 | - } else { |
|
| 275 | - redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_NOVALIDORDER); |
|
| 276 | - exit(); |
|
| 277 | - } |
|
| 278 | - if ($editrights == '1') { |
|
| 279 | - $form = new XoopsThemeForm(_MD_CONFIRM_TERMINATE_TITLE, 'terminateform', 'subscriptions.php?item=' . $get_itemid . ''); |
|
| 280 | - $form->addElement(new XoopsFormLabel(_MD_CONFIRMATION, _MD_CONFIRM_TERMINATION_TEXT)); |
|
| 281 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
| 282 | - $form->addElement(new XoopsFormHidden('op', 'terminate_confirm')); |
|
| 283 | - $form->addElement(new XoopsFormHidden('orderid', $get_orderid)); |
|
| 284 | - $form->display(); |
|
| 285 | - } else { |
|
| 286 | - redirect_header("subscriptions.php?itemid=$get_itemid", 2, _MD_NORIGHTS); |
|
| 287 | - exit(); |
|
| 288 | - } |
|
| 271 | + global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $editrights; |
|
| 272 | + if (!empty($_GET['order'])) { |
|
| 273 | + $get_orderid = (int)$_GET['order']; |
|
| 274 | + } else { |
|
| 275 | + redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_NOVALIDORDER); |
|
| 276 | + exit(); |
|
| 277 | + } |
|
| 278 | + if ($editrights == '1') { |
|
| 279 | + $form = new XoopsThemeForm(_MD_CONFIRM_TERMINATE_TITLE, 'terminateform', 'subscriptions.php?item=' . $get_itemid . ''); |
|
| 280 | + $form->addElement(new XoopsFormLabel(_MD_CONFIRMATION, _MD_CONFIRM_TERMINATION_TEXT)); |
|
| 281 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
|
| 282 | + $form->addElement(new XoopsFormHidden('op', 'terminate_confirm')); |
|
| 283 | + $form->addElement(new XoopsFormHidden('orderid', $get_orderid)); |
|
| 284 | + $form->display(); |
|
| 285 | + } else { |
|
| 286 | + redirect_header("subscriptions.php?itemid=$get_itemid", 2, _MD_NORIGHTS); |
|
| 287 | + exit(); |
|
| 288 | + } |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | function terminate_confirm() |
| 292 | 292 | { |
| 293 | - global $subscription, $get_itemid; |
|
| 294 | - if (isset($_POST['orderid'])) { |
|
| 295 | - $post_orderid = (int)$_POST['orderid']; |
|
| 296 | - if ($subscription->delete($post_orderid)) { |
|
| 297 | - redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_ORDER_DELETED); |
|
| 298 | - exit(); |
|
| 299 | - } |
|
| 300 | - } else { |
|
| 301 | - redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_NOVALIDORDER); |
|
| 302 | - exit(); |
|
| 303 | - } |
|
| 293 | + global $subscription, $get_itemid; |
|
| 294 | + if (isset($_POST['orderid'])) { |
|
| 295 | + $post_orderid = (int)$_POST['orderid']; |
|
| 296 | + if ($subscription->delete($post_orderid)) { |
|
| 297 | + redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_ORDER_DELETED); |
|
| 298 | + exit(); |
|
| 299 | + } |
|
| 300 | + } else { |
|
| 301 | + redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_NOVALIDORDER); |
|
| 302 | + exit(); |
|
| 303 | + } |
|
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | function renew() |
| 307 | 307 | { |
| 308 | - global $subscription, $get_itemid, $editrights; |
|
| 309 | - if (!empty($_GET['order'])) { |
|
| 310 | - $get_orderid = (int)$_GET['order']; |
|
| 311 | - } else { |
|
| 312 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 313 | - exit(); |
|
| 314 | - } |
|
| 315 | - if ($editrights == '1') { |
|
| 316 | - redirect_header("subscriptions.php?item=$get_itemid&op=orderpayment&orderid=$get_orderid", 2, _MD_FORWARDED_PAYMENT_PAGE); |
|
| 317 | - exit(); |
|
| 318 | - } |
|
| 308 | + global $subscription, $get_itemid, $editrights; |
|
| 309 | + if (!empty($_GET['order'])) { |
|
| 310 | + $get_orderid = (int)$_GET['order']; |
|
| 311 | + } else { |
|
| 312 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 313 | + exit(); |
|
| 314 | + } |
|
| 315 | + if ($editrights == '1') { |
|
| 316 | + redirect_header("subscriptions.php?item=$get_itemid&op=orderpayment&orderid=$get_orderid", 2, _MD_FORWARDED_PAYMENT_PAGE); |
|
| 317 | + exit(); |
|
| 318 | + } |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | switch ($op) { |
| 322 | - case 'upgrade': |
|
| 323 | - upgrade(); |
|
| 324 | - break; |
|
| 325 | - case 'orderselect': |
|
| 326 | - orderselect(); |
|
| 327 | - break; |
|
| 328 | - case 'orderpayment': |
|
| 329 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 330 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 331 | - orderpayment(); |
|
| 332 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 333 | - break; |
|
| 334 | - case 'terminate': |
|
| 335 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 336 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 337 | - terminate(); |
|
| 338 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 339 | - break; |
|
| 340 | - case 'terminate_confirm': |
|
| 341 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 342 | - terminate_confirm(); |
|
| 343 | - break; |
|
| 344 | - case 'renew': |
|
| 345 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 346 | - renew(); |
|
| 347 | - break; |
|
| 348 | - default: |
|
| 349 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 350 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 351 | - showsubscription(); |
|
| 352 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 353 | - break; |
|
| 322 | + case 'upgrade': |
|
| 323 | + upgrade(); |
|
| 324 | + break; |
|
| 325 | + case 'orderselect': |
|
| 326 | + orderselect(); |
|
| 327 | + break; |
|
| 328 | + case 'orderpayment': |
|
| 329 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 330 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 331 | + orderpayment(); |
|
| 332 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 333 | + break; |
|
| 334 | + case 'terminate': |
|
| 335 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 336 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 337 | + terminate(); |
|
| 338 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 339 | + break; |
|
| 340 | + case 'terminate_confirm': |
|
| 341 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 342 | + terminate_confirm(); |
|
| 343 | + break; |
|
| 344 | + case 'renew': |
|
| 345 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 346 | + renew(); |
|
| 347 | + break; |
|
| 348 | + default: |
|
| 349 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 350 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 351 | + showsubscription(); |
|
| 352 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 353 | + break; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -319,38 +319,38 @@ |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | switch ($op) { |
| 322 | - case 'upgrade': |
|
| 323 | - upgrade(); |
|
| 324 | - break; |
|
| 325 | - case 'orderselect': |
|
| 326 | - orderselect(); |
|
| 327 | - break; |
|
| 328 | - case 'orderpayment': |
|
| 329 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 330 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 331 | - orderpayment(); |
|
| 332 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 333 | - break; |
|
| 334 | - case 'terminate': |
|
| 335 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 336 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 337 | - terminate(); |
|
| 338 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 339 | - break; |
|
| 340 | - case 'terminate_confirm': |
|
| 341 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 342 | - terminate_confirm(); |
|
| 343 | - break; |
|
| 344 | - case 'renew': |
|
| 345 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 346 | - renew(); |
|
| 347 | - break; |
|
| 348 | - default: |
|
| 349 | - $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 350 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 351 | - showsubscription(); |
|
| 352 | - $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 353 | - break; |
|
| 322 | + case 'upgrade': |
|
| 323 | + upgrade(); |
|
| 324 | + break; |
|
| 325 | + case 'orderselect': |
|
| 326 | + orderselect(); |
|
| 327 | + break; |
|
| 328 | + case 'orderpayment': |
|
| 329 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 330 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 331 | + orderpayment(); |
|
| 332 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 333 | + break; |
|
| 334 | + case 'terminate': |
|
| 335 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 336 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 337 | + terminate(); |
|
| 338 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 339 | + break; |
|
| 340 | + case 'terminate_confirm': |
|
| 341 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 342 | + terminate_confirm(); |
|
| 343 | + break; |
|
| 344 | + case 'renew': |
|
| 345 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 346 | + renew(); |
|
| 347 | + break; |
|
| 348 | + default: |
|
| 349 | + $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
|
| 350 | + include XOOPS_ROOT_PATH . '/header.php'; |
|
| 351 | + showsubscription(); |
|
| 352 | + $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
|
| 353 | + break; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | include XOOPS_ROOT_PATH . '/footer.php'; |
@@ -18,14 +18,14 @@ 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.subscription.php'; |
|
| 28 | -require_once __DIR__ . '/class/class.formradio.php'; |
|
| 21 | +include __DIR__.'/header.php'; |
|
| 22 | +$myts = MyTextSanitizer::getInstance(); // MyTextSanitizer object |
|
| 23 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 24 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 27 | +require_once __DIR__.'/class/class.subscription.php'; |
|
| 28 | +require_once __DIR__.'/class/class.formradio.php'; |
|
| 29 | 29 | |
| 30 | 30 | $eh = new ErrorHandler; |
| 31 | 31 | $subscription = new efqSubscription(); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 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 | $get_itemid = '0'; |
| 53 | 53 | } |
@@ -76,13 +76,13 @@ discard block |
||
| 76 | 76 | //Show current subscription order for listing |
| 77 | 77 | $defaultstartdate = time(); |
| 78 | 78 | $sql = 'SELECT i.title, i.typeid, o.orderid, o.offerid, o.startdate, o.enddate, o.billto, o.status, o.itemid, o.autorenew, t.typename, p.ref, p.payment_status FROM ' |
| 79 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_itemtypes') |
|
| 79 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_itemtypes') |
|
| 80 | 80 | . ' t, ' |
| 81 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_items') |
|
| 81 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_items') |
|
| 82 | 82 | . ' i, ' |
| 83 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_orders') |
|
| 83 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_subscr_orders') |
|
| 84 | 84 | . ' o LEFT JOIN ' |
| 85 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_payments') |
|
| 85 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_subscr_payments') |
|
| 86 | 86 | . ' p ON (o.orderid=p.orderid) WHERE o.typeid = t.typeid AND o.itemid=p.ref AND o.itemid=i.itemid AND i.itemid=' |
| 87 | 87 | . $get_itemid |
| 88 | 88 | . ' ORDER BY t.typelevel ASC'; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } else { |
| 159 | 159 | $order_form_title = _MD_SUBSCR_FORM; |
| 160 | 160 | } |
| 161 | - $form = new XoopsThemeForm($order_form_title, 'subscribeform', 'subscriptions.php?item=' . $get_itemid . ''); |
|
| 161 | + $form = new XoopsThemeForm($order_form_title, 'subscribeform', 'subscriptions.php?item='.$get_itemid.''); |
|
| 162 | 162 | $duration_arr = $subscription->durationPriceArray('1'); |
| 163 | 163 | $itemtype_select = new efqFormRadio(_MD_SUBSCR_TYPE, 'typeofferid', null, '<br>'); |
| 164 | 164 | $itemtype_select->addOptionArray($duration_arr); |
@@ -205,15 +205,15 @@ discard block |
||
| 205 | 205 | //Show current subscription for listing |
| 206 | 206 | //If standard subscription: Show subcription offers plus link to upgrade |
| 207 | 207 | if (!empty($_GET['orderid'])) { |
| 208 | - $get_orderid = (int)$_GET['orderid']; |
|
| 208 | + $get_orderid = (int) $_GET['orderid']; |
|
| 209 | 209 | } else { |
| 210 | 210 | redirect_header('index.php', 2, _MD_NOVALIDITEM); |
| 211 | 211 | exit(); |
| 212 | 212 | } |
| 213 | - $sql = 'SELECT o.orderid, o.uid, o.offerid, o.typeid, o.startdate, o.billto, o.status, o.itemid, o.autorenew, f.price, f.currency FROM ' |
|
| 214 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_orders') |
|
| 213 | + $sql = 'SELECT o.orderid, o.uid, o.offerid, o.typeid, o.startdate, o.billto, o.status, o.itemid, o.autorenew, f.price, f.currency FROM ' |
|
| 214 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_subscr_orders') |
|
| 215 | 215 | . ' o, ' |
| 216 | - . $xoopsDB->prefix($module->getVar('dirname', 'n') . '_subscr_offers') |
|
| 216 | + . $xoopsDB->prefix($module->getVar('dirname', 'n').'_subscr_offers') |
|
| 217 | 217 | . ' f WHERE o.offerid=f.offerid AND o.orderid=' |
| 218 | 218 | . $get_orderid |
| 219 | 219 | . ''; |
@@ -270,13 +270,13 @@ discard block |
||
| 270 | 270 | { |
| 271 | 271 | global $xoopsDB, $eh, $myts, $moddir, $get_itemid, $editrights; |
| 272 | 272 | if (!empty($_GET['order'])) { |
| 273 | - $get_orderid = (int)$_GET['order']; |
|
| 273 | + $get_orderid = (int) $_GET['order']; |
|
| 274 | 274 | } else { |
| 275 | 275 | redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_NOVALIDORDER); |
| 276 | 276 | exit(); |
| 277 | 277 | } |
| 278 | 278 | if ($editrights == '1') { |
| 279 | - $form = new XoopsThemeForm(_MD_CONFIRM_TERMINATE_TITLE, 'terminateform', 'subscriptions.php?item=' . $get_itemid . ''); |
|
| 279 | + $form = new XoopsThemeForm(_MD_CONFIRM_TERMINATE_TITLE, 'terminateform', 'subscriptions.php?item='.$get_itemid.''); |
|
| 280 | 280 | $form->addElement(new XoopsFormLabel(_MD_CONFIRMATION, _MD_CONFIRM_TERMINATION_TEXT)); |
| 281 | 281 | $form->addElement(new XoopsFormButton('', 'submit', _MD_CONTINUE, 'submit')); |
| 282 | 282 | $form->addElement(new XoopsFormHidden('op', 'terminate_confirm')); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | { |
| 293 | 293 | global $subscription, $get_itemid; |
| 294 | 294 | if (isset($_POST['orderid'])) { |
| 295 | - $post_orderid = (int)$_POST['orderid']; |
|
| 295 | + $post_orderid = (int) $_POST['orderid']; |
|
| 296 | 296 | if ($subscription->delete($post_orderid)) { |
| 297 | 297 | redirect_header("subscriptions.php?item=$get_itemid", 2, _MD_ORDER_DELETED); |
| 298 | 298 | exit(); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | { |
| 308 | 308 | global $subscription, $get_itemid, $editrights; |
| 309 | 309 | if (!empty($_GET['order'])) { |
| 310 | - $get_orderid = (int)$_GET['order']; |
|
| 310 | + $get_orderid = (int) $_GET['order']; |
|
| 311 | 311 | } else { |
| 312 | 312 | redirect_header('index.php', 2, _MD_NOVALIDITEM); |
| 313 | 313 | exit(); |
@@ -327,30 +327,30 @@ discard block |
||
| 327 | 327 | break; |
| 328 | 328 | case 'orderpayment': |
| 329 | 329 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
| 330 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 330 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 331 | 331 | orderpayment(); |
| 332 | 332 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 333 | 333 | break; |
| 334 | 334 | case 'terminate': |
| 335 | 335 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
| 336 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 336 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 337 | 337 | terminate(); |
| 338 | 338 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 339 | 339 | break; |
| 340 | 340 | case 'terminate_confirm': |
| 341 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 341 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 342 | 342 | terminate_confirm(); |
| 343 | 343 | break; |
| 344 | 344 | case 'renew': |
| 345 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 345 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 346 | 346 | renew(); |
| 347 | 347 | break; |
| 348 | 348 | default: |
| 349 | 349 | $GLOBALS['xoopsOption']['template_main'] = 'efqdiralpha1_subscriptions.tpl'; |
| 350 | - include XOOPS_ROOT_PATH . '/header.php'; |
|
| 350 | + include XOOPS_ROOT_PATH.'/header.php'; |
|
| 351 | 351 | showsubscription(); |
| 352 | 352 | $xoopsTpl->assign('xoops_module_header', $xoops_module_header); |
| 353 | 353 | break; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | -include XOOPS_ROOT_PATH . '/footer.php'; |
|
| 356 | +include XOOPS_ROOT_PATH.'/footer.php'; |
|
@@ -339,8 +339,8 @@ |
||
| 339 | 339 | define('_MD_NOACTIVECATEGORIES', 'There are not any selectable categories in this directory.'); |
| 340 | 340 | |
| 341 | 341 | //Frontside index |
| 342 | -define('_MD_INTERESTING_LISTING', 'Interesting listing at %s'); // %s is your site name |
|
| 343 | -define('_MD_INTERESTING_LISTING_FOUND', 'Here is an interesting listing I have found at %s'); // %s is your site name |
|
| 342 | +define('_MD_INTERESTING_LISTING', 'Interesting listing at %s'); // %s is your site name |
|
| 343 | +define('_MD_INTERESTING_LISTING_FOUND', 'Here is an interesting listing I have found at %s'); // %s is your site name |
|
| 344 | 344 | define('_MD_NOACTIVEDIRECTORIES', 'There are no directories active at this moment.'); |
| 345 | 345 | define('_MD_DIRECTORIES_HEADER', 'Directories'); |
| 346 | 346 | define('_MD_LISTINGS', 'Listings'); |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | |
| 127 | 127 | //Help |
| 128 | 128 | define('_MI_EFQDIR_DIRNAME', basename(dirname(dirname(__DIR__)))); |
| 129 | -define('_MI_EFQDIR_HELP_HEADER', __DIR__ . '/help/helpheader.html'); |
|
| 129 | +define('_MI_EFQDIR_HELP_HEADER', __DIR__.'/help/helpheader.html'); |
|
| 130 | 130 | define('_MI_EFQDIR_BACK_2_ADMIN', 'Back to Administration of '); |
| 131 | 131 | define('_MI_EFQDIR_OVERVIEW', 'Overview'); |
| 132 | 132 | |