From 6322ac79a020ab584d412d782d62b2ee77d7c6cf Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 16:23:15 +0400 Subject: remove $link --- plugins/auth_remote/init.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'plugins/auth_remote') diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index 7e4638fb2..f0da1afc8 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -1,7 +1,6 @@ link = $host->get_link(); $this->host = $host; - $this->base = new Auth_Base($this->link); + $this->base = new Auth_Base(); $host->add_hook($host::HOOK_AUTH_USER, $this); } function get_login_by_ssl_certificate() { - $cert_serial = db_escape_string($this->link, get_ssl_certificate_id()); + $cert_serial = db_escape_string( get_ssl_certificate_id()); if ($cert_serial) { - $result = db_query($this->link, "SELECT login FROM ttrss_user_prefs, ttrss_users + $result = db_query( "SELECT login FROM ttrss_user_prefs, ttrss_users WHERE pref_name = 'SSL_CERT_SERIAL' AND value = '$cert_serial' AND owner_uid = ttrss_users.id"); if (db_num_rows($result) != 0) { - return db_escape_string($this->link, db_fetch_result($result, 0, "login")); + return db_escape_string( db_fetch_result($result, 0, "login")); } } @@ -38,10 +36,10 @@ class Auth_Remote extends Plugin implements IAuthModule { function authenticate($login, $password) { - $try_login = db_escape_string($this->link, $_SERVER["REMOTE_USER"]); + $try_login = db_escape_string( $_SERVER["REMOTE_USER"]); // php-cgi - if (!$try_login) $try_login = db_escape_string($this->link, $_SERVER["REDIRECT_REMOTE_USER"]); + if (!$try_login) $try_login = db_escape_string( $_SERVER["REDIRECT_REMOTE_USER"]); if (!$try_login) $try_login = $this->get_login_by_ssl_certificate(); # if (!$try_login) $try_login = "test_qqq"; @@ -60,15 +58,15 @@ class Auth_Remote extends Plugin implements IAuthModule { // update user name $fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN']; if ($fullname){ - $fullname = db_escape_string($this->link, $fullname); - db_query($this->link, "UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " . + $fullname = db_escape_string( $fullname); + db_query( "UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " . $user_id); } // update user mail $email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL']; if ($email){ - $email = db_escape_string($this->link, $email); - db_query($this->link, "UPDATE ttrss_users SET email = '$email' WHERE id = " . + $email = db_escape_string( $email); + db_query( "UPDATE ttrss_users SET email = '$email' WHERE id = " . $user_id); } } -- cgit v1.2.3 From d632b28cef93a159739e674a3573f197cc705c74 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 18:21:32 +0400 Subject: fix some missing constructor parameters --- plugins/auth_remote/init.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/auth_remote') diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index f0da1afc8..a87eea599 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -11,9 +11,9 @@ class Auth_Remote extends Plugin implements IAuthModule { true); } - function init($host) { + function init($dbh, host) { $this->host = $host; - $this->base = new Auth_Base(); + $this->base = new Auth_Base($dbh); $host->add_hook($host::HOOK_AUTH_USER, $this); } -- cgit v1.2.3 From a0ed0d38d467a7ceb5e576e8b363b5ee1af05ab1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 18:27:41 +0400 Subject: auth_remote: fix typo --- plugins/auth_remote/init.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/auth_remote') diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index a87eea599..f0da1afc8 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -11,9 +11,9 @@ class Auth_Remote extends Plugin implements IAuthModule { true); } - function init($dbh, host) { + function init($host) { $this->host = $host; - $this->base = new Auth_Base($dbh); + $this->base = new Auth_Base(); $host->add_hook($host::HOOK_AUTH_USER, $this); } -- cgit v1.2.3 From a42c55f02b7e313ab61bf826794d0888f2dceae1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 17 Apr 2013 18:34:18 +0400 Subject: fix blank character after opening bracket in function calls --- plugins/auth_remote/init.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'plugins/auth_remote') diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index f0da1afc8..a551c6bd0 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -19,15 +19,15 @@ class Auth_Remote extends Plugin implements IAuthModule { } function get_login_by_ssl_certificate() { - $cert_serial = db_escape_string( get_ssl_certificate_id()); + $cert_serial = db_escape_string(get_ssl_certificate_id()); if ($cert_serial) { - $result = db_query( "SELECT login FROM ttrss_user_prefs, ttrss_users + $result = db_query("SELECT login FROM ttrss_user_prefs, ttrss_users WHERE pref_name = 'SSL_CERT_SERIAL' AND value = '$cert_serial' AND owner_uid = ttrss_users.id"); if (db_num_rows($result) != 0) { - return db_escape_string( db_fetch_result($result, 0, "login")); + return db_escape_string(db_fetch_result($result, 0, "login")); } } @@ -36,10 +36,10 @@ class Auth_Remote extends Plugin implements IAuthModule { function authenticate($login, $password) { - $try_login = db_escape_string( $_SERVER["REMOTE_USER"]); + $try_login = db_escape_string($_SERVER["REMOTE_USER"]); // php-cgi - if (!$try_login) $try_login = db_escape_string( $_SERVER["REDIRECT_REMOTE_USER"]); + if (!$try_login) $try_login = db_escape_string($_SERVER["REDIRECT_REMOTE_USER"]); if (!$try_login) $try_login = $this->get_login_by_ssl_certificate(); # if (!$try_login) $try_login = "test_qqq"; @@ -58,15 +58,15 @@ class Auth_Remote extends Plugin implements IAuthModule { // update user name $fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN']; if ($fullname){ - $fullname = db_escape_string( $fullname); - db_query( "UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " . + $fullname = db_escape_string($fullname); + db_query("UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " . $user_id); } // update user mail $email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL']; if ($email){ - $email = db_escape_string( $email); - db_query( "UPDATE ttrss_users SET email = '$email' WHERE id = " . + $email = db_escape_string($email); + db_query("UPDATE ttrss_users SET email = '$email' WHERE id = " . $user_id); } } -- cgit v1.2.3 From 106a3de91c7c8c6c275323152de414253f01127a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Apr 2013 17:31:56 +0400 Subject: plugins: bump API version --- plugins/auth_remote/init.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plugins/auth_remote') diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index a551c6bd0..2bf090d54 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -77,6 +77,11 @@ class Auth_Remote extends Plugin implements IAuthModule { return false; } + + function api_version() { + return 2; + } + } ?> -- cgit v1.2.3 From 6f7798b6434f5ef6073447998c436901b507e3df Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Tue, 7 May 2013 00:35:10 -0700 Subject: Fixing bugs found by static analysis --- plugins/auth_remote/init.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/auth_remote') diff --git a/plugins/auth_remote/init.php b/plugins/auth_remote/init.php index 2bf090d54..2ec2c87b2 100644 --- a/plugins/auth_remote/init.php +++ b/plugins/auth_remote/init.php @@ -45,7 +45,7 @@ class Auth_Remote extends Plugin implements IAuthModule { # if (!$try_login) $try_login = "test_qqq"; if ($try_login) { - $user_id = $this->base->auto_create_user($try_login); + $user_id = $this->base->auto_create_user($try_login, $password); if ($user_id) { $_SESSION["fake_login"] = $try_login; -- cgit v1.2.3