New plugin loader, page features, API0.2b, Bugfixes

This commit is contained in:
2016-11-19 16:13:37 +01:00
parent 6d1eef25ca
commit b97faf21fd
230 changed files with 36532 additions and 36346 deletions

13
.htaccess Normal file
View File

@ -0,0 +1,13 @@
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*) index.php?pathsec=$1 [QSA]
php_value display_errors On
Options -Indexes
Redirect 301 /sitemap.xml /plugins/sitemap-xml/sitemap.php

View File

@ -4,7 +4,7 @@ require_once 'core.php';
header('Content-type: application/json'); header('Content-type: application/json');
$blog = new blog(); $blog = new blog(false, 0, true, (isset($_GET['no']) ? $_GET['no'] : fasle));
$entries = array(); $entries = array();
if ($blog->entries) if ($blog->entries)

View File

@ -4,16 +4,21 @@
session_start(); session_start();
// REALLY NICE ERROR PAGE KINDA THING // REALLY NICE ERROR PAGE KINDA THING
function nice_error($err, $errstr = false) function nice_error($err, $errstr = false, $file, $line)
{ {
if ($errstr) { $errno = $err; $err = $errstr; } if ($errstr) { $errno = $err; $err = $errstr; }
if (($errstr && $errno != 2048) || !$errstr) if (($errstr && $errno != 2048) || !$errstr)
die('<!doctype html><html><head><title>Insanely</title><meta charset="utf-8" /></head><body><h1>So bad...</h1><p><img style="width: 260px" src="/data/imgs/coding_in_progress.jpg" alt=""/></p><p>'.$err.(isset($errno) ? ' ('.$errno.')' : '').'</p></body></html>'); {
ob_end_clean();
header('Content-type: text/plain');
die($err.(isset($errno) ? ' ('.$errno.')' : '')." [$file] <$line>");
}
} }
set_error_handler('nice_error'); set_error_handler('nice_error');
// LOAD CONFIG // LOAD CONFIG
require_once 'config.php'; define('_FS_PATH', dirname(__FILE__).'/');
require_once _FS_PATH.'config.php';
// FEEDBACK // FEEDBACK
$info = array(); $info = array();
@ -34,7 +39,7 @@ $_sql->query("SET NAMES ".DBCHAR);
$_sql->query("SET CHARACTER SET ".DBCHAR); $_sql->query("SET CHARACTER SET ".DBCHAR);
// LANGUAGE // LANGUAGE
$_locale = (array)json_decode(file_get_contents('includes/locale/hu_HU.lng')); $_locale = (array)json_decode(file_get_contents(_FS_PATH.'includes/locale/hu_HU.lng'));
// OTHER CLEVER STUFFS // OTHER CLEVER STUFFS
function clear_cache() { header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); } function clear_cache() { header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); }
@ -45,17 +50,17 @@ function sqlprot($in) { global $_sql; return $_sql->real_escape_string($in); }
function trimlink($in, $length = 140) { $in = html_entity_decode(strip_tags($in)); if (strlen($in) > $length) return substr($in, 0, $length-3).'...'; return $in; } function trimlink($in, $length = 140) { $in = html_entity_decode(strip_tags($in)); if (strlen($in) > $length) return substr($in, 0, $length-3).'...'; return $in; }
$set = $_sql->query("SELECT * FROM settings"); // SETTINGS
while ($data = $set->fetch_assoc()) require_once _FS_PATH.'includes/settings.class.php';
$_set[$data['variable']] = $data['value']; $_set = settings::getdata();
// CLASSES // CLASSES
require_once 'includes/user.class.php'; require_once _FS_PATH.'includes/user.class.php';
require_once 'includes/blog.class.php'; require_once _FS_PATH.'includes/blog.class.php';
require_once 'includes/page.class.php'; require_once _FS_PATH.'includes/page.class.php';
require_once 'includes/check.class.php'; require_once _FS_PATH.'includes/check.class.php';
require_once 'includes/comment.class.php'; require_once _FS_PATH.'includes/comment.class.php';
// FUNCTIONS // FUNCTIONS
@ -65,26 +70,29 @@ function get_profile_link($slug = false, $p = false) { global $_set; $prefix =
function get_profile_picture($userData = false, $p = false) { global $_set; $prefix = ($p ? $_set['url'] : ''); if (!$userData) if (LOGGEDIN) { global $user; $userData = $user;} else $userData = array('userPic'=>0); return $prefix.($userData['userPic'] ? "/data/profile_pics/$userData[userId].jpg" : '/data/imgs/'.$_set['defaultProfilePic']); } function get_profile_picture($userData = false, $p = false) { global $_set; $prefix = ($p ? $_set['url'] : ''); if (!$userData) if (LOGGEDIN) { global $user; $userData = $user;} else $userData = array('userPic'=>0); return $prefix.($userData['userPic'] ? "/data/profile_pics/$userData[userId].jpg" : '/data/imgs/'.$_set['defaultProfilePic']); }
function get_current_link($p = false) { global $_set, $seo; $prefix = ($p ? $_set['url'] : ''); $link = ''; for ($i = 0; $i < sizeof($seo); $i++) $link .= '/'.$seo[$i]; return $prefix.($_set['seo'] ? $link : '/?pathsec='.$link); } function get_current_link($p = false) { global $_set, $seo; $prefix = ($p ? $_set['url'] : ''); $link = ''; for ($i = 0; $i < sizeof($seo); $i++) $link .= '/'.$seo[$i]; return $prefix.($_set['seo'] ? $link : '/?pathsec='.$link); }
function get_theme_lib() { global $_set; if (file_exists('themes/'.$_set['mainTheme'])) return 'themes/'.$_set['mainTheme']; return false; } function get_theme_lib() { global $_set; if (file_exists(_FS_PATH.'themes/'.$_set['mainTheme'])) return 'themes/'.$_set['mainTheme']; return false; }
function get_theme() function get_theme()
{ {
global $_set; global $_set;
if (file_exists('themes/'.$_set['mainTheme'].'/template.php')) if (file_exists(_FS_PATH.'themes/'.$_set['mainTheme'].'/template.php'))
return 'themes/'.$_set['mainTheme'].'/template.php'; return _FS_PATH.'themes/'.$_set['mainTheme'].'/template.php';
return false; return false;
} }
function get_site_link() { global $_set; return $_set['url']; } function get_site_link() { global $_set; return $_set['url']; }
function get_site_body() { global $output; return output_replacer($output); } function get_site_body() { global $output; return output_replacer($output); }
function get_navigation($append = '') function get_navigation($append = '', $returnarray = false)
{ {
global $_locale, $_sql, $seo, $_title; global $_locale, $_sql, $seo, $_title;
$navLinks = array(); $navLinks = array();
if ($seo[0] && isset($_title[0])) array_push($navLinks, array('link' => '/', 'title' => $_locale['home'])); if ($seo[0] && isset($_title[0])) array_push($navLinks, array('link' => '/', 'title' => $_locale['home']));
$navQuery = $_sql->query("SELECT pageSlug, pageTitle FROM pages ORDER BY pageTitle ASC"); $navQuery = $_sql->query("SELECT pageSlug, pageTitle FROM pages WHERE pageDeleted IS NULL ORDER BY pageTitle ASC");
while ($navData = $navQuery->fetch_assoc()) while ($navData = $navQuery->fetch_assoc())
array_push($navLinks, array('link' => get_page_link($navData['pageSlug']), 'title' => $navData['pageTitle'])); array_push($navLinks, array('link' => get_page_link($navData['pageSlug']), 'title' => $navData['pageTitle']));
if ($returnarray)
return $navLinks;
for ($i = 0; $i < sizeof($navLinks); $i++) for ($i = 0; $i < sizeof($navLinks); $i++)
{ {
$link = explode('/', $navLinks[$i]['link']); $link = explode('/', $navLinks[$i]['link']);
@ -223,7 +231,7 @@ function entry_replacer($in)
$replace[] = '<iframe style="width: 100%; height: 10em; border: 0; padding: 0; margin: 0;" class="music" src="http://music.sandros.hu/shared/$1?volume=50"></iframe>'; $replace[] = '<iframe style="width: 100%; height: 10em; border: 0; padding: 0; margin: 0;" class="music" src="http://music.sandros.hu/shared/$1?volume=50"></iframe>';
$pattern[] = '#\[youtube=(.*?)\]#'; $pattern[] = '#\[youtube=(.*?)\]#';
$replace[] = '<iframe style="width: 100%; height: 600px; border: 0; padding: 0; margin: 0;" class="youtube" src="http://www.youtube-nocookie.com/embed/$1"></iframe>'; $replace[] = '<iframe style="width: 100%; height: 600px; border: 0; padding: 0; margin: 0;" class="youtube" src="http://www.youtube.com/embed/$1"></iframe>';
$pattern[] = '#\[spoiler\](.*?)\[/spoiler\]#'; $pattern[] = '#\[spoiler\](.*?)\[/spoiler\]#';
$replace[] = '<div class="spoiler"><div class="spoiler_b"><button onclick="spoilerToggle($(this))">'.$_locale['show_hidden_content'].'</button><div style="display:none" class="spoiler_c">$1</div></div>'; $replace[] = '<div class="spoiler"><div class="spoiler_b"><button onclick="spoilerToggle($(this))">'.$_locale['show_hidden_content'].'</button><div style="display:none" class="spoiler_c">$1</div></div>';
@ -273,7 +281,7 @@ function output_replacer($in)
/* LOGIN SYSTEM */ /* LOGIN SYSTEM */
if (isset($_COOKIE['filtr_token'])) if (isset($_COOKIE['filtr_token']))
{ {
require_once 'includes/filtr.class.php'; require_once _FS_PATH.'includes/filtr.class.php';
$filtr = new filtrLogin(); $filtr = new filtrLogin();
$filtr->cache = '/tmp/'; $filtr->cache = '/tmp/';

View File

@ -4,4 +4,5 @@
<li><a href='/admin/entry'>{locale:entry_editor}</a></li> <li><a href='/admin/entry'>{locale:entry_editor}</a></li>
<li><a href='/admin/plugins'>{locale:plugin_manager}</a></li> <li><a href='/admin/plugins'>{locale:plugin_manager}</a></li>
<li><a href='/admin/page'>{locale:page_editor}</a></li> <li><a href='/admin/page'>{locale:page_editor}</a></li>
<li><a href='/admin/settings'>{locale:site_settings}</a></li>
</ul> </ul>

View File

@ -82,20 +82,20 @@ if (isset($seo[2]) && $user['userLevel'] > 2)
if ($timedQuery->num_rows) if ($timedQuery->num_rows)
{ {
echo "<h1>{locale:timed_entries}</h1>"; echo "<h1>{locale:timed_entries}</h1>";
echo "<table class='designed timed'><tr><td>{locale:entry_title}</td><td>{locale:created_on}</td><td>{locale:timed_pub_date}</td></tr>"; echo "<table class='designed timed'><thead><tr><th>{locale:entry_title}</th><th>{locale:created_on}</th><th>{locale:timed_pub_date}</th></tr></thead><tbody>";
while ($data = $timedQuery->fetch_assoc()) while ($data = $timedQuery->fetch_assoc())
echo "<tr><td><a href='".get_entry_link($data['entrySlug'])."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>"; echo "<tr><td><a href='".get_entry_link($data['entrySlug'])."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>";
echo "</table>"; echo "</tbody></table>";
} }
$hiddenQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryHidden IS NOT NULL"); $hiddenQuery = $_sql->query("SELECT entrySlug, entryTitle, entryCreated, entryPublished FROM entries WHERE entryHidden IS NOT NULL");
if ($hiddenQuery->num_rows) if ($hiddenQuery->num_rows)
{ {
echo "<h1>{locale:hidden_entries}</h1>"; echo "<h1>{locale:hidden_entries}</h1>";
echo "<table class='designed timed'><tr><td>{locale:entry_title}</td><td>{locale:created_on}</td><td>{locale:timed_pub_date}</td></tr>"; echo "<table class='designed timed'><thead><tr><th>{locale:entry_title}</th><th>{locale:created_on}</th><th>{locale:timed_pub_date}</th></tr></thead><tbody>";
while ($data = $hiddenQuery->fetch_assoc()) while ($data = $hiddenQuery->fetch_assoc())
echo "<tr><td><a href='".get_entry_link($data['entrySlug'], null, true)."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>"; echo "<tr><td><a href='".get_entry_link($data['entrySlug'], null, true)."'>$data[entryTitle]</a></td><td>".show_date($data['entryCreated'])."</td><td>".show_date($data['entryPublished'])."</td></tr>";
echo "</table>"; echo "</tbody></table>";
} }
} }
?> ?>
@ -132,7 +132,7 @@ if (isset($entryData))
if ($tags->num_rows) if ($tags->num_rows)
{ {
echo "<h3>{locale:tags}</h3>"; echo "<h3>{locale:tags}</h3>";
echo "<table class='designed'><tr><td>{locale:tag_name}</td><td>{locale:add}</td></tr>" echo "<table class='designed'><thead><tr><th>{locale:tag_name}</th><th>{locale:add}</th></tr></thead><tbody>"
."<form action='".get_current_link()."' method='post' name='tagentry'>" ."<form action='".get_current_link()."' method='post' name='tagentry'>"
."<input type='hidden' name='entryId' value='$entryData[entryId]' />" ."<input type='hidden' name='entryId' value='$entryData[entryId]' />"
."<input type='hidden' name='entryTag' value='true' />"; ."<input type='hidden' name='entryTag' value='true' />";
@ -141,7 +141,7 @@ if (isset($entryData))
echo "<tr><td>$tag[tagName]</td><td>".($_sql->query("SELECT taggedId FROM tagged WHERE taggedEntry = $entryData[entryId] AND taggedTag = $tag[tagId]")->num_rows ? "<button type='submit' name='tagIdRemove' value='$tag[tagId]'>{locale:remove}</button>":"<button type='submit' name='tagId' value='$tag[tagId]'>{locale:add}</button>")."</td></tr>"; echo "<tr><td>$tag[tagName]</td><td>".($_sql->query("SELECT taggedId FROM tagged WHERE taggedEntry = $entryData[entryId] AND taggedTag = $tag[tagId]")->num_rows ? "<button type='submit' name='tagIdRemove' value='$tag[tagId]'>{locale:remove}</button>":"<button type='submit' name='tagId' value='$tag[tagId]'>{locale:add}</button>")."</td></tr>";
echo "</form>" echo "</form>"
."</table>"; ."</tbody></table>";
} }
} }
?> ?>

View File

@ -12,6 +12,12 @@ switch ($seo[1])
exit; exit;
break; break;
case 'settings':
if ($user['userLevel'] < 3) redirect();
addTitle($_locale['site_settings']);
include 'includes/admin/settings.php';
break;
case 'plugins': case 'plugins':
if ($user['userLevel'] < 3) redirect(); if ($user['userLevel'] < 3) redirect();
addTitle($_locale['plugin_manager']); addTitle($_locale['plugin_manager']);

View File

@ -19,18 +19,27 @@ if (isset($_POST['pageContent']) && isset($_POST['pageSlug']) && $user['userLeve
} }
if (isset($_POST['page_delete']))
{
$page = new page($_POST['page_delete']);
if ($page -> delete()) array_push($info, $_locale['page_deleted']);
else array_push($error, $_locale['page_delete_failed']);
}
if (isset($seo[2])) if (isset($seo[2]))
$page = new page($seo[2]); $page = new page($seo[2]);
else else
{ {
$pagesQuery = $_sql->query("SELECT pageSlug, pageTitle FROM pages"); $pagesQuery = $_sql->query("SELECT pageSlug, pageTitle, pageCreated, pageModified, pageDeleted FROM pages ORDER BY pageDeleted ASC, pageTitle ASC");
if ($pagesQuery->num_rows) if ($pagesQuery->num_rows)
{ {
echo "<h1>{locale:pages}</h1>"; echo "<h1>{locale:pages}</h1>";
echo "<table class='designed pages'><tr><td>{locale:page_title}</td></tr>"; echo "<form action='".get_current_link()."' method='post' name='page-delete'>";
echo "<table class='designed pages'><thead><tr><th>{locale:page_title}</th><th>{locale:page_modified}</th><th>{locale:page_delete}</th></tr></thead><tbody>";
while ($data = $pagesQuery->fetch_assoc()) while ($data = $pagesQuery->fetch_assoc())
echo "<tr><td><a href='/admin/page/$data[pageSlug]'>$data[pageTitle]</a></td></tr>"; echo "<tr><td><a href='/admin/page/$data[pageSlug]'>$data[pageTitle]</a></td><td>".date($_set['dateformat'], $data['pageModified'] > $data['pageCreated'] ? $data['pageModified'] : $data['pageCreated'])."</td><td>".($data['pageDeleted'] ? date($_set['dateformat'], $data['pageDeleted']) : "<button type='submit' name='page_delete' value='$data[pageSlug]'>{locale:delete}</button>")."</td></tr>";
echo "</table>"; echo "</tbody></table>";
echo "</form>";
} }
} }
?> ?>

View File

@ -1,6 +1,6 @@
<?php <?php
if (isset($_POST['pluginId']) && isnum($_POST['pluginId'])) if (isset($_POST['pluginId']) && is_numeric($_POST['pluginId']))
{ {
if ($_sql->query("UPDATE plugins SET pluginStatus = ".(isset($_POST['pluginEnable']) ? 1 : 0)." WHERE pluginId = $_POST[pluginId]")) if ($_sql->query("UPDATE plugins SET pluginStatus = ".(isset($_POST['pluginEnable']) ? 1 : 0)." WHERE pluginId = $_POST[pluginId]"))
redirect(get_current_link()); redirect(get_current_link());
@ -15,7 +15,7 @@ $plugins = array();
if ($pluginsQuery->num_rows) if ($pluginsQuery->num_rows)
{ {
echo "<table class='designed plugins'>"; echo "<table class='designed plugins'>";
echo "<tr><td>{locale:plugin_name}</td><td>{locale:description}</td><td>{locale:scope}</td><td>{locale:status}</td></tr>"; echo "<thead><tr><th>{locale:plugin_name}</th><th>{locale:description}</th><th>{locale:scope}</th><th>{locale:status}</th></tr></thead><tbody>";
while ($data = $pluginsQuery->fetch_assoc()) while ($data = $pluginsQuery->fetch_assoc())
{ {
$pinfo = './plugins/'.$data['pluginLib'].'/info.json'; $pinfo = './plugins/'.$data['pluginLib'].'/info.json';
@ -23,15 +23,16 @@ if ($pluginsQuery->num_rows)
{ {
$pinfo = (array)json_decode(file_get_contents($pinfo)); $pinfo = (array)json_decode(file_get_contents($pinfo));
if ($data['pluginStatus']) if (!isset($pinfo['enabler']) || (isset($pinfo['enabler']) && in_array($pinfo['enabler'], ['true', '1', 'yes', 'y'])))
$button = "<button name='pluginDisable' class='orange'>{locale:disable}</button>"; if ($data['pluginStatus']) $button = "<button name='pluginDisable' class='orange'>{locale:disable}</button>";
else $button = "<button name='pluginEnable'>{locale:enable}</button>"; else $button = "<button name='pluginEnable'>{locale:enable}</button>";
else $button = "{locale:plugin_noenable}";
echo "<tr><td>$pinfo[name]</td><td>$pinfo[description]<td>$pinfo[paths]</td><td><form action='".get_current_link()."' method='post'><input type='hidden' name='pluginId' value='$data[pluginId]'/>$button</form></td></tr>"; echo "<tr><td>$pinfo[name]</td><td>$pinfo[description]<td>$pinfo[paths]</td><td><form action='".get_current_link()."' method='post'><input type='hidden' name='pluginId' value='$data[pluginId]'/>$button</form></td></tr>";
} }
array_push($plugins, $data['pluginLib']); array_push($plugins, $data['pluginLib']);
} }
echo "</table>"; echo "</tbody></table>";
} else } else
echo "<p>$_locale[plugins_empty]</p>"; echo "<p>$_locale[plugins_empty]</p>";

View File

@ -0,0 +1,47 @@
<?php
if (isset($_POST['save_settings']))
{
$fail = false;
$settings = new settings();
foreach ($_POST AS $var => $val)
if (substr($var, 0, 13) == 'settings_var_')
{
$var = substr($var, 13, strlen($var) - 13);
if (isset($_set[$var]) && $_set[$var] != $val)
if (!$settings -> update($var, $val))
$fail = true;
}
if ($fail) array_push($error, $_locale['settings_update_failed']);
else array_push($info, $_locale['settings_updated']);
unset($fail);
unset($var);
unset($settings);
}
$_set_settings = settings::getdata();
?>
<h1>{locale:site_settings}</h1>
<form action="<?=get_current_link()?>" method="post" name="entry-edit">
<table class="designed settings">
<thead>
<tr>
<th>{locale:settings_variable}</th>
<th>{locale:settings_value}</th>
</tr>
</thead>
<tbody>
<?php foreach ($_set_settings AS $var => $val): ?>
<tr>
<td>{locale:settings_var_<?=$var?>}</td>
<td><input type="text" name="settings_var_<?=$var?>" value="<?=htmlentities($val)?>" /></td>
</tr>
<?php endforeach; unset($_set_settings); ?>
</tbody>
</table>
<button type="submit" name="save_settings" value="1">{locale:settings_save}</button>
</form>

View File

@ -9,21 +9,28 @@ class blog
public $perpage = 10; public $perpage = 10;
public $entries = 0; public $entries = 0;
public function __construct($entry = false, $page = 1) public function __construct($entry = false, $page = 1, $getall = false, $limit = false)
{ {
global $_set, $_sql; global $_set, $_sql;
if (!$getall)
{
$this->perpage = $_set['entriesPerPage']; $this->perpage = $_set['entriesPerPage'];
if ($entry) if ($entry)
{ {
$this->query = $_sql->query("SELECT entries.*, users.userName AS userName, users.userPublicName AS publicName FROM entries INNER JOIN users ON userId = entryBy WHERE entrySlug = '".sqlprot($entry)."' LIMIT 1"); $this->query = $_sql->query("SELECT entries.*, users.userId AS userId, users.userName AS userName, users.userPublicName AS publicName FROM entries INNER JOIN users ON userId = entryBy WHERE entrySlug = '".sqlprot($entry)."' LIMIT 1");
if ($this->query->num_rows) if ($this->query->num_rows)
{ {
$this->entries = 1; $this->entries = 1;
} }
} else } else
{ {
$this->query = $_sql->query("SELECT entries.*, users.userName AS userName, users.userPublicName AS publicName FROM entries INNER JOIN users ON userId = entryBy WHERE entryHidden IS NULL AND entryPublished <= ".time()." ORDER BY entryPinned DESC, entryPublished DESC, entryId DESC LIMIT ".$this->perpage." OFFSET ".(($page-1) * $this->perpage).""); $this->query = $_sql->query("SELECT entries.*, users.userId AS userId, users.userName AS userName, users.userPublicName AS publicName FROM entries INNER JOIN users ON userId = entryBy WHERE entryHidden IS NULL AND entryPublished <= ".time()." ORDER BY entryPinned DESC, entryPublished DESC, entryId DESC LIMIT ".$this->perpage." OFFSET ".(($page-1) * $this->perpage)."");
$this->entries = $this->query->num_rows;
}
} else
{
$this->query = $_sql->query("SELECT * FROM entries ORDER BY entryPublished DESC".($limit && is_numeric($limit) ? ' LIMIT '.$limit : null));
$this->entries = $this->query->num_rows; $this->entries = $this->query->num_rows;
} }
} }

View File

@ -84,6 +84,10 @@
"pages": "Oldalak", "pages": "Oldalak",
"page_editor": "Oldal szerkesztése", "page_editor": "Oldal szerkesztése",
"page_delete": "Oldal törlése",
"page_delete_failed": "Az oldal törlése sikertelen.",
"page_deleted": "Az oldal sikeresen törölve.",
"page_modified": "Módosítva",
"page_title": "Az oldal címe", "page_title": "Az oldal címe",
"page_slug": "Az oldal linkje (example.org/page/ez-itt)", "page_slug": "Az oldal linkje (example.org/page/ez-itt)",
"page_added": "Az oldal mentése sikeresen megtörtént.", "page_added": "Az oldal mentése sikeresen megtörtént.",
@ -116,11 +120,39 @@
"plugins": "Bővítmények", "plugins": "Bővítmények",
"plugin_name": "Név", "plugin_name": "Név",
"scope": "Hatáskör", "scope": "Hatáskör",
"plugin_noenable": "Static",
"plugins_empty": "Nincsenek elérhető bővítmények.", "plugins_empty": "Nincsenek elérhető bővítmények.",
"plugin_added": "Bővítmény sikeresen hozzáadva.", "plugin_added": "Bővítmény sikeresen hozzáadva.",
"plugin_not_added": "A bővítmény nem lett hozzáadva.", "plugin_not_added": "A bővítmény nem lett hozzáadva.",
"plugin_not_updated": "A beállítást nem lehet elvégezni.", "plugin_not_updated": "A beállítást nem lehet elvégezni.",
"site_settings": "Oldal beállításai",
"settings": "Beállítások",
"settings_save": "Beállítások mentése",
"settings_update_failed": "Nem sikerült minden beállítást frissíteni.",
"settings_updated": "A beállítások frissítése sikeresen megtörtént.",
"settings_variable": "Beállítás",
"settings_value": "Érték",
"settings_var_allowedPicTypes": "Engedélyezett képek (mime)",
"settings_var_dateformat": "Dátum formátum",
"settings_var_dateformatShort": "Rövid dátum formátum",
"settings_var_defaultProfilePic": "Alap profilkép",
"settings_var_description": "Oldal leírása (meta)",
"settings_var_entriesPerPage": "Bejegyzések oldalanként",
"settings_var_filtr_appid": "Filtr. App ID",
"settings_var_filtr_apptoken": "Filtr. App Token",
"settings_var_keywords": "Oldal kulcsszavai (meta)",
"settings_var_mainTheme": "Megjelenés könyvtára",
"settings_var_seo": "SEO linkek",
"settings_var_subEntry": "Bejegyzések aloldala",
"settings_var_subPage": "Oldalak aloldala",
"settings_var_subProfile": "Porfilok aloldala",
"settings_var_tagline": "Megjelenítendő leírás",
"settings_var_title": "Oldal címe",
"settings_var_titleFormat": "Oldal címének formátuma",
"settings_var_twitter_site": "Twitter felhasználó",
"settings_var_url": "Oldal URL-je",
"comments": "Hozzászólások", "comments": "Hozzászólások",
"post_reply": "Válasz", "post_reply": "Válasz",
"share_impressions": "Oszd meg a véleményed...", "share_impressions": "Oszd meg a véleményed...",

View File

@ -16,11 +16,11 @@ else
{ {
while ($data = $blog->entries()) while ($data = $blog->entries())
echo "<article> echo "<article>
<header> <header itemscope itemtype='http://schema.org/Article'>
<h2><a href='".get_entry_link($data['entrySlug'])."'>".htmlspecialchars($data['entryTitle'])."</a></h2> <h2><a href='".get_entry_link($data['entrySlug'])."' itemprop='name'>".htmlspecialchars($data['entryTitle'])."</a></h2>
<p class='meta'><time class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</time><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a>".get_entry_admin($data)."</p> <p class='meta'><time class='date' title='{locale:published_on}' itemprop='datePublished' content='".date('Y-m-d', $data['entryPublished'])."'>".show_date($data['entryPublished'])."</time><span itemprop='author' itemscope itemtype='http://schema.org/Person'><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}' itemprop='url'><span itemprop='name'>$data[publicName]</span></a></span>".get_entry_admin($data)."</p>
</header> </header>
<div class='content'>".entry_show_init($data['entryContent'], $data['entrySlug'])."</div> <div class='content' itemprop='articleBody'>".entry_show_init($data['entryContent'], $data['entrySlug'])."</div>
</article>\n"; </article>\n";
echo "<p class='paginator'>".(isset($seo[1]) && isnum($seo[1]) ? "<a href='/p/".($seo[1]+1)."'>{locale:next_page}</a><a href='/p/".($seo[1]-1)."'>{locale:prev_page}</a>" : "<a href='/p/2'>{locale:next_page}</a>")."</p>"; echo "<p class='paginator'>".(isset($seo[1]) && isnum($seo[1]) ? "<a href='/p/".($seo[1]+1)."'>{locale:next_page}</a><a href='/p/".($seo[1]-1)."'>{locale:prev_page}</a>" : "<a href='/p/2'>{locale:next_page}</a>")."</p>";
} else } else

View File

@ -23,12 +23,14 @@ else
else else
{ {
addDescription(entry_show_init($data['entryContent'], $data['entrySlug'])); addDescription(entry_show_init($data['entryContent'], $data['entrySlug']));
addImage((preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $data['entryContent'], $images) ? $images[1] : 0)); addImage($data['entryHeader']);
headerImage($data['entryHeader']); headerImage($data['entryHeader']);
echo "<article class='full'> echo "<article class='full' itemscope itemtype='http://schema.org/Article'>
<h2>".htmlspecialchars($data['entryTitle'])."</h2> <h2 itemprop='name'>".htmlspecialchars($data['entryTitle'])."</h2>
<div class='content'>".entry_show_all($data['entryContent'])."</div> <div class='hidden' itemprop='headline'>".htmlspecialchars($data['entryTitle'])."</div>
<p class='meta'><time class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</time><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a>".get_entry_admin($data)."</p> ".($data['entryHeader'] ? "<img class='hidden' itemprop='image' src='$data[entryHeader]' alt='Header image'/>" : null)."
<div class='content' itemprop='articleBody'>".entry_show_all($data['entryContent'])."</div>
<p class='meta'><time class='date' title='{locale:published_on}' itemprop='datePublished' content='".date('Y-m-d', $data['entryPublished'])."'>".show_date($data['entryPublished'])."</time><span itemprop='author' itemscope itemtype='http://schema.org/Person'><a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}' itemprop='url'><span itemprop='name'>$data[publicName]</span></a></span>".get_entry_admin($data)."</p>
</article>\n"; </article>\n";
} }
} }

