Added Router

This commit is contained in:
kolaente 2016-08-04 17:22:50 +02:00
parent 04b20c4773
commit 5960199867
14 changed files with 551 additions and 462 deletions

View File

@ -93,7 +93,7 @@ input[type=checkbox] + label i {
width: 15px;
height: 15px;
margin: 0 10px 0 0;
vertical-align: middle;
vertical-align: bottom;
transition: 0.2s ease;
-webkit-transition: 0.2s ease;
border-radius: 2px;
@ -626,7 +626,7 @@ header {
right: 0;
height: 35px;
color: #727272;
z-index: 10;
z-index: 2;
font-size: 30px;
overflow: hidden;
}
@ -736,7 +736,7 @@ nav {
position: fixed;
top: 0;
bottom: 0;
z-index: 1;
z-index: 2;
/*overflow-x: hidden;
overflow-y: auto;*/
}
@ -780,7 +780,11 @@ nav ul li:hover a {
color: #4CAF50;
}
nav ul li a.now, nav ul li a.now:hover, nav ul li.active a, nav ul li.active a:hover, nav ul li.active ul li a.now {
nav ul li a.now,
nav ul li a.now:hover,
nav ul li.active a,
nav ul li.active a:hover,
nav ul li.active ul li.active a{
background: #4CAF50;
color: #e8e8e8 !important;
}
@ -806,6 +810,11 @@ nav ul li ul {
color: #e8e8e8;
}
nav.no-transition ul li ul, nav.no-transition ul li a{
transition: 0s ease;
-webkit-transition: 0s ease;
}
nav ul li:hover ul li a {
color: #e8e8e8;
}
@ -907,6 +916,17 @@ input[type=checkbox]#show-menu:checked ~ .mobile-overlay {
opacity: 1;
}
.copy{
width: calc(100% - 25px);
display: block;
padding: 13px 0 13px 25px;
color: #e8e8e8;
font-weight: 600;
position: absolute;
bottom: 0;
font-size: 14px;
}
/*main*/
.main {
width: 1156px;
@ -1376,6 +1396,51 @@ img.zoomedin {
cursor: default;
}
/*toploading*/
@-webkit-keyframes toploading-stripes{
from{
background-position:0 0
}
to{
background-position:40px 0
}
}
@keyframes toploading-stripes{
from{
background-position:0 0
}
to{
background-position:40px 0
}
}
.toploading {
height: 0;
-webkit-animation:toploading-stripes 550ms linear infinite;
animation:toploading-stripes 350ms linear infinite;
background-image: -webkit-linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);
background-image: linear-gradient(-45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);
background-size: 40px 40px;
background-color: #4CAF50;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 99;
}
.loader-overlay{
opacity: 0.6;
background: #fff;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
display: none;
}
/*installer*/
.install-container{
width: 600px;

11
admin/assets/js/jquery.form.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
admin/assets/js/page.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -67,7 +67,7 @@ tinymce();
<i class="divider"></i>
<h1><?php echo $lang->get('general_database');?></h1>
<p>
<a href="action.php?dbbackup" class="button"><i class="icon">&#xe964;</i> <?php echo $lang->get('general_create_backup');?>
<a href="action.php?dbbackup" class="button" download="download"><i class="icon">&#xe964;</i> <?php echo $lang->get('general_create_backup');?>
</a>
<a href="<?php
echo $MCONF['phpmyadmin'];
@ -95,7 +95,7 @@ tinymce();
}
?>
<i class="divider"></i>
<input type="submit" class="speichern" value="<?php echo $lang->get('general_config');?>Speichern" style="width: auto;" />
<input type="submit" class="speichern" value="<?php echo $lang->get('general_save_changes');?>" style="width: auto;" />
</form>
<?php
echo '</div>';

View File

@ -7,7 +7,7 @@ if (file_exists('install.php'))
{
if (unlink('install.php'))
{
echo $lang->get('delete_config_success');
echo msg('info', $lang->get('delete_config_success'));
}
}
@ -21,12 +21,12 @@ if (hasPerm('view_dashboard'))
?>
<a href="general_config.php" class="card-blue"><span class="icon">&#xe994;</span><br/>
<?php echo $lang->get('general_config');?></a>
<a href="../apps/logfiles/index.php" class="card-lime"><span class="icon">&#xe9bb;</span><br/><?php echo $lang->get('logfiles');?></a>
<a href=".<?php echo $GLOBALS['MCONF']['home_uri']; ?>apps/logfiles/index.php" class="card-lime"><span class="icon">&#xe9bb;</span><br/><?php echo $lang->get('logfiles');?></a>
</div>
<div class="cardsContainer cardsContainer-main">
<a href="../apps/SimplePages/backend/management.php" class="card-red"><span class="icon">&#xe95c;</span><br/><?php echo $lang->get('manage_pages');?></a>
<a href="../apps/SimplePages/berechtigungen.php" class="card-pink"><span class="icon">&#xe905;</span><br/><?php echo $lang->get('manage_contents');?></a>
<a href="../apps/Files/index.php" class="card-amber"><span
<a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>apps/SimplePages/backend/management.php" class="card-red"><span class="icon">&#xe95c;</span><br/><?php echo $lang->get('manage_pages');?></a>
<a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>apps/SimplePages/backend/permissions.php" class="card-pink"><span class="icon">&#xe905;</span><br/><?php echo $lang->get('manage_contents');?></a>
<a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>apps/Files/index.php" class="card-amber"><span
class="icon">&#xe90e;</span><br/><?php echo $lang->get('manage_files');?></a>
</div>
<?php

235
admin/install.php → admin/install-dev.php Executable file → Normal file
View File

@ -11,16 +11,14 @@ require_once '../inc/libs/lang.class.php';
require_once '../inc/libs/db-mysql.php';
require_once '../inc/libs/YAML/autoload.php';
use Symfony\Component\Yaml\Yaml;
$lang = new lang();
$lang->setLangFolder('lang/');
?>
<html>
<head>
<title>Installation</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="assets/admin.css" type="text/css">
<title>Installation</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="assets/admin.css" type="text/css">
</head>
<body style="background: url('assets/bglogin.jpg') no-repeat center fixed;">
<img src="http://server/SelfCMS/Version2/admin/assets/Logo.svg" alt="Mowie" class="install-logo"/>
@ -47,63 +45,54 @@ if(isset($_POST['submit']))
$_POST['admin_pw2'] !==''
)
{
$CONFIG = [];
$CONFIG = [];
$CONFIG['General']['web_uri'] = $_POST['general_webUrl'];
$CONFIG['General']['home_uri'] = $_POST['general_home_url'];
$CONFIG['General']['phpmyadmin'] = $_POST['general_pma'];
$CONFIG['General']['title'] = 'inc/System/page_title.txt';
$CONFIG['General']['tinymce_css'] = $_POST['general_editor_css'];
$CONFIG['Database']['db_type'] = 'mysql';
$CONFIG['Database']['db_host'] = $_POST['db_host'];
$CONFIG['Database']['db_name'] = $_POST['db_name'];
$CONFIG['Database']['db_usr'] = $_POST['db_user'];
$CONFIG['Database']['db_pw'] = $_POST['db_pw1'];
$CONFIG['Database']['db_prefix'] = $_POST['db_prefix'];
$CONFIG['Templating']['template'] = $_POST['general_template'];
$CONFIG['Templating']['tpl_title'] = 'title';
$CONFIG['Templating']['tpl_content'] = 'content';
$CONFIG['Templating']['tpl_webUri'] = 'website_uri';
$CONFIG['Versioning']['version'] = '0.6 Beta';
$CONFIG['Versioning']['version_num'] = 1;
$CONFIG['Versioning']['update_uri'] = 'http://cdn.kola-entertainments.de/cms/';
//Test Passwords
if($_POST['db_pw1']!==$_POST['db_pw2'])
{
echo msg('fail', 'Mysqlpasswords don\'t match.');
exit;
}
if($_POST['admin_pw1']!==$_POST['admin_pw2'])
{
echo msg('fail', 'Adminpasswords don\'t match');
//Test Passwords
if($_POST['db_pw1']!==$_POST['db_pw2'])
{
echo msg('fail', 'Mysqlpasswords don\'t match.');
exit;
}
//Database
$db = new db($_POST['db_host'], $_POST['db_name'], $_POST['db_user'], $_POST['db_pw1'], $_POST['db_prefix']);
//Create Tables
}
if($_POST['admin_pw1']!==$_POST['admin_pw2'])
{
echo msg('fail', 'Adminpasswords don\'t match');
exit;
}
//Database
$db = new db($_POST['db_host'], $_POST['db_name'], $_POST['db_user'], $_POST['db_pw1'], $_POST['db_prefix']);
//Create Tables
if($db->query('SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE TABLE `'.$_POST['db_prefix'].'meta_meta` (
`name` text NOT NULL,
`content` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `'.$_POST['db_prefix'].'sidebar_sidebar` (
`active` tinyint(1) NOT NULL,
`content` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `'.$_POST['db_prefix'].'sidebar_sidebar` (`active`, `content`) VALUES
(0, \'\');
CREATE TABLE `'.$_POST['db_prefix'].'simplePages_pages` (
`id` int(11) NOT NULL,
`title` text CHARACTER SET utf8 NOT NULL,
@ -116,7 +105,6 @@ CREATE TABLE `'.$_POST['db_prefix'].'simplePages_pages` (
`created` int(11) NOT NULL,
`lastedit` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `'.$_POST['db_prefix'].'simplePages_pages_confirm` (
`id` int(11) NOT NULL,
`page_id` int(11) NOT NULL,
@ -130,14 +118,12 @@ CREATE TABLE `'.$_POST['db_prefix'].'simplePages_pages_confirm` (
`created` int(11) NOT NULL,
`lastedit` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `'.$_POST['db_prefix'].'simplePages_permissions` (
`id` int(11) NOT NULL,
`page` int(11) NOT NULL,
`user` int(11) NOT NULL,
`lastedit` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `'.$_POST['db_prefix'].'system_admins` (
`id` int(11) NOT NULL,
`username` text NOT NULL,
@ -146,7 +132,6 @@ CREATE TABLE `'.$_POST['db_prefix'].'system_admins` (
`mail` text NOT NULL,
`secret` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `'.$_POST['db_prefix'].'system_loggedin` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
@ -155,46 +140,35 @@ CREATE TABLE `'.$_POST['db_prefix'].'system_loggedin` (
`time` int(11) NOT NULL,
`token` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `'.$_POST['db_prefix'].'system_roles` (
`id` int(11) NOT NULL,
`name` text COLLATE utf8_unicode_ci NOT NULL,
`permissions` longtext COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `'.$_POST['db_prefix'].'simplePages_pages`
ADD PRIMARY KEY (`id`);
ALTER TABLE `'.$_POST['db_prefix'].'simplePages_pages_confirm`
ADD PRIMARY KEY (`id`);
ALTER TABLE `'.$_POST['db_prefix'].'simplePages_permissions`
ADD PRIMARY KEY (`id`);
ALTER TABLE `'.$_POST['db_prefix'].'system_admins`
ADD PRIMARY KEY (`id`);
ALTER TABLE `'.$_POST['db_prefix'].'system_loggedin`
ADD PRIMARY KEY (`id`);
ALTER TABLE `'.$_POST['db_prefix'].'system_roles`
ADD PRIMARY KEY (`id`);
ALTER TABLE `'.$_POST['db_prefix'].'simplePages_pages`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `'.$_POST['db_prefix'].'simplePages_pages_confirm`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE `'.$_POST['db_prefix'].'simplePages_permissions`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `'.$_POST['db_prefix'].'system_admins`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `'.$_POST['db_prefix'].'system_loggedin`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
ALTER TABLE `'.$_POST['db_prefix'].'system_roles`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
'))
@ -206,7 +180,6 @@ ALTER TABLE `'.$_POST['db_prefix'].'system_roles`
echo msg('fail', 'Failed Creating Tables');
exit;
}
//Admin group
$db->setCol('system_roles');
$db->data['name'] = 'Admins';
@ -219,7 +192,6 @@ ALTER TABLE `'.$_POST['db_prefix'].'system_roles`
echo msg('fail', 'Error creating admin group.');
exit;
}
//Admin User
$db->setCol('system_admins');
$db->data['username'] = $_POST['admin_name'];
@ -235,21 +207,19 @@ ALTER TABLE `'.$_POST['db_prefix'].'system_roles`
echo msg('fail', 'Error creating admin user.');
exit;
}
//Page title
if(file_put_contents('../inc/System/page_title.txt', $_POST['general_page_title']))
{
echo msg('succes', 'Page Title was successfully set.<br/>');
}
else
{
echo msg('fail', 'Error setting page title.');
exit;
}
//htacces
$htacces = 'ErrorDocument 404 '.$_POST['general_home_url'].'index.php
//Page title
if(file_put_contents('../inc/System/page_title.txt', $_POST['general_page_title']))
{
echo msg('succes', 'Page Title was successfully set.<br/>');
}
else
{
echo msg('fail', 'Error setting page title.');
exit;
}
//htacces
$htacces = 'ErrorDocument 404 '.$_POST['general_home_url'].'index.php
<Ifapps mod_rewrite.c>
<Ifapps mod_env.c>
SetEnv gp_rewrite U9sL2S2
@ -266,16 +236,15 @@ RewriteRule /?(.*) "'.$_POST['general_home_url'].'index.php?$1" [qsa,L]
RewriteRule . "'.$_POST['general_home_url'].'index.php" [L]
</Ifapps>
</Ifapps>';
if(file_put_contents('../.htaccess', $htacces))
{
echo msg('succes', '.htaccess was successfully set.<br/>');
}
else
{
echo msg('fail', 'Error setting up .htaccess.<br/>');
exit;
}
if(file_put_contents('../.htaccess', $htacces))
{
echo msg('succes', '.htaccess was successfully set.<br/>');
}
else
{
echo msg('fail', 'Error setting up .htaccess.<br/>');
exit;
}
//Apps
$modulurl = '../apps/';
if ($handle = opendir($modulurl))
@ -293,7 +262,6 @@ RewriteRule . "'.$_POST['general_home_url'].'index.php" [L]
}
closedir($handle);
}
//Write Config
$configfile = Yaml::dump($CONFIG);
if(file_put_contents('../inc/config.yml', $configfile))
@ -305,77 +273,76 @@ RewriteRule . "'.$_POST['general_home_url'].'index.php" [L]
echo msg('fail', 'Error creating configfile.');
exit;
}
echo msg('info', 'Installation successfully completed. <a href="'.$_POST['general_webUrl'].'admin">Login</a>');
}
else
{
echo msg('info', 'Please fill in all fields!');
}
}
else
{
echo msg('info', 'Please fill in all fields!');
}
}
else
{
?>
<div class="install-container">
<form action="" method="post" class="form">
<h2>Language</h2>
<span>Select your language:</span>
<select name="lang">
<?php
$langs = $lang->getAll();
foreach ($langs as $lang_code => $lang_detail)
{
echo '<option value="'.$lang_code.'">'.$lang_detail['Lang'].'</option>';
}
?>
</select><br/><br/>
<h2>Mysql</h2>
<span>Host</span><input type="text" placeholder="Host" name="db_host" value="localhost"/><br/>
<span>Database</span><input type="text" placeholder="Database" name="db_name"/><br/>
<span>Username</span><input type="text" placeholder="Username" name="db_user" value="root"/><br/>
<span>Password</span><input type="password" placeholder="Password" name="db_pw1"/><br/>
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="db_pw2"/><br/>
<span>Table prefix</span><input type="text" placeholder="Table prefix" name="db_prefix"/><br/><br/>
<h2>Website</h2>
<span>Website Url</span><input type="text" placeholder="Website Url" name="general_webUrl" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']);?>"/><br/>
<span>Home Url</span><input type="text" placeholder="Home Url" name="general_home_url" value="<?php echo str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']);?>"/><br/>
<span>Phpmyadmin Url</span><input type="text" placeholder="Phpmyadmin Url" name="general_pma"/><br/>
<span>Page Title</span><input type="text" placeholder="Page Title" name="general_page_title"/><br/>
<span>Editor CSS</span><input type="text" placeholder="Editor CSS" name="general_editor_css"/><br/>
<span>Template</span><input type="text" placeholder="Template" name="general_template" value="content/template.tpl"/><br/>
<h2>First Adminuser</h2>
<span>Name</span><input type="text" placeholder="Name" name="admin_name"/><br/>
<span>Email-Adress</span><input type="email" placeholder="Email-Adress" name="admin_mail"/><br/>
<span>Password</span><input type="password" placeholder="Password" name="admin_pw1"/><br/>
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="admin_pw2"/><br/>
<?php
$modulurl = '../apps/';
if ($handle = opendir($modulurl))
{
while (false !== ($mod = readdir($handle)))
{
if ($mod != "." && $mod != ".." && is_dir($modulurl . $mod))
{
//echo $mod;
require $modulurl . $mod . '/config.php';
if (isset($_CONF['install']) && $_CONF['install'] != '' && file_exists($modulurl . $mod . '/' . $_CONF['install']))
<div class="install-container">
<form action="" method="post" class="form">
<h2>Language</h2>
<span>Select your language:</span>
<select name="lang">
<?php
$langs = $lang->getAll();
foreach ($langs as $lang_code => $lang_detail)
{
require $modulurl . $mod . '/' . $_CONF['install'];
echo '<option value="'.$lang_code.'">'.$lang_detail['Lang'].'</option>';
}
}
}
closedir($handle);
}
?>
<p style="text-align: center"><input type="submit" value="Install" name="submit"/></p>
</form>
?>
</select><br/><br/>
</div>
<?php
<h2>Mysql</h2>
<span>Host</span><input type="text" placeholder="Host" name="db_host" value="localhost"/><br/>
<span>Database</span><input type="text" placeholder="Database" name="db_name"/><br/>
<span>Username</span><input type="text" placeholder="Username" name="db_user" value="root"/><br/>
<span>Password</span><input type="password" placeholder="Password" name="db_pw1"/><br/>
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="db_pw2"/><br/>
<span>Table prefix</span><input type="text" placeholder="Table prefix" name="db_prefix"/><br/><br/>
<h2>Website</h2>
<span>Website Url</span><input type="text" placeholder="Website Url" name="general_webUrl" value="http://<?php echo $_SERVER['SERVER_NAME'].str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']);?>"/><br/>
<span>Home Url</span><input type="text" placeholder="Home Url" name="general_home_url" value="<?php echo str_replace('admin/install.php', '', $_SERVER['REQUEST_URI']);?>"/><br/>
<span>Phpmyadmin Url</span><input type="text" placeholder="Phpmyadmin Url" name="general_pma"/><br/>
<span>Page Title</span><input type="text" placeholder="Page Title" name="general_page_title"/><br/>
<span>Editor CSS</span><input type="text" placeholder="Editor CSS" name="general_editor_css"/><br/>
<span>Template</span><input type="text" placeholder="Template" name="general_template" value="content/template.tpl"/><br/>
<h2>First Adminuser</h2>
<span>Name</span><input type="text" placeholder="Name" name="admin_name"/><br/>
<span>Email-Adress</span><input type="email" placeholder="Email-Adress" name="admin_mail"/><br/>
<span>Password</span><input type="password" placeholder="Password" name="admin_pw1"/><br/>
<span>Confirm Password</span><input type="password" placeholder="Confirm Password" name="admin_pw2"/><br/>
<?php
$modulurl = '../apps/';
if ($handle = opendir($modulurl))
{
while (false !== ($mod = readdir($handle)))
{
if ($mod != "." && $mod != ".." && is_dir($modulurl . $mod))
{
//echo $mod;
require $modulurl . $mod . '/config.php';
if (isset($_CONF['install']) && $_CONF['install'] != '' && file_exists($modulurl . $mod . '/' . $_CONF['install']))
{
require $modulurl . $mod . '/' . $_CONF['install'];
}
}
}
closedir($handle);
}
?>
<p style="text-align: center"><input type="submit" value="Install" name="submit"/></p>
</form>
</div>
<?php
}
?>
</body>

View File

@ -20,6 +20,7 @@ $lang['all_fields'] = 'Bitte alle Felder ausfüllen.';
$lang['error_2fa'] = 'Fehler bei der Anmeldung in zwei Schritten.';
$lang['wrong_username_or_pass'] = 'Benutzername oder Passwort falsch.';
$lang['wrong_pass'] = 'Falsches Passwort';
$lang['404_not_found'] = 'Die Seite wurde nicht gefunden.';
//Dashboard
$lang['delete_config_success'] = 'Die installationsdatei wurde erfolgreich gelöscht.';

View File

@ -20,6 +20,7 @@ $lang['all_fields'] = 'Please fill in all fields';
$lang['error_2fa'] = 'Error with 2-Step Verification authentication';
$lang['wrong_username_or_pass'] = 'Wrong username or password.';
$lang['wrong_pass'] = 'Wrong password';
$lang['404_not_found'] = 'The page you requested was not found.';
//Dashboard
$lang['delete_config_success'] = 'The Install-file was deleted successfully';

View File

@ -405,7 +405,7 @@ if (isset($_SESSION['user']))
$('#content').html('<div><textarea id="text"></textarea></div>');
$('#text').load(url);
}
$('#content').append('<p><?php echo $lang->get('files_url'); ?>:<input type="text" class="select" value="' + url + '" onClick="this.select();"/></p><p><a href="' + webUri + 'apps/Files/index.php?dl=' + url + '" class="button"><i class="icon-download"></i> <?php echo $lang->get('files_download'); ?></a> <a onclick="deleteFile(\'' + $('#displayUrl').html() + file + '\');" class="button btn_del"><i class="icon-trash-o"></i> <?php echo $lang->get('files_delete'); ?></a></p>');
$('#content').append('<p><?php echo $lang->get('files_url'); ?>:<input type="text" class="select" value="' + url + '" onClick="this.select();"/></p><p><a href="' + webUri + 'apps/Files/index.php?dl=' + url + '" class="button" download="download"><i class="icon-download"></i> <?php echo $lang->get('files_download'); ?></a> <a onclick="deleteFile(\'' + $('#displayUrl').html() + file + '\');" class="button btn_del"><i class="icon-trash-o"></i> <?php echo $lang->get('files_delete'); ?></a></p>');
//uuund einbelnden
$(".overlay").fadeIn(250);

View File

@ -4,7 +4,7 @@ if (isset($_POST['sidebarconf']))
$sidebar_inhalt = 'text';
$text = $_POST['sidebar_inhalt'];
$active = false;
if($_POST['aktiv'] == 'true')
if(isset($_POST['active']) && $_POST['active'] == 'true')
{
$active = true;
}
@ -13,7 +13,7 @@ if (isset($_POST['sidebarconf']))
$db->data = ['active' => $active, 'content' => $text];
if ($db->update())
{
echo msg('succes', 'Die &Auml;nderungen der Sidebar wurden erfolgreich gespeichert.');
echo msg('success', 'Die &Auml;nderungen der Sidebar wurden erfolgreich gespeichert.');
}
else
{
@ -30,11 +30,9 @@ else
$active = '';
if(!$db->data[0]['active']) $active = ' selected';
?>
<p><span>Sidebar anzeigen:</span>
<select name="aktiv" id="aktivswitch" onchange="toggleTextField()">
<option value="true">Ja</option>
<option value="false"<?php echo $active ?>>Nein</option>
</select>
<p>
<input type="checkbox" name="active" value="y" id="activeswitch" onchange="toggleTextField()"/>
<label for="activeswitch"><i></i>Sidebar anzeigen</label>
</p>
</div>
<div id="editorContainer">
@ -44,14 +42,15 @@ else
</div>
<input type="hidden" name="sidebarconf" value="smbt"/>
<script>
if($('#aktivswitch').val() == 'true') {
if($('#activeswitch').is(':checked')) {
$('#editorContainer').show();
}
else {
$('#editorContainer').hide();
}
function toggleTextField(){
if($('#aktivswitch').val() == 'true') {
if($('#activeswitch').is(':checked')) {
$('#editorContainer').show();
}
else {

View File

@ -1 +1,8 @@
<h1>Baustelle</h1>
<h1>Baustelle</h1>
<p>&nbsp;</p>
<p>oder so</p>
<p>&nbsp;</p>
<p>(oder?)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="/SelfCMS/Mowie-Github/admin/mowie.cc">mowie.cc</a></p>

View File

@ -1,12 +1,133 @@
<div id="showMsg"></div>
<script>
function showMsg(msg){
$('#showMsg').html('<div class="snackbar"><a onclick="closeMsg();" class="closeMsg"><i class="icon-close"></i> </a><p>' + msg + '</p></div>');
}
<?php
if(!isset($_GET['direct']))
{
?>
</div>
<div id="showMsg"></div>
<script src="<?php echo $MCONF['web_uri']?>admin/assets/js/page.js"></script>
<script>
function showMsg(msg) {
$('#showMsg').html('<div class="snackbar"><a onclick="closeMsg();" class="closeMsg"><i class="icon-close"></i> </a><p>' + msg + '</p></div>');
}
function closeMsg(){
$('#showMsg').html('');
}
</script>
</body>
</html>
function closeMsg() {
$('#showMsg').html('');
}
//Show Loader
function showTopLoader() {
$('.loader-overlay').fadeIn(150);
$('.toploading').animate({height: "8px"}, 150);
}
function hideTopLoader() {
$('.loader-overlay').fadeOut(150);
$('.toploading').animate({height: "0"}, 150);
}
$(document).ready(function() {
//Form
// pre-submit callback
function showLoader(formData, jqForm, options) {
showTopLoader();
console.log('Form');
return true;
}
// post-submit callback
function showResponse(responseText, statusText, xhr, $form) {
//return false;
hideTopLoader();
console.log(statusText);
}
//Error
function showError(e) {
console.log(e);
}
var options = {
target: '#loader',
beforeSubmit: showLoader,
success: showResponse,
error: showError,
resetForm: false,
data: {direct: ''}
};
$('form').ajaxForm(options);
//Router
$('#topnav').addClass('no-transition');
page.base('<?php echo $MCONF['home_uri'];?>');
page('*', findPage);
page();
function findPage(ctx, next) {
//console.log(ctx);
if(!ctx.init) {
//if('<?php echo str_replace($MCONF['home_uri'], '', $MCONF['web_uri']);?>' + ctx.canonicalPath != window.location.href) {
showTopLoader();
//Load Title
var title = '';
var query = '';
if (ctx.querystring != '') {
query += '&' + ctx.querystring;
}
$.get(ctx.pathname + '?title' + query, function (data) {
title = data;
}).fail(function (e) {
if(e.status == 404){
showMsg('<?php echo $lang->get('404_not_found');?> (' + e.statusText + ')');
} else {
showMsg('Error.');
}
});
//Load Content
$.get(ctx.pathname + '?direct' + query, function (data) {
hideTopLoader();
if (data == 'Login First.') {
location.reload();
} else {
$("#loader").html(data);
//Set Title
$("#title").html(title);
document.title = title + ' | <?php echo $lang->get('admin_title') . ' | ' . $MCONF['title']?>';
//Update Menu
$('li').each(function (index) {
$(this).removeClass('active');
});
//Find Class & Parent for menu
var menuitem = 'mw-menu-' + ctx.path.replace(/\//g, '-').replace('.php', '').replace('?', '').replace('&', '').replace('=', '');
//console.log(menuitem);
$('#' + menuitem).addClass('active');
//Find Top item
var topitems = menuitem.split('-');
//console.log(topitems);
$('#' + 'mw-menu-' + topitems[2] + '-' + topitems[3] + '-top').addClass('active');
if (topitems[3] == 'roles' || topitems[3] == 'users' || topitems[3] == 'permissions' || topitems[3] == 'new_user') {
$('#' + 'mw-menu-admin-users-top').addClass('active');
}
}
}).fail(function (e) {
if(e.status == 404){
showMsg('<?php echo $lang->get('404_not_found');?> (' + e.statusText + ')');
} else {
showMsg('Error.');
}
});
// }
}
}
});
</script>
</body>
</html>
<?php
}

View File

@ -2,55 +2,41 @@
//msg
function msg($typ, $msg = null)
{
$out = [];
$msg = str_replace('{back}', '<a onclick="history.back(-1)">Zurück</a>', $msg);
if ($typ == 'succes' || $typ == 'success')
{
if (!isset($msg)) $msg = 'Die Operation wurde erfolgreich durchgeführt.';
$out['type'] = 'success';
$out['msg'] = $msg;
return '<div class="message-success">' . $msg . '</div>';
} elseif ($typ == 'fail')
}
elseif ($typ == 'fail')
{
if (!isset($msg)) $msg = 'Fehler. ' . $GLOBALS['texte'][2];
$out['type'] = 'fail';
$out['msg'] = $msg;
return '<div class="message-fail">' . $msg . '</div>';
} else
}
else
{
$out['type'] = 'info';
$out['msg'] = $msg;
return '<div class="message-info">' . $msg . '</div>';
}
}
//datum rückwärts
function datum_ruck($timestamp)
{
$diff = time() - $timestamp;
if ($diff < 30)
if(isset($_GET['json']))
{
return 'vor kurzem';
}
if ($diff < 60)
{
return 'vor weniger als einer Minute';
}
if ($diff < 3600)
{
return 'vor ' . round(($diff / 60)) . ' Minuten';
}
if ($diff < 86400)
{
return 'vor ' . round((($diff / 60) / 60)) . ' Stunden';
}
if ($diff < 2592000)
{
return 'vor ' . round(((($diff / 60) / 60) / 24)) . ' Tagen';
}
if ($diff < 31104000)
{
return 'vor ' . round((((($diff / 60) / 60) / 24) / 12)) . ' Monaten';
}
if ($diff > 30693600)
{
return 'vor ' . round(($diff / 31536000)) . ' Jahren';
}
header('Content-Type: application/json');
return json_encode($out);
return $diff;
}
else
{
return '<div class="message-'.$out['type'].'">' . $out['msg'] . '</div>';
}
}
//nichtleeren ordner löschen
@ -75,121 +61,15 @@ function rrmdir($dir)
}
}
//Simple Image
class SimpleImage
{
var $image;
var $image_type;
function load($filename)
{
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if ($this->image_type == IMAGETYPE_JPEG)
{
$this->image = imagecreatefromjpeg($filename);
} elseif ($this->image_type == IMAGETYPE_GIF)
{
$this->image = imagecreatefromgif($filename);
} elseif ($this->image_type == IMAGETYPE_PNG)
{
$this->image = imagecreatefrompng($filename);
}
}
function save($filename, $image_type = IMAGETYPE_JPEG, $compression = 95, $permissions = null)
{
if ($image_type == IMAGETYPE_JPEG)
{
imagejpeg($this->image, $filename, $compression);
} elseif ($image_type == IMAGETYPE_GIF)
{
imagegif($this->image, $filename);
} elseif ($image_type == IMAGETYPE_PNG)
{
imagepng($this->image, $filename);
}
if ($permissions != null)
{
chmod($filename, $permissions);
}
}
function output($image_type = IMAGETYPE_JPEG)
{
if ($image_type == IMAGETYPE_JPEG)
{
imagejpeg($this->image);
} elseif ($image_type == IMAGETYPE_GIF)
{
imagegif($this->image);
} elseif ($image_type == IMAGETYPE_PNG)
{
imagepng($this->image);
}
}
function getWidth()
{
return imagesx($this->image);
}
function getHeight()
{
return imagesy($this->image);
}
function resizeToHeight($height)
{
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$this->resize($width, $height);
}
function resizeToWidth($width)
{
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$this->resize($width, $height);
}
function scale($scale)
{
$width = $this->getWidth() * $scale / 100;
$height = $this->getheight() * $scale / 100;
$this->resize($width, $height);
}
function resize($width, $height)
{
$new_image = imagecreatetruecolor($width, $height);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
}
//Tinymce
function tinymce($css = '../../css/tinymce.css', $edit_area = '#editor')
{
echo '<script src="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/js/tinymce/tinymce.min.js"></script>
if(!isset($_GET['json']))
{
echo '<script src="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/js/tinymce/tinymce.min.js"></script>
<script>
tinymce.init({
selector: "'.$edit_area.'",
selector: "' . $edit_area . '",
auto_focus: "editor",
theme: "modern",
skin: "light",
@ -212,12 +92,13 @@ function tinymce($css = '../../css/tinymce.css', $edit_area = '#editor')
width: "100%"
});
</script>';
}
}
function random($lange)
function random($size)
{
$zahlen_und_buchstaben = array('a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', 'G', 'g', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P', 'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y', 'z', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
for ($i = 0, $random = ''; $i < $lange; $i++)
for ($i = 0, $random = ''; $i < $size; $i++)
{
$random .= $zahlen_und_buchstaben[array_rand($zahlen_und_buchstaben)];
}
@ -269,7 +150,6 @@ function is_loggedin()
{
$GLOBALS['db']->setCol('system_loggedin');
$GLOBALS['db']->data['token'] = $_SESSION['token'];
$GLOBALS['db']->data['user'] = $_SESSION['userid'];
$GLOBALS['db']->delete();
// last request was more than 30 minutes ago
@ -313,193 +193,229 @@ function printHeader($title)
$title = $GLOBALS['lang']->get('login');
}
//<link rel="stylesheet prefetch" href="' . $GLOBALS['MCONF']['web_uri'] . 'css/video-js.css" type="text/css"/>
echo '<!DOCTYPE html>
if(isset($_REQUEST['direct']))
{
if(!is_loggedin())
{
header("Content-Type: text/plain");
echo 'Login First.';
exit;
}
}
elseif (isset($_GET['title']))
{
if(!is_loggedin())
{
header("Content-Type: text/plain");
echo 'Login First.';
exit;
}
else
{
header("Content-Type: text/plain");
echo $title;
exit;
}
}
else
{
//<link rel="stylesheet prefetch" href="' . $GLOBALS['MCONF']['web_uri'] . 'css/video-js.css" type="text/css"/>
echo '<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>' . $title . ' | '.$GLOBALS['lang']->get('admin_title').' | ' . $GLOBALS['MCONF']['title'] . '</title>
<title>' . $title . ' | ' . $GLOBALS['lang']->get('admin_title') . ' | ' . $GLOBALS['MCONF']['title'] . '</title>
<link rel="shourtcut icon" href="' . $GLOBALS['MCONF']['web_uri'] . 'favicon.ico"/>
<link rel="stylesheet" href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/admin.css" type="text/css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<script src="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/js/jquery.min.js"></script>
<script src="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/js/jquery.form.min.js"></script>
</head>
<body>';
if (is_loggedin())
{
echo '<header>
' . $title . '
if (is_loggedin())
{
echo '<div class="toploading"></div> <header>
<span id="title">' . $title . '</span>
<div class="options" tabindex="0">
<input type="checkbox" id="options_menu" />
<label for="options_menu">
<p><span class="usr_info"><img src="http://www.gravatar.com/avatar/' . md5(strtolower(trim($_SESSION['mail']))) . '?s=40&d=mm" alt=""/>' . $_SESSION['user'] . '</span> <span class="icon-"></span></p>
<ul>
<li><a href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/user_settings.php"><span class="icon-gear"></span> '.$GLOBALS['lang']->get('settings').'</a></li>
<li><a href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/logout.php"><span class="icon-exit"></span> '.$GLOBALS['lang']->get('logout').'</a></li>
<li><a href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/user_settings.php"><span class="icon-gear"></span> ' . $GLOBALS['lang']->get('settings') . '</a></li>
<li><a href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/logout.php" rel="external"><span class="icon-exit"></span> ' . $GLOBALS['lang']->get('logout') . '</a></li>
</ul>
</label>
</div>
</header>
<label for="show-menu" class="show-menu"><i class="icon-navicon"></i> </label>
<input type="checkbox" id="show-menu" role="button">
<nav>
<nav id="topnav">
<header>
<a href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/"><img src="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/Logo.svg" alt="Mowie CMS"/></a>
<a href="' . $GLOBALS['MCONF']['home_uri'] . 'admin/"><img src="' . $GLOBALS['MCONF']['web_uri'] . 'admin/assets/Logo.svg" alt="Mowie CMS"/></a>
</header>
<ul><li><a href="' . $GLOBALS['MCONF']['web_uri'] . '" target="_blank"><i class="icon-external-link"></i> '.$GLOBALS['lang']->get('main_page').'</a></li>
<ul id="menulist"><li><a href="' . $GLOBALS['MCONF']['home_uri'] . '" target="_blank"><i class="icon-external-link"></i> ' . $GLOBALS['lang']->get('main_page') . '</a></li>
<li';
if ($title == $GLOBALS['lang']->get('dashboard_title')) echo ' class="active"';
echo '><a href="' . $GLOBALS['MCONF']['web_uri'] . 'admin/"><i class="icon-dashboard"></i> '.$GLOBALS['lang']->get('dashboard').'</a></li>';
if ($title == $GLOBALS['lang']->get('dashboard_title')) echo ' class="active"';
echo ' id="mw-menu-admin-"><a href="' . $GLOBALS['MCONF']['home_uri'] . 'admin/"><i class="icon-dashboard"></i> ' . $GLOBALS['lang']->get('dashboard') . '</a></li>';
if (hasPerm('manage_system', 'System'))
{
echo '<li';
if ($title == $GLOBALS['lang']->get('general_config')) echo ' class="active"';
echo '><a href="'.$GLOBALS['MCONF']['web_uri'].'admin/general_config.php"><i
if (hasPerm('manage_system', 'System'))
{
echo '<li';
if ($title == $GLOBALS['lang']->get('general_config')) echo ' class="active"';
echo ' id="mw-menu-admin-general_config"><a href="' . $GLOBALS['MCONF']['home_uri'] . 'admin/general_config.php"><i
class="icon-sliders"></i>
'.$GLOBALS['lang']->get('general_config').'</a></li>';
}
if (hasPerm('manage_admins', 'System'))
{
?>
<li<?php
if ($title == $GLOBALS['lang']->get('admins_list') || $title == $GLOBALS['lang']->get('admins_create_new') || $title == $GLOBALS['lang']->get('admins_groups') || $title == $GLOBALS['lang']->get('admins_permissions')) echo ' class="active"';
?>><a href="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/users.php"><i class="icon-users2"></i>
<?php echo $GLOBALS['lang']->get('admins_title');?><i class="icon-chevron-right sub_menu"></i></a>
<ul>
<li><a href="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/users.php"<?php
if ($title == $GLOBALS['lang']->get('admins_list')) echo ' class="now"';
?>><i class="icon-users2"></i> <?php echo $GLOBALS['lang']->get('admins_list');?></a></li>
<li><a href="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/roles.php"<?php
if ($title == $GLOBALS['lang']->get('admins_groups')) echo ' class="now"';
?>><i class="icon-group"></i> <?php echo $GLOBALS['lang']->get('admins_groups');?></a></li>
<li><a href="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/permissions.php"<?php
if ($title == $GLOBALS['lang']->get('admins_permissions')) echo ' class="now"';
?>><i class="icon-group"></i> <?php echo $GLOBALS['lang']->get('admins_permissions');?></a></li>
<li><a href="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/new_user.php"<?php
if ($title == $GLOBALS['lang']->get('admins_create_new')) echo ' class="now"';
?>><i class="icon-user-plus2"></i> <?php echo $GLOBALS['lang']->get('admins_create_new');?></a></li>
</ul>
</li>
<?php
}
$moduluri = '../apps/';
$pos = strpos($_SERVER['REQUEST_URI'], '/apps/');
if ($pos !== false)
{
$moduluri = '../';
$rel = explode('/', str_replace($GLOBALS['MCONF']['home_uri'].'apps/', '', $_SERVER['REQUEST_URI']));
$count = count($rel);
$count = $count -1;
$i = 1;
while($i<$count)
{
$moduluri .= '../';
$i++;
' . $GLOBALS['lang']->get('general_config') . '</a></li>';
}
}
if ($handle = opendir($moduluri))
{
while (false !== ($mod = readdir($handle)))
if (hasPerm('manage_admins', 'System'))
{
if ($mod != "." && $mod != ".." && is_dir($moduluri . $mod))
{
require $moduluri . $mod . '/config.php';
if ($_CONF['menu_top'] !== '')
{
$now = '';
if (strpos($_SERVER['REQUEST_URI'], $mod) !== false)
{
$now = ' class="active"';
}
?>
<li<?php
if ($title == $GLOBALS['lang']->get('admins_list') || $title == $GLOBALS['lang']->get('admins_create_new') || $title == $GLOBALS['lang']->get('admins_groups') || $title == $GLOBALS['lang']->get('admins_permissions')) echo ' class="active"';
?> id="mw-menu-admin-users-top"><a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>admin/users.php"><i class="icon-users2"></i>
<?php echo $GLOBALS['lang']->get('admins_title'); ?><i class="icon-chevron-right sub_menu"></i></a>
<ul>
<li id="mw-menu-admin-users"><a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>admin/users.php"<?php
if ($title == $GLOBALS['lang']->get('admins_list')) echo ' class="active"';
?>><i class="icon-users2"></i> <?php echo $GLOBALS['lang']->get('admins_list'); ?></a></li>
<li id="mw-menu-admin-roles"><a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>admin/roles.php"<?php
if ($title == $GLOBALS['lang']->get('admins_groups')) echo ' class="active"';
?>><i class="icon-group"></i> <?php echo $GLOBALS['lang']->get('admins_groups'); ?></a></li>
<li id="mw-menu-admin-permissions"><a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>admin/permissions.php"<?php
if ($title == $GLOBALS['lang']->get('admins_permissions')) echo ' class="active"';
?>><i class="icon-group"></i> <?php echo $GLOBALS['lang']->get('admins_permissions'); ?></a>
</li>
<li id="mw-menu-admin-new_user"><a href="<?php echo $GLOBALS['MCONF']['home_uri']; ?>admin/new_user.php"<?php
if ($title == $GLOBALS['lang']->get('admins_create_new')) echo ' class="active"';
?>><i class="icon-user-plus2"></i> <?php echo $GLOBALS['lang']->get('admins_create_new'); ?>
</a></li>
</ul>
</li>
<?php
}
$moduluri = '../apps/';
$pos = strpos($_SERVER['REQUEST_URI'], '/apps/');
if ($pos !== false)
{
$moduluri = '../';
$rel = explode('/', str_replace($GLOBALS['MCONF']['home_uri'] . 'apps/', '', $_SERVER['REQUEST_URI']));
$count = count($rel);
$count = $count - 1;
if (array_key_exists('menu_top', $_CONF['menu']))
$i = 1;
while ($i < $count)
{
$moduluri .= '../';
$i++;
}
}
if ($handle = opendir($moduluri))
{
while (false !== ($mod = readdir($handle)))
{
if ($mod != "." && $mod != ".." && is_dir($moduluri . $mod))
{
require $moduluri . $mod . '/config.php';
if ($_CONF['menu_top'] !== '')
{
echo "\n" . '<li' . $now . '><a href="' . $moduluri . $mod . '/' . $_CONF['menu']['menu_top'] . '">' . $_CONF['menu_top'] . '</a>' . "\n";
} else
{
$first_itm = array_keys($_CONF['menu']);
echo "\n" . '<li' . $now . '><a href="' . $moduluri . $mod . '/' . $_CONF['menu'][$first_itm[0]] . '">' . $_CONF['menu_top'] . '<i class="icon-chevron-right sub_menu"></i></a>' . "\n" . '<ul>';
foreach ($_CONF['menu'] as $mod_name_anz => $mod_name_url)
$now = '';
if (strpos($_SERVER['REQUEST_URI'], $mod) !== false)
{
$now = '';
if (strpos($_SERVER['REQUEST_URI'], $mod_name_url) !== false && strpos($_SERVER['REQUEST_URI'], $mod) !== false)
{
$now = ' class="now"';
}
echo '<li><a href="' . $moduluri . $mod . '/' . $mod_name_url . '"' . $now . '>' . $mod_name_anz . '</a></li>' . "\n";
$now = ' class="active"';
}
echo '</ul></li>' . "\n";
if (array_key_exists('menu_top', $_CONF['menu']))
{
echo "\n" . '<li' . $now . ' id="mw-menu-apps-'.$mod.'-top"><a href="' . $GLOBALS['MCONF']['home_uri'] . 'apps/' . $mod . '/' . $_CONF['menu']['menu_top'] . '">' . $_CONF['menu_top'] . '</a>' . "\n";
} else
{
$first_itm = array_keys($_CONF['menu']);
echo "\n" . '<li' . $now . ' id="mw-menu-apps-'.$mod.'-top"><a href="' . $GLOBALS['MCONF']['home_uri'] . 'apps/' . $mod . '/' . $_CONF['menu'][$first_itm[0]] . '">' . $_CONF['menu_top'] . '<i class="icon-chevron-right sub_menu"></i></a>' . "\n" . '<ul>';
foreach ($_CONF['menu'] as $mod_name_anz => $mod_name_url)
{
$now = '';
if (strpos($_SERVER['REQUEST_URI'], $mod_name_url) !== false && strpos($_SERVER['REQUEST_URI'], $mod) !== false)
{
$now = ' class="active"';
}
echo '<li' . $now . ' id="mw-menu-apps-'.$mod.'-'.str_replace(['.php', '?', '&'], '', str_replace('/', '-', $mod_name_url)).'"><a href="' . $GLOBALS['MCONF']['home_uri'] . 'apps/' . $mod . '/' . $mod_name_url . '">' . $mod_name_anz . '</a></li>' . "\n";
}
echo '</ul></li>' . "\n";
}
$_CONF['menu_top'] = '';
}
$_CONF['menu_top'] = '';
}
}
closedir($handle);
}
closedir($handle);
}
echo '</ul>
echo '</ul>
<div class="copy"> © 2016 <a href="http://mowie.cc">Mowie</a></div>
</nav>
<label for="show-menu" class="mobile-overlay"></label>
<div style="height: 40px;"></div>';
}
else
{
?>
<div class="login_wrapper">
<img src="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/assets/Logo.svg" alt="Mowie"/>
<div class="login_container">
<h1><?php echo $GLOBALS['lang']->get('login');?></h1>
<form action="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/login.php" method="post"
id="login">
<input type="text" placeholder="<?php echo $GLOBALS['lang']->get('username');?>" id="username" autofocus/><br/>
<input type="password" placeholder="<?php echo $GLOBALS['lang']->get('password');?>" id="pw"/><br/>
<div id="2faContainer" style="display: none">
<input type="text" id="2fa" autocomplete="off" placeholder="<?php echo $GLOBALS['lang']->get('2fa_code');?>"><br/>
</div>
<input type="submit" value="<?php echo $GLOBALS['lang']->get('login');?>"/>
</form>
<div id="msg"></div>
<div style="height: 40px;"></div>
<div class="loader-overlay"></div>
<div id="loader">
';
} else
{
?>
<div class="login_wrapper">
<img src="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/assets/Logo.svg" alt="Mowie"/>
<div class="login_container">
<h1><?php echo $GLOBALS['lang']->get('login'); ?></h1>
<form action="<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/login.php" method="post"
id="login">
<input type="text" placeholder="<?php echo $GLOBALS['lang']->get('username'); ?>" id="username"
autofocus/><br/>
<input type="password" placeholder="<?php echo $GLOBALS['lang']->get('password'); ?>"
id="pw"/><br/>
<div id="2faContainer" style="display: none">
<input type="text" id="2fa" autocomplete="off"
placeholder="<?php echo $GLOBALS['lang']->get('2fa_code'); ?>"><br/>
</div>
<input type="submit" value="<?php echo $GLOBALS['lang']->get('login'); ?>"/>
</form>
<div id="msg"></div>
</div>
<p style="text-align: center;color: #fff;text-shadow: 1px 1px 1px #555;">&copy; 2016 Mowie CMS</p>
</div>
<p style="text-align: center;color: #fff;text-shadow: 1px 1px 1px #555;">&copy; 2016 Mowie CMS</p>
</div>
<script>
$("#login").submit(function () {
if ($('#username').val() == '' || $('#pw').val() == '') {
$('#msg').html('<?php echo $GLOBALS['lang']->get('all_fields');?>');
}
else {
$('#msg').html('<div class="spinner-container"><svg class="spinner" style="width:41px;height:40px;" viewBox="0 0 44 44"><circle class="path" cx="22" cy="22" r="20" fill="none" stroke-width="4"></circle> </svg> </div>');
<script>
$("#login").submit(function () {
if ($('#username').val() == '' || $('#pw').val() == '') {
$('#msg').html('<?php echo $GLOBALS['lang']->get('all_fields');?>');
}
else {
$('#msg').html('<div class="spinner-container"><svg class="spinner" style="width:41px;height:40px;" viewBox="0 0 44 44"><circle class="path" cx="22" cy="22" r="20" fill="none" stroke-width="4"></circle> </svg> </div>');
$.ajax({
type: 'POST',
url: '<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/login.php',
data: "username=" + $('#username').val() + "&pw=" + $('#pw').val() + "&2fa=" + $('#2fa').val(),
success: function (msg) {
console.log(msg);
if (msg == 'success') {
location.reload();
$.ajax({
type: 'POST',
url: '<?php echo $GLOBALS['MCONF']['web_uri']; ?>admin/login.php',
data: "username=" + $('#username').val() + "&pw=" + $('#pw').val() + "&2fa=" + $('#2fa').val(),
success: function (msg) {
console.log(msg);
if (msg == 'success') {
location.reload();
}
else if (msg == '2fa') {
$('#2faContainer').show();
$('#msg').hide();
}
else if (msg == '2fafail') {
$('#msg').html('<div class="message-fail"><?php echo $GLOBALS['lang']->get('error_2fa');?></div>');
}
else {
$('#msg').html('<div class="message-fail"><?php echo $GLOBALS['lang']->get('wrong_username_or_pass');?></div>');
}
}
else if(msg == '2fa') {
$('#2faContainer').show();
$('#msg').hide();
}
else if(msg == '2fafail') {
$('#msg').html('<div class="message-fail"><?php echo $GLOBALS['lang']->get('error_2fa');?></div>');
}
else {
$('#msg').html('<div class="message-fail"><?php echo $GLOBALS['lang']->get('wrong_username_or_pass');?></div>');
}
}
});
}
return false;
});
</script>
</body>
</html><?php
exit;
});
}
return false;
});
</script>
</body>
</html><?php
exit;
}
}
}