From db1d099341e048438b7518f71a75dd0818bc9e26 Mon Sep 17 00:00:00 2001 From: Sebijk Date: Wed, 1 Feb 2023 20:15:05 +0100 Subject: [PATCH] remove obsolete koobi7 and jfchat plugin --- src/plugins/jfchat.auth.php | 299 ---------------- src/plugins/koobi7.auth.php | 332 ------------------ src/plugins/templates/images/koobi32.png | Bin 640 -> 0 bytes .../templates/jfchatauth.plugin.prefs.tpl | 46 --- .../templates/koobi7auth.plugin.prefs.tpl | 46 --- 5 files changed, 723 deletions(-) delete mode 100644 src/plugins/jfchat.auth.php delete mode 100644 src/plugins/koobi7.auth.php delete mode 100644 src/plugins/templates/images/koobi32.png delete mode 100644 src/plugins/templates/jfchatauth.plugin.prefs.tpl delete mode 100644 src/plugins/templates/koobi7auth.plugin.prefs.tpl diff --git a/src/plugins/jfchat.auth.php b/src/plugins/jfchat.auth.php deleted file mode 100644 index 03ee523..0000000 --- a/src/plugins/jfchat.auth.php +++ /dev/null @@ -1,299 +0,0 @@ -type = BMPLUGIN_DEFAULT; - $this->name = 'jfChat Authentication Plugin'; - $this->author = 'b1gMail Project'; - $this->web = 'https://www.b1gmail.org/'; - $this->mail = 'info@b1gmail.org'; - $this->version = '1.2'; - - // admin pages - $this->admin_pages = true; - $this->admin_page_title = 'jfChat-Auth'; - } - - /** - * get list of domains - * - * @return array - */ - private function _getDomains() - { - global $bm_prefs; - - if(function_exists('GetDomainList')) - return GetDomainList(); - else - return explode(':', $bm_prefs['domains']); - } - - /** - * installation routine - * - * @return bool - */ - function Install() - { - global $db, $bm_prefs; - - // create prefs table - $db->Query('CREATE TABLE {pre}jfchat_plugin_prefs(enableAuth tinyint(4) NOT NULL DEFAULT 0, mysqlHost varchar(128) NOT NULL, mysqlUser varchar(128) NOT NULL, mysqlPass varchar(128) NOT NULL, mysqlDB varchar(128) NOT NULL, mysqlPrefix varchar(128) NOT NULL, userDomain varchar(128) NOT NULL)'); - - // insert initial row - list($domain) = explode(':', $bm_prefs['domains']); - $db->Query('REPLACE INTO {pre}jfchat_plugin_prefs(enableAuth, mysqlHost, mysqlUser, mysqlPass, mysqlDB, mysqlPrefix, userDomain) VALUES' - . '(?,?,?,?,?,?,?)', - 0, - 'localhost', - 'jfchat-user', - 'password', - 'jfchat', - 'fwc_', - $domain); - - return(true); - } - - /** - * uninstallation routine - * - * @return bool - */ - function Uninstall() - { - global $db; - - // drop prefs table - $db->Query('DROP TABLE {pre}jfchat_plugin_prefs'); - - return(true); - } - - /** - * authentication handler - * - * @param string $userName - * @param string $userDomain - * @param string $passwordMD5 - * @return array - */ - function OnAuthenticate($userName, $userDomain, $passwordMD5, $passwordPlain = '') - { - global $db, $bm_prefs; - - // get config - $res = $db->Query('SELECT * FROM {pre}jfchat_plugin_prefs LIMIT 1'); - $jfchat_prefs = $res->FetchArray(); - $res->Free(); - - // enabled? - if($jfchat_prefs['enableAuth'] != 1) - return(false); - - // our domain? - if(strtolower($userDomain) != strtolower($jfchat_prefs['userDomain'])) - return(false); - - // connect to jfChat DB - $mysql = @mysqli_connect($jfchat_prefs['mysqlHost'], $jfchat_prefs['mysqlUser'], $jfchat_prefs['mysqlPass'], true); - if($mysql) - { - if(mysqli_select_db($jfchat_prefs['mysqlDB'], $mysql)) - { - $jfchatDB = new DB($mysql); - - // search user - $res = $jfchatDB->Query('SELECT `username`,`password`,`emailadresse`,`wohnort` FROM ' . $jfchat_prefs['mysqlPrefix'] . 'registry WHERE `username`=?', - $userName); - if($res->RowCount() == 0) - return(false); - $row = $res->FetchArray(MYSQLI_ASSOC); - $res->Free(); - - // check password - if($row['password'] === $passwordMD5) - { - $uid = sprintf($this->_uidFormat, $row['username']); - $myUserName = sprintf('%s@%s', $userName, $userDomain); - - // create user in b1gMail? - if(BMUser::GetID($myUserName) == 0) - { - PutLog(sprintf('Creating b1gMail user for jfChat user <%s>', - $userName), - PRIO_PLUGIN, - __FILE__, - __LINE__); - $bmUID = BMUser::CreateAccount($myUserName, - '', - '', - '', - '', - '', - $row['wohnort'], - $bm_prefs['std_land'], - '', - '', - $row['emailadresse'], - '', - $passwordMD5, - array(), - true, - $uid); - } - - // return - $result = array( - 'uid' => $uid, - 'profile' => array( - 'altmail' => $row['emailadresse'], - 'ort' => $row['wohnort'] - ) - ); - return($result); - } - else - return(false); - } - else - PutLog('Failed to select jfChat db', - PRIO_PLUGIN, - __FILE__, - __LINE__); - - unset($jfchatDB); - mysqli_close($mysql); - } - else - PutLog('MySQL connection to jfChat db failed', - PRIO_PLUGIN, - __FILE__, - __LINE__); - - return(false); - } - - /** - * user page handler - * - */ - function FileHandler($file, $action) - { - global $userRow; - - if(!isset($userRow) || !is_array($userRow)) - return(false); - - if(strpos($userRow['uid'], substr($this->_uidFormat, 0, strpos($this->_uidFormat, ':')+1)) === false || $userRow['vorname'] != '' || $userRow['nachname'] != '') - return(false); - - $file = strtolower($file); - $action = strtolower($action); - - if($file != 'index.php' && ($file != 'prefs.php' || $action != 'contact') - && ($file != 'start.php' || $action != 'logout')) - { - header('Location: prefs.php?action=contact&sid=' . session_id()); - exit(); - } - } - - /** - * admin handler - * - */ - function AdminHandler() - { - global $tpl, $plugins, $lang_admin; - - if(!isset($_REQUEST['action'])) - $_REQUEST['action'] = 'prefs'; - - $tabs = array( - 0 => array( - 'title' => $lang_admin['prefs'], - 'link' => $this->_adminLink() . '&', - 'active' => $_REQUEST['action'] == 'prefs' - ) - ); - - $tpl->assign('tabs', $tabs); - - if($_REQUEST['action'] == 'prefs') - $this->_prefsPage(); - } - - /** - * admin prefs page - * - */ - function _prefsPage() - { - global $tpl, $db, $bm_prefs; - - // save? - if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') - { - $db->Query('UPDATE {pre}jfchat_plugin_prefs SET enableAuth=?,mysqlHost=?,mysqlUser=?,mysqlPass=?,mysqlDB=?,mysqlPrefix=?,userDomain=?', - isset($_REQUEST['enableAuth']) ? 1 : 0, - $_REQUEST['mysqlHost'], - $_REQUEST['mysqlUser'], - $_REQUEST['mysqlPass'], - $_REQUEST['mysqlDB'], - $_REQUEST['mysqlPrefix'], - trim($_REQUEST['userDomain'])); - } - - // get config - $res = $db->Query('SELECT * FROM {pre}jfchat_plugin_prefs LIMIT 1'); - $jfchat_prefs = $res->FetchArray(); - $res->Free(); - - // assign - $tpl->assign('domains', $this->_getDomains()); - $tpl->assign('jfchat_prefs', $jfchat_prefs); - $tpl->assign('pageURL', $this->_adminLink()); - $tpl->assign('page', $this->_templatePath('jfchatauth.plugin.prefs.tpl')); - } -} - -/** - * register plugin - */ -$plugins->registerPlugin('jfChatAuthPlugin'); -?> \ No newline at end of file diff --git a/src/plugins/koobi7.auth.php b/src/plugins/koobi7.auth.php deleted file mode 100644 index d365de7..0000000 --- a/src/plugins/koobi7.auth.php +++ /dev/null @@ -1,332 +0,0 @@ -type = BMPLUGIN_DEFAULT; - $this->name = 'Koobi7 Authentication Plugin'; - $this->author = 'b1gMail Project'; - $this->web = 'https://www.b1gmail.org/'; - $this->mail = 'ps@b1g.de'; - $this->version = '1.2'; - - // admin pages - $this->admin_pages = true; - $this->admin_page_title = 'Koobi7-Auth'; - $this->admin_page_icon = "koobi32.png"; - } - - /** - * get list of domains - * - * @return array - */ - private function _getDomains() - { - global $bm_prefs; - - if(function_exists('GetDomainList')) - return GetDomainList(); - else - return explode(':', $bm_prefs['domains']); - } - - /** - * installation routine - * - * @return bool - */ - function Install() - { - global $db, $bm_prefs; - - // create prefs table - $db->Query('CREATE TABLE {pre}koobi7_plugin_prefs(enableAuth tinyint(4) NOT NULL DEFAULT 0, mysqlHost varchar(128) NOT NULL, mysqlUser varchar(128) NOT NULL, mysqlPass varchar(128) NOT NULL, mysqlDB varchar(128) NOT NULL, mysqlPrefix varchar(128) NOT NULL, userDomain varchar(128) NOT NULL)'); - - // insert initial row - list($domain) = explode(':', $bm_prefs['domains']); - $db->Query('REPLACE INTO {pre}koobi7_plugin_prefs(enableAuth, mysqlHost, mysqlUser, mysqlPass, mysqlDB, mysqlPrefix, userDomain) VALUES' - . '(?,?,?,?,?,?,?)', - 0, - 'localhost', - 'koobi7-user', - 'password', - 'koobi7', - 'koobi7_', - $domain); - - return(true); - } - - /** - * uninstallation routine - * - * @return bool - */ - function Uninstall() - { - global $db; - - // drop prefs table - $db->Query('DROP TABLE {pre}koobi7_plugin_prefs'); - - return(true); - } - - /** - * authentication handler - * - * @param string $userName - * @param string $userDomain - * @param string $passwordMD5 - * @return array - */ - function OnAuthenticate($userName, $userDomain, $passwordMD5, $passwordPlain = '') - { - global $db, $bm_prefs; - - // get config - $res = $db->Query('SELECT * FROM {pre}koobi7_plugin_prefs LIMIT 1'); - $koobi7_prefs = $res->FetchArray(); - $res->Free(); - - // enabled? - if($koobi7_prefs['enableAuth'] != 1) - return(false); - - // our domain? - if(strtolower($userDomain) != strtolower($koobi7_prefs['userDomain'])) - return(false); - - // connect to koobi7 DB - $mysql = @mysqli_connect($koobi7_prefs['mysqlHost'], $koobi7_prefs['mysqlUser'], $koobi7_prefs['mysqlPass'], true); - if($mysql) - { - if(mysqli_select_db($koobi7_prefs['mysqlDB'], $mysql)) - { - $koobi7DB = new DB($mysql); - - // search user - $res = $koobi7DB->Query('SELECT `Id`,`Kennwort`,`Email`,`Vorname`,`Nachname`,`Strasse_Nr`,`Postleitzahl`,`Ort`,`Telefon`,`Telefax`,`Land` FROM ' . $koobi7_prefs['mysqlPrefix'] . 'benutzer WHERE `Benutzername`=? AND `Aktiv`=1', - $userName); - if($res->RowCount() == 0) - return(false); - $row = $res->FetchArray(MYSQLI_ASSOC); - $res->Free(); - - // check password - if(md5($passwordMD5) === $row['Kennwort']) - { - $uid = sprintf($this->_uidFormat, $row['Id']); - $myUserName = sprintf('%s@%s', $userName, $userDomain); - - // split street/no - $strasseNrParts = explode(' ', $row['Strasse_Nr']); - if(count($strasseNrParts) > 1) - { - $no = array_pop($strasseNrParts); - $street = implode(' ', $strasseNrParts); - } - else - { - $street = $row['Strasse_Nr']; - $no = ''; - } - - // find country - $countries = CountryList(); - $country = $bm_prefs['std_land']; - foreach($countries as $countryID=>$countryName) - if($countryName == $row['Land']) - { - $country = $countryID; - break; - } - - // create user in b1gMail? - if(BMUser::GetID($myUserName) == 0) - { - PutLog(sprintf('Creating b1gMail user for Koobi7 user <%s> (%d)', - $userName, - $row['Id']), - PRIO_PLUGIN, - __FILE__, - __LINE__); - $bmUID = BMUser::CreateAccount($myUserName, - $row['Vorname'], - $row['Nachname'], - $street, - $no, - $row['Postleitzahl'], - $row['Ort'], - $country, - $row['Telefon'], - $row['Telefax'], - $row['Email'], - '', - $passwordMD5, - array(), - true, - $uid); - } - - // return - $result = array( - 'uid' => $uid, - 'profile' => array( - 'altmail' => $row['Email'], - 'vorname' => $row['Vorname'], - 'nachname' => $row['Nachname'], - 'strasse' => $street, - 'hnr' => $no, - 'plz' => $row['Postleitzahl'], - 'ort' => $row['Ort'], - 'land' => $country, - 'tel' => $row['Telefon'], - 'fax' => $row['Telefax'] - ) - ); - return($result); - } - else - return(false); - } - else - PutLog('Failed to select koobi7 db', - PRIO_PLUGIN, - __FILE__, - __LINE__); - - unset($koobi7DB); - mysqli_close($mysql); - } - else - PutLog('MySQL connection to koobi7 db failed', - PRIO_PLUGIN, - __FILE__, - __LINE__); - - return(false); - } - - /** - * user page handler - * - */ - function FileHandler($file, $action) - { - global $userRow; - - if(!isset($userRow) || !is_array($userRow)) - return(false); - - if(strpos($userRow['uid'], substr($this->_uidFormat, 0, strpos($this->_uidFormat, ':')+1)) === false || $userRow['vorname'] != '' || $userRow['nachname'] != '') - return(false); - - $file = strtolower($file); - $action = strtolower($action); - - if($file != 'index.php' && ($file != 'prefs.php' || $action != 'contact') - && ($file != 'start.php' || $action != 'logout')) - { - header('Location: prefs.php?action=contact&sid=' . session_id()); - exit(); - } - } - - /** - * admin handler - * - */ - function AdminHandler() - { - global $tpl, $plugins, $lang_admin; - - if(!isset($_REQUEST['action'])) - $_REQUEST['action'] = 'prefs'; - - $tabs = array( - 0 => array( - 'title' => $lang_admin['prefs'], - 'link' => $this->_adminLink() . '&', - 'active' => $_REQUEST['action'] == 'prefs' - ) - ); - - $tpl->assign('tabs', $tabs); - - if($_REQUEST['action'] == 'prefs') - $this->_prefsPage(); - } - - /** - * admin prefs page - * - */ - function _prefsPage() - { - global $tpl, $db, $bm_prefs; - - // save? - if(isset($_REQUEST['do']) && $_REQUEST['do'] == 'save') - { - $db->Query('UPDATE {pre}koobi7_plugin_prefs SET enableAuth=?,mysqlHost=?,mysqlUser=?,mysqlPass=?,mysqlDB=?,mysqlPrefix=?,userDomain=?', - isset($_REQUEST['enableAuth']) ? 1 : 0, - $_REQUEST['mysqlHost'], - $_REQUEST['mysqlUser'], - $_REQUEST['mysqlPass'], - $_REQUEST['mysqlDB'], - $_REQUEST['mysqlPrefix'], - trim($_REQUEST['userDomain'])); - } - - // get config - $res = $db->Query('SELECT * FROM {pre}koobi7_plugin_prefs LIMIT 1'); - $koobi7_prefs = $res->FetchArray(); - $res->Free(); - - // assign - $tpl->assign('domains', $this->_getDomains()); - $tpl->assign('koobi7_prefs', $koobi7_prefs); - $tpl->assign('pageURL', $this->_adminLink()); - $tpl->assign('page', $this->_templatePath('koobi7auth.plugin.prefs.tpl')); - } -} - -/** - * register plugin - */ -$plugins->registerPlugin('Koobi7AuthPlugin'); -?> \ No newline at end of file diff --git a/src/plugins/templates/images/koobi32.png b/src/plugins/templates/images/koobi32.png deleted file mode 100644 index 324f6a35633792ab391d52038ea3983a45155d7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 640 zcmV-`0)PF9P)WTlQ5PXOR0&7t$ka6*zK(w+q<8o(8v<1tY6NeM1P#rt?Ay9#h z172Df+#*fSpQIe%mK3z$o#wR zRf%y733Cs#Rl`v`_YrF+Al}xBw{B_ex$TLE-FaZ4a(2wZ^X9|}ffuyqAqj{~jzX@f`K1rQ${!H-t(&X*AwuOs-uZONK0 zr&I_yrMaVd;$Pf!cb2Sn0+*6-?h&a9oTz_wEO@X2E#L}FFY&&p<=VLmvXCbT=|Cmy zvB6QzrB0|dfflDDQAPF;ubmU<0p6&Jv5qJNZfd_5VcC`<5(>eYR5xI}5hTFJbPpBv zS0Dm>+d~x_Z_PS^U7)NpcVQ1zJX^Ec>?R0MwweY3tDzZM$d5f*8Il;TfQTLd0000 - {lng p="prefs"} - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{lng p="enable"}?
MySQL {lng p="host"}:
MySQL {lng p="user"}:
MySQL {lng p="password"}:
MySQL {lng p="db"}:
MySQL Prefix:
{lng p="user"}-{lng p="domain"}:
-

-

- -
-

-
- \ No newline at end of file diff --git a/src/plugins/templates/koobi7auth.plugin.prefs.tpl b/src/plugins/templates/koobi7auth.plugin.prefs.tpl deleted file mode 100644 index e06a233..0000000 --- a/src/plugins/templates/koobi7auth.plugin.prefs.tpl +++ /dev/null @@ -1,46 +0,0 @@ -
- {lng p="prefs"} - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{lng p="enable"}?
MySQL {lng p="host"}:
MySQL {lng p="user"}:
MySQL {lng p="password"}:
MySQL {lng p="db"}:
MySQL Prefix:
{lng p="user"}-{lng p="domain"}:
-

-

- -
-

-
-
\ No newline at end of file