$b['mtime']) ? -1 : 1;
}
function getLogFiles() {
$logFiles = array();
foreach(array(DIR_FS_LOGS, DIR_FS_SQL_CACHE, DIR_FS_CATALOG . '/includes/modules/payment/paypal/logs') as $logFolder) {
$logFolder = rtrim($logFolder, '/'); /*v1.0.1c-lat9*/
$dir = @dir($logFolder); /*v1.0.1c-lat9*/
if ($dir != NULL) { /*v1.0.1a-lat9*/
while ($file = $dir->read()) {
if ( ($file != '.') && ($file != '..') && substr($file, 0, 1) != '.') {
if (preg_match('/^(myDEBUG-|AIM_Debug_|SIM_Debug_|FirstData_Debug_|Linkpoint_Debug_|Paypal|paypal|ipn_|zcInstall|notifier|usps|SHIP_usps).*\.log$/', $file)) { /*v1.0.5c-lat9*/
$hash = sha1 ($logFolder . '/' . $file);
$logFiles[$hash] = array ( 'name' => $logFolder . '/' . $file,
'mtime' => filemtime($logFolder . '/' . $file),
'filesize' => filesize($logFolder . '/' . $file) /*v1.0.2-design75*/
);
}
}
}
$dir->close(); /*v1.0.3m-lat9*/
unset($dir); /*v1.0.3m-lat9*/
} /*v1.0.1a-lat9*/
}
uasort($logFiles, (isset($_GET) && isset($_GET['sort']) && $_GET['sort'] == 'a') ? 'sortLogA' : 'sortLogD');
reset($logFiles);
return $logFiles;
}
// -----
// Start main processing ...
//
require('includes/application_top.php');
$logFiles = getLogFiles();
// -----
// If any file delete requests have been made, process them first.
//
$action = (isset($_GET['action'])) ? $_GET['action'] : '';
if (zen_not_null($action) && $action == 'delete') {
if (isset($_POST) && isset($_POST['dList']) && sizeof($_POST['dList']) != 0) {
$numFiles = sizeof($_POST['dList']);
$filesDeleted = 0;
foreach ($_POST['dList'] as $currentHash => $value) {
if (array_key_exists($currentHash, $logFiles)) {
if (is_writeable($logFiles[$currentHash]['name'])) {
zen_remove($logFiles[$currentHash]['name']);
$filesDeleted++;
}
}
}
if ($filesDeleted == $numFiles) {
$messageStack->add_session(sprintf(SUCCESS_FILES_DELETED, $numFiles), 'success'); //-v1.0.4c
} else {
$messageStack->add_session(sprintf(WARNING_SOME_FILES_DELETED, $filesDeleted, $numFiles), 'warning'); //-v1.0.4c
}
} else {
$messageStack->add_session(WARNING_NO_FILES_SELECTED, 'warning'); //-v1.0.4c
}
zen_redirect(zen_href_link(FILENAME_DISPLAY_LOGS)); //-v1.0.4c
}
if (isset($_GET) && isset($_GET['fID'])){
if (array_key_exists($_GET['fID'], $logFiles)) {
$getFile = $_GET['fID'];
} else {
unset($_GET['fID']);
$getFile = key($logFiles);
}
} elseif (sizeof($logFiles) != 0) {
$getFile = key($logFiles);
} else {
$getFile = '';
}
$numLogFiles = sizeof($logFiles);
//-bof-v1.0.3a-lat9
// -----
// If more files are in the log-file array than will be displayed, free up the memory associated with
// those files' entries by popping them off the end of the array.
//
if ($numLogFiles > MAX_LOG_FILES_TO_VIEW) {
for ($i = 0, $n = $numLogFiles - MAX_LOG_FILES_TO_VIEW; $i < $n; $i++) {
array_pop($logFiles);
}
}
//-eof-v1.0.3a-lat9
?>
>
|
|
MAX_LOG_FILES_TO_VIEW) ? MAX_LOG_FILES_TO_VIEW : $numLogFiles), $numLogFiles); //-v1.0.6c ?> |
|
|
|
|