Fix exemple Module, Add Exemple Module, prepare to update 6.1.7

This commit is contained in:
Nexus633 2020-07-20 23:22:16 +02:00
parent 14f90f666b
commit 1400e6e24a
13 changed files with 442 additions and 10 deletions

View File

@ -196,7 +196,11 @@ if (versioncheck($version, '6.0.5', 'update_600-605.php', $response)) {
if (versioncheck($version, '6.1.6', 'update_605-616.php', $response)) {
$version = '6.1.6';
}
/*
if (versioncheck($version, '6.1.7', 'update_616-617.php', $response)) {
$version = '6.1.7';
}
*/
try {
$query = $sql->prepare("SELECT `developer` FROM `settings` WHERE `resellerid`=0 LIMIT 1");
@ -205,6 +209,7 @@ try {
if ($query->fetchColumn() == 'Y') {
$devVersion = '6.1.6';
//$devVersion = '6.1.7';
if (versioncheck($version, $devVersion, 'update_developer.php', $response, true)) {
$version = $devVersion;

124
install/update_616-617.php Normal file
View File

@ -0,0 +1,124 @@
<?php
/**
* File: update_616-620.php.
* Author: Ulrich Block
* Date: 19.07.20
* Time: 18:38
* 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 (isset($include) and $include == true) {
$query = $sql->prepare("INSERT INTO `easywi_version` (`version`,`de`,`en`) VALUES
('6.1.7','<div align=\"right\">19.07.2020</div>
<b>&Auml;nderungen:</b><br/>
<ul>
<li>General
<ul>
<li>Beispiel Modul Hinzugefügt</li>
<li>kosmetische Fehler behoben</li>
<li>Ticketsystem überarbeitet</li>
<li>Modul Liste geupdatet -> Example Modules</li>
<li>PhpMailer auf version 6 geupdated</li>
</ul></li></li></ul>
<b>Bugfixes:</b>
<ul>
<li>Sendmail Bug Behoben</li>
<li>Ticketsystem unterkategorie Bug behoben</li>
<li>Masterapps MC update Bug Behoben</li>
<li>DNS bei der Gameserver Anzeige Bug Behoben</li>
</ul>','<div align=\"right\">19.07.2020</div>
<b>Changes:</b><br/>
<ul>
<li>General
<ul>
<li>Exemple Module Added </li>
<li>cosmetic errors fixed</li>
<li>Ticketsystem upgraded</li>
<li>Modul List Updated -> Example Modules</li>
<li>Upgrade PhpMailer to version 6</li>
<li>
</ul></li></li>
<b>Bugfixes:</b>
<ul>
<li>Sendmail Bug Fixed</li>
<li>Supportsystem Subcategory Bug Fixed</li>
<li>Masterapps Minecraft update Bug Fixed</li>
<li>Dns not showing correctly by Gameserver view Bug Fixed</li>
</ul>')");
$query->execute();
$query2 = $sql->prepare("SELECT `id` FROM `modules` WHERE `type`='A' AND `get`=? LIMIT 1");
$query2->execute(array('ex'));
$modulesid = (int) $query2->fetchColumn();
if($modulesid == 0){
$query3 = $sql->prepare("INSERT INTO `modules` (`get`,`file`,`sub`,`active`, `type`) VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE `active`=VALUES(`active`)");
$query3->execute(array('ex', 'example.php', 'mo', 'Y', 'A'));
$modulesid = $sql->lastInsertId();
}
$modullanguage = [
["type" => "mo", "lang" => "de", "transID" => $modulesid, "resellerID" => 0, "text" => "Beispiel Modul"],
["type" => "mo", "lang" => "dk", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "it", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "pt", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "ru", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "uk", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
];
if($modulesid != 0){
$query4 = $sql->prepare("SELECT `id` FROM `translations` WHERE `type`='mo' AND `lang`=? And `transID`=? LIMIT 1");
$query5 = $sql->prepare("INSERT INTO `translations` (`type`, `lang`, `transID`, `resellerID`, `text`) VALUES (?,?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach ($modullanguage as $lang){
$query4->execute(array($lang["lang"], $modulesid));
$transID = (int)$query4->fetchColumn();
if($transID == 0){
$query5->execute(array($lang["type"], $lang["lang"], $lang["transID"], $lang["resellerID"], $lang["text"]));
}
}
}
$response->add('Action: insert_easywi_version done: ');
$query->closecursor();
$query2->closecursor();
$query3->closecursor();
$query4->closecursor();
$query5->closecursor();
} else {
echo "Error: this file needs to be included by the updater!<br />";
}

View File

@ -131,4 +131,5 @@
<welcome>Willkommen: </welcome>
<yes>Ja</yes>
<zurueck>Zurück</zurueck>
<example>Beispiel Modul</example>
</sprache>

View File

@ -111,4 +111,5 @@
<welcome>Velkommen: </welcome>
<yes>Ja</yes>
<zurueck>Baglæns</zurueck>
<example>Exemples Module</example>
</sprache>

View File

@ -135,4 +135,5 @@
<welcome>Benvenuto: </welcome>
<yes>Si</yes>
<zurueck>Indietro</zurueck>
<example>Exemples Module</example>
</sprache>

View File

@ -135,4 +135,5 @@
<welcome>Bem vindo: </welcome>
<yes>Sim</yes>
<zurueck>Para trás</zurueck>
<example>Exemples Module</example>
</sprache>

View File

@ -133,4 +133,5 @@
<welcome>Добро пожаловать: </welcome>
<yes>Да</yes>
<zurueck>Обратно</zurueck>
<example>Exemples Module</example>
</sprache>

View File

@ -135,4 +135,5 @@
<welcome>Welcome: </welcome>
<yes>Yes</yes>
<zurueck>Backwards</zurueck>
<example>Exemples Module</example>
</sprache>

View File

@ -60,10 +60,9 @@ $coreModules = array(
4 => array('id' => 4, 'active' => 'Y', 'name' => $gsprache->voiceserver, 'sub' => 'vo', 'type' => $sprache->type_core),
5 => array('id' => 5, 'active' => 'Y', 'name' => $gsprache->lendserver, 'sub' => 'le', 'type' => $sprache->type_core),
6 => array('id' => 6, 'active' => 'Y', 'name' => $gsprache->support, 'sub' => 'ti', 'type' => $sprache->type_core),
7 => array('id' => 7, 'active' => 'Y', 'name' => 'Rootserver', 'sub' => 'ro', 'type' => $sprache->type_core),
8 => array('id' => 8, 'active' => 'Y', 'name' => $gsprache->imprint, 'sub' => 'ip', 'type' => $sprache->type_core),
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)
7 => array('id' => 7, 'active' => 'Y', 'name' => $gsprache->imprint, 'sub' => 'ip', 'type' => $sprache->type_core),
8 => array('id' => 8, 'active' => 'N', 'name' => 'CMS', 'sub' => 'pn', 'type' => $sprache->type_core),
9 => array('id' => 9, 'active' => 'Y', 'name' => $gsprache->webspace, 'sub' => 'ws', 'type' => $sprache->type_core),
);
$query = $sql->prepare("SELECT `id` FROM `modules` WHERE `type`='C' AND `get`=? LIMIT 1");
@ -89,6 +88,38 @@ foreach ($coreModules as $module) {
}
}
$query4 = $sql->prepare("SELECT `id` FROM `modules` WHERE `type`='A' AND `get`=? LIMIT 1");
$query4->execute(array('ex'));
$modulesid = (int) $query4->fetchColumn();
if($modulesid == 0){
$query5 = $sql->prepare("INSERT INTO `modules` (`get`,`file`,`sub`,`active`, `type`) VALUES(?,?,?,?,?) ON DUPLICATE KEY UPDATE `active`=VALUES(`active`)");
$query5->execute(array('ex', 'example.php', 'mo', 'Y', 'A'));
$modulesid = $sql->lastInsertId();
}
$modullanguage = [
["type" => "mo", "lang" => "de", "transID" => $modulesid, "resellerID" => 0, "text" => "Beispiel Modul"],
["type" => "mo", "lang" => "dk", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "it", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "pt", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "ru", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
["type" => "mo", "lang" => "uk", "transID" => $modulesid, "resellerID" => 0, "text" => "Example Module"],
];
if($modulesid != 0){
$query6 = $sql->prepare("SELECT `id` FROM `translations` WHERE `type`='mo' AND `lang`=? And `transID`=? LIMIT 1");
$query7 = $sql->prepare("INSERT INTO `translations` (`type`, `lang`, `transID`, `resellerID`, `text`) VALUES (?,?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach ($modullanguage as $lang){
$query6->execute(array($lang["lang"], $modulesid));
$transID = (int)$query6->fetchColumn();
if($transID == 0){
$query7->execute(array($lang["type"], $lang["lang"], $lang["transID"], $lang["resellerID"], $lang["text"]));
}
}
}
if ($ui->st('action', 'post') and !token(true)) {
unset($header, $text);

View File

@ -0,0 +1,55 @@
<?php
//example by tbs, implentation by Nexus633
$start_time = microtime(TRUE);
$free = shell_exec('free');
$free = (string)trim($free);
$free_arr = explode("\n", $free);
$mem = explode(" ", $free_arr[1]);
$mem = array_filter($mem, function($value) {
return ($value !== null && $value !== false && $value !== '');
}
); // removes nulls from array
// puts arrays back to [0],[1],[2] after filter removes nulls
$mem = array_merge($mem);
$memtotal = round($mem[1] / 1000000,2);
$memused = round($mem[2] / 1000000,2);
$memfree = round($mem[3] / 1000000,2);
$memshared = round($mem[4] / 1000000,2);
$memcached = round($mem[5] / 1000000,2);
$memavailable = round($mem[6] / 1000000,2);
$memusage = round(($memtotal/$memavailable)*100-100,2);
$connections = `netstat -ntu | grep :80 | grep ESTABLISHED | grep -v LISTEN | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | grep -v 127.0.0.1 | wc -l`;
$totalconnections = `netstat -ntu | grep :80 | grep -v LISTEN | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn | grep -v 127.0.0.1 | wc -l`;
$load = sys_getloadavg();
$cpuload = $load[0];
$diskfree = round(disk_free_space(".") / 1000000000);
$disktotal = round(disk_total_space(".") / 1000000000);
$diskused = round($disktotal - $diskfree);
$diskusage = round($diskused/$disktotal*100);
if ($memusage > 85 || $cpuload > 4 || $diskusage > 95) {
$trafficlight = 'box-danger';
} elseif ($memusage > 70 || $cpuload > 2 || $diskusage > 85) {
$trafficlight = 'box-warning';
} else {
$trafficlight = 'box-success';
}
$end_time = microtime(TRUE);
$time_taken = $end_time - $start_time;
$total_time = round($time_taken,4);
// Load the TPL file -> template/default/custom_modules/example.tpl
$template_file = "example.tpl";
?>

View File

@ -39,7 +39,7 @@
*/
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
if (!defined('EASYWIDIR')) {
define('EASYWIDIR', '');
@ -653,7 +653,6 @@ if (!function_exists('passwordgenerate')) {
}
if (!class_exists('PHPMailer')) {
include(EASYWIDIR . '/third_party/phpmailer6/Exception.php');
include(EASYWIDIR . '/third_party/phpmailer6/PHPMailer.php');
include(EASYWIDIR . '/third_party/phpmailer6/SMTP.php');
}
@ -937,8 +936,12 @@ if (!function_exists('passwordgenerate')) {
} else if (is_file(EASYWIDIR . '/template/default/'.$file) and preg_match('/^(.*)\.[\w]{1,}$/', $file)) {
return EASYWIDIR . '/template/default/' . $file;
} else if (is_file(EASYWIDIR . '/template/default/custom_modules'.$file) and preg_match('/^(.*)\.[\w]{1,}$/', $file)) {
return EASYWIDIR . '/template/default/custom_modules'.$file;
} else if (preg_match('/^(.*)\.[\w]{1,}$/', $file)) {
return EASYWIDIR . '/template/' . $file;
}
return false;
}

View File

@ -280,11 +280,12 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
} else if ($ui->smallletters('action', 2, 'post') == 'wr') {
$query = $sql->prepare("SELECT `supporter`,`state` FROM `tickets` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query = $sql->prepare("SELECT `supporter`,`state`,`topic` FROM `tickets` WHERE `id`=? AND `resellerid`=? LIMIT 1");
$query->execute(array($id, $reseller_id));
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
$userid = $row['supporter'];
$state = $row['state'];
$topicid = $row['topic'];
}
if (isset($state) and $state != 'C') {
@ -315,7 +316,7 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
$query->execute(array($userid));
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
if ($row['mail_ticket'] == 'Y') {
sendmail('emailnewticket', $userid, $ui->post['ticket'], array($id, $user_id));
sendmail('emailnewticket', $userid, $ui->post['ticket'], array($id, $user_id, $topicid));
}
}

View File

@ -0,0 +1,207 @@
<section class="content-header">
<h1>Beispiel Modul / Exemple Module</h1>
<ol class="breadcrumb">
<li><a href="<?php echo (isset($targetFile)) ? $targetFile : '../admin.php';?>"><i class="fa fa-home"></i> Home</a></li>
<li class="active">Beispiel Modul / Exemple Module</li>
</ol>
</section>
<section class="content" style="margin-top: 25px;">
<div class="row">
<div class="col-md-4">
<div class="box <?php echo $trafficlight; ?>">
<div class="box-body">
<div class="form-group col-md-12" style="text-align: center;">
<label>Server Used</label>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label >RAM Usage:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memusage; ?>%</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>CPU Usage:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $cpuload; ?>%</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>Hard Disk Usage:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $diskusage; ?>%</label>
</div>
</div>
<div class="form-group col-md-12">
<label>&nbsp;</label>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>Established Connections:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $connections; ?></label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>Total Connections:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $totalconnections; ?></label>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box <?php echo $trafficlight; ?>">
<div class="box-body">
<div class="form-group col-md-12" style="text-align: center;">
<label>Memory</label>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>RAM Total:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memtotal; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>RAM Free:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memfree; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>RAM Used:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memused; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>RAM Shared:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memshared; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>RAM Cached:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memcached; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>RAM Available:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $memavailable; ?> GB</label>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="box <?php echo $trafficlight; ?>">
<div class="box-body">
<div class="form-group col-md-12" style="text-align: center;">
<label>Disk</label>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>Hard Disk Free:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $diskfree; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>Hard Disk Used:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $diskused; ?> GB</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-8 col-md-6">
<label>Hard Disk Total:</label>
</div>
<div class="col-xs-4 col-md-6">
<label><?php echo $disktotal; ?> GB</label>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- rows have max 12 cols -->
<div class="row">
<div class="col-md-4">
<div class="box <?php echo $trafficlight; ?>">
<div class="box-body">
<div class="form-group col-md-12" style="text-align: center;">
<label>Server</label>
</div>
<div class="form-group">
<div class="col-xs-5 col-md-6">
<label>Server Name:</label>
</div>
<div class="col-xs-7 col-md-6">
<label><?php echo $ui->server['SERVER_NAME']; ?></label>
</div>
</div>
<div class="form-group">
<div class="col-xs-6 col-md-6">
<label>Server Addr:</label>
</div>
<div class="col-xs-6 col-md-6">
<label><?php echo $ui->server['SERVER_ADDR']; ?></label>
</div>
</div>
<div class="form-group">
<div class="col-xs-6 col-md-6">
<label>PHP Version:</label>
</div>
<div class="col-xs-6 col-md-6">
<label><?php echo phpversion(); ?></label>
</div>
</div>
<div class="form-group">
<div class="col-xs-6 col-md-6">
<label>Load Time:</label>
</div>
<div class="col-xs-6 col-md-6">
<label><?php echo $total_time; ?> sec</label>
</div>
</div>
<div class="form-group">
<div class="col-xs-5 col-md-6">
<label>Local Time:</label>
</div>
<div class="col-xs-7 col-md-6">
<label><?php echo date("Y-m-d H:i:s"); ?></label>
</div>
</div>
</div>
</div>
</div>
</div>
</section>