aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rwxr-xr-xinc/poche/Poche.class.php9
-rwxr-xr-xinc/poche/Routing.class.php9
-rwxr-xr-xinc/poche/Tools.class.php13
-rwxr-xr-xinc/poche/config.inc.default.php3
4 files changed, 18 insertions, 16 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 15d83bfe..9014f455 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -448,8 +448,9 @@ class Poche
448 $themes = $this->tpl->getInstalledThemes(); 448 $themes = $this->tpl->getInstalledThemes();
449 $languages = $this->language->getInstalledLanguages(); 449 $languages = $this->language->getInstalledLanguages();
450 $token = $this->user->getConfigValue('token'); 450 $token = $this->user->getConfigValue('token');
451 $http_auth = (isset($_SERVER['PHP_AUTH_USER']) || isset($_SERVER['REMOTE_USER'])) ? true : false; 451 $http_auth = isset($_SERVER['REMOTE_USER']);
452 $only_user = ($this->store->listUsers() > 1) ? false : true; 452 $only_user = ($this->store->listUsers() > 1) ? false : true;
453 $https = substr(Tools::getPocheUrl(), 0, 5) == 'https';
453 $tpl_vars = array( 454 $tpl_vars = array(
454 'themes' => $themes, 455 'themes' => $themes,
455 'languages' => $languages, 456 'languages' => $languages,
@@ -462,7 +463,8 @@ class Poche
462 'token' => $token, 463 'token' => $token,
463 'user_id' => $this->user->getId(), 464 'user_id' => $this->user->getId(),
464 'http_auth' => $http_auth, 465 'http_auth' => $http_auth,
465 'only_user' => $only_user 466 'only_user' => $only_user,
467 'https' => $https
466 ); 468 );
467 Tools::logm('config view'); 469 Tools::logm('config view');
468 break; 470 break;
@@ -653,9 +655,6 @@ class Poche
653 */ 655 */
654 private function credentials() 656 private function credentials()
655 { 657 {
656 if (isset($_SERVER['PHP_AUTH_USER'])) {
657 return array($_SERVER['PHP_AUTH_USER'], 'php_auth', true);
658 }
659 if (!empty($_POST['login']) && !empty($_POST['password'])) { 658 if (!empty($_POST['login']) && !empty($_POST['password'])) {
660 return array($_POST['login'], $_POST['password'], false); 659 return array($_POST['login'], $_POST['password'], false);
661 } 660 }
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php
index 33a81435..fb37a838 100755
--- a/inc/poche/Routing.class.php
+++ b/inc/poche/Routing.class.php
@@ -75,15 +75,6 @@ class Routing
75 } elseif (ALLOW_REGISTER && isset($_GET['register'])){ 75 } elseif (ALLOW_REGISTER && isset($_GET['register'])){
76 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']); 76 $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser'], $_POST['newuseremail']);
77 Tools::redirect(); 77 Tools::redirect();
78 } elseif(isset($_SERVER['PHP_AUTH_USER'])) {
79 if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) {
80 $this->wallabag->login($this->referer);
81 } else {
82 $this->wallabag->messages->add('e', _('login failed: user doesn\'t exist'));
83 Tools::logm('user doesn\'t exist');
84 $tplFile = Tools::getTplFile('login');
85 $tplVars['http_auth'] = 1;
86 }
87 } elseif(isset($_SERVER['REMOTE_USER'])) { 78 } elseif(isset($_SERVER['REMOTE_USER'])) {
88 if($this->wallabag->store->userExists($_SERVER['REMOTE_USER'])) { 79 if($this->wallabag->store->userExists($_SERVER['REMOTE_USER'])) {
89 $this->wallabag->login($this->referer); 80 $this->wallabag->login($this->referer);
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index f3d1013f..9c748391 100755
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -40,6 +40,8 @@ final class Tools
40 */ 40 */
41 public static function getPocheUrl() 41 public static function getPocheUrl()
42 { 42 {
43 $baseUrl = "";
44
43 $https = (!empty($_SERVER['HTTPS']) 45 $https = (!empty($_SERVER['HTTPS'])
44 && (strtolower($_SERVER['HTTPS']) == 'on')) 46 && (strtolower($_SERVER['HTTPS']) == 'on'))
45 || (isset($_SERVER["SERVER_PORT"]) 47 || (isset($_SERVER["SERVER_PORT"])
@@ -72,8 +74,15 @@ final class Tools
72 $serverport = ''; 74 $serverport = '';
73 } 75 }
74 76
75 return 'http' . ($https ? 's' : '') . '://' 77 // check if BASE_URL is configured
76 . $host . $serverport . $scriptname; 78 if(BASE_URL) {
79 $baseUrl = BASE_URL;
80 } else {
81 $baseUrl = 'http' . ($https ? 's' : '') . '://' . $host . $serverport;
82 }
83
84 return $baseUrl . $scriptname;
85
77 } 86 }
78 87
79 /** 88 /**
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php
index 09d3aa9a..5d889ffd 100755
--- a/inc/poche/config.inc.default.php
+++ b/inc/poche/config.inc.default.php
@@ -31,6 +31,9 @@
31// Change this if not using the standart port for SSL - i.e you server is behind sslh 31// Change this if not using the standart port for SSL - i.e you server is behind sslh
32@define ('SSL_PORT', 443); 32@define ('SSL_PORT', 443);
33 33
34// Define this only if you use wallabag behind a proxy and if you encounter problems
35@define ('BASE_URL', '');
36
34@define ('MODE_DEMO', FALSE); 37@define ('MODE_DEMO', FALSE);
35@define ('DEBUG_POCHE', FALSE); 38@define ('DEBUG_POCHE', FALSE);
36 39