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

Commit 1c1f9c6f authored by fauno's avatar fauno

adjusted site model to be more like libre.fm/homepage (the new one!)

parent c5723ae7
......@@ -24,9 +24,9 @@ require_once('database.php');
session_start();
if(isset($_SESSION['session_id'])) {
$res = $mdb2->query("SELECT Users.username,userlevel FROM Scrobble_Sessions,Users WHERE "
. "sessionid = " . $mdb2->quote($_SESSION['session_id'], "text")
. " AND expires > " . time() . " AND Users.username = Scrobble_Sessions.username");
$res = $mdb2->query('SELECT Users.username,userlevel FROM Scrobble_Sessions,Users WHERE '
. 'sessionid = ' . $mdb2->quote($_SESSION['session_id'], 'text')
. ' AND expires > ' . time() . ' AND Users.username = Scrobble_Sessions.username');
if(!$res->numRows()) {
// Session is invalid
unset($_SESSION['session_id']);
......
......@@ -22,6 +22,7 @@
require_once('database.php');
require_once('templating.php');
require_once($install_path . '/data/User.php');
if(isset($_POST['login'])) {
......@@ -53,6 +54,9 @@ if(isset($_POST['login'])) {
$_SESSION['session_id'] = $session_id;
$logged_in = true;
$smarty->assign('logged_in', true);
$_SESSION['user'] = new User($username);
$smarty->assign('user', $_SESSION['user']);
}
}
}
......
......@@ -38,7 +38,7 @@ if(isset($user->name)) {
$smarty->assign('bio', $user->bio);
$smarty->assign('homepage', $user->homepage);
$smarty->assign('location', $user->location);
$smarty->assign('scrobbles', $user->getScrobbles(10));
$smarty->assign('scrobbles', $user->getScrobbles(20));
$smarty->assign('userlevel', $user->userlevel);
$smarty->display('profile.tpl');
} else {
......
html, body, #doc3,h1{margin: 0; padding: 0; font-family: Liberation Sans, Verdana}
html {
background-color: #ECECEC;
color: #2e3436;
}
a {
text-decoration: none;
outline: none;
color: #3465a4;
}
img {
border: none
}
#hd{background: #980101 url(images/header.png) no-repeat;
background-position: 15px top;
-moz-border-radius-bottomleft: 10px;
-moz-border-radius-bottomright: 10px;
width: 80%;
border: 0;
margin: 0;
padding: 0;
margin: auto;
padding: 0 15px;
}
#hd a{
......@@ -21,27 +39,34 @@ html, body, #doc3,h1{margin: 0; padding: 0; font-family: Liberation Sans, Verdan
}
#menu {
color: #eee;
float: left;
background: #980101;
padding: 1em;
margin-right: 1em;
margin-bottom: 1em;
width: 160px;
font-size: 90%;
}
#menu a {
color: #CC8F5C;
text-decoration: none;
color: #666;
margin: .5em auto;
font-size: .8em;
width: 80%;
clear: both;
}
div#menu ul li {
padding: 0 1em;
display: inline
}
#menu a {
text-decoration: none;
color: #2e3436
}
#menu a:hover {
text-decoration: underline;
}
#menu a:hover {
text-decoration: underline;
}
#menu a:visited {
color: #2e3436;
}
#main {
padding-left: 215px;
width: 75%;
margin: auto;
background-color: #FFF;
padding: 2em;
-moz-border-radius: 10px
}
h2 {
......@@ -49,6 +74,8 @@ h2 {
margin-bottom: 5px;
}
div#footer a {
}
.yui-b, #ft{padding: 1em;}
.odd { background:#F4B624 !important; color:#000; }
......@@ -105,7 +132,6 @@ div#login form fieldset input {
div#invite form fieldset input[type=submit],
div#register form fieldset input[type=submit],
div#login form fieldset input[type=submit] {
background: white;
margin: 0;
width: 100%;
}
......@@ -147,7 +173,8 @@ ul#topartists.listcloud dd { font-size: 80%; }
color: #666666
}
dl.gobbles { }
dl.gobbles {
}
dl.gobbles dt.artist a {
text-decoration: none;
color: #2e3436;
......
</div>
</div>
<div id='footer'>
<p><a rel='license' href='http://creativecommons.org/licenses/by-sa/3.0/us/'><img src='themes/librefm/images/cc-by-sa.png'/></a></p>
</div>
</body>
</html>
......@@ -6,7 +6,7 @@
<p id='errors'>{$errors}</p>
{/if}
<div id="login">
<div id='login'>
<form action='' method='post'>
<fieldset>
<label for='username'>Username<span>&nbsp;</span></label>
......@@ -15,7 +15,7 @@
<label for='password'>Password<span>&nbsp;</span></label>
<input id='password' name='password' type='password' value=''/>
<input type='submit' name='login' value="Let me in!" />
<input type='submit' name='login' value='Let me in!' />
</fieldset>
</form>
......
<div id="menu">
{if ($logged_in)}
<p>Logged in as: <a href="{$base_url}/profile.php?user={$username|urlencode}">{$username}</a></p>
{/if}
<ul id="navigation">
{if ($logged_in)}
<li><a href="{$base_url}/profile.php?user={$username|urlencode}">{$username}</a></li>
{/if}
<ul id="navigation">
{if ($logged_in)}
<li>Invites disabled</li>
{if $userlevel > 0}
<li><a href="/admin.php">Admin panel</a></li>
{/if}
{else}
<li><a href="{$base_url}/login.php">Login</a></li>
<li><a href="{$base_url}/request.php">Request invitation</a></li>
{/if}
<li>Explore:
<ul>
{if ($logged_in)}
<li>Invites disabled</li>
{if $userlevel > 0}
<li><a href="/admin.php">Admin panel</a></li>
{/if}
{else}
<li><a href="{$base_url}/login.php">Login</a></li>
<li><a href="{$base_url}/request.php">Request invitation</a></li>
{/if}
<li>Explore:</li>
<li><a href="explore.php?mode=artists">Artists</a></li>
</ul>
</li>
</ul>
</div>
......@@ -20,7 +20,7 @@
<p>{$bio}</p>
</dd>
</dl>
<h3>Latest 10 Gobbles:</h3>
<h3>Latest {$scrobbles|@count} Gobbles:</h3>
{section name=i loop=$scrobbles}
{if $smarty.capture.artist_last <> $scrobbles[i].artist}
{if $scrobbles[i] != $scrobbles[0]}
......
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