#30 custom modules + #497 Replace IDs with type

This commit is contained in:
Ulrich Block 2014-09-21 18:41:13 +02:00
parent 2f22b9d66d
commit 066ebfc930
10 changed files with 463 additions and 311 deletions

View File

@ -81,52 +81,57 @@ if ($ui->smallletters('w', 9, 'get') == 'datatable') {
require_once(EASYWIDIR . '/stuff/ajax/datatable_userlog.php');
// Mail log
// Mail log
} else if ($ui->smallletters('d', 7, 'get') =='maillog' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['jobs']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_maillog.php');
// Job log
// Job log
} else if ($ui->smallletters('d', 6, 'get') =='joblog' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['jobs']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_joblog.php');
// ipbans
// IP bans
} else if ($ui->smallletters('d', 6, 'get') =='ipbans' and isset($admin_id) and isset($reseller_id) and $reseller_id == 0 and $pa['ipBans']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_ipbans.php');
// App server
} else if ($ui->smallletters('d', 9, 'get') =='appserver' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['roots']) {
// custom module
} else if ($ui->smallletters('d', 12, 'get') =='custommodule' and isset($admin_id) and isset($reseller_id) and $reseller_id == 0 and $pa['root']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_appserver.php');
require_once(EASYWIDIR . '/stuff/ajax/datatable_custommodule.php');
// App (GS + Tools) masterserver
} else if ($ui->smallletters('d', 15, 'get') =='appmasterserver' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['masterServer']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_appmasterserver.php');
// GS images
} else if ($ui->smallletters('d', 10, 'get') =='gameimages' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['gimages']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_gameimages.php');
// GS addons
} else if ($ui->smallletters('d', 16, 'get') =='gameserveraddons' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['addons']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_gameaddons.php');
// List of imported news feeds
// List of imported news feeds
} else if ($ui->smallletters('d', 16, 'get') =='feedsnewsentries' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['addons']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_feedsnewsentries.php');
// List of feeds
// List of feeds
} else if ($ui->smallletters('d', 5, 'get') =='feeds' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['addons']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_feeds.php');
// Code wise it seems odd, but this way we can get plausible userIDs for following queries up front
// App (GS + Tools) masterserver
} else if ($ui->smallletters('d', 15, 'get') =='appmasterserver' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['masterServer']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_appmasterserver.php');
// GS images
} else if ($ui->smallletters('d', 10, 'get') =='gameimages' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['gimages']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_gameimages.php');
// GS addons
} else if ($ui->smallletters('d', 16, 'get') =='gameserveraddons' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['addons']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_gameaddons.php');
// App server
} else if ($ui->smallletters('d', 9, 'get') =='appserver' and isset($admin_id) and isset($reseller_id) and isset($resellerLockupID) and $pa['roots']) {
require_once(EASYWIDIR . '/stuff/ajax/datatable_appserver.php');
// Code wise it seems odd, but this way we can get plausible userIDs for following queries up front
} else {
// When searching a table combination that should provide a server and user´s loginname, firstname, lastname. First do a search at usertable and get IDs.

View File

@ -48,12 +48,12 @@ $logusername = getusername($admin_id);
$logusertype = 'admin';
$logreseller = 0;
$logsubuser = 0;
$sprache = getlanguagefile('modules',$user_language,$reseller_id);
$sprache = getlanguagefile('modules', $user_language, $reseller_id);
unset($name);
# array with easy-wi core modules to prevent legacy issues and users from removing
$table = array(
$coreModules = array(
1 => array('id' => 1, 'active' => 'Y', 'name' => $gsprache->gameserver, 'sub' => 'gs', 'type' => $sprache->type_core),
2 => array('id' => 2, 'active' => 'Y', 'name' => 'Easy Anti Cheat', 'sub' => 'ea', 'type' => $sprache->type_core),
3 => array('id' => 3, 'active' => 'Y', 'name' => 'MySQL', 'sub' => 'my', 'type' => $sprache->type_core),
@ -65,7 +65,25 @@ $table = array(
9 => array('id' => 9, 'active' => 'Y', 'name' => 'CMS', 'sub' => 'pn', 'type' => $sprache->type_core),
10 => array('id' => 10, 'active' => 'Y', 'name' => $gsprache->webspace, 'sub' => 'ws', 'type' => $sprache->type_core)
);
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `modules` WHERE `type`='C' AND `get`=? LIMIT 1");
$query2 = $sql->prepare("INSERT INTO `modules` (`file`,`get`,`sub`,`type`,`active`) VALUES ('',?,?,'C',?) ON DUPLICATE KEY UPDATE `active`=VALUES(`active`)");
$query3 = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('mo',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach ($coreModules as $module) {
$query->execute(array($module['sub']));
if ((int) $query->fetchColumn() == 0) {
$query2->execute(array($module['sub'], $module['sub'], 'Y'));
$instertedID = $sql->lastInsertId();
$query3->execute(array($instertedID, $user_language, $module['name'], 0));
}
}
if ($ui->st('action', 'post') and !token(true)) {
unset($header, $text);
@ -82,29 +100,7 @@ if ($ui->st('action', 'post') and !token(true)) {
$active = ($ui->active('active', 'post')) ? $ui->active('active', 'post') : 'Y';
$langAvailable = getlanguages($template_to_use);
// Easy-WI core modules should only be (de)activated
if ($ui->st('d', 'get') == 'md' and $ui->st('action', 'post') == 'md' and $id < 1001) {
$query = $sql->prepare("INSERT INTO `modules` (`id`,`file`,`get`,`sub`,`type`,`active`) VALUES (?,'',?,'','C',?) ON DUPLICATE KEY UPDATE `active`=VALUES(`active`)");
$query->execute(array($id, (isset($table[$id]['sub'])) ? $table[$id]['sub'] : '', $active));
$template_file = ($query->rowCount() == 0) ? $spracheResponse->error_table : $spracheResponse->table_add;
} else if ($ui->st('d', 'get') == 'md' and !$ui->st('action', 'post') and $id < 1001) {
$name = (isset($table[$id]['name'])) ? $table[$id]['name'] : '';
$query = $sql->prepare("SELECT `active` FROM `modules` WHERE `id`=? LIMIT 1");
$query->execute(array($id));
$active = $query->fetchColumn();
if ($query->rowCount() == 0) {
$active = 'Y';
}
$template_file = (isset($table[$id])) ? 'admin_modules_md.tpl' : 'admin_404.tpl';
// Custom Modules
} else if ($id > 1000 or $ui->st('d', 'get') == 'ad') {
if ($ui->st('d', 'get') == 'ad' or $ui->st('d', 'get') == 'md') {
$dbSuccess = false;
$file = $ui->config('file', 'post');
@ -126,6 +122,8 @@ if ($ui->st('action', 'post') and !token(true)) {
if ($ui->st('action', 'post')) {
$coreModuleFound = false;
if (!$sub or !in_array($sub, array('gs', 'pa', 'mo', 'my', 'ro', 'ti', 'us', 'vo','ws')) ) {
$errors['sub'] = $sprache->sub;
}
@ -156,11 +154,27 @@ if ($ui->st('action', 'post') and !token(true)) {
$errors['file'] = $sprache->file;
}
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `modules` WHERE `type`='C' AND `id`=? LIMIT 1");
$query->execute(array($id));
if ($query->fetchColumn() == 1) {
$errors = array();
$coreModuleFound = true;
}
if (count($errors) == 0) {
if ($ui->st('action', 'post') == 'md') {
$query = $sql->prepare("UPDATE `modules` SET `get`=?,`file`=?,`sub`=?,`active`=?,`type`=? WHERE `id`=? LIMIT 1");
$query->execute(array($get, $file, $sub, $active, $type, $id));
if ($coreModuleFound) {
$query = $sql->prepare("UPDATE `modules` SET `active`=? WHERE `id`=? LIMIT 1");
$query->execute(array($active, $id));
} else {
$query = $sql->prepare("UPDATE `modules` SET `get`=?,`file`=?,`sub`=?,`active`=?,`type`=? WHERE `id`=? LIMIT 1");
$query->execute(array($get, $file, $sub, $active, $type, $id));
}
if ($query->rowCount() > 0) {
$dbSuccess = true;
@ -177,43 +191,45 @@ if ($ui->st('action', 'post') and !token(true)) {
$id = $sql->lastInsertId();
}
if ($ui->smallletters('lang', 2, 'post')) {
$array = (array) $ui->smallletters('lang', 2, 'post');
if (!$coreModuleFound) {
if ($ui->smallletters('lang', 2, 'post')) {
$array = (array) $ui->smallletters('lang', 2, 'post');
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('mo',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach($array as $lang) {
$query = $sql->prepare("INSERT INTO `translations` (`type`,`transID`,`lang`,`text`,`resellerID`) VALUES ('mo',?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach($array as $lang) {
if (small_letters_check($lang, 2)) {
$query->execute(array($id, $lang, $ui->description('translation', 'post', $lang), 0));
if (small_letters_check($lang, 2)) {
$query->execute(array($id, $lang, $ui->description('translation', 'post', $lang), 0));
if ($dbSuccess === false and $query->rowCount() > 0) {
$dbSuccess = true;
if ($dbSuccess === false and $query->rowCount() > 0) {
$dbSuccess = true;
}
}
}
}
$query = $sql->prepare("SELECT `lang` FROM `translations` WHERE `type`='mo' AND `transID`=? AND `resellerID`=?");
$query2 = $sql->prepare("DELETE FROM `translations` WHERE `type`='mo' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($id, 0));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$query = $sql->prepare("SELECT `lang` FROM `translations` WHERE `type`='mo' AND `transID`=? AND `resellerID`=?");
$query2 = $sql->prepare("DELETE FROM `translations` WHERE `type`='mo' AND `transID`=? AND `lang`=? AND `resellerID`=? LIMIT 1");
$query->execute(array($id, 0));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (!in_array($row['lang'],$array)) {
if (!in_array($row['lang'],$array)) {
$query2->execute(array($id, $row['lang'], 0));
$query2->execute(array($id, $row['lang'], 0));
if ($dbSuccess === false and $query2->rowCount() > 0) {
$dbSuccess = true;
if ($dbSuccess === false and $query2->rowCount() > 0) {
$dbSuccess = true;
}
}
}
}
} else {
} else {
$query = $sql->prepare("DELETE FROM `translations` WHERE `type`='mo' AND `transID`=? AND `resellerID`=?");
$query->execute(array($id, 0));
$query = $sql->prepare("DELETE FROM `translations` WHERE `type`='mo' AND `transID`=? AND `resellerID`=?");
$query->execute(array($id, 0));
if ($dbSuccess === false and $query->rowCount() > 0) {
$dbSuccess = true;
if ($dbSuccess === false and $query->rowCount() > 0) {
$dbSuccess = true;
}
}
}
@ -237,13 +253,16 @@ if ($ui->st('action', 'post') and !token(true)) {
$query = $sql->prepare("SELECT * FROM `modules` WHERE `id`=? LIMIT 1");
$query->execute(array($id));
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
$active = $row['active'];
$file = $row['file'];
$sub = $row['sub'];
$get = $row['get'];
$type = $row['type'];
$found = true;
}
$languageTexts = array();
foreach ($langAvailable as $lg) {
$languageTexts[$lg] = '';
}
@ -277,11 +296,15 @@ if ($ui->st('action', 'post') and !token(true)) {
$template_file = 'admin_404.tpl';
}
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id',10, 'get')) {
} else if ($ui->st('d', 'get') == 'dl' and $ui->id('id', 10, 'get')) {
$id = $ui->id('id',10, 'get');
if ($id < 1001) {
$query = $sql->prepare("SELECT COUNT(1) AS `amount` FROM `modules` WHERE `type`='C' AND `id`=? LIMIT 1");
$query->execute(array($id));
if ($query->fetchColumn() == 1) {
$template_file = $sprache->error_core;
} else {
@ -315,41 +338,7 @@ if ($ui->st('action', 'post') and !token(true)) {
}
} else {
$query = $sql->prepare("SELECT * FROM `modules`");
$query2 = $sql->prepare("SELECT `text` FROM `translations` WHERE `type`='mo' AND `transID`=? AND `lang`=? LIMIT 1");
$query->execute();
foreach ($query->fetchAll(PDO::FETCH_ASSOC) as $row) {
if (isset($table[$row['id']])) {
$table[$row['id']]['active'] = $row['active'];
} else {
$query2->execute(array($row['id'], $user_language));
$name = $query2->fetchColumn();
if (strlen($name) == 0) {
$query2->execute(array($row['id'], $rSA['language']));
$name = $query2->fetchColumn();
}
if (strlen($name) == 0) {
$name = $row['file'];
}
$type = '';
if ($row['type'] == 'A') {
$type = $sprache->type_admin;
} else if ($row['type'] == 'P') {
$type = $sprache->type_cms;
} else if ($row['type'] == 'U') {
$type = $sprache->type_user;
}
$table[$row['id']] = array('id' => $row['id'], 'active' => $row['active'], 'name' => $name, 'type' => $type);
}
}
configureDateTables('-1', '1, "asc"', 'ajax.php?w=datatable&d=custommodule');
$template_file = 'admin_modules_list.tpl';
}

View File

@ -0,0 +1,103 @@
<?php
/**
* File: datatable_custommodule.php.
* Author: Ulrich Block
* Date: 21.09.14
* Contact: <ulrich.block@easy-wi.com>
*
* This file is part of Easy-WI.
*
* Easy-WI is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Easy-WI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Easy-WI. If not, see <http://www.gnu.org/licenses/>.
*
* Diese Datei ist Teil von Easy-WI.
*
* Easy-WI ist Freie Software: Sie koennen es unter den Bedingungen
* der GNU General Public License, wie von der Free Software Foundation,
* Version 3 der Lizenz oder (nach Ihrer Wahl) jeder spaeteren
* veroeffentlichten Version, weiterverbreiten und/oder modifizieren.
*
* Easy-WI wird in der Hoffnung, dass es nuetzlich sein wird, aber
* OHNE JEDE GEWAEHELEISTUNG, bereitgestellt; sogar ohne die implizite
* Gewaehrleistung der MARKTFAEHIGKEIT oder EIGNUNG FUER EINEN BESTIMMTEN ZWECK.
* Siehe die GNU General Public License fuer weitere Details.
*
* Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
* Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
*/
if (!defined('AJAXINCLUDED')) {
die('Do not access directly!');
}
$sprache = getlanguagefile('modules', $user_language, $resellerLockupID);
$types = array('A' => $sprache->type_admin, 'P' => $sprache->type_cms, 'U' => $sprache->type_user, 'C' => $sprache->type_core);
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `modules`");
$query->execute();
$array['iTotalRecords'] = $query->fetchColumn();
if ($sSearch) {
$translationIDs = array();
$query = $sql->prepare("SELECT `transID` FROM `translations` WHERE `type`='mo' AND `lang`=:lang AND `text` LIKE :search");
$query->execute(array(':lang' => $user_language, ':search' => '%' . $sSearch . '%'));
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$translationIDs[] = $row['transID'];
}
$translationInQuery = (count($translationIDs) > 0) ? ' OR m.`id` IN (' . implode(',', $translationIDs) . ')' : '';
$translationTypeKeys = array();
foreach ($types as $key => $value) {
if (strpos(strtolower($value), strtolower($sSearch)) !== false) {
$translationTypeKeys[] = $key;
}
}
$translationInQuery .= (count($translationTypeKeys) > 0) ? ' OR m.`type` IN (\'' . implode("','", $translationTypeKeys) . '\')' : '';
$query = $sql->prepare("SELECT COUNT(`id`) AS `amount` FROM `modules` AS m WHERE `id` LIKE :search $translationInQuery");
$query->execute(array(':search' => '%' . $sSearch . '%'));
$array['iTotalDisplayRecords'] = $query->fetchColumn();
} else {
$array['iTotalDisplayRecords'] = $array['iTotalRecords'];
}
$orderFields = array(0 => '`name`', 1 => 'm.`id`', 2 => 'm.`active`', 3 => 'm.`type`');
if (isset($orderFields[$iSortCol]) and is_array($orderFields[$iSortCol])) {
$orderBy = implode(' ' . $sSortDir . ', ', $orderFields[$iSortCol]) . ' ' . $sSortDir;
} else if (isset($orderFields[$iSortCol]) and !is_array($orderFields[$iSortCol])) {
$orderBy = $orderFields[$iSortCol] . ' ' . $sSortDir;
} else {
$orderBy = 'm.`id` ASC';
}
if ($sSearch) {
$query = $sql->prepare("SELECT m.*,(SELECT `text` FROM `translations` WHERE `type`='mo' AND `transID`=m.`id` AND `lang`=:lang LIMIT 1) AS `name` FROM `modules` AS m WHERE m.`id` LIKE :search $translationInQuery ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array(':lang' => $user_language, ':search' => '%' . $sSearch . '%'));
} else {
$query = $sql->prepare("SELECT m.*,(SELECT `text` FROM `translations` WHERE `type`='mo' AND `transID`=m.`id` AND `lang`=? LIMIT 1) AS `name` FROM `modules` AS m ORDER BY $orderBy LIMIT {$iDisplayStart},{$iDisplayLength}");
$query->execute(array($user_language));
}
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$array['aaData'][] = array($row['name'], $row['id'], returnButton($template_to_use, 'ajax_admin_show_status.tpl', '', '', ($row['active'] == 'N') ? 2 : 4, ''), (string) $types[$row['type']], returnButton($template_to_use, 'ajax_admin_buttons_dl.tpl', 'mo', 'dl', $row['id'], $gsprache->del) . ' ' . returnButton($template_to_use, 'ajax_admin_buttons_md.tpl', 'mo', 'md', $row['id'], $gsprache->mod));
}

View File

@ -641,7 +641,7 @@ $query = "CREATE TABLE IF NOT EXISTS `modules` (
`active` enum('Y','N') DEFAULT 'Y',
`type` enum('A','C','P','U') DEFAULT 'A',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1001;";
) ENGINE=InnoDB;";
$add = $sql->prepare($query);
$add->execute();

View File

@ -11,7 +11,7 @@
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-info">
<div class="box box-danger">
<form role="form" action="admin.php?w=im&amp;d=dl&amp;id=<?php echo $id;?>&amp;r=im" onsubmit="return confirm('<?php echo $gsprache->sure;?>');" method="post">

View File

@ -15,18 +15,18 @@
<table id="dataTable" class="table table-bordered table-hover">
<thead>
<tr>
<th><?php echo $sprache->haupt_ip;?></a></th>
<th>ID</a></th>
<th><?php echo $sprache->desc;?></a></th>
<th><?php echo $sprache->haupt_ip;?></th>
<th>ID</th>
<th><?php echo $sprache->desc;?></th>
<th><?php echo $gsprache->master;?></th>
<th><?php echo $gsprache->action;?></th>
</tr>
</thead>
<tfoot>
<tr>
<th><?php echo $sprache->haupt_ip;?></a></th>
<th>ID</a></th>
<th><?php echo $sprache->desc;?></a></th>
<th><?php echo $sprache->haupt_ip;?></th>
<th>ID</th>
<th><?php echo $sprache->desc;?></th>
<th><?php echo $gsprache->master;?></th>
<th><?php echo $gsprache->action;?></th>
</tr>

View File

@ -7,77 +7,100 @@
</ol>
</section>
<!-- Main Content -->
<section class="content">
<div class="box box-info">
<div class="box-body">
<?php if (count($errors)>0){ ?>
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4><?php echo $gsprache->errors;?></h4>
<?php echo implode(', ',$errors);?>
</div>
<?php }?>
<form role="form" action="admin.php?w=mo&amp;d=ad&amp;r=mo" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="ad">
<div class="form-group<?php if(isset($errors['active'])) echo ' error';?>">
<label for="inputActive"><?php echo $sprache->active;?></label>
<select class="form-control" id="inputActive" name="active">
<option value="Y"><?php echo $gsprache->yes;?></option>
<option value="N" <?php if ($active=='N') echo 'selected="selected"'; ?>><?php echo $gsprache->no;?></option>
</select>
<?php if (count($errors)>0){ ?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4><?php echo $gsprache->errors;?></h4>
<?php echo implode(', ',$errors);?>
</div>
</div>
</div>
<?php }?>
<div class="row">
<div class="col-md-12">
<div class="box box-success">
<form role="form" action="admin.php?w=mo&amp;d=ad&amp;r=mo" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="ad">
<div class="box-body">
<div class="form-group<?php if(isset($errors['active'])) echo ' error';?>">
<label for="inputActive"><?php echo $sprache->active;?></label>
<select class="form-control" id="inputActive" name="active">
<option value="Y"><?php echo $gsprache->yes;?></option>
<option value="N" <?php if ($active=='N') echo 'selected="selected"'; ?>><?php echo $gsprache->no;?></option>
</select>
</div>
<div class="form-group<?php if(isset($errors['type'])) echo ' error';?>">
<label for="inputType"><?php echo $sprache->type;?></label>
<select class="form-control" id="inputType" name="type">
<option value="A"><?php echo $sprache->type_admin;?></option>
<option value="P" <?php if ($type=='P') echo 'selected="selected"'; ?>><?php echo $sprache->type_cms;?></option>
<option value="U" <?php if ($type=='U') echo 'selected="selected"'; ?>><?php echo $sprache->type_user;?></option>
</select>
</div>
<div class="form-group<?php if(isset($errors['sub'])) echo ' error';?>">
<label for="inputSub"><?php echo $sprache->sub;?></label>
<select class="form-control" id="inputSub" name="sub">
<option value="mo"><?php echo $gsprache->modules;?></option>
<option value="gs" <?php if ($sub=='gs') echo 'selected="selected"'; ?>><?php echo $gsprache->gameserver;?></option>
<option value="vo" <?php if ($sub=='vo') echo 'selected="selected"'; ?>><?php echo $gsprache->voiceserver;?></option>
<option value="ro" <?php if ($sub=='ro') echo 'selected="selected"'; ?>>Rootserver</option>
<option value="my" <?php if ($sub=='my') echo 'selected="selected"'; ?>>MySQL</option>
<option value="fd" <?php if ($sub=='fd') echo 'selected="selected"'; ?>><?php echo $gsprache->fastdownload;?></option>
<option value="gs" <?php if ($sub=='us') echo 'selected="selected"'; ?>><?php echo $gsprache->user;?></option>
<option value="ti" <?php if ($sub=='ti') echo 'selected="selected"'; ?>><?php echo $gsprache->support;?></option>
<option value="pa" <?php if ($sub=='pa') echo 'selected="selected"'; ?>>CMS</option>
</select>
</div>
<div class="form-group<?php if(isset($errors['file'])) echo ' error';?>">
<label for="inputFile"><?php echo $sprache->file;?></label>
<select class="form-control" id="inputFile" name="file">
<?php foreach($files as $row){ ?>
<option <?php if($file==$row) echo 'selected="selected"';?>><?php echo $row;?></option>
<?php } ?>
</select>
</div>
<div class="form-group<?php if(isset($errors['get'])) echo ' error';?>">
<label for="inputGet"><?php echo $sprache->get;?></label>
<input class="form-control" id=inputGet type="text" name="get" value="<?php echo $get;?>">
</div>
<h3><?php echo $sprache->description;?></h3>
<div class="form-group">
<?php foreach ($langAvailable as $lg){ ?>
<label class="checkbox-inline">
<input name="language[]" value="<?php echo $lg;?>" onclick="textdrop('<?php echo $lg;?>');" type="checkbox" checked="checked"> <img src="images/flags/<?php echo $lg;?>.png" alt="Flag: 16_<?php echo $lg;?>'.png"/>
</label>
<?php } ?>
</div>
<?php foreach ($langAvailable as $lg) { ?>
<div id="<?php echo $lg;?>" class="form-group">
<label for="inputLangs-<?php echo $lg;?>"><img src="images/flags/<?php echo $lg;?>.png" alt="Flag: 16_<?php echo $lg;?>'.png"/></label>
<input class="form-control" id="inputLangs-<?php echo $lg;?>" type="text" name="translation[<?php echo $lg;?>]" value="<?php echo $ui->description('translation', 'post', $lg);?>">
</div>
<?php } ?>
</div>
<div class="box-footer">
<button class="btn btn-success" id="inputEdit" type="submit"><i class="fa fa-plus-circle">&nbsp;<?php echo $gsprache->add;?></i></button>
</div>
</form>
</div>
<div class="form-group<?php if(isset($errors['type'])) echo ' error';?>">
<label for="inputType"><?php echo $sprache->type;?></label>
<select class="form-control" id="inputType" name="type">
<option value="A"><?php echo $sprache->type_admin;?></option>
<option value="P" <?php if ($type=='P') echo 'selected="selected"'; ?>><?php echo $sprache->type_cms;?></option>
<option value="U" <?php if ($type=='U') echo 'selected="selected"'; ?>><?php echo $sprache->type_user;?></option>
</select>
</div>
<div class="form-group<?php if(isset($errors['sub'])) echo ' error';?>">
<label for="inputSub"><?php echo $sprache->sub;?></label>
<select class="form-control" id="inputSub" name="sub">
<option value="mo"><?php echo $gsprache->modules;?></option>
<option value="gs" <?php if ($sub=='gs') echo 'selected="selected"'; ?>><?php echo $gsprache->gameserver;?></option>
<option value="vo" <?php if ($sub=='vo') echo 'selected="selected"'; ?>><?php echo $gsprache->voiceserver;?></option>
<option value="ro" <?php if ($sub=='ro') echo 'selected="selected"'; ?>>Rootserver</option>
<option value="my" <?php if ($sub=='my') echo 'selected="selected"'; ?>>MySQL</option>
<option value="fd" <?php if ($sub=='fd') echo 'selected="selected"'; ?>><?php echo $gsprache->fastdownload;?></option>
<option value="gs" <?php if ($sub=='us') echo 'selected="selected"'; ?>><?php echo $gsprache->user;?></option>
<option value="ti" <?php if ($sub=='ti') echo 'selected="selected"'; ?>><?php echo $gsprache->support;?></option>
<option value="pa" <?php if ($sub=='pa') echo 'selected="selected"'; ?>>CMS</option>
</select>
</div>
<div class="form-group<?php if(isset($errors['file'])) echo ' error';?>">
<label for="inputFile"><?php echo $sprache->file;?></label>
<select class="form-control" id="inputFile" name="file">
<?php foreach($files as $row){ ?>
<option <?php if($file==$row) echo 'selected="selected"';?>><?php echo $row;?></option>
<?php } ?>
</select>
</div>
<div class="form-group<?php if(isset($errors['get'])) echo ' error';?>">
<label for="inputGet"><?php echo $sprache->get;?></label>
<input class="form-control" id=inputGet type="text" name="get" value="<?php echo $get;?>">
</div>
<div class="form-group">
<label for="inputDescription"><?php echo $sprache->description;?></label>
<?php foreach ($langAvailable as $lg) echo '<label class="checkbox inline"><input type="checkbox" checked="checked" name="lang[]" value="'.$lg.'" onclick="textdrop('."'".$lg."'".');"><img src="images/flags/'.$lg.'.png" alt="Flag: '.$lg.'.png"/></label>';?>
</div>
<?php foreach ($langAvailable as $lg) { ?>
<div id="<?php echo $lg;?>" class="form-group <?php echo $array['display'];?>">
<label for="inputLangs-<?php echo $lg;?>"><img src="images/flags/<?php echo $lg;?>.png" alt="Flag: 16_<?php echo $lg;?>'.png"/></label>
<input class="form-control" id="inputLangs-<?php echo $lg;?>" type="text" name="translation[<?php echo $lg;?>]" value="<?php echo $ui->description('translation', 'post', $lg);?>">
</div>
<?php } ?>
</div>
</div>
<label for="inputEdit"></label>
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="icon-plus-sign icon-white"></i></button>
</form>
</section>

View File

@ -8,30 +8,28 @@
</ol>
</section>
<!-- Main Content -->
<section class="content">
<div class="col-md-6">
<div class="box box-info">
<div class="box-body">
<dl class="dl-horizontal">
<dt><?php echo $sprache->file;?></dt>
<dd><?php echo $moduleFile;?></dd>
</dl>
<div class="row">
<div class="col-md-12">
<div class="box box-danger">
<form role="form" action="admin.php?w=mo&amp;d=dl&amp;id=<?php echo $id;?>&amp;r=mo" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="dl">
<div class="box-body">
<div class="form-group">
<label for="inputFile"><?php echo $sprache->file;?></label>
<div class="controls"><input type="text" class="form-control" id="inputFile" name="file" value="<?php echo $moduleFile;?>" disabled="disabled"></div>
</div>
</div>
<div class="box-footer">
<button class="btn btn-danger" id="inputEdit" type="submit"><i class="fa fa-trash-o"></i> <?php echo $gsprache->del;?></button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="box box-info">
<div class="box-body">
<form class="form-horizontal" action="admin.php?w=mo&amp;d=dl&amp;id=<?php echo $id;?>&amp;r=mo" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="dl">
</div>
</div>
<label class="control-label" for="inputEdit"></label>
<button class="btn btn-danger" id="inputEdit" type="submit"><i class="fa fa-trash-o"></i> <?php echo $gsprache->del;?></button>
</form>
</div>
</section>

View File

@ -1,39 +1,47 @@
<section class="content-header">
<h1><?php echo $gsprache->logs;?></h1>
<h1><?php echo $gsprache->modules;?></h1>
<ol class="breadcrumb">
<li><a href="admin.php"><i class="fa fa-home"></i> Home</a></li>
<li class="active"><?php echo $gsprache->modules;?></li>
</ol>
</section>
<!-- Main Content -->
<section class="content">
<div class="form-group">
<?php echo $gsprache->modules;?> <a href="admin.php?w=mo&amp;d=ad"><span class="btn btn-primary btn-sm"><i class="fa fa-plus"></i></span></a>
<div class="row">
<div class="col-md-12">
<?php echo $gsprache->modules;?> <a href="admin.php?w=mo&amp;d=ad"><span class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i> <?php echo $gsprache->add;?></span></a>
</div>
</div>
<div class="box box-info">
<div class="box-body table-responsive no-padding">
<table class="table table-bordered table-hover">
<thead>
<tr>
<th><?php echo $sprache->name;?></th>
<th><?php echo $sprache->type;?></th>
<th><?php echo $gsprache->del;?></a></th>
<th><?php echo $gsprache->mod;?></a></th>
</tr>
</thead>
<tbody>
<?php foreach ($table as $table_row) { ?>
<tr class="<?php if($table_row['active']=='Y') echo 'success'; else echo 'error';?>">
<td><?php echo $table_row['name'];?></td>
<td><?php echo $table_row['type'];?></td>
<td><?php if($table_row['id']>1000) { ?><a href="admin.php?w=mo&amp;d=dl&amp;id=<?php echo $table_row['id'];?>" ><span class="btn btn-sm btn-danger"><i class="fa fa-trash-o"></i></span></a><?php } ?></td>
<td><a href="admin.php?w=mo&amp;d=md&amp;id=<?php echo $table_row['id'];?>" ><span class="btn btn-sm btn-primary"><i class="fa fa-edit"></i></span></a></td>
</tr>
<?php } ?>
</tbody>
</table>
<hr>
<div class="row">
<div class="col-md-12">
<div class="box box-info">
<div class="box-body table-responsive">
<table id="dataTable" class="table table-bordered table-hover">
<thead>
<tr>
<th><?php echo $sprache->name;?></th>
<th>ID</th>
<th><?php echo $gsprache->active;?></th>
<th><?php echo $sprache->type;?></th>
<th><?php echo $gsprache->action;?></th>
</tr>
</thead>
<tfoot>
<tr>
<th><?php echo $sprache->name;?></th>
<th>ID</th>
<th><?php echo $gsprache->active;?></th>
<th><?php echo $sprache->type;?></th>
<th><?php echo $gsprache->action;?></th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
</section>

View File

@ -8,82 +8,108 @@
</ol>
</section>
<!-- Main Content -->
<section class="content">
<div class="box box-info">
<div class="box-body">
<?php if (count($errors)>0){ ?>
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4><?php echo $gsprache->errors;?></h4>
<?php echo implode(', ',$errors);?>
</div>
<?php }?>
<form role="form" action="admin.php?w=mo&amp;d=md&amp;id=<?php echo $id;?>&amp;r=mo" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="md">
<div class="form-group<?php if(isset($errors['active'])) echo ' error';?>">
<label for="inputActive"><?php echo $sprache->active;?></label>
<select class="form-control" id="inputActive" name="active">
<option value="Y"><?php echo $gsprache->yes;?></option>
<option value="N" <?php if ($active=='N') echo 'selected="selected"'; ?>><?php echo $gsprache->no;?></option>
</select>
<?php if (count($errors)>0){ ?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-error">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<h4><?php echo $gsprache->errors;?></h4>
<?php echo implode(', ',$errors);?>
</div>
</div>
</div>
<?php }?>
<div class="row">
<div class="col-md-12">
<div class="box box-info">
<form role="form" action="admin.php?w=mo&amp;d=md&amp;id=<?php echo $id;?>&amp;r=mo" onsubmit="return confirm('<?php echo $gsprache->sure; ?>');" method="post">
<input type="hidden" name="token" value="<?php echo token();?>">
<input type="hidden" name="action" value="md">
<div class="box-header">
<h3 class="box-title"><?php echo $name;?></h3>
</div>
<div class="box-body">
<div class="form-group<?php if(isset($errors['active'])) echo ' error';?>">
<label for="inputActive"><?php echo $sprache->active;?></label>
<select class="form-control" id="inputActive" name="active">
<option value="Y"><?php echo $gsprache->yes;?></option>
<option value="N" <?php if ($active=='N') echo 'selected="selected"';?>><?php echo $gsprache->no;?></option>
</select>
</div>
<?php if($type!='C'){ ?>
<div class="form-group<?php if(isset($errors['type'])) echo ' error';?>">
<label for="inputType"><?php echo $sprache->type;?></label>
<select class="form-control" id="inputType" name="type">
<option value="A"><?php echo $sprache->type_admin;?></option>
<option value="P" <?php if ($type=='P') echo 'selected="selected"'; ?>><?php echo $sprache->type_cms;?></option>
<option value="U" <?php if ($type=='U') echo 'selected="selected"'; ?>><?php echo $sprache->type_user;?></option>
</select>
</div>
<div class="form-group<?php if(isset($errors['sub'])) echo ' error';?>">
<label for="inputSub"><?php echo $sprache->sub;?></label>
<select class="form-control" id="inputSub" name="sub">
<option value="mo"><?php echo $gsprache->modules;?></option>
<option value="gs" <?php if ($sub=='gs') echo 'selected="selected"'; ?>><?php echo $gsprache->gameserver;?></option>
<option value="vo" <?php if ($sub=='vo') echo 'selected="selected"'; ?>><?php echo $gsprache->voiceserver;?></option>
<option value="ro" <?php if ($sub=='ro') echo 'selected="selected"'; ?>>Rootserver</option>
<option value="my" <?php if ($sub=='my') echo 'selected="selected"'; ?>>MySQL</option>
<option value="fd" <?php if ($sub=='fd') echo 'selected="selected"'; ?>><?php echo $gsprache->fastdownload;?></option>
<option value="gs" <?php if ($sub=='us') echo 'selected="selected"'; ?>><?php echo $gsprache->user;?></option>
<option value="ti" <?php if ($sub=='ti') echo 'selected="selected"'; ?>><?php echo $gsprache->support;?></option>
<option value="pa" <?php if ($sub=='pa') echo 'selected="selected"'; ?>>CMS</option>
</select>
</div>
<div class="form-group<?php if(isset($errors['file'])) echo ' error';?>">
<label for="inputFile"><?php echo $sprache->file;?></label>
<select class="form-control" id="inputFile" name="file">
<?php foreach($files as $row){ ?>
<option <?php if($file==$row) echo 'selected="selected"';?>><?php echo $row;?></option>
<?php } ?>
</select>
</div>
<div class="form-group<?php if(isset($errors['get'])) echo ' error';?>">
<label for="inputGet"><?php echo $sprache->get;?></label>
<input class="form-control" id=inputGet type="text" name="get" value="<?php echo $get;?>">
</div>
<h3><?php echo $sprache->description;?></h3>
<div class="form-group">
<?php foreach ($langAvailable as $lg){ ?>
<label class="checkbox-inline">
<input name="lang[]" value="<?php echo $lg;?>" onclick="textdrop('<?php echo $lg;?>');" type="checkbox" <?php if(in_array($lg, $langAvailable)) echo 'checked';?>> <img src="images/flags/<?php echo $lg;?>.png" alt="Flag: 16_<?php echo $lg;?>'.png"/>
</label>
<?php } ?>
</div>
<?php foreach ($langAvailable as $lg) { ?>
<div id="<?php echo $lg;?>" class="form-group <?php echo $array['display'];?>">
<label for="inputLangs-<?php echo $lg;?>"><img src="images/flags/<?php echo $lg;?>.png" alt="Flag: 16_<?php echo $lg;?>'.png"/></label>
<input class="form-control" type="text" id="inputLangs-<?php echo $lg;?>" name="translation[<?php echo $lg;?>]" value="<?php echo $languageTexts[$lg];?>">
</div>
<?php } ?>
<?php } ?>
</div>
<div class="box-footer">
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="fa fa-save">&nbsp;<?php echo $gsprache->save;?></i></button>
</div>
</form>
</div>
<?php if($id>1000){ ?>
<div class="form-group<?php if(isset($errors['type'])) echo ' error';?>">
<label for="inputType"><?php echo $sprache->type;?></label>
<select class="form-control" id="inputType" name="type">
<option value="A"><?php echo $sprache->type_admin;?></option>
<option value="P" <?php if ($type=='P') echo 'selected="selected"'; ?>><?php echo $sprache->type_cms;?></option>
<option value="U" <?php if ($type=='U') echo 'selected="selected"'; ?>><?php echo $sprache->type_user;?></option>
</select>
</div>
<div class="form-group<?php if(isset($errors['sub'])) echo ' error';?>">
<label for="inputSub"><?php echo $sprache->sub;?></label>
<select class="form-control" id="inputSub" name="sub">
<option value="mo"><?php echo $gsprache->modules;?></option>
<option value="gs" <?php if ($sub=='gs') echo 'selected="selected"'; ?>><?php echo $gsprache->gameserver;?></option>
<option value="vo" <?php if ($sub=='vo') echo 'selected="selected"'; ?>><?php echo $gsprache->voiceserver;?></option>
<option value="ro" <?php if ($sub=='ro') echo 'selected="selected"'; ?>>Rootserver</option>
<option value="my" <?php if ($sub=='my') echo 'selected="selected"'; ?>>MySQL</option>
<option value="fd" <?php if ($sub=='fd') echo 'selected="selected"'; ?>><?php echo $gsprache->fastdownload;?></option>
<option value="gs" <?php if ($sub=='us') echo 'selected="selected"'; ?>><?php echo $gsprache->user;?></option>
<option value="ti" <?php if ($sub=='ti') echo 'selected="selected"'; ?>><?php echo $gsprache->support;?></option>
<option value="pa" <?php if ($sub=='pa') echo 'selected="selected"'; ?>>CMS</option>
</select>
</div>
<div class="form-group<?php if(isset($errors['file'])) echo ' error';?>">
<label for="inputFile"><?php echo $sprache->file;?></label>
<select class="form-control" id="inputFile" name="file">
<?php foreach($files as $row){ ?>
<option <?php if($file==$row) echo 'selected="selected"';?>><?php echo $row;?></option>
<?php } ?>
</select>
</div>
<div class="form-group<?php if(isset($errors['get'])) echo ' error';?>">
<label for="inputGet"><?php echo $sprache->get;?></label>
<input class="form-control" id=inputGet type="text" name="get" value="<?php echo $get;?>">
</div>
<div class="form-group">
<label for="inputDescription"><?php echo $sprache->description;?></label>
<?php foreach ($langAvailable as $lg) { ?>
<label class="checkbox inline">
<input class="form-control" type="checkbox" name="lang[]" value="<?php echo $lg;?>" onclick="textdrop('<?php echo $lg;?>');" <?php if(isset($lg) and isset($languageTexts[$lg])) echo 'checked="checked"';?>><img src="images/flags/<?php echo $lg;?>.png" alt="Flag: <?php echo $lg;?>.png"/></label>
<?php } ?>
</div>
<?php foreach ($langAvailable as $lg) { ?>
<div id="<?php echo $lg;?>" class="form-group <?php echo $array['display'];?>">
<label for="inputLangs-<?php echo $lg;?>"><img src="images/flags/<?php echo $lg;?>.png" alt="Flag: 16_<?php echo $lg;?>'.png"/></label>
<input class="form-control" type="text" id="inputLangs-<?php echo $lg;?>" name="translation[<?php echo $lg;?>]" value="<?php echo $languageTexts[$lg];?>">
</div>
<?php } ?>
<?php } ?>
</div>
</div>
<label for="inputEdit"></label>
<button class="btn btn-primary" id="inputEdit" type="submit"><i class="fa fa-save">&nbsp;<?php echo $gsprache->save;?></i></button>
</form>
</section>