Archived
1
0

Holiday changes ;)

This commit is contained in:
Marcel 2018-10-27 12:08:54 +02:00
parent 23a79c98df
commit 774dbc3388
39 changed files with 2931 additions and 2332 deletions

View File

@ -14,7 +14,7 @@ class File extends MY_Controller
if ($title == null) { if ($title == null) {
redirect(base_url()); redirect(base_url());
} else { } else {
$file = $this->db->query('SELECT name, type, path FROM files WHERE name = ?', [urldecode($title)])->result_array(); $file = $this->db->query('SELECT name, type, path, isUserData FROM files WHERE name = ?', [urldecode($title)])->result_array();
if (!empty($file)) { if (!empty($file)) {
$file = $file[0]; $file = $file[0];
@ -25,7 +25,7 @@ class File extends MY_Controller
header("Content-Disposition: attachment; filename=" . $file['name'] . '.' . explode('/', $file['type'])[1]); header("Content-Disposition: attachment; filename=" . $file['name'] . '.' . explode('/', $file['type'])[1]);
} }
$imagePath = 'files/' . (isset($_GET['w']) || isset($_GET['h']) ? 'thumbs/' : '') . $file['name'] . (isset($_GET['w']) ? '_w' . $_GET['w'] : '') . (isset($_GET['h']) ? '_h' . $_GET['h'] : '') . '.' . explode('.', $file['path'])[1]; $imagePath = 'files/' . ($file['isUserData'] ? 'userContent/' : '') . (isset($_GET['w']) || isset($_GET['h']) ? 'thumbs/' : '') . $file['name'] . (isset($_GET['w']) ? '_w' . $_GET['w'] : '') . (isset($_GET['h']) ? '_h' . $_GET['h'] : '') . '.' . explode('.', $file['path'])[1];
if (!file_exists($imagePath)) { if (!file_exists($imagePath)) {
$config['image_library'] = 'gd2'; $config['image_library'] = 'gd2';

View File

@ -221,7 +221,8 @@
if (strlen($content) >= 10000) { if (strlen($content) >= 10000) {
?> ?>
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
<b>Veröffentlichung des Posts fehlgeschlagen!</b> Dein Post ist leider zu lang. Er darf maximal 10.000 Zeichen umfassen. <b>Veröffentlichung des Posts fehlgeschlagen!</b> Dein Post ist leider zu lang. Er darf maximal 10.000
Zeichen umfassen.
</div> </div>
<?php <?php
exit; exit;
@ -231,7 +232,8 @@
if ($replyTo !== "-1" && !$this->PostsModel->isUUIDValid($replyTo)) { if ($replyTo !== "-1" && !$this->PostsModel->isUUIDValid($replyTo)) {
?> ?>
<div class="alert alert-warning" role="alert"> <div class="alert alert-warning" role="alert">
<b>Veröffentlichung des Posts fehlgeschlagen!</b> Der Post, an den du deine Antwort richten willst, existiert nicht (mehr).<br> <b>Veröffentlichung des Posts fehlgeschlagen!</b> Der Post, an den du deine Antwort richten willst,
existiert nicht (mehr).<br>
Solltest du dies für einen Fehler halten, versuche es später erneut oder kontaktiere uns. Solltest du dies für einen Fehler halten, versuche es später erneut oder kontaktiere uns.
</div> </div>
<?php <?php
@ -261,7 +263,8 @@
<div class="alert alert-success" role="alert"> <div class="alert alert-success" role="alert">
<b>Dein Post wurde erfolgreich veröffentlicht!</b> Möchtest du nun deine Posts ansehen? <br> <b>Dein Post wurde erfolgreich veröffentlicht!</b> Möchtest du nun deine Posts ansehen? <br>
<button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Nein</button> <button type="button" class="btn btn-sm btn-default" data-dismiss="modal">Nein</button>
<a href='<?= base_url('user/' . $_SESSION['user']['username'] . '/posts') ?>' class='btn btn-sm btn-primary'>Ja</a> <a href='<?= base_url('user/' . $_SESSION['user']['username'] . '/posts') ?>'
class='btn btn-sm btn-primary'>Ja</a>
</div> </div>
<?php <?php
} }
@ -446,16 +449,14 @@
} }
// Avatar // Avatar
if (isset($_FILES['avatar'])) { if (isset($_FILES['avatar'])) {
$image = $this->FileModel->uploadImage('avatar', 4096, $_FILES['avatar']['name'], 200); $image = $this->FileModel->uploadCroppedImage('avatar', 4096, $_FILES['avatar']['name'], 500, 500);
if ($image != null) if ($image != null)
$newData['profile_picture'] = $image; $newData['profile_picture'] = $image;
unset($_FILES['avatar']); unset($_FILES['avatar']);
} }
// Header // Header
if (isset($_FILES['header'])) { if (isset($_FILES['header'])) {
// var_dump($_FILES['header']);
$image = $this->FileModel->uploadImage('header', 4096, $_FILES['header']['name'], 1920); $image = $this->FileModel->uploadImage('header', 4096, $_FILES['header']['name'], 1920);
// var_dump($image);
if ($image != null) if ($image != null)
$newData['header_image'] = $image; $newData['header_image'] = $image;
unset($_FILES['header']); unset($_FILES['header']);
@ -543,17 +544,23 @@
} }
if (!empty($newData)) { if (!empty($newData)) {
// Add entry to history // Add entry to history
unset($user_data['rankName']);
unset($_SESSION['user']);
$this->UserModel->insertIntoHistory($user_data); $this->UserModel->insertIntoHistory($user_data);
// Update profile // Update profile
$this->UserModel->updateProfile($newData, $user_data['ID']); $this->UserModel->updateProfile($newData, $user_data['ID']);
// redirect(base_url(uri_string())); $this->db->cache_delete('user', $user_data['username']);
$this->LoginModel->reloadLoginSession($user_data);
redirect(base_url(uri_string()));
} }
$user_stats = $this->UserModel->getUserStats($user_data['ID']); $user_stats = $this->UserModel->getUserStats($user_data['ID']);
$title = $user_data['displayname'] . ' - Profil bearbeiten'; $title = $user_data['displayname'] . ' - Profil bearbeiten';
} }
$this->load->view('header', ['active' => 'profile', 'title' => $title, 'additionalStyles' => ['lib/selectize.css', 'lib/selectize.bootstrap3.css', 'profile_page.css']]); $this->load->view('header', ['active' => 'profile', 'title' => $title, 'additionalStyles' => ['lib/selectize.css', 'lib/selectize.bootstrap3.css', 'lib/bootstrap-colorpicker.min.css', 'profile_page.css']]);
$editMessage = isset($_SESSION['profileEditNotification']) ? $_SESSION['profileEditNotification'] : ""; $editMessage = isset($_SESSION['profileEditNotification']) ? $_SESSION['profileEditNotification'] : "";
$_SESSION['profileEditNotification'] = ""; $_SESSION['profileEditNotification'] = "";
if (isset($message)) { if (isset($message)) {
@ -562,7 +569,7 @@
if ($user_exists) { if ($user_exists) {
$this->load->view('network/user/profile_edit', ['message' => $editMessage, 'data' => $user_data, 'stats' => $user_stats]); $this->load->view('network/user/profile_edit', ['message' => $editMessage, 'data' => $user_data, 'stats' => $user_stats]);
} }
$this->load->view('footer', ['additionalScripts' => ['lib/selectize.js', 'profile_page.js', 'profile_edit.js']]); $this->load->view('footer', ['additionalScripts' => ['lib/selectize.js', 'lib/bootstrap-colorpicker.min.js', 'profile_page.js', 'profile_edit.js']]);
} }
public function single_post($username = null, $uuid = null, $origin = null) public function single_post($username = null, $uuid = null, $origin = null)

View File

@ -32,7 +32,8 @@
if ($edit) { if ($edit) {
if ($this->ProjectsModel->checkIfExists($id)) { if ($this->ProjectsModel->checkIfExists($id)) {
$content = $this->ProjectsModel->getEntry($id)[0]; $content = $this->ProjectsModel->getEntry($id);
$content = $this->ProjectsModel->mergeFullTranslationData($content)[0];
$projectCategories = $this->ProjectsModel->getEntryCategories($id); $projectCategories = $this->ProjectsModel->getEntryCategories($id);
} else { } else {
redirect(base_url('admin/projects/edit')); redirect(base_url('admin/projects/edit'));
@ -42,7 +43,7 @@
$categories = $this->ProjectsModel->getCategories(); $categories = $this->ProjectsModel->getCategories();
$this->load->view('admin/sidebar', ['title' => 'Projekt erstellen', 'additionalStyles' => ['lib/content-tools/content-tools.min.css', 'project-edit.css']]); $this->load->view('admin/sidebar', ['title' => 'Projekt erstellen', 'additionalStyles' => ['lib/content-tools/content-tools.min.css', 'project-edit.css']]);
$this->load->view('admin/project_edit', ['edit' => -1, 'categories' => $categories, 'content' => $content, 'pCategories' => $projectCategories]); $this->load->view('admin/project_edit', ['edit' => $id === NULL ? -1 : $id, 'categories' => $categories, 'content' => $content, 'pCategories' => $projectCategories]);
$this->load->view('admin/footer', ['additionalScripts' => ['lib/content-tools/content-tools.min.js', 'project-edit.js']]); $this->load->view('admin/footer', ['additionalScripts' => ['lib/content-tools/content-tools.min.js', 'project-edit.js']]);
} }
@ -58,6 +59,12 @@
$translations['de']['title'] = $this->input->post('titleDE'); $translations['de']['title'] = $this->input->post('titleDE');
$translations['de']['description'] = $this->input->post('headlineDE'); $translations['de']['description'] = $this->input->post('headlineDE');
$translations['de']['content'] = $this->input->post('contentDE'); $translations['de']['content'] = $this->input->post('contentDE');
$translations['en']['title'] = $this->input->post('titleEN');
$translations['en']['description'] = $this->input->post('headlineEN');
$translations['en']['content'] = $this->input->post('contentEN');
$translations['fr']['title'] = $this->input->post('titleFR');
$translations['fr']['description'] = $this->input->post('headlineFR');
$translations['fr']['content'] = $this->input->post('contentFR');
$url = $this->input->post('url'); $url = $this->input->post('url');

View File

@ -6,287 +6,662 @@ class DatabaseModel extends CI_Model
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->createMissingDatbases(); $this->createMissingDatabases();
} }
public function createMissingDatbases() { public function createMissingDatabases()
$this->createDatabases(); {
//$this->createDatabases();
$this->createTables(); $this->createTables();
$this->fillBlogDb(); //$this->addIndices();
$this->fillMainDb(); //$this->addAutoIncrements();
$this->fillPortfolioDb(); //$this->addConstraints();
$this->fillBlogTables();
$this->fillFeedbackTable();
$this->fillMainTable();
$this->fillProjectsTable();
} }
public function createDatabases() { private function createDatabases()
{
// $this->db->query('CREATE DATABASE IF NOT EXISTS `blog` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci'); // $this->db->query('CREATE DATABASE IF NOT EXISTS `blog` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci');
// $this->db->query('CREATE DATABASE IF NOT EXISTS `kingofdog` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci'); // $this->db->query('CREATE DATABASE IF NOT EXISTS `kingofdog` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci');
// $this->db->query('CREATE DATABASE IF NOT EXISTS `portfolio` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci'); // $this->db->query('CREATE DATABASE IF NOT EXISTS `portfolio` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci');
// $this->db->query('CREATE DATABASE IF NOT EXISTS `social_media` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci'); // $this->db->query('CREATE DATABASE IF NOT EXISTS `social_media` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci');
$this->db->query('SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;');
} }
private function createTables()
public function createTables()
{ {
// Calendar Table $this->db->query("CREATE TABLE IF NOT EXISTS `blog_categories` (
$this->db->query('CREATE TABLE IF NOT EXISTS `calendar` ( `ID` int(11) NOT NULL AUTO_INCREMENT,
`id` INT(11) NOT NULL AUTO_INCREMENT, `name` varchar(25) NOT NULL,
`title` VARCHAR(300) NOT NULL, `display_name` varchar(50) NOT NULL,
`allDay` TINYINT(1) NOT NULL,
`start` VARCHAR(20) NOT NULL,
`end` VARCHAR(20) NOT NULL,
`url` TEXT NOT NULL,
`overlap` TINYINT(1) NOT NULL,
`color` TEXT NOT NULL,
`textColor` TEXT NOT NULL,
`description` TEXT NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1');
// Feedback Table
$this->db->query('CREATE TABLE IF NOT EXISTS `feedback` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`page` VARCHAR(100) DEFAULT NULL,
`message` TEXT,
`datetime` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`anonymous` TINYINT(1) DEFAULT \'1\',
`userID` INT(11) DEFAULT NULL,
`email` VARCHAR(50) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1');
// Files Table
$this->db->query('CREATE TABLE IF NOT EXISTS `files` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NOT NULL,
`original_name` VARCHAR(50) NOT NULL,
`type` VARCHAR(30) NOT NULL,
`size` INT(11) NOT NULL,
`path` VARCHAR(300) NOT NULL,
`uploadDate` DATETIME DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=latin1');
// Redirects Table
$this->db->query('CREATE TABLE IF NOT EXISTS `redirects` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`redirect` TEXT NOT NULL,
`url` TEXT NOT NULL,
`temporary` TINYINT(1) NOT NULL,
`expireDate` DATETIME DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=220 DEFAULT CHARSET=latin1');
// User Followers Table
$this->db->query('CREATE TABLE IF NOT EXISTS `user_followers` (
`followedUserID` INT(11) NOT NULL,
`followerUserID` INT(11) NOT NULL,
`followedSince` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1');
// User Posts Table
$this->db->query('CREATE TABLE IF NOT EXISTS `user_posts` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`user_id` INT(11) DEFAULT NULL,
`title` VARCHAR(150) NOT NULL,
`content` TEXT,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`reply_to` INT(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `user_posts_ID_uindex` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=latin1');
// User Posts Likes Table
$this->db->query('CREATE TABLE IF NOT EXISTS `user_posts_likes` (
`postID` INT(11) NOT NULL,
`likedUserID` INT(11) NOT NULL,
`likerUserID` INT(11) NOT NULL,
UNIQUE KEY `likerUserID` (`likerUserID`),
UNIQUE KEY `postID` (`postID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1');
// Users Table
$this->db->query('CREATE TABLE IF NOT EXISTS `users` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`original_name` VARCHAR(25) NOT NULL,
`username` VARCHAR(25) NOT NULL,
`displayname` VARCHAR(25) NOT NULL,
`login_method` INT(11) DEFAULT \'0\',
`password` TEXT,
`email` TEXT NOT NULL,
`rank` TEXT NOT NULL,
`profile_picture` TEXT NOT NULL,
`header_image` TEXT,
`social_networks` TEXT,
`is_activated` TINYINT(1) NOT NULL,
`activation_key` VARCHAR(256) DEFAULT NULL,
`showAds` TINYINT(1) NOT NULL DEFAULT \'1\',
`date_created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`isCurrentlyOnline` TINYINT(1) DEFAULT \'0\',
`about` TEXT NOT NULL,
`lastLogin` DATETIME NOT NULL,
`language` VARCHAR(10) DEFAULT \'DE\',
`country` VARCHAR(2) DEFAULT NULL,
`gender` VARCHAR(10) DEFAULT NULL,
`receiveEmails` TINYINT(1) NOT NULL DEFAULT \'1\',
`receiveNewsletter` TINYINT(1) NOT NULL DEFAULT \'1\',
`forget_password_key` VARCHAR(256) DEFAULT NULL,
`isDeleted` TINYINT(1) DEFAULT \'0\',
UNIQUE KEY `id` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1');
// Users History Table
$this->db->query('CREATE TABLE IF NOT EXISTS `users_history` (
`changeID` INT(11) NOT NULL AUTO_INCREMENT,
`changeDate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ID` INT(11) NOT NULL,
`username` VARCHAR(25) NOT NULL,
`displayname` VARCHAR(25) NOT NULL,
`email` TEXT NOT NULL,
`rank` INT(11) NOT NULL,
`profile_picture` TEXT NOT NULL,
`header_image` TEXT,
`social_networks` TEXT,
`showAds` TINYINT(1) NOT NULL DEFAULT \'1\',
`about` TEXT NOT NULL,
`language` VARCHAR(10) DEFAULT \'DE\',
`country` VARCHAR(2) DEFAULT NULL,
`gender` VARCHAR(10) DEFAULT NULL,
`receiveEmails` TINYINT(1) NOT NULL DEFAULT \'1\',
`receiveNewsletter` TINYINT(1) NOT NULL DEFAULT \'1\',
UNIQUE KEY `changeID` (`changeID`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1');
// Blog Categories Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_categories` (
`ID` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(25) NOT NULL,
`display_name` VARCHAR(50) NOT NULL,
PRIMARY KEY (`ID`), PRIMARY KEY (`ID`),
UNIQUE KEY `blog_categories_name_display_name_uindex` (`name`, `display_name`) UNIQUE KEY `blog_categories_name_display_name_uindex` (`name`, `display_name`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1'); ) ENGINE = InnoDB DEFAULT CHARSET = latin1;");
// Blog Comments Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_comments` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_comments` (
`ID` INT(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
`post_id` INT(11) NOT NULL, `post_id` int(11) NOT NULL,
`user_id` INT(11) NOT NULL, `user_id` int(11) NOT NULL,
`comment` TEXT NOT NULL, `comment` text NOT NULL,
`date_created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`like_count` INT(11) NOT NULL, `like_count` int(11) NOT NULL,
`reply` TINYINT(1) NOT NULL DEFAULT \'0\', `reply` tinyint(1) NOT NULL DEFAULT '0',
`replyTo_id` INT(11) DEFAULT NULL, `replyTo_id` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
// Blog Content Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_content` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_content` (
`contentID` INT(11) NOT NULL AUTO_INCREMENT, `contentID` int(11) NOT NULL AUTO_INCREMENT,
`postID` INT(11) NOT NULL, `postID` int(11) NOT NULL,
`contentDate` DATETIME NOT NULL, `contentDate` datetime NOT NULL,
`content` MEDIUMTEXT NOT NULL, `content` mediumtext COLLATE utf8mb4_bin NOT NULL,
`contentAuthorID` INT(11) DEFAULT NULL, `contentAuthorID` int(11) DEFAULT NULL,
`isNativePost` TINYINT(1) NOT NULL, `isNativePost` tinyint(1) NOT NULL,
`isActive` TINYINT(1) NOT NULL, `isActive` tinyint(1) NOT NULL,
`versionMessage` VARCHAR(300) NOT NULL, `versionMessage` varchar(300) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`language` VARCHAR(10) DEFAULT NULL, `language` varchar(10) CHARACTER SET latin1 DEFAULT NULL,
`wordCount` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`contentID`) PRIMARY KEY (`contentID`)
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// Blog Posts Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_posts` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_posts` (
`postID` INT(11) NOT NULL AUTO_INCREMENT, `postID` int(11) NOT NULL AUTO_INCREMENT,
`postUrl` VARCHAR(300) NOT NULL, `postUrl` varchar(300) CHARACTER SET latin1 DEFAULT NULL,
`postTitle` VARCHAR(255) DEFAULT NULL, `postPublishDate` datetime DEFAULT NULL,
`postDesc` TEXT, `postLastEdit` datetime DEFAULT NULL,
`postPublishDate` DATETIME DEFAULT NULL, `postAuthorID` int(11) DEFAULT NULL,
`postLastEdit` DATETIME DEFAULT NULL, `postImage` text CHARACTER SET latin1,
`postAuthorID` INT(11) DEFAULT NULL, `postState` varchar(50) CHARACTER SET latin1 NOT NULL,
`postImage` TEXT NOT NULL, `postViews` int(11) NOT NULL DEFAULT '0',
`postState` VARCHAR(50) NOT NULL, `postCategoryID` int(11) NOT NULL,
`postViews` INT(11) NOT NULL DEFAULT \'0\', `postIsDeleted` tinyint(1) NOT NULL DEFAULT '0',
`postCategoryID` INT(11) NOT NULL, `postDeletedDate` datetime DEFAULT NULL,
`postIsDeleted` TINYINT(1) NOT NULL DEFAULT \'0\',
`postDeletedDate` DATETIME DEFAULT NULL,
PRIMARY KEY (`postID`) PRIMARY KEY (`postID`)
) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// Blog Post Likes Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_post_likes` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_post_likes` (
`post_id` int(11) NOT NULL, `post_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL, `user_id` int(11) NOT NULL,
PRIMARY KEY (`post_id`, `user_id`), PRIMARY KEY (`post_id`, `user_id`),
KEY `fk_post_likes_user` (`user_id`), KEY `fk_post_likes_user` (`user_id`),
CONSTRAINT `fk_post_likes_post` FOREIGN KEY (`post_id`) REFERENCES `blog_posts` (`postID`), CONSTRAINT `fk_post_likes_post` FOREIGN KEY (`post_id`) REFERENCES `blog_posts` (`postID`),
CONSTRAINT `fk_post_likes_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`ID`) CONSTRAINT `fk_post_likes_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
// Blog Post Tags Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_post_tags` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_post_tags` (
`post_id` INT(11) NOT NULL, `post_id` int(11) NOT NULL,
`tag_id` INT(11) NOT NULL, `tag_id` int(11) NOT NULL,
PRIMARY KEY (`post_id`, `tag_id`) PRIMARY KEY (`post_id`, `tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
// Blog States Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_states` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_states` (
`ID` INT(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(15) NOT NULL, `name` varchar(15) NOT NULL,
`display_name` VARCHAR(15) NOT NULL, `display_name` varchar(15) NOT NULL,
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
// Blog Tags Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_tags` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_tags` (
`ID` INT(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(25) NOT NULL, `name` varchar(25) NOT NULL,
`display_name` VARCHAR(50) NOT NULL, `display_name` varchar(50) NOT NULL,
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
// Blog Translations Table
$this->db->query('CREATE TABLE IF NOT EXISTS `blog_translations` ( $this->db->query("CREATE TABLE IF NOT EXISTS `blog_translations` (
`postID` INT(11) DEFAULT NULL, `postTranslationID` int(11) NOT NULL AUTO_INCREMENT,
`language` VARCHAR(10) DEFAULT \'en\', `postID` int(11) NOT NULL,
`postTitle` VARCHAR(255) DEFAULT NULL, `language` varchar(5) COLLATE utf8mb4_bin NOT NULL DEFAULT 'de',
`postDesc` TEXT, `postTitle` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
UNIQUE KEY `blog_translations_language_uindex` (`language`), `postDesc` text COLLATE utf8mb4_bin,
UNIQUE KEY `blog_translations_postID_uindex` (`postID`) PRIMARY KEY (`postTranslationID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
// Collections Table
$this->db->query('CREATE TABLE IF NOT EXISTS `collections` ( $this->db->query("CREATE TABLE IF NOT EXISTS `calendar` (
`ID` INT(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`collection` TEXT NOT NULL, `title` varchar(300) NOT NULL,
`displayname` TEXT NOT NULL, `allDay` tinyint(1) NOT NULL,
`displaynameEnglish` TEXT NOT NULL, `start` varchar(20) NOT NULL,
`displaynameFrench` TEXT NOT NULL, `end` varchar(20) NOT NULL,
`url` text NOT NULL,
`overlap` tinyint(1) NOT NULL,
`color` text NOT NULL,
`textColor` text NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
// Portfolio Table
$this->db->query('CREATE TABLE IF NOT EXISTS `portfolio` ( $this->db->query("CREATE TABLE IF NOT EXISTS `feedback` (
`ID` INT(11) NOT NULL AUTO_INCREMENT, `ID` int(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL, `page` varchar(100) CHARACTER SET latin1 DEFAULT NULL,
`datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, `message` text COLLATE utf8mb4_bin,
`source` TEXT NOT NULL, `datetime` datetime DEFAULT CURRENT_TIMESTAMP,
`isDownloadable` TINYINT(1) NOT NULL DEFAULT \'0\', `anonymous` tinyint(1) DEFAULT '1',
`isOpenSource` TINYINT(1) NOT NULL DEFAULT \'0\', `userID` int(11) DEFAULT NULL,
`title` TEXT NOT NULL, `email` varchar(50) CHARACTER SET latin1 DEFAULT NULL,
`titleEnglish` TEXT NOT NULL, `feedbackState` int(11) NOT NULL DEFAULT '0',
`titleFrench` TEXT NOT NULL, `lastStateUpdate` datetime DEFAULT NULL,
`headline` TEXT NOT NULL, `feedbackStatusMessage` text COLLATE utf8mb4_bin,
`headlineEnglish` TEXT NOT NULL, `supporterID` int(11) DEFAULT NULL,
`headlineFrench` TEXT NOT NULL, PRIMARY KEY (`ID`)
`description` TEXT NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
`descriptionEnglish` TEXT NOT NULL,
`descriptionFrench` TEXT NOT NULL, $this->db->query("CREATE TABLE IF NOT EXISTS `feedback_archive` (
PRIMARY KEY (`ID`), `ID` int(11) NOT NULL AUTO_INCREMENT,
UNIQUE KEY `name` (`name`) `page` varchar(100) CHARACTER SET latin1 DEFAULT NULL,
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1'); `message` text COLLATE utf8mb4_bin,
// Project Categories Table `datetime` datetime DEFAULT CURRENT_TIMESTAMP,
$this->db->query('CREATE TABLE IF NOT EXISTS `project_categories` ( `anonymous` tinyint(1) DEFAULT '1',
`projectID` INT(11) NOT NULL, `userID` int(11) DEFAULT NULL,
`categoryID` INT(11) NOT NULL `email` varchar(50) CHARACTER SET latin1 DEFAULT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=latin1'); `feedbackState` int(11) NOT NULL DEFAULT '0',
// Social Posts Table `feedbackStatusMessage` text COLLATE utf8mb4_bin,
$this->db->query('CREATE TABLE IF NOT EXISTS `social_posts` ( `supporterID` int(11) DEFAULT NULL,
`post_id` INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`ID`)
`post_plattform` VARCHAR(20) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
`post_content` TEXT NOT NULL,
`post_url` VARCHAR(75) NOT NULL, $this->db->query("CREATE TABLE IF NOT EXISTS `feedback_states` (
`post_author` VARCHAR(20) NOT NULL, `ID` int(11) NOT NULL AUTO_INCREMENT,
`post_author_url` TEXT NOT NULL, `name` varchar(50) NOT NULL,
`post_date` INT(11) NOT NULL, `displayname` text NOT NULL,
`post_img_source` TEXT, PRIMARY KEY (`ID`)
`post_original_id` BIGINT(20) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `files` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`original_name` varchar(50) NOT NULL,
`type` varchar(30) NOT NULL,
`size` int(11) NOT NULL,
`path` varchar(300) NOT NULL,
`uploadDate` datetime DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `notifications` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`recipientID` int(11) NOT NULL,
`senderID` int(11) NOT NULL,
`unread` tinyint(1) NOT NULL,
`type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`referenceID` int(11) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`parameters` text COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$this->db->query("CREATE TABLE IF NOT EXISTS `projects` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET latin1 DEFAULT NULL,
`datetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`source` text CHARACTER SET latin1,
`isDownloadable` tinyint(1) NOT NULL DEFAULT '0',
`downloadLink` text COLLATE utf8mb4_bin,
`isOpenSource` tinyint(1) NOT NULL DEFAULT '0',
`openSourceLink` text COLLATE utf8mb4_bin,
`customLink` text COLLATE utf8mb4_bin,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
$this->db->query("CREATE TABLE IF NOT EXISTS `projects_categories` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`collection` text NOT NULL,
`displayname` text NOT NULL,
`displaynameEnglish` text NOT NULL,
`displaynameFrench` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `projects_entry_categories` (
`projectID` int(11) NOT NULL,
`categoryID` int(11) NOT NULL,
PRIMARY KEY (`projectID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `projects_entry_votes` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`projectID` int(11) NOT NULL,
`userID` int(11) NOT NULL,
`type` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `projects_translations` (
`translationID` int(11) NOT NULL AUTO_INCREMENT,
`projectID` int(11) NOT NULL,
`title` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`description` text COLLATE utf8mb4_unicode_ci,
`content` text COLLATE utf8mb4_unicode_ci,
`downloadName` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`openSourceName` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`customLinkName` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`lang` varchar(2) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`translationID`),
UNIQUE KEY `projectID` (`projectID`, `lang`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$this->db->query("CREATE TABLE IF NOT EXISTS `redirects` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`redirect` text NOT NULL,
`url` text NOT NULL,
`temporary` tinyint(1) NOT NULL,
`expireDate` datetime DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `social_posts` (
`post_id` int(11) NOT NULL AUTO_INCREMENT,
`post_plattform` varchar(20) CHARACTER SET latin1 NOT NULL,
`post_content` text COLLATE utf8mb4_bin NOT NULL,
`post_url` varchar(75) CHARACTER SET latin1 NOT NULL,
`post_author` varchar(20) CHARACTER SET latin1 NOT NULL,
`post_author_url` text CHARACTER SET latin1 NOT NULL,
`post_date` int(11) NOT NULL,
`post_img_source` text CHARACTER SET latin1,
`post_original_id` bigint(20) NOT NULL,
PRIMARY KEY (`post_id`), PRIMARY KEY (`post_id`),
UNIQUE KEY `post_url` (`post_url`) UNIQUE KEY `post_url` (`post_url`)
) ENGINE=InnoDB AUTO_INCREMENT=5474 DEFAULT CHARSET=latin1'); ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
$this->db->query("CREATE TABLE IF NOT EXISTS `users` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`original_name` varchar(25) COLLATE utf8mb4_bin NOT NULL,
`username` varchar(25) COLLATE utf8mb4_bin NOT NULL,
`displayname` varchar(25) COLLATE utf8mb4_bin NOT NULL,
`login_method` int(11) DEFAULT '0',
`password` mediumtext COLLATE utf8mb4_bin,
`email` mediumtext COLLATE utf8mb4_bin NOT NULL,
`rank` mediumtext COLLATE utf8mb4_bin NOT NULL,
`profile_picture` mediumtext COLLATE utf8mb4_bin NOT NULL,
`header_image` mediumtext COLLATE utf8mb4_bin,
`social_networks` mediumtext COLLATE utf8mb4_bin,
`is_activated` tinyint(1) NOT NULL,
`activation_key` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL,
`showAds` tinyint(1) NOT NULL DEFAULT '1',
`date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`isCurrentlyOnline` tinyint(1) DEFAULT '0',
`lastOnlineUpdate` datetime DEFAULT NULL,
`about` mediumtext COLLATE utf8mb4_bin NOT NULL,
`lastLogin` datetime NOT NULL,
`language` varchar(10) COLLATE utf8mb4_bin DEFAULT 'DE',
`country` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL,
`gender` varchar(10) COLLATE utf8mb4_bin DEFAULT NULL,
`birthdate` mediumtext COLLATE utf8mb4_bin,
`birthyear` int(11) DEFAULT NULL,
`receiveEmails` tinyint(1) NOT NULL DEFAULT '1',
`receiveNewsletter` tinyint(1) NOT NULL DEFAULT '1',
`forget_password_key` varchar(256) COLLATE utf8mb4_bin DEFAULT NULL,
`isDeleted` tinyint(1) DEFAULT '0',
UNIQUE KEY `id` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
$this->db->query("CREATE TABLE IF NOT EXISTS `users_history` (
`changeID` int(11) NOT NULL AUTO_INCREMENT,
`changeDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`ID` int(11) NOT NULL,
`username` varchar(25) NOT NULL,
`displayname` varchar(25) NOT NULL,
`email` text NOT NULL,
`rank` int(11) NOT NULL,
`profile_picture` text NOT NULL,
`header_image` text,
`social_networks` text,
`showAds` tinyint(1) NOT NULL DEFAULT '1',
`about` text NOT NULL,
`language` varchar(10) DEFAULT 'DE',
`country` varchar(2) DEFAULT NULL,
`gender` varchar(10) DEFAULT NULL,
`birthdate` text,
`birthyear` int(11) DEFAULT NULL,
`receiveEmails` tinyint(1) NOT NULL DEFAULT '1',
`receiveNewsletter` tinyint(1) NOT NULL DEFAULT '1',
UNIQUE KEY `changeID` (`changeID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_followers` (
`followedUserID` int(11) NOT NULL,
`followerUserID` int(11) NOT NULL,
`followedSince` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_posts` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`uuid` varchar(32) CHARACTER SET latin1 NOT NULL,
`user_id` int(11) DEFAULT NULL,
`content` text CHARACTER SET utf8 COLLATE utf8_bin,
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lastEditDate` datetime DEFAULT NULL,
`reply_to` int(11) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `user_posts_ID_uindex` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_posts_hashtags` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`userID` int(11) NOT NULL,
`postID` int(11) NOT NULL,
`hashtag` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`position` int(11) NOT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `user_posts_hashtags_ID_uindex` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_posts_likes` (
`postID` int(11) NOT NULL,
`likedUserID` int(11) NOT NULL,
`likerUserID` int(11) NOT NULL,
PRIMARY KEY (`postID`,`likerUserID`),
UNIQUE KEY `postID_2` (`postID`,`likerUserID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_posts_media` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`postID` int(11) NOT NULL,
`mediaType` varchar(50) NOT NULL,
`mediaUrl` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_posts_mentions` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`userID` int(11) NOT NULL,
`postID` int(11) NOT NULL,
`mentionedUserID` int(11) NOT NULL,
`position` int(11) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
$this->db->query("CREATE TABLE IF NOT EXISTS `user_posts_reports` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`postID` int(11) NOT NULL,
`reason` varchar(255) NOT NULL,
`reasonText` text NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;");
} }
public function fillBlogDb() { private function addIndices() {
$this->db->query("ALTER TABLE `blog_comments`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `blog_content`
ADD PRIMARY KEY (`contentID`);");
$this->db->query("ALTER TABLE `blog_posts`
ADD PRIMARY KEY (`postID`);");
$this->db->query("ALTER TABLE `blog_post_likes`
ADD PRIMARY KEY (`post_id`,`user_id`),
ADD KEY `fk_post_likes_user` (`user_id`);");
$this->db->query("ALTER TABLE `blog_post_tags`
ADD PRIMARY KEY (`post_id`,`tag_id`);");
$this->db->query("ALTER TABLE `blog_states`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `blog_tags`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `blog_translations`
ADD PRIMARY KEY (`postTranslationID`);");
$this->db->query("ALTER TABLE `calendar`
ADD PRIMARY KEY (`id`);");
$this->db->query("ALTER TABLE `feedback`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `feedback_archive`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `feedback_states`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `files`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `notifications`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects_categories`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects_entry_votes`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects_translations`
ADD PRIMARY KEY (`translationID`),
ADD UNIQUE KEY `projectID` (`projectID`,`lang`);");
$this->db->query("ALTER TABLE `redirects`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `social_posts`
ADD PRIMARY KEY (`post_id`),
ADD UNIQUE KEY `post_url` (`post_url`);");
$this->db->query("ALTER TABLE `users`
ADD UNIQUE KEY `id` (`ID`);");
$this->db->query("ALTER TABLE `users_history`
ADD UNIQUE KEY `changeID` (`changeID`);");
$this->db->query("ALTER TABLE `user_posts`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `user_posts_ID_uindex` (`ID`);");
$this->db->query("ALTER TABLE `user_posts_hashtags`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `user_posts_hashtags_ID_uindex` (`ID`);");
$this->db->query("ALTER TABLE `user_posts_likes`
ADD PRIMARY KEY (`postID`,`likerUserID`),
ADD UNIQUE KEY `postID_2` (`postID`,`likerUserID`);");
$this->db->query("ALTER TABLE `user_posts_media`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `user_posts_mentions`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `user_posts_reports`
ADD PRIMARY KEY (`ID`);");$this->db->query("ALTER TABLE `blog_categories`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `blog_categories_name_display_name_uindex` (`name`,`display_name`);");
$this->db->query("ALTER TABLE `blog_comments`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `blog_content`
ADD PRIMARY KEY (`contentID`);");
$this->db->query("ALTER TABLE `blog_posts`
ADD PRIMARY KEY (`postID`);");
$this->db->query("ALTER TABLE `blog_post_likes`
ADD PRIMARY KEY (`post_id`,`user_id`),
ADD KEY `fk_post_likes_user` (`user_id`);");
$this->db->query("ALTER TABLE `blog_post_tags`
ADD PRIMARY KEY (`post_id`,`tag_id`);");
$this->db->query("ALTER TABLE `blog_states`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `blog_tags`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `blog_translations`
ADD PRIMARY KEY (`postTranslationID`);");
$this->db->query("ALTER TABLE `calendar`
ADD PRIMARY KEY (`id`);");
$this->db->query("ALTER TABLE `feedback`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `feedback_archive`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `feedback_states`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `files`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `notifications`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects_categories`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects_entry_votes`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `projects_translations`
ADD PRIMARY KEY (`translationID`),
ADD UNIQUE KEY `projectID` (`projectID`,`lang`);");
$this->db->query("ALTER TABLE `redirects`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `social_posts`
ADD PRIMARY KEY (`post_id`),
ADD UNIQUE KEY `post_url` (`post_url`);");
$this->db->query("ALTER TABLE `users`
ADD UNIQUE KEY `id` (`ID`);");
$this->db->query("ALTER TABLE `users_history`
ADD UNIQUE KEY `changeID` (`changeID`);");
$this->db->query("ALTER TABLE `user_posts`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `user_posts_ID_uindex` (`ID`);");
$this->db->query("ALTER TABLE `user_posts_hashtags`
ADD PRIMARY KEY (`ID`),
ADD UNIQUE KEY `user_posts_hashtags_ID_uindex` (`ID`);");
$this->db->query("ALTER TABLE `user_posts_likes`
ADD PRIMARY KEY (`postID`,`likerUserID`),
ADD UNIQUE KEY `postID_2` (`postID`,`likerUserID`);");
$this->db->query("ALTER TABLE `user_posts_media`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `user_posts_mentions`
ADD PRIMARY KEY (`ID`);");
$this->db->query("ALTER TABLE `user_posts_reports`
ADD PRIMARY KEY (`ID`);");
}
private function addAutoIncrements() {
$this->db->query("ALTER TABLE `blog_categories`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;");
$this->db->query("ALTER TABLE `blog_comments`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;");
$this->db->query("ALTER TABLE `blog_content`
MODIFY `contentID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89;");
$this->db->query("ALTER TABLE `blog_posts`
MODIFY `postID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=98;");
$this->db->query("ALTER TABLE `blog_states`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;");
$this->db->query("ALTER TABLE `blog_tags`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=61;");
$this->db->query("ALTER TABLE `blog_translations`
MODIFY `postTranslationID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;");
$this->db->query("ALTER TABLE `calendar`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;");
$this->db->query("ALTER TABLE `feedback`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;");
$this->db->query("ALTER TABLE `feedback_archive`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;");
$this->db->query("ALTER TABLE `files`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=125;");
$this->db->query("ALTER TABLE `notifications`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=74;");
$this->db->query("ALTER TABLE `projects`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=64;");
$this->db->query("ALTER TABLE `projects_categories`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;");
$this->db->query("ALTER TABLE `projects_entry_votes`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=260;");
$this->db->query("ALTER TABLE `projects_translations`
MODIFY `translationID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;");
$this->db->query("ALTER TABLE `redirects`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=47;");
$this->db->query("ALTER TABLE `social_posts`
MODIFY `post_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=484298;");
$this->db->query("ALTER TABLE `users`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;");
$this->db->query("ALTER TABLE `users_history`
MODIFY `changeID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=35;");
$this->db->query("ALTER TABLE `user_posts`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=209;");
$this->db->query("ALTER TABLE `user_posts_hashtags`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;");
$this->db->query("ALTER TABLE `user_posts_media`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;");
$this->db->query("ALTER TABLE `user_posts_mentions`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;");
$this->db->query("ALTER TABLE `user_posts_reports`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;");
}
private function addConstraints() {
$this->db->query("ALTER TABLE `blog_post_likes`
ADD CONSTRAINT `fk_post_likes_post` FOREIGN KEY (`post_id`) REFERENCES `blog_posts` (`postID`),
ADD CONSTRAINT `fk_post_likes_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`ID`);");
}
private function fillBlogTables()
{
if ($this->db->query('SELECT COUNT(*) count FROM blog_categories')->result_array()[0]['count'] == 0) { if ($this->db->query('SELECT COUNT(*) count FROM blog_categories')->result_array()[0]['count'] == 0) {
$this->db->query("INSERT INTO `blog_categories` (`ID`, `name`, `display_name`) VALUES $this->db->query("INSERT INTO `blog_categories` (`ID`, `name`, `display_name`) VALUES
(1, 'design', 'Design'), (1, 'design', 'Design'),
@ -323,12 +698,6 @@ class DatabaseModel extends CI_Model
(15, 'photography', 'Fotografie'), (15, 'photography', 'Fotografie'),
(16, 'videos', 'Videos & Filmen'), (16, 'videos', 'Videos & Filmen'),
(17, 'learning', 'Lernen'), (17, 'learning', 'Lernen'),
(28, '', ''),
(29, 'test', 'test'),
(30, 'kacke', 'kacke'),
(31, 'asdfla', 'asdfla'),
(32, 'admin', 'Admin'),
(33, 'tset', 'tset'),
(34, 'programmiersprachen', 'Programmiersprachen'), (34, 'programmiersprachen', 'Programmiersprachen'),
(35, 'sprachen', 'Sprachen'), (35, 'sprachen', 'Sprachen'),
(36, 'serie', 'Serie'), (36, 'serie', 'Serie'),
@ -337,17 +706,25 @@ class DatabaseModel extends CI_Model
(39, 'kingofdog', 'KingOfDog'), (39, 'kingofdog', 'KingOfDog'),
(40, 'entwicklung', 'Entwicklung'), (40, 'entwicklung', 'Entwicklung'),
(41, 'programmierung', 'Programmierung'), (41, 'programmierung', 'Programmierung'),
(42, 'webseite', 'Webseite'), (42, 'webseite', 'Webseite')");
(43, 'posts', 'Posts'),
(44, 'post', 'Post'),
(45, 'system', 'System'),
(46, 'nutzer', 'Nutzer'),
(47, 'user', 'User'),
(48, 'php', 'PHP')");
} }
} }
public function fillMainDb() { private function fillFeedbackTable() {
if($this->db->query('SELECT COUNT(*) count FROM redirects')->result_array()[0]['count'] == 0) {
$this->db->query("INSERT INTO `feedback_states` (`ID`, `name`, `displayname`) VALUES
(0, 'new', 'ungelesen'),
(1, 'read', 'gelesen'),
(2, 'question', 'Rückfrage'),
(5, 'fixing', 'in Bearbeitung'),
(7, 'paused', 'pausiert'),
(10, 'closed', 'geschlossen'),
(15, 'fixed', 'geschlossen & gelöst');");
}
}
private function fillMainTable()
{
if ($this->db->query('SELECT COUNT(*) count FROM redirects')->result_array()[0]['count'] == 0) { if ($this->db->query('SELECT COUNT(*) count FROM redirects')->result_array()[0]['count'] == 0) {
$this->db->query("INSERT INTO `redirects` (`ID`, `date`, `redirect`, `url`, `temporary`, `expireDate`) VALUES $this->db->query("INSERT INTO `redirects` (`ID`, `date`, `redirect`, `url`, `temporary`, `expireDate`) VALUES
(1, '2016-10-15 18:09:51', 'yt', 'http://youtube.com/KingOfDog', 0, '0000-00-00 00:00:00'), (1, '2016-10-15 18:09:51', 'yt', 'http://youtube.com/KingOfDog', 0, '0000-00-00 00:00:00'),
@ -357,7 +734,8 @@ class DatabaseModel extends CI_Model
} }
} }
public function fillPortfolioDb() { private function fillProjectsTable()
{
if ($this->db->query('SELECT COUNT(*) count FROM projects_categories')->result_array()[0]['count'] == 0) { if ($this->db->query('SELECT COUNT(*) count FROM projects_categories')->result_array()[0]['count'] == 0) {
$this->db->query("INSERT INTO `projects_categories` (`ID`, `collection`, `displayname`, `displaynameEnglish`, `displaynameFrench`) VALUES $this->db->query("INSERT INTO `projects_categories` (`ID`, `collection`, `displayname`, `displaynameEnglish`, `displaynameFrench`) VALUES
(1, 'banner', 'Banner', 'Banner', 'Bannière'), (1, 'banner', 'Banner', 'Banner', 'Bannière'),

View File

@ -11,9 +11,13 @@ class FileModel extends CI_Model
parent::__construct(); parent::__construct();
} }
public function uploadFile($original_name, $tmpname, $size, $type) private function getPath($fileName, $userContent) {
return 'files/' . ($userContent ? 'userContent/' : '') . $fileName;
}
public function uploadFile($original_name, $tmpname, $size, $type, $userContent = true)
{ {
$target_dir = "files" . DIRECTORY_SEPARATOR; $target_dir = "files" . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
$filetype = pathinfo(basename($original_name), PATHINFO_EXTENSION); $filetype = pathinfo(basename($original_name), PATHINFO_EXTENSION);
$target_file = $target_dir . $this->generateName() . '.' . $filetype; $target_file = $target_dir . $this->generateName() . '.' . $filetype;
$name = explode('.' . $filetype, explode(DIRECTORY_SEPARATOR, $target_file)[1])[0]; $name = explode('.' . $filetype, explode(DIRECTORY_SEPARATOR, $target_file)[1])[0];
@ -22,13 +26,13 @@ class FileModel extends CI_Model
die('File couldn\'t be uploaded!'); die('File couldn\'t be uploaded!');
} }
$this->db->query('INSERT INTO files (name, original_name, type, size, path) VALUES (?, ?, ?, ?, ?)', [$name, $original_name, $type, $size, $target_file]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $type, $size, $target_file, $userContent]);
return "/file/open/" . $name; return "/f/" . $name;
} }
public function uploadImage($name, $max_size, $originalname, $max_width) { public function uploadImage($name, $max_size, $originalname, $max_width, $userContent = true) {
$config['upload_path'] = './files/'; $config['upload_path'] = '.' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
$config['allowed_types'] = 'gif|jpg|png'; $config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = $max_size; $config['max_size'] = $max_size;
$config['file_name'] = $this->generateName() . "." . pathinfo(basename($originalname), PATHINFO_EXTENSION); $config['file_name'] = $this->generateName() . "." . pathinfo(basename($originalname), PATHINFO_EXTENSION);
@ -50,13 +54,65 @@ class FileModel extends CI_Model
$this->image_lib->resize(); $this->image_lib->resize();
$this->db->query('INSERT INTO files (name, original_name, type, size, path) VALUES (?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, 'files/' . $data['file_name']]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, $this->getPath($data['file_name'], $userContent), $userContent]);
return '/f/' . $data['raw_name']; return '/f/' . $data['raw_name'];
} }
} }
public function uploadFileByContent($content, $original_name, $fullType, $fileSize) { public function uploadCroppedImage($name, $max_size, $originalname, $width, $height, $userContent = true) {
$target_dir = "files" . DIRECTORY_SEPARATOR; $config['upload_path'] = '.' . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = $max_size;
$config['file_name'] = $this->generateName() . "." . pathinfo(basename($originalname), PATHINFO_EXTENSION);
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload($name)) {
return null;
} else {
$data = $this->upload->data();
// Resize
$config['image_library'] = 'gd2';
$config['source_image'] = $data['full_path'];
$config['maintain_ratio'] = TRUE;
$size = getimagesize($data['full_path']);
if($size[0] > $size[1]) {
$config['height'] = $height;
} else {
$config['width'] = $width;
}
$this->load->library('image_lib');
$this->image_lib->initialize($config);
$this->image_lib->resize();
$config['source_image'] = $config['upload_path'] . $config['file_name'];
$config['maintain_ratio'] = FALSE;
$config['height'] = $height;
$config['width'] = $width;
$size = getimagesize($config['source_image']);
if($size[0] > $size[1]) {
$config['x_axis'] = ($size[0] - $width) / 2;
} else {
$config['y_axis'] = ($size[1] - $height) / 2;
}
$this->image_lib->clear();
$this->image_lib->initialize($config);
$this->image_lib->crop();
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$data['raw_name'], $originalname, $data['file_type'], $data['file_size'] * 1024, $this->getPath($data['file_name'], $userContent), $userContent]);
return '/f/' . $data['raw_name'];
}
}
public function uploadFileByContent($content, $original_name, $fullType, $fileSize, $userContent = true) {
$target_dir = "files" . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
$filetype = pathinfo(basename($original_name), PATHINFO_EXTENSION); $filetype = pathinfo(basename($original_name), PATHINFO_EXTENSION);
$target_file = $target_dir . $this->generateName() . '.' . $filetype; $target_file = $target_dir . $this->generateName() . '.' . $filetype;
$name = explode('.' . $filetype, explode(DIRECTORY_SEPARATOR, $target_file)[1])[0]; $name = explode('.' . $filetype, explode(DIRECTORY_SEPARATOR, $target_file)[1])[0];
@ -65,7 +121,7 @@ class FileModel extends CI_Model
fwrite($fp, $content); fwrite($fp, $content);
fclose($fp); fclose($fp);
$this->db->query('INSERT INTO files (name, original_name, type, size, path) VALUES (?, ?, ?, ?, ?)', [$name, $original_name, $fullType, $fileSize, $target_file]); $this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $fullType, $fileSize, $target_file, $userContent]);
return '/f/' . $name; return '/f/' . $name;
} }

View File

@ -69,6 +69,20 @@ class LoginModel extends CI_Model
} }
} }
public function reloadLoginSession($logindata) {
$_SESSION['user']['displayname'] = $logindata['displayname'];
$_SESSION['user']['username'] = $logindata['username'];
$_SESSION['user']['rank'] = $logindata['rank'];
$_SESSION['user']['ID'] = $logindata['ID'];
$_SESSION['user']['ads'] = $logindata['showAds'];
$profilePic = $logindata['profile_picture'];
if (empty($profilePic)) {
$_SESSION['user']['profilePic'] = '/assets/images/steam.jpg';
} else {
$_SESSION['user']['profilePic'] = $profilePic;
}
}
public function getUserHash($username, $password, $email, $id) public function getUserHash($username, $password, $email, $id)
{ {
$hash = hash('sha256', $id . '//' . $username . '//' . substr($password, 0, 5) . '//' . substr($email, 0, 5)); $hash = hash('sha256', $id . '//' . $username . '//' . substr($password, 0, 5) . '//' . substr($email, 0, 5));

View File

@ -229,10 +229,18 @@
} }
private function mergeReplyData($post) { private function mergeReplyData($post) {
$data = $this->db->query('SELECT uuid, username, displayname FROM user_posts LEFT JOIN users ON users.ID = user_posts.user_id WHERE user_posts.ID = ?', [$post['reply_to']])->result_array(); $data = $this->db->query('SELECT p.*, username, displayname FROM user_posts p LEFT JOIN users ON users.ID = p.user_id WHERE p.ID = ?', [$post['reply_to']])->result_array();
$post['replyToUuid'] = $data[0]['uuid']; $data = $this->preparePostList($data);
$post['replyToUsername'] = $data[0]['username']; if(!empty($data)) {
$post['replyToDisplayname'] = $data[0]['displayname']; $post['replyToPost'] = $data[0];
} else {
$post['replyToPost'] = [
'username' => '',
'displayname' => '',
'content' => 'Nicht existent',
'date' => '',
];
}
return $post; return $post;
} }

View File

@ -1,14 +1,17 @@
<?php <?php
defined('BASEPATH') OR exit('No direct script access allowed'); defined('BASEPATH') OR exit('No direct script access allowed');
class ProjectsModel extends CI_Model { class ProjectsModel extends CI_Model
{
public function __construct() { public function __construct()
{
parent::__construct(); parent::__construct();
$this->load->model('projectsModel', '', TRUE); $this->load->model('projectsModel', '', TRUE);
} }
public function getEntries($category) { public function getEntries($category)
{
if ($category !== 'all') { if ($category !== 'all') {
$content = $this->db->query('SELECT *, (SELECT (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = p.ID AND type = 1) - (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = p.ID AND type = -1)) voteCount FROM projects p WHERE ID IN (SELECT projectID FROM projects_entry_categories WHERE categoryID = ?) ORDER BY datetime DESC', [$category])->result_array(); $content = $this->db->query('SELECT *, (SELECT (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = p.ID AND type = 1) - (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = p.ID AND type = -1)) voteCount FROM projects p WHERE ID IN (SELECT projectID FROM projects_entry_categories WHERE categoryID = ?) ORDER BY datetime DESC', [$category])->result_array();
} else { } else {
@ -20,32 +23,60 @@ class ProjectsModel extends CI_Model {
return $content; return $content;
} }
public function getCategories() { public function mergeTranslationData($postList, $lang = 'de')
{
foreach ($postList as $i => $post) {
$data = $this->db->query('SELECT * FROM projects_translations WHERE projectID = ? AND (lang = ? OR lang = ?) ORDER BY lang', [$post['ID'], 'de', $lang])->result_array();
if (sizeof($data) == 1) {
$postList[$i] = array_merge($post, $data[0]);
continue;
}
$merged = [];
foreach ($data[0] as $key => $value) {
if (($value == NULL && $data[1][$key] == NULL) || ($value != NULL && $data[1][$key] == NULL)) {
$merged[$key] = $value;
} else {
$merged[$key] = $data[1][$key];
}
}
$postList[$i] = array_merge($post, $merged);
}
return $postList;
}
public function getCategories()
{
$collections = $this->db->query('SELECT c.*, count(p.projectID) count FROM projects_categories c LEFT JOIN projects_entry_categories p ON c.ID = p.categoryID GROUP BY c.ID ORDER BY c.collection')->result_array(); $collections = $this->db->query('SELECT c.*, count(p.projectID) count FROM projects_categories c LEFT JOIN projects_entry_categories p ON c.ID = p.categoryID GROUP BY c.ID ORDER BY c.collection')->result_array();
return $collections; return $collections;
} }
public function editEntry($data, $id) { public function editEntry($data, $id)
{
$this->db->update('projects', $data, ['id' => $id]); $this->db->update('projects', $data, ['id' => $id]);
$this->db->cache_delete('projects', 'index'); $this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry'); $this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects'); $this->db->cache_delete('admin', 'projects');
} }
public function addEntry($data) { public function addEntry($data)
{
$this->db->insert('projects', $data); $this->db->insert('projects', $data);
$this->db->cache_delete('projects', 'index'); $this->db->cache_delete('projects', 'index');
$this->db->cache_delete('admin', 'projects'); $this->db->cache_delete('admin', 'projects');
} }
public function delete($id) { public function delete($id)
{
$this->db->query('DELETE FROM projects WHERE ID = ? LIMIT 1', [$id]); $this->db->query('DELETE FROM projects WHERE ID = ? LIMIT 1', [$id]);
$this->db->cache_delete('projects', 'index'); $this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry'); $this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects'); $this->db->cache_delete('admin', 'projects');
} }
public function deleteCategory($id) { public function deleteCategory($id)
{
$this->db->query('DELETE FROM projects_entry_categories WHERE categoryID = ?', [$id]); $this->db->query('DELETE FROM projects_entry_categories WHERE categoryID = ?', [$id]);
$this->db->query('DELETE FROM projects_categories WHERE ID = ? LIMIT 1', [$id]); $this->db->query('DELETE FROM projects_categories WHERE ID = ? LIMIT 1', [$id]);
$this->db->cache_delete('projects', 'index'); $this->db->cache_delete('projects', 'index');
@ -53,7 +84,8 @@ class ProjectsModel extends CI_Model {
$this->db->cache_delete('admin', 'projects'); $this->db->cache_delete('admin', 'projects');
} }
public function checkIfExists($id) { public function checkIfExists($id)
{
$result = $this->db->query('SELECT ID FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array(); $result = $this->db->query('SELECT ID FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array();
if (!empty($result)) { if (!empty($result)) {
return true; return true;
@ -62,7 +94,8 @@ class ProjectsModel extends CI_Model {
} }
} }
public function checkIfNameExists($name) { public function checkIfNameExists($name)
{
$result = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array(); $result = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array();
if (!empty($result)) { if (!empty($result)) {
return true; return true;
@ -71,11 +104,13 @@ class ProjectsModel extends CI_Model {
} }
} }
public function getEntry($id) { public function getEntry($id)
{
return $this->db->query('SELECT * FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array(); return $this->db->query('SELECT * FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array();
} }
public function getEntryByName($name, $lang = 'de') { public function getEntryByName($name, $lang = 'de')
{
$result = $this->db->query('SELECT * FROM projects WHERE name = ? LIMIT 1', [$name])->result_array(); $result = $this->db->query('SELECT * FROM projects WHERE name = ? LIMIT 1', [$name])->result_array();
$result = $this->mergeTranslationData($result, $lang); $result = $this->mergeTranslationData($result, $lang);
@ -83,37 +118,43 @@ class ProjectsModel extends CI_Model {
return !empty($result) ? $result[0] : null; return !empty($result) ? $result[0] : null;
} }
public function getEntryCategories($id) { public function getEntryCategories($id)
{
return $this->db->query('SELECT * FROM projects_categories WHERE ID IN (SELECT categoryID FROM projects_entry_categories WHERE projectID = ?)', [$id])->result_array(); return $this->db->query('SELECT * FROM projects_categories WHERE ID IN (SELECT categoryID FROM projects_entry_categories WHERE projectID = ?)', [$id])->result_array();
} }
public function resetEntryCategories($postID) { public function updateCategories($postID, $categories)
$this->db->query('DELETE FROM projects_entry_categories WHERE projectID = ?', $postID); {
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function addCategoryToEntryID($postID, $categoryID) {
$this->db->query('INSERT INTO projects_entry_categories (projectID, categoryID) VALUES (?, ?)', [$postID, $categoryID]);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function updateCategories($postID, $categories) {
$this->resetEntryCategories($postID); $this->resetEntryCategories($postID);
foreach ($categories as $category) { foreach ($categories as $category) {
$this->addCategoryToEntryID($postID, $category); $this->addCategoryToEntryID($postID, $category);
} }
} }
public function addCategoryToEntryName($name, $categoryID) { public function resetEntryCategories($postID)
{
$this->db->query('DELETE FROM projects_entry_categories WHERE projectID = ?', $postID);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function addCategoryToEntryID($postID, $categoryID)
{
$this->db->query('INSERT INTO projects_entry_categories (projectID, categoryID) VALUES (?, ?)', [$postID, $categoryID]);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function addCategoryToEntryName($name, $categoryID)
{
$id = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array()[0]; $id = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array()[0];
$this->addCategoryToEntryID(intval($id['ID']), $categoryID); $this->addCategoryToEntryID(intval($id['ID']), $categoryID);
} }
public function getPrevProject($id) { public function getPrevProject($id)
{
$result = $this->db->query('SELECT * FROM projects WHERE datetime < (SELECT datetime FROM projects WHERE ID = ?) ORDER BY datetime DESC LIMIT 1', [$id])->result_array(); $result = $this->db->query('SELECT * FROM projects WHERE datetime < (SELECT datetime FROM projects WHERE ID = ?) ORDER BY datetime DESC LIMIT 1', [$id])->result_array();
$result = $this->mergeTranslationData($result, $_SESSION['site_lang']); $result = $this->mergeTranslationData($result, $_SESSION['site_lang']);
@ -121,7 +162,8 @@ class ProjectsModel extends CI_Model {
return $result; return $result;
} }
public function getNextProject($id) { public function getNextProject($id)
{
$result = $this->db->query('SELECT * FROM projects WHERE datetime > (SELECT datetime FROM projects WHERE ID = ?) ORDER BY datetime ASC LIMIT 1', [$id])->result_array(); $result = $this->db->query('SELECT * FROM projects WHERE datetime > (SELECT datetime FROM projects WHERE ID = ?) ORDER BY datetime ASC LIMIT 1', [$id])->result_array();
$result = $this->mergeTranslationData($result, $_SESSION['site_lang']); $result = $this->mergeTranslationData($result, $_SESSION['site_lang']);
@ -129,7 +171,8 @@ class ProjectsModel extends CI_Model {
return $result; return $result;
} }
public function addVote($projectID, $userID, $voteType) { public function addVote($projectID, $userID, $voteType)
{
$this->db->query('DELETE FROM projects_entry_votes WHERE projectID = ? AND userID = ?', [$projectID, $userID]); $this->db->query('DELETE FROM projects_entry_votes WHERE projectID = ? AND userID = ?', [$projectID, $userID]);
$this->db->query('INSERT INTO projects_entry_votes (projectID, userID, type) VALUES (?, ?, ?)', [$projectID, $userID, $voteType]); $this->db->query('INSERT INTO projects_entry_votes (projectID, userID, type) VALUES (?, ?, ?)', [$projectID, $userID, $voteType]);
$this->db->cache_delete('projects', 'index'); $this->db->cache_delete('projects', 'index');
@ -138,19 +181,22 @@ class ProjectsModel extends CI_Model {
$this->db->cache_delete('admin', 'projects'); $this->db->cache_delete('admin', 'projects');
} }
public function getVoteCount($projectID) { public function getVoteCount($projectID)
{
$result = $this->db->query('SELECT (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = ? AND type = 1) - (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = ? AND type = -1) voteCount', [$projectID, $projectID])->result_array(); $result = $this->db->query('SELECT (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = ? AND type = 1) - (SELECT COUNT(*) FROM projects_entry_votes WHERE projectID = ? AND type = -1) voteCount', [$projectID, $projectID])->result_array();
return $result[0]['voteCount']; return $result[0]['voteCount'];
} }
public function getUserVoteType($projectID, $userID) { public function getUserVoteType($projectID, $userID)
{
$result = $this->db->query('SELECT type FROM projects_entry_votes WHERE projectID = ? AND userID = ?', [$projectID, $userID])->result_array(); $result = $this->db->query('SELECT type FROM projects_entry_votes WHERE projectID = ? AND userID = ?', [$projectID, $userID])->result_array();
if (empty($result)) if (empty($result))
return 0; return 0;
return $result[0]['type']; return $result[0]['type'];
} }
public function createNewProjectDraft() { public function createNewProjectDraft()
{
$this->db->query('INSERT INTO projects () VALUES ()'); $this->db->query('INSERT INTO projects () VALUES ()');
$this->db->cache_delete('admin', 'projects'); $this->db->cache_delete('admin', 'projects');
@ -159,7 +205,8 @@ class ProjectsModel extends CI_Model {
return $data[0]['ID']; return $data[0]['ID'];
} }
public function updateProject($id, $translations, $url, $download, $openSource, $customLink, $date, $image) { public function updateProject($id, $translations, $url, $download, $openSource, $customLink, $date, $image)
{
$this->db->query('UPDATE projects SET name = ?, isDownloadable = ?, downloadLink = ?, isOpenSource = ?, openSourceLink = ?, customLink = ?, datetime = ?, source = ? WHERE ID = ?', [$url, $download['available'], $download['link'], $openSource['available'], $openSource['link'], $customLink['link'], $date, $image, $id]); $this->db->query('UPDATE projects SET name = ?, isDownloadable = ?, downloadLink = ?, isOpenSource = ?, openSourceLink = ?, customLink = ?, datetime = ?, source = ? WHERE ID = ?', [$url, $download['available'], $download['link'], $openSource['available'], $openSource['link'], $customLink['link'], $date, $image, $id]);
$this->db->cache_off(); $this->db->cache_off();
@ -183,24 +230,13 @@ class ProjectsModel extends CI_Model {
$this->db->cache_delete('projects', 'entry'); $this->db->cache_delete('projects', 'entry');
} }
public function mergeTranslationData($postList, $lang = 'de') { public function mergeFullTranslationData($postList)
{
foreach ($postList as $i => $post) { foreach ($postList as $i => $post) {
$data = $this->db->query('SELECT * FROM projects_translations WHERE projectID = ? AND (lang = ? OR lang = ?) ORDER BY lang', [$post['ID'], 'de', $lang])->result_array(); $data = $this->db->query('SELECT * FROM projects_translations WHERE projectID = ? ORDER BY lang', [$post['ID']])->result_array();
if(sizeof($data) == 1) { foreach ($data as $lang) {
$postList[$i] = array_merge($post, $data[0]); $postList[$i]['translations'][$lang['lang']] = $lang;
continue;
} }
$merged = [];
foreach ($data[0] as $key => $value) {
if(($value == NULL && $data[1][$key] == NULL) || ($value != NULL && $data[1][$key] == NULL)) {
$merged[$key] = $value;
} else {
$merged[$key] = $data[1][$key];
}
}
$postList[$i] = array_merge($post, $merged);
} }
return $postList; return $postList;
} }

View File

@ -12,10 +12,13 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</div> </div>
</div> </div>
<script src="/assets/js/lib/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<?php <?php
$scripts = [ $scripts = [
'lib/jquery.min.js', 'lib/jquery.min.js',
'lib/bootstrap.min.js', 'lib/bootstrap-3.3.7.min.js',
'lib/typeahead.bundle.min.js', 'lib/typeahead.bundle.min.js',
'lib/datatables.js', 'lib/datatables.js',
'lib/jquery.tagsinput.min.js', 'lib/jquery.tagsinput.min.js',
@ -28,7 +31,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
'custom.js' 'custom.js'
]; ];
if(isset($additionalScripts)) { if(isset($additionalScripts)) {
// $scripts[] = $additionalScripts;
foreach ($additionalScripts as $additionalScript) { foreach ($additionalScripts as $additionalScript) {
$scripts[] = $additionalScript; $scripts[] = $additionalScript;
} }

View File

@ -154,7 +154,7 @@
<div class="form-group"> <div class="form-group">
<label for="title">Titel (Deutsch)</label> <label for="title">Titel (Deutsch)</label>
<input type="text" class="form-control" name="title" id="title" placeholder="Titel auf Deutsch" <input type="text" class="form-control" name="title" id="title" placeholder="Titel auf Deutsch"
required value="<?= isset($content) ? $content['title'] : '' ?>"> required value="<?= isset($content) && isset($content['translations']['de']) ? $content['translations']['de']['title'] : '' ?>">
</div> </div>
<!-- Headline input --> <!-- Headline input -->
<div class="form-group"> <div class="form-group">
@ -162,13 +162,13 @@
<textarea name="headline" id="headline" rows="2" <textarea name="headline" id="headline" rows="2"
placeholder="Headline auf Deutsch" placeholder="Headline auf Deutsch"
class="form-control" class="form-control"
required><?= isset($content) ? $content['headline'] : '' ?></textarea> required><?= isset($content) && isset($content['translations']['de']) ? $content['translations']['de']['description'] : '' ?></textarea>
</div> </div>
<!-- Description input --> <!-- Description input -->
<div class="form-group"> <div class="form-group">
<label for="description">Beschreibung (Deutsch)</label> <label for="description">Beschreibung (Deutsch)</label>
<div data-editable data-name="content-german" id="content"> <div data-editable data-name="content-german" id="content">
<?= isset($content) ? $content['description'] : '' ?> <?= isset($content) && isset($content['translations']['de']) ? $content['translations']['de']['content'] : '' ?>
</div> </div>
</div> </div>
</div> </div>
@ -177,20 +177,20 @@
<div class="form-group"> <div class="form-group">
<label for="titleEnglish">Titel (Englisch)</label> <label for="titleEnglish">Titel (Englisch)</label>
<input type="text" class="form-control" name="titleEnglish" id="titleEnglish" placeholder="Titel auf Englisch" <input type="text" class="form-control" name="titleEnglish" id="titleEnglish" placeholder="Titel auf Englisch"
value="<?= isset($content) ? $content['titleEnglish'] : '' ?>"> value="<?= isset($content) && isset($content['translations']['en']) ? $content['translations']['en']['title'] : '' ?>">
</div> </div>
<!-- Headline English input --> <!-- Headline English input -->
<div class="form-group"> <div class="form-group">
<label for="headlineEnglish">Headline (Englisch)</label> <label for="headlineEnglish">Headline (Englisch)</label>
<textarea name="headlineEnglish" id="headlineEnglish" rows="2" <textarea name="headlineEnglish" id="headlineEnglish" rows="2"
placeholder="Headline auf Englisch" placeholder="Headline auf Englisch"
class="form-control"><?= isset($content) ? $content['headlineEnglish'] : '' ?></textarea> class="form-control"><?= isset($content) && isset($content['translations']['en']) ? $content['translations']['en']['description'] : '' ?></textarea>
</div> </div>
<!-- Description English input --> <!-- Description English input -->
<div class="form-group"> <div class="form-group">
<label for="descriptionEnglish">Beschreibung (Englisch)</label> <label for="descriptionEnglish">Beschreibung (Englisch)</label>
<div data-editable data-name="content-english" id="contentEnglish"> <div data-editable data-name="content-english" id="contentEnglish">
<?= isset($content) ? $content['descriptionEnglish'] : '' ?> <?= isset($content) && isset($content['translations']['en']) ? $content['translations']['en']['content'] : '' ?>
</div> </div>
</div> </div>
</div> </div>
@ -199,20 +199,20 @@
<div class="form-group"> <div class="form-group">
<label for="titleFrench">Titel (Französisch)</label> <label for="titleFrench">Titel (Französisch)</label>
<input type="text" class="form-control" name="titleFrench" id="titleFrench" placeholder="Titel auf Französisch" <input type="text" class="form-control" name="titleFrench" id="titleFrench" placeholder="Titel auf Französisch"
value="<?= isset($content) ? $content['titleFrench'] : '' ?>"> value="<?= isset($content) && isset($content['translations']['fr']) ? $content['translations']['fr']['title'] : '' ?>">
</div> </div>
<!-- Headline French input --> <!-- Headline French input -->
<div class="form-group"> <div class="form-group">
<label for="headlineFrench">Headline (Französisch)</label> <label for="headlineFrench">Headline (Französisch)</label>
<textarea name="headlineFrench" id="headlineFrench" rows="2" <textarea name="headlineFrench" id="headlineFrench" rows="2"
placeholder="Headline auf Französisch" placeholder="Headline auf Französisch"
class="form-control"><?= isset($content) ? $content['headlineFrench'] : '' ?></textarea> class="form-control"><?= isset($content) && isset($content['translations']['fr']) ? $content['translations']['fr']['description'] : '' ?></textarea>
</div> </div>
<!-- Description French input --> <!-- Description French input -->
<div class="form-group"> <div class="form-group">
<label for="descriptionFrench">Beschreibung (Französisch)</label> <label for="descriptionFrench">Beschreibung (Französisch)</label>
<div data-editable data-name="content-french" id="contentFrench"> <div data-editable data-name="content-french" id="contentFrench">
<?= isset($content) ? $content['descriptionFrench'] : '' ?> <?= isset($content) && isset($content['translations']['fr']) ? $content['translations']['fr']['content'] : '' ?>
</div> </div>
</div> </div>
</div> </div>

View File

@ -117,8 +117,8 @@
<?php } ?> <?php } ?>
</tbody> </tbody>
</table> </table>
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog"
aria-labelledby="deleteModalTitle"> <div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalTitle">
<div class="modal-dialog" role="document"> <div class="modal-dialog" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -147,3 +147,4 @@
</div> </div>
</div> </div>
</div> </div>

View File

@ -102,12 +102,10 @@
</div> </div>
</footer> </footer>
<!--/#footer--> <!--/#footer-->
<script src="/assets/js/lib/jquery.min.js"></script>
<script src="/assets/js/lib/popper.min.js"></script>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>-->
<!--<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>-->
<?php <?php
$scripts = [ $scripts = [
'lib/jquery.min.js',
'lib/popper.min.js',
'lib/bootstrap.min.js', 'lib/bootstrap.min.js',
'lib/jquery.PageScroll2id.min.js', 'lib/jquery.PageScroll2id.min.js',
'lib/jquery.mobile.custom.min.js', 'lib/jquery.mobile.custom.min.js',

View File

@ -25,6 +25,7 @@
<link rel="stylesheet" href="<?= base_url('/assets/css/lib/bootstrap.min.css') ?>"> <link rel="stylesheet" href="<?= base_url('/assets/css/lib/bootstrap.min.css') ?>">
<?php <?php
$styles = [ $styles = [
'fonts.css',
'fix-bootstrap-4.css', 'fix-bootstrap-4.css',
'custom-buttons.css', 'custom-buttons.css',
'custom-alerts.css', 'custom-alerts.css',
@ -56,7 +57,7 @@
</head> </head>
<!--/head--> <!--/head-->
<body> <body>
<header class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top" role="banner"> <header class="navbar navbar-expand-lg navbar-dark bg-primary fixed-top <?= isset($active) && $active == 'profile' ? 'bg-custom' : '' ?>" role="banner">
<a data-track-content data-content-name="Header Logo Link" class="navbar-brand" <a data-track-content data-content-name="Header Logo Link" class="navbar-brand"
href="<?= base_url(); ?>"> href="<?= base_url(); ?>">
<div class="logo-container"> <div class="logo-container">
@ -302,6 +303,11 @@
<div class="side-navigation-background"></div> <div class="side-navigation-background"></div>
<div class="btn-floating"> <div class="btn-floating">
<ul class="btn-floating-list"> <ul class="btn-floating-list">
<li>
<a href="#" data-title="Dark Theme" id="switchDarkmode">
<i class="fa fa-moon"></i>
</a>
</li>
<li> <li>
<a data-title="<?= lang('header_contact') ?>" href="#" data-toggle="modal" data-target="#contactModal"> <a data-title="<?= lang('header_contact') ?>" href="#" data-toggle="modal" data-target="#contactModal">
<i class="fa fa-envelope"></i> <i class="fa fa-envelope"></i>

View File

@ -227,8 +227,7 @@
</div> </div>
</section> </section>
<section class="dark"> <section class="container">
<div class="container">
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4"> <div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
<h2><?= lang('home_active_users') ?></h2> <h2><?= lang('home_active_users') ?></h2>
@ -273,7 +272,6 @@
</ul> </ul>
</div> </div>
</div> </div>
</div>
</section> </section>
<section class="section-parallax section-orange"> <section class="section-parallax section-orange">
@ -282,7 +280,8 @@
<div class="col-md-6"> <div class="col-md-6">
<h1>Portfolio</h1> <h1>Portfolio</h1>
<p class="lead"> <p class="lead">
Seit ich angefangen habe YouTube-Videos hochzuladen, bin ich auch langsam in Richtung Design, Programmieren, Fotografie, Videoschnitt, Animation etc. hineingeraten. Mit der Zeit haben sich einige mehr oder weniger gute Projekte angehäuft, die ihr in meinem Portfolio betrachten könnt. Seit ich angefangen habe YouTube-Videos hochzuladen, bin ich auch langsam in Richtung Design, Programmieren, Fotografie, Videoschnitt, Animation etc. hineingeraten. Mit der Zeit haben sich einige mehr oder weniger gute Projekte angehäuft,
die ihr in meinem Portfolio betrachten könnt.
</p> </p>
<a href="<?= base_url('projects') ?>" class="btn btn-default round">Projekte ansehen</a> <a href="<?= base_url('projects') ?>" class="btn btn-default round">Projekte ansehen</a>
</div> </div>
@ -413,7 +412,8 @@
<div class="col-md-6"> <div class="col-md-6">
<h1>Blog</h1> <h1>Blog</h1>
<p class="lead"> <p class="lead">
Seid ihr an Programmierung, Design, Technik, Internet, Aktuellem, Gaming, zufälligem Kram und mehr interessiert? Dann ist mein Blog zwar nicht die erste Anlaufstelle, dennoch könnte man ihn eventuell ein-zwei Mal berücksichtigen. Schaut doch einfach mal vorbei und lasst euch selbst überraschen. Seid ihr an Programmierung, Design, Technik, Internet, Aktuellem, Gaming, zufälligem Kram und mehr interessiert? Dann ist mein Blog zwar nicht die erste Anlaufstelle, dennoch könnte man ihn eventuell ein-zwei Mal berücksichtigen. Schaut
doch einfach mal vorbei und lasst euch selbst überraschen.
</p> </p>
<a href="<?= base_url('blog') ?>" class="btn btn-default round">Zum Blog</a> <a href="<?= base_url('blog') ?>" class="btn btn-default round">Zum Blog</a>
</div> </div>

View File

@ -4,8 +4,8 @@
use Coduo\PHPHumanizer\DateTimeHumanizer; use Coduo\PHPHumanizer\DateTimeHumanizer;
?> ?>
<li class="post-item my-2" data-uuid="<?= $uuid ?>" data-username="<?= $username ?>"> <li class="post-item is-reply% my-2" data-uuid="<?= $uuid ?>" data-username="<?= $username ?>">
<div class="comment-well"> <div class="comment-well" <?= isset($hideShadows) && $hideShadows ? 'style="box-shadow: none;padding:0"' : '' ?>>
<div class="post-non-content"> <div class="post-non-content">
<a href="<?= base_url('user/' . $username) ?>" target="_blank"> <a href="<?= base_url('user/' . $username) ?>" target="_blank">
<img src="<?= $profile_picture ?>?w=100" class="img-fluid"> <img src="<?= $profile_picture ?>?w=100" class="img-fluid">
@ -24,7 +24,7 @@
<small> <small>
<i class="fa fa-reply"></i> <i class="fa fa-reply"></i>
als Antwort an als Antwort an
<a href="#" onclick="showFullPost('<?= $replyToUuid ?>', '<?= $replyToUsername ?>')">@<?= $replyToDisplayname ?></a> <a href="#" onclick="showFullPost('<?= $replyToPost['uuid'] ?>', '<?= $replyToPost['username'] ?>')">@<?= $replyToPost['displayname'] ?></a>
</small> </small>
<?php endif; ?> <?php endif; ?>
</h3> </h3>

View File

@ -7,14 +7,23 @@
<?= $message; ?> <?= $message; ?>
<div class="row justify-content-center">
<ul class="comment-list">
<?php
$post['replyToPost']['hideShadows'] = true;
$this->load->view('network/posts/post_item', $post['replyToPost'])
?>
</ul>
</div>
<div class="row"> <div class="row">
<div class="col-sm-2"> <div class="post-non-content">
<a href="<?= base_url('user/' . $post['username']) ?>"> <a href="<?= base_url('user/' . $post['username']) ?>">
<img src="<?= $post['profile_picture'] ?>?w=75" alt="" class="img-fluid rounded-circle"> <img src="<?= $post['profile_picture'] ?>?w=75" alt="" class="img-fluid rounded-circle">
</a> </a>
</div> </div>
<div class="col-sm-10"> <div class="col">
<h4> <h4>
<a href="<?= base_url('user/' . $post['username']) ?>"> <a href="<?= base_url('user/' . $post['username']) ?>">
<?= $post['displayname'] ?> <?= $post['displayname'] ?>

View File

@ -10,37 +10,43 @@ $this->load->view('network/user/profile_page_header');
<?= $message ?> <?= $message ?>
<h1>Profil bearbeiten</h1> <h1>Profil bearbeiten</h1>
<div class="row"> <div class="row">
<div class="col-xs-3 vertical-tab-menu"> <div class="col-3">
<div class="list-group"> <div class="nav nav-pills flex-column" role="tablist" aria-orientation="vertical">
<a href="#" class="list-group-item active text-center" id="general"> <a href="#general" class="nav-link active text-center" role="tab" data-toggle="pill"
id="general-pill" aria-controls="general" aria-selected="true">
<i class="fa fa-tasks"></i> <i class="fa fa-tasks"></i>
<br> <br>
Allgemein Allgemein
</a> </a>
<a href="#" class="list-group-item text-center" id="email"> <a href="#email" class="nav-link text-center" role="tab" data-toggle="pill" id="email-pill"
aria-controls="email" aria-selected="false">
<i class="fa fa-envelope"></i> <i class="fa fa-envelope"></i>
<br> <br>
E-Mail E-Mail
</a> </a>
<a href="#" class="list-group-item text-center" id="password"> <a href="#password" class="nav-link text-center" role="tab" data-toggle="pill"
id="password-pill" aria-controls="password" aria-selected="false">
<i class="fa fa-lock"></i> <i class="fa fa-lock"></i>
<br> <br>
Passwort & Sicherheit Passwort & Sicherheit
</a> </a>
<a href="#" class="list-group-item text-center" id="premium"> <a href="#premium" class="nav-link text-center" role="tab" data-toggle="pill" id="premium-pill"
aria-controls="premium" aria-selected="false">
<i class="fa fa-star"></i> <i class="fa fa-star"></i>
<br> <br>
Premium Premium
</a> </a>
</div> </div>
</div> </div>
<div class="col-xs-9 vertical-tabs"> <div class="col-9">
<div class="vertical-tab-content active" id="general"> <div class="tab-content" id="tabContent">
<div class="tab-pane fade show active" id="general" role="tabpanel"
aria-labelledby="general-pill">
<form method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<!-- Username --> <!-- Username -->
<div class="form-group"> <div class="form-group">
<label for="username">Nutzername</label> <label for="username">Nutzername</label>
<input name="username" class="form-control" <input name="username" id="username" class="form-control"
value="<?= isset($data['displayname']) ? $data['displayname'] : '' ?>"> value="<?= isset($data['displayname']) ? $data['displayname'] : '' ?>">
<span class="error-message" id="usernameErrorLength"> <span class="error-message" id="usernameErrorLength">
<b>Dein Nutzername ist zu kurz!</b> Er muss mindestens 4 Zeichen lang sein <b>Dein Nutzername ist zu kurz!</b> Er muss mindestens 4 Zeichen lang sein
@ -52,7 +58,7 @@ $this->load->view('network/user/profile_page_header');
<!-- Gender --> <!-- Gender -->
<div class="form-group"> <div class="form-group">
<label for="gender">Geschlecht</label> <label for="gender">Geschlecht</label>
<select class="form-control" name="gender"> <select class="form-control" name="gender" id="gender">
<option value="">---</option> <option value="">---</option>
<option value="male" <?= isset($data['gender']) && $data['gender'] == "male" ? "selected" : "" ?>> <option value="male" <?= isset($data['gender']) && $data['gender'] == "male" ? "selected" : "" ?>>
Männlich Männlich
@ -69,7 +75,7 @@ $this->load->view('network/user/profile_page_header');
<div class="form-group"> <div class="form-group">
<label for="birthdate">Geburtsdatum</label> <label for="birthdate">Geburtsdatum</label>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-6">
<select name="birthdate-month" id="birthdate-month" class="form-control" <select name="birthdate-month" id="birthdate-month" class="form-control"
data-default="<?= isset($data['birthdate']) ? explode('.', $data['birthdate'])[1] : '' ?>"> data-default="<?= isset($data['birthdate']) ? explode('.', $data['birthdate'])[1] : '' ?>">
<option value="">-- Monat --</option> <option value="">-- Monat --</option>
@ -87,7 +93,7 @@ $this->load->view('network/user/profile_page_header');
<option value="12">Dezember</option> <option value="12">Dezember</option>
</select> </select>
</div> </div>
<div class="col-xs-6"> <div class="col-6">
<select name="birthdate-day" id="birthdate-day" class="form-control" <select name="birthdate-day" id="birthdate-day" class="form-control"
data-default="<?= isset($data['birthdate']) ? explode('.', $data['birthdate'])[0] : '' ?>"> data-default="<?= isset($data['birthdate']) ? explode('.', $data['birthdate'])[0] : '' ?>">
<option value="">-- Tag --</option> <option value="">-- Tag --</option>
@ -95,7 +101,7 @@ $this->load->view('network/user/profile_page_header');
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-xs-offset-3"> <div class="col-6 col-offset-3">
<select name="birthdate-year" id="birthdate-year" class="form-control"> <select name="birthdate-year" id="birthdate-year" class="form-control">
<option value="">-- Jahr --</option> <option value="">-- Jahr --</option>
</select> </select>
@ -105,8 +111,7 @@ $this->load->view('network/user/profile_page_header');
<!-- Language --> <!-- Language -->
<div class="form-group"> <div class="form-group">
<label for="language">Sprache</label> <label for="language">Sprache</label>
<select aria-describedby="languageHelp" name="language" <select aria-describedby="languageHelp" class="form-control" name="language" data-placeholder="Wähle deine Sprache aus..." id="language">
data-placeholder="Wähle deine Sprache aus..." id="language">
<option value="">---</option> <option value="">---</option>
<option value="AF" <?= isset($data['language']) && $data['language'] === "AF" ? "selected" : "" ?>> <option value="AF" <?= isset($data['language']) && $data['language'] === "AF" ? "selected" : "" ?>>
Afrikanns Afrikanns
@ -330,7 +335,7 @@ $this->load->view('network/user/profile_page_header');
<!-- Country --> <!-- Country -->
<div class="form-group"> <div class="form-group">
<label for="country">Land</label> <label for="country">Land</label>
<select aria-describedby="countryHelp" name="country" id="country"> <select aria-describedby="countryHelp" class="form-control" name="country" id="country">
<option value="">---</option> <option value="">---</option>
<option value="AF" <?= isset($data['country']) && $data['country'] === "AF" ? "selected" : "" ?>> <option value="AF" <?= isset($data['country']) && $data['country'] === "AF" ? "selected" : "" ?>>
Afghanistan Afghanistan
@ -1085,35 +1090,39 @@ $this->load->view('network/user/profile_page_header');
<!-- Bio --> <!-- Bio -->
<div class="form-group"> <div class="form-group">
<label for="biography">Profilbeschreibung/Biographie</label> <label for="biography">Profilbeschreibung/Biographie</label>
<textarea class="form-control" <textarea class="form-control" name="biography" id="biography">
name="biography"><?= isset($data['about']) ? $data['about'] : "" ?></textarea> <?= isset($data['about']) ? $data['about'] : "" ?>
</textarea>
</div> </div>
<!-- Avatar --> <!-- Avatar -->
<div class="form-group"> <div class="form-group">
<label for="avatar">Avatar</label> <label for="avatar">Avatar</label>
<?php if (isset($data['profile_picture']) || $data['profile_picture'] != ""): ?> <?php if (isset($data['profile_picture']) || $data['profile_picture'] != ""): ?>
<img class="img-fluid thumbnail picture-preview" <img class="img-fluid img-thumbnail picture-preview d-block"
src="<?= $data['profile_picture'] ?>"> src="<?= $data['profile_picture'] ?>">
<?php endif; ?> <?php endif; ?>
<input type="file" name="avatar"> <input type="file" name="avatar" id="avatar">
</div> </div>
<!-- Header --> <!-- Header -->
<div class="form-group"> <div class="form-group">
<label for="header">Header</label> <label for="header">Header</label>
<?php if (isset($data['header_image']) || $data['header_image'] != ""): ?> <?php if (isset($data['header_image']) || $data['header_image'] != ""): ?>
<img class="img-fluid thumbnail picture-preview" <img class="img-fluid img-thumbnail picture-preview d-block"
src="<?= $data['header_image'] ?>"> src="<?= $data['header_image'] ?>">
<?php endif; ?> <?php endif; ?>
<input type="file" name="header"> <input type="file" name="header" id="header">
</div> </div>
<!-- Social Networks --> <!-- Social Networks -->
<div class="form-group"></div> <div class="form-group"></div>
<!-- Color --> <!-- Color -->
<div class="form-group"></div> <div class="form-group">
<label for="color">Persönliche Farbe</label>
<div id="color"></div>
</div>
<input type="submit" class="btn btn-primary" value="Speichern"> <input type="submit" class="btn btn-primary" value="Speichern">
</form> </form>
</div> </div>
<div class="vertical-tab-content" id="email"> <div class="tab-pane fade" id="email" role="tabpanel" aria-labelledby="email-pill">
<form method="post"> <form method="post">
<div class="form-group"> <div class="form-group">
<label for="email">E-Mail-Adresse</label> <label for="email">E-Mail-Adresse</label>
@ -1138,7 +1147,7 @@ $this->load->view('network/user/profile_page_header');
<input type="submit" class="btn btn-primary" value="Speichern"> <input type="submit" class="btn btn-primary" value="Speichern">
</form> </form>
</div> </div>
<div class="vertical-tab-content" id="password"> <div class="tab-pane fade" id="password" role="tabpanel" aria-labelledby="password-pill">
<form method="post"> <form method="post">
<div class="form-group"> <div class="form-group">
<label for="passwordOld">Altes Passwort</label> <label for="passwordOld">Altes Passwort</label>
@ -1155,7 +1164,7 @@ $this->load->view('network/user/profile_page_header');
<input type="submit" class="btn btn-primary" value="Speichern"> <input type="submit" class="btn btn-primary" value="Speichern">
</form> </form>
</div> </div>
<div class="vertical-tab-content" id="premium"> <div class="tab-pane fade" id="premium" role="tabpanel" aria-labelledby="premium-pill">
<form method="post"> <form method="post">
<?php if (isset($_SESSION['user']['rank']) && $_SESSION['user']['rank'] >= 2): ?> <?php if (isset($_SESSION['user']['rank']) && $_SESSION['user']['rank'] >= 2): ?>
<div class="form-group"> <div class="form-group">
@ -1173,7 +1182,8 @@ $this->load->view('network/user/profile_page_header');
Services und gleichzeitig erhälst du die Möglichkeit, den Dienst ohne Werbung zu Services und gleichzeitig erhälst du die Möglichkeit, den Dienst ohne Werbung zu
erleben.</p> erleben.</p>
<p>Plus-Nutzer oder Team-Mitglied kannst du nur auf persönliche Einladung eines <p>Plus-Nutzer oder Team-Mitglied kannst du nur auf persönliche Einladung eines
hochrangigen Team-Mitgliedes werden. Der Plus-Rang wird beispielsweise an YouTuber, hochrangigen Team-Mitgliedes werden. Der Plus-Rang wird beispielsweise an
YouTuber,
bekannte Persönlichkeiten, sehr aktive Nutzer, sehr großzügige Spender, aktive bekannte Persönlichkeiten, sehr aktive Nutzer, sehr großzügige Spender, aktive
Abonnenten des Kanals <a href="https://youtube.com/KingOfDog" target="_blank">KingOfDog</a> Abonnenten des Kanals <a href="https://youtube.com/KingOfDog" target="_blank">KingOfDog</a>
oder Freunde und Bekannte vergeben.</p> oder Freunde und Bekannte vergeben.</p>
@ -1186,51 +1196,15 @@ $this->load->view('network/user/profile_page_header');
</div> </div>
</div> </div>
</div> </div>
</div>
</section> </section>
<style> <style>
#profile-content-container { .nav-pills .nav-link {
min-height: 375px; position: relative;
transition: color .2s, background-color .2s;
} }
.vertical-tab-menu { .nav-pills .nav-link:after {
padding-right: 0;
padding-left: 0;
padding-bottom: 0;
}
.vertical-tab-menu .list-group {
margin-bottom: 0;
}
.vertical-tab-menu .list-group > a {
margin-bottom: 0;
border: 0;
}
.vertical-tab-menu .list-group > a .fa {
color: #2272FF;
}
.vertical-tab-menu .list-group > a:first-child {
border-top-right-radius: 0;
-moz-border-top-right-radius: 0;
}
.vertical-tab-menu .list-group > a:last-child {
border-bottom-right-radius: 0;
-moz-border-bottom-right-radius: 0;
}
.vertical-tab-menu .list-group > a.active {
background-color: #2272FF;
color: #ffffff;
}
.vertical-tab-menu .list-group > a.active .fa {
color: #ffffff;
}
.vertical-tab-menu .list-group > a.active:after {
content: ''; content: '';
position: absolute; position: absolute;
left: 100%; left: 100%;
@ -1239,21 +1213,26 @@ $this->load->view('network/user/profile_page_header');
border-left: 0; border-left: 0;
border-bottom: 13px solid transparent; border-bottom: 13px solid transparent;
border-top: 13px solid transparent; border-top: 13px solid transparent;
border-left: 10px solid #2272FF; border-left: 10px solid transparent;
transition: border-left-color .2s;
} }
.vertical-tabs { .nav-pills .nav-link:not(.active):hover,
margin-left: -15px; .nav-pills .nav-link:not(.active):focus {
color: #2272ff !important;
} }
.vertical-tab-content { .nav-pills .nav-link.active {
background-color: #ffffff; color: #fff !important;
padding: 10px 25px; background-color: #2272ff;
min-height: 285px;
} }
.vertical-tabs .vertical-tab-content:not(.active) { .nav-pills .nav-link.active:after {
display: none; border-left-color: #2272ff;
}
#profile-content-container {
min-height: 375px;
} }
.picture-preview { .picture-preview {

View File

@ -18,46 +18,46 @@
</div> </div>
<div class="col-xs-9 col-sm-10 col-md-8 col-lg-8"> <div class="col-xs-9 col-sm-10 col-md-8 col-lg-8">
<div class="row"> <div class="row">
<div class="profile-stats"> <div class="profile-stats border-custom">
<div class="item <?= isset($active) && $active == 'profile' ? 'active' : '' ?>"> <div class="item border-custom <?= isset($active) && $active == 'profile' ? 'active' : '' ?>">
<a href="<?= base_url('user/' . $data['username']) ?>"> <a href="<?= base_url('user/' . $data['username']) ?>">
<span class="label"><?= lang('profile_contributions') ?></span> <span class="label"><?= lang('profile_contributions') ?></span>
<span class="count" <span class="count <?= isset($active) && $active == 'profile' ? 'text-custom' : '' ?>"
data-count="<?= $stats['postCount'] + $stats['blogCount'] + $stats['commentCount'] ?>"><?= $stats['postCount'] + $stats['blogCount'] + $stats['commentCount'] ?></span> data-count="<?= $stats['postCount'] + $stats['blogCount'] + $stats['commentCount'] ?>"><?= $stats['postCount'] + $stats['blogCount'] + $stats['commentCount'] ?></span>
</a> </a>
</div> </div>
<div class="item <?= isset($active) && $active == 'posts' ? 'active' : '' ?>"> <div class="item border-custom <?= isset($active) && $active == 'posts' ? 'active' : '' ?>">
<a href="<?= base_url('user/' . $data['username'] . '/posts') ?>"> <a href="<?= base_url('user/' . $data['username'] . '/posts') ?>">
<span class="label"><?= lang('profile_posts') ?></span> <span class="label"><?= lang('profile_posts') ?></span>
<span class="count" <span class="count <?= isset($active) && $active == 'posts' ? 'text-custom' : '' ?>"
data-count="<?= $stats['postCount'] ?>"><?= $stats['postCount'] ?></span> data-count="<?= $stats['postCount'] ?>"><?= $stats['postCount'] ?></span>
</a> </a>
</div> </div>
<div class="item <?= isset($active) && $active == 'blog-posts' ? 'active' : '' ?>"> <div class="item border-custom <?= isset($active) && $active == 'blog-posts' ? 'active' : '' ?>">
<a href="<?= base_url('user/' . $data['username'] . '/blogposts') ?>"> <a href="<?= base_url('user/' . $data['username'] . '/blogposts') ?>">
<span class="label"><?= lang('profile_blog_posts') ?></span> <span class="label"><?= lang('profile_blog_posts') ?></span>
<span class="count" <span class="count <?= isset($active) && $active == 'blog-posts' ? 'text-custom' : '' ?>"
data-count="<?= $stats['blogCount'] ?>"><?= $stats['blogCount'] ?></span> data-count="<?= $stats['blogCount'] ?>"><?= $stats['blogCount'] ?></span>
</a> </a>
</div> </div>
<div class="item <?= isset($active) && $active == 'blog-comments' ? 'active' : '' ?>"> <div class="item border-custom <?= isset($active) && $active == 'blog-comments' ? 'active' : '' ?>">
<a href="<?= base_url('user/' . $data['username'] . '/comments') ?>"> <a href="<?= base_url('user/' . $data['username'] . '/comments') ?>">
<span class="label"><?= lang('profile_blog_comments') ?></span> <span class="label"><?= lang('profile_blog_comments') ?></span>
<span class="count" <span class="count <?= isset($active) && $active == 'blog-comments' ? 'text-custom' : '' ?>"
data-count="<?= $stats['commentCount'] ?>"><?= $stats['commentCount'] ?></span> data-count="<?= $stats['commentCount'] ?>"><?= $stats['commentCount'] ?></span>
</a> </a>
</div> </div>
<div class="item <?= isset($active) && $active == 'followers' ? 'active' : '' ?>"> <div class="item border-custom <?= isset($active) && $active == 'followers' ? 'active' : '' ?>">
<a href="<?= base_url('user/' . $data['username'] . '/followers') ?>"> <a href="<?= base_url('user/' . $data['username'] . '/followers') ?>">
<span class="label"><?= lang('profile_followers') ?></span> <span class="label"><?= lang('profile_followers') ?></span>
<span class="count" <span class="count <?= isset($active) && $active == 'followers' ? 'text-custom' : '' ?>"
data-count="<?= $stats['followerCount'] ?>"><?= $stats['followerCount'] ?></span> data-count="<?= $stats['followerCount'] ?>"><?= $stats['followerCount'] ?></span>
</a> </a>
</div> </div>
<div class="item <?= isset($active) && $active == 'following' ? 'active' : '' ?>"> <div class="item border-custom <?= isset($active) && $active == 'following' ? 'active' : '' ?>">
<a href="<?= base_url('user/' . $data['username'] . '/following') ?>"> <a href="<?= base_url('user/' . $data['username'] . '/following') ?>">
<span class="label"><?= lang('profile_followed_users') ?></span> <span class="label"><?= lang('profile_followed_users') ?></span>
<span class="count" <span class="count <?= isset($active) && $active == 'followers' ? 'text-custom' : '' ?>"
data-count="<?= $stats['followedCount'] ?>"><?= $stats['followedCount'] ?></span> data-count="<?= $stats['followedCount'] ?>"><?= $stats['followedCount'] ?></span>
</a> </a>
</div> </div>
@ -118,3 +118,17 @@
</div> </div>
</div> </div>
</div> </div>
<style id="customColor">
.text-custom {
color: #2272ff;
}
.bg-custom {
background-color: #2272ff;
}
.border-custom {
border-color: #2272ff;
}
</style>

41
assets/css/fonts.css Normal file
View File

@ -0,0 +1,41 @@
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(/assets/fonts/Roboto/Roboto-Thin.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(/assets/fonts/Roboto/Roboto-Light.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(/assets/fonts/Roboto/Roboto-Regular.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(/assets/fonts/Roboto/Roboto-Medium.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(/assets/fonts/Roboto/Roboto-Bold.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(/assets/fonts/Roboto/Roboto-Black.ttf) format('truetype');
}

View File

@ -65,12 +65,13 @@
border: 3px solid rgba(255, 255, 255, 0.5); border: 3px solid rgba(255, 255, 255, 0.5);
color: #fff; color: #fff;
margin-top: 5px; margin-top: 5px;
box-sizing: border-box;
transition: ease-in-out .1s; transition: ease-in-out .1s;
} }
#main-slider .carousel-item .btn:hover { #main-slider .carousel-item .btn:hover {
border-width: 0; border-width: 0;
margin: 8px 3px; padding: 13px 18px;
} }
#main-slider .active .animation.animated-item-1 { #main-slider .active .animation.animated-item-1 {

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
@import url('https://fonts.googleapis.com/css?family=Roboto');
.repeating-background-transparent, .repeating-background-white { .repeating-background-transparent, .repeating-background-white {
position: relative; position: relative;
width: 100%; width: 100%;
@ -20,6 +18,30 @@ body > section {
padding: 50px 0; padding: 50px 0;
} }
.dark {
background: #222222;
color: #FAFAFA;
}
.dark h1, .dark h2, .dark h3 {
color: #fafafa;
}
.dark .btn.btn-default {
background: #222222;
color: #FAFAFA;
border: 2px solid #FAFAFA;
}
.dark .btn.btn-default:hover,
.dark .btn.btn-default:focus,
.dark .btn.btn-default:active,
.dark .btn.btn-default.active {
background: #FAFAFA;
color: #222222;
}
.primary p, .secondary p, .turquoise p, .green-sea p, .sun-flower p, .section-orange p, .section-green p, .nephrits p, .carrot p, .pumkin p, .peter-river p, .belize-hole p, .section-red p, .pomegranate p, .amethyst p, .wisteria p, .clouds .silver p, .wet-asphalt p, .midnight-blue p, .concrete p, .asbestos p, .primary h2, .secondary h2, .turquoise h2, .green-sea h2, .sun-flower h2, .section-orange h2, .section-green h2, .nephrits h2, .carrot h2, .pumkin h2, .peter-river h2, .belize-hole h2, .section-red h2, .pomegranate h2, .amethyst h2, .wisteria h2, .clouds .silver h2, .wet-asphalt h2, .midnight-blue h2, .concrete h2, .asbestos h2, .primary h3, .secondary h3, .turquoise h3, .green-sea h3, .sun-flower h3, .section-orange h3, .section-green h3, .nephrits h3, .carrot h3, .pumkin h3, .peter-river h3, .belize-hole h3, .section-red h3, .pomegranate h3, .amethyst h3, .wisteria h3, .clouds .silver h3, .wet-asphalt h3, .midnight-blue h3, .concrete h3, .asbestos h3, .primary h4, .secondary h4, .turquoise h4, .green-sea h4, .sun-flower h4, .section-orange h4, .section-green h4, .nephrits h4, .carrot h4, .pumkin h4, .peter-river h4, .belize-hole h4, .section-red h4, .pomegranate h4, .amethyst h4, .wisteria h4, .clouds .silver h4, .wet-asphalt h4, .midnight-blue h4, .concrete h4, .asbestos h4, .primary h5, .secondary h5, .turquoise h5, .green-sea h5, .sun-flower h5, .section-orange h5, .section-green h5, .nephrits h5, .carrot h5, .pumkin h5, .peter-river h5, .belize-hole h5, .section-red h5, .pomegranate h5, .amethyst h5, .wisteria h5, .clouds .silver h5, .wet-asphalt h5, .midnight-blue h5, .concrete h5, .asbestos h5, .primary h6, .secondary h6, .turquoise h6, .green-sea h6, .sun-flower h6, .section-orange h6, .section-green h6, .nephrits h6, .carrot h6, .pumkin h6, .peter-river h6, .belize-hole h6, .section-red h6, .pomegranate h6, .amethyst h6, .wisteria h6, .clouds .silver h6, .wet-asphalt h6, .midnight-blue h6, .concrete h6, .asbestos h6 { .primary p, .secondary p, .turquoise p, .green-sea p, .sun-flower p, .section-orange p, .section-green p, .nephrits p, .carrot p, .pumkin p, .peter-river p, .belize-hole p, .section-red p, .pomegranate p, .amethyst p, .wisteria p, .clouds .silver p, .wet-asphalt p, .midnight-blue p, .concrete p, .asbestos p, .primary h2, .secondary h2, .turquoise h2, .green-sea h2, .sun-flower h2, .section-orange h2, .section-green h2, .nephrits h2, .carrot h2, .pumkin h2, .peter-river h2, .belize-hole h2, .section-red h2, .pomegranate h2, .amethyst h2, .wisteria h2, .clouds .silver h2, .wet-asphalt h2, .midnight-blue h2, .concrete h2, .asbestos h2, .primary h3, .secondary h3, .turquoise h3, .green-sea h3, .sun-flower h3, .section-orange h3, .section-green h3, .nephrits h3, .carrot h3, .pumkin h3, .peter-river h3, .belize-hole h3, .section-red h3, .pomegranate h3, .amethyst h3, .wisteria h3, .clouds .silver h3, .wet-asphalt h3, .midnight-blue h3, .concrete h3, .asbestos h3, .primary h4, .secondary h4, .turquoise h4, .green-sea h4, .sun-flower h4, .section-orange h4, .section-green h4, .nephrits h4, .carrot h4, .pumkin h4, .peter-river h4, .belize-hole h4, .section-red h4, .pomegranate h4, .amethyst h4, .wisteria h4, .clouds .silver h4, .wet-asphalt h4, .midnight-blue h4, .concrete h4, .asbestos h4, .primary h5, .secondary h5, .turquoise h5, .green-sea h5, .sun-flower h5, .section-orange h5, .section-green h5, .nephrits h5, .carrot h5, .pumkin h5, .peter-river h5, .belize-hole h5, .section-red h5, .pomegranate h5, .amethyst h5, .wisteria h5, .clouds .silver h5, .wet-asphalt h5, .midnight-blue h5, .concrete h5, .asbestos h5, .primary h6, .secondary h6, .turquoise h6, .green-sea h6, .sun-flower h6, .section-orange h6, .section-green h6, .nephrits h6, .carrot h6, .pumkin h6, .peter-river h6, .belize-hole h6, .section-red h6, .pomegranate h6, .amethyst h6, .wisteria h6, .clouds .silver h6, .wet-asphalt h6, .midnight-blue h6, .concrete h6, .asbestos h6 {
color: #fff; color: #fff;
} }
@ -143,30 +165,6 @@ body > section {
margin: 0; margin: 0;
} }
section.dark {
background: #222222;
color: #FAFAFA;
}
section.dark h1, section.dark h2, section.dark h3 {
color: #fafafa;
}
section.dark .btn.btn-default {
background: #222222;
color: #FAFAFA;
border: 2px solid #FAFAFA;
}
section.dark .btn.btn-default:hover,
section.dark .btn.btn-default:focus,
section.dark .btn.btn-default:active,
section.dark .btn.btn-default.active {
background: #FAFAFA;
color: #222222;
}
#title h1 { #title h1 {
margin: 0; margin: 0;
font-size: 36px; font-size: 36px;
@ -1116,7 +1114,8 @@ ul#downloadSlider a.active .overlay {
border-radius: 50%; border-radius: 50%;
} }
.comment-list .comment-well .post-non-content { .comment-list .comment-well .post-non-content,
.postFullviewModal .post-non-content {
display: inline-block; display: inline-block;
width: 100px; width: 100px;
padding: 10px; padding: 10px;
@ -1560,6 +1559,7 @@ ul#downloadSlider a.active .overlay {
transition: 0.4s ease; transition: 0.4s ease;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
white-space: nowrap;
} }
.btn-floating .btn-floating-shadow { .btn-floating .btn-floating-shadow {

View File

@ -26,7 +26,7 @@
-moz-transition: box-shadow .2s; -moz-transition: box-shadow .2s;
-ms-transition: box-shadow .2s; -ms-transition: box-shadow .2s;
-o-transition: box-shadow .2s; -o-transition: box-shadow .2s;
transition: border .1s, box-shadow .2s; transition: border-bottom-width .1s, box-shadow .2s;
} }
.profile-stats .item.active { .profile-stats .item.active {
@ -84,7 +84,7 @@
padding: 0; padding: 0;
width: 100%; width: 100%;
box-shadow: 0 1px 3px 0 rgba(0,0,0,.25); box-shadow: 0 1px 3px 0 rgba(0,0,0,.25);
z-index: 1; z-index: 2;
} }
#profile-sub-header.fixedTop { #profile-sub-header.fixedTop {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -204,7 +204,6 @@ $(function () {
} else { } else {
defaultDate = new Date(); defaultDate = new Date();
} }
console.log('lteasdf');
$('#datetimepicker').datetimepicker({ $('#datetimepicker').datetimepicker({
format: 'DD.MM.YYYY HH:mm', format: 'DD.MM.YYYY HH:mm',
stepping: '10', stepping: '10',

View File

@ -343,3 +343,15 @@ function loadNotificationsAsync() {
} }
loadNotificationsAsync(); loadNotificationsAsync();
$('#switchDarkmode').click(function (event) {
event.preventDefault();
$('body').toggleClass('dark');
if($('body').hasClass('dark')) {
$(this).find('.fa-moon').removeClass('fa').addClass('far');
$(this).attr('data-title', 'Light Theme')
} else {
$(this).find('.fa-moon').removeClass('far').addClass('fa');
$(this).attr('data-title', 'Dark Theme')
}
});

View File

@ -61,3 +61,33 @@ function updateYearSelection() {
updateMonthSelection(); updateMonthSelection();
updateDaySelection(); updateDaySelection();
updateYearSelection(); updateYearSelection();
$(function () {
$('#color').colorpicker({
inline: true,
container: true,
format: 'hsl',
useAlpha: false,
fallbackColor: '#2272ff',
})
.on('colorpickerChange colorpickerCreate', function (e) {
$('#customColor').html(`
.text-custom {
color: ${e.value} !important
}
.bg-custom {
background-color: ${e.value} !important
}
.bg-custom * {
color: ${e.color.isDark() ? '#fff' : '#333'} !important;
fill: ${e.color.isDark() ? '#fff' : '#333'} !important;
}
.border-custom {
border-color: ${e.value} !important
}
`)
});
});

View File

@ -45,6 +45,7 @@ $(window).scroll(function () {
if ($(this).scrollTop() + 75 > scrollTrigger.offset().top) { if ($(this).scrollTop() + 75 > scrollTrigger.offset().top) {
parallaxActive = false; parallaxActive = false;
$('#profile-sub-header').addClass('fixedTop').css('transform', 'translate3d(0,0,0)'); $('#profile-sub-header').addClass('fixedTop').css('transform', 'translate3d(0,0,0)');
$('#profile-content').css('transform', 'translate3d(0, ' + $('#profile-sub-header').height() + 'px, 0)');
} else { } else {
parallaxActive = true; parallaxActive = true;
$('#profile-sub-header').removeClass('fixedTop'); $('#profile-sub-header').removeClass('fixedTop');