} else { $text = "\n\t\t<form method='post' action='" . e_SELF . "' id='core-banner-list-form'>\n\t\t\t<fieldset id='core-banner-list'>\n\t\t\t\t<legend class='e-hideme'>" . LAN_MANAGE . "</legend>\n\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t<colgroup span='7'>\n\t\t\t\t\t\t<col style='width: 5%'></col>\n\t\t\t\t\t\t<col style='width: 35%'></col>\n\t\t\t\t\t\t<col style='width: 10%'></col>\n\t\t\t\t\t\t<col style='width: 10%'></col>\n\t\t\t\t\t\t<col style='width: 15%'></col>\n\t\t\t\t\t\t<col style='width: 15%'></col>\n\t\t\t\t\t\t<col style='width: 10%'></col>\n\t\t\t\t\t</colgroup>\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th class='center'>" . LAN_ID . "</th>\n\t\t\t\t\t\t\t<th>" . BANNERLAN_22 . "</th>\n\t\t\t\t\t\t\t<th class='center'>" . BANNERLAN_24 . "</th>\n\t\t\t\t\t\t\t<th class='center'>" . BANNERLAN_25 . "</th>\n\t\t\t\t\t\t\t<th class='center'>" . BANNERLAN_26 . "</th>\n\t\t\t\t\t\t\t<th class='center'>" . BANNERLAN_26 . "</th>\n\t\t\t\t\t\t\t<th class='center'>" . LAN_OPTIONS . "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>"; while ($banner_row = $sql->fetch()) { $clickpercentage = $banner_row['banner_clicks'] && $banner_row['banner_impressions'] ? round($banner_row['banner_clicks'] / $banner_row['banner_impressions'] * 100) . "%" : "-"; $impressions_left = $banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] - $banner_row['banner_impressions'] : BANNERLAN_30; $impressions_purchased = $banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] : BANNERLAN_30; $start_date = $banner_row['banner_startdate'] ? strftime("%d %B %Y", $banner_row['banner_startdate']) : LAN_NONE; $end_date = $banner_row['banner_enddate'] ? strftime("%d %B %Y", $banner_row['banner_enddate']) : LAN_NONE; if (strpos($banner_row['banner_campaign'], "^") !== FALSE) { $campaignsplit = explode("^", $banner_row['banner_campaign']); $banner_row['banner_campaign'] = $campaignsplit[0]; $textvisivilitychanged = "(*)"; } else { $textvisivilitychanged = ""; } $text .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='center'>" . $banner_row['banner_id'] . "</td>\n\t\t\t\t\t\t\t<td class='e-pointer' onclick=\"e107Helper.toggle('banner-infocell-{$banner_row['banner_id']}')\">\n\t\t\t\t\t\t\t\t<a href='#banner-infocell-{$banner_row['banner_id']}' class='action e-expandit' title='" . BNRLAN_7 . "'>\n\t\t\t\t\t\t\t\t" . ($banner_row['banner_clientname'] ? $banner_row['banner_clientname'] : BNRLAN_8) . "</a>\n\t\t\t\t\t\t\t\t<div class='e-hideme clear' id='banner-infocell-{$banner_row['banner_id']}'>\n\t\t\t\t\t\t\t\t\t<div class='indent'>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . BNRLAN_11 . ": </strong>" . $banner_row['banner_campaign'] . "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . LAN_VISIBILITY . " </strong>" . r_userclass_name($banner_row['banner_active']) . " " . $textvisivilitychanged . "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . BNRLAN_9 . ": </strong>" . $start_date . "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . BNRLAN_10 . ": </strong>" . $end_date . "</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class='center'>" . $banner_row['banner_clicks'] . "</td>\n\t\t\t\t\t\t\t<td class='center'>" . $clickpercentage . "</td>\n\t\t\t\t\t\t\t<td class='center'>" . $impressions_purchased . "</td>\n\t\t\t\t\t\t\t<td class='center'>" . $impressions_left . "</td>\n\t\t\t\t\t\t\t<td class='center options'>\n\n\t\t\t\t\t\t\t\t<a class='btn btn-large' href='" . e_SELF . "?create.edit." . $banner_row['banner_id'] . "'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t\t\t\t\t<a class='btn btn-large action delete' id='banner-delete-{$banner_row['banner_id']}' href='" . e_SELF . "?delete." . $banner_row['banner_id'] . "' rel='no-confirm' title='" . LAN_CONFDELETE . "'>" . ADMIN_DELETE_ICON . "</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t"; } } $text .= "\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t\t<input type='hidden' id='delete_confirm' name='delete_confirm' value='0' />\n\t\t\t</fieldset>\n\t\t</form>\n\t\t<script type='text/javascript'>\n\t\t\t\$\$('a[id^=banner-delete-]').each( function(element) {\n\t\t\t\telement.observe('click', function(e) {\n\t\t\t\t\tvar el = e.findElement('a.delete'), msg = el.readAttribute('title') || e107.getModLan('delete_confirm');\n\t\t\t\t\t e.stop();\n\t\t\t\t\tif( !e107Helper.confirm(msg) ) return;\n\t\t\t\t\telse {\n\t\t\t\t\t\t\$('delete_confirm').value = 1;\n\t\t\t\t\t\t\$('core-banner-list-form').writeAttribute('action', el.href).submit();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t</script>\n\t"; $ns->tablerender(LAN_PLUGIN_BANNER_NAME . SEP . LAN_MANAGE, $mes->render() . $text); } if ($action == "create") { if ($sub_action == "edit" && $id) { if (!$sql->select("banner", "*", "banner_id = '" . $id . "'")) { $mes->addWarning(BNRLAN_01); } else { while ($banner_row = $sql->fetch()) { $_POST['client_name'] = $banner_row['banner_clientname']; $_POST['client_login'] = $banner_row['banner_clientlogin']; $_POST['client_password'] = $banner_row['banner_clientpassword']; $_POST['banner_image'] = $banner_row['banner_image'];
function show_categories($current) { global $sql, $ns, $ue, $frm; $text = "<div style='text-align:center'>"; $text .= "\n <table class='table adminlist'>\n\n\t\t<thead>\n\t\t<tr>\n\t\t<th>" . EXTLAN_1 . "</th>\n\t\t<th>" . EXTLAN_79 . "</th>\n\t\t<th>" . EXTLAN_5 . "</th>\n\t\t<th>" . EXTLAN_6 . "</th>\n\t\t<th>" . EXTLAN_7 . "</th>\n\t\t<th> </th>\n\t\t<th>" . EXTLAN_8 . "</th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>\n\t\t"; $catList = $ue->user_extended_get_categories(FALSE); if (count($catList)) { // Show current categories $i = 0; foreach ($catList as $ext) { if ($ext['user_extended_struct_order'] != $i) { $ext['user_extended_struct_order'] = $i; $xID = $ext['user_extended_struct_id']; $sql->db_Update("user_extended_struct", "user_extended_struct_order={$i} WHERE user_extended_struct_type = 0 AND user_extended_struct_id={$xID}"); } $text .= "\n\t\t\t\t<tr>\n\t\t\t\t<td>{$ext['user_extended_struct_name']}</td>\n\t\t\t\t<td>" . deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']) . "</td>\n\t\t\t\t<td>" . r_userclass_name($ext['user_extended_struct_applicable']) . "</td>\n\t\t\t\t<td>" . r_userclass_name($ext['user_extended_struct_read']) . "</td>\n\t\t\t\t<td>" . r_userclass_name($ext['user_extended_struct_write']) . "</td>\n\t\t\t\t<td>\n\t\t\t\t<form method='post' action='" . e_SELF . "?cat'>\n\t\t\t\t<div>\n\t\t\t\t<input type='hidden' name='id' value='{$ext['user_extended_struct_id']}.{$ext['user_extended_struct_order']}' />\n\t\t\t\t"; if ($i > 0) { $text .= "\n\t\t\t\t\t<input type='image' alt='' title='" . EXTLAN_26 . "' src='" . ADMIN_UP_ICON_PATH . "' name='catup' value='{$ext['user_extended_struct_id']}.{$i}' />\n\t\t\t\t\t"; } if ($i <= count($catList) - 2) { $text .= "<input type='image' alt='' title='" . EXTLAN_25 . "' src='" . ADMIN_DOWN_ICON_PATH . "' name='catdown' value='{$ext['user_extended_struct_id']}.{$i}' />"; } $text .= "\n\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t\t</td>\n\t\t\t\t<td class='center' style='white-space: nowrap'>\n\t\t\t\t<form method='post' action='" . e_SELF . "?cat' onsubmit='return confirm(\"" . EXTLAN_27 . "\")'>\n\t\t\t\t<div>\n\t\t\t\t<input type='hidden' name='eu_action' value='delcat' />\n\t\t\t\t<input type='hidden' name='key' value='{$ext['user_extended_struct_id']},{$ext['user_extended_struct_name']}' />\n\t\t\t\t<a style='text-decoration:none' href='" . e_SELF . "?cat.{$ext['user_extended_struct_id']}'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t<input type='image' title='" . LAN_DELETE . "' name='eudel' src='" . ADMIN_DELETE_ICON_PATH . "' />\n\t\t\t\t</div>\n\t\t\t\t</form>\n\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t"; $i++; } } else { $text .= "\n\t\t\t<tr>\n\t\t\t<td colspan='8' class='center'>" . EXTLAN_37 . "</td>\n\t\t\t</tr>\n\t\t\t"; } //Show add/edit form $text .= "</tbody>\n\t\t</table>\n\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n\t\t"; $text .= "<div><br /></div>\n\t\t<table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>"; $text .= "\n\n\t\t<tr>\n\t\t<td>" . EXTLAN_38 . ":</td>\n\t\t<td colspan='3'>\n\t\t<input class='tbox' type='text' name='user_field' size='40' value='" . $current['user_extended_struct_name'] . "' maxlength='50' />\n\t\t<br /><span class='field-help'>" . EXTLAN_11 . "</span>\n\t\t</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t<td>" . EXTLAN_31 . ":</td>\n\t\t<td colspan='3'>\n\t\t<input class='tbox' type='text' name='user_text' size='40' value='" . $current['user_extended_struct_text'] . "' maxlength='255' />\n\t\t<br /><span class='field-help'>" . EXTLAN_32 . "</span>\n\t\t</td>\n\t\t</tr>\n\t\t\n\t\t<tr>\n\t\t<td>" . EXTLAN_5 . "</td>\n\t\t<td colspan='3'>\n\t\t" . r_userclass("user_applicable", $current['user_extended_struct_applicable'], 'off', 'member, admin, classes') . "<br /><span class='field-help'>" . EXTLAN_20 . "</span>\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td>" . EXTLAN_6 . "</td>\n\t\t<td colspan='3'>\n\t\t" . r_userclass("user_read", $current['user_extended_struct_read'], 'off', 'public, member, admin, classes, readonly') . "<br /><span class='field-help'>" . EXTLAN_22 . "</span>\n\t\t</td>\n\t\t</tr>\n\n\t\t<tr>\n\t\t<td >" . EXTLAN_7 . "</td>\n\t\t<td colspan='3'>\n\t\t" . r_userclass("user_write", $current['user_extended_struct_write'], 'off', 'member, admin, classes') . "<br /><span class='field-help'>" . EXTLAN_21 . "</span>\n\t\t</td>\n\t\t</tr>\n\t\t</table>"; $text .= "<div class='buttons-bar center'>"; if (!is_array($current)) { $text .= $frm->admin_button('add_category', EXTLAN_39); } else { $text .= $frm->admin_button('update_category', EXTLAN_42, 'update') . $frm->admin_button('cancel', EXTLAN_33); } // ======= end added by Cam. $text .= "</div></form></div>"; $emessage = e107::getMessage(); $ns->tablerender(EXTLAN_9, $emessage->render() . $text); }
function showLimits() { $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); $pref = e107::getPref(); //global $pref; if ($sql->select('userclass_classes', 'userclass_id, userclass_name')) { $classList = $sql->db_getList(); } if ($sql->select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as limit_bw_num, gen_ip as limit_bw_days, gen_intdata as limit_count_num, gen_chardata as limit_count_days", "gen_type = 'download_limit'")) { while ($row = $sql->fetch()) { $limitList[$row['limit_classnum']] = $row; } } $txt = "\n\t\t\t\t<form method='post' action='" . e_SELF . "?" . e_QUERY . "'>\n\t\t\t\t<table class='table adminform'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan='4' style='text-align:left'>\n\t\t\t\t"; if (vartrue($pref['download_limits']) == 1) { $chk = " checked = 'checked'"; } else { $chk = ""; } $txt .= "\n\t\t\t\t\t<input type='checkbox' name='download_limits' value='on'{$chk}/> " . DOWLAN_125 . "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<th class='fcaption'>" . LAN_ID . "</th>\n\t\t\t\t\t<th class='fcaption'>" . DOWLAN_113 . "</th>\n\t\t\t\t\t<th class='fcaption'>" . DOWLAN_107 . "</th>\n\t\t\t\t\t<th class='fcaption'>" . DOWLAN_108 . "</th>\n\t\t\t\t</tr>\n\t\t\t"; if (is_array(vartrue($limitList))) { foreach ($limitList as $row) { $txt .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td>" . $row['limit_id'] . "</td>\n\t\t\t\t\t<td>" . r_userclass_name($row['limit_classnum']) . "</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type='text' class='tbox' size='5' name='count_num[{$row['limit_id']}]' value='" . ($row['limit_count_num'] ? $row['limit_count_num'] : "") . "'/> " . DOWLAN_109 . "\n\t\t\t\t\t\t<input type='text' class='tbox' size='5' name='count_days[{$row['limit_id']}]' value='" . ($row['limit_count_days'] ? $row['limit_count_days'] : "") . "'/> " . DOWLAN_110 . "\n\t\t\t\t\t</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type='text' class='tbox' size='5' name='bw_num[{$row['limit_id']}]' value='" . ($row['limit_bw_num'] ? $row['limit_bw_num'] : "") . "'/> " . DOWLAN_111 . " " . DOWLAN_109 . "\n\t\t\t\t\t\t<input type='text' class='tbox' size='5' name='bw_days[{$row['limit_id']}]' value='" . ($row['limit_bw_days'] ? $row['limit_bw_days'] : "") . "'/> " . DOWLAN_110 . "\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; } } $txt .= "\n\t\t\t</table>\n\t\t\t<div class='buttons-bar center'>\n\t\t\t<input type='submit' class='btn btn-default button' name='updatelimits' value='" . DOWLAN_115 . "'/>\n\t\t\t</div>\n\t\t\t\n\t\t\t<table class='table adminlist'>\n\t\t\t<tr>\n\t\t\t<td colspan='4'><br/><br/></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan='2'>" . r_userclass("newlimit_class", 0, "off", "guest, member, admin, classes, language") . "</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' class='tbox' size='5' name='new_count_num' value=''/> " . DOWLAN_109 . "\n\t\t\t\t<input type='text' class='tbox' size='5' name='new_count_days' value=''/> " . DOWLAN_110 . "\n\t\t\t</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' class='tbox' size='5' name='new_bw_num' value=''/> " . DOWLAN_111 . " " . DOWLAN_109 . "\n\t\t\t\t<input type='text' class='tbox' size='5' name='new_bw_days' value=''/> " . DOWLAN_110 . "\n\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\n\t\t\t"; $txt .= "</table>\n\t\t\t<div class='buttons-bar center'>\n\t\t\t<input type='submit' class='btn btn-default button' name='addlimit' value='" . DOWLAN_114 . "'/>\n\t\t\t</div></form>"; echo $txt; // $ns->tablerender(DOWLAN_112, $txt); // require_once(e_ADMIN.'footer.php'); // exit; }
// Hide date integer values 0 $discount_valid_from = $row['discount_valid_from'] > 0 ? date("Y/m/d", $row['discount_valid_from']) : ""; $discount_valid_till = $row['discount_valid_till'] > 0 ? date("Y/m/d", $row['discount_valid_till']) : ""; // Replace disount flag by description: 0 = Price, 1 = Percentage $discount_flag = $row['discount_flag'] == 1 ? EASYSHOP_ADMIN_DISC_08B : EASYSHOP_ADMIN_DISC_08A; $discount_amount = $row['discount_flag'] == 1 ? $row['discount_percentage'] : $unicode_character_before . number_format($row['discount_price'], 2, '.', '') . $unicode_character_after; $perc_sign = $row['discount_flag'] == 1 ? " %" : ""; // Do something special for 'special' percentages when print_discount_icons flag is set if ($print_discount_icons == 1 and $row['discount_flag'] == 1 and strstr("_5_10_20_50_", "_" . $row['discount_percentage'] . "_")) { $perc_sign .= " <img src='" . e_PLUGIN_ABS . "easyshop/images/offer_" . $row['discount_percentage'] . ".gif' style='height:22px' />"; } // Determine the locked status if ($row['discount_code'] > "") { $discount_locked = "<center><img src='" . e_PLUGIN_ABS . "easyshop/images/lock.gif' style='height:22px' alt='" . $row['discount_code'] . "' title='" . $row['discount_code'] . "'/></center>"; } $text .= "\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $row['discount_name'] . "</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . r_userclass_name($row['discount_class']) . "</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $discount_flag . "</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $discount_amount . $perc_sign . "</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $discount_valid_from . "</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $discount_valid_till . "</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>" . $discount_locked . "</td>\n\t\t\t\t\t\t\t\t\t\t"; // Show the edit and delete icons $text .= "\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>\n\t\t\t\t\t\t\t\t\t\t\t<center>\n\t\t\t\t\t\t\t\t\t\t\t<a href='admin_discounts.php?edit." . $row['discount_id'] . "' alt='" . EASYSHOP_ADMIN_DISC_15 . "'>" . ADMIN_EDIT_ICON . "</a>\n \n\t\t\t\t\t\t\t\t\t\t\t<a href='admin_discounts.php?delete." . $row['discount_id'] . "' alt='" . EASYSHOP_ADMIN_DISC_16 . "'>" . ADMIN_DELETE_ICON . "</a>"; $text .= "\n\t\t\t\t\t\t\t\t\t\t\t</center>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t</tr>"; // Reset the values of variables for the next fetch unset($discount_valid_from); unset($discount_valid_till); unset($discount_flag); unset($discount_amount); unset($discount_locked); } // End of while $text .= "\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</center>"; } $text .= "\n\t\t\t\t\t\t<br />\n\t\t\t\t</fieldset>\n\t\t</center>\n\t</form>\n\t<br />"; // --------------------------------------------------------------------------+
} $text .= "</select><br /><br />\n\t\t<input class='button' type='button' value='" . UCSLAN_17 . "' onclick='removeMe();' />\n\t\t<input class='button' type='button' value='" . UCSLAN_18 . "' onclick='clearMe({$userclass_id});' />\n\t\t<input type='hidden' name='class_id' value='{$userclass_id}' />\n\n\t\t</td></tr></table>\n\t\t</td></tr>\n\t\t<tr><td colspan='2' style='text-align:center' class='forumheader'>\n\t\t<input class='button' type='button' value='" . UCSLAN_19 . " " . $userclass_name . " " . UCSLAN_20 . "' onclick='saveMe({$userclass_id});' />\n\t\t</td>\n\t\t</tr>\n\t\t</table>"; } $text .= "</form>\n\t</div>"; // // Show a table of all userclasses and who can manage them // // lazy get list again $class_total = $sql->db_Select("userclass_classes", "*", "ORDER BY userclass_name", "nowhere"); $text .= "<br /><div style='text-align:center'>\n\t<table class='fborder' style='" . ADMIN_WIDTH . "'>\n\t<tr>\n\t<td class='fcaption'>" . UCSLAN_12 . "</td>\n\t<td class='fcaption'>" . UCSLAN_24 . "</td>\n\t<td class='fcaption'>" . UCSLAN_13 . "</td>\n\t</tr>\n"; if ($class_total == "0") { $text .= "<tr><td colspan='3'>" . UCSLAN_7 . "</td></tr>"; } else { while ($row = $sql->db_Fetch()) { $rEditClass = $row['userclass_editclass']; if (check_class($rEditClass) || getperms("0")) { if (!isset($rEditClass)) { $rEditClass = e_UC_ADMIN; } $text .= "<tr>\n\t\t\t<td class='forumheader3'>{$row['userclass_name']}</td>\n\t\t\t<td class='forumheader3'>" . r_userclass_name($rEditClass) . "</td>\n\t\t\t<td class='forumheader3'>{$row['userclass_description']}</td>\n"; } } } $text .= "</table>"; $ns->tablerender(UCSLAN_21, $text); require_once "footer.php"; function headerjs() { $script_js = "<script type=\"text/javascript\">\n\t\t//<![CDATA[\n\t\t// Adapted from original: Kathi O'Shea (Kathi.O'Shea@internet.com)\n\t\tfunction moveOver() {\n\t\tvar boxLength = document.getElementById('assignclass2').length;\n\t\tvar selectedItem = document.getElementById('assignclass1').selectedIndex;\n\t\tvar selectedText = document.getElementById('assignclass1').options[selectedItem].text;\n\t\tvar selectedValue = document.getElementById('assignclass1').options[selectedItem].value;\n\t\tvar i;\n\t\tvar isNew = true;\n\t\tif (boxLength != 0) {\n\t\tfor (i = 0; i < boxLength; i++) {\n\t\tthisitem = document.getElementById('assignclass2').options[i].text;\n\t\tif (thisitem == selectedText) {\n\t\tisNew = false;\n\t\tbreak;\n\t\t}\n\t\t}\n\t\t}\n\t\tif (isNew) {\n\t\tnewoption = new Option(selectedText, selectedValue, false, false);\n\t\tdocument.getElementById('assignclass2').options[boxLength] = newoption;\n\t\tdocument.getElementById('assignclass1').options[selectedItem].text = '';\n\t\t}\n\t\tdocument.getElementById('assignclass1').selectedIndex=-1;\n\t\t}\n\n\n\t\tfunction removeMe() {\n\t\tvar boxLength = document.getElementById('assignclass2').length;\n\t\tvar boxLength2 = document.getElementById('assignclass1').length;\n\t\tarrSelected = new Array();\n\t\tvar count = 0;\n\t\tfor (i = 0; i < boxLength; i++) {\n\t\tif (document.getElementById('assignclass2').options[i].selected) {\n\t\tarrSelected[count] = document.getElementById('assignclass2').options[i].value;\n\t\tvar valname = document.getElementById('assignclass2').options[i].text;\n\t\tfor (j = 0; j < boxLength2; j++) {\n\t\tif (document.getElementById('assignclass1').options[j].value == arrSelected[count]){\n\t\tdocument.getElementById('assignclass1').options[j].text = valname;\n\t\t}\n\t\t}\n\n\t\t// document.getElementById('assignclass1').options[i].text = valname;\n\t\t}\n\t\tcount++;\n\t\t}\n\t\tvar x;\n\t\tfor (i = 0; i < boxLength; i++) {\n\t\tfor (x = 0; x < arrSelected.length; x++) {\n\t\tif (document.getElementById('assignclass2').options[i].value == arrSelected[x]) {\n\t\tdocument.getElementById('assignclass2').options[i] = null;\n\t\t}\n\t\t}\n\t\tboxLength = document.getElementById('assignclass2').length;\n\t\t}\n\t\t}\n\n\t\tfunction clearMe(clid) {\n\t\tlocation.href = document.location + \"?clear.\" + clid;\n\t\t}\n\n\t\tfunction saveMe(clid) {\n\t\tvar strValues = \"\";\n\t\tvar boxLength = document.getElementById('assignclass2').length;\n\t\tvar count = 0;\n\t\tif (boxLength != 0) {\n\t\tfor (i = 0; i < boxLength; i++) {\n\t\tif (count == 0) {\n\t\tstrValues = document.getElementById('assignclass2').options[i].value;\n\t\t} else {\n\t\tstrValues = strValues + \",\" + document.getElementById('assignclass2').options[i].value;\n\t\t}\n\t\tcount++;\n\t\t}\n\t\t}\n\t\tif (strValues.length == 0) {\n\t\t//alert(\"You have not made any selections\");\n\t\t}\n\t\telse {\n\t\tlocation.href = document.location + \"?\" + clid + \"-\" + strValues;\n\t\t}\n\t\t}\n\t\t//]]>\n\t\t</script>\n"; return $script_js; }
function PreFile_Select($formid = 'prefile_selector') { require_once e_HANDLER . "userclass_class.php"; global $IMAGES_DIRECTORY, $fl; $sql = e107::getDb(); $fl = e107::getFile(); $filelist = array(); $downloadList = array(); /*$sql->db_Select('download', '*', 'download_class != '.e_UC_NOBODY); while ($row = $sql->db_Fetch()) { extract($row); if($download_url) { $filelist[] = array('id' => $download_id, 'name' => $download_name, 'url' => $download_url, 'class' => $download_class); $downloadList[] = $download_url; } }*/ $tmp = $fl->get_files(e_FILE . 'downloads/'); foreach ($tmp as $value) { if (!in_array($value['fname'], $downloadList)) { $filelist[] = array('id' => 0, 'name' => $value['fname'], 'url' => $value['fname']); } } $text = "<!-- Start of PreFile selector -->\n\t<div style='margin-left:0px;margin-right:0px; position:relative;z-index:1000;float:right;display:none' id='{$formid}'>"; $text .= "<div style='position:absolute; bottom:30px; right:75px'>"; $text .= "<table class='fborder' style='background-color: #fff'>\n\t<tr><td class='forumheader3' style='white-space: nowrap'>"; if (!count($filelist)) { $text .= LANHELP_40; } else { $text .= "<select class='tbox' name='prefileselect' onchange=\"addtext(this.value); expandit('{$formid}')\">\n\t\t\t\t<option value=''>" . LANHELP_43 . "</option>"; foreach ($filelist as $file) { if (isset($file['class'])) { $ucinfo = "^" . $file['class']; $ucname = r_userclass_name($file['class']); } else { $ucinfo = ""; $ucname = r_userclass_name(0); } if ($file['id']) { $text .= "<option value=\"[file={e_BASE}request.php?" . $file['id'] . "{$ucinfo}]" . htmlspecialchars($file['name']) . "[/file]\">" . htmlspecialchars($file['name']) . " - {$ucname}</option>\n"; } else { $text .= "<option value=\"[file={e_BASE}request.php?" . htmlspecialchars($file['url']) . "{$ucinfo}]" . htmlspecialchars($file['name']) . "[/file]\">" . htmlspecialchars($file['name']) . " - {$ucname}</option>\n"; } } $text .= "</select>"; } $text .= "</td></tr>\t\n </table></div>\n\t</div>\n<!-- End of PreFile selector -->\n"; return $text; }
while ($row = $sql->db_Fetch()) { $text .= "\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3' valign='top'>"; if ($row['item_image'] == '') { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t "; } else { $item_image = explode(",", $row['item_image']); $arrayLength = count($item_image); // Only show the first item_image $text .= "<img src='{$store_image_path}" . $item_image[0] . "' alt='" . $item_image[0] . "' title='" . $item_image[0] . "' />"; if ($arrayLength > 1) { // Display number of images if there are multiple images $text .= "<br />" . EASYSHOP_CONF_ITM_44 . ": {$arrayLength}"; } } if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0) { $text .= "<br /><img src='" . e_PLUGIN . "easyshop/images/userclass_16.png' alt='" . EASYSHOP_CONF_ITM_46 . "' title='" . EASYSHOP_CONF_ITM_46 . "'/>" . r_userclass_name($row['prod_promo_class']); } $text .= "\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3' valign='top'>\n\t\t\t\t\t\t\t\t\t\t\t" . $row['item_name'] . "\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3' valign='top'>\n\t\t\t\t\t\t\t\t\t\t\t" . number_format($row['item_price'], 2, '.', '') . "\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3' valign='top'>\n\t\t\t\t\t\t\t\t\t\t\t<div style='text-align:center;'>"; if ($row['item_active_status'] == 2) { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<input class='tbox' type='checkbox' name='item_active_status[]' value='" . $row['item_id'] . "' checked='checked' />"; } else { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<input class='tbox' type='checkbox' name='item_active_status[]' value='" . $row['item_id'] . "' />"; } $text .= "\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3' valign='top'>\n\t\t\t\t\t\t\t\t\t\t\t<div style='text-align:center;'>"; if ($row['item_out_of_stock'] == 2) { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<input class='tbox' type='checkbox' name='item_out_of_stock[]' value='" . $row['item_id'] . "' checked='checked' />"; } else { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<input class='tbox' type='checkbox' name='item_out_of_stock[]' value='" . $row['item_id'] . "' />"; } $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t\t<b>" . EASYSHOP_CONF_ITM_21 . ":<b>\n\t\t\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t\t\t<textarea class='tbox' cols='20' rows='3' name='item_out_of_stock_explanation[" . $row['item_id'] . "]'>" . $row['item_out_of_stock_explanation'] . "</textarea>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3' valign='top'>\n\t\t\t\t\t\t\t\t\t\t\t<div style='text-align:center;'>\n\t\t\t\t\t\t <select class='tbox' name='item_order[]'>"; $sql2 = new db();
function show_existing_items($action, $sub_action, $id, $from, $amount) { global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref; $text = "<div style='text-align:center'><div style='padding : 1px; " . ADMIN_WIDTH . "; margin-left: auto; margin-right: auto;'>"; $sortorder = $pref['download_order'] ? $pref['download_order'] : "download_datestamp"; $sortdirection = $pref['download_sort'] ? strtolower($pref['download_sort']) : "desc"; if ($sortdirection != 'desc') { $sortdirection = 'asc'; } if (isset($_POST['searchdisp'])) { $pref['admin_download_disp'] = implode("|", $_POST['searchdisp']); save_prefs(); } if (!$pref['admin_download_disp']) { $search_display = array("download_name", "download_class"); } else { $search_display = explode("|", $pref['admin_download_disp']); } $query = "SELECT d.*, dc.* FROM `#download` AS d\tLEFT JOIN `#download_category` AS dc ON dc. download_category_id = d.download_category"; if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") { $query .= " WHERE download_url REGEXP('" . $_POST['searchquery'] . "') OR download_author REGEXP('" . $_POST['searchquery'] . "') OR download_description REGEXP('" . $_POST['searchquery'] . "') "; foreach ($search_display as $disp) { $query .= " OR {$disp} REGEXP('" . $_POST['searchquery'] . "') "; } $query .= " ORDER BY {$sortorder} {$sortdirection}"; } else { $query .= " ORDER BY " . ($sub_action ? $sub_action : $sortorder) . " " . ($id ? $id : $sortdirection) . " LIMIT {$from}, {$amount}"; } if ($dl_count = $sql->db_Select_gen($query)) { $text .= $rs->form_open("post", e_SELF . "?" . e_QUERY, "myform") . "\n\t\t\t\t<table class='fborder' style='width:99%'>\n\t\t\t\t<tr>\n\t\t\t\t<td style='width:5%' class='fcaption'>ID</td>\n\t\t\t\t"; // Search Display Column header.---------- foreach ($search_display as $disp) { if ($disp == "download_name") { // Toggle direction $text .= "<td class='fcaption'><a href='" . e_SELF . "?main.download_name." . ($id == "desc" ? "asc" : "desc") . ".{$from}'>" . DOWLAN_27 . "</a></td>"; } else { $repl = array("download_", "_"); $text .= "<td class='fcaption'><a href='" . e_SELF . "?main.{$disp}." . ($id == "desc" ? "asc" : "desc") . ".{$from}'>" . ucwords(str_replace($repl, " ", $disp)) . "</a></td>"; } } $text .= "<td style='width:10%' class='fcaption'>" . LAN_OPTIONS . "</td></tr>"; while ($row = $sql->db_Fetch()) { $text .= "<tr><td style='width:5%;vertical-align:top' class='forumheader3'>" . $row['download_id'] . "</td>"; // Display Chosen options foreach ($search_display as $disp) { $text .= "<td class='forumheader3' style='vertical-align:top'>"; switch ($disp) { case "download_name": $text .= "<a href='" . e_BASE . "download.php?view." . $row['download_id'] . "'>" . $row['download_name'] . "</a>"; break; case "download_category": $text .= $row['download_category_name'] . " "; break; case "download_datestamp": $text .= $row[$disp] ? strftime($pref['shortdate'], $row[$disp]) . " " : " "; break; case "download_class": case "download_visible": $text .= r_userclass_name($row[$disp]) . " "; break; case "download_filesize": $text .= $row[$disp] ? round($row[$disp] / 1000) . " Kb " : " "; break; case "download_thumb": $text .= $row[$disp] ? "<img src='" . e_FILE . "downloadthumbs/" . $row[$disp] . "' alt='' />" : ""; break; case "download_image": $text .= "<a rel='external' href='" . e_FILE . "downloadimages/" . $row[$disp] . "' >" . $row[$disp] . "</a> "; break; case "download_description": $text .= $tp->toHTML($row[$disp], TRUE) . " "; break; case "download_active": if ($row[$disp] == 1) { $text .= "<img src='" . ADMIN_TRUE_ICON_PATH . "' title='" . DOWLAN_123 . "' alt='' style='cursor:help' />\n"; } elseif ($row[$disp] == 2) { $text .= "<img src='" . ADMIN_TRUE_ICON_PATH . "' title='" . DOWLAN_124 . "' alt='' style='cursor:help' /><img src='" . ADMIN_TRUE_ICON_PATH . "' title='" . DOWLAN_124 . "' alt='' style='cursor:help' />\n"; } else { $text .= "<img src='" . ADMIN_FALSE_ICON_PATH . "' title='" . DOWLAN_122 . "' alt='' style='cursor:help' />\n"; } break; case "download_comment": $text .= $row[$disp] ? ADMIN_TRUE_ICON : " "; break; default: $text .= $row[$disp] . " "; } $text .= "</td>"; } $text .= "\n\t\t\t\t\t<td style='width:20%;vertical-align:top; text-align:center' class='forumheader3'>\n\t\t\t\t\t<a href='" . e_SELF . "?create.edit." . $row['download_id'] . "'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t\t<input type='image' title='" . LAN_DELETE . "' name='delete[main_" . $row['download_id'] . "]' src='" . ADMIN_DELETE_ICON_PATH . "' onclick=\"return jsconfirm('" . $tp->toJS(DOWLAN_33 . " [ID: " . $row['download_id'] . " ]") . "') \" />\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>"; } $text .= "</table></form>"; } else { // 'No downloads yet' $text .= "<div style='text-align:center'>" . DOWLAN_6 . "</div>"; } $text .= "</div>"; // Next-Previous. $downloads = $sql->db_Count("download"); if ($downloads > $amount && !$_POST['searchquery']) { $parms = "{$downloads},{$amount},{$from}," . e_SELF . "?" . (e_QUERY ? "{$action}.{$sub_action}.{$id}." : "main.{$sortorder}.{$sortdirection}.") . "[FROM]"; $text .= "<br />" . $tp->parseTemplate("{NEXTPREV={$parms}}"); } // Search & display options etc. $text .= "<br /><form method='post' action='" . e_SELF . "'>\n<p>\n<input class='tbox' type='text' name='searchquery' size='20' value='' maxlength='50' />\n<input class='button' type='submit' name='searchsubmit' value='" . DOWLAN_51 . "' />\n</p>"; $text .= "<div style='cursor:pointer' onclick=\"expandit('sdisp')\">" . LAN_DISPLAYOPT . "</div>"; $text .= "<div id='sdisp' style='padding-top:4px;display:none;text-align:center;margin-left:auto;margin-right:auto'>\n\t\t<table class='forumheader3' style='width:95%'><tr>"; $fields = mysql_list_fields($mySQLdefaultdb, MPREFIX . "download"); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $fname[] = mysql_field_name($fields, $i); } $m = 0; $replacechar = array("download_", "_"); foreach ($fname as $fcol) { $checked = in_array($fcol, $search_display) ? "checked='checked'" : ""; $text .= "<td style='text-align:left; padding:0px'>"; $text .= "<input type='checkbox' name='searchdisp[]' value='" . $fcol . "' {$checked} />" . str_replace($replacechar, " ", $fcol) . "</td>\n"; $m++; if ($m == 5) { $text .= "</tr><tr>"; $m = 0; } } $text .= "</table></div>\n\t\t</form>\n\n\t\t</div>"; $ns->tablerender(DOWLAN_7, $text); }
function poll_list() { $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); $frm = e107::getForm(); $mes = e107::getMessage(); global $user_pref; if (isset($_POST['etrigger_ecolumns'])) { $user_pref['admin_poll_columns'] = $_POST['e-columns']; save_prefs('user'); } $fieldpref = varset($user_pref['admin_poll_columns']) ? $user_pref['admin_poll_columns'] : array("poll_id", "poll_title", "poll_options", "poll_vote_userclass"); //TODO Add more column options. $fields = array('poll_id' => array('title' => LAN_ID, 'width' => '5%', 'forced' => TRUE), 'poll_title' => array('title' => POLLAN_3, 'width' => 'auto'), 'poll_options' => array('title' => POLLAN_4, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'), 'poll_vote_userclass' => array('title' => LAN_USERCLASS, 'type' => 'text', 'width' => 'auto'), 'options' => array('title' => LAN_OPTIONS, 'forced' => TRUE, 'width' => '10%', 'thclass' => 'center last')); $text = "\n\t\t<form action='" . e_SELF . "' method='post' id='del_poll'>"; if ($poll_total = $sql->select("polls", "*")) { $text .= "<table class='table adminlist'>"; $text .= $frm->colGroup($fields, $fieldpref) . $frm->thead($fields, $fieldpref); $text .= "<tbody>"; while ($row = $sql->fetch()) { extract($row); // FIXME $pollopts = explode(chr(1), $poll_options); $pollopts = array_filter($pollopts); $text .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$poll_id}</td>"; $text .= in_array("poll_title", $fieldpref) ? "<td class='left'>" . $tp->toHTML($poll_title, TRUE, "no_hook, emotes_off, defs") . "</td>" : ""; $text .= in_array("poll_options", $fieldpref) ? "<td class='left'><ul><li>" . implode("</li><li>", $pollopts) . "</li></ul></td>" : ""; $text .= in_array("poll_comment", $fieldpref) ? "<td>" . ($poll_comment ? LAN_YES : LAN_NO) . "</td>" : ""; $text .= in_array("poll_vote_userclass", $fieldpref) ? "<td>" . r_userclass_name($poll_vote_userclass) . "</td>" : ""; $text .= "\n\t\t\t\t<td class='center' style='white-space:nowrap'>\n\t\t\t\t\t<button class='btn btn-large' type='submit' name='edit[{$poll_id}]' value='edit' alt='" . LAN_EDIT . "' title='" . LAN_EDIT . "' >" . ADMIN_EDIT_ICON . "</button>\n\t\t\t\t\t<button class='btn btn-large action delete' type='submit' name='delete[{$poll_id}]' value='del' onclick=\"return jsconfirm('" . $tp->toJS(LAN_CONFIRMDEL . " [" . $poll_id . "]") . "') \" title='" . LAN_DELETE . "' >" . ADMIN_DELETE_ICON . "</button>\n\t\t\t\t</td>\n\t\t\t</tr>"; } $text .= "</tbody></table>"; } else { $mes->addInfo(POLLAN_7); } $text .= "</form>"; $ns->tablerender(POLLAN_MENU_CAPTION . SEP . POLLAN_1, $mes->render() . $text); }
function poll_list() { $sql = e107::getDb(); $ns = e107::getRender(); $tp = e107::getParser(); $frm = new e_form(true); global $user_pref; if (isset($_POST['etrigger_ecolumns'])) { $user_pref['admin_poll_columns'] = $_POST['e-columns']; save_prefs('user'); } $fieldpref = varset($user_pref['admin_poll_columns']) ? $user_pref['admin_poll_columns'] : array("poll_id", "poll_title", "poll_options", "poll_vote_userclass"); //TODO Add more column options. $fields = array('poll_id' => array('title' => ID, 'width' => '5%', 'forced' => TRUE), 'poll_title' => array('title' => POLLAN_3, 'width' => 'auto'), 'poll_options' => array('title' => POLLAN_4, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center'), 'poll_vote_userclass' => array('title' => LAN_USERCLASS, 'type' => 'text', 'width' => 'auto'), 'options' => array('title' => LAN_OPTIONS, 'forced' => TRUE, 'width' => '10%', 'thclass' => 'center last')); $text = "<div style='text-align:center'><div>\n\t\t<form action='" . e_SELF . "' method='post' id='del_poll'>"; if ($poll_total = $sql->db_Select("polls", "*", "poll_type=1")) { $text .= "<table class='table adminlist'>"; $text .= $frm->colGroup($fields, $fieldpref) . $frm->thead($fields, $fieldpref); $text .= "<tbody>"; while ($row = $sql->db_Fetch()) { extract($row); $text .= "<tr>\n\t\t\t\t<td>{$poll_id}</td>"; $text .= in_array("poll_title", $fieldpref) ? "<td class='left'>" . $tp->toHTML($poll_title, TRUE, "no_hook, emotes_off, defs") . "</td>" : ""; $text .= in_array("poll_options", $fieldpref) ? "<td class='left'>" . str_replace(chr(1), "<br />", $poll_options) . "</td>" : ""; $text .= in_array("poll_comment", $fieldpref) ? "<td>" . ($poll_comment ? LAN_YES : LAN_NO) . "</td>" : ""; $text .= in_array("poll_vote_userclass", $fieldpref) ? "<td>" . r_userclass_name($poll_vote_userclass) . "</td>" : ""; $text .= "\n\t\t\t\t<td class='center'>\n\t\t\t\t\t<input type='image' name='edit[{$poll_id}]' value='edit' src='" . ADMIN_EDIT_ICON_PATH . "' alt='" . LAN_EDIT . "' title='" . LAN_EDIT . "' style='border:0px' />\n\t\t\t\t\t<input type='image' name='delete[{$poll_id}]' value='del' onclick=\"return jsconfirm('" . $tp->toJS(LAN_CONFIRMDEL . " [" . $poll_id . "]") . "') \" src='" . ADMIN_DELETE_ICON_PATH . "' alt='" . LAN_DELETE . "' title='" . LAN_DELETE . "' style='border:0px' />\n\t\t\t\t</td>\n\t\t\t\t</tr>"; } $text .= "</tbody></table>"; } else { $text .= "<div style='text-align:center'>" . POLLAN_7 . "</div>"; } $text .= "</form></div></div>"; $emessage = eMessage::getInstance(); $ns->tablerender(POLLAN_MENU_CAPTION . " :: " . POLLAN_1, $emessage->render() . $text); }
function update_stock($txn_id = NULL, $phpsessionid = NULL) { global $pref; $sqlcheck = new db(); $trans_array = transaction($phpsessionid, 0, 0, "Completed"); $items_array = unserialize($trans_array['all_items']); $count = 1; $temp_array = ""; while ($items_array["db_id_" . $count]) { if ($sqlcheck->db_Select("easyshop_items", "*", "item_id = '" . $items_array["db_id_" . $count] . "'")) { while ($row = $sqlcheck->db_Fetch()) { if ($row['item_track_stock'] == 2) { // Is this a tracked stock item? if ($row['item_instock'] >= $items_array["quantity" . $count]) { $newstock = $row['item_instock'] - $items_array["quantity_" . $count]; if ($row['item_minimum'] == 0 || $row['item_minimum'] == NULL) { // Minimum level is flexible, but with bottom-level 1. $minimum_level = 1; } else { $minimum_level = $row['item_minimum']; } if ($newstock <= $minimum_level && $newstock != 0) { // Minimum level is reached; send e-mail alert ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 1); // Alert-type = 1 } if ($newstock == 0) { $sqlcheck->db_Update("easyshop_items", "item_instock = '" . $newstock . "', item_out_of_stock = '2'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'"); ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 3); // Alert-type = 3 } else { $sqlcheck->db_Update("easyshop_items", "item_instock = '" . $newstock . "'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'"); } } else { // There is a problem; client has paid for more items than are in stock // Raise out of stock flag and send email $sqlcheck->db_Update("easyshop_items", "item_instock = '0', item_out_of_stock = '2'\r\n\t\t\t\t\t\t\t\t\tWHERE item_id = '" . $items_array["db_id_" . $count] . "'"); ShopMail::easyshop_sendalert($row['item_id'], $newstock, $minimum_level, 2); // Alert-type = 2 } } if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0 && $trans_array['ipn_user_id'] > 0) { // Auto promotion of user $sqlcheck2 = new db(); $sqlcheck3 = new db(); require_once e_HANDLER . 'userclass_class.php'; $promo_class_name = r_userclass_name($row['prod_promo_class']); $sqlcheck2->db_Select("user", "*", "user_id='" . $trans_array['ipn_user_id'] . "'"); if ($row2 = $sqlcheck2->db_Fetch()) { $user_name = $row2['user_name']; $class_extant = explode(',', $row2['user_class']); foreach ($class_extant as $key => $value) { if (intval($value) == 0) { unset($class_extant[$key]); } } if ($row['prod_promo_class'] != 255 && $row['prod_promo_class'] != 0 && !in_array($row['prod_promo_class'], $class_extant)) { $class_extant[] = $row['prod_promo_class']; } $new_array = array_unique($class_extant); sort($new_array); $class_list = implode(',', $new_array); $sqlcheck3->db_Update("user", "user_class='" . $class_list . "' where user_id='" . $trans_array['ipn_user_id'] . "'"); $mailto = !(isset($pref['siteadminemail']) && strlen($pref['siteadminemail']) == 0) ? $pref['replyto_email'] : $pref['siteadminemail']; // Keep 0.7.8 compatible $subject = $pref['sitename'] . ": " . EASYSHOP_IPN_30; // [USERNAME] upgraded to class [PROMOCLASS] $subject = str_replace("[USERNAME]", $user_name, $subject); $subject = str_replace("[PROMOCLASS]", $promo_class_name, $subject); $message = EASYSHOP_IPN_31 . "<br /><br />"; $message .= EASYSHOP_IPN_32 . "<br /><br />"; $message .= EASYSHOP_IPN_33 . "<br />"; $message .= "<br />" . EASYSHOP_IPN_34 . " " . $pref['siteurl']; $message .= "<br /><br />© " . date("Y") . " EasyShop"; $message = str_replace("[USERNAME]", $row2['user_name'], $message); $message = str_replace("[USERLINK]", SITEURL . "user.php?id." . $trans_array['ipn_user_id'], $message); $message = str_replace("[PROMOCLASS]", r_userclass_name($row['prod_promo_class']), $message); $message = str_replace("[TRANSACTIONID]", $trans_array['txn_id'], $message); $message = str_replace("[PRODUCTPRICE]", $items_array["amount_" . $count], $message); $message = str_replace("[PRODUCTQTY]", $items_array["quantity_" . $count], $message); $message = str_replace("[CURRENCY]", $trans_array['mc_currency'], $message); $message = str_replace("[GROSSAMOUNT]", $trans_array['mc_gross'], $message); $message = str_replace("[PAYMENTDATE]", $trans_array['payment_date'], $message); $message = str_replace("[PRODLINK]", SITEURL . e_PLUGIN . "easyshop/easyshop.php?prod." . $items_array["db_id_" . $count], $message); $message = str_replace("[PRODUCTNAME]", $items_array["item_name_" . $count], $message); $user_message = EASYSHOP_IPN_35; $user_message .= "<br />" . EASYSHOP_IPN_36; $user_message .= "<br />" . EASYSHOP_IPN_34 . " " . $pref['siteurl']; $user_message .= "<br /><br />© " . date("Y") . " EasyShop"; $user_message = str_replace("[PRODUCTNAME]", $items_array["item_name_" . $count], $user_message); $user_message = str_replace("[PROMOCLASS]", r_userclass_name($row['prod_promo_class']), $user_message); //ShopMail::easyshop_sendemail($mailto, $subject, $message, $headers2, $attachment_name); if ($row2['user_class'] != $class_list) { // Only send an e-mail if the user_class array actually changed ShopMail::easyshop_sendemail($mailto, $subject, $message, $headers2, $attachment_name); // Mail to admin ShopMail::easyshop_sendemail($row2['user_email'], $subject, $user_message, $headers2, $attachment_name); // Mail to user } } } $temp_array = array($row['item_id'] => array("item_name" => $items_array["item_name_" . $count], "db_id" => $row['item_id'])); } } else { // This item does not exist!!! //$sqlcheck -> db_Close(); return FALSE; } $count++; } // Send downloads $to_email = $trans_array['payer_email']; ShopMail::easyshop_senddownloads($temp_array, $to_email); //$sqlcheck -> db_Close(); return TRUE; }
$count++; } $text .= "\n\t\t\t\t\t\t </select>"; $text .= "\n\t\t\t\t\t\t </div>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>\n\t\t\t\t\t\t\t\t\t\t\t<div style='text-align:center;'>"; // Display the check box for active status (active = 2) if ($row['category_active_status'] == 2) { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<input type='checkbox' name='category_active_status[]' value='" . $row['category_id'] . "' checked='checked' />"; } else { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t\t<input type='checkbox' name='category_active_status[]' value='" . $row['category_id'] . "' />"; } // Show the number of products in the category $text .= "\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'><div style='text-align:center;'>" . $prod_cat_count . "</div>\n\t\t\t\t\t\t\t\t\t\t</td>"; // Show class description $text .= "<td class='forumheader3'>" . r_userclass_name($row['category_class']) . "</td>"; // Show class_order description $text .= "<td class='forumheader3'>" . r_userclass_name($row['category_order_class']) . "</td>"; // Show the edit and delete icons $text .= "\n\t\t\t\t\t\t\t\t\t\t<td class='forumheader3'>\n\t\t\t\t\t\t\t\t\t\t\t<div style='text-align:center;'>\n\t\t\t\t\t\t\t\t\t\t\t<a href='" . e_SELF . "?edit_category=1&category_id=" . $row['category_id'] . "' alt='" . EASYSHOP_CAT_16 . "'>" . ADMIN_EDIT_ICON . "</a>\n "; // Show delete icon conditionally (only when there are no products in the category) if ($prod_cat_count == 0) { $text .= "\n\t\t\t\t\t\t\t\t\t\t\t<a href='" . e_SELF . "?delete_category=1&category_id=" . $row['category_id'] . "' alt='" . EASYSHOP_CAT_17 . "'>" . ADMIN_DELETE_ICON . "</a>"; } $text .= "\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t</tr>"; } $text .= "\n\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<br />\n\t\t\t\t\t\t<div style='text-align:center;'>\n\t\t\t\t\t\t\t<input type='hidden' name='change_order' value='1' />\n\t\t\t\t\t\t\t<input class='button' type='submit' value='" . EASYSHOP_CAT_13 . "' />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<br />"; if ($no_active_categories == 1) { $text .= "<img src='" . e_IMAGE . "admin_images/docs_16.png' title='' alt='' /> " . EASYSHOP_CAT_20; } } $text .= "\n\t\t\t\t</fieldset>\n\t\t</div>\n\t</form>\n\t<br />"; // Create a new category
function show_create_category() { global $qs, $plugintable, $plugindir, $sql, $ns, $rs, $aa, $fl, $pref, $tp; global $message, $content_parent, $content_heading, $content_subheading, $content_text, $content_icon, $content_comment, $content_rate, $content_pe, $content_class; global $stylespacer, $TOPIC_ROW_SPACER, $TOPIC_ROW, $TOPIC_ROW_NOEXPAND; $frm = e107::getForm(); $months = array(CONTENT_ADMIN_DATE_LAN_0, CONTENT_ADMIN_DATE_LAN_1, CONTENT_ADMIN_DATE_LAN_2, CONTENT_ADMIN_DATE_LAN_3, CONTENT_ADMIN_DATE_LAN_4, CONTENT_ADMIN_DATE_LAN_5, CONTENT_ADMIN_DATE_LAN_6, CONTENT_ADMIN_DATE_LAN_7, CONTENT_ADMIN_DATE_LAN_8, CONTENT_ADMIN_DATE_LAN_9, CONTENT_ADMIN_DATE_LAN_10, CONTENT_ADMIN_DATE_LAN_11); if (!is_object($sql)) { $sql = new db(); } $formurl = e_SELF . "?" . e_QUERY; $array = $aa->getCategoryTree("", "", FALSE); $mainparent = $aa->getMainParent(isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "0")); $content_pref = $aa->getContentPref($mainparent); $content_cat_icon_path_small = $tp->replaceConstants($content_pref["content_cat_icon_path_small"]); $content_cat_icon_path_large = $tp->replaceConstants($content_pref["content_cat_icon_path_large"]); if ($qs[0] == "cat" && $qs[1] == "create" && isset($qs[2]) && is_numeric($qs[2])) { if (!$sql->db_Select($plugintable, "*", "content_id='" . intval($qs[2]) . "' ")) { header("location:" . e_SELF . "?cat"); exit; } $formurl = e_SELF . "?" . e_QUERY; } if ($qs[0] == "cat" && $qs[1] == "edit" && isset($qs[2]) && is_numeric($qs[2])) { if (!$sql->db_Select($plugintable, "*", "content_id='" . intval($qs[2]) . "' ")) { header("location:" . e_SELF . "?cat"); exit; } else { $row = $sql->db_Fetch(); if (substr($row['content_parent'], 0, 1) != "0") { header("location:" . e_SELF . "?cat"); exit; } $menuheading = $row['content_heading']; } $formurl = e_SELF . "?" . e_QUERY; } if (isset($_POST['preview_category'])) { $formurl = e_SELF . "?" . e_QUERY; $cat_heading = $tp->post_toHTML($_POST['cat_heading']); $cat_subheading = $tp->post_toHTML($_POST['cat_subheading']); //$cat_text = $tp -> post_toHTML($_POST['cat_text']); if (e_WYSIWYG) { $_POST['cat_text'] = $tp->createConstants($_POST['cat_text']); // convert e107_images/ to {e_IMAGE} etc. } $cat_text = $tp->post_toHTML($_POST['cat_text'], TRUE); $caticon = $aa->geticon("catlarge", $_POST['cat_icon'], $content_cat_icon_path_large, "", "", ""); $text = "\n\t\t\t\t<div class='text-left'>\n\t\t\t\t<table class='table adminform' id='show_create_category_01'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='forumheader3' rowspan='3' style='width:5%; vertical-align:top;'>" . $caticon . "</td>\n\t\t\t\t\t<td class='fcaption'>" . $cat_heading . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td class='forumheader3'>" . $cat_subheading . "</td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . $cat_text . "</td></tr>\n\t\t\t\t<tr><td colspan='2'> </td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . CONTENT_ADMIN_DATE_LAN_15 . "</td><td class='forumheader3'>\n\t\t\t\t\t" . $_POST['cat_startdate'] . "\n\t\t\t\t</td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . CONTENT_ADMIN_DATE_LAN_16 . "</td><td class='forumheader3'>\n\t\t\t\t\t" . $_POST['cat_enddate'] . "\n\t\t\t\t</td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . CONTENT_ADMIN_CAT_LAN_17 . "</td><td class='forumheader3'>" . r_userclass_name($_POST['cat_class']) . "</td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . CONTENT_ADMIN_CAT_LAN_14 . "</td><td class='forumheader3'>" . ($_POST['cat_comment'] == "1" ? CONTENT_ADMIN_ITEM_LAN_85 : CONTENT_ADMIN_ITEM_LAN_86) . "</td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . CONTENT_ADMIN_CAT_LAN_15 . "</td><td class='forumheader3'>" . ($_POST['cat_rate'] == "1" ? CONTENT_ADMIN_ITEM_LAN_85 : CONTENT_ADMIN_ITEM_LAN_86) . "</td></tr>\n\t\t\t\t<tr><td class='forumheader3'>" . CONTENT_ADMIN_CAT_LAN_16 . "</td><td class='forumheader3'>" . ($_POST['cat_pe'] == "1" ? CONTENT_ADMIN_ITEM_LAN_85 : CONTENT_ADMIN_ITEM_LAN_86) . "</td></tr>\n\t\t\t\t</table>\n\t\t\t\t</div>"; $ns->tablerender($cat_heading, $text); } if (isset($_POST['preview_category']) || isset($message) || isset($_POST['uploadcaticon'])) { $row['content_heading'] = $tp->post_toForm($_POST['cat_heading']); $row['content_subheading'] = $tp->post_toForm($_POST['cat_subheading']); //$row['content_text'] = $tp -> post_toForm($_POST['cat_text']); if (e_WYSIWYG) { $_POST['cat_text'] = $tp->toHTML($_POST['cat_text'], $parseBB = TRUE); // parse the bbcodes to we can edit as html. $_POST['cat_text'] = $tp->replaceConstants($_POST['cat_text'], TRUE); // eg. replace {e_IMAGE} with e107_images/ and NOT ../e107_images } $row['content_text'] = $tp->post_toForm($_POST['cat_text']); $row['content_datestamp'] = $_POST['content_datestamp']; $row['content_startdate'] = $_POST['cat_startdate']; $row['content_enddate'] = $_POST['cat_enddate']; $row['content_icon'] = $_POST['cat_icon']; $row['content_comment'] = $_POST['cat_comment']; $row['content_rate'] = $_POST['cat_rate']; $row['content_pe'] = $_POST['cat_pe']; $row['content_class'] = $_POST['cat_class']; } else { if (e_WYSIWYG) { $row['content_text'] = $tp->replaceConstants($row['content_text'], TRUE); // eg. replace {e_IMAGE} with e107_images/ and NOT ../e107_images } } //check which areas should be visible (dependent on options in admin:create category) $checksubheading = isset($content_pref["content_admincat_subheading"]) ? $content_pref["content_admincat_subheading"] : (isset($content_pref["content_admincat_subheading"]) ? $content_pref["content_admincat_subheading"] : ""); $checkstartdate = isset($content_pref["content_admincat_startdate"]) ? $content_pref["content_admincat_startdate"] : (isset($content_pref["content_admincat_startdate"]) ? $content_pref["content_admincat_startdate"] : ""); $checkenddate = isset($content_pref["content_admincat_enddate"]) ? $content_pref["content_admincat_enddate"] : (isset($content_pref["content_admincat_enddate"]) ? $content_pref["content_admincat_enddate"] : ""); $checkselecticon = isset($content_pref["content_admincat_selecticon"]) ? $content_pref["content_admincat_selecticon"] : (isset($content_pref["content_admincat_selecticon"]) ? $content_pref["content_admincat_selecticon"] : ""); $checkcomment = isset($content_pref["content_admincat_comment"]) ? $content_pref["content_admincat_comment"] : (isset($content_pref["content_admincat_comment"]) ? $content_pref["content_admincat_comment"] : ""); $checkrating = isset($content_pref["content_admincat_rating"]) ? $content_pref["content_admincat_rating"] : (isset($content_pref["content_admincat_rating"]) ? $content_pref["content_admincat_rating"] : ""); $checkpe = isset($content_pref["content_admincat_pe"]) ? $content_pref["content_admincat_pe"] : (isset($content_pref["content_admincat_pe"]) ? $content_pref["content_admincat_pe"] : ""); $checkvisibility = isset($content_pref["content_admincat_visibility"]) ? $content_pref["content_admincat_visibility"] : (isset($content_pref["content_admincat_visibility"]) ? $content_pref["content_admincat_visibility"] : ""); $text = "\n\t\t\t<div class='text-left'>\n\t\t\t" . $rs->form_open("post", $formurl, "dataform", "", "enctype='multipart/form-data'") . "\n <table class='table adminform' id='show_create_category_02'>"; //category parent $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_27; if ($qs[1] == "create") { $parent = isset($qs[3]) && is_numeric($qs[3]) ? $qs[3] : (isset($qs[2]) && is_numeric($qs[2]) ? $qs[2] : "0"); } elseif ($qs[1] == "edit") { if (isset($qs[3]) && is_numeric($qs[3])) { $parent = $qs[3]; } else { $parent = strpos($row['content_parent'], ".") ? substr($row['content_parent'], 2) : ""; } } $TOPIC_FIELD = $aa->ShowOption($parent, "category"); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; $text .= $TOPIC_ROW_SPACER; $row['content_heading'] = isset($row['content_heading']) ? $row['content_heading'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_2; $TOPIC_FIELD = $frm->text("cat_heading", $row['content_heading'], 250, array('size' => 'block-level')); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; if ($checksubheading) { $row['content_subheading'] = isset($row['content_subheading']) ? $row['content_subheading'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_3; $TOPIC_FIELD = $frm->text("cat_subheading", $row['content_subheading'], 250, array('size' => 'block-level')); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_subheading", $row['content_subheading']); } $row['content_text'] = isset($row['content_text']) ? $row['content_text'] : ""; require_once e_HANDLER . "ren_help.php"; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_4; $TOPIC_FIELD = $frm->bbarea("cat_text", $row['content_text'], '', '', 'medium'); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; if (isset($row['content_datestamp']) && $row['content_datestamp'] != "0") { $cat_startdate = strftime("%Y-%m-%d %H:%M", $row['content_datestamp']); } else { $cat_startdate = isset($cat_startdate) ? $cat_startdate : ""; } if (isset($row['content_enddate']) && $row['content_enddate'] != "0") { $cat_enddate = strftime("%Y-%m-%d %H:%M", $row['content_enddate']); } else { $cat_enddate = isset($cat_enddate) ? $cat_enddate : ""; } $smarray = getdate(); $current_year = $smarray['year']; $text .= $TOPIC_ROW_SPACER; if ($checkstartdate) { $TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_15; $TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_73; $TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_17; $TOPIC_FIELD = $frm->datepicker("cat_startdate", $row['content_startdate'], "type=date&size=xx-large"); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); $fanat1k_tmp = $TOPIC_ROW; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_startdate", $startdate); } if ($checkenddate) { $TOPIC_TOPIC = CONTENT_ADMIN_DATE_LAN_16; $TOPIC_HEADING = CONTENT_ADMIN_ITEM_LAN_74; $TOPIC_HELP = CONTENT_ADMIN_DATE_LAN_18; $TOPIC_FIELD = $frm->datepicker("cat_enddate", $row['content_enddate'], "type=date&size=xx-large"); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); $fanat1k_tmp = $TOPIC_ROW; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_enddate", $cat_enddate); } $rejectlist = array('$.', '$..', '/', 'CVS', 'thumbs.db', 'Thumbs.db', '*._$', 'index', 'null*'); $iconlist = $fl->get_files($content_cat_icon_path_large, "", $rejectlist); if ($checkselecticon) { //icon $row['content_icon'] = isset($row['content_icon']) ? $row['content_icon'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_5; $TOPIC_HEADING = CONTENT_ADMIN_CAT_LAN_60; $TOPIC_HELP = ""; $options = array('writeParms' => 'glyphs=1'); $TOPIC_FIELD = $frm->imagepicker("cat_icon", $row["content_icon"], CONTENT_ADMIN_CAT_LAN_8, 'media=content&w=400&glyphs=1'); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW); $fanat1k_tmp = $TOPIC_ROW; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_icon", $row['content_icon']); } if ($checkcomment) { $row['content_comment'] = isset($row['content_comment']) ? $row['content_comment'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_14; $TOPIC_FIELD = "\n\t\t\t\t" . $rs->form_radio("cat_comment", "1", $row['content_comment'] ? "1" : "0", "", "") . CONTENT_ADMIN_ITEM_LAN_85 . "\n\t\t\t\t" . $rs->form_radio("cat_comment", "0", $row['content_comment'] ? "0" : "1", "", "") . CONTENT_ADMIN_ITEM_LAN_86; //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_comment", $row['content_comment']); } if ($checkrating) { $row['content_rate'] = isset($row['content_rate']) ? $row['content_rate'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_15; $TOPIC_FIELD = "\n\t\t\t\t" . $rs->form_radio("cat_rate", "1", $row['content_rate'] ? "1" : "0", "", "") . CONTENT_ADMIN_ITEM_LAN_85 . "\n\t\t\t\t" . $rs->form_radio("cat_rate", "0", $row['content_rate'] ? "0" : "1", "", "") . CONTENT_ADMIN_ITEM_LAN_86; //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_rate", $row['content_rate']); } if ($checkpe) { $row['content_pe'] = isset($row['content_pe']) ? $row['content_pe'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_16; $TOPIC_FIELD = "\n\t\t\t\t" . $rs->form_radio("cat_pe", "1", $row['content_pe'] ? "1" : "0", "", "") . CONTENT_ADMIN_ITEM_LAN_85 . "\n\t\t\t\t" . $rs->form_radio("cat_pe", "0", $row['content_pe'] ? "0" : "1", "", "") . CONTENT_ADMIN_ITEM_LAN_86; //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_pe", $row['content_pe']); } if ($checkvisibility) { $row['content_class'] = isset($row['content_class']) ? $row['content_class'] : ""; $TOPIC_TOPIC = CONTENT_ADMIN_CAT_LAN_17; $TOPIC_FIELD = r_userclass("cat_class", $row['content_class']); //$text .= preg_replace("/\{(.*?)\}/e", '$\1', $TOPIC_ROW_NOEXPAND); $fanat1k_tmp = $TOPIC_ROW_NOEXPAND; preg_match_all("/\\{(.*?)\\}/", $fanat1k_tmp, $matches); for ($i = 0; $i < count($matches[1]); $i++) { $fanat1k_tmp = str_replace("{{$matches[1][$i]}}", ${$matches[1][$i]}, $fanat1k_tmp); } $text .= $fanat1k_tmp; } else { $hidden .= $rs->form_hidden("cat_class", $row['content_class']); } $text .= $TOPIC_ROW_SPACER; $text .= "\n\t\t\t<tr>\n\t\t\t\t<td class='forumheader' style='text-align:center' colspan='2'>" . $hidden; if ($qs[1] == "edit" && is_numeric($qs[2])) { $text .= $rs->form_button("submit", "preview_category", isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26); $text .= $rs->form_button("submit", "update_category", CONTENT_ADMIN_CAT_LAN_7) . $rs->form_button("submit", "category_clear", CONTENT_ADMIN_CAT_LAN_21) . $rs->form_hidden("parent_id", $parent) . $rs->form_hidden("cat_id", $qs[2]) . $rs->form_hidden("id", $qs[2]) . $rs->form_hidden("menuheading", $menuheading); $text .= $rs->form_hidden("content_datestamp", $row['content_datestamp']); $caption = CONTENT_ADMIN_CAT_LAN_1; } else { $text .= $rs->form_button("submit", "preview_category", isset($_POST['preview_category']) ? CONTENT_ADMIN_MAIN_LAN_27 : CONTENT_ADMIN_MAIN_LAN_26); $text .= $rs->form_button("submit", "create_category", CONTENT_ADMIN_CAT_LAN_6); $caption = CONTENT_ADMIN_CAT_LAN_0; } $text .= "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t" . $rs->form_close() . "\n\t\t\t</div>"; $ns->tablerender($caption, $text); }
if (isset($_POST['main_delete'])) { $del_id = array_keys($_POST['main_delete']); welcome_adminlog('03', $wmId, ''); $message = $sql->db_Delete("generic", "gen_id='" . $del_id[0] . "' ") ? LAN_DELETED : LAN_DELETED_FAILED; } if (isset($message)) { $ns->tablerender("", "<div style='text-align:center'><b>" . $message . "</b></div>"); } // Show Existing ------- if ($action == "main" || $action == "") { if ($wm_total = $sql->db_Select("generic", "*", "gen_type='wmessage' ORDER BY gen_id ASC")) { $wmList = $sql->db_getList(); $text = $rs->form_open('post', e_SELF, 'myform_wmessage', '', ''); $text .= "<div style='text-align:center'>\n <table class='table adminlist'>\n\t\t\t<colgroup>\n\t\t\t\t<col style='width:5%' />\n\t\t\t\t<col style='width:60%' />\n\t\t\t\t<col style='width:20%' />\n\t\t\t\t<col style='width:10%' />\n \t\t\t</colgroup>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>ID</th>\n\t\t\t\t<th>" . WMLAN_02 . "</th>\n\t\t\t\t<th class='center'>" . WMLAN_03 . "</th>\n\t\t\t\t<th class='center'>" . LAN_OPTIONS . "</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>"; foreach ($wmList as $row) { $text .= "\n\t\t\t<tr>\n\t\t\t\t<td class='center' style='text-align: center; vertical-align: middle'>" . $row['gen_id'] . "</td>\n\t\t\t\t<td>" . strip_tags($tp->toHTML($row['gen_ip'])) . "</td>\n\t\t\t\t<td>" . r_userclass_name($row['gen_intdata']) . "</td>\n \t<td class='center nowrap'>\n\t\t\t\t\t<a href='" . e_SELF . "?create.edit.{$row['gen_id']}'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t\t<input type='image' title='" . LAN_DELETE . "' name='main_delete[" . $row['gen_id'] . "]' src='" . ADMIN_DELETE_ICON_PATH . "' onclick=\"return jsconfirm('" . LAN_CONFIRMDEL . " [ID: {$row['gen_id']} ]')\"/>\n\t\t\t\t</td>\n\t\t\t</tr>"; } $text .= "</tbody></table></div>"; $text .= $rs->form_close(); } else { $text .= "<div style='text-align:center'>" . WMLAN_09 . "</div>"; } $ns->tablerender(WMLAN_00, $text); } // Create and Edit if ($action == "create" || $action == "edit") { if ($sub_action == "edit") { $sql->db_Select("generic", "gen_intdata, gen_ip, gen_chardata", "gen_id = {$id}"); $row = $sql->db_Fetch(); } $text = "\n\t\t<div style='text-align:center'>\n\t\t<form method='post' action='" . e_SELF . "' id='wmform'>\n\t\t<fieldset id='code-wmessage-create'>\n <table class='table adminform'>\n\t\t<colgroup>\n\t\t\t<col class='col-label' />\n\t\t\t<col class='col-control' />\n\t\t</colgroup>\n\t\t";
} else { while ($banner_row = $sql->db_Fetch()) { //extract($row); - killed by SecretR $clickpercentage = $banner_row['banner_clicks'] && $banner_row['banner_impressions'] ? round($banner_row['banner_clicks'] / $banner_row['banner_impressions'] * 100) . "%" : "-"; $impressions_left = $banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] - $banner_row['banner_impressions'] : BNRLAN_16; $impressions_purchased = $banner_row['banner_impurchased'] ? $banner_row['banner_impurchased'] : BNRLAN_16; $start_date = $banner_row['banner_startdate'] ? strftime("%d %B %Y", $banner_row['banner_startdate']) : BNRLAN_17; $end_date = $banner_row['banner_enddate'] ? strftime("%d %B %Y", $banner_row['banner_enddate']) : BNRLAN_17; if (strpos($banner_row['banner_campaign'], "^") !== FALSE) { $campaignsplit = explode("^", $banner_row['banner_campaign']); $banner_row['banner_campaign'] = $campaignsplit[0]; $textvisivilitychanged = "(*)"; } else { $textvisivilitychanged = ""; } $text .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='center'>" . $banner_row['banner_id'] . "</td>\n\t\t\t\t\t\t\t<td class='e-pointer' onclick=\"e107Helper.toggle('banner-infocell-{$banner_row['banner_id']}')\">\n\t\t\t\t\t\t\t\t<a href='#banner-infocell-{$banner_row['banner_id']}' class='action e-expandit f-right' title='" . BNRLAN_65 . "'><img class='action info S16' src='" . e_IMAGE_ABS . "admin_images/info_16.png' alt='' /></a>\n\t\t\t\t\t\t\t\t" . ($banner_row['banner_clientname'] ? $banner_row['banner_clientname'] : BNRLAN_66) . "\n\t\t\t\t\t\t\t\t<div class='e-hideme clear' id='banner-infocell-{$banner_row['banner_id']}'>\n\t\t\t\t\t\t\t\t\t<div class='indent'>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . BNRLAN_24 . ": </strong>" . $banner_row['banner_campaign'] . "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . MENLAN_4 . " </strong>" . r_userclass_name($banner_row['banner_active']) . " " . $textvisivilitychanged . "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . BNRLAN_45 . ": </strong>" . $start_date . "</div>\n\t\t\t\t\t\t\t\t\t\t<div class='field-spacer'><strong>" . BNRLAN_21 . ": </strong>" . $end_date . "</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td class='center'>" . $banner_row['banner_clicks'] . "</td>\n\t\t\t\t\t\t\t<td class='center'>" . $clickpercentage . "</td>\n\t\t\t\t\t\t\t<td class='center'>" . $impressions_purchased . "</td>\n\t\t\t\t\t\t\t<td class='center'>" . $impressions_left . "</td>\n\t\t\t\t\t\t\t<td class='center'>\n\n\t\t\t\t\t\t\t\t<a href='" . e_SELF . "?create.edit." . $banner_row['banner_id'] . "'>" . ADMIN_EDIT_ICON . "</a>\n\t\t\t\t\t\t\t\t<a class='action delete' id='banner-delete-{$banner_row['banner_id']}' href='" . e_SELF . "?delete." . $banner_row['banner_id'] . "' rel='no-confirm' title='" . BNRLAN_5 . "'>" . ADMIN_DELETE_ICON . "</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t"; } } $text .= "\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t\t<input type='hidden' id='delete_confirm' name='delete_confirm' value='0' />\n\t\t\t</fieldset>\n\t\t</form>\n\t\t<script type='text/javascript'>\n\t\t\t\$\$('a[id^=banner-delete-]').each( function(element) {\n\t\t\t\telement.observe('click', function(e) {\n\t\t\t\t\tvar el = e.findElement('a.delete'), msg = el.readAttribute('title') || e107.getModLan('delete_confirm');\n\t\t\t\t\t e.stop();\n\t\t\t\t\tif( !e107Helper.confirm(msg) ) return;\n\t\t\t\t\telse {\n\t\t\t\t\t\t\$('delete_confirm').value = 1;\n\t\t\t\t\t\t\$('core-banner-list-form').writeAttribute('action', el.href).submit();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t</script>\n\t"; $e107->ns->tablerender(BNRLAN_42 . ' - ' . BNRLAN_7, $emessage->render() . $text); } if ($action == "create") { if ($sub_action == "edit" && $id) { if (!$sql->db_Select("banner", "*", "banner_id = '" . $id . "' ")) { $text .= "<div class='center'>" . BNRLAN_15 . "</div>"; } else { while ($banner_row = $sql->db_Fetch()) { //extract($row); - killed by SecretR $_POST['client_name'] = $banner_row['banner_clientname']; $_POST['client_login'] = $banner_row['banner_clientlogin']; $_POST['client_password'] = $banner_row['banner_clientpassword'];