diff options
Diffstat (limited to 'inc')
-rwxr-xr-x | inc/poche/Poche.class.php | 4 | ||||
-rwxr-xr-x | inc/poche/Routing.class.php | 10 | ||||
-rwxr-xr-x | inc/poche/Tools.class.php | 2 | ||||
-rwxr-xr-x | inc/poche/config.inc.default.php | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 8ade91b4..cd7578e3 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -76,6 +76,7 @@ class Poche | |||
76 | */ | 76 | */ |
77 | public function createNewUser($username, $password, $email = "", $internalRegistration = false) | 77 | public function createNewUser($username, $password, $email = "", $internalRegistration = false) |
78 | { | 78 | { |
79 | Tools::logm('Trying to create a new user...'); | ||
79 | if (!empty($username) && !empty($password)){ | 80 | if (!empty($username) && !empty($password)){ |
80 | $newUsername = filter_var($username, FILTER_SANITIZE_STRING); | 81 | $newUsername = filter_var($username, FILTER_SANITIZE_STRING); |
81 | $email = filter_var($email, FILTER_SANITIZE_STRING); | 82 | $email = filter_var($email, FILTER_SANITIZE_STRING); |
@@ -130,6 +131,9 @@ class Poche | |||
130 | Tools::redirect(); | 131 | Tools::redirect(); |
131 | } | 132 | } |
132 | } | 133 | } |
134 | else { | ||
135 | Tools::logm('Password or username were empty'); | ||
136 | } | ||
133 | } | 137 | } |
134 | 138 | ||
135 | /** | 139 | /** |
diff --git a/inc/poche/Routing.class.php b/inc/poche/Routing.class.php index 82ff20d6..e9b67771 100755 --- a/inc/poche/Routing.class.php +++ b/inc/poche/Routing.class.php | |||
@@ -68,6 +68,12 @@ class Routing | |||
68 | $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose); | 68 | $this->wallabag->action($this->action, $this->url, $this->id, FALSE, $this->autoclose); |
69 | $tplFile = Tools::getTplFile($this->view); | 69 | $tplFile = Tools::getTplFile($this->view); |
70 | $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); | 70 | $tplVars = array_merge($this->vars, $this->wallabag->displayView($this->view, $this->id)); |
71 | } elseif(ALLOW_REGISTER && isset($_GET['registerform'])) { | ||
72 | Tools::logm('register'); | ||
73 | $tplFile = Tools::getTplFile('register'); | ||
74 | } elseif (ALLOW_REGISTER && isset($_GET['register'])){ | ||
75 | $this->wallabag->createNewUser($_POST['newusername'], $_POST['password4newuser']); | ||
76 | Tools::redirect(); | ||
71 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { | 77 | } elseif(isset($_SERVER['PHP_AUTH_USER'])) { |
72 | if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { | 78 | if($this->wallabag->store->userExists($_SERVER['PHP_AUTH_USER'])) { |
73 | $this->wallabag->login($this->referer); | 79 | $this->wallabag->login($this->referer); |
@@ -105,7 +111,9 @@ class Routing | |||
105 | $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); | 111 | $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0); |
106 | $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0); | 112 | $limit = (isset($_GET['limit']) ? intval($_GET['limit']) : 0); |
107 | $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit); | 113 | $this->wallabag->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type'], $limit); |
108 | } | 114 | } //elseif (ALLOW_REGISTER && isset($_GET['register'])) { |
115 | //$this->wallabag->register | ||
116 | //} | ||
109 | 117 | ||
110 | //allowed ONLY to logged in user | 118 | //allowed ONLY to logged in user |
111 | if (\Session::isLogged() === true) | 119 | if (\Session::isLogged() === true) |
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 7ccfc069..d0b31d4f 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php | |||
@@ -117,7 +117,7 @@ final class Tools | |||
117 | { | 117 | { |
118 | $views = array( | 118 | $views = array( |
119 | 'install', 'import', 'export', 'config', 'tags', | 119 | 'install', 'import', 'export', 'config', 'tags', |
120 | 'edit-tags', 'view', 'login', 'error', 'about' | 120 | 'edit-tags', 'view', 'login', 'error', 'about', 'register' |
121 | ); | 121 | ); |
122 | 122 | ||
123 | return (in_array($view, $views) ? $view . '.twig' : 'home.twig'); | 123 | return (in_array($view, $views) ? $view . '.twig' : 'home.twig'); |
diff --git a/inc/poche/config.inc.default.php b/inc/poche/config.inc.default.php index 0fd9bc0e..e569dddd 100755 --- a/inc/poche/config.inc.default.php +++ b/inc/poche/config.inc.default.php | |||
@@ -33,6 +33,8 @@ | |||
33 | @define ('MODE_DEMO', FALSE); | 33 | @define ('MODE_DEMO', FALSE); |
34 | @define ('DEBUG_POCHE', FALSE); | 34 | @define ('DEBUG_POCHE', FALSE); |
35 | 35 | ||
36 | @define ('ALLOW_REGISTER', TRUE); | ||
37 | |||
36 | //default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL. | 38 | //default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL. |
37 | @define ('ERROR_REPORTING', E_ALL & ~E_NOTICE); | 39 | @define ('ERROR_REPORTING', E_ALL & ~E_NOTICE); |
38 | 40 | ||