Dump all the stuff from SVN

This commit is contained in:
Fándly Gergő
2019-08-08 16:35:16 +03:00
parent e71fd3470c
commit 198ba9a5b8
75 changed files with 6655 additions and 0 deletions

47
subs/loader.php Normal file
View File

@ -0,0 +1,47 @@
<?php
/**
* /subs/loader.php
* @version 1.1
* @desc Subsite loader
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
if(!isset($BOM)){
require_once("../config/config.php");
}
function loadPart($view, $backend=false){
global $lm, $lang, $langcode, $langstr, $db, $BOM, $config, $sub;
if($view!="" && $view!="projects" && $view!="repos" && $view!="blog" && $view!="about" && $view!="userarea" && $view!="products" && $view!="contact"){
functions::setError(404);
$view="";
}
if($backend){
include("parts/".$view."_backend.php");
}
else{
include("parts/".$view.".php");
}
}
if(isset($_GET['load'])){
loadPart($_GET['load'], isset($_GET['backend']));
}

40
subs/msg.php Normal file
View File

@ -0,0 +1,40 @@
<?php
/**
* /subs/msg.php
* @version 1.0
* @desc Message reader
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
if(!isset($BOM)){
require_once("../config/config.php");
}
if(functions::isMessage()){
foreach(functions::getMessageArray() as $i){
echo "<div class=\"message\"><p>".$lang['message'][$i]."</p></div><br>";
}
}
if(functions::isError()){
foreach(functions::getErrorArray() as $i){
echo "<div class=\"message error\"><p>".$lang['error'][$i]."</p></div><br>";
}
}

2
subs/parts/.htaccess Normal file
View File

@ -0,0 +1,2 @@
order allow,deny
deny from all

36
subs/parts/.php Normal file
View File

@ -0,0 +1,36 @@
<?php
/**
* /subs/parts/.php
* @version 1.4
* @desc News page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<p style="font-size: 1.2em"><?php echo $lang['index_content'] ?></p>
<h2><?php echo $lang['news'] ?></h2>
<div id="news" class="center">
<!-- news will be printed here -->
</div>
<button type="button" onclick="loadNews()"><?php echo $lang['loadmore'] ?></button>
<script>
loadNews();
</script>

37
subs/parts/_backend.php Normal file
View File

@ -0,0 +1,37 @@
<?php
/**
* /subs/parts/_backend.php
* @version 1.3
* @desc News page backend
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
if(isset($_GET['news_offset']) && isset($_GET['news_limit'])){
$sql=$db->prepare("SELECT n.id, u.fullname AS owner, n.date, n.subject_".$langcode." AS subject, n.content_".$langcode." AS content FROM news AS n INNER JOIN users AS u ON (u.id=n.owner) WHERE published=1 and n.subject_".$langcode."<>'' ORDER BY n.date DESC LIMIT :lim OFFSET :off");
$sql->execute(array(":lim"=>$_GET['news_limit'], ":off"=>$_GET['news_offset']));
$news=array();
while($res=$sql->fetch(PDO::FETCH_ASSOC)){
array_push($news, json_encode($res));
}
echo json_encode($news);
}

34
subs/parts/about.php Normal file
View File

@ -0,0 +1,34 @@
<?php
/**
* /subs/parts/about.php
* @version 1.0
* @desc About page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<?php if($langstr=="en_US"): ?>
<p>Something will be here actually in the folowing days.</p>
<?php elseif($langstr=="hu_HU"): ?>
<p>Az elkövetkező napokban tényleg lesz itt valami!</p>
<?php elseif($langstr=="ro_RO"): ?>
<p>In zilele urmatoare va fi postat si aici ceva.</p>
<?php endif ?>

View File

@ -0,0 +1,25 @@
<?php
/**
* /subs/parts/about_backend.php
* @version 1.0
* @desc About page backend
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/

65
subs/parts/blog.php Normal file
View File

@ -0,0 +1,65 @@
<?php
/**
* /subs/parts/blog.php
* @version 1.1
* @desc Blog page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<span id="langReadMore" style="display: none"><?php echo $lang['readmore'] ?></span>
<?php if($sub==""): ?>
<div id="keywords">
<h3><?php echo $lang['keywords'] ?></h3>
<?php
$sql=$db->prepare("SELECT DISTINCT tag, COUNT(tag) AS count FROM blog_tags GROUP BY tag ORDER BY count DESC");
$sql->execute();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "<a href=\"/blog/tag:".$row['tag']."\" style=\"margin-right: 1em\">".$row['tag']." (".$row['count'].")</a>";
}
?>
</div>
<hr class="placeholder">
<div id="posts">
<!-- POSTS GO HERE -->
<script>
loadMorePosts();
</script>
</div>
<hr class="placeholder">
<button type="button" onclick="loadMorePosts()"><?php echo $lang['readmore'] ?></button>
<?php elseif(substr($sub, 0, 4)=="tag:"): ?>
<div id="posts">
<!-- posts that match a tag go here -->
<script>
loadTagPosts("<?php echo substr($_GET['sub'], 4) ?>");
</script>
</div>
<hr class="placeholder">
<button type="button" onclick="loadMorePosts()"><?php echo $lang['readmore'] ?></button>
<?php else: ?>
<div id="post">
<!-- Specific post goes here -->
<script>
loadPost("<?php echo $_GET['sub'] ?>");
</script>
</div>
<?php endif ?>

View File

@ -0,0 +1,61 @@
<?php
/**
* /subs/parts/blog_backend.php
* @version 1.0
* @desc Blog page backend
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
if(isset($_GET['posts_offset']) && isset($_GET['posts_limit'])){
$sql=$db->prepare("SELECT b.id, b.title, u.fullname AS owner, b.date, b.content, GROUP_CONCAT(bt.tag SEPARATOR ';') AS tags FROM blog AS b INNER JOIN users AS u ON (u.id=b.owner) LEFT JOIN blog_tags AS bt ON (bt.blogentry=b.id) WHERE b.published=1 GROUP BY b.id ORDER BY b.date DESC LIMIT :lim OFFSET :off");
$sql->execute(array(":lim"=>$_GET['posts_limit'], ":off"=>$_GET['posts_offset']));
$blog=array();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
array_push($blog, json_encode($row));
}
echo json_encode($blog);
die();
}
if(isset($_GET['posts_tag']) && isset($_GET['posts_tag_offset']) && isset($_GET['posts_tag_limit'])){
$sql=$db->prepare("SELECT b.id, b.title, u.fullname AS owner, b.date, b.content, GROUP_CONCAT(bt.tag SEPARATOR ';') AS tags FROM blog AS b INNER JOIN users AS u ON (u.id=b.owner) LEFT JOIN blog_tags AS bt ON (bt.blogentry=b.id) WHERE b.published=1 and bt.tag=:tag GROUP BY b.id ORDER BY b.date DESC LIMIT :lim OFFSET :off");
$sql->execute(array(":tag"=>$_GET['posts_tag'], ":lim"=>$_GET['posts_tag_limit'], ":off"=>$_GET['posts_tag_offset']));
$blog=array();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
array_push($blog, json_encode($row));
}
echo json_encode($blog);
die();
}
if(isset($_GET['post'])){
$sql=$db->prepare("SELECT b.id, b.title, u.fullname AS owner, b.date, b.content, GROUP_CONCAT(bt.tag SEPARATOR ';') AS tags FROM blog AS b INNER JOIN users AS u ON (u.id=b.owner) LEFT JOIN blog_tags AS bt ON (bt.blogentry=b.id) WHERE b.published=1 and b.id=:id GROUP BY b.id ORDER BY b.date DESC");
$sql->execute(array(":id"=>$_GET['post']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
echo json_encode($res);
die();
}

111
subs/parts/contact.php Normal file
View File

@ -0,0 +1,111 @@
<?php
/**
* /subs/parts/contact.php
* @version 1.0
* @desc Contact page with necesar infos and a form
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<div id="contact">
<h2><?php echo $lang['contact'] ?></h2>
<p><b><?php echo $lang['email'].": " ?></b><a href="mailto:contact@systemtest.tk">contact@systemtest.tk</a></p>
<!--
<p><b><?php echo $lang['phone'].": " ?></b>+40-000-000000</p>
-->
<p><b><a onclick="toggleDropdown('#pgppublic')"><?php echo $lang['php_public'] ?></a></b></p>
<div id="pgppublic" style="display: none">
<textarea cols="60" rows="50" readonly>
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFrV6CIBEADK6U1KXZAXUXh11VK47t4tT9oOihVcuw/wpL4B18Nkcdnp3HtT
70XY6iGS2bSC+35zAw85mJUMtbo6Fq3v8eQjbsXSqrl+I/CaYvE/ogmF1/yvD/P8
MTB4/GJnkYMdRAHKWp+N0DQ01u2qN3okSVyv/P2eb42Y3okdiWPy2hpZ74LgQypw
+CYsNYCytFOTHDVqXZ6LNqnDhhaVSLEPZ34hXJDEUJVx/TBiAj5AtRulBspp4qWs
L4r4gmk32OX/PoP5XgszX7meYlUty+2axRwMvCQIzYVnm9J2EWu7MWELYsaOGukV
HeqB85fYMbC+dKc+YdS2mMHYpniwg6NBhy2X/RgUxACAFM5HQWH9YM7n/WoXMkp3
lRgcLE9mPO+fH4bCewArHzU6EWK2afp16vkfofQLvfq8JcX58+1zrI0qTq6Bhixh
7MQMEqxjqrFCF8Ml9yKi8gt8SRvBOEsCJAdmaYKhlJyP4Xm0xOYWmnxJQ9Dm6ZrB
q3vv3/q6YNLPLlVJhw7U3OchVsSCjQvBaCg1NBHd2TOPYlcPqF70IOaFyLa/43dF
V/JNugVaoviZjwR1f9KmYg5qktGQ1H0+ozs+qDgeFE0Ebn4dGPTlOcHE1g+d1oy8
Z6JfTtZ5uZoa+zsHpTSGFauhYSp5Yse5rGdAysS9xpZJMK2i/rSX+/44LwARAQAB
tCpTeXN0ZW10ZXN0IGNvbnRhY3QgPGNvbnRhY3RAc3lzdGVtdGVzdC50az6JAk4E
EwEIADgWIQQoAct1JOvsB3/d9ysxSwXf9PEFowUCWtXoIgIbAwULCQgHAgYVCgkI
CwIEFgIDAQIeAQIXgAAKCRAxSwXf9PEFoxp0D/sF9zAWPbb46/6mc3Xbn/SwjqSd
EQC3EhstB4RgYrzLBtFLeGJ6Jlp5zivMDyQd3vLXPfDCgpoMq657TviLXfgfKU5z
KStxPtu5L1sYn1tlpdKF9URyyloI9bwrrz8GuU0pJ2GxRBh1wLWSffEuYNGjmYBL
50ZWJG7LPn/XtTHPxmhoB7u1UMJmA8C3pgGk1VbkuvtsYlG871FIR/SlemjUp9eY
TxMQvP6cZs2Zy6ykvNcH105gIGFkv2/RDxmfd20jXjIxd6xekJLlR/WDw+fMUuxh
kG8KXe10joQuEnOJklNujQuKnqrl8U45UOl+jaoSwSn+FYySqcv5HLSs2nreANqZ
JbS97V1Xp2QycGW+ABy+O/Ajp8Cv32yqnF/35u0sMkXoUfS4393D7ihoxSzSg4NO
llU8trmjtOtJK042EWdLP5CWR24C/FehW2Le6cpklX4LC1BDgSYTbXdupbdLLOE5
2p1VSq0gXmEyaIPfPAFyA6xatV3YgnO7/TlxO8PZM181q5nFCKKZx3Fa8qWllUn5
TZcwaHOvNeQlsqGpmGdXWkyGvDk7P8ykYX7/UEfK+dtq59Hg7Xw16pmInJqtutYk
l2StS26EbDJPPVU3TDaJN3gMa7YrsJCj95mmKlchoTcxU3MgFG7ZQbFSZlLDXSkh
YiHuiNybHCe5f19StrkCDQRa1egiARAA7q7AEYLHwlAZUy6YqLI6sul6IaQjVTJq
7P1Qck5/2WKaywblZivGPZoNPi6SaUgMT5BhpGVjw6vdRnUxYLEzKAHtGeHwL1MV
V8gwRTd5YYcwlT79GA0TC2TqxDD/qKDwyqbOskEutnHWr23dhdPnuKDgxBo94nqm
cas+Zrgjd3Du+MLhzFB51//vWMFi1RAHBYGhV7VxLGY/dUlfOv+fjgBUGB0UNvR0
1ZV9ba+UsfOXLnMTNfTl/NHbbv8b7dfkiw7+fa2JI0Jt9QJ5wtvUqiOxJTJledQw
id1i/yIHetBVM0ewK0lOSAWOp1ucXt97SngENEE7uCLs80jJA3LKFrM2yESUy1pI
c/P/GBCKjf5X9cSYQBd2FFhC/psN7kXChSCb5A888Cu5OFG1+9mi8Ylsd7GXH2lF
OfE/sBmqA3y4YMExT5V9OG9ZXyL5dNOgn48hM7ZiEVYyICHEzEQJVXHRfZkf8sX1
vOAgkYseuEufC9g8HCfKwoFaahiHQDPbzie4lLMwTqs3uMhZvUDIg3jW0eUpqhVl
iy8OishPqcx/gO4ENizXcE/5XratY5lhDhaZTxNnC3ghJTjr0o2d9QifkrGeUty7
AsBg5B4LtFMZGdtrwu3KqOViCnQ6FoG2Gc+bT1SYYjLMKIkymtr1CwWo2oHQQVsn
mZiZp+18980AEQEAAYkCNgQYAQgAIBYhBCgBy3Uk6+wHf933KzFLBd/08QWjBQJa
1egiAhsMAAoJEDFLBd/08QWjoGoP/2nOhYlp1sMtiCAwqFYJuBQGrRUNGxym+UaX
/PtMpmF4dCaa6TSgkcTPBsTUXwD0qpNP16hDPNTd7GMfv1PZLJJkP/oA1u+PWtK4
YWk/Qwo3AUHicq9dJM5aZhRiA+hFNVhEQL2SPAhj/ReApwaS4gTKZXbp47EmkbrV
45bgpkj6l9QlvWqB+yk9zR67M7MBKxVwxzZbCmoOFflZBVji/knZAgl1FPc6gsXe
Tj1zKrdMrx07Q/UFM/AJf/Ts+Gd+Mbk2rrIIOSB/wwdBhOENCHFiKd2Z+YMZKNS+
09hz/MXAuTDerdn0NTPbftAmaGaZf6jETQBk4mDu2uD9GsEbwYBaGycBYRllsmAo
eD3lfVQO3KL6k7JLdYAEsmd7PC/TdT49lRTf1cgdY8sgNZr2kydscnl6gcfG0biY
LRQlWqbd2E5qwdNQVxBIATZhrf7iY+ujxrwgLcsng9f09MfbHYjVPHSVLb/P4UqT
mlkx0qZm/NcO2zGumjOsTGEQmVcRi6dOosVGyVccvbGwztl4JitsPJ1WHY+XSw8T
phhI8h5dso0b1anThDblUB/OwuMYoQnglCqBrO6m0DNNiJkZJT3FltdsIR19pAx0
x8PU7knpdrekcXX+oOG+7sxHviKH74uv9zzmdth9kKw+9CyIEqVxtcFzsnp+XDNo
rpFr9f/8
=wzss
-----END PGP PUBLIC KEY BLOCK-----
</textarea>
</div>
</div>
<div id="contactform">
<form method="POST" class="ajaxform" onsubmit="sendMessage()">
<fieldset>
<legend><?php echo $lang['send_message'] ?></legend>
<table>
<tr>
<td><?php echo $lang['subject'].": " ?></td>
<td><input type="text" name="subject" placeholder="<?php echo $lang['subject'] ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['message'].": " ?></td>
<td><textarea name="message" placeholder="<?php echo $lang['message']."..." ?>" cols="50" rows="10" max="1500"></textarea></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</fieldset>
</form>
</div>

View File

@ -0,0 +1,25 @@
<?php
/**
* /subs/parts/contact_backend.php
* @version 1.0
* @desc Backend for contact page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/

33
subs/parts/projects.php Normal file
View File

@ -0,0 +1,33 @@
<?php
/**
* /subs/parts/project.php
* @version 1.3
* @desc Projects page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<span id="langView" style="display: none"><?php echo $lang['view'] ?></span>
<span id="langSource" style="display: none"><?php echo $lang['source'] ?></span>
<p style="font-size: 1.2em"><?php echo $lang['projects_content'] ?></p>
<div id="projects" class="tileset">
<!-- projects go here! -->
</div>

View File

@ -0,0 +1,37 @@
<?php
/**
* /subs/parts/projects_backend.php
* @version 1.3
* @desc Projects page backend
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
if(isset($_GET['getprojects'])){
$sql=$db->prepare("SELECT p.id, p.name, p.description, u.username, p.path, p.repo, p.status, p.image FROM projects AS p INNER JOIN users AS u ON (u.id=p.owner) ORDER BY id DESC");
$sql->execute();
$projects=array();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
array_push($projects, json_encode($projects));
}
echo json_encode($projects);
}

31
subs/parts/repos.php Normal file
View File

@ -0,0 +1,31 @@
<?php
/**
* /subs/parts/repos.php
* @version 1.0
* @desc Repositories page
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<iframe style="width: 99%; height: 40em" src="/websvn"></iframe>
<br>
<br>
<button type="button" onclick="window.location='/websvn'"><?php echo $lang['repos'] ?></button>

View File

@ -0,0 +1,24 @@
<?php
/**
* /subs/parts/projects_backend.php
* @version 1.0
* @desc Repositories page backend
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/

120
subs/parts/userarea.php Normal file
View File

@ -0,0 +1,120 @@
<?php
/**
* /subs/parts/userarea.php
* @version 1.2
* @desc Users area and admin console
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
$lm->loginPrepare();
?>
<span id="title" style="display: none"><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></span>
<span id="langName" style="display: none"><?php echo $lang['name'] ?></span>
<span id="langExtension" style="display: none"><?php echo $lang['extension'] ?></span>
<span id="langCopyToClip" style="display: none"><?php echo $lang['copytoclip'] ?></span>
<span id="langQuotaErr" style="display: none"><?php echo $lang['error'][4] ?></span>
<span id="langFileTooBig" style="display: none"><?php echo $lang['error'][5] ?></span>
<span id="langSure" style="display: none"><?php echo $lang['sure'] ?></span>
<span id="langEnterPassword" style="display: none"><?php echo $lang['enter_password'] ?></span>
<span id="langEnterAccesslevel" style="display: none"><?php echo $lang['enter_accesslevel'] ?></span>
<span id="langEnterQuota" style="display: none"><?php echo $lang['enter_quota'] ?></span>
<span id="langEncrypting" style="display: none"><?php echo $lang['encrypting'] ?></span>
<span id="langEncrypted" style="display: none"><?php echo $lang['encrypted'] ?></span>
<span id="langConfDelShipping" style="display: none"><?php echo $lang['confirm_delete_shipping'] ?></span>
<span id="langPGPNotValid" style="display: none"><?php echo $lang['error'][12] ?></span>
<?php if(!$lm->validateLogin()): ?>
<!-- unauthenticated -->
<div id="loginPrompt">
<?php if($lm->isRememberingUser()): ?>
<fieldset class="center">
<legend><?php echo $lang['login'] ?></legend>
<?php
$sql=$db->prepare("SELECT fullname FROM users WHERE id=:id");
$sql->execute(array(":id"=>$lm->isRememberingUser()));
$res=$sql->fetch(PDO::FETCH_ASSOC);
?>
<h3><?php echo $lang['welcome_back_1'].$res['fullname'].$lang['welcome_back_2'] ?></h3>
<button type="button" onclick="window.location='./userarea?auto_login'"><?php echo $lang['login'] ?></button>
<br>
<?php $lm->printCaptcha() ?>
<br>
<br>
<button type="button" onclick="window.location='./userarea?forget_user'"><?php echo $lang['forget_user'] ?></button>
</fieldset>
<?php else: ?>
<form method="POST" action="" id="loginForm">
<fieldset class="center">
<legend><?php echo $lang['login'] ?></legend>
<table class="center">
<tr>
<td><?php echo $lang['username'].": " ?></td>
<td><input type="text" name="username" placeholder="<?php echo $lang['username']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['password'].": " ?></td>
<td><input type="password" name="password" placeholder="<?php echo $lang['password']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['remember'].": " ?></td>
<td>
<div class="checkbox">
<input id="remember" type="checkbox" name="remember" hidden>
<label for="remember"></label>
</div>
</td>
</tr>
</table>
<br>
<?php $lm->printCaptcha() ?>
<br>
<br>
<button type="submit" form="loginForm" class="center"><?php echo $lang['ok'] ?></button>
</fieldset>
</form>
<?php endif ?>
</div>
<?php else: ?>
<!-- authenticated -->
<div id="usersArea">
<div class="center" id="submenu">
<button type="button" onclick="window.location='/userarea/fileshare'"><?php echo $lang['fileshare'] ?></button>
<?php if($_SESSION['accesslevel']>=1): ?>
<button type="button" onclick="window.location='/userarea/blog'"><?php echo $lang['blog'] ?></button>
<?php endif; if($_SESSION['accesslevel']>=2): ?>
<button type="button" onclick="window.location='/userarea/orders'"><?php echo $lang['orders'] ?></button>
<button type="button" onclick="window.location='/userarea/messages'"><?php echo $lang['messages'] ?></button>
<?php endif; if($_SESSION['accesslevel']>=3): ?>
<button type="button" onclick="window.location='/userarea/news'"><?php echo $lang['news'] ?></button>
<button type="button" onclick="window.location='/userarea/admin'"><?php echo $lang['adminarea'] ?></button>
<?php endif ?>
<button type="button" onclick="window.location='/userarea/profile'"><?php echo $lang['profile'] ?></button>
<button type="button" onclick="window.location='/userarea?logout'"><?php echo $lang['logout'] ?></button>
</div>
<hr class="placeholder">
<div id="subcontent">
<?php
if($sub!=""){
include("./subs/parts/userarea/".$sub.".php");
}
?>
</div>
</div>
<?php endif ?>

View File

@ -0,0 +1,141 @@
<?php
/**
* /subs/parts/userarea/admin.php
* @version 1.0
* @desc Userarea: admin area
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<div id="userlist">
<h2><?php echo $lang['userlist'] ?></h2>
<table class="footable">
<thead>
<tr>
<th><?php echo $lang['id'] ?></td>
<th><?php echo $lang['username'] ?></td>
<th data-breakpoints="xs sm"><?php echo $lang['fullname'] ?></td>
<th data-breakpoints="xs sm"><?php echo $lang['email'] ?></td>
<th data-breakpoints="xs sm"><?php echo $lang['accesslevel'] ?></td>
<th data-breakpoints="xs sm"><?php echo $lang['quota'] ?></td>
<th data-breakpoints="xs sm"><?php echo $lang['operations'] ?></td>
</tr>
</thead>
<tbody>
<?php
$sql=$db->prepare("SELECT id, username, fullname, email, accesslevel, quota FROM users WHERE id<>1");
$sql->execute();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "
<tr>
<td>".$row['id']."</td>
<td>".$row['username']."</td>
<td>".$row['fullname']."</td>
<td>".$row['email']."</td>
<td>".$row['accesslevel']."</td>
<td>".$row['quota']."</td>
<td>
<button type=\"button\" onclick=\"adminNewPassword(".$row['id'].")\">".$lang['ch_passwd']."</button>
<button type=\"button\" onclick=\"adminChangeLevel(".$row['id'].")\">".$lang['ch_accesslevel']."</button>
<button type=\"button\" onclick=\"adminChangeQuota(".$row['id'].")\">".$lang['ch_quota']."</button>
</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
<hr class="placeholder">
<div id="requestlist">
<h2><?php echo $lang['requestlist'] ?></h2>
<table class="footable">
<thead>
<tr>
<th><?php echo $lang['id'] ?></td>
<th><?php echo $lang['date'] ?></td>
<th data-breakpoints="xs sm"><?php echo $lang['username'] ?></td>
<th data-breakpoints="all"><?php echo $lang['pgp_public'] ?></th>
<th data-breakpoints="xs sqm"><?php echo $lang['operations'] ?></th>
</tr>
</thead>
<tbody>
<?php
$sql=$db->prepare("SELECT dr.id, dr.date, u.username, dr.pgp FROM data_requests AS dr INNER JOIN users AS u ON (u.id=dr.user) WHERE finished=0 ORDER BY date DESC");
$sql->execute();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "
<tr>
<td>".$row['id']."</td>
<td>".$row['date']."</td>
<td>".$row['username']."</td>
<td>".str_replace("\n", "<br>", $row['pgp'])."</td>
<td>
<button type=\"button\" onclick=\"adminFinishRequest(".$row['id'].", this)\">".$lang['finish'] ."</button>
</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
<hr class="placeholder">
<div id="newuser">
<form method="POST" class="ajaxform" onsubmit="adminNewUser()" id="usernewForm">
<fieldset style="margin: auto">
<legend><?php echo $lang['new_user'] ?></legend>
<table>
<tr>
<td><?php echo $lang['username'].": " ?></td>
<td><input type="text" name="usernew_username" placeholder="<?php echo $lang['username']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['fullname'].": " ?></td>
<td><input type="text" name="usernew_fullname" placeholder="<?php echo $lang['fullname']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['email'].": " ?></td>
<td><input type="email" name="usernew_email" placeholder="<?php echo $lang['email']."..." ?>"></td>
</tr>
<tr>
<td><?php echo $lang['accesslevel'].": " ?></td>
<td><input type="number" min="0" max="3" name="usernew_accesslevel" placeholder="<?php echo $lang['accesslevel']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['quota'].": " ?></td>
<td><input type="number" min="-1" value="100" name="usernew_quota" placeholder="<?php echo $lang['quota']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['password'].": " ?></td>
<td><input type="password" name="usernew_password" placeholder="<?php echo $lang['password']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['password_confirm'].": " ?></td>
<td><input type="password" name="usernew_password_confirm" placeholder="<?php echo $lang['password_confirm']."..." ?>" required></td>
</tr>
</table>
<br>
<br>
<button type="submit" form="usernewForm"><?php echo $lang['ok'] ?></button>
<button type="reset" form="usernewForm"><?php echo $lang['cancel'] ?></button>
</fieldset>
</form>
</div>

View File

@ -0,0 +1,116 @@
<?php
/**
* /subs/parts/userarea/blog.php
* @version 1.3
* @desc Userarea: blog
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<div id="postlist">
<table class="footable" style="text-align: left">
<thead>
<tr>
<th><?php echo $lang['title'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['tags'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['owner'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['date'] ?></th>
<th><?php echo $lang['published'] ?></th>
<th data-breakpoints="xs sm md"><?php echo $lang['operations'] ?></th>
</tr>
</thead>
<tbody>
<?php
if($_SESSION['accesslevel']<3){
$sql=$db->prepare("SELECT b.id, b.title, u.fullname AS owner, b.date, b.published, GROUP_CONCAT(bt.tag SEPARATOR ';') FROM blog AS b INNER JOIN users AS u ON (u.id=b.owner) LEFT JOIN blog_tags AS bt ON (bt.blogentry=b.id) WHERE b.owner=:uid GROUP BY b.id ORDER BY date DESC");
$sql->execute(array(":uid"=>$_SESSION['id']));
}
else{
$sql=$db->prepare("SELECT b.id, b.title, u.fullname AS owner, b.date, b.published, GROUP_CONCAT(bt.tag SEPARATOR ';') AS tags FROM blog AS b INNER JOIN users AS u ON (u.id=b.owner) LEFT JOIN blog_tags AS bt ON (bt.blogentry=b.id) GROUP BY b.id ORDER BY date DESC");
$sql->execute();
}
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "
<tr>
<td>".$row['title']."</td>
<td>".$row['tags']."</td>
<td>".$row['owner']."</td>
<td>".$row['date']."</td>
<td>".($row['published']==1?$lang['tyes']:$lang['tno'])."</td>
<td>
<button type=\"button\" onclick=\"blogEdit(".$row['id'].")\">".$lang['edit']."</button>
<button type=\"button\" onclick=\"blogDelete(".$row['id'].", this)\">".$lang['delete']."</button>
</td>
</tr>
";
}
?>
</tbody>
</table>
<hr class="placeholder">
<button type="button" onclick="newBlog()"><i class="fa fa-plus-circle"></i> <?php echo $lang['new'] ?></button>
</div>
<div id="postEdit" style="display: none">
<hr class="placeholder">
<form method="POST" action="" class="ajaxform">
<input type="hidden" name="blog_id" id="blog_id">
<fieldset style="width: 95%">
<legend><?php echo $lang['editor'] ?></legend>
<table>
<tr>
<td><?php echo $lang['name'].": " ?></td>
<td><input type="text" name="blog_title" placeholder="<?php echo $lang['name']."..." ?>" required style="width: 95%"></td>
</tr>
<tr>
<td><?php echo $lang['tags'].": " ?></td>
<td><input type="text" name="blog_tags" placeholder="<?php echo $lang['tags']."..." ?>" style="widht: 95%"></td>
</tr>
<tr>
<td><?php echo $lang['published'].": " ?></td>
<td>
<div class="checkbox">
<input type="checkbox" name="blog_published" id="blog_published" hidden>
<label for="blog_published"></label>
</div>
</td>
</tr>
<tr>
<td><?php echo $lang['autosave'].": " ?></td>
<td>
<div class="checkbox">
<input type="checkbox" id="autosave" onclick="blogAutoSave()" hidden>
<label for="autosave"></label>
</div>
</td>
</tr>
</table>
<br>
<div id="editorContainer" style="background: rgb(255, 255, 255)">
<div id="editor"></div>
</div>
<p style="text-align: right"><i><?php echo $lang['last_saved'].": " ?><span id="lastSaved"></span></i></p>
<br>
<br>
<button type="button" class="green" onclick="blogSave()"><i class="fa fa-save"></i> <?php echo $lang['save'] ?></button>
<button type="button" class="red" onclick="blogDiscard()"><i class="fa fa-trash"></i> <?php echo $lang['discard'] ?></button>
</fieldset>
</form>
</div>

View File

@ -0,0 +1,94 @@
<?php
/**
* /subs/parts/userarea/fileshare.php
* @version 1.0.1
* @desc Userarea: fileshare
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<div id="filelist">
<h3><?php echo $lang['files'] ?></h3>
<table class="footable" style="text-align: left">
<thead>
<tr>
<th><?php echo $lang['name'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['extension'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['size'] ?></th>
<th data-breakpoints="xs sm md"><?php echo $lang['reference'] ?></th>
<th data-breakpoints="xs sm md"><?php echo $lang['operations'] ?></th>
</tr>
</thead>
<tbody>
<?php
$sql=$db->prepare("SELECT id, token, name, extension, size FROM files WHERE owner=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "
<tr>
<td>".$row['name']."</td>
<td>".$row['extension']."</td>
<td>".($row['size']/1000000)." MB</td>
<td>
<textarea rows=\"3\" cols=\"30\" readonly>https://systemtest.tk/uploads/".$row['token']."</textarea>
<button type=\"button\" onclick=\"copyRefToClipboard(this)\">".$lang['copytoclip']."</button>
</td>
<td>
<button type=\"button\" onclick=\"deleteFileFromServer(".$row['id'].", this)\">".$lang['delete']."</button>
</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
<hr class="separator">
<div id="quota">
<h3><?php echo $lang['quota'] ?></h3>
<?php
$sql=$db->prepare("SELECT SUM(size) AS sum FROM files WHERE owner=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
$used=$sql->fetch(PDO::FETCH_ASSOC)['sum']; //in B
$sql=$db->prepare("SELECT quota FROM users WHERE id=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
$total=$sql->fetch(PDO::FETCH_ASSOC)['quota']; //in MB
?>
<div class="progressbar" style="width: 90%; margin: auto">
<div style="width: <?php echo $total!=-1?($used*100/($total*1000000)):"100" ?>%">
<span><?php echo round($used/1000000, 1)."MB&nbsp;/&nbsp;".($total!=-1?$total:$lang['unlimited']." ")."MB" ?></span>
</div>
</div>
</div>
<hr class="placeholder">
<div id="upload">
<h3><?php echo $lang['upload'] ?></h3>
<form method="POST" action="" class="ajaxform" id="uploadForm">
<input type="file" name="fileinput" multiple onchange="loadFileList(this)">
</form>
<hr class="placeholder">
<div id="files">
<!-- files to upload -->
</div>
<hr class="placeholder">
<button type="button" class="red" onclick="clearMyFiles()"><i class="fa fa-minus-circle"></i> <?php echo $lang['clear'] ?></button>
<button type="button" class="green" onclick="startFileUpload()"><i class="fa fa-upload"></i> <?php echo $lang['upload'] ?></button>
</div>

View File

@ -0,0 +1,127 @@
<?php
/**
* /subs/parts/userarea/news.php
* @version 1.0
* @desc Userarea: news
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<div id="newslist">
<table class="footable" style="text-align: left">
<thead>
<tr>
<th data-breakpoints="xs sm"><?php echo $lang['owner'] ?></th>
<th><?php echo $lang['date'] ?></th>
<th><?php echo $lang['subject']."/".$lang['eng'] ?></th>
<th data-breakpoints="xs sm md"><?php echo $lang['subject']."/".$lang['hun'] ?></th>
<th data-breakpoints="xs sm md"><?php echo $lang['subject']."/".$lang['rou'] ?></th>
<th data-breakpoints="xs"><?php echo $lang['published'] ?></th>
<th data-breakpoints="xs sm"><?php echo $lang['operations'] ?></th>
</tr>
</thead>
<tbody>
<?php
$sql=$db->prepare("SELECT n.id, u.fullname AS owner, n.date, n.subject_eng, n.subject_hun, n.subject_rou, n.published FROM news AS n INNER JOIN users AS u ON (u.id=n.owner) ORDER BY date DESC");
$sql->execute();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "
<tr>
<td>".$row['owner']."</td>
<td>".$row['date']."</td>
<td>".$row['subject_eng']."</td>
<td>".$row['subject_hun']."</td>
<td>".$row['subject_rou']."</td>
<td>".($row['published']==1?$lang['tyes']:$lang['tno'])."</td>
<td>
<button type=\"button\" onclick=\"newsEdit(".$row['id'].")\">".$lang['edit']."</button>
<button type=\"button\" onclick=\"newsDelete(".$row['id'].", this)\">".$lang['delete']."</button>
</td>
</tr>
";
}
?>
</tbody>
</table>
<hr class="placeholder">
<button type="button" onclick="newNews()"><i class="fa fa-plus-circle"></i> <?php echo $lang['new'] ?></button>
</div>
<div id="newsEdit" style="display: none">
<hr class="placeholder">
<form method="POST" action="" class="ajaxform">
<input type="hidden" name="news_id" id="news_id">
<fieldset style="width: 95%">
<legend><?php echo $lang['editor'] ?></legend>
<table>
<tr>
<td><?php echo $lang['subject']."/".$lang['eng'].": " ?></td>
<td><input type="text" name="news_subject_eng" placeholder="<?php echo $lang['name']."..." ?>" required style="width: 95%"></td>
</tr>
<tr>
<td><?php echo $lang['subject']."/".$lang['hun'].": " ?></td>
<td><input type="text" name="news_subject_hun" placeholder="<?php echo $lang['name']."..." ?>" required style="width: 95%"></td>
</tr>
<tr>
<td><?php echo $lang['subject']."/".$lang['rou'].": " ?></td>
<td><input type="text" name="news_subject_rou" placeholder="<?php echo $lang['name']."..." ?>" required style="width: 95%"></td>
</tr>
<tr>
<td><?php echo $lang['published'].": " ?></td>
<td>
<div class="checkbox">
<input type="checkbox" name="news_published" id="news_published" hidden>
<label for="news_published"></label>
</div>
</td>
</tr>
<tr>
<td><?php echo $lang['autosave'].": " ?></td>
<td>
<div class="checkbox">
<input type="checkbox" id="autosave" onclick="newsAutoSave()" hidden>
<label for="autosave"></label>
</div>
</td>
</tr>
</table>
<br>
<p><?php echo $lang['editor']."/".$lang['eng'] ?></p>
<div id="engEditorContainer" style="background: rgb(255, 255, 255)">
<div id="engEditor"></div>
</div>
<br>
<p><?php echo $lang['editor']."/".$lang['hun'] ?></p>
<div id="hunEditorContainer" style="background: rgb(255, 255, 255)">
<div id="hunEditor"></div>
</div>
<br>
<p><?php echo $lang['editor']."/".$lang['rou'] ?></p>
<div id="rouEditorContainer" style="background: rgb(255, 255, 255)">
<div id="rouEditor"></div>
</div>
<p style="text-align: right"><i><?php echo $lang['last_saved'].": " ?><span id="lastSaved"></span></i></p>
<br>
<br>
<button type="button" class="green" onclick="newsSave()"><i class="fa fa-save"></i> <?php echo $lang['save'] ?></button>
<button type="button" class="red" onclick="newsDiscard()"><i class="fa fa-trash"></i> <?php echo $lang['discard'] ?></button>
</fieldset>
</form>
</div>

View File

@ -0,0 +1,442 @@
<?php
/**
* /subs/parts/userarea/profile.php
* @version 1.1
* @desc Userarea: profile
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
?>
<form method="POST" class="ajaxform" onsubmit="profileUpdate()" id="profileForm">
<fieldset class="center">
<legend><?php echo $lang['profile'] ?></legend>
<table>
<tr>
<td><?php echo $lang['id'].": " ?></td>
<td><?php echo $_SESSION['id'] ?></td>
</tr>
<tr>
<td><?php echo $lang['username'].": " ?></td>
<td><?php echo $_SESSION['username'] ?></td>
</tr>
<tr>
<td><?php echo $lang['fullname'].": " ?></td>
<td><input type="text" name="profile_fullname" placeholder="<?php echo $lang['fullname']."..." ?>" value="<?php echo $_SESSION['fullname'] ?>" required></td>
</tr>
<tr>
<td>
<?php echo $lang['email'].": " ?>
<br>
<span style="font-size: 0.8em"><?php echo $lang['emailspoiler'] ?></span>
</td>
<td><input type="email" name="profile_email" placeholder="<?php echo $lang['email']."..." ?>" value="<?php echo $_SESSION['email'] ?>"></td>
</tr>
</table>
<br>
<br>
<button type="submit" class="green" form="profileForm"><i class="fa fa-check-circle"></i> <?php echo $lang['ok'] ?></button>
<button type="reset" class="red" form="profileForm"><i class="fa fa-times-circle"></i> <?php echo $lang['cancel'] ?></button>
</fieldset>
</form>
<hr class="placeholder">
<form method="POST" class="ajaxform" onsubmit="profileUpdatePassword()" id="profilePassword">
<fieldset class="center">
<legend><?php echo $lang['ch_passwd'] ?></legend>
<table>
<tr>
<td><?php echo $lang['password'].": " ?></td>
<td><input type="password" name="profile_password" placeholder="<?php echo $lang['password']."..." ?>" required></td>
</tr>
<tr>
<td><?php echo $lang['password_confirm'].": " ?></td>
<td><input type="password" name="profile_password_confirm" placeholder="<?php echo $lang['password_confirm']."..." ?>" required></td>
</tr>
</table>
<br>
<br>
<button type="submit" class="green" form="profilePassword"><i class="fa fa-check-circle"></i> <?php echo $lang['ok'] ?></button>
<button type="reset" class="red" form="profilePassword"><i class="fa fa-times-circle"></i> <?php echo $lang['cancel'] ?></button>
</fieldset>
</form>
<hr class="placeholder">
<form method="POST" class="ajaxform" onsubmit="profileSubmitShipping()" id="profileShipping">
<fieldset class="center">
<legend><?php echo $lang['shipping_address'] ?></legend>
<p>
<?php
echo $lang['status'].": ";
$sql=$db->prepare("SELECT orderer FROM users WHERE id=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['orderer']!=null){
echo "<span class=\"green\"><i class=\"fa fa-check-circle\"></i> ".$lang['set']."</span>";
}
else{
echo "<span class=\"red\"><i class=\"fa fa-times-circle\"></i> ".$lang['not_set']."</span>";
}
?>
</p>
<p><?php echo $lang['profile_shipping_address_spoiler'] ?></p>
<p><?php echo $lang['shipping_address_spoiler'] ?></p>
<br>
<table>
<tr>
<td><?php echo $lang['shipping_name'].": " ?></td>
<td><input type="text" name="profile_shipping_name" placeholder="<?php echo $lang['shipping_name']."..." ?>" style="width: 50em" required></td>
</tr>
<tr>
<td><?php echo $lang['shipping_country'].": " ?></td>
<td>
<select name="address_country" style="width: 51em" required>
<option value="AF">Afghanistan</option>
<option value="AX">Åland Islands</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia, Plurinational State of</option>
<option value="BQ">Bonaire, Sint Eustatius and Saba</option>
<option value="BA">Bosnia and Herzegovina</option>
<option value="BW">Botswana</option>
<option value="BV">Bouvet Island</option>
<option value="BR">Brazil</option>
<option value="IO">British Indian Ocean Territory</option>
<option value="BN">Brunei Darussalam</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CX">Christmas Island</option>
<option value="CC">Cocos (Keeling) Islands</option>
<option value="CO">Colombia</option>
<option value="KM">Comoros</option>
<option value="CG">Congo</option>
<option value="CD">Congo, the Democratic Republic of the</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CI">Côte d'Ivoire</option>
<option value="HR">Croatia</option>
<option value="CU">Cuba</option>
<option value="CW">Curaçao</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FK">Falkland Islands (Malvinas)</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="TF">French Southern Territories</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GG">Guernsey</option>
<option value="GN">Guinea</option>
<option value="GW">Guinea-Bissau</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HM">Heard Island and McDonald Islands</option>
<option value="VA">Holy See (Vatican City State)</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IR">Iran, Islamic Republic of</option>
<option value="IQ">Iraq</option>
<option value="IE">Ireland</option>
<option value="IM">Isle of Man</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JE">Jersey</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="KP">Korea, Democratic People's Republic of</option>
<option value="KR">Korea, Republic of</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Lao People's Democratic Republic</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macao</option>
<option value="MK">Macedonia, the former Yugoslav Republic of</option>
<option value="MG">Madagascar</option>
<option value="MW">Malawi</option>
<option value="MY">Malaysia</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="YT">Mayotte</option>
<option value="MX">Mexico</option>
<option value="FM">Micronesia, Federated States of</option>
<option value="MD">Moldova, Republic of</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="ME">Montenegro</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Namibia</option>
<option value="NR">Nauru</option>
<option value="NP">Nepal</option>
<option value="NL">Netherlands</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NU">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="MP">Northern Mariana Islands</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau</option>
<option value="PS">Palestinian Territory, Occupied</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PN">Pitcairn</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="RE">Réunion</option>
<option value="RO">Romania</option>
<option value="RU">Russian Federation</option>
<option value="RW">Rwanda</option>
<option value="BL">Saint Barthélemy</option>
<option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
<option value="KN">Saint Kitts and Nevis</option>
<option value="LC">Saint Lucia</option>
<option value="MF">Saint Martin (French part)</option>
<option value="PM">Saint Pierre and Miquelon</option>
<option value="VC">Saint Vincent and the Grenadines</option>
<option value="WS">Samoa</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome and Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="RS">Serbia</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SX">Sint Maarten (Dutch part)</option>
<option value="SK">Slovakia</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="SO">Somalia</option>
<option value="ZA">South Africa</option>
<option value="GS">South Georgia and the South Sandwich Islands</option>
<option value="SS">South Sudan</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SJ">Svalbard and Jan Mayen</option>
<option value="SZ">Swaziland</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syrian Arab Republic</option>
<option value="TW">Taiwan, Province of China</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania, United Republic of</option>
<option value="TH">Thailand</option>
<option value="TL">Timor-Leste</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad and Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TM">Turkmenistan</option>
<option value="TC">Turks and Caicos Islands</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VE">Venezuela, Bolivarian Republic of</option>
<option value="VN">Viet Nam</option>
<option value="VG">Virgin Islands, British</option>
<option value="VI">Virgin Islands, U.S.</option>
<option value="WF">Wallis and Futuna</option>
<option value="EH">Western Sahara</option>
<option value="YE">Yemen</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
</select>
</td>
</tr>
<tr>
<td><?php echo $lang['shipping_region'].": " ?></td>
<td><input type="text" name="address_region" placeholder="<?php echo $lang['shipping_region']."..." ?>" style="width: 50em" required></td>
</tr>
<tr>
<td><?php echo $lang['shipping_city'].": " ?></td>
<td><input type="text" name="address_city" placeholder="<?php echo $lang['shipping_city']."..." ?>" style="width: 50em" required></td>
</tr>
<tr>
<td><?php echo $lang['shipping_address_line1'].": " ?></td>
<td><input type="text" name="address_line1" placeholder="<?php echo $lang['shipping_address_line1']."..." ?>" style="width: 50em" required></td>
</tr>
<tr>
<td><?php echo $lang['shipping_address_line2'].": " ?></td>
<td><input type="text" name="address_line2" placeholder="<?php echo $lang['shipping_address_line2']."..." ?>" style="width: 50em"></td>
</tr>
<tr>
<td><?php echo $lang['shipping_zip'].": " ?></td>
<td><input type="text" name="address_zip" placeholder="<?php echo $lang['shipping_zip']."..." ?>" style="width: 50em" required></td>
</tr>
<tr>
<td><?php echo $lang['shipping_email'].": " ?></td>
<td><input type="email" name="profile_shipping_email" placeholder="<?php echo $lang['shipping_email']."..." ?>" style="width: 50em" required></td>
</tr>
<tr>
<td><?php echo $lang['shipping_phone'].": " ?></td>
<td><input type="text" name="profile_shipping_phone" placeholder="<?php echo $lang['shipping_phone_example']."..." ?>" style="width: 50em" required</td>
</tr>
</table>
<br>
<span id="encStatus"></span>
<br>
<button type="submit" class="green" form="profileShipping"><i class="fa fa-check-circle"></i> <?php echo $lang['ok'] ?></button>
<button type="reset" class="red" form="profileShipping"><i class="fa fa-times-circle"></i> <?php echo $lang['cancel'] ?></button>
<button type="button" class="red" onclick="profileDeleteShipping()"><i class="fa fa-trash"></i> <?php echo $lang['delete'] ?></button>
</fieldset>
</form>
<hr class="placeholder">
<form method="POST" class="ajaxform" onsubmit="deleteProfile()" id="profileDelete">
<fieldset class="center">
<legend><?php echo $lang['delete_profile'] ?></legend>
<p><?php echo $lang['delete_profile_spoiler'] ?></p>
<br>
<br>
<p><?php echo $lang['sure'] ?></p>
<div class="checkbox center">
<input type="checkbox" id="delete_profile_box1" hidden>
<label for="delete_profile_box1"></label>
</div>
<br>
<p><?php echo $lang['sure_2'] ?></p>
<div class="checkbox center">
<input type="checkbox" id="delete_profile_box2" hidden>
<label for="delete_profile_box2"></label>
</div>
<br>
<p><?php echo $lang['sure_3'] ?></p>
<div class="checkbox center">
<input type="checkbox" id="delete_profile_box3" hidden>
<label for="delete_profile_box3"></label>
</div>
<br>
<br>
<button type="submit" class="red" form="profileDelete"><i class="fa fa-trash"></i> <?php echo $lang['delete_profile'] ?></button>
<button type="reset" class="green" form="profileDelete"><i class="fa fa-check-circle"></i> <?php echo $lang['cancel'] ?></button>
</fieldset>
</form>
<hr class="placeholder">
<form method="POST" class="ajaxform">
<fieldset class="center">
<legend><?php echo $lang['get_all_profile_data'] ?></legend>
<p><?php echo $lang['get_all_profile_data_spoiler'] ?></p>
<br>
<table class="center">
<tr>
<td><?php echo $lang['pgp_public'].": " ?></td>
<td><textarea id="request_profile_data_pgp" rows="20" cols="60" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----&#x0a;&#x0a;...&#x0a;&#x0a;-----END PGP PUBLIC KEY BLOCK-----"></textarea></td>
</tr>
</table>
<br>
<button type="button" onclick="requestProfileData()"><i class="fa fa-download"></i> <?php echo $lang['get_all_profile_data'] ?></button>
</fieldset>
</form>

View File

@ -0,0 +1,710 @@
<?php
/**
* /subs/parts/userarea_backend.php
* @version 1.5
* @desc Users area backend
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
if(!$lm->validateLogin()){
if(isset($_POST['username']) && isset($_POST['password'])){
$lm->login($_POST['username'], $_POST['password'], isset($_POST['remember']));
}
if(isset($_GET['auto_login'])){
$lm->login("", "");
}
if(isset($_GET['forget_user'])){
$lm->forgetUser();
}
}
else{
if(isset($_GET['logout'])){
$lm->logout();
die();
}
if($sub!=""){
if($sub!="fileshare" && $sub!="blog" && $sub!="orders" && $sub!="messages" && $sub!="news" && $sub!="admin" && $sub!="profile"){
functions::setError(500);
header("Location: /userarea");
}
if($sub=="blog" && $_SESSION['accesslevel']<1){
functions::setError(500);
header("Location: /userarea");
}
if(($sub=="orders" || $sub=="messages") && $_SESSION['accesslevel']<2){
functions::setError(500);
header("Location: /userarea");
}
if(($sub=="news" || $sub=="admin") && $_SESSION['accesslevel']<3){
functions::setError(500);
header("Location: /userarea");
}
}
/*
* FILESHARE
*/
//file upload
if(isset($_POST['upload_name']) && isset($_FILES['upload_file'])){
$token=hash("md5", $_POST['upload_name']."<<<>>>".functions::randomString(16, functions::RAND_SPEC));
$ext=strtolower(pathinfo($_FILES['upload_file']['name'], PATHINFO_EXTENSION));
$size=$_FILES['upload_file']['size'];
//get user quota
if($_SESSION['quota']!=-1){
//calc previous uploads quota:
$sql=$db->prepare("SELECT SUM(size) AS size FROM files WHERE owner=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
$prev=$sql->fetch(PDO::FETCH_ASSOC)['size'];
if($prev+$size > $_SESSION['quota']*1000000){
functions::setError(4);
echo "quota";
die();
}
}
//add file to database
$sql=$db->prepare("INSERT INTO files (token, owner, name, extension, size) VALUES (:token, :owner, :name, :ext, :size)");
$sql->execute(array(":token"=>$token, ":owner"=>$_SESSION['id'], ":name"=>$_POST['upload_name'], ":ext"=>$ext, ":size"=>$size));
$fid=$db->lastInsertId();
$target="../uploads/files/".$fid;
if(!move_uploaded_file($_FILES['upload_file']['tmp_name'], $target)){
//wrong.
//roll back SQL changes
$sql=$db->prepare("DELETE FROM files WHERE id=:fid");
$sql->execute(array(":fid"=>$fid));
functions::setError(6);
echo "error";
die();
}
else{
echo "https://systemtest.tk/uploads/".$token;
die();
}
}
//file delete
if(isset($_POST['delete_file'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM files WHERE id=:fid and owner=:uid");
$sql->execute(array(":fid"=>$_POST['delete_file'], ":uid"=>$_SESSION['id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
die();
}
else{
if(unlink("../uploads/files/".$_POST['delete_file'])){
$sql=$db->prepare("DELETE FROM files WHERE id=:fid");
$sql->execute(array(":fid"=>$_POST['delete_file']));
functions::setMessage(3);
echo "ok";
die();
}
else{
functions::setError(6);
echo "error";
die();
}
}
}
/*
* BLOG
*/
if($_SESSION['accesslevel']>=1){
//new entry
if(isset($_POST['blog_new'])){
$sql=$db->prepare("INSERT INTO blog (owner, published) VALUES (:uid, 0)");
$sql->execute(array(":uid"=>$_SESSION['id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
echo $db->lastInsertId();
die();
}
}
//update entry
if(isset($_POST['blog_id']) && isset($_POST['blog_title']) && isset($_POST['blog_content']) && isset($_POST['blog_tags']) && isset($_POST['blog_published'])){
if($_SESSION['accesslevel'] < 3){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM blog WHERE id=:bid and owner=:uid");
$sql->execute(array(":bid"=>$_POST['blog_id'], ":uid"=>$_SESSION['id']));
}
else{
$sql=$db->prepare("SELECT COUNT(id) AS count FROM blog WHERE id=:bid");
$sql->execute(array(":bid"=>$_POST['blog_id']));
}
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
//merge updates
if($_SESSION['accesslevel'] < 3){
$sql=$db->prepare("UPDATE blog SET title=:title, date=:date, content=:content, published=:published WHERE id=:bid and owner=:uid");
$sql->execute(array(":title"=>$_POST['blog_title'], ":date"=>date("Y-m-d H:i:s"), ":content"=>$_POST['blog_content'], ":published"=>$_POST['blog_published'], ":bid"=>$_POST['blog_id'], ":uid"=>$_SESSION['id']));
}
else{
$sql=$db->prepare("UPDATE blog SET title=:title, date=:date, content=:content, published=:published WHERE id=:bid");
$sql->execute(array(":title"=>$_POST['blog_title'], ":date"=>date("Y-m-d H:i:s"), ":content"=>$_POST['blog_content'], ":published"=>$_POST['blog_published'], ":bid"=>$_POST['blog_id']));
}
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
}
else{
$sql=$db->prepare("DELETE FROM blog_tags WHERE blogentry=:bid");
$sql->execute(array(":bid"=>$_POST['blog_id']));
foreach(explode(";", $_POST['blog_tags']) as $t){
$sql=$db->prepare("INSERT INTO blog_tags (blogentry, tag) VALUES (:bid, :tag)");
$sql->execute(array(":bid"=>$_POST['blog_id'], ":tag"=>$t));
}
functions::setMessage(4);
}
}
}
//get data
if(isset($_GET['blog_get'])){
$sql=$db->prepare("SELECT COUNT(b.id) AS count, b.id, b.title, u.fullname AS owner, b.date, b.content, b.published, GROUP_CONCAT(bt.tag SEPARATOR ';') AS tags FROM blog AS b INNER JOIN users AS u ON (u.id=b.owner) LEFT JOIN blog_tags AS bt ON (bt.blogentry=b.id) WHERE b.id=:id GROUP BY b.id");
$sql->execute(array(":id"=>$_GET['blog_get']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
echo json_encode($res);
die();
}
}
//delete entry
if(isset($_POST['blog_delete'])){
if($_SESSION['accesslevel'] < 3){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM blog WHERE id=:bid and owner=:uid");
$sql->execute(array(":bid"=>$_POST['blog_delete'], ":uid"=>$_SESSION['id']));
}
else{
$sql=$db->prepare("SELECT COUNT(id) AS count FROM blog WHERE id=:bid");
$sql->execute(array(":bid"=>$_POST['blog_delete']));
}
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
if($_SESSION['accesslevel'] < 3){
$sql=$db->prepare("DELETE FROM blog WHERE id=:bid and owner=:uid");
$sql->execute(array(":bid"=>$_POST['blog_delete'], ":uid"=>$_SESSION['id']));
}
else{
$sql=$db->prepare("DELETE FROM blog WHERE id=:bid");
$sql->execute(array(":bid"=>$_POST['blog_delete']));
}
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(5);
echo "ok";
die();
}
}
}
}
/*
* NEWS
*/
if($_SESSION['accesslevel']>=3){
//new entry
if(isset($_POST['news_new'])){
$sql=$db->prepare("INSERT INTO news (owner, published) VALUES (:uid, 0)");
$sql->execute(array(":uid"=>$_SESSION['id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
echo $db->lastInsertId();
die();
}
}
//update entry
if(isset($_POST['news_id']) && isset($_POST['news_subject_eng']) && isset($_POST['news_subject_hun']) && isset($_POST['news_subject_rou']) && isset($_POST['news_content_eng']) && isset($_POST['news_content_hun']) && isset($_POST['news_content_rou']) && isset($_POST['news_published'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM news WHERE id=:id");
$sql->execute(array(":id"=>$_POST['news_id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("UPDATE news SET date=:date, subject_eng=:subj_eng, subject_hun=:subj_hun, subject_rou=:subj_rou, content_eng=:cont_eng, content_hun=:cont_hun, content_rou=:cont_rou, published=:pub WHERE id=:id");
$sql->execute(array(":date"=>date("Y-m-d H:i:s"), ":subj_eng"=>$_POST['news_subject_eng'], ":subj_hun"=>$_POST['news_subject_hun'], ":subj_rou"=>$_POST['news_subject_rou'], ":cont_eng"=>$_POST['news_content_eng'], ":cont_hun"=>$_POST['news_content_hun'], ":cont_rou"=>$_POST['news_content_rou'], ":pub"=>$_POST['news_published'], ":id"=>$_POST['news_id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(4);
echo "ok";
die();
}
}
}
//get data
if(isset($_GET['news_get'])){
$sql=$db->prepare("SELECT COUNT(id) AS count, id, owner, date, subject_eng, subject_hun, subject_rou, content_eng, content_hun, content_rou, published FROM news WHERE id=:id");
$sql->execute(array(":id"=>$_GET['news_get']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
echo json_encode($res);
die();
}
}
//delete entry
if(isset($_POST['news_delete'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM news WHERE id=:id");
$sql->execute(array(":id"=>$_POST['news_delete']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("DELETE FROM news WHERE id=:id");
$sql->execute(array(":id"=>$_POST['news_delete']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(5);
echo "ok";
die();
}
}
}
/*
* ADMIN AREA
*/
//new password
if(isset($_POST['new_password_user']) && isset($_POST['new_password'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM users WHERE id=:id");
$sql->execute(array(":id"=>$_POST['new_password_user']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("UPDATE users SET password=:passwd WHERE id=:id");
$passwd=PasswordStorage::create_hash($_POST['new_password']);
$sql->execute(array(":passwd"=>$passwd, ":id"=>$_POST['new_password_user']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(4);
echo "ok";
die();
}
}
}
//new accesslevel
if(isset($_POST['new_accesslevel_user']) && isset($_POST['new_accesslevel'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM users WHERE id=:id");
$sql->execute(array(":id"=>$_POST['new_accesslevel_user']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("UPDATE users SET accesslevel=:al WHERE id=:id");
$sql->execute(array(":al"=>$_POST['new_accesslevel'], ":id"=>$_POST['new_accesslevel_user']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(4);
echo "ok";
die();
}
}
}
//new quota
if(isset($_POST['new_quota_user']) && isset($_POST['new_quota'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM users WHERE id=:id");
$sql->execute(array(":id"=>$_POST['new_quota_user']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("UPDATE users SET quota=:q WHERE id=:id");
$sql->execute(array(":q"=>$_POST['new_quota'], ":id"=>$_POST['new_quota_user']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(4);
echo "ok";
die();
}
}
}
//finalize request
if(isset($_POST['admin_finish_request'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM data_requests WHERE id=:id and finished=0");
$sql->execute(array(":id"=>$_POST['admin_finish_request']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("UPDATE data_requests SET finished=1 WHERE id=:id");
$sql->execute(array(":id"=>$_POST['admin_finish_request']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(14);
echo "ok";
die();
}
}
}
//new user
if(isset($_POST['usernew_username']) && isset($_POST['usernew_fullname']) && isset($_POST['usernew_email']) && isset($_POST['usernew_accesslevel']) && isset($_POST['usernew_quota']) && isset($_POST['usernew_password']) && isset($_POST['usernew_password_confirm'])){
if($_POST['usernew_password']!=$_POST['usernew_password_confirm']){
functions::setError(8);
echo "error";
die();
}
else{
$sql=$db->prepare("SELECT COUNT(id) AS count FROM users WHERE username=:username");
$sql->execute(array(":username"=>$_POST['usernew_username']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] > 0){
functions::setError(9);
echo "error";
die();
}
else{
$passwd=PasswordStorage::create_hash($_POST['usernew_password']);
$sql=$db->prepare("INSERT INTO users (username, fullname, email, accesslevel, quota, password) VALUE (:uname, :fname, :email, :al, :quota, :passwd)");
$sql->execute(array(":uname"=>$_POST['usernew_username'], ":fname"=>$_POST['usernew_fullname'], ":email"=>$_POST['usernew_email'], ":al"=>$_POST['usernew_accesslevel'], ":quota"=>$_POST['usernew_quota'], ":passwd"=>$passwd));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(6);
echo "ok";
die();
}
}
}
}
}
/*
* PROFILE
*/
//update details
if(isset($_POST['profile_fullname']) && isset($_POST['profile_email'])){
$sql=$db->prepare("UPDATE users SET fullname=:fname, email=:email WHERE id=:id");
$sql->execute(array(":fname"=>$_POST['profile_fullname'], ":email"=>$_POST['profile_email'], ":id"=>$_SESSION['id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(7);
echo "ok";
die();
}
}
//update password
if(isset($_POST['profile_password']) && isset($_POST['profile_password_confirm'])){
if($_POST['profile_password']!=$_POST['profile_password_confirm']){
functions::setError(8);
echo "error";
die();
}
else{
$passwd=PasswordStorage::create_hash($_POST['profile_password']);
$sql=$db->prepare("UPDATE users SET password=:passwd WHERE id=:id");
$sql->execute(array(":passwd"=>$passwd, ":id"=>$_SESSION['id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(8);
echo "ok";
die();
}
}
}
//update shipping details
if(isset($_POST['profile_shipping_name']) && isset($_POST['profile_shipping_address']) && isset($_POST['profile_shipping_email']) && isset($_POST['profile_shipping_phone'])){
//get wich entry to use
$sql=$db->prepare("SELECT COUNT(id) AS count, orderer FROM users WHERE id=:id and orderer is not null");
$sql->execute(array(":id"=>$_SESSION['id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] > 0){
//already exists, just needs to be updated
$sql=$db->prepare("UPDATE orderers SET name=:name, address=:address, email=:email, phone=:phone WHERE reference=:ref");
$sql->execute(array(":name"=>$_POST['profile_shipping_name'], ":address"=>$_POST['profile_shipping_address'], ":email"=>$_POST['profile_shipping_email'], ":phone"=>$_POST['profile_shipping_phone'], ":ref"=>$res['orderer']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(9);
echo "ok";
die();
}
}
else{
$ref=hash("md5", date("Y-m-d H:i:s")."<<<>>>".functions::randomString(16, functions::RAND_SPEC));
$sql=$db->prepare("INSERT INTO orderers (reference, name, address, email, phone) VALUES (:ref, :name, :addr, :email, :phone)");
$sql->execute(array(":ref"=>$ref, ":name"=>$_POST['profile_shipping_name'], ":addr"=>$_POST['profile_shipping_address'], ":email"=>$_POST['profile_shipping_email'], ":phone"=>$_POST['profile_shipping_phone']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
//assign to user
$sql=$db->prepare("UPDATE users SET orderer=:oref WHERE id=:id");
$sql->execute(array(":oref"=>$ref, ":id"=>$_SESSION['id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(10);
echo "ok";
die();
}
}
}
}
//delete shipping details
if(isset($_POST['profile_shipping_delete'])){
//get wich entry to use
$sql=$db->prepare("SELECT COUNT(id) AS count, orderer FROM users WHERE id=:id and orderer is not null");
$sql->execute(array(":id"=>$_SESSION['id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] < 1){
functions::setError(7);
echo "error";
die();
}
else{
$sql=$db->prepare("DELETE FROM orderers WHERE reference=:ref");
$sql->execute(array(":ref"=>$res['orderer']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
echo "error";
die();
}
else{
functions::setMessage(11);
echo "ok";
die();
}
}
}
//delete profile
if(isset($_POST['delete_profile'])){
//delete files
$sql=$db->prepare("SELECT id FROM files WHERE owner=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
while($res=$sql->fetch(PDO::FETCH_ASSOC)){
unlink("../uploads/files/".$res['id']);
}
//delete shipping address
$sql=$db->prepare("SELECT orderer FROM users WHERE id=:uid");
$sql->execute(array(":uid"=>$_SESSION['id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['orderer']!=null){
$sql=$db->prepare("DELETE FROM orderers WHERE reference=:ref");
$sql->execute(array(":ref"=>$res['orderer']));
}
//delete profile
$sql=$db->prepare("DELETE FROM users WHERE id=:id");
$sql->execute(array(":id"=>$_SESSION['id']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(10);
echo "error";
die();
}
else{
functions::setMessage(12);
echo "ok";
die();
}
}
//request profile data
if(isset($_POST['request_profile_data']) && isset($_POST['request_profile_data_pgp'])){
$sql=$db->prepare("SELECT COUNT(id) AS count FROM data_requests WHERE user=:uid and finished=0");
$sql->execute(array(":uid"=>$_SESSION['id']));
$res=$sql->fetch(PDO::FETCH_ASSOC);
if($res['count'] > 0){
functions::setError(11);
}
else{
$sql=$db->prepare("INSERT INTO data_requests (date, user, pgp, finished) VALUES (:date, :uid, :pgp, 0)");
$sql->execute(array(":date"=>date("Y-m-d H:i:s"), ":uid"=>$_SESSION['id'], ":pgp"=>$_POST['request_profile_data_pgp']));
$res=$sql->rowCount();
if($res < 1){
functions::setError(6);
}
else{
functions::setMessage(13);
}
}
}
}

27
subs/pubkey.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/**
* /subs/pubkey.php
* @version 1.0
* @desc Get public RSA key
* @author Fándly Gergő Zoltán (gergo@systemtest.tk, systemtest.tk)
* @copy 2018 Fándly Gergő Zoltán
* License:
Systemtest.tk website's.
Copyright (C) 2018 Fándly Gergő Zoltán
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
readfile("../config/pubkey.pub");
die();