Dump all the stuff from SVN
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
config.ini
|
4
.htaccess
Normal file
@ -0,0 +1,4 @@
|
||||
RewriteEngine on
|
||||
RewriteRule ^([a-zA-Z_]+)\/((config|proj|res|script|style|subs|uploads|websvn)\/?([a-zA-Z_.\/]+)?)$ /$2 [L,R]
|
||||
RewriteRule ^(config|mailer|proj|res|script|style|subs|uploads|websvn)\/?(.)+?$ - [L]
|
||||
RewriteRule ^([a-zA-Z_]+)(\/([a-zA-Z0-9_:]+))?\/?$ index.php?view=$1&sub=$3 [L,QSA]
|
2
config/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
150
config/config.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* /config/config.php
|
||||
* @version 1.0
|
||||
* @desc configuration
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
|
||||
const VERSION="0.5";
|
||||
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
require_once("lib/loginManager/loginManager.php");
|
||||
require_once("lib/PasswordStorage.php");
|
||||
require_once("lib/functions.php");
|
||||
|
||||
$config=parse_ini_file("config.ini", true);
|
||||
|
||||
/*
|
||||
* Regionals
|
||||
*/
|
||||
date_default_timezone_set($config['general']['timezone']);
|
||||
mb_internal_encoding("UTF-8");
|
||||
|
||||
/*
|
||||
* Language files
|
||||
*/
|
||||
$langstr="";
|
||||
if(isset($_GET['setlang'])){
|
||||
$langstr=$_GET['setlang'];
|
||||
setcookie("language", $langstr, 90*86000);
|
||||
}
|
||||
else if(isset($_COOKIE['language'])){
|
||||
$langstr=$_COOKIE['language'];
|
||||
}
|
||||
else{
|
||||
$langstr=$config['language']['default'];
|
||||
}
|
||||
if(!in_array($langstr, $config['language']['available'])){
|
||||
$langstr=$config['language']['default'];
|
||||
}
|
||||
$langcode="";
|
||||
if($langstr=="en_US"){
|
||||
$langcode="eng";
|
||||
}
|
||||
else if($langstr=="hu_HU"){
|
||||
$langcode="hun";
|
||||
}
|
||||
else if($langstr=="ro_RO"){
|
||||
$langcode="rou";
|
||||
}
|
||||
$lang=parse_ini_file("lang/".$langstr.".ini", false);
|
||||
|
||||
/*
|
||||
* DB setup
|
||||
*/
|
||||
$db=new PDO($config['database']['type'].":host=".$config['database']['host'].";dbname=".$config['database']['name'].";charset=utf8", $config['database']['user'], $config['database']['password']);
|
||||
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, FALSE);
|
||||
|
||||
/*
|
||||
* UTF8 BOM
|
||||
*/
|
||||
$BOM=chr(239).chr(187).chr(191);
|
||||
|
||||
/*
|
||||
* DEBUG
|
||||
*/
|
||||
if($config['general']['debug']){
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
ini_set("display_errors", true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Login manager
|
||||
*/
|
||||
class handler implements lmHandler{
|
||||
public function handle($state, $target=0){
|
||||
global $db;
|
||||
switch($state){
|
||||
case lmStates::LOGIN_FAILED:
|
||||
functions::setError(1);
|
||||
functions::safeReload();
|
||||
break;
|
||||
case lmStates::LOGIN_OK:
|
||||
$sql=$db->prepare("SELECT id, username, fullname, email, accesslevel, quota, orderer FROM users WHERE id=:id");
|
||||
$sql->execute(array(":id"=>$target));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
$_SESSION['id']=$res['id'];
|
||||
$_SESSION['username']=$res['username'];
|
||||
$_SESSION['fullname']=$res['fullname'];
|
||||
$_SESSION['email']=$res['email'];
|
||||
$_SESSION['accesslevel']=$res['accesslevel'];
|
||||
$_SESSION['quota']=$res['quota'];
|
||||
$_SESSION['orderer']=$res['orderer'];
|
||||
header("Location: /userarea");
|
||||
break;
|
||||
case lmStates::CAPTCHA_FAILED:
|
||||
functions::setError(2);
|
||||
functions::safeReload();
|
||||
break;
|
||||
case lmStates::BANNED:
|
||||
functions::setError(3);
|
||||
functions::safeReload();
|
||||
break;
|
||||
case lmStates::FORGET_DONE:
|
||||
functions::setMessage(1);
|
||||
functions::safeReload();
|
||||
break;
|
||||
case lmStates::LOGOUT_DONE:
|
||||
functions::setMessage(2);
|
||||
functions::safeReload();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
class password implements lmPassword{
|
||||
public function verifyPassword($cleartext, $database){
|
||||
if($database==""){
|
||||
return false;
|
||||
}
|
||||
return PasswordStorage::verify_password($cleartext, $database);
|
||||
}
|
||||
}
|
||||
class twoFactor implements lmTwoFactor{
|
||||
public function secondFactor($uid){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
$lm=new loginManager(new lmConfig($db, $config['login']['session_lifetime'], $config['login']['captcha_enable'], $config['login']['captcha_after'], $config['login']['captcha_sitekey'], $config['login']['captcha_secretkey'], $config['login']['ban_enable'], $config['login']['ban_after'], $config['login']['ban_time'], $config['login']['look'], $config['login']['remember_enable'], $config['login']['remember_time'], lmStates::AUTH_UNAME), new handler(), new password(), new twoFactor());
|
||||
$lm->init();
|
213
config/database setup.sql
Normal file
@ -0,0 +1,213 @@
|
||||
/**
|
||||
* /config/database setup.php
|
||||
* @version 1.0
|
||||
* @desc Database setup
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
CREATE TABLE `users`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`username` varchar(65) NOT NULL default '', /* optional */
|
||||
`fullname` varchar(65) NOT NULL default '',
|
||||
`email` varchar(65) NOT NULL default '',
|
||||
`accesslevel` tinyint(1) UNSIGNED NOT NULL default 0, /* 0-regular user; 1-blogger; 2-order handler/helpdesk; 3-admin */
|
||||
`quota` int(4) NOT NULL default 100, /* quota in MBs; -1 for unlimited */
|
||||
`orderer` varchar(35) default null,
|
||||
`password` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`orderer`) REFERENCES orderers(`reference`) ON DELETE SET NULL
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `login_history`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`user` int(4) UNSIGNED NOT NULL default 1, /* id of nouser */
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`ip` varchar(45) NOT NULL default '0.0.0.0',
|
||||
`auth_token` varchar(65) NOT NULL default '',
|
||||
`user_agent` varchar(500) NOT NULL default '',
|
||||
`success` tinyint(1) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `login_remember`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`user` int(4) UNSIGNED NOT NULL default 0,
|
||||
`remember_token` varchar(65) NOT NULL default '',
|
||||
`until` timestamp NOT NULL default current_timestamp,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `login_bans`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`ip` varchar(45) NOT NULL default '0.0.0.0',
|
||||
`until` timestamp NOT NULL default current_timestamp,
|
||||
PRIMARY KEY (`id`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `projects` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`name` varchar(65) NOT NULL default '',
|
||||
`description` text NOT NULL default '',
|
||||
`owner` int(4) UNSIGNED NOT NULL default 0,
|
||||
`path` varchar(125) NOT NULL default '',
|
||||
`repo` varchar(125) NOT NULL default '',
|
||||
`status` varchar(65) NOT NULL default '',
|
||||
`image` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`owner`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `files` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`token` varchar(35) NOT NULL default '', /* MD5 hash computed from {name}<<<>>>{random 16 char string} */
|
||||
`owner` int(4) UNSIGNED NOT NULL default 0,
|
||||
`name` varchar(65) NOT NULL default 0,
|
||||
`extension` varchar(20) NOT NULL default '.*',
|
||||
`size` int(4) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`owner`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `news` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`owner` int(4) UNSIGNED NOT NULL default 0,
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`subject_eng` varchar(65) NOT NULL default '',
|
||||
`subject_hun` varchar(65) NOT NULL default '',
|
||||
`subject_rou` varchar(65) NOT NULL default '',
|
||||
`content_eng` text NOT NULL default '',
|
||||
`content_hun` text NOT NULL default '',
|
||||
`content_rou` text NOT NULL default '',
|
||||
`published` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`owner`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `blog` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`title` varchar(65) NOT NULL default '',
|
||||
`owner` int(4) UNSIGNED NOT NULL default 0,
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`content` text NOT NULL default '',
|
||||
`published` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`owner`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `blog_tags` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`blogentry` int(4) UNSIGNED NOT NULL default 0,
|
||||
`tag` varchar(65) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`blogentry`) REFERENCES blog(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `products` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`name_eng` varchar(65) NOT NULL default '',
|
||||
`name_hun` varchar(65) NOT NULL default '',
|
||||
`name_rou` varchar(65) NOT NULL default '',
|
||||
`description_eng` text NOT NULL default '',
|
||||
`description_hun` text NOT NULL default '',
|
||||
`description_rou` text NOT NULL default '',
|
||||
`price` int(4) NOT NULL default 0, /* if -2: to be announced, -1: contact us */
|
||||
PRIMARY KEY (`id`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `product_tags` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`product` int(4) UNSIGNED NOT NULL default 0,
|
||||
`tag` varchar(65) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`product`) REFERENCES products(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `product_images` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`product` int(4) UNSIGNED NOT NULL default 0,
|
||||
`image` int(4) UNSIGNED NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`product`) REFERENCES products(`id`) ON DELETE CASCADE,
|
||||
FOREIGN KEY (`image`) REFERENCES files(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `product_reviews` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`orderid` int(4) UNSIGNED NOT NULL default 0,
|
||||
`writer` varchar(65) NOT NULL default 'Anonymous',
|
||||
`rating` tinyint(1) UNSIGNED NOT NULL default 5, /* from 1 to 5 */
|
||||
`comment` varchar(2000) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`orderid`) REFERENCES orders(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `orderers` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`reference` varchar(35) NOT NULL default '', /* md5 hash computed from {current timestamp}<<<>>>{random 16 char string} */
|
||||
`name` text NOT NULL default '', /* encrypted */
|
||||
`address` text NOT NULL default '',
|
||||
`email` text NOT NULL default '',
|
||||
`phone` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY (`reference`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `orders` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`reference` varchar(35) NOT NULL default '', /* md5 hash reference computed from {current timestamp}<<<>>>{random 16 char string} */
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`product` int(4) UNSIGNED default 0,
|
||||
`quantity` int(4) UNSIGNED NOT NULL default 1,
|
||||
`orderer` varchar(35) default '',
|
||||
`comments` text NOT NULL default '',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL default 0, /* 0:order placed; 1:preprocessing, produceing; 2:waiting payment; 3:payed; 4:packing; 5:shipped; 6:arrieved; 10:order cancelled */
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`product`) REFERENCES products(`id`) ON DELETE SET NULL,
|
||||
FOREIGN KEY (`orderer`) REFERENCES orderers(`reference`) ON DELETE SET NULL
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `messages` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`subject` varchar(65) NOT NULL default '',
|
||||
`message` varchar(1500) NOT NULL default '',
|
||||
`blogentry` int(4) UNSIGNED default NULL,
|
||||
`product` int(4) UNSIGNED default NULL,
|
||||
`orderid` int(4) UNSIGNED default NULL,
|
||||
`replyemail` varchar(65) NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`blogentry`) REFERENCES blog(`id`) ON DELETE SET NULL,
|
||||
FOREIGN KEY (`product`) REFERENCES products(`id`) ON DELETE SET NULL,
|
||||
FOREIGN KEY (`orderid`) REFERENCES orders(`id`) ON DELETE SET NULL
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `data_requests` (
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`user` int(4) UNSIGNED NOT NULL default 1,
|
||||
`pgp` varchar(10000) NOT NULL default '',
|
||||
`finished` tinyint(1) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
INSERT INTO users (`id`, `username`) VALUES (1, 'nouser');
|
144
config/lang/en_US.ini
Normal file
@ -0,0 +1,144 @@
|
||||
sitetitle="Systemtest"
|
||||
cookie_message="This site uses cookies to ensure you have the best experience on our website."
|
||||
cookie_dismiss="Got it!"
|
||||
cookie_link="Learn more"
|
||||
index="Home"
|
||||
projects="Projects"
|
||||
repos="Repositories"
|
||||
blog="Blog"
|
||||
about="About us"
|
||||
userarea="User area"
|
||||
products="Products"
|
||||
contact="Contact"
|
||||
index_content="Hi there! This is a site where I test my projects, ocasionally post some stuff and write articles which I hope will offer help to some people (these are mostly in Hungarian). I also have an SVN repository, a small file share server (100MB lifetime storage for free) and a products tab where I offer services (building websites, configuring networks, servers, etc) but also some pre-built projects (for example an automated, programmable aquarium fertilizer).<br>If you have any question or you just have something to say, feel free to write me!<br>Have a good day!"
|
||||
news="News"
|
||||
loadmore="Load more!"
|
||||
projects_content="Here you can find the projects I made."
|
||||
view="View"
|
||||
source="Source"
|
||||
keywords="Keywords"
|
||||
readmore="Read more"
|
||||
login="Log in"
|
||||
username="Username"
|
||||
password="Password"
|
||||
ok="Ok!"
|
||||
welcome_back_1="Welcome back, "
|
||||
welcome_back_2="!"
|
||||
forget_user="Somebody else? Or just want to forget?"
|
||||
remember="Remember me"
|
||||
fileshare="File share"
|
||||
profile="Profile"
|
||||
orders="Orders"
|
||||
messages="Messages"
|
||||
adminarea="Administrator area"
|
||||
logout="Log out"
|
||||
name="Name"
|
||||
files="Your files"
|
||||
extension="Extension"
|
||||
operations="Operations"
|
||||
reference="Reference"
|
||||
copytoclip="Copy to clipboard"
|
||||
delete="Delete"
|
||||
quota="Quota"
|
||||
size="Size"
|
||||
upload="Upload"
|
||||
clear="Clear"
|
||||
sure="Are you sure?"
|
||||
owner="Owner"
|
||||
date="Date"
|
||||
published="Published"
|
||||
tags="Tags"
|
||||
tyes="Yes"
|
||||
tno="No"
|
||||
edit="Edit"
|
||||
editor="Editor"
|
||||
title="Title"
|
||||
save="Save"
|
||||
discard="Discard"
|
||||
autosave="Auto save"
|
||||
last_saved="Last saved"
|
||||
new="New"
|
||||
subject="Subject"
|
||||
eng="English"
|
||||
hun="Hungarian"
|
||||
rou="Romanian"
|
||||
id="ID"
|
||||
accesslevel="Access level"
|
||||
email="Email address"
|
||||
encrypted="Encrypted"
|
||||
ch_passwd="Change password"
|
||||
ch_accesslevel="Change access level"
|
||||
new_user="New user"
|
||||
password_confirm="Confirm password"
|
||||
cancel="Cancel"
|
||||
enter_password="Please enter the new password!"
|
||||
enter_accesslevel="Pleade enter the new accesslevel"
|
||||
fullname="Full name"
|
||||
emailspoiler="This address is only used to recover your account. It is not needed to set it, you can leave it empty."
|
||||
status="Status"
|
||||
set="Already set"
|
||||
not_set="Not set"
|
||||
profile_shipping_address_spoiler="If your shipping address is already set, we can't show it to you, because they are asymmetrically encrypted and the private key is stored off-site for maximum safety. If you want to update it, please set it below, all the previous entries will be deleted."
|
||||
shipping_address_spoiler="The shipping addresses are stored safely encrypted with a 4096 bit asymetric RSA key. It can only be viewed when the coresponding private key is supplied. This key is stored off-site divided into multiple parts, owned by the administrators of this page. The parts are only paired when shipping your order. After your command is finalized all the shipping data will be removed from our database if you specifically doesn't save it for further use (by registering an account). The encryption keypair is changed periodically and the encryption/decryption is done on the client side, so maximum confidence can be assured."
|
||||
shipping_name="Shipping and facturing name"
|
||||
shipping_country="Country"
|
||||
shipping_region="State/Province/Region"
|
||||
shipping_city="City"
|
||||
shipping_address_line1="Address line 1"
|
||||
shipping_address_line2="Address line 2"
|
||||
shipping_zip="Zip/Postal code"
|
||||
shipping_email="Contact email"
|
||||
shipping_phone="Phone number (with prefix)"
|
||||
shipping_phone_example="ex: +40770000000"
|
||||
shipping_address="Shipping address"
|
||||
encrypting="Encryption"
|
||||
confirm_delete_shipping="Are you sure you wan't to remove your shipping address? This will affect all your current orders which aren't in the shipped state yet."
|
||||
delete_profile="Delete profile"
|
||||
sure_2="Absolutely sure?"
|
||||
sure_3="Totally?"
|
||||
delete_profile_spoiler="If you delete your profile it will be unrecoverable. All the data which is related with your profile (this includes: username, your full name, email address, shipping address, all your files and your login history), but the orders you placed, your reviews and the messages you left won't be deleted, because they arn't linked to your account. But don't panic, they are completely anonym. The invoices however will be kept for legal reasons."
|
||||
get_all_profile_data="Get all my data!"
|
||||
get_all_profile_data_spoiler="We offer you to download all the data which is stored in our database and can be linked to your profile (username, full name, email address, shipping address, login history and you previous data requests). All the data will be sent to you in email, so it is required to set a contact email address (you can delete it afterwards). If you want to receive your data encrypted, you can set a public PGP key, but it's not required. These requests are processed manually, so please be patient. It may take up to 2 weeks (but it's usually done in 3-5 days)."
|
||||
pgp_public="Public PGP key"
|
||||
date="Date"
|
||||
finished="Finished"
|
||||
userlist="User list"
|
||||
requestlist="Request list"
|
||||
ch_quota="Change quota"
|
||||
enter_quota="Pleade enter the new quota"
|
||||
unlimited="Unlimited"
|
||||
finish="Finalize!"
|
||||
send_message="Send message"
|
||||
message="Message"
|
||||
|
||||
;Errors
|
||||
error[1]="Wrong username or password!"
|
||||
error[2]="Please fill in the reCaptcha!"
|
||||
error[3]="Due to many failed login attempts, your IP address have been blocked for 10 minutes!"
|
||||
error[4]="Your quota has been reached!"
|
||||
error[5]="Your file is bigger than 500MB. Unfortunately we can't handle it."
|
||||
error[6]="Something went wrong. Please try again later!"
|
||||
error[7]="Nothing found with this ID."
|
||||
error[8]="Passwords doesn't match."
|
||||
error[9]="Username already taken."
|
||||
error[10]="Something went wrong while we were deleting your profile. This probably lead to data corruption. Please contact us!"
|
||||
error[11]="You already have a pending request. Please be patient!"
|
||||
error[12]="The supplied PGP public key is not valid!"
|
||||
error[404]="Page not found."
|
||||
error[500]="You have no permission to access that page!"
|
||||
|
||||
;Messages
|
||||
message[1]="Your login credintials have been removed from this computer successfully."
|
||||
message[2]="You have been logged out successfully."
|
||||
message[3]="File deleted successfully."
|
||||
message[4]="Edit submitted successfully."
|
||||
message[5]="Entry deleted successfully."
|
||||
message[6]="User successfully created."
|
||||
message[7]="Profile successfully edited."
|
||||
message[8]="Password successfully updated."
|
||||
message[9]="Shipping information successfully updated."
|
||||
message[10]="Shipping information successfully added."
|
||||
message[11]="Shipping information successfully deleted."
|
||||
message[12]="Your profile has been deleted successfully. You won't be able to log in anymore. This process is irreversible."
|
||||
message[13]="Request submitted successfully. Please be patient!"
|
||||
message[14]="That's done, bro!"
|
333
config/lib/PasswordStorage.php
Normal file
@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
class InvalidHashException extends Exception {}
|
||||
class CannotPerformOperationException extends Exception {}
|
||||
|
||||
class PasswordStorage
|
||||
{
|
||||
// These constants may be changed without breaking existing hashes.
|
||||
const PBKDF2_HASH_ALGORITHM = "sha1";
|
||||
const PBKDF2_ITERATIONS = 64000;
|
||||
const PBKDF2_SALT_BYTES = 24;
|
||||
const PBKDF2_OUTPUT_BYTES = 18;
|
||||
|
||||
// These constants define the encoding and may not be changed.
|
||||
const HASH_SECTIONS = 5;
|
||||
const HASH_ALGORITHM_INDEX = 0;
|
||||
const HASH_ITERATION_INDEX = 1;
|
||||
const HASH_SIZE_INDEX = 2;
|
||||
const HASH_SALT_INDEX = 3;
|
||||
const HASH_PBKDF2_INDEX = 4;
|
||||
|
||||
/**
|
||||
* Hash a password with PBKDF2
|
||||
*
|
||||
* @param string $password
|
||||
* @return string
|
||||
*/
|
||||
public static function create_hash($password)
|
||||
{
|
||||
// format: algorithm:iterations:outputSize:salt:pbkdf2output
|
||||
if (!\is_string($password)) {
|
||||
throw new InvalidArgumentException(
|
||||
"create_hash(): Expected a string"
|
||||
);
|
||||
}
|
||||
if (\function_exists('random_bytes')) {
|
||||
try {
|
||||
$salt_raw = \random_bytes(self::PBKDF2_SALT_BYTES);
|
||||
} catch (Error $e) {
|
||||
$salt_raw = false;
|
||||
} catch (Exception $e) {
|
||||
$salt_raw = false;
|
||||
} catch (TypeError $e) {
|
||||
$salt_raw = false;
|
||||
}
|
||||
} else {
|
||||
$salt_raw = \mcrypt_create_iv(self::PBKDF2_SALT_BYTES, MCRYPT_DEV_URANDOM);
|
||||
}
|
||||
if ($salt_raw === false) {
|
||||
throw new CannotPerformOperationException(
|
||||
"Random number generator failed. Not safe to proceed."
|
||||
);
|
||||
}
|
||||
|
||||
$PBKDF2_Output = self::pbkdf2(
|
||||
self::PBKDF2_HASH_ALGORITHM,
|
||||
$password,
|
||||
$salt_raw,
|
||||
self::PBKDF2_ITERATIONS,
|
||||
self::PBKDF2_OUTPUT_BYTES,
|
||||
true
|
||||
);
|
||||
|
||||
return self::PBKDF2_HASH_ALGORITHM .
|
||||
":" .
|
||||
self::PBKDF2_ITERATIONS .
|
||||
":" .
|
||||
self::PBKDF2_OUTPUT_BYTES .
|
||||
":" .
|
||||
\base64_encode($salt_raw) .
|
||||
":" .
|
||||
\base64_encode($PBKDF2_Output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that a password matches the stored hash
|
||||
*
|
||||
* @param string $password
|
||||
* @param string $hash
|
||||
* @return bool
|
||||
*/
|
||||
public static function verify_password($password, $hash)
|
||||
{
|
||||
if (!\is_string($password) || !\is_string($hash)) {
|
||||
throw new InvalidArgumentException(
|
||||
"verify_password(): Expected two strings"
|
||||
);
|
||||
}
|
||||
$params = \explode(":", $hash);
|
||||
if (\count($params) !== self::HASH_SECTIONS) {
|
||||
throw new InvalidHashException(
|
||||
"Fields are missing from the password hash."
|
||||
);
|
||||
}
|
||||
|
||||
$pbkdf2 = \base64_decode($params[self::HASH_PBKDF2_INDEX], true);
|
||||
if ($pbkdf2 === false) {
|
||||
throw new InvalidHashException(
|
||||
"Base64 decoding of pbkdf2 output failed."
|
||||
);
|
||||
}
|
||||
|
||||
$salt_raw = \base64_decode($params[self::HASH_SALT_INDEX], true);
|
||||
if ($salt_raw === false) {
|
||||
throw new InvalidHashException(
|
||||
"Base64 decoding of salt failed."
|
||||
);
|
||||
}
|
||||
|
||||
$storedOutputSize = (int) $params[self::HASH_SIZE_INDEX];
|
||||
if (self::ourStrlen($pbkdf2) !== $storedOutputSize) {
|
||||
throw new InvalidHashException(
|
||||
"PBKDF2 output length doesn't match stored output length."
|
||||
);
|
||||
}
|
||||
|
||||
$iterations = (int) $params[self::HASH_ITERATION_INDEX];
|
||||
if ($iterations < 1) {
|
||||
throw new InvalidHashException(
|
||||
"Invalid number of iterations. Must be >= 1."
|
||||
);
|
||||
}
|
||||
|
||||
return self::slow_equals(
|
||||
$pbkdf2,
|
||||
self::pbkdf2(
|
||||
$params[self::HASH_ALGORITHM_INDEX],
|
||||
$password,
|
||||
$salt_raw,
|
||||
$iterations,
|
||||
self::ourStrlen($pbkdf2),
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two strings $a and $b in length-constant time.
|
||||
*
|
||||
* @param string $a
|
||||
* @param string $b
|
||||
* @return bool
|
||||
*/
|
||||
public static function slow_equals($a, $b)
|
||||
{
|
||||
if (!\is_string($a) || !\is_string($b)) {
|
||||
throw new InvalidArgumentException(
|
||||
"slow_equals(): expected two strings"
|
||||
);
|
||||
}
|
||||
if (\function_exists('hash_equals')) {
|
||||
return \hash_equals($a, $b);
|
||||
}
|
||||
|
||||
// PHP < 5.6 polyfill:
|
||||
$diff = self::ourStrlen($a) ^ self::ourStrlen($b);
|
||||
for($i = 0; $i < self::ourStrlen($a) && $i < self::ourStrlen($b); $i++) {
|
||||
$diff |= \ord($a[$i]) ^ \ord($b[$i]);
|
||||
}
|
||||
return $diff === 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* PBKDF2 key derivation function as defined by RSA's PKCS #5: https://www.ietf.org/rfc/rfc2898.txt
|
||||
* $algorithm - The hash algorithm to use. Recommended: SHA256
|
||||
* $password - The password.
|
||||
* $salt - A salt that is unique to the password.
|
||||
* $count - Iteration count. Higher is better, but slower. Recommended: At least 1000.
|
||||
* $key_length - The length of the derived key in bytes.
|
||||
* $raw_output - If true, the key is returned in raw binary format. Hex encoded otherwise.
|
||||
* Returns: A $key_length-byte key derived from the password and salt.
|
||||
*
|
||||
* Test vectors can be found here: https://www.ietf.org/rfc/rfc6070.txt
|
||||
*
|
||||
* This implementation of PBKDF2 was originally created by https://defuse.ca
|
||||
* With improvements by http://www.variations-of-shadow.com
|
||||
*/
|
||||
public static function pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output = false)
|
||||
{
|
||||
// Type checks:
|
||||
if (!\is_string($algorithm)) {
|
||||
throw new InvalidArgumentException(
|
||||
"pbkdf2(): algorithm must be a string"
|
||||
);
|
||||
}
|
||||
if (!\is_string($password)) {
|
||||
throw new InvalidArgumentException(
|
||||
"pbkdf2(): password must be a string"
|
||||
);
|
||||
}
|
||||
if (!\is_string($salt)) {
|
||||
throw new InvalidArgumentException(
|
||||
"pbkdf2(): salt must be a string"
|
||||
);
|
||||
}
|
||||
// Coerce strings to integers with no information loss or overflow
|
||||
$count += 0;
|
||||
$key_length += 0;
|
||||
|
||||
$algorithm = \strtolower($algorithm);
|
||||
if (!\in_array($algorithm, \hash_algos(), true)) {
|
||||
throw new CannotPerformOperationException(
|
||||
"Invalid or unsupported hash algorithm."
|
||||
);
|
||||
}
|
||||
|
||||
// Whitelist, or we could end up with people using CRC32.
|
||||
$ok_algorithms = array(
|
||||
"sha1", "sha224", "sha256", "sha384", "sha512",
|
||||
"ripemd160", "ripemd256", "ripemd320", "whirlpool"
|
||||
);
|
||||
if (!\in_array($algorithm, $ok_algorithms, true)) {
|
||||
throw new CannotPerformOperationException(
|
||||
"Algorithm is not a secure cryptographic hash function."
|
||||
);
|
||||
}
|
||||
|
||||
if ($count <= 0 || $key_length <= 0) {
|
||||
throw new CannotPerformOperationException(
|
||||
"Invalid PBKDF2 parameters."
|
||||
);
|
||||
}
|
||||
|
||||
if (\function_exists("hash_pbkdf2")) {
|
||||
// The output length is in NIBBLES (4-bits) if $raw_output is false!
|
||||
if (!$raw_output) {
|
||||
$key_length = $key_length * 2;
|
||||
}
|
||||
return \hash_pbkdf2($algorithm, $password, $salt, $count, $key_length, $raw_output);
|
||||
}
|
||||
|
||||
$hash_length = self::ourStrlen(\hash($algorithm, "", true));
|
||||
$block_count = \ceil($key_length / $hash_length);
|
||||
|
||||
$output = "";
|
||||
for($i = 1; $i <= $block_count; $i++) {
|
||||
// $i encoded as 4 bytes, big endian.
|
||||
$last = $salt . \pack("N", $i);
|
||||
// first iteration
|
||||
$last = $xorsum = \hash_hmac($algorithm, $last, $password, true);
|
||||
// perform the other $count - 1 iterations
|
||||
for ($j = 1; $j < $count; $j++) {
|
||||
$xorsum ^= ($last = \hash_hmac($algorithm, $last, $password, true));
|
||||
}
|
||||
$output .= $xorsum;
|
||||
}
|
||||
|
||||
if($raw_output) {
|
||||
return self::ourSubstr($output, 0, $key_length);
|
||||
} else {
|
||||
return \bin2hex(self::ourSubstr($output, 0, $key_length));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We need these strlen() and substr() functions because when
|
||||
* 'mbstring.func_overload' is set in php.ini, the standard strlen() and
|
||||
* substr() are replaced by mb_strlen() and mb_substr().
|
||||
*/
|
||||
|
||||
/**
|
||||
* Calculate the length of a string
|
||||
*
|
||||
* @param string $str
|
||||
* @return int
|
||||
*/
|
||||
private static function ourStrlen($str)
|
||||
{
|
||||
static $exists = null;
|
||||
if ($exists === null) {
|
||||
$exists = \function_exists('mb_strlen');
|
||||
}
|
||||
|
||||
if (!\is_string($str)) {
|
||||
throw new InvalidArgumentException(
|
||||
"ourStrlen() expects a string"
|
||||
);
|
||||
}
|
||||
|
||||
if ($exists) {
|
||||
$length = \mb_strlen($str, '8bit');
|
||||
if ($length === false) {
|
||||
throw new CannotPerformOperationException();
|
||||
}
|
||||
return $length;
|
||||
} else {
|
||||
return \strlen($str);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Substring
|
||||
*
|
||||
* @param string $str
|
||||
* @param int $start
|
||||
* @param int $length
|
||||
* @return string
|
||||
*/
|
||||
private static function ourSubstr($str, $start, $length = null)
|
||||
{
|
||||
static $exists = null;
|
||||
if ($exists === null) {
|
||||
$exists = \function_exists('mb_substr');
|
||||
}
|
||||
// Type validation:
|
||||
if (!\is_string($str)) {
|
||||
throw new InvalidArgumentException(
|
||||
"ourSubstr() expects a string"
|
||||
);
|
||||
}
|
||||
|
||||
if ($exists) {
|
||||
// mb_substr($str, 0, NULL, '8bit') returns an empty string on PHP
|
||||
// 5.3, so we have to find the length ourselves.
|
||||
if (!isset($length)) {
|
||||
if ($start >= 0) {
|
||||
$length = self::ourStrlen($str) - $start;
|
||||
} else {
|
||||
$length = -$start;
|
||||
}
|
||||
}
|
||||
|
||||
return \mb_substr($str, $start, $length, '8bit');
|
||||
}
|
||||
|
||||
// Unlike mb_substr(), substr() doesn't accept NULL for length
|
||||
if (isset($length)) {
|
||||
return \substr($str, $start, $length);
|
||||
} else {
|
||||
return \substr($str, $start);
|
||||
}
|
||||
}
|
||||
}
|
274
config/lib/functions.php
Normal file
@ -0,0 +1,274 @@
|
||||
<?php
|
||||
/**
|
||||
* functions.php
|
||||
* @version 2.4
|
||||
* @desc General issued php function library for me
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
class functions{
|
||||
const STR_SAME=0;
|
||||
const STR_LOWERCASE=1;
|
||||
const STR_RACCENT=2;
|
||||
const STR_RACCLOW=3;
|
||||
const RAND_SMALL=0;
|
||||
const RAND_LARGE=1;
|
||||
const RAND_SPEC=2;
|
||||
const COOKIE_LIFETIME=3;
|
||||
|
||||
public static function setError($code){
|
||||
global $errcode;
|
||||
if(isset($errcode)){
|
||||
array_push($errcode, $code);
|
||||
}
|
||||
else{
|
||||
$errcode=array($code);
|
||||
}
|
||||
setcookie("errcode", serialize($errcode), time()+functions::COOKIE_LIFETIME);
|
||||
}
|
||||
|
||||
public static function isError(){
|
||||
global $errcode;
|
||||
if(isset($errcode) || isset($_COOKIE['errcode'])){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getErrorArray(){
|
||||
global $errcode;
|
||||
if(functions::isError()){
|
||||
if(isset($errcode)){
|
||||
return $errcode;
|
||||
}
|
||||
if(isset($_COOKIE['errcode'])){
|
||||
return unserialize($_COOKIE['errcode']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function setMessage($code){
|
||||
global $msgcode;
|
||||
if(isset($msgcode)){
|
||||
array_push($msgcode, $code);
|
||||
}
|
||||
else{
|
||||
$msgcode=array($code);
|
||||
}
|
||||
setcookie("msgcode", serialize($msgcode), time()+functions::COOKIE_LIFETIME);
|
||||
}
|
||||
|
||||
public static function isMessage(){
|
||||
global $msgcode;
|
||||
if(isset($msgcode) || isset($_COOKIE['msgcode'])){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getMessageArray(){
|
||||
global $msgcode;
|
||||
if(functions::isMessage()){
|
||||
if(isset($msgcode)){
|
||||
return $msgcode;
|
||||
}
|
||||
if(isset($_COOKIE['msgcode'])){
|
||||
return unserialize($_COOKIE['msgcode']);
|
||||
}
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static function clearError(){
|
||||
global $errcode;
|
||||
if(isset($errcode)){
|
||||
unset($errcode);
|
||||
}
|
||||
setcookie("errcode", null, -1);
|
||||
}
|
||||
|
||||
public static function clearMessage(){
|
||||
global $msgcode;
|
||||
if(isset($msgcode)){
|
||||
unset($msgcode);
|
||||
}
|
||||
setcookie("msgcode", null, -1);
|
||||
}
|
||||
|
||||
public static function safeReload(){
|
||||
header("Location: ".explode("?", $_SERVER['REQUEST_URI'])[0]);
|
||||
}
|
||||
|
||||
public static function randomString($length, $char=functions::RAND_SMALL){
|
||||
if($char==0){
|
||||
$charset="0123456789abcdefghijklmnopqrstuvwxyz";
|
||||
}
|
||||
else if($char==1){
|
||||
$charset="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
}
|
||||
else if($char==2){
|
||||
$charset="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_-=+\?/.>,<";
|
||||
}
|
||||
$charsetlength=strlen($charset);
|
||||
$string="";
|
||||
for($i=0; $i<$length; $i++){
|
||||
$string=$string . $charset[rand(0, $charsetlength-1)];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function get_string_between($string, $start, $end){
|
||||
$string=' ' . $string;
|
||||
$ini=strpos($string, $start);
|
||||
if($ini==0) return '';
|
||||
$ini+=strlen($start);
|
||||
$len=strpos($string, $end, $ini) - $ini;
|
||||
return substr($string, $ini, $len);
|
||||
}
|
||||
|
||||
public static function process_string($str, $dep){
|
||||
global $functions_accent_convert;
|
||||
switch($dep){
|
||||
case 0:
|
||||
{
|
||||
return $str;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
return strtolower($str);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
return strtr($str, $functions_accent_convert);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
return strtolower(strtr($str, $functions_accent_convert));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function validate_captcha($secretkey, $response){
|
||||
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretkey."&response=".$response);
|
||||
$data=json_decode($verify);
|
||||
if($data->success){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$functions_accent_convert=array(
|
||||
// Decompositions for Latin-1 Supplement
|
||||
chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
|
||||
chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
|
||||
chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
|
||||
chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
|
||||
chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
|
||||
chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
|
||||
chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
|
||||
chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
|
||||
chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
|
||||
chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
|
||||
chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
|
||||
chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
|
||||
chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
|
||||
chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
|
||||
chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
|
||||
chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
|
||||
chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
|
||||
chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
|
||||
chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
|
||||
chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
|
||||
chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
|
||||
chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
|
||||
chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
|
||||
chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
|
||||
chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
|
||||
chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
|
||||
chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
|
||||
chr(195).chr(191) => 'y',
|
||||
// Decompositions for Latin Extended-A
|
||||
chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
|
||||
chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
|
||||
chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
|
||||
chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
|
||||
chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
|
||||
chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
|
||||
chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
|
||||
chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
|
||||
chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
|
||||
chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
|
||||
chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
|
||||
chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
|
||||
chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
|
||||
chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
|
||||
chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
|
||||
chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
|
||||
chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
|
||||
chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
|
||||
chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
|
||||
chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
|
||||
chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
|
||||
chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
|
||||
chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
|
||||
chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
|
||||
chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
|
||||
chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
|
||||
chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
|
||||
chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
|
||||
chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
|
||||
chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
|
||||
chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
|
||||
chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
|
||||
chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
|
||||
chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
|
||||
chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
|
||||
chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
|
||||
chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
|
||||
chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
|
||||
chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
|
||||
chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
|
||||
chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
|
||||
chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
|
||||
chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
|
||||
chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
|
||||
chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
|
||||
chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
|
||||
chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
|
||||
chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
|
||||
chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
|
||||
chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
|
||||
chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
|
||||
chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
|
||||
chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
|
||||
chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
|
||||
chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
|
||||
chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
|
||||
chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
|
||||
chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
|
||||
chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
|
||||
chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
|
||||
chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
|
||||
chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
|
||||
chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
|
||||
chr(197).chr(190) => 'z', chr(197).chr(191) => 's');
|
||||
|
||||
?>
|
82
config/lib/loginManager/lmConfig.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/lmConfig.php
|
||||
* @version 1.3
|
||||
* @desc config class
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
class lmConfig{
|
||||
public function __construct($_pdo, $_session_lifetime, $_captcha_enable, $_captcha_after, $_captcha_sitekey, $_captcha_secretkey, $_ban_enable, $_ban_after, $_ban_time, $_look, $_remember_enable, $_remember_time, $_auth_type){
|
||||
$this->pdo=$_pdo;
|
||||
$this->session_lifetime=$_session_lifetime;
|
||||
$this->captcha_enable=$_captcha_enable;
|
||||
$this->captcha_after=$_captcha_after;
|
||||
$this->captcha_sitekey=$_captcha_sitekey;
|
||||
$this->captcha_secretkey=$_captcha_secretkey;
|
||||
$this->ban_enable=$_ban_enable;
|
||||
$this->ban_after=$_ban_after;
|
||||
$this->ban_time=$_ban_time;
|
||||
$this->look=$_look;
|
||||
$this->remember_enable=$_remember_enable;
|
||||
$this->remember_time=$_remember_time;
|
||||
$this->auth_type=$_auth_type;
|
||||
}
|
||||
|
||||
private $pdo;
|
||||
private $session_lifetime;
|
||||
private $captcha_enable;
|
||||
private $captcha_after;
|
||||
private $captcha_sitekey;
|
||||
private $captcha_secretkey;
|
||||
private $ban_enable;
|
||||
private $ban_after;
|
||||
private $ban_time;
|
||||
private $look;
|
||||
private $remember_enable; //NOT SAFE AT ALL!!!
|
||||
private $remember_time;
|
||||
private $auth_type;
|
||||
|
||||
public function getPDO(){
|
||||
return $this->pdo;
|
||||
}
|
||||
public function getSessionLifetime(){
|
||||
return $this->session_lifetime;
|
||||
}
|
||||
public function isCaptchaEnabled(){
|
||||
return $this->captcha_enable;
|
||||
}
|
||||
public function getCaptchaAfter(){
|
||||
return $this->captcha_after;
|
||||
}
|
||||
public function getCaptchaSitekey(){
|
||||
return $this->captcha_sitekey;
|
||||
}
|
||||
public function getCaptchaSecretkey(){
|
||||
return $this->captcha_secretkey;
|
||||
}
|
||||
public function isBanEnabled(){
|
||||
return $this->ban_enable;
|
||||
}
|
||||
public function getBanAfter(){
|
||||
return $this->ban_after;
|
||||
}
|
||||
public function getBanTime(){
|
||||
return $this->ban_time;
|
||||
}
|
||||
public function getLook(){
|
||||
return $this->look;
|
||||
}
|
||||
public function isRememberEnabled(){
|
||||
return $this->remember_enable;
|
||||
}
|
||||
public function getRememberTime(){
|
||||
return $this->remember_time;
|
||||
}
|
||||
public function getAuthType(){
|
||||
return $this->auth_type;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
14
config/lib/loginManager/lmHandler.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/lmHandler.php
|
||||
* @version 1.1
|
||||
* @desc Event handler for login manager
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
interface lmHandler{
|
||||
public function handle($state, $target=0);
|
||||
}
|
||||
|
||||
?>
|
14
config/lib/loginManager/lmPassword.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/lmPassword.php
|
||||
* @version 1.0
|
||||
* @desc interface for function verifying password
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
interface lmPassword{
|
||||
public function verifyPassword($cleartext, $database);
|
||||
}
|
||||
|
||||
?>
|
24
config/lib/loginManager/lmStates.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/lmStates.php
|
||||
* @version 1.2
|
||||
* @desc States of login manager
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
class lmStates{
|
||||
const LOGIN_FAILED=0;
|
||||
const LOGIN_OK=1;
|
||||
const CAPTCHA_FAILED=2;
|
||||
const BANNED=3;
|
||||
const FORGET_DONE=4;
|
||||
const LOGOUT_DONE=5;
|
||||
|
||||
const AUTH_ID=10;
|
||||
const AUTH_UNAME=11;
|
||||
|
||||
const NOUSER=1;
|
||||
}
|
||||
|
||||
?>
|
14
config/lib/loginManager/lmTwoFactor.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/lmTwoFactor.php
|
||||
* @version 1.0
|
||||
* @desc second factor auth to LM
|
||||
* @author Fándly Gergő Zoltán 2017
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
interface lmTwoFactor{
|
||||
public function secondFactor($uid);
|
||||
}
|
||||
|
||||
?>
|
44
config/lib/loginManager/lmUtils.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/lmUtils.php
|
||||
* @desc utilities for correct functioning
|
||||
* @version 1.0
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
class lmUtils{
|
||||
/**
|
||||
* generate a random string with special character
|
||||
* @param int $length length of the requested string
|
||||
* @return string
|
||||
*/
|
||||
public static function randomString($length){
|
||||
$charset="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~!@#$%^&*()_-=+\?/.>,<";
|
||||
$charsetLength=strlen($charset);
|
||||
$string="";
|
||||
for($i=0; $i<$length; $i++){
|
||||
$string.=$charset[rand(0, $charsetLength-1)];
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* validate google ReCaptcha
|
||||
* @param string $secretkey secret key to captcha API
|
||||
* @param string $response response of API
|
||||
* @return bool
|
||||
*/
|
||||
public static function validateCaptcha($secretkey, $response){
|
||||
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretkey."&response=".$response);
|
||||
$data=json_decode($verify);
|
||||
if($data->success){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
393
config/lib/loginManager/loginManager.php
Normal file
@ -0,0 +1,393 @@
|
||||
<?php
|
||||
/**
|
||||
* loginManager/loginManager.php
|
||||
* @version 1.1
|
||||
* @desc Easily manage authentication to your system
|
||||
* @author Fándly Gergő Zoltán
|
||||
* @copy 2017 Fándly Gergő Zoltán
|
||||
*/
|
||||
|
||||
/**
|
||||
* NEEDED Database structure:
|
||||
*
|
||||
<?sql
|
||||
CREATE TABLE `users`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`username` varchar(65) NOT NULL default '', /* optional
|
||||
`password` varchar(255) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `login_history`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`user` int(4) UNSIGNED NOT NULL default 1, /* id of nouser
|
||||
`date` timestamp NOT NULL default current_timestamp,
|
||||
`ip` varchar(45) NOT NULL default '0.0.0.0',
|
||||
`auth_token` varchar(65) NOT NULL default '',
|
||||
`user_agent` varchar(500) NOT NULL default '',
|
||||
`success` tinyint(1) NOT NULL default 0,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `login_remember`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`user` int(4) UNSIGNED NOT NULL default 0,
|
||||
`remember_token` varchar(65) NOT NULL default '',
|
||||
`until` timestamp NOT NULL default current_timestamp,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`user`) REFERENCES users(`id`) ON DELETE CASCADE
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
CREATE TABLE `login_bans`(
|
||||
`id` int(4) UNSIGNED NOT NULL auto_increment,
|
||||
`ip` varchar(45) NOT NULL default '0.0.0.0',
|
||||
`until` timestamp NOT NULL default current_timestamp,
|
||||
PRIMARY KEY (`id`)
|
||||
) CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||
|
||||
INSERT INTO users (`id`, `username`) VALUES (1, 'nouser');
|
||||
?>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Includes
|
||||
*/
|
||||
require("lmStates.php");
|
||||
require("lmConfig.php");
|
||||
require("lmHandler.php");
|
||||
require("lmPassword.php");
|
||||
require("lmTwoFactor.php");
|
||||
require("lmUtils.php");
|
||||
|
||||
|
||||
/*
|
||||
* Class
|
||||
*/
|
||||
class loginManager{
|
||||
//constructor
|
||||
|
||||
/**
|
||||
* building...
|
||||
* @param lmConfig $_config configuration for login Manager
|
||||
* @param lmHandler $_eventHandler handler of events
|
||||
* @param lmPassword $_passwordEngine engine for verifying passwords
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($_config, $_eventHandler, $_passwordEngine, $_twoFactor){
|
||||
$this->config=$_config;
|
||||
$this->eventHandler=$_eventHandler;
|
||||
$this->passwordEngine=$_passwordEngine;
|
||||
$this->twoFactor=$_twoFactor;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//settings
|
||||
|
||||
private $config;
|
||||
private $eventHandler;
|
||||
private $passwordEngine;
|
||||
private $twoFactor;
|
||||
|
||||
|
||||
|
||||
//frontend functions
|
||||
|
||||
/**
|
||||
* initialize session and set its lifetime
|
||||
* @return bool
|
||||
*/
|
||||
public function init(){
|
||||
session_set_cookie_params($this->config->getSessionLifetime());
|
||||
return session_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* prepare for login. Run this on the top of your login page!
|
||||
* @return void
|
||||
*/
|
||||
public function loginPrepare(){
|
||||
$this->passFailedAttempts();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* lets start here!
|
||||
* @param int/string @identifier id or username of user
|
||||
* @param string @password cleartext password from input
|
||||
* @param bool $remember save user fot further use
|
||||
* @return void
|
||||
*/
|
||||
public function login($identifier, $password, $remember=false){
|
||||
global $lm_force_captcha;
|
||||
|
||||
if($this->passFailedAttempts()){ //not banned
|
||||
if(isset($lm_force_captcha)){ //check captcha
|
||||
if(!isset($_POST['g-recaptcha-response'])){
|
||||
$captcha_failed=true;
|
||||
$this->addLoginHistory(lmStates::NOUSER, lmStates::LOGIN_FAILED);
|
||||
$this->eventHandler->handle(lmStates::CAPTCHA_FAILED);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
if(!lmUtils::validateCaptcha($this->config->getCaptchaSecretkey(), $_POST['g-recaptcha-response'])){
|
||||
$captcha_failed=true;
|
||||
$this->addLoginHistory(lmStates::NOUSER, lmStates::LOGIN_FAILED);
|
||||
$this->eventHandler->handle(lmStates::CAPTCHA_FAILED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!isset($captcha_failed)){
|
||||
if($this->config->isRememberEnabled()){ //check if remembering is enabled
|
||||
if($this->isRememberingUser() && $this->twoFactor->secondFactor($this->isRememberingUser())){ //remembering.
|
||||
$this->permitLogin($this->isRememberingUser()); //good to go!
|
||||
return;
|
||||
}
|
||||
}
|
||||
//proceed with normal login
|
||||
if($this->config->getAuthType()==lmStates::AUTH_UNAME){ //username based authentication
|
||||
$sql=$this->config->getPDO()->prepare("SELECT COUNT(id) AS count, id, password FROM users WHERE username=:identifier and id<>1");
|
||||
}
|
||||
else{
|
||||
$sql=$this->config->getPDO()->prepare("SELECT COUNT(id) AS count, id, password FROM users WHERE id=:identifier and id<>1");
|
||||
}
|
||||
$sql->execute(array(":identifier"=>$identifier));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($res['count']==0){ //user not existing
|
||||
$this->addLoginHistory(lmStates::NOUSER, lmStates::LOGIN_FAILED);
|
||||
$this->eventHandler->handle(lmStates::LOGIN_FAILED);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
if($this->passwordEngine->verifyPassword($password, $res['password']) && $this->twoFactor->secondFactor($res['id'])){
|
||||
if($this->config->isRememberEnabled()){ //remember... if he wants to be insecure
|
||||
if($remember){
|
||||
$this->rememberUser($res['id']);
|
||||
}
|
||||
}
|
||||
$this->permitLogin($res['id']); //good to go!
|
||||
return;
|
||||
}
|
||||
else{
|
||||
$this->addLoginHistory($res['id'], lmStates::LOGIN_FAILED);
|
||||
$this->eventHandler->handle(lmStates::LOGIN_FAILED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* finish it up!
|
||||
* @return void
|
||||
*/
|
||||
public function logout(){
|
||||
$_SESSION=array();
|
||||
session_destroy();
|
||||
setcookie("lm_login_random", NULL, -1);
|
||||
$this->eventHandler->handle(lmStates::LOGOUT_DONE);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* just some formal checking
|
||||
* @return bool
|
||||
*/
|
||||
public function validateLogin(){
|
||||
if(!isset($_SESSION['lm_id'])){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
$sql=$this->config->getPDO()->prepare("SELECT auth_token FROM login_history WHERE user=:id and success=1 ORDER BY id DESC LIMIT 1");
|
||||
$sql->execute(array(":id"=>$_SESSION['lm_id']));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($res['auth_token']==$this->getSessionKey()){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* do i know you?
|
||||
* @return int
|
||||
*/
|
||||
public function isRememberingUser(){
|
||||
if(!$this->config->isRememberEnabled()){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(is_null($this->getRememberKey())){
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
$sql=$this->config->getPDO()->prepare("SELECT COUNT(id) AS count, user FROM login_remember WHERE remember_token=:token and until>:until");
|
||||
$sql->execute(array(":token"=>$this->getRememberKey(), ":until"=>date("Y-m-d H:i:s")));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($res['count']!=1){
|
||||
$this->addLoginHistory(lmStates::NOUSER, lmStates::LOGIN_FAILED);
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
return $res['user'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* i don't know you anymore!
|
||||
* @return void
|
||||
*/
|
||||
public function forgetUser(){
|
||||
$sql=$this->config->getPDO()->prepare("UPDATE login_remember SET until=0 WHERE remember_token=:token");
|
||||
$sql->execute(array(":token"=>$this->getRememberKey()));
|
||||
|
||||
setcookie("lm_login_remember", NULL, -1);
|
||||
|
||||
$this->eventHandler->handle(lmStates::FORGET_DONE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* print captcha html code if needed
|
||||
* @param bool $dark use the dark theme, default false
|
||||
* @return void
|
||||
*/
|
||||
public function printCaptcha($force=false, $dark=false){
|
||||
if($this->config->isCaptchaEnabled()){
|
||||
global $lm_force_captcha;
|
||||
if(isset($lm_force_captcha) || $force){
|
||||
if($dark){
|
||||
echo "<div class=\"g-recaptcha\" data-sitekey=\"".$this->config->getCaptchaSitekey()."\" data-theme=\"dark\"></div>";
|
||||
}
|
||||
else{
|
||||
echo "<div class=\"g-recaptcha\" data-sitekey=\"".$this->config->getCaptchaSitekey()."\"></div>";
|
||||
}
|
||||
return;
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//backend functions
|
||||
|
||||
protected function generateSessionKey(){
|
||||
$random=lmUtils::randomString(32);
|
||||
setcookie("lm_login_random", $random, time()+$this->config->getSessionLifetime());
|
||||
$hash=hash("sha256", $_SERVER['REMOTE_ADDR']."***".$_SERVER['HTTP_USER_AGENT']."***".$random);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
protected function getSessionKey(){
|
||||
if(!isset($_COOKIE['lm_login_random'])){
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
$hash=hash("sha256", $_SERVER['REMOTE_ADDR']."***".$_SERVER['HTTP_USER_AGENT']."***".$_COOKIE['lm_login_random']);
|
||||
return $hash;
|
||||
}
|
||||
}
|
||||
|
||||
protected function passFailedAttempts(){
|
||||
//check if no limitations are enabled
|
||||
if(!$this->config->isCaptchaEnabled() && !$this->config->isBanEnabled()){
|
||||
return true; //nothing to do
|
||||
}
|
||||
|
||||
//check if is already banned
|
||||
if($this->config->isBanEnabled()){
|
||||
$sql=$this->config->getPDO()->prepare("SELECT COUNT(id) AS count FROM login_bans WHERE ip=:ip and until>:until");
|
||||
$sql->execute(array(":ip"=>$_SERVER['REMOTE_ADDR'], ":until"=>date("Y-m-d H:i:s")));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($res['count']!=0){
|
||||
$this->eventHandler->handle(lmStates::BANNED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//count failed attempts
|
||||
$sql=$this->config->getPDO()->prepare("SELECT COUNT(id) AS count FROM login_history WHERE ip=:ip and date>:date and success=0");
|
||||
$sql->execute(array(":ip"=>$_SERVER['REMOTE_ADDR'], ":date"=>date("Y-m-d H:i:s", time()-$this->config->getLook())));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
//force captcha if case
|
||||
if($res['count']>=$this->config->getCaptchaAfter() && $this->config->isCaptchaEnabled()){
|
||||
global $lm_force_captcha;
|
||||
$lm_force_captcha=true;
|
||||
}
|
||||
|
||||
//bann if case
|
||||
if($res['count']>=$this->config->getBanAfter() && $this->config->isBanEnabled()){
|
||||
$sql=$this->config->getPDO()->prepare("INSERT INTO login_bans (ip, until) VALUES (:ip, :until)");
|
||||
$sql->execute(array(":ip"=>$_SERVER['REMOTE_ADDR'], ":until"=>date("Y-m-d H:i:s", time()+$this->config->getBanTime())));
|
||||
global $lm_banned;
|
||||
$lm_banned=true;
|
||||
$this->eventHandler->handle(lmStates::BANNED);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function addLoginHistory($uid, $success=lmStates::LOGIN_FAILED, $token=""){
|
||||
$sql=$this->config->getPDO()->prepare("INSERT INTO login_history (user, date, ip, auth_token, user_agent, success) VALUES (:user, :date, :ip, :auth_token, :user_agent, :success)");
|
||||
$sql->execute(array(":user"=>$uid, ":date"=>date("Y-m-d H:i:s"), ":ip"=>$_SERVER['REMOTE_ADDR'], ":auth_token"=>$token, ":user_agent"=>$_SERVER['HTTP_USER_AGENT'], ":success"=>$success));
|
||||
return;
|
||||
}
|
||||
|
||||
protected function permitLogin($uid){
|
||||
$token=$this->generateSessionKey();
|
||||
$this->addLoginHistory($uid, lmStates::LOGIN_OK, $token);
|
||||
|
||||
$_SESSION=array();
|
||||
$_SESSION['lm_id']=$uid;
|
||||
|
||||
$this->eventHandler->handle(lmStates::LOGIN_OK, $uid);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//functions for remembering
|
||||
protected function generateRememberKey(){
|
||||
$random=lmUtils::randomString(32);
|
||||
setcookie("lm_login_remember", $random, time()+(86000*$this->config->getRememberTime()));
|
||||
$hash=hash("sha256", $_SERVER['REMOTE_ADDR']."***".$_SERVER['HTTP_USER_AGENT']."***".$random);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
protected function getRememberKey(){
|
||||
if(!isset($_COOKIE['lm_login_remember'])){
|
||||
return NULL;
|
||||
}
|
||||
else{
|
||||
$hash=hash("sha256", $_SERVER['REMOTE_ADDR']."***".$_SERVER['HTTP_USER_AGENT']."***".$_COOKIE['lm_login_remember']);
|
||||
return $hash;
|
||||
}
|
||||
}
|
||||
|
||||
protected function rememberUser($uid){
|
||||
$sql=$this->config->getPDO()->prepare("INSERT INTO login_remember (user, remember_token, until) VALUES (:user, :token, :until)");
|
||||
$sql->execute(array(":user"=>$uid, ":token"=>$this->generateRememberKey(), ":until"=>date("Y-m-d H:i:s", time()+(86400*$this->config->getRememberTime()))));
|
||||
return;
|
||||
}
|
||||
}
|
14
config/pubkey.pub
Normal file
@ -0,0 +1,14 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAy84FIxzbceSdhxeSGCuh
|
||||
uWnJ9k9Y3GoiHNo7yUXHCWsoFQfqlptXyOzDJvzBetIwUZpyCYTltM6glc/303Z5
|
||||
QGbkJaPEocgE4XumJHlCDTnIa102uUM6+dGpOToQLjFhE/iylfSX4igJdko8v/uK
|
||||
vznq2nfV0PUI/dS7tcCscP2UX7r57lP2vTM/qtW+9IFS4TCVxyecm1hlyo2WFMfb
|
||||
7qmljqO6k7Mt66ImjcZLVOJXZJK8aZa4drOIykKGc2wimMjyyInVqb8lQZfrY9we
|
||||
Xma0+742Ybu05rnq+SpkTVQM8cAEmZ2xKK7Y7SKCkTms0/2pMCJHuMgc8A5zWZwl
|
||||
OFy6Abv+uHTpW36bfJae8zDic+0bLpcn3wpdVdIdqZXszCnBm6EaOFu81Yg2c++V
|
||||
oxccVouUxAiv0xNB22je8+QuofofYulxwKrJiAXg1xTmQShSrKHnDD+KXdomXx91
|
||||
auEnql8EmvUw/n8JzdyzCxaHOifdySac1N4oQorIGKelHb2MakLBeQms7/Aa0AGU
|
||||
LDpDZcClwPQtANJZv0pItefa0mNHFWsxvXNyV4pkq8yOOyeDGyrpAJBAOYblJa52
|
||||
izoJPfOvVdEbkgas9E8fOZ2/dI9gI0TzlmQtXdWW7sSkF8vmCQN/sruR10zTPQdP
|
||||
DP8Fo49h/OOJfYL/OhcEE5MCAwEAAQ==
|
||||
-----END PUBLIC KEY-----
|
134
index.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
/**
|
||||
* /index.php
|
||||
* @version 1.3
|
||||
* @desc Main index file
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
require("config/config.php");
|
||||
require("subs/loader.php");
|
||||
|
||||
$view="";
|
||||
if(isset($_GET['view'])){
|
||||
$view=$_GET['view'];
|
||||
if($view!="" && $view!="projects" && $view!="repos" && $view!="blog" && $view!="about" && $view!="userarea" && $view!="products" && $view!="contact"){
|
||||
$view="";
|
||||
}
|
||||
}
|
||||
$sub="";
|
||||
if(isset($_GET['sub'])){
|
||||
$sub=$_GET['sub'];
|
||||
}
|
||||
|
||||
loadPart($view, true);
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo (isset($titleExtend)?$titleExtend." :: ":"").($view==""?"":$lang[$view]." :: ").$lang['sitetitle'] ?></title>
|
||||
<meta charset="UTF-8">
|
||||
<!-- style -->
|
||||
<link rel="stylesheet" href="./style/main.css">
|
||||
<link rel="stylesheet" media="screen and (max-width: 1024px)" href="./style/mobile.css">
|
||||
<link rel="icon" href="./res/logo.png">
|
||||
<!-- jQuerry -->
|
||||
<script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<!-- cookie consent -->
|
||||
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css">
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
|
||||
<script>
|
||||
window.addEventListener("load", function(){
|
||||
window.cookieconsent.initialise({
|
||||
"palette": {
|
||||
"popup": {
|
||||
"background": "#000"
|
||||
},
|
||||
"button": {
|
||||
"background": "#f1d600"
|
||||
}
|
||||
},
|
||||
"content": {
|
||||
"message": "<?php echo $lang['cookie_message'] ?>",
|
||||
"dismiss": "<?php echo $lang['cookie_dismiss'] ?>",
|
||||
"link": "<?php echo $lang['cookie_link'] ?>"
|
||||
}
|
||||
})});
|
||||
</script>
|
||||
<!-- reCaptcha -->
|
||||
<script src="https://www.google.com/recaptcha/api.js"></script>
|
||||
<!-- Quill editor -->
|
||||
<script src="//cdn.quilljs.com/1.3.6/quill.min.js"></script>
|
||||
<link rel="stylesheet" href="//cdn.quilljs.com/1.3.6/quill.snow.css">
|
||||
<!-- other stuff -->
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.6/footable.min.js"></script>
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery-footable/3.1.6/footable.standalone.min.css">
|
||||
<!-- font awesome -->
|
||||
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.0.9/css/all.css">
|
||||
<!-- jsEncrypt -->
|
||||
<script src="./script/lib/jsencrypt.min.js"></script>
|
||||
<!-- main script -->
|
||||
<script src="./script/js.php?load=main"></script>
|
||||
<script src="./script/js.php?load=<?php echo $view ?>"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="messageOverlay" class="overlay messages" style="display: none" onclick="disposeMessageOverlay()"></div>
|
||||
<div id="header" class="header">
|
||||
<img class="title" src="./res/title.png" alt="title image">
|
||||
<div class="langselect">
|
||||
<a href="./?setlang=en_US"><img src="./res/lang/eng.png" alt="english"></a>
|
||||
<a href="./?setlang=hu_HU"><img src="./res/lang/hun.png" alt="magyar"></a>
|
||||
<a href="./?setlang=ro_RO"><img src="./res/lang/rou.png" alt="romana"></a>
|
||||
</div>
|
||||
<hr class="breakfloat">
|
||||
</div>
|
||||
<hr class="placeholder">
|
||||
<div id="contentHolder" class="content">
|
||||
<div id="menu">
|
||||
<ul class="menu">
|
||||
<a onclick="goTo('')"><li><?php echo $lang['index'] ?></li></a>
|
||||
<a onclick="goTo('projects')"><li><?php echo $lang['projects'] ?></li></a>
|
||||
<a onclick="goTo('repos')"><li><?php echo $lang['repos'] ?></li></a>
|
||||
<a onclick="goTo('blog')"><li><?php echo $lang['blog'] ?></li></a>
|
||||
<a onclick="goTo('about')"><li><?php echo $lang['about'] ?></li></a>
|
||||
<a onclick="goTo('userarea')"><li><?php echo $lang['userarea'] ?></li></a>
|
||||
<!--
|
||||
<a onclick="goTo('products')"><li><?php echo $lang['products'] ?></li></a>
|
||||
-->
|
||||
<a onclick="goTo('contact')"><li><?php echo $lang['contact'] ?></li></a>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content" class="inner">
|
||||
<!-- content goes here! -->
|
||||
<?php loadPart($view); ?>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="placeholder" style="height: 25em">
|
||||
<footer>
|
||||
<p>This site and server is owned and maintained by Fándly Gergő</p>
|
||||
<p>© Fándly Gergő <?php echo date("Y") ?></p>
|
||||
<p>Version <?php echo VERSION ?></p>
|
||||
<p>Contact:<br>contact@systemtest.tk</p>
|
||||
<a href="#header">TOP</a>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
621
license.txt
Normal file
@ -0,0 +1,621 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
BIN
res/!useless/gear.jpg
Normal file
After Width: | Height: | Size: 350 KiB |
BIN
res/!useless/gear.psd
Normal file
BIN
res/!useless/gear_light.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
res/!useless/logo.png
Normal file
After Width: | Height: | Size: 409 KiB |
BIN
res/!useless/logo.psd
Normal file
BIN
res/!useless/metal.jpg
Normal file
After Width: | Height: | Size: 2.4 MiB |
BIN
res/!useless/title.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
res/!useless/title.psd
Normal file
BIN
res/bg.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
BIN
res/lang/eng.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
res/lang/hun.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/lang/rou.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
res/logo.png
Normal file
After Width: | Height: | Size: 409 KiB |
BIN
res/news.png
Normal file
After Width: | Height: | Size: 9.0 KiB |
BIN
res/title.png
Normal file
After Width: | Height: | Size: 53 KiB |
5
robots.txt
Normal file
@ -0,0 +1,5 @@
|
||||
User-agent: *
|
||||
Disallow: /websvn
|
||||
Disallow: /phpmyadmin
|
||||
Disallow: /res
|
||||
Disallow: /uploads
|
48
script/.js
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* /script/.js
|
||||
* @version 1.2
|
||||
* @desc Script file for the index
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
var current=0;
|
||||
function loadNews(){
|
||||
$.ajax({
|
||||
url: "./subs/loader.php",
|
||||
type: "GET",
|
||||
data: {"load":"", "backend":true, "news_offset":current, "news_limit":15},
|
||||
success: function(response){
|
||||
var news=(response instanceof Object)?response:JSON.parse(response);
|
||||
$.each(news, function(i, val){
|
||||
var cur=(val instanceof Object)?val:JSON.parse(val);
|
||||
var el=$("<div class=\"news\"><\div>");
|
||||
el.html("<p><b>"+cur.subject+"</b></p><p style=\"font-size: 0.7em\">"+cur.date+"</p><hr class=\"separator\">");
|
||||
var container=$("<div class=\"ql-snow\"></div>");
|
||||
var quill=$("<div style=\"text-align: initial\" class=\"ql-editor\"></div>");
|
||||
loadQuill(quill, cur.content);
|
||||
quill.appendTo(container);
|
||||
container.appendTo(el);
|
||||
el.hide().appendTo("#news").slideDown();
|
||||
$("<br><br>").hide().appendTo("#news").slideDown();
|
||||
});
|
||||
}
|
||||
});
|
||||
current+=15;
|
||||
}
|
23
script/about.js
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* /script/about.js
|
||||
* @version 1.0
|
||||
* @desc Script file for the about tab
|
||||
* @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/>.
|
||||
**/
|
152
script/blog.js
Normal file
@ -0,0 +1,152 @@
|
||||
/**
|
||||
* /script/blog.js
|
||||
* @version 1.2
|
||||
* @desc Script file for the blog tab
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
function expandPost(caller){
|
||||
var el=$(caller).prev("div.fadeout");
|
||||
|
||||
//expand to full height
|
||||
var curHeight=$(el).height();
|
||||
var targetHeight=$(el).css("height", "auto").height();
|
||||
$(el).height(curHeight).animate({
|
||||
height: targetHeight
|
||||
});
|
||||
|
||||
//remove fadeout class
|
||||
$(el).removeClass("fadeout");
|
||||
|
||||
//no need for button now
|
||||
$(caller).slideUp(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
|
||||
var postOffset=0;
|
||||
function loadMorePosts(){
|
||||
$.ajax({
|
||||
url: "./subs/loader.php",
|
||||
data: {"load":"blog", "backend":true, "posts_offset":postOffset, "posts_limit":15},
|
||||
success: function(response){
|
||||
var posts=(response instanceof Object)?response:JSON.parse(response);
|
||||
$.each(posts, function(i, val){
|
||||
var post=(val instanceof Object)?val:JSON.parse(val);
|
||||
|
||||
var el=$("<div class=\"post\" style=\"width: 95%\"></div>");
|
||||
var cont="<a href=\"/blog/"+post.id+"\"><h2>"+post.title+"</h2></a>";
|
||||
cont+="<p style=\"text-align: right; font-size: 0.8em\">"+post.date+"<br>by: "+post.owner+"</p>";
|
||||
|
||||
cont+="<p>Tags: ";
|
||||
var tags=post.tags.split(";");
|
||||
$.each(tags, function(i, val){
|
||||
cont+="<a href=\"/blog/tag:"+val+"\" style=\"margin-right: 1em\">"+val+"</a>";
|
||||
});
|
||||
cont+="</p>";
|
||||
|
||||
cont+="<hr class=\"separator\">";
|
||||
|
||||
var fade=$("<div class=\"fadeout grey ql-snow\" style=\"height: 15em\"></div");
|
||||
var quill=$("<div style=\"text-align: initial; height: fit-content\" class=\"ql-editor\"></div>");
|
||||
loadQuill(quill, post.content);
|
||||
quill.appendTo(fade);
|
||||
|
||||
el.html(cont);
|
||||
fade.appendTo(el);
|
||||
|
||||
var button=$("<button type=\"button\" onclick=\"expandPost(this)\">"+$("#langReadMore").text()+"</button>");
|
||||
button.appendTo(el);
|
||||
|
||||
el.hide().appendTo("#posts").slideDown();
|
||||
$("<br><br>").hide().appendTo("#posts").slideDown();
|
||||
});
|
||||
}
|
||||
});
|
||||
postOffset+=15;
|
||||
}
|
||||
|
||||
var tagPostOffset=0;
|
||||
function loadTagPosts(tag){
|
||||
$.ajax({
|
||||
url: "./subs/loader.php",
|
||||
data: {"load":"blog", "backend":true, "posts_tag":tag, "posts_tag_offset":postOffset, "posts_tag_limit":15},
|
||||
success: function(response){
|
||||
var posts=(response instanceof Object)?response:JSON.parse(response);
|
||||
$.each(posts, function(i, val){
|
||||
var post=(val instanceof Object)?val:JSON.parse(val);
|
||||
|
||||
var el=$("<div class=\"post\" style=\"width: 95%\"></div>");
|
||||
var cont="<a href=\"/blog/"+post.id+"\"><h2>"+post.title+"</h2></a>";
|
||||
cont+="<p style=\"text-align: right; font-size: 0.8em\">"+post.date+"<br>by: "+post.owner+"</p>";
|
||||
|
||||
cont+="<hr class=\"separator\">";
|
||||
|
||||
var fade=$("<div class=\"fadeout grey ql-snow\" style=\"height: 15em\"></div");
|
||||
var quill=$("<div style=\"text-align: initial; height: fit-content\" class=\"ql-editor\"></div>");
|
||||
loadQuill(quill, post.content);
|
||||
quill.appendTo(fade);
|
||||
|
||||
el.html(cont);
|
||||
fade.appendTo(el);
|
||||
|
||||
var button=$("<button type=\"button\" onclick=\"expandPost(this)\">"+$("#langReadMore").text()+"</button>");
|
||||
button.appendTo(el);
|
||||
|
||||
el.hide().appendTo("#posts").slideDown();
|
||||
$("<br><br>").hide().appendTo("#posts").slideDown();
|
||||
});
|
||||
}
|
||||
});
|
||||
tagPostOffset+=15;
|
||||
}
|
||||
|
||||
function loadPost(id){
|
||||
$.ajax({
|
||||
url: "./subs/loader.php",
|
||||
data: {"load":"blog", "backend":true, "post":id},
|
||||
success: function(response){
|
||||
var post=(response instanceof Object)?response:JSON.parse(response);
|
||||
var el=$("<div></div>");
|
||||
var cont="<a href=\"/blog/"+post.id+"\"><h2>"+post.title+"</h2></a>";
|
||||
cont+="<p style=\"text-align: right; font-size: 0.8em\">"+post.date+"<br>by: "+post.owner+"</p>";
|
||||
|
||||
cont+="<p>Tags: ";
|
||||
var tags=post.tags.split(";");
|
||||
$.each(tags, function(i, val){
|
||||
cont+="<a href=\"/blog/tag:"+val+"\" style=\"margin-right: 1em\">"+val+"</a>";
|
||||
});
|
||||
cont+="</p>";
|
||||
|
||||
cont+="<hr class=\"separator\">";
|
||||
|
||||
var container=$("<div class=\"ql-snow\"></div");
|
||||
var quill=$("<div style=\"text-align: initial\" class=\"ql-editor\"></div>");
|
||||
loadQuill(quill, post.content);
|
||||
quill.appendTo(container);
|
||||
|
||||
el.html(cont);
|
||||
container.appendTo(el);
|
||||
|
||||
document.title=post.title+" :: "+document.title;
|
||||
el.hide().appendTo("#post").slideDown();
|
||||
}
|
||||
});
|
||||
}
|
23
script/contact.js
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* /script/contact.js
|
||||
* @version 1.0
|
||||
* @desc Script file for the contact tab
|
||||
* @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/>.
|
||||
**/
|
29
script/js.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* /script/js.php
|
||||
* @version 1.0
|
||||
* @desc Script for serving JS files
|
||||
* @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['load'])){
|
||||
header("Content-type: application/javascript");
|
||||
readfile($_GET['load'].".js", true);
|
||||
}
|
1
script/lib/jsencrypt.min.js
vendored
Normal file
132
script/main.js
Normal file
@ -0,0 +1,132 @@
|
||||
/**
|
||||
* /script/main.js
|
||||
* @version 1.1
|
||||
* @desc Main script file
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
function disposeMessageOverlay(){
|
||||
$("#messageOverlay").fadeOut(function(){
|
||||
$("#messageOverlay").html("");
|
||||
});
|
||||
}
|
||||
|
||||
function showMessage(html){
|
||||
$("#messageOverlay").html(html);
|
||||
$("#messageOverlay").fadeIn();
|
||||
setTimeout(function(){
|
||||
disposeMessageOverlay();
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
function loadMessage(){
|
||||
$.ajax({
|
||||
url: "./subs/msg.php",
|
||||
type: "GET",
|
||||
success: function(response){
|
||||
if(response!=""){
|
||||
showMessage(response);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function goTo(site, pop=false){
|
||||
$("#content").slideUp(function(){
|
||||
$.getScript("./script/js.php?load="+site, function(){
|
||||
$.ajax({
|
||||
url: "./subs/loader.php",
|
||||
type: "GET",
|
||||
data: {"load": site},
|
||||
success: function(response){
|
||||
$("#content").html(response);
|
||||
document.title=$("#content").children("#title").text();
|
||||
|
||||
if(!pop){
|
||||
window.history.pushState({"site": site}, null, "/"+site);
|
||||
}
|
||||
},
|
||||
complete: function(){
|
||||
$("#content").slideDown(function(){
|
||||
prepareSite();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function prepareSite(){
|
||||
//smooth scroll
|
||||
$('a[href^="#"]').on('click', function(event) {
|
||||
var target = $(this.getAttribute('href'));
|
||||
if( target.length ) {
|
||||
event.preventDefault();
|
||||
$('html, body').stop().animate({
|
||||
scrollTop: target.offset().top
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
|
||||
//disable ajax forms submit
|
||||
$(".ajaxform").submit(function(e){
|
||||
e.preventDefault(); //prevent classic submit
|
||||
});
|
||||
|
||||
//enable footable on certain tables
|
||||
$(".footable").footable();
|
||||
}
|
||||
|
||||
function toggleDropdown(content){
|
||||
if($(content).css("display")=="none"){
|
||||
$(content).slideDown();
|
||||
}
|
||||
else{
|
||||
$(content).slideUp();
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
window.addEventListener("popstate", function(e){
|
||||
if(e.state!=null){
|
||||
goTo(e.state["site"], true);
|
||||
}
|
||||
else{
|
||||
goTo("", true);
|
||||
}
|
||||
});
|
||||
prepareSite();
|
||||
loadMessage();
|
||||
});
|
||||
|
||||
//quill loading functions
|
||||
function loadQuill(object, delta){
|
||||
var tmp=$("<div></div>");
|
||||
(new Quill(tmp[0])).setContents(JSON.parse(delta));
|
||||
$(object).html(tmp.html());
|
||||
}
|
||||
|
||||
//add leading zeros
|
||||
function checkTime(t){
|
||||
if(t<10){
|
||||
t="0"+t;
|
||||
}
|
||||
return t;
|
||||
}
|
51
script/projects.js
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* /script/projects.js
|
||||
* @version 1.1
|
||||
* @desc Script file for the projects tab
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
function loadProjects(){
|
||||
$.ajax({
|
||||
url: "./subs/loader.php",
|
||||
type: "GET",
|
||||
data: {"load":"projects", "backend":true, "getprojects":true},
|
||||
success: function(response){
|
||||
var projects=(response instanceof Object)?response:JSON.parse(response);
|
||||
$.each(projects, function(i, val){
|
||||
var cur=(val instanceof Object)?val:JSON.parse(val);
|
||||
var el=$("<div class=\"tile\"></div>");
|
||||
var content="<h2>"+cur.name+"</h2><hr class=\"separator\">";
|
||||
|
||||
content+="<div class=\"imgholder\"><img src=\""+val.image+"\"></div>";
|
||||
content+="<div class=\"fadeout\" style=\"height: 10em\"><p>"+cur.description+"</p></div><br>";
|
||||
content+="<button type=\"button\" style=\"float: left\" onclick=\"window.location='"+cur.path+"'\">"+$("#langView").text()+"</button><button type=\"button\" style=\"float: right\" onclick=\"window.location='"+cur.repo+"'\">"+$("#langSource").text()+"</button>";
|
||||
content+="<p style=\"clear: both; font-size: 0.7em\">status: "+cur.status+", by: "+cur.owner+"</p>";
|
||||
el.html(content);
|
||||
el.hide().appendTo("#projects").slideDown();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* RUN
|
||||
*/
|
||||
loadProjects();
|
23
script/repos.js
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* /script/repos.js
|
||||
* @version 1.0
|
||||
* @desc Script file for the repos tab
|
||||
* @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/>.
|
||||
**/
|
724
script/userarea.js
Normal file
@ -0,0 +1,724 @@
|
||||
/**
|
||||
* /script/userarea.js
|
||||
* @version 1.7
|
||||
* @desc Script file for the userarea tab
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
var quillOpts={
|
||||
modules: {
|
||||
toolbar: [
|
||||
["bold", "italic", "underline", "strike"],
|
||||
["blockquote", "code-block"],
|
||||
[{"script": "sub"}, {"script": "super"}],
|
||||
[{"indent": "-1"}, {"indent": "+1"}],
|
||||
[{"header": [1, 2, 3, 4, 5, 6, false]}],
|
||||
[{"color": []}, {"background": []}],
|
||||
[{"font": []}],
|
||||
[{"align": []}],
|
||||
["clean"]
|
||||
],
|
||||
history: {
|
||||
delay: 2000,
|
||||
maxStack: 200,
|
||||
userOnly: true
|
||||
}
|
||||
},
|
||||
theme: "snow"
|
||||
};
|
||||
|
||||
/*
|
||||
* FILESHARE
|
||||
*/
|
||||
function getMatchingIcon(ext){
|
||||
var ficon="fa-file-alt";
|
||||
if(ext=="doc" || ext=="docx" || ext=="docm"){
|
||||
ficon="fa-file-word";
|
||||
}
|
||||
else if(ext=="ppt" || ext=="pptx" || ext=="pptm"){
|
||||
ficon="fa-file-powerpoint";
|
||||
}
|
||||
else if(ext=="jpg" || ext=="png" || ext=="jpeg" || ext=="gif" || ext=="bmp"){
|
||||
ficon="fa-file-image";
|
||||
}
|
||||
else if(ext=="xls" || ext=="xlsx" || ext=="xlsm"){
|
||||
ficon="fa-file-excel";
|
||||
}
|
||||
else if(ext=="c" || ext=="cpp" || ext=="java" || ext=="js" || ext=="php" || ext=="cs" || ext=="css"){
|
||||
ficon="fa-file-code";
|
||||
}
|
||||
else if(ext=="wav" || ext=="mp3" || ext=="flac" || ext=="ogg" || ext=="3gp"){
|
||||
ficon="fa-file-audio";
|
||||
}
|
||||
else if(ext=="mp4" || ext=="avi" || ext=="mkv"){
|
||||
ficon="fa-file-video";
|
||||
}
|
||||
else if(ext=="zip" || ext=="gz" || ext=="rar" || ext=="tar" || ext=="7z"){
|
||||
ficon="fa-file-archive";
|
||||
}
|
||||
else if(ext=="pdf"){
|
||||
ficon="fa-file-pdf";
|
||||
}
|
||||
|
||||
return ficon;
|
||||
}
|
||||
|
||||
function copyRefToClipboard(el){
|
||||
$(el).prev("textarea").select();
|
||||
document.execCommand("copy");
|
||||
}
|
||||
|
||||
function loadFileList(el){
|
||||
var filename=new RegExp("(.*)[.]");
|
||||
var extension=new RegExp("(?:[a-zA-Z0-9](?![.]))+$");
|
||||
|
||||
$.each(el.files, function(i, val){
|
||||
//check if file is bigger than 500M. In that case output error
|
||||
if(val.size>500000000){
|
||||
alert($("#langFileTooBig").text());
|
||||
}
|
||||
else{
|
||||
if(filename.exec(val.name)){
|
||||
var name=filename.exec(val.name)[1];
|
||||
var ext=extension.exec(val.name)[0].toLowerCase();
|
||||
}
|
||||
else{
|
||||
//if filename doesn't contain any dots
|
||||
var name=val.name;
|
||||
var ext="";
|
||||
}
|
||||
|
||||
var obj=$("<div></div>");
|
||||
|
||||
var cont="<table style=\"width: 100%\"><tr><td rowspan=\"3\" style=\"width: 10em\"><i class=\"fa "+getMatchingIcon(ext)+"\" style=\"font-size: 10em\" name=\"fileicon\"></i></td>";
|
||||
cont+="<td>"+$("#langName").text()+": <input type=\"text\" name=\"fname\" style=\"width: 95%\" value=\""+name+"\"></td></tr>";
|
||||
cont+="<tr><td>"+$("#langExtension").text()+": "+ext+"</td></tr>";
|
||||
cont+="<tr><td name=\"control\"><button class=\"red\" type=\"button\" onclick=\"removeMyFile(this)\"><i class=\"fa fa-trash\"></i></button></td></tr></table>";
|
||||
cont+="<hr class=\"separator\">";
|
||||
|
||||
obj.html(cont);
|
||||
|
||||
var file=$("<span name=\"file\"></span>");
|
||||
file.data("fileobj", val);
|
||||
file.appendTo(obj);
|
||||
|
||||
obj.hide().appendTo("#files").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$(el).val("");
|
||||
}
|
||||
|
||||
function removeMyFile(el){
|
||||
$(el).parent("td").parent("tr").parent("tbody").parent("table").parent("div").slideUp(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
|
||||
function clearMyFiles(){
|
||||
$("#files").slideUp(function(){
|
||||
$("#files").html("");
|
||||
});
|
||||
$("#files").slideDown();
|
||||
}
|
||||
|
||||
function startFileUpload(){
|
||||
$("#files").children("div").each(function(){
|
||||
var base=$(this).children("table").children("tbody").children("tr");
|
||||
|
||||
var name=base.children("td").children("input[name=fname]").val();
|
||||
var file=$(this).children("span[name=file]").data("fileobj");
|
||||
|
||||
base.children("td[name=control]").html("<div class=\"progressbar\"><div style=\"width: 0%\"><span>0%</span></div></div>");
|
||||
|
||||
var progressbar=base.children("td[name=control]").children("div.progressbar");
|
||||
var icon=base.children("td").children("i[name=fileicon]");
|
||||
|
||||
var data=new FormData();
|
||||
data.append("upload_name", name);
|
||||
data.append("upload_file", file);
|
||||
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: data,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
xhr: function(){
|
||||
var myXHR=$.ajaxSettings.xhr();
|
||||
if(myXHR.upload){
|
||||
myXHR.upload.addEventListener("progress", function(e){
|
||||
if(e.lengthComputable){
|
||||
var percent=Math.round(e.loaded*100/e.total*10)/10;
|
||||
percent=percent.toString()+"%";
|
||||
|
||||
//show change on progressbar
|
||||
progressbar.children("div").css("width", percent);
|
||||
progressbar.children("div").children("span").text(percent);
|
||||
|
||||
//show change on icon
|
||||
icon.css("background-image", "linear-gradient(to top, rgba(74,230,74,0.9), rgba(74,230,74,0.9) "+percent+", rgb(0,0,0) "+percent+")");
|
||||
icon.css("color", "transparent");
|
||||
icon.css("-webkit-background-clip", "text");
|
||||
icon.css("background-clip", "text");
|
||||
}
|
||||
});
|
||||
}
|
||||
return myXHR;
|
||||
},
|
||||
success: function(response){
|
||||
if(response=="quota"){
|
||||
loadMessage();
|
||||
var text=$("#langQuotaErr").text();
|
||||
}
|
||||
else if(response=="error"){
|
||||
loadMessage();
|
||||
var text="Error";
|
||||
}
|
||||
else{
|
||||
var text="<textarea rows=3 cols=30 readonly>"+response+"</textarea><button type=\"button\" onclick=\"copyRefToClipboard(this)\">"+$("#langCopyToClip").text()+"</button>";
|
||||
}
|
||||
|
||||
//replace progressbar
|
||||
progressbar.parent().html(text);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function deleteFileFromServer(fid, caller){
|
||||
if(confirm($("#langSure").text())){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"delete_file":fid},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response=="ok"){
|
||||
$(caller).parent("td").parent("tr").css("background", "red").fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BLOG
|
||||
*/
|
||||
var quill;
|
||||
|
||||
function resetBlog(){
|
||||
$("#postEdit").children("form")[0].reset();
|
||||
quill=null;
|
||||
$("#editorContainer").html("<div id=\"editor\"></div>");
|
||||
$("#lastSaved").html("");
|
||||
}
|
||||
|
||||
function newBlog(){
|
||||
$("#postEdit").slideUp(function(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"blog_new":true},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response!="error"){
|
||||
resetBlog();
|
||||
|
||||
$("#blog_id").val(response);
|
||||
|
||||
//last saved
|
||||
var now=new Date();
|
||||
var h=checkTime(now.getHours());
|
||||
var m=checkTime(now.getMinutes());
|
||||
var s=checkTime(now.getSeconds());
|
||||
$("#lastSaved").html(h+":"+m+":"+s);
|
||||
|
||||
//init quill
|
||||
quill=new Quill("#editor", quillOpts);
|
||||
|
||||
//slide down editor
|
||||
$("#postEdit").slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function blogAutoSave(){
|
||||
if($("#autosave").is(":checked")){
|
||||
blogSave();
|
||||
setTimeout(blogAutoSave, 180*1000);
|
||||
}
|
||||
}
|
||||
|
||||
function blogSave(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {
|
||||
"blog_id": $("#blog_id").val(),
|
||||
"blog_title": $("[name=blog_title]").val(),
|
||||
"blog_content": JSON.stringify(quill.getContents()),
|
||||
"blog_tags": $("[name=blog_tags]").val(),
|
||||
"blog_published": ($("[name=blog_published]").is(":checked")?1:0)
|
||||
},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
|
||||
if(response!="error"){
|
||||
//last saved
|
||||
var now=new Date();
|
||||
var h=checkTime(now.getHours());
|
||||
var m=checkTime(now.getMinutes());
|
||||
var s=checkTime(now.getSeconds());
|
||||
$("#lastSaved").html(h+":"+m+":"+s);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function blogDiscard(){
|
||||
$("#postEdit").slideUp(function(){
|
||||
resetBlog();
|
||||
});
|
||||
}
|
||||
|
||||
function blogEdit(id){
|
||||
$("#postEdit").slideUp(function(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php",
|
||||
type: "GET",
|
||||
data: {"load": "userarea", "backend": true, "blog_get": id},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response!="error"){
|
||||
var blog=(response instanceof Object)?repsonse:JSON.parse(response);
|
||||
|
||||
resetBlog();
|
||||
|
||||
//insert data
|
||||
$("#blog_id").val(blog.id);
|
||||
$("[name=blog_title]").val(blog.title);
|
||||
$("[name=blog_tags]").val(blog.tags);
|
||||
$("[name=blog_published]").attr("checked", blog.published=="1");
|
||||
|
||||
//last saved
|
||||
var now=new Date();
|
||||
var h=checkTime(now.getHours());
|
||||
var m=checkTime(now.getMinutes());
|
||||
var s=checkTime(now.getSeconds());
|
||||
$("#lastSaved").html(h+":"+m+":"+s);
|
||||
|
||||
//init quill
|
||||
quill=new Quill("#editor", quillOpts);
|
||||
//check if delta is valid JSON
|
||||
if(blog.content!=""){
|
||||
quill.setContents(JSON.parse(blog.content));
|
||||
}
|
||||
|
||||
//slide down editor
|
||||
$("#postEdit").slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function blogDelete(id, el){
|
||||
if(confirm($("#langSure").text())){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"blog_delete": id},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response=="ok"){
|
||||
$(el).parent("td").parent("tr").css("background", "red").fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* NEWS
|
||||
*/
|
||||
var quillEng;
|
||||
var quillHun;
|
||||
var quillRou;
|
||||
|
||||
function resetNews(){
|
||||
$("#newsEdit").children("form")[0].reset();
|
||||
quillEng=null;
|
||||
quillHun=null;
|
||||
quillRou=null;
|
||||
$("#engEditorContainer").html("<div id=\"engEditor\"></div>");
|
||||
$("#hunEditorContainer").html("<div id=\"hunEditor\"></div>");
|
||||
$("#rouEditorContainer").html("<div id=\"rouEditor\"></div>");
|
||||
$("#lastSaved").html("");
|
||||
}
|
||||
|
||||
function newNews(){
|
||||
$("#newsEdit").slideUp(function(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"news_new": true},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response!="error"){
|
||||
resetNews();
|
||||
|
||||
//load id
|
||||
$("#news_id").val(response);
|
||||
|
||||
//last saved
|
||||
var now=new Date();
|
||||
var h=checkTime(now.getHours());
|
||||
var m=checkTime(now.getMinutes());
|
||||
var s=checkTime(now.getSeconds());
|
||||
$("#lastSaved").html(h+":"+m+":"+s);
|
||||
|
||||
//init quill instances
|
||||
quillEng=new Quill("#engEditor", quillOpts);
|
||||
quillHun=new Quill("#hunEditor", quillOpts);
|
||||
quillRou=new Quill("#rouEditor", quillOpts);
|
||||
|
||||
//slide down
|
||||
$("#newsEdit").slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function newsAutoSave(){
|
||||
if($("#autosave").is(":checked")){
|
||||
newsSave();
|
||||
setTimeout(newsAutoSave, 180*1000);
|
||||
}
|
||||
}
|
||||
|
||||
function newsSave(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {
|
||||
"news_id": $("#news_id").val(),
|
||||
"news_subject_eng": $("[name=news_subject_eng]").val(),
|
||||
"news_subject_hun": $("[name=news_subject_hun]").val(),
|
||||
"news_subject_rou": $("[name=news_subject_rou]").val(),
|
||||
"news_content_eng": JSON.stringify(quillEng.getContents()),
|
||||
"news_content_hun": JSON.stringify(quillHun.getContents()),
|
||||
"news_content_rou": JSON.stringify(quillRou.getContents()),
|
||||
"news_published": ($("[name=news_published]").is(":checked")?1:0)
|
||||
},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response!="error"){
|
||||
//last saved
|
||||
var now=new Date();
|
||||
var h=checkTime(now.getHours());
|
||||
var m=checkTime(now.getMinutes());
|
||||
var s=checkTime(now.getSeconds());
|
||||
$("#lastSaved").html(h+":"+m+":"+s);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function newsDiscard(){
|
||||
$("#newsEdit").slideUp(function(){
|
||||
resetNews();
|
||||
});
|
||||
}
|
||||
|
||||
function newsEdit(id){
|
||||
$("#newsEdit").slideUp(function(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php",
|
||||
type: "GET",
|
||||
data: {"load": "userarea", "backend": true, "news_get": id},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response!="error"){
|
||||
var news=(response instanceof Object)?response:JSON.parse(response);
|
||||
|
||||
resetNews();
|
||||
|
||||
//insert data
|
||||
$("#news_id").val(news.id);
|
||||
$("[name=news_subject_eng]").val(news.subject_eng);
|
||||
$("[name=news_subject_hun]").val(news.subject_hun);
|
||||
$("[name=news_subject_rou]").val(news.subject_rou);
|
||||
$("[name=news_published]").attr("checked", news.published=="1");
|
||||
|
||||
//last saved
|
||||
var now=new Date();
|
||||
var h=checkTime(now.getHours());
|
||||
var m=checkTime(now.getMinutes());
|
||||
var s=checkTime(now.getSeconds());
|
||||
$("#lastSaved").html(h+":"+m+":"+s);
|
||||
|
||||
//init quill instances
|
||||
quillEng=new Quill("#engEditor", quillOpts);
|
||||
quillHun=new Quill("#hunEditor", quillOpts);
|
||||
quillRou=new Quill("#rouEditor", quillOpts);
|
||||
if(news.content_eng!=""){
|
||||
quillEng.setContents(JSON.parse(news.content_eng));
|
||||
}
|
||||
if(news.content_hun!=""){
|
||||
quillHun.setContents(JSON.parse(news.content_hun));
|
||||
}
|
||||
if(news.content_rou!=""){
|
||||
quillRou.setContents(JSON.parse(news.content_rou));
|
||||
}
|
||||
|
||||
//slide down editor
|
||||
$("#newsEdit").slideDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function newsDelete(id, el){
|
||||
if(confirm($("#langSure").text())){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"news_delete": id},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response=="ok"){
|
||||
$(el).parent("td").parent("tr").css("background", "red").fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ADMIN AREA
|
||||
*/
|
||||
function adminNewPassword(id){
|
||||
var response=prompt($("#langEnterPassword").text());
|
||||
if(response!=null && response!=""){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"new_password_user": id, "new_password": response},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function adminChangeLevel(id){
|
||||
var response=prompt($("#langEnterAccesslevel").text());
|
||||
if(response!=null && response!=""){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"new_accesslevel_user": id, "new_accesslevel": response},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function adminChangeQuota(id){
|
||||
var response=prompt($("#langEnterQuota").text());
|
||||
if(response!=null && response!=""){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"new_quota_user": id, "new_quota": response},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function adminNewUser(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: $("#usernewForm").serialize(),
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response=="ok"){
|
||||
$("#usernewForm")[0].reset();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function adminFinishRequest(id, el){
|
||||
if(confirm($("#langSure").text())){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"admin_finish_request": id},
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response=="ok"){
|
||||
$(el).parent("td").parent("tr").css("background", "red").fadeOut(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* PROFILE
|
||||
*/
|
||||
function profileUpdate(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: $("#profileForm").serialize(),
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function profileUpdatePassword(){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: $("#profilePassword").serialize(),
|
||||
success: function(response){
|
||||
loadMessage();
|
||||
if(response=="ok"){
|
||||
$("#profilePassword").reset();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function profileSubmitShipping(){
|
||||
$.ajax({
|
||||
url: "/subs/pubkey.php",
|
||||
type: "GET",
|
||||
success: function(pubkey){
|
||||
//set up encryptor
|
||||
var encrypt=new JSEncrypt();
|
||||
encrypt.setPublicKey(pubkey);
|
||||
|
||||
//update status
|
||||
$("#encStatus").hide().removeClass().addClass("red").html("<i class=\"fa fa-lock-open\"></i> "+$("#langEncrypting").text()).fadeIn();
|
||||
|
||||
//encrypt data
|
||||
var name=encrypt.encrypt($("[name=profile_shipping_name]").val());
|
||||
var addr="Country: "+$("[name=address_country]").val()+"<br>";
|
||||
addr+="Region: "+$("[name=address_region]").val()+"<br>";
|
||||
addr+="City: "+$("[name=address_city]").val()+"<br>";
|
||||
addr+="Address Line 1: "+$("[name=address_line1]").val()+"<br>";
|
||||
addr+="Address line 2: "+$("[name=address_line2]").val()+"<br>";
|
||||
addr+="Postal code: "+$("[name=address_zip]").val();
|
||||
addr=encrypt.encrypt(addr);
|
||||
var email=encrypt.encrypt($("[name=profile_shipping_email]").val());
|
||||
var phone=encrypt.encrypt($("[name=profile_shipping_phone]").val());
|
||||
|
||||
//update status
|
||||
$("#encStatus").fadeOut(function(){
|
||||
$(this).removeClass().addClass("green").html("<i class=\"fa fa-lock\"></i> "+$("#langEncrypted").text()).fadeIn();
|
||||
});
|
||||
|
||||
//post
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {
|
||||
"profile_shipping_name": name,
|
||||
"profile_shipping_address": addr,
|
||||
"profile_shipping_email": email,
|
||||
"profile_shipping_phone": phone
|
||||
},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function profileDeleteShipping(){
|
||||
if(confirm($("#langConfDelShipping").text())){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"profile_shipping_delete": true},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteProfile(){
|
||||
if($("#delete_profile_box1").is(":checked") && $("#delete_profile_box2").is(":checked") && $("#delete_profile_box3").is(":checked")){
|
||||
if(confirm($("#langSure").text())){
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"delete_profile": true},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function requestProfileData(){
|
||||
if($("#request_profile_data_pgp").val()!="" && (!$("#request_profile_data_pgp").val().includes("-----BEGIN PGP PUBLIC KEY BLOCK-----") || !$("#request_profile_data_pgp").val().includes("-----END PGP PUBLIC KEY BLOCK-----"))){
|
||||
alert($("#langPGPNotValid").text());
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: "/subs/loader.php?load=userarea&backend",
|
||||
type: "POST",
|
||||
data: {"request_profile_data": true, "request_profile_data_pgp": $("#request_profile_data_pgp").val()},
|
||||
success: function(){
|
||||
loadMessage();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
373
style/main.css
Normal file
@ -0,0 +1,373 @@
|
||||
/**
|
||||
* /style/style.css
|
||||
* @version 1.3
|
||||
* @desc Main style file
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
html{
|
||||
background: url("../res/bg.png") no-repeat center center fixed;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
div.header{
|
||||
overflow: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.content{
|
||||
border: 1px solid rgb(75, 75, 75);
|
||||
border-bottom-left-radius: 2em;
|
||||
border-bottom-right-radius: 2em;
|
||||
background: rgba(100, 100, 100, 0.8);
|
||||
overflow: auto;
|
||||
width: 95%;
|
||||
margin: auto;
|
||||
padding-bottom: 1.5em;
|
||||
}
|
||||
div.content div.inner{
|
||||
padding: 1.5em;
|
||||
}
|
||||
|
||||
ul.menu{
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
background: rgb(0, 190, 255);
|
||||
display: flex;
|
||||
justify-content: stretch;
|
||||
padding: 0;
|
||||
}
|
||||
ul.menu li{
|
||||
display: block;
|
||||
padding: 1em;
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
ul.menu li:hover{
|
||||
background: rgb(0, 153, 204);
|
||||
}
|
||||
ul.menu a{
|
||||
text-decoration: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
footer{
|
||||
background: rgba(75, 75, 75, 0.8);
|
||||
border: 1px solid rgb(20, 20, 20);
|
||||
border-radius: 0.5em;
|
||||
padding: 1em;
|
||||
width: 50%;
|
||||
margin: auto;
|
||||
font-size: 0.8em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
hr.placeholder{
|
||||
border: none;
|
||||
height: 30px;
|
||||
}
|
||||
hr.separator{
|
||||
border: 1px solid rgb(75, 75, 75);
|
||||
width: 80%;
|
||||
margin-bottom: 1.5em;
|
||||
}
|
||||
hr.breakfloat{
|
||||
border: none;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
img.title{
|
||||
float: left;
|
||||
max-width: 60%;
|
||||
max-height: 10em;
|
||||
}
|
||||
img.logo{
|
||||
max-width: 30%;
|
||||
}
|
||||
|
||||
div.langselect{
|
||||
float: right;
|
||||
width: 10%;
|
||||
background: rgb(195, 195, 195);
|
||||
border-radius: 5px;
|
||||
display: flex;
|
||||
padding: 5px;
|
||||
justify-content: space-around;
|
||||
}
|
||||
div.langselect a{
|
||||
display: block;
|
||||
max-width: 30%;
|
||||
max-height: 95%;
|
||||
}
|
||||
div.langselect img{
|
||||
max-width: 100%;
|
||||
max-height: 7em;
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
div.news{
|
||||
background: url('./res/news.png') no-repeat center center;
|
||||
background-size: contain;
|
||||
border: 1px solid rgb(0, 0, 0);
|
||||
border-radius: 5px;
|
||||
width: 70%;
|
||||
padding: 0.5em;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
button{
|
||||
margin: 0.1em;
|
||||
background: rgb(0, 190, 255);
|
||||
padding: 1em;
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
color: rgb(255, 255, 255);
|
||||
min-width: 7em;
|
||||
}
|
||||
button:hover{
|
||||
background: rgb(0, 153, 204);
|
||||
}
|
||||
|
||||
div.container{
|
||||
background: rgba(100, 100, 100, 1);
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
padding: 1em;
|
||||
width: 40%;
|
||||
}
|
||||
div.container p{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
div.post{
|
||||
background: rgba(100, 100, 100, 1);
|
||||
border-radius: 5px;
|
||||
padding: 1em;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
input{
|
||||
border-radius: 5px;
|
||||
padding: 0.5em;
|
||||
border: 1px solid rgb(75, 75, 75);
|
||||
}
|
||||
textarea{
|
||||
border-radius: 5px;
|
||||
padding: 0.5em;
|
||||
border: 1px solid rgb(75, 75, 75);
|
||||
}
|
||||
select{
|
||||
border-radius: 5px;
|
||||
padding: 0.5em;
|
||||
border: 1px solid rgb(75, 75, 75);
|
||||
}
|
||||
|
||||
div.checkbox{
|
||||
width: 7em;
|
||||
height: 2.5em;
|
||||
background: rgb(50, 50, 50);
|
||||
border-radius: 1.5em;
|
||||
position: relative;
|
||||
}
|
||||
div.checkbox:before{
|
||||
content: 'On';
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
left: 15%;
|
||||
color: rgb(35, 200, 40);
|
||||
font-size: 1em;
|
||||
}
|
||||
div.checkbox:after{
|
||||
content: 'Off';
|
||||
position: absolute;
|
||||
top: 30%;
|
||||
right: 15%;
|
||||
color: rgb(15, 15, 15);
|
||||
font-size: 1em;
|
||||
}
|
||||
div.checkbox label{
|
||||
display: block;
|
||||
width: 45%;
|
||||
height: 55%;
|
||||
border-radius: 1.5em;
|
||||
transition: 0.5s;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
top: 22.5%;
|
||||
left: 10%;
|
||||
z-index: 1;
|
||||
background: rgb(220, 220, 220);
|
||||
}
|
||||
div.checkbox input[type=checkbox]:checked + label{
|
||||
left: 45%;
|
||||
background: rgb(35, 200, 40);
|
||||
}
|
||||
|
||||
fieldset{
|
||||
border: 5px solid rgba(75, 75, 75, 1);
|
||||
background: rgba(100, 100, 100, 1);
|
||||
border-radius: 1em;
|
||||
padding: 2em;
|
||||
width: 60%;
|
||||
text-align: left;
|
||||
}
|
||||
fieldset legend{
|
||||
background: rgba(100, 100, 100, 1);
|
||||
color: rgb(255,255,255);
|
||||
padding: 0.3em;
|
||||
font-size: 2em;
|
||||
border-radius: 0.5em;
|
||||
box-shadow: 0 0 0 5px rgba(75, 75, 75, 1);
|
||||
text-align:left;
|
||||
margin-left: 10%;
|
||||
}
|
||||
|
||||
div.overlay.messages{
|
||||
height: 30%;
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
div.message{
|
||||
width: 50%;
|
||||
padding: 1em;
|
||||
border: 2px solid rgb(60, 255, 60);
|
||||
border-radius: 10px;
|
||||
margin: auto;
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
background: rgba(0, 255, 0, 0.8);
|
||||
text-align: center;
|
||||
}
|
||||
div.message.error{
|
||||
border: 2px solid rgb(255, 60, 60);
|
||||
background: rgba(255, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
.center{
|
||||
margin: auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tiles
|
||||
*/
|
||||
div.tileset{
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-around;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
div.tileset div.tile{
|
||||
margin: 1em;
|
||||
background: rgb(0, 180, 245);
|
||||
padding: 0.5em;
|
||||
text-align: center;
|
||||
width: 20em;
|
||||
height: 30em;
|
||||
}
|
||||
|
||||
div.tile .imgholder{
|
||||
width: 90%;
|
||||
height: 9em;
|
||||
}
|
||||
|
||||
div.tile img{
|
||||
max-width: 99%;
|
||||
max-height: 99%;
|
||||
}
|
||||
|
||||
div.fadeout{
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div.fadeout:before{
|
||||
content: "";
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: linear-gradient(transparent 7.5em, rgb(0, 180, 245));
|
||||
}
|
||||
div.fadeout.grey:before{
|
||||
background: linear-gradient(transparent 7.5em, rgba(100, 100, 100, 1));
|
||||
}
|
||||
|
||||
div.progressbar{
|
||||
background: rgba(100, 100, 100, 1);
|
||||
border-radius: 2em;
|
||||
}
|
||||
div.progressbar div{
|
||||
background: rgb(0, 180, 245);
|
||||
border-radius: 2em;
|
||||
color: rgb(255, 255, 255);
|
||||
padding-top: 0.5em;
|
||||
padding-bottom: 0.2em;
|
||||
}
|
||||
div.progressbar span{
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
button.red{
|
||||
background: rgba(230,74,74,0.9);
|
||||
border: 1px solid rgba(187,48,48,0.9);
|
||||
}
|
||||
button.red:hover{
|
||||
background: rgba(200,54,54,0.9);
|
||||
}
|
||||
button.green{
|
||||
background: rgba(74,230,74,0.9);
|
||||
border: 1px solid rgba(48,487,48,0.9);
|
||||
}
|
||||
button.green:hover{
|
||||
background: rgba(54,200,54,0.9);
|
||||
}
|
||||
|
||||
span.red{
|
||||
color: rgba(230,74,74,0.9);
|
||||
}
|
||||
span.green{
|
||||
color: rgba(74,230,74,0.9);
|
||||
}
|
||||
|
||||
#editor{
|
||||
height: 90vh;
|
||||
}
|
||||
#engEditor{
|
||||
height: 90vh;
|
||||
}
|
||||
#hunEditor{
|
||||
height: 90vh;
|
||||
}
|
||||
#rouEditor{
|
||||
height: 90vh;
|
||||
}
|
||||
|
||||
.footable{
|
||||
text-align: left;
|
||||
}
|
1
style/mobile.css
Normal file
@ -0,0 +1 @@
|
||||
|
47
subs/loader.php
Normal 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
@ -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
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|
36
subs/parts/.php
Normal 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
@ -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
@ -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 ?>
|
25
subs/parts/about_backend.php
Normal 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
@ -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 ?>
|
61
subs/parts/blog_backend.php
Normal 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
@ -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>
|
25
subs/parts/contact_backend.php
Normal 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
@ -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>
|
37
subs/parts/projects_backend.php
Normal 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
@ -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>
|
24
subs/parts/repos_backend.php
Normal 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
@ -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 ?>
|
141
subs/parts/userarea/admin.php
Normal 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>
|
116
subs/parts/userarea/blog.php
Normal 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>
|
94
subs/parts/userarea/fileshare.php
Normal 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 / ".($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>
|
127
subs/parts/userarea/news.php
Normal 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>
|
442
subs/parts/userarea/profile.php
Normal 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-----

...

-----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>
|
710
subs/parts/userarea_backend.php
Normal 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
@ -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();
|
77
systemtest_tk_project.geany
Normal file
@ -0,0 +1,77 @@
|
||||
[editor]
|
||||
line_wrapping=false
|
||||
line_break_column=72
|
||||
auto_continue_multiline=true
|
||||
|
||||
[file_prefs]
|
||||
final_new_line=true
|
||||
ensure_convert_new_lines=false
|
||||
strip_trailing_spaces=false
|
||||
replace_tabs=false
|
||||
|
||||
[indentation]
|
||||
indent_width=4
|
||||
indent_type=0
|
||||
indent_hard_tab_width=8
|
||||
detect_indent=false
|
||||
detect_indent_width=false
|
||||
indent_mode=2
|
||||
|
||||
[project]
|
||||
name=Systemtest_tk
|
||||
base_path=H:\\Munkák\\Systemtest_tk
|
||||
description=
|
||||
|
||||
[long line marker]
|
||||
long_line_behaviour=1
|
||||
long_line_column=72
|
||||
|
||||
[files]
|
||||
current_page=46
|
||||
FILE_NAME_0=4212;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cindex.php;0;4
|
||||
FILE_NAME_1=3051;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Cmain.js;0;4
|
||||
FILE_NAME_2=1242;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cloader.php;0;4
|
||||
FILE_NAME_3=2416;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Cconfig.php;0;4
|
||||
FILE_NAME_4=545;Conf;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Cconfig.ini;0;4
|
||||
FILE_NAME_5=54;None;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5C.htaccess;0;4
|
||||
FILE_NAME_6=5;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Cjs.php;0;4
|
||||
FILE_NAME_7=4675;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Clib%5Cfunctions.php;0;4
|
||||
FILE_NAME_8=0;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Clib%5CPasswordStorage.php;0;4
|
||||
FILE_NAME_9=9259;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Clib%5CloginManager%5CloginManager.php;0;4
|
||||
FILE_NAME_10=0;CSS;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cstyle%5Cmobile.css;0;4
|
||||
FILE_NAME_11=1325;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cmsg.php;0;4
|
||||
FILE_NAME_12=7355;CSS;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cstyle%5Cmain.css;0;4
|
||||
FILE_NAME_13=48;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5C.php;0;4
|
||||
FILE_NAME_14=1156;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5C_backend.php;0;4
|
||||
FILE_NAME_15=36;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5C.js;0;4
|
||||
FILE_NAME_16=1102;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cprojects.php;0;4
|
||||
FILE_NAME_17=7;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cprojects_backend.php;0;4
|
||||
FILE_NAME_18=1242;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Cprojects.js;0;4
|
||||
FILE_NAME_19=1104;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Crepos.php;0;4
|
||||
FILE_NAME_20=976;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Crepos_backend.php;0;4
|
||||
FILE_NAME_21=957;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Crepos.js;0;4
|
||||
FILE_NAME_22=8359;SQL;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Cdatabase%20setup.sql;0;4
|
||||
FILE_NAME_23=2240;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cblog.php;0;4
|
||||
FILE_NAME_24=3245;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Cblog.js;0;4
|
||||
FILE_NAME_25=2443;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cblog_backend.php;0;4
|
||||
FILE_NAME_26=1097;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cabout.php;0;4
|
||||
FILE_NAME_27=7;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cabout_backend.php;0;4
|
||||
FILE_NAME_28=0;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Cabout.js;0;4
|
||||
FILE_NAME_29=1001;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea.php;0;4
|
||||
FILE_NAME_30=3249;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea%5Cfileshare.php;0;4
|
||||
FILE_NAME_31=130;None;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cuploads%5C.htaccess;0;4
|
||||
FILE_NAME_32=2473;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cuploads%5Cfile.php;0;4
|
||||
FILE_NAME_33=33;None;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cuploads%5Cfiles%5C.htaccess;0;4
|
||||
FILE_NAME_34=5434;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea%5Cblog.php;0;4
|
||||
FILE_NAME_35=1616;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea%5Cnews.php;0;4
|
||||
FILE_NAME_36=3909;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea%5Cadmin.php;0;4
|
||||
FILE_NAME_37=2796;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea_backend.php;0;4
|
||||
FILE_NAME_38=4396;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Cuserarea.js;0;4
|
||||
FILE_NAME_39=24578;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Cuserarea%5Cprofile.php;0;4
|
||||
FILE_NAME_40=812;None;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Cpubkey.pub;0;4
|
||||
FILE_NAME_41=998;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cpubkey.php;0;4
|
||||
FILE_NAME_42=5690;Conf;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cconfig%5Clang%5Cen_US.ini;0;4
|
||||
FILE_NAME_43=5577;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Ccontact.php;0;4
|
||||
FILE_NAME_44=976;PHP;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Csubs%5Cparts%5Ccontact_backend.php;0;4
|
||||
FILE_NAME_45=961;Javascript;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5Cscript%5Ccontact.js;0;4
|
||||
FILE_NAME_46=41;Conf;0;EUTF-8;0;1;0;H%3A%5CMunkák%5CSystemtest_tk%5C.user.ini;0;4
|
51
testkey.rsa
Normal file
@ -0,0 +1,51 @@
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
MIIJKQIBAAKCAgEAy84FIxzbceSdhxeSGCuhuWnJ9k9Y3GoiHNo7yUXHCWsoFQfq
|
||||
lptXyOzDJvzBetIwUZpyCYTltM6glc/303Z5QGbkJaPEocgE4XumJHlCDTnIa102
|
||||
uUM6+dGpOToQLjFhE/iylfSX4igJdko8v/uKvznq2nfV0PUI/dS7tcCscP2UX7r5
|
||||
7lP2vTM/qtW+9IFS4TCVxyecm1hlyo2WFMfb7qmljqO6k7Mt66ImjcZLVOJXZJK8
|
||||
aZa4drOIykKGc2wimMjyyInVqb8lQZfrY9weXma0+742Ybu05rnq+SpkTVQM8cAE
|
||||
mZ2xKK7Y7SKCkTms0/2pMCJHuMgc8A5zWZwlOFy6Abv+uHTpW36bfJae8zDic+0b
|
||||
Lpcn3wpdVdIdqZXszCnBm6EaOFu81Yg2c++VoxccVouUxAiv0xNB22je8+Quofof
|
||||
YulxwKrJiAXg1xTmQShSrKHnDD+KXdomXx91auEnql8EmvUw/n8JzdyzCxaHOifd
|
||||
ySac1N4oQorIGKelHb2MakLBeQms7/Aa0AGULDpDZcClwPQtANJZv0pItefa0mNH
|
||||
FWsxvXNyV4pkq8yOOyeDGyrpAJBAOYblJa52izoJPfOvVdEbkgas9E8fOZ2/dI9g
|
||||
I0TzlmQtXdWW7sSkF8vmCQN/sruR10zTPQdPDP8Fo49h/OOJfYL/OhcEE5MCAwEA
|
||||
AQKCAgEAhfpiwCl5TY8Xy7ZAEWmlgGk+HpEc/pE66bLBeNhJNzTdfa3dlrJ6bBjR
|
||||
VfD1FFPW9d5NN1rJUyo+wR2dcsNAhIjfVKsrWZtPMhgCKZoZRO6GhaYakoHS5GXj
|
||||
FD7KYkON6P4mEJRhwIfHaJ72/tJS7NEbRhFfW2WqSout9pa6BfF9t80H/pft7YUi
|
||||
RqELTlsx693vqKOuvSTIjfa0Aec8+tFFh9a0keJJvsyzAaKo5R2CjBg2ikdN7qKp
|
||||
uyUuk/QzbjMz/4c1EckZqdxAHz6WLELimVf7Eha+nqr8AF7Q31DwzYAIxh+3VeJT
|
||||
sthr8yJyLk5kCcOPWLcc5ubpB7CxegZedo5U9uu+RM5qV5aWpgmXiB9E4X/L73Nx
|
||||
9mKFn0RGcdLSp9KlKv8vWNLII5no9ropb57KuY1GPAse71V2xa5wugBNeTdmEuAn
|
||||
H15pPEFw+PwzFUVdKCZWWJG2KS9xi4dKvUQW7jB/OnXUJNoLvUeR/+jHMFuhRt/+
|
||||
i/OgDjYSM6WW08ZnyF4UxGml7QWjra9sY5YhuxRajmRzU+V6eeFyFyTd256qL0vB
|
||||
U+z3egMkc+85dtauD0SdqmUktLhwpcJweEjlYhhTmc6A8yteuU9mMrbVdWvrKEVq
|
||||
PMOKavn8RdLbMBmo9sBo8HfJbgokYdLgfeOY5uFNX2rYcXnAzpECggEBAOzkCvo2
|
||||
0VZZitMLqt6/5VgSviuAo1SR14zW7KKopYmCIGTuL+rAnIgWXrOJkBJSP++I/Pqc
|
||||
jvGFchJXee7JkVUrWBwBM62PsdhcuS3sMV2DM2GEIRoZS54kEWPFsChWlFdZvqpE
|
||||
Pldn696qifCClmBK+jy9V118Il3CtKIe+C22K3hunDz9D58Up0gNC5hF4vW93UQX
|
||||
gUAs2lCrx6GzZ1TR3rpvli0EYK9UC+eCd6Epc/J7JOQWvU8SJWwEsaaX9fD7SwTG
|
||||
g/43+Q0pcV09ag5sqxej1pSEcsbQpuIUn5Lv5/DCFHRaU/VZ0ENUQ8JLhkPPrtO1
|
||||
MbfpflhSBTtknWsCggEBANw+umMjpWV9k2dk4dVarJAQ15dfrYMGUGoapDjvQBZX
|
||||
cSe6WPgp9LGI+tZ/8UBa3EalOw8A8KsLu+oTFjsRWv5BxCkAmiAq8OoZGYOFnF2T
|
||||
8TTSqPn6IV6aOHkeWO1fB6NfDRz0lykX9ZHUE09RBCgC76GX+rDbU7+eBYte9B/T
|
||||
fvRX/624lSN5WkixujGTz9R8Ag6h4s4bJYIdcAh5K1m8ev7Gdt4SeBHs5TlMJ/L0
|
||||
H3pOhesMJnGVhehc8f6mtYtIagPbZxC0p6IMdAXFSPjvDjLoehoP3RjsZcXNS2gd
|
||||
CnreJ5iX6X0OflYtqICUe2d95bwjwwvkonnRtNYABHkCggEAUThm4x9EavzMcku/
|
||||
zBuzQJ08gqHaXjaa1vkhrStxhlINVU2tNCnSAX7Z/Wie8wksTq6DPlHLWNfOIqfH
|
||||
cK2/nJn93awz0cBA09QG0c33pv5C8Z5h0xb1LEVliPXQziPRPJnSm4JGdaV146RJ
|
||||
IyNC98T9QzIP8EeNaORHFobTxKh/Aw25l9eUMZDdQgDnBtB/Xo44fQ4qDJzURXCA
|
||||
Q9rFBPnoCbgUn16u365LXpcG+UTDMlIyddmuEpxAJGb/mgTkGDmwoPSHcPQz+eVJ
|
||||
rxRNdqCfkL1l5wn6aFxFu6IijDihJ5UDelk2DBs9IriTetx2Lm3YnVG0uD/gR9vn
|
||||
W1PF/QKCAQEAkoUMnE2nh8gt2vgLIVPsPv9lXafiF6uIrb3BiLrpqLNNbP+Ulqva
|
||||
xIz7St3c0lJf/oOHsaiPc0sgHU3LWUpnfYSlCh4DaukGUsaV6aBmcP6t1dVbYsnb
|
||||
j0ML1M+ym1/ABhiC8cNqGIV+8h/jJL4iBLhHUPp5ZVTT90MaLyjhQZcC+2zbhGeq
|
||||
l+nwfTH3S2opNhO1jqR17WWz40bQNGLfyxgPvxSrGXux80LlD+QxI3jyw/wfLUps
|
||||
/N1bM0U6HI4tclafaKd6fmugpbahLQGdVTY7/PQZ3uK01RLXderogn/na+wE7YgK
|
||||
Zg7RT2Walsew/R2NS0eDR5M339D5+/ARCQKCAQBP7UD7dgEW7LQk/8JdNM8qQ+Pv
|
||||
XlEylxiqSp1RCiSlv7ZB80buUl0M8qeClgSZ72Tv2wcX9pAijenzbApeujVq5Y7J
|
||||
Gmk2YBTk+2qc+DRzt/mgWx9oPlKzQz2YrPd9qMMlDmYuSDC/44bQIy8XCgEUOX4F
|
||||
Gy8lY9txaVCwBF8o60Z3O7QFhEUzpvZJ1EwVl/v/AQRn+LKBHxu9Gn78ghIlln91
|
||||
zx0vaTe/CC5MhFYkFwQY9mxwDcDFlcBMpfIgoL1Gtxpxmhg1dmk5/Xz0NcbplH6i
|
||||
K58HTLpN1XCRz1fbiOA9guuyTEq7iGlJP7ytY3rRvM4tolgeVUvMrU+rcPlO
|
||||
-----END RSA PRIVATE KEY-----
|
4
uploads/.htaccess
Normal file
@ -0,0 +1,4 @@
|
||||
RewriteEngine on
|
||||
RewriteRule ^[a-zA-Z0-9]+$ file.php?token=$0 [L,QSA]
|
||||
RewriteCond %{REQUEST_URI} !^.+/.+$
|
||||
RewriteRule ^ - [F]
|
74
uploads/file.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* /uploads/file.php
|
||||
* @version 1.0
|
||||
* @desc Output files based on tokens
|
||||
* @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/>.
|
||||
**/
|
||||
|
||||
require_once("../config/config.php");
|
||||
|
||||
if(isset($_GET['token'])){
|
||||
$sql=$db->prepare("SELECT COUNT(id) AS count, id, name, extension FROM files WHERE token=:token");
|
||||
$sql->execute(array(":token"=>$_GET['token']));
|
||||
$res=$sql->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if($res['count']<1){
|
||||
echo "Not found";
|
||||
die();
|
||||
}
|
||||
else{
|
||||
if($res['extension']=="txt"){
|
||||
header("Content-type: text/plain");
|
||||
}
|
||||
else if($res['extension']=="js"){
|
||||
header("Content-type: text/javascript");
|
||||
}
|
||||
else if($res['extension']=="css"){
|
||||
header("Content-type: text/css");
|
||||
}
|
||||
else if($res['extension']=="html"){
|
||||
header("Content-type: text/html");
|
||||
}
|
||||
else if($res['extension']=="gif"){
|
||||
header("Content-type: image/gif");
|
||||
}
|
||||
else if($res['extension']=="png"){
|
||||
header("Content-type: image/png");
|
||||
}
|
||||
else if($res['extension']=="jpg" || $res['extension']=="jpeg"){
|
||||
header("Content-type: image/jpeg");
|
||||
}
|
||||
else if($res['extension']=="bmp"){
|
||||
header("Content-type: image/bmp");
|
||||
}
|
||||
else if($res['extension']=="pdf"){
|
||||
header("Content-type: application/pdf");
|
||||
}
|
||||
else{
|
||||
header("Content-type: application/octet-stream");
|
||||
header("Content-disposition: attachment; filename='".$res['name'].".".$res['extension']."'");
|
||||
}
|
||||
|
||||
$path="./files/".$res['id'];
|
||||
readfile($path);
|
||||
die();
|
||||
}
|
||||
}
|
2
uploads/files/.htaccess
Normal file
@ -0,0 +1,2 @@
|
||||
order allow,deny
|
||||
deny from all
|