aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMark Pemberton <mpemberton5@gmail.com>2011-05-21 21:38:25 -0400
committerMark Pemberton <mpemberton5@gmail.com>2011-05-21 21:38:25 -0400
commitb105867e75f103ae2b0c54edfaa9ce6467a8a258 (patch)
tree299bd99f271a55a98de88e8b27e457ea8401d2f1 /src
parente0149e24e2b5fac3b875fda468b18fbe2b6b1218 (diff)
parent97bba97049eeed2ecec022caa641b50ca507cb72 (diff)
downloadsemanticscuttle-b105867e75f103ae2b0c54edfaa9ce6467a8a258.tar.gz
semanticscuttle-b105867e75f103ae2b0c54edfaa9ce6467a8a258.tar.bz2
Merge branch 'master' into privatekey2
Diffstat (limited to 'src')
-rw-r--r--src/SemanticScuttle/Service/AuthUser.php2
-rw-r--r--src/SemanticScuttle/Service/User.php4
-rw-r--r--src/SemanticScuttle/header-standalone.php1
-rw-r--r--src/SemanticScuttle/header.php17
4 files changed, 15 insertions, 9 deletions
diff --git a/src/SemanticScuttle/Service/AuthUser.php b/src/SemanticScuttle/Service/AuthUser.php
index 479b68a..9447ee4 100644
--- a/src/SemanticScuttle/Service/AuthUser.php
+++ b/src/SemanticScuttle/Service/AuthUser.php
@@ -130,7 +130,7 @@ class SemanticScuttle_Service_AuthUser extends SemanticScuttle_Service_User
//FIXME: caching?
$name = $this->auth->getUsername();
if (!$name) {
- return false;
+ return parent::getCurrentUserId();
}
return $this->getIdFromUser($name);
}
diff --git a/src/SemanticScuttle/Service/User.php b/src/SemanticScuttle/Service/User.php
index 01945ca..18d5a29 100644
--- a/src/SemanticScuttle/Service/User.php
+++ b/src/SemanticScuttle/Service/User.php
@@ -455,8 +455,8 @@ class SemanticScuttle_Service_User extends SemanticScuttle_DbService
if ($ssls->hasValidCert()) {
$id = $ssls->getUserIdFromCert();
if ($id !== false) {
- $this->setCurrentUserId($id);
- return (int)$_SESSION[$this->getSessionKey()];
+ $this->setCurrentUserId($id, true);
+ return $this->currentuserId;
}
}
return false;
diff --git a/src/SemanticScuttle/header-standalone.php b/src/SemanticScuttle/header-standalone.php
index cc1b0bd..3755ea1 100644
--- a/src/SemanticScuttle/header-standalone.php
+++ b/src/SemanticScuttle/header-standalone.php
@@ -14,7 +14,6 @@
* @link http://sourceforge.net/projects/semanticscuttle
*/
$_SERVER['HTTP_HOST'] = 'http://localhost/';
-define('UNIT_TEST_MODE', true);
require_once dirname(__FILE__) . '/header.php';
?> \ No newline at end of file
diff --git a/src/SemanticScuttle/header.php b/src/SemanticScuttle/header.php
index b0705b0..098e5c3 100644
--- a/src/SemanticScuttle/header.php
+++ b/src/SemanticScuttle/header.php
@@ -46,14 +46,21 @@ if (isset($_GET['unittestMode']) && $_GET['unittestMode'] == 1
die("Unittestmode is not allowed\n");
}
- $unittestConfigFile = $datadir . '/config.unittest.php';
- if (file_exists($unittestConfigFile)) {
- require_once $unittestConfigFile;
- }
define('HTTP_UNIT_TEST_MODE', true);
define('UNIT_TEST_MODE', true);
}
if (defined('UNIT_TEST_MODE')) {
+ //load configuration for unit tests
+ $testingConfigFile = $datadir . '/config.testing.php';
+ if (file_exists($testingConfigFile)) {
+ require_once $testingConfigFile;
+ }
+ //test-specific configuration file
+ $unittestConfigFile = $datadir . '/config.testing-tmp.php';
+ if (file_exists($unittestConfigFile)) {
+ require_once $unittestConfigFile;
+ }
+
//make local config vars global - needed for unit tests
//run with phpunit
foreach (get_defined_vars() as $var => $value) {
@@ -107,7 +114,7 @@ T_bind_textdomain_codeset($domain, 'UTF-8');
T_textdomain($domain);
// 4 // Session
-if (!defined('UNIT_TEST_MODE') || defined('HTTP_UNIT_TEST_MODE')) {
+if (isset($_SERVER['REMOTE_ADDR'])) {
session_start();
if ($GLOBALS['enableVoting']) {
if (isset($_SESSION['lastUrl'])) {