View File

@ -61,7 +61,7 @@ class page
$content = sqlprot($content); $content = sqlprot($content);
if (Check::title($title) && $this->data) if (Check::title($title) && $this->data)
if ($_sql->query("UPDATE pages SET pageTitle = '$title', pageContent = '$content' WHERE pageSlug = '".$this->data['pageSlug']."'")) if ($_sql->query("UPDATE pages SET pageTitle = '$title', pageContent = '$content', pageModified = ".time()." WHERE pageSlug = '".$this->data['pageSlug']."' AND pageDeleted IS NULL"))
return true; return true;
return false; return false;
} }
@ -75,7 +75,7 @@ class page
$content = sqlprot($content); $content = sqlprot($content);
if (Check::title($title) && Check::slug($slug) && !$this->data) if (Check::title($title) && Check::slug($slug) && !$this->data)
if ($_sql->query("INSERT INTO pages (pageSlug, pageTitle, pageContent) VALUES ('$slug', '$title', '$content')")) if ($_sql->query("INSERT INTO pages (pageSlug, pageTitle, pageContent, pageCreated) VALUES ('$slug', '$title', '$content', ".time().")"))
return true; return true;
return false; return false;
} }
@ -85,7 +85,7 @@ class page
global $_sql; global $_sql;
if ($this->data) if ($this->data)
if ($_sql->query("UPDATE pages SET pageDeleted = 1 WHERE pageSlug = '".$this->data['pageSlug']."'")) if ($_sql->query("UPDATE pages SET pageDeleted = ".time()." WHERE pageSlug = '".$this->data['pageSlug']."'"))
return true; return true;
return false; return false;
} }

