diff options
-rw-r--r-- | admin/purgecache.php | 5 | ||||
-rw-r--r-- | app/classes/Cache.php | 4 | ||||
-rw-r--r-- | app/classes/OpmlManager.php | 2 | ||||
-rw-r--r-- | app/helpers.php | 2 | ||||
-rwxr-xr-x | index.php | 4 | ||||
-rwxr-xr-x | install.php | 7 |
6 files changed, 15 insertions, 9 deletions
diff --git a/admin/purgecache.php b/admin/purgecache.php index 7b01c97..b020758 100644 --- a/admin/purgecache.php +++ b/admin/purgecache.php @@ -13,8 +13,9 @@ if (isset($_POST['purge'])) { continue; } - if (filemtime($dir . DIRECTORY_SEPARATOR . $filename) < time()) { - @unlink($dir . DIRECTORY_SEPARATOR . $filename); + $file = $dir . DIRECTORY_SEPARATOR . $filename; + if (is_file($file) && filemtime($file) < time()) { + unlink($file); } } } diff --git a/app/classes/Cache.php b/app/classes/Cache.php index f4b2dcf..c2e0c27 100644 --- a/app/classes/Cache.php +++ b/app/classes/Cache.php @@ -112,7 +112,9 @@ class Cache return true; } - @unlink($filename); + if (is_file($filename)) { + unlink($filename); + } return false; } diff --git a/app/classes/OpmlManager.php b/app/classes/OpmlManager.php index 66de7c9..fe1adda 100644 --- a/app/classes/OpmlManager.php +++ b/app/classes/OpmlManager.php @@ -37,7 +37,7 @@ class OpmlManager $out.= '</head>'."\n"; $out.= '<body>'."\n"; foreach ($opml->entries as $person) { - $out.= '<outline text="' . htmlspecialchars($person['name'], ENT_QUOTES) . '" htmlUrl="' . htmlspecialchars($person['website'], ENT_QUOTES) . '" xmlUrl="' . htmlspecialchars($person['feed'], ENT_QUOTES) . '" isDown="' . htmlspecialchars($person['isDown'], ENT_QUOTES) . '"/>'."\n"; + $out.= '<outline text="' . htmlspecialchars($person['name'], ENT_QUOTES) . '" htmlUrl="' . htmlspecialchars($person['website'], ENT_QUOTES) . '" xmlUrl="' . htmlspecialchars($person['feed'], ENT_QUOTES) . '" isDown="' . htmlspecialchars($person['isDown'] ?? '', ENT_QUOTES) . '"/>'."\n"; } $out.= '</body>'."\n"; $out.= '</opml>'; diff --git a/app/helpers.php b/app/helpers.php index 3bb0c1d..a7e68ae 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -71,7 +71,7 @@ function removeCustomFiles() ]; foreach ($toRemove as $path) { - if (file_exists($path)) { + if (is_file($path)) { unlink($path); } } @@ -19,7 +19,7 @@ if (0 < $Planet->loadOpml($PlanetConfig->getOpmlFile())) { Cache::$enabled = false; $cache_key = (count($items)) ? $items[0]->get_id() : ''; $last_modified = (count($items)) ? $items[0]->get_date() : ''; -$cache_duration = $PlanetConfig->getOutputTimeout()*60; +$cache_duration = $PlanetConfig->getOutputTimeout() * 60; Cache::setStore($PlanetConfig->getCacheDir()); @@ -36,7 +36,7 @@ if (isset($_GET['type']) && $_GET['type'] == 'atom10') { //Go display if (!isset($_GET['type']) || !is_file(__DIR__.'/custom/views/'.$_GET['type'].'/index.tpl.php') || - strpos($_GET['type'], DIRECTORY_SEPARATOR) || strpos($GET['type'], '..')) { + strpos($_GET['type'], DIRECTORY_SEPARATOR) || strpos($_GET['type'], '..')) { $_GET['type'] = 'default'; } diff --git a/install.php b/install.php index 4294beb..75166a3 100755 --- a/install.php +++ b/install.php @@ -78,9 +78,12 @@ if ($PlanetConfig::isInstalled()) { // We now test that all required files and directories are writable. foreach ($tests as $v) { - if (touch(__DIR__ . $v)) { + $filename = __DIR__ . $v; + if (touch($filename)) { $strInstall .= installStatus("<code>$v</code> is writable", 'OK', true); - unlink(__DIR__.$v); + if (is_file($filename)) { + unlink($filename); + } } else { $strInstall .= installStatus("<code>$v</code> is writable", 'FAIL', false); $strRecommendation .= "<li>Make <code>$v</code> writable with CHMOD</li>"; |