diff --git a/database/yggtracker.mwb b/database/yggtracker.mwb index a18577b..75b7bf5 100644 Binary files a/database/yggtracker.mwb and b/database/yggtracker.mwb differ diff --git a/src/library/database.php b/src/library/database.php index ae572a1..56c415c 100644 --- a/src/library/database.php +++ b/src/library/database.php @@ -537,6 +537,17 @@ class Database { return $query->rowCount(); } + public function updateUserPublic(int $userId, bool $public, int $timeUpdated) : int { + + $this->_debug->query->update->total++; + + $query = $this->_db->prepare('UPDATE `user` SET `public` = ?, `timeUpdated` = ? WHERE `userId` = ?'); + + $query->execute([(int) $public, $timeUpdated, $userId]); + + return $query->rowCount(); + } + // Magnet public function addMagnet(int $userId, int $xl, diff --git a/src/public/assets/theme/default/css/framework.css b/src/public/assets/theme/default/css/framework.css index 95d80c2..090d649 100644 --- a/src/public/assets/theme/default/css/framework.css +++ b/src/public/assets/theme/default/css/framework.css @@ -40,9 +40,15 @@ color: #d77575; } +.text-color-pink { + color: #b55cab; +} + +/* .text-color-pink { color: #a44399; } +*/ .text-color-blue { color: #5785b7; @@ -193,6 +199,10 @@ padding-bottom: 8px; } +.padding-b-16 { + padding-bottom: 16px; +} + .padding-t-16 { padding-top: 16px; } @@ -261,6 +271,10 @@ margin-bottom: 16px; } +.margin-b-24 { + margin-bottom: 24px; +} + .display-block { display: block; } diff --git a/src/public/welcome.php b/src/public/welcome.php new file mode 100644 index 0000000..a369f7d --- /dev/null +++ b/src/public/welcome.php @@ -0,0 +1,156 @@ + + true, + 'message' => _('Internal server error'), +]; + +// Yggdrasil connections only +if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR'])) +{ + $response->success = false; + $response->message = _('Yggdrasil connection required for this action'); +} + +// Init session +else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) +{ + $response->success = false; + $response->message = _('Could not init user session'); +} + +// Init user +else if (!$user = $db->getUser($userId)) +{ + $response->success = false; + $response->message = _('Could not get user session'); +} + +// User can change public level once, because by agreement data could be already sent +// Otherwise, local access level could be changed to public on settings page later +// Redirect to website features +else if (!is_null($user->public)) +{ + header( + sprintf('Location: %s', WEBSITE_URL) + ); +} + +// Apply answer on form submit +else if (isset($_POST['public'])) +{ + if ($db->updateUserPublic($user->userId, (bool) $_POST['public'], time())) + { + header( + sprintf('Location: %s', WEBSITE_URL) + ); + } +} + +?> + + + + + + + <?php echo sprintf(_('Welcome to %s'), WEBSITE_NAME) ?> + + + + + + +
+
+ +
+
+
+
+
+
+
+ success) { ?> +
+
+

+
+

+

+

address ?>

+
+
+ + +
+
+ +
+
+
+ +
message ?>
+ +
+
+
+
+
+ + + \ No newline at end of file