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 } }
function merge_down($file_array) { $return_array = array(); foreach ($file_array as $file_name) { if (is_array($file_name)) { $return_array = array_merge($return_array, merge_down($file_name)); } else { $return_array[] = $file_name; } } return $return_array; }