Prechádzať zdrojové kódy

change header, add wbb2 plugin files

Sebijk 3 rokov pred
rodič
commit
6a8c9a281f

BIN
src/plugins/templates/images/wbb2.png


+ 50 - 0
src/plugins/templates/wbb2auth.plugin.prefs.tpl

@@ -0,0 +1,50 @@
+<fieldset>
+	<legend>{lng p="prefs"}</legend>
+	
+	<form action="{$pageURL}&sid={$sid}&do=save" method="post" onsubmit="spin(this)">
+	<table>
+		<tr>
+			<td align="left" rowspan="8" valign="top" width="40"><img src="../plugins/templates/images/wbb2.png" border="0" alt="" width="32" height="32" /></td>
+			<td class="td1" width="160">{lng p="enable"}?</td>
+			<td class="td2"><input name="enableAuth"{if $wbb2_prefs.enableAuth} checked="checked"{/if} type="checkbox" /></td>
+		</tr>
+		<tr>
+			<td class="td1">MySQL {lng p="host"}:</td>
+			<td class="td2"><input type="text" name="mysqlHost" value="{text value=$wbb2_prefs.mysqlHost}" size="36" /></td>
+		</tr>
+		<tr>
+			<td class="td1">MySQL {lng p="user"}:</td>
+			<td class="td2"><input type="text" name="mysqlUser" value="{text value=$wbb2_prefs.mysqlUser}" size="36" /></td>
+		</tr>
+		<tr>
+			<td class="td1">MySQL {lng p="password"}:</td>
+			<td class="td2"><input type="password" name="mysqlPass" value="{text value=$wbb2_prefs.mysqlPass}" size="36" /></td>
+		</tr>
+		<tr>
+			<td class="td1">MySQL {lng p="db"}:</td>
+			<td class="td2"><input type="text" name="mysqlDB" value="{text value=$wbb2_prefs.mysqlDB}" size="36" /></td>
+		</tr>
+		<tr>
+			<td class="td1">MySQL Prefix:</td>
+			<td class="td2"><input type="text" name="mysqlPrefix" value="{text value=$wbb2_prefs.mysqlPrefix allowEmpty=true}" size="36" /></td>
+		</tr>
+		<tr>
+			<td class="td1">{lng p="user"}-{lng p="domain"}:</td>
+			<td class="td2"><select name="userDomain">
+			{foreach from=$domains item=domain}
+				<option value="{$domain}"{if $wbb2_prefs.userDomain==$domain} selected="selected"{/if}>{$domain}</option>
+			{/foreach}
+			</select></td>
+		</tr>
+		<tr>
+			<td class="td1" width="160">{lng p="user"}-{lng p="domain"} {lng p="signup"} {lng p="enable"}?</td>
+			<td class="td2"><input name="enableReg"{if $wbb2_prefs.enableReg} checked="checked"{/if} type="checkbox" /></td>
+		</tr>
+	</table>
+	<p>
+		<div style="float:right;">
+			<input type="submit" value=" {lng p="save"} " />
+		</div>
+	</p>
+	</form>
+</fieldset>

+ 37 - 14
src/plugins/wbb2.auth.php

@@ -1,10 +1,21 @@
 <?php
 <?php
 /*
 /*
  * b1gMail wbb2 auth plugin
  * b1gMail wbb2 auth plugin
- * (c) 2002-2008 B1G Software and (c) 2009 IND-InterNetDienst Schlei
- * 
- * Redistribution of this code without explicit permission
- * is forbidden!
+ * (c) 2021 Patrick Schlangen et al, (c) 2009 IND-InterNetDienst Schlei
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *
  */
  */
 
 