View File

@ -0,0 +1,32 @@
<?php
class settings
{
public function __construct() {}
public static function getdata()
{
global $_sql;
$_set = array();
$set = $_sql->query("SELECT * FROM settings");
while ($data = $set->fetch_assoc())
$_set[$data['variable']] = $data['value'];
return $_set;
}
public function update($var, $val)
{
global $_sql, $_set;
if (isset($_set[$var]) && $_sql->query("UPDATE `settings` SET `value` = '".sqlprot($val)."' WHERE `variable` = '".$var."'"))
return true;
return false;
}
}

View File

@ -10,13 +10,8 @@ else :
?> ?>
<li> <li>
<h2><?=$_locale['login']?></h2> <h2><?=$_locale['login']?></h2>
<form action="<?=get_current_link()?>" method="post" name="login-form"> <form action="//filtr.sandros.hu/app_login/<?=$_set['filtr_appid']?>&amp;ret" method="get" name="login-form" id="footer-account">
<input type="submit" name="login" value="<?=$_locale['login']?>" />
<input type="text" name="login_name" value="" placeholder="<?=$_locale['username']?>" />
<input type="password" name="login_pass" value="" placeholder="<?=$_locale['password']?>" />
<button type="submit"><?=$_locale['login']?></button>
</form> </form>
</li> </li>
<?php endif; <?php endif;

