|
|
|
@ -10,6 +10,23 @@ $notes = [];
|
|
|
|
|
foreach ($noteids as $n) {
|
|
|
|
|
$notes[] = Note::loadNote($n);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check note quota
|
|
|
|
|
$notequota = $SETTINGS['note_limit'];
|
|
|
|
|
$notequotaset = $SETTINGS['note_limit'] !== false;
|
|
|
|
|
$notequotareached = false;
|
|
|
|
|
$usernotecount = 0;
|
|
|
|
|
$userunlimited = false;
|
|
|
|
|
if ($notequotaset) {
|
|
|
|
|
$usernotecount = $database->count("notes", ['ownerid' => $_SESSION['uid']]);
|
|
|
|
|
$usernotelimit = $SETTINGS['note_limit'];
|
|
|
|
|
if ((new User($_SESSION['uid']))->hasPermission($SETTINGS['unlimited_permission'])) {
|
|
|
|
|
$userunlimited = true;
|
|
|
|
|
}
|
|
|
|
|
if (!$userunlimited && $usernotecount >= $usernotelimit) {
|
|
|
|
|
$notequotareached = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<style nonce="<?php echo $SECURE_NONCE; ?>">
|
|
|
|
@ -70,7 +87,13 @@ foreach ($colors as $c) {
|
|
|
|
|
</style>
|
|
|
|
|
|
|
|
|
|
<div class="btn-group mb-4">
|
|
|
|
|
<a href="app.php?page=newnote" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("New note"); ?></a>
|
|
|
|
|
<?php if ($notequotareached) { ?>
|
|
|
|
|
<button type="button" class="btn btn-success" data-toggle="modal" data-target="#quotamodal">
|
|
|
|
|
<i class="fas fa-plus"></i> <?php $Strings->get("New note"); ?>
|
|
|
|
|
</button>
|
|
|
|
|
<?php } else { ?>
|
|
|
|
|
<a href="app.php?page=newnote" class="btn btn-success"><i class="fas fa-plus"></i> <?php $Strings->get("New note"); ?></a>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
<a href="app.php?page=home" class="btn btn-light"><i class="fas fa-sync-alt"></i> <?php $Strings->get("Refresh"); ?></a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
@ -185,6 +208,40 @@ foreach ($colors as $c) {
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<?php if ($notequotaset) { ?>
|
|
|
|
|
<div class="quotamsg" data-toggle="modal" data-target="#quotamodal">
|
|
|
|
|
<?php
|
|
|
|
|
if ($userunlimited) {
|
|
|
|
|
$Strings->get("Note quota: Unlimited");
|
|
|
|
|
} else {
|
|
|
|
|
$Strings->build("Note quota: {x} of {y} used.", ["x" => $usernotecount, "y" => $notequota]);
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="quotamodal" tabindex="-1" role="dialog" aria-labelledby="quotamodallabel" aria-hidden="true">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
<div class="modal-header">
|
|
|
|
|
<h5 class="modal-title" id="quotamodallabel"><i class="fas fa-tachometer-alt"></i> <?php $Strings->get("Note quota"); ?></h5>
|
|
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
|
|
|
<span aria-hidden="true">×</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-body">
|
|
|
|
|
<?php
|
|
|
|
|
$quotamsg = str_replace(["{{notecount}}", "{{notelimit}}"], [$usernotecount, ($userunlimited ? $Strings->get("unlimited", false) : $notequota)], $SETTINGS['quota_msg_content']);
|
|
|
|
|
echo $quotamsg;
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="modal-footer">
|
|
|
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php $Strings->get("Close"); ?></button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" tabindex="-1" role="dialog" id="colormodal">
|
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
|
<form class="modal-content" action="action.php" method="POST">
|
|
|
|
|