bernd
nicht mehr der user mit der kleinsten UID ist Kunden sondern der, der als solcher gekennzeichnet ist.
bernd commited 51a8235 at 2007-08-11 17:50:51
useraccounts.php
<?php
require_once("inc/debug.php");
require_once("inc/db_connect.php");
require_role(ROLE_CUSTOMER);
function customer_may_have_useraccounts()
{
$customerno = (int) $_SESSION['customerinfo']['customerno'];
$result = db_query("SELECT COUNT(*) FROM system.useraccounts WHERE kunde={$customerno}");
return (mysql_num_rows($result) > 0);
}
function customer_useraccount($uid) {
$uid = (int) $uid;
$customerno = (int) $_SESSION['customerinfo']['customerno'];
$result = db_query("SELECT 1 FROM system.useraccounts WHERE kunde={$customerno} AND uid={$uid} AND kundenaccount=1");
return mysql_num_rows($result) > 0;
}
function primary_useraccount()
{
if (! ($_SESSION['role'] & ROLE_SYSTEMUSER))
return NULL;
$customerno = (int) $_SESSION['customerinfo']['customerno'];
$result = db_query("SELECT MIN(uid) AS uid FROM system.useraccounts WHERE kunde={$customerno}");
$uid = mysql_fetch_object($result)->uid;
DEBUG("primary useraccount: {$uid}");
return $uid;
}
function list_useraccounts()
{
$customerno = (int) $_SESSION['customerinfo']['customerno'];
$result = db_query("SELECT uid,username,name,erstellungsdatum,softquota FROM system.useraccounts WHERE kunde={$customerno}");
$ret = array();
while ($item = mysql_fetch_object($result))
{
DEBUG('Useraccount: '.print_r($item, true));
array_push($ret, $item);
}
return $ret;
}
function get_account_details($uid)
{
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX