function makeList($uid, $selfurl, $offset = 0, $numShow = 75) { $db = DB_DataObject::factory('playsms_tblUserInbox'); if (!$offset) { $offset = 0; } $db->limit($offset, $numShow); $db->orderBy("in_id DESC"); $pagetitle = "Inbox"; if (isadmin() && !$uid) { $pagetitle .= " (All)"; } else { $db->in_uid = $uid; } $db->in_hidden = '0'; if ($offset) { $newOffset = $offset - $numShow; $prevUrl = "{$selfurl}&offset={$newOffset}"; } else { $prevUrl = "#"; } $note = "<p>Note: This inbox shows messages not processed by any of the features (e.g., AutoReply, Poll, etc)</p>"; $newOffset = $offset + $numShow; $nextUrl = "{$selfurl}&offset={$newOffset}"; $exportUrl = "{$selfurl}&op=export"; $linksPrevNext = "<a href='{$prevUrl}'>[ Prev] </a>\n \t\t \t\t <a href='{$nextUrl}'>[ Next ]</a>\n <a href='{$exportUrl}'>[ Export ]</a>"; // create hidden form with the // id to delete, this way it will // get POSTed // $delForm = generateActionSubmitter("del", "{$selfurl}&op=del", "id"); $content = "{$delForm}\n\t\t <h2>{$pagetitle}</h2>\n\t\t <p/>\n\t\t\t{$linksPrevNext}\n\t\t <p/>{$note}\n\t\t <table width=100% cellpadding=1 cellspacing=1 border=1>\n\t\t <tr>\n\t\t <td align=center class=box_title width=4>*</td>\n\t\t <td align=center class=box_title width=20%>Time</td>\n\t\t <td align=center class=box_title width=20%>Sender</td>\n\t\t <td align=center class=box_title width=60%>Message</td>\n\t\t <td align=center class=box_title>Action</td>\n\t\t </tr>\n\t\t"; $db->find(); while ($db->fetch()) { $in_id = $db->in_id; $in_sender = $db->in_sender; $p_desc = pnum2pdesc($in_sender); $current_sender = $in_sender; if ($p_desc) { $current_sender = "{$in_sender}<br>({$p_desc})"; } $in_msg = nl2br($db->in_msg); $in_datetime = $db->in_datetime; $deleteCode = "javascript: del({$db->in_id}, " . "'Are you sure you want to delete this SMS ?');"; $actionCode = "<a href=\"{$deleteCode}\">[Delete]</a>"; $content .= "\n\t\t\t<tr>\n\t\t\t\t<td valign=top class=box_text align=left width=4>{$db->in_id}</td>\n\t\t\t\t<td valign=top class=box_text align=center width=20%>{$in_datetime}</td>\n\t\t\t\t<td valign=top class=box_text align=center width=20%>{$current_sender}</td>\n\t\t\t\t<td valign=top class=box_text align=left width=60%>{$in_msg}</td>\n\t\t\t\t<td valign=top class=box_text align=left nowrap>{$actionCode}</td>\n\t\t\t</tr>\n\t\t "; } $content .= "</table>"; return $content; }
$db_query = "UPDATE playsms_tblUserPhonebook SET gpid='{$gpid}' WHERE pid='{$c_pid}'"; $db_result = @dba_affected_rows($db_query); } } header("Location: fr_right.php"); die; break; case "delete": $op_content = "\n\t\t <table cellpadding=0 cellspacing=0 border=1 width=400>\n\t\t <form action=\"menu.php?inc=phonebook\" method=post>\n\t\t <input type=hidden name=op value=delete_yes>\n\t\t <tr>\n\t\t\t<td class=box_title width=4> * </td>\n\t\t\t<td class=box_title>Deleted Owner</td>\n\t\t\t<td class=box_title>Deleted Number</td>\n\t\t\t<td class=box_title>Deleted Email</td>\n\t\t\t\n\t\t </tr>\n\t\t"; $j = 0; for ($i = 1; $i <= $item_count; $i++) { $c_chkbox = ${"chkid" . $i}; if (($c_pid = ${"pid" . $i}) && $c_chkbox == "on") { $j++; $c_pnum = pid2pnum($c_pid); $c_pdesc = pnum2pdesc($c_pnum); $c_pemail = pnum2pemail($c_pnum); $op_content .= "\n\t\t\t\t\t <input type=hidden name=pid" . $j . " value=\"{$c_pid}\">\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td class=box_text width=4> {$j}. </td>\n\t\t\t\t\t\t<td class=box_text> {$c_pdesc}</td>\n\t\t\t\t\t\t<td class=box_text> {$c_pnum}</td>\n\t\t\t\t\t\t<td class=box_text> {$c_pemail}</td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t"; } } $item_count = $j; $op_content .= "\n\t\t </table>\n\t\t <p><input type=submit class=button value=\"Delete Item(s)\">\n\t\t <input type=hidden name=item_count value=\"{$item_count}\">\n\t\t </form>\n\t\t"; break; case "delete_yes": $gpid = $_POST['gpid']; for ($i = 1; $i <= $item_count; $i++) { $c_pid = ${"pid" . $i}; if ($c_pid) { $db_query = "DELETE FROM playsms_tblUserPhonebook WHERE pid='{$c_pid}'"; $db_result = @dba_affected_rows($db_query); }
function makeList($uid, $selfurl, $offset = 0, $numShow = 75) { $db = DB_DataObject::factory('playsms_tblSMSOutgoing'); if (!$offset) { $offset = 0; } $db->limit($offset, $numShow); $db->orderBy("smslog_id DESC"); $pagetitle = "Delivery report"; if (isadmin() && !$uid) { $pagetitle .= " (All)"; } else { $db->uid = $uid; } $db->flag_deleted = '0'; if ($offset) { $newOffset = $offset - $numShow; $prevUrl = "{$selfurl}&offset={$newOffset}"; } else { $prevUrl = "#"; } $newOffset = $offset + $numShow; $nextUrl = "{$selfurl}&offset={$newOffset}"; $exportUrl = "{$selfurl}&op=export"; $linksPrevNext = "<a href='{$prevUrl}'>[ Prev] </a>\n \t\t \t\t <a href='{$nextUrl}'>[ Next ]</a>\n <a href='{$exportUrl}'>[ Export ]</a>"; // create hidden form with the // id to delete, this way it will // get POSTed // $delForm = generateActionSubmitter("del", "{$selfurl}&op=del", "smslog_id"); $resendForm = generateActionSubmitter("resend", "{$selfurl}&op=resend", "smslog_id"); $content = "{$delForm} \n {$resendForm}\n \t\t <h2>{$pagetitle}</h2>\n \t\t <p/>\n\t\t\t\t{$linksPrevNext}\n \t\t <p/>\n \t\t <table width=100% cellpadding=1 cellspacing=1 border=1>\n \t\t <tr>\n \t\t <td align=center class=box_title width=2%>id</td>\n \t\t <td align=center class=box_title width=12%>Time</td>\n \t\t <td align=center class=box_title width=12%>Receiver</td>\n \t\t <td align=center class=box_title width=50%>Message</td>\n \t\t <td align=center class=box_title width=8%>Status</td>\n \t\t <td align=center class=box_title width=8%>Group</td>\n \t\t <td align=center class=box_title width=8%>Action</td>\n \t\t </tr>\n \t\t"; $db->find(); while ($db->fetch()) { $p_desc = pnum2pdesc($db->p_dst); $current_p_dst = $db->p_dst; if ($p_desc) { $current_p_dst = "{$db->p_dst}<br/>({$p_desc})"; } $hide_p_dst = $db->p_dst; if ($p_desc) { $hide_p_dst = "{$p_dst} ({$p_desc})"; } $p_sms_type = $db->p_sms_type; $hide_p_dst = str_replace("\\'", "", $hide_p_dst); $hide_p_dst = str_replace("\"", "", $hide_p_dst); $p_msg = nl2br($db->p_msg); if (($p_footer = $db->p_footer) && ($p_sms_type == "text" || $p_sms_type == "flash")) { $p_msg = $p_msg . " {$p_footer}"; } $p_datetime = $db->p_datetime; $p_update = $db->p_update; $p_status = $db->p_status; $p_gpid = $db->p_gpid; $status_color = getStatusColor($p_status); $status_name = getStatusName($p_status); $p_status = "<font color={$status_color}>{$status_name}</font> <br/>({$db->send_tries} tries)"; $p_status .= " {$db_row['p_status']}"; if ($p_gpid) { $db_query1 = "SELECT gp_code FROM playsms_tblUserGroupPhonebook WHERE gpid='{$p_gpid}'"; $db_result1 = dba_query($db_query1); $db_row1 = dba_fetch_array($db_result1); $p_gpcode = strtoupper($db_row1[gp_code]); } else { $p_gpcode = " "; } $deleteCode = "javascript: del({$db->smslog_id}, " . "'Are you sure you want to delete outgoing SMS to `{$hide_p_dst}`, number {$db->smslog_id} ?');"; $resendCode = "javascript: resend({$db->smslog_id});"; $actionCode = "<a href=\"{$deleteCode}\">[Delete]</a> <br/>\n\t\t <a href=\"{$resendCode}\">[Resend]</a>"; $content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign=top class=box_text align=left width=2%>{$db->smslog_id}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=12%>{$db->p_datetime}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=12%>{$current_p_dst}</td>\n\t\t\t\t\t<td valign=top class=box_text align=left width=50%>{$p_msg}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=8%>{$p_status}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=8%>{$p_gpcode}</td>\n\t\t\t\t\t<td valign=top class=box_text align=center width=8%>\n\t\t\t\t\t\t{$actionCode}\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t "; } $content .= "</form></table>\n \t\t\t<p/>\n \t\t {$linksPrevNext}"; return $content; }