From b46cee71f79795f7300c275f2cfea7fca27a752d Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 7 Feb 2017 17:49:10 +0100 Subject: Web interface --- frontend/index.php | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 frontend/index.php (limited to 'frontend/index.php') diff --git a/frontend/index.php b/frontend/index.php new file mode 100644 index 0000000..373052f --- /dev/null +++ b/frontend/index.php @@ -0,0 +1,229 @@ + + Your account has been created. + Your name is name?> and your password is . + Store this password in a secure place. + ' . $e->getMessage() . '.

'; + } +} + +if (isset($_POST['login'])) { + $authors = Author::search($_pdo, ['`name` like ?'], [$_POST['login_name']]); + if (count($authors) == 0) { + echo '

No such user.

'; + } else { + $author = $authors[0]; + if ($author->verifyPassword($_POST['login_pass'])) { + $_SESSION['logged_in_id'] = $author->id; + } else { + echo '

Invalid password.

'; + } + } +} + +if (isset($_SESSION['logged_in_id'])) { + $_author = new Author($_pdo, $_SESSION['logged_in_id']); + echo "You are logged in as {$_author->name}. Logout.
"; + + if (isset($_POST['create_pkg'])) { + try { + $pkg = Package::create($_pdo, + [ $_author->id + , $_POST['create_pkg_name'] + , $_POST['create_pkg_url'] + , $_POST['create_pkg_git_url'] + , $_POST['create_pkg_desc']]); + echo 'Your package has been created.'; + } catch (Exception $e) { + echo '

' . $e->getMessage() . '.

'; + } + } +} +?> + +

Packages

+No packages found.

'; +else : +?> + + + + + + + + + + + + "; + + if ($pkg->url != '') + echo ""; + else + echo ""; + + echo ""; + + echo + " + "; + } + ?> +
NameAuthorDescriptionWebsiteVersions
{$pkg->name}" . $pkg->getAuthor()->name . "{$pkg->desc}Go&endash;"; + foreach ($pkg->getVersions() as $v) + echo "{$v->major}.{$v->minor}.{$v->revision} ({$v->time_added})"; + echo "{$pkg->name}
+ + +
+ +

Create an account

+You only need an account to add new packages. +
+ + + + + + + + + + + + + + + +
NamePosted publicly.
EmailKept private.
+
+ +
+ + +

Your packages

+ getPackages(); + if (count($pkgs) == 0) : + echo '

No packages found.

'; + else : + ?> +

To change details, please contact the CLPM maintainer.

+ + + + + + + + + "; + if ($pkg->url != '') + echo ""; + else + echo ""; + echo " + + + "; + } + ?> +
NameURLGit URLDescription
{$pkg->name}{$pkg->url}&endash;{$pkg->git_url}{$pkg->desc}
+ + +

Add new

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
NameShown publicly.
URLShown publicly.
Git URL +

Your git repository. It should not require authorisation.

+

On scheduled intervals, we will clone the repository and + search for tags that look like a version number, e.g. v1.0.2. + For those versions that are not yet found in the database, + we will checkout the tag and run make TARGET.tar.gz for all targets + (currently linux32, linux64, mac, win32 and win64). + We will then copy tose files to /repo/PACKAGE/VERSION/PLATFORM.tar.gz.

+
Description + +
+
+ +

Login

+
+ + + + + + + + + + + + + +
Name
Password
+

If you lost your password, please contact the CLPM maintainer.

+
+