diff --git a/apps/sync_mobile.php b/apps/sync_mobile.php deleted file mode 100644 index 7ded6d8..0000000 --- a/apps/sync_mobile.php +++ /dev/null @@ -1,105 +0,0 @@ -get("sync mobile", false); - $APPS["sync_mobile"]["icon"] = "mobile"; - - if (!is_empty($_GET['delsynccode'])) { - if ($database->has("mobile_codes", ["AND" => ["uid" => $_SESSION['uid'], "codeid" => $_GET['delsynccode']]])) { - $database->delete("mobile_codes", ["AND" => ["uid" => $_SESSION['uid'], "codeid" => $_GET['delsynccode']]]); - } - } - - if ($_GET['mobilecode'] == "generate") { - if (!is_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)); - $database->insert('mobile_codes', ['uid' => $_SESSION['uid'], 'code' => $code]); - } - 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); - $APPS["sync_mobile"]["content"] = '
' - . $Strings->get("scan sync qrcode", false) - . '
' - . << -.margintop-15px { - margin-top: 15px; -} -.mono-chunk { - text-align: center; - font-size: 110%; - font-family: monospace; -} - - -
-
-END - . "" . $Strings->get("manual setup", false) . "
" - . '
' . $_SESSION['username'] . '
' - . "" - . <<$chunk_code
-END - . "" - . <<$url
- - -$lang_done -END; - } else { - $activecodes = $database->select("mobile_codes", ["codeid", "code"], ["uid" => $_SESSION['uid']]); - $content = '
' . $Strings->get("sync explained", false) . '
' - . '' - . $Strings->get("generate sync", false) . ''; - $content .= "
" . $Strings->get("active sync codes", false) . ":
"; - $content .= "
"; - if (count($activecodes) > 0) { - foreach ($activecodes as $c) { - $content .= "
" . trim(chunk_split($c['code'], 5, ' ')) . "
"; - } - } else { - $content .= "
" . $Strings->get("no active codes", false) . "
"; - } - $content .= "
"; - $content .= << - .mobilekey { - display: flex; - flex-wrap: wrap; - justify-content: space-between; - } - .mobilekey #mobilecode { - font-family: Ubuntu Mono,monospace; - flex-shrink: 0; - } - -END; - $APPS["sync_mobile"]["content"] = $content; - } -} \ No newline at end of file diff --git a/database.mwb b/database.mwb index 361362e..e514b55 100644 Binary files a/database.mwb and b/database.mwb differ diff --git a/database.sql b/database.sql index a4e8264..a5d10da 100644 --- a/database.sql +++ b/database.sql @@ -1,5 +1,5 @@ -- MySQL Script generated by MySQL Workbench --- Tue 24 Jul 2018 01:22:42 AM MDT +-- Sat 28 Jul 2018 03:55:27 PM MDT -- Model: New Model Version: 1.0 -- MySQL Workbench Forward Engineering @@ -301,6 +301,7 @@ CREATE TABLE IF NOT EXISTS `notifications` ( `url` VARCHAR(255) NOT NULL, `seen` TINYINT(1) NOT NULL DEFAULT 0, `sensitive` TINYINT(1) NOT NULL, + `appid` VARCHAR(255) NULL, PRIMARY KEY (`notificationid`, `uid`), UNIQUE INDEX `notificationid_UNIQUE` (`notificationid` ASC), INDEX `fk_notifications_accounts1_idx` (`uid` ASC), diff --git a/database_upgrade/1.0.1_2.0.sql b/database_upgrade/1.0.1_2.0.sql index 5534e26..6742458 100644 --- a/database_upgrade/1.0.1_2.0.sql +++ b/database_upgrade/1.0.1_2.0.sql @@ -14,24 +14,25 @@ ENGINE = InnoDB DEFAULT CHARACTER SET = utf8; CREATE TABLE IF NOT EXISTS `notifications` ( - `notificationid` INT(11) NOT NULL AUTO_INCREMENT, - `uid` INT(11) NOT NULL, + `notificationid` INT NOT NULL AUTO_INCREMENT, + `uid` INT NOT NULL, `timestamp` DATETIME NOT NULL, `title` VARCHAR(255) NOT NULL, `content` TINYTEXT NOT NULL, `url` VARCHAR(255) NOT NULL, `seen` TINYINT(1) NOT NULL DEFAULT 0, - `sensitive` TINYINT(1) NOT NULL DEFAULT 0, + `sensitive` TINYINT(1) NOT NULL, + `appid` VARCHAR(255) NULL, PRIMARY KEY (`notificationid`, `uid`), UNIQUE INDEX `notificationid_UNIQUE` (`notificationid` ASC), INDEX `fk_notifications_accounts1_idx` (`uid` ASC), CONSTRAINT `fk_notifications_accounts1` FOREIGN KEY (`uid`) - REFERENCES `accounthub`.`accounts` (`uid`) + REFERENCES `accounts` (`uid`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB -DEFAULT CHARACTER SET = utf8 +DEFAULT CHARACTER SET = utf8; SET FOREIGN_KEY_CHECKS = 0;