From 24ab2724f58294647d61fbf7c69420baf1e9c586 Mon Sep 17 00:00:00 2001 From: zachweix Date: Wed, 12 Feb 2020 15:21:53 -0500 Subject: [PATCH 1/2] Update ZohoOAuth.php you say you allow host address, but you don't account for that in the code itself --- src/oauth/ZohoOAuth.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/oauth/ZohoOAuth.php b/src/oauth/ZohoOAuth.php index 64652fc7..417ed0d0 100644 --- a/src/oauth/ZohoOAuth.php +++ b/src/oauth/ZohoOAuth.php @@ -54,7 +54,9 @@ private static function setConfigValues($configuration) ZohoOAuthConstants::DATABASE_PORT, ZohoOAuthConstants::DATABASE_PASSWORD, ZohoOAuthConstants::DATABASE_USERNAME, - ZohoOAuthConstants::PERSISTENCE_HANDLER_CLASS_NAME + ZohoOAuthConstants::PERSISTENCE_HANDLER_CLASS_NAME, + ZohoOAuthConstants::DATABASE_NAME, + ZohoOAuthConstants::HOST_ADDRESS ); if (! array_key_exists(ZohoOAuthConstants::ACCESS_TYPE, $configuration) || $configuration[ZohoOAuthConstants::ACCESS_TYPE] == "") { @@ -160,4 +162,4 @@ public static function getClientInstance() } return ZohoOAuthClient::getInstanceWithOutParam(); } -} \ No newline at end of file +} From 2e5c07bf21d363defde3351e28f3f6e6a8547533 Mon Sep 17 00:00:00 2001 From: zachweix Date: Wed, 12 Feb 2020 15:25:41 -0500 Subject: [PATCH 2/2] Update ZohoOAuthPersistenceHandler.php --- src/oauth/persistence/ZohoOAuthPersistenceHandler.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/oauth/persistence/ZohoOAuthPersistenceHandler.php b/src/oauth/persistence/ZohoOAuthPersistenceHandler.php index f6bc7d60..44cec93c 100644 --- a/src/oauth/persistence/ZohoOAuthPersistenceHandler.php +++ b/src/oauth/persistence/ZohoOAuthPersistenceHandler.php @@ -83,11 +83,16 @@ public function deleteOAuthTokens($userEmailId) public function getMysqlConnection() { - $mysqli_con = new \mysqli(ZohoOAuth::getConfigValue(ZohoOAuthConstants::HOST_ADDRESS).":". ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_PORT), ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_USERNAME), ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_PASSWORD), ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_NAME)); + $url = ZohoOAuth::getConfigValue(ZohoOAuthConstants::HOST_ADDRESS); + $port = ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_PORT); + if ($port != null && $port != "") { + $url .= ":" . $port; + } + $mysqli_con = new \mysqli($url , ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_USERNAME), ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_PASSWORD), ZohoOAuth::getConfigValue(ZohoOAuthConstants::DATABASE_NAME)); if ($mysqli_con->connect_errno) { Logger::severe("Failed to connect to MySQL: (" . $mysqli_con->connect_errno . ") " . $mysqli_con->connect_error); echo "Failed to connect to MySQL: (" . $mysqli_con->connect_errno . ") " . $mysqli_con->connect_error; } return $mysqli_con; } -} \ No newline at end of file +}