Browse Source

Added plugin-call to Session

Tobias Reich 11 years ago
parent
commit
2400564a79
2 changed files with 19 additions and 1 deletions
  1. 0 1
      php/api.php
  2. 19 0
      php/modules/Session.php

+ 0 - 1
php/api.php

@@ -25,7 +25,6 @@ if (!empty($_POST['function'])||!empty($_GET['function'])) {
 	require('modules/db.php');
 	require('modules/misc.php');
 	require('modules/photo.php');
-	require('modules/_session.php');
 	require('modules/settings.php');
 	require('modules/upload.php');
 

+ 19 - 0
php/modules/_session.php → php/modules/Session.php

@@ -41,6 +41,9 @@ class Session {
 
 		if (!isset($this->settings, $public, $version)) return false;
 
+		# Call plugins
+		$this->plugins(__METHOD__, 0, func_get_args());
+
 		global $configVersion;
 
 		# Update
@@ -74,6 +77,9 @@ class Session {
 
 		}
 
+		# Call plugins
+		$this->plugins(__METHOD__, 1, func_get_args());
+
 		return $return;
 
 	}
@@ -82,6 +88,9 @@ class Session {
 
 		if (!isset($this->settings, $username, $password)) return false;
 
+		# Call plugins
+		$this->plugins(__METHOD__, 0, func_get_args());
+
 		# Check login
 		if ($username===$this->settings['username']&&$password===$this->settings['password']) {
 			$_SESSION['login'] = true;
@@ -94,13 +103,23 @@ class Session {
 			return true;
 		}
 
+		# Call plugins
+		$this->plugins(__METHOD__, 1, func_get_args());
+
 		return false;
 
 	}
 
 	public function logout() {
 
+		# Call plugins
+		$this->plugins(__METHOD__, 0, func_get_args());
+
 		session_destroy();
+
+		# Call plugins
+		$this->plugins(__METHOD__, 1, func_get_args());
+
 		return true;
 
 	}