Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Tips/Tricks/Mods

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
View Poll Results: Is this of any interest?
No, you can't code, don't post anything else! 0 0%
Probably not, thanks anyway 0 0%
Yes!, how do you install it again? 1 100.00%
Yes, yes! this is just what I've been looking for, do you want a job? 0 0%
Voters: 1. You may not vote on this poll

Reply
 
Thread Tools Display Modes
  #1  
Old 27th February 2006, 13:22
fcl fcl is offline
Junior Member
 
Join Date: Feb 2006
Location: UK, North West
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
 
Post UebiMiau username lookup patches

So, I've been having fun with ISPConfig for a few months now (after having finally wrestled it onto my Slackware 10.2 distro!).

It's a nice system, we've just migrated a collection of remote mail users over to it, and in doing so I had to "fix" some usability issues with the UebiMiau implementation.

These patches do the following:

E-Mail address login is no longer case sensitive.

ISPConfig mail username can now be used as login (but NOT first time through!)

On first login, ISPConfig stored name and mail address are used as the default Name and "Reply-to", NOT mail username.

Note that though I learn't to read by reading K&R ( ;) ), I'm new to PHP (indeed, everything I know about PHP I learned by hacking this and ISPConfig), so whilst what I've done works, I make no guarantee that it's the most elegant solution, just mine!

Two files modified, msglist.php and inc/lib.php, both live in the webmail directory of your admispconfig web dir (which is /home/admispconfig/ispconfig/web/webmail on my box).

PATCHES (diff unified, should be suitable for patch) follow:

