Commit e9c04299 authored by Pablo Rauzy's avatar Pablo Rauzy
Browse files

fix never logged in bug

parent 06649c58
......@@ -69,15 +69,19 @@ while ($usr = $res->fetchArray(SQLITE3_ASSOC)) {
list($name, $domain, $tld) = explode('.', $usr['name'], 3);
$home = str_replace('%DOMAIN%', $domain, $config['home']).$name;
}
else {
$home = $config['home'].$usr['name'];
else { $home = $config['home'].$usr['name']; }
try {
$udb = new SQLite3($home.'.db', SQLITE3_OPEN_READONLY);
$usr['quota'] = $udb->querySingle("select value from settings where key='diskquota'");
$udb->close();
$usr['usage'] = dirsize($home);
$usr['usage'] += filesize($home.'.db');
$usr['usage'] += @filesize($home.'.zip');
}
catch (Exception $e) {
$usr['quota'] = -1;
$usr['usage'] = 0;
}
$udb = new SQLite3($home.'.db');
$usr['quota'] = $udb->querySingle("select value from settings where key='diskquota'");
$udb->close();
$usr['usage'] = dirsize($home);
$usr['usage'] += filesize($home.'.db');
$usr['usage'] += @filesize($home.'.zip');
$users[] = $usr;
}
$db->close();
......@@ -126,7 +130,11 @@ $db->close();
<span><a href="https://<?php echo $u['name']; ?>.cygale.net/"><?php echo $u['name']; ?></a></span>
<?php endif; ?>
<span>
<span style="display:inline-block; position:relative; width:200px; background-color:#aaa; z-index:5; text-align:center;"><span style="display:inline-block; position:absolute; left:0; top:0; z-index:6; width:<?php echo round(($u['usage'] / $u['quota']) * 200); ?>px; background-color: #08f; ">&nbsp;</span><span style="position:relative; z-index:7; color:#fff;"><?php echo round($u['usage'] / 1024, 2); ?>KB / <?php echo ($u['quota'] / (1024 * 1024)); ?>MB</span></span>
<?php if ($u['quota'] < 0): ?>
never logged in
<?php else: ?>
<span style="display:inline-block; position:relative; width:200px; background-color:#aaa; z-index:5; text-align:center;"><span style="display:inline-block; position:absolute; left:0; top:0; z-index:6; width:<?php echo round(($u['usage'] / $u['quota']) * 200); ?>px; background-color:#08f;">&nbsp;</span><span style="position:relative; z-index:7; color:#fff;"><?php echo round($u['usage'] / 1024, 2); ?>KB / <?php echo ($u['quota'] / (1024 * 1024)); ?>MB</span></span>
<?php endif; ?>
</span>
<span>
<button type="submit" name="quota" value="<?php echo $u['name']; ?>">Update quota</button>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment