aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-09-18 23:28:11 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-09-18 23:28:11 +0200
commit6eef15cdc3bef5971d8ffe95bcbcaff368c87e69 (patch)
treed42ffe8c61445601413418aa1996e0faa2ddcc51
parentb81d2ab65f8fafce3b818eeb96c1cdcecd3e675f (diff)
downloadphorkie-6eef15cdc3bef5971d8ffe95bcbcaff368c87e69.tar.gz
phorkie-6eef15cdc3bef5971d8ffe95bcbcaff368c87e69.zip
rename "secureAtLevel" variable since it does not define a level at all
-rw-r--r--www/delete.php2
-rw-r--r--www/display.php2
-rw-r--r--www/doap.php2
-rw-r--r--www/edit.php3
-rw-r--r--www/fork.php2
-rw-r--r--www/index.php2
-rw-r--r--www/list.php2
-rw-r--r--www/new.php2
-rw-r--r--www/raw.php2
-rw-r--r--www/revision.php2
-rw-r--r--www/search.php2
-rw-r--r--www/user.php2
-rw-r--r--www/www-security.php24
13 files changed, 23 insertions, 26 deletions
diff --git a/www/delete.php b/www/delete.php
index d9ee251..43ec9d5 100644
--- a/www/delete.php
+++ b/www/delete.php
@@ -3,7 +3,7 @@ namespace phorkie;
/**
* Delete paste or ask for deletion
*/
-$secureAtLevel = '1';
+$reqWritePermissions = true;
require_once 'www-header.php';
$repo = new Repository();
diff --git a/www/display.php b/www/display.php
index fc93b0d..ffc9786 100644
--- a/www/display.php
+++ b/www/display.php
@@ -3,7 +3,7 @@ namespace phorkie;
/**
* Display paste contents
*/
-$secureAtLevel = '0';
+$reqWritePermissions = false;
require_once 'www-header.php';
$repo = new Repository();
diff --git a/www/doap.php b/www/doap.php
index 377030b..63a66e6 100644
--- a/www/doap.php
+++ b/www/doap.php
@@ -4,7 +4,7 @@ namespace phorkie;
* Display DOAP of the paste.
* Contains a machine-readable project description with Git URL.
*/
-$secureAtLevel = '0';
+$reqWritePermissions = false;
require_once 'www-header.php';
$repo = new Repository();
diff --git a/www/edit.php b/www/edit.php
index f83dfb3..4de3d47 100644
--- a/www/edit.php
+++ b/www/edit.php
@@ -3,8 +3,9 @@ namespace phorkie;
/**
* Edit paste contents
*/
-$secureAtLevel = '1';
+$reqWritePermissions = true;
require_once 'www-header.php';
+
$repo = new Repository();
$repo->loadFromRequest();
diff --git a/www/fork.php b/www/fork.php
index 10bd1e2..6c96a6a 100644
--- a/www/fork.php
+++ b/www/fork.php
@@ -3,7 +3,7 @@
* Fork a repository
*/
namespace phorkie;
-$secureAtLevel = '1';
+$reqWritePermissions = true;
require_once 'www-header.php';
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
diff --git a/www/index.php b/www/index.php
index 7ff1814..0ee9211 100644
--- a/www/index.php
+++ b/www/index.php
@@ -3,7 +3,7 @@
* Jump to the index as per the configuration
*/
namespace phorkie;
-$secureAtLevel = false;
+$reqWritePermissions = false;
require_once 'www-header.php';
header(
diff --git a/www/list.php b/www/list.php
index 8252f37..750e811 100644
--- a/www/list.php
+++ b/www/list.php
@@ -3,7 +3,7 @@
* List a repository
*/
namespace phorkie;
-$secureAtLevel = '0';
+$reqWritePermissions = false;
require_once 'www-header.php';
$rs = new Repositories();
diff --git a/www/new.php b/www/new.php
index e2611c0..7a70891 100644
--- a/www/new.php
+++ b/www/new.php
@@ -10,7 +10,7 @@ namespace phorkie;
*
* Creates and redirects to display page
*/
-$secureAtLevel = '1';
+$reqWritePermissions = true;
require_once 'www-header.php';
$repopo = new Repository_Post();
diff --git a/www/raw.php b/www/raw.php
index 612a6b8..605462d 100644
--- a/www/raw.php
+++ b/www/raw.php
@@ -3,7 +3,7 @@ namespace phorkie;
/**
* Displays a file
*/
-$secureAtLevel = '0';
+$reqWritePermissions = false;
require_once 'www-header.php';
$repo = new Repository();
diff --git a/www/revision.php b/www/revision.php
index 513ca67..4d4f97c 100644
--- a/www/revision.php
+++ b/www/revision.php
@@ -3,7 +3,7 @@ namespace phorkie;
/**
* Display historic paste contents
*/
-$secureAtLevel = '0';
+$reqWritePermissions = false;
require_once 'www-header.php';
$repo = new Repository();
diff --git a/www/search.php b/www/search.php
index 82d5f76..9c7ff6e 100644
--- a/www/search.php
+++ b/www/search.php
@@ -3,7 +3,7 @@ namespace phorkie;
/**
* Search for a search term
*/
-$secureAtLevel = '0';
+$reqWritePermissions = false;
require_once 'www-header.php';
if (!isset($_GET['q']) || $_GET['q'] == '') {
diff --git a/www/user.php b/www/user.php
index 9e20f6a..8b86a50 100644
--- a/www/user.php
+++ b/www/user.php
@@ -3,7 +3,7 @@
* Edit user information
*/
namespace phorkie;
-$secureAtLevel = '1';
+$reqWritePermissions = true;
require_once 'www-header.php';
if (isset($_POST['name'])) {
diff --git a/www/www-security.php b/www/www-security.php
index ccbdb97..5051b0f 100644
--- a/www/www-security.php
+++ b/www/www-security.php
@@ -26,23 +26,19 @@ if (!isset($_SESSION['identity'])) {
$logged_in = true;
}
-if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) {
- if ($logged_in) {
- return;
- }
-} else {
+if ($logged_in) {
+ //you may do everything if you're logged in
return;
}
-// p / G / log_in = disp
-// 0 / 1 / true = return
-// 0 / 1 / false = block
-// 0 / 2 / true = return
-// 0 / 2 / false = return
-// 1 / 1 / true = return
-// 1 / 1 / false = block
-// 1 / 2 / true = return
-// 1 / 2 / false = block
+if (!isset($reqWritePermissions)) {
+ $reqWritePermissions = true;
+}
+if ($GLOBALS['phorkie']['auth']['securityLevel'] == 1
+ && !$reqWritePermissions
+) {
+ return;
+}
$_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI'];
require 'forbidden.php';