Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #11  
Old 25th July 2008, 00:15
luchs3 luchs3 is offline
Member
 
Join Date: Sep 2007
Posts: 68
Thanks: 7
Thanked 0 Times in 0 Posts
Default

How does this patch work?

Is it possible to adapt it for RC?
In wich language is it written?
Reply With Quote
Sponsored Links
  #12  
Old 24th September 2009, 16:05
bswinnerton bswinnerton is offline
Senior Member
 
Join Date: Jul 2007
Location: Connecticut, US
Posts: 502
Thanks: 51
Thanked 17 Times in 14 Posts
Default

Not to bring back an old post, but I thought maybe something had changed from the old versions of ISPConfig until now.

Roundcube still uses this feature, Disk Usage:.. and it just states that it is unlimited.

So I believe what has to be done is that you have to configure imap to use quota. How would we go about doing that?

Thanks everyone
Reply With Quote
  #13  
Old 23rd January 2010, 05:23
johnwilson1969 johnwilson1969 is offline
Junior Member
 
Join Date: Jun 2007
Location: Ringgold, GA USA
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to johnwilson1969
Default Quick and Dirty Hack to get Roundcube to Show Quota Usage in ISPCONFIG2

I hammered this out today, just as a test. Need to refine and rewrite....

** Fixed error caused by quota output containing varying number of spaces as quota changes
** added comments for clarity

This is version 0.3.2

Basically, I am highjacking what is already there, pulling the username from roundcube, doing a quota query using the shell and returning the results back to roundcube.

1. Open 'program/steps/mail/func.inc
2. replace rcmail_quota_content function with the following:

Code:
function rcmail_quota_content($attrib)
  {
  global $RCMAIL;
 
  #get user name from roundcube
  $temp = $RCMAIL->user->get_username();
  $tempboom = explode ('@', $temp);
  $qusern=$tempboom[0];

  #run quota on user name
  $output= shell_exec("/usr/bin/quota " . $qusern);
  # remove consecutive spaces
  $output = ereg_replace("[ \t\n\r]+", " ", $output);
  #split apart
  $parts = explode(" ",$output);
  #calculate 
  $out = 35 - round(($parts[17] * 1024)/1048576);
  $quota_result = $out . "MB";
  
  return $quota_result;
  }
Note: I set all my user quotas to 35M, change this to reflect your needs or remove to show usage.

3. Open /skins/default/templates/main.html

4. look for <div id="listcontrols"> (should be around line 74)

change the last span to:
Code:
<span style="margin-left: 20px; margin-right: 5px">Storage Space Remaining:</span>
<roundcube:object name="quotaDisplay" id="quotadisplay" />
5. This needs to be cleaned up to be an actual option, maybe add a database query to get the actual user quota from either the database or from the results of the quota query.

6. Double check for typos, etc. if you need any help, send me a message.

NOTE: this is mainly a proof of concept, a starting point. I am using this on a production machine, but it has very low volume of users.

Anyone that can help continue, please please do.

Last edited by johnwilson1969; 23rd January 2010 at 17:35. Reason: clarity
Reply With Quote
The Following User Says Thank You to johnwilson1969 For This Useful Post:
falko (24th January 2010)
  #14  
Old 22nd October 2010, 18:44
johnwilson1969 johnwilson1969 is offline
Junior Member
 
Join Date: Jun 2007
Location: Ringgold, GA USA
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via Yahoo to johnwilson1969
 
Default Changes Quota working in Roundcube Stable: 0.4.2 for ISPConfig 2

edit: program/steps/mail/func.inc

replace the following function

Unlike 0.3, No other changes required on this version.
Would love to automate the retrieval of the individual quota settings, but do not have the time right now. Currently set to 35M, change value to your standard quota setting.


Code:
function rcmail_quota_content($attrib=NULL)
  {
  global $COMM_PATH, $RCMAIL;

  #### MOD STARTS HERE
  #$quota = $RCMAIL->imap->get_quota();
  #$quota = $RCMAIL->plugins->exec_hook('quota', $quota);

  #$quota_result = (array) $quota;
  $quota_result['type'] = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';

  #get user name from roundcube
  $temp = $RCMAIL->user->get_username();
  $tempboom = explode ('@', $temp);
  $qusern=$tempboom[0];

  #run quota on user name
  $output= shell_exec("/usr/bin/quota " . $qusern);
  # remove consecutive spaces
  $output = ereg_replace("[ \t\n\r]+", " ", $output);
  #split apart
  $parts = explode(" ",$output);
  #This is what you assign to your users
  $quota['total'] = 35000; 
  #get amount used
  $quota['used'] = round($parts[17]);
  #### MOD ENDS HERE
  
  if (!$quota['total'] && $RCMAIL->config->get('quota_zero_as_unlimited')) {
    $quota_result['title'] = rcube_label('unlimited');
    $quota_result['percent'] = 0;
    }
  else if ($quota['total']) {
    if (!isset($quota['percent']))
      $quota_result['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));

    $title = sprintf('%s / %s (%.0f%%)',
        show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
        $quota_result['percent']);

    $quota_result['title'] = $title;

    if ($attrib['width'])
      $quota_result['width'] = $attrib['width'];
    if ($attrib['height'])
      $quota_result['height']	= $attrib['height'];
    }
  else {
    $quota_result['title'] = rcube_label('unknown');
    $quota_result['percent'] = 0;
    }

  return $quota_result;
  }
Reply With Quote
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
RoundCube Webmail On Your ISPConfig Server Within 10 Easy Steps SoMBS HOWTO-Related Questions 17 25th November 2010 13:19
RoundCube webmail contact list disapears. kanour Installation/Configuration 1 7th April 2007 13:53
Problems with copy & paste dspuser Server Operation 3 23rd May 2006 17:21
in webmail there is no quota indicator luxor Installation/Configuration 6 1st December 2005 17:48
webmail klient quota problem? jernis Installation/Configuration 9 30th November 2005 22:14


All times are GMT +2. The time now is 05:51.


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