function get_saved_data($val) { global $mysqli; $q = 'SELECT ' . $val . ' FROM campaigns WHERE id = "' . mysqli_real_escape_string($mysqli, $_GET['c']) . '" AND userID = ' . get_app_info('main_userID'); $r = mysqli_query($mysqli, $q); if ($r && mysqli_num_rows($r) > 0) { while ($row = mysqli_fetch_array($r)) { $value = stripslashes($row[$val]); //if title if ($val == 'title') { //tags for subject preg_match_all('/\\[([a-zA-Z0-9!#%^&*()+=$@._-|\\/?<>~`"\'\\s]+),\\s*fallback=/i', $value, $matches_var, PREG_PATTERN_ORDER); preg_match_all('/,\\s*fallback=([a-zA-Z0-9!,#%^&*()+=$@._-|\\/?<>~`"\'\\s]*)\\]/i', $value, $matches_val, PREG_PATTERN_ORDER); preg_match_all('/(\\[[a-zA-Z0-9!#%^&*()+=$@._-|\\/?<>~`"\'\\s]+,\\s*fallback=[a-zA-Z0-9!,#%^&*()+=$@._-|\\/?<>~`"\'\\s]*\\])/i', $value, $matches_all, PREG_PATTERN_ORDER); $matches_var = $matches_var[1]; $matches_val = $matches_val[1]; $matches_all = $matches_all[1]; for ($i = 0; $i < count($matches_var); $i++) { $field = $matches_var[$i]; $fallback = $matches_val[$i]; $tag = $matches_all[$i]; //for each match, replace tag with fallback $value = str_replace($tag, $fallback, $value); } $value = str_replace('[Email]', get_saved_data('from_email'), $value); } return $value; } } }
function get_saved_data($val) { global $mysqli; global $edit; $q = 'SELECT ' . $val . ' FROM campaigns WHERE id = "' . mysqli_real_escape_string($mysqli, $_GET['c']) . '" AND userID = ' . get_app_info('main_userID'); $r = mysqli_query($mysqli, $q); if ($r && mysqli_num_rows($r) > 0) { while ($row = mysqli_fetch_array($r)) { $value = stripslashes($row[$val]); //if title if ($val == 'title' && !$edit) { //tags for subject preg_match_all('/\\[([a-zA-Z0-9!#%^&*()+=$@._\\-\\:|\\/?<>~`"\'\\s]+),\\s*fallback=/i', $value, $matches_var, PREG_PATTERN_ORDER); preg_match_all('/,\\s*fallback=([a-zA-Z0-9!,#%^&*()+=$@._\\-\\:|\\/?<>~`"\'\\s]*)\\]/i', $value, $matches_val, PREG_PATTERN_ORDER); preg_match_all('/(\\[[a-zA-Z0-9!#%^&*()+=$@._\\-\\:|\\/?<>~`"\'\\s]+,\\s*fallback=[a-zA-Z0-9!,#%^&*()+=$@._\\-\\:|\\/?<>~`"\'\\s]*\\])/i', $value, $matches_all, PREG_PATTERN_ORDER); $matches_var = $matches_var[1]; $matches_val = $matches_val[1]; $matches_all = $matches_all[1]; for ($i = 0; $i < count($matches_var); $i++) { $field = $matches_var[$i]; $fallback = $matches_val[$i]; $tag = $matches_all[$i]; //for each match, replace tag with fallback $value = str_replace($tag, $fallback, $value); } $value = str_replace('[Email]', get_saved_data('from_email'), $value); //convert date if (get_app_info('timezone') != '') { date_default_timezone_set(get_app_info('timezone')); } $sent = get_saved_data('sent'); $send_date = get_saved_data('send_date'); $today = $sent == '' ? time() : $sent; $today = $send_date != '' && $send_date != 0 ? $send_date : $today; $currentdaynumber = strftime('%d', $today); $currentday = strftime('%A', $today); $currentmonthnumber = strftime('%m', $today); $currentmonth = strftime('%B', $today); $currentyear = strftime('%Y', $today); $unconverted_date = array('[currentdaynumber]', '[currentday]', '[currentmonthnumber]', '[currentmonth]', '[currentyear]'); $converted_date = array($currentdaynumber, $currentday, $currentmonthnumber, $currentmonth, $currentyear); $value = str_replace($unconverted_date, $converted_date, $value); } return $value; } } }
?> " title="<?php echo _('View the campaign'); ?> " class="iframe-preview"><span class="icon-eye-open"></span></a></h3><br/> <p><em><?php echo _('Sent on'); ?> <?php echo parse_date(get_saved_data('sent'), 'long', false); ?> <?php echo _('to'); ?> <span class="label"><?php echo number_format(get_saved_data('recipients')); ?> <?php echo _('subscribers'); ?> </span></em></p> <p><em><?php echo _('Lists'); ?> : <?php echo get_lists(); ?> </em></p><br/> <div class="row-fluid"> <div class="span4">
?> "> </div> </div> <label class="control-label" for="reply_to"><?php echo _('Reply to email'); ?> </label> <div class="control-group"> <div class="controls"> <input type="text" class="input-xlarge" id="reply_to" name="reply_to" placeholder="<?php echo _('Reply to email'); ?> " value="<?php echo get_saved_data('reply_to'); ?> "> </div> </div> <?php } ?> <input type="hidden" name="uid" value="<?php echo get_app_info('userID'); ?> "> <input type="hidden" name="redirect" id="redirect" value="<?php echo get_app_info('path') . '/settings';
<!-- Reset on day --> <label class="control-label" for="reset-on-day" id="limit-reset-label" <?php if (get_saved_data('allocated_quota') == '-1') { ?> style="display:none;"<?php } ?> ><?php echo _('Reset limit on which day of the month?'); ?> </label> <div class="control-group"> <div class="controls"> <select name="reset-on-day" id="reset-on-day" style="width:80px; <?php if (get_saved_data('allocated_quota') == '-1') { ?> display:none;<?php } ?> "> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option>
?> "); } } ); }); </script> </div> <br/> <div class="control-group"> <div class="controls"> <textarea class="input-xlarge" id="html" name="html" rows="10" placeholder="<?php echo _('Email content'); ?> "><?php echo get_saved_data('html_text'); ?> </textarea> </div> </div> <p><?php echo _('Use the following tags in your subject, plain text or HTML code and they\'ll automatically be formatted when your campaign is sent. For web version and unsubscribe tags, you can style them with inline CSS.'); ?> </p><br/> <div class="row-fluid"> <?php include 'includes/helpers/personalization.tags.php'; ?> </div> </p> </div>
</h2><br/> <blockquote><strong><?php echo _('From'); ?> </strong> <span class="label"><?php echo get_saved_data('from_name'); ?> <<?php echo get_saved_data('from_email'); ?> ></span></blockquote> <blockquote><strong><?php echo _('Subject'); ?> </strong> <span class="label"><?php echo get_saved_data('title'); ?> </span></blockquote> <iframe src="<?php echo get_app_info('path'); ?> /w/<?php echo short($_GET['c']); ?> ?<?php echo time(); ?> " id="preview-iframe"></iframe> </div> </div> </div>
</div> </div> </div> <label class="control-label" for="cost_per_recipient"><?php echo _('Cost per recipient'); ?> </label> <div class="control-group"> <div class="controls"> <div class="input-prepend input-append"> <span class="add-on"><?php echo $currency_symbol; ?> </span><input type="text" class="input-xlarge" id="cost_per_recipient" name="cost_per_recipient" placeholder="Eg. .01" value="<?php echo get_saved_data('cost_per_recipient'); ?> " style="width: 80px;"> </div> </div> </div> <button type="submit" class="btn btn-inverse"><i class="icon-ok icon-white"></i> <?php echo _('Save'); ?> </button> </div> </div> </form>