<?php $i++; ?> <td><strong><?php echo stripslashes($result->pack_name); ?> </strong><a class="tip" tip="<?php echo $result->pack_desc; ?> " tabindex="99"><div class="helpico"></div></a></td> <td><?php echo $benefit; ?> </td> <td><?php echo cp_pos_price($result->pack_membership_price) . ' / ' . $result->pack_duration . ' ' . __('days', 'appthemes'); ?> </td> <td><input type="submit" name="step1" id="step1" class="btn_orange" onclick="document.getElementById('pack').value=<?php echo $result->pack_id; ?> ;" value="<?php _e('Buy Now ››', 'appthemes'); ?> " style="margin-left: 5px; margin-bottom: 5px;" /></td> </tr> <?php } //end if('active_membership' || 'inactive_membership') }
function cp_other_fields() { global $wpdb; // are images on ads allowed if (get_option('cp_ad_images') == 'yes') { echo cp_image_input_fields(); } // show the featured ad box if enabled if (get_option('cp_sys_feat_price')) { ?> <li class="withborder"> <div class="labelwrapper"> <label><?php _e('Featured Listing', 'appthemes'); ?> <?php echo cp_pos_price(get_option('cp_sys_feat_price')); ?> </label> </div> <div class="clr"></div> <input name="featured_ad" value="1" type="checkbox" <?php if (isset($_POST['featured_ad']) == '1') { echo 'CHECKED'; } ?> /> <?php _e('Your listing will appear in the featured slider section at the top of the front page.', 'appthemes'); ?> <div class="clr"></div> </li> <?php } // show the payment method box if enabled if (get_option('cp_charge_ads') == 'yes') { ?> <?php if (get_option('cp_price_scheme') == 'single') { ?> <li> <div class="labelwrapper"> <label><?php _e('Ad Package', 'appthemes'); ?> :</label> </div> <?php // go get all the active ad packs and create a drop-down of options $results = $wpdb->get_results($wpdb->prepare("SELECT pack_id, pack_name FROM {$wpdb->cp_ad_packs} WHERE pack_status = 'active' ORDER BY pack_id asc")); if ($results) { ?> <select name="ad_pack_id" class="dropdownlist required"> <?php foreach ($results as $result) { ?> <option value="<?php echo esc_attr($result->pack_id); ?> "><?php echo esc_attr(stripslashes($result->pack_name)); ?> </option> <?php } ?> </select> <?php } else { ?> <?php _e('Error: no ad pack has been defined. Please contact the site administrator.', 'appthemes'); ?> <?php } ?> <div class="clr"></div> </li> <?php } ?> <?php if (get_option('cp_enable_coupons') == 'yes') { ?> <li> <div class="labelwrapper"> <label><?php _e('Coupon Code', 'appthemes'); ?> :</label> </div> <input type="text" class="text" value="" id="cp_coupon_code" name="cp_coupon_code"> <div class="clr"></div> </li> <?php } } // end charge for ads check }
</div> <div class="clr"></div> <input type="radio" name="dazakepacks" value="featured" > <?php _e('Your listing will appear in the featured slider section at the top of the front page.', 'appthemes'); ?> <div class="clr"></div> </li> <li class="withborder"> <div class="labelwrapper"> <label><?php _e('Premium Listing', 'appthemes'); ?> <?php cp_pos_price(cp_ad_dazake_premium_listing_free($_POST['cat'])); ?> </label> </div> <div class="clr"></div> <input type="radio" name="dazakepacks" value="premium" > <?php _e("Your will allow to upload ", 'appthemes'); echo get_option("dazake_category{$_POST['cat']}_pic_num"); _e(" images ", 'appthemes'); ?> <div class="clr"></div> </li> <li class="withborder">
function cp_coupons() { global $options_new_coupon, $wpdb, $current_user, $app_version; $current_user = wp_get_current_user(); // check to prevent php "notice: undefined index" msg if (isset($_GET['action'])) { $theswitch = $_GET['action']; } else { $theswitch = ''; } ?> <script type="text/javascript"> //<![CDATA[ /* initialize the datepicker feature */ jQuery(document).ready(function($) { /* initialize the form validation */ $("#mainform").validate({errorClass: "invalid"}); $('form#mainform .datepicker').datepicker({ showOn: 'button', dateFormat: 'yy-mm-dd', minDate: 0, buttonImageOnly: true, buttonText: '', buttonImage: '../wp-includes/images/blank.gif' // calling the real calendar image in the admin-style.css. need a blank placeholder image b/c of IE. }); }); //]]> </script> <?php switch ($theswitch) { case 'addcoupon': ?> <div class="wrap"> <div class="icon32" id="icon-edit-pages"><br/></div> <h2><?php _e('New Coupon', 'appthemes'); ?> </h2> <?php //if your database is not at least version 3.1, you must upgrade first. if (get_option('cp_version') != $app_version) { echo '<div class="error">' . __('Error: Your ClassiPress database is not updated to match your version of ClassiPress.', 'appthemes') . '</div>'; echo __('Product Version', 'appthemes') . ': <strong>' . get_option('cp_version') . '</strong> '; if (get_option('cp_version') != $app_version) { echo __('(You upgraded to version ') . $app_version . '. <a href="admin.php?page=admin-options.php&upgrade=yes">Click here to finish your upgrade.</a>)'; } die; } ?> <?php cp_admin_info_box(); ?> <?php // check and make sure the form was submitted if (isset($_POST['submitted'])) { //echo $_POST['coupon_expire_date'] . '<-- expire date'; // @todo Switch to // adding $wpdb->prepare causes the query to be empty for some reason $insert = "INSERT INTO " . $wpdb->prefix . "cp_coupons" . " (coupon_code, coupon_desc, coupon_discount, coupon_discount_type, coupon_start_date, coupon_expire_date, coupon_status, coupon_max_use_count, coupon_owner, coupon_created, coupon_modified) " . "VALUES ('" . $wpdb->escape(appthemes_clean($_POST['coupon_code'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_desc'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_discount'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_discount_type'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_start_date'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_expire_date'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_status'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_max_use_count'])) . "','" . $wpdb->escape(appthemes_clean($_POST['coupon_owner'])) . "','" . gmdate('Y-m-d H:i:s') . "','" . gmdate('Y-m-d H:i:s') . "')"; $results = $wpdb->query($insert); if ($results) { ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Creating your coupon.....', 'appthemes'); ?> <br /><br /><img src="<?php echo bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=coupons"> <?php } } else { ?> <form method="post" id="mainform" action=""> <?php cp_admin_fields($options_new_coupon); ?> <p class="submit"><input class="btn button-primary" name="save" type="submit" value="<?php _e('Create New Coupon', 'appthemes'); ?> " /> <input name="cancel" type="button" onClick="location.href='?page=coupons'" value="<?php _e('Cancel', 'appthemes'); ?> " /></p> <input name="submitted" type="hidden" value="yes" /> <input name="coupon_owner" type="hidden" value="<?php echo $current_user->user_login; ?> " /> </form> <?php } ?> </div><!-- end wrap --> <?php break; case 'editcoupon': ?> <div class="wrap"> <div class="icon32" id="icon-themes"><br/></div> <h2><?php _e('Edit Coupon', 'appthemes'); ?> </h2> <?php cp_admin_info_box(); ?> <?php if (isset($_POST['submitted']) && $_POST['submitted'] == 'yes') { // adding $wpdb->prepare causes the query to be empty for some reason $update = "UPDATE " . $wpdb->prefix . "cp_coupons SET" . " coupon_code = '" . $wpdb->escape(appthemes_clean($_POST['coupon_code'])) . "'," . " coupon_desc = '" . $wpdb->escape(appthemes_clean($_POST['coupon_desc'])) . "'," . " coupon_discount = '" . $wpdb->escape(appthemes_clean($_POST['coupon_discount'])) . "'," . " coupon_discount_type = '" . $wpdb->escape(appthemes_clean($_POST['coupon_discount_type'])) . "'," . " coupon_start_date = '" . $wpdb->escape(appthemes_clean($_POST['coupon_start_date'])) . "'," . " coupon_expire_date = '" . $wpdb->escape(appthemes_clean($_POST['coupon_expire_date'])) . "'," . " coupon_status = '" . $wpdb->escape(appthemes_clean($_POST['coupon_status'])) . "'," . " coupon_max_use_count = '" . $wpdb->escape(appthemes_clean($_POST['coupon_max_use_count'])) . "'," . " coupon_owner = '" . $wpdb->escape(appthemes_clean($_POST['coupon_owner'])) . "'," . " coupon_modified = '" . gmdate('Y-m-d H:i:s') . "'" . " WHERE coupon_id ='" . $wpdb->escape($_GET['id']) . "'"; $results = $wpdb->get_row($update); ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Saving your changes.....', 'appthemes'); ?> <br /><br /><img src="<?php echo bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=coupons"> <?php } else { ?> <form method="post" id="mainform" action=""> <?php cp_admin_db_fields($options_new_coupon, 'cp_coupons', 'coupon_id'); ?> <p class="submit"> <input class="btn button-primary" name="save" type="submit" value="<?php _e('Save changes', 'appthemes'); ?> " /> <input name="cancel" type="button" onClick="location.href='?page=coupons'" value="<?php _e('Cancel', 'appthemes'); ?> " /> <input name="submitted" type="hidden" value="yes" /> <input name="coupon_owner" type="hidden" value="<?php echo $current_user->user_login; ?> " /> </p> </form> <?php } ?> </div><!-- end wrap --> <?php break; case 'delete': $wpdb->query($wpdb->prepare("DELETE FROM " . $wpdb->prefix . "cp_coupons WHERE coupon_id = %s", $_GET['id'])); ?> <p style="text-align:center;padding-top:50px;font-size:22px;"><?php _e('Deleting coupon.....', 'appthemes'); ?> <br /><br /><img src="<?php echo bloginfo('template_directory'); ?> /images/loader.gif" alt="" /></p> <meta http-equiv="refresh" content="0; URL=?page=coupons"> <?php break; default: $results = cp_get_coupons(); ?> <div class="wrap"> <div class="icon32" id="icon-edit-pages"><br/></div> <h2><?php _e('Coupons', 'appthemes'); ?> <a class="button add-new-h2" href="?page=coupons&action=addcoupon"><?php _e('Add New', 'appthemes'); ?> </a></h2> <?php cp_admin_info_box(); ?> <p class="admin-msg"><?php _e('Create coupons to offer special discounts to your customers.', 'appthemes'); ?> </p> <table id="tblspacer" class="widefat fixed"> <thead> <tr> <th scope="col" style="width:35px;"> </th> <th scope="col"><?php _e('Code', 'appthemes'); ?> </th> <th scope="col"><?php _e('Description', 'appthemes'); ?> </th> <th scope="col"><?php _e('Discount', 'appthemes'); ?> </th> <th scope="col"><?php _e('Usage', 'appthemes'); ?> </th> <th scope="col"><?php _e('Valid', 'appthemes'); ?> </th> <th scope="col"><?php _e('Expires', 'appthemes'); ?> </th> <th scope="col" style="width:150px;"><?php _e('Modified', 'appthemes'); ?> </th> <th scope="col" style="width:75px;"><?php _e('Status', 'appthemes'); ?> </th> <th scope="col" style="text-align:center;width:100px;"><?php _e('Actions', 'appthemes'); ?> </th> </tr> </thead> <?php if ($results) { $rowclass = ''; $i = 1; ?> <tbody id="list"> <?php foreach ($results as $result) { $rowclass = 'even' == $rowclass ? 'alt' : 'even'; ?> <tr class="<?php echo $rowclass; ?> "> <td style="padding-left:10px;"><?php echo $i; ?> .</td> <td><a href="?page=coupons&action=editcoupon&id=<?php echo $result->coupon_id; ?> "><strong><?php echo $result->coupon_code; ?> </strong></a></td> <td><?php echo $result->coupon_desc; ?> </td> <td><?php if ($result->coupon_discount_type == '%') { echo number_format($result->coupon_discount, 0) . '%'; } else { echo cp_pos_price($result->coupon_discount); } ?> </td> <td><?php echo $result->coupon_use_count; if ($result->coupon_max_use_count != 0) { echo '/' . $result->coupon_max_use_count; } ?> </td> <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $result->coupon_start_date); ?> </td> <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $result->coupon_expire_date); ?> </td> <td><?php echo mysql2date(get_option('date_format') . ' ' . get_option('time_format'), $result->coupon_modified); ?> <br /><?php _e('by', 'appthemes'); ?> <?php echo $result->coupon_owner; ?> </td> <td><?php echo ucfirst($result->coupon_status); ?> </td> <td style="text-align:center"> <a href="?page=coupons&action=editcoupon&id=<?php echo $result->coupon_id; ?> "><img src="<?php echo bloginfo('template_directory'); ?> /images/edit.png" alt="<?php echo _e('Edit coupon', 'appthemes'); ?> " title="<?php echo _e('Edit coupon', 'appthemes'); ?> " /></a> <a onclick="return confirmBeforeDelete();" href="?page=coupons&action=delete&id=<?php echo $result->coupon_id; ?> "><img src="<?php echo bloginfo('template_directory'); ?> /images/cross.png" alt="<?php echo _e('Delete coupon', 'appthemes'); ?> " title="<?php echo _e('Delete coupon', 'appthemes'); ?> " /></a> </td> </tr> <?php $i++; } // end for each ?> </tbody> <?php } else { ?> <tr> <td> </td><td colspan="8"><?php _e('No coupons found.', 'appthemes'); ?> </td> </tr> <?php } // end $results ?> </table> </div><!-- end wrap --> <?php } // end switch ?> <script type="text/javascript"> /* <![CDATA[ */ function confirmBeforeDelete() { return confirm("<?php _e('Are you sure you want to delete this coupon?', 'appthemes'); ?> "); } /* ]]> */ </script> <?php }
<hr class="bevel-double" /> <div class="clr"></div> <li> <div class="labelwrapper"> <label><?php _e('Total Amount Due', 'appthemes'); ?> :</label> </div> <div id="review"><strong> <?php // if it costs to post an ad OR its free and someone selected a featured ad price if ($total_cost > 0) { echo cp_pos_price($total_cost); } else { echo __('--'); } ?> </strong></div> <div class="clr"></div> </li> <li> <?php if ($total_cost > 0) { ?> <div class="labelwrapper"> <label><?php
function cp_show_review($postvals) { global $wpdb; // if there's no form id it must mean the default form is being used so let's go grab those fields if (!$postvals['fid']) { // use this if there's no custom form being used and give us the default form $sql = $wpdb->prepare("SELECT field_label, field_name, field_type, field_values, field_req " . "FROM " . $wpdb->prefix . "cp_ad_fields " . "WHERE field_core = '1' " . "ORDER BY field_id asc"); } else { // now we should have the formid so show the form layout based on the category selected $sql = $wpdb->prepare("SELECT f.field_label,f.field_name,f.field_type,f.field_values,f.field_perm,m.meta_id,m.field_pos,m.field_req,m.form_id " . "FROM " . $wpdb->prefix . "cp_ad_fields f " . "INNER JOIN " . $wpdb->prefix . "cp_ad_meta m " . "ON f.field_id = m.field_id " . "WHERE m.form_id = %s " . "ORDER BY m.field_pos asc", $postvals['fid']); } $results = $wpdb->get_results($sql); if ($results) { // loop through the custom form fields and display them echo cp_formbuilder_review($results); } else { echo sprintf(__('ERROR: The form template for form ID %s does not exist or the session variable is empty.', 'appthemes'), $postvals['fid'] . "\n\n"); } ?> <hr class="bevel" /> <div class="clr"></div> <?php // if a payment method has been posted AND the total is not equal to zero if (isset($_POST['cp_payment_method']) && $postvals['cp_sys_total_ad_cost'] != 0) { ?> <li> <div class="labelwrapper"> <label><?php _e('Payment Method', 'appthemes'); ?> :</label> </div> <div id="review"><?php echo ucfirst($_POST['cp_payment_method']); ?> </div> <div class="clr"></div> </li> <?php } ?> <li> <div class="labelwrapper"> <label><?php _e('Ad Listing Fee', 'appthemes'); ?> :</label> </div> <div id="review"><?php if (get_option('cp_charge_ads') == 'yes') { echo cp_pos_price(number_format($postvals['cp_sys_ad_listing_fee'], 2)); } else { echo __('FREE', 'appthemes'); } ?> </div> <div class="clr"></div> </li> <?php if (isset($_POST['featured_ad'])) { ?> <li> <div class="labelwrapper"> <label><?php _e('Featured Listing Fee', 'appthemes'); ?> :</label> </div> <div id="review"><?php echo cp_pos_price(number_format($postvals['cp_sys_feat_price'], 2)); ?> </div> <div class="clr"></div> </li> <?php } ?> <?php if (isset($postvals['cp_coupon_type'])) { ?> <li> <div class="labelwrapper"> <label><?php _e('Coupon', 'appthemes'); ?> :</label> </div> <?php if ($postvals['cp_coupon_type'] != '%') { ?> <div id="review"><?php echo cp_pos_price(number_format($postvals['cp_coupon'], 2)); ?> </div> <?php } else { ?> <div id="review"><?php echo str_replace('.00', '', $postvals['cp_coupon']) . $postvals['cp_coupon_type']; ?> </div> <?php } ?> <div class="clr"></div> </li> <?php } ?> <?php if (isset($postvals['cp_membership_pack'])) { ?> <li> <div class="labelwrapper"> <label><?php _e('Membership', 'appthemes'); ?> :</label> </div> <div id="review"><?php echo get_pack_benefit($postvals['cp_membership_pack']); ?> </div> <div class="clr"></div> </li> <?php } ?> <hr class="bevel-double" /> <div class="clr"></div> <li> <div class="labelwrapper"> <label><?php _e('Total Amount Due', 'appthemes'); ?> :</label> </div> <div id="review"><strong> <?php // if it costs to post an ad OR its free and someone selected a featured ad price if (get_option('cp_charge_ads') == 'yes' || isset($postvals['featured_ad'])) { echo cp_pos_price($postvals['cp_sys_total_ad_cost']); } else { echo __('--'); } ?> </strong></div> <div class="clr"></div> </li> <?php }