Current time: 11-16-2024, 05:54 PM Hello There, Guest! (LoginRegister)


Thread Closed 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[TICKET/PATCH]: Mailboxquota im GUI einstellen.
Author Message
FISA4 Offline
Member
***

Posts: 668
Joined: Feb 2008
Reputation: 15
Post: #1
[TICKET/PATCH]: Mailboxquota im GUI einstellen.
Nur für Dovecot Benutzer (Version >= 1.1)

Im englischsprachigen Bereich wurde gefragt ob man im GUI irgendwo die Mailbox Quota einstellen kann.
Da das nicht geht hab ich es mal gehend gemacht.

Hier mein HowTo dazu:

öffne /var/www/ispcp/gui/reseller/domain_edit.php:

nach:
Code:
require '../include/ispcp-lib.php';

einfügen:
Code:
include '../include/ispcp-mailquota.php

nähe Zeile 69 nach:
Code:
'TR_DISK' => tr('Disk limit [MB] <br /><i>(0 unlimited)</i>'),

einfügen:
Code:
'TR_MAIL_QUOTA' => tr('Mailbox Quota [MB]'),

Zeile 229 ändern von:
Code:
GLOBAL $username;

in
Code:
GLOBAL $username, $mailquota;

bei Zeile 282 nach:
Code:
'VL_DOM_DISK' => $disk,

einfügen:
Code:
'VL_MAIL_QUOTA' => $mailquota,


öffne /var/www/ispcp/gui/themes/omega_original/reseller/domain_edit.tpl

nach:
Code:
            <tr>
                        <td width="25">&nbsp;</td>
                        <td class="content2" width="193">{TR_MAIL_ACCOUNT}</td>
                        <td class="content"><input type="text" name="dom_mail_acCount" value="{VL_DOM_MAIL_ACCOUNT}" style="width:100px" class="textinput">
                        </td>
                      </tr>

einfügen:
Code:
<tr>
                        <td width="25">&nbsp;</td>
                        <td class="content2" width="193">{TR_MAIL_QUOTA}</td>
                        <td class="content"><input type="text" name="mailboxquota" value="{VL_MAIL_QUOTA}" style="width:100px" class="textinput"></td>
                        </td>
                      </tr>

neue Datei erstellen /var/www/ispcp/gui/includes/ispcp-mailquota.php
Inhalt:
Code:
<?php
/**
* ispCP ω (OMEGA) a Virtual Hosting Control System
*
* @copyright     2001-2006 by moleSoftware GmbH
* @copyright     2006-2008 by ispCP | http://isp-control.net
* @version     SVN: $ID$
* @link         http://isp-control.net
* @author         ispCP Team
*
* @license
*   This program is free software; you can redistribute it and/or modify it under
*   the terms of the MPL General Public License as published by the Free Software
*   Foundation; either version 1.1 of the License, or (at your option) any later
*   version.
*   You should have received a copy of the MPL Mozilla Public License along with
*   this program; if not, write to the Open Source Initiative (OSI)
*   http://opensource.org | osi@opensource.org
*/


/** Connect to Database */

$dbUser="root";     // Database Username
$dbPass="";        // Database Password
$dbHost="localhost";    // Database Server
$dbName="ispcp";    // Database

$connect = @mysql_connect($dbHost, $dbUser, $dbPass) or die("Could not connect to Database-Server!");
$selectDB = @mysql_select_db($dbName, $connect) or die("Could not select <b>$dbName</b>!");


/** Read Mailbox Quota */

if(isset($_GET['edit_id']))
{
$id=$_GET['edit_id'];

$sql="SELECT `quota` FROM `mail_users` WHERE `domain_id` = '".$id."' LIMIT 1;";
$handle = mysql_query($sql);
$result=mysql_fetch_object($handle);
$mailquota = $result->quota/1024/1024;
mysql_close();
}

/** Write Mailbox Quota */

if(isset($_POST['Submit']))
{
$_POST['mailboxquota'] = $_POST['mailboxquota'] * 1024 * 1024;
$sql0="UPDATE `mail_users` SET `quota` = '".$_POST['mailboxquota']."' WHERE `domain_id` = '".$_SESSION['edit_id']."';";
$result = mysql_query($sql0);
mysql_close();
}
?>

