Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions about.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
session_start();
$page_title = "About";
$page_title = 'About';
?>
<!DOCTYPE html>
<html>
<head>
<?php require("partials/html.head.php"); ?>
<?php require('partials/html.head.php'); ?>
</head>
<body>
<h1 id="page-title">About</h1>
Expand Down Expand Up @@ -34,6 +34,6 @@
</ul>
</p>
</div>
<?php require("partials/footer.php"); require("partials/header.php"); ?>
<?php require('partials/footer.php'); require('partials/header.php'); ?>
</body>
</html>
Expand Down
184 changes: 92 additions & 92 deletions candidate.php

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions config/constants.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
define('IS_LOCALHOST', $_SERVER["SERVER_ADDR"] == "127.0.0.1");
define('IS_HTTPS', !empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] != "off");
define('IS_LOCALHOST', $_SERVER['SERVER_ADDR'] == '127.0.0.1');
define('IS_HTTPS', !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off');
define('IS_SECURE', IS_HTTPS || IS_LOCALHOST);

define('REL_ADDRESS', substr(dirname(dirname(__FILE__)), strlen(rtrim($_SERVER['DOCUMENT_ROOT'], '/'))) . '/');
define('RELATIVE_URL', substr($_SERVER["REQUEST_URI"], strlen(REL_ADDRESS)));
define('RELATIVE_URL', substr($_SERVER['REQUEST_URI'], strlen(REL_ADDRESS)));

define('ROOT_URL', (IS_HTTPS ? "https" : "http") . "://"
. $_SERVER["SERVER_NAME"]
define('ROOT_URL', (IS_HTTPS ? 'https' : 'http') . '://'
. $_SERVER['SERVER_NAME']
. REL_ADDRESS);
define('SECURE_ROOT_URL', IS_SECURE ? ROOT_URL : "https://ahk4.net/user/maulesel/");
define('SECURE_ROOT_URL', IS_SECURE ? ROOT_URL : 'https://libba.net/');

define('API_URL', ROOT_URL . "api");
define('SECURE_API_URL', SECURE_ROOT_URL . "api");
define('API_URL', ROOT_URL . 'api');
define('SECURE_API_URL', SECURE_ROOT_URL . 'api');
?>
34 changes: 17 additions & 17 deletions create-account.php
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
<?php
require_once("util/ALD.php");
require_once("util/db.php");
require_once("modules/HttpException/HttpException.php");
require_once("config/constants.php");
require_once('util/ALD.php');
require_once('util/db.php');
require_once('modules/HttpException/HttpException.php');
require_once('config/constants.php');

try
{
# check if required data present
if (empty($_POST["user"]) || empty($_POST["mail"]) || empty($_POST["id"]))
if (empty($_POST['user']) || empty($_POST['mail']) || empty($_POST['id']))
{
throw new HttpException(400, NULL, "data missing");
throw new HttpException(400, NULL, 'data missing');
}

$db_connection = db_ensure_connection();

# check if account exists
$db_query = "SELECT * FROM $db_table_user_profile WHERE mail = '$mail' OR id = UNHEX('$id')";
$db_query = 'SELECT * FROM ' . DB_TABLE_USER_PROFILE . ' WHERE mail = "' . $mail . '" OR id = UNHEX("' . $id . '")';
$db_result = mysql_query($db_query, $db_connection);
if (!$db_result)
{
throw new HttpException(500, NULL, mysql_error());
}
if (mysql_num_rows($db_result) > 0)
{
throw new HttpException(409, NULL, "Account already exists");
throw new HttpException(409, NULL, 'Account already exists');
}

# check if user is correct
$api = new ALD( API_URL );
try
{
$user = $api->getUserById($_POST["id"]);
$user = $api->getUserById($_POST['id']);
}
catch (HttpException $e)
{
throw new HttpException(404, NULL, "User not found in backend: '{$e->getMessage()}'.");
throw new HttpException(404, NULL, 'User not found in backend: "' . $e->getMessage() . '")';
}
if ($user["name"] != $_POST["user"] || $user["mail"] != md5($_POST["mail"]))
if ($user['name'] != $_POST['user'] || $user['mail'] != md5($_POST['mail']))
{
throw new HttpException(400, NULL, "data invalid");
throw new HttpException(400, NULL, 'data invalid');
}

# create account
$id = mysql_real_escape_string($_POST["id"]);
$mail = mysql_real_escape_string($_POST["mail"]);
$id = mysql_real_escape_string($_POST['id']);
$mail = mysql_real_escape_string($_POST['mail']);

$db_query = "INSERT INTO $db_table_user_profile (id, mail) VALUES (UNHEX('$id'), '$mail')";
$db_query = 'INSERT INTO ' . DB_TABLE_USER_PROFILE . ' (id, mail) VALUES (UNHEX("' . $id . '"), "' . $mail . '")';
$db_result = mysql_query($db_query, $db_connection);
if (!$db_result)
{
throw new HttpException(500, NULL, mysql_error());
}

header("HTTP/1.1 204 " . HttpException::getStatusMessage(204));
header('HTTP/1.1 204 ' . HttpException::getStatusMessage(204));
exit;
}
catch (HttpException $e)
{
header("HTTP/1.1 {$e->getCode()} " . HttpException::getStatusMessage($e->getCode()));
header('HTTP/1.1 ' . $e->getCode() . ' ' . HttpException::getStatusMessage($e->getCode()));
echo $e->getMessage();
}
?>
6 changes: 3 additions & 3 deletions help.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php
session_start();
$page_title = "Help";
$page_title = 'Help';
?>
<!DOCTYPE html>
<html>
<head>
<?php require("partials/html.head.php"); ?>
<?php require('partials/html.head.php'); ?>
<link rel="stylesheet" type="text/css" href="style/help.css"/>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="javascript/jquery-ui.js"></script>
Expand Down Expand Up @@ -45,6 +45,6 @@
</p>
</div>
</div>
<?php require("partials/footer.php"); require("partials/header.php"); ?>
<?php require('partials/footer.php'); require('partials/header.php'); ?>
</body>
</html>
8 changes: 4 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
session_start();
$page_title = "Home";
$page_title = 'Home';
?>
<!DOCTYPE html>
<html>
<head>
<?php require("partials/html.head.php"); ?>
<?php require('partials/html.head.php'); ?>
<link rel="stylesheet" type="text/css" href="style/index.css"/>
</head>
<body>
<?php require("partials/header.php"); ?>
<?php require('partials/header.php'); ?>
<div id="page-content">
<a href="about" title="Get to know libba.net"><img id="logo" alt="libba.net logo" src="images/logo.png"/></a>

Expand Down Expand Up @@ -40,6 +40,6 @@
<a href="http://apache.org" title="Running on Apache"><img alt="apache" src="images/apache.gif"/></a>
</div>
</div>
<?php require("partials/footer.php"); ?>
<?php require('partials/footer.php'); ?>
</body>
</html>
18 changes: 9 additions & 9 deletions internal/mailimage.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<?php
session_start();

require_once("../util/db.php");
require_once('../util/db.php');
$db_connection = db_ensure_connection();

$db_query = "SELECT mail, show_mail FROM $db_table_user_profile WHERE id = UNHEX('" . mysql_real_escape_string($_GET["user"]) . "')";
$db_query = 'SELECT mail, show_mail FROM ' . DB_TABLE_USER_PROFILE . ' WHERE id = UNHEX("' . mysql_real_escape_string($_GET['user']) . '")';
$db_result = mysql_query($db_query, $db_connection);

if (!$db_connection)
{
header("HTTP/1.1 500 Server error");
header('HTTP/1.1 500 Server error');
exit;
}

if (mysql_num_rows($db_result) != 1)
{
header("HTTP/1.1 404 Not found");
header('HTTP/1.1 404 Not found');
exit;
}

$user = mysql_fetch_assoc($db_result);
if ($user["show_mail"] == "hidden" || ($user["show_mail"] == "members" && !isset($_SESSION["user"])))
if ($user['show_mail'] == 'hidden' || ($user['show_mail'] == 'members' && !isset($_SESSION['user'])))
{
header("HTTP/1.1 403 Forbidden");
header('HTTP/1.1 403 Forbidden');
exit;
}

$width = 10 + 7.5 * strlen($user['mail']);

if (!$image = @imagecreate($width, 15))
{
header("HTTP/1.1 500 Server error");
header('HTTP/1.1 500 Server error');
exit;
}

Expand All @@ -40,14 +40,14 @@

if (!imagettftext($image, 10, 0, 5, 12.5, $black, '../style/font/Quicksand_Bold-webfont.ttf', $user['mail']))
{
header("HTTP/1.1 500 Server error");
header('HTTP/1.1 500 Server error');
exit;
}

header('Content-Type: image/jpeg');
if (!imagepng($image))
{
header("HTTP/1.1 500 Server error");
header('HTTP/1.1 500 Server error');
exit;
}
imagedestroy($image);
Expand Down
10 changes: 5 additions & 5 deletions items/compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
define('ACT_DEL', 2);
define('ACT_MOD', 3);

$page_title = "Compare ERROR";
$page_title = 'Compare ERROR';
$error = true; $warning = false;
for ($i = 0; $i < 1; $i++) {
$api = new ALD(API_URL);
Expand Down Expand Up @@ -152,7 +152,7 @@
}
}

$page_title = "Comparing $item_name v$version_old with v$version_new";
$page_title = 'Comparing ' . $item_name . ' v' . $version_old . ' with v' . $version_new;
$error = false;
}
?>
Expand Down Expand Up @@ -206,10 +206,10 @@
foreach ($meta_actions AS $action) {
switch ($action['type']) {
case ACT_ADD: $prefix = 'Added:';
$details = "Property <code>$action[property]</code> has been added to the package metadata.";
$details = 'Property <code>' . $action['property'] . '</code> has been added to the package metadata.';
break;
case ACT_DEL: $prefix = 'Deleted:';
$details = "Property <code>$action[property]</code> has been removed from the package metadata.";
$details = 'Property <code>' . $action['property'] . '</code> has been removed from the package metadata.';
break;
default:
case ACT_MOD: $prefix = 'Modified:';
Expand All @@ -226,7 +226,7 @@
</body>
</html>
<?php
require_once("../util/rewriter.php");
require_once('../util/rewriter.php');
echo rewrite();
ob_end_flush();
?>
Loading