Changes of the last few months including restructuring system from using only ranks to permissions
This commit is contained in:
parent
72f3434803
commit
1a1ac17ecf
|
@ -102,7 +102,7 @@ class Blog extends MY_Controller {
|
|||
}
|
||||
|
||||
function add() {
|
||||
if(isset($_SESSION['user']) && $_SESSION['user']['rank'] >= 6) {
|
||||
if(isset($_SESSION['user']) && $this->hasPermission('blog.create')) {
|
||||
redirect('/admin/blog/add');
|
||||
} else {
|
||||
redirect('/blog');
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Faq extends MY_Controller {
|
||||
class Faq extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('faq');
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,12 @@ class File extends MY_Controller
|
|||
header("Content-Disposition: attachment; filename=" . $file['name'] . '.' . explode('/', $file['type'])[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];
|
||||
$imagePath = 'files' . DIRECTORY_SEPARATOR .
|
||||
($file['isUserData'] ? 'userContent' . DIRECTORY_SEPARATOR : '') .
|
||||
(isset($_GET['w']) || isset($_GET['h']) ? 'thumbs' . DIRECTORY_SEPARATOR : '') .
|
||||
$file['name'] . (isset($_GET['w']) ? '_w' . $_GET['w'] : '') .
|
||||
(isset($_GET['h']) ? '_h' . $_GET['h'] : '') . '.' .
|
||||
explode('.', $file['path'])[1];
|
||||
|
||||
if (!file_exists($imagePath)) {
|
||||
$config['image_library'] = 'gd2';
|
||||
|
|
|
@ -143,8 +143,8 @@
|
|||
{
|
||||
unset($_SESSION['user']);
|
||||
$this->load->helper('cookie');
|
||||
delete_cookie('rememberMe');
|
||||
delete_cookie('token');
|
||||
// delete_cookie('rememberMe');
|
||||
// delete_cookie('token');
|
||||
$notice = '<div class="alert alert-warning alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-label="Schließen"><span aria-hidden="true">×</span></button><strong>Abgemeldet!</strong> Du wurdest erfolgreich abgemeldet! Ich hoffe wir sehen uns bald wieder.</div>';
|
||||
$_SESSION['notice'] = $notice;
|
||||
$_SESSION['loggedOut'] = true;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('home');
|
||||
parent::__construct('home', 'profile');
|
||||
$this->load->model('YoutubePlayerModel', '', TRUE);
|
||||
$this->load->model('SocialMediaModel', '', TRUE);
|
||||
$this->load->model('UserModel', '', TRUE);
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Redirect extends CI_Controller {
|
||||
class Redirect extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('RedirectModel', '', TRUE);
|
||||
}
|
||||
|
||||
public function index($redirect = null) {
|
||||
public function index($redirect = null)
|
||||
{
|
||||
if ($redirect == null) {
|
||||
redirect(base_url());
|
||||
} else {
|
||||
|
@ -16,10 +19,17 @@ class Redirect extends CI_Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function p($redirect = null) {
|
||||
var_dump($redirect);
|
||||
if($redirect == null) {
|
||||
if(isset($_SESSION['user']) && $_SESSION['user']['rank'] >= 9) {
|
||||
public function p($redirect = null)
|
||||
{
|
||||
if ($redirect != null) {
|
||||
$url = $this->RedirectModel->getUrl($redirect);
|
||||
redirect($url);
|
||||
}
|
||||
|
||||
if (!$this->hasPermission('redirect.view')) {
|
||||
redirect(base_url());
|
||||
}
|
||||
|
||||
$returnMessage = '';
|
||||
if (isset($_POST['redirectInput']) && !empty($_POST['redirectInput']) && isset($_POST['redirectUrl']) && !empty($_POST['redirectUrl'])) {
|
||||
$feedback = $this->redirect->insertRedirect($_POST['redirectUrl'], $_POST['redirectInput']);
|
||||
|
@ -33,13 +43,6 @@ class Redirect extends CI_Controller {
|
|||
$this->load->view('header', ['title' => 'Redirect-Manager', 'active' => '']);
|
||||
$this->load->view('redirect', ['message' => $returnMessage, 'allItems' => $this->RedirectModel->getItems()]);
|
||||
$this->load->view('footer');
|
||||
} else {
|
||||
header("Location: /");
|
||||
}
|
||||
} else {
|
||||
$url = $this->RedirectModel->getUrl($redirect);
|
||||
header("Location: " . $url);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -499,14 +499,17 @@ class User extends MY_Controller
|
|||
$_SESSION['profileEditNotification'] .= "<div class='alert alert-danger' role='alert'><b>Bitte gib dein Passwort ein!</b> Das Ändern der E-Mail-Adresse ist ein tiefgreifender Eingriff in den Account. Daher benötigen wir zur Sicherheit nochmal dein Passwort.</div>";
|
||||
}
|
||||
}
|
||||
|
||||
// Notifications
|
||||
if (isset($_POST['email-notifications'])) {
|
||||
$newData['receiveEmails'] = filter_var($_POST['email-notifications'], FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
// Newsletter
|
||||
if (isset($_POST['newsletter'])) {
|
||||
$newData['receiveNewsletter'] = filter_var($_POST['newsletter'], FILTER_VALIDATE_BOOLEAN);
|
||||
}
|
||||
|
||||
// Password
|
||||
if (isset($_POST['passwordNew'])) {
|
||||
if (isset($_POST['passwordOld'])) {
|
||||
|
@ -536,7 +539,7 @@ class User extends MY_Controller
|
|||
}
|
||||
}
|
||||
if (isset($_POST['showAds'])) {
|
||||
if (isset($_SESSION['user']) && $_SESSION['user']['rank'] >= 2) {
|
||||
if ($this->hasPermission('user.disableAds')) {
|
||||
$newData['showAds'] = filter_var($_POST['email-notifications'], FILTER_VALIDATE_BOOLEAN);
|
||||
} else {
|
||||
$_SESSION['profileEditNotification'] .= "<div class='alert alert-danger' role='alert'><b>Du bist dazu nicht berechtigt!</b> Um diese Einstellung zu verändern, musst du mindestens ein Premium-Nutzer oder höher sein!</div>";
|
||||
|
|
|
@ -298,7 +298,7 @@ class Blog extends CI_Controller
|
|||
$categories = $this->BlogModel->getCategories();
|
||||
$this->load->view('admin/sidebar', ['title' => 'Blog-Post erstellen', 'additionalStyles' => ['lib/medium-editor.min.css', 'lib/default.min.css', 'lib/medium-editor-insert-plugin.min.css']]);
|
||||
$this->load->view('admin/blog_edit', ['categories' => $categories, 'postID' => $postID, 'contents' => $contents, 'translations' => $translations, 'postLanguage' => $lang]);
|
||||
$this->load->view('admin/footer', ['additionalScripts' => 'lib/medium-editor.min.js,lib/handlebars.runtime-v4.0.10.js,lib/jquery-sortable.min.js,lib/jquery.ui.widget.js,lib/jquery.iframe-transport.js,lib/jquery.fileupload.js,lib/medium-editor-insert-plugin.min.js,lib/autolist.min.js,lib/highlight.pack.js,lib/quill.min.js,blog-edit.js']);
|
||||
$this->load->view('admin/footer', ['additionalScripts' => ['lib/medium-editor.min.js', 'lib/handlebars.runtime-v4.0.10.js', 'lib/jquery-sortable.min.js', 'lib/jquery.ui.widget.js', 'lib/jquery.iframe-transport.js', 'lib/jquery.fileupload.js', 'lib/medium-editor-insert-plugin.min.js', 'lib/autolist.min.js', 'lib/highlight.pack.js', 'lib/quill.min.js', 'blog-edit.js']]);
|
||||
}
|
||||
|
||||
public function history($postID = NULL)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Dashboard extends CI_Controller {
|
||||
class Dashboard extends MY_Controller {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
|
@ -9,7 +9,8 @@ class Dashboard extends CI_Controller {
|
|||
|
||||
public function index()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 6) redirect(base_url('login'));
|
||||
$this->neededPermission('dashboard.view');
|
||||
|
||||
$this->load->view('admin/sidebar', ['title' => 'Dashboard']);
|
||||
$this->load->view('admin/dashboard');
|
||||
$this->load->view('admin/footer');
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Downloads extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('downloadsModel', '', TRUE);
|
||||
$this->load->model('FileModel', '', TRUE);
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$downloads = $this->downloadsModel->getDownloads();
|
||||
$this->load->view('admin/sidebar', ['title' => 'Alle Downloads']);
|
||||
$this->load->view('admin/downloads', ['downloads' => $downloads]);
|
||||
$this->load->view('admin/footer');
|
||||
}
|
||||
|
||||
public function edit($id = NULL)
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$edit = $id === NULL ? false : true;
|
||||
$p = $this->input->post(['title', 'description', 'descriptionEnglish', 'image', 'url', 'datetime']);
|
||||
|
||||
if ($edit) {
|
||||
if ($this->downloadsModel->checkIfExists($id)) {
|
||||
$downloadContent = $this->downloadsModel->getDownload($id);
|
||||
} else {
|
||||
redirect(base_url('admin/downloads/edit'));
|
||||
}
|
||||
|
||||
if ($p['title'] != NULL && $p['description'] != NULL && $p['datetime'] != NULL && $p['url'] !== NULL) {
|
||||
$imgurl = '/assets/images/placeholder.jpg';
|
||||
if (isset($_FILES['downloadImage']) && $_FILES['downloadImage']['size'] > 0) {
|
||||
$fileName = $_FILES['downloadImage']['name'];
|
||||
$tmpName = $_FILES['downloadImage']['tmp_name'];
|
||||
$fileSize = $_FILES['downloadImage']['size'];
|
||||
$fileType = $_FILES['downloadImage']['type'];
|
||||
unset($_FILES['downloadImage']);
|
||||
|
||||
$imgurl = $this->FileModel->uploadFile($fileName, $tmpName, $fileSize, $fileType);
|
||||
}
|
||||
$this->downloadsModel->addNewDownload($p['datetime'], $p['title'], $p['description'], $p['descriptionEnglish'], $imgurl, $p['url']);
|
||||
redirect(base_url('admin/downloads/edit/' . $id));
|
||||
}
|
||||
|
||||
$this->load->view('admin/sidebar', ['title' => 'Download-Eintrag bearbeiten']);
|
||||
$this->load->view('admin/download_edit', ['edit' => $edit, 'content' => $downloadContent]);
|
||||
$this->load->view('admin/footer');
|
||||
} else {
|
||||
if ($p['title'] != NULL && $p['description'] != NULL && $p['datetime'] != NULL && isset($_FILES['downloadImage']) && $_FILES['downloadImage']['size'] > 0 && $p['url'] !== NULL) {
|
||||
$fileName = $_FILES['downloadImage']['name'];
|
||||
$tmpName = $_FILES['downloadImage']['tmp_name'];
|
||||
$fileSize = $_FILES['downloadImage']['size'];
|
||||
$fileType = $_FILES['downloadImage']['type'];
|
||||
|
||||
$imgurl = $this->FileModel->uploadFile($fileName, $tmpName, $fileSize, $fileType);
|
||||
unset($_FILES['downloadImage']);
|
||||
|
||||
$this->downloadsModel->addNewDownload($p['datetime'], $p['title'], $p['description'], $p['descriptionEnglish'], $imgurl, $p['url']);
|
||||
redirect(base_url('admin/downloads/edit'));
|
||||
}
|
||||
|
||||
$this->load->view('admin/sidebar', ['title' => 'Download-Eintrag erstellen']);
|
||||
$this->load->view('admin/download_edit', ['edit' => $edit]);
|
||||
$this->load->view('admin/footer');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Feedback extends CI_Controller
|
||||
class Feedback extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
@ -11,7 +11,7 @@ class Feedback extends CI_Controller
|
|||
}
|
||||
|
||||
public function index() {
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('feedback.receive');
|
||||
|
||||
$feedback = $this->MessageModel->getFeedbackMessages();
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Feedback extends CI_Controller
|
|||
}
|
||||
|
||||
public function takeover($id = null, $state = 1) {
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('feedback.reply');
|
||||
|
||||
if($id != null) {
|
||||
$this->MessageModel->setFeedbackSupporter($id, $_SESSION['user']['ID'], $state);
|
||||
|
@ -31,7 +31,7 @@ class Feedback extends CI_Controller
|
|||
}
|
||||
|
||||
public function change($id) {
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('feedback.reply');
|
||||
|
||||
if($id != null) {
|
||||
$newStatus = $this->input->post('feedbackState');
|
||||
|
@ -44,7 +44,7 @@ class Feedback extends CI_Controller
|
|||
|
||||
public function archive() {
|
||||
// header('Content-Type: application/json');
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) {
|
||||
if (!$this->hasPermission('feedback.reply')) {
|
||||
echo json_encode(['type' => 'error', 'message' => 'Du musst eingeloggt sein, um Feedbacks zu beantworten.']);
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Files extends CI_Controller
|
||||
class Files extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
@ -12,7 +12,7 @@ class Files extends CI_Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('file.view');
|
||||
|
||||
if(isset($_FILES['fileUpload'])) {
|
||||
$fileName = $_FILES['fileUpload']['name'];
|
||||
|
@ -20,7 +20,7 @@ class Files extends CI_Controller
|
|||
$fileSize = $_FILES['fileUpload']['size'];
|
||||
$fileType = $_FILES['fileUpload']['type'];
|
||||
|
||||
$this->FileModel->uploadFile($fileName, $tmpName, $fileSize, $fileType);
|
||||
$this->FileModel->uploadFile($fileName, $tmpName, $fileSize, $fileType, false);
|
||||
|
||||
unset($_FILES['fileUpload']);
|
||||
|
||||
|
@ -36,7 +36,8 @@ class Files extends CI_Controller
|
|||
}
|
||||
|
||||
public function delete() {
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('file.delete');
|
||||
|
||||
$id = filter_input(INPUT_POST, "id");
|
||||
$this->FileModel->delete($id);
|
||||
}
|
||||
|
@ -44,7 +45,7 @@ class Files extends CI_Controller
|
|||
public function uploadImage()
|
||||
{
|
||||
header("Content-Type: application/json");
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 6) {
|
||||
if (!$this->hasPermission('file.uploadManual')) {
|
||||
echo json_encode([
|
||||
'success' => false,
|
||||
'message' => '<b>Fehler beim Upload!</b> Aufgrund von zu geringen Zugriffsrechten konnte das Bild leider nicht hochgeladen werden. Sollte es sich dabei um ein Irrtum handeln, kontaktiere bitte einen Admin über das Kontaktformular.'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Projects extends CI_Controller
|
||||
class Projects extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
public function index()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('projects.view');
|
||||
|
||||
$entries = $this->ProjectsModel->getEntries('all');
|
||||
$categories = $this->ProjectsModel->getCategories('all');
|
||||
|
@ -25,12 +25,17 @@
|
|||
|
||||
public function edit($id = NULL)
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('projects.create');
|
||||
|
||||
$edit = $id === NULL ? false : true;
|
||||
|
||||
$content = null;
|
||||
$projectCategories = [];
|
||||
|
||||
if ($edit) {
|
||||
// TODO: Check if project is created by user or not
|
||||
$this->neededPermission('projects.edit');
|
||||
|
||||
if ($this->ProjectsModel->checkIfExists($id)) {
|
||||
$content = $this->ProjectsModel->getEntry($id);
|
||||
$content = $this->ProjectsModel->mergeFullTranslationData($content)[0];
|
||||
|
@ -50,8 +55,16 @@
|
|||
public function sendEdit()
|
||||
{
|
||||
header('Content-Type: application/json');
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) {
|
||||
echo json_encode(['success' => false, 'message' => 'Du hast nicht genügend Rechte, um Projekte zu erstellen bzw. bearbeiten.']);
|
||||
if (!$this->hasPermission('projects.create')) {
|
||||
echo json_encode(['success' => false, 'message' => 'Du hast nicht genügend Rechte, um Projekte zu erstellen.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$editingID = $this->input->post('editingID');
|
||||
|
||||
// TODO: Check if user is author of project
|
||||
if($editingID !== '-1' && !$this->hasPermission('projects.edit')) {
|
||||
echo json_encode(['success' => false, 'message' => 'Du hast nicht genügend Rechte, um Projekte zu bearbeiten.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -83,7 +96,6 @@
|
|||
$date = date('Y-m-d H:i:s', strtotime($this->input->post('date')));
|
||||
$image = $this->input->post('image');
|
||||
|
||||
$editingID = $this->input->post('editingID');
|
||||
|
||||
if($editingID == '-1' && $this->ProjectsModel->checkIfNameExists($url)) {
|
||||
echo json_encode(['success' => false, 'message' => 'Die angegebene URL ist bereits vergeben.']);
|
||||
|
@ -102,14 +114,17 @@
|
|||
|
||||
public function delete()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
// TODO: Check if user is author of project
|
||||
$this->neededPermission('projects.delete');
|
||||
|
||||
$id = filter_input(INPUT_POST, "id");
|
||||
$this->ProjectsModel->delete($id);
|
||||
}
|
||||
|
||||
public function delete_category()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('projects.deleteCategory');
|
||||
|
||||
$id = filter_input(INPUT_POST, "id");
|
||||
$this->ProjectsModel->deleteCategory($id);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Redirects extends CI_Controller
|
||||
class Redirects extends MY_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
|
@ -12,7 +12,8 @@ class Redirects extends CI_Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('redirect.view');
|
||||
|
||||
$redirects = $this->RedirectModel->getItems();
|
||||
$this->load->view('admin/sidebar', ['title' => 'Alle Weiterleitungen']);
|
||||
$this->load->view('admin/redirects', ['redirects' => $redirects]);
|
||||
|
@ -20,7 +21,7 @@ class Redirects extends CI_Controller
|
|||
}
|
||||
|
||||
public function addRedirect() {
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('redirect.create');
|
||||
|
||||
$id = $this->input->post('redirectID');
|
||||
$name = $this->input->post('redirectName');
|
||||
|
@ -28,6 +29,8 @@ class Redirects extends CI_Controller
|
|||
|
||||
if(isset($name) && isset($url)) {
|
||||
if(isset($id)) {
|
||||
$this->neededPermission('redirect.edit');
|
||||
|
||||
$this->RedirectModel->editRedirect($id, $url, $name);
|
||||
} else {
|
||||
$this->RedirectModel->insertRedirect($url, $name);
|
||||
|
@ -38,7 +41,7 @@ class Redirects extends CI_Controller
|
|||
}
|
||||
|
||||
public function removeRedirect($id = null) {
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('redirect.delete');
|
||||
|
||||
if($id != null) {
|
||||
$this->RedirectModel->removeRedirect($id);
|
||||
|
|
|
@ -3,27 +3,89 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
|
||||
class Users extends MY_Controller
|
||||
{
|
||||
private $availablePermissions;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->model('UserModel', '', TRUE);
|
||||
|
||||
$this->availablePermissions = [
|
||||
'projects' => [
|
||||
'view',
|
||||
'create',
|
||||
'editOwn',
|
||||
'edit',
|
||||
'deleteOwn',
|
||||
'delete',
|
||||
'deleteCategory',
|
||||
],
|
||||
'blog' => [
|
||||
'view',
|
||||
'create',
|
||||
'editOwn',
|
||||
'edit',
|
||||
'deleteOwn',
|
||||
'delete',
|
||||
'deleteOwnFinally',
|
||||
'deleteFinally',
|
||||
'createCategory',
|
||||
'publishNow',
|
||||
'publish',
|
||||
'publishSelf',
|
||||
],
|
||||
'file' => [
|
||||
'view',
|
||||
'upload',
|
||||
'uploadManually',
|
||||
'delete',
|
||||
],
|
||||
'redirect' => [
|
||||
'view',
|
||||
'create',
|
||||
'edit',
|
||||
'delete',
|
||||
],
|
||||
'user' => [
|
||||
'disableAds',
|
||||
'view',
|
||||
'viewDetails',
|
||||
'changeRank',
|
||||
'editPermissions',
|
||||
'ban',
|
||||
'deletePost',
|
||||
],
|
||||
'reports' => [
|
||||
'receive',
|
||||
],
|
||||
'feedback' => [
|
||||
'receive',
|
||||
'reply',
|
||||
],
|
||||
'contact' => [
|
||||
'view',
|
||||
'answer',
|
||||
],
|
||||
'dashboard' => [
|
||||
'view',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('user.view');
|
||||
|
||||
$usersData = $this->UserModel->getUserList(50, 0);
|
||||
|
||||
$this->load->view('admin/sidebar', ['title' => 'Alle Nutzer']);
|
||||
$this->load->view('admin/users', ['users' => $usersData]);
|
||||
$this->load->view('admin/footer');
|
||||
$this->load->view('admin/footer', ['additionalScripts' => ['admin_users.js']]);
|
||||
}
|
||||
|
||||
public function details($userID = NULL)
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('user.viewDetails');
|
||||
|
||||
if ($userID == NULL) redirect(base_url('admin/users'));
|
||||
|
||||
|
@ -39,7 +101,7 @@ class Users extends MY_Controller
|
|||
|
||||
public function settings($userID = NULL)
|
||||
{
|
||||
if (!isset($_SESSION['user']) || empty($_SESSION['user']) || $_SESSION['user']['rank'] < 9) redirect(base_url('login'));
|
||||
$this->neededPermission('user.viewDetails');
|
||||
|
||||
if ($userID == NULL) redirect(base_url('admin/users'));
|
||||
|
||||
|
@ -48,7 +110,9 @@ class Users extends MY_Controller
|
|||
if ($userData == null) redirect(base_url('admin/users'));
|
||||
$userData = $userData[0];
|
||||
|
||||
if (isset($_POST['rank'])) {
|
||||
$reload = false;
|
||||
|
||||
if ($this->hasPermission('user.changeRank') && isset($_POST['rank'])) {
|
||||
$rank = intval($_POST['rank']);
|
||||
if (($rank < 1) || ($rank > 3 && $rank < 6) || $rank > 10) {
|
||||
redirect(base_url(uri_string()));
|
||||
|
@ -74,11 +138,40 @@ class Users extends MY_Controller
|
|||
$this->UserModel->insertIntoHistory($historyData);
|
||||
// Update profile
|
||||
$this->UserModel->updateProfile(['rank' => $rank], $userID);
|
||||
|
||||
$reload = true;
|
||||
}
|
||||
|
||||
if($this->hasPermission('user.editPermissions') && isset($_POST['permissions'])) {
|
||||
$perms = array_keys($_POST['permissions']);
|
||||
|
||||
foreach ($this->availablePermissions as $group => $permissions) {
|
||||
foreach ($permissions as $permission) {
|
||||
$userHasPermission = $this->UserModel->hasPermission($userID, $group, $permission);
|
||||
|
||||
if(in_array($group . $permission, $perms)) { // Permission was given by user
|
||||
if(!$userHasPermission) { // Subject hasn't got the permission already
|
||||
$this->UserModel->addPermission($userID, $group, $permission, $_SESSION['user']['ID']);
|
||||
}
|
||||
} else {
|
||||
if($userHasPermission) {
|
||||
$this->UserModel->revokePermission($userID, $group, $permission);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$reload = true;
|
||||
}
|
||||
|
||||
if($reload) {
|
||||
redirect(base_url(uri_string()));
|
||||
}
|
||||
|
||||
$permissions = $this->UserModel->getPermissions($userID);
|
||||
|
||||
$this->load->view('admin/sidebar', ['title' => 'Nutzer-Einstellungen - ' . $userData['displayname']]);
|
||||
$this->load->view('admin/user_settings', ['user' => $userData]);
|
||||
$this->load->view('admin/footer');
|
||||
$this->load->view('admin/user_settings', ['user' => $userData, 'permissions' => $permissions, 'availablePermissions' => $this->availablePermissions]);
|
||||
$this->load->view('admin/footer', ['additionalScripts' => ['user-edit.js']]);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ class MY_Controller extends CI_Controller
|
|||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('cookie');
|
||||
$this->load->model('LoginModel', '', TRUE);
|
||||
|
||||
$lang = isset($_SESSION['site_lang']) ? $_SESSION['site_lang'] : 'de';
|
||||
$_SESSION['site_lang'] = $lang;
|
||||
|
@ -29,8 +30,27 @@ class MY_Controller extends CI_Controller
|
|||
$rememberMe = get_cookie('rememberMe');
|
||||
|
||||
if($rememberMe != NULL) {
|
||||
$token = get_cookie('token');
|
||||
var_dump($rememberMe, $token);
|
||||
$this->LoginModel->autoLogin();
|
||||
}
|
||||
}
|
||||
|
||||
public function hasPermission(...$permissions) {
|
||||
if(!isset($_SESSION['user']) || empty($_SESSION['user'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($permissions as $permission) {
|
||||
if(!in_array($permission, $_SESSION['user']['permissions'])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function neededPermission($permission) {
|
||||
if(!$this->hasPermission($permission)) {
|
||||
redirect(base_url());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,10 +16,12 @@ $lang['home_slider_video_des'] = 'Regieanweisung: <i>Bedenken Sie, einen Drücke
|
|||
$lang['home_slider_video_btn'] = 'Jetzt ansehen';
|
||||
|
||||
$lang['home_channels_title'] = 'YouTube-Kanäle';
|
||||
$lang['home_kingofdog_des'] = 'KingOfDog ist mein erster YouTube-Kanal und besteht mittlerweile schon seit über 4 Jahren. Hier gibt es Gaming, Fakten, Informationen, News, Meinungen, Reviews, Vlogs und vieles mehr. Über 600 Abonnenten können sich hier ca. 350 Videos ansehen.';
|
||||
$lang['home_zeybefx_des'] = 'Auf ZeybeFX gibt es seit über anderthalb Jahren Speedarts, Design-Tutorials, Giveaways und alle möglichen anderen Videos, die mit Design zu tun haben. Der Kanal ist englischsprachig und ist derzeit noch etwas inaktiv.';
|
||||
$lang['home_zeybeofficial_des'] = 'Der neueste Kanal von mir existiert erst seit Anfang 2017, ist dafür jedoch sehr aktiv. Täglich um 15 Uhr gibt es ein neues Video mit copyright-freier Musik, die jeder für seine eigenen Videos, Spiele, Webseiten, Podcasts oder ähnliches nutzen kann. Teilweise gibt es auch eigene Musik, die ich selbst erstellt habe.';
|
||||
$lang['home_kingofdog_des'] = 'KingOfDog ist mein erster YouTube-Kanal und besteht mittlerweile schon seit Ende 2013. Ging es früher hier um Gaming und Let\'s Plays, so dreht sich dieser Kanal heute eher um die Programmierwelt, Wissen, Politik sowie verschiedene andere Themen.';
|
||||
$lang['home_zeybefx_des'] = 'ZeybeFX ist leider aus Zeitgründen etwas inaktiver. Der eigentliche Zweck des Kanals sind Videos rund ums Thema Design. So gibt es auf ZeybeFX Speedarts, Tutorials, Tipps und Tricks für das Designen von Grafiken, Webseiten, Nutzerinterfaces, Spielen und so weiter.';
|
||||
$lang['home_zeybeofficial_des'] = 'Dieser Kanal, ZeybeOfficial, konzentriert sich auf die klangvolle Welt der Musik. Mit einigen selbstkomponierten Songs, aber auch Musik von anderen Künstlern bietet ZeybeOfficial eine Plattform für Copyright-freie Musik, die jeder in seinen Videos, Spielen oder Programmen kostenlos nutzen darf.';
|
||||
$lang['home_kingofdogint_des'] = 'KingOfDog International ist die internationale bzw. englische Version meines Hauptkanals KingOfDog. Hier gibt es übersetzte Videos vom deutschen Kanal, um mehr Menschen erreichen zu können.';
|
||||
$lang['home_kingofdogtv_des'] = 'KingOfDogTV ist mein Kanal für Livestreams aller Art. Zwar streame ich nicht sonderlich regelmäßig, aber wenn ich dann doch mal live sein sollte, wird das Resultat später auf KingOfDogTV hochgeladen.';
|
||||
$lang['home_minepoint_des'] = 'Der Kanal MinePoint ist die offizielle YouTube-Präsenz des mittlerweile nicht mehr fortgeführten Minecraft-Servers MinePoint, an dem ich vor einigen Jahren als Administrator, Entwickler und Video-Cutter mitgewirkt habe.';
|
||||
|
||||
$lang['home_active_users'] = 'Derzeit aktive Nutzer';
|
||||
$lang['home_newest_users'] = 'Neueste Nutzer';
|
||||
|
|
|
@ -16,10 +16,12 @@ $lang['home_slider_video_des'] = 'Stage direction: <i>Press the left mouse butto
|
|||
$lang['home_slider_video_btn'] = 'Watch now';
|
||||
|
||||
$lang['home_channels_title'] = 'YouTube Channels';
|
||||
$lang['home_kingofdog_des'] = 'KingOfDog is my very first YouTube channel and have existed meanwhile for more than 3 years. On this channel you get access to the newest games, facts, information, news, opinions, reviews, vlogs and much more. Over 600 subscribers can watch around 350 videos here.';
|
||||
$lang['home_zeybefx_des'] = 'There have been speedarts, design tutorials, giveaways, and much more videos dealing with design on ZeybeFX for more than one and a half years. This channel is in English and currently a little bit inactive.';
|
||||
$lang['home_zeybeofficial_des'] = 'The most recent channel of mine has existed since the beginning of 2017, but is very active. Each of the daily videos at 3 pm delivers you a new copyright free music track, which you can use in your own videos, games, websites, podcast, and similar things. Partially I upload my own music, which I created on my own, also.';
|
||||
$lang['home_kingofdog_des'] = 'KingOfDog is my very first YouTube channel and already exists since the end of 2013. While gaming and let\'s plays played a major role on this channel a few years ago, the main focus of KingOfDog are topics like programming, knowledge, politics and many more.';
|
||||
$lang['home_zeybefx_des'] = 'ZeybeFX sadly has not very much uploads because of a lack of time. However, this channel centres around design, as there are speedarts, tutorials, tips and tricks about making graphics, websites, user interfaces, games or else.';
|
||||
$lang['home_zeybeofficial_des'] = 'This channel focuses on the wonderful world of music. With partly self-composed music it is supposed to evolve to a practical platform with royalty-free music for everyon to use in their games, videos, programs and so on.';
|
||||
$lang['home_kingofdogint_des'] = 'KingOfDog International is the (as the name already tells) international, English version of my main channel KingOfDog. Here you can discover translated videos from the German channel - because subtitles aren\'t that cool.';
|
||||
$lang['home_kingofdogtv_des'] = 'KingOfDogTV is my channel for all the livestreams. Admittedly, I\'m not going live very often but if I do then the resulting video is uploaded to this channel so that everyone has an archive with all the previous livestreams.';
|
||||
$lang['home_minepoint_des'] = 'The channel MinePoint is the official YouTube page of the Minecraft server MinePoint which no longer exists. Anyways, I was administrator, developer and video creator of this server project a few years ago.';
|
||||
|
||||
$lang['home_active_users'] = 'Currently Active Users';
|
||||
$lang['home_newest_users'] = 'Newly Registered Users';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
$config['mailtype'] = 'html';
|
||||
$this->email->initialize($config);
|
||||
|
||||
$this->email->from('no-reply@kingofdog.eu', 'KingOfDog');
|
||||
$this->email->from('no-reply@kingofdog.eu', 'KingOfDog.eu');
|
||||
$this->email->to($recipient);
|
||||
|
||||
$this->email->subject($subject);
|
||||
|
|
|
@ -17,18 +17,22 @@ class FileModel extends CI_Model
|
|||
|
||||
public function uploadFile($original_name, $tmpname, $size, $type, $userContent = true)
|
||||
{
|
||||
$target_dir = "files" . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
|
||||
$target_dir = 'files' . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
|
||||
$filetype = pathinfo(basename($original_name), PATHINFO_EXTENSION);
|
||||
$target_file = $target_dir . $this->generateName() . '.' . $filetype;
|
||||
$name = explode('.' . $filetype, explode(DIRECTORY_SEPARATOR, $target_file)[1])[0];
|
||||
$name = $this->generateName();
|
||||
$target_file = $target_dir . $name . '.' . $filetype;
|
||||
|
||||
if (!move_uploaded_file($tmpname, $target_file)) {
|
||||
die('File couldn\'t be uploaded!');
|
||||
}
|
||||
|
||||
$target_file = str_replace('\\', '/', $target_file);
|
||||
|
||||
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $type, $size, $target_file, $userContent]);
|
||||
|
||||
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
|
||||
$this->db->cache_delete('admin', 'files');
|
||||
|
||||
echo shell_exec('python /var/www/codeigniter/duplicates.py');
|
||||
|
||||
return "/f/" . $name;
|
||||
}
|
||||
|
@ -58,7 +62,9 @@ class FileModel extends CI_Model
|
|||
|
||||
$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]);
|
||||
|
||||
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
|
||||
$this->db->cache_delete('admin', 'files');
|
||||
|
||||
echo shell_exec('python /var/www/codeigniter/duplicates.py');
|
||||
|
||||
return '/f/' . $data['raw_name'];
|
||||
}
|
||||
|
@ -113,25 +119,31 @@ class FileModel extends CI_Model
|
|||
|
||||
$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]);
|
||||
|
||||
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
|
||||
$this->db->cache_delete('admin', 'files');
|
||||
|
||||
echo shell_exec('python /var/www/codeigniter/duplicates.py');
|
||||
|
||||
return '/f/' . $data['raw_name'];
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadFileByContent($content, $original_name, $fullType, $fileSize, $userContent = true) {
|
||||
$target_dir = "files" . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
|
||||
$target_dir = 'files' . DIRECTORY_SEPARATOR . ($userContent ? 'userContent' . DIRECTORY_SEPARATOR : '');
|
||||
$filetype = pathinfo(basename($original_name), PATHINFO_EXTENSION);
|
||||
$target_file = $target_dir . $this->generateName() . '.' . $filetype;
|
||||
$name = explode('.' . $filetype, explode(DIRECTORY_SEPARATOR, $target_file)[1])[0];
|
||||
$name = $this->generateName();
|
||||
$target_file = $target_dir . $name . '.' . $filetype;
|
||||
|
||||
$fp = fopen($target_file, 'w');
|
||||
fwrite($fp, $content);
|
||||
fclose($fp);
|
||||
|
||||
$target_file = str_replace('\\', '/', $target_file);
|
||||
|
||||
$this->db->query('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (?, ?, ?, ?, ?, ?)', [$name, $original_name, $fullType, $fileSize, $target_file, $userContent]);
|
||||
|
||||
echo shell_exec(escapeshellcmd('python /var/www/codeigniter/duplicates.py'));
|
||||
$this->db->cache_delete('admin', 'files');
|
||||
|
||||
echo shell_exec('python /var/www/codeigniter/duplicates.py');
|
||||
|
||||
return '/f/' . $name;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
{
|
||||
parent::__construct();
|
||||
$this->load->model('NotificationModel', '', TRUE);
|
||||
$this->load->model('UserModel', '', TRUE);
|
||||
$this->load->model('EmailModel', '', TRUE);
|
||||
$this->load->helper('cookie');
|
||||
}
|
||||
|
@ -22,19 +23,26 @@
|
|||
}
|
||||
$logindata = $logindata[0];
|
||||
|
||||
if($logindata['isDeleted']) {
|
||||
$_SESSION['notice'] .= '<div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-label="Schließen"><span aria-hidden="true">×</span></button><strong>Der Account wurde deaktiviert!</strong> Dein Account wurde vom System deaktiviert, womöglich aufgrund von Fehlverhalten (beispielsweise in Form von anstößigen, unerwünschten, diskriminierenden oder volksverhetzenden Kommentaren, Posts oder Namen). Solltest du dies für ein Fehler halten, nutze bitte das Kontaktformular, um dich <b>höflich</b> zu beschweren.</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
$encryptedPassword = $this->getPasswordHash($password, $logindata['original_name']);
|
||||
|
||||
if ($encryptedPassword == $logindata['password']) {
|
||||
$this->startLoginSession($logindata, $rememberMe);
|
||||
} else {
|
||||
$_SESSION['notice'] .= '<div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-label="Schließen"><span aria-hidden="true">×</span></button><strong>Falsche Anmeldedaten!</strong> Benutzername und Passwort stimmen nicht überein!</div>';
|
||||
$_SESSION['notice'] .= '<div class="alert alert-danger alert-dismissible"><button type="button" class="close" data-dismiss="alert" aria-label="Schließen"><span aria-hidden="true">×</span></button><strong>Falsche Anmeldedaten!</strong> Benutzername oder Passwort stimmen nicht mit unseren Akten überein.</div>';
|
||||
}
|
||||
}
|
||||
|
||||
public function getLoginData($username)
|
||||
{
|
||||
$this->db->cache_off();
|
||||
$return = $this->db->query('SELECT * FROM users WHERE (username = lower(?) OR email = lower(?)) AND is_activated = TRUE LIMIT 1',
|
||||
[htmlspecialchars($username, ENT_QUOTES), $username])->result_array();
|
||||
$this->db->cache_on();
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -47,26 +55,26 @@
|
|||
|
||||
public function startLoginSession($logindata, $rememberMe)
|
||||
{
|
||||
$_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;
|
||||
}
|
||||
$this->reloadLoginSession($logindata);
|
||||
|
||||
$this->db->query('UPDATE users SET isCurrentlyOnline = 1, lastLogin = CURRENT_TIMESTAMP() WHERE ID = ?', [$logindata['ID']]);
|
||||
|
||||
if ($rememberMe == 'on') {
|
||||
$expire = time() + 3600 * 24 * 60;
|
||||
$expire = 3600 * 24 * 60;
|
||||
$userHash = $this->LoginModel->getUserHash($logindata['username'], $logindata['password'], $logindata['email'], $logindata['ID']);
|
||||
var_dump($expire);
|
||||
set_cookie('rememberMe', base64_encode($logindata['username']), $expire, base_url(), '/');
|
||||
set_cookie('token', $userHash, $expire, base_url(), '/');
|
||||
// $this->input->set_cookie('rememberMe', base64_encode($logindata['username']), $expire, base_url(), '/');
|
||||
// $this->input->set_cookie('token', $userHash, $expire, base_url(), '/');
|
||||
|
||||
var_dump(get_cookie('rememberMe'));
|
||||
|
||||
echo 'fresh';
|
||||
var_dump($_COOKIE);
|
||||
$_COOKIE['rememberMe'] = base64_encode($logindata['username']);
|
||||
$_COOKIE['token'] = $userHash;
|
||||
echo 'tech';
|
||||
// var_dump(get_cookie('rememberMe'));
|
||||
// var_dump(get_cookie('token'));
|
||||
var_dump($_COOKIE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,6 +91,8 @@
|
|||
} else {
|
||||
$_SESSION['user']['profilePic'] = $profilePic;
|
||||
}
|
||||
|
||||
$_SESSION['user']['permissions'] = $this->UserModel->getPermissions($logindata['ID']);
|
||||
}
|
||||
|
||||
public function isTrashMail($email)
|
||||
|
@ -133,13 +143,16 @@
|
|||
if (isset($_SESSION['loggedOut']) && $_SESSION['loggedOut']) {
|
||||
return;
|
||||
}
|
||||
var_dump('test');
|
||||
if (!isset($_SESSION['user']) && isset($_COOKIE['rememberMe']) && isset($_COOKIE['token'])) {
|
||||
var_dump($_COOKIE);
|
||||
$logindata = $this->getLoginData(base64_decode($_COOKIE['rememberMe']));
|
||||
if (!empty($logindata)) {
|
||||
$logindata = $logindata[0];
|
||||
$token = $this->getUserHash($logindata['username'], $logindata['password'], $logindata['email'], $logindata['ID']);
|
||||
|
||||
if ($_COOKIE['token'] == $token) {
|
||||
echo '<br> TEST! <br>';
|
||||
$this->startLoginSession($logindata, 'on');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
$this->db->cache_delete('Main', 'getNotifications');
|
||||
|
||||
// Send email
|
||||
$email = $this->UserModel->getUserEmailByID($notification->sender->getId());
|
||||
$email = $this->UserModel->getUserEmailByID($notification->recipient->getId());
|
||||
$group = new NotificationGroup([$notification], 1);
|
||||
$messageData = $group->message();
|
||||
$message = sprintf(lang($messageData['line']), ...$messageData['attributes']);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
function getUser($username)
|
||||
{
|
||||
$result = $this->db->query('SELECT ID, username, displayname, email, rank, profile_picture, header_image, about, social_networks, showAds, date_created, gender, language, country, birthdate, birthyear, receiveEmails, receiveNewsletter FROM users WHERE username = ? AND is_activated = TRUE LIMIT 1', [$username])->result_array();
|
||||
$result = $this->db->query('SELECT ID, username, displayname, email, rank, profile_picture, header_image, about, social_networks, showAds, date_created, gender, language, country, birthdate, birthyear, receiveEmails, receiveNewsletter FROM users WHERE username = ? AND is_activated = TRUE AND isDeleted = FALSE LIMIT 1', [$username])->result_array();
|
||||
if (empty($result)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
|||
{
|
||||
for ($i = 0; $i < sizeof($userList); $i++) {
|
||||
if ((isset($userList[$i]['header_image']) && ($userList[$i]['header_image'] == '' || $userList[$i]['header_image'] == NULL)) || !isset($userList[$i]['header_image'])) {
|
||||
$userList[$i]['header_image'] = substr(base_url(), 0, base_url() - 1) . ':5000/' . $userList[$i]['displayname'];
|
||||
$userList[$i]['header_image'] = 'https://cdn.kinogofdog.eu' . '/' . $userList[$i]['displayname'];
|
||||
}
|
||||
if (isset($userList[$i]['profile_picture']) && $userList[$i]['profile_picture'] == '') {
|
||||
$userList[$i]['profile_picture'] = base_url('/f/8d204712d8132b36d765640ce775ce15');
|
||||
|
@ -64,7 +64,7 @@
|
|||
public function getFollowers($id)
|
||||
{
|
||||
$this->db->cache_off();
|
||||
$followers = $this->db->query('SELECT ID, followedSince, username, displayname, profile_picture, header_image FROM user_followers LEFT JOIN users ON ID = followerUserID WHERE followedUserID = ? ORDER BY followedSince DESC', [$id])->result_array();
|
||||
$followers = $this->db->query('SELECT ID, followedSince, username, displayname, profile_picture, header_image FROM user_followers LEFT JOIN users ON ID = followerUserID WHERE followedUserID = ? AND is_activated = TRUE AND isDeleted = FALSE ORDER BY followedSince DESC', [$id])->result_array();
|
||||
$this->db->cache_on();
|
||||
$followers = $this->setDefaultImages($followers);
|
||||
$followers = $this->mergeFollowerCount($followers);
|
||||
|
@ -73,7 +73,7 @@
|
|||
|
||||
function getUserByID($id)
|
||||
{
|
||||
$result = $this->db->query('SELECT ID, original_name, username, displayname, email, rank, profile_picture, header_image, is_activated, about, lastLogin, social_networks, showAds, date_created, gender, language, country, birthdate, birthyear, receiveEmails, receiveNewsletter FROM users WHERE ID = ? AND is_activated = TRUE LIMIT 1', [$id])->result_array();
|
||||
$result = $this->db->query('SELECT ID, original_name, username, displayname, email, rank, profile_picture, header_image, is_activated, about, lastLogin, social_networks, showAds, date_created, gender, language, country, birthdate, birthyear, receiveEmails, receiveNewsletter FROM users WHERE ID = ? AND is_activated = TRUE AND isDeleted = FALSE LIMIT 1', [$id])->result_array();
|
||||
if (empty($result)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -83,14 +83,14 @@
|
|||
}
|
||||
|
||||
function getUserEmailByID($id) {
|
||||
$result = $this->db->query('SELECT email FROM users WHERE ID = ? AND is_activated = TRUE', [$id])->result_array();
|
||||
$result = $this->db->query('SELECT email FROM users WHERE ID = ? AND is_activated = TRUE AND isDeleted = TRUE', [$id])->result_array();
|
||||
return !empty($result) ? $result[0]['email'] : '';
|
||||
}
|
||||
|
||||
public function getFollowing($id)
|
||||
{
|
||||
$this->db->cache_off();
|
||||
$following = $this->db->query('SELECT ID, followedSince, username, displayname, profile_picture, header_image FROM user_followers LEFT JOIN users ON ID = followedUserID WHERE followerUserID = ? ORDER BY followedSince DESC', [$id])->result_array();
|
||||
$following = $this->db->query('SELECT ID, followedSince, username, displayname, profile_picture, header_image FROM user_followers LEFT JOIN users ON ID = followedUserID WHERE followerUserID = ? AND isDeleted = FALSE ORDER BY followedSince DESC', [$id])->result_array();
|
||||
$this->db->cache_on();
|
||||
$following = $this->setDefaultImages($following);
|
||||
$following = $this->mergeFollowerCount($following);
|
||||
|
@ -187,14 +187,14 @@ WHERE user_id = ?', [$userID, $userID, $userID])->result_array()[0];
|
|||
|
||||
function getActiveUsers($count)
|
||||
{
|
||||
$data = $this->db->query('SELECT username, displayname, profile_picture, lastLogin, (SELECT COUNT(*) FROM user_followers WHERE followedUserID = users.ID) follower_count FROM users WHERE isCurrentlyOnline = TRUE ORDER BY lastLogin DESC LIMIT ?', [$count])->result_array();
|
||||
$data = $this->db->query('SELECT username, displayname, profile_picture, lastLogin, (SELECT COUNT(*) FROM user_followers WHERE followedUserID = users.ID) follower_count FROM users WHERE isCurrentlyOnline = TRUE AND is_activated = TRUE AND isDeleted = FALSE ORDER BY lastLogin DESC LIMIT ?', [$count])->result_array();
|
||||
$data = $this->setDefaultImages($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getNewestUsers($count)
|
||||
{
|
||||
$data = $this->db->query('SELECT username, displayname, profile_picture, date_created, (SELECT COUNT(*) FROM user_followers WHERE followedUserID = users.ID) follower_count FROM users ORDER BY date_created DESC LIMIT ?', [$count])->result_array();
|
||||
$data = $this->db->query('SELECT username, displayname, profile_picture, date_created, (SELECT COUNT(*) FROM user_followers WHERE followedUserID = users.ID) follower_count FROM users WHERE is_activated = TRUE AND isDeleted = FALSE ORDER BY date_created DESC LIMIT ?', [$count])->result_array();
|
||||
$data = $this->setDefaultImages($data);
|
||||
return $data;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ WHERE user_id = ?', [$userID, $userID, $userID])->result_array()[0];
|
|||
$dbClause = join(' AND ', $conditions);
|
||||
$inputs[] = $amount;
|
||||
$inputs[] = $offset;
|
||||
$data = $this->db->query('SELECT username, displayname, profile_picture, header_image, about, rank FROM users WHERE ' . $dbClause . ' LIMIT ? OFFSET ?', $inputs)->result_array();
|
||||
$data = $this->db->query('SELECT username, displayname, profile_picture, header_image, about, rank FROM users WHERE is_activated = TRUE AND isDeleted = FALSE AND ' . $dbClause . ' LIMIT ? OFFSET ?', $inputs)->result_array();
|
||||
|
||||
$data = $this->setDefaultImages($data);
|
||||
$data = $this->setRankname($data);
|
||||
|
@ -238,4 +238,36 @@ WHERE user_id = ?', [$userID, $userID, $userID])->result_array()[0];
|
|||
return $this->db->query('SELECT language, count(*) langUserCount FROM users GROUP BY language ORDER BY language')->result_array();
|
||||
}
|
||||
|
||||
public function deleteUser($id) {
|
||||
$this->db->query('UPDATE users SET isDeleted = TRUE, isCurrentlyOnline = FALSE, lastOnlineUpdate = NULL WHERE ID = ?', [$id])->result_array();
|
||||
}
|
||||
|
||||
public function getPermissions($userID) {
|
||||
$this->db->cache_off();
|
||||
$result = $this->db->query('SELECT * FROM user_permissions WHERE userID = ?', [$userID])->result_array();
|
||||
$this->db->cache_on();
|
||||
|
||||
$perms = [];
|
||||
|
||||
foreach ($result as $item) {
|
||||
$perms[] = $item['permissionType'] . '.' . $item['permissionName'];
|
||||
}
|
||||
|
||||
return $perms;
|
||||
}
|
||||
|
||||
public function hasPermission($userID, $permType, $permName) {
|
||||
$this->db->cache_off();
|
||||
$result = $this->db->query('SELECT ID FROM user_permissions WHERE userID = ? AND permissionType = ? AND permissionName = ?', [$userID, $permType, $permName])->result_array();
|
||||
$this->db->cache_on();
|
||||
return !empty($result);
|
||||
}
|
||||
|
||||
public function addPermission($userID, $permissionGroup, $permissionName, $givenBy) {
|
||||
$this->db->query('INSERT INTO user_permissions (userID, permissionType, permissionName, givenBy) VALUES (?, ?, ?, ?)', [$userID, $permissionGroup, $permissionName, $givenBy]);
|
||||
}
|
||||
|
||||
public function revokePermission($userID, $permissionGroup, $permissionName) {
|
||||
$this->db->query('DELETE FROM user_permissions WHERE userID = ? AND permissionType = ? AND permissionName = ?', [$userID, $permissionGroup, $permissionName]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<iframe src="/piwik/index.php?module=CoreHome&action=index&idSite=1&period=day&date=today"
|
||||
<iframe src="https://stats.kingofdog.eu/"
|
||||
style="height:100vh;width:100%" frameborder="0" async></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
?>
|
||||
|
||||
<link href="<?= $styleName ?>" rel="stylesheet">
|
||||
<link rel="stylesheet" href="<?= base_url('assets/css/lib/fontawesome-all.min.css') ?>">
|
||||
<link rel="stylesheet" href="<?= base_url('assets/css/lib/fontawesome-all-5.2.0.min.css') ?>">
|
||||
|
||||
<link href="/assets/images/ico/favicon.ico" rel="icon">
|
||||
</head>
|
||||
|
@ -91,64 +91,78 @@
|
|||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if (get_instance()->hasPermission('blog.view')): ?>
|
||||
<div class="menu_section">
|
||||
<h3>Blog</h3>
|
||||
<ul class="nav side-menu">
|
||||
<?php if (get_instance()->hasPermission('blog.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/blog">
|
||||
<i class="fa fa-comments"></i>
|
||||
Blog-Posts
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (get_instance()->hasPermission('blog.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/blog/trashbin">
|
||||
<i class="fa fa-trash"></i>
|
||||
Gelöschte Blog-Posts
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (get_instance()->hasPermission('blog.create')): ?>
|
||||
<li>
|
||||
<a href="/admin/blog/edit">
|
||||
<i class="fa fa-edit"></i>
|
||||
Blog-Post erstellen
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if ($_SESSION['user']['rank'] >= 9): ?>
|
||||
<?php endif; ?>
|
||||
<div class="menu_section">
|
||||
<h3>Verwaltung</h3>
|
||||
<ul class="nav side-menu">
|
||||
<?php if (get_instance()->hasPermission('projects.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/projects">
|
||||
<i class="fa fa-camera"></i>
|
||||
Projekte
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (get_instance()->hasPermission('projects.create')): ?>
|
||||
<li>
|
||||
<a href="/admin/projects/edit">
|
||||
<i class="fa fa-plus"></i>
|
||||
Projekt erstellen
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (get_instance()->hasPermission('file.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/files">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
Dateien
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (get_instance()->hasPermission('redirect.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/redirects">
|
||||
<i class="fa fa-arrow-right"></i>
|
||||
Weiterleitungen
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="menu_section">
|
||||
<h3>Nutzer</h3>
|
||||
<ul class="nav side-menu">
|
||||
<?php if ($_SESSION['user']['rank'] >= 9): ?>
|
||||
<?php if (get_instance()->hasPermission('user.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/users">
|
||||
<i class="fa fa-users"></i>
|
||||
|
@ -156,7 +170,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($_SESSION['user']['rank'] >= 9): ?>
|
||||
<?php if (get_instance()->hasPermission('feedback.receive')): ?>
|
||||
<li>
|
||||
<a href="/admin/feedback">
|
||||
<i class="fa fa-comments"></i>
|
||||
|
@ -164,7 +178,7 @@
|
|||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if ($_SESSION['user']['rank'] >= 8): ?>
|
||||
<?php if (get_instance()->hasPermission('contact.view')): ?>
|
||||
<li>
|
||||
<a href="/admin/contact">
|
||||
<i class="fa fa-envelope"></i>
|
||||
|
|
|
@ -77,5 +77,36 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 col-sm-4 col-xs-4">
|
||||
<div class="x_panel">
|
||||
<div class="x_title">
|
||||
<h2>Individuelle Rechte</h2>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="x_content">
|
||||
<form method="POST" class="form">
|
||||
<?php foreach ($availablePermissions as $group => $perms): ?>
|
||||
<h4>
|
||||
<?= $group ?>
|
||||
|
||||
<input type="checkbox" class="group-all">
|
||||
</h4>
|
||||
|
||||
<ul>
|
||||
<?php foreach ($perms as $perm):
|
||||
$name = $group . '.' . $perm; ?>
|
||||
<li>
|
||||
<label data-toggle="tooltip" title="blablabla" for="<?= $group . $perm ?>"><?= $name ?></label>
|
||||
<input type="checkbox" value="true" name="permissions[<?= $group . $perm ?>]" id="<?= $group . $perm ?>" <?= in_array($name, $permissions) ? 'checked' : '' ?>>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
<input type="submit" class="btn btn-primary" value="Speichern">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -55,10 +55,11 @@
|
|||
];
|
||||
$loginMethod = $loginMethods[$user['login_method']];
|
||||
|
||||
$date_created = strtotime($user['date_created']);
|
||||
$last_login = strtotime($user['lastLogin']);
|
||||
$date_created_str = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$date_created"), "de_DE");
|
||||
$last_login_str = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$last_login"), "de_DE");
|
||||
$dateCreated = strtotime($user['date_created']);
|
||||
$lastLogin = strtotime($user['lastLogin']);
|
||||
$dateCreatedStr = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$dateCreated"), "de_DE");
|
||||
if($lastLogin)
|
||||
$lastLoginStr = DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$lastLogin"), "de_DE");
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -76,9 +77,9 @@
|
|||
<?= $user['rankName'] ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $date_created_str ?>
|
||||
<?= $dateCreatedStr ?>
|
||||
<br>
|
||||
(<?= date("d.m.Y H:i", $date_created) ?>)
|
||||
(<?= date("d.m.Y H:i", $dateCreated) ?>)
|
||||
</td>
|
||||
<td>
|
||||
<img src="<?= $user['profile_picture'] ?>?w=50" class="img-fluid rounded"
|
||||
|
@ -104,9 +105,9 @@
|
|||
<?= $loginMethod ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= $last_login_str ?>
|
||||
<?= $lastLoginStr ?>
|
||||
<br>
|
||||
(<?= date("d.m.Y H:i", $last_login) ?>)
|
||||
(<?= date("d.m.Y H:i", $lastLogin) ?>)
|
||||
</td>
|
||||
<td>
|
||||
<?= Locale::getDisplayLanguage($user['language'], "de") ?>
|
||||
|
@ -114,14 +115,23 @@
|
|||
<?= Locale::getDisplayRegion("-" . $user['country'], 'de') ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php if (isset($_SESSION['user']) && $_SESSION['user']['rank'] >= 8 && ($_SESSION['user']['rank'] > $user['rank'] || $_SESSION['user']['rank'] == 10)): ?>
|
||||
<?php if(get_instance()->hasPermission('user.viewDetails')): ?>
|
||||
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Details" href="<?= base_url('admin/users/details/' . $user['ID']) ?>" target="_blank" class="btn btn-xs btn-default">
|
||||
<i class="fa fa-info-circle"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(get_instance()->hasPermission('user.viewDetails')): ?>
|
||||
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Einstellungen" href="<?= base_url('admin/users/settings/' . $user['ID']) ?>" target="_blank" class="btn btn-xs btn-default">
|
||||
<i class="fa fa-cog"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if(get_instance()->hasPermission('user.ban')): ?>
|
||||
<a data-toggle="tooltip" data-placement="top" title="" data-original-title="Account löschen" onclick="showDeleteModal(<?= $user['ID'] ?>. <?= $user['username'] ?>)" target="_blank" class="btn btn-xs btn-red">
|
||||
<i class="fas fa-user-slash"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -127,6 +127,21 @@
|
|||
});
|
||||
})(jQuery);
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var _paq = _paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="//stats.kingofdog.eu/";
|
||||
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
||||
_paq.push(['setSiteId', '1']);
|
||||
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
|
||||
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
<!--<script type="text/javascript">
|
||||
var _paq = _paq || [];
|
||||
_paq.push(['trackPageView']);
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
$this->LoginModel->autoLogin();
|
||||
|
||||
if (!isset($_SESSION['site_lang']) && isset($_COOKIE['language']) && in_array($_COOKIE['language'], ['de', 'en', 'fr'])) {
|
||||
$this->session->set_userdata('site_lang', $_COOKIE['language']);
|
||||
redirect(base_url(uri_string()));
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= $_SESSION['site_lang'] ?>">
|
||||
|
@ -138,7 +131,7 @@
|
|||
<i class="fa fa-user-edit"></i>
|
||||
<?= lang('header_edit_profile') ?>
|
||||
</a>
|
||||
<?php if ($_SESSION['user']['rank'] >= 6): ?>
|
||||
<?php if (get_instance()->hasPermission('dashboard.view')): ?>
|
||||
<a href="<?= base_url('admin') ?>" class="dropdown-item">
|
||||
<i class="fa fa-tachometer-alt"></i>
|
||||
<?= lang('header_admin_panel') ?>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</p>
|
||||
<br>
|
||||
<a class="boxed btn btn-md animation animated-item-4"
|
||||
href="<?= base_url('portfolio') ?>">
|
||||
href="<?= base_url('projects') ?>">
|
||||
<?= lang('home_slider_portfolio_btn') ?>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -140,70 +140,57 @@
|
|||
</a>
|
||||
</section>
|
||||
<!--/#main-slider-->
|
||||
<section class="container">
|
||||
|
||||
<section class="container-fluid p-0">
|
||||
<div class="container">
|
||||
<div class="row my-2">
|
||||
<div class="col">
|
||||
<h1><?= lang('home_channels_title') ?></h1>
|
||||
<div class="row">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xs-4 mx-4 m-sm-0">
|
||||
<a href="https://www.youtube.de/KingOfDog" target="_blank">
|
||||
<img src="/f/59768b61257e439b593ff2fb112d5079?w=200" class="img-fluid rounded">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col mr-4 m-sm-0">
|
||||
<a href="https://www.youtube.de/KingOfDog" target="_blank">
|
||||
<h2>KingOfDog</h2>
|
||||
</a>
|
||||
<p class="text-justify"><?= lang('home_kingofdog_des') ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xs-4 mx-4 m-sm-0">
|
||||
<a href="https://www.youtube.com/channel/UCossYe6KMMhf9HJ9Uaqtu-g" target="_blank">
|
||||
<img src="/f/fbee51f02df362fc8cca5a2a177e1852?w=200" class="img-fluid rounded">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col mr-4 m-sm-0">
|
||||
<a href="https://www.youtube.com/channel/UCossYe6KMMhf9HJ9Uaqtu-g" target="_blank">
|
||||
<h2>ZeybeFX</h2>
|
||||
</a>
|
||||
<p class="text-justify"><?= lang('home_zeybefx_des') ?></p>
|
||||
|
||||
<div class="tilted-columns">
|
||||
<div class="tilted-column">
|
||||
<img class="column-image" src="/f/59768b61257e439b593ff2fb112d5079" alt="KingOfDog Logo">
|
||||
<div class="column-caption">
|
||||
<h1 class="column-title">KingOfDog</h1>
|
||||
<h3 class="column-desc"><?= lang('home_kingofdog_des') ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-100"></div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xs-4 mx-4 m-sm-0">
|
||||
<a href="https://www.youtube.com/channel/UCJ1_Tj4SVkU5h9a8Q0VrB4A" target="_blank">
|
||||
<img src="/f/b1771da2202f7fc83325520be61d961a?w=200" class="img-fluid rounded">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col mr-4 m-sm-0">
|
||||
<a href="https://www.youtube.com/channel/UCJ1_Tj4SVkU5h9a8Q0VrB4A" target="_blank">
|
||||
<h2>ZeybeOfficial</h2>
|
||||
</a>
|
||||
<p class="text-justify"><?= lang('home_zeybeofficial_des') ?></p>
|
||||
<div class="tilted-column">
|
||||
<img class="column-image" src="/f/3c930821892961aba30c7f91df1e5d4e" alt="ZeybeFX Logo">
|
||||
<div class="column-caption">
|
||||
<h1 class="column-title">ZeybeFX</h1>
|
||||
<h3 class="column-desc"><?= lang('home_zeybefx_des') ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xs-4 mx-4 m-sm-0">
|
||||
<a href="https://www.youtube.com/channel/UCthOkS9cpKgnBSj7AdR1rDg" target="_blank">
|
||||
<img src="/f/972a648bc945712b44dd2b020150d3d5?w=200" class="img-fluid rounded">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col mr-4 m-sm-0">
|
||||
<a href="https://www.youtube.com/channel/UCthOkS9cpKgnBSj7AdR1rDg" target="_blank">
|
||||
<h2>KingOfDog International</h2>
|
||||
</a>
|
||||
<p class="text-justify"><?= lang('home_kingofdogint_des') ?></p>
|
||||
<div class="tilted-column">
|
||||
<img class="column-image" src="/f/54c5963da3587342cb34336fd15c87aa" alt="ZeybeOfficial Logo">
|
||||
<div class="column-caption">
|
||||
<h1 class="column-title">ZeybeOfficial</h1>
|
||||
<h3 class="column-desc"><?= lang('home_zeybeofficial_des') ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tilted-column">
|
||||
<img class="column-image" src="/f/7b3fd0b5fb3ef9565f396a266db14a64" alt="KingOfDog International Logo">
|
||||
<div class="column-caption">
|
||||
<h1 class="column-title">KingOfDog International</h1>
|
||||
<h3 class="column-desc"><?= lang('home_kingofdogint_des') ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tilted-column">
|
||||
<img class="column-image" src="/f/d904d757da59e2d514d9b12604b9c8b6" alt="KingOfDogTV Logo">
|
||||
<div class="column-caption">
|
||||
<h1 class="column-title">KingOfDogTV</h1>
|
||||
<h3 class="column-desc"><?= lang('home_kingofdogtv_des') ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tilted-column">
|
||||
<img class="column-image" src="/f/1771967ab185e4d62ff5963977032fd8" alt="MinePoint Logo">
|
||||
<div class="column-caption">
|
||||
<h1 class="column-title">MinePoint</h1>
|
||||
<h3 class="column-desc"><?= lang('home_minepoint_des') ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -228,8 +215,8 @@
|
|||
</section>
|
||||
|
||||
<section class="container">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
|
||||
<div class="grid grid-kod-network">
|
||||
<div class="item-active">
|
||||
<h2><?= lang('home_active_users') ?></h2>
|
||||
<?php foreach ($currentlyActiveUsers as $activeUser):
|
||||
$loginTime = strtotime($activeUser['lastLogin']); ?>
|
||||
|
@ -245,7 +232,7 @@
|
|||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
|
||||
<div class="item-newest">
|
||||
<h2><?= lang('home_newest_users') ?></h2>
|
||||
<?php
|
||||
foreach ($newestUsers as $newestUser):
|
||||
|
@ -263,7 +250,7 @@
|
|||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
|
||||
<div class="item-posts">
|
||||
<h2><?= lang('home_newest_posts') ?></h2>
|
||||
<ul class="comment-list">
|
||||
<?php foreach ($newestPosts as $newestPost):
|
||||
|
|
|
@ -5,10 +5,9 @@ $this->load->view('network/user/profile_page_header');
|
|||
<section class="container" id="profile-content" data-type="foreground" data-speed="10">
|
||||
<div class="row">
|
||||
<!-- --><?php //$this->load->view('network/user/user_profile_card') ?>
|
||||
<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4"></div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8" id="profile-content-container">
|
||||
<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8 offset-md-2" id="profile-content-container">
|
||||
<?= $message ?>
|
||||
<h1>Profil bearbeiten</h1>
|
||||
<h1 class="text-center">Profil bearbeiten</h1>
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<div class="nav nav-pills flex-column" role="tablist" aria-orientation="vertical">
|
||||
|
@ -24,6 +23,11 @@ $this->load->view('network/user/profile_page_header');
|
|||
<br>
|
||||
E-Mail
|
||||
</a>
|
||||
<a href="#messages" class="nav-link text-center" role="tab" data-toggle="pill" id="messages-pill" aria-controls="messages" aria-selected="false">
|
||||
<i class="fa fa-bell"></i>
|
||||
<br>
|
||||
Nachrichten
|
||||
</a>
|
||||
<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>
|
||||
|
@ -1126,22 +1130,27 @@ $this->load->view('network/user/profile_page_header');
|
|||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="email">E-Mail-Adresse</label>
|
||||
<input type="email" class="form-control" name="email"
|
||||
<input type="email" class="form-control" name="email" id="email"
|
||||
value="<?= isset($data['email']) ? $data['email'] : "" ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email-password">Passwort zur Bestätigung der E-Mail-Adresse</label>
|
||||
<input type="password" class="form-control" name="email-password"
|
||||
<input type="password" class="form-control" name="email-password" id="email-password"
|
||||
placeholder="Bitte gebe dein derzeitiges Passwort ein">
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Speichern">
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="messages" role="tabpanel" aria-labelledby="messages-pill">
|
||||
<form method="post">
|
||||
<div class="form-group">
|
||||
<input type="checkbox" value="true"
|
||||
name="email-notifications" <?= isset($data['receiveEmails']) && $data['receiveEmails'] ? "checked" : "" ?>>
|
||||
rel="email-notifications" id="email-notifications" <?= isset($data['receiveEmails']) && $data['receiveEmails'] ? "checked" : "" ?>>
|
||||
<label for="email-notifications">E-Mail Benachrichtigungen</label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" value="true"
|
||||
name="newsletter" <?= isset($data['receiveNewsletter']) && $data['receiveNewsletter'] ? "checked" : "" ?>>
|
||||
rel="newsletter" id="newsletter" <?= isset($data['receiveNewsletter']) && $data['receiveNewsletter'] ? "checked" : "" ?>>
|
||||
<label for="newsletter">Newsletter</label>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Speichern">
|
||||
|
@ -1151,42 +1160,49 @@ $this->load->view('network/user/profile_page_header');
|
|||
<form method="post">
|
||||
<div class="form-group">
|
||||
<label for="passwordOld">Altes Passwort</label>
|
||||
<input type="password" class="form-control" name="passwordOld">
|
||||
<input type="password" class="form-control" name="passwordOld" id="passwordOld">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passwordNew">Neues Passwort</label>
|
||||
<input type="password" class="form-control" name="passwordNew">
|
||||
<input type="password" class="form-control" name="passwordNew" id="passwordNew">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="passwordNewRepeat">Neues Passwort wiederholen</label>
|
||||
<input type="password" class="form-control" name="passwordNewRepeat">
|
||||
<input type="password" class="form-control" name="passwordNewRepeat" id="passwordNewRepeat">
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Speichern">
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="premium" role="tabpanel" aria-labelledby="premium-pill">
|
||||
<form method="post">
|
||||
<?php if (isset($_SESSION['user']['rank']) && $_SESSION['user']['rank'] >= 2): ?>
|
||||
<?php if (get_instance()->hasPermission('user.disableAds')): ?>
|
||||
<div class="form-group">
|
||||
<input type="checkbox" name="showAds" value="true"
|
||||
aria-describedby="adHelp" <?= isset($data['showAds']) && $data['showAds'] ? "checked" : "" ?>>
|
||||
<input type="checkbox" name="showAds" id="showAds" value="true"
|
||||
aria-describedby="adsThankYou" <?= isset($data['showAds']) && $data['showAds'] ? "checked" : "" ?>>
|
||||
<label for="showAds">Werbung anzeigen und uns unterstützen</label>
|
||||
<span class="help-block" id="adsHelp">Danke für deine bisherige Unterstützung durch Spenden. Solltest du dennoch weiterhin uns unterstützen wollen, kannst du freiwilligerweise Werbeanzeigen aktivieren. Wie immer gilt unser Motto: höchstens eine Anzeige pro Seite!</span>
|
||||
<small class="form-text text-muted" id="adsThankYou">Danke für deine bisherige Unterstützung durch Spenden. Solltest du dennoch weiterhin uns unterstützen wollen, kannst du freiwilligerweise Werbeanzeigen aktivieren. Wie immer gilt unser Motto: höchstens eine Anzeige pro Seite!</small>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
||||
<p class="text-warning">Um diese Einstellungen zu sehen und zu verändern, musst du
|
||||
entweder ein Team-Mitglied, ein Plus-Nutzer oder ein Premium-Nutzer sein.</p>
|
||||
<p>Premium-Nutzer kannst du werden, indem du einen beliebigen Betrag auf der <a
|
||||
href="<?= base_url('donate') ?>">Spenden-Seite</a> hinterlässt. So
|
||||
<p>Premium-Nutzer kannst du werden, indem du einen beliebigen Betrag auf der
|
||||
<a
|
||||
href="<?= base_url('donate') ?>">Spenden-Seite
|
||||
</a>
|
||||
hinterlässt. So
|
||||
unterstützt du zum einen diese Webseite und sorgst für ein Weiterleben dieses
|
||||
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
|
||||
hochrangigen Team-Mitgliedes werden. Der Plus-Rang wird beispielsweise an
|
||||
YouTuber,
|
||||
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>
|
||||
oder Freunde und Bekannte vergeben.</p>
|
||||
Abonnenten des Kanals
|
||||
<a href="https://youtube.com/KingOfDog" target="_blank">KingOfDog</a>
|
||||
oder Freunde und Bekannte vergeben.
|
||||
</p>
|
||||
<p>Es gilt jedoch eine Regel: <b>Bitte. Nicht. Nach. Einem. Rang. Betteln.</b> Durch
|
||||
eine solche Aktivität verfliegt eure Chance auf einen Rang.</p>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -106,6 +106,158 @@
|
|||
animation: fadeInUp 300ms linear 1200ms both;
|
||||
}
|
||||
|
||||
.tilted-column {
|
||||
position: relative;
|
||||
width: calc((100% / 3) + 6px + (32px / 3));
|
||||
height: 33vw;
|
||||
display: inline-block;
|
||||
margin-left: -6px;
|
||||
overflow: hidden;
|
||||
border-right: 10px solid transparent;
|
||||
transform: skewX(-6deg);
|
||||
}
|
||||
|
||||
.tilted-column:nth-child(3n+1) {
|
||||
margin-left: -24px;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.tilted-column:nth-child(3n+3) {
|
||||
margin-right: -32px;
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.tilted-column > .column-image {
|
||||
width: 100%;
|
||||
transform: skewX(6deg) scale(1.1);
|
||||
transition: transform .8s;
|
||||
}
|
||||
|
||||
.tilted-column > .column-caption {
|
||||
position: absolute;
|
||||
width: 75%;
|
||||
top: 100%;
|
||||
left: 56%;
|
||||
opacity: 0;
|
||||
transform: skewX(6deg) translate(-50%, 0);
|
||||
transition: all .8s;
|
||||
}
|
||||
|
||||
.tilted-column > .column-caption > .column-title,
|
||||
.tilted-column > .column-caption > .column-desc {
|
||||
color: #fff;
|
||||
background-color: rgba(0, 0, 0, .8);
|
||||
padding: 4px 16px;
|
||||
border-radius: 10px;
|
||||
font-size: 2.5vw;
|
||||
}
|
||||
|
||||
.tilted-column > .column-caption > .column-desc {
|
||||
font-size: 1.25vw;
|
||||
font-weight: bolder;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tilted-column:hover > .column-image {
|
||||
transform: skewX(6deg) scale(1.5);
|
||||
}
|
||||
|
||||
.tilted-column:hover > .column-caption {
|
||||
top: 50%;
|
||||
left: 54%;
|
||||
transform: skewX(6deg) translate(-50%, -50%);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.tilted-column {
|
||||
width: calc(50% + 6px + (32px / 2));
|
||||
height: 50vw;
|
||||
}
|
||||
|
||||
.tilted-column:nth-child(3n+1) {
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
.tilted-column:nth-child(3n+3) {
|
||||
margin-right: 0;
|
||||
border-right: 10px solid transparent;
|
||||
}
|
||||
|
||||
.tilted-column:nth-child(2n+1) {
|
||||
margin-left: -24px;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.tilted-column:nth-child(2n + 2) {
|
||||
margin-right: -32px !important;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.tilted-column > .column-caption > .column-title {
|
||||
font-size: 4vw;
|
||||
}
|
||||
|
||||
.tilted-column > .column-caption > .column-desc {
|
||||
font-size: 2.5vw;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 575px) {
|
||||
.tilted-column {
|
||||
width: 100%;
|
||||
height: 100vw;
|
||||
margin: 10px 0 !important;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.tilted-column > .column-image {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.tilted-column > .column-caption {
|
||||
left: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
.tilted-column:hover > .column-image {
|
||||
transform: scale(1.5);
|
||||
}
|
||||
|
||||
.tilted-column:hover > .column-caption {
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.grid-kod-network {
|
||||
grid-template-areas: "posts" "active" "newest";
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.grid-kod-network {
|
||||
grid-template-areas: "posts posts" "active newest";
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.grid-kod-network {
|
||||
grid-template-areas: "active posts" "newest posts";
|
||||
}
|
||||
}
|
||||
|
||||
.grid-kod-network > .item-active {
|
||||
grid-area: active;
|
||||
}
|
||||
|
||||
.grid-kod-network > .item-newest {
|
||||
grid-area: newest;
|
||||
}
|
||||
|
||||
.grid-kod-network > .item-posts {
|
||||
grid-area: posts;
|
||||
}
|
||||
|
||||
/* Backgrounds for social media posts */
|
||||
.bg-twitter {
|
||||
background-color: #4099FF;
|
||||
|
|
|
@ -18,6 +18,13 @@ body > section {
|
|||
padding: 50px 0;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto;
|
||||
grid-template-rows: auto;
|
||||
grid-gap: 10px 20px;
|
||||
}
|
||||
|
||||
.dark {
|
||||
background: #222222;
|
||||
color: #FAFAFA;
|
||||
|
@ -1836,26 +1843,20 @@ ul#downloadSlider a.active .overlay {
|
|||
}
|
||||
|
||||
.user-item {
|
||||
display: grid;
|
||||
grid-template-columns: 50px 1fr;
|
||||
grid-gap: 10px;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .5);
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .25);
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.user-item img {
|
||||
height: 50px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.user-item .user-info {
|
||||
display: inline-block;
|
||||
width: calc(100% - 60px);
|
||||
float: right;
|
||||
margin: 2.5px 0;
|
||||
}
|
||||
|
||||
.user-item .user-info h2 {
|
||||
|
|
27
assets/js/admin_users.js
Normal file
27
assets/js/admin_users.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
function showDeleteModal(userID, username) {
|
||||
const modal = $(`
|
||||
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">Bestätigung</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<b>Bist du dir sicher, dass du den Account von ${username} löschen möchtest?</b>
|
||||
Die Account-Daten werden für eine gewisse Zeit noch auf dem Server gespeichert, allerdings wird der Nutzer nicht mehr dazu in der Lage sein, sich in seinen Account einzuloggen, und somit auch keine Posts, Kommentare etc. verfassen können.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary">Account löschen</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Abbruch</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
$('body').append(modal);
|
||||
|
||||
modal.modal('show');
|
||||
}
|
|
@ -219,6 +219,26 @@ $(function () {
|
|||
});
|
||||
});
|
||||
|
||||
Number.prototype.pad = function(size) {
|
||||
let s = String(this);
|
||||
while(s.length < (size || 2)) s = "0" + s;
|
||||
return s;
|
||||
};
|
||||
|
||||
function convertDate(dbDate) {
|
||||
const date = new Date(dbDate);
|
||||
console.log(date);
|
||||
|
||||
const day = date.getDate().pad();
|
||||
const month = (date.getMonth() + 1).pad();
|
||||
const year = date.getFullYear();
|
||||
|
||||
const hour = date.getHours().pad();
|
||||
const minutes = date.getMinutes().pad();
|
||||
|
||||
return `${day}.${month}.${year} ${hour}:${minutes}`;
|
||||
}
|
||||
|
||||
function getPostData() {
|
||||
const postID = $('#postID').val();
|
||||
$.ajax({
|
||||
|
@ -234,7 +254,9 @@ function getPostData() {
|
|||
$('#postUrl').val(result.postData.postUrl);
|
||||
$('#postCategory').val(result.postData.postCategoryID);
|
||||
switchCategory();
|
||||
$('#postPublishDate').val(result.postData.postPublishDate);
|
||||
|
||||
$('#postPublishDate').data('DateTimePicker').setValue(convertDate(result.postData.postPublishDate));
|
||||
// $('#postPublishDate').val(convertDate(result.postData.postPublishDate));
|
||||
$('#uploadedImage').val(result.postData.postImage);
|
||||
$('.img-container').css('background-image', 'url(' + result.postData.postImage + ')');
|
||||
|
||||
|
|
|
@ -91,3 +91,15 @@ $(function () {
|
|||
`)
|
||||
});
|
||||
});
|
||||
|
||||
const chk = $('input[type="checkbox"]');
|
||||
|
||||
chk.each(function () {
|
||||
const v = $(this).is(':checked');
|
||||
$(this).after(`<input type="hidden" name="${$(this).attr('rel')}" value="${v.toString()}" />`);
|
||||
});
|
||||
|
||||
chk.change(function () {
|
||||
const v = $(this).is(':checked');
|
||||
$(this).next('input[type="hidden"]').val(v.toString());
|
||||
});
|
28
assets/js/user-edit.js
Normal file
28
assets/js/user-edit.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
$('.group-all').change(function () {
|
||||
const v = $(this).is(':checked');
|
||||
|
||||
const items = $(this).parent().next('ul').children();
|
||||
items.each(function () {
|
||||
$(this).find('input[type=checkbox]').prop('checked', v);
|
||||
});
|
||||
});
|
||||
|
||||
$('input[type=checkbox]:not(.group-all)').change(function () {
|
||||
const groupAll = $(this).parent().parent().prev('h4').find('.group-all');
|
||||
if(!$(this).is(':checked')) {
|
||||
groupAll.prop('checked', false);
|
||||
} else {
|
||||
const siblings = $(this).parent().siblings().find('input[type=checkbox]:not(:checked)');
|
||||
if(siblings.length === 0) {
|
||||
groupAll.prop('checked', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function checkSiblings() {
|
||||
|
||||
}
|
||||
|
||||
$(function () {
|
||||
|
||||
});
|
43
unregistered_images.py
Normal file
43
unregistered_images.py
Normal file
|
@ -0,0 +1,43 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from os import listdir, remove
|
||||
from os.path import isfile, join, getsize
|
||||
import hashlib, pymysql
|
||||
|
||||
files = [f for f in listdir('files') if isfile(join('files', f))]
|
||||
|
||||
db = pymysql.connect('localhost',
|
||||
'kingofdog',
|
||||
'123456',
|
||||
'kingofdog')
|
||||
cur = db.cursor()
|
||||
|
||||
def pushToDatabase(fileName, originalName, fileType, size, path, uploadDate, isUserData):
|
||||
try:
|
||||
cur.execute('INSERT INTO files (name, original_name, type, size, path, isUserData) VALUES (%s, %s, %s, %s, %s, %s)', (fileName, originalName, fileType, size, path, isUserData))
|
||||
db.commit()
|
||||
except:
|
||||
db.rollback()
|
||||
|
||||
def checkInDatabase(name):
|
||||
cur.execute('SELECT * FROM files WHERE name = %s', (name))
|
||||
result = cur.fetchone()
|
||||
return result != None
|
||||
|
||||
def findUnregisteredImages():
|
||||
for file in files:
|
||||
with open('./files/' + file, 'rb') as imageFile:
|
||||
imageName = file.split(".")[0]
|
||||
if(not checkInDatabase(imageName)):
|
||||
print('Adding "' + imageName + '" to the database.')
|
||||
fileType = 'image/jpeg'
|
||||
size = getsize(imageFile.name)
|
||||
path = imageFile.name[2:]
|
||||
pushToDatabase(imageName, file, fileType, size, path, None, False)
|
||||
|
||||
|
||||
print('Searching for unregistered files...')
|
||||
findUnregisteredImages()
|
||||
print('Successfully finished registering all previously unregistered files.')
|
||||
|
||||
db.close()
|
Reference in New Issue
Block a user