mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
New page template system kinda.
This commit is contained in:
parent
259e4132ed
commit
6f40bebfc2
20 changed files with 532 additions and 105 deletions
|
@ -30,6 +30,5 @@ updatePageViews($conn);
|
|||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/archive.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'archive';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"scrivo/highlight.php": "v9.18.1.7",
|
||||
"ext-pdo": "*",
|
||||
"ext-openssl": "*",
|
||||
"erusev/parsedown": "^1.7"
|
||||
"erusev/parsedown": "^1.7",
|
||||
"ext-gd": "*"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,6 @@ $random_pastes = array_map('transformPasteRow', getRandomPastes($conn, 10));
|
|||
|
||||
// Theme
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/discover.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'discover';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
||||
|
|
|
@ -20,12 +20,9 @@ require_once('includes/functions.php');
|
|||
// UTF-8
|
||||
header('Content-Type: text/html; charset=utf-8');
|
||||
|
||||
$date = date('jS F Y');
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/event.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'event';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
34
includes/ViewBag.class.php
Normal file
34
includes/ViewBag.class.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
class ViewBag {
|
||||
private static array $global = [];
|
||||
private static array $local = [];
|
||||
|
||||
public static function putGlobal(string $key, string $value) : void {
|
||||
ViewBag::$global[$key] = $value;
|
||||
}
|
||||
|
||||
public static function put(string $key, string $value) : void {
|
||||
ViewBag::$local[$key] = $value;
|
||||
}
|
||||
|
||||
public static function getGlobal(string $key, bool $escape = true) : string {
|
||||
$value = ViewBag::$global[$key];
|
||||
|
||||
if ($escape) {
|
||||
$value = pp_html_escape($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
public static function get(string $key, bool $escape = true) : string {
|
||||
$value = ViewBag::$local[$key];
|
||||
|
||||
if ($escape) {
|
||||
$value = pp_html_escape($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
|
@ -101,22 +101,25 @@ function captcha($color, $mode, $mul, $allowed) : array {
|
|||
}
|
||||
|
||||
if (!function_exists('hex2rgb')) {
|
||||
function hex2rgb($hex_str, $return_string = false, $separator = ',') {
|
||||
function hex2rgb($hex_str) : array | null {
|
||||
$hex_str = preg_replace("/[^0-9A-Fa-f]/", '', $hex_str); // Gets a proper hex string
|
||||
$rgb_array = array();
|
||||
|
||||
if (strlen($hex_str) == 6) {
|
||||
$color_val = hexdec($hex_str);
|
||||
$rgb_array['r'] = 0xFF & ($color_val >> 0x10);
|
||||
$rgb_array['g'] = 0xFF & ($color_val >> 0x8);
|
||||
$rgb_array['b'] = 0xFF & $color_val;
|
||||
return [
|
||||
'r' => 0xFF & ($color_val >> 0x10),
|
||||
'g' => 0xFF & ($color_val >> 0x8),
|
||||
'b' => 0xFF & $color_val
|
||||
];
|
||||
} elseif (strlen($hex_str) == 3) {
|
||||
$rgb_array['r'] = hexdec(str_repeat(substr($hex_str, 0, 1), 2));
|
||||
$rgb_array['g'] = hexdec(str_repeat(substr($hex_str, 1, 1), 2));
|
||||
$rgb_array['b'] = hexdec(str_repeat(substr($hex_str, 2, 1), 2));
|
||||
} else {
|
||||
return false;
|
||||
return [
|
||||
'r' => hexdec(str_repeat(substr($hex_str, 0, 1), 2)),
|
||||
'g' => hexdec(str_repeat(substr($hex_str, 1, 1), 2)),
|
||||
'b' => hexdec(str_repeat(substr($hex_str, 2, 1), 2))
|
||||
];
|
||||
}
|
||||
return $return_string ? implode($separator, $rgb_array) : $rgb_array;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ require_once(__DIR__ . '/config.php');
|
|||
require_once(__DIR__ . '/functions.php');
|
||||
require_once(__DIR__ . '/DatabaseHandle.class.php');
|
||||
require_once(__DIR__ . '/User.class.php');
|
||||
require_once(__DIR__ . '/ViewBag.class.php');
|
||||
|
||||
/* View functions */
|
||||
function urlForPaste($paste_id) : string {
|
||||
|
@ -98,11 +99,10 @@ $conn = new DatabaseHandle("mysql:host=$db_host;dbname=$db_schema;charset=utf8mb
|
|||
|
||||
// Setup site info
|
||||
$site_info = getSiteInfo();
|
||||
$global_site_info = $site_info['site_info'];
|
||||
$row = $site_info['site_info'];
|
||||
$title = Trim($row['title']);
|
||||
$des = Trim($row['description']);
|
||||
$baseurl = Trim($row['baseurl']);
|
||||
$keyword = Trim($row['keywords']);
|
||||
$site_name = Trim($row['site_name']);
|
||||
$email = Trim($row['email']);
|
||||
$ga = Trim($row['google_analytics']);
|
||||
|
@ -125,9 +125,6 @@ if ($site_permissions) {
|
|||
$disableguest = 'off';
|
||||
}
|
||||
|
||||
$privatesite = $siteprivate;
|
||||
$noguests = $disableguest;
|
||||
|
||||
// CAPTCHA configuration
|
||||
$captcha_config = $site_info['captcha'];
|
||||
$captcha_enabled = (bool)$captcha_config['enabled'];
|
||||
|
@ -151,10 +148,8 @@ $total_unique_views = getSiteTotal_unique_views($conn);
|
|||
|
||||
$current_user = User::current($conn);
|
||||
|
||||
if ($current_user) {
|
||||
$noguests = "off";
|
||||
}
|
||||
|
||||
/* Security headers */
|
||||
header('X-Frame-Options: SAMEORIGIN');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
|
||||
//ob_start();
|
||||
|
|
|
@ -45,21 +45,12 @@ if (gethostname() === 'thunderlane') {
|
|||
const PP_ENCRYPTION_ALGO = 'AES-256-CBC';
|
||||
const PP_ENCRYPTION_KEY = '';
|
||||
|
||||
|
||||
// Available GeSHi formats
|
||||
$geshiformats = [
|
||||
const PP_HIGHLIGHT_FORMATS = [
|
||||
'green' => 'Green Text',
|
||||
'text' => 'Plain Text',
|
||||
'pastedown' => 'pastedown',
|
||||
'pastedown_old' => 'pastedown old'
|
||||
];
|
||||
|
||||
// Popular formats that are listed first.
|
||||
$popular_formats = [
|
||||
'green',
|
||||
'text',
|
||||
'pastedown',
|
||||
'pastedown_old'
|
||||
];
|
||||
|
||||
// Cookie - I want a cookie, can I have one?
|
||||
|
|
|
@ -232,9 +232,9 @@ function doDownload($paste_id, $p_title, $p_member, $p_conntent, $p_code) {
|
|||
return $stats;
|
||||
}
|
||||
|
||||
function embedView($paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl, $ges_style, $lang) {
|
||||
function embedView($paste_id, $p_title, $content, $p_code, $title, $baseurl, $lang) {
|
||||
$stats = false;
|
||||
if ($p_conntent) {
|
||||
if ($content) {
|
||||
// Build the output
|
||||
$output = "<div class='paste_embed_conntainer'>";
|
||||
$output .= "<style>"; // Add our own styles
|
||||
|
@ -282,8 +282,7 @@ function embedView($paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl,
|
|||
line-height:20px;
|
||||
}";
|
||||
$output .= "</style>";
|
||||
$output .= "$ges_style"; // Dynamic GeSHI Style
|
||||
$output .= $p_conntent; // Paste content
|
||||
$output .= $content; // Paste content
|
||||
$output .= "<div class='paste_embed_footer'>";
|
||||
$output .= "<a href='https://ponepaste.org/$paste_id'>$p_title</a> " . $lang['embed-hosted-by'] . " <a href='https://ponepaste.org'>$title</a> | <a href='https://ponepaste.org/raw/$paste_id'>" . strtolower($lang['view-raw']) . "</a>";
|
||||
$output .= "</div>";
|
||||
|
@ -291,7 +290,7 @@ function embedView($paste_id, $p_title, $p_conntent, $p_code, $title, $baseurl,
|
|||
|
||||
// Display embed conntent using json_encode since that escapes
|
||||
// characters well enough to satisfy javascript. http://stackoverflow.com/a/169035
|
||||
header('conntent-type: text/javascript; charset=utf-8;');
|
||||
header('Content-Type: text/javascript; charset=utf-8;');
|
||||
echo 'document.write(' . json_encode($output) . ')';
|
||||
$stats = true;
|
||||
} else {
|
||||
|
@ -328,7 +327,5 @@ function addToSitemap($paste_id, $priority, $changefreq, $mod_rewrite) {
|
|||
}
|
||||
|
||||
function paste_protocol() : string {
|
||||
return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
|
||||
return !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -192,7 +192,5 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||
}
|
||||
|
||||
OutPut:
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/main.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'main';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
|
|
@ -140,6 +140,7 @@ if (isset($_POST['forgot'])) {
|
|||
}
|
||||
}
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/login.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'login';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ if (isset($_GET['page'])) {
|
|||
}
|
||||
}
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/pages.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'pages';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
||||
|
||||
|
|
12
paste.php
12
paste.php
|
@ -172,11 +172,10 @@ if ($paste_code === "pastedown") {
|
|||
|
||||
// Embed view after highlighting is applied so that $p_code is syntax highlighted as it should be.
|
||||
if (isset($_GET['embed'])) {
|
||||
embedView($paste_id, $paste_title, $p_content, $paste_code, $title, $baseurl, $ges_style, $lang);
|
||||
embedView($paste_id, $paste_title, $p_content, $paste_code, $title, $baseurl, $lang);
|
||||
exit();
|
||||
}
|
||||
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
if ($password_required && $password_valid) {
|
||||
/* base64 here means that the password is exposed in the URL, technically - how to handle this better? */
|
||||
$p_download = "paste.php?download&id=$paste_id&password=" . base64_encode($password_candidate);
|
||||
|
@ -201,16 +200,15 @@ if (@$_SESSION['not_unique'] !== $paste_id) {
|
|||
$conn->query("UPDATE pastes SET views = (views + 1) where id = ?", [$paste_id]);
|
||||
}
|
||||
|
||||
require_once('theme/' . $default_theme . '/view.php');
|
||||
$page_template = 'view';
|
||||
|
||||
Not_Valid_Paste:
|
||||
|
||||
if ($is_private || $notfound || !$password_valid) {
|
||||
// FIXME
|
||||
// Display errors
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/errors.php');
|
||||
$page_template = 'errors';
|
||||
}
|
||||
|
||||
// Footer
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ $ip = $_SERVER['REMOTE_ADDR'];
|
|||
|
||||
$p_title = $lang['myprofile']; //"My Profile";
|
||||
|
||||
|
||||
// Check if already logged in
|
||||
if ($current_user === null) {
|
||||
header("Location: ./login.php");
|
||||
|
@ -68,6 +67,6 @@ updatePageViews($conn);
|
|||
$total_user_pastes = getTotalPastes($conn, $current_user->user_id);
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/profile.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'profile';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ header('Content-Type: text/html; charset=utf-8');
|
|||
$p_title = $lang['archive']; // "Pastes Archive";
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/rules.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'rules';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
||||
|
|
439
theme/bulma/common.php
Normal file
439
theme/bulma/common.php
Normal file
|
@ -0,0 +1,439 @@
|
|||
<?php
|
||||
|
||||
/* prevent inclusion of arbitrary files */
|
||||
$template_candidates = scandir(__DIR__);
|
||||
if (!in_array($page_template . '.php', $template_candidates)) {
|
||||
die('Failed to find template');
|
||||
}
|
||||
|
||||
//$page_content = ob_get_clean();
|
||||
$date = time();
|
||||
$statrttime = microtime();
|
||||
$time = explode(' ', $statrttime);
|
||||
$time = $time[1] + $time[0];
|
||||
$start = $time;
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?php echo basename($default_lang, ".php"); ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>
|
||||
<?php
|
||||
$title = $global_site_info['title'];
|
||||
|
||||
if (isset($paste_title)) {
|
||||
$title = $paste_title . ' - ' . $title;
|
||||
}
|
||||
|
||||
echo pp_html_escape($title);
|
||||
?>
|
||||
</title>
|
||||
<meta name="description" content="<?= pp_html_escape($global_site_info['description']) ?>"/>
|
||||
<meta name="keywords" content="<?= pp_html_escape($global_site_info['keywords']) ?>"/>
|
||||
<link rel="shortcut icon" href="<?php echo '//' . $baseurl . '/theme/' . $default_theme; ?>/img/favicon.ico">
|
||||
<link href="//<?= $baseurl ?>/theme/bulma/css/paste.css" rel="stylesheet" />
|
||||
<link href="//<?= $baseurl ?>/theme/bulma/css/table-responsive.css" rel="stylesheet" />
|
||||
<link href="//<?= $baseurl ?>/theme/bulma/css/table-row-orders.css" rel="stylesheet" />
|
||||
<script src="//<?= $baseurl ?>/theme/bulma/js/jquery.min.js"></script>
|
||||
<script src="//<?= $baseurl ?>/theme/bulma/js/jquery-ui.min.js"></script>
|
||||
<script src="//<?= $baseurl ?>/theme/bulma/js/paste.js"></script>
|
||||
<script src="//<?= $baseurl ?>/theme/bulma/js/modal-fx.min.js"></script>
|
||||
<script src="//<?= $baseurl ?>/theme/bulma/js/datatables.min.js"></script>
|
||||
<script src=//<?= $baseurl ?>/theme/bulma/js/table-responsive.js"></script>
|
||||
<script src="//<?= $baseurl ?>/theme/bulma/js/table-reorder.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav id="navbar" class="bd-navbar navbar is-spaced">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a style="font-size: 24px;"
|
||||
href="<?php echo '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); ?>"
|
||||
class="navbar-item mx-1"><?php echo $site_name; ?></a>
|
||||
<div class="theme-switch-wrapper">
|
||||
<label class="theme-switch" for="checkbox">
|
||||
<input type="checkbox" id="checkbox" />
|
||||
<div class="slider round"></div>
|
||||
</label>
|
||||
</div>
|
||||
<div id="navbarBurger" class="navbar-burger burger" data-target="navMenuDocumentation">
|
||||
<span></span><span></span><span></span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="navMenuDocumentation" class="navbar-menu">
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item">
|
||||
<?php if ($current_user !== null) {
|
||||
if (!isset($privatesite) || $privatesite !== "on") {
|
||||
if (PP_MOD_REWRITE) {
|
||||
echo ' <a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</span><span>New Paste</span>
|
||||
</a><a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/archive">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Discover</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span></a>';
|
||||
} else {
|
||||
echo '
|
||||
</span>
|
||||
<span>Archive</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/archive">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Lightmode</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Lightmode</span>
|
||||
</a>
|
||||
<span>Discover</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span></a>';
|
||||
}
|
||||
}
|
||||
echo '<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link" role="presentation">' . pp_html_escape($current_user->username) . '</a>
|
||||
<div class="navbar-dropdown">';
|
||||
if (PP_MOD_REWRITE) {
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/user/' . urlencode($current_user->username) . '">Pastes</a>';
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/profile">Settings</a>';
|
||||
} else {
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/user.php?user=' . urlencode($current_user->username) . '">Pastes</a>';
|
||||
echo '<a class="navbar-item" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/profile.php">Settings</a>';
|
||||
}
|
||||
?>
|
||||
<hr class="navbar-divider"/>
|
||||
<form action="../logout.php" method="POST">
|
||||
<input class="button navbar-link" type="submit" value="Logout"
|
||||
style="border:none;padding: 0.375rem 1rem;"/>
|
||||
</form>
|
||||
<?php } else { ?>
|
||||
<div class="buttons">
|
||||
<?php
|
||||
if (!isset($privatesite) || $privatesite != "on") {
|
||||
if (PP_MOD_REWRITE) {
|
||||
echo '<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/archive">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span></a>
|
||||
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-compass" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Discover</span></a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span>';
|
||||
} else {
|
||||
echo '<a class="button" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/discover.php">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-book" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Archive</span>
|
||||
</a>
|
||||
<a class="button navbar-item mx-2" href="' . '//' . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/event.php">
|
||||
<span class="icon has-text-info">
|
||||
<i class="fa fa-calendar" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Events</span>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<a class="button is-info modal-button" data-target="#signin">Sign In</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div id="#signin" class="modal modal-fx-fadeInScale">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-content modal-card is-tiny">
|
||||
<header class="modal-card-head">
|
||||
<nav class="tabs" style="margin-bottom: -1.25rem;flex-grow:1;">
|
||||
<div class="container">
|
||||
<ul>
|
||||
<li class="tab is-active" onclick="openTab(event,'logid')"><a>Login</a></li>
|
||||
<li class="tab" onclick="openTab(event,'regid')"><a>Register</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<button class="modal-button-close delete" aria-label="close"></button>
|
||||
</header>
|
||||
<div id="logid" class="content-tab">
|
||||
<section class="modal-card-body">
|
||||
<form method="POST" action="../login.php">
|
||||
<div class="field">
|
||||
<label class="label"><?php echo $lang['username']; ?></label>
|
||||
<div class="control has-icons-left has-icons-right">
|
||||
<input type="text" class="input" name="username" autocomplete="on"
|
||||
placeholder="<?php echo $lang['username']; ?>">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-user"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label"><?php echo $lang['curpwd']; ?></label>
|
||||
<div class="control has-icons-left has-icons-right">
|
||||
<input type="password" class="input" name="password" autocomplete="on"
|
||||
placeholder="<?php echo $lang['curpwd']; ?>">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-key"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<input class="button is-link is-fullwidth my-4" type="submit" name="signin" value="Login"
|
||||
value="<?php echo md5($date . $ip); ?>">
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input id="rememberme" name="remember_me" type="checkbox" checked="">
|
||||
<label for="rememberme">
|
||||
<?php echo $lang['rememberme']; ?>
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
<footer class="modal-card-foot">
|
||||
<a href="../login.php?forgotpassw">Forgot Password?</a>
|
||||
</footer>
|
||||
</div>
|
||||
<div id="regid" class="content-tab" style="display:none">
|
||||
<section class="modal-card-body">
|
||||
<form method="POST" action="../login.php?register">
|
||||
<div class="field">
|
||||
<label class="label"><?php echo $lang['username']; ?></label>
|
||||
<div class="control has-icons-left has-icons-right">
|
||||
<input type="text" class="input" name="username"
|
||||
placeholder="<?php echo $lang['username']; ?>">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-user"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label class="label"><?php echo $lang['newpwd']; ?></label>
|
||||
<div class="control has-icons-left has-icons-right">
|
||||
<input type="password" class="input" name="password"
|
||||
placeholder="<?php echo $lang['newpwd']; ?>">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-key"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input required id="agecheck" name="agecheck" type="checkbox">
|
||||
<label for="agecheck">
|
||||
I'm over 18.
|
||||
</label>
|
||||
</div>
|
||||
<div class="field">
|
||||
<div class="notification">
|
||||
<span class="tags are-large"><?php echo '<img src="' . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA" class="imagever">'; ?></span>
|
||||
<input type="text" class="input" name="scode" value=""
|
||||
placeholder="<?php echo $lang['entercode']; ?>">
|
||||
<p class="is-size-6 has-text-grey-light has-text-left mt-2">and press
|
||||
"Enter"</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input class="button is-link is-fullwidth my-4" type="submit" name="signup" value="Register"
|
||||
value="<?php echo md5($date . $ip); ?>">
|
||||
<div class="field">
|
||||
<p style="float:left;">By signing up you agree to our <a href="page/privacy">Privacy policy </a>
|
||||
and <a href="page/rules">Site rules</a>. This site may contain material not sutible for
|
||||
under 18's</p>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
|
||||
CONTENT HERE!
|
||||
|
||||
-->
|
||||
|
||||
<?php require_once($page_template . '.php'); ?>
|
||||
|
||||
|
||||
<footer class="footer has-background-white" style="border-top: 1px solid #ebeaeb">
|
||||
<div class="container">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<hr>
|
||||
<div class="columns is-mobile is-centered">
|
||||
<h5 class="title is-5">Support PonePaste</h5>
|
||||
</div>
|
||||
<a href='https://liberapay.com/Ponepaste/donate' target='_blank'><img src='../img/lib.png'/></a>
|
||||
<a href='https://ko-fi.com/V7V02K3I2' target='_blank'><img src='../img/kofi.png'/></a>
|
||||
</div>
|
||||
<div class="column">
|
||||
<hr>
|
||||
<div class="columns is-mobile is-centered">
|
||||
<h5 class="title is-5">Links</h5>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<ul>
|
||||
<li><a href="/page/rules" target="_blank">Site Rules</a></li>
|
||||
<li><a href="/page/privacy" target="_blank">Privacy Policy</a></li>
|
||||
<li><a href="mailto:admin@ponepaste.org">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="column">
|
||||
<ul>
|
||||
<li><a href="/page/tags" target="_blank">Tag Guide</a></li>
|
||||
<li><a href="/page/transparency " target="_blank">Transparency</a></li>
|
||||
<li><a href="https://liberapay.com/Ponepaste" target="_blank">Donate </a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="column">
|
||||
<hr>
|
||||
<div class="columns is-mobile is-centered">
|
||||
<h5 class="title is-5">Stats</h5>
|
||||
</div>
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<ul>
|
||||
<li> <?php
|
||||
$endtime = microtime();
|
||||
$time = explode(' ', $endtime);
|
||||
$time = $time[1] + $time[0];
|
||||
$finish = $time;
|
||||
$total_time = round(($finish - $start), 4);
|
||||
echo 'Page load: ' . $total_time . 's';
|
||||
?>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo 'Page Hits Today: ' . $total_page_views . ''; ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo 'Unique Visitors Today: ' . $total_unique_views . ''; ?>
|
||||
</li>
|
||||
<li>
|
||||
<?php echo 'Total Pastes: ' . $total_pastes . ''; ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
const whenReady = (callback) => {
|
||||
if (document.readyState !== 'loading') {
|
||||
callback();
|
||||
} else {
|
||||
document.addEventListener('DOMContentLoaded', callback);
|
||||
}
|
||||
};
|
||||
|
||||
// Tabs function for popup login
|
||||
function openTab(evt, tabName) {
|
||||
const x = document.getElementsByClassName("content-tab");
|
||||
for (let i = 0; i < x.length; i++) {
|
||||
x[i].style.display = "none";
|
||||
}
|
||||
|
||||
const tablinks = document.getElementsByClassName("tab");
|
||||
|
||||
for (let i = 0; i < x.length; i++) {
|
||||
tablinks[i].className = tablinks[i].className.replace(" is-active", "");
|
||||
}
|
||||
document.getElementById(tabName).style.display = "block";
|
||||
evt.currentTarget.className += " is-active";
|
||||
}
|
||||
|
||||
whenReady(() => {
|
||||
// Notifications
|
||||
(document.querySelectorAll('.notification .delete') || []).forEach(($delete) => {
|
||||
$notification = $delete.parentNode;
|
||||
|
||||
$delete.addEventListener('click', () => {
|
||||
$notification.parentNode.removeChild($notification);
|
||||
});
|
||||
});
|
||||
|
||||
// Hamburger menu
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||
if ($navbarBurgers.length > 0) {
|
||||
$navbarBurgers.forEach(el => {
|
||||
el.addEventListener('click', () => {
|
||||
const target = el.dataset.target;
|
||||
const $target = document.getElementById(target);
|
||||
el.classList.toggle('is-active');
|
||||
$target.classList.toggle('is-active');
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script nonce="D4rkm0d3">
|
||||
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
||||
const currentTheme = localStorage.getItem('theme');
|
||||
|
||||
if (currentTheme) {
|
||||
document.documentElement.setAttribute('data-theme', currentTheme);
|
||||
|
||||
if (currentTheme === 'dark') {
|
||||
toggleSwitch.checked = true;
|
||||
}
|
||||
}
|
||||
|
||||
function switchTheme(e) {
|
||||
if (e.target.checked) {
|
||||
document.documentElement.setAttribute('data-theme', 'dark');
|
||||
localStorage.setItem('theme', 'dark');
|
||||
} else {
|
||||
document.documentElement.setAttribute('data-theme', 'light');
|
||||
localStorage.setItem('theme', 'light');
|
||||
}
|
||||
}
|
||||
|
||||
toggleSwitch.addEventListener('change', switchTheme, false);
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Additional Scripts -->
|
||||
<?php echo $additional_scripts; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -152,7 +152,7 @@
|
|||
<div class="panel-body">
|
||||
<div class="list-widget pagination-content">
|
||||
<?php
|
||||
$res = getevent($con, 100);
|
||||
$res = getevent($conn, 100);
|
||||
while ($row = mysqli_fetch_array($res)) {
|
||||
$title = Trim($row['title']);
|
||||
$p_member = Trim($row['member']);
|
||||
|
|
|
@ -206,9 +206,8 @@ function setupTagsInput() {
|
|||
<div class="level-item is-pulled-left mx-1">
|
||||
<div class="select">
|
||||
<select data-live-search="true" name="format">
|
||||
<?php // Show popular GeSHi formats
|
||||
foreach ($geshiformats as $code => $name) {
|
||||
if (in_array($code, $popular_formats)) {
|
||||
<?php
|
||||
foreach (PP_HIGHLIGHT_FORMATS as $code => $name) {
|
||||
if (isset($_POST['format'])) {
|
||||
$sel = ($_POST['format'] == $code) ? 'selected="selected"' : ''; // Pre-populate if we come here on an error
|
||||
} else {
|
||||
|
@ -216,19 +215,6 @@ function setupTagsInput() {
|
|||
}
|
||||
echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>';
|
||||
}
|
||||
}
|
||||
echo '<option value="text">__________________</option>';
|
||||
// Show all GeSHi formats.
|
||||
foreach ($geshiformats as $code => $name) {
|
||||
if (!in_array($code, $popular_formats)) {
|
||||
if (isset($_POST['format'])) {
|
||||
$sel = ($_POST['format'] == $code) ? 'selected="selected"' : ''; // Pre-populate if we come here on an error
|
||||
} else {
|
||||
$sel = ($code == "text") ? 'selected="selected"' : '';
|
||||
}
|
||||
echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
|
|
@ -307,20 +307,10 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
|
|||
<div class="select">
|
||||
<select data-live-search="true" name="format">
|
||||
<?php // Show popular GeSHi formats
|
||||
foreach ($geshiformats as $code => $name) {
|
||||
if (in_array($code, $popular_formats)) {
|
||||
foreach (PP_HIGHLIGHT_FORMATS as $code => $name) {
|
||||
$sel = ($paste['code'] == $code) ? 'selected="selected"' : ' ';
|
||||
echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>';
|
||||
}
|
||||
}
|
||||
|
||||
// Show all GeSHi formats.
|
||||
foreach ($geshiformats as $code => $name) {
|
||||
if (!in_array($code, $popular_formats)) {
|
||||
$sel = ($paste['code'] == $code) ? 'selected="selected"' : '';
|
||||
echo '<option ' . $sel . ' value="' . $code . '">' . $name . '</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
|
5
user.php
5
user.php
|
@ -116,6 +116,5 @@ if (isset($_GET['del'])) {
|
|||
}
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
require_once('theme/' . $default_theme . '/user_profile.php');
|
||||
require_once('theme/' . $default_theme . '/footer.php');
|
||||
$page_template = 'user_profile';
|
||||
require_once('theme/' . $default_theme . '/common.php');
|
||||
|
|
Loading…
Add table
Reference in a new issue