Advertisement
Guest User

Status Center 1.3 STABLE - build: 132

a guest
Nov 24th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 71.01 KB | None | 0 0
  1. <?php
  2.  
  3. /**************************************************
  4.  * File: statuscenter.php
  5.  * Author: Tankey 'Reno' - Delta Commanders
  6.  * Version: 1.3 STABLE -- build: 132
  7.  * Website: http://www.deltacommanders.com
  8.  * License: Creative Commons Attribution-NonCommerical ShareAlike 3.0
  9.  *          http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
  10.  **************************************************/
  11.  
  12. // Include the MyBB Framework files to let this page work properly
  13. define("IN_MYBB", 1);
  14. require_once "./global.php";
  15. $title = "Status Center";
  16. add_breadcrumb($lang->sub_statuscenter, "statuscenter");
  17.  
  18. global $headerinclude, $header, $theme, $footer;
  19.  
  20. // Generate the page load time - header settings
  21. $time = microtime();
  22. $time = explode(' ', $time);
  23. $time = $time[1] + $time[0];
  24. $start = $time;
  25.  
  26. // Get the user ID for further reference.
  27. $user_check = $mybb->user['uid'];
  28. $user = get_user($user_check);
  29.  
  30. // List of all Admin Functions used in the file's home screen.
  31. if(($mybb->user['usergroup'] == 8) || ($mybb->user['usergroup'] == 4))
  32. {
  33.     $admin_end_user_notif = '<br /><b><center>Admin Functions:</b> <a href="http://deltacommanders.com/forum/hier.php?submit_notification=true&user='.$user_check.'" title="Submit new notification as \''.$user['username'].'\'">1. Submit new notification</a></center><center><a href="http://deltacommanders.com/forum/hier.php?show_subscribers=true" title="Display all Subscribers">2. Display Subscribers</a></center>';
  34.     $admin_end_user_update = '<br /><b><center>Admin Functions:</b> <a href="http://deltacommanders.com/forum/hier.php?submit_update=true&status='.$_GET['status'].'&id='.$_GET['id'].'&user='.$user_check.'" title="Submit new update as \''.$user['username'].'\'">1. Submit new update</a></center>';
  35. }
  36.  
  37. // Header of the home page.
  38. $template = '
  39. <html>
  40.     <head>
  41.         <title>'.$title.'</title>
  42.         {$headerinclude}
  43.         <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  44.     </head>
  45.     <body>
  46.     {$header}
  47. ';
  48.  
  49. // Information section holder
  50. $template .= '
  51.     <br />
  52.     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  53.         <thead>
  54.             <tr>
  55.                 <td class="thead" colspan="2">
  56.                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_info'].'.gif" id="status_info_img" class="expander" alt="[-]" title="[-]" /></div>
  57.                 <strong><center>Delta Commanders - Status Center</center></strong>
  58.                 </td>
  59.             </tr>
  60.         </thead>
  61.         <tbody style="'.$collapsed['status_info'].'" id="status_info_e">
  62.         <tr>
  63.             <td class="row1" width="90%" valign="top" rowspan="5"><span class="smalltext">The information on this page is an overview of all by Delta Commanders known outages, disruptions and maintenances (both current and recently resolved). To submit a still unknown failure you can contact us on <a href="mailto:admin@deltacommanders.com" title="admin@deltacommanders.com">admin@deltacommanders.com</a>.<br /><br />To stay updated about the statusses of Delta Commanders you can use our RSS function to receive new updates when available.<br />We already like to notify you already about the <b>SMS-alert function</b> which will be included soon to get real-time updates!</span></td>
  64.         </tr>
  65.         <tr>
  66.             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  67.         </tr>
  68.         <tr>
  69.             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  70.         </tr>
  71.         <tr>
  72.             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  73.         </tr>
  74.         <tr>
  75.             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  76.         </tr>
  77.         </tbody>
  78.     </table>
  79.     <br />
  80.     <br />';
  81. // End of Information section holder
  82.  
  83. // Outstanding Notifications section holder
  84. $template .= '
  85.     <table border="0" cellspacing="1" cellpadding="3" width="100%">
  86.     <tr>
  87.         <td width="50%" valign="top">
  88.     <table border="0" cellspacing="1" cellpadding="3" width="100%">
  89.         <thead>
  90.             <tr>
  91.                 <td colspan="2" class="thead">
  92.                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_current'].'.gif" id="status_current_img" class="expander" alt="[-]" title="[-]" /></div>
  93.                 <font size="2.4"><b>Outstanding Notifications</b></font>
  94.                 </td>
  95.             </tr>
  96.         </thead>
  97.         <tbody style="'.$collapsed['status_current'].'" id="status_current_e">';
  98.  
  99. $get_items_current = $db->query("SELECT *
  100. FROM `".TABLE_PREFIX."statuscenter_items`
  101. WHERE `item_status` IN (1,2)
  102. ORDER BY `latest_update` DESC");
  103.  
  104. $count_items_current = $db->num_rows($get_items_current);
  105. if($count_items_current > 0)
  106. {
  107.     while ($itemlvl = $db->fetch_array($get_items_current))
  108.     {
  109.         $item_id = intval($itemlvl['id']);
  110.         $item_summary = $itemlvl['item_summary'];
  111.         $item_prefix_raw = intval($itemlvl['item_prefix']);
  112.        
  113.         $item_add_query = $db->query("SELECT
  114.            `update_parent`,
  115.            `update_date` AS `latest_update`,
  116.             update_status
  117.        FROM `".TABLE_PREFIX."statuscenter_updates`
  118.         WHERE update_parent = ".$item_id."
  119.        ORDER BY `update_date` DESC LIMIT 1");
  120.        
  121.         $item_additional = $db->fetch_array($item_add_query);
  122.         $item_status_raw = intval($item_additional['update_status']);
  123.         $item_date_raw = intval($itemlvl['item_date']);
  124.         $item_update_raw = intval($item_additional['latest_update']);
  125.        
  126.         if($item_status_raw == 1)
  127.         {
  128.             $item_status = "Outage";
  129.         }
  130.         elseif($item_status_raw == 2)
  131.         {
  132.             $item_status = "Disruption";
  133.         }
  134.         elseif($item_status_raw == 3)
  135.         {
  136.             $item_status = "Resolved";
  137.         }
  138.         elseif($item_status_raw == 4)
  139.         {
  140.             $item_status = "Information";
  141.         }
  142.         else
  143.         {
  144.             $item_status = "";
  145.         }
  146.        
  147.         if($item_prefix_raw == 1)
  148.         {
  149.             $item_prefix = "[Forum]";
  150.         }
  151.         elseif($item_prefix_raw == 2)
  152.         {
  153.             $item_prefix = "[Website]";
  154.         }
  155.         elseif($item_prefix_raw == 3)
  156.         {
  157.             $item_prefix = "[Gameserver]";
  158.         }
  159.         elseif($item_prefix_raw == 4)
  160.         {
  161.             $item_prefix = "[Voiceserver]";
  162.         }
  163.         elseif($item_prefix_raw == 5)
  164.         {
  165.             $item_prefix = "[Update]";
  166.         }
  167.         elseif($item_prefix_raw == 6)
  168.         {
  169.             $item_prefix = "[Release]";
  170.         }
  171.         else
  172.         {
  173.             $item_prefix = "";
  174.         }
  175.        
  176.         $item_created = date('d-m-Y',$item_date_raw);
  177.         $item_updated = date('d-m-Y H:i',$item_update_raw);
  178.                
  179.         $template .= '<tr>
  180.                         <td>
  181.                             <a href="?showupdates=true&status='.$item_status.'&id='.$item_id.'" class="issue '.$item_status.'" title="Show details">
  182.                                 <span class="status"></span>
  183.                                 <span class="created">'.$item_created.':</span>
  184.                                 <span class="title">'.$item_prefix.' '.$item_summary.'</span>
  185.                                 <span class="updated"><span>Latest update:</span><br />'.$item_updated.'</span>
  186.                                 <span class="description"><span>Status:</span> '.$item_status.'</span>
  187.                             </a>
  188.                         </td>
  189.                     </tr>';
  190.     }
  191. }
  192. else
  193. {
  194.     $template .= '<tr align="center"><td><b>--> There are no outstanding notifications at the moment. <--</b></td></tr>';
  195. }
  196.  
  197. $template .= '</tbody></table></td>';
  198. // End of Outstanding Notifications
  199.  
  200. // Latest Updates section holder
  201. $template .= '
  202.     <td valign="top" width="50%">
  203.     <table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
  204.         <thead>
  205.             <tr>
  206.                 <td colspan="2" class="thead">
  207.                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_updates'].'.gif" id="status_updates_img" class="expander" alt="[-]" title="[-]" /></div>
  208.                 <font size="2.4"><b>Latest Updates</b></font>
  209.                 </td>
  210.             </tr>
  211.         </thead>
  212.         <tbody style="'.$collapsed['status_updates'].'" id="status_updates_e">';
  213.  
  214. $get_items_updates = $db->query("SELECT *
  215. FROM `".TABLE_PREFIX."statuscenter_items`
  216. WHERE `item_status` = 4
  217. ORDER BY `latest_update` DESC
  218. LIMIT 3");
  219. $count_items_updates = $db->num_rows($get_items_updates);
  220.  
  221. if($count_items_updates > 0)
  222. {
  223.     while ($itemlvl = $db->fetch_array($get_items_updates))
  224.     {
  225.         $item_id = intval($itemlvl['id']);
  226.         $item_summary = $itemlvl['item_summary'];
  227.         $item_prefix_raw = intval($itemlvl['item_prefix']);
  228.        
  229.         $item_add_query = $db->query("SELECT
  230.            `update_parent`,
  231.            `update_date` AS `latest_update`,
  232.             update_status
  233.        FROM `".TABLE_PREFIX."statuscenter_updates`
  234.         WHERE update_parent = ".$item_id."
  235.        ORDER BY `update_date` DESC LIMIT 1");
  236.        
  237.         $item_additional = $db->fetch_array($item_add_query);
  238.         $item_status_raw = intval($item_additional['update_status']);
  239.         $item_date_raw = intval($itemlvl['item_date']);
  240.         $item_update_raw = intval($item_additional['latest_update']);
  241.        
  242.         if($item_status_raw == 1)
  243.         {
  244.             $item_status = "Outage";
  245.         }
  246.         elseif($item_status_raw == 2)
  247.         {
  248.             $item_status = "Disruption";
  249.         }
  250.         elseif($item_status_raw == 3)
  251.         {
  252.             $item_status = "Resolved";
  253.         }
  254.         elseif($item_status_raw == 4)
  255.         {
  256.             $item_status = "Information";
  257.         }
  258.         else
  259.         {
  260.             $item_status = "";
  261.         }
  262.        
  263.         if($item_prefix_raw == 1)
  264.         {
  265.             $item_prefix = "[Forum]";
  266.         }
  267.         elseif($item_prefix_raw == 2)
  268.         {
  269.             $item_prefix = "[Website]";
  270.         }
  271.         elseif($item_prefix_raw == 3)
  272.         {
  273.             $item_prefix = "[Gameserver]";
  274.         }
  275.         elseif($item_prefix_raw == 4)
  276.         {
  277.             $item_prefix = "[Voiceserver]";
  278.         }
  279.         elseif($item_prefix_raw == 5)
  280.         {
  281.             $item_prefix = "[Update]";
  282.         }
  283.         elseif($item_prefix_raw == 6)
  284.         {
  285.             $item_prefix = "[Release]";
  286.         }
  287.         else
  288.         {
  289.             $item_prefix = "";
  290.         }
  291.        
  292.         $item_created = date('d-m-Y',$item_date_raw);
  293.         $item_updated = date('d-m-Y H:i',$item_update_raw);
  294.        
  295.         $template .= '<tr>
  296.                         <td>
  297.                             <a href="?showupdates=true&status='.$item_status.'&id='.$item_id.'" class="issue '.$item_status.'" title="Show details">
  298.                                 <span class="status"></span>
  299.                                 <span class="created">'.$item_created.':</span>
  300.                                 <span class="title">'.$item_prefix.' '.$item_summary.'</span>
  301.                                 <span class="updated"><span>Latest update:</span><br />'.$item_updated.'</span>
  302.                                 <span class="description"><span>Status:</span> '.$item_status.'</span>
  303.                             </a>
  304.                         </td>
  305.                     </tr>';
  306.     }
  307. }
  308. else
  309. {
  310.     $template .= '<tr align="center"><td><b>--> There is no information to be displayed. <--</b></td></tr>';
  311. }
  312.  
  313. $template .= '</tbody></table></td></tr></table>';
  314. // End of Latest Updates
  315.  
  316. // Recently Solved Notifications section holder
  317. $template .= '
  318.     <br />
  319.     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  320.         <thead>
  321.             <tr>
  322.                 <td colspan="2" class="thead">
  323.                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_recently'].'.gif" id="status_recently_img" class="expander" alt="[-]" title="[-]" /></div>
  324.                 <font size="2.4"><b>Recently Resolved Notifications <font size="0.5">(7 days log)</font> -- <a href="?displaylogs=true" title="View all logs">*View all logs*</a></font>
  325.                 </td>
  326.             </tr>
  327.         </thead>
  328.         <tbody style="'.$collapsed['status_recently'].'" id="status_recently_e">';
  329.  
  330. $get_items_recently = $db->query("SELECT u.*, uf.update_date
  331.                                                             FROM `".TABLE_PREFIX."statuscenter_items` AS u
  332.                                                             LEFT JOIN `".TABLE_PREFIX."statuscenter_updates` AS uf
  333.                                                             ON u.id = uf.update_parent
  334.                                                             WHERE u.`item_status` = 3
  335.                                                             AND uf.update_status = 3
  336.                                                             AND FROM_UNIXTIME(u.`latest_update`) >= DATE_SUB(CURRENT_TIMESTAMP,INTERVAL 7 DAY)
  337.                                                             ORDER BY uf.`update_date` DESC
  338.                                                             LIMIT 15");
  339.                                                            
  340. $count_items_recently = $db->num_rows($get_items_recently);
  341.  
  342. if($count_items_recently > 0)
  343. {
  344.     while ($itemlvl = $db->fetch_array($get_items_recently))
  345.     {
  346.         $item_id = intval($itemlvl['id']);
  347.         $item_summary = $itemlvl['item_summary'];
  348.         $item_prefix_raw = intval($itemlvl['item_prefix']);
  349.        
  350.         $item_add_query = $db->query("SELECT
  351.            `update_parent`,
  352.            `update_date` AS `latest_update`,
  353.             update_status
  354.        FROM `".TABLE_PREFIX."statuscenter_updates`
  355.         WHERE update_parent = ".$item_id."
  356.        ORDER BY `update_date` DESC LIMIT 1");
  357.        
  358.         $item_additional = $db->fetch_array($item_add_query);
  359.         $item_status_raw = intval($item_additional['update_status']);
  360.         $item_date_raw = intval($itemlvl['item_date']);
  361.         $item_update_raw = intval($item_additional['latest_update']);
  362.        
  363.         if($item_status_raw == 1)
  364.         {
  365.             $item_status = "Outage";
  366.         }
  367.         elseif($item_status_raw == 2)
  368.         {
  369.             $item_status = "Disruption";
  370.         }
  371.         elseif($item_status_raw == 3)
  372.         {
  373.             $item_status = "Resolved";
  374.         }
  375.         elseif($item_status_raw == 4)
  376.         {
  377.             $item_status = "Information";
  378.         }
  379.         else
  380.         {
  381.             $item_status = "";
  382.         }
  383.        
  384.         if($item_prefix_raw == 1)
  385.         {
  386.             $item_prefix = "[Forum]";
  387.         }
  388.         elseif($item_prefix_raw == 2)
  389.         {
  390.             $item_prefix = "[Website]";
  391.         }
  392.         elseif($item_prefix_raw == 3)
  393.         {
  394.             $item_prefix = "[Gameserver]";
  395.         }
  396.         elseif($item_prefix_raw == 4)
  397.         {
  398.             $item_prefix = "[Voiceserver]";
  399.         }
  400.         elseif($item_prefix_raw == 5)
  401.         {
  402.             $item_prefix = "[Update]";
  403.         }
  404.         elseif($item_prefix_raw == 6)
  405.         {
  406.             $item_prefix = "[Release]";
  407.         }
  408.         else
  409.         {
  410.             $item_prefix = "";
  411.         }
  412.        
  413.         $item_created = date('d-m-Y',$item_date_raw);
  414.         $item_updated = date('d-m-Y H:i',$item_update_raw);
  415.        
  416.         $template .= '<tr>
  417.                         <td>
  418.                             <a href="?showupdates=true&status='.$item_status.'&id='.$item_id.'" class="issue '.$item_status.'" title="Show details">
  419.                                 <span class="status"></span>
  420.                                 <span class="created">'.$item_created.':</span>
  421.                                 <span class="title">'.$item_prefix.' '.$item_summary.'</span>
  422.                                 <span class="updated"><span>Latest update:</span><br />'.$item_updated.'</span>
  423.                                 <span class="description"><span>Status:</span> '.$item_status.'</span>
  424.                             </a>
  425.                         </td>
  426.                     </tr>';
  427.     }
  428. }
  429. else
  430. {
  431.     $template .= '<tr align="center"><td><b>--> There is no information to be displayed. <--</b></td></tr>';
  432. }
  433.  
  434. if($mybb->user['uid'])
  435. {
  436.     $get_signup_user = $db->query("SELECT email FROM `".TABLE_PREFIX."statuscenter_signup` WHERE `uid` = $user_check");
  437.     $count_signup_user = $db->num_rows($get_signup_user);
  438.     if ($count_signup_user == 0)
  439.     {
  440.         $user_end_notif = '<br /><b><center>User Functions:</b> <a href="http://deltacommanders.com/forum/hier.php?email_subscription=true&action=subscribe" title="Subscribe as \''.$user['username'].'\'" onclick="return confirm(\'Are you sure you want to subscribe for new notifications?\');">1. Subscribe for notifications (Email)</a></center>';
  441.     }
  442.     elseif ($count_signup_user > 0)
  443.     {
  444.         $user_end_notif = '<br /><b><center>User Functions:</b> <a href="http://deltacommanders.com/forum/hier.php?email_subscription=true&action=unsubscribe" title="Unsubscribe as \''.$user['username'].'\'" onclick="return confirm(\'Are you sure you want to unsubscribe for new notifications?\');">1. Unsubscribe for notifications (Email)</a></center>';
  445.     }
  446. }
  447.  
  448. $template .= '</tbody></table>
  449.                 '.$admin_end_user_notif.'
  450.                 '.$user_end_notif;
  451. // End of Recently Solved Notifications
  452.  
  453. // Check if user used signup for email
  454. if(isset($_GET['email_subscription'], $_GET['action']))
  455. {
  456.     if($_GET['email_subscription'] == "true")
  457.     {
  458.         $get_signup_user_b = $db->query("SELECT email FROM `".TABLE_PREFIX."statuscenter_signup` WHERE `uid` = $user_check");
  459.         $count_signup_user_b = $db->num_rows($get_signup_user_b);
  460.        
  461.         if (($count_signup_user == 0) && ($_GET['action'] == "subscribe"))
  462.         {
  463.             $get_email_from_main = $db->query("SELECT email FROM `".TABLE_PREFIX."users` WHERE `uid` = $user_check");
  464.             $get_email = $get_email_from_main->fetch_assoc();
  465.             $email = $get_email['email'];
  466.             $user_check = $mybb->user['uid'];
  467.             $db->insert_query('statuscenter_signup', array(
  468.                 'uid'   => (int) $user_check,
  469.                 'email' => $email
  470.                 ));
  471.            
  472.             $page = 'hier.php';
  473.             header('Location: '.$page, true, 303);
  474.             exit;
  475.         }
  476.         elseif (($count_signup_user > 0) && ($_GET['action'] == "unsubscribe"))
  477.         {
  478.             $user_check = $mybb->user['uid'];
  479.             $db->query("DELETE FROM `".TABLE_PREFIX."statuscenter_signup` WHERE `uid` = $user_check");
  480.             $db->query("OPTIMIZE TABLE `".TABLE_PREFIX."statuscenter_signup`");
  481.             $page = 'hier.php';
  482.             header('Location: '.$page, true, 303);
  483.             exit;
  484.         }
  485.     }
  486. }
  487. // End :)
  488.        
  489. // The form for submitting a new notification
  490. if(isset($_POST['submit_notif']))
  491. {
  492.     $notification_title = nl2br(str_replace("'", "\'", $_POST["item_title"]));
  493.     $notification_summary = nl2br(str_replace("'", "\'", $_POST["item_summary"]));
  494.     $notification_prefix = $_POST["item_prefix"];
  495.     $notification_status = $_POST["item_status"];
  496.     $notification_byuid = $user_check;
  497.     $notification_time = time();
  498.        
  499.             $db->insert_query('statuscenter_items', array(
  500.                 'item_summary'  => $notification_title,
  501.                 'item_prefix'   => (int) $notification_prefix,
  502.                 'item_status'   => (int) $notification_status,
  503.                 'item_date'     => (int) $notification_time,
  504.                 'latest_update' => (int) $notification_time,
  505.                 'by_uid'        => (int) $notification_byuid
  506.                 ));
  507.                
  508.             $get_parent_id = $db->query("SELECT id FROM `".TABLE_PREFIX."statuscenter_items` WHERE `item_date` = '$notification_time'");
  509.             $pid = $get_parent_id->fetch_assoc();
  510.                
  511.             $notification_parent = $pid['id'];
  512.                    
  513.             $db->insert_query('statuscenter_updates', array(
  514.                 'update_summary'    => $notification_summary,
  515.                 'update_parent'     => (int) $notification_parent,
  516.                 'update_status'     => (int) $notification_status,
  517.                 'update_date'       => (int) $notification_time,
  518.                 'update_first'      => (int) 1,
  519.                 'by_uid'            => (int) $notification_byuid
  520.                 ));
  521.            
  522.             $get_subscribers = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_signup`");
  523.                 while ($sublvl = $db->fetch_array($get_subscribers))
  524.                 {
  525.                     $sub_id = intval($sublvl['uid']);
  526.                     $sub_raw = get_user($sub_id);
  527.                     $sub_username = $sub_raw['username'];
  528.                     $sub_mail = $sublvl['email'];
  529.                    
  530.                     if($notification_status == 1)
  531.                     {
  532.                         $item_status = "Outage";
  533.                     }
  534.                     elseif($notification_status == 2)
  535.                     {
  536.                         $item_status = "Disruption";
  537.                     }
  538.                     elseif($notification_status == 3)
  539.                     {
  540.                         $item_status = "Resolved";
  541.                     }
  542.                     elseif($notification_status == 4)
  543.                     {
  544.                         $item_status = "Information";
  545.                     }
  546.                     else
  547.                     {
  548.                         $item_status = "";
  549.                     }
  550.                    
  551.                     if($notification_prefix == 1)
  552.                     {
  553.                         $item_prefix = "[Forum]";
  554.                     }
  555.                     elseif($notification_prefix == 2)
  556.                     {
  557.                         $item_prefix = "[Website]";
  558.                     }
  559.                     elseif($notification_prefix == 3)
  560.                     {
  561.                         $item_prefix = "[Gameserver]";
  562.                     }
  563.                     elseif($notification_prefix == 4)
  564.                     {
  565.                         $item_prefix = "[Voiceserver]";
  566.                     }
  567.                     elseif($notification_prefix == 5)
  568.                     {
  569.                         $item_prefix = "[Update]";
  570.                     }
  571.                     elseif($notification_prefix == 6)
  572.                     {
  573.                         $item_prefix = "[Release]";
  574.                     }
  575.                     else
  576.                     {
  577.                         $item_prefix = "";
  578.                     }
  579.                    
  580.                     //Mail includings
  581.                     $subject = $item_prefix . " " . $notification_title;
  582.                    
  583.                     $message = 'Dear '.$sub_username.',';
  584.                     $message .= '<br />';
  585.                     $message .= '<br />';
  586.                     $message .= 'You have subscribed to the Status Center System by Delta Commanders and therefore you receive this message.';
  587.                     $message .= '<br />';
  588.                     $message .= 'If you don\'t want to receive any mails from our system anymore, then you can unsubscribe <a href="http://deltacommanders.com/forum/hier.php?email_subscription=true&action=unsubscribe">here</a>.';
  589.                     $message .= '<br />';
  590.                     $message .= '<br />';
  591.                     $message .= '------------------> <strong>'.$subject.'</strong> *'.$item_status.'* <------------------';
  592.                     $message .= '<br />';
  593.                     $message .= '<br />';
  594.                     $message .= stripslashes($notification_summary);
  595.                     $message .= '<br />';
  596.                     $message .= '<br />';
  597.                     $message .= '--------------------------------------------------------------------';
  598.                     $message .= '<br />';
  599.                     $message .= '<br />';
  600.                     $message .= 'Thanks for your subscription. You can view the full message on our website: <a href="http://www.deltacommanders.com/forum/hier.php?showupdates=true&status='.$item_status.'&id='.$notification_parent.'">http://www.deltacommanders.com/forum/hier.php?showupdates=true&status='.$item_status.'&id='.$notification_parent.'</a>';
  601.                     $message .= '<br />';
  602.                     $message .= 'If you want to check out all updates and notifications please go to <a href="http://www.deltacommanders.com/forum/hier.php">http://www.deltacommanders.com/forum/hier.php</a>';
  603.                     $message .= '<br />';
  604.                     $message .= '<br />';
  605.                     $message .= 'If you have any questions left about this issue, please do not hesitate to contact us so we can give additional support to fit your needs.';
  606.                     $message .= '<br />';
  607.                     $message .= '<br />';
  608.                     $message .= 'Kindest regards,';
  609.                     $message .= '<br />';
  610.                     $message .= 'Delta Commanders Staff';
  611.                    
  612.                     $headers .= "From: Status Center - Delta Commanders <support@deltacommanders.com>\r\n";
  613.                     $headers .= "Reply-To: support@deltacommanders.com\r\n";
  614.                     $headers .= "MIME-Version: 1.0\r\n";
  615.                     $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  616.                     $headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
  617.                     $headers .= "X-Priority: 1\r\n";
  618.                     $headers .= "Priority: Urgent\r\n";
  619.                     $headers .= "Importance: High\r\n";
  620.                     $headers .= "X-MSMail-Priority: High\r\n";
  621.                    
  622.                     mail($sub_mail, $subject, $message, $headers);
  623.                 }
  624.                
  625.         $page = 'hier.php';
  626.         header('Location: '.$page, true, 303);
  627.         exit;
  628. }
  629.  
  630. if(isset($_POST['submit_update']))
  631. {
  632.     $update_summary = nl2br(str_replace("'", "\'", $_POST["update_summary"]));
  633.     $update_status = $_POST["update_status"];
  634.     $update_parent = $_POST["parent_id"];
  635.     $update_time = time();
  636.     $update_byuid = $user_check;
  637.    
  638.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_updates`
  639.                 SET `update_latest` = '0'
  640.                 WHERE `update_parent` =  $update_parent'");
  641.    
  642.     $db->insert_query('statuscenter_updates', array(
  643.                 'update_summary'    => $update_summary,
  644.                 'update_parent'     => (int) $update_parent,
  645.                 'update_status'     => (int) $update_status,
  646.                 'update_date'       => (int) $update_time,
  647.                 'by_uid'            => (int) $update_byuid
  648.                 ));
  649.                
  650.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_items`
  651.                 SET `latest_update` = '$update_time'
  652.                 WHERE `id` = '$update_parent'");
  653.                
  654.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_items`
  655.                 SET `item_status` = '$update_status'
  656.                 WHERE `id` = '$update_parent'");
  657.                
  658.     $get_parent_info = $db->query("SELECT id,item_summary, item_prefix FROM `".TABLE_PREFIX."statuscenter_items` WHERE `id` = '$update_parent'");
  659.     $iid = $get_parent_info->fetch_assoc();
  660.         $parent_name = $iid['item_summary'];
  661.         $parent_prefix = $iid['item_prefix'];
  662.         $parent_status = $iid['item_status'];
  663.         $parent_id = $iid['id'];
  664.                
  665.         $get_subscribers = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_signup`");
  666.                 while ($sublvl = $db->fetch_array($get_subscribers))
  667.                 {
  668.                     $sub_id = intval($sublvl['uid']);
  669.                     $sub_raw = get_user($sub_id);
  670.                     $sub_username = $sub_raw['username'];
  671.                     $sub_mail = $sublvl['email'];
  672.                    
  673.                     if($update_status == 1)
  674.                     {
  675.                         $item_status = "Outage";
  676.                     }
  677.                     elseif($update_status == 2)
  678.                     {
  679.                         $item_status = "Disruption";
  680.                     }
  681.                     elseif($update_status == 3)
  682.                     {
  683.                         $item_status = "Resolved";
  684.                     }
  685.                     elseif($update_status == 4)
  686.                     {
  687.                         $item_status = "Information";
  688.                     }
  689.                     else
  690.                     {
  691.                         $item_status = "";
  692.                     }
  693.                    
  694.                     if($parent_status == 1)
  695.                     {
  696.                         $item_status_p = "Outage";
  697.                     }
  698.                     elseif($parent_status == 2)
  699.                     {
  700.                         $item_status_p = "Disruption";
  701.                     }
  702.                     elseif($parent_status == 3)
  703.                     {
  704.                         $item_status_p = "Resolved";
  705.                     }
  706.                     elseif($parent_status == 4)
  707.                     {
  708.                         $item_status_p = "Information";
  709.                     }
  710.                     else
  711.                     {
  712.                         $item_status_p = "";
  713.                     }
  714.                    
  715.                     if($parent_prefix == 1)
  716.                     {
  717.                         $item_prefix = "[Forum]";
  718.                     }
  719.                     elseif($parent_prefix == 2)
  720.                     {
  721.                         $item_prefix = "[Website]";
  722.                     }
  723.                     elseif($parent_prefix == 3)
  724.                     {
  725.                         $item_prefix = "[Gameserver]";
  726.                     }
  727.                     elseif($parent_prefix == 4)
  728.                     {
  729.                         $item_prefix = "[Voiceserver]";
  730.                     }
  731.                     elseif($parent_prefix == 5)
  732.                     {
  733.                         $item_prefix = "[Update]";
  734.                     }
  735.                     elseif($parent_prefix == 6)
  736.                     {
  737.                         $item_prefix = "[Release]";
  738.                     }
  739.                     else
  740.                     {
  741.                         $item_prefix = "";
  742.                     }
  743.                    
  744.                     //Mail includings
  745.                     $subject = $item_prefix.' '.$parent_name;
  746.                    
  747.                     $message = 'Dear '.$sub_username.',';
  748.                     $message .= '<br />';
  749.                     $message .= '<br />';
  750.                     $message .= 'You have subscribed to the Status Center System by Delta Commanders and therefore you receive this message.';
  751.                     $message .= '<br />';
  752.                     $message .= 'If you don\'t want to receive any mails from our system anymore, then you can unsubscribe <a href="http://deltacommanders.com/forum/hier.php?email_subscription=true&action=unsubscribe">here</a>.';
  753.                     $message .= '<br />';
  754.                     $message .= '<br />';
  755.                     $message .= '------------------> <strong>'.$subject.'</strong> (update) *'.$item_status.'* <------------------';
  756.                     $message .= '<br />';
  757.                     $message .= '<br />';
  758.                     $message .= stripslashes($update_summary);
  759.                     $message .= '<br />';
  760.                     $message .= '<br />';
  761.                     $message .= '--------------------------------------------------------------------';
  762.                     $message .= '<br />';
  763.                     $message .= '<br />';
  764.                     $message .= 'Thanks for your subscription. You can view the full message on our website: <a href="http://www.deltacommanders.com/forum/hier.php?showupdates=true&status='.$item_status_p.'&id='.$parent_id.'">http://www.deltacommanders.com/forum/hier.php?showupdates=true&status='.$item_status_p.'&id='.$parent_id.'</a>';
  765.                     $message .= '<br />';
  766.                     $message .= 'If you want to check out all updates and notifications please go to <a href="http://www.deltacommanders.com/forum/hier.php">http://www.deltacommanders.com/forum/hier.php</a>';
  767.                     $message .= '<br />';
  768.                     $message .= '<br />';
  769.                     $message .= 'If you have any questions left about this issue, please do not hesitate to contact us so we can give additional support to fit your needs.';
  770.                     $message .= '<br />';
  771.                     $message .= '<br />';
  772.                     $message .= 'Kindest regards,';
  773.                     $message .= '<br />';
  774.                     $message .= 'Delta Commanders Staff';
  775.                    
  776.                     $headers .= "From: Status Center - Delta Commanders <support@deltacommanders.com>\r\n";
  777.                     $headers .= "Reply-To: support@deltacommanders.com\r\n";
  778.                     $headers .= "MIME-Version: 1.0\r\n";
  779.                     $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
  780.                     $headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
  781.                     $headers .= "X-Priority: 1\r\n";
  782.                     $headers .= "Priority: Urgent\r\n";
  783.                     $headers .= "Importance: High\r\n";
  784.                     $headers .= "X-MSMail-Priority: High\r\n";
  785.                    
  786.                     mail($sub_mail, $subject, $message, $headers);
  787.                 }
  788.        
  789.         $page = 'hier.php';
  790.         header('Location: '.$page, true, 303);
  791.         exit;
  792. }
  793.  
  794. // Submit editted update
  795. if(isset($_POST['submit_editted_update']))
  796. {
  797.     $updated_title = str_replace("'", "\'", $_POST["item_title"]);
  798.     $updated_summary = nl2br(str_replace("'", "\'", $_POST["item_summary"]));
  799.     $update_status = $_POST["item_status"];
  800.     $update_prefix = $_POST["item_prefix"];
  801.     $update_updated_on = time();
  802.     $update_updated_by = $mybb->user['uid'];
  803.    
  804.     $update_id = $_POST["updated_id"];
  805.    
  806.     $get_inf_query = $db->query("SELECT update_parent, update_latest FROM `".TABLE_PREFIX."statuscenter_updates` WHERE `id` = $update_id");
  807.     $get_inf = $get_inf_query->fetch_assoc();
  808.     $parent_id = $get_inf["update_parent"];
  809.     $is_latest_updated = $get_inf["update_latest"];
  810.    
  811.     if($is_latest_updated == "1")
  812.     {
  813.         $db->query("UPDATE `".TABLE_PREFIX."statuscenter_items`
  814.                 SET `item_status` = '$update_status'
  815.                 WHERE `id` = '$parent_id'");
  816.     }
  817.    
  818.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_items`
  819.                 SET `item_summary` = '$updated_title'
  820.                 WHERE `id` = '$parent_id'");
  821.                
  822.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_items`
  823.                 SET `item_prefix` = '$update_prefix'
  824.                 WHERE `id` = '$parent_id'");
  825.                
  826.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_items`
  827.                 SET `by_uid` = '$update_updated_by'
  828.                 WHERE `id` = '$parent_id'");
  829.                
  830.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_updates`
  831.                 SET `update_summary` = '$updated_summary'
  832.                 WHERE `id` = '$update_id'");
  833.                
  834.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_updates`
  835.                 SET `update_status` = '$update_status'
  836.                 WHERE `id` = '$update_id'");
  837.                
  838.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_updates`
  839.                 SET `updated_by` = '$update_updated_by'
  840.                 WHERE `id` = '$update_id'");
  841.                
  842.     $db->query("UPDATE `".TABLE_PREFIX."statuscenter_updates`
  843.                 SET `updated_on` = '$update_updated_on'
  844.                 WHERE `id` = '$update_id'");
  845.    
  846. }  
  847.  
  848. // Display all logs of the database
  849. if(isset($_GET['displaylogs']))
  850. {
  851.     if($_GET['displaylogs'] == "true")
  852.     {
  853.         $template = '
  854.             <html>
  855.                 <head>
  856.                     <title>'.$title.'</title>
  857.                     {$headerinclude}
  858.                     <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  859.                 </head>
  860.                 <body>
  861.                     {$header}';
  862.        
  863.         $template .= '
  864.                     <br />
  865.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  866.                         <thead>
  867.                             <tr>
  868.                                 <td class="thead" colspan="3">
  869.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_info'].'.gif" id="status_info_img" class="expander" alt="[-]" title="[-]" /></div>
  870.                                 <strong><center>Delta Commanders - Status Center</center></strong>
  871.                                 </td>
  872.                             </tr>
  873.                         </thead>
  874.                         <tbody style="'.$collapsed['status_info'].'" id="status_info_e">
  875.                         <tr>
  876.                             <td class="row1" width="10%" rowspan="5"><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back"><img src="http://www.deltacommanders.com/forum/images/back.png" align="left">Back to overview</a></td>
  877.                             <td class="row1" width="80%" valign="top" rowspan="5"><span class="smalltext">Welcome at the log section.<br />All old logs will be stored here for further references to previous errors and updates. Nothing will be pruned, nothing will be modified.</span></td>
  878.                         </tr>
  879.                         <tr>
  880.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  881.                         </tr>
  882.                         <tr>
  883.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  884.                         </tr>
  885.                         <tr>
  886.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  887.                         </tr>
  888.                         <tr>
  889.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  890.                         </tr>
  891.                         </tbody>
  892.                     </table>
  893.                     <br />
  894.                     <br />';
  895.                    
  896.         $template .= '
  897.                     <br />
  898.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  899.                         <thead>
  900.                             <tr>
  901.                                 <td class="thead" colspan="2">
  902.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['display_all'].'.gif" id="display_all_img" class="expander" alt="[-]" title="[-]" /></div>
  903.                                 <strong><center>Display all logs</center></strong>
  904.                                 </td>
  905.                             </tr>
  906.                         </thead>
  907.                         <tbody style="'.$collapsed['display_all'].'" id="display_all_e">
  908.                             <tr>
  909.                                 <td>
  910.                                     <div align="center"><b>Filter: <a href="?displaylogs=true&filter=all" title="Show all notifications">All</a> | <a href="?displaylogs=true&filter=updates" title="Show updates only">Updates</a> | <a href="?displaylogs=true&filter=resolved" title="Show resolved notifications only">Resolved</a></div>
  911.                                 </td>
  912.                             </tr>';
  913.        
  914.             if($_GET['filter'] == "all")
  915.             {
  916.                 $get_items_displayall = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_items` WHERE `item_status` IN (3,4) ORDER BY `latest_update` DESC");
  917.             }
  918.             elseif($_GET['filter'] == "updates")
  919.             {
  920.                 $get_items_displayall = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_items` WHERE `item_status` = 4 ORDER BY `latest_update` DESC");
  921.             }
  922.             elseif($_GET['filter'] == "resolved")
  923.             {
  924.                 $get_items_displayall = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_items` WHERE `item_status` = 3 ORDER BY `latest_update` DESC");
  925.             }
  926.             else
  927.             {
  928.                 $get_items_displayall = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_items` WHERE `item_status` IN (3,4) ORDER BY `latest_update` DESC");
  929.             }
  930.            
  931.         $count_items_displayall = $db->num_rows($get_items_displayall);
  932.        
  933.         if($count_items_displayall > 0)
  934.         {
  935.             while ($itemlvl = $db->fetch_array($get_items_displayall))
  936.             {
  937.                 $item_id = intval($itemlvl['id']);
  938.                 $item_summary = $itemlvl['item_summary'];
  939.                 $item_prefix_raw = intval($itemlvl['item_prefix']);
  940.        
  941.                 $item_add_query = $db->query("SELECT
  942.                                                 `update_parent`,
  943.                                                 `update_date` AS `latest_update`,
  944.                                                 update_status
  945.                                                 FROM `".TABLE_PREFIX."statuscenter_updates`
  946.                                                 WHERE update_parent = ".$item_id."
  947.                                                 ORDER BY `update_date` DESC LIMIT 1");
  948.        
  949.                 $item_additional = $db->fetch_array($item_add_query);
  950.                 $item_status_raw = intval($item_additional['update_status']);
  951.                 $item_date_raw = intval($itemlvl['item_date']);
  952.                 $item_update_raw = intval($item_additional['latest_update']);
  953.                
  954.                 if($item_status_raw == 1)
  955.                 {
  956.                     $item_status = "Outage";
  957.                 }
  958.                 elseif($item_status_raw == 2)
  959.                 {
  960.                     $item_status = "Disruption";
  961.                 }
  962.                 elseif($item_status_raw == 3)
  963.                 {
  964.                     $item_status = "Resolved";
  965.                 }
  966.                 elseif($item_status_raw == 4)
  967.                 {
  968.                     $item_status = "Information";
  969.                 }
  970.                 else
  971.                 {
  972.                     $item_status = "";
  973.                 }
  974.                
  975.                 if($item_prefix_raw == 1)
  976.                 {
  977.                     $item_prefix = "[Forum]";
  978.                 }
  979.                 elseif($item_prefix_raw == 2)
  980.                 {
  981.                     $item_prefix = "[Website]";
  982.                 }
  983.                 elseif($item_prefix_raw == 3)
  984.                 {
  985.                     $item_prefix = "[Gameserver]";
  986.                 }
  987.                 elseif($item_prefix_raw == 4)
  988.                 {
  989.                     $item_prefix = "[Voiceserver]";
  990.                 }
  991.                 elseif($item_prefix_raw == 5)
  992.                 {
  993.                     $item_prefix = "[Update]";
  994.                 }
  995.                 elseif($item_prefix_raw == 6)
  996.                 {
  997.                     $item_prefix = "[Release]";
  998.                 }
  999.                 else
  1000.                 {
  1001.                     $item_prefix = "";
  1002.                 }
  1003.                
  1004.                 $item_created = date('d-m-Y',$item_date_raw);
  1005.                 $item_updated = date('d-m-Y H:i',$item_update_raw);
  1006.                
  1007.                 $template .= '<tr>
  1008.                         <td>
  1009.                             <a href="?showupdates=true&status='.$item_status.'&id='.$item_id.'" class="issue '.$item_status.'" title="Show details">
  1010.                                 <span class="status"></span>
  1011.                                 <span class="created">'.$item_created.':</span>
  1012.                                 <span class="title">'.$item_prefix.' '.$item_summary.'</span>
  1013.                                 <span class="updated"><span>Latest update:</span><br />'.$item_updated.'</span>
  1014.                                 <span class="description"><span>Status:</span> '.$item_status.'</span>
  1015.                             </a>
  1016.                         </td>
  1017.                     </tr>';
  1018.             }
  1019.         }
  1020.         else
  1021.         {
  1022.             $template .= '<tr align="center"><td><b>--> There is no information to be displayed. <--</b></td></tr>';
  1023.         }
  1024.        
  1025.     $template .= '</tbody></table><br /><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back" style="padding: 140px;"><-- Go back</a>';
  1026.     }
  1027.     else
  1028.     {
  1029.         false;
  1030.     }
  1031. }
  1032. // End of displaying all logs of the database
  1033.  
  1034. // Check if client clicked on a url to display additional info - if so, this section will get it working
  1035. elseif(isset($_GET['showupdates'], $_GET['status'], $_GET['id']))
  1036. {
  1037.     if($_GET['showupdates'] == "true")
  1038.     {      
  1039.         $template = '
  1040.             <html>
  1041.                 <head>
  1042.                     <title>'.$title.'</title>
  1043.                     {$headerinclude}
  1044.                     <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  1045.                 </head>
  1046.                 <body>
  1047.                     {$header}';
  1048.    
  1049.         $template .= '
  1050.                     <br />
  1051.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  1052.                         <thead>
  1053.                             <tr>
  1054.                                 <td class="thead" colspan="3">
  1055.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_info'].'.gif" id="status_info_img" class="expander" alt="[-]" title="[-]" /></div>
  1056.                                 <strong><center>Delta Commanders - Status Center</center></strong>
  1057.                                 </td>
  1058.                             </tr>
  1059.                         </thead>
  1060.                         <tbody style="'.$collapsed['status_info'].'" id="status_info_e">
  1061.                         <tr>
  1062.                             <td class="row1" width="10%" rowspan="5"><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back"><img src="http://www.deltacommanders.com/forum/images/back.png" align="left">Back to overview</a></td>
  1063.                             <td class="row1" width="80%" valign="top" rowspan="5"><span class="smalltext">On this page you see the additional information & updates about this issue. If the status of the issue is changed, whithout us knowing so, you can report the new status to <a href="mailto:admin@deltacommanders.com">admin@deltacommanders.com</a><br /><br />We try to keep this update as accurate as possible so you\'re able to use this center as main location for problems.<br />Thanks in advance!</span></td>
  1064.                         </tr>
  1065.                         <tr>
  1066.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  1067.                         </tr>
  1068.                         <tr>
  1069.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  1070.                         </tr>
  1071.                         <tr>
  1072.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  1073.                         </tr>
  1074.                         <tr>
  1075.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  1076.                         </tr>
  1077.                         </tbody>
  1078.                     </table>
  1079.                     <br />
  1080.                     <br />';
  1081.                    
  1082.                     $parent_id = intval($_GET['id']);
  1083.                     $show_item_sum_raw = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_items` WHERE `id` = $parent_id");
  1084.                     $show_item_sum = $show_item_sum_raw->fetch_assoc();
  1085.                    
  1086.                     if($show_item_sum['item_prefix'] == 1)
  1087.                     {
  1088.                         $item_prefix = "[Forum]";
  1089.                     }
  1090.                     elseif($show_item_sum['item_prefix'] == 2)
  1091.                     {
  1092.                         $item_prefix = "[Website]";
  1093.                     }
  1094.                     elseif($show_item_sum['item_prefix'] == 3)
  1095.                     {
  1096.                         $item_prefix = "[Gameserver]";
  1097.                     }
  1098.                     elseif($show_item_sum['item_prefix'] == 4)
  1099.                     {
  1100.                         $item_prefix = "[Voiceserver]";
  1101.                     }
  1102.                     elseif($show_item_sum['item_prefix'] == 5)
  1103.                     {
  1104.                         $item_prefix = "[Update]";
  1105.                     }
  1106.                     elseif($show_item_sum['item_prefix'] == 6)
  1107.                     {
  1108.                         $item_prefix = "[Release]";
  1109.                     }
  1110.                     else
  1111.                     {
  1112.                         $item_prefix = "";
  1113.                     }
  1114.                    
  1115.                     if($show_item_sum['item_status'] == 1)
  1116.                     {
  1117.                         $item_status = "Outage";
  1118.                     }
  1119.                     elseif($show_item_sum['item_status'] == 2)
  1120.                     {
  1121.                         $item_status = "Disruption";
  1122.                     }
  1123.                     elseif($show_item_sum['item_status'] == 3)
  1124.                     {
  1125.                         $item_status = "Resolved";
  1126.                     }
  1127.                     elseif($show_item_sum['item_status'] == 4)
  1128.                     {
  1129.                         $item_status = "Information";
  1130.                     }
  1131.                     else
  1132.                     {
  1133.                         $item_status = "";
  1134.                     }
  1135.                    
  1136.                     $view_item_created = date('d-m-Y, H:i',$show_item_sum['item_date']);
  1137.  
  1138.                     $template .= '<table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  1139.                         <thead>
  1140.                             <tr>
  1141.                                 <td colspan="3">
  1142.                                     <div class="'.$item_status.'">
  1143.                                         <span class="status"></span><h2>'.$item_prefix.' '.$show_item_sum['item_summary'].'</h2>
  1144.                                         <span class="headtime">Created on: <span style="font-weight: bold;">'.$view_item_created.'</span></span>
  1145.                                     </div>
  1146.                                     <br />
  1147.                                 </td>
  1148.                             </tr>
  1149.                             <tr align="center">
  1150.                                 <td class="tcat" width="15%"><strong><div class="time">Date / Time</div></strong></td>
  1151.                                 <td class="tcat" width="1%" style="font-weight: bold;">#</td>
  1152.                                 <td class="tcat" width="84%"><strong>Description</strong></td>
  1153.                             </tr>
  1154.                         </thead>
  1155.                         <tbody>';
  1156.                        
  1157.                     // Get information out of the database
  1158.                     $get_info_item_updates = $db->query("SELECT *
  1159.                                                             FROM `".TABLE_PREFIX."statuscenter_items` AS u
  1160.                                                             RIGHT JOIN `".TABLE_PREFIX."statuscenter_updates` AS uf
  1161.                                                             ON u.id = uf.update_parent
  1162.                                                             WHERE u.`id` = $parent_id
  1163.                                                             ORDER BY uf.`id`
  1164.                                                             DESC");
  1165.                    
  1166.                     $count_info_item_updates = $db->num_rows($get_info_item_updates);
  1167.                        
  1168.                     if($count_info_item_updates > 0) // Count the rows - if more then one show details - otherwise show error message (it should not show the error message though..)
  1169.                     {
  1170.                         while ($g_info = $db->fetch_array($get_info_item_updates))
  1171.                         {
  1172.                             $show_item_id = intval($g_info['pid']);
  1173.                             $show_item_sum = $g_info['item_summary'];
  1174.                             $show_item_prefix = $g_info['item_prefix'];
  1175.                             $show_item_status = intval($g_info['item_status']);
  1176.                             $show_item_date = intval($g_info['item_date']);
  1177.                            
  1178.                             $show_update_id = intval($g_info['id']);
  1179.                             $show_update_sum = $g_info['update_summary'];
  1180.                             $show_update_parent = intval($g_info['update_parent']);
  1181.                             $show_update_status = intval($g_info['update_status']);
  1182.                             $show_update_date = intval($g_info['update_date']);
  1183.                            
  1184.                             $view_update_created_date = date('d-m-Y,',$show_update_date);
  1185.                             $view_update_created_time = date('H:i',$show_update_date);
  1186.                            
  1187.                             $is_updated_on_raw = intval($g_info['updated_on']);
  1188.                             if ($is_updated_on_raw != "0")
  1189.                             {
  1190.                                 $is_updated_by = intval($g_info['updated_by']);
  1191.                                 $is_updated_on = date('D, j M Y H:i:s',$is_updated_on_raw);
  1192.                                
  1193.                                 $sub_name = get_user($is_updated_by);
  1194.                                 $sub_username = $sub_name['username'];
  1195.                                
  1196.                                 $is_edited = '<br /><font size="1.8pt">Last edited on '.$is_updated_on.', by '.$sub_username.'</span>.';
  1197.                             }
  1198.                            
  1199.                             if($show_update_status == 1)
  1200.                             {
  1201.                                 $view_update_status = "Outage";
  1202.                             }
  1203.                             elseif($show_update_status == 2)
  1204.                             {
  1205.                                 $view_update_status = "Disruption";
  1206.                             }
  1207.                             elseif($show_update_status == 3)
  1208.                             {
  1209.                                 $view_update_status = "Resolved";
  1210.                             }
  1211.                             elseif($show_update_status == 4)
  1212.                             {
  1213.                                 $view_update_status = "Information";
  1214.                             }
  1215.                             else
  1216.                             {
  1217.                                 $view_update_status = "";
  1218.                             }
  1219.                            
  1220.                             if(($mybb->user['usergroup'] == 8) || ($mybb->user['usergroup'] == 4))
  1221.                             {
  1222.                                 $admin_edit_update = '<br /><a href="http://deltacommanders.com/forum/hier.php?edit_update=true&status='.$view_update_status.'&id='.$show_update_id.'&user='.$user_check.'" title="Edit this update"><img src="http://docs.gimp.org/en/images/dialogs/stock-edit-16.png" style="float: right; padding-right: 15px;"></a>';
  1223.                             }
  1224.                            
  1225.                         $template .= '<tr>
  1226.                                         <td align="center" valign="top" style="border-bottom-style:solid; border-bottom-width:1px; padding-bottom: 25px">'.$view_update_created_date.'<br /><b>'.$view_update_created_time.'</b></td>
  1227.                                         <td align="center" valign="top" style="border-bottom-style:solid; border-bottom-width:1px; padding-bottom: 25px"><span class="status '.$view_update_status.'" style="text-align: center;"></span></td>
  1228.                                         <td valign="top" style="border-bottom-style:solid; border-bottom-width:1px; padding-bottom: 30px"><div class="description">'.$show_update_sum.' '.$admin_edit_update.' '.$is_edited.'</div></td>
  1229.                                     </tr>';
  1230.                         }
  1231.                     }
  1232.                     else
  1233.                     {
  1234.                         $template .= '<tr>
  1235.                                         <td align="center" valign="top" style="border-bottom-style:solid; border-bottom-width:1px; padding-bottom: 25px" colspan="3"><b>--> There is no information to be displayed. <--</b></td>
  1236.                                     </tr>';
  1237.                     }
  1238.                    
  1239.                 $template .= '</tbody></table>'.$admin_end_user_update;
  1240.     }
  1241. }
  1242. elseif(isset($_GET['submit_notification'], $_GET['user']) && (($mybb->user['usergroup'] == 8) || ($mybb->user['usergroup'] == 4)))
  1243. {
  1244.     if(($_GET['submit_notification'] == "true") && ($_GET['user'] == $user_check))
  1245.     {
  1246.         $template = '
  1247.             <html>
  1248.                 <head>
  1249.                     <title>'.$title.'</title>
  1250.                     {$headerinclude}
  1251.                     <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  1252.                     <script type="text/javascript" src="http://www.deltacommanders.com/forum/jscripts/statuscenter.js"></script>
  1253.                 </head>
  1254.                 <body>
  1255.                     {$header}';
  1256.        
  1257.         $template .= '
  1258.                     <br />
  1259.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  1260.                         <thead>
  1261.                             <tr>
  1262.                                 <td class="thead" colspan="3">
  1263.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['submit_notification'].'.gif" id="submit_notification_img" class="expander" alt="[-]" title="[-]" /></div>
  1264.                                 <strong><center>Delta Commanders - Status Center</center></strong>
  1265.                                 </td>
  1266.                             </tr>
  1267.                         </thead>
  1268.                         <tbody style="'.$collapsed['submit_notification'].'" id="submit_notification_e">
  1269.                         <tr>
  1270.                             <td class="row1" width="10%" rowspan="5"><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back"><img src="http://www.deltacommanders.com/forum/images/back.png" align="left">Back to overview</a></td>
  1271.                             <td class="row1" width="80%" valign="top" rowspan="5"><span class="smalltext">Submit new notification to global. <b>Everything entered here will be visible to everyone, so watch out what you post here!</b><br /><br />This is mainly used for updates and other important notifications.</span></td>
  1272.                         </tr>
  1273.                         <tr>
  1274.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  1275.                         </tr>
  1276.                         <tr>
  1277.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  1278.                         </tr>
  1279.                         <tr>
  1280.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  1281.                         </tr>
  1282.                         <tr>
  1283.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  1284.                         </tr>
  1285.                         </tbody>
  1286.                     </table>
  1287.                     <br />
  1288.                     <br />';
  1289.                
  1290.         $template .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="submit_notification" onsubmit="return validateForm(this);">
  1291.                         <table border="0" cellspacing="1" cellpadding="3" align="center" width="50%">
  1292.                             <thead>
  1293.                                 <tr>
  1294.                                     <td class="thead" colspan="6">
  1295.                                     <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['submit_new_notification_e'].'.gif" id="submit_new_notification_img" class="expander" alt="[-]" title="[-]" /></div>
  1296.                                     <strong><center>Status Center - Submit a new notification/update</center></strong>
  1297.                                     </td>
  1298.                                 </tr>
  1299.                             </thead>
  1300.                             <tbody style="'.$collapsed['submit_new_notification'].'" id="submit_new_notification_e">
  1301.                                 <tr align="center">
  1302.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Notification Title:</strong></span></td>
  1303.                                     <td class="trow1"><input type="text" name="item_title" /></td>
  1304.                                 </tr>
  1305.                                 <tr align="center">
  1306.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Notification Summary:</strong></span></td>
  1307.                                     <td class="trow2"><textarea name="item_summary" rows="4" cols="40"/></textarea></td>
  1308.                                 </tr>
  1309.                                 <tr align="center">
  1310.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Notification Status:</strong></span></td>
  1311.                                     <td class="trow1"><select id="item_status" name="item_status"><option value="0" selected="selected">Choose</option><option value="1">Outage</option><option value="2">Disruption</option><option value="3" disabled="disabled">Resolved</option><option value="4">Update</option></td>
  1312.                                 </tr>
  1313.                                 <tr align="center">
  1314.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Notification Prefix:</strong></span></td>
  1315.                                     <td class="trow2"><select id="item_prefix" name="item_prefix"><option value="0" selected="selected">Choose</option><option value="1">[Forum]</option><option value="2">[Website]</option><option value="3">[Gameserver]</option><option value="4">[Voiceserver]</option><option value="5">[Update]</option><option value="6">[Release]</option></td>
  1316.                                 </tr>
  1317.                                 <tr align="center">
  1318.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Current Time:</strong></span></td>
  1319.                                     <td class="trow1"><span id="curTime"></span></td>
  1320.                                 </tr>
  1321.                                 <tr align="center">
  1322.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Submit by:</strong></span></td>
  1323.                                     <td class="trow2">'.$user['username'].' - (uid: '.$user['uid'].')</td>
  1324.                                 </tr>
  1325.                                 <tr align="center">
  1326.                                     <td class="trow2" colspan="2"><input type="submit" name="submit_notif" value="Submit"></td>
  1327.                                 </tr>
  1328.                             </tbody>
  1329.                         </table>
  1330.                         </form>';
  1331.  
  1332.     }
  1333. }
  1334. elseif(isset($_GET['submit_update'], $_GET['status'], $_GET['id'], $_GET['user']))
  1335. {
  1336.     if(($_GET['submit_update'] == "true") && ($_GET['user'] == $user_check))
  1337.     {
  1338.         $template = '
  1339.             <html>
  1340.                 <head>
  1341.                     <title>'.$title.'</title>
  1342.                     {$headerinclude}
  1343.                     <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  1344.                     <script type="text/javascript" src="http://www.deltacommanders.com/forum/jscripts/statuscenter.js"></script>
  1345.                 </head>
  1346.                 <body>
  1347.                     {$header}';
  1348.    
  1349.         $template .= '
  1350.                     <br />
  1351.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  1352.                         <thead>
  1353.                             <tr>
  1354.                                 <td class="thead" colspan="3">
  1355.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['status_info'].'.gif" id="status_info_img" class="expander" alt="[-]" title="[-]" /></div>
  1356.                                 <strong><center>Delta Commanders - Status Center</center></strong>
  1357.                                 </td>
  1358.                             </tr>
  1359.                         </thead>
  1360.                         <tbody style="'.$collapsed['status_info'].'" id="status_info_e">
  1361.                         <tr>
  1362.                             <td class="row1" width="10%" rowspan="5"><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back"><img src="http://www.deltacommanders.com/forum/images/back.png" align="left">Back to overview</a></td>
  1363.                             <td class="row1" width="80%" valign="top" rowspan="5"><span class="smalltext">On this page you see the additional information & updates about this issue. If the status of the issue is changed, whithout us knowing so, you can report the new status to <a href="mailto:admin@deltacommanders.com">admin@deltacommanders.com</a><br /><br />We try to keep this update as accurate as possible so you\'re able to use this center as main location for problems.<br />Thanks in advance!</span></td>
  1364.                         </tr>
  1365.                         <tr>
  1366.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  1367.                         </tr>
  1368.                         <tr>
  1369.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  1370.                         </tr>
  1371.                         <tr>
  1372.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  1373.                         </tr>
  1374.                         <tr>
  1375.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  1376.                         </tr>
  1377.                         </tbody>
  1378.                     </table>
  1379.                     <br />
  1380.                     <br />';
  1381.            
  1382.             $get_parent_id = $_GET['id'];
  1383.             $get_parent_name = $db->query("SELECT `item_summary`, `item_prefix` FROM `".TABLE_PREFIX."statuscenter_items` WHERE `id` = '$get_parent_id'");
  1384.             $nid = $get_parent_name->fetch_assoc();
  1385.                
  1386.             $parent_name = $nid['item_summary'];
  1387.             $parent_prefix_raw = $nid['item_prefix'];
  1388.            
  1389.             if($parent_prefix_raw == 1)
  1390.             {
  1391.                 $parent_prefix = "[Forum]";
  1392.             }
  1393.             elseif($parent_prefix_raw == 2)
  1394.             {
  1395.                 $parent_prefix = "[Website]";
  1396.             }
  1397.             elseif($parent_prefix_raw == 3)
  1398.             {
  1399.                 $parent_prefix = "[Gameserver]";
  1400.             }
  1401.             elseif($parent_prefix_raw == 4)
  1402.             {
  1403.                 $parent_prefix = "[Voiceserver]";
  1404.             }
  1405.             elseif($parent_prefix_raw == 5)
  1406.             {
  1407.                 $parent_prefix = "[Update]";
  1408.             }
  1409.             elseif($parent_prefix_raw == 6)
  1410.             {
  1411.                 $parent_prefix = "[Release]";
  1412.             }
  1413.             else
  1414.             {
  1415.                 $parent_prefix = "";
  1416.             }
  1417.                    
  1418.         $template .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="submit_update" onsubmit="return CheckForm(this);">
  1419.                         <table border="0" cellspacing="1" cellpadding="3" align="center" width="50%">
  1420.                             <thead>
  1421.                                 <tr>
  1422.                                     <td class="thead" colspan="2">
  1423.                                     <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['submit_update_e'].'.gif" id="submit_update_img" class="expander" alt="[-]" title="[-]" /></div>
  1424.                                     <strong><center>Status Center - Submit an Update</center></strong>
  1425.                                     </td>
  1426.                                 </tr>
  1427.                                 <tr align="center">
  1428.                                     <td class="trow1" colspan="2">Update from Notification:<br /><b>'.$parent_prefix.' '.$parent_name.' <font size="1">(id: '.$_GET['id'].')</font></b></td>
  1429.                                 </tr>                                  
  1430.                             </thead>
  1431.                             <tbody style="'.$collapsed['submit_update'].'" id="submit_update_e">
  1432.                                 <tr align="center">
  1433.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Update Summary:</strong></span></td>
  1434.                                     <td class="trow2"><textarea name="update_summary" rows="4" cols="50"/></textarea></td>
  1435.                                 </tr>
  1436.                                 <tr align="center">
  1437.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Update Status:</strong></span></td>
  1438.                                     <td class="trow1"><select id="update_status" name="update_status"><option value="0" selected="selected">Choose</option><option value="1">Outage</option><option value="2">Disruption</option><option value="3">Resolved</option><option value="4">Update</option></td>
  1439.                                 </tr>
  1440.                                 <tr align="center">
  1441.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Current Time:</strong></span></td>
  1442.                                     <td class="trow2"><span id="curTime"></span></td>
  1443.                                 </tr>
  1444.                                 <tr align="center">
  1445.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Submit by:</strong></span></td>
  1446.                                     <td class="trow1">'.$user['username'].' - (uid: '.$user['uid'].')</td>
  1447.                                 </tr>
  1448.                                 <tr align="center">
  1449.                                     <input type="hidden" name="parent_id" value="'.$_GET['id'].'">
  1450.                                     <td class="trow1" colspan="2"><input type="submit" name="submit_update" value="Submit"></td>
  1451.                                 </tr>
  1452.                             </tbody>
  1453.                         </table>
  1454.                         </form>';
  1455.     }
  1456. }
  1457. // Check if user used signup for email
  1458. elseif(isset($_GET['email_subscription'], $_GET['action']))
  1459. {
  1460.     if($_GET['email_subscription'] == "true")
  1461.     {
  1462.         $get_signup_user_b = $db->query("SELECT email FROM `".TABLE_PREFIX."statuscenter_signup` WHERE `uid` = $user_check");
  1463.         $count_signup_user_b = $db->num_rows($get_signup_user_b);
  1464.        
  1465.         if (($count_signup_user == 0) && ($_GET['action'] == "subscribe"))
  1466.         {
  1467.             $get_email_from_main = $db->query("SELECT email FROM `".TABLE_PREFIX."users` WHERE `uid` = $user_check");
  1468.             $get_email = $get_email_from_main->fetch_assoc();
  1469.             $email = $get_email['email'];
  1470.             $user_check = $mybb->user['uid'];
  1471.             $db->insert_query('statuscenter_signup', array(
  1472.                 'uid'   => (int) $user_check,
  1473.                 'email' => $email
  1474.                 ));
  1475.            
  1476.             $page = 'hier.php';
  1477.             header('Location: '.$page, true, 303);
  1478.             exit;
  1479.         }
  1480.         elseif (($count_signup_user > 0) && ($_GET['action'] == "unsubscribe"))
  1481.         {
  1482.             $user_check = $mybb->user['uid'];
  1483.             $db->query("DELETE FROM `".TABLE_PREFIX."statuscenter_signup` WHERE `uid` = $user_check");
  1484.             $db->query("OPTIMIZE TABLE `".TABLE_PREFIX."statuscenter_signup`");
  1485.             $page = 'hier.php';
  1486.             header('Location: '.$page, true, 303);
  1487.             exit;
  1488.         }
  1489.     }
  1490. }
  1491. elseif(isset($_GET['show_subscribers']))
  1492. {
  1493.     if(($_GET['show_subscribers'] == "true") && (($mybb->user['usergroup'] == 8) || ($mybb->user['usergroup'] == 4)))
  1494.     {
  1495.         $template = '
  1496.             <html>
  1497.                 <head>
  1498.                     <title>'.$title.'</title>
  1499.                     {$headerinclude}
  1500.                     <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  1501.                 </head>
  1502.                 <body>
  1503.                     {$header}';
  1504.        
  1505.         $template .= '
  1506.                     <br />
  1507.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  1508.                         <thead>
  1509.                             <tr>
  1510.                                 <td class="thead" colspan="3">
  1511.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['subscribers'].'.gif" id="subscribers_img" class="expander" alt="[-]" title="[-]" /></div>
  1512.                                 <strong><center>Delta Commanders - Status Center</center></strong>
  1513.                                 </td>
  1514.                             </tr>
  1515.                         </thead>
  1516.                         <tbody style="'.$collapsed['subscribers'].'" id="subscribers_e">
  1517.                         <tr>
  1518.                             <td class="row1" width="10%" rowspan="5"><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back"><img src="http://www.deltacommanders.com/forum/images/back.png" align="left">Back to overview</a></td>
  1519.                             <td class="row1" width="80%" valign="top" rowspan="5"><span class="smalltext">Welcome to the subscribers section, Admin!<br />On this page you can see all users who have registered to the mail-update function.<br /><br />You can manually delete users from the list, if necessary.</span></td>
  1520.                         </tr>
  1521.                         <tr>
  1522.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  1523.                         </tr>
  1524.                         <tr>
  1525.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  1526.                         </tr>
  1527.                         <tr>
  1528.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  1529.                         </tr>
  1530.                         <tr>
  1531.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  1532.                         </tr>
  1533.                         </tbody>
  1534.                     </table>
  1535.                     <br />';
  1536.                    
  1537.         $template .= '
  1538.                         <br />
  1539.                         <table border="0" cellspacing="1" cellpadding="3" width="50%" align="center">
  1540.                             <thead>
  1541.                                 <tr>
  1542.                                     <td class="thead" colspan="3">
  1543.                                         <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['subscribers_list_e'].'.gif" id="subscribers_list_img" class="expander" alt="[-]" title="[-]" /></div>
  1544.                                         <strong><center>Users subscribed to the mail-updates function.</center></strong>
  1545.                                     </td>
  1546.                                 </tr>
  1547.                             </thead>
  1548.                             <tbody style="'.$collapsed['subscribers_list'].'" id="subscribers_list_e">
  1549.                             <tr align="center">
  1550.                                     <td class="tcat" width="48%"><span class="smalltext"><strong>Username</strong></span></td>
  1551.                                     <td class="tcat" width="48%"><span class="smalltext"><strong>Email</strong></span></td>
  1552.                                     <td class="tcat" width="4%"><span class="smalltext"><strong>#</strong></span></td>
  1553.                                 </tr>';
  1554.        
  1555.         $get_sub_data = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_signup` ORDER BY id DESC");
  1556.         $count_sub_data = $db->num_rows($get_sub_data);
  1557.         if($count_sub_data > 0)
  1558.         {
  1559.             $get_sub_data = $db->query("SELECT * FROM `".TABLE_PREFIX."statuscenter_signup` ORDER BY id DESC");
  1560.        
  1561.             while ($s_info = $db->fetch_array($get_sub_data))
  1562.             {
  1563.                 $s_id = intval($s_info['id']);
  1564.                 $sub_id = intval($s_info['uid']);
  1565.                     $sub_name = get_user($sub_id);
  1566.                     $sub_username = $sub_name['username'];
  1567.                 $sub_email = $s_info['email'];
  1568.                
  1569.                 if($mybb->user['usergroup'] == 8 || $mybb->user['usergroup'] == 4)
  1570.                 {
  1571.                     $add_admin_func = "";
  1572.                
  1573.                     if(isset($_GET['prune']))
  1574.                     {
  1575.    
  1576.                         $db->delete_query('statuscenter_signup', 'id='.$s_id) or die(mysql_error());
  1577.                    
  1578.                         $page = 'hier.php?show_subscribers=true';
  1579.                         header('Location: '.$page, true, 303);
  1580.                         exit;
  1581.                     }
  1582.                 }
  1583.                
  1584.                 $template .= '
  1585.                     <tr align="center">
  1586.                         <td class="trow1" width="48%"><a href="http://deltacommanders.com/forum/user-'.$sub_id.'.html" title="Visit \''.$sub_username.'\'s\' profile page">'.$sub_username.'</a></td>
  1587.                         <td class="trow2" width="48%">'.$sub_email.'</td>
  1588.                         <td class="trow1" width="4%"><a href="hier.php?show_subscribers=true&prune='.$s_id.'" title="Delete subscriber" onclick="return confirm(\'Are you sure you want to delete '.$sub_username.' from the subscriberslist? The user will NOT be notified about this action!\');"><img src="http://cdn2.iconfinder.com/data/icons/aspneticons_v1.0_Nov2006/trash_(delete)_16x16.gif" /></a></td>
  1589.                     </tr>';
  1590.             }
  1591.         }
  1592.         else
  1593.         {
  1594.             $template .= '
  1595.                         <tr align="center">
  1596.                             <td class="trow1" colspan="2">There is no information to be displayed.</td>
  1597.                         </tr>';
  1598.         }
  1599.         $template .= '
  1600.             </tbody>
  1601.         </table>
  1602.         <br />';
  1603.     }
  1604. }
  1605. elseif(isset($_GET['edit_update'], $_GET['status'], $_GET['id'], $_GET['user']))
  1606. {
  1607.     if(($_GET['edit_update'] == "true") && ($_GET['user'] == $user_check) && (($mybb->user['usergroup'] == 8) || ($mybb->user['usergroup'] == 4)))
  1608.     {
  1609.         $update_id = $_GET['id'];
  1610.         $get_update_data = $db->query("SELECT update_summary, update_status, update_date, update_parent FROM `".TABLE_PREFIX."statuscenter_updates` WHERE id = $update_id");
  1611.         $up_inf = $get_update_data->fetch_assoc();
  1612.             $update_parent = $up_inf['update_parent'];
  1613.             $update_summary = $up_inf['update_summary'];
  1614.             $update_status = $up_inf['update_status'];
  1615.             $update_date_raw = $up_inf['update_date'];
  1616.            
  1617.             $update_summary = str_replace("<br />","",$update_summary);
  1618.            
  1619.             $update_date = date('D, j M Y H:i:s O',$update_date_raw);
  1620.            
  1621.         $get_update_title = $db->query("SELECT item_summary, item_prefix FROM `".TABLE_PREFIX."statuscenter_items` WHERE id = $update_parent");
  1622.         $up_title = $get_update_title->fetch_assoc();
  1623.             $update_title = $up_title['item_summary'];
  1624.             $update_prefix = $up_title['item_prefix'];
  1625.        
  1626.         // Update status
  1627.         if($update_status == "1")
  1628.         {
  1629.             $status_0 = '<option value="0" disabled="disabled">Choose</option>';
  1630.             $status_1 = '<option value="1" selected="selected">Outage</option>';
  1631.             $status_2 = '<option value="2">Disruption</option>';
  1632.             $status_3 = '<option value="3">Resolved</option>';
  1633.             $status_4 = '<option value="4">Information</option>';
  1634.         }
  1635.         elseif($update_status == "2")
  1636.         {
  1637.             $status_0 = '<option value="0" disabled="disabled">Choose</option>';
  1638.             $status_1 = '<option value="1">Outage</option>';
  1639.             $status_2 = '<option value="2" selected="selected">Disruption</option>';
  1640.             $status_3 = '<option value="3">Resolved</option>';
  1641.             $status_4 = '<option value="4">Information</option>';
  1642.         }
  1643.         elseif($update_status == "3")
  1644.         {
  1645.             $status_0 = '<option value="0" disabled="disabled">Choose</option>';
  1646.             $status_1 = '<option value="1">Outage</option>';
  1647.             $status_2 = '<option value="2">Disruption</option>';
  1648.             $status_3 = '<option value="3" selected="selected">Resolved</option>';
  1649.             $status_4 = '<option value="4">Information</option>';
  1650.         }
  1651.         elseif($update_status == "4")
  1652.         {
  1653.             $status_0 = '<option value="0" disabled="disabled">Choose</option>';
  1654.             $status_1 = '<option value="1">Outage</option>';
  1655.             $status_2 = '<option value="2">Disruption</option>';
  1656.             $status_3 = '<option value="3">Resolved</option>';
  1657.             $status_4 = '<option value="4" selected="selected">Information</option>';
  1658.         }
  1659.         else
  1660.         {
  1661.             $status_0 = '<option value="0" disabled="disabled" selected="selected">Choose</option>';
  1662.             $status_1 = '<option value="1">Outage</option>';
  1663.             $status_2 = '<option value="2">Disruption</option>';
  1664.             $status_3 = '<option value="3">Resolved</option>';
  1665.             $status_4 = '<option value="4">Information</option>';
  1666.         }
  1667.        
  1668.         // Update prefixes
  1669.         if($update_prefix == "1")
  1670.         {
  1671.             $prefix_0 = '<option value="0" disabled="disabled">Choose</option>';
  1672.             $prefix_1 = '<option value="1" selected="selected">[Forum]</option>';
  1673.             $prefix_2 = '<option value="2">[Website]</option>';
  1674.             $prefix_3 = '<option value="3">[Gameserver]</option>';
  1675.             $prefix_4 = '<option value="4">[Voiceserver]</option>';
  1676.             $prefix_5 = '<option value="5">[Update]</option>';
  1677.             $prefix_6 = '<option value="6">[Release]</option>';
  1678.         }
  1679.         elseif($update_prefix == "2")
  1680.         {
  1681.             $prefix_0 = '<option value="0" disabled="disabled">Choose</option>';
  1682.             $prefix_1 = '<option value="1">[Forum]</option>';
  1683.             $prefix_2 = '<option value="2" selected="selected">[Website]</option>';
  1684.             $prefix_3 = '<option value="3">[Gameserver]</option>';
  1685.             $prefix_4 = '<option value="4">[Voiceserver]</option>';
  1686.             $prefix_5 = '<option value="5">[Update]</option>';
  1687.             $prefix_6 = '<option value="6">[Release]</option>';
  1688.         }
  1689.         elseif($update_prefix == "3")
  1690.         {
  1691.             $prefix_0 = '<option value="0" disabled="disabled">Choose</option>';
  1692.             $prefix_1 = '<option value="1">[Forum]</option>';
  1693.             $prefix_2 = '<option value="2">[Website]</option>';
  1694.             $prefix_3 = '<option value="3" selected="selected">[Gameserver]</option>';
  1695.             $prefix_4 = '<option value="4">[Voiceserver]</option>';
  1696.             $prefix_5 = '<option value="5">[Update]</option>';
  1697.             $prefix_6 = '<option value="6">[Release]</option>';
  1698.         }
  1699.         elseif($update_prefix == "4")
  1700.         {
  1701.             $prefix_0 = '<option value="0" disabled="disabled">Choose</option>';
  1702.             $prefix_1 = '<option value="1">[Forum]</option>';
  1703.             $prefix_2 = '<option value="2">[Website]</option>';
  1704.             $prefix_3 = '<option value="3">[Gameserver]</option>';
  1705.             $prefix_4 = '<option value="4" selected="selected">[Voiceserver]</option>';
  1706.             $prefix_5 = '<option value="5">[Update]</option>';
  1707.             $prefix_6 = '<option value="6">[Release]</option>';
  1708.         }
  1709.         elseif($update_prefix == "5")
  1710.         {
  1711.             $prefix_0 = '<option value="0" disabled="disabled">Choose</option>';
  1712.             $prefix_1 = '<option value="1">[Forum]</option>';
  1713.             $prefix_2 = '<option value="2">[Website]</option>';
  1714.             $prefix_3 = '<option value="3">[Gameserver]</option>';
  1715.             $prefix_4 = '<option value="4">[Voiceserver]</option>';
  1716.             $prefix_5 = '<option value="5" selected="selected">[Update]</option>';
  1717.             $prefix_6 = '<option value="6">[Release]</option>';
  1718.         }
  1719.         elseif($update_prefix == "6")
  1720.         {
  1721.             $prefix_0 = '<option value="0" disabled="disabled">Choose</option>';
  1722.             $prefix_1 = '<option value="1">[Forum]</option>';
  1723.             $prefix_2 = '<option value="2">[Website]</option>';
  1724.             $prefix_3 = '<option value="3">[Gameserver]</option>';
  1725.             $prefix_4 = '<option value="4">[Voiceserver]</option>';
  1726.             $prefix_5 = '<option value="5">[Update]</option>';
  1727.             $prefix_6 = '<option value="6" selected="selected">[Release]</option>';
  1728.         }
  1729.         else
  1730.         {
  1731.             $prefix_0 = '<option value="0" disabled="disabled" selected="selected">Choose</option>';
  1732.             $prefix_1 = '<option value="1">[Forum]</option>';
  1733.             $prefix_2 = '<option value="2">[Website]</option>';
  1734.             $prefix_3 = '<option value="3">[Gameserver]</option>';
  1735.             $prefix_4 = '<option value="4">[Voiceserver]</option>';
  1736.             $prefix_5 = '<option value="5">[Update]</option>';
  1737.             $prefix_6 = '<option value="6">[Release]</option>';
  1738.         }
  1739.        
  1740.         $template = '
  1741.             <html>
  1742.                 <head>
  1743.                     <title>'.$title.'</title>
  1744.                     {$headerinclude}
  1745.                     <link rel="stylesheet" type="text/css" href="http://www.deltacommanders.com/forum/css/status_center.css">
  1746.                     <script type="text/javascript" src="http://www.deltacommanders.com/forum/jscripts/statuscenter.js"></script>
  1747.                 </head>
  1748.                 <body>
  1749.                     {$header}';
  1750.        
  1751.         $template .= '
  1752.                     <br />
  1753.                     <table border="0" cellspacing="1" cellpadding="3" align="center" width="80%">
  1754.                         <thead>
  1755.                             <tr>
  1756.                                 <td class="thead" colspan="3">
  1757.                                 <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['edit_update'].'.gif" id="edit_update_img" class="expander" alt="[-]" title="[-]" /></div>
  1758.                                 <strong><center>Delta Commanders - Status Center</center></strong>
  1759.                                 </td>
  1760.                             </tr>
  1761.                         </thead>
  1762.                         <tbody style="'.$collapsed['edit_update'].'" id="edit_update_e">
  1763.                         <tr>
  1764.                             <td class="row1" width="10%" rowspan="5"><a href="http://www.deltacommanders.com/forum/hier.php" title="Go back"><img src="http://www.deltacommanders.com/forum/images/back.png" align="left">Back to overview</a></td>
  1765.                             <td class="row1" width="80%" valign="top" rowspan="5"><span class="smalltext">Submit new notification to global. <b>Everything entered here will be visible to everyone, so watch out what you post here!</b><br /><br />This is mainly used for updates and other important notifications.</span></td>
  1766.                         </tr>
  1767.                         <tr>
  1768.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Resolved"></span> Resolved</td>
  1769.                         </tr>
  1770.                         <tr>
  1771.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Disruption"></span> Disruption</td>
  1772.                         </tr>
  1773.                         <tr>
  1774.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Outage"></span> Outage</td>
  1775.                         </tr>
  1776.                         <tr>
  1777.                             <td class="row1" width="10%" style="padding: 0px;"><span class="status Information"></span> Information</td>
  1778.                         </tr>
  1779.                         </tbody>
  1780.                     </table>
  1781.                     <br />
  1782.                     <br />';
  1783.                
  1784.         $template .= '<form action="'.$_SERVER['PHP_SELF'].'" method="post" name="edit_update">
  1785.                         <table border="0" cellspacing="1" cellpadding="3" align="center" width="50%">
  1786.                             <thead>
  1787.                                 <tr>
  1788.                                     <td class="thead" colspan="6">
  1789.                                     <div class="expcolimage"><img src="'.$theme['imgdir'].'/collapse'.$collapsedimg['editted_update_e'].'.gif" id="editted_update_img" class="expander" alt="[-]" title="[-]" /></div>
  1790.                                     <strong><center>Status Center - Submit a new notification/update</center></strong>
  1791.                                     </td>
  1792.                                 </tr>
  1793.                             </thead>
  1794.                             <tbody style="'.$collapsed['editted_update'].'" id="editted_update_e">
  1795.                                 <tr align="center">
  1796.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Notification Info:</strong></span></td>
  1797.                                     <td class="trow1"><select id="item_prefix" name="item_prefix">'.$prefix_0.''.$prefix_1.''.$prefix_2.''.$prefix_3.''.$prefix_4.''.$prefix_5.''.$prefix_6.'</select>&nbsp;&nbsp;&nbsp;<input type="text" name="item_title" value="'.$update_title.'" style="width: 150px;" /></td>
  1798.                                 </tr>
  1799.                                 <tr align="center">
  1800.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Notification Summary:</strong></span></td>
  1801.                                     <td class="trow2"><textarea name="item_summary" rows="4" cols="40" />'.$update_summary.'</textarea></td>
  1802.                                 </tr>
  1803.                                 <tr align="center">
  1804.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Notification Status:</strong></span></td>
  1805.                                     <td class="trow1"><select id="item_status" name="item_status">'.$status_0.''.$status_1.''.$status_2.''.$status_3.''.$status_4.'</select></td>
  1806.                                 </tr>
  1807.                                 <tr align="center">
  1808.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Previous update time:</strong></span></td>
  1809.                                     <td class="trow2">'.$update_date.'</td>
  1810.                                 </tr>
  1811.                                 <tr align="center">
  1812.                                     <td class="trow1" align="center"><span class="smalltext"><strong>Current Time:</strong></span></td>
  1813.                                     <td class="trow1"><span id="curTime"></span></td>
  1814.                                 </tr>
  1815.                                 <tr align="center">
  1816.                                     <td class="trow2" align="center"><span class="smalltext"><strong>Submit by:</strong></span></td>
  1817.                                     <td class="trow2">'.$user['username'].' - (uid: '.$user['uid'].')</td>
  1818.                                 </tr>
  1819.                                 <tr align="center">
  1820.                                     <input type="hidden" name="updated_id" value="'.$_GET['id'].'">
  1821.                                     <td class="trow2" colspan="2"><input type="submit" name="submit_editted_update" value="Submit"></td>
  1822.                                 </tr>
  1823.                             </tbody>
  1824.                         </table>
  1825.                         </form>';
  1826.     }
  1827. }
  1828. // End :)
  1829.    
  1830. // Generate the page load time - footer settings settings
  1831. $time = microtime();
  1832. $time = explode(' ', $time);
  1833. $time = $time[1] + $time[0];
  1834. $finish = $time;
  1835. $total_time = round(($finish - $start), 5);
  1836.  
  1837. $template .= '<br /><center>Page generated in '.$total_time.' seconds.</center>
  1838.         {$footer}
  1839.     </body>
  1840. </html>';
  1841.  
  1842. // Last shizzle - convert template variables into php thing
  1843. $template=str_replace("\'", "'", addslashes($template));
  1844.  
  1845. add_breadcrumb($pages['name']);
  1846.  
  1847. eval("\$page=\"".$template."\";");
  1848.  
  1849. output_page($page);
  1850. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement