@@ -43,546 +43,546 @@ |
||
| 43 | 43 | $moddir = $xoopsModule->getVar('dirname'); |
| 44 | 44 | |
| 45 | 45 | if (isset($_GET['item'])) { |
| 46 | - $get_itemid = (int)$_GET['item']; |
|
| 46 | + $get_itemid = (int)$_GET['item']; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function listings() |
| 50 | 50 | { |
| 51 | - global $xoopsDB, $xoopsModule; |
|
| 52 | - xoops_cp_header(); |
|
| 53 | - //adminmenu(0, _MD_A_MODADMIN_HOME); |
|
| 54 | - echo '<h4>' . _MD_LISTINGSCONF . '</h4>'; |
|
| 55 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . '<tr class="odd"><td>'; |
|
| 56 | - //$result = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("efqdiralpha1_broken").""); |
|
| 57 | - //list($totalbrokenlinks) = $xoopsDB->fetchRow($result); |
|
| 58 | - $result3 = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " WHERE status='1'"); |
|
| 59 | - list($totalnewlistings) = $xoopsDB->fetchRow($result3); |
|
| 60 | - if ($totalnewlistings > 0) { |
|
| 61 | - $totalnewlistings = "<span style='color: #ff0000; font-weight: bold'>$totalnewlistings</span>"; |
|
| 62 | - } |
|
| 63 | - // echo " - <a href='".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid')."'>"._MD_GENERALSET."</a>"; |
|
| 64 | - // echo "<br><br>"; |
|
| 65 | - // echo " - <a href=directories.php>"._MD_MANAGEDIRECTORIES."</a>"; |
|
| 66 | - // echo "<br><br>"; |
|
| 67 | - // echo " - <a href=fieldtypes.php>"._MD_MANAGEFIELDTYPES."</a>"; |
|
| 68 | - // echo "<br><br>"; |
|
| 69 | - // echo " - <a href=main.php?op=listNewListings>"._MD_LISTINGSWAITING." ($totalnewlistings)</a>"; |
|
| 70 | - // echo "<br><br>"; |
|
| 71 | - // echo " - <a href=main.php?op=duplicateDataTypes>"._MD_DUPLICATE_DATATYPES."</a>"; |
|
| 72 | - // echo "<br><br>"; |
|
| 73 | - $result = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . ' WHERE status>0'); |
|
| 74 | - list($numrows) = $xoopsDB->fetchRow($result); |
|
| 75 | - echo '<br /<div>'; |
|
| 76 | - printf(_MD_THEREARE, $numrows); |
|
| 77 | - echo '</div>'; |
|
| 78 | - echo '</td></tr></table>'; |
|
| 79 | - xoops_cp_footer(); |
|
| 51 | + global $xoopsDB, $xoopsModule; |
|
| 52 | + xoops_cp_header(); |
|
| 53 | + //adminmenu(0, _MD_A_MODADMIN_HOME); |
|
| 54 | + echo '<h4>' . _MD_LISTINGSCONF . '</h4>'; |
|
| 55 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . '<tr class="odd"><td>'; |
|
| 56 | + //$result = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("efqdiralpha1_broken").""); |
|
| 57 | + //list($totalbrokenlinks) = $xoopsDB->fetchRow($result); |
|
| 58 | + $result3 = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " WHERE status='1'"); |
|
| 59 | + list($totalnewlistings) = $xoopsDB->fetchRow($result3); |
|
| 60 | + if ($totalnewlistings > 0) { |
|
| 61 | + $totalnewlistings = "<span style='color: #ff0000; font-weight: bold'>$totalnewlistings</span>"; |
|
| 62 | + } |
|
| 63 | + // echo " - <a href='".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=".$xoopsModule->getVar('mid')."'>"._MD_GENERALSET."</a>"; |
|
| 64 | + // echo "<br><br>"; |
|
| 65 | + // echo " - <a href=directories.php>"._MD_MANAGEDIRECTORIES."</a>"; |
|
| 66 | + // echo "<br><br>"; |
|
| 67 | + // echo " - <a href=fieldtypes.php>"._MD_MANAGEFIELDTYPES."</a>"; |
|
| 68 | + // echo "<br><br>"; |
|
| 69 | + // echo " - <a href=main.php?op=listNewListings>"._MD_LISTINGSWAITING." ($totalnewlistings)</a>"; |
|
| 70 | + // echo "<br><br>"; |
|
| 71 | + // echo " - <a href=main.php?op=duplicateDataTypes>"._MD_DUPLICATE_DATATYPES."</a>"; |
|
| 72 | + // echo "<br><br>"; |
|
| 73 | + $result = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . ' WHERE status>0'); |
|
| 74 | + list($numrows) = $xoopsDB->fetchRow($result); |
|
| 75 | + echo '<br /<div>'; |
|
| 76 | + printf(_MD_THEREARE, $numrows); |
|
| 77 | + echo '</div>'; |
|
| 78 | + echo '</td></tr></table>'; |
|
| 79 | + xoops_cp_footer(); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | function listNewListings() //completed |
| 83 | 83 | { |
| 84 | - global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $eh, $mytree, $mytree2, $moddir; |
|
| 85 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " i WHERE i.status='1'"; |
|
| 86 | - $result = $xoopsDB->query($sql, 10, 0); |
|
| 87 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 88 | - if ($numrows > 0) { |
|
| 89 | - xoops_cp_header(); |
|
| 90 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 91 | - $adminObject->displayNavigation('main.php?op=listNewListings'); |
|
| 92 | - |
|
| 93 | - echo '<h4>' . _MD_LISTINGSCONF . '</h4>'; |
|
| 94 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 95 | - echo '<tr class="odd"><td>'; |
|
| 96 | - echo '<h4>' . _MD_LISTINGSWAITING . " ($numrows)</h4><br>"; |
|
| 97 | - echo '<table width="95%">'; |
|
| 98 | - echo '<tr><td align="left"nowrap><b>' . _MD_LISTINGTITLE . '</b></td>'; |
|
| 99 | - echo '<td align="left" nowrap><b>' . _MD_SUBMITTER . '</b></td><td align="left" nowrap><b>' . _MD_CREATED . '</b></td><td> </td></tr>'; |
|
| 100 | - while (list($itemid, $logourl, $submitterid, $status, $date, $title, $type) = $xoopsDB->fetchRow($result)) { |
|
| 101 | - $title = $myts->htmlSpecialChars($title); |
|
| 102 | - $submitter = XoopsUser::getUnameFromId($submitterid); |
|
| 103 | - $created = formatTimestamp($date); |
|
| 104 | - echo "<tr><td>$title</td><td><a href=\"" . XOOPS_URL . "/userinfo.php?uid=$submitterid\">$submitter</a></td><td>$created</td><td valign=\"bottom\">"; |
|
| 105 | - echo '<a href="' . XOOPS_URL . '/modules/' . $moddir . "/admin/main.php?op=edit&item=$itemid\">" . _MD_EDIT . '</a>'; |
|
| 106 | - echo "</td></tr>\n"; |
|
| 107 | - } |
|
| 108 | - echo '</table></td></tr></table>'; |
|
| 109 | - xoops_cp_footer(); |
|
| 110 | - } else { |
|
| 111 | - redirect_header('' . XOOPS_URL . '/modules/' . $moddir . '/admin/main.php?op=listings', 1, _MD_NONEW_LISTINGS); |
|
| 112 | - exit(); |
|
| 113 | - } |
|
| 84 | + global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $eh, $mytree, $mytree2, $moddir; |
|
| 85 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " i WHERE i.status='1'"; |
|
| 86 | + $result = $xoopsDB->query($sql, 10, 0); |
|
| 87 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 88 | + if ($numrows > 0) { |
|
| 89 | + xoops_cp_header(); |
|
| 90 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 91 | + $adminObject->displayNavigation('main.php?op=listNewListings'); |
|
| 92 | + |
|
| 93 | + echo '<h4>' . _MD_LISTINGSCONF . '</h4>'; |
|
| 94 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 95 | + echo '<tr class="odd"><td>'; |
|
| 96 | + echo '<h4>' . _MD_LISTINGSWAITING . " ($numrows)</h4><br>"; |
|
| 97 | + echo '<table width="95%">'; |
|
| 98 | + echo '<tr><td align="left"nowrap><b>' . _MD_LISTINGTITLE . '</b></td>'; |
|
| 99 | + echo '<td align="left" nowrap><b>' . _MD_SUBMITTER . '</b></td><td align="left" nowrap><b>' . _MD_CREATED . '</b></td><td> </td></tr>'; |
|
| 100 | + while (list($itemid, $logourl, $submitterid, $status, $date, $title, $type) = $xoopsDB->fetchRow($result)) { |
|
| 101 | + $title = $myts->htmlSpecialChars($title); |
|
| 102 | + $submitter = XoopsUser::getUnameFromId($submitterid); |
|
| 103 | + $created = formatTimestamp($date); |
|
| 104 | + echo "<tr><td>$title</td><td><a href=\"" . XOOPS_URL . "/userinfo.php?uid=$submitterid\">$submitter</a></td><td>$created</td><td valign=\"bottom\">"; |
|
| 105 | + echo '<a href="' . XOOPS_URL . '/modules/' . $moddir . "/admin/main.php?op=edit&item=$itemid\">" . _MD_EDIT . '</a>'; |
|
| 106 | + echo "</td></tr>\n"; |
|
| 107 | + } |
|
| 108 | + echo '</table></td></tr></table>'; |
|
| 109 | + xoops_cp_footer(); |
|
| 110 | + } else { |
|
| 111 | + redirect_header('' . XOOPS_URL . '/modules/' . $moddir . '/admin/main.php?op=listings', 1, _MD_NONEW_LISTINGS); |
|
| 112 | + exit(); |
|
| 113 | + } |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | function delVote() |
| 117 | 117 | { |
| 118 | - global $xoopsDB, $_GET, $eh; |
|
| 119 | - $rid = $_GET['rid']; |
|
| 120 | - $get_itemid = (int)$_GET['itemid']; |
|
| 121 | - $sql = sprintf('DELETE FROM %s WHERE ratingid = %u', $xoopsDB->prefix('listings_votedata'), $rid); |
|
| 122 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 123 | - updaterating($get_itemid); |
|
| 124 | - redirect_header('index.php', 1, _MD_VOTEDELETED); |
|
| 125 | - exit(); |
|
| 118 | + global $xoopsDB, $_GET, $eh; |
|
| 119 | + $rid = $_GET['rid']; |
|
| 120 | + $get_itemid = (int)$_GET['itemid']; |
|
| 121 | + $sql = sprintf('DELETE FROM %s WHERE ratingid = %u', $xoopsDB->prefix('listings_votedata'), $rid); |
|
| 122 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 123 | + updaterating($get_itemid); |
|
| 124 | + redirect_header('index.php', 1, _MD_VOTEDELETED); |
|
| 125 | + exit(); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | function delListingConfirm() |
| 129 | 129 | { |
| 130 | - global $xoopsDB, $eh, $xoopsModule, $get_itemid; |
|
| 131 | - xoops_cp_header(); |
|
| 132 | - $form = new XoopsThemeForm(_MD_CONFIRM_DELETELISTING_FORM, 'confirmform', 'main.php'); |
|
| 133 | - $submit_tray = new XoopsFormElementTray(_MD_DELETEYN, '', 'cid'); |
|
| 134 | - $submit_tray->addElement(new XoopsFormButton('', 'submit', _MD_DELETE, 'submit')); |
|
| 135 | - $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="' . _MD_CANCEL . "\" onclick=\"location='main.php?op=edit&item=$get_itemid'\"")); |
|
| 136 | - $form->addElement($submit_tray, true); |
|
| 137 | - //$form->addElement($form_submit); |
|
| 138 | - $form->addElement(new XoopsFormHidden('op', 'deleteListing')); |
|
| 139 | - $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 140 | - $form->display(); |
|
| 141 | - xoops_cp_footer(); |
|
| 130 | + global $xoopsDB, $eh, $xoopsModule, $get_itemid; |
|
| 131 | + xoops_cp_header(); |
|
| 132 | + $form = new XoopsThemeForm(_MD_CONFIRM_DELETELISTING_FORM, 'confirmform', 'main.php'); |
|
| 133 | + $submit_tray = new XoopsFormElementTray(_MD_DELETEYN, '', 'cid'); |
|
| 134 | + $submit_tray->addElement(new XoopsFormButton('', 'submit', _MD_DELETE, 'submit')); |
|
| 135 | + $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="' . _MD_CANCEL . "\" onclick=\"location='main.php?op=edit&item=$get_itemid'\"")); |
|
| 136 | + $form->addElement($submit_tray, true); |
|
| 137 | + //$form->addElement($form_submit); |
|
| 138 | + $form->addElement(new XoopsFormHidden('op', 'deleteListing')); |
|
| 139 | + $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 140 | + $form->display(); |
|
| 141 | + xoops_cp_footer(); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | function delListing() |
| 145 | 145 | { |
| 146 | - global $xoopsDB, $eh, $xoopsModule; |
|
| 147 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 148 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 149 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 150 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 151 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_img'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 152 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 153 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 154 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 155 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_loc'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 156 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 157 | - xoops_comment_delete($xoopsModule->getVar('mid'), (int)$_POST['itemid']); |
|
| 158 | - xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'listing', (int)$_POST['itemid']); |
|
| 159 | - redirect_header('index.php', 1, _MD_LISTINGDELETED); |
|
| 160 | - exit(); |
|
| 146 | + global $xoopsDB, $eh, $xoopsModule; |
|
| 147 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 148 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 149 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 150 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 151 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_img'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 152 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 153 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 154 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 155 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_loc'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 156 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 157 | + xoops_comment_delete($xoopsModule->getVar('mid'), (int)$_POST['itemid']); |
|
| 158 | + xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'listing', (int)$_POST['itemid']); |
|
| 159 | + redirect_header('index.php', 1, _MD_LISTINGDELETED); |
|
| 160 | + exit(); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | function approve() |
| 164 | 164 | { |
| 165 | - global $xoopsConfig, $xoopsDB, $get_itemid, $eh; |
|
| 166 | - $query = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " set status='2' where itemid=" . $get_itemid . ''; |
|
| 167 | - $xoopsDB->queryF($query) or $eh->show('0013'); |
|
| 168 | - redirect_header('main.php?op=listNewListings', 1, _MD_LISTINGAPPROVED); |
|
| 165 | + global $xoopsConfig, $xoopsDB, $get_itemid, $eh; |
|
| 166 | + $query = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " set status='2' where itemid=" . $get_itemid . ''; |
|
| 167 | + $xoopsDB->queryF($query) or $eh->show('0013'); |
|
| 168 | + redirect_header('main.php?op=listNewListings', 1, _MD_LISTINGAPPROVED); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | function updateItemType() |
| 172 | 172 | { |
| 173 | - global $xoopsConfig, $xoopsDB, $eh; |
|
| 174 | - $post_itemid = (int)$_POST['itemid']; |
|
| 175 | - $post_typeid = (int)$_POST['typeid']; |
|
| 176 | - $query = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET typeid='$post_typeid' WHERE itemid=" . $post_itemid . ''; |
|
| 177 | - $xoopsDB->query($query) or $eh->show('0013'); |
|
| 178 | - redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
|
| 173 | + global $xoopsConfig, $xoopsDB, $eh; |
|
| 174 | + $post_itemid = (int)$_POST['itemid']; |
|
| 175 | + $post_typeid = (int)$_POST['typeid']; |
|
| 176 | + $query = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET typeid='$post_typeid' WHERE itemid=" . $post_itemid . ''; |
|
| 177 | + $xoopsDB->query($query) or $eh->show('0013'); |
|
| 178 | + redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | function listDuplicateDataTypes() |
| 182 | 182 | { |
| 183 | - global $xoopsConfig, $xoopsDB, $eh, $myts, $moddir, $xoopsModule; |
|
| 184 | - |
|
| 185 | - xoops_cp_header(); |
|
| 186 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 187 | - $adminObject->displayNavigation('main.php?op=duplicateDataTypes'); |
|
| 188 | - //adminmenu(-1, _MD_DUPLICATE_DATATYPES); |
|
| 189 | - echo '<br>'; |
|
| 190 | - $sql = 'SELECT dt1.dtypeid, dt1.title, dt1.fieldtypeid '; |
|
| 191 | - $sql .= 'FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' dt1, ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' dt2 '; |
|
| 192 | - $sql .= 'WHERE dt1.title=dt2.title AND dt1.fieldtypeid=dt2.fieldtypeid ORDER BY dt1.title ASC, dt1.fieldtypeid ASC'; |
|
| 193 | - |
|
| 194 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 195 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 196 | - |
|
| 197 | - if ($numrows > 0) { |
|
| 198 | - echo '<h4>' . _MD_DUPLICATE_DATATYPES . '</h4>'; |
|
| 199 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 200 | - echo '<tr><th>' . _MD_DTYPE . '</th><th>' . _MD_DTYPE_TITLE . '</th><th>' . _MD_FIELDTYPE . '</th></tr>'; |
|
| 201 | - while (list($dtypeid, $title, $fieldtypeid) = $xoopsDB->fetchRow($result)) { |
|
| 202 | - $dtypetitle = $myts->htmlSpecialChars($title); |
|
| 203 | - $result_arr[] = $dtypeid . $dtypetitle . $fieldtypeid; |
|
| 204 | - $result_array[] = array($dtypeid, $dtypetitle, $fieldtypeid); |
|
| 205 | - } |
|
| 206 | - $checkKeysUniqueComparison = create_function('$value', 'if ($value > 1) return true;'); |
|
| 207 | - $duplicate_results = array_keys(array_filter(array_count_values($result_arr), $checkKeysUniqueComparison)); |
|
| 208 | - |
|
| 209 | - if (count($duplicate_results) > 0) { |
|
| 210 | - $duplicates = '1'; |
|
| 211 | - } else { |
|
| 212 | - $duplicates = '0'; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $last_title = ''; |
|
| 216 | - $last_fieldtypeid = '0'; |
|
| 217 | - $merge = ''; |
|
| 218 | - foreach ($result_array as $arr) { |
|
| 219 | - $id = $arr[0]; |
|
| 220 | - $match[$id] = $arr[0] . $arr[1] . $arr[2]; |
|
| 221 | - $test = array_pop($match); |
|
| 222 | - $key_to_be_deleted = array_search($test, $duplicate_results); |
|
| 223 | - |
|
| 224 | - if (in_array($test, $duplicate_results)) { |
|
| 225 | - echo '<tr>'; |
|
| 226 | - echo "<td class=\"even\">$arr[0]</td>"; |
|
| 227 | - echo "<td class=\"odd\">$arr[1]</td>"; |
|
| 228 | - echo "<td class=\"even\">$arr[2]</td>"; |
|
| 229 | - echo '</tr>'; |
|
| 230 | - if ($last_title == '' && $last_fieldtypeid == '0') { |
|
| 231 | - $last_title = $arr[1]; |
|
| 232 | - $last_fieldtypeid = $arr[2]; |
|
| 233 | - $merge .= $arr[0]; |
|
| 234 | - } elseif ($arr[1] != $last_title && $arr[2] != $last_fieldtypeid) { |
|
| 235 | - $last_title = $arr[1]; |
|
| 236 | - $last_fieldtypeid = $arr[2]; |
|
| 237 | - $merge .= '|' . $arr[0]; |
|
| 238 | - echo "<tr><td colspan='3'>"; |
|
| 239 | - echo "<form action='main.php' method='post'>"; |
|
| 240 | - echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
|
| 241 | - echo "<input type='button' class='formButton' action='submit' name='submit' id='submit' value='" . _MD_MERGE . '\''; |
|
| 242 | - echo "<input type='hidden' name='merge' value='$merge'>"; |
|
| 243 | - echo "<input type='hidden' name='op' value='mergeDuplicates'>"; |
|
| 244 | - echo '</form>'; |
|
| 245 | - echo '</td></tr>'; |
|
| 246 | - $merge = ''; |
|
| 247 | - } else { |
|
| 248 | - $merge .= '|' . $arr[0]; |
|
| 249 | - } |
|
| 250 | - unset($duplicate_results[$key_to_be_deleted]); |
|
| 251 | - } |
|
| 252 | - unset($match); |
|
| 253 | - } |
|
| 254 | - if ($duplicates == '1') { |
|
| 255 | - echo "<tr><td colspan='3'>"; |
|
| 256 | - echo "<form action='main.php' method='post'>"; |
|
| 257 | - echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
|
| 258 | - echo "<input type='submit' class='formButton' action='submit' name='submit' id='submit' value='" . _MD_MERGE . '\''; |
|
| 259 | - echo "<input type='hidden' name='merge' value='$merge'>"; |
|
| 260 | - echo "<input type='hidden' name='op' value='mergeDuplicates'>"; |
|
| 261 | - echo '</form>'; |
|
| 262 | - echo '</td></tr>'; |
|
| 263 | - } else { |
|
| 264 | - echo "<tr><td colspan='3'>"; |
|
| 265 | - echo _MD_NORESULTS; |
|
| 266 | - echo '</td></tr>'; |
|
| 267 | - } |
|
| 268 | - echo '</table>'; |
|
| 269 | - } |
|
| 270 | - xoops_cp_footer(); |
|
| 183 | + global $xoopsConfig, $xoopsDB, $eh, $myts, $moddir, $xoopsModule; |
|
| 184 | + |
|
| 185 | + xoops_cp_header(); |
|
| 186 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 187 | + $adminObject->displayNavigation('main.php?op=duplicateDataTypes'); |
|
| 188 | + //adminmenu(-1, _MD_DUPLICATE_DATATYPES); |
|
| 189 | + echo '<br>'; |
|
| 190 | + $sql = 'SELECT dt1.dtypeid, dt1.title, dt1.fieldtypeid '; |
|
| 191 | + $sql .= 'FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' dt1, ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' dt2 '; |
|
| 192 | + $sql .= 'WHERE dt1.title=dt2.title AND dt1.fieldtypeid=dt2.fieldtypeid ORDER BY dt1.title ASC, dt1.fieldtypeid ASC'; |
|
| 193 | + |
|
| 194 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 195 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 196 | + |
|
| 197 | + if ($numrows > 0) { |
|
| 198 | + echo '<h4>' . _MD_DUPLICATE_DATATYPES . '</h4>'; |
|
| 199 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 200 | + echo '<tr><th>' . _MD_DTYPE . '</th><th>' . _MD_DTYPE_TITLE . '</th><th>' . _MD_FIELDTYPE . '</th></tr>'; |
|
| 201 | + while (list($dtypeid, $title, $fieldtypeid) = $xoopsDB->fetchRow($result)) { |
|
| 202 | + $dtypetitle = $myts->htmlSpecialChars($title); |
|
| 203 | + $result_arr[] = $dtypeid . $dtypetitle . $fieldtypeid; |
|
| 204 | + $result_array[] = array($dtypeid, $dtypetitle, $fieldtypeid); |
|
| 205 | + } |
|
| 206 | + $checkKeysUniqueComparison = create_function('$value', 'if ($value > 1) return true;'); |
|
| 207 | + $duplicate_results = array_keys(array_filter(array_count_values($result_arr), $checkKeysUniqueComparison)); |
|
| 208 | + |
|
| 209 | + if (count($duplicate_results) > 0) { |
|
| 210 | + $duplicates = '1'; |
|
| 211 | + } else { |
|
| 212 | + $duplicates = '0'; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $last_title = ''; |
|
| 216 | + $last_fieldtypeid = '0'; |
|
| 217 | + $merge = ''; |
|
| 218 | + foreach ($result_array as $arr) { |
|
| 219 | + $id = $arr[0]; |
|
| 220 | + $match[$id] = $arr[0] . $arr[1] . $arr[2]; |
|
| 221 | + $test = array_pop($match); |
|
| 222 | + $key_to_be_deleted = array_search($test, $duplicate_results); |
|
| 223 | + |
|
| 224 | + if (in_array($test, $duplicate_results)) { |
|
| 225 | + echo '<tr>'; |
|
| 226 | + echo "<td class=\"even\">$arr[0]</td>"; |
|
| 227 | + echo "<td class=\"odd\">$arr[1]</td>"; |
|
| 228 | + echo "<td class=\"even\">$arr[2]</td>"; |
|
| 229 | + echo '</tr>'; |
|
| 230 | + if ($last_title == '' && $last_fieldtypeid == '0') { |
|
| 231 | + $last_title = $arr[1]; |
|
| 232 | + $last_fieldtypeid = $arr[2]; |
|
| 233 | + $merge .= $arr[0]; |
|
| 234 | + } elseif ($arr[1] != $last_title && $arr[2] != $last_fieldtypeid) { |
|
| 235 | + $last_title = $arr[1]; |
|
| 236 | + $last_fieldtypeid = $arr[2]; |
|
| 237 | + $merge .= '|' . $arr[0]; |
|
| 238 | + echo "<tr><td colspan='3'>"; |
|
| 239 | + echo "<form action='main.php' method='post'>"; |
|
| 240 | + echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
|
| 241 | + echo "<input type='button' class='formButton' action='submit' name='submit' id='submit' value='" . _MD_MERGE . '\''; |
|
| 242 | + echo "<input type='hidden' name='merge' value='$merge'>"; |
|
| 243 | + echo "<input type='hidden' name='op' value='mergeDuplicates'>"; |
|
| 244 | + echo '</form>'; |
|
| 245 | + echo '</td></tr>'; |
|
| 246 | + $merge = ''; |
|
| 247 | + } else { |
|
| 248 | + $merge .= '|' . $arr[0]; |
|
| 249 | + } |
|
| 250 | + unset($duplicate_results[$key_to_be_deleted]); |
|
| 251 | + } |
|
| 252 | + unset($match); |
|
| 253 | + } |
|
| 254 | + if ($duplicates == '1') { |
|
| 255 | + echo "<tr><td colspan='3'>"; |
|
| 256 | + echo "<form action='main.php' method='post'>"; |
|
| 257 | + echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
|
| 258 | + echo "<input type='submit' class='formButton' action='submit' name='submit' id='submit' value='" . _MD_MERGE . '\''; |
|
| 259 | + echo "<input type='hidden' name='merge' value='$merge'>"; |
|
| 260 | + echo "<input type='hidden' name='op' value='mergeDuplicates'>"; |
|
| 261 | + echo '</form>'; |
|
| 262 | + echo '</td></tr>'; |
|
| 263 | + } else { |
|
| 264 | + echo "<tr><td colspan='3'>"; |
|
| 265 | + echo _MD_NORESULTS; |
|
| 266 | + echo '</td></tr>'; |
|
| 267 | + } |
|
| 268 | + echo '</table>'; |
|
| 269 | + } |
|
| 270 | + xoops_cp_footer(); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | function mergeDuplicates() |
| 274 | 274 | { |
| 275 | - global $xoopsDB, $eh; |
|
| 276 | - if (isset($_POST['merge'])) { |
|
| 277 | - $merge = $_POST['merge']; |
|
| 278 | - $merge_arr = explode('[|]', $merge); |
|
| 279 | - $replacements_arr = array_slice($merge_arr, 1); |
|
| 280 | - $replacements = ''; |
|
| 281 | - foreach ($replacements_arr as $key => $value) { |
|
| 282 | - $replacements .= '\'' . $value . '\','; |
|
| 283 | - } |
|
| 284 | - $length = strlen($replacements); |
|
| 285 | - $replacements = substr($replacements, 0, $length - 1); |
|
| 286 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') . ' SET dtypeid=' . $merge_arr[0] . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 287 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 288 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' SET dtypeid=' . $merge_arr[0] . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 289 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 290 | - $sql = 'DELETE FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 291 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 292 | - } else { |
|
| 293 | - $merge = ''; |
|
| 294 | - } |
|
| 295 | - redirect_header('main.php?op=duplicateDataTypes', 2, _MD_SAVED); |
|
| 275 | + global $xoopsDB, $eh; |
|
| 276 | + if (isset($_POST['merge'])) { |
|
| 277 | + $merge = $_POST['merge']; |
|
| 278 | + $merge_arr = explode('[|]', $merge); |
|
| 279 | + $replacements_arr = array_slice($merge_arr, 1); |
|
| 280 | + $replacements = ''; |
|
| 281 | + foreach ($replacements_arr as $key => $value) { |
|
| 282 | + $replacements .= '\'' . $value . '\','; |
|
| 283 | + } |
|
| 284 | + $length = strlen($replacements); |
|
| 285 | + $replacements = substr($replacements, 0, $length - 1); |
|
| 286 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') . ' SET dtypeid=' . $merge_arr[0] . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 287 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 288 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' SET dtypeid=' . $merge_arr[0] . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 289 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 290 | + $sql = 'DELETE FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 291 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 292 | + } else { |
|
| 293 | + $merge = ''; |
|
| 294 | + } |
|
| 295 | + redirect_header('main.php?op=duplicateDataTypes', 2, _MD_SAVED); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if (!isset($_POST['op'])) { |
| 299 | - $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
|
| 299 | + $op = isset($_GET['op']) ? $_GET['op'] : 'main'; |
|
| 300 | 300 | } else { |
| 301 | - $op = $_POST['op']; |
|
| 301 | + $op = $_POST['op']; |
|
| 302 | 302 | } |
| 303 | 303 | switch ($op) { |
| 304 | - case 'approve': |
|
| 305 | - approve(); |
|
| 306 | - break; |
|
| 307 | - case 'deleteListingConfirm': |
|
| 308 | - delListingConfirm(); |
|
| 309 | - break; |
|
| 310 | - case 'deleteListing': |
|
| 311 | - delListing(); |
|
| 312 | - break; |
|
| 313 | - case 'delVote': |
|
| 314 | - delVote(); |
|
| 315 | - break; |
|
| 316 | - case 'listNewListings': |
|
| 317 | - listNewListings(); |
|
| 318 | - break; |
|
| 319 | - case 'updateItemType': |
|
| 320 | - updateItemType(); |
|
| 321 | - break; |
|
| 322 | - case 'duplicateDataTypes': |
|
| 323 | - listDuplicateDataTypes(); |
|
| 324 | - break; |
|
| 325 | - case 'mergeDuplicates': |
|
| 326 | - mergeDuplicates(); |
|
| 327 | - break; |
|
| 328 | - case 'edit': |
|
| 329 | - global $xoopsDB, $xoopsConfig, $myts, $eh, $efqtree, $moddir, $xoopsUser, $datafieldmanager, $subscription, $subscriptionhandler; |
|
| 330 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid, t.description FROM ' |
|
| 331 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') |
|
| 332 | - . ' i LEFT JOIN ' |
|
| 333 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') |
|
| 334 | - . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' |
|
| 335 | - . $get_itemid |
|
| 336 | - . ''; |
|
| 337 | - $item_result = $xoopsDB->query($sql); |
|
| 338 | - $numrows = $xoopsDB->getRowsNum($item_result); |
|
| 339 | - xoops_cp_header(); |
|
| 340 | - //adminmenu(-1, _MD_A_MODADMIN_HOME); |
|
| 341 | - echo "<hr size='1'><br>"; |
|
| 342 | - while (list($itemid, $logourl, $submitter, $status, $created, $itemtitle, $typeid, $description) = $xoopsDB->fetchRow($item_result)) { |
|
| 343 | - if ($status == '1') { |
|
| 344 | - echo '<input type="button" value="' . _MD_APPROVE . "\" onclick=\"location='main.php?op=approve&item=$get_itemid'\"> "; |
|
| 345 | - } |
|
| 346 | - echo ' <input type="button" value="' |
|
| 347 | - . _MD_DELETE |
|
| 348 | - . "\" onClick=\"location='main.php?op=deleteListingConfirm&item=$get_itemid'\"> <input type=\"button\" value=\"" |
|
| 349 | - . _MD_VIEWITEM |
|
| 350 | - . "\" onclick=\"location='" |
|
| 351 | - . XOOPS_URL |
|
| 352 | - . '/modules/' |
|
| 353 | - . $moddir |
|
| 354 | - . "/listing.php?item=$get_itemid'\"><br><br>"; |
|
| 355 | - |
|
| 356 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value, d.customtitle, t.custom '; |
|
| 357 | - $sql .= 'FROM ' |
|
| 358 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 359 | - . ' ic, ' |
|
| 360 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 361 | - . ' xc, ' |
|
| 362 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 363 | - . ' f, ' |
|
| 364 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 365 | - . ' t '; |
|
| 366 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $get_itemid . ') '; |
|
| 367 | - $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=" . $get_itemid . ''; |
|
| 368 | - $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 369 | - $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 370 | - |
|
| 371 | - $form = new XoopsThemeForm(_MD_EDITITEM_FORM, 'editform', 'main.php'); |
|
| 372 | - $form->addElement(new XoopsFormText(_MD_TITLE, 'itemtitle', 50, 250, $itemtitle), true); |
|
| 373 | - //$categories = getCategoriesPaths($get_itemid); |
|
| 374 | - $get_dirid = getDirIdFromItem($itemid); |
|
| 375 | - $categories = getCatSelectArea($itemid, $get_dirid); |
|
| 376 | - $form_cats = new XoopsFormLabel(_MD_ITEMCATEGORIES, "$categories"); |
|
| 377 | - $form->addElement($form_cats); |
|
| 378 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'description', $description, 5, 50)); |
|
| 379 | - while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value, $customtitle, $custom) = $xoopsDB->fetchRow($data_result)) { |
|
| 380 | - $field = $datafieldmanager->createField($title, $dtypeid, $fieldtype, $ext, $options, $value, $custom, $customtitle); |
|
| 381 | - } |
|
| 382 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 383 | - $form->addElement(new XoopsFormHidden('op', 'save')); |
|
| 384 | - $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 385 | - $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 386 | - $form->addElement(new XoopsFormHidden('ini_itemtitle', $itemtitle)); |
|
| 387 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 388 | - if ($description === false) { |
|
| 389 | - $form->addElement(new XoopsFormHidden('description_set', '0')); |
|
| 390 | - } else { |
|
| 391 | - $form->addElement(new XoopsFormHidden('description_set', '1')); |
|
| 392 | - } |
|
| 393 | - $form->display(); |
|
| 394 | - echo '<br>'; |
|
| 395 | - $itemtypes = $subscriptionhandler->itemTypesArray(); |
|
| 396 | - $form = new XoopsThemeForm(_MD_EDITITEMTYPE_FORM, 'edititemtypeform', 'main.php'); |
|
| 397 | - $itemtypes_select = new XoopsFormSelect(_MD_SELECT_ITEMTYPE, 'typeid', $typeid); |
|
| 398 | - $itemtypes_select->addOptionArray($itemtypes); |
|
| 399 | - $form->addElement($itemtypes_select); |
|
| 400 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 401 | - $form->addElement(new XoopsFormHidden('op', 'updateItemType')); |
|
| 402 | - $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 403 | - $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 404 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 405 | - $form->display(); |
|
| 406 | - } |
|
| 407 | - xoops_cp_footer(); |
|
| 408 | - break; |
|
| 409 | - case 'save': |
|
| 410 | - if (!empty($_POST['submit'])) { |
|
| 411 | - $submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
| 412 | - |
|
| 413 | - if (!empty($_POST['itemid'])) { |
|
| 414 | - $post_itemid = (int)$_POST['itemid']; |
|
| 415 | - } else { |
|
| 416 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 417 | - exit(); |
|
| 418 | - } |
|
| 419 | - if (isset($_POST['itemtitle'])) { |
|
| 420 | - $p_title = $myts->makeTboxData4Save($_POST['itemtitle']); |
|
| 421 | - $p_ini_title = $_POST['ini_itemtitle']; |
|
| 422 | - if ($p_title != $p_ini_title) { |
|
| 423 | - //If the posted title is different from the initial title the record should be updated. |
|
| 424 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET title = '$p_title' WHERE itemid = $post_itemid"; |
|
| 425 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 426 | - } |
|
| 427 | - } else { |
|
| 428 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 429 | - exit(); |
|
| 430 | - } |
|
| 431 | - if (!empty($_POST['dirid'])) { |
|
| 432 | - $post_dirid = (int)$_POST['dirid']; |
|
| 433 | - } else { |
|
| 434 | - $post_dirid = 0; |
|
| 435 | - } |
|
| 436 | - if (isset($_POST['ini_description'])) { |
|
| 437 | - $p_ini_description = $myts->makeTareaData4Save($_POST['ini_description']); |
|
| 438 | - } else { |
|
| 439 | - $p_ini_description = null; |
|
| 440 | - } |
|
| 441 | - if (isset($_POST['description'])) { |
|
| 442 | - $p_description = $myts->makeTareaData4Save($_POST['description']); |
|
| 443 | - } else { |
|
| 444 | - $p_description = null; |
|
| 445 | - } |
|
| 446 | - if (isset($_POST['description_set'])) { |
|
| 447 | - if ($_POST['description_set'] == '1') { |
|
| 448 | - if ($p_ini_description != $p_description) { |
|
| 449 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') . " SET description = '$p_description' WHERE itemid = $post_itemid"; |
|
| 450 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 451 | - } |
|
| 452 | - } elseif (isset($_POST['description']) && $_POST['description'] != '') { |
|
| 453 | - if ($p_description != null) { |
|
| 454 | - $sql = sprintf("INSERT INTO %s (itemid, description) VALUES (%u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), $post_itemid, $p_description); |
|
| 455 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 456 | - } |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value '; |
|
| 460 | - $sql .= 'FROM ' |
|
| 461 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 462 | - . ' ic, ' |
|
| 463 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 464 | - . ' xc, ' |
|
| 465 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 466 | - . ' f, ' |
|
| 467 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 468 | - . ' t '; |
|
| 469 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $post_itemid . ') '; |
|
| 470 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND ic.itemid=" . $post_itemid . ''; |
|
| 471 | - $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 472 | - $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 473 | - while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value) = $xoopsDB->fetchRow($data_result)) { |
|
| 474 | - if (isset($_POST["$dtypeid"])) { |
|
| 475 | - if ($fieldtype == 'textarea' || 'dhtml') { |
|
| 476 | - $post_value = $myts->makeTareaData4Save($_POST["$dtypeid"]); |
|
| 477 | - } else { |
|
| 478 | - $post_value = $myts->makeTboxData4Save($_POST["$dtypeid"]); |
|
| 479 | - } |
|
| 480 | - } else { |
|
| 481 | - $post_value = ''; |
|
| 482 | - } |
|
| 483 | - |
|
| 484 | - if (isset($_POST['custom' . $dtypeid . ''])) { |
|
| 485 | - $post_customtitle = $myts->makeTboxData4Save($_POST['custom' . $dtypeid . '']); |
|
| 486 | - } else { |
|
| 487 | - $post_customtitle = ''; |
|
| 488 | - } |
|
| 489 | - if ($fieldtype == 'address') { |
|
| 490 | - $addressfields = array('address', 'address2', 'zip', 'postcode', 'phone', 'lat', 'lon', 'phone', 'fax', 'mobile', 'city', 'country', 'uselocyn', 'main', 'active'); |
|
| 491 | - foreach ($addressfields as $field) { |
|
| 492 | - if (isset($_POST["$dtypeid$field"])) { |
|
| 493 | - ${'post_' . $field} = $myts->makeTboxData4Save($_POST["$dtypeid$field"]); |
|
| 494 | - } else { |
|
| 495 | - ${'post_' . $field} = ''; |
|
| 496 | - } |
|
| 497 | - } |
|
| 498 | - //INSERT OF UPDATE address |
|
| 499 | - //If INSERT, then get $newid and save it as the value in efqdiralpha1_data table |
|
| 500 | - if (isset($_POST['submitaddress'])) { |
|
| 501 | - if ($itemid == null || $post_value == '') { |
|
| 502 | - //That means there was not any value, so a new record should be added to the data table. |
|
| 503 | - $newaddrid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') . '_addrid_seq'); |
|
| 504 | - $sql = sprintf("INSERT INTO %s (addrid, itemid, dtypeid, address, address2, zip, postcode, phone, lat, lon, main, active, fax, mobile, city, country) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, %u, '%s', '%s', '%s', '%s')", |
|
| 505 | - $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses'), $newaddrid, $post_itemid, $dtypeid, $post_address, $post_address2, $post_zip, $post_postcode, $post_phone, $post_lat, $post_lon, $post_main, $post_active, $post_fax, $post_mobile, |
|
| 506 | - $post_city, $post_country); |
|
| 507 | - //echo $sql."<br><br>"; |
|
| 508 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 509 | - $post_value = $xoopsDB->getInsertId(); |
|
| 510 | - } else { |
|
| 511 | - $sql = 'UPDATE ' |
|
| 512 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') |
|
| 513 | - . " SET address = '$post_address', address2 = '$post_address2', zip = '$post_zip', postcode = '$post_postcode', lat = '$post_lat', lon = '$post_lon', main = '$post_main', active = '$post_active', fax = '$post_fax', mobile = '$post_mobile', city = '$post_city', country = '$post_country' WHERE addrid = '$post_value' AND itemid = '$post_itemid'"; |
|
| 514 | - //echo $sql."<br><br>"; |
|
| 515 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 516 | - } |
|
| 517 | - } |
|
| 518 | - } |
|
| 519 | - if ($itemid == null) { |
|
| 520 | - //That means there was not any value, so a new record should be added to the data table. |
|
| 521 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . '_dataid_seq'); |
|
| 522 | - $sql = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time()); |
|
| 523 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 524 | - } else { |
|
| 525 | - if ($value != $post_value) { |
|
| 526 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . " SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid"; |
|
| 527 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 528 | - } |
|
| 529 | - } |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - $efqlisting = new efqListing(); |
|
| 533 | - $efqlistinghandler = new efqListingHandler(); |
|
| 534 | - $linkedcats = $efqlistinghandler->getLinkedCatsArray($post_itemid, $post_dirid); |
|
| 535 | - $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $post_dirid . '\' AND active=\'1\''; |
|
| 536 | - $allcatsresult = $xoopsDB->query($sql); |
|
| 537 | - |
|
| 538 | - $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
| 539 | - $count = 0; |
|
| 540 | - if ($numrows > 0) { |
|
| 541 | - while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
| 542 | - if (isset($_POST['selected' . $cid . ''])) { |
|
| 543 | - if (!in_array($cid, $linkedcats)) { |
|
| 544 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 545 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $post_itemid, 1, time()); |
|
| 546 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - ++$count; |
|
| 550 | - } else { |
|
| 551 | - if (in_array($cid, $linkedcats)) { |
|
| 552 | - $sql = sprintf('DELETE FROM %s WHERE cid=%u AND itemid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $cid, $post_itemid); |
|
| 553 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 554 | - } |
|
| 555 | - } |
|
| 556 | - } |
|
| 557 | - if ($count == 0) { |
|
| 558 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORYMATCH); |
|
| 559 | - exit(); |
|
| 560 | - } |
|
| 561 | - } else { |
|
| 562 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
| 563 | - exit(); |
|
| 564 | - } |
|
| 565 | - |
|
| 566 | - redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
|
| 567 | - exit(); |
|
| 568 | - } |
|
| 569 | - break; |
|
| 570 | - default: |
|
| 571 | - listings(); |
|
| 572 | - break; |
|
| 304 | + case 'approve': |
|
| 305 | + approve(); |
|
| 306 | + break; |
|
| 307 | + case 'deleteListingConfirm': |
|
| 308 | + delListingConfirm(); |
|
| 309 | + break; |
|
| 310 | + case 'deleteListing': |
|
| 311 | + delListing(); |
|
| 312 | + break; |
|
| 313 | + case 'delVote': |
|
| 314 | + delVote(); |
|
| 315 | + break; |
|
| 316 | + case 'listNewListings': |
|
| 317 | + listNewListings(); |
|
| 318 | + break; |
|
| 319 | + case 'updateItemType': |
|
| 320 | + updateItemType(); |
|
| 321 | + break; |
|
| 322 | + case 'duplicateDataTypes': |
|
| 323 | + listDuplicateDataTypes(); |
|
| 324 | + break; |
|
| 325 | + case 'mergeDuplicates': |
|
| 326 | + mergeDuplicates(); |
|
| 327 | + break; |
|
| 328 | + case 'edit': |
|
| 329 | + global $xoopsDB, $xoopsConfig, $myts, $eh, $efqtree, $moddir, $xoopsUser, $datafieldmanager, $subscription, $subscriptionhandler; |
|
| 330 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid, t.description FROM ' |
|
| 331 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') |
|
| 332 | + . ' i LEFT JOIN ' |
|
| 333 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') |
|
| 334 | + . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' |
|
| 335 | + . $get_itemid |
|
| 336 | + . ''; |
|
| 337 | + $item_result = $xoopsDB->query($sql); |
|
| 338 | + $numrows = $xoopsDB->getRowsNum($item_result); |
|
| 339 | + xoops_cp_header(); |
|
| 340 | + //adminmenu(-1, _MD_A_MODADMIN_HOME); |
|
| 341 | + echo "<hr size='1'><br>"; |
|
| 342 | + while (list($itemid, $logourl, $submitter, $status, $created, $itemtitle, $typeid, $description) = $xoopsDB->fetchRow($item_result)) { |
|
| 343 | + if ($status == '1') { |
|
| 344 | + echo '<input type="button" value="' . _MD_APPROVE . "\" onclick=\"location='main.php?op=approve&item=$get_itemid'\"> "; |
|
| 345 | + } |
|
| 346 | + echo ' <input type="button" value="' |
|
| 347 | + . _MD_DELETE |
|
| 348 | + . "\" onClick=\"location='main.php?op=deleteListingConfirm&item=$get_itemid'\"> <input type=\"button\" value=\"" |
|
| 349 | + . _MD_VIEWITEM |
|
| 350 | + . "\" onclick=\"location='" |
|
| 351 | + . XOOPS_URL |
|
| 352 | + . '/modules/' |
|
| 353 | + . $moddir |
|
| 354 | + . "/listing.php?item=$get_itemid'\"><br><br>"; |
|
| 355 | + |
|
| 356 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value, d.customtitle, t.custom '; |
|
| 357 | + $sql .= 'FROM ' |
|
| 358 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 359 | + . ' ic, ' |
|
| 360 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 361 | + . ' xc, ' |
|
| 362 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 363 | + . ' f, ' |
|
| 364 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 365 | + . ' t '; |
|
| 366 | + $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $get_itemid . ') '; |
|
| 367 | + $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=" . $get_itemid . ''; |
|
| 368 | + $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 369 | + $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 370 | + |
|
| 371 | + $form = new XoopsThemeForm(_MD_EDITITEM_FORM, 'editform', 'main.php'); |
|
| 372 | + $form->addElement(new XoopsFormText(_MD_TITLE, 'itemtitle', 50, 250, $itemtitle), true); |
|
| 373 | + //$categories = getCategoriesPaths($get_itemid); |
|
| 374 | + $get_dirid = getDirIdFromItem($itemid); |
|
| 375 | + $categories = getCatSelectArea($itemid, $get_dirid); |
|
| 376 | + $form_cats = new XoopsFormLabel(_MD_ITEMCATEGORIES, "$categories"); |
|
| 377 | + $form->addElement($form_cats); |
|
| 378 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'description', $description, 5, 50)); |
|
| 379 | + while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value, $customtitle, $custom) = $xoopsDB->fetchRow($data_result)) { |
|
| 380 | + $field = $datafieldmanager->createField($title, $dtypeid, $fieldtype, $ext, $options, $value, $custom, $customtitle); |
|
| 381 | + } |
|
| 382 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 383 | + $form->addElement(new XoopsFormHidden('op', 'save')); |
|
| 384 | + $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 385 | + $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 386 | + $form->addElement(new XoopsFormHidden('ini_itemtitle', $itemtitle)); |
|
| 387 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 388 | + if ($description === false) { |
|
| 389 | + $form->addElement(new XoopsFormHidden('description_set', '0')); |
|
| 390 | + } else { |
|
| 391 | + $form->addElement(new XoopsFormHidden('description_set', '1')); |
|
| 392 | + } |
|
| 393 | + $form->display(); |
|
| 394 | + echo '<br>'; |
|
| 395 | + $itemtypes = $subscriptionhandler->itemTypesArray(); |
|
| 396 | + $form = new XoopsThemeForm(_MD_EDITITEMTYPE_FORM, 'edititemtypeform', 'main.php'); |
|
| 397 | + $itemtypes_select = new XoopsFormSelect(_MD_SELECT_ITEMTYPE, 'typeid', $typeid); |
|
| 398 | + $itemtypes_select->addOptionArray($itemtypes); |
|
| 399 | + $form->addElement($itemtypes_select); |
|
| 400 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 401 | + $form->addElement(new XoopsFormHidden('op', 'updateItemType')); |
|
| 402 | + $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 403 | + $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 404 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 405 | + $form->display(); |
|
| 406 | + } |
|
| 407 | + xoops_cp_footer(); |
|
| 408 | + break; |
|
| 409 | + case 'save': |
|
| 410 | + if (!empty($_POST['submit'])) { |
|
| 411 | + $submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
| 412 | + |
|
| 413 | + if (!empty($_POST['itemid'])) { |
|
| 414 | + $post_itemid = (int)$_POST['itemid']; |
|
| 415 | + } else { |
|
| 416 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 417 | + exit(); |
|
| 418 | + } |
|
| 419 | + if (isset($_POST['itemtitle'])) { |
|
| 420 | + $p_title = $myts->makeTboxData4Save($_POST['itemtitle']); |
|
| 421 | + $p_ini_title = $_POST['ini_itemtitle']; |
|
| 422 | + if ($p_title != $p_ini_title) { |
|
| 423 | + //If the posted title is different from the initial title the record should be updated. |
|
| 424 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET title = '$p_title' WHERE itemid = $post_itemid"; |
|
| 425 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 426 | + } |
|
| 427 | + } else { |
|
| 428 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 429 | + exit(); |
|
| 430 | + } |
|
| 431 | + if (!empty($_POST['dirid'])) { |
|
| 432 | + $post_dirid = (int)$_POST['dirid']; |
|
| 433 | + } else { |
|
| 434 | + $post_dirid = 0; |
|
| 435 | + } |
|
| 436 | + if (isset($_POST['ini_description'])) { |
|
| 437 | + $p_ini_description = $myts->makeTareaData4Save($_POST['ini_description']); |
|
| 438 | + } else { |
|
| 439 | + $p_ini_description = null; |
|
| 440 | + } |
|
| 441 | + if (isset($_POST['description'])) { |
|
| 442 | + $p_description = $myts->makeTareaData4Save($_POST['description']); |
|
| 443 | + } else { |
|
| 444 | + $p_description = null; |
|
| 445 | + } |
|
| 446 | + if (isset($_POST['description_set'])) { |
|
| 447 | + if ($_POST['description_set'] == '1') { |
|
| 448 | + if ($p_ini_description != $p_description) { |
|
| 449 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') . " SET description = '$p_description' WHERE itemid = $post_itemid"; |
|
| 450 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 451 | + } |
|
| 452 | + } elseif (isset($_POST['description']) && $_POST['description'] != '') { |
|
| 453 | + if ($p_description != null) { |
|
| 454 | + $sql = sprintf("INSERT INTO %s (itemid, description) VALUES (%u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), $post_itemid, $p_description); |
|
| 455 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 456 | + } |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value '; |
|
| 460 | + $sql .= 'FROM ' |
|
| 461 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 462 | + . ' ic, ' |
|
| 463 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 464 | + . ' xc, ' |
|
| 465 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 466 | + . ' f, ' |
|
| 467 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 468 | + . ' t '; |
|
| 469 | + $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $post_itemid . ') '; |
|
| 470 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND ic.itemid=" . $post_itemid . ''; |
|
| 471 | + $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 472 | + $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 473 | + while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value) = $xoopsDB->fetchRow($data_result)) { |
|
| 474 | + if (isset($_POST["$dtypeid"])) { |
|
| 475 | + if ($fieldtype == 'textarea' || 'dhtml') { |
|
| 476 | + $post_value = $myts->makeTareaData4Save($_POST["$dtypeid"]); |
|
| 477 | + } else { |
|
| 478 | + $post_value = $myts->makeTboxData4Save($_POST["$dtypeid"]); |
|
| 479 | + } |
|
| 480 | + } else { |
|
| 481 | + $post_value = ''; |
|
| 482 | + } |
|
| 483 | + |
|
| 484 | + if (isset($_POST['custom' . $dtypeid . ''])) { |
|
| 485 | + $post_customtitle = $myts->makeTboxData4Save($_POST['custom' . $dtypeid . '']); |
|
| 486 | + } else { |
|
| 487 | + $post_customtitle = ''; |
|
| 488 | + } |
|
| 489 | + if ($fieldtype == 'address') { |
|
| 490 | + $addressfields = array('address', 'address2', 'zip', 'postcode', 'phone', 'lat', 'lon', 'phone', 'fax', 'mobile', 'city', 'country', 'uselocyn', 'main', 'active'); |
|
| 491 | + foreach ($addressfields as $field) { |
|
| 492 | + if (isset($_POST["$dtypeid$field"])) { |
|
| 493 | + ${'post_' . $field} = $myts->makeTboxData4Save($_POST["$dtypeid$field"]); |
|
| 494 | + } else { |
|
| 495 | + ${'post_' . $field} = ''; |
|
| 496 | + } |
|
| 497 | + } |
|
| 498 | + //INSERT OF UPDATE address |
|
| 499 | + //If INSERT, then get $newid and save it as the value in efqdiralpha1_data table |
|
| 500 | + if (isset($_POST['submitaddress'])) { |
|
| 501 | + if ($itemid == null || $post_value == '') { |
|
| 502 | + //That means there was not any value, so a new record should be added to the data table. |
|
| 503 | + $newaddrid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') . '_addrid_seq'); |
|
| 504 | + $sql = sprintf("INSERT INTO %s (addrid, itemid, dtypeid, address, address2, zip, postcode, phone, lat, lon, main, active, fax, mobile, city, country) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, %u, '%s', '%s', '%s', '%s')", |
|
| 505 | + $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses'), $newaddrid, $post_itemid, $dtypeid, $post_address, $post_address2, $post_zip, $post_postcode, $post_phone, $post_lat, $post_lon, $post_main, $post_active, $post_fax, $post_mobile, |
|
| 506 | + $post_city, $post_country); |
|
| 507 | + //echo $sql."<br><br>"; |
|
| 508 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 509 | + $post_value = $xoopsDB->getInsertId(); |
|
| 510 | + } else { |
|
| 511 | + $sql = 'UPDATE ' |
|
| 512 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') |
|
| 513 | + . " SET address = '$post_address', address2 = '$post_address2', zip = '$post_zip', postcode = '$post_postcode', lat = '$post_lat', lon = '$post_lon', main = '$post_main', active = '$post_active', fax = '$post_fax', mobile = '$post_mobile', city = '$post_city', country = '$post_country' WHERE addrid = '$post_value' AND itemid = '$post_itemid'"; |
|
| 514 | + //echo $sql."<br><br>"; |
|
| 515 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | + } |
|
| 519 | + if ($itemid == null) { |
|
| 520 | + //That means there was not any value, so a new record should be added to the data table. |
|
| 521 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . '_dataid_seq'); |
|
| 522 | + $sql = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time()); |
|
| 523 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 524 | + } else { |
|
| 525 | + if ($value != $post_value) { |
|
| 526 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . " SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid"; |
|
| 527 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 528 | + } |
|
| 529 | + } |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + $efqlisting = new efqListing(); |
|
| 533 | + $efqlistinghandler = new efqListingHandler(); |
|
| 534 | + $linkedcats = $efqlistinghandler->getLinkedCatsArray($post_itemid, $post_dirid); |
|
| 535 | + $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $post_dirid . '\' AND active=\'1\''; |
|
| 536 | + $allcatsresult = $xoopsDB->query($sql); |
|
| 537 | + |
|
| 538 | + $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
| 539 | + $count = 0; |
|
| 540 | + if ($numrows > 0) { |
|
| 541 | + while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
| 542 | + if (isset($_POST['selected' . $cid . ''])) { |
|
| 543 | + if (!in_array($cid, $linkedcats)) { |
|
| 544 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 545 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $post_itemid, 1, time()); |
|
| 546 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 547 | + } |
|
| 548 | + |
|
| 549 | + ++$count; |
|
| 550 | + } else { |
|
| 551 | + if (in_array($cid, $linkedcats)) { |
|
| 552 | + $sql = sprintf('DELETE FROM %s WHERE cid=%u AND itemid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $cid, $post_itemid); |
|
| 553 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 554 | + } |
|
| 555 | + } |
|
| 556 | + } |
|
| 557 | + if ($count == 0) { |
|
| 558 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORYMATCH); |
|
| 559 | + exit(); |
|
| 560 | + } |
|
| 561 | + } else { |
|
| 562 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
| 563 | + exit(); |
|
| 564 | + } |
|
| 565 | + |
|
| 566 | + redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
|
| 567 | + exit(); |
|
| 568 | + } |
|
| 569 | + break; |
|
| 570 | + default: |
|
| 571 | + listings(); |
|
| 572 | + break; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | function unique_events($array) |
| 576 | 576 | { |
| 577 | - //checks $array for duplicate values and returns an |
|
| 578 | - //array containing the keys of duplicates |
|
| 579 | - $count = array_intersect_assoc($array, array_flip(array_count_values($array))); |
|
| 580 | - $return = array(); |
|
| 581 | - foreach ($array as $key => $value) { |
|
| 582 | - if (in_array($value, $count)) { |
|
| 583 | - $return[$value][] = $key; |
|
| 584 | - } |
|
| 585 | - } |
|
| 586 | - |
|
| 587 | - return $return; |
|
| 577 | + //checks $array for duplicate values and returns an |
|
| 578 | + //array containing the keys of duplicates |
|
| 579 | + $count = array_intersect_assoc($array, array_flip(array_count_values($array))); |
|
| 580 | + $return = array(); |
|
| 581 | + foreach ($array as $key => $value) { |
|
| 582 | + if (in_array($value, $count)) { |
|
| 583 | + $return[$value][] = $key; |
|
| 584 | + } |
|
| 585 | + } |
|
| 586 | + |
|
| 587 | + return $return; |
|
| 588 | 588 | } |
@@ -301,275 +301,275 @@ |
||
| 301 | 301 | $op = $_POST['op']; |
| 302 | 302 | } |
| 303 | 303 | switch ($op) { |
| 304 | - case 'approve': |
|
| 305 | - approve(); |
|
| 306 | - break; |
|
| 307 | - case 'deleteListingConfirm': |
|
| 308 | - delListingConfirm(); |
|
| 309 | - break; |
|
| 310 | - case 'deleteListing': |
|
| 311 | - delListing(); |
|
| 312 | - break; |
|
| 313 | - case 'delVote': |
|
| 314 | - delVote(); |
|
| 315 | - break; |
|
| 316 | - case 'listNewListings': |
|
| 317 | - listNewListings(); |
|
| 318 | - break; |
|
| 319 | - case 'updateItemType': |
|
| 320 | - updateItemType(); |
|
| 321 | - break; |
|
| 322 | - case 'duplicateDataTypes': |
|
| 323 | - listDuplicateDataTypes(); |
|
| 324 | - break; |
|
| 325 | - case 'mergeDuplicates': |
|
| 326 | - mergeDuplicates(); |
|
| 327 | - break; |
|
| 328 | - case 'edit': |
|
| 329 | - global $xoopsDB, $xoopsConfig, $myts, $eh, $efqtree, $moddir, $xoopsUser, $datafieldmanager, $subscription, $subscriptionhandler; |
|
| 330 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid, t.description FROM ' |
|
| 331 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') |
|
| 332 | - . ' i LEFT JOIN ' |
|
| 333 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') |
|
| 334 | - . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' |
|
| 335 | - . $get_itemid |
|
| 336 | - . ''; |
|
| 337 | - $item_result = $xoopsDB->query($sql); |
|
| 338 | - $numrows = $xoopsDB->getRowsNum($item_result); |
|
| 339 | - xoops_cp_header(); |
|
| 340 | - //adminmenu(-1, _MD_A_MODADMIN_HOME); |
|
| 341 | - echo "<hr size='1'><br>"; |
|
| 342 | - while (list($itemid, $logourl, $submitter, $status, $created, $itemtitle, $typeid, $description) = $xoopsDB->fetchRow($item_result)) { |
|
| 343 | - if ($status == '1') { |
|
| 344 | - echo '<input type="button" value="' . _MD_APPROVE . "\" onclick=\"location='main.php?op=approve&item=$get_itemid'\"> "; |
|
| 345 | - } |
|
| 346 | - echo ' <input type="button" value="' |
|
| 347 | - . _MD_DELETE |
|
| 348 | - . "\" onClick=\"location='main.php?op=deleteListingConfirm&item=$get_itemid'\"> <input type=\"button\" value=\"" |
|
| 349 | - . _MD_VIEWITEM |
|
| 350 | - . "\" onclick=\"location='" |
|
| 351 | - . XOOPS_URL |
|
| 352 | - . '/modules/' |
|
| 353 | - . $moddir |
|
| 354 | - . "/listing.php?item=$get_itemid'\"><br><br>"; |
|
| 355 | - |
|
| 356 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value, d.customtitle, t.custom '; |
|
| 357 | - $sql .= 'FROM ' |
|
| 358 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 359 | - . ' ic, ' |
|
| 360 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 361 | - . ' xc, ' |
|
| 362 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 363 | - . ' f, ' |
|
| 364 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 365 | - . ' t '; |
|
| 366 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $get_itemid . ') '; |
|
| 367 | - $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=" . $get_itemid . ''; |
|
| 368 | - $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 369 | - $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 370 | - |
|
| 371 | - $form = new XoopsThemeForm(_MD_EDITITEM_FORM, 'editform', 'main.php'); |
|
| 372 | - $form->addElement(new XoopsFormText(_MD_TITLE, 'itemtitle', 50, 250, $itemtitle), true); |
|
| 373 | - //$categories = getCategoriesPaths($get_itemid); |
|
| 374 | - $get_dirid = getDirIdFromItem($itemid); |
|
| 375 | - $categories = getCatSelectArea($itemid, $get_dirid); |
|
| 376 | - $form_cats = new XoopsFormLabel(_MD_ITEMCATEGORIES, "$categories"); |
|
| 377 | - $form->addElement($form_cats); |
|
| 378 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'description', $description, 5, 50)); |
|
| 379 | - while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value, $customtitle, $custom) = $xoopsDB->fetchRow($data_result)) { |
|
| 380 | - $field = $datafieldmanager->createField($title, $dtypeid, $fieldtype, $ext, $options, $value, $custom, $customtitle); |
|
| 381 | - } |
|
| 382 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 383 | - $form->addElement(new XoopsFormHidden('op', 'save')); |
|
| 384 | - $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 385 | - $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 386 | - $form->addElement(new XoopsFormHidden('ini_itemtitle', $itemtitle)); |
|
| 387 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 388 | - if ($description === false) { |
|
| 389 | - $form->addElement(new XoopsFormHidden('description_set', '0')); |
|
| 390 | - } else { |
|
| 391 | - $form->addElement(new XoopsFormHidden('description_set', '1')); |
|
| 392 | - } |
|
| 393 | - $form->display(); |
|
| 394 | - echo '<br>'; |
|
| 395 | - $itemtypes = $subscriptionhandler->itemTypesArray(); |
|
| 396 | - $form = new XoopsThemeForm(_MD_EDITITEMTYPE_FORM, 'edititemtypeform', 'main.php'); |
|
| 397 | - $itemtypes_select = new XoopsFormSelect(_MD_SELECT_ITEMTYPE, 'typeid', $typeid); |
|
| 398 | - $itemtypes_select->addOptionArray($itemtypes); |
|
| 399 | - $form->addElement($itemtypes_select); |
|
| 400 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 401 | - $form->addElement(new XoopsFormHidden('op', 'updateItemType')); |
|
| 402 | - $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 403 | - $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 404 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 405 | - $form->display(); |
|
| 406 | - } |
|
| 407 | - xoops_cp_footer(); |
|
| 408 | - break; |
|
| 409 | - case 'save': |
|
| 410 | - if (!empty($_POST['submit'])) { |
|
| 411 | - $submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
| 412 | - |
|
| 413 | - if (!empty($_POST['itemid'])) { |
|
| 414 | - $post_itemid = (int)$_POST['itemid']; |
|
| 415 | - } else { |
|
| 416 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 417 | - exit(); |
|
| 418 | - } |
|
| 419 | - if (isset($_POST['itemtitle'])) { |
|
| 420 | - $p_title = $myts->makeTboxData4Save($_POST['itemtitle']); |
|
| 421 | - $p_ini_title = $_POST['ini_itemtitle']; |
|
| 422 | - if ($p_title != $p_ini_title) { |
|
| 423 | - //If the posted title is different from the initial title the record should be updated. |
|
| 424 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET title = '$p_title' WHERE itemid = $post_itemid"; |
|
| 425 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 426 | - } |
|
| 427 | - } else { |
|
| 428 | - redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 429 | - exit(); |
|
| 430 | - } |
|
| 431 | - if (!empty($_POST['dirid'])) { |
|
| 432 | - $post_dirid = (int)$_POST['dirid']; |
|
| 433 | - } else { |
|
| 434 | - $post_dirid = 0; |
|
| 435 | - } |
|
| 436 | - if (isset($_POST['ini_description'])) { |
|
| 437 | - $p_ini_description = $myts->makeTareaData4Save($_POST['ini_description']); |
|
| 438 | - } else { |
|
| 439 | - $p_ini_description = null; |
|
| 440 | - } |
|
| 441 | - if (isset($_POST['description'])) { |
|
| 442 | - $p_description = $myts->makeTareaData4Save($_POST['description']); |
|
| 443 | - } else { |
|
| 444 | - $p_description = null; |
|
| 445 | - } |
|
| 446 | - if (isset($_POST['description_set'])) { |
|
| 447 | - if ($_POST['description_set'] == '1') { |
|
| 448 | - if ($p_ini_description != $p_description) { |
|
| 449 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') . " SET description = '$p_description' WHERE itemid = $post_itemid"; |
|
| 450 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 451 | - } |
|
| 452 | - } elseif (isset($_POST['description']) && $_POST['description'] != '') { |
|
| 453 | - if ($p_description != null) { |
|
| 454 | - $sql = sprintf("INSERT INTO %s (itemid, description) VALUES (%u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), $post_itemid, $p_description); |
|
| 455 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 456 | - } |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value '; |
|
| 460 | - $sql .= 'FROM ' |
|
| 461 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 462 | - . ' ic, ' |
|
| 463 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 464 | - . ' xc, ' |
|
| 465 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 466 | - . ' f, ' |
|
| 467 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 468 | - . ' t '; |
|
| 469 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $post_itemid . ') '; |
|
| 470 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND ic.itemid=" . $post_itemid . ''; |
|
| 471 | - $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 472 | - $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 473 | - while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value) = $xoopsDB->fetchRow($data_result)) { |
|
| 474 | - if (isset($_POST["$dtypeid"])) { |
|
| 475 | - if ($fieldtype == 'textarea' || 'dhtml') { |
|
| 476 | - $post_value = $myts->makeTareaData4Save($_POST["$dtypeid"]); |
|
| 477 | - } else { |
|
| 478 | - $post_value = $myts->makeTboxData4Save($_POST["$dtypeid"]); |
|
| 479 | - } |
|
| 480 | - } else { |
|
| 481 | - $post_value = ''; |
|
| 482 | - } |
|
| 483 | - |
|
| 484 | - if (isset($_POST['custom' . $dtypeid . ''])) { |
|
| 485 | - $post_customtitle = $myts->makeTboxData4Save($_POST['custom' . $dtypeid . '']); |
|
| 486 | - } else { |
|
| 487 | - $post_customtitle = ''; |
|
| 488 | - } |
|
| 489 | - if ($fieldtype == 'address') { |
|
| 490 | - $addressfields = array('address', 'address2', 'zip', 'postcode', 'phone', 'lat', 'lon', 'phone', 'fax', 'mobile', 'city', 'country', 'uselocyn', 'main', 'active'); |
|
| 491 | - foreach ($addressfields as $field) { |
|
| 492 | - if (isset($_POST["$dtypeid$field"])) { |
|
| 493 | - ${'post_' . $field} = $myts->makeTboxData4Save($_POST["$dtypeid$field"]); |
|
| 494 | - } else { |
|
| 495 | - ${'post_' . $field} = ''; |
|
| 496 | - } |
|
| 497 | - } |
|
| 498 | - //INSERT OF UPDATE address |
|
| 499 | - //If INSERT, then get $newid and save it as the value in efqdiralpha1_data table |
|
| 500 | - if (isset($_POST['submitaddress'])) { |
|
| 501 | - if ($itemid == null || $post_value == '') { |
|
| 502 | - //That means there was not any value, so a new record should be added to the data table. |
|
| 503 | - $newaddrid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') . '_addrid_seq'); |
|
| 504 | - $sql = sprintf("INSERT INTO %s (addrid, itemid, dtypeid, address, address2, zip, postcode, phone, lat, lon, main, active, fax, mobile, city, country) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, %u, '%s', '%s', '%s', '%s')", |
|
| 505 | - $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses'), $newaddrid, $post_itemid, $dtypeid, $post_address, $post_address2, $post_zip, $post_postcode, $post_phone, $post_lat, $post_lon, $post_main, $post_active, $post_fax, $post_mobile, |
|
| 506 | - $post_city, $post_country); |
|
| 507 | - //echo $sql."<br><br>"; |
|
| 508 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 509 | - $post_value = $xoopsDB->getInsertId(); |
|
| 510 | - } else { |
|
| 511 | - $sql = 'UPDATE ' |
|
| 512 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') |
|
| 513 | - . " SET address = '$post_address', address2 = '$post_address2', zip = '$post_zip', postcode = '$post_postcode', lat = '$post_lat', lon = '$post_lon', main = '$post_main', active = '$post_active', fax = '$post_fax', mobile = '$post_mobile', city = '$post_city', country = '$post_country' WHERE addrid = '$post_value' AND itemid = '$post_itemid'"; |
|
| 514 | - //echo $sql."<br><br>"; |
|
| 515 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 516 | - } |
|
| 517 | - } |
|
| 518 | - } |
|
| 519 | - if ($itemid == null) { |
|
| 520 | - //That means there was not any value, so a new record should be added to the data table. |
|
| 521 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . '_dataid_seq'); |
|
| 522 | - $sql = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time()); |
|
| 523 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 524 | - } else { |
|
| 525 | - if ($value != $post_value) { |
|
| 526 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . " SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid"; |
|
| 527 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 528 | - } |
|
| 529 | - } |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - $efqlisting = new efqListing(); |
|
| 533 | - $efqlistinghandler = new efqListingHandler(); |
|
| 534 | - $linkedcats = $efqlistinghandler->getLinkedCatsArray($post_itemid, $post_dirid); |
|
| 535 | - $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $post_dirid . '\' AND active=\'1\''; |
|
| 536 | - $allcatsresult = $xoopsDB->query($sql); |
|
| 537 | - |
|
| 538 | - $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
| 539 | - $count = 0; |
|
| 540 | - if ($numrows > 0) { |
|
| 541 | - while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
| 542 | - if (isset($_POST['selected' . $cid . ''])) { |
|
| 543 | - if (!in_array($cid, $linkedcats)) { |
|
| 544 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 545 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $post_itemid, 1, time()); |
|
| 546 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - ++$count; |
|
| 550 | - } else { |
|
| 551 | - if (in_array($cid, $linkedcats)) { |
|
| 552 | - $sql = sprintf('DELETE FROM %s WHERE cid=%u AND itemid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $cid, $post_itemid); |
|
| 553 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 554 | - } |
|
| 555 | - } |
|
| 556 | - } |
|
| 557 | - if ($count == 0) { |
|
| 558 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORYMATCH); |
|
| 559 | - exit(); |
|
| 560 | - } |
|
| 561 | - } else { |
|
| 562 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
| 563 | - exit(); |
|
| 564 | - } |
|
| 565 | - |
|
| 566 | - redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
|
| 567 | - exit(); |
|
| 568 | - } |
|
| 569 | - break; |
|
| 570 | - default: |
|
| 571 | - listings(); |
|
| 572 | - break; |
|
| 304 | + case 'approve': |
|
| 305 | + approve(); |
|
| 306 | + break; |
|
| 307 | + case 'deleteListingConfirm': |
|
| 308 | + delListingConfirm(); |
|
| 309 | + break; |
|
| 310 | + case 'deleteListing': |
|
| 311 | + delListing(); |
|
| 312 | + break; |
|
| 313 | + case 'delVote': |
|
| 314 | + delVote(); |
|
| 315 | + break; |
|
| 316 | + case 'listNewListings': |
|
| 317 | + listNewListings(); |
|
| 318 | + break; |
|
| 319 | + case 'updateItemType': |
|
| 320 | + updateItemType(); |
|
| 321 | + break; |
|
| 322 | + case 'duplicateDataTypes': |
|
| 323 | + listDuplicateDataTypes(); |
|
| 324 | + break; |
|
| 325 | + case 'mergeDuplicates': |
|
| 326 | + mergeDuplicates(); |
|
| 327 | + break; |
|
| 328 | + case 'edit': |
|
| 329 | + global $xoopsDB, $xoopsConfig, $myts, $eh, $efqtree, $moddir, $xoopsUser, $datafieldmanager, $subscription, $subscriptionhandler; |
|
| 330 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid, t.description FROM ' |
|
| 331 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') |
|
| 332 | + . ' i LEFT JOIN ' |
|
| 333 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') |
|
| 334 | + . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' |
|
| 335 | + . $get_itemid |
|
| 336 | + . ''; |
|
| 337 | + $item_result = $xoopsDB->query($sql); |
|
| 338 | + $numrows = $xoopsDB->getRowsNum($item_result); |
|
| 339 | + xoops_cp_header(); |
|
| 340 | + //adminmenu(-1, _MD_A_MODADMIN_HOME); |
|
| 341 | + echo "<hr size='1'><br>"; |
|
| 342 | + while (list($itemid, $logourl, $submitter, $status, $created, $itemtitle, $typeid, $description) = $xoopsDB->fetchRow($item_result)) { |
|
| 343 | + if ($status == '1') { |
|
| 344 | + echo '<input type="button" value="' . _MD_APPROVE . "\" onclick=\"location='main.php?op=approve&item=$get_itemid'\"> "; |
|
| 345 | + } |
|
| 346 | + echo ' <input type="button" value="' |
|
| 347 | + . _MD_DELETE |
|
| 348 | + . "\" onClick=\"location='main.php?op=deleteListingConfirm&item=$get_itemid'\"> <input type=\"button\" value=\"" |
|
| 349 | + . _MD_VIEWITEM |
|
| 350 | + . "\" onclick=\"location='" |
|
| 351 | + . XOOPS_URL |
|
| 352 | + . '/modules/' |
|
| 353 | + . $moddir |
|
| 354 | + . "/listing.php?item=$get_itemid'\"><br><br>"; |
|
| 355 | + |
|
| 356 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value, d.customtitle, t.custom '; |
|
| 357 | + $sql .= 'FROM ' |
|
| 358 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 359 | + . ' ic, ' |
|
| 360 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 361 | + . ' xc, ' |
|
| 362 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 363 | + . ' f, ' |
|
| 364 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 365 | + . ' t '; |
|
| 366 | + $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $get_itemid . ') '; |
|
| 367 | + $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=" . $get_itemid . ''; |
|
| 368 | + $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 369 | + $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 370 | + |
|
| 371 | + $form = new XoopsThemeForm(_MD_EDITITEM_FORM, 'editform', 'main.php'); |
|
| 372 | + $form->addElement(new XoopsFormText(_MD_TITLE, 'itemtitle', 50, 250, $itemtitle), true); |
|
| 373 | + //$categories = getCategoriesPaths($get_itemid); |
|
| 374 | + $get_dirid = getDirIdFromItem($itemid); |
|
| 375 | + $categories = getCatSelectArea($itemid, $get_dirid); |
|
| 376 | + $form_cats = new XoopsFormLabel(_MD_ITEMCATEGORIES, "$categories"); |
|
| 377 | + $form->addElement($form_cats); |
|
| 378 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_DESCRIPTION, 'description', $description, 5, 50)); |
|
| 379 | + while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value, $customtitle, $custom) = $xoopsDB->fetchRow($data_result)) { |
|
| 380 | + $field = $datafieldmanager->createField($title, $dtypeid, $fieldtype, $ext, $options, $value, $custom, $customtitle); |
|
| 381 | + } |
|
| 382 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 383 | + $form->addElement(new XoopsFormHidden('op', 'save')); |
|
| 384 | + $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 385 | + $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 386 | + $form->addElement(new XoopsFormHidden('ini_itemtitle', $itemtitle)); |
|
| 387 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 388 | + if ($description === false) { |
|
| 389 | + $form->addElement(new XoopsFormHidden('description_set', '0')); |
|
| 390 | + } else { |
|
| 391 | + $form->addElement(new XoopsFormHidden('description_set', '1')); |
|
| 392 | + } |
|
| 393 | + $form->display(); |
|
| 394 | + echo '<br>'; |
|
| 395 | + $itemtypes = $subscriptionhandler->itemTypesArray(); |
|
| 396 | + $form = new XoopsThemeForm(_MD_EDITITEMTYPE_FORM, 'edititemtypeform', 'main.php'); |
|
| 397 | + $itemtypes_select = new XoopsFormSelect(_MD_SELECT_ITEMTYPE, 'typeid', $typeid); |
|
| 398 | + $itemtypes_select->addOptionArray($itemtypes); |
|
| 399 | + $form->addElement($itemtypes_select); |
|
| 400 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SAVE, 'submit')); |
|
| 401 | + $form->addElement(new XoopsFormHidden('op', 'updateItemType')); |
|
| 402 | + $form->addElement(new XoopsFormHidden('itemid', $get_itemid)); |
|
| 403 | + $form->addElement(new XoopsFormHidden('dirid', $get_dirid)); |
|
| 404 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 405 | + $form->display(); |
|
| 406 | + } |
|
| 407 | + xoops_cp_footer(); |
|
| 408 | + break; |
|
| 409 | + case 'save': |
|
| 410 | + if (!empty($_POST['submit'])) { |
|
| 411 | + $submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
|
| 412 | + |
|
| 413 | + if (!empty($_POST['itemid'])) { |
|
| 414 | + $post_itemid = (int)$_POST['itemid']; |
|
| 415 | + } else { |
|
| 416 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 417 | + exit(); |
|
| 418 | + } |
|
| 419 | + if (isset($_POST['itemtitle'])) { |
|
| 420 | + $p_title = $myts->makeTboxData4Save($_POST['itemtitle']); |
|
| 421 | + $p_ini_title = $_POST['ini_itemtitle']; |
|
| 422 | + if ($p_title != $p_ini_title) { |
|
| 423 | + //If the posted title is different from the initial title the record should be updated. |
|
| 424 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET title = '$p_title' WHERE itemid = $post_itemid"; |
|
| 425 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 426 | + } |
|
| 427 | + } else { |
|
| 428 | + redirect_header('index.php', 2, _MD_NOVALIDITEM); |
|
| 429 | + exit(); |
|
| 430 | + } |
|
| 431 | + if (!empty($_POST['dirid'])) { |
|
| 432 | + $post_dirid = (int)$_POST['dirid']; |
|
| 433 | + } else { |
|
| 434 | + $post_dirid = 0; |
|
| 435 | + } |
|
| 436 | + if (isset($_POST['ini_description'])) { |
|
| 437 | + $p_ini_description = $myts->makeTareaData4Save($_POST['ini_description']); |
|
| 438 | + } else { |
|
| 439 | + $p_ini_description = null; |
|
| 440 | + } |
|
| 441 | + if (isset($_POST['description'])) { |
|
| 442 | + $p_description = $myts->makeTareaData4Save($_POST['description']); |
|
| 443 | + } else { |
|
| 444 | + $p_description = null; |
|
| 445 | + } |
|
| 446 | + if (isset($_POST['description_set'])) { |
|
| 447 | + if ($_POST['description_set'] == '1') { |
|
| 448 | + if ($p_ini_description != $p_description) { |
|
| 449 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') . " SET description = '$p_description' WHERE itemid = $post_itemid"; |
|
| 450 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 451 | + } |
|
| 452 | + } elseif (isset($_POST['description']) && $_POST['description'] != '') { |
|
| 453 | + if ($p_description != null) { |
|
| 454 | + $sql = sprintf("INSERT INTO %s (itemid, description) VALUES (%u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), $post_itemid, $p_description); |
|
| 455 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 456 | + } |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value '; |
|
| 460 | + $sql .= 'FROM ' |
|
| 461 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 462 | + . ' ic, ' |
|
| 463 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 464 | + . ' xc, ' |
|
| 465 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 466 | + . ' f, ' |
|
| 467 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 468 | + . ' t '; |
|
| 469 | + $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $post_itemid . ') '; |
|
| 470 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND ic.itemid=" . $post_itemid . ''; |
|
| 471 | + $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 472 | + $numrows = $xoopsDB->getRowsNum($data_result); |
|
| 473 | + while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value) = $xoopsDB->fetchRow($data_result)) { |
|
| 474 | + if (isset($_POST["$dtypeid"])) { |
|
| 475 | + if ($fieldtype == 'textarea' || 'dhtml') { |
|
| 476 | + $post_value = $myts->makeTareaData4Save($_POST["$dtypeid"]); |
|
| 477 | + } else { |
|
| 478 | + $post_value = $myts->makeTboxData4Save($_POST["$dtypeid"]); |
|
| 479 | + } |
|
| 480 | + } else { |
|
| 481 | + $post_value = ''; |
|
| 482 | + } |
|
| 483 | + |
|
| 484 | + if (isset($_POST['custom' . $dtypeid . ''])) { |
|
| 485 | + $post_customtitle = $myts->makeTboxData4Save($_POST['custom' . $dtypeid . '']); |
|
| 486 | + } else { |
|
| 487 | + $post_customtitle = ''; |
|
| 488 | + } |
|
| 489 | + if ($fieldtype == 'address') { |
|
| 490 | + $addressfields = array('address', 'address2', 'zip', 'postcode', 'phone', 'lat', 'lon', 'phone', 'fax', 'mobile', 'city', 'country', 'uselocyn', 'main', 'active'); |
|
| 491 | + foreach ($addressfields as $field) { |
|
| 492 | + if (isset($_POST["$dtypeid$field"])) { |
|
| 493 | + ${'post_' . $field} = $myts->makeTboxData4Save($_POST["$dtypeid$field"]); |
|
| 494 | + } else { |
|
| 495 | + ${'post_' . $field} = ''; |
|
| 496 | + } |
|
| 497 | + } |
|
| 498 | + //INSERT OF UPDATE address |
|
| 499 | + //If INSERT, then get $newid and save it as the value in efqdiralpha1_data table |
|
| 500 | + if (isset($_POST['submitaddress'])) { |
|
| 501 | + if ($itemid == null || $post_value == '') { |
|
| 502 | + //That means there was not any value, so a new record should be added to the data table. |
|
| 503 | + $newaddrid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') . '_addrid_seq'); |
|
| 504 | + $sql = sprintf("INSERT INTO %s (addrid, itemid, dtypeid, address, address2, zip, postcode, phone, lat, lon, main, active, fax, mobile, city, country) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, %u, '%s', '%s', '%s', '%s')", |
|
| 505 | + $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses'), $newaddrid, $post_itemid, $dtypeid, $post_address, $post_address2, $post_zip, $post_postcode, $post_phone, $post_lat, $post_lon, $post_main, $post_active, $post_fax, $post_mobile, |
|
| 506 | + $post_city, $post_country); |
|
| 507 | + //echo $sql."<br><br>"; |
|
| 508 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 509 | + $post_value = $xoopsDB->getInsertId(); |
|
| 510 | + } else { |
|
| 511 | + $sql = 'UPDATE ' |
|
| 512 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') |
|
| 513 | + . " SET address = '$post_address', address2 = '$post_address2', zip = '$post_zip', postcode = '$post_postcode', lat = '$post_lat', lon = '$post_lon', main = '$post_main', active = '$post_active', fax = '$post_fax', mobile = '$post_mobile', city = '$post_city', country = '$post_country' WHERE addrid = '$post_value' AND itemid = '$post_itemid'"; |
|
| 514 | + //echo $sql."<br><br>"; |
|
| 515 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | + } |
|
| 519 | + if ($itemid == null) { |
|
| 520 | + //That means there was not any value, so a new record should be added to the data table. |
|
| 521 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . '_dataid_seq'); |
|
| 522 | + $sql = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time()); |
|
| 523 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 524 | + } else { |
|
| 525 | + if ($value != $post_value) { |
|
| 526 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . " SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid"; |
|
| 527 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 528 | + } |
|
| 529 | + } |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + $efqlisting = new efqListing(); |
|
| 533 | + $efqlistinghandler = new efqListingHandler(); |
|
| 534 | + $linkedcats = $efqlistinghandler->getLinkedCatsArray($post_itemid, $post_dirid); |
|
| 535 | + $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $post_dirid . '\' AND active=\'1\''; |
|
| 536 | + $allcatsresult = $xoopsDB->query($sql); |
|
| 537 | + |
|
| 538 | + $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
| 539 | + $count = 0; |
|
| 540 | + if ($numrows > 0) { |
|
| 541 | + while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
| 542 | + if (isset($_POST['selected' . $cid . ''])) { |
|
| 543 | + if (!in_array($cid, $linkedcats)) { |
|
| 544 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 545 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $post_itemid, 1, time()); |
|
| 546 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 547 | + } |
|
| 548 | + |
|
| 549 | + ++$count; |
|
| 550 | + } else { |
|
| 551 | + if (in_array($cid, $linkedcats)) { |
|
| 552 | + $sql = sprintf('DELETE FROM %s WHERE cid=%u AND itemid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $cid, $post_itemid); |
|
| 553 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 554 | + } |
|
| 555 | + } |
|
| 556 | + } |
|
| 557 | + if ($count == 0) { |
|
| 558 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORYMATCH); |
|
| 559 | + exit(); |
|
| 560 | + } |
|
| 561 | + } else { |
|
| 562 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
| 563 | + exit(); |
|
| 564 | + } |
|
| 565 | + |
|
| 566 | + redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
|
| 567 | + exit(); |
|
| 568 | + } |
|
| 569 | + break; |
|
| 570 | + default: |
|
| 571 | + listings(); |
|
| 572 | + break; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | function unique_events($array) |
@@ -18,23 +18,23 @@ 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 | |
| 23 | -require_once __DIR__ . '/../include/functions.php'; |
|
| 24 | -require_once XOOPS_ROOT_PATH . '/class/xoopstree.php'; |
|
| 23 | +require_once __DIR__.'/../include/functions.php'; |
|
| 24 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 25 | 25 | //require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
| 26 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
| 27 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 28 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 27 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 28 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 29 | 29 | global $xoopsModule; |
| 30 | 30 | //$myts = MyTextSanitizer::getInstance(); |
| 31 | 31 | $eh = new ErrorHandler; |
| 32 | -$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 33 | -require_once __DIR__ . '/../class/class.datafieldmanager.php'; |
|
| 34 | -require_once __DIR__ . '/../class/class.subscription.php'; |
|
| 35 | -require_once __DIR__ . '/../class/class.efqtree.php'; |
|
| 36 | -require_once __DIR__ . '/../class/class.listing.php'; |
|
| 37 | -$efqtree = new EfqTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 32 | +$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 33 | +require_once __DIR__.'/../class/class.datafieldmanager.php'; |
|
| 34 | +require_once __DIR__.'/../class/class.subscription.php'; |
|
| 35 | +require_once __DIR__.'/../class/class.efqtree.php'; |
|
| 36 | +require_once __DIR__.'/../class/class.listing.php'; |
|
| 37 | +$efqtree = new EfqTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 38 | 38 | $datafieldmanager = new efqDataFieldManager(); |
| 39 | 39 | |
| 40 | 40 | $listinghandler = new efqListingHandler; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $moddir = $xoopsModule->getVar('dirname'); |
| 44 | 44 | |
| 45 | 45 | if (isset($_GET['item'])) { |
| 46 | - $get_itemid = (int)$_GET['item']; |
|
| 46 | + $get_itemid = (int) $_GET['item']; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | function listings() |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | global $xoopsDB, $xoopsModule; |
| 52 | 52 | xoops_cp_header(); |
| 53 | 53 | //adminmenu(0, _MD_A_MODADMIN_HOME); |
| 54 | - echo '<h4>' . _MD_LISTINGSCONF . '</h4>'; |
|
| 55 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . '<tr class="odd"><td>'; |
|
| 54 | + echo '<h4>'._MD_LISTINGSCONF.'</h4>'; |
|
| 55 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>".'<tr class="odd"><td>'; |
|
| 56 | 56 | //$result = $xoopsDB->query("select count(*) from ".$xoopsDB->prefix("efqdiralpha1_broken").""); |
| 57 | 57 | //list($totalbrokenlinks) = $xoopsDB->fetchRow($result); |
| 58 | - $result3 = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " WHERE status='1'"); |
|
| 58 | + $result3 = $xoopsDB->query('SELECT count(*) FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items')." WHERE status='1'"); |
|
| 59 | 59 | list($totalnewlistings) = $xoopsDB->fetchRow($result3); |
| 60 | 60 | if ($totalnewlistings > 0) { |
| 61 | 61 | $totalnewlistings = "<span style='color: #ff0000; font-weight: bold'>$totalnewlistings</span>"; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | // echo "<br><br>"; |
| 71 | 71 | // echo " - <a href=main.php?op=duplicateDataTypes>"._MD_DUPLICATE_DATATYPES."</a>"; |
| 72 | 72 | // echo "<br><br>"; |
| 73 | - $result = $xoopsDB->query('SELECT count(*) FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . ' WHERE status>0'); |
|
| 73 | + $result = $xoopsDB->query('SELECT count(*) FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items').' WHERE status>0'); |
|
| 74 | 74 | list($numrows) = $xoopsDB->fetchRow($result); |
| 75 | 75 | echo '<br /<div>'; |
| 76 | 76 | printf(_MD_THEREARE, $numrows); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | function listNewListings() //completed |
| 83 | 83 | { |
| 84 | 84 | global $xoopsDB, $xoopsModule, $xoopsConfig, $myts, $eh, $mytree, $mytree2, $moddir; |
| 85 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " i WHERE i.status='1'"; |
|
| 85 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items')." i WHERE i.status='1'"; |
|
| 86 | 86 | $result = $xoopsDB->query($sql, 10, 0); |
| 87 | 87 | $numrows = $xoopsDB->getRowsNum($result); |
| 88 | 88 | if ($numrows > 0) { |
@@ -90,25 +90,25 @@ discard block |
||
| 90 | 90 | $adminObject = \Xmf\Module\Admin::getInstance(); |
| 91 | 91 | $adminObject->displayNavigation('main.php?op=listNewListings'); |
| 92 | 92 | |
| 93 | - echo '<h4>' . _MD_LISTINGSCONF . '</h4>'; |
|
| 93 | + echo '<h4>'._MD_LISTINGSCONF.'</h4>'; |
|
| 94 | 94 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
| 95 | 95 | echo '<tr class="odd"><td>'; |
| 96 | - echo '<h4>' . _MD_LISTINGSWAITING . " ($numrows)</h4><br>"; |
|
| 96 | + echo '<h4>'._MD_LISTINGSWAITING." ($numrows)</h4><br>"; |
|
| 97 | 97 | echo '<table width="95%">'; |
| 98 | - echo '<tr><td align="left"nowrap><b>' . _MD_LISTINGTITLE . '</b></td>'; |
|
| 99 | - echo '<td align="left" nowrap><b>' . _MD_SUBMITTER . '</b></td><td align="left" nowrap><b>' . _MD_CREATED . '</b></td><td> </td></tr>'; |
|
| 98 | + echo '<tr><td align="left"nowrap><b>'._MD_LISTINGTITLE.'</b></td>'; |
|
| 99 | + echo '<td align="left" nowrap><b>'._MD_SUBMITTER.'</b></td><td align="left" nowrap><b>'._MD_CREATED.'</b></td><td> </td></tr>'; |
|
| 100 | 100 | while (list($itemid, $logourl, $submitterid, $status, $date, $title, $type) = $xoopsDB->fetchRow($result)) { |
| 101 | 101 | $title = $myts->htmlSpecialChars($title); |
| 102 | 102 | $submitter = XoopsUser::getUnameFromId($submitterid); |
| 103 | 103 | $created = formatTimestamp($date); |
| 104 | - echo "<tr><td>$title</td><td><a href=\"" . XOOPS_URL . "/userinfo.php?uid=$submitterid\">$submitter</a></td><td>$created</td><td valign=\"bottom\">"; |
|
| 105 | - echo '<a href="' . XOOPS_URL . '/modules/' . $moddir . "/admin/main.php?op=edit&item=$itemid\">" . _MD_EDIT . '</a>'; |
|
| 104 | + echo "<tr><td>$title</td><td><a href=\"".XOOPS_URL."/userinfo.php?uid=$submitterid\">$submitter</a></td><td>$created</td><td valign=\"bottom\">"; |
|
| 105 | + echo '<a href="'.XOOPS_URL.'/modules/'.$moddir."/admin/main.php?op=edit&item=$itemid\">"._MD_EDIT.'</a>'; |
|
| 106 | 106 | echo "</td></tr>\n"; |
| 107 | 107 | } |
| 108 | 108 | echo '</table></td></tr></table>'; |
| 109 | 109 | xoops_cp_footer(); |
| 110 | 110 | } else { |
| 111 | - redirect_header('' . XOOPS_URL . '/modules/' . $moddir . '/admin/main.php?op=listings', 1, _MD_NONEW_LISTINGS); |
|
| 111 | + redirect_header(''.XOOPS_URL.'/modules/'.$moddir.'/admin/main.php?op=listings', 1, _MD_NONEW_LISTINGS); |
|
| 112 | 112 | exit(); |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | global $xoopsDB, $_GET, $eh; |
| 119 | 119 | $rid = $_GET['rid']; |
| 120 | - $get_itemid = (int)$_GET['itemid']; |
|
| 120 | + $get_itemid = (int) $_GET['itemid']; |
|
| 121 | 121 | $sql = sprintf('DELETE FROM %s WHERE ratingid = %u', $xoopsDB->prefix('listings_votedata'), $rid); |
| 122 | 122 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 123 | 123 | updaterating($get_itemid); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $form = new XoopsThemeForm(_MD_CONFIRM_DELETELISTING_FORM, 'confirmform', 'main.php'); |
| 133 | 133 | $submit_tray = new XoopsFormElementTray(_MD_DELETEYN, '', 'cid'); |
| 134 | 134 | $submit_tray->addElement(new XoopsFormButton('', 'submit', _MD_DELETE, 'submit')); |
| 135 | - $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="' . _MD_CANCEL . "\" onclick=\"location='main.php?op=edit&item=$get_itemid'\"")); |
|
| 135 | + $submit_tray->addElement(new XoopsFormLabel('', '<input type="button" class="formButton" value="'._MD_CANCEL."\" onclick=\"location='main.php?op=edit&item=$get_itemid'\"")); |
|
| 136 | 136 | $form->addElement($submit_tray, true); |
| 137 | 137 | //$form->addElement($form_submit); |
| 138 | 138 | $form->addElement(new XoopsFormHidden('op', 'deleteListing')); |
@@ -144,18 +144,18 @@ discard block |
||
| 144 | 144 | function delListing() |
| 145 | 145 | { |
| 146 | 146 | global $xoopsDB, $eh, $xoopsModule; |
| 147 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 147 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items'), (int) $_POST['itemid']); //EDIT-RC10 |
|
| 148 | 148 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 149 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 149 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_text'), (int) $_POST['itemid']); //EDIT-RC10 |
|
| 150 | 150 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 151 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_img'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 151 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_img'), (int) $_POST['itemid']); //EDIT-RC10 |
|
| 152 | 152 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 153 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 153 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat'), (int) $_POST['itemid']); //EDIT-RC10 |
|
| 154 | 154 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 155 | - $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_loc'), (int)$_POST['itemid']);//EDIT-RC10 |
|
| 155 | + $sql = sprintf('DELETE FROM %s WHERE itemid = %u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_loc'), (int) $_POST['itemid']); //EDIT-RC10 |
|
| 156 | 156 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 157 | - xoops_comment_delete($xoopsModule->getVar('mid'), (int)$_POST['itemid']); |
|
| 158 | - xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'listing', (int)$_POST['itemid']); |
|
| 157 | + xoops_comment_delete($xoopsModule->getVar('mid'), (int) $_POST['itemid']); |
|
| 158 | + xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'listing', (int) $_POST['itemid']); |
|
| 159 | 159 | redirect_header('index.php', 1, _MD_LISTINGDELETED); |
| 160 | 160 | exit(); |
| 161 | 161 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | function approve() |
| 164 | 164 | { |
| 165 | 165 | global $xoopsConfig, $xoopsDB, $get_itemid, $eh; |
| 166 | - $query = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " set status='2' where itemid=" . $get_itemid . ''; |
|
| 166 | + $query = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items')." set status='2' where itemid=".$get_itemid.''; |
|
| 167 | 167 | $xoopsDB->queryF($query) or $eh->show('0013'); |
| 168 | 168 | redirect_header('main.php?op=listNewListings', 1, _MD_LISTINGAPPROVED); |
| 169 | 169 | } |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | function updateItemType() |
| 172 | 172 | { |
| 173 | 173 | global $xoopsConfig, $xoopsDB, $eh; |
| 174 | - $post_itemid = (int)$_POST['itemid']; |
|
| 175 | - $post_typeid = (int)$_POST['typeid']; |
|
| 176 | - $query = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET typeid='$post_typeid' WHERE itemid=" . $post_itemid . ''; |
|
| 174 | + $post_itemid = (int) $_POST['itemid']; |
|
| 175 | + $post_typeid = (int) $_POST['typeid']; |
|
| 176 | + $query = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items')." SET typeid='$post_typeid' WHERE itemid=".$post_itemid.''; |
|
| 177 | 177 | $xoopsDB->query($query) or $eh->show('0013'); |
| 178 | 178 | redirect_header("main.php?op=edit&item=$post_itemid", 2, _MD_ITEM_UPDATED); |
| 179 | 179 | } |
@@ -188,19 +188,19 @@ discard block |
||
| 188 | 188 | //adminmenu(-1, _MD_DUPLICATE_DATATYPES); |
| 189 | 189 | echo '<br>'; |
| 190 | 190 | $sql = 'SELECT dt1.dtypeid, dt1.title, dt1.fieldtypeid '; |
| 191 | - $sql .= 'FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' dt1, ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' dt2 '; |
|
| 191 | + $sql .= 'FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes').' dt1, '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes').' dt2 '; |
|
| 192 | 192 | $sql .= 'WHERE dt1.title=dt2.title AND dt1.fieldtypeid=dt2.fieldtypeid ORDER BY dt1.title ASC, dt1.fieldtypeid ASC'; |
| 193 | 193 | |
| 194 | 194 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 195 | 195 | $numrows = $xoopsDB->getRowsNum($result); |
| 196 | 196 | |
| 197 | 197 | if ($numrows > 0) { |
| 198 | - echo '<h4>' . _MD_DUPLICATE_DATATYPES . '</h4>'; |
|
| 198 | + echo '<h4>'._MD_DUPLICATE_DATATYPES.'</h4>'; |
|
| 199 | 199 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
| 200 | - echo '<tr><th>' . _MD_DTYPE . '</th><th>' . _MD_DTYPE_TITLE . '</th><th>' . _MD_FIELDTYPE . '</th></tr>'; |
|
| 200 | + echo '<tr><th>'._MD_DTYPE.'</th><th>'._MD_DTYPE_TITLE.'</th><th>'._MD_FIELDTYPE.'</th></tr>'; |
|
| 201 | 201 | while (list($dtypeid, $title, $fieldtypeid) = $xoopsDB->fetchRow($result)) { |
| 202 | 202 | $dtypetitle = $myts->htmlSpecialChars($title); |
| 203 | - $result_arr[] = $dtypeid . $dtypetitle . $fieldtypeid; |
|
| 203 | + $result_arr[] = $dtypeid.$dtypetitle.$fieldtypeid; |
|
| 204 | 204 | $result_array[] = array($dtypeid, $dtypetitle, $fieldtypeid); |
| 205 | 205 | } |
| 206 | 206 | $checkKeysUniqueComparison = create_function('$value', 'if ($value > 1) return true;'); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $merge = ''; |
| 218 | 218 | foreach ($result_array as $arr) { |
| 219 | 219 | $id = $arr[0]; |
| 220 | - $match[$id] = $arr[0] . $arr[1] . $arr[2]; |
|
| 220 | + $match[$id] = $arr[0].$arr[1].$arr[2]; |
|
| 221 | 221 | $test = array_pop($match); |
| 222 | 222 | $key_to_be_deleted = array_search($test, $duplicate_results); |
| 223 | 223 | |
@@ -230,22 +230,22 @@ discard block |
||
| 230 | 230 | if ($last_title == '' && $last_fieldtypeid == '0') { |
| 231 | 231 | $last_title = $arr[1]; |
| 232 | 232 | $last_fieldtypeid = $arr[2]; |
| 233 | - $merge .= $arr[0]; |
|
| 233 | + $merge .= $arr[0]; |
|
| 234 | 234 | } elseif ($arr[1] != $last_title && $arr[2] != $last_fieldtypeid) { |
| 235 | 235 | $last_title = $arr[1]; |
| 236 | 236 | $last_fieldtypeid = $arr[2]; |
| 237 | - $merge .= '|' . $arr[0]; |
|
| 237 | + $merge .= '|'.$arr[0]; |
|
| 238 | 238 | echo "<tr><td colspan='3'>"; |
| 239 | 239 | echo "<form action='main.php' method='post'>"; |
| 240 | 240 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
| 241 | - echo "<input type='button' class='formButton' action='submit' name='submit' id='submit' value='" . _MD_MERGE . '\''; |
|
| 241 | + echo "<input type='button' class='formButton' action='submit' name='submit' id='submit' value='"._MD_MERGE.'\''; |
|
| 242 | 242 | echo "<input type='hidden' name='merge' value='$merge'>"; |
| 243 | 243 | echo "<input type='hidden' name='op' value='mergeDuplicates'>"; |
| 244 | 244 | echo '</form>'; |
| 245 | 245 | echo '</td></tr>'; |
| 246 | 246 | $merge = ''; |
| 247 | 247 | } else { |
| 248 | - $merge .= '|' . $arr[0]; |
|
| 248 | + $merge .= '|'.$arr[0]; |
|
| 249 | 249 | } |
| 250 | 250 | unset($duplicate_results[$key_to_be_deleted]); |
| 251 | 251 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | echo "<tr><td colspan='3'>"; |
| 256 | 256 | echo "<form action='main.php' method='post'>"; |
| 257 | 257 | echo $GLOBALS['xoopsSecurity']->getTokenHTML(); |
| 258 | - echo "<input type='submit' class='formButton' action='submit' name='submit' id='submit' value='" . _MD_MERGE . '\''; |
|
| 258 | + echo "<input type='submit' class='formButton' action='submit' name='submit' id='submit' value='"._MD_MERGE.'\''; |
|
| 259 | 259 | echo "<input type='hidden' name='merge' value='$merge'>"; |
| 260 | 260 | echo "<input type='hidden' name='op' value='mergeDuplicates'>"; |
| 261 | 261 | echo '</form>'; |
@@ -279,15 +279,15 @@ discard block |
||
| 279 | 279 | $replacements_arr = array_slice($merge_arr, 1); |
| 280 | 280 | $replacements = ''; |
| 281 | 281 | foreach ($replacements_arr as $key => $value) { |
| 282 | - $replacements .= '\'' . $value . '\','; |
|
| 282 | + $replacements .= '\''.$value.'\','; |
|
| 283 | 283 | } |
| 284 | 284 | $length = strlen($replacements); |
| 285 | 285 | $replacements = substr($replacements, 0, $length - 1); |
| 286 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') . ' SET dtypeid=' . $merge_arr[0] . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 286 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat').' SET dtypeid='.$merge_arr[0].' WHERE dtypeid IN ('.$replacements.')'; |
|
| 287 | 287 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 288 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' SET dtypeid=' . $merge_arr[0] . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 288 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_data').' SET dtypeid='.$merge_arr[0].' WHERE dtypeid IN ('.$replacements.')'; |
|
| 289 | 289 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 290 | - $sql = 'DELETE FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') . ' WHERE dtypeid IN (' . $replacements . ')'; |
|
| 290 | + $sql = 'DELETE FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes').' WHERE dtypeid IN ('.$replacements.')'; |
|
| 291 | 291 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 292 | 292 | } else { |
| 293 | 293 | $merge = ''; |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | break; |
| 328 | 328 | case 'edit': |
| 329 | 329 | global $xoopsDB, $xoopsConfig, $myts, $eh, $efqtree, $moddir, $xoopsUser, $datafieldmanager, $subscription, $subscriptionhandler; |
| 330 | - $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid, t.description FROM ' |
|
| 331 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') |
|
| 330 | + $sql = 'SELECT i.itemid, i.logourl, i.uid, i.status, i.created, i.title, i.typeid, t.description FROM ' |
|
| 331 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items') |
|
| 332 | 332 | . ' i LEFT JOIN ' |
| 333 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') |
|
| 333 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_text') |
|
| 334 | 334 | . ' t ON (i.itemid=t.itemid) WHERE i.itemid=' |
| 335 | 335 | . $get_itemid |
| 336 | 336 | . ''; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | echo "<hr size='1'><br>"; |
| 342 | 342 | while (list($itemid, $logourl, $submitter, $status, $created, $itemtitle, $typeid, $description) = $xoopsDB->fetchRow($item_result)) { |
| 343 | 343 | if ($status == '1') { |
| 344 | - echo '<input type="button" value="' . _MD_APPROVE . "\" onclick=\"location='main.php?op=approve&item=$get_itemid'\"> "; |
|
| 344 | + echo '<input type="button" value="'._MD_APPROVE."\" onclick=\"location='main.php?op=approve&item=$get_itemid'\"> "; |
|
| 345 | 345 | } |
| 346 | 346 | echo ' <input type="button" value="' |
| 347 | 347 | . _MD_DELETE |
@@ -353,18 +353,18 @@ discard block |
||
| 353 | 353 | . $moddir |
| 354 | 354 | . "/listing.php?item=$get_itemid'\"><br><br>"; |
| 355 | 355 | |
| 356 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value, d.customtitle, t.custom '; |
|
| 357 | - $sql .= 'FROM ' |
|
| 358 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 356 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value, d.customtitle, t.custom '; |
|
| 357 | + $sql .= 'FROM ' |
|
| 358 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat') |
|
| 359 | 359 | . ' ic, ' |
| 360 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 360 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 361 | 361 | . ' xc, ' |
| 362 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 362 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes') |
|
| 363 | 363 | . ' f, ' |
| 364 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 364 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 365 | 365 | . ' t '; |
| 366 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $get_itemid . ') '; |
|
| 367 | - $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=" . $get_itemid . ''; |
|
| 366 | + $sql .= 'LEFT JOIN '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_data').' d ON (t.dtypeid=d.dtypeid AND d.itemid='.$get_itemid.') '; |
|
| 367 | + $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=".$get_itemid.''; |
|
| 368 | 368 | $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 369 | 369 | $numrows = $xoopsDB->getRowsNum($data_result); |
| 370 | 370 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $submitter = !empty($xoopsUser) ? $xoopsUser->getVar('uid') : 0; |
| 412 | 412 | |
| 413 | 413 | if (!empty($_POST['itemid'])) { |
| 414 | - $post_itemid = (int)$_POST['itemid']; |
|
| 414 | + $post_itemid = (int) $_POST['itemid']; |
|
| 415 | 415 | } else { |
| 416 | 416 | redirect_header('index.php', 2, _MD_NOVALIDITEM); |
| 417 | 417 | exit(); |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | $p_ini_title = $_POST['ini_itemtitle']; |
| 422 | 422 | if ($p_title != $p_ini_title) { |
| 423 | 423 | //If the posted title is different from the initial title the record should be updated. |
| 424 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_items') . " SET title = '$p_title' WHERE itemid = $post_itemid"; |
|
| 424 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_items')." SET title = '$p_title' WHERE itemid = $post_itemid"; |
|
| 425 | 425 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 426 | 426 | } |
| 427 | 427 | } else { |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | exit(); |
| 430 | 430 | } |
| 431 | 431 | if (!empty($_POST['dirid'])) { |
| 432 | - $post_dirid = (int)$_POST['dirid']; |
|
| 432 | + $post_dirid = (int) $_POST['dirid']; |
|
| 433 | 433 | } else { |
| 434 | 434 | $post_dirid = 0; |
| 435 | 435 | } |
@@ -446,28 +446,28 @@ discard block |
||
| 446 | 446 | if (isset($_POST['description_set'])) { |
| 447 | 447 | if ($_POST['description_set'] == '1') { |
| 448 | 448 | if ($p_ini_description != $p_description) { |
| 449 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text') . " SET description = '$p_description' WHERE itemid = $post_itemid"; |
|
| 449 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_text')." SET description = '$p_description' WHERE itemid = $post_itemid"; |
|
| 450 | 450 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 451 | 451 | } |
| 452 | 452 | } elseif (isset($_POST['description']) && $_POST['description'] != '') { |
| 453 | 453 | if ($p_description != null) { |
| 454 | - $sql = sprintf("INSERT INTO %s (itemid, description) VALUES (%u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_text'), $post_itemid, $p_description); |
|
| 454 | + $sql = sprintf("INSERT INTO %s (itemid, description) VALUES (%u, '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_text'), $post_itemid, $p_description); |
|
| 455 | 455 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | } |
| 459 | - $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value '; |
|
| 460 | - $sql .= 'FROM ' |
|
| 461 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') |
|
| 459 | + $sql = 'SELECT DISTINCT t.dtypeid, t.title, t.section, f.typeid, f.fieldtype, f.ext, t.options, d.itemid, d.value '; |
|
| 460 | + $sql .= 'FROM ' |
|
| 461 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat') |
|
| 462 | 462 | . ' ic, ' |
| 463 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes_x_cat') |
|
| 463 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes_x_cat') |
|
| 464 | 464 | . ' xc, ' |
| 465 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_fieldtypes') |
|
| 465 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_fieldtypes') |
|
| 466 | 466 | . ' f, ' |
| 467 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_dtypes') |
|
| 467 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_dtypes') |
|
| 468 | 468 | . ' t '; |
| 469 | - $sql .= 'LEFT JOIN ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . ' d ON (t.dtypeid=d.dtypeid AND d.itemid=' . $post_itemid . ') '; |
|
| 470 | - $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND ic.itemid=" . $post_itemid . ''; |
|
| 469 | + $sql .= 'LEFT JOIN '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_data').' d ON (t.dtypeid=d.dtypeid AND d.itemid='.$post_itemid.') '; |
|
| 470 | + $sql .= "WHERE ic.cid=xc.cid AND ic.active='1' AND xc.dtypeid=t.dtypeid AND t.fieldtypeid=f.typeid AND ic.itemid=".$post_itemid.''; |
|
| 471 | 471 | $data_result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 472 | 472 | $numrows = $xoopsDB->getRowsNum($data_result); |
| 473 | 473 | while (list($dtypeid, $title, $section, $ftypeid, $fieldtype, $ext, $options, $itemid, $value) = $xoopsDB->fetchRow($data_result)) { |
@@ -481,8 +481,8 @@ discard block |
||
| 481 | 481 | $post_value = ''; |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - if (isset($_POST['custom' . $dtypeid . ''])) { |
|
| 485 | - $post_customtitle = $myts->makeTboxData4Save($_POST['custom' . $dtypeid . '']); |
|
| 484 | + if (isset($_POST['custom'.$dtypeid.''])) { |
|
| 485 | + $post_customtitle = $myts->makeTboxData4Save($_POST['custom'.$dtypeid.'']); |
|
| 486 | 486 | } else { |
| 487 | 487 | $post_customtitle = ''; |
| 488 | 488 | } |
@@ -490,9 +490,9 @@ discard block |
||
| 490 | 490 | $addressfields = array('address', 'address2', 'zip', 'postcode', 'phone', 'lat', 'lon', 'phone', 'fax', 'mobile', 'city', 'country', 'uselocyn', 'main', 'active'); |
| 491 | 491 | foreach ($addressfields as $field) { |
| 492 | 492 | if (isset($_POST["$dtypeid$field"])) { |
| 493 | - ${'post_' . $field} = $myts->makeTboxData4Save($_POST["$dtypeid$field"]); |
|
| 493 | + ${'post_'.$field} = $myts->makeTboxData4Save($_POST["$dtypeid$field"]); |
|
| 494 | 494 | } else { |
| 495 | - ${'post_' . $field} = ''; |
|
| 495 | + ${'post_'.$field} = ''; |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | //INSERT OF UPDATE address |
@@ -500,16 +500,16 @@ discard block |
||
| 500 | 500 | if (isset($_POST['submitaddress'])) { |
| 501 | 501 | if ($itemid == null || $post_value == '') { |
| 502 | 502 | //That means there was not any value, so a new record should be added to the data table. |
| 503 | - $newaddrid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') . '_addrid_seq'); |
|
| 503 | + $newaddrid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_addresses').'_addrid_seq'); |
|
| 504 | 504 | $sql = sprintf("INSERT INTO %s (addrid, itemid, dtypeid, address, address2, zip, postcode, phone, lat, lon, main, active, fax, mobile, city, country) VALUES (%u, %u, %u, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %u, %u, '%s', '%s', '%s', '%s')", |
| 505 | - $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses'), $newaddrid, $post_itemid, $dtypeid, $post_address, $post_address2, $post_zip, $post_postcode, $post_phone, $post_lat, $post_lon, $post_main, $post_active, $post_fax, $post_mobile, |
|
| 505 | + $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_addresses'), $newaddrid, $post_itemid, $dtypeid, $post_address, $post_address2, $post_zip, $post_postcode, $post_phone, $post_lat, $post_lon, $post_main, $post_active, $post_fax, $post_mobile, |
|
| 506 | 506 | $post_city, $post_country); |
| 507 | 507 | //echo $sql."<br><br>"; |
| 508 | 508 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 509 | 509 | $post_value = $xoopsDB->getInsertId(); |
| 510 | 510 | } else { |
| 511 | 511 | $sql = 'UPDATE ' |
| 512 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_addresses') |
|
| 512 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_addresses') |
|
| 513 | 513 | . " SET address = '$post_address', address2 = '$post_address2', zip = '$post_zip', postcode = '$post_postcode', lat = '$post_lat', lon = '$post_lon', main = '$post_main', active = '$post_active', fax = '$post_fax', mobile = '$post_mobile', city = '$post_city', country = '$post_country' WHERE addrid = '$post_value' AND itemid = '$post_itemid'"; |
| 514 | 514 | //echo $sql."<br><br>"; |
| 515 | 515 | $xoopsDB->query($sql) or $eh->show('0013'); |
@@ -518,12 +518,12 @@ discard block |
||
| 518 | 518 | } |
| 519 | 519 | if ($itemid == null) { |
| 520 | 520 | //That means there was not any value, so a new record should be added to the data table. |
| 521 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . '_dataid_seq'); |
|
| 522 | - $sql = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data'), $newid, $post_itemid, $dtypeid, $post_value, time()); |
|
| 521 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_data').'_dataid_seq'); |
|
| 522 | + $sql = sprintf("INSERT INTO %s (dataid, itemid, dtypeid, VALUE, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_data'), $newid, $post_itemid, $dtypeid, $post_value, time()); |
|
| 523 | 523 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 524 | 524 | } else { |
| 525 | 525 | if ($value != $post_value) { |
| 526 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_data') . " SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid"; |
|
| 526 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_data')." SET value = '$post_value' WHERE dtypeid = $dtypeid AND itemid = $itemid"; |
|
| 527 | 527 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 528 | 528 | } |
| 529 | 529 | } |
@@ -532,34 +532,34 @@ discard block |
||
| 532 | 532 | $efqlisting = new efqListing(); |
| 533 | 533 | $efqlistinghandler = new efqListingHandler(); |
| 534 | 534 | $linkedcats = $efqlistinghandler->getLinkedCatsArray($post_itemid, $post_dirid); |
| 535 | - $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE dirid='" . $post_dirid . '\' AND active=\'1\''; |
|
| 535 | + $sql = 'SELECT cid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." WHERE dirid='".$post_dirid.'\' AND active=\'1\''; |
|
| 536 | 536 | $allcatsresult = $xoopsDB->query($sql); |
| 537 | 537 | |
| 538 | 538 | $numrows = $xoopsDB->getRowsNum($allcatsresult); |
| 539 | 539 | $count = 0; |
| 540 | 540 | if ($numrows > 0) { |
| 541 | 541 | while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
| 542 | - if (isset($_POST['selected' . $cid . ''])) { |
|
| 542 | + if (isset($_POST['selected'.$cid.''])) { |
|
| 543 | 543 | if (!in_array($cid, $linkedcats)) { |
| 544 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 545 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cid, $post_itemid, 1, time()); |
|
| 544 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat').'_xid_seq'); |
|
| 545 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat'), $newid, $cid, $post_itemid, 1, time()); |
|
| 546 | 546 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | ++$count; |
| 550 | 550 | } else { |
| 551 | 551 | if (in_array($cid, $linkedcats)) { |
| 552 | - $sql = sprintf('DELETE FROM %s WHERE cid=%u AND itemid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $cid, $post_itemid); |
|
| 552 | + $sql = sprintf('DELETE FROM %s WHERE cid=%u AND itemid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat'), $cid, $post_itemid); |
|
| 553 | 553 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 554 | 554 | } |
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | if ($count == 0) { |
| 558 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORYMATCH); |
|
| 558 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/main.php?op=edit&item=".$post_itemid.'', 2, _MD_NOCATEGORYMATCH); |
|
| 559 | 559 | exit(); |
| 560 | 560 | } |
| 561 | 561 | } else { |
| 562 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/main.php?op=edit&item=" . $post_itemid . '', 2, _MD_NOCATEGORIESAVAILABLE); |
|
| 562 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/main.php?op=edit&item=".$post_itemid.'', 2, _MD_NOCATEGORIESAVAILABLE); |
|
| 563 | 563 | exit(); |
| 564 | 564 | } |
| 565 | 565 | |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | * @version $Id $ |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | -require_once __DIR__ . '/admin_header.php'; |
|
| 21 | +require_once __DIR__.'/admin_header.php'; |
|
| 22 | 22 | xoops_cp_header(); |
| 23 | 23 | |
| 24 | 24 | $adminObject->displayNavigation(basename(__FILE__)); |
| 25 | 25 | $adminObject->setPaypal('[email protected]'); |
| 26 | 26 | $adminObject->displayAbout(false); |
| 27 | 27 | |
| 28 | -require_once __DIR__ . '/admin_footer.php'; |
|
| 28 | +require_once __DIR__.'/admin_footer.php'; |
|
@@ -35,95 +35,95 @@ |
||
| 35 | 35 | $moddir = $xoopsModule->getVar('dirname'); |
| 36 | 36 | |
| 37 | 37 | if (isset($_GET['item'])) { |
| 38 | - $get_itemid = (int)$_GET['item']; |
|
| 38 | + $get_itemid = (int)$_GET['item']; |
|
| 39 | 39 | } |
| 40 | 40 | if (isset($_POST['item'])) { |
| 41 | - $post_itemid = (int)$_POST['item']; |
|
| 41 | + $post_itemid = (int)$_POST['item']; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (isset($_POST['dirid'])) { |
| 45 | - $post_dirid = (int)$_POST['dirid']; |
|
| 45 | + $post_dirid = (int)$_POST['dirid']; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $eh = new ErrorHandler; //ErrorHandler object |
| 49 | 49 | |
| 50 | 50 | if (isset($_GET['op'])) { |
| 51 | - $op = $_GET['op']; |
|
| 51 | + $op = $_GET['op']; |
|
| 52 | 52 | } elseif (isset($_POST['op'])) { |
| 53 | - $op = $_POST['op']; |
|
| 53 | + $op = $_POST['op']; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if (!empty($_POST['submit'])) { |
| 57 | - //Get all selectable categories and put the prefix 'selectcat' in front of the catid. |
|
| 58 | - //With all results check if the result has a corresponding $_POST value. |
|
| 59 | - $dirid = getDirIdFromItem($post_itemid); |
|
| 60 | - $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " WHERE itemid='" . $post_itemid . '\''; |
|
| 61 | - $allitemcatsresult = $xoopsDB->query($sql); |
|
| 62 | - $numrows = $xoopsDB->getRowsNum($allitemcatsresult); |
|
| 63 | - $count = 0; |
|
| 64 | - $allitemcats = array(); |
|
| 65 | - if ($numrows > 0) { |
|
| 66 | - while (list($cid) = $xoopsDB->fetchRow($allitemcatsresult)) { |
|
| 67 | - $allitemcats[] = $cid; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - $activeitemcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " WHERE itemid='" . $post_itemid . '\' AND active=\'1\''); |
|
| 71 | - $numrows = $xoopsDB->getRowsNum($activeitemcatsresult); |
|
| 72 | - $count = 0; |
|
| 73 | - $activeitemcats = array(); |
|
| 74 | - if ($numrows > 0) { |
|
| 75 | - while (list($cid) = $xoopsDB->fetchRow($activeitemcatsresult)) { |
|
| 76 | - $activeitemcats[] = $cid; |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - $allcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE active='1'"); |
|
| 80 | - $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
| 81 | - $allcats = array(); |
|
| 82 | - $postedcats = array(); |
|
| 83 | - if ($numrows > 0) { |
|
| 84 | - while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
| 85 | - $allcats[] = $cid; |
|
| 86 | - if (isset($_POST['selected' . $cid . ''])) { |
|
| 87 | - $postedcats[] = $cid; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - } |
|
| 91 | - //$inactivatecats is determined by the difference between posted cats and itemcats. |
|
| 92 | - //$nonpostedcats = array_diff($postedcats, $allitemcats); |
|
| 57 | + //Get all selectable categories and put the prefix 'selectcat' in front of the catid. |
|
| 58 | + //With all results check if the result has a corresponding $_POST value. |
|
| 59 | + $dirid = getDirIdFromItem($post_itemid); |
|
| 60 | + $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " WHERE itemid='" . $post_itemid . '\''; |
|
| 61 | + $allitemcatsresult = $xoopsDB->query($sql); |
|
| 62 | + $numrows = $xoopsDB->getRowsNum($allitemcatsresult); |
|
| 63 | + $count = 0; |
|
| 64 | + $allitemcats = array(); |
|
| 65 | + if ($numrows > 0) { |
|
| 66 | + while (list($cid) = $xoopsDB->fetchRow($allitemcatsresult)) { |
|
| 67 | + $allitemcats[] = $cid; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + $activeitemcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " WHERE itemid='" . $post_itemid . '\' AND active=\'1\''); |
|
| 71 | + $numrows = $xoopsDB->getRowsNum($activeitemcatsresult); |
|
| 72 | + $count = 0; |
|
| 73 | + $activeitemcats = array(); |
|
| 74 | + if ($numrows > 0) { |
|
| 75 | + while (list($cid) = $xoopsDB->fetchRow($activeitemcatsresult)) { |
|
| 76 | + $activeitemcats[] = $cid; |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + $allcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE active='1'"); |
|
| 80 | + $numrows = $xoopsDB->getRowsNum($allcatsresult); |
|
| 81 | + $allcats = array(); |
|
| 82 | + $postedcats = array(); |
|
| 83 | + if ($numrows > 0) { |
|
| 84 | + while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
|
| 85 | + $allcats[] = $cid; |
|
| 86 | + if (isset($_POST['selected' . $cid . ''])) { |
|
| 87 | + $postedcats[] = $cid; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + } |
|
| 91 | + //$inactivatecats is determined by the difference between posted cats and itemcats. |
|
| 92 | + //$nonpostedcats = array_diff($postedcats, $allitemcats); |
|
| 93 | 93 | |
| 94 | - //Update these categories to inactive |
|
| 95 | - foreach ($postedcats as $cat) { |
|
| 96 | - if (!in_array($cat, $allitemcats)) { |
|
| 97 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 98 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cat, $post_itemid, 1, time()); |
|
| 99 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 100 | - } elseif (!in_array($cat, $activeitemcats)) { |
|
| 101 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " SET active = '1' WHERE itemid = '" . $post_itemid . '\' AND cid=\'' . $cat . '\''; |
|
| 102 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - foreach ($allitemcats as $cat) { |
|
| 106 | - if (!in_array($cat, $postedcats)) { |
|
| 107 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " SET active = '0' WHERE itemid = '" . $post_itemid . '\' AND cid=\'' . $cat . '\''; |
|
| 108 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/editcategories.php?item=" . $post_itemid . '', 2, _MD_CATEGORIES_UPDATED); |
|
| 112 | - exit(); |
|
| 94 | + //Update these categories to inactive |
|
| 95 | + foreach ($postedcats as $cat) { |
|
| 96 | + if (!in_array($cat, $allitemcats)) { |
|
| 97 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 98 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cat, $post_itemid, 1, time()); |
|
| 99 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 100 | + } elseif (!in_array($cat, $activeitemcats)) { |
|
| 101 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " SET active = '1' WHERE itemid = '" . $post_itemid . '\' AND cid=\'' . $cat . '\''; |
|
| 102 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + foreach ($allitemcats as $cat) { |
|
| 106 | + if (!in_array($cat, $postedcats)) { |
|
| 107 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " SET active = '0' WHERE itemid = '" . $post_itemid . '\' AND cid=\'' . $cat . '\''; |
|
| 108 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/editcategories.php?item=" . $post_itemid . '', 2, _MD_CATEGORIES_UPDATED); |
|
| 112 | + exit(); |
|
| 113 | 113 | } else { |
| 114 | - xoops_cp_header(); |
|
| 115 | - $dirid = getDirIdFromItem($get_itemid); |
|
| 116 | - //Query datatypes that match the cargories selected. If not category selected. |
|
| 117 | - $form = new XoopsThemeForm(_MD_SELECTCAT_FORM, 'submitform', 'editcategories.php'); |
|
| 118 | - $form->setExtra('enctype="multipart/form-data"'); |
|
| 119 | - $category_tray = new XoopsFormElementTray(_MD_CATEGORIES, '', 'cid'); |
|
| 120 | - $catselarea = getCatSelectArea($dirid); |
|
| 121 | - $category_tray->addElement(new XoopsFormLabel('', $catselarea)); |
|
| 122 | - $form->addElement($category_tray, true); |
|
| 123 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 124 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 125 | - $form->addElement(new XoopsFormHidden('item', $get_itemid)); |
|
| 126 | - $form->addElement(new XoopsFormHidden('dirid', $dirid)); |
|
| 127 | - $form->display(); |
|
| 128 | - xoops_cp_footer(); |
|
| 114 | + xoops_cp_header(); |
|
| 115 | + $dirid = getDirIdFromItem($get_itemid); |
|
| 116 | + //Query datatypes that match the cargories selected. If not category selected. |
|
| 117 | + $form = new XoopsThemeForm(_MD_SELECTCAT_FORM, 'submitform', 'editcategories.php'); |
|
| 118 | + $form->setExtra('enctype="multipart/form-data"'); |
|
| 119 | + $category_tray = new XoopsFormElementTray(_MD_CATEGORIES, '', 'cid'); |
|
| 120 | + $catselarea = getCatSelectArea($dirid); |
|
| 121 | + $category_tray->addElement(new XoopsFormLabel('', $catselarea)); |
|
| 122 | + $form->addElement($category_tray, true); |
|
| 123 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 124 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 125 | + $form->addElement(new XoopsFormHidden('item', $get_itemid)); |
|
| 126 | + $form->addElement(new XoopsFormHidden('dirid', $dirid)); |
|
| 127 | + $form->display(); |
|
| 128 | + xoops_cp_footer(); |
|
| 129 | 129 | } |
@@ -18,31 +18,31 @@ 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/xoopslists.php'; |
|
| 27 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
| 28 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 29 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 24 | +include __DIR__.'/../include/functions.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 27 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 28 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 29 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 30 | 30 | $myts = MyTextSanitizer::getInstance(); |
| 31 | 31 | $eh = new ErrorHandler; |
| 32 | -$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat'), 'cid', 'pid'); |
|
| 33 | -require_once __DIR__ . '/../class/class.datafieldmanager.php'; |
|
| 32 | +$mytree = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat'), 'cid', 'pid'); |
|
| 33 | +require_once __DIR__.'/../class/class.datafieldmanager.php'; |
|
| 34 | 34 | $datafieldmanager = new efqDataFieldManager(); |
| 35 | 35 | $moddir = $xoopsModule->getVar('dirname'); |
| 36 | 36 | |
| 37 | 37 | if (isset($_GET['item'])) { |
| 38 | - $get_itemid = (int)$_GET['item']; |
|
| 38 | + $get_itemid = (int) $_GET['item']; |
|
| 39 | 39 | } |
| 40 | 40 | if (isset($_POST['item'])) { |
| 41 | - $post_itemid = (int)$_POST['item']; |
|
| 41 | + $post_itemid = (int) $_POST['item']; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | if (isset($_POST['dirid'])) { |
| 45 | - $post_dirid = (int)$_POST['dirid']; |
|
| 45 | + $post_dirid = (int) $_POST['dirid']; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $eh = new ErrorHandler; //ErrorHandler object |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | //Get all selectable categories and put the prefix 'selectcat' in front of the catid. |
| 58 | 58 | //With all results check if the result has a corresponding $_POST value. |
| 59 | 59 | $dirid = getDirIdFromItem($post_itemid); |
| 60 | - $sql = 'SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " WHERE itemid='" . $post_itemid . '\''; |
|
| 60 | + $sql = 'SELECT cid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat')." WHERE itemid='".$post_itemid.'\''; |
|
| 61 | 61 | $allitemcatsresult = $xoopsDB->query($sql); |
| 62 | 62 | $numrows = $xoopsDB->getRowsNum($allitemcatsresult); |
| 63 | 63 | $count = 0; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $allitemcats[] = $cid; |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - $activeitemcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " WHERE itemid='" . $post_itemid . '\' AND active=\'1\''); |
|
| 70 | + $activeitemcatsresult = $xoopsDB->query('SELECT cid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat')." WHERE itemid='".$post_itemid.'\' AND active=\'1\''); |
|
| 71 | 71 | $numrows = $xoopsDB->getRowsNum($activeitemcatsresult); |
| 72 | 72 | $count = 0; |
| 73 | 73 | $activeitemcats = array(); |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | $activeitemcats[] = $cid; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | - $allcatsresult = $xoopsDB->query('SELECT cid FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_cat') . " WHERE active='1'"); |
|
| 79 | + $allcatsresult = $xoopsDB->query('SELECT cid FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_cat')." WHERE active='1'"); |
|
| 80 | 80 | $numrows = $xoopsDB->getRowsNum($allcatsresult); |
| 81 | 81 | $allcats = array(); |
| 82 | 82 | $postedcats = array(); |
| 83 | 83 | if ($numrows > 0) { |
| 84 | 84 | while (list($cid) = $xoopsDB->fetchRow($allcatsresult)) { |
| 85 | 85 | $allcats[] = $cid; |
| 86 | - if (isset($_POST['selected' . $cid . ''])) { |
|
| 86 | + if (isset($_POST['selected'.$cid.''])) { |
|
| 87 | 87 | $postedcats[] = $cid; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -94,21 +94,21 @@ discard block |
||
| 94 | 94 | //Update these categories to inactive |
| 95 | 95 | foreach ($postedcats as $cat) { |
| 96 | 96 | if (!in_array($cat, $allitemcats)) { |
| 97 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . '_xid_seq'); |
|
| 98 | - $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat'), $newid, $cat, $post_itemid, 1, time()); |
|
| 97 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat').'_xid_seq'); |
|
| 98 | + $sql = sprintf("INSERT INTO %s (xid, cid, itemid, active, created) VALUES (%u, %u, %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat'), $newid, $cat, $post_itemid, 1, time()); |
|
| 99 | 99 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 100 | 100 | } elseif (!in_array($cat, $activeitemcats)) { |
| 101 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " SET active = '1' WHERE itemid = '" . $post_itemid . '\' AND cid=\'' . $cat . '\''; |
|
| 101 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat')." SET active = '1' WHERE itemid = '".$post_itemid.'\' AND cid=\''.$cat.'\''; |
|
| 102 | 102 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | foreach ($allitemcats as $cat) { |
| 106 | 106 | if (!in_array($cat, $postedcats)) { |
| 107 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_item_x_cat') . " SET active = '0' WHERE itemid = '" . $post_itemid . '\' AND cid=\'' . $cat . '\''; |
|
| 107 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_item_x_cat')." SET active = '0' WHERE itemid = '".$post_itemid.'\' AND cid=\''.$cat.'\''; |
|
| 108 | 108 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/editcategories.php?item=" . $post_itemid . '', 2, _MD_CATEGORIES_UPDATED); |
|
| 111 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/editcategories.php?item=".$post_itemid.'', 2, _MD_CATEGORIES_UPDATED); |
|
| 112 | 112 | exit(); |
| 113 | 113 | } else { |
| 114 | 114 | xoops_cp_header(); |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | // ------------------------------------------------------------------------- // |
| 32 | 32 | include __DIR__ . '/../../../include/cp_header.php'; |
| 33 | 33 | if (file_exists(__DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php')) { |
| 34 | - include __DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 34 | + include __DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 35 | 35 | } else { |
| 36 | - include __DIR__ . '/../language/english/main.php'; |
|
| 36 | + include __DIR__ . '/../language/english/main.php'; |
|
| 37 | 37 | } |
| 38 | 38 | include __DIR__ . '/../include/functions.php'; |
| 39 | 39 | include __DIR__ . '/../class/class.fieldtype.php'; |
@@ -48,74 +48,74 @@ discard block |
||
| 48 | 48 | $moddir = $xoopsModule->getVar('dirname'); |
| 49 | 49 | |
| 50 | 50 | if (isset($_GET['dirid'])) { |
| 51 | - $get_dir = (int)$_GET['dirid']; |
|
| 51 | + $get_dir = (int)$_GET['dirid']; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function xdirConfig() |
| 55 | 55 | { |
| 56 | - global $xoopsDB, $xoopsModule, $xoopsUser, $myts, $moddir; |
|
| 57 | - xoops_cp_header(); |
|
| 58 | - adminmenu(0, _MD_A_DIRADMIN); |
|
| 59 | - echo '<h4>' . _MD_MIGRATE_FROM_XDIR . '</h4>'; |
|
| 60 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 61 | - $form = new XoopsThemeForm(_MD_XIDR_MIGRATE_TO_NEWDIR, 'submitform', 'xdir_migrate.php'); |
|
| 62 | - $form->addElement(new XoopsFormText(_MD_DIRNAME, 'dirname', 100, 150, ''), true); |
|
| 63 | - $form_diropen = new XoopsFormCheckBox(_MD_OPENYN, 'open', 0); |
|
| 64 | - $form_diropen->addOption(1, _MD_YESNO); |
|
| 65 | - $form->addElement($form_diropen); |
|
| 66 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 67 | - $form->addElement(new XoopsFormHidden('op', 'newdir')); |
|
| 68 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 69 | - $form->display(); |
|
| 70 | - echo '</td></tr></table>'; |
|
| 71 | - xoops_cp_footer(); |
|
| 56 | + global $xoopsDB, $xoopsModule, $xoopsUser, $myts, $moddir; |
|
| 57 | + xoops_cp_header(); |
|
| 58 | + adminmenu(0, _MD_A_DIRADMIN); |
|
| 59 | + echo '<h4>' . _MD_MIGRATE_FROM_XDIR . '</h4>'; |
|
| 60 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 61 | + $form = new XoopsThemeForm(_MD_XIDR_MIGRATE_TO_NEWDIR, 'submitform', 'xdir_migrate.php'); |
|
| 62 | + $form->addElement(new XoopsFormText(_MD_DIRNAME, 'dirname', 100, 150, ''), true); |
|
| 63 | + $form_diropen = new XoopsFormCheckBox(_MD_OPENYN, 'open', 0); |
|
| 64 | + $form_diropen->addOption(1, _MD_YESNO); |
|
| 65 | + $form->addElement($form_diropen); |
|
| 66 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 67 | + $form->addElement(new XoopsFormHidden('op', 'newdir')); |
|
| 68 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 69 | + $form->display(); |
|
| 70 | + echo '</td></tr></table>'; |
|
| 71 | + xoops_cp_footer(); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | function newDir() |
| 75 | 75 | { |
| 76 | - global $xoopsDB, $_POST, $myts, $eh; |
|
| 77 | - if (isset($_POST['dirname']) and $_POST['dirname'] !== '') { |
|
| 78 | - $p_dirname = $_POST['dirname']; |
|
| 79 | - } else { |
|
| 80 | - redirect_header("directories.php?op=moddir&dirid=$db_dirid", 2, _MD_XDIR_CREATE_EMPTY_DIR); |
|
| 81 | - } |
|
| 82 | - if (isset($_POST['open'])) { |
|
| 83 | - $p_open = $_POST['open']; |
|
| 84 | - } else { |
|
| 85 | - $p_open = 0; |
|
| 86 | - } |
|
| 87 | - $directory = new efqDirectory; |
|
| 88 | - $directory->setVar('name', $p_dirname); |
|
| 89 | - $directory->setVar('open', $p_open); |
|
| 90 | - $directoryHandler = new efqDirectoryHandler; |
|
| 91 | - $directoryHandler->insertDirectory($directory); |
|
| 92 | - $db_dirid = $directory->getVar('dirid'); |
|
| 76 | + global $xoopsDB, $_POST, $myts, $eh; |
|
| 77 | + if (isset($_POST['dirname']) and $_POST['dirname'] !== '') { |
|
| 78 | + $p_dirname = $_POST['dirname']; |
|
| 79 | + } else { |
|
| 80 | + redirect_header("directories.php?op=moddir&dirid=$db_dirid", 2, _MD_XDIR_CREATE_EMPTY_DIR); |
|
| 81 | + } |
|
| 82 | + if (isset($_POST['open'])) { |
|
| 83 | + $p_open = $_POST['open']; |
|
| 84 | + } else { |
|
| 85 | + $p_open = 0; |
|
| 86 | + } |
|
| 87 | + $directory = new efqDirectory; |
|
| 88 | + $directory->setVar('name', $p_dirname); |
|
| 89 | + $directory->setVar('open', $p_open); |
|
| 90 | + $directoryHandler = new efqDirectoryHandler; |
|
| 91 | + $directoryHandler->insertDirectory($directory); |
|
| 92 | + $db_dirid = $directory->getVar('dirid'); |
|
| 93 | 93 | |
| 94 | - if ($db_dirid > 0) { |
|
| 95 | - $xdirHandler = new efqXdirHandler(); |
|
| 96 | - $xdirHandler->doMigrate($db_dirid); |
|
| 97 | - $migration_errors = $xdirHandler->get_errors(); |
|
| 98 | - if (count($migration_errors) > 0) { |
|
| 99 | - redirect_header('xdir_migrate.php', 2, _MD_XDIR_MIGRATION_FAILED); |
|
| 100 | - } else { |
|
| 101 | - redirect_header('directories.php?op=moddir&dirid=' . $db_dirid, 2, _MD_XDIR_MIGRATION_COMPLETED); |
|
| 102 | - } |
|
| 103 | - } else { |
|
| 104 | - redirect_header('xdir_migrate.php', 2, _MD_XDIR_MIGRATION_FAILED); |
|
| 105 | - } |
|
| 94 | + if ($db_dirid > 0) { |
|
| 95 | + $xdirHandler = new efqXdirHandler(); |
|
| 96 | + $xdirHandler->doMigrate($db_dirid); |
|
| 97 | + $migration_errors = $xdirHandler->get_errors(); |
|
| 98 | + if (count($migration_errors) > 0) { |
|
| 99 | + redirect_header('xdir_migrate.php', 2, _MD_XDIR_MIGRATION_FAILED); |
|
| 100 | + } else { |
|
| 101 | + redirect_header('directories.php?op=moddir&dirid=' . $db_dirid, 2, _MD_XDIR_MIGRATION_COMPLETED); |
|
| 102 | + } |
|
| 103 | + } else { |
|
| 104 | + redirect_header('xdir_migrate.php', 2, _MD_XDIR_MIGRATION_FAILED); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if (!isset($_POST['op'])) { |
| 109 | - $op = isset($_GET['op']) ? $_GET['op'] : 'dirConfig'; |
|
| 109 | + $op = isset($_GET['op']) ? $_GET['op'] : 'dirConfig'; |
|
| 110 | 110 | } else { |
| 111 | - $op = $_POST['op']; |
|
| 111 | + $op = $_POST['op']; |
|
| 112 | 112 | } |
| 113 | 113 | switch ($op) { |
| 114 | 114 | |
| 115 | - case 'newdir': |
|
| 116 | - newDir(); |
|
| 117 | - break; |
|
| 118 | - default: |
|
| 119 | - xdirConfig(); |
|
| 120 | - break; |
|
| 115 | + case 'newdir': |
|
| 116 | + newDir(); |
|
| 117 | + break; |
|
| 118 | + default: |
|
| 119 | + xdirConfig(); |
|
| 120 | + break; |
|
| 121 | 121 | } |
@@ -112,10 +112,10 @@ |
||
| 112 | 112 | } |
| 113 | 113 | switch ($op) { |
| 114 | 114 | |
| 115 | - case 'newdir': |
|
| 116 | - newDir(); |
|
| 117 | - break; |
|
| 118 | - default: |
|
| 119 | - xdirConfig(); |
|
| 120 | - break; |
|
| 115 | + case 'newdir': |
|
| 116 | + newDir(); |
|
| 117 | + break; |
|
| 118 | + default: |
|
| 119 | + xdirConfig(); |
|
| 120 | + break; |
|
| 121 | 121 | } |
@@ -29,26 +29,26 @@ discard block |
||
| 29 | 29 | // Purpose: Create a business directory for xoops. // |
| 30 | 30 | // Based upon the mylinks and the mxDirectory modules // |
| 31 | 31 | // ------------------------------------------------------------------------- // |
| 32 | -include __DIR__ . '/../../../include/cp_header.php'; |
|
| 33 | -if (file_exists(__DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php')) { |
|
| 34 | - include __DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 32 | +include __DIR__.'/../../../include/cp_header.php'; |
|
| 33 | +if (file_exists(__DIR__.'/../language/'.$xoopsConfig['language'].'/main.php')) { |
|
| 34 | + include __DIR__.'/../language/'.$xoopsConfig['language'].'/main.php'; |
|
| 35 | 35 | } else { |
| 36 | - include __DIR__ . '/../language/english/main.php'; |
|
| 36 | + include __DIR__.'/../language/english/main.php'; |
|
| 37 | 37 | } |
| 38 | -include __DIR__ . '/../include/functions.php'; |
|
| 39 | -include __DIR__ . '/../class/class.fieldtype.php'; |
|
| 40 | -include __DIR__ . '/../class/class.datatype.php'; |
|
| 41 | -include __DIR__ . '/../class/class.directory.php'; |
|
| 42 | -include __DIR__ . '/../class/class.xdir.php'; |
|
| 43 | -include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 44 | -include_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 38 | +include __DIR__.'/../include/functions.php'; |
|
| 39 | +include __DIR__.'/../class/class.fieldtype.php'; |
|
| 40 | +include __DIR__.'/../class/class.datatype.php'; |
|
| 41 | +include __DIR__.'/../class/class.directory.php'; |
|
| 42 | +include __DIR__.'/../class/class.xdir.php'; |
|
| 43 | +include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 44 | +include_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 45 | 45 | $myts = MyTextSanitizer::getInstance(); |
| 46 | 46 | $eh = new ErrorHandler; |
| 47 | 47 | |
| 48 | 48 | $moddir = $xoopsModule->getVar('dirname'); |
| 49 | 49 | |
| 50 | 50 | if (isset($_GET['dirid'])) { |
| 51 | - $get_dir = (int)$_GET['dirid']; |
|
| 51 | + $get_dir = (int) $_GET['dirid']; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function xdirConfig() |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | global $xoopsDB, $xoopsModule, $xoopsUser, $myts, $moddir; |
| 57 | 57 | xoops_cp_header(); |
| 58 | 58 | adminmenu(0, _MD_A_DIRADMIN); |
| 59 | - echo '<h4>' . _MD_MIGRATE_FROM_XDIR . '</h4>'; |
|
| 59 | + echo '<h4>'._MD_MIGRATE_FROM_XDIR.'</h4>'; |
|
| 60 | 60 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
| 61 | 61 | $form = new XoopsThemeForm(_MD_XIDR_MIGRATE_TO_NEWDIR, 'submitform', 'xdir_migrate.php'); |
| 62 | 62 | $form->addElement(new XoopsFormText(_MD_DIRNAME, 'dirname', 100, 150, ''), true); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (count($migration_errors) > 0) { |
| 99 | 99 | redirect_header('xdir_migrate.php', 2, _MD_XDIR_MIGRATION_FAILED); |
| 100 | 100 | } else { |
| 101 | - redirect_header('directories.php?op=moddir&dirid=' . $db_dirid, 2, _MD_XDIR_MIGRATION_COMPLETED); |
|
| 101 | + redirect_header('directories.php?op=moddir&dirid='.$db_dirid, 2, _MD_XDIR_MIGRATION_COMPLETED); |
|
| 102 | 102 | } |
| 103 | 103 | } else { |
| 104 | 104 | redirect_header('xdir_migrate.php', 2, _MD_XDIR_MIGRATION_FAILED); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | * @author XOOPS Development Team |
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | -require_once __DIR__ . '/admin_header.php'; |
|
| 20 | +require_once __DIR__.'/admin_header.php'; |
|
| 21 | 21 | //include __DIR__ . '/../../../include/cp_header.php'; |
| 22 | 22 | |
| 23 | 23 | xoops_cp_header(); |
@@ -27,4 +27,4 @@ discard block |
||
| 27 | 27 | $adminObject->displayNavigation(basename(__FILE__)); |
| 28 | 28 | $adminObject->displayIndex(); |
| 29 | 29 | |
| 30 | -include __DIR__ . '/admin_footer.php'; |
|
| 30 | +include __DIR__.'/admin_footer.php'; |
|
@@ -36,363 +36,363 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $moddir = $xoopsModule->getVar('dirname'); |
| 38 | 38 | if (isset($_GET['typeid'])) { |
| 39 | - $get_typeid = (int)$_GET['typeid']; |
|
| 39 | + $get_typeid = (int)$_GET['typeid']; |
|
| 40 | 40 | } else { |
| 41 | - $get_typeid = '0'; |
|
| 42 | - if (isset($_POST['typeid'])) { |
|
| 43 | - $post_typeid = (int)$_POST['typeid']; |
|
| 44 | - } |
|
| 41 | + $get_typeid = '0'; |
|
| 42 | + if (isset($_POST['typeid'])) { |
|
| 43 | + $post_typeid = (int)$_POST['typeid']; |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | if (isset($_GET['offerid'])) { |
| 47 | - $get_offerid = (int)$_GET['offerid']; |
|
| 47 | + $get_offerid = (int)$_GET['offerid']; |
|
| 48 | 48 | } else { |
| 49 | - $get_offerid = 0; |
|
| 49 | + $get_offerid = 0; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $eh = new ErrorHandler; //ErrorHandler object |
| 53 | 53 | |
| 54 | 54 | if (isset($_GET['op'])) { |
| 55 | - $op = $_GET['op']; |
|
| 55 | + $op = $_GET['op']; |
|
| 56 | 56 | } elseif (isset($_POST['op'])) { |
| 57 | - $op = $_POST['op']; |
|
| 57 | + $op = $_POST['op']; |
|
| 58 | 58 | } else { |
| 59 | - $op = ''; |
|
| 59 | + $op = ''; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //function to list subscription types |
| 63 | 63 | function listoffers() |
| 64 | 64 | { |
| 65 | - global $xoopsDB, $eh, $xoopsUser, $subscription, $subscriptionhandler, $itemtypes, $myts, $xoopsModule; |
|
| 66 | - xoops_cp_header(); |
|
| 67 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 68 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 69 | - //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
|
| 70 | - echo '<br>'; |
|
| 71 | - |
|
| 72 | - //list subscription offers |
|
| 73 | - $sql = 'SELECT o.offerid, o.typeid, o.title, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 74 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') |
|
| 75 | - . ' t, ' |
|
| 76 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 77 | - . ' o WHERE o.typeid=t.typeid'; |
|
| 78 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 79 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 80 | - if ($numrows > 0) { |
|
| 81 | - echo '<h4>' . _MD_SUBSCR_OFFERS . '</h4>'; |
|
| 82 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 83 | - echo '<tr><th>' . _MD_OFFER_TITLE . '</th><th>' . _MD_OFFER_DURATION . '</th><th>' . _MD_OFFER_COUNT . '</th><th>' . _MD_OFFER_PRICE . '</th><th>' . _MD_OFFER_CURRENCY . '</th><th>' . _MD_OFFER_ACTIVE . '</th></tr>'; |
|
| 84 | - $duration_arr = $subscription->durationArray(); |
|
| 85 | - while (list($offerid, $typeid, $title, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 86 | - $offertitle = $myts->htmlSpecialChars($title); |
|
| 87 | - if ($activeyn == '1') { |
|
| 88 | - $activeyn = _MD_YES; |
|
| 89 | - } else { |
|
| 90 | - $activeyn = _MD_NO; |
|
| 91 | - } |
|
| 92 | - //Show offers |
|
| 93 | - echo '<tr>'; |
|
| 94 | - echo "<td class=\"even\"><a href=\"subscriptions.php?op=editoffer&offerid=$offerid\">$offertitle</a></td>"; |
|
| 95 | - echo "<td class=\"odd\">$duration_arr[$duration]</td>"; |
|
| 96 | - echo "<td class=\"even\">$count</td>"; |
|
| 97 | - echo "<td class=\"odd\">$price</td>"; |
|
| 98 | - echo "<td class=\"even\">$currency</td>"; |
|
| 99 | - echo "<td class=\"odd\">$activeyn</td>"; |
|
| 100 | - echo '</tr>'; |
|
| 101 | - } |
|
| 102 | - echo '</table>'; |
|
| 103 | - } else { |
|
| 104 | - echo '' . _MD_NORESULTS . '<br><br>'; |
|
| 105 | - } |
|
| 106 | - echo '<h4>' . _MD_ADD_SUBSCR_OFFER . '</h4>'; |
|
| 107 | - |
|
| 108 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 109 | - $form = new XoopsThemeForm(_MD_ADD_OFFER_FORM, 'newofferform', 'subscriptions.php'); |
|
| 110 | - $form->addElement(new XoopsFormText(_MD_OFFER_TITLE, 'title', 50, 100, ''), true); |
|
| 111 | - |
|
| 112 | - $itemtypes_arr = $subscriptionhandler->itemTypesArray(); |
|
| 113 | - $itemtype_select = new XoopsFormSelect(_MD_SUBSCR_ITEMTYPE, 'typeid'); |
|
| 114 | - $itemtype_select->addOptionArray($itemtypes_arr); |
|
| 115 | - $form->addElement($itemtype_select); |
|
| 116 | - |
|
| 117 | - $duration_arr = $subscription->durationArray(); |
|
| 118 | - $duration_select = new XoopsFormSelect(_MD_OFFER_DURATION, 'duration'); |
|
| 119 | - $duration_select->addOptionArray($duration_arr); |
|
| 120 | - $form->addElement($duration_select); |
|
| 121 | - |
|
| 122 | - $form->addElement(new XoopsFormText(_MD_OFFER_COUNT, 'count', 10, 50, ''), true); |
|
| 123 | - $form->addElement(new XoopsFormText(_MD_OFFER_PRICE, 'price', 20, 50, ''), true); |
|
| 124 | - |
|
| 125 | - $currency_arr = $subscription->currencyArray(); |
|
| 126 | - $currency_select = new XoopsFormSelect(_MD_OFFER_CURRENCY, 'currency'); |
|
| 127 | - $currency_select->addOptionArray($currency_arr); |
|
| 128 | - $form->addElement($currency_select); |
|
| 129 | - |
|
| 130 | - $form_active = new XoopsFormCheckBox(_MD_OFFER_ACTIVEYN, 'activeyn', 0); |
|
| 131 | - $form_active->addOption(1, _MD_YESNO); |
|
| 132 | - $form->addElement($form_active, true); |
|
| 133 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_OFFER_DESCR, 'descr', '', 5, 50, '')); |
|
| 134 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 135 | - $form->addElement(new XoopsFormHidden('op', 'addoffer')); |
|
| 136 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 137 | - $form->display(); |
|
| 138 | - echo '</td></tr></table>'; |
|
| 139 | - |
|
| 140 | - //Show item types |
|
| 141 | - $sql = 'SELECT typeid, typename, typelevel FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . ''; |
|
| 142 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 143 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 144 | - if ($numrows > 0) { |
|
| 145 | - echo '<h4>' . _MD_ITEMTYPES . '</h4>'; |
|
| 146 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 147 | - echo '<tr><th>' . _MD_ITEMTYPE_NAME . '</th><th>' . _MD_ITEMTYPE_LEVEL . '</th><th>' . _MD_ACTION . '</th></tr>'; |
|
| 148 | - $duration_arr = $subscription->durationArray(); |
|
| 149 | - while (list($typeid, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 150 | - $typename = $myts->htmlSpecialChars($typename); |
|
| 151 | - $level = $myts->htmlSpecialChars($level); |
|
| 152 | - |
|
| 153 | - //Show types |
|
| 154 | - echo '<tr>'; |
|
| 155 | - echo "<td class=\"even\"><a href=\"subscriptions.php?op=edittype&typeid=$typeid\">$typename</strong></td>"; |
|
| 156 | - echo "<td class=\"odd\">$level</td>"; |
|
| 157 | - echo "<td class=\"odd\"><a href=\"subscriptions.php?op=deltype&typeid=$typeid\">" . _MD_DELETE . '</strong></td>'; |
|
| 158 | - echo '</tr>'; |
|
| 159 | - } |
|
| 160 | - echo '</table>'; |
|
| 161 | - } else { |
|
| 162 | - echo '' . _MD_NORESULTS . '<br><br>'; |
|
| 163 | - } |
|
| 164 | - echo '<h4>' . _MD_ADD_ITEMTYPE . '</h4>'; |
|
| 165 | - |
|
| 166 | - //Add item type form |
|
| 167 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 168 | - $form = new XoopsThemeForm(_MD_ADD_ITEMTYPE_FORM, 'newitemtypeform', 'subscriptions.php'); |
|
| 169 | - $form->addElement(new XoopsFormText(_MD_ITEMTYPE_NAME, 'typename', 50, 100, ''), true); |
|
| 170 | - $form->addElement(new XoopsFormText(_MD_ITEMTYPE_LEVEL, 'typelevel', 10, 50, ''), true); |
|
| 171 | - |
|
| 172 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 173 | - $form->addElement(new XoopsFormHidden('op', 'addtype')); |
|
| 174 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 175 | - $form->display(); |
|
| 176 | - echo '</td></tr></table>'; |
|
| 177 | - xoops_cp_footer(); |
|
| 65 | + global $xoopsDB, $eh, $xoopsUser, $subscription, $subscriptionhandler, $itemtypes, $myts, $xoopsModule; |
|
| 66 | + xoops_cp_header(); |
|
| 67 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 68 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 69 | + //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
|
| 70 | + echo '<br>'; |
|
| 71 | + |
|
| 72 | + //list subscription offers |
|
| 73 | + $sql = 'SELECT o.offerid, o.typeid, o.title, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 74 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') |
|
| 75 | + . ' t, ' |
|
| 76 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 77 | + . ' o WHERE o.typeid=t.typeid'; |
|
| 78 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 79 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 80 | + if ($numrows > 0) { |
|
| 81 | + echo '<h4>' . _MD_SUBSCR_OFFERS . '</h4>'; |
|
| 82 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 83 | + echo '<tr><th>' . _MD_OFFER_TITLE . '</th><th>' . _MD_OFFER_DURATION . '</th><th>' . _MD_OFFER_COUNT . '</th><th>' . _MD_OFFER_PRICE . '</th><th>' . _MD_OFFER_CURRENCY . '</th><th>' . _MD_OFFER_ACTIVE . '</th></tr>'; |
|
| 84 | + $duration_arr = $subscription->durationArray(); |
|
| 85 | + while (list($offerid, $typeid, $title, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 86 | + $offertitle = $myts->htmlSpecialChars($title); |
|
| 87 | + if ($activeyn == '1') { |
|
| 88 | + $activeyn = _MD_YES; |
|
| 89 | + } else { |
|
| 90 | + $activeyn = _MD_NO; |
|
| 91 | + } |
|
| 92 | + //Show offers |
|
| 93 | + echo '<tr>'; |
|
| 94 | + echo "<td class=\"even\"><a href=\"subscriptions.php?op=editoffer&offerid=$offerid\">$offertitle</a></td>"; |
|
| 95 | + echo "<td class=\"odd\">$duration_arr[$duration]</td>"; |
|
| 96 | + echo "<td class=\"even\">$count</td>"; |
|
| 97 | + echo "<td class=\"odd\">$price</td>"; |
|
| 98 | + echo "<td class=\"even\">$currency</td>"; |
|
| 99 | + echo "<td class=\"odd\">$activeyn</td>"; |
|
| 100 | + echo '</tr>'; |
|
| 101 | + } |
|
| 102 | + echo '</table>'; |
|
| 103 | + } else { |
|
| 104 | + echo '' . _MD_NORESULTS . '<br><br>'; |
|
| 105 | + } |
|
| 106 | + echo '<h4>' . _MD_ADD_SUBSCR_OFFER . '</h4>'; |
|
| 107 | + |
|
| 108 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 109 | + $form = new XoopsThemeForm(_MD_ADD_OFFER_FORM, 'newofferform', 'subscriptions.php'); |
|
| 110 | + $form->addElement(new XoopsFormText(_MD_OFFER_TITLE, 'title', 50, 100, ''), true); |
|
| 111 | + |
|
| 112 | + $itemtypes_arr = $subscriptionhandler->itemTypesArray(); |
|
| 113 | + $itemtype_select = new XoopsFormSelect(_MD_SUBSCR_ITEMTYPE, 'typeid'); |
|
| 114 | + $itemtype_select->addOptionArray($itemtypes_arr); |
|
| 115 | + $form->addElement($itemtype_select); |
|
| 116 | + |
|
| 117 | + $duration_arr = $subscription->durationArray(); |
|
| 118 | + $duration_select = new XoopsFormSelect(_MD_OFFER_DURATION, 'duration'); |
|
| 119 | + $duration_select->addOptionArray($duration_arr); |
|
| 120 | + $form->addElement($duration_select); |
|
| 121 | + |
|
| 122 | + $form->addElement(new XoopsFormText(_MD_OFFER_COUNT, 'count', 10, 50, ''), true); |
|
| 123 | + $form->addElement(new XoopsFormText(_MD_OFFER_PRICE, 'price', 20, 50, ''), true); |
|
| 124 | + |
|
| 125 | + $currency_arr = $subscription->currencyArray(); |
|
| 126 | + $currency_select = new XoopsFormSelect(_MD_OFFER_CURRENCY, 'currency'); |
|
| 127 | + $currency_select->addOptionArray($currency_arr); |
|
| 128 | + $form->addElement($currency_select); |
|
| 129 | + |
|
| 130 | + $form_active = new XoopsFormCheckBox(_MD_OFFER_ACTIVEYN, 'activeyn', 0); |
|
| 131 | + $form_active->addOption(1, _MD_YESNO); |
|
| 132 | + $form->addElement($form_active, true); |
|
| 133 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_OFFER_DESCR, 'descr', '', 5, 50, '')); |
|
| 134 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 135 | + $form->addElement(new XoopsFormHidden('op', 'addoffer')); |
|
| 136 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 137 | + $form->display(); |
|
| 138 | + echo '</td></tr></table>'; |
|
| 139 | + |
|
| 140 | + //Show item types |
|
| 141 | + $sql = 'SELECT typeid, typename, typelevel FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . ''; |
|
| 142 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 143 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 144 | + if ($numrows > 0) { |
|
| 145 | + echo '<h4>' . _MD_ITEMTYPES . '</h4>'; |
|
| 146 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
|
| 147 | + echo '<tr><th>' . _MD_ITEMTYPE_NAME . '</th><th>' . _MD_ITEMTYPE_LEVEL . '</th><th>' . _MD_ACTION . '</th></tr>'; |
|
| 148 | + $duration_arr = $subscription->durationArray(); |
|
| 149 | + while (list($typeid, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 150 | + $typename = $myts->htmlSpecialChars($typename); |
|
| 151 | + $level = $myts->htmlSpecialChars($level); |
|
| 152 | + |
|
| 153 | + //Show types |
|
| 154 | + echo '<tr>'; |
|
| 155 | + echo "<td class=\"even\"><a href=\"subscriptions.php?op=edittype&typeid=$typeid\">$typename</strong></td>"; |
|
| 156 | + echo "<td class=\"odd\">$level</td>"; |
|
| 157 | + echo "<td class=\"odd\"><a href=\"subscriptions.php?op=deltype&typeid=$typeid\">" . _MD_DELETE . '</strong></td>'; |
|
| 158 | + echo '</tr>'; |
|
| 159 | + } |
|
| 160 | + echo '</table>'; |
|
| 161 | + } else { |
|
| 162 | + echo '' . _MD_NORESULTS . '<br><br>'; |
|
| 163 | + } |
|
| 164 | + echo '<h4>' . _MD_ADD_ITEMTYPE . '</h4>'; |
|
| 165 | + |
|
| 166 | + //Add item type form |
|
| 167 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 168 | + $form = new XoopsThemeForm(_MD_ADD_ITEMTYPE_FORM, 'newitemtypeform', 'subscriptions.php'); |
|
| 169 | + $form->addElement(new XoopsFormText(_MD_ITEMTYPE_NAME, 'typename', 50, 100, ''), true); |
|
| 170 | + $form->addElement(new XoopsFormText(_MD_ITEMTYPE_LEVEL, 'typelevel', 10, 50, ''), true); |
|
| 171 | + |
|
| 172 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 173 | + $form->addElement(new XoopsFormHidden('op', 'addtype')); |
|
| 174 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 175 | + $form->display(); |
|
| 176 | + echo '</td></tr></table>'; |
|
| 177 | + xoops_cp_footer(); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | function edittype() |
| 181 | 181 | { |
| 182 | - global $xoopsDB, $eh, $myts, $get_typeid, $xoopsUser; |
|
| 183 | - if ($get_typeid == 0) { |
|
| 184 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 185 | - exit(); |
|
| 186 | - } |
|
| 187 | - xoops_cp_header(); |
|
| 188 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 189 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 190 | - //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
|
| 191 | - echo '<br>'; |
|
| 192 | - $sql = 'SELECT typeid, typename, typelevel FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . " WHERE typeid=$get_typeid"; |
|
| 193 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 194 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 195 | - if ($numrows > 0) { |
|
| 196 | - //$duration_arr = $subscription->durationArray(); |
|
| 197 | - while (list($typeid, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 198 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 199 | - $form = new XoopsThemeForm(_MD_EDIT_ITEMTYPE_FORM, 'edititemtypeform', 'subscriptions.php'); |
|
| 200 | - $form->addElement(new XoopsFormText(_MD_ITEMTYPE_NAME, 'typename', 50, 100, $typename), true); |
|
| 201 | - $form->addElement(new XoopsFormText(_MD_ITEMTYPE_LEVEL, 'typelevel', 10, 50, $level), true); |
|
| 202 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 203 | - $form->addElement(new XoopsFormHidden('op', 'savetype')); |
|
| 204 | - $form->addElement(new XoopsFormHidden('typeid', "$get_typeid")); |
|
| 205 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 206 | - $form->display(); |
|
| 207 | - echo '</td></tr></table>'; |
|
| 208 | - } |
|
| 209 | - } else { |
|
| 210 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 211 | - exit(); |
|
| 212 | - } |
|
| 213 | - xoops_cp_footer(); |
|
| 182 | + global $xoopsDB, $eh, $myts, $get_typeid, $xoopsUser; |
|
| 183 | + if ($get_typeid == 0) { |
|
| 184 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 185 | + exit(); |
|
| 186 | + } |
|
| 187 | + xoops_cp_header(); |
|
| 188 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 189 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 190 | + //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
|
| 191 | + echo '<br>'; |
|
| 192 | + $sql = 'SELECT typeid, typename, typelevel FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . " WHERE typeid=$get_typeid"; |
|
| 193 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 194 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 195 | + if ($numrows > 0) { |
|
| 196 | + //$duration_arr = $subscription->durationArray(); |
|
| 197 | + while (list($typeid, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 198 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 199 | + $form = new XoopsThemeForm(_MD_EDIT_ITEMTYPE_FORM, 'edititemtypeform', 'subscriptions.php'); |
|
| 200 | + $form->addElement(new XoopsFormText(_MD_ITEMTYPE_NAME, 'typename', 50, 100, $typename), true); |
|
| 201 | + $form->addElement(new XoopsFormText(_MD_ITEMTYPE_LEVEL, 'typelevel', 10, 50, $level), true); |
|
| 202 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 203 | + $form->addElement(new XoopsFormHidden('op', 'savetype')); |
|
| 204 | + $form->addElement(new XoopsFormHidden('typeid', "$get_typeid")); |
|
| 205 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 206 | + $form->display(); |
|
| 207 | + echo '</td></tr></table>'; |
|
| 208 | + } |
|
| 209 | + } else { |
|
| 210 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 211 | + exit(); |
|
| 212 | + } |
|
| 213 | + xoops_cp_footer(); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | function editoffer() |
| 217 | 217 | { |
| 218 | - global $xoopsDB, $eh, $xoopsUser, $subscription, $subscriptionhandler, $get_offerid, $itemtypes; |
|
| 219 | - if ($get_offerid == 0) { |
|
| 220 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 221 | - exit(); |
|
| 222 | - } |
|
| 223 | - xoops_cp_header(); |
|
| 224 | - $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 225 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
| 226 | - //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
|
| 227 | - echo '<br>'; |
|
| 228 | - $sql = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 229 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') |
|
| 230 | - . ' t, ' |
|
| 231 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 232 | - . ' o WHERE o.typeid=t.typeid AND o.offerid=' |
|
| 233 | - . $get_offerid |
|
| 234 | - . ''; |
|
| 235 | - $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 236 | - $numrows = $xoopsDB->getRowsNum($result); |
|
| 237 | - if ($numrows > 0) { |
|
| 238 | - $duration_arr = $subscription->durationArray(); |
|
| 239 | - while (list($offerid, $offertitle, $typeid, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 240 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 241 | - $form = new XoopsThemeForm(_MD_ADD_OFFER_FORM, 'newofferform', 'subscriptions.php'); |
|
| 242 | - $form->addElement(new XoopsFormText(_MD_OFFER_TITLE, 'title', 50, 100, $offertitle), true); |
|
| 243 | - |
|
| 244 | - $itemtypes_arr = $subscriptionhandler->itemTypesArray(); |
|
| 245 | - $itemtype_select = new XoopsFormSelect(_MD_SUBSCR_ITEMTYPE, 'typeid', $typeid); |
|
| 246 | - $itemtype_select->addOptionArray($itemtypes_arr); |
|
| 247 | - $form->addElement($itemtype_select); |
|
| 248 | - |
|
| 249 | - //$duration_arr = $subscription->durationArray(); |
|
| 250 | - $duration_select = new XoopsFormSelect(_MD_OFFER_DURATION, 'duration', $duration); |
|
| 251 | - $duration_select->addOptionArray($duration_arr); |
|
| 252 | - $form->addElement($duration_select); |
|
| 253 | - |
|
| 254 | - $form->addElement(new XoopsFormText(_MD_OFFER_COUNT, 'count', 10, 50, $count), true); |
|
| 255 | - $form->addElement(new XoopsFormText(_MD_OFFER_PRICE, 'price', 20, 50, $price), true); |
|
| 256 | - |
|
| 257 | - $currency_arr = $subscription->currencyArray(); |
|
| 258 | - $currency_select = new XoopsFormSelect(_MD_OFFER_CURRENCY, 'currency', $currency); |
|
| 259 | - $currency_select->addOptionArray($currency_arr); |
|
| 260 | - $form->addElement($currency_select); |
|
| 261 | - |
|
| 262 | - $form_active = new XoopsFormCheckBox(_MD_OFFER_ACTIVEYN, 'activeyn', $activeyn); |
|
| 263 | - $form_active->addOption(1, _MD_YESNO); |
|
| 264 | - $form->addElement($form_active, true); |
|
| 265 | - $form->addElement(new XoopsFormDhtmlTextArea(_MD_OFFER_DESCR, 'descr', $descr, 5, 50, '')); |
|
| 266 | - $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 267 | - $form->addElement(new XoopsFormHidden('op', 'saveoffer')); |
|
| 268 | - $form->addElement(new XoopsFormHidden('offerid', "$get_offerid")); |
|
| 269 | - $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 270 | - $form->display(); |
|
| 271 | - echo '</td></tr></table>'; |
|
| 272 | - } |
|
| 273 | - } else { |
|
| 274 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 275 | - exit(); |
|
| 276 | - } |
|
| 277 | - xoops_cp_footer(); |
|
| 218 | + global $xoopsDB, $eh, $xoopsUser, $subscription, $subscriptionhandler, $get_offerid, $itemtypes; |
|
| 219 | + if ($get_offerid == 0) { |
|
| 220 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 221 | + exit(); |
|
| 222 | + } |
|
| 223 | + xoops_cp_header(); |
|
| 224 | + $adminObject = \Xmf\Module\Admin::getInstance(); |
|
| 225 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
| 226 | + //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
|
| 227 | + echo '<br>'; |
|
| 228 | + $sql = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 229 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') |
|
| 230 | + . ' t, ' |
|
| 231 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 232 | + . ' o WHERE o.typeid=t.typeid AND o.offerid=' |
|
| 233 | + . $get_offerid |
|
| 234 | + . ''; |
|
| 235 | + $result = $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 236 | + $numrows = $xoopsDB->getRowsNum($result); |
|
| 237 | + if ($numrows > 0) { |
|
| 238 | + $duration_arr = $subscription->durationArray(); |
|
| 239 | + while (list($offerid, $offertitle, $typeid, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $xoopsDB->fetchRow($result)) { |
|
| 240 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
|
| 241 | + $form = new XoopsThemeForm(_MD_ADD_OFFER_FORM, 'newofferform', 'subscriptions.php'); |
|
| 242 | + $form->addElement(new XoopsFormText(_MD_OFFER_TITLE, 'title', 50, 100, $offertitle), true); |
|
| 243 | + |
|
| 244 | + $itemtypes_arr = $subscriptionhandler->itemTypesArray(); |
|
| 245 | + $itemtype_select = new XoopsFormSelect(_MD_SUBSCR_ITEMTYPE, 'typeid', $typeid); |
|
| 246 | + $itemtype_select->addOptionArray($itemtypes_arr); |
|
| 247 | + $form->addElement($itemtype_select); |
|
| 248 | + |
|
| 249 | + //$duration_arr = $subscription->durationArray(); |
|
| 250 | + $duration_select = new XoopsFormSelect(_MD_OFFER_DURATION, 'duration', $duration); |
|
| 251 | + $duration_select->addOptionArray($duration_arr); |
|
| 252 | + $form->addElement($duration_select); |
|
| 253 | + |
|
| 254 | + $form->addElement(new XoopsFormText(_MD_OFFER_COUNT, 'count', 10, 50, $count), true); |
|
| 255 | + $form->addElement(new XoopsFormText(_MD_OFFER_PRICE, 'price', 20, 50, $price), true); |
|
| 256 | + |
|
| 257 | + $currency_arr = $subscription->currencyArray(); |
|
| 258 | + $currency_select = new XoopsFormSelect(_MD_OFFER_CURRENCY, 'currency', $currency); |
|
| 259 | + $currency_select->addOptionArray($currency_arr); |
|
| 260 | + $form->addElement($currency_select); |
|
| 261 | + |
|
| 262 | + $form_active = new XoopsFormCheckBox(_MD_OFFER_ACTIVEYN, 'activeyn', $activeyn); |
|
| 263 | + $form_active->addOption(1, _MD_YESNO); |
|
| 264 | + $form->addElement($form_active, true); |
|
| 265 | + $form->addElement(new XoopsFormDhtmlTextArea(_MD_OFFER_DESCR, 'descr', $descr, 5, 50, '')); |
|
| 266 | + $form->addElement(new XoopsFormButton('', 'submit', _MD_SUBMIT, 'submit')); |
|
| 267 | + $form->addElement(new XoopsFormHidden('op', 'saveoffer')); |
|
| 268 | + $form->addElement(new XoopsFormHidden('offerid', "$get_offerid")); |
|
| 269 | + $form->addElement(new XoopsFormHidden('uid', $xoopsUser->getVar('uid'))); |
|
| 270 | + $form->display(); |
|
| 271 | + echo '</td></tr></table>'; |
|
| 272 | + } |
|
| 273 | + } else { |
|
| 274 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 275 | + exit(); |
|
| 276 | + } |
|
| 277 | + xoops_cp_footer(); |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | //function to view one subscription type |
| 281 | 281 | function viewtype() |
| 282 | 282 | { |
| 283 | - global $xoopsDB, $eh, $get_typeid; |
|
| 284 | - if (isset($get_itemid)) { |
|
| 285 | - //view type |
|
| 286 | - } |
|
| 283 | + global $xoopsDB, $eh, $get_typeid; |
|
| 284 | + if (isset($get_itemid)) { |
|
| 285 | + //view type |
|
| 286 | + } |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | function addoffer() |
| 290 | 290 | { |
| 291 | - global $xoopsDB, $eh, $myts, $moddir; |
|
| 292 | - //Get POST variables; |
|
| 293 | - $post_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 294 | - $post_typeid = (int)$_POST['typeid']; |
|
| 295 | - $post_duration = $myts->makeTboxData4Save($_POST['duration']); |
|
| 296 | - $post_currency = $myts->makeTboxData4Save($_POST['currency']); |
|
| 297 | - $post_count = (int)$_POST['count']; |
|
| 298 | - $post_price = $myts->makeTboxData4Save($_POST['price']); |
|
| 299 | - if (isset($activeyn)) { |
|
| 300 | - $post_activeyn = (int)$_POST['activeyn']; |
|
| 301 | - } else { |
|
| 302 | - $post_activeyn = 0; |
|
| 303 | - } |
|
| 304 | - if (isset($_POST['descr'])) { |
|
| 305 | - $post_descr = $myts->makeTboxData4Save($_POST['descr']); |
|
| 306 | - } else { |
|
| 307 | - $post_descr = ''; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') . '_offerid_seq'); |
|
| 311 | - $sql = sprintf("INSERT INTO %s (offerid, title, typeid, duration, COUNT, price, activeyn, currency, descr) VALUES (%u, '%s', %u, %u, %u, '%s', %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers'), $gen_offerid, $post_title, $post_typeid, |
|
| 312 | - $post_duration, $post_count, $post_price, $post_activeyn, $post_currency, $post_descr); |
|
| 313 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 314 | - $gen_offerid = $xoopsDB->getInsertId(); |
|
| 315 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php?offerid=" . $gen_offerid . '', 2, _MD_SAVED); |
|
| 316 | - exit(); |
|
| 291 | + global $xoopsDB, $eh, $myts, $moddir; |
|
| 292 | + //Get POST variables; |
|
| 293 | + $post_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 294 | + $post_typeid = (int)$_POST['typeid']; |
|
| 295 | + $post_duration = $myts->makeTboxData4Save($_POST['duration']); |
|
| 296 | + $post_currency = $myts->makeTboxData4Save($_POST['currency']); |
|
| 297 | + $post_count = (int)$_POST['count']; |
|
| 298 | + $post_price = $myts->makeTboxData4Save($_POST['price']); |
|
| 299 | + if (isset($activeyn)) { |
|
| 300 | + $post_activeyn = (int)$_POST['activeyn']; |
|
| 301 | + } else { |
|
| 302 | + $post_activeyn = 0; |
|
| 303 | + } |
|
| 304 | + if (isset($_POST['descr'])) { |
|
| 305 | + $post_descr = $myts->makeTboxData4Save($_POST['descr']); |
|
| 306 | + } else { |
|
| 307 | + $post_descr = ''; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') . '_offerid_seq'); |
|
| 311 | + $sql = sprintf("INSERT INTO %s (offerid, title, typeid, duration, COUNT, price, activeyn, currency, descr) VALUES (%u, '%s', %u, %u, %u, '%s', %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers'), $gen_offerid, $post_title, $post_typeid, |
|
| 312 | + $post_duration, $post_count, $post_price, $post_activeyn, $post_currency, $post_descr); |
|
| 313 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 314 | + $gen_offerid = $xoopsDB->getInsertId(); |
|
| 315 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php?offerid=" . $gen_offerid . '', 2, _MD_SAVED); |
|
| 316 | + exit(); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | function saveoffer() |
| 320 | 320 | { |
| 321 | - global $xoopsDB, $eh, $myts, $moddir; |
|
| 322 | - //Get POST variables; |
|
| 323 | - $post_offerid = (int)$_POST['offerid']; |
|
| 324 | - $post_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 325 | - $post_typeid = (int)$_POST['typeid']; |
|
| 326 | - $post_duration = $myts->makeTboxData4Save($_POST['duration']); |
|
| 327 | - $post_currency = $myts->makeTboxData4Save($_POST['currency']); |
|
| 328 | - $post_count = (int)$_POST['count']; |
|
| 329 | - $post_price = $myts->makeTboxData4Save($_POST['price']); |
|
| 330 | - if (isset($_POST['activeyn'])) { |
|
| 331 | - $post_activeyn = (int)$_POST['activeyn']; |
|
| 332 | - } else { |
|
| 333 | - $post_activeyn = 0; |
|
| 334 | - } |
|
| 335 | - if (isset($_POST['descr'])) { |
|
| 336 | - $post_descr = $myts->makeTboxData4Save($_POST['descr']); |
|
| 337 | - } else { |
|
| 338 | - $post_descr = ''; |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') . '_offerid_seq'); |
|
| 342 | - $sql = 'UPDATE ' |
|
| 343 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 344 | - . " SET title = '$post_title', typeid = '$post_typeid', duration = '$post_duration', count = '$post_count', price = '$post_price', activeyn = '$post_activeyn', currency = '$post_currency', descr = '$post_descr' WHERE offerid='$post_offerid'"; |
|
| 345 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 346 | - $gen_offerid = $xoopsDB->getInsertId(); |
|
| 347 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php?offerid=" . $post_offerid . '', 2, _MD_SAVED); |
|
| 348 | - exit(); |
|
| 321 | + global $xoopsDB, $eh, $myts, $moddir; |
|
| 322 | + //Get POST variables; |
|
| 323 | + $post_offerid = (int)$_POST['offerid']; |
|
| 324 | + $post_title = $myts->makeTboxData4Save($_POST['title']); |
|
| 325 | + $post_typeid = (int)$_POST['typeid']; |
|
| 326 | + $post_duration = $myts->makeTboxData4Save($_POST['duration']); |
|
| 327 | + $post_currency = $myts->makeTboxData4Save($_POST['currency']); |
|
| 328 | + $post_count = (int)$_POST['count']; |
|
| 329 | + $post_price = $myts->makeTboxData4Save($_POST['price']); |
|
| 330 | + if (isset($_POST['activeyn'])) { |
|
| 331 | + $post_activeyn = (int)$_POST['activeyn']; |
|
| 332 | + } else { |
|
| 333 | + $post_activeyn = 0; |
|
| 334 | + } |
|
| 335 | + if (isset($_POST['descr'])) { |
|
| 336 | + $post_descr = $myts->makeTboxData4Save($_POST['descr']); |
|
| 337 | + } else { |
|
| 338 | + $post_descr = ''; |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') . '_offerid_seq'); |
|
| 342 | + $sql = 'UPDATE ' |
|
| 343 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 344 | + . " SET title = '$post_title', typeid = '$post_typeid', duration = '$post_duration', count = '$post_count', price = '$post_price', activeyn = '$post_activeyn', currency = '$post_currency', descr = '$post_descr' WHERE offerid='$post_offerid'"; |
|
| 345 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 346 | + $gen_offerid = $xoopsDB->getInsertId(); |
|
| 347 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php?offerid=" . $post_offerid . '', 2, _MD_SAVED); |
|
| 348 | + exit(); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | function addtype() |
| 352 | - //function to save a new item type |
|
| 352 | + //function to save a new item type |
|
| 353 | 353 | { |
| 354 | - global $xoopsDB, $eh, $myts, $_POST, $moddir; |
|
| 355 | - $p_typename = $myts->makeTboxData4Save($_POST['typename']); |
|
| 356 | - $p_level = $myts->makeTboxData4Save($_POST['typelevel']); |
|
| 357 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . '_typeid_seq'); |
|
| 358 | - $sql = sprintf("INSERT INTO %s (typeid, typename, typelevel) VALUES (%u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), $newid, $p_typename, $p_level); |
|
| 359 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 360 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 361 | - exit(); |
|
| 354 | + global $xoopsDB, $eh, $myts, $_POST, $moddir; |
|
| 355 | + $p_typename = $myts->makeTboxData4Save($_POST['typename']); |
|
| 356 | + $p_level = $myts->makeTboxData4Save($_POST['typelevel']); |
|
| 357 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . '_typeid_seq'); |
|
| 358 | + $sql = sprintf("INSERT INTO %s (typeid, typename, typelevel) VALUES (%u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), $newid, $p_typename, $p_level); |
|
| 359 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 360 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 361 | + exit(); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | function deltype() |
| 365 | - //function to delete an item type |
|
| 365 | + //function to delete an item type |
|
| 366 | 366 | { |
| 367 | - global $xoopsDB, $eh, $moddir, $subscriptionhandler; |
|
| 368 | - if (isset($_GET['typeid'])) { |
|
| 369 | - $g_typeid = (int)$_GET['typeid']; |
|
| 370 | - } else { |
|
| 371 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_ERR_ITEMTYPE_DELETE); |
|
| 372 | - exit(); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - if ($subscriptionhandler->countSubscriptionsForType($g_typeid) > 0) { |
|
| 376 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 3, _MD_ERR_ITEMTYPE_LINKED_TO_LISTINGS); |
|
| 377 | - exit(); |
|
| 378 | - } |
|
| 379 | - $sql = sprintf('DELETE FROM %s WHERE typeid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), $g_typeid); |
|
| 380 | - $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 381 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 1, _MD_ITEMTYPE_DELETED); |
|
| 382 | - exit(); |
|
| 367 | + global $xoopsDB, $eh, $moddir, $subscriptionhandler; |
|
| 368 | + if (isset($_GET['typeid'])) { |
|
| 369 | + $g_typeid = (int)$_GET['typeid']; |
|
| 370 | + } else { |
|
| 371 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_ERR_ITEMTYPE_DELETE); |
|
| 372 | + exit(); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + if ($subscriptionhandler->countSubscriptionsForType($g_typeid) > 0) { |
|
| 376 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 3, _MD_ERR_ITEMTYPE_LINKED_TO_LISTINGS); |
|
| 377 | + exit(); |
|
| 378 | + } |
|
| 379 | + $sql = sprintf('DELETE FROM %s WHERE typeid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), $g_typeid); |
|
| 380 | + $xoopsDB->queryF($sql) or $eh->show('0013'); |
|
| 381 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 1, _MD_ITEMTYPE_DELETED); |
|
| 382 | + exit(); |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | //function to save an existing subscription type |
| 386 | 386 | function savetype() |
| 387 | 387 | { |
| 388 | - global $xoopsDB, $eh, $post_typeid, $myts, $moddir; |
|
| 389 | - $p_typename = $myts->makeTboxData4Save($_POST['typename']); |
|
| 390 | - $p_level = (int)$_POST['typelevel']; |
|
| 391 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . '_typeid_seq'); |
|
| 392 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . " SET typename='$p_typename', typelevel='$p_level' WHERE typeid='$post_typeid'"; |
|
| 393 | - $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 394 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 395 | - exit(); |
|
| 388 | + global $xoopsDB, $eh, $post_typeid, $myts, $moddir; |
|
| 389 | + $p_typename = $myts->makeTboxData4Save($_POST['typename']); |
|
| 390 | + $p_level = (int)$_POST['typelevel']; |
|
| 391 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . '_typeid_seq'); |
|
| 392 | + $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . " SET typename='$p_typename', typelevel='$p_level' WHERE typeid='$post_typeid'"; |
|
| 393 | + $xoopsDB->query($sql) or $eh->show('0013'); |
|
| 394 | + redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 395 | + exit(); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | //function to delete an existing subscription type |
@@ -402,37 +402,37 @@ discard block |
||
| 402 | 402 | }*/ |
| 403 | 403 | |
| 404 | 404 | switch ($op) { |
| 405 | - case 'delete': |
|
| 406 | - deltype(); |
|
| 407 | - break; |
|
| 408 | - case 'save': |
|
| 409 | - savetype(); |
|
| 410 | - break; |
|
| 411 | - case 'addtype': |
|
| 412 | - addtype(); |
|
| 413 | - break; |
|
| 414 | - case 'edittype': |
|
| 415 | - edittype(); |
|
| 416 | - break; |
|
| 417 | - case 'deltype': |
|
| 418 | - deltype(); |
|
| 419 | - break; |
|
| 420 | - case 'savetype': |
|
| 421 | - savetype(); |
|
| 422 | - break; |
|
| 423 | - case 'viewtype': |
|
| 424 | - viewtype(); |
|
| 425 | - break; |
|
| 426 | - case 'addoffer': |
|
| 427 | - addoffer(); |
|
| 428 | - break; |
|
| 429 | - case 'editoffer': |
|
| 430 | - editoffer(); |
|
| 431 | - break; |
|
| 432 | - case 'saveoffer': |
|
| 433 | - saveoffer(); |
|
| 434 | - break; |
|
| 435 | - default: |
|
| 436 | - listoffers(); |
|
| 437 | - break; |
|
| 405 | + case 'delete': |
|
| 406 | + deltype(); |
|
| 407 | + break; |
|
| 408 | + case 'save': |
|
| 409 | + savetype(); |
|
| 410 | + break; |
|
| 411 | + case 'addtype': |
|
| 412 | + addtype(); |
|
| 413 | + break; |
|
| 414 | + case 'edittype': |
|
| 415 | + edittype(); |
|
| 416 | + break; |
|
| 417 | + case 'deltype': |
|
| 418 | + deltype(); |
|
| 419 | + break; |
|
| 420 | + case 'savetype': |
|
| 421 | + savetype(); |
|
| 422 | + break; |
|
| 423 | + case 'viewtype': |
|
| 424 | + viewtype(); |
|
| 425 | + break; |
|
| 426 | + case 'addoffer': |
|
| 427 | + addoffer(); |
|
| 428 | + break; |
|
| 429 | + case 'editoffer': |
|
| 430 | + editoffer(); |
|
| 431 | + break; |
|
| 432 | + case 'saveoffer': |
|
| 433 | + saveoffer(); |
|
| 434 | + break; |
|
| 435 | + default: |
|
| 436 | + listoffers(); |
|
| 437 | + break; |
|
| 438 | 438 | } |
@@ -18,33 +18,33 @@ 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/xoopslists.php'; |
|
| 27 | -require_once XOOPS_ROOT_PATH . '/include/xoopscodes.php'; |
|
| 28 | -require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
|
| 29 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 30 | -require_once __DIR__ . '/../class/class.subscription.php'; |
|
| 24 | +include __DIR__.'/../include/functions.php'; |
|
| 25 | +require_once XOOPS_ROOT_PATH.'/class/xoopstree.php'; |
|
| 26 | +require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
|
| 27 | +require_once XOOPS_ROOT_PATH.'/include/xoopscodes.php'; |
|
| 28 | +require_once XOOPS_ROOT_PATH.'/class/module.errorhandler.php'; |
|
| 29 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 30 | +require_once __DIR__.'/../class/class.subscription.php'; |
|
| 31 | 31 | $myts = MyTextSanitizer::getInstance(); |
| 32 | 32 | $eh = new ErrorHandler; |
| 33 | -$itemtypes = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), 'typeid', ''); |
|
| 33 | +$itemtypes = new XoopsTree($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes'), 'typeid', ''); |
|
| 34 | 34 | $subscription = new efqSubscription(); |
| 35 | 35 | $subscriptionhandler = new efqSubscriptionHandler(); |
| 36 | 36 | |
| 37 | 37 | $moddir = $xoopsModule->getVar('dirname'); |
| 38 | 38 | if (isset($_GET['typeid'])) { |
| 39 | - $get_typeid = (int)$_GET['typeid']; |
|
| 39 | + $get_typeid = (int) $_GET['typeid']; |
|
| 40 | 40 | } else { |
| 41 | 41 | $get_typeid = '0'; |
| 42 | 42 | if (isset($_POST['typeid'])) { |
| 43 | - $post_typeid = (int)$_POST['typeid']; |
|
| 43 | + $post_typeid = (int) $_POST['typeid']; |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($_GET['offerid'])) { |
| 47 | - $get_offerid = (int)$_GET['offerid']; |
|
| 47 | + $get_offerid = (int) $_GET['offerid']; |
|
| 48 | 48 | } else { |
| 49 | 49 | $get_offerid = 0; |
| 50 | 50 | } |
@@ -70,17 +70,17 @@ discard block |
||
| 70 | 70 | echo '<br>'; |
| 71 | 71 | |
| 72 | 72 | //list subscription offers |
| 73 | - $sql = 'SELECT o.offerid, o.typeid, o.title, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 74 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') |
|
| 73 | + $sql = 'SELECT o.offerid, o.typeid, o.title, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 74 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes') |
|
| 75 | 75 | . ' t, ' |
| 76 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 76 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_subscr_offers') |
|
| 77 | 77 | . ' o WHERE o.typeid=t.typeid'; |
| 78 | 78 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 79 | 79 | $numrows = $xoopsDB->getRowsNum($result); |
| 80 | 80 | if ($numrows > 0) { |
| 81 | - echo '<h4>' . _MD_SUBSCR_OFFERS . '</h4>'; |
|
| 81 | + echo '<h4>'._MD_SUBSCR_OFFERS.'</h4>'; |
|
| 82 | 82 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
| 83 | - echo '<tr><th>' . _MD_OFFER_TITLE . '</th><th>' . _MD_OFFER_DURATION . '</th><th>' . _MD_OFFER_COUNT . '</th><th>' . _MD_OFFER_PRICE . '</th><th>' . _MD_OFFER_CURRENCY . '</th><th>' . _MD_OFFER_ACTIVE . '</th></tr>'; |
|
| 83 | + echo '<tr><th>'._MD_OFFER_TITLE.'</th><th>'._MD_OFFER_DURATION.'</th><th>'._MD_OFFER_COUNT.'</th><th>'._MD_OFFER_PRICE.'</th><th>'._MD_OFFER_CURRENCY.'</th><th>'._MD_OFFER_ACTIVE.'</th></tr>'; |
|
| 84 | 84 | $duration_arr = $subscription->durationArray(); |
| 85 | 85 | while (list($offerid, $typeid, $title, $duration, $count, $price, $activeyn, $currency, $descr, $typename, $level) = $xoopsDB->fetchRow($result)) { |
| 86 | 86 | $offertitle = $myts->htmlSpecialChars($title); |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | echo '</table>'; |
| 103 | 103 | } else { |
| 104 | - echo '' . _MD_NORESULTS . '<br><br>'; |
|
| 104 | + echo ''._MD_NORESULTS.'<br><br>'; |
|
| 105 | 105 | } |
| 106 | - echo '<h4>' . _MD_ADD_SUBSCR_OFFER . '</h4>'; |
|
| 106 | + echo '<h4>'._MD_ADD_SUBSCR_OFFER.'</h4>'; |
|
| 107 | 107 | |
| 108 | 108 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
| 109 | 109 | $form = new XoopsThemeForm(_MD_ADD_OFFER_FORM, 'newofferform', 'subscriptions.php'); |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | echo '</td></tr></table>'; |
| 139 | 139 | |
| 140 | 140 | //Show item types |
| 141 | - $sql = 'SELECT typeid, typename, typelevel FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . ''; |
|
| 141 | + $sql = 'SELECT typeid, typename, typelevel FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes').''; |
|
| 142 | 142 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 143 | 143 | $numrows = $xoopsDB->getRowsNum($result); |
| 144 | 144 | if ($numrows > 0) { |
| 145 | - echo '<h4>' . _MD_ITEMTYPES . '</h4>'; |
|
| 145 | + echo '<h4>'._MD_ITEMTYPES.'</h4>'; |
|
| 146 | 146 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>"; |
| 147 | - echo '<tr><th>' . _MD_ITEMTYPE_NAME . '</th><th>' . _MD_ITEMTYPE_LEVEL . '</th><th>' . _MD_ACTION . '</th></tr>'; |
|
| 147 | + echo '<tr><th>'._MD_ITEMTYPE_NAME.'</th><th>'._MD_ITEMTYPE_LEVEL.'</th><th>'._MD_ACTION.'</th></tr>'; |
|
| 148 | 148 | $duration_arr = $subscription->durationArray(); |
| 149 | 149 | while (list($typeid, $typename, $level) = $xoopsDB->fetchRow($result)) { |
| 150 | 150 | $typename = $myts->htmlSpecialChars($typename); |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | echo '<tr>'; |
| 155 | 155 | echo "<td class=\"even\"><a href=\"subscriptions.php?op=edittype&typeid=$typeid\">$typename</strong></td>"; |
| 156 | 156 | echo "<td class=\"odd\">$level</td>"; |
| 157 | - echo "<td class=\"odd\"><a href=\"subscriptions.php?op=deltype&typeid=$typeid\">" . _MD_DELETE . '</strong></td>'; |
|
| 157 | + echo "<td class=\"odd\"><a href=\"subscriptions.php?op=deltype&typeid=$typeid\">"._MD_DELETE.'</strong></td>'; |
|
| 158 | 158 | echo '</tr>'; |
| 159 | 159 | } |
| 160 | 160 | echo '</table>'; |
| 161 | 161 | } else { |
| 162 | - echo '' . _MD_NORESULTS . '<br><br>'; |
|
| 162 | + echo ''._MD_NORESULTS.'<br><br>'; |
|
| 163 | 163 | } |
| 164 | - echo '<h4>' . _MD_ADD_ITEMTYPE . '</h4>'; |
|
| 164 | + echo '<h4>'._MD_ADD_ITEMTYPE.'</h4>'; |
|
| 165 | 165 | |
| 166 | 166 | //Add item type form |
| 167 | 167 | echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td>"; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | global $xoopsDB, $eh, $myts, $get_typeid, $xoopsUser; |
| 183 | 183 | if ($get_typeid == 0) { |
| 184 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 184 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 185 | 185 | exit(); |
| 186 | 186 | } |
| 187 | 187 | xoops_cp_header(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $adminObject->displayNavigation(basename(__FILE__)); |
| 190 | 190 | //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
| 191 | 191 | echo '<br>'; |
| 192 | - $sql = 'SELECT typeid, typename, typelevel FROM ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . " WHERE typeid=$get_typeid"; |
|
| 192 | + $sql = 'SELECT typeid, typename, typelevel FROM '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes')." WHERE typeid=$get_typeid"; |
|
| 193 | 193 | $result = $xoopsDB->query($sql) or $eh->show('0013'); |
| 194 | 194 | $numrows = $xoopsDB->getRowsNum($result); |
| 195 | 195 | if ($numrows > 0) { |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | echo '</td></tr></table>'; |
| 208 | 208 | } |
| 209 | 209 | } else { |
| 210 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 210 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_TYPEID); |
|
| 211 | 211 | exit(); |
| 212 | 212 | } |
| 213 | 213 | xoops_cp_footer(); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | global $xoopsDB, $eh, $xoopsUser, $subscription, $subscriptionhandler, $get_offerid, $itemtypes; |
| 219 | 219 | if ($get_offerid == 0) { |
| 220 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 220 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 221 | 221 | exit(); |
| 222 | 222 | } |
| 223 | 223 | xoops_cp_header(); |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | $adminObject->displayNavigation(basename(__FILE__)); |
| 226 | 226 | //adminmenu(4, _MD_MANAGE_SUBSCRIPTION_OFFERS); |
| 227 | 227 | echo '<br>'; |
| 228 | - $sql = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 229 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') |
|
| 228 | + $sql = 'SELECT o.offerid, o.title, o.typeid, o.duration, o.count, o.price, o.activeyn, o.currency, o.descr, t.typename, t.typelevel FROM ' |
|
| 229 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes') |
|
| 230 | 230 | . ' t, ' |
| 231 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 231 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_subscr_offers') |
|
| 232 | 232 | . ' o WHERE o.typeid=t.typeid AND o.offerid=' |
| 233 | 233 | . $get_offerid |
| 234 | 234 | . ''; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | echo '</td></tr></table>'; |
| 272 | 272 | } |
| 273 | 273 | } else { |
| 274 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 274 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_INVALID_OFFERID); |
|
| 275 | 275 | exit(); |
| 276 | 276 | } |
| 277 | 277 | xoops_cp_footer(); |
@@ -291,13 +291,13 @@ discard block |
||
| 291 | 291 | global $xoopsDB, $eh, $myts, $moddir; |
| 292 | 292 | //Get POST variables; |
| 293 | 293 | $post_title = $myts->makeTboxData4Save($_POST['title']); |
| 294 | - $post_typeid = (int)$_POST['typeid']; |
|
| 294 | + $post_typeid = (int) $_POST['typeid']; |
|
| 295 | 295 | $post_duration = $myts->makeTboxData4Save($_POST['duration']); |
| 296 | 296 | $post_currency = $myts->makeTboxData4Save($_POST['currency']); |
| 297 | - $post_count = (int)$_POST['count']; |
|
| 297 | + $post_count = (int) $_POST['count']; |
|
| 298 | 298 | $post_price = $myts->makeTboxData4Save($_POST['price']); |
| 299 | 299 | if (isset($activeyn)) { |
| 300 | - $post_activeyn = (int)$_POST['activeyn']; |
|
| 300 | + $post_activeyn = (int) $_POST['activeyn']; |
|
| 301 | 301 | } else { |
| 302 | 302 | $post_activeyn = 0; |
| 303 | 303 | } |
@@ -307,12 +307,12 @@ discard block |
||
| 307 | 307 | $post_descr = ''; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') . '_offerid_seq'); |
|
| 311 | - $sql = sprintf("INSERT INTO %s (offerid, title, typeid, duration, COUNT, price, activeyn, currency, descr) VALUES (%u, '%s', %u, %u, %u, '%s', %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers'), $gen_offerid, $post_title, $post_typeid, |
|
| 310 | + $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_subscr_offers').'_offerid_seq'); |
|
| 311 | + $sql = sprintf("INSERT INTO %s (offerid, title, typeid, duration, COUNT, price, activeyn, currency, descr) VALUES (%u, '%s', %u, %u, %u, '%s', %u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_subscr_offers'), $gen_offerid, $post_title, $post_typeid, |
|
| 312 | 312 | $post_duration, $post_count, $post_price, $post_activeyn, $post_currency, $post_descr); |
| 313 | 313 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 314 | 314 | $gen_offerid = $xoopsDB->getInsertId(); |
| 315 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php?offerid=" . $gen_offerid . '', 2, _MD_SAVED); |
|
| 315 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php?offerid=".$gen_offerid.'', 2, _MD_SAVED); |
|
| 316 | 316 | exit(); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | { |
| 321 | 321 | global $xoopsDB, $eh, $myts, $moddir; |
| 322 | 322 | //Get POST variables; |
| 323 | - $post_offerid = (int)$_POST['offerid']; |
|
| 323 | + $post_offerid = (int) $_POST['offerid']; |
|
| 324 | 324 | $post_title = $myts->makeTboxData4Save($_POST['title']); |
| 325 | - $post_typeid = (int)$_POST['typeid']; |
|
| 325 | + $post_typeid = (int) $_POST['typeid']; |
|
| 326 | 326 | $post_duration = $myts->makeTboxData4Save($_POST['duration']); |
| 327 | 327 | $post_currency = $myts->makeTboxData4Save($_POST['currency']); |
| 328 | - $post_count = (int)$_POST['count']; |
|
| 328 | + $post_count = (int) $_POST['count']; |
|
| 329 | 329 | $post_price = $myts->makeTboxData4Save($_POST['price']); |
| 330 | 330 | if (isset($_POST['activeyn'])) { |
| 331 | - $post_activeyn = (int)$_POST['activeyn']; |
|
| 331 | + $post_activeyn = (int) $_POST['activeyn']; |
|
| 332 | 332 | } else { |
| 333 | 333 | $post_activeyn = 0; |
| 334 | 334 | } |
@@ -338,13 +338,13 @@ discard block |
||
| 338 | 338 | $post_descr = ''; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | - $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') . '_offerid_seq'); |
|
| 341 | + $gen_offerid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_subscr_offers').'_offerid_seq'); |
|
| 342 | 342 | $sql = 'UPDATE ' |
| 343 | - . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_subscr_offers') |
|
| 343 | + . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_subscr_offers') |
|
| 344 | 344 | . " SET title = '$post_title', typeid = '$post_typeid', duration = '$post_duration', count = '$post_count', price = '$post_price', activeyn = '$post_activeyn', currency = '$post_currency', descr = '$post_descr' WHERE offerid='$post_offerid'"; |
| 345 | 345 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 346 | 346 | $gen_offerid = $xoopsDB->getInsertId(); |
| 347 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php?offerid=" . $post_offerid . '', 2, _MD_SAVED); |
|
| 347 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php?offerid=".$post_offerid.'', 2, _MD_SAVED); |
|
| 348 | 348 | exit(); |
| 349 | 349 | } |
| 350 | 350 | |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | global $xoopsDB, $eh, $myts, $_POST, $moddir; |
| 355 | 355 | $p_typename = $myts->makeTboxData4Save($_POST['typename']); |
| 356 | 356 | $p_level = $myts->makeTboxData4Save($_POST['typelevel']); |
| 357 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . '_typeid_seq'); |
|
| 358 | - $sql = sprintf("INSERT INTO %s (typeid, typename, typelevel) VALUES (%u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), $newid, $p_typename, $p_level); |
|
| 357 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes').'_typeid_seq'); |
|
| 358 | + $sql = sprintf("INSERT INTO %s (typeid, typename, typelevel) VALUES (%u, '%s', '%s')", $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes'), $newid, $p_typename, $p_level); |
|
| 359 | 359 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 360 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 360 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 361 | 361 | exit(); |
| 362 | 362 | } |
| 363 | 363 | |
@@ -366,19 +366,19 @@ discard block |
||
| 366 | 366 | { |
| 367 | 367 | global $xoopsDB, $eh, $moddir, $subscriptionhandler; |
| 368 | 368 | if (isset($_GET['typeid'])) { |
| 369 | - $g_typeid = (int)$_GET['typeid']; |
|
| 369 | + $g_typeid = (int) $_GET['typeid']; |
|
| 370 | 370 | } else { |
| 371 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_ERR_ITEMTYPE_DELETE); |
|
| 371 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_ERR_ITEMTYPE_DELETE); |
|
| 372 | 372 | exit(); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | if ($subscriptionhandler->countSubscriptionsForType($g_typeid) > 0) { |
| 376 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 3, _MD_ERR_ITEMTYPE_LINKED_TO_LISTINGS); |
|
| 376 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 3, _MD_ERR_ITEMTYPE_LINKED_TO_LISTINGS); |
|
| 377 | 377 | exit(); |
| 378 | 378 | } |
| 379 | - $sql = sprintf('DELETE FROM %s WHERE typeid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes'), $g_typeid); |
|
| 379 | + $sql = sprintf('DELETE FROM %s WHERE typeid=%u', $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes'), $g_typeid); |
|
| 380 | 380 | $xoopsDB->queryF($sql) or $eh->show('0013'); |
| 381 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 1, _MD_ITEMTYPE_DELETED); |
|
| 381 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 1, _MD_ITEMTYPE_DELETED); |
|
| 382 | 382 | exit(); |
| 383 | 383 | } |
| 384 | 384 | |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | { |
| 388 | 388 | global $xoopsDB, $eh, $post_typeid, $myts, $moddir; |
| 389 | 389 | $p_typename = $myts->makeTboxData4Save($_POST['typename']); |
| 390 | - $p_level = (int)$_POST['typelevel']; |
|
| 391 | - $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . '_typeid_seq'); |
|
| 392 | - $sql = 'UPDATE ' . $xoopsDB->prefix($xoopsModule->getVar('dirname', 'n') . '_itemtypes') . " SET typename='$p_typename', typelevel='$p_level' WHERE typeid='$post_typeid'"; |
|
| 390 | + $p_level = (int) $_POST['typelevel']; |
|
| 391 | + $newid = $xoopsDB->genId($xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes').'_typeid_seq'); |
|
| 392 | + $sql = 'UPDATE '.$xoopsDB->prefix($xoopsModule->getVar('dirname', 'n').'_itemtypes')." SET typename='$p_typename', typelevel='$p_level' WHERE typeid='$post_typeid'"; |
|
| 393 | 393 | $xoopsDB->query($sql) or $eh->show('0013'); |
| 394 | - redirect_header(XOOPS_URL . "/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 394 | + redirect_header(XOOPS_URL."/modules/$moddir/admin/subscriptions.php", 2, _MD_SAVED); |
|
| 395 | 395 | exit(); |
| 396 | 396 | } |
| 397 | 397 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | if (false !== ($moduleHelper = Xmf\Module\Helper::getHelper($moduleDirName))) { |
| 28 | 28 | } else { |
| 29 | - $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
| 29 | + $moduleHelper = Xmf\Module\Helper::getHelper('system'); |
|
| 30 | 30 | } |
| 31 | 31 | $adminObject = \Xmf\Module\Admin::getInstance(); |
| 32 | 32 | |
@@ -36,39 +36,39 @@ discard block |
||
| 36 | 36 | $moduleHelper->loadLanguage('modinfo'); |
| 37 | 37 | |
| 38 | 38 | $adminmenu[] = [ |
| 39 | - 'title' => _AM_MODULEADMIN_HOME, |
|
| 40 | - 'link' => 'admin/index.php', |
|
| 41 | - 'icon' => $pathIcon32 . '/home.png', |
|
| 39 | + 'title' => _AM_MODULEADMIN_HOME, |
|
| 40 | + 'link' => 'admin/index.php', |
|
| 41 | + 'icon' => $pathIcon32 . '/home.png', |
|
| 42 | 42 | ]; |
| 43 | 43 | $adminmenu[] = [ |
| 44 | - 'title' => _MI_EFQDIR_ADMENU3, |
|
| 45 | - 'link' => 'admin/directories.php', |
|
| 46 | - 'icon' => $pathIcon32 . '/category.png', |
|
| 44 | + 'title' => _MI_EFQDIR_ADMENU3, |
|
| 45 | + 'link' => 'admin/directories.php', |
|
| 46 | + 'icon' => $pathIcon32 . '/category.png', |
|
| 47 | 47 | ]; |
| 48 | 48 | $adminmenu[] = [ |
| 49 | - 'title' => _MI_EFQDIR_ADMENU4, |
|
| 50 | - 'link' => 'admin/fieldtypes.php', |
|
| 51 | - 'icon' => $pathIcon32 . '/manage.png' |
|
| 49 | + 'title' => _MI_EFQDIR_ADMENU4, |
|
| 50 | + 'link' => 'admin/fieldtypes.php', |
|
| 51 | + 'icon' => $pathIcon32 . '/manage.png' |
|
| 52 | 52 | ]; |
| 53 | 53 | $adminmenu[] = [ |
| 54 | - 'title' => _MI_EFQDIR_ADMENU5, |
|
| 55 | - 'link' => 'admin/main.php?op=listNewListings', |
|
| 56 | - 'icon' => 'images/prefs.png', |
|
| 54 | + 'title' => _MI_EFQDIR_ADMENU5, |
|
| 55 | + 'link' => 'admin/main.php?op=listNewListings', |
|
| 56 | + 'icon' => 'images/prefs.png', |
|
| 57 | 57 | ]; |
| 58 | 58 | $adminmenu[] = [ |
| 59 | - 'title' => _MI_EFQDIR_ADMENU7, |
|
| 60 | - 'link' => 'admin/subscriptions.php', |
|
| 61 | - 'icon' => $pathIcon32 . '/manage.png' |
|
| 59 | + 'title' => _MI_EFQDIR_ADMENU7, |
|
| 60 | + 'link' => 'admin/subscriptions.php', |
|
| 61 | + 'icon' => $pathIcon32 . '/manage.png' |
|
| 62 | 62 | ]; |
| 63 | 63 | $adminmenu[] = [ |
| 64 | - 'title' => _MI_EFQDIR_ADMENU8, |
|
| 65 | - 'link' => 'admin/main.php?op=duplicateDataTypes', |
|
| 66 | - 'icon' => $pathIcon32 . '/manage.png', |
|
| 64 | + 'title' => _MI_EFQDIR_ADMENU8, |
|
| 65 | + 'link' => 'admin/main.php?op=duplicateDataTypes', |
|
| 66 | + 'icon' => $pathIcon32 . '/manage.png', |
|
| 67 | 67 | ]; |
| 68 | 68 | $adminmenu[] = [ |
| 69 | - 'title' => _AM_MODULEADMIN_ABOUT, |
|
| 70 | - 'link' => 'admin/about.php', |
|
| 71 | - 'icon' => $pathIcon32 . '/about.png', |
|
| 69 | + 'title' => _AM_MODULEADMIN_ABOUT, |
|
| 70 | + 'link' => 'admin/about.php', |
|
| 71 | + 'icon' => $pathIcon32 . '/about.png', |
|
| 72 | 72 | ]; |
| 73 | 73 | //$adminmenu[5]['title'] = _MI_EFQDIR_ADMENU6; |
| 74 | 74 | //$adminmenu[5]['link'] = "admin/addresstypes.php"; |
@@ -38,17 +38,17 @@ discard block |
||
| 38 | 38 | $adminmenu[] = [ |
| 39 | 39 | 'title' => _AM_MODULEADMIN_HOME, |
| 40 | 40 | 'link' => 'admin/index.php', |
| 41 | - 'icon' => $pathIcon32 . '/home.png', |
|
| 41 | + 'icon' => $pathIcon32.'/home.png', |
|
| 42 | 42 | ]; |
| 43 | 43 | $adminmenu[] = [ |
| 44 | 44 | 'title' => _MI_EFQDIR_ADMENU3, |
| 45 | 45 | 'link' => 'admin/directories.php', |
| 46 | - 'icon' => $pathIcon32 . '/category.png', |
|
| 46 | + 'icon' => $pathIcon32.'/category.png', |
|
| 47 | 47 | ]; |
| 48 | 48 | $adminmenu[] = [ |
| 49 | 49 | 'title' => _MI_EFQDIR_ADMENU4, |
| 50 | 50 | 'link' => 'admin/fieldtypes.php', |
| 51 | - 'icon' => $pathIcon32 . '/manage.png' |
|
| 51 | + 'icon' => $pathIcon32.'/manage.png' |
|
| 52 | 52 | ]; |
| 53 | 53 | $adminmenu[] = [ |
| 54 | 54 | 'title' => _MI_EFQDIR_ADMENU5, |
@@ -58,17 +58,17 @@ discard block |
||
| 58 | 58 | $adminmenu[] = [ |
| 59 | 59 | 'title' => _MI_EFQDIR_ADMENU7, |
| 60 | 60 | 'link' => 'admin/subscriptions.php', |
| 61 | - 'icon' => $pathIcon32 . '/manage.png' |
|
| 61 | + 'icon' => $pathIcon32.'/manage.png' |
|
| 62 | 62 | ]; |
| 63 | 63 | $adminmenu[] = [ |
| 64 | 64 | 'title' => _MI_EFQDIR_ADMENU8, |
| 65 | 65 | 'link' => 'admin/main.php?op=duplicateDataTypes', |
| 66 | - 'icon' => $pathIcon32 . '/manage.png', |
|
| 66 | + 'icon' => $pathIcon32.'/manage.png', |
|
| 67 | 67 | ]; |
| 68 | 68 | $adminmenu[] = [ |
| 69 | 69 | 'title' => _AM_MODULEADMIN_ABOUT, |
| 70 | 70 | 'link' => 'admin/about.php', |
| 71 | - 'icon' => $pathIcon32 . '/about.png', |
|
| 71 | + 'icon' => $pathIcon32.'/about.png', |
|
| 72 | 72 | ]; |
| 73 | 73 | //$adminmenu[5]['title'] = _MI_EFQDIR_ADMENU6; |
| 74 | 74 | //$adminmenu[5]['link'] = "admin/addresstypes.php"; |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | $pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); |
| 22 | -echo "<div class='adminfooter'>\n" . " <div style='text-align: center;'>\n" . " <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n" . " </div>\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '</div>'; |
|
| 22 | +echo "<div class='adminfooter'>\n"." <div style='text-align: center;'>\n"." <a href='http://www.xoops.org' rel='external'><img src='{$pathIcon32}/xoopsmicrobutton.gif' alt='XOOPS' title='XOOPS'></a>\n"." </div>\n".' '._AM_MODULEADMIN_ADMIN_FOOTER."\n".'</div>'; |
|
| 23 | 23 | |
| 24 | 24 | xoops_cp_footer(); |
@@ -27,60 +27,60 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | //adminmenu(-1); |
| 29 | 29 | if (file_exists(__DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php')) { |
| 30 | - include __DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 30 | + include __DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 31 | 31 | } else { |
| 32 | - include __DIR__ . '/../language/english/main.php'; |
|
| 32 | + include __DIR__ . '/../language/english/main.php'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $couponHandler = xoops_getModuleHandler('coupon', $moddir); |
| 36 | 36 | //$couponHandler = new ListingsCouponHandler; |
| 37 | 37 | |
| 38 | 38 | if (!isset($_GET['op'])) { |
| 39 | - header('location', 'index.php'); |
|
| 39 | + header('location', 'index.php'); |
|
| 40 | 40 | } |
| 41 | 41 | $op = trim($_GET['op']); |
| 42 | 42 | $criteria = new CriteriaCompo(); |
| 43 | 43 | |
| 44 | 44 | switch ($op) { |
| 45 | - case 'expired': |
|
| 46 | - $criteria->add(new Criteria('expire', time(), '<')); |
|
| 47 | - $criteria->add(new Criteria('expire', '0', '!=')); |
|
| 48 | - break; |
|
| 45 | + case 'expired': |
|
| 46 | + $criteria->add(new Criteria('expire', time(), '<')); |
|
| 47 | + $criteria->add(new Criteria('expire', '0', '!=')); |
|
| 48 | + break; |
|
| 49 | 49 | |
| 50 | - case 'noexp': |
|
| 51 | - $criteria->add(new Criteria('expire', '0', '=')); |
|
| 52 | - break; |
|
| 50 | + case 'noexp': |
|
| 51 | + $criteria->add(new Criteria('expire', '0', '=')); |
|
| 52 | + break; |
|
| 53 | 53 | |
| 54 | - case 'future': |
|
| 55 | - $criteria->add(new Criteria('publish', time(), '>')); |
|
| 56 | - break; |
|
| 54 | + case 'future': |
|
| 55 | + $criteria->add(new Criteria('publish', time(), '>')); |
|
| 56 | + break; |
|
| 57 | 57 | } |
| 58 | 58 | $coupons = $couponHandler->getObjects($criteria, false); |
| 59 | 59 | $coupons = $couponHandler->prepare2show($coupons); |
| 60 | 60 | $output = '<table>'; |
| 61 | 61 | foreach ($coupons as $catid => $category) { |
| 62 | - $output .= '<tr> |
|
| 62 | + $output .= '<tr> |
|
| 63 | 63 | <th colspan="2"> |
| 64 | 64 | ' . $category['catTitle'] . '; |
| 65 | 65 | </th> |
| 66 | 66 | </tr>'; |
| 67 | - foreach ($category['coupons'] as $key => $coupon) { |
|
| 68 | - if (!isset($class) || ($class !== 'odd')) { |
|
| 69 | - $class = 'odd'; |
|
| 70 | - } else { |
|
| 71 | - $class = 'even'; |
|
| 72 | - } |
|
| 73 | - $output .= "<tr class='" . $class . '\'> |
|
| 67 | + foreach ($category['coupons'] as $key => $coupon) { |
|
| 68 | + if (!isset($class) || ($class !== 'odd')) { |
|
| 69 | + $class = 'odd'; |
|
| 70 | + } else { |
|
| 71 | + $class = 'even'; |
|
| 72 | + } |
|
| 73 | + $output .= "<tr class='" . $class . '\'> |
|
| 74 | 74 | <td>'; |
| 75 | - $output .= '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/addcoupon.php?couponid=' . $coupon['couponid'] . '"><img src="' . XOOPS_URL . '/modules/' . $mydirname . '/assets/images/editicon.gif" alt="' . _MD_EDITCOUPON . '"></a> |
|
| 75 | + $output .= '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/addcoupon.php?couponid=' . $coupon['couponid'] . '"><img src="' . XOOPS_URL . '/modules/' . $mydirname . '/assets/images/editicon.gif" alt="' . _MD_EDITCOUPON . '"></a> |
|
| 76 | 76 | <a href="' . XOOPS_URL . '/modules/' . $moddir . '/singlelink.php?lid=' . $coupon['lid'] . '">' . $coupon['linkTitle'] . '</a><br> |
| 77 | 77 | <br> |
| 78 | 78 | ' . _MD_PUBLISHEDON . ' ' . $coupon['publish']; |
| 79 | - if ($coupon['expire'] > 0) { |
|
| 80 | - $output .= '<br>' . _MD_EXPIRESON . $coupon['expire']; |
|
| 81 | - } |
|
| 82 | - $output .= '<br>' . _MD_COUPONHITS . ' : ' . $coupon['counter']; |
|
| 83 | - $output .= '</div> |
|
| 79 | + if ($coupon['expire'] > 0) { |
|
| 80 | + $output .= '<br>' . _MD_EXPIRESON . $coupon['expire']; |
|
| 81 | + } |
|
| 82 | + $output .= '<br>' . _MD_COUPONHITS . ' : ' . $coupon['counter']; |
|
| 83 | + $output .= '</div> |
|
| 84 | 84 | </td> |
| 85 | 85 | <td valign="top">' . $coupon['heading'] . '<br>' . $coupon['description'] . '</td> |
| 86 | 86 | </tr> |
@@ -88,11 +88,11 @@ discard block |
||
| 88 | 88 | <td colspan="2" class="foot"> |
| 89 | 89 | <a href="' . XOOPS_URL . '/modules/' . $moddir . '/addcoupon.php?couponid=' . $coupon['couponid'] . '">' . _MD_EDITCOUPON . '</a> |
| 90 | 90 | </tr>'; |
| 91 | - } |
|
| 91 | + } |
|
| 92 | 92 | } |
| 93 | 93 | $output .= '</table>'; |
| 94 | 94 | if (count($coupons) < 1) { |
| 95 | - $output = _MD_NOSAVINGS; |
|
| 95 | + $output = _MD_NOSAVINGS; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | echo $output; |
@@ -18,18 +18,18 @@ 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 | //$mydirname = $xoopsModule->getVar('dirname'); |
| 24 | 24 | |
| 25 | 25 | xoops_cp_header(); |
| 26 | -include __DIR__ . '/../include/functions.php'; |
|
| 26 | +include __DIR__.'/../include/functions.php'; |
|
| 27 | 27 | |
| 28 | 28 | //adminmenu(-1); |
| 29 | -if (file_exists(__DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php')) { |
|
| 30 | - include __DIR__ . '/../language/' . $xoopsConfig['language'] . '/main.php'; |
|
| 29 | +if (file_exists(__DIR__.'/../language/'.$xoopsConfig['language'].'/main.php')) { |
|
| 30 | + include __DIR__.'/../language/'.$xoopsConfig['language'].'/main.php'; |
|
| 31 | 31 | } else { |
| 32 | - include __DIR__ . '/../language/english/main.php'; |
|
| 32 | + include __DIR__.'/../language/english/main.php'; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $couponHandler = xoops_getModuleHandler('coupon', $moddir); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | foreach ($coupons as $catid => $category) { |
| 62 | 62 | $output .= '<tr> |
| 63 | 63 | <th colspan="2"> |
| 64 | - ' . $category['catTitle'] . '; |
|
| 64 | + ' . $category['catTitle'].'; |
|
| 65 | 65 | </th> |
| 66 | 66 | </tr>'; |
| 67 | 67 | foreach ($category['coupons'] as $key => $coupon) { |
@@ -70,23 +70,23 @@ discard block |
||
| 70 | 70 | } else { |
| 71 | 71 | $class = 'even'; |
| 72 | 72 | } |
| 73 | - $output .= "<tr class='" . $class . '\'> |
|
| 73 | + $output .= "<tr class='".$class.'\'> |
|
| 74 | 74 | <td>'; |
| 75 | - $output .= '<a href="' . XOOPS_URL . '/modules/' . $moddir . '/addcoupon.php?couponid=' . $coupon['couponid'] . '"><img src="' . XOOPS_URL . '/modules/' . $mydirname . '/assets/images/editicon.gif" alt="' . _MD_EDITCOUPON . '"></a> |
|
| 76 | - <a href="' . XOOPS_URL . '/modules/' . $moddir . '/singlelink.php?lid=' . $coupon['lid'] . '">' . $coupon['linkTitle'] . '</a><br> |
|
| 75 | + $output .= '<a href="'.XOOPS_URL.'/modules/'.$moddir.'/addcoupon.php?couponid='.$coupon['couponid'].'"><img src="'.XOOPS_URL.'/modules/'.$mydirname.'/assets/images/editicon.gif" alt="'._MD_EDITCOUPON.'"></a> |
|
| 76 | + <a href="' . XOOPS_URL.'/modules/'.$moddir.'/singlelink.php?lid='.$coupon['lid'].'">'.$coupon['linkTitle'].'</a><br> |
|
| 77 | 77 | <br> |
| 78 | - ' . _MD_PUBLISHEDON . ' ' . $coupon['publish']; |
|
| 78 | + ' . _MD_PUBLISHEDON.' '.$coupon['publish']; |
|
| 79 | 79 | if ($coupon['expire'] > 0) { |
| 80 | - $output .= '<br>' . _MD_EXPIRESON . $coupon['expire']; |
|
| 80 | + $output .= '<br>'._MD_EXPIRESON.$coupon['expire']; |
|
| 81 | 81 | } |
| 82 | - $output .= '<br>' . _MD_COUPONHITS . ' : ' . $coupon['counter']; |
|
| 82 | + $output .= '<br>'._MD_COUPONHITS.' : '.$coupon['counter']; |
|
| 83 | 83 | $output .= '</div> |
| 84 | 84 | </td> |
| 85 | - <td valign="top">' . $coupon['heading'] . '<br>' . $coupon['description'] . '</td> |
|
| 85 | + <td valign="top">' . $coupon['heading'].'<br>'.$coupon['description'].'</td> |
|
| 86 | 86 | </tr> |
| 87 | 87 | <tr> |
| 88 | 88 | <td colspan="2" class="foot"> |
| 89 | - <a href="' . XOOPS_URL . '/modules/' . $moddir . '/addcoupon.php?couponid=' . $coupon['couponid'] . '">' . _MD_EDITCOUPON . '</a> |
|
| 89 | + <a href="' . XOOPS_URL.'/modules/'.$moddir.'/addcoupon.php?couponid='.$coupon['couponid'].'">'._MD_EDITCOUPON.'</a> |
|
| 90 | 90 | </tr>'; |
| 91 | 91 | } |
| 92 | 92 | } |