From 1400e6e24a9ab349f98b08a4e99bf22a89e32adc Mon Sep 17 00:00:00 2001 From: Nexus633 Date: Mon, 20 Jul 2020 23:22:16 +0200 Subject: [PATCH] Fix exemple Module, Add Exemple Module, prepare to update 6.1.7 --- install/update.php | 7 +- install/update_616-617.php | 124 ++++++++++++ languages/default/de/general.xml | 1 + languages/default/dk/general.xml | 1 + languages/default/it/general.xml | 1 + languages/default/pt/general.xml | 1 + languages/default/ru/general.xml | 1 + languages/default/uk/general.xml | 1 + stuff/admin/admin_modules.php | 39 +++- stuff/custom_modules/example.php | 55 ++++++ stuff/methods/functions.php | 9 +- stuff/user/userpanel_tickets.php | 5 +- template/default/custom_modules/example.tpl | 207 ++++++++++++++++++++ 13 files changed, 442 insertions(+), 10 deletions(-) create mode 100644 install/update_616-617.php create mode 100644 stuff/custom_modules/example.php create mode 100644 template/default/custom_modules/example.tpl diff --git a/install/update.php b/install/update.php index df5f6a65..6304b78d 100644 --- a/install/update.php +++ b/install/update.php @@ -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; diff --git a/install/update_616-617.php b/install/update_616-617.php new file mode 100644 index 00000000..ac4b3b24 --- /dev/null +++ b/install/update_616-617.php @@ -0,0 +1,124 @@ + + * + * 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 . + * + * 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 . + */ + +if (isset($include) and $include == true) { + + $query = $sql->prepare("INSERT INTO `easywi_version` (`version`,`de`,`en`) VALUES +('6.1.7','
19.07.2020
+Änderungen:
+
    +
  • General +
      +
    • Beispiel Modul Hinzugefügt
    • +
    • kosmetische Fehler behoben
    • +
    • Ticketsystem überarbeitet
    • +
    • Modul Liste geupdatet -> Example Modules
    • +
    • PhpMailer auf version 6 geupdated
    • +
+Bugfixes: +
    +
  • Sendmail Bug Behoben
  • +
  • Ticketsystem unterkategorie Bug behoben
  • +
  • Masterapps MC update Bug Behoben
  • +
  • DNS bei der Gameserver Anzeige Bug Behoben
  • +
','
19.07.2020
+Changes:
+
    +
  • General +
      +
    • Exemple Module Added
    • +
    • cosmetic errors fixed
    • +
    • Ticketsystem upgraded
    • +
    • Modul List Updated -> Example Modules
    • +
    • Upgrade PhpMailer to version 6
    • +
    • +
  • +Bugfixes: +
      +
    • Sendmail Bug Fixed
    • +
    • Supportsystem Subcategory Bug Fixed
    • +
    • Masterapps Minecraft update Bug Fixed
    • +
    • Dns not showing correctly by Gameserver view Bug Fixed
    • +
    ')"); + $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!
    "; +} diff --git a/languages/default/de/general.xml b/languages/default/de/general.xml index 1a7fe51e..dffd67ff 100644 --- a/languages/default/de/general.xml +++ b/languages/default/de/general.xml @@ -131,4 +131,5 @@ Willkommen: Ja Zurück + Beispiel Modul \ No newline at end of file diff --git a/languages/default/dk/general.xml b/languages/default/dk/general.xml index c7db5a68..27063120 100644 --- a/languages/default/dk/general.xml +++ b/languages/default/dk/general.xml @@ -111,4 +111,5 @@ Velkommen: Ja Baglæns + Exemples Module \ No newline at end of file diff --git a/languages/default/it/general.xml b/languages/default/it/general.xml index de8fb5b1..911a018d 100644 --- a/languages/default/it/general.xml +++ b/languages/default/it/general.xml @@ -135,4 +135,5 @@ Benvenuto: Si Indietro + Exemples Module \ No newline at end of file diff --git a/languages/default/pt/general.xml b/languages/default/pt/general.xml index 9fdcc0c0..ffa7c76f 100644 --- a/languages/default/pt/general.xml +++ b/languages/default/pt/general.xml @@ -135,4 +135,5 @@ Bem vindo: Sim Para trás + Exemples Module diff --git a/languages/default/ru/general.xml b/languages/default/ru/general.xml index a5d9c73c..c38c1782 100644 --- a/languages/default/ru/general.xml +++ b/languages/default/ru/general.xml @@ -133,4 +133,5 @@ Добро пожаловать: Да Обратно + Exemples Module \ No newline at end of file diff --git a/languages/default/uk/general.xml b/languages/default/uk/general.xml index fe988984..4af3ff02 100644 --- a/languages/default/uk/general.xml +++ b/languages/default/uk/general.xml @@ -135,4 +135,5 @@ Welcome: Yes Backwards + Exemples Module \ No newline at end of file diff --git a/stuff/admin/admin_modules.php b/stuff/admin/admin_modules.php index f28c80f3..7b77095f 100644 --- a/stuff/admin/admin_modules.php +++ b/stuff/admin/admin_modules.php @@ -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); diff --git a/stuff/custom_modules/example.php b/stuff/custom_modules/example.php new file mode 100644 index 00000000..ceb4c4f3 --- /dev/null +++ b/stuff/custom_modules/example.php @@ -0,0 +1,55 @@ + 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"; + +?> + diff --git a/stuff/methods/functions.php b/stuff/methods/functions.php index dcbd1199..e9f8b6fc 100644 --- a/stuff/methods/functions.php +++ b/stuff/methods/functions.php @@ -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'); } @@ -935,10 +934,14 @@ if (!function_exists('passwordgenerate')) { return EASYWIDIR . '/template/default/' . $location. '/' . $file; } else if (is_file(EASYWIDIR . '/template/default/'.$file) and preg_match('/^(.*)\.[\w]{1,}$/', $file)) { - return EASYWIDIR . '/template/default/'.$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; } diff --git a/stuff/user/userpanel_tickets.php b/stuff/user/userpanel_tickets.php index 87f0e9c7..d1f7d04e 100644 --- a/stuff/user/userpanel_tickets.php +++ b/stuff/user/userpanel_tickets.php @@ -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)); } } diff --git a/template/default/custom_modules/example.tpl b/template/default/custom_modules/example.tpl new file mode 100644 index 00000000..b35a88f0 --- /dev/null +++ b/template/default/custom_modules/example.tpl @@ -0,0 +1,207 @@ +
    +

    Beispiel Modul / Exemple Module

    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    \ No newline at end of file