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.
Reply
 
Thread Tools Display Modes
  #11  
Old 5th December 2010, 15:04
madmucho madmucho is offline
Senior Member
 
Join Date: Oct 2006
Location: Czech republic, Karlovy Vary
Posts: 158
Thanks: 78
Thanked 11 Times in 11 Posts
Send a message via ICQ to madmucho
Default new test acc

Heloo that was new email address and new profile. I dont see any error in roundcubemail log.
Reply With Quote
Sponsored Links
  #12  
Old 6th December 2010, 18:58
necromncr necromncr is offline
Junior Member
 
Join Date: Jul 2008
Posts: 9
Thanks: 1
Thanked 6 Times in 3 Posts
Default

Quote:
Originally Posted by madmucho View Post
Heloo that was new email address and new profile. I dont see any error in roundcubemail log.
Oh, sorry I'll give it a look.
Reply With Quote
  #13  
Old 8th December 2010, 12:04
smartcms smartcms is offline
Junior Member
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 2 Times in 1 Post
Default

Thanks necromncr for your plugin. It was just what we were looking for.

However I think we had the same problem as madmucho, and we found the following problems:
- The rcmail->db class doesn't seem to like the parameters ( ? ) in the query.
- It's trying to update the identities table using identity_id = $rcmail->user->data['user_id']
- The latest version of ISPConfig 2 seems to be using the user_email field insterad of the user_emailalias field

So we updated ispconfig_addons.php like this:
Code:
<?php

/**                                                                                                                                                                                                            
 * ISPConfig v2.x integration for Roundcube 0.4.2 plugin                                                                                                                                                       
 *                                                                                                                                                                                                             
 * Adds ability to authenticate against ISPConfig 2.x user database.                                                                                                                                           
 *                                                                                                                                                                                                             
 * To use you must have config.inc.php file following settings:                                                                                                                                                
 * isp_db_name - ISPConfig database name                                                                                                                                                                       
 * isp_db_user - user with access to only selected fields in selected tables                                                                                                                                   
 * isp_db_pass - password for that user                                                                                                                                                                        
 *                                                                                                                                                                                                             
 * Code is tested however there is no waranty for it. Use at your own risk. Feedback is welcome!                                                                                                               
 *                                                                                                                                                                                                             
 * @version 0.1                                                                                                                                                                                                
 * @author Janez Dolinar s.p., <info@tuksi.net>                                                                                                                                                                
 */   
class ispconfig_addons extends rcube_plugin
{  
  function init()
  {
    $this->add_hook('user_create', array($this, 'usercreate'));
    $this->add_hook('login_after', array($this, 'loginafter'));

    $this->load_config();
  }
                                                                                                                                                                                                               
  function loginafter($query) {                                                                                                                                                                                
    $rcmail = rcmail::get_instance();                                                                                                                                                                          
                                                                                                                                                                                                               
    if (isset($_SESSION['userFullName'])) {                                                                                                                                                                    
      $sql = "UPDATE identities SET name='" . $_SESSION['userFullName'] . "', email='" . $_SESSION['userEmail'] . "' WHERE user_id = " . $rcmail->user->data['user_id'];                                                                                                                                    
                                                                                                                                                                                                               
      $rcmail->db->query($sql);                                                                                           
                                                                                                                                                                                                               
      unset($_SESSION['userFullName']);                                                                                                                                                                        
      unset($_SESSION['userEmail']);                                                                                                                                                                           
    }                                                                                                                                                                                                          
    return $query;
  }
  
  
  function usercreate($args)
  {
    $rcmail = rcmail::get_instance();
    if (($rcmail->config->get('isp_db_name')=='') || ($rcmail->config->get('isp_db_user')=='') || ($rcmail->config->get('isp_db_pass')=='')) {
      return $args;
    } else {
      $sql = "SELECT iiu.user_username, iiu.user_email, iiu.user_name, iid.web_domain FROM isp_isp_user iiu, isp_dep id, isp_isp_web iid "
            ."WHERE iiu.user_username = '%s'  AND iiu.doc_id = id.child_doc_id  AND id.child_doctype_id = 1014  AND iid.doc_id = id.parent_doc_id";
            
      $mysql = new MySQLi('localhost', $rcmail->config->get('isp_db_user'), $rcmail->config->get('isp_db_pass'), $rcmail->config->get('isp_db_name'));
      
      if ($mysql->connect_error) return false;
      $result = $mysql->query(sprintf($sql,addslashes($args['user'])));

      if ($result) {
        $row = $result->fetch_object();
        $userEmail = explode("\n",str_replace("\r","",$row->user_email));
        $args['alias'] = $userEmail[0].'@'.$row->web_domain;
        $_SESSION['userFullName'] = $row->user_name;
        $_SESSION['userEmail'] = $userEmail[0].'@'.$row->web_domain;
        $result->close();
      }
      
      $mysql->close();
    }
  
    return $args;
  }

}
?>

Remember to update the permissions of your roundcube MySQL user to grant select on the user_email field instead of the user_emailalias field.

We also had to change the following parameters in the roundcube config main.inc.php:
Code:
$rcmail_config['identities_level'] = 3;
before we had
Code:
$rcmail_config['identities_level'] = 1;
Hope this helps someone!

/ Andreas & Niklas
smartcms.se
Reply With Quote
The Following 2 Users Say Thank You to smartcms For This Useful Post:
falko (9th December 2010), madmucho (22nd August 2011)
  #14  
Old 16th February 2011, 20:02
amoniak amoniak is offline
Junior Member
 
Join Date: Apr 2008
Posts: 14
Thanks: 2
Thanked 2 Times in 1 Post
Default

hello

I have just checked the roundcube website and there is a version 0.5.1 out already - can anyone give me a hint if the install instructions for ispconfig 2 are the same as described here, or are there new instructions...?

currently I already hvae 04. roundcube running on the server with ispconfig 2

would be happy if anyone could help

all best and thx
dan
Reply With Quote
  #15  
Old 17th February 2011, 22:40
Hans Hans is offline
Moderator
 
Join Date: Dec 2005
Location: Montfoort, The Netherlands
Posts: 2,256
Thanks: 211
Thanked 648 Times in 294 Posts
Send a message via Skype™ to Hans
Default

I see what i can do..
__________________
Hans

BB-Hosting | Quality Web Hosting since 2005
Reply With Quote
  #16  
Old 24th June 2011, 14:15
kextra1 kextra1 is offline
Senior Member
 
Join Date: Apr 2008
Posts: 118
Thanks: 6
Thanked 6 Times in 4 Posts
Default Can't wait to try this out!

Wow, thanks necromancr... I've been away for awhile so I wish I saw this earlier.

I can't wait to try this out. Plus I already use MySQLite er i mean MySQLi instead of regular mysql for roundcube anyways so I don't have to go the opposite way for a change .

I will most definitely give this a try.

Much thanks.
Reply With Quote
  #17  
Old 22nd August 2011, 09:59
madmucho madmucho is offline
Senior Member
 
Join Date: Oct 2006
Location: Czech republic, Karlovy Vary
Posts: 158
Thanks: 78
Thanked 11 Times in 11 Posts
Send a message via ICQ to madmucho
 
Default Working ok

Version: 2.2.40 after update roundcubemail plugin files all working correctly, thank you.
Reply With Quote
Reply

Bookmarks

Tags
ispconfig 2, roundcube, webmail

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
Which XEN howto is recommended for webhosting? Hans HOWTO-Related Questions 2 29th June 2009 18:23


All times are GMT +2. The time now is 14:22.


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