<?php
/***************************************************************************
*
* Quota.php
* -------------------
*
* begin : Friday, Nov 17, 2002
* copyright : (C) 2002 The Kabramps Team
* email : hide@address.com,
* hide@address.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
* (http://www.gnu.org/licenses/gpl.html)
*
***************************************************************************/
class Quota extends Addon {
function Quota() {
}
function get_view() {
global $HTTP_GET_VARS;
global $addonoptions;
global $attribute;
$servers = array();
$filename = $addonoptions['homeserver'];
$filebuffer = fopen ($filename,"r");
if ($filebuffer) {
$content = fread($filebuffer, filesize($filename));
fclose($filebuffer);
$servers = split("\n",$content);
}
$filename = $addonoptions['quotaclass'];
$filebuffer = fopen ($filename,"r");
if ($filebuffer) {
$content = fread($filebuffer, filesize($filename));
fclose($filebuffer);
$quota = split("\n",$content);
}
$tmpl = new Smarty;
$serverlist = "";
for ($i=0; $i<count($servers);$i++){
if ( $servers[$i] != "" ) {
$result = split(":",$servers[$i]);
$server[] = $result[0];
$serverlist .= $result[1].";";
}
}
$serverlist = substr($serverlist,0,-1);
$tmpl->assign(array("SERVER" => $server,
"SERVERLIST" => $serverlist,
"QUOTACLASS" => $quota,
"SUBMIT" => gettext("ok"),
"CLOSE" => gettext("cancel"),
"ATTRIBUTE" => $attribute
));
return $tmpl->fetch("addons/quota.tpl");
}
function get_jsfile() {
global $options;
return array( $options['templates']."addons/quota.js",
$options['templates']."addons/values.js"
);
}
function onload() {
return "get_values('quota');";
}
}