Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
Restructure GetMenu() and GetMainPageContent() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrisp2 committed Oct 23, 2018
1 parent ae6f721 commit 23eca0d
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,26 +682,19 @@ function GetAllUsers() {
function GetMainPageContent() {
if (isset($_COOKIE['username'])) {
$hasaccess = CheckUserAccess($_COOKIE['username']);
} else {
$hasaccess = 0;
}
if ($hasaccess > 0) {
return "Welcome, " . $_COOKIE['username'] . ". You are already logged in, and you are registered as a member with access to the app, so feel free to stick around.";
} else {
$hasaccess = 0;
return "This app is only intended for use by the <?php echo $teamname; ?> Translation Team. You need to login before you proceed to use anything in this app!<br /><a href=\"https://steemconnect.com/oauth2/authorize?client_id=aristotle.app&redirect_uri=https://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . "callback.php&scope=login\" class=\"font-weight-bold\">Secure login via SteemConnect</a>";
}

}

function GetMenu() {
if (isset($_COOKIE['username'])) {
$hasaccess = CheckUserAccess($_COOKIE['username']);
} else {
$hasaccess = 0;
}
if ($hasaccess > 0) {
return "<button type=\"button\" class=\"btn btn-secondary dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Welcome ".$_COOKIE['username']."</button><div class=\"dropdown-menu dropdown-menu-right\"><a class=\"btn dropdown-item\" href=\"logout.php\">Logout</a></div>";
} else {
$hasaccess = 0;
return "<button type=\"button\" class=\"btn btn-secondary dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Welcome, Guest</button><div class=\"dropdown-menu dropdown-menu-right\"><a class=\"btn dropdown-item\" href=\"https://steemconnect.com/oauth2/authorize?client_id=aristotle.app&redirect_uri=". $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . "callback.php&scope=login\">Login via SteemConnect</a></div>";
}
}
Expand Down

0 comments on commit 23eca0d

Please sign in to comment.