View File

@ -68,28 +68,19 @@ while ($data = $pluginsQuery->fetch_assoc())
$pexec = 'plugins/'.$data['pluginLib'].'/_plugin.php'; $pexec = 'plugins/'.$data['pluginLib'].'/_plugin.php';
if (file_exists($pinfo) && file_exists($pexec)) if (file_exists($pinfo) && file_exists($pexec))
{ {
$pinfo = (array)json_decode(file_get_contents($pinfo)); $pinfo = (array)json_decode(file_get_contents($pinfo));
$cpath = explode(',', $pinfo['paths']); $paths = explode(',', $pinfo['paths']);
for ($a = 0; $a < sizeof($cpath); $a++)
foreach ($paths AS $index => $path)
if (fnmatch($path, get_current_link()))
{ {
$ppath = explode('/', ltrim($cpath[$a], '/'));
$load = true;
for ($i = 0; $i < sizeof($ppath); $i++)
if (isset($seo[$i]) && $seo[$i] == $ppath[$i] && $load)
$load = true;
else
$load = false;
if ($load)
include $pexec; include $pexec;
break;
}
} }
unset($i);
unset($a);
unset($pinfo); unset($pinfo);
unset($load);
unset($pexec); unset($pexec);
unset($ppath);
unset($cpath);
}
} }
// LOAD THEME // LOAD THEME

