We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 113db174 authored by tonyb486's avatar tonyb486

Added beginning of profile page

parent 8f9a60a4
<?php
/* Libre.fm -- a free network service for sharing your music listening habits
Copyright (C) 2009 Libre.fm Project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once($install_path . '/database.php');
require_once($install_path . "/data/sanitize.php");
/**
* Represents User data
*
* General attributes are accessible as public variables.
*
*/
class User {
public $name, $email, $fullname, $bio, $location, $homepage, $error;
/**
* Artist constructor
*
* @param string name The name of the artist to load
*/
function __construct($name) {
global $mdb2;
$res = $mdb2->query("SELECT * FROM Users WHERE "
. "username = " . $mdb2->quote($name, "text"));
if($res->numRows()) {
$row = sanitize($res->fetchRow(MDB2_FETCHMODE_ASSOC));
$this->name = $row["username"];
$this->email = $row["email"];
$this->fullname = $row["fullname"];
$this->homepage = $row["homepage"];
$this->bio = $row["bio"];
$this->location = $row["location"];
}
}
function getgobbles($number) {
$res = $mdb2->query("SELECT "); /* stub for now */
}
}
<?php
/* Libre.fm -- a free network service for sharing your music listening habits
Copyright (C) 2009 Libre.fm Project
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once('database.php');
require_once('templating.php');
require_once('data/User.php');
require_once('utils/EmailAddressValidator.php');
if(!isset($_GET['user'])) {
$smarty->assign("error", "Error!");
$smarty->assign("details", "User not set! You shouldn't be here!");
$smarty->display("error.tpl");
die();
}
$user = new User($_GET['user']);
if(isset($user->name)) {
$smarty->assign("user", $user->name);
$smarty->assign("email", $user->email);
$smarty->assign("fullname", $user->fullname);
$smarty->assign("bio", $user->bio);
$smarty->assign("homepage", $user->homepage);
$smarty->assign("location", $user->location);
$smarty->display("profile.tpl");
} else {
$smarty->assign("error", "User not found");
$smarty->assign("details", "Shall I call in a missing persons report?");
$smarty->display("error.tpl");
}
?>
{include file='header.tpl'}
<h2>{$error}</h2>
{$details}
{include file='footer.tpl'}
{include file='header.tpl'}
<h2>{$user}'s profile</h2>
Username: {$user} <br />
Real Name: {$fullname} <br />
Homepage: {$homepage} <br />
Location: {$location} <br />
Bio: {$bio} <br />
{include file='footer.tpl'}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment