Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Moeglichkeit hinzugefuegt, dass man auch unendlich Ressourcen an eine…
Browse files Browse the repository at this point in the history
…n Kunden verteilen kann (einfach -1 eintragen).

git-svn-id: file:///var/svn/trunk/syscp@7 45fdb5c4-e40b-0410-b369-9aab4fe9a275
  • Loading branch information
Florian Lippert committed Aug 7, 2004
1 parent eff2851 commit d238608
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 22 deletions.
6 changes: 4 additions & 2 deletions admin_customers.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
$row['deactivated'] = str_replace('0', $lng['panel']['yes'], $row['deactivated']);
$row['deactivated'] = str_replace('1', $lng['panel']['no'], $row['deactivated']);

if($row['traffic_used']>$row['traffic'])
if($row['traffic_used'] > $row['traffic'] && $row['traffic'] != '-1')
{
$row['traffic_color']='red';
}
Expand All @@ -74,7 +74,7 @@
$row['traffic_color']='';
}

if($row['diskspace_used']>$row['diskspace'])
if($row['diskspace_used'] > $row['diskspace'] && $row['diskspace'] != '-1')
{
$row['diskspace_color']='red';
}
Expand All @@ -83,6 +83,8 @@
$row['diskspace_color']='';
}

$row = str_replace_array('-1', 'UL', $row, 'diskspace traffic mysqls emails email_forwarders ftps subdomains');