View File

@ -1,5 +1,5 @@
{ {
"name": "CKeditor", "name": "CKeditor",
"description": "A really good text editor.", "description": "A really good text editor.",
"paths": "/admin/entry,/admin/page" "paths": "/admin/entry*,/admin/page*"
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "CKeditor Simple", "name": "CKeditor Simple",
"description": "Easy to use rich text editor.", "description": "Easy to use rich text editor.",
"paths": "/admin/entry" "paths": "/admin/entry*,/admin/page*"
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "Disqus", "name": "Disqus",
"description": "Disqus comment system for you site. Edit the plugin info before enabling this plugin.", "description": "Disqus comment system for you site. Edit the plugin info before enabling this plugin.",
"paths": "/entry" "paths": "/entry*"
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "Facebook Comments", "name": "Facebook Comments",
"description": "Facebook comment system under entries.", "description": "Facebook comment system under entries.",
"paths": "/entry" "paths": "/entry*"
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "Facebook Root", "name": "Facebook Root",
"description": "Loads the facebook script. Required for every facebook plugins.", "description": "Loads the facebook script. Required for every facebook plugins.",
"paths": "/entry" "paths": "*"
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "Facebook Share", "name": "Facebook Share",
"description": "Button to share the article on Facebook.", "description": "Button to share the article on Facebook.",
"paths": "/entry" "paths": "/entry*"
} }

