|
|
|
@ -15,36 +15,35 @@ if (!empty($_GET['delsynccode'])) {
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<div class="row justify-content-center">
|
|
|
|
|
<div class="col-sm-10 col-md-6 col-lg-5 col-xl-4">
|
|
|
|
|
<div class="col-sm-10 col-md-6 col-lg-4 col-xl-4">
|
|
|
|
|
<div class="card">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<h5 class="card-title"><i class="fas fa-mobile-alt"></i> <?php $Strings->get("sync mobile"); ?></h5>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($_GET['mobilecode']) && $_GET['mobilecode'] == "generate") {
|
|
|
|
|
if (!empty($_GET['showsynccode']) && $database->has("mobile_codes", ["AND" => ["uid" => $_SESSION['uid'], "codeid" => $_GET['showsynccode']]])) {
|
|
|
|
|
$code = $database->get("mobile_codes", 'code', ["AND" => ["uid" => $_SESSION['uid'], "codeid" => $_GET['showsynccode']]]);
|
|
|
|
|
} else {
|
|
|
|
|
$code = strtoupper(substr(md5(mt_rand() . uniqid("", true)), 0, 20));
|
|
|
|
|
$desc = htmlspecialchars($_POST['desc']);
|
|
|
|
|
$database->insert('mobile_codes', ['uid' => $_SESSION['uid'], 'code' => $code, 'description' => $desc]);
|
|
|
|
|
}
|
|
|
|
|
if (strpos(URL, "http") !== FALSE) {
|
|
|
|
|
$url = URL . "mobile/index.php";
|
|
|
|
|
} else {
|
|
|
|
|
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . (($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) ? ":" . $_SERVER['SERVER_PORT'] : "") . URL . "mobile/index.php";
|
|
|
|
|
}
|
|
|
|
|
$encodedurl = str_replace("/", "\\", $url);
|
|
|
|
|
$codeuri = "bizsync://" . $encodedurl . "/" . $_SESSION['username'] . "/" . $code;
|
|
|
|
|
$qrCode = new QrCode($codeuri);
|
|
|
|
|
$qrCode->setWriterByName('svg');
|
|
|
|
|
$qrCode->setSize(550);
|
|
|
|
|
$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH);
|
|
|
|
|
$qrcode = $qrCode->writeDataUri();
|
|
|
|
|
$chunk_code = trim(chunk_split($code, 5, ' '));
|
|
|
|
|
$lang_done = $Strings->get("done adding sync code", false);
|
|
|
|
|
?>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<hr />
|
|
|
|
|
<?php
|
|
|
|
|
if (!empty($_GET['mobilecode']) && $_GET['mobilecode'] == "generate") {
|
|
|
|
|
if (!empty($_GET['showsynccode']) && $database->has("mobile_codes", ["AND" => ["uid" => $_SESSION['uid'], "codeid" => $_GET['showsynccode']]])) {
|
|
|
|
|
$code = $database->get("mobile_codes", 'code', ["AND" => ["uid" => $_SESSION['uid'], "codeid" => $_GET['showsynccode']]]);
|
|
|
|
|
} else {
|
|
|
|
|
$code = strtoupper(substr(md5(mt_rand() . uniqid("", true)), 0, 20));
|
|
|
|
|
$desc = htmlspecialchars($_POST['desc']);
|
|
|
|
|
$database->insert('mobile_codes', ['uid' => $_SESSION['uid'], 'code' => $code, 'description' => $desc]);
|
|
|
|
|
}
|
|
|
|
|
if (strpos(URL, "http") !== FALSE) {
|
|
|
|
|
$url = URL . "mobile/index.php";
|
|
|
|
|
} else {
|
|
|
|
|
$url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://" . $_SERVER['HTTP_HOST'] . (($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) ? ":" . $_SERVER['SERVER_PORT'] : "") . URL . "mobile/index.php";
|
|
|
|
|
}
|
|
|
|
|
$encodedurl = str_replace("/", "\\", $url);
|
|
|
|
|
$codeuri = "bizsync://" . $encodedurl . "/" . $_SESSION['username'] . "/" . $code;
|
|
|
|
|
$qrCode = new QrCode($codeuri);
|
|
|
|
|
$qrCode->setWriterByName('svg');
|
|
|
|
|
$qrCode->setSize(550);
|
|
|
|
|
$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH);
|
|
|
|
|
$qrcode = $qrCode->writeDataUri();
|
|
|
|
|
$chunk_code = trim(chunk_split($code, 5, ' '));
|
|
|
|
|
$lang_done = $Strings->get("done adding sync code", false);
|
|
|
|
|
?>
|
|
|
|
|
<p class="card-text"><?php $Strings->get("scan sync qrcode"); ?></p>
|
|
|
|
|
</div>
|
|
|
|
|
<img src="<?php echo $qrcode; ?>" class="card-img px-4" />
|
|
|
|
@ -72,57 +71,57 @@ if (!empty($_GET['delsynccode'])) {
|
|
|
|
|
} else {
|
|
|
|
|
$activecodes = $database->select("mobile_codes", ["codeid", "code", "description"], ["uid" => $_SESSION['uid']]);
|
|
|
|
|
?>
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<p class="card-text">
|
|
|
|
|
<?php $Strings->get("sync explained"); ?>
|
|
|
|
|
</p>
|
|
|
|
|
<form action="app.php?page=sync&mobilecode=generate" method="POST">
|
|
|
|
|
<input type="text" name="desc" class="form-control" placeholder="<?php $Strings->get("sync code name"); ?>" required />
|
|
|
|
|
<button class="btn btn-success btn-block mt-2" type="submit">
|
|
|
|
|
<?php $Strings->get("generate sync"); ?>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
<p class="card-text">
|
|
|
|
|
<?php $Strings->get("sync explained"); ?>
|
|
|
|
|
</p>
|
|
|
|
|
<form action="app.php?page=sync&mobilecode=generate" method="POST">
|
|
|
|
|
<input type="text" name="desc" class="form-control" placeholder="<?php $Strings->get("sync code name"); ?>" required />
|
|
|
|
|
<button class="btn btn-success btn-block mt-2" type="submit">
|
|
|
|
|
<?php $Strings->get("generate sync"); ?>
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="list-group list-group-flush">
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("active sync codes"); ?></b>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="list-group list-group-flush">
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<b><?php $Strings->get("active sync codes"); ?></b>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
if (count($activecodes) > 0) {
|
|
|
|
|
foreach ($activecodes as $c) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
|
|
<div>
|
|
|
|
|
<div class="text-monospace">
|
|
|
|
|
<?php echo trim(chunk_split($c['code'], 5, ' ')); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text-muted">
|
|
|
|
|
<i class="fas fa-mobile-alt"></i> <?php echo $c['description']; ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
if (count($activecodes) > 0) {
|
|
|
|
|
foreach ($activecodes as $c) {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item d-flex justify-content-between align-items-center">
|
|
|
|
|
<div>
|
|
|
|
|
<div class="text-monospace">
|
|
|
|
|
<?php echo trim(chunk_split($c['code'], 5, ' ')); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<a class="btn btn-primary btn-sm m-1" href="app.php?page=sync&mobilecode=generate&showsynccode=<?php echo $c['codeid']; ?>">
|
|
|
|
|
<i class="fas fa-qrcode"></i>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="btn btn-danger btn-sm m-1" href="app.php?page=sync&delsynccode=<?php echo $c['codeid']; ?>">
|
|
|
|
|
<i class='fas fa-trash'></i>
|
|
|
|
|
</a>
|
|
|
|
|
<div class="text-muted">
|
|
|
|
|
<i class="fas fa-mobile-alt"></i> <?php echo $c['description']; ?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
?>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<?php $Strings->get("no active codes"); ?>
|
|
|
|
|
<div>
|
|
|
|
|
<a class="btn btn-primary btn-sm m-1" href="app.php?page=sync&mobilecode=generate&showsynccode=<?php echo $c['codeid']; ?>">
|
|
|
|
|
<i class="fas fa-qrcode"></i>
|
|
|
|
|
</a>
|
|
|
|
|
<a class="btn btn-danger btn-sm m-1" href="app.php?page=sync&delsynccode=<?php echo $c['codeid']; ?>">
|
|
|
|
|
<i class='fas fa-trash'></i>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="list-group-item">
|
|
|
|
|
<?php $Strings->get("no active codes"); ?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|