Evtl. kann jemand helfen damit der Connect-Bereich aus der Datei raus kann. (include '../ich/weiss/nicht/welches/file.php'Wink
(This post was last modified: 03-13-2009 09:56 PM by BeNe.)
03-13-2009 11:49 AM
Find all posts by this user
TheCry Away
Member
***

Posts: 851
Joined: Oct 2008
Reputation: 21
Post: #2
RE: [HowTo]: Mailboxquota im GUI einstellen.
Erst einmal Danke für Deine Bemühungen... Ich habe wohl auch danach gefragt.. Wink

(03-13-2009 11:49 AM)FISA4 Wrote:  Evtl. kann jemand helfen damit der Connect-Bereich aus der Datei raus kann. (include '../ich/weiss/nicht/welches/file.php'Wink

Warum nutzt Du nicht die Funktionen von ISPCP?
In der domain_edit müsstest Du das doch alles so abwickeln können, oder?.

Gruß
Sascha
(This post was last modified: 03-13-2009 04:22 PM by TheCry.)
03-13-2009 04:20 PM
Find all posts by this user
TheCry Away
Member
***

Posts: 851
Joined: Oct 2008
Reputation: 21
Post: #3
RE: [HowTo]: Mailboxquota im GUI einstellen.
Ich habe etwas Zeit und konnte mir das mal ansehen...
Suche mal in der domain_edit.php nach
Code:
global $domain_name, $domain_ip, $php_sup
Das sollte in der Funktion "load_additional_data" liegen (direkt am Anfang).

Die Zeile änderst Du dann in
Code:
global $domain_name, $domain_ip, $php_sup, $mailquota;

Danach suche die Zeile
Code:
} //End of load_additional_data()
Davor trägst Du dies ein
Code:
//Mailbox Quotas
        // Get domain data
        $query = <<<SQL_QUERY
        SELECT
            quota
        FROM
            mail_users
        WHERE
            domain_id = ?
SQL_QUERY;

        $res = exec_query($sql, $query, array($domain_id));
        $data = $res->FetchRow();

        $mailquota = $data['quota']/1024/1024
;

Damit sollte das auslesen schon funktionieren...
Den zusätzlichen Include brauchst Du nicht!


Das Update wird dann so gemacht:
Suche in der gleichen Datei nach der Funktion "function check_user_data".
Dort muss die Zeile
Code:
global $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk, $sql, $domain_ip, $domain_php, $domain_cgi
in
Code:
global $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk, $sql, $domain_ip, $domain_php, $domain_cgi, $mailquota;
geändert werden.

Suche weiter nach
Code:
$domain_cgi = $_POST['domain_cgi'];
Füge dahinter ein
Code:
$mailquota = clean_input($_POST['mailboxquota']);

Such weiter nach
Code:
if (!ispcp_limit_check($disk, null)) {
                $ed_error .= tr('Incorrect disk quota limit!');
        }
Füge danach ein
Code:
if (!ispcp_limit_check($mailquota, null)) {
                $ed_error .= tr('Incorrect mailbox quota limit!');
        }
        else if ($mailquota < 10) {
                $ed_error .= tr('mailbox quota should be minimum 10MB!');
        }

Suche weiter nach
Code:
if (!update_reseller_props($reseller_id, $reseller_props)) {

                    set_page_message(tr('Domain properties could not be updated!'));

                    return false;
                }

Füge danach ein
Code:
//update mailbox quotas
                $mailquota = $mailquota*1024*1024;
                $query = "UPDATE `mail_users` SET `quota` = '$mailquota' WHERE `domain_id` = ?";
                $rs = exec_query($sql, $query, array($user_id));


Jetzt fehlt nur noch die Übersetzung.. Smile
(This post was last modified: 03-13-2009 07:19 PM by TheCry.)
03-13-2009 05:34 PM
Find all posts by this user
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #4
RE: [HowTo]: Mailboxquota im GUI einstellen.
Sauber! Will es mal testen und gebe dann bescheid.

Greez BeNe
03-13-2009 05:40 PM
Visit this user's website Find all posts by this user
TheCry Away
Member
***

Posts: 851
Joined: Oct 2008
Reputation: 21
Post: #5
RE: [HowTo]: Mailboxquota im GUI einstellen.
So...
Hier noch die Änderung für die deutsche Übersetzung
In der Datenbank (ispcp -> Tabelle lang_GermanGermany) 2 Zeilen eingefügt werden:

Code:
INSERT INTO `ispcp`.`lang_GermanGermany` (
`msgid` ,
`msgstr`
)
VALUES (
'Incorrect mailbox quota limit!', 'Fehlerhafte Postfach Speichergröße!'
), (
'mailbox quota should be minimum 10MB!', 'Postfach Speicherplatzgröße muss mindestens 10MB haben!'
);
(This post was last modified: 03-13-2009 06:46 PM by TheCry.)
03-13-2009 05:57 PM
Find all posts by this user
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #6
RE: [HowTo]: Mailboxquota im GUI einstellen.
Habe grad den ersten Part versucht:
Code:
Parse error: syntax error, unexpected '}' in /var/www/ispcp/gui/reseller/domain_edit.php on line 236
Diesen Punkt meine ich:
Code:
//Mailbox Quotas
        // Get domain data
        $query = <<<SQL_QUERY
        SELECT
            quota
        FROM
            mail_users
        WHERE
            domain_id = ?
SQL_QUERY;

        $res = exec_query($sql, $query, array($domain_id));
        $data = $res->FetchRow();

        $mailquota = $data['quota']/1024/1024
} //End of load_additional_data()
Habe ich was vergessen ?