View File

@ -1,5 +1,5 @@
{ {
"name": "Filtr. Stat", "name": "Filtr. Stat",
"description": "Count visitors, etc.", "description": "Track visitors, log actions to better understand how others use your site.",
"paths": "/,/entry,/page,/p,/user" "paths": "*"
} }

View File

@ -1,4 +1,4 @@
<?php <?php
addHead('<script src="/plugins/galleria-io/galleria.min.js"></script>'); addHead('<script src="/plugins/galleria-io/galleria.min.js"></script>', 'galleria-io');
addBody('<script>if($(".gallery[data-gid]").length){Galleria.loadTheme("/plugins/galleria-io/themes/classic/galleria.classic.min.js");$(".gallery[data-gid]").each(function(){$(this).css("width","100%").css("min-height","500px");Galleria.run(".gallery[data-gid="+$(this).attr("data-gid")+"]");});}</script>'); addBody('<script>if($(".gallery[data-gid]").length){Galleria.loadTheme("/plugins/galleria-io/themes/classic/galleria.classic.min.js");$(".gallery[data-gid]").each(function(){$(this).css("width","100%").css("min-height","500px");Galleria.run(".gallery[data-gid="+$(this).attr("data-gid")+"]");});}</script>', 'galleria-io-js');

View File

@ -1,5 +1,5 @@
{ {
"name": "Galleria.io", "name": "Galleria.io",
"description": "Transform your shit into a nice gallery.", "description": "Transform your shit into a nice gallery.",
"paths": "/,/p,/entry,/entries" "paths": "/,/p/*,/page*,/entry*,/entries*"
} }

