summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authornashe <contact@nashe.fr>2015-08-11 12:04:53 +0200
committernashe <contact@nashe.fr>2015-08-11 12:04:53 +0200
commitb84b865d45b00600d982fef18991398cb655c7e9 (patch)
tree5f3d0432facd74395d029c480bb79d9e0669eb01 /admin
parentf2788a4ed2eae7f0056ab200b8fc787ed20a32da (diff)
downloadplanet-b84b865d45b00600d982fef18991398cb655c7e9.tar
planet-b84b865d45b00600d982fef18991398cb655c7e9.tar.gz
planet-b84b865d45b00600d982fef18991398cb655c7e9.tar.bz2
planet-b84b865d45b00600d982fef18991398cb655c7e9.tar.xz
planet-b84b865d45b00600d982fef18991398cb655c7e9.zip
Clean code
Replace dirname(__FILE__) by __DIR__.
Diffstat (limited to 'admin')
-rwxr-xr-xadmin/administration.php8
-rw-r--r--admin/changepassword.php4
-rwxr-xr-xadmin/index.php10
-rwxr-xr-xadmin/login.php4
-rw-r--r--admin/purgecache.php4
-rwxr-xr-xadmin/subscriptions.php12
6 files changed, 21 insertions, 21 deletions
diff --git a/admin/administration.php b/admin/administration.php
index d3a8fdf..34afe73 100755
--- a/admin/administration.php
+++ b/admin/administration.php
@@ -1,10 +1,10 @@
<?php
-require_once dirname(__FILE__) . '/../app/app.php';
-require_once dirname(__FILE__) . '/inc/auth.inc.php';
+require_once __DIR__ . '/../app/app.php';
+require_once __DIR__ . '/inc/auth.inc.php';
-$opml = OpmlManager::load(dirname(__FILE__) . '/../custom/people.opml');
+$opml = OpmlManager::load(__DIR__ . '/../custom/people.opml');
$opml_people = $opml->getPeople();
$page_id = 'admin-admin';
$header_extra = <<<"HTML"
@@ -40,4 +40,4 @@ FRAGMENT;
$footer_extra = '';
$admin_access = 1;
-require_once dirname(__FILE__) . '/template.php';
+require_once __DIR__ . '/template.php';
diff --git a/admin/changepassword.php b/admin/changepassword.php
index 1fa505e..8c38769 100644
--- a/admin/changepassword.php
+++ b/admin/changepassword.php
@@ -1,9 +1,9 @@
<?php
-require_once dirname(__FILE__).'/inc/auth.inc.php';
+require_once __DIR__.'/inc/auth.inc.php';
if (isset($_POST['password']) && ('' != $_POST['password'])){
$out = '<?php $login="admin"; $password="'.md5($_POST['password']).'"; ?>';
- file_put_contents(dirname(__FILE__).'/inc/pwd.inc.php', $out);
+ file_put_contents(__DIR__.'/inc/pwd.inc.php', $out);
die("Password changed. <a href='administration.php'>Login</a>");
} else {
die('Can not change password');
diff --git a/admin/index.php b/admin/index.php
index 25b337b..42ddf19 100755
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,10 +1,10 @@
<?php
-require_once dirname(__FILE__) . '/../app/app.php';
-require_once dirname(__FILE__) . '/inc/auth.inc.php';
+require_once __DIR__ . '/../app/app.php';
+require_once __DIR__ . '/inc/auth.inc.php';
//Load configuration
-$config_file = dirname(__FILE__) . '/../custom/config.yml';
+$config_file = __DIR__ . '/../custom/config.yml';
if (is_file($config_file)){
$conf = Spyc::YAMLLoad($config_file);
@@ -17,7 +17,7 @@ if (is_file($config_file)){
$Planet = new Planet($PlanetConfig);
//Load
-if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) {
+if (0 < $Planet->loadOpml(__DIR__ . '/../custom/people.opml')) {
$Planet->loadFeeds();
$items = $Planet->getItems();
}
@@ -136,4 +136,4 @@ $page_content = ob_get_contents();
ob_end_clean();
$admin_access = 1;
-require_once dirname(__FILE__) . '/template.php';
+require_once __DIR__ . '/template.php';
diff --git a/admin/login.php b/admin/login.php
index 796011f..3ba4d2b 100755
--- a/admin/login.php
+++ b/admin/login.php
@@ -4,7 +4,7 @@ if (isset($_POST['password'])) {
header('Location: index.php');
}
-require_once dirname(__FILE__) . '/../app/app.php';
+require_once __DIR__ . '/../app/app.php';
$page_content = <<<FRAGMENT
<form action="" method="post" class="login">
<fieldset>
@@ -31,4 +31,4 @@ FRAGMENT;
$page_id = 'admin-login';
$admin_access = 0;
-require_once dirname(__FILE__) . '/template.php';
+require_once __DIR__ . '/template.php';
diff --git a/admin/purgecache.php b/admin/purgecache.php
index 8657938..23a5712 100644
--- a/admin/purgecache.php
+++ b/admin/purgecache.php
@@ -1,10 +1,10 @@
<?php
require_once __DIR__.'/../app/app.php';
-require_once dirname(__FILE__).'/inc/auth.inc.php';
+require_once __DIR__.'/inc/auth.inc.php';
if (isset($_POST['purge'])){
- $dir = dirname(__FILE__).'/../cache/';
+ $dir = __DIR__.'/../cache/';
$dh = opendir($dir);
diff --git a/admin/subscriptions.php b/admin/subscriptions.php
index 8367a16..f2d51f5 100755
--- a/admin/subscriptions.php
+++ b/admin/subscriptions.php
@@ -1,7 +1,7 @@
<?php
-require_once dirname(__FILE__) . '/../app/app.php';
-require_once dirname(__FILE__) . '/inc/auth.inc.php';
+require_once __DIR__ . '/../app/app.php';
+require_once __DIR__ . '/inc/auth.inc.php';
function removeSlashes(&$item, $key){
$item = stripslashes($item);
@@ -10,12 +10,12 @@ function removeSlashes(&$item, $key){
if (isset($_POST['opml']) || isset($_POST['add'])) {
// Load config and old OPML
- $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml');
+ $conf = Spyc::YAMLLoad(__DIR__.'/../custom/config.yml');
$PlanetConfig = new PlanetConfig($conf);
if ($PlanetConfig->getName() === '') {
$PlanetConfig->setName($oldOpml->getTitle());
}
- $oldOpml = OpmlManager::load(dirname(__FILE__).'/../custom/people.opml');
+ $oldOpml = OpmlManager::load(__DIR__.'/../custom/people.opml');
$newOpml = new opml();
$newOpml->title = $PlanetConfig->getName();
@@ -57,10 +57,10 @@ if (isset($_POST['opml']) || isset($_POST['add'])) {
}
// Backup old OPML
- OpmlManager::backup(dirname(__FILE__).'/../custom/people.opml');
+ OpmlManager::backup(__DIR__.'/../custom/people.opml');
// Save new OPML
- OpmlManager::save($newOpml, dirname(__FILE__).'/../custom/people.opml');
+ OpmlManager::save($newOpml, __DIR__.'/../custom/people.opml');
}
header("Location: index.php");
die();