Fix Updater, Add easy-wi update email Template

This commit is contained in:
Nexus633 2020-07-21 22:22:50 +02:00
parent a8112b1c90
commit 17350e50aa
12 changed files with 97 additions and 28 deletions

View File

@ -41,37 +41,40 @@
if (isset($include) and $include == true) { if (isset($include) and $include == true) {
$query = $sql->prepare("INSERT INTO `easywi_version` (`version`,`de`,`en`) VALUES $query = $sql->prepare("INSERT INTO `easywi_version` (`version`,`de`,`en`) VALUES
('6.1.7','<div align=\"right\">19.07.2020</div> ('6.1.7','<div align=\"right\">21.07.2020</div>
<b>&Auml;nderungen:</b><br/> <b>&Auml;nderungen:</b><br/>
<ul> <ul>
<li>General <li>General
<ul> <ul>
<li>Update Email-Template Hinzugefügt</li>
<li>Beispiel Modul Hinzugefügt</li> <li>Beispiel Modul Hinzugefügt</li>
<li>kosmetische Fehler behoben</li> <li>kosmetische Fehler behoben</li>
<li>Ticketsystem überarbeitet</li> <li>Ticketsystem überarbeitet</li>
<li>Modul Liste geupdatet -> Example Modules</li> <li>Modul Liste geupdatet -> Example Modules</li>
<li>PhpMailer auf version 6 geupdated</li> <li>PhpMailer auf version 6 geupdated</li>
</ul></li></li></ul> </ul></li></ul>
<b>Bugfixes:</b> <b>Bugfixes:</b>
<ul> <ul>
<li>Updater Bug Behoben</li>
<li>Sendmail Bug Behoben</li> <li>Sendmail Bug Behoben</li>
<li>Ticketsystem unterkategorie Bug behoben</li> <li>Ticketsystem unterkategorie Bug behoben</li>
<li>Masterapps MC update Bug Behoben</li> <li>Masterapps MC update Bug Behoben</li>
<li>DNS bei der Gameserver Anzeige Bug Behoben</li> <li>DNS bei der Gameserver Anzeige Bug Behoben</li>
</ul>','<div align=\"right\">19.07.2020</div> </ul>','<div align=\"right\">21.07.2020</div>
<b>Changes:</b><br/> <b>Changes:</b><br/>
<ul> <ul>
<li>General <li>General
<ul> <ul>
<li>Update Email-Template Added </li>
<li>Exemple Module Added </li> <li>Exemple Module Added </li>
<li>cosmetic errors fixed</li> <li>cosmetic errors fixed</li>
<li>Ticketsystem upgraded</li> <li>Ticketsystem upgraded</li>
<li>Modul List Updated -> Example Modules</li> <li>Modul List Updated -> Example Modules</li>
<li>Upgrade PhpMailer to version 6</li> <li>Upgrade PhpMailer to version 6</li>
<li> </ul></li></ul>
</ul></li></li>
<b>Bugfixes:</b> <b>Bugfixes:</b>
<ul> <ul>
<li>Updater Bug Fixed</li>
<li>Sendmail Bug Fixed</li> <li>Sendmail Bug Fixed</li>
<li>Supportsystem Subcategory Bug Fixed</li> <li>Supportsystem Subcategory Bug Fixed</li>
<li>Masterapps Minecraft update Bug Fixed</li> <li>Masterapps Minecraft update Bug Fixed</li>
@ -100,7 +103,7 @@ if (isset($include) and $include == true) {
]; ];
if($modulesid != 0){ if($modulesid != 0){
$query4 = $sql->prepare("SELECT `id` FROM `translations` WHERE `type`='mo' AND `lang`=? And `transID`=? LIMIT 1"); $query4 = $sql->prepare("SELECT `transID` 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`)"); $query5 = $sql->prepare("INSERT INTO `translations` (`type`, `lang`, `transID`, `resellerID`, `text`) VALUES (?,?,?,?,?) ON DUPLICATE KEY UPDATE `text`=VALUES(`text`)");
foreach ($modullanguage as $lang){ foreach ($modullanguage as $lang){
$query4->execute(array($lang["lang"], $modulesid)); $query4->execute(array($lang["lang"], $modulesid));

View File

@ -118,6 +118,7 @@
<templates>Images/Templates</templates> <templates>Images/Templates</templates>
<traffic>Traffic</traffic> <traffic>Traffic</traffic>
<update>Aktualisieren</update> <update>Aktualisieren</update>
<update_easy>Easy-Wi Update</update_easy>
<upload>Upload</upload> <upload>Upload</upload>
<use>Anwenden</use> <use>Anwenden</use>
<used>Belegt</used> <used>Belegt</used>

View File

@ -98,6 +98,7 @@
<templates>Images/Templates</templates> <templates>Images/Templates</templates>
<traffic>Trafik</traffic> <traffic>Trafik</traffic>
<update>Opdater</update> <update>Opdater</update>
<update_easy>Easy-Wi Opdater</update_easy>
<upload>Upload</upload> <upload>Upload</upload>
<use>Brug</use> <use>Brug</use>
<used></used> <used></used>

View File

@ -122,6 +122,7 @@
<templates>Modelli</templates> <templates>Modelli</templates>
<traffic>Traffico</traffic> <traffic>Traffico</traffic>
<update>Aggiorna</update> <update>Aggiorna</update>
<update_easy>Easy-Wi Aggiorna</update_easy>
<upload>Carica</upload> <upload>Carica</upload>
<use>Utilizza</use> <use>Utilizza</use>
<used>In uso</used> <used>In uso</used>

View File

@ -122,6 +122,7 @@
<templates>Imagems/Modelos</templates> <templates>Imagems/Modelos</templates>
<traffic>Tráfego</traffic> <traffic>Tráfego</traffic>
<update>Update</update> <update>Update</update>
<update_easy>Easy-Wi Update</update_easy>
<upload>Enviar</upload> <upload>Enviar</upload>
<use>Usar</use> <use>Usar</use>
<used>Usado</used> <used>Usado</used>

View File

@ -120,6 +120,7 @@
<templates>Картинки/Шаблоны</templates> <templates>Картинки/Шаблоны</templates>
<traffic>Траффик</traffic> <traffic>Траффик</traffic>
<update>Обновить</update> <update>Обновить</update>
<update_easy>Easy-Wi Обновить</update_easy>
<upload>Загрузить</upload> <upload>Загрузить</upload>
<use>Использовать</use> <use>Использовать</use>
<used>Использовано</used> <used>Использовано</used>

View File

@ -122,6 +122,7 @@
<templates>Images/Templates</templates> <templates>Images/Templates</templates>
<traffic>Traffic</traffic> <traffic>Traffic</traffic>
<update>Update</update> <update>Update</update>
<update_easy>Easy-Wi Update</update_easy>
<upload>Upload</upload> <upload>Upload</upload>
<use>Use</use> <use>Use</use>
<used>Used</used> <used>Used</used>

View File

@ -88,21 +88,20 @@ if (!isset($ip) or $ui->escaped('SERVER_ADDR', 'server') == $ip or in_array($ip,
echo "<br><br>New Easy-Wi{$developerVersion} version available: {$rSA['version']}\r\n"; echo "<br><br>New Easy-Wi{$developerVersion} version available: {$rSA['version']}\r\n";
if (date('G') == 5) {
$updateMail = "A new Easy-Wi{$developerVersion} version is available. The version is {$rSA['version']}.\r\nYou can download it at https://github.com/easy-wi/developer/releases/tag/{$rSA['version']}"; $updateMail = "A new Easy-Wi{$developerVersion} version is available. The version is {$rSA['version']}.\r\nYou can download it at https://github.com/easy-wi/developer/releases/tag/{$rSA['version']}";
$query = $sql->prepare("SELECT `id`,`cname`,`mail` FROM `userdata` WHERE `accounttype`='a' AND `active`='Y'"); $query = $sql->prepare("SELECT `id`,`cname`,`mail` FROM `userdata` WHERE `accounttype`='a' AND `active`='Y'");
$query->execute(); $query->execute();
while ($row = $query->fetch(PDO::FETCH_ASSOC)) { while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
if (sendmail('easy-wi-update', $row['id'], $updateMail, 'Y')) { if (sendmail('emaileasyupdate', $row['id'], $updateMail, 'Y')) {
echo "<br>Update notification send to user {$row['cname']} ({$row['mail']})\r\n"; echo "<br>Update notification send to user {$row['cname']} ({$row['mail']})\r\n";
} else { } else {
echo "<br>Sending update notification to user {$row['cname']} ({$row['mail']}) failed\r\n"; echo "<br>Sending update notification to user {$row['cname']} ({$row['mail']}) failed\r\n";
}
} }
} }
} else { } else {
echo "<br>You are running the latest Easy-Wi{$developerVersion} version: {$installedEasyWiVersion}.\r\n"; echo "<br>You are running the latest Easy-Wi{$developerVersion} version: {$installedEasyWiVersion}.\r\n";
} }

View File

@ -85,6 +85,9 @@ $emailTemplates = array(
), ),
'emailgserverupdate' => array( 'emailgserverupdate' => array(
'query' => "INSERT INTO `settings_email_template` (`id`, `reseller_id`, `language`, `active`, `category`, `email_setting_name`, `subject`, `email_body`, `ccmailing`, `bccmailing`, `attachments`) VALUES (16, ?, 'de', '1', '6', 'emailgserverupdate', 'Game Server wurde upgedatet!', '<div style=\"text-align:center\">\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:#FAFAFA\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">&nbsp;\r\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:1px solid #DDDDDD\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">\r\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tbody>\r\n <tr>\r\n <td valign=\"top\">\r\n <h1 style=\"background-color:#505050;border-bottom:10px solid #12438f;padding:20px;line-height:130%;color:#D2CFCF;margin:0px;font-size:20px\">%topic%</h1>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"border-bottom:1px solid #eee;background-color:#fff;padding:15px;font-size:13px\" valign=\"top\"><strong>%topic%</strong>\r\n <p>%salutation% %fullname%,</p>\r\n\r\n <p>eine veraltete Version wurde an Ihrem Game Master Server entdeckt. Diese wurde nun erfolgreich upgedatet. Alle Ihre Server sollten weiterhin erreichbar sein.</p>\r\n\r\n <p>Ihr<br />\r\n Easy-Wi Team</p>\r\n\r\n <center><small>%noreply%</small></center>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">\r\n <table border=\"0\" cellpadding=\"10\" cellspacing=\"0\">\r\n <tbody>\r\n <tr>\r\n <td valign=\"top\">\r\n <table border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td colspan=\"2\" valign=\"middle\">\r\n <div style=\"color:#999;font-size:11px;text-align:center\">Powered by <a href=\"http://www.easy-wi.com\" target=\"_blank\">Easy-Wi</a></div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n</div>\r\n', '', '', '')" 'query' => "INSERT INTO `settings_email_template` (`id`, `reseller_id`, `language`, `active`, `category`, `email_setting_name`, `subject`, `email_body`, `ccmailing`, `bccmailing`, `attachments`) VALUES (16, ?, 'de', '1', '6', 'emailgserverupdate', 'Game Server wurde upgedatet!', '<div style=\"text-align:center\">\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:#FAFAFA\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">&nbsp;\r\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:1px solid #DDDDDD\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">\r\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tbody>\r\n <tr>\r\n <td valign=\"top\">\r\n <h1 style=\"background-color:#505050;border-bottom:10px solid #12438f;padding:20px;line-height:130%;color:#D2CFCF;margin:0px;font-size:20px\">%topic%</h1>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"border-bottom:1px solid #eee;background-color:#fff;padding:15px;font-size:13px\" valign=\"top\"><strong>%topic%</strong>\r\n <p>%salutation% %fullname%,</p>\r\n\r\n <p>eine veraltete Version wurde an Ihrem Game Master Server entdeckt. Diese wurde nun erfolgreich upgedatet. Alle Ihre Server sollten weiterhin erreichbar sein.</p>\r\n\r\n <p>Ihr<br />\r\n Easy-Wi Team</p>\r\n\r\n <center><small>%noreply%</small></center>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">\r\n <table border=\"0\" cellpadding=\"10\" cellspacing=\"0\">\r\n <tbody>\r\n <tr>\r\n <td valign=\"top\">\r\n <table border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td colspan=\"2\" valign=\"middle\">\r\n <div style=\"color:#999;font-size:11px;text-align:center\">Powered by <a href=\"http://www.easy-wi.com\" target=\"_blank\">Easy-Wi</a></div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n</div>\r\n', '', '', '')"
),
'emaileasyupdate' => array(
'query' => "INSERT INTO `settings_email_template` (`id`, `reseller_id`, `language`, `active`, `category`, `email_setting_name`, `subject`, `email_body`, `ccmailing`, `bccmailing`, `attachments`) VALUES (17, ?, 'de', '1', '4', 'emaileasyupdate', 'Eine neue Easy-Wi version ist verügbar!', '<div style=\"text-align:center\">\r\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:#FAFAFA\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">&nbsp;\r\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border:1px solid #DDDDDD\">\r\n <tbody>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">\r\n <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n <tbody>\r\n <tr>\r\n <td valign=\"top\">\r\n <h1 style=\"background-color:#505050;border-bottom:10px solid #12438f;padding:20px;line-height:130%;color:#D2CFCF;margin:0px;font-size:20px\">%topic%</h1>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style=\"border-bottom:1px solid #eee;background-color:#fff;padding:15px;font-size:13px\" valign=\"top\"><strong>%topic%</strong>\r\n <p>%salutation% %fullname%,</p>\r\n\r\n <p>eine neue Easy-Wi version ist vorhanden.</p>\r\n\r\n <p>Ihr<br />\r\n Easy-Wi Team</p>\r\n\r\n <center><small>%noreply%</small></center>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align=\"center\" valign=\"top\">\r\n <table border=\"0\" cellpadding=\"10\" cellspacing=\"0\">\r\n <tbody>\r\n <tr>\r\n <td valign=\"top\">\r\n <table border=\"0\" cellpadding=\"10\" cellspacing=\"0\" width=\"100%\">\r\n <tbody>\r\n <tr>\r\n <td colspan=\"2\" valign=\"middle\">\r\n <div style=\"color:#999;font-size:11px;text-align:center\">Powered by <a href=\"http://www.easy-wi.com\" target=\"_blank\">Easy-Wi</a></div>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </td>\r\n </tr>\r\n </tbody>\r\n</table>\r\n</div>\r\n', '', '', '')"
) )
); );

View File

@ -661,7 +661,6 @@ if (!function_exists('passwordgenerate')) {
$writerid = $shorten[1]; $writerid = $shorten[1];
$topicid = $shorten[2]; $topicid = $shorten[2];
$shorten = $shorten[0]; $shorten = $shorten[0];
} }
//Load costomer //Load costomer
@ -1254,25 +1253,47 @@ if (!function_exists('passwordgenerate')) {
return $return; return $return;
} }
function licenceRequest($return = false) { function licenceRequest($return = false, $boolreturn = false) {
global $sql, $ui, $rSA; global $sql, $ui, $rSA;
$developer = (isset($rSA['developer'])) ? $rSA['developer'] : 'N'; $developer = (isset($rSA['developer'])) ? $rSA['developer'] : 'N';
$user_agent = isset($ui->server['HTTP_HOST']) ? $ui->server['HTTP_HOST'] : $rSA['paneldomain'];
$host = "https://api.github.com/repos/easy-wi/developer/" . (($developer == 'Y') ? 'tags' : 'releases/latest');
$header = [
"Accept: application/vnd.github.v3+json",
"User-Agent: " . $user_agent
];
$apiResponse = webhostRequest('api.github.com', isset($ui->server['HTTP_HOST']) ? $ui->server['HTTP_HOST'] : $rSA['paneldomain'], '/repos/easy-wi/developer/' . (($developer == 'Y') ? 'tags' : 'releases/latest'), null, 443); $curl = curl_init();
$json = @json_decode($apiResponse); curl_setopt($curl, CURLOPT_URL, $host);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
$respones = curl_exec($curl);
$request_info = curl_getinfo($curl);
curl_close($curl);
if (($developer == 'N' and is_object($json) and property_exists($json, 'tag_name') or ($developer == 'Y' and is_array($json) and isset($json[0]) and is_object($json[0]) and property_exists($json[0], 'name')))) { list($header, $content) = parseHeaders($respones);
if($request_info["http_code"] == 200){
$json = json_decode($content);
$version = ($developer == 'Y') ? $json[0]->name : $json->tag_name; if (($developer == 'N' and is_object($json) and property_exists($json, 'tag_name') or ($developer == 'Y' and is_array($json) and isset($json[0]) and is_object($json[0]) and property_exists($json[0], 'name')))) {
$apiResponse = array('v' => $version);
$query = $sql->prepare("UPDATE `settings` SET `version`=? WHERE `resellerid`=0 LIMIT 1"); $version = ($developer == 'Y') ? $json[0]->name : $json->tag_name;
$query->execute(array($version)); $rSA['version'] = $version;
$apiResponse = array('v' => $version);
$query = $sql->prepare("UPDATE `settings` SET `version`=? WHERE `resellerid`=0 LIMIT 1");
$query->execute(array($version));
}
return ($return == true) ? $json : $boolreturn;
}else{
return false;
} }
return ($return == true) ? $apiResponse : false;
} }
function token ($check = false) { function token ($check = false) {
@ -1660,4 +1681,25 @@ $(function() {
function getLoginHeader($valueOfTitle){ function getLoginHeader($valueOfTitle){
return preg_replace('/(.+)[\s](.+)/i', '<b>${1}</b> $2', $valueOfTitle, -1, $count); return preg_replace('/(.+)[\s](.+)/i', '<b>${1}</b> $2', $valueOfTitle, -1, $count);
} }
function parseHeaders($data)
{
list($header, $content) = explode("\r\n\r\n", $data);
$headers = explode("\r\n", $header);
$head = array();
foreach( $headers as $k=>$v )
{
$t = explode( ':', $v, 2 );
if( isset( $t[1] ) )
$head[ trim($t[0]) ] = trim( $t[1] );
else
{
$head[] = $v;
if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) )
$head['reponse_code'] = intval($out[1]);
}
}
return [$head, $content];
}
} }

View File

@ -122,6 +122,13 @@
</label> </label>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" id="inputTemplate-emaileasyupdate" name="templates[]" value="emaileasyupdate">
<?php echo $gsprache->update_easy;?>
</label>
</div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input id="checkAll" type="checkbox" value="yes" onclick="checkall(this.checked,'templates[]')"> <input id="checkAll" type="checkbox" value="yes" onclick="checkall(this.checked,'templates[]')">

View File

@ -66,6 +66,15 @@
<div class="navbar-custom-menu"> <div class="navbar-custom-menu">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<?php if(isset($toooldversion)){ ?>
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu hidden-xs">
<a href="admin.php?w=vc" class="dropdown-toggle">
<i class="fa fa-cloud"></i>
<span class="label label-warning"><?php echo $rSA['version'];?></span>
</a>
</li>
<?php } ?>
<?php if($statsArray['ticketsTotal']>0){ ?> <?php if($statsArray['ticketsTotal']>0){ ?>
<!-- Messages: style can be found in dropdown.less--> <!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu hidden-xs"> <li class="dropdown messages-menu hidden-xs">