View File

@ -0,0 +1,2 @@
<?php
addHead('<link rel="sitemap" type="application/xml" title="Sitemap" href="/plugins/sitemap-xml/sitemap.php" />', 'sitemap-xml');

View File

@ -0,0 +1,6 @@
{
"name": "Sitemap XML",
"description": "Generates an XML file with the pages and posts all included.",
"paths": "/page/*",
"enabler": "yes"
}

View File

@ -0,0 +1,21 @@
<?php
header('Content-type: application/xml');
require_once "../../core.php";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<url>
<loc>https://sandros.hu/</loc>
<changefreq>monthly</changefreq>
</url>
<?php
$blog = new blog(null, null, true);
if ($blog->entries)
while ($data = $blog->entries())
echo "\t<url>\n\t\t<loc>".$_set['url'].get_entry_link($data['entrySlug'])."</loc>\n\t\t<changefreq>monthly</changefreq>\n\t</url>";
$nav = get_navigation(null, true);
foreach ($nav AS $index => $n)
echo "\t<url>\n\t\t<loc>".$_set['url'].$n['link']."</loc>\n\t\t<changefreq>monthly</changefreq>\n\t</url>";
?>
</urlset>

3
robots.txt Normal file
View File

@ -0,0 +1,3 @@
User-Agent: *
Disallow:
Allow: /

View File

