Added options to enable/disable account upgrades and coinpayments
This commit is contained in:
@ -119,6 +119,7 @@ const SKIP_USER_CHROOT_UPDATE = true; //skips updating user chroots when running
|
|||||||
const DEFAULT_QUOTA_SIZE = 1024 * 1024; //per user disk quota in kb - Defaults to 1 GB
|
const DEFAULT_QUOTA_SIZE = 1024 * 1024; //per user disk quota in kb - Defaults to 1 GB
|
||||||
const DEFAULT_QUOTA_FILES = 100000; //per user file quota - by default allow no more than 100000 files
|
const DEFAULT_QUOTA_FILES = 100000; //per user file quota - by default allow no more than 100000 files
|
||||||
const NUM_GUARDS = 50; //number of tor guard relays to distribute the load on
|
const NUM_GUARDS = 50; //number of tor guard relays to distribute the load on
|
||||||
|
const ENABLE_UPGRADES = true; //enable users to upgrade their account againt payment? true/false
|
||||||
//Optional paid upgrades in format of 'identifier' => ['name', 'usd_price']
|
//Optional paid upgrades in format of 'identifier' => ['name', 'usd_price']
|
||||||
const ACCOUNT_UPGRADES = [
|
const ACCOUNT_UPGRADES = [
|
||||||
'1g_quota' => ['name' => '+1GB disk Quota', 'usd_price' => 10],
|
'1g_quota' => ['name' => '+1GB disk Quota', 'usd_price' => 10],
|
||||||
@ -127,6 +128,7 @@ const ACCOUNT_UPGRADES = [
|
|||||||
'20g_quota' => ['name' => '+20GB disk Quota', 'usd_price' => 40],
|
'20g_quota' => ['name' => '+20GB disk Quota', 'usd_price' => 40],
|
||||||
'100k_files_quota' => ['name' => '+100k files Quota', 'usd_price' => 10],
|
'100k_files_quota' => ['name' => '+100k files Quota', 'usd_price' => 10],
|
||||||
];
|
];
|
||||||
|
const COINPAYMENTS_ENABLED = true; //enable CoinPayments as payment processor true/false
|
||||||
const COINPAYMENTS_PRIVATE = 'COINPAYMENTS_PRIVATE'; //Coinpayments private API key
|
const COINPAYMENTS_PRIVATE = 'COINPAYMENTS_PRIVATE'; //Coinpayments private API key
|
||||||
const COINPAYMENTS_PUBLIC = 'COINPAYMENTS_PUBLIC'; //Coinpayments public API key
|
const COINPAYMENTS_PUBLIC = 'COINPAYMENTS_PUBLIC'; //Coinpayments public API key
|
||||||
const COINPAYMENTS_MERCHANT_ID = 'COINPAYMENTS_MERCHANT_ID'; //Coinpayments merchant ID
|
const COINPAYMENTS_MERCHANT_ID = 'COINPAYMENTS_MERCHANT_ID'; //Coinpayments merchant ID
|
||||||
|
@ -1,29 +1,30 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../common.php');
|
require('../common.php');
|
||||||
|
|
||||||
|
if(!ENABLE_UPGRADES){
|
||||||
|
die('Upgrades disabled');
|
||||||
|
}
|
||||||
|
if(!COINPAYMENTS_ENABLED){
|
||||||
|
die('CoinPayments disabled');
|
||||||
|
}
|
||||||
if(empty($_SERVER['HTTP_HMAC'])){
|
if(empty($_SERVER['HTTP_HMAC'])){
|
||||||
die("No HMAC signature sent");
|
die("No HMAC signature sent");
|
||||||
}
|
}
|
||||||
|
|
||||||
$merchant = $_POST['merchant'] ?? '';
|
$merchant = $_POST['merchant'] ?? '';
|
||||||
if(empty($merchant)){
|
if(empty($merchant)){
|
||||||
die("No Merchant ID passed");
|
die("No Merchant ID passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if($merchant !== COINPAYMENTS_MERCHANT_ID){
|
if($merchant !== COINPAYMENTS_MERCHANT_ID){
|
||||||
die("Invalid Merchant ID");
|
die("Invalid Merchant ID");
|
||||||
}
|
}
|
||||||
|
|
||||||
$request = file_get_contents('php://input');
|
$request = file_get_contents('php://input');
|
||||||
if(empty($request)){
|
if(empty($request)){
|
||||||
die("Error reading POST data");
|
die("Error reading POST data");
|
||||||
}
|
}
|
||||||
|
|
||||||
$hmac = hash_hmac("sha512", $request, COINPAYMENTS_IPN_SECRET);
|
$hmac = hash_hmac("sha512", $request, COINPAYMENTS_IPN_SECRET);
|
||||||
if($hmac !== $_SERVER['HTTP_HMAC']){
|
if($hmac !== $_SERVER['HTTP_HMAC']){
|
||||||
die("HMAC signature does not match");
|
die("HMAC signature does not match");
|
||||||
}
|
}
|
||||||
|
|
||||||
$db = get_db_instance();
|
$db = get_db_instance();
|
||||||
$status = 0;
|
$status = 0;
|
||||||
if($_POST['status'] < 0){
|
if($_POST['status'] < 0){
|
||||||
|
@ -324,8 +324,8 @@ $quota_files_usage = $quota['quota_files_used'] / $quota['quota_files'];
|
|||||||
$usage_text = bytes_to_human_readable($quota['quota_size_used'] * 1024) . ' of ' . bytes_to_human_readable($quota['quota_size'] * 1024) . ' - ' . round($quota_usage * 100, 2).'%';
|
$usage_text = bytes_to_human_readable($quota['quota_size_used'] * 1024) . ' of ' . bytes_to_human_readable($quota['quota_size'] * 1024) . ' - ' . round($quota_usage * 100, 2).'%';
|
||||||
$usage_files_text = "$quota[quota_files_used] of $quota[quota_files] - " . round($quota_files_usage * 100, 2).'%';
|
$usage_files_text = "$quota[quota_files_used] of $quota[quota_files] - " . round($quota_files_usage * 100, 2).'%';
|
||||||
?>
|
?>
|
||||||
<p>Your disk usage: <meter value="<?php echo round($quota_usage, 2); ?>"><?php echo $usage_text; ?></meter> - <?php echo $usage_text; ?> (updated hourly) <a href="upgrade.php?upgrade=1g_quota">Upgrade</a></p>
|
<p>Your disk usage: <meter value="<?php echo round($quota_usage, 2); ?>"><?php echo $usage_text; ?></meter> - <?php echo $usage_text; ?> (updated hourly) <?php echo ENABLE_UPGRADE ? '<a href="upgrade.php?upgrade=1g_quota">Upgrade</a>' : ''; ?></p>
|
||||||
<p>Your file number usage: <meter value="<?php echo round($quota_files_usage, 2); ?>"><?php echo $usage_files_text; ?></meter> - <?php echo $usage_files_text; ?> (updated hourly) <a href="upgrade.php?upgrade=100k_files_quota">Upgrade</a></p>
|
<p>Your file number usage: <meter value="<?php echo round($quota_files_usage, 2); ?>"><?php echo $usage_files_text; ?></meter> - <?php echo $usage_files_text; ?> (updated hourly) <?php echo ENABLE_UPGRADE ? '<a href="upgrade.php?upgrade=100k_files_quota">Upgrade</a>' : ''; ?></p>
|
||||||
<h3>Logs</h3>
|
<h3>Logs</h3>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
<tr><th>Date</th><th>access.log</th><th>error.log</th></tr>
|
<tr><th>Date</th><th>access.log</th><th>error.log</th></tr>
|
||||||
|
@ -24,7 +24,7 @@ header('X-Accel-Expires: 60');
|
|||||||
<li>Web-based file manager</li>
|
<li>Web-based file manager</li>
|
||||||
<li>FTP and SFTP access</li>
|
<li>FTP and SFTP access</li>
|
||||||
<li>command line access to shell via SSH</li>
|
<li>command line access to shell via SSH</li>
|
||||||
<li>1GB disk quota and a maximum of 100.000 files. - upgradable</li>
|
<li>1GB disk quota and a maximum of 100.000 files<?php echo ENABLE_UPGRADES ? ' - upgradable' : ''; ?></li>
|
||||||
<li>mail() can send e-mails from your_system_account@<?php echo ADDRESS; ?> (your_system_account@hosting.danwin1210.me for clearnet)</li>
|
<li>mail() can send e-mails from your_system_account@<?php echo ADDRESS; ?> (your_system_account@hosting.danwin1210.me for clearnet)</li>
|
||||||
<li>Webmail and IMAP, POP3 and SMTP access to your mail account</li>
|
<li>Webmail and IMAP, POP3 and SMTP access to your mail account</li>
|
||||||
<li>Mail sent to anything@your.onion gets automatically redirected to your inbox</li>
|
<li>Mail sent to anything@your.onion gets automatically redirected to your inbox</li>
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require('../common.php');
|
require('../common.php');
|
||||||
|
if(!ENABLE_UPGRADES || !COINPAYMENTS_ENABLED){
|
||||||
|
header('Location: home.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
$user=check_login();
|
$user=check_login();
|
||||||
use chillerlan\QRCode\QRCode;
|
use chillerlan\QRCode\QRCode;
|
||||||
use chillerlan\QRCode\QROptions;
|
use chillerlan\QRCode\QROptions;
|
||||||
|
Reference in New Issue
Block a user