function delete_image($dbc, $image_id) { $file = IMG_UPLOADPATH . get_image_file_by_id($dbc, $image_id); unlink($file); $query = "DELETE FROM images WHERE id = '{$image_id}'"; mysqli_query($dbc, $query) or die('Error querying database.'); foreach (get_all_segments($dbc) as $segment_id) { delete_image_from_segment($dbc, $segment_id, $image_id); } }
function print_message_select_form($bapi, $session_id, $msg_id = null, $list_ids = null, $seg_ids = null, $year = null, $month = null, $day = null, $from_addr = null, $from_name = null, $reply_addr = null) { // Use the API to retrieve messages, lists, and segments for client. if (!$bapi) { return false; } // The next 3 API calls will fail on the Agency account itself. $bapi must reference a subaccount. $messages = get_all_messages($bapi); $lists = get_all_lists($bapi); $segments = get_all_segments($bapi); ?> <h2><?php echo HEADER_REQUEST; ?> - Message Selection</h2> <form method="post" action="<?php echo REQUEST_SCRIPT; ?> "> <input type="hidden" name="fm_stage" value="select"/> <input type="hidden" name="fm_sessionid" value="<?php echo $session_id; ?> "/> <p> <label class="required">Please select the message to be approved:</label> </p> <?php if (count($messages) > 0) { ?> <select name="fm_msgid"> <option value="">Please select a message...</option> <?php foreach ($messages as $msg) { $sel_flag = $msg->id == $msg_id ? "selected" : ""; echo "<option value=\"{$msg->id}\" {$sel_flag}>{$msg->name}</option>\n"; } ?> </select> <?php } else { echo "<div class=\"warning\">There are no messages to select.</div>"; } ?> <p> <label class="required">Please select the list(s) and/or segment(s) to be targeted:</label> </p> <div id="list_seg_2_cols"> <?php echo "<div id=\"list_select\">\n<p><u>Lists</u></p>\n"; if (count($lists) > 0) { foreach ($lists as $list) { $chk_flag = $list_ids && in_array($list->id, $list_ids) ? "checked" : ""; echo "<input type=\"checkbox\" name=\"fm_listids[]\" value=\"{$list->id}\" {$chk_flag}/>{$list->name} [{$list->activeCount}]<br/>\n"; } } else { echo "<div class=\"warning\">There are no lists to select.</div>\n"; } echo "\n</div>\n<div id=\"segment_select\">\n<p><u>Segments</u></p>\n"; if (count($segments) > 0) { foreach ($segments as $segment) { $chk_flag = $seg_ids && in_array($segment->id, $seg_ids) ? "checked" : ""; echo "<input type=\"checkbox\" name=\"fm_segids[]\" value=\"{$segment->id}\" {$chk_flag}/>{$segment->name}<br/>\n"; } } else { echo "<div class=\"warning\">There are no segments to select.</div>\n"; } ?> </div> <div style="clear: both"></div> <p> Please enter the date on which the message should be sent: </p> <?php display_date_selector($year, $month, $day); ?> <p> Please enter message header information: </p> <p> <label class="required">From Address:</label> <input type="text" name="fm_fromaddr" value="<?php echo $from_addr; ?> "/> <label class="required">From Full Name:</label> <input type="text" name="fm_fromname" value="<?php echo $from_name; ?> "/> <label class="optional">Reply Address:</label> <input type="text" name="fm_replyaddr" value="<?php echo $reply_addr; ?> "/> </p> <p> <input type="submit" value="Submit"/> <input type="button" value="Cancel" onclick="window.location='<?php echo REQUEST_SCRIPT; ?> '"/> </p> </form> <?php return true; }