Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../lib
File: wfLog.php
}
[2000] Fix | Delete
[2001] Fix | Delete
/**
[2002] Fix | Delete
* @return mixed
[2003] Fix | Delete
*/
[2004] Fix | Delete
public function getParam() {
[2005] Fix | Delete
return $this->param;
[2006] Fix | Delete
}
[2007] Fix | Delete
[2008] Fix | Delete
/**
[2009] Fix | Delete
* @param mixed $param
[2010] Fix | Delete
*/
[2011] Fix | Delete
public function setParam($param) {
[2012] Fix | Delete
$this->param = $param;
[2013] Fix | Delete
}
[2014] Fix | Delete
[2015] Fix | Delete
}
[2016] Fix | Delete
[2017] Fix | Delete
[2018] Fix | Delete
class wfLiveTrafficQueryException extends Exception {
[2019] Fix | Delete
[2020] Fix | Delete
}
[2021] Fix | Delete
[2022] Fix | Delete
class wfErrorLogHandler {
[2023] Fix | Delete
public static function getErrorLogs($deepSearch = false) {
[2024] Fix | Delete
static $errorLogs = null;
[2025] Fix | Delete
[2026] Fix | Delete
if ($errorLogs === null) {
[2027] Fix | Delete
$searchPaths = array(ABSPATH, ABSPATH . 'wp-admin', ABSPATH . 'wp-content');
[2028] Fix | Delete
[2029] Fix | Delete
$homePath = wfUtils::getHomePath();
[2030] Fix | Delete
if (!in_array($homePath, $searchPaths)) {
[2031] Fix | Delete
$searchPaths[] = $homePath;
[2032] Fix | Delete
}
[2033] Fix | Delete
[2034] Fix | Delete
$errorLogPath = ini_get('error_log');
[2035] Fix | Delete
if (!empty($errorLogPath) && !in_array($errorLogPath, $searchPaths)) {
[2036] Fix | Delete
$searchPaths[] = $errorLogPath;
[2037] Fix | Delete
}
[2038] Fix | Delete
[2039] Fix | Delete
$errorLogs = array();
[2040] Fix | Delete
foreach ($searchPaths as $s) {
[2041] Fix | Delete
$errorLogs = array_merge($errorLogs, self::_scanForLogs($s, $deepSearch));
[2042] Fix | Delete
}
[2043] Fix | Delete
}
[2044] Fix | Delete
return $errorLogs;
[2045] Fix | Delete
}
[2046] Fix | Delete
[2047] Fix | Delete
private static function _scanForLogs($path, $deepSearch = false) {
[2048] Fix | Delete
static $processedFolders = array(); //Protection for endless loops caused by symlinks
[2049] Fix | Delete
if (is_file($path)) {
[2050] Fix | Delete
$file = basename($path);
[2051] Fix | Delete
if (preg_match('#(?:^php_errorlog$|error_log(\-\d+)?$|\.log$)#i', $file)) {
[2052] Fix | Delete
return array($path => is_readable($path));
[2053] Fix | Delete
}
[2054] Fix | Delete
return array();
[2055] Fix | Delete
}
[2056] Fix | Delete
[2057] Fix | Delete
$path = untrailingslashit($path);
[2058] Fix | Delete
$contents = @scandir($path);
[2059] Fix | Delete
if (!is_array($contents)) {
[2060] Fix | Delete
return array();
[2061] Fix | Delete
}
[2062] Fix | Delete
[2063] Fix | Delete
$processedFolders[$path] = true;
[2064] Fix | Delete
$errorLogs = array();
[2065] Fix | Delete
foreach ($contents as $name) {
[2066] Fix | Delete
if ($name == '.' || $name == '..') { continue; }
[2067] Fix | Delete
$testPath = $path . DIRECTORY_SEPARATOR . $name;
[2068] Fix | Delete
if (!array_key_exists($testPath, $processedFolders)) {
[2069] Fix | Delete
if ((is_dir($testPath) && $deepSearch) || !is_dir($testPath)) {
[2070] Fix | Delete
$errorLogs = array_merge($errorLogs, self::_scanForLogs($testPath, $deepSearch));
[2071] Fix | Delete
}
[2072] Fix | Delete
}
[2073] Fix | Delete
}
[2074] Fix | Delete
return $errorLogs;
[2075] Fix | Delete
}
[2076] Fix | Delete
[2077] Fix | Delete
public static function outputErrorLog($path) {
[2078] Fix | Delete
$errorLogs = self::getErrorLogs();
[2079] Fix | Delete
if (!isset($errorLogs[$path])) { //Only allow error logs we've identified
[2080] Fix | Delete
global $wp_query;
[2081] Fix | Delete
$wp_query->set_404();
[2082] Fix | Delete
status_header(404);
[2083] Fix | Delete
nocache_headers();
[2084] Fix | Delete
[2085] Fix | Delete
$template = get_404_template();
[2086] Fix | Delete
if ($template && file_exists($template)) {
[2087] Fix | Delete
include($template);
[2088] Fix | Delete
}
[2089] Fix | Delete
exit;
[2090] Fix | Delete
}
[2091] Fix | Delete
[2092] Fix | Delete
$fh = @fopen($path, 'r');
[2093] Fix | Delete
if (!$fh) {
[2094] Fix | Delete
status_header(503);
[2095] Fix | Delete
nocache_headers();
[2096] Fix | Delete
echo "503 Service Unavailable";
[2097] Fix | Delete
exit;
[2098] Fix | Delete
}
[2099] Fix | Delete
[2100] Fix | Delete
$headersOutputted = false;
[2101] Fix | Delete
while (!feof($fh)) {
[2102] Fix | Delete
$data = fread($fh, 1 * 1024 * 1024); //read 1 megs max per chunk
[2103] Fix | Delete
if ($data === false) { //Handle the error where the file was reported readable but we can't actually read it
[2104] Fix | Delete
status_header(503);
[2105] Fix | Delete
nocache_headers();
[2106] Fix | Delete
echo "503 Service Unavailable";
[2107] Fix | Delete
exit;
[2108] Fix | Delete
}
[2109] Fix | Delete
[2110] Fix | Delete
if (!$headersOutputted) {
[2111] Fix | Delete
header('Content-Type: text/plain');
[2112] Fix | Delete
header('Content-Disposition: attachment; filename="' . basename($path));
[2113] Fix | Delete
$headersOutputted = true;
[2114] Fix | Delete
}
[2115] Fix | Delete
echo $data;
[2116] Fix | Delete
}
[2117] Fix | Delete
exit;
[2118] Fix | Delete
}
[2119] Fix | Delete
}
[2120] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function