eval("\$customers.=\"".getTemplate("customers/customers_customer")."\";");
}
eval("echo \"".getTemplate("customers/customers")."\";");
Expand Down
11 changes: 7 additions & 4 deletions customer_domains.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
$row['documentroot']=str_replace($userinfo['documentroot'],'',$row['documentroot']);
eval("\$domains.=\"".getTemplate("domains/domains_domain")."\";");
}
if($userinfo['subdomains_used']<$userinfo['subdomains'])
if($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1')
{
if($db->num_rows($result) > 15)
{
eval("\$domains=\"".getTemplate("domains/domains_adddomain")."\".\$domains;");
}
eval("\$domains.=\"".getTemplate("domains/domains_adddomain")."\";");
}
eval("echo \"".getTemplate("domains/domainlist")."\";");
Expand Down Expand Up @@ -79,7 +83,7 @@

elseif($action=='add')
{
if($userinfo['subdomains_used']<$userinfo['subdomains'])
if($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1')
{
if(isset($_POST['send']) && $_POST['send']=='send')
{
Expand Down Expand Up @@ -176,7 +180,6 @@
}
}
}


}

?>
16 changes: 12 additions & 4 deletions customer_email.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
{
eval("\$accounts.=\"".getTemplate("email/pop_account")."\";");
}
if($userinfo['emails_used']<$userinfo['emails'])
if($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1')
{
if($db->num_rows($result) > 15)
{
eval("\$accounts=\"".getTemplate("email/pop_addaccount")."\".\$accounts;");
}
eval("\$accounts.=\"".getTemplate("email/pop_addaccount")."\";");
}
eval("echo \"".getTemplate("email/pop")."\";");
Expand All @@ -75,7 +79,7 @@

elseif($action=='add')
{
if($userinfo['emails_used']<$userinfo['emails'])
if($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1')
{
if(isset($_POST['send']) && $_POST['send']=='send')
{
Expand Down Expand Up @@ -161,8 +165,12 @@
}
eval("\$accounts.=\"".getTemplate("email/forwarders_forwarder")."\";");
}
if($userinfo['email_forwarders_used']<$userinfo['email_forwarders'])
if($userinfo['email_forwarders_used'] < $userinfo['email_forwarders'] || $userinfo['email_forwarders'] == '-1')
{
if($db->num_rows($result) > 15)
{
eval("\$accounts=\"".getTemplate("email/forwarders_addforwarder")."\".\$accounts;");
}
eval("\$accounts.=\"".getTemplate("email/forwarders_addforwarder")."\";");
}
eval("echo \"".getTemplate("email/forwarders")."\";");
Expand All @@ -187,7 +195,7 @@

elseif($action=='add')
{
if($userinfo['email_forwarders_used']<$userinfo['email_forwarders'])
if($userinfo['email_forwarders_used'] < $userinfo['email_forwarders'] || $userinfo['email_forwarders'] == '-1')
{
if(isset($_POST['send']) && $_POST['send']=='send')
{
Expand Down
12 changes: 10 additions & 2 deletions customer_ftp.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
$row['documentroot']=str_replace($userinfo['documentroot'],'',$row['homedir']);
eval("\$accounts.=\"".getTemplate("ftp/accounts_account")."\";");
}
if($userinfo['ftps_used']<$userinfo['ftps'])
if($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1')
{
if($db->num_rows($result) > 15)
{
eval("\$accounts=\"".getTemplate("ftp/accounts_addaccount")."\".\$accounts;");
}
eval("\$accounts.=\"".getTemplate("ftp/accounts_addaccount")."\";");
}
eval("echo \"".getTemplate("ftp/accounts")."\";");
Expand All @@ -69,6 +73,10 @@
{
$resetaccnumber=" , `ftp_lastaccountnumber`='0'";
}
else
{
$resetaccnumber='';
}
$result=$db->query("UPDATE `".TABLE_PANEL_CUSTOMERS."` SET `ftps_used`=`ftps_used`-1 $resetaccnumber WHERE `customerid`='".$userinfo['customerid']."'");
header("Location: $filename?page=$page&s=$s");
}
Expand All @@ -84,7 +92,7 @@

elseif($action=='add')
{
if($userinfo['ftps_used']<$userinfo['ftps'])
if($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1')
{
if(isset($_POST['send']) && $_POST['send']=='send')
{
Expand Down
10 changes: 6 additions & 4 deletions customer_index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@
/* $traffic=$db->query_first("SELECT SUM(http) AS http_sum, SUM(ftp_up) AS ftp_up_sum, SUM(ftp_down) AS ftp_down_sum, SUM(mail) AS mail_sum FROM ".TABLE_PANEL_TRAFFIC." WHERE year='".date('Y')."' AND month='".date('m')."' AND day<='".date('d')."' AND customerid='".$userinfo['customerid']."'");
$userinfo['traffic_used']=$traffic['http_sum']+$traffic['ftp_up_sum']+$traffic['ftp_down_sum']+$traffic['mail_sum'];*/

$userinfo['diskspace']=round($userinfo['diskspace']/1024,4).' MB';
$userinfo['diskspace_used']=round($userinfo['diskspace_used']/1024,4).' MB';
$userinfo['traffic']=round($userinfo['traffic']/(1024*1024),4).' GB';
$userinfo['traffic_used']=round($userinfo['traffic_used']/(1024*1024),4).' GB';
$userinfo['diskspace']=round($userinfo['diskspace']/1024,4);
$userinfo['diskspace_used']=round($userinfo['diskspace_used']/1024,4);
$userinfo['traffic']=round($userinfo['traffic']/(1024*1024),4);
$userinfo['traffic_used']=round($userinfo['traffic_used']/(1024*1024),4);

$userinfo = str_replace_array('-1', $lng['customer']['unlimited'], $userinfo, 'diskspace traffic mysqls emails email_forwarders ftps subdomains');

eval("echo \"".getTemplate("index/index")."\";");
}
Expand Down
12 changes: 10 additions & 2 deletions customer_mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@
{
eval("\$mysqls.=\"".getTemplate("mysql/mysqls_database")."\";");
}
if($userinfo['mysqls_used']<$userinfo['mysqls'])
if($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1')
{
if($db->num_rows($result) > 15)
{
eval("\$mysqls=\"".getTemplate("mysql/mysqls_adddatabase")."\".\$mysqls;");
}
eval("\$mysqls.=\"".getTemplate("mysql/mysqls_adddatabase")."\";");
}
eval("echo \"".getTemplate("mysql/mysqls")."\";");
Expand All @@ -75,6 +79,10 @@
{
$resetaccnumber=" , `mysql_lastaccountnumber`='0'";
}
else
{
$resetaccnumber='';
}
$result=$db->query("UPDATE ".TABLE_PANEL_CUSTOMERS." SET `mysqls_used`=`mysqls_used`-1 $resetaccnumber WHERE `customerid`='".$userinfo['customerid']."'");
header("Location: $filename?page=$page&s=$s");
}
Expand All @@ -86,7 +94,7 @@

elseif($action=='add')
{
if($userinfo['mysqls_used']<$userinfo['mysqls'])
if($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1')
{
if(isset($_POST['send']) && $_POST['send']=='send')
{
Expand Down
36 changes: 36 additions & 0 deletions lib/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,42 @@ function array_trim($source)
return $returnval;
}

/**
* Replaces Strings in an array, with the advantage that you can select which fields should be str_replace'd
*
* @param mixed String or array of strings to search for
* @param mixed String or array to replace with
* @param array The subject array
* @param string The fields which should be checked for, seperated by spaces
* @return array The str_replace'd array
*/
function str_replace_array($search, $replace, $subject, $fields = '')
{
if(is_array($subject))
{
$fields = explode(' ', $fields);
if(is_array($fields) && !empty($fields))
{
while(list(,$field)=each($fields))
{
if($field != '')
{
$subject[$field] = str_replace($search, $replace, $subject[$field]);
}
}
}
else
{
$subject = str_replace($search, $replace, $subject);
}
}
else
{
$subject = str_replace($search, $replace, $subject);
}
return $subject;
}

/**
* Returns if an emailaddress is in correct format or not
*
Expand Down
10 changes: 6 additions & 4 deletions lib/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@
$remote_addr = htmlspecialchars($_SERVER['REMOTE_ADDR']);
$http_user_agent = htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
$nosession = 0;
unset($customerinfo);
unset($userinfo);
unset($userid);
unset($customerid);
unset($adminid);
unset($s);

if(isset($_POST['s']))
Expand Down Expand Up @@ -121,7 +123,7 @@
*/
$languages = Array( 'german' => 'Deutsch' , 'english' => 'English' ) ;
$standardlanguage = 'german';
if(!isset($customerinfo['language']) || !isset($languages[$customerinfo['language']]))
if(!isset($userinfo['language']) || !isset($languages[$userinfo['language']]))
{
if(isset($_GET['language']) && isset($languages[$_GET['language']]))
{
Expand All @@ -134,7 +136,7 @@
}
else
{
$language = $customerinfo['language'];
$language = $userinfo['language'];
}

if(file_exists('./lng/'.$language.'.lng.php'))
Expand All @@ -150,7 +152,7 @@
*/
if($nosession == 1 && AREA != 'login')
{
unset($customerinfo);
unset($userinfo);
header('Location: ./index.php');
}

Expand Down
1 change: 1 addition & 0 deletions lng/english.lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
$lng['customer']['ftps'] = 'FTP-Accounts';
$lng['customer']['subdomains'] = 'Sub-Domain(s)';
$lng['customer']['domains'] = 'Domain(s)';
$lng['customer']['unlimited'] = 'unlimited';

/**
* Customermenue
Expand Down
1 change: 1 addition & 0 deletions lng/german.lng.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
$lng['customer']['ftps'] = 'FTP-Accounts';
$lng['customer']['subdomains'] = 'Sub-Domain(s)';
$lng['customer']['domains'] = 'Domain(s)';
$lng['customer']['unlimited'] = 'unendlich';

/**
* Customermenue
Expand Down

0 comments on commit d238608

Please sign in to comment.