@@ -23,25 +34,37 @@ class wbb2AuthPlugin extends BMPlugin
 	 */
 	 */
 	function __construct()
 	function __construct()
 	{
 	{
-		// extract version
-		sscanf('$Revision: 1.0 $', chr(36) . 'Revision: %d.%d ' . chr(36),
-			$vMajor,
-			$vMinor);
 		
 		
 		// plugin info
 		// plugin info
 		$this->name					= 'wbb2 Authentication Plugin';
 		$this->name					= 'wbb2 Authentication Plugin';
-		$this->author			    = 'IND-InterNetDienst Schlei';
+		$this->author			    = 'b1gMail Project, IND-InterNetDienst Schlei';
 		$this->web					= 'http://www.ind.de/';
 		$this->web					= 'http://www.ind.de/';
 		$this->mail					= 'b1gmail.com@ind.de';
 		$this->mail					= 'b1gmail.com@ind.de';
-		$this->version				= sprintf('%d.%d', $vMajor, $vMinor);
-		$this->designedfor			= '7.1.0';
+		$this->version				= '1.0.1';
 		$this->type             	= BMPLUGIN_DEFAULT;
 		$this->type             	= BMPLUGIN_DEFAULT;
 		$this->update_url       	= 'http://my.b1gmail.com/update_service/';
 		$this->update_url       	= 'http://my.b1gmail.com/update_service/';
 		
 		
 		// admin pages
 		// admin pages
 		$this->admin_pages				= true;
 		$this->admin_pages				= true;
 		$this->admin_page_title			= 'wbb2-Auth';
 		$this->admin_page_title			= 'wbb2-Auth';
+		$this->admin_page_icon		= "wbb2.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
 	 * installation routine
@@ -102,7 +125,7 @@ class wbb2AuthPlugin extends BMPlugin
         	// Domainliste ggf. neu erstellen, wenn Registrierung ueber UserDomain nicht mehr gewuenscht
         	// Domainliste ggf. neu erstellen, wenn Registrierung ueber UserDomain nicht mehr gewuenscht
 		if($wbb2_prefs['enableReg']==0)
 		if($wbb2_prefs['enableReg']==0)
 		{
 		{
-        		$domains = explode(':', $bm_prefs['domains']);
+        		$domains = $this->_getDomains();
 
 
 	        	foreach($domains as $domain) {
 	        	foreach($domains as $domain) {
 	        		if($domain != $wbb2_prefs['userDomain'])
 	        		if($domain != $wbb2_prefs['userDomain'])
@@ -151,7 +174,7 @@ class wbb2AuthPlugin extends BMPlugin
 				$wbb2DB = new DB($mysql);
 				$wbb2DB = new DB($mysql);
 				
 				
 				// search user
 				// search user
-				$res = $wbb2DB->Query('SELECT `userID`,`password`,`sha1_password`,`email` FROM ' . $wbb2_prefs['mysqlPrefix'] . 'users WHERE `username`=? AND `activation`=1 AND `blocked`=0',
+				$res = $wbb2DB->Query('SELECT userid,password,email FROM ' . $wbb2_prefs['mysqlPrefix'] . 'users WHERE username=? AND activation=1 AND blocked=0',
 					$userName);
 					$userName);
 				if($res->RowCount() == 0)
 				if($res->RowCount() == 0)
 					return(false);
 					return(false);
@@ -303,7 +326,7 @@ class wbb2AuthPlugin extends BMPlugin
 		$res->Free();
 		$res->Free();
 			
 			
 		// assign
 		// assign
-		$tpl->assign('domains', explode(':', $bm_prefs['domains']));
+		$tpl->assign('domains', $this->_getDomains());
 		$tpl->assign('wbb2_prefs', $wbb2_prefs);
 		$tpl->assign('wbb2_prefs', $wbb2_prefs);
 		$tpl->assign('pageURL', $this->_adminLink());
 		$tpl->assign('pageURL', $this->_adminLink());
 		$tpl->assign('page', $this->_templatePath('wbb2auth.plugin.prefs.tpl'));
 		$tpl->assign('page', $this->_templatePath('wbb2auth.plugin.prefs.tpl'));