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.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 17th April 2006, 06:08
hastlaug hastlaug is offline
Member
 
Join Date: Apr 2006
Posts: 30
Thanks: 0
Thanked 1 Time in 1 Post
Default Some hints for Horde IMP with ISPConfig

Although this post seems long: Read it - it's (almost) just copy and paste in 2 positions. No big changes. Don't be afraid

If you setup Horde IMP as webmailer, you might want to have the sender mail address and the sender name correctly be set.

That's not that easy because you need (non-existing) hook functions retrieving the data. But as I wrote such functions for me, you don't need to do this again

First locate the horde config files.
In horde3/config/prefs.php change the following:

Code:
$_prefs['fullname'] = array(
    'value' => '',
    'locked' => false,
    'shared' => true,
    'type' => 'text',
    'hook' => true,
    'desc' => _("Your full name:")
);

$_prefs['from_addr'] = array(
    'value' => '',
    'locked' => true,
    'shared' => true,
    'type' => 'text',
    'hook' => true,
    'desc' =>  _("Your From: address:")
);
Especially 'hook' has to be true. I suggest setting 'locked' of 'from_addr' to true if you don't want users to be able to modify their from-address.

Then you have to add the following to your horde3/config/hooks.php:

Code:
if (!function_exists('_prefs_hook_from_addr')) {
  function _prefs_hook_from_addr($user=null) {
    $dsn = 'mysql://sqluser:sqlpass@localhost/db_ispconfig';

    if (is_null($user)) {
      $user = Auth::getAuth();
    }

    $db =& DB::connect($dsn, true);
    if (PEAR::isError($db)) {
      return $user;
    }

    $query  = 'SELECT user_email,domain_domain FROM (isp_isp_user INNER JOIN isp_dep ON (isp_isp_user.doc_id=child_doc_id AND isp_isp_user.doctype_id=child_doctype_id))';
    $query .= ' INNER JOIN isp_isp_domain ON (parent_doc_id=isp_isp_domain.doc_id AND parent_doctype_id=isp_isp_domain.doctype_id) WHERE user_username=' . $db->quote($user);
    $result =& $db->query($query);

    if ($result->fetchInto($row, DB_FETCHMODE_ASSOC)) {
      $return = $row['user_email'] . "@" . $row['domain_domain'];
    } else {
      $return = $query;
    }

    $db->disconnect();

    return $return;
  }
}

if (!function_exists('_prefs_hook_fullname')) {
  function _prefs_hook_fullname($user=null) {
    $dsn = 'mysql://sqluser:sqlpass@localhost/db_ispconfig';

    if (is_null($user)) {
      $user = Auth::getAuth();
    }

    $db =& DB::connect($dsn, true);
    if (PEAR::isError($db)) {
      return $user;
    }

    $query = 'SELECT * FROM isp_isp_user WHERE user_username=' . $db->quote($user);
    $result =& $db->query($query);

    if ($result->fetchInto($row, DB_FETCHMODE_ASSOC)) {
      $return = $row['user_name'];
    } else {
      $return = $user;
    }

    $db->disconnect();

    return $return;
  }
}
Make sure you replace sqluser by your sql user with sufficient rights to query the ispconfig database and replace sqlpassword by its password. Maybe you also want to replace localhost by the correct sql server and db_ispconfig by the correct sql database. Please note that you have these changes TWO times in the code above.

Done

Last edited by hastlaug; 18th April 2006 at 00:37.
Reply With Quote
The Following User Says Thank You to hastlaug For This Useful Post:
ghesty (17th August 2007)
Sponsored Links
 

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
cannot access ispconfig site Nu2Linux Installation/Configuration 13 3rd January 2009 15:29
FC4 Setup DNS and ISPCONFIG issues The General Installation/Configuration 7 15th May 2006 09:45
Users and websites aren't created Glorfindel Installation/Configuration 9 23rd February 2006 04:20
42goISP vs. ISPConfig nveid General 1 16th January 2006 09:07
Mirroring ISPConfig with DRBD rodriglm General 5 2nd January 2006 12:48


All times are GMT +2. The time now is 19:03.


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