@ -4,16 +4,18 @@ if ($blog->entries)
while ($data = $blog->entries()) while ($data = $blog->entries())
{ {
$entry_init = entry_show_init($data['entryContent'], $data['entrySlug']); $entry_init = entry_show_init($data['entryContent'], $data['entrySlug']);
echo "<article".($data['entryPinned'] ? ' class="pinned"' : null).(strlen(strip_tags($entry_init)) <= 210 ? ' class="tweet"' : null)." title='".show_date($data['entryPublished'])."'> echo "<article".($data['entryPinned'] ? ' class="pinned"' : null).(strlen(strip_tags($entry_init)) <= 210 ? ' class="tweet"' : null)." title='".show_date($data['entryPublished'])."' itemscope itemtype='http://schema.org/Article'>
<a href='".get_entry_link($data['entrySlug'])."'><header".($data['entryHeader'] ? " style='background-image:url($data[entryHeader])'" : null)."> <a href='".get_entry_link($data['entrySlug'])."'><header".($data['entryHeader'] ? " style='background-image:url($data[entryHeader])'" : null).">
<div> <div>
<h2>".htmlspecialchars($data['entryTitle'])."</h2> <h2 itemprop='name'>".htmlspecialchars($data['entryTitle'])."</h2>
</div> </div>
</header></a> </header></a>
<div class='content'>".$entry_init."</div> <div class='content' itemprop='articleBody'>".$entry_init."</div>
<p class='meta'> <p class='meta'>
<a href='".get_entry_link($data['entrySlug'])."' class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</a> <a href='".get_entry_link($data['entrySlug'])."' class='date' title='{locale:published_on}' itemprop='datePublished' content='".date('Y-m-d', $data['entryPublished'])."'>".show_date($data['entryPublished'])."</a>
<a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a> <span itemprop='author' itemscope itemtype='http://schema.org/Person'>
<a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}' itemprop='url'><span itemprop='name'>$data[publicName]</span></a>
</span>
</p> </p>
</article>\n"; </article>\n";
unset($entry_init); unset($entry_init);

View File

@ -18,14 +18,17 @@ if ($blog->entries)
addDescription(entry_show_init($data['entryContent'], $data['entrySlug'])); addDescription(entry_show_init($data['entryContent'], $data['entrySlug']));
addImage((preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $data['entryContent'], $images) ? $images[1] : 0)); addImage((preg_match('/< *img[^>]*src *= *["\']?([^"\']*)/i', $data['entryContent'], $images) ? $images[1] : 0));
headerImage($data['entryHeader']); headerImage($data['entryHeader']);
echo "<article class='full'>"; echo "<article class='full' itemscope itemtype='http://schema.org/Article'>";
if (strlen($data['entryTitle']) > 50) echo "<header".(strlen($data['entryTitle']) < 50 ? " class='hidden'" : null)."><div><h2 itemprop='name'>".htmlspecialchars($data['entryTitle'])."</h2></div></header>";
echo "<header><div><h2>".htmlspecialchars($data['entryTitle'])."</h2></div></header>"; echo "<div class='hidden' itemprop='headline'>".htmlspecialchars($data['entryTitle'])."</div>";
if ($data['entryHeader']) echo "<img class='hidden' itemprop='image' src='$data[entryHeader]' alt='Header image'/>";
echo "<div class='content'>".entry_show_all($data['entryContent'])."</div> echo "<div class='content' itemprop='articleBody'>".entry_show_all($data['entryContent'])."</div>
<p class='meta'> <p class='meta'>
<a href='".get_entry_link($data['entrySlug'])."' class='date' title='{locale:published_on}'>".show_date($data['entryPublished'])."</a> <a href='".get_entry_link($data['entrySlug'])."' class='date' title='{locale:published_on}' itemprop='datePublished' content='".date('Y-m-d', $data['entryPublished'])."'>".show_date($data['entryPublished'])."</a>
<a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}'>$data[publicName]</a> <span itemprop='author' itemscope itemtype='http://schema.org/Person'>
<a href='".get_profile_link($data['userName'])."' class='by' title='{locale:entry_by}' itemprop='url'><span itemprop='name'>$data[publicName]</span></a>
</span>
".get_entry_admin($data)." ".get_entry_admin($data)."
</article>\n"; </article>\n";
} }

View File

@ -477,7 +477,7 @@ div.box.introduction { border-left-color: #dd823b; width: 100%; }
table.designed, table.designed,
table.pro { table.pro {
width: 100%; width: 100%;
margin: 0; margin: 0 0 2em 0;
padding: 0; padding: 0;
background-color: #FFF; background-color: #FFF;
border: 1px solid #f2f2f2; border: 1px solid #f2f2f2;
@ -489,7 +489,6 @@ table button { padding: 0.2em; margin: 0; width: 120px; }
table.designed td { padding: 0.4em; } table.designed td { padding: 0.4em; }
table.designed tr:nth-child(2n+0) { background: #eaeaea; } table.designed tr:nth-child(2n+0) { background: #eaeaea; }
table.designed tr:first-child { background: #202434; color: #FFF; font-weight: bold; }
table.designed tr td:first-child { font-weight: bold; } table.designed tr td:first-child { font-weight: bold; }
table.pro td { padding: 0.4em; } table.pro td { padding: 0.4em; }
@ -497,6 +496,11 @@ table.pro tr:nth-child(2n+0) { background: #eaeaea; }
table.pro tr td:last-child { text-align: right; } table.pro tr td:last-child { text-align: right; }
table.designed thead th { padding: 0.6em 0.2em; background: #202434; color: #FFF; font-weight: bold; text-align: left; }
table.pages td:last-child { width: 1%; }
table.settings td:first-child { width: 25%; }
/* Infobars */ /* Infobars */
p.phantom { p.phantom {
@ -532,6 +536,8 @@ p.paginator a:before { font-size: 1.2em; }
p.paginator a.prev:before { content: '\e047'; } p.paginator a.prev:before { content: '\e047'; }
p.paginator a.next:before { content: '\e048'; } p.paginator a.next:before { content: '\e048'; }
.hidden { display: none; }
/* EXTRA Stuff */ /* EXTRA Stuff */
body.tinyscreen { width: 100%; } body.tinyscreen { width: 100%; }

View File

@ -7,11 +7,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="generator" content="Insanely 0.9b" /> <meta name="generator" content="Insanely 0.9b" />
<link href="/includes/css/ui-lightness/jquery-ui.custom.min.css" rel="stylesheet" /> <link href="/includes/css/ui-lightness/jquery-ui.custom.min.css" rel="preload" onload="this.rel='stylesheet'" />
<link href="/<?=get_theme_lib()?>/font/typicons.min.css" rel="stylesheet" /> <link href="/<?=get_theme_lib()?>/font/typicons.min.css" rel="preload" onload="this.rel='stylesheet'" />
<link href="/<?=get_theme_lib()?>/style.css" rel="stylesheet" /> <link href="/<?=get_theme_lib()?>/style.css" rel="stylesheet" />
<link href="//fonts.googleapis.com/css?family=Archivo+Narrow:400,700%7COpen+Sans:400,300&amp;subset=latin,latin-ext" rel="stylesheet" /> <link href="//fonts.googleapis.com/css?family=Archivo+Narrow:400,700%7COpen+Sans:400,300&amp;subset=latin,latin-ext" rel="preload" onload="this.rel='stylesheet'" />
<link href="<?=$_set['url']?>/rss" rel="alternate" type="application/rss+xml" title="<?=$_set['title']?>" />
<script src="/includes/js/jquery.js"></script> <script src="/includes/js/jquery.js"></script>
<script src="/includes/js/jquery-ui.custom.min.js"></script> <script src="/includes/js/jquery-ui.custom.min.js"></script>