--- msglist.php 2005-05-26 13:49:35.000000000 +0100
+++ msglist.php 2006-02-27 10:46:42.000000000 +0000
@@ -16,41 +16,55 @@
$dbname = 'db_'.$go_info["server"]["db_type"];
$db = new $dbname;
if($f_email){
- list($alias,$domain) = explode("@", $f_email);
- $webs = $db->queryAllRecords("SELECT * from isp_isp_web, isp_nodes where isp_isp_web.doc_id = isp_nodes.doc_id and isp_nodes.doctype_id = '1013' and isp_isp_web.server_id = '1' and isp_nodes.status = '1'");
- if(!empty($webs)){
- foreach($webs as $web){
- if($web["web_host"] != ""){
- $domain_hosts[] = $web["web_host"].".".$web["web_domain"];
- } else {
- $domain_hosts[] = $web["web_domain"];
- }
- $codomains = $db->queryAllRecords("SELECT isp_isp_domain.domain_domain, isp_isp_domain.domain_host from isp_dep,isp_isp_domain where isp_dep.child_doc_id = isp_isp_domain.doc_id and isp_dep.child_doctype_id ='1015' and isp_dep.parent_doctype_id = '1013' and isp_dep.parent_doc_id = '".$web["doc_id"]."' and isp_isp_domain.status != 'd'");
- if(!empty($codomains)){
- foreach($codomains as $codomain){
- if($codomain["domain_host"] != ""){
- $domain_hosts[] = $codomain["domain_host"].".".$codomain["domain_domain"];
- } else {
- $domain_hosts[] = $codomain["domain_domain"];
+ if(strchr($f_email,'@')) {
+ list($alias,$domain) = explode("@", $f_email,2);
+ $domain_i = strtolower($domain);
+ $webs = $db->queryAllRecords("SELECT * from isp_isp_web, isp_nodes where isp_isp_web.doc_id = isp_nodes.doc_id and isp_nodes.doctype_id = '1013' and isp_isp_web.server_id = '1' and isp_nodes.status = '1'");
+ if(!empty($webs)){
+ foreach($webs as $web){
+ if($web["web_host"] != ""){
+ $tempdom = $domain_hosts[] = strtolower($tempdom_cs = ($web["web_host"].".".$web["web_domain"]));
+
+ } else {
+ $tempdom = $domain_hosts[] = strtolower($tempdom_cs = $web["web_domain"]);
+ }
+ $domain_hosts_cs[$tempdom]=$tempdom_cs;
+ $codomains = $db->queryAllRecords("SELECT isp_isp_domain.domain_domain, isp_isp_domain.domain_host from isp_dep,isp_isp_domain where isp_dep.child_doc_id = isp_isp_domain.doc_id and isp_dep.child_doctype_id ='1015' and isp_dep.parent_doctype_id = '1013' and isp_dep.parent_doc_id = '".$web["doc_id"]."' and isp_isp_domain.status != 'd'");
+ if(!empty($codomains)){
+ foreach($codomains as $codomain){
+ if($codomain["domain_host"] != ""){
+ $tempdom = $domain_hosts[] = strtolower($tempdom_cs = ($codomain["domain_host"].".".$codomain["domain_domain"]));
+ } else {
+ $tempdom = $domain_hosts[] = strtolower($tempdom_cs = $codomain["domain_domain"]);
+ }
+ $domain_hosts_cs[$tempdom]=$tempdom_cs;
}
}
- }
- if(in_array($domain, $domain_hosts)){
- $users = $db->queryAllRecords("SELECT * FROM isp_nodes, isp_dep, isp_isp_user WHERE isp_dep.parent_doc_id = '".$web["doc_id"]."' AND isp_dep.parent_doctype_id = '1013' AND isp_dep.child_doc_id = isp_isp_user.doc_id AND isp_dep.child_doctype_id = '1014' AND isp_nodes.doc_id = isp_isp_user.doc_id AND isp_nodes.doctype_id = '1014' AND isp_nodes.status = '1'");
- if(!empty($users)){
- foreach($users as $user){
- $aliasse = explode("\n", str_replace("\r\n", "\n", trim($user["user_emailalias"])));
- if(trim($user["user_email"]) != "") $aliasse[] = trim($user["user_email"]);
- $aliasse[] = trim($user["user_username"]);
- if(in_array($alias, $aliasse)) $f_email = $user["user_username"]."@".$domain;
+ if(in_array($domain_i, $domain_hosts)){
+ $users = $db->queryAllRecords("SELECT * FROM isp_nodes, isp_dep, isp_isp_user WHERE isp_dep.parent_doc_id = '".$web["doc_id"]."' AND isp_dep.parent_doctype_id = '1013' AND isp_dep.child_doc_id = isp_isp_user.doc_id AND isp_dep.child_doctype_id = '1014' AND isp_nodes.doc_id = isp_isp_user.doc_id AND isp_nodes.doctype_id = '1014' AND isp_nodes.status = '1'");
+ if(!empty($users)){
+ foreach($users as $user){
+ $aliasse = explode("\n", str_replace("\r\n", "\n", strtolower(trim($user["user_emailalias"]))));
+ if(trim($user["user_email"]) != "") $aliasse[] = strtolower(trim($user["user_email"]));
+ $aliasse[] = strtolower(trim($user["user_username"]));
+ if(in_array(strtolower($alias), $aliasse)) {
+ $f_email = $user["user_username"]."@".$domain;
+ $f_email_reply = $alias."@".$domain_hosts_cs[$domain_i];
+ $f_display_name = $user["user_name"];
+ }
unset($aliasse);
+ }
}
}
+ unset($domain_hosts);
+ unset($domain_hosts_cs);
}
- unset($domain_hosts);
}
+ } else {
+ $f_email = $f_email."@localhost";
}
}
+
//////////////////////// Map Alias to User Name (ISPConfig) ENDE ////////////////
require("./inc/inc.php");

--- inc/lib.php 2003-05-27 12:44:40.000000000 +0100
+++ inc/lib.php 2006-02-27 10:47:19.000000000 +0000
@@ -132,15 +132,23 @@

global $userfolder,
$sess,
- $default_preferences;
+ $default_preferences, $f_display_name, $f_email_reply;

extract($default_preferences);

$pref_file = $userfolder."_infos/prefs.upf";

if(!file_exists($pref_file)) {
- $prefs["real-name"] = UCFirst(substr($sess["email"],0,strpos($sess["email"],"@")));
- $prefs["reply-to"] = $sess["email"];
+ if(isset($f_display_name)) {
+ $prefs["real-name"] = $f_display_name;
+ } else {
+ $prefs["real-name"] = UCFirst(substr($sess["email"],0,strpos($sess["email"],"@")));
+ }
+ if(isset($f_email_reply)) {
+ $prefs["reply-to"] = $f_email_reply;
+ } else {
+ $prefs["reply-to"] = $sess["email"];
+ }
$prefs["save-to-trash"] = $send_to_trash_default;
$prefs["st-only-read"] = $st_only_ready_default;
$prefs["empty-trash"] = $empty_trash_default;
Reply With Quote
Sponsored Links
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Uebimiau and courier-imap: cannot create folders ddelbia General 7 6th April 2006 00:46
Login to Postfix via Uebimiau problem Qrup Installation/Configuration 10 15th February 2006 01:46
username generation Lord_Garfield General 1 25th October 2005 11:00
Mail not accepting username and password! nformosa General 9 14th September 2005 10:58
Webmail with uebimiau. cjkeeme General 8 4th August 2005 23:21


All times are GMT +2. The time now is 12:47.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.