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';

File diff suppressed because it is too large Load Diff

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');

File diff suppressed because it is too large Load Diff

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,207 +1,243 @@
<?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(); {
$this->load->model('projectsModel', '', TRUE); parent::__construct();
} $this->load->model('projectsModel', '', TRUE);
public function getEntries($category) {
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();
} else {
$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 ORDER BY datetime DESC')->result_array();
} }
$content = $this->mergeTranslationData($content, $_SESSION['site_lang']); public function getEntries($category)
{
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();
} else {
$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 ORDER BY datetime DESC')->result_array();
}
return $content; $content = $this->mergeTranslationData($content, $_SESSION['site_lang']);
}
public function getCategories() { return $content;
$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;
}
public function editEntry($data, $id) {
$this->db->update('projects', $data, ['id' => $id]);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function addEntry($data) {
$this->db->insert('projects', $data);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('admin', 'projects');
}
public function delete($id) {
$this->db->query('DELETE FROM projects WHERE ID = ? LIMIT 1', [$id]);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function deleteCategory($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->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function checkIfExists($id) {
$result = $this->db->query('SELECT ID FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array();
if(!empty($result)) {
return true;
} else {
return false;
} }
}
public function checkIfNameExists($name) { public function mergeTranslationData($postList, $lang = 'de')
$result = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array(); {
if(!empty($result)) { foreach ($postList as $i => $post) {
return true; $data = $this->db->query('SELECT * FROM projects_translations WHERE projectID = ? AND (lang = ? OR lang = ?) ORDER BY lang', [$post['ID'], 'de', $lang])->result_array();
} else { if (sizeof($data) == 1) {
return false; $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 getEntry($id) { public function getCategories()
return $this->db->query('SELECT * FROM projects WHERE ID = ? LIMIT 1', [$id])->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;
public function getEntryByName($name, $lang = 'de') {
$result = $this->db->query('SELECT * FROM projects WHERE name = ? LIMIT 1', [$name])->result_array();
$result = $this->mergeTranslationData($result, $lang);
return !empty($result) ? $result[0] : null;
}
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();
}
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 updateCategories($postID, $categories) {
$this->resetEntryCategories($postID);
foreach ($categories as $category) {
$this->addCategoryToEntryID($postID, $category);
} }
}
public function addCategoryToEntryName($name, $categoryID) { public function editEntry($data, $id)
$id = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array()[0]; {
$this->addCategoryToEntryID(intval($id['ID']), $categoryID); $this->db->update('projects', $data, ['id' => $id]);
} $this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function getPrevProject($id) { public function addEntry($data)
$result = $this->db->query('SELECT * FROM projects WHERE datetime < (SELECT datetime FROM projects WHERE ID = ?) ORDER BY datetime DESC LIMIT 1', [$id])->result_array(); {
$this->db->insert('projects', $data);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('admin', 'projects');
}
$result = $this->mergeTranslationData($result, $_SESSION['site_lang']); public function delete($id)
{
$this->db->query('DELETE FROM projects WHERE ID = ? LIMIT 1', [$id]);
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
return $result; public function deleteCategory($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->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('admin', 'projects');
}
public function getNextProject($id) { public function checkIfExists($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 ID FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array();
if (!empty($result)) {
return true;
} else {
return false;
}
}
$result = $this->mergeTranslationData($result, $_SESSION['site_lang']); public function checkIfNameExists($name)
{
$result = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array();
if (!empty($result)) {
return true;
} else {
return false;
}
}
return $result; public function getEntry($id)
} {
return $this->db->query('SELECT * FROM projects WHERE ID = ? LIMIT 1', [$id])->result_array();
}
public function addVote($projectID, $userID, $voteType) { public function getEntryByName($name, $lang = 'de')
$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]); $result = $this->db->query('SELECT * FROM projects WHERE name = ? LIMIT 1', [$name])->result_array();
$this->db->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('projects', 'addVote');
$this->db->cache_delete('admin', 'projects');
}
public function getVoteCount($projectID) { $result = $this->mergeTranslationData($result, $lang);
$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'];
}
public function getUserVoteType($projectID, $userID) { return !empty($result) ? $result[0] : null;
$result = $this->db->query('SELECT type FROM projects_entry_votes WHERE projectID = ? AND userID = ?', [$projectID, $userID])->result_array(); }
if(empty($result))
return 0;
return $result[0]['type'];
}
public function createNewProjectDraft() { public function getEntryCategories($id)
$this->db->query('INSERT INTO projects () VALUES ()'); {
return $this->db->query('SELECT * FROM projects_categories WHERE ID IN (SELECT categoryID FROM projects_entry_categories WHERE projectID = ?)', [$id])->result_array();
}
$this->db->cache_delete('admin', 'projects'); public function updateCategories($postID, $categories)
{
$this->resetEntryCategories($postID);
foreach ($categories as $category) {
$this->addCategoryToEntryID($postID, $category);
}
}
$data = $this->db->query('SELECT ID FROM projects ORDER BY ID DESC LIMIT 1')->result_array(); public function resetEntryCategories($postID)
return $data[0]['ID']; {
} $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 updateProject($id, $translations, $url, $download, $openSource, $customLink, $date, $image) { public function addCategoryToEntryID($postID, $categoryID)
$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('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');
}
$this->db->cache_off(); public function addCategoryToEntryName($name, $categoryID)
foreach($translations as $lang => $translation) { {
$data = $this->db->query('SELECT translationID FROM projects_translations WHERE projectID = ? AND lang = ?', [$id, $lang])->result_array(); $id = $this->db->query('SELECT ID FROM projects WHERE name = ? LIMIT 1', [$name])->result_array()[0];
$this->addCategoryToEntryID(intval($id['ID']), $categoryID);
}
if(empty($data)) { public function getPrevProject($id)
$this->db->query('INSERT INTO projects_translations (projectID, lang) VALUES (?, ?)', [$id, $lang]); {
$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']);
return $result;
}
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->mergeTranslationData($result, $_SESSION['site_lang']);
return $result;
}
public function addVote($projectID, $userID, $voteType)
{
$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->cache_delete('projects', 'index');
$this->db->cache_delete('projects', 'entry');
$this->db->cache_delete('projects', 'addVote');
$this->db->cache_delete('admin', 'projects');
}
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();
return $result[0]['voteCount'];
}
public function getUserVoteType($projectID, $userID)
{
$result = $this->db->query('SELECT type FROM projects_entry_votes WHERE projectID = ? AND userID = ?', [$projectID, $userID])->result_array();
if (empty($result))
return 0;
return $result[0]['type'];
}
public function createNewProjectDraft()
{
$this->db->query('INSERT INTO projects () VALUES ()');
$this->db->cache_delete('admin', 'projects');
$data = $this->db->query('SELECT ID FROM projects ORDER BY ID DESC LIMIT 1')->result_array();
return $data[0]['ID'];
}
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->cache_off();
foreach ($translations as $lang => $translation) {
$data = $this->db->query('SELECT translationID FROM projects_translations WHERE projectID = ? AND lang = ?', [$id, $lang])->result_array(); $data = $this->db->query('SELECT translationID FROM projects_translations WHERE projectID = ? AND lang = ?', [$id, $lang])->result_array();
if (empty($data)) {
$this->db->query('INSERT INTO projects_translations (projectID, lang) VALUES (?, ?)', [$id, $lang]);
$data = $this->db->query('SELECT translationID FROM projects_translations WHERE projectID = ? AND lang = ?', [$id, $lang])->result_array();
}
$translationID = $data[0]['translationID'];
$this->db->query('UPDATE projects_translations SET title = ?, description = ?, content = ?, downloadName = ?, openSourceName = ?, customLinkName = ? WHERE translationID = ?', array_merge($translation, [$download['name'], $openSource['name'], $customLink['name'], $translationID]));
} }
$this->db->cache_on();
$translationID = $data[0]['translationID']; $this->db->cache_delete('admin', 'projects');
$this->db->cache_delete('projects', 'index');
$this->db->query('UPDATE projects_translations SET title = ?, description = ?, content = ?, downloadName = ?, openSourceName = ?, customLinkName = ? WHERE translationID = ?', array_merge($translation, [$download['name'], $openSource['name'], $customLink['name'], $translationID])); $this->db->cache_delete('projects', 'entry');
} }
$this->db->cache_on();
$this->db->cache_delete('admin', 'projects'); public function mergeFullTranslationData($postList)
$this->db->cache_delete('projects', 'index'); {
$this->db->cache_delete('projects', 'entry'); foreach ($postList as $i => $post) {
} $data = $this->db->query('SELECT * FROM projects_translations WHERE projectID = ? ORDER BY lang', [$post['ID']])->result_array();
foreach ($data as $lang) {
public function mergeTranslationData($postList, $lang = 'de') { $postList[$i]['translations'][$lang['lang']] = $lang;
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];
} }
} }
return $postList;
$postList[$i] = array_merge($post, $merged);
} }
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,51 +227,49 @@
</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> <?php foreach ($currentlyActiveUsers as $activeUser):
<?php foreach ($currentlyActiveUsers as $activeUser): $loginTime = strtotime($activeUser['lastLogin']); ?>
$loginTime = strtotime($activeUser['lastLogin']); ?> <div class="user-item">
<img src="<?= $activeUser['profile_picture'] ?>?w=50" alt="" class="img-fluid rounded-circle">
<div class="user-info">
<a href="<?= base_url('user/' . $activeUser['username']) ?>">
<h2><?= $activeUser['displayname'] ?></h2>
</a>
<small><?= $activeUser['follower_count'] ?> Followers | online
seit <?= str_replace(['vor ', ' ago', 'il y a '], ['', '', ''], DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$loginTime"), $_SESSION['site_lang'])) ?></small>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
<h2><?= lang('home_newest_users') ?></h2>
<?php
foreach ($newestUsers as $newestUser):
$registeredDate = strtotime($newestUser['date_created']); ?>
<div class="user-item"> <div class="user-item">
<img src="<?= $activeUser['profile_picture'] ?>?w=50" alt="" class="img-fluid rounded-circle"> <img src="<?= $newestUser['profile_picture'] ?>?w=50" alt="" class="img-fluid rounded-circle">
<div class="user-info"> <div class="user-info">
<a href="<?= base_url('user/' . $activeUser['username']) ?>"> <a href="<?= base_url('user/' . $newestUser['username']) ?>">
<h2><?= $activeUser['displayname'] ?></h2> <h2><?= $newestUser['displayname'] ?></h2>
</a> </a>
<small><?= $activeUser['follower_count'] ?> Followers | online <small><?= $newestUser['follower_count'] ?> Followers |
seit <?= str_replace(['vor ', ' ago', 'il y a '], ['', '', ''], DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$loginTime"), $_SESSION['site_lang'])) ?></small> registriert
seit <?= str_replace(['vor ', ' ago', 'il y a '], ['', '', ''], DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$registeredDate"), $_SESSION['site_lang'])) ?></small>
</div> </div>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<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_newest_users') ?></h2> <h2><?= lang('home_newest_posts') ?></h2>
<?php <ul class="comment-list">
foreach ($newestUsers as $newestUser): <?php foreach ($newestPosts as $newestPost):
$registeredDate = strtotime($newestUser['date_created']); ?> $this->load->view('network/posts/post_item', $newestPost);
<div class="user-item"> endforeach; ?>
<img src="<?= $newestUser['profile_picture'] ?>?w=50" alt="" class="img-fluid rounded-circle"> </ul>
<div class="user-info">
<a href="<?= base_url('user/' . $newestUser['username']) ?>">
<h2><?= $newestUser['displayname'] ?></h2>
</a>
<small><?= $newestUser['follower_count'] ?> Followers |
registriert
seit <?= str_replace(['vor ', ' ago', 'il y a '], ['', '', ''], DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$registeredDate"), $_SESSION['site_lang'])) ?></small>
</div>
</div>
<?php endforeach; ?>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
<h2><?= lang('home_newest_posts') ?></h2>
<ul class="comment-list">
<?php foreach ($newestPosts as $newestPost):
$this->load->view('network/posts/post_item', $newestPost);
endforeach; ?>
</ul>
</div>
</div> </div>
</div> </div>
</section> </section>
@ -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'] ?>

File diff suppressed because it is too large Load Diff

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

@ -28,7 +28,7 @@ $('#birthdate-month').change(function () {
}); });
$('#birthdate-year').change(function () { $('#birthdate-year').change(function () {
if(parseInt($('#birthdate-year').val()) % 4 === 0 && $('#birthdate-month').val() === 2) { if (parseInt($('#birthdate-year').val()) % 4 === 0 && $('#birthdate-month').val() === 2) {
updateDaySelection(29); updateDaySelection(29);
} }
}); });
@ -53,7 +53,7 @@ function updateDaySelection() {
function updateYearSelection() { function updateYearSelection() {
const curYear = new Date().getFullYear(); const curYear = new Date().getFullYear();
for(let i = curYear; i >= curYear - 120; i--) { for (let i = curYear; i >= curYear - 120; i--) {
$('#birthdate-year').append('<option value="' + i + '">' + i + '</option>'); $('#birthdate-year').append('<option value="' + i + '">' + i + '</option>');
} }
} }
@ -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');