From 3959c998c420dacfc73b36cd423894ec1209a4d3 Mon Sep 17 00:00:00 2001 From: Cameron <e107inc@gmail.com> Date: Tue, 2 Oct 2018 12:15:58 -0700 Subject: [PATCH] Issue #3463 - Alt-auth missing port field. --- e107_handlers/e_parse_class.php | 2 +- e107_plugins/alt_auth/alt_auth_adminmenu.php | 2 ++ e107_plugins/alt_auth/e107db_auth.php | 3 ++- e107_plugins/alt_auth/e107db_conf.php | 2 +- e107_plugins/alt_auth/languages/English/admin_alt_auth.php | 6 ++++++ e107_plugins/alt_auth/otherdb_auth.php | 4 +++- e107_plugins/alt_auth/otherdb_conf.php | 2 +- 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index 21b0e3aee..1cef9c588 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -3202,7 +3202,7 @@ class e_parse extends e_parser * "" (default) = URL's get relative path e.g. ../e107_plugins/etc * @param mixed $all [optional] if TRUE, then when $mode is "full" or TRUE, USERID is also replaced... * when $mode is "" (default), ALL other e107 constants are replaced - * @return string + * @return array|string */ public function replaceConstants($text, $mode = '', $all = FALSE) { diff --git a/e107_plugins/alt_auth/alt_auth_adminmenu.php b/e107_plugins/alt_auth/alt_auth_adminmenu.php index 498e59b4e..2acb00841 100755 --- a/e107_plugins/alt_auth/alt_auth_adminmenu.php +++ b/e107_plugins/alt_auth/alt_auth_adminmenu.php @@ -246,6 +246,8 @@ class alt_auth_admin extends alt_auth_base */ private $common_fields = array( 'server' => array('fieldname' => 'server', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_32, 'help' => ''), + 'port' => array('fieldname' => 'port', 'size' => 4, 'max_size' => 7, 'prompt' => LAN_ALT_80, 'help' => 'eg. 3306'), + 'uname' => array('fieldname' => 'username', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_33, 'help' => ''), 'pwd' => array('fieldname' => 'password', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_34, 'help' => ''), 'db' => array('fieldname' => 'database', 'size' => 35, 'max_size' => 120, 'prompt' => LAN_ALT_35, 'help' => ''), diff --git a/e107_plugins/alt_auth/e107db_auth.php b/e107_plugins/alt_auth/e107db_auth.php index e683d822f..03a9706f5 100644 --- a/e107_plugins/alt_auth/e107db_auth.php +++ b/e107_plugins/alt_auth/e107db_auth.php @@ -97,7 +97,8 @@ class auth_login extends alt_auth_base if ($connect_only) return AUTH_SUCCESS; // Test mode may just want to connect to the DB */ - $dsn = 'mysql:dbname=' . $this->conf['e107db_database'] . ';host=' . $this->conf['e107db_server']; + // $dsn = 'mysql:dbname=' . $this->conf['e107db_database'] . ';host=' . $this->conf['e107db_server']; + $dsn = "mysql:host=".$this->conf['e107db_server'].";port=".varset($this->conf['e107db_port'],3306).";dbname=".$this->conf['e107db_database']; try { diff --git a/e107_plugins/alt_auth/e107db_conf.php b/e107_plugins/alt_auth/e107db_conf.php index b9e9d6ce2..3745fc383 100644 --- a/e107_plugins/alt_auth/e107db_conf.php +++ b/e107_plugins/alt_auth/e107db_conf.php @@ -60,7 +60,7 @@ class alt_auth_e107db extends alt_auth_admin $tab1 .= E107DB_LAN_1; $tab1 .= "</td></tr>"; - $tab1 .= $this->alt_auth_get_db_fields('e107db', $frm, $parm, 'server|uname|pwd|db|prefix|classfilt'); + $tab1 .= $this->alt_auth_get_db_fields('e107db', $frm, $parm, 'server|port|uname|pwd|db|prefix|classfilt'); $tab1 .= "<tr><td>".E107DB_LAN_9."</td><td>"; $tab1 .= $this->altAuthGetPasswordSelector('e107db_password_method', $frm, $parm['e107db_password_method'], FALSE); diff --git a/e107_plugins/alt_auth/languages/English/admin_alt_auth.php b/e107_plugins/alt_auth/languages/English/admin_alt_auth.php index fac32ea3c..a78e3f8e7 100644 --- a/e107_plugins/alt_auth/languages/English/admin_alt_auth.php +++ b/e107_plugins/alt_auth/languages/English/admin_alt_auth.php @@ -103,6 +103,12 @@ define('LAN_ALT_76', 'User class restriction (a numeric value - zero or blank fo define('LAN_ALT_77', 'Only users in this class (on the database set above) are permitted access'); define('LAN_ALT_78', 'Failed password action'); define('LAN_ALT_79', 'If user exists in primary DB, but enters an incorrect password, how should that be handled?'); +define('LAN_ALT_80', "Port: "); + + + + + define('IMPORTDB_LAN_2', 'Plain Text'); define('IMPORTDB_LAN_3', 'Joomla salted'); diff --git a/e107_plugins/alt_auth/otherdb_auth.php b/e107_plugins/alt_auth/otherdb_auth.php index 5cdd0833a..387d6f39a 100644 --- a/e107_plugins/alt_auth/otherdb_auth.php +++ b/e107_plugins/alt_auth/otherdb_auth.php @@ -80,7 +80,9 @@ class auth_login extends alt_auth_base public function login($uname, $pword, &$newvals, $connect_only = FALSE) { /* Begin - Deltik's PDO Workaround (part 1/2) */ - $dsn = 'mysql:dbname=' . $this->conf['otherdb_database'] . ';host=' . $this->conf['otherdb_server']; + // $dsn = 'mysql:dbname=' . $this->conf['otherdb_database'] . ';host=' . $this->conf['otherdb_server']; + $dsn = "mysql:host=".$this->conf['otherdb_server'].";port=".varset($this->conf['otherdb_port'],3306).";dbname=".$this->conf['otherdb_database']; + try { diff --git a/e107_plugins/alt_auth/otherdb_conf.php b/e107_plugins/alt_auth/otherdb_conf.php index 0802d247c..ccb5633d4 100644 --- a/e107_plugins/alt_auth/otherdb_conf.php +++ b/e107_plugins/alt_auth/otherdb_conf.php @@ -64,7 +64,7 @@ class alt_auth_otherdb extends alt_auth_admin $tab1 .= OTHERDB_LAN_15; $tab1 .= "</td></tr>"; - $tab1 .= $this->alt_auth_get_db_fields('otherdb', $frm, $parm, 'server|uname|pwd|db|table|ufield|pwfield|salt'); + $tab1 .= $this->alt_auth_get_db_fields('otherdb', $frm, $parm, 'server|port|uname|pwd|db|table|ufield|pwfield|salt'); $tab1 .= "<tr><td>".OTHERDB_LAN_9."</td><td>"; $tab1 .= $this->altAuthGetPasswordSelector('otherdb_password_method', $frm, $parm['otherdb_password_method'], TRUE);