Greez BeNe
03-13-2009 06:08 PM
Visit this user's website Find all posts by this user
TheCry Away
Member
***

Posts: 851
Joined: Oct 2008
Reputation: 21
Post: #7
RE: [HowTo]: Mailboxquota im GUI einstellen.
(03-13-2009 06:08 PM)BeNe Wrote:  
Code:
} //End of load_additional_data()
Hast Du das auch eingefügt?
Wenn die Zeile 2mal drin ist, dann bitt einmal löschen!

Code:
//Mailbox Quotas
        // Get domain data
        $query = <<<SQL_QUERY
        SELECT
            quota
        FROM
            mail_users
        WHERE
            domain_id = ?
SQL_QUERY;

        $res = exec_query($sql, $query, array($domain_id));
        $data = $res->FetchRow();

        $mailquota = $data['quota']/1024/1024
Das muss davor eingesetzt werden!!
(This post was last modified: 03-13-2009 06:50 PM by TheCry.)
03-13-2009 06:50 PM
Find all posts by this user
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #8
RE: [HowTo]: Mailboxquota im GUI einstellen.
Ja, habe ich. Hier ein Patch zum diff:
Code:
--- /root/trunk/gui/reseller/domain_edit.php    2009-03-12 06:38:55.000000000 +0000
+++ domain_edit.php     2009-03-13 08:06:33.000000000 +0000
@@ -118,7 +118,7 @@
function load_user_data($user_id, $domain_id) {
        $sql = Database::getInstance();

-       global $domain_name, $domain_ip, $php_sup;
+       global $domain_name, $domain_ip, $php_sup, $mailquota;
        global $cgi_supp , $sub, $als;
        global $mail, $ftp, $sql_db;
        global $sql_user, $traff, $disk;
@@ -154,6 +154,7 @@
                ) = generate_user_props($domain_id);;

        load_additional_data($user_id, $domain_id);
+
} //End of load_user_data()

// Load additional data
@@ -216,6 +217,22 @@
        $data = $res->FetchRow();

        $username = $data['admin_name'];
+
+       //Mailbox Quotas
+        // Get domain data
+        $query = <<<SQL_QUERY
+        SELECT
+            quota
+        FROM
+            mail_users
+        WHERE
+            domain_id = ?
+SQL_QUERY;
+
+        $res = exec_query($sql, $query, array($domain_id));
+        $data = $res->FetchRow();
+
+        $mailquota = $data['quota']/1024/1024
} //End of load_additional_data()

// Show user data
@@ -588,4 +605,4 @@

unset_messages();

-?>
\ No newline at end of file
+?>
Sollte doch passen oder ?
03-13-2009 07:07 PM
Visit this user's website Find all posts by this user
TheCry Away
Member
***

Posts: 851
Joined: Oct 2008
Reputation: 21
Post: #9
RE: [HowTo]: Mailboxquota im GUI einstellen.
Fehler von mir
Ich habe es oben in der Anleitung schon geändert...
Das Semikolon in der Zeile
Code:
$mailquota = $data['quota']/1024/1024
Es muss
Code:
$mailquota = $data['quota']/1024/1024;
heissen!!!
03-13-2009 07:20 PM
Find all posts by this user
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #10
RE: [HowTo]: Mailboxquota im GUI einstellen.
Sieht schon besser aus Wink
Und was muss ich noch von oben übernehmen ?
Weil das Feld jetzt ja noch nicht in der GUI ist. Fehlt ja noch was am Template oder ?

Der nächste Schritt wäre ja dann noch es per User und nicht per Domain einzustellen. Mehr oder weniger erstmal eine Vererbung der Domaineinstellung auf die User und wenn nötig kann man diese dann auch noch höher/niedriger setzen ?

Greez BeNe
03-13-2009 07:38 PM
Visit this user's website Find all posts by this user
Thread Closed 


Forum Jump:


User(s) browsing this thread: 4 Guest(s)