function spdebug_stats() { global $wpdb, $spdebug_stats, $spdebug_queries; if (defined('SP_DEVFLAG') && SP_DEVFLAG == true && isset($spdebug_stats)) { $out = "\n\n<div class='spdebug'>\n"; $out .= "\t<table>\n"; if (isset($spdebug_stats['total_time'])) { $out .= "\t\t<tr>\n"; $out .= "\t\t\t<td>Target section</td>\n"; $out .= "\t\t\t<td>" . $spdebug_stats['total_query'] . " queries</td>\n"; $out .= "\t\t\t<td>" . number_format($spdebug_stats['total_time'], 3) . " seconds</td>\n"; $out .= "\t\t</tr>\n"; } $out .= "\t\t<tr>\n"; $out .= "\t\t\t<td>Total page</td>\n"; $out .= "\t\t\t<td>" . (get_num_queries() - $spdebug_queries) . " queries</td>\n"; $out .= "\t\t\t<td>" . timer_stop(0) . " seconds</td>\n"; $out .= "\t\t</tr>\n"; $out .= "\t</table>\n"; $out .= "</div>\n\n"; echo $out; show_log(); show_control(); } }
function admin_activity_log($user, $path) { global $conf_stats_path; $svn_ignore = array(".c9", ".svn", ".tmux", ".user", ".svn.fifo", ".inotify_pid", ".nakignore", "global_events", "last_update_rev", ".gcc.out"); // Učitaj stats file unset($stats); $user_efn = escape_filename($user); // Make username safe for filename $stat_path = $conf_stats_path . "/{$user_efn}.stats"; if (file_exists($stat_path)) { eval(file_get_contents($stat_path)); } if (!isset($stats)) { ?> <p>Activity log file doesn't exist or isn't valid... it's possible that stats were never generated for this user.</p> <?php return; } // Stats file can reference other files to be included foreach ($stats as $key => $value) { if (is_array($value) && array_key_exists("goto", $value)) { $goto_path = $conf_stats_path . "/" . $value['goto']; eval(file_get_contents($goto_path)); foreach ($stats_goto as $ks => $vs) { $stats[$ks] = $vs; } $stats_goto = null; } } // Show stats for complete tree below current path $log = merge_down($stats, $path); $counter = show_log($log); if ($counter == 0) { ?> <p>There is no recorded activity in path <b><?php echo $path; ?> </b>.<br>User probably created this path after the last statistics update. You can update the stats manually. If the problem persists after update, please contact your administrator.</p> <?php } }
$db = new PDO('sqlite:' . $log); if (!is_object($db)) { // Failure, can't access Phergie Log. // Bail with an error message, not pretty, but works: echo "ERROR: Cannot access Phergie Log File, " . "please check the configuration & access privileges"; exit; } /********** DETECTION **********/ // Determine the mode of the application and call the appropriate handler function $mode = empty($_GET['m']) ? '' : $_GET['m']; switch ($mode) { case 'channel': show_days($db); break; case 'day': show_log($db); break; default: show_channels($db); } // Exit not really needed here, // but reminds us that everything below is support functions: exit; /********** MODES **********/ /** * show_channels * * Provide a list of all channel's that we are logging information for: * * @param PDO $db A PDO object referring to the database *
function do_ticket($theRow, $theWidth, $search = FALSE, $dist = TRUE) { // returns table - 6/26/10 global $iw_width, $nature, $disposition, $patient, $incident, $incidents; // 12/3/10 $tickno = get_variable('serial_no_ap') == 0 ? " <I>(#" . $theRow['id'] . ")</I>" : ""; // 1/25/09 switch ($theRow['severity']) { //color tickets by severity case $GLOBALS['SEVERITY_MEDIUM']: $severityclass = 'severity_medium'; break; case $GLOBALS['SEVERITY_HIGH']: $severityclass = 'severity_high'; break; default: $severityclass = 'severity_normal'; break; } $print = "<TABLE BORDER='0' ID='left' width='" . $theWidth . "'>\n"; // $print .= "<TR CLASS='even'><TD ALIGN='left' CLASS='td_data' COLSPAN=2 ALIGN='center'><B>{$incident}: <I>" . highlight($search, $theRow['scope']) . "</B>" . $tickno . "</TD></TR>\n"; $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Addr") . ":</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['tick_street']) . "</TD></TR>\n"; $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("City") . ":</TD>\t\t\t<TD ALIGN='left'>" . highlight($search, $theRow['tick_city']); $print .= " " . highlight($search, $theRow['tick_state']) . "</TD></TR>\n"; $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Priority") . ":</TD> <TD ALIGN='left' CLASS='" . $severityclass . "'>" . get_severity($theRow['severity']); $print .= " {$nature}: " . get_type($theRow['in_types_id']); $print .= "</TD></TR>\n"; $print .= "<TR CLASS='even' VALIGN='top'><TD ALIGN='left'>" . get_text("Synopsis") . ":</TD>\t<TD ALIGN='left'>" . replace_quotes(highlight($search, nl2br($theRow['tick_descr']))) . "</TD></TR>\n"; // 8/12/09 $print .= "<TR CLASS='odd' ><TD ALIGN='left'>" . get_text("Protocol") . ":</TD> <TD ALIGN='left' CLASS='{$severityclass}'>{$theRow['protocol']}</TD></TR>\n"; // 7/16/09 $print .= "<TR CLASS='even' VALIGN='top'><TD ALIGN='left'>" . get_text("911 Contacted") . ":</TD>\t<TD ALIGN='left'>" . highlight($search, nl2br($theRow['nine_one_one'])) . "</TD></TR>\n"; // 6/26/10 $print .= "<TR CLASS='odd'><TD ALIGN='left'>" . get_text("Reported by") . ":</TD>\t<TD ALIGN='left'>" . highlight($search, $theRow['contact']) . "</TD></TR>\n"; $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("Phone") . ":</TD>\t\t\t<TD ALIGN='left'>" . format_phone($theRow['phone']) . "</TD></TR>\n"; $end_date = intval($theRow['problemend']) > 1 ? $theRow['problemend'] : time() - intval(get_variable('delta_mins')) * 60; $elapsed = my_date_diff($theRow['problemstart'], $end_date); $elaped_str = intval($theRow['problemend']) > 1 ? "" : " ({$elapsed})"; $print .= "<TR CLASS='odd'><TD ALIGN='left'>" . get_text("Status") . ":</TD>\t\t<TD ALIGN='left'>" . get_status($theRow['status']) . "{$elaped_str}</TD></TR>\n"; $by_str = $theRow['call_taker'] == 0 ? "" : " by " . get_owner($theRow['call_taker']) . " "; // 1/7/10 $print .= "<TR CLASS='even'><TD ALIGN='left'>" . get_text("Written") . ":</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['date']) . $by_str; $print .= " Updated: " . format_date($theRow['updated']) . "</TD></TR>\n"; $print .= empty($theRow['booked_date']) ? "" : "<TR CLASS='odd'><TD ALIGN='left'>Scheduled date:</TD>\t\t<TD ALIGN='left'>" . format_date($theRow['booked_date']) . "</TD></TR>\n"; // 10/6/09 $print .= "<TR CLASS='even' ><TD ALIGN='left' COLSPAN='2'> \t<TD ALIGN='left'></TR>\n"; // separator $print .= empty($theRow['fac_name']) ? "" : "<TR CLASS='odd' ><TD ALIGN='left'>{$incident} at Facility:</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['fac_name']) . "</TD></TR>\n"; // 8/1/09 $print .= empty($theRow['rec_fac_name']) ? "" : "<TR CLASS='even' ><TD ALIGN='left'>Receiving Facility:</TD>\t\t<TD ALIGN='left'>" . highlight($search, $theRow['rec_fac_name']) . "</TD></TR>\n"; // 10/6/09 $print .= empty($theRow['comments']) ? "" : "<TR CLASS='odd' VALIGN='top'><TD ALIGN='left'>{$disposition}:</TD>\t<TD ALIGN='left'>" . replace_quotes(highlight($search, nl2br($theRow['comments']))) . "</TD></TR>\n"; $print .= "<TR CLASS='even' ><TD ALIGN='left'>" . get_text("Run Start") . ":</TD>\t\t\t\t\t<TD ALIGN='left'>" . format_date($theRow['problemstart']); $elaped_str = intval($theRow['problemend']) > 1 ? $elapsed : ""; $print .= " End: " . format_date($theRow['problemend']) . " ({$elaped_str})</TD></TR>\n"; $locale = get_variable('locale'); // 08/03/09 switch ($locale) { case "0": $grid_type = " USNG " . LLtoUSNG($theRow['lat'], $theRow['lng']); break; case "1": $grid_type = " OSGB " . LLtoOSGB($theRow['lat'], $theRow['lng']); // 8/23/08, 10/15/08, 8/3/09 break; case "2": $coords = $theRow['lat'] . "," . $theRow['lng']; // 8/12/09 $grid_type = " UTM " . toUTM($coords); // 8/23/08, 10/15/08, 8/3/09 break; default: print "ERROR in " . basename(__FILE__) . " " . __LINE__ . "<BR />"; } $print .= "<TR CLASS='odd'><TD ALIGN='left' onClick = 'javascript: do_coords(" . $theRow['lat'] . "," . $theRow['lng'] . ")'><U>" . get_text("Position") . "</U>: </TD>\n\t\t<TD ALIGN='left'>" . get_lat($theRow['lat']) . " " . get_lng($theRow['lng']) . $grid_type . "</TD></TR>\n"; // 9/13/08 $print .= "<TR><TD colspan=2 ALIGN='left'>"; $print .= show_log($theRow[0]); // log $print .= "</TD></TR>"; $print .= "<TR STYLE = 'display:none;'><TD colspan=2><SPAN ID='oldlat'>" . $theRow['lat'] . "</SPAN><SPAN ID='oldlng'>" . $theRow['lng'] . "</SPAN></TD></TR>"; $print .= "</TABLE>\n"; $print .= show_assigns(0, $theRow[0]); // 'id' ambiguity - 7/27/09 $print .= show_actions($theRow[0], "date", FALSE, FALSE); return $print; }
} $db = new PDO($dsn, $user, $pass); if (!is_object($db)) { // Failure, can't access Phergie Log. exit("ERROR: Cannot access log, please check the configuration & access privileges"); } $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); /********** DETECTION **********/ // Determine the mode of the application and call the appropriate handler function $mode = empty($_GET['m']) ? '' : $_GET['m']; switch ($mode) { case 'channel': show_days($db, $table); break; case 'day': show_log($db, $table); break; default: show_channels($db, $table); } // Exit not really needed here, // but reminds us that everything below is support functions: exit; /********** MODES **********/ /** * show_channels * * Provide a list of all channel's that we are logging information for: * * @param PDO $db A PDO object referring to the database * @param string $table The name of the logging table