From 21471dcfa06e0c5afcbb5076d5bebe68cc4fcbbc Mon Sep 17 00:00:00 2001 From: Newcomer1989 Date: Sun, 30 Aug 2015 00:07:57 +0200 Subject: [PATCH] mades changes --- install.php | 9 +-- lang.php | 67 ++++++++++++++--- list_rankup.php | 49 ++++++++---- other/style.css.php | 2 + other/webinterface_list.php | 139 ++++++++++++++++++++--------------- other/webinterface_login.php | 2 +- update_0-12.php | 72 ++++++++++++++++++ webinterface.php | 17 ++++- worker.php | 115 ++++++++++++++++++++++++++--- 9 files changed, 364 insertions(+), 108 deletions(-) create mode 100644 update_0-12.php diff --git a/install.php b/install.php index 3088211..7565794 100644 --- a/install.php +++ b/install.php @@ -50,10 +50,7 @@ if(isset($_POST['confweb'])) echo''.sprintf($lang['isntwidel'],"webinterface.php").''; } } -elseif($db['host']!='hostname') -{ - echo''.sprintf($lang['isntwidel'],"webinterface.php").''; -} + else { if(isset($_POST['installdb'])) @@ -216,8 +213,8 @@ $db[\'dbname\']="'.$dbname.'"; } fclose($handle); } - } elseif (!is_writable('./other/dbconfig.php')) { - echo '',$lang['isntwicfg'],''; + } elseif (!is_writable('./other/dbconfig.php') || substr(sprintf('%o', fileperms('./icons/')), -4)!='0777') { + echo '',$lang['isntwichm'],''; } else { echo '
diff --git a/lang.php b/lang.php index 54cb2e2..62e19bd 100644 --- a/lang.php +++ b/lang.php @@ -5,6 +5,15 @@ if ($language == "de") { $lang['alrup'] = "Das Ranksystem ist bereits up to date. Bitte lösche diese Datei von deinem Webserver!"; $lang['changedbid'] = "User %s (eindeutige Client-ID: %s) hat eine neue TeamSpeak Client-Datenbank-ID (%s). Ersetze die alte Client-Datenbank-ID (%s) und setze die gesammelte Zeiten zurück"; $lang['crawl'] = "Scanne nach verbundenen Usern und sammle die online Zeit..."; + $lang['clean'] = "Scanne nach Usern, welche zu löschen sind..."; + $lang['cleanc'] = "Clientlöschung"; + $lang['cleancdesc'] = "Mit dieser Funktion werden alte Clients aus dem Ranksystem gelöscht.

Hierzu wird die TeamSpeak Datenbank mit dem Ranksystem abgeglichen. Clients, welche nicht mehr in der TeamSpeak Datenbank existieren, werden aus dem Ranksystem gelöscht.

Diese Funktion kann nur genutzt werden, wenn der 'Slowmode' deaktiviert ist!


Zur automatischen Bereinigung der TeamSpeak Datenbank kann der ClientCleaner genutzt werden:
http://ts-n.net/clientcleaner.php"; + $lang['cleandel'] = "Es wurden %s Clients aus der Ranksystem-Datenbank gelöscht, da sie nicht mehr in der TeamSpeak Datenbank vorhanden sind."; + $lang['cleanno'] = "Es gab nicht zu löschen..."; + $lang['cleanp'] = "Löschintervall"; + $lang['cleanpdesc'] = "Bestimme einen Intervall, wie of die 'Clientlöschung' laufen soll.

Angabe der Zeit in Sekunden!

Empfohlen wird die Clientlöschung nur einmal am Tag laufen zu lassen, da für größere Datenbanken die Laufzeit extrem steigt."; + $lang['cleanrs'] = "Clients in der Ranksystem Datenbank: %s"; + $lang['cleants'] = "Clients in der TeamSpeak Datenbank gefunden: %s (von %s)"; $lang['dbconerr'] = "Verbindung zur MySQL-Datenbank gescheitert: "; $lang['delcldgrpif'] = "Fehler beim Löschen der Servergruppen aus der Datenbank: %s"; $lang['delcldgrpsc'] = "Knowledge der Servergruppen für %s User erfolgreich gelöscht."; @@ -18,6 +27,7 @@ if ($language == "de") { $lang['errukwn'] = "Unbekannter Fehler aufgetreten!"; $lang['errupcount'] = "Fehler beim Überschreiben der ges. online Zeit %s bei User mit der eindeutigen Client-ID %s!"; $lang['firstuse'] = "Scheint der erste Lauf zu sein. Starte loggen der Userhistorie..."; + $lang['highest'] = "höchster Rang erreicht"; $lang['instdb'] = "Installiere Datenbank:"; $lang['instdberr'] = "Fehler beim Erstellen der Datenbank: "; $lang['instdbsubm'] = "Datenbank einrichten"; @@ -26,6 +36,7 @@ if ($language == "de") { $lang['insttberr'] = "Fehler beim Erstellen der Tabelle: "; $lang['insttbsuc'] = "Tabelle %s wurde erfolgreich angelegt."; $lang['isntwicfg'] = "Die Datenbankkonfigurationen konnten nicht gespeichert werden! Bitte versehe die 'other/dbconfig.php' mit einem chmod 0777 und versuche es anschließend erneut."; + $lang['isntwichm'] = "Bitte versehe die 'other/dbconfig.php' und den Ordner 'icons/' mit einem chmod 0777 und versuche es anschließend erneut."; $lang['isntwidb'] = "Trage deine Datenbank Einstellungen ein:"; $lang['isntwidberr'] = "Bitte überprüfe, ob alle Felder korrekt ausgefüllt wurden!"; $lang['isntwidbhost'] = "DB Hostadresse:"; @@ -58,6 +69,7 @@ if ($language == "de") { $lang['listsumo'] = "ges. online Zeit"; $lang['listtime'] = "%s Tag(e), %s Std., %s Min., %s Sek."; $lang['listuid'] = "eindeutige Client-ID"; + $lang['new'] = "neu"; $lang['nocount'] = "User %s (eindeutige Client-ID: %s; Client-Datenbank-ID %s) ist ein Query-User oder ist mehrmals online (nur erste Verbindung zählt) -> diese wird nicht gewertet!"; $lang['noentry'] = "Keine Einträge gefunden; versuche erst einmal die worker.php zu starten.."; $lang['pass'] = "Passwort: "; @@ -70,6 +82,7 @@ if ($language == "de") { $lang['sgrprerr'] = "Es ist ein Problem mit den Servergruppen des Users %s (eindeutige Client-ID: %s; Client-Datenbank-ID %s) aufgetreten!"; $lang['sgrprm'] = "Servergruppe %s von User %s (eindeutige Client-ID: %s; Client-Datenbank-ID %s) entfernt."; $lang['sitegen'] = "Seite generiert in %s Sekunden mit %s Clients."; + $lang['sitegenl'] = "Seite generiert in %s Sekunden mit %s Clients (davon %s angezeigt; %s betroffen von Ausnahmeregeln; %s im höchsten Rang)."; $lang['updb'] = "Das Update muss nur ausgeführt werden, wenn das Ranksystem bereits mit einer älteren Version als %s genutzt wird!

Führe das Update nur einmal aus und lösche danach die 'update_%s.php' sofort von deinem Webserver.


Update Datenbank:
"; $lang['updel'] = "Bitte lösche die folgenden Dateien vom Hauptverzeichnis des Ranksystems, sofern sie existieren:
%s"; $lang['upinf'] = "Eine neu Version des Ranksystems ist verfügbar. Informiere Clients auf dem Server..."; @@ -153,6 +166,8 @@ if ($language == "de") { $lang['wishexgrpdesc'] = "Zeige User in der list_rankup.php, welche über die 'Servergruppen-Ausnahmen' nicht am Ranksystem teilnehmen."; $lang['wishgen'] = "Seitengenerierung"; $lang['wishgendesc'] = "Zeige die Zeit, welche zur Generierung der Seite benötigt wird, am Ende der Seite."; + $lang['wishhicld'] = "User in höchestem Rang"; + $lang['wishhiclddesc'] = "Zeige User in der list_rankup.php, welche den höchsten Rang errreicht haben."; $lang['wisupidle'] = "Idlezeit"; $lang['wisupidledesc'] = "Ist diese Funktion aktiv, wird die 'ges. idle Zeit' eines Users von der 'ges. online Zeit' abgezogen. Anstelle der 'ges. online Zeit' wird somit die vorgenannte Differenz für Rangsteigerungen herangezogen."; $lang['wisvconf'] = "speichern"; @@ -191,6 +206,15 @@ if ($language == "de") { $lang['alrup'] = "Вы уже обновили свою базу данных. Пожалуйста, удалите этот файл из своего веб-сервера!"; $lang['changedbid'] = "Пользователь %s (Уникальный ID клиента: %s) получил новый TeamSpeak Client-database-ID (%s). Обновление старой Client-database-ID (%s) и сброс collected times!"; $lang['crawl'] = "Сканирование активности подключенных пользователей..."; + $lang['clean'] = "Scan for clients, which have to delete..."; + $lang['cleanc'] = "clean clients"; + $lang['cleancdesc'] = "With this function the old clients in the Ranksystem gets deleted.

To this end, the Ranksystem sychronized with the TeamSpeak database. Clients, which does not exist in TeamSpeak will be deleted from the Ranksystem.

This function is only enabled when the 'Slowmode' is deactivated!


For automatic adjustment of the TeamSpeak database the ClientCleaner can be used:
http://ts-n.net/clientcleaner.php"; + $lang['cleandel'] = "There were %s clients deleted out of the Ranksystem database, cause they were no longer exist in the TeamSpeak database."; + $lang['cleanno'] = "There were nothing to delete..."; + $lang['cleanp'] = "clean period"; + $lang['cleanpdesc'] = "Set a time that has to elapse before the 'clean clients' runs next.

Set a time in seconds.

Recommended is once a day, cause the client cleaning needs much time for bigger databases."; + $lang['cleanrs'] = "Clients in the Ranksystem database: %s"; + $lang['cleants'] = "Clients found in the TeamSpeak database: %s (at %s)"; $lang['dbconerr'] = "Ошибка подключения к базе данных MySQL: "; $lang['delcldgrpif'] = "Error by removing the knowledge for servergroups: %s"; $lang['delcldgrpsc'] = "Knowledge about servergroups for %s User successfully removed."; @@ -204,6 +228,7 @@ if ($language == "de") { $lang['errukwn'] = "Произошла неизвестная ошибка!"; $lang['errupcount'] = "Ошибка подсчета суммарного времени подключения %s пользователя с UCI %s"; $lang['firstuse'] = "Кажется это первый запуск. Начинаю вести Историю Пользователей..."; + $lang['highest'] = "highest rank reached"; $lang['instdb'] = "Установка Базы данных:"; $lang['instdberr'] = "Ошибка создания базы данных: "; $lang['instdbsubm'] = "Создание Базы данных"; @@ -211,20 +236,21 @@ if ($language == "de") { $lang['insttb'] = "Установка Базы Данных:"; $lang['insttberr'] = "Ошибка при установке таблиц: "; $lang['insttbsuc'] = "Таблица %s успешно создана."; - $lang['isntwicfg'] = "Не получилось записать настройки базы данных! Пожалуйста установите права на запись 'dbconfig.php' chmod 0777 и попробуйте снова."; + $lang['isntwicfg'] = "Не получилось записать настройки базы данных! Пожалуйста установите права на запись 'other/dbconfig.php' chmod 0777 и попробуйте снова."; + $lang['isntwicfg'] = "Пожалуйста установите права на запись 'other/dbconfig.php' and the folder 'icons/' chmod 0777 и попробуйте снова."; $lang['isntwidb'] = "Укажите настройки для подключения к базе данных:"; $lang['isntwidberr'] = "Пожалуйста, проверьте, все ли поля были заполнены а так же корректность заполнения!"; $lang['isntwidbhost'] = "Адрес Базы Данных:"; - $lang['isntwidbhostdesc'] = "Database server address
(IP or DNS)"; + $lang['isntwidbhostdesc'] = "база данных server address
(IP or DNS)"; $lang['isntwidbmsg'] = "Данных Ошибка: "; $lang['isntwidbname'] = "Имя Базы Данных:"; - $lang['isntwidbnamedesc'] = "Name of database"; + $lang['isntwidbnamedesc'] = "Name of база данных"; $lang['isntwidbpass'] = "Пароль Базы Данных:"; - $lang['isntwidbpassdesc'] = "Password to access the database"; - $lang['isntwidbtype'] = "Database type:"; - $lang['isntwidbtypedesc'] = "Database type

You have to install the needed PDO Driver.
For more informations look at requirements on http://ts-n.net/ranksystem.php"; + $lang['isntwidbpassdesc'] = "Password to access the база данных"; + $lang['isntwidbtype'] = "база данных тип:"; + $lang['isntwidbtypedesc'] = "база данных тип

You have to install the needed PDO Driver.
For more informations look at requirements on http://ts-n.net/ranksystem.php"; $lang['isntwidbusr'] = "Пользователь Базы Данных:"; - $lang['isntwidbusrdesc'] = "User to access the database"; + $lang['isntwidbusrdesc'] = "User to access the база данных"; $lang['isntwidel'] = "Пожалуйста удалите файл 'install.php' и файлы 'update_x-xx.php' с вашего Веб-Сервера и откройте %s для настройки Ранг Системы!"; $lang['isntwiusr'] = "Пользователь Веб-Панели успешно создан."; $lang['isntwiusrcr'] = "создание доступа"; @@ -237,13 +263,14 @@ if ($language == "de") { $lang['listnick'] = "Ник"; $lang['listnxsg'] = "Следующая сервер группа"; $lang['listnxup'] = "Следующий Ранг через"; - $lang['listrank'] = "rank"; - $lang['listseen'] = "last seen"; + $lang['listrank'] = "ранг"; + $lang['listseen'] = "последняя активность"; $lang['listsuma'] = "Сумм. время активности"; $lang['listsumi'] = "Сумм. время простоя"; $lang['listsumo'] = "Сумм. время подключения"; $lang['listtime'] = "%s день(й), %s час(ов), %s мин., %s сек."; $lang['listuid'] = "Уникальный ID клиента"; + $lang['new'] = "новый"; $lang['nocount'] = "Пользователь %s (Уникальный Клиент ID: %s; Клиент ID %s) это query-пользователь (постоянно первое подключение) -> не будет учитываться!"; $lang['noentry'] = "Записей не найдено; Для начала запустите worker.php.."; $lang['pass'] = "Пароль: "; @@ -256,11 +283,12 @@ if ($language == "de") { $lang['sgrprerr'] = "Что то пошло не так, проблема с сервер группой пользователя %s (Уникальный ID клиента:: %s; ID в базе данных %s)!"; $lang['sgrprm'] = "С пользователя %s (Уникальный ID клиента: %s; ID в базе данных: %s) удалена сервер-группа %s."; $lang['sitegen'] = "Страница генерирована за %s секунд. %s пользователей."; + $lang['sitegenl'] = "Site generated in %s seconds with %s clients (thereof %s displayed; %s affected by exception rules; %s in highest rank)."; $lang['updb'] = "You have only to run this, if you want to update the Ranksystem from an older version to %s!

Run this once time and delete the update_%s.php file after from your webserver.


Update Database:
"; $lang['updel'] = "Please remove the following files from the root directory of the ranksystem, if they are still existing:
%s"; $lang['upinf'] = "Доступна новая версия Ранг Системы; Сообщаю Клиентам на Сервере..."; $lang['upmov'] = "Please move the \'%s\' into the subfolder \'%s\' and overwrite the existing one!"; - $lang['upmsg'] = "\nЭй, доступна новая версия [B]Ранг Системы[/B]!\n\nтекущая версия: %s\n[B]новая версия: %s[/B]\n\nПожалуйста посетите наш сайт [URL]http://ts-n.net/Ranksystem.php[/URL] для получения более подробной информации."; + $lang['upmsg'] = "\nЭй, доступна новая версия [B]Ранг Системы[/B]!\n\nтекущая версия: %s\n[B]новая версия: %s[/B]\n\nПожалуйста посетите наш сайт [URL]http://ts-n.net/ranksystem.php[/URL] для получения более подробной информации."; $lang['upsucc'] = "Обновление базы данных успешно выполнено."; $lang['upuser'] = "Пользователь %s (Уникальный ID клиента: %s; ID в базе данных: %s) получает новое количество (сумм. время подключения) из %s (thereof active %s)."; $lang['upusrerr'] = "Пользователь с уникальным ID %s не был найден (не правильно указан Уникальный ID или пользователь в настоящий момент не подключен к серверу Teamspeak)!"; @@ -339,6 +367,8 @@ if ($language == "de") { $lang['wishexgrpdesc'] = "Показывать клиентов в list_rankup.php, которые находятся в списке 'исключение клиента' и не должы учитываться Системой Рангов."; $lang['wishgen'] = "Sitegen"; $lang['wishgendesc'] = "Показывать время генерации списка в конце страницы."; + $lang['wishhicld'] = "Clients in highest Level"; + $lang['wishhiclddesc'] = "Show clients in list_rankup.php, which reached the highest level in the Ranksystem."; $lang['wisupidle'] = "Время простоя"; $lang['wisupidledesc'] = "Если эта функция активна, 'сумм. время простоя' будет основанием от 'сумм. время подключения'. Вместо 'сумм. время подключения', предыдущая вычитание будет рассматриваться на повышение Ранга."; $lang['wisvconf'] = "сохранить"; @@ -377,6 +407,15 @@ if ($language == "de") { $lang['alrup'] = "You already updated your database. Please delete this file from your webspace!"; $lang['changedbid'] = "User %s (unique Client-ID: %s) got a new TeamSpeak Client-database-ID (%s). Update the old Client-database-ID (%s) and reset collected times!"; $lang['crawl'] = "Scan for connected user and count the activity..."; + $lang['clean'] = "Scan for clients, which have to delete..."; + $lang['cleanc'] = "clean clients"; + $lang['cleancdesc'] = "With this function the old clients in the Ranksystem gets deleted.

To this end, the Ranksystem sychronized with the TeamSpeak database. Clients, which does not exist in TeamSpeak will be deleted from the Ranksystem.

This function is only enabled when the 'Slowmode' is deactivated!


For automatic adjustment of the TeamSpeak database the ClientCleaner can be used:
http://ts-n.net/clientcleaner.php"; + $lang['cleandel'] = "There were %s clients deleted out of the Ranksystem database, cause they were no longer exist in the TeamSpeak database."; + $lang['cleanno'] = "There were nothing to delete..."; + $lang['cleanp'] = "clean period"; + $lang['cleanpdesc'] = "Set a time that has to elapse before the 'clean clients' runs next.

Set a time in seconds.

Recommended is once a day, cause the client cleaning needs much time for bigger databases."; + $lang['cleanrs'] = "Clients in the Ranksystem database: %s"; + $lang['cleants'] = "Clients found in the TeamSpeak database: %s (at %s)"; $lang['dbconerr'] = "Failed to connect to MySQL-Database: "; $lang['delcldgrpif'] = "Error by removing the knowledge for servergroups: %s"; $lang['delcldgrpsc'] = "Knowledge about servergroups for %s User successfully removed."; @@ -390,6 +429,7 @@ if ($language == "de") { $lang['errukwn'] = "Unkown error happens!"; $lang['errupcount'] = "Error by renewing the summary online time of %s by user with the unique Client-ID %s"; $lang['firstuse'] = "Seems to be the first run. Start logging the Userhistory..."; + $lang['highest'] = "highest rank reached"; $lang['instdb'] = "Install database:"; $lang['instdberr'] = "Error by creating the database: "; $lang['instdbsubm'] = "Create database"; @@ -398,6 +438,7 @@ if ($language == "de") { $lang['insttberr'] = "Error by creating table: "; $lang['insttbsuc'] = "Table %s successfully created."; $lang['isntwicfg'] = "Can't save the database configuration! Please edit the 'other/dbconfig.php' with a chmod 0777 and try again after."; + $lang['isntwicfg'] = "Please edit the 'other/dbconfig.php' and the folder 'icons/' with a chmod 0777 and try again after."; $lang['isntwidb'] = "Enter your database settings:"; $lang['isntwidberr'] = "Please check, if you filled out all fields and the values are correctly!"; $lang['isntwidbhost'] = "DB Hostaddress:"; @@ -430,6 +471,7 @@ if ($language == "de") { $lang['listsumo'] = "sum. online time"; $lang['listtime'] = "%s day(s), %s hour(s), %s min., %s sec."; $lang['listuid'] = "unique Client-ID"; + $lang['new'] = "new"; $lang['nocount'] = "User %s (unique Client-ID: %s; Client-database-ID %s) is a query-user or is several times online (only first connection counts) -> this will not count!"; $lang['noentry'] = "No entries found; try to run the worker.php first.."; $lang['pass'] = "Password: "; @@ -442,11 +484,12 @@ if ($language == "de") { $lang['sgrprerr'] = "It happened a problem with the servergroup of the user %s (unique Client-ID: %s; Client-database-ID %s)!"; $lang['sgrprm'] = "Removed servergroup %s from user %s (unique Client-ID: %s; Client-database-ID %s)."; $lang['sitegen'] = "Site generated in %s seconds with %s clients."; + $lang['sitegenl'] = "Site generated in %s seconds with %s clients (thereof %s displayed; %s affected by exception rules; %s in highest rank)."; $lang['updb'] = "You have only to run this, if you want to update the Ranksystem from an older version to %s!

Run this once time and delete the update_%s.php file after from your webserver.


Update Database:
"; $lang['updel'] = "Please remove the following files from the root directory of the ranksystem, if they are still existing:
%s"; $lang['upinf'] = "A new Version of the Ranksystem is available; Inform Clients on Server..."; $lang['upmov'] = "Please move the \'%s\' into the subfolder \'%s\' and overwrite the existing one!"; - $lang['upmsg'] = "\nHey, a new version of the [B]Ranksystem[/B] is available!\n\ncurrent version: %s\n[B]new version: %s[/B]\n\nPlease check out our site for more informations [URL]http://ts-n.net/Ranksystem.php[/URL]."; + $lang['upmsg'] = "\nHey, a new version of the [B]Ranksystem[/B] is available!\n\ncurrent version: %s\n[B]new version: %s[/B]\n\nPlease check out our site for more informations [URL]http://ts-n.net/ranksystem.php[/URL]."; $lang['upsucc'] = "Database update successfully executed."; $lang['upuser'] = "User %s (unique Client-ID: %s; Client-database-ID %s) gets a new count (sum. online time) of %s (thereof active %s)."; $lang['upusrerr'] = "The unique Client-ID %s couldn't reached on the TeamSpeak!"; @@ -525,6 +568,8 @@ if ($language == "de") { $lang['wishexgrpdesc'] = "Show clients in list_rankup.php, which are in the list 'client exception' and shouldn't be conside for the Ranksystem."; $lang['wishgen'] = "Sitegen"; $lang['wishgendesc'] = "Show the needed time for the generation of the site at the end of the site."; + $lang['wishhicld'] = "Clients in highest Level"; + $lang['wishhiclddesc'] = "Show clients in list_rankup.php, which reached the highest level in the Ranksystem."; $lang['wisupidle'] = "Idletime"; $lang['wisupidledesc'] = "If this function is active, the 'sum. idle time' will be substrate from the 'sum. online time'. Instead of the 'sum. online time', the previoused substration will consided for the rank up."; $lang['wisvconf'] = "save"; diff --git a/list_rankup.php b/list_rankup.php index c4d3568..149e5ed 100644 --- a/list_rankup.php +++ b/list_rankup.php @@ -79,6 +79,11 @@ $dbgroups = $mysqlcon->query("SELECT * FROM $dbname.groups"); $servergroups = $dbgroups->fetchAll(PDO::FETCH_ASSOC); foreach($servergroups as $servergroup) { $sqlhisgroup[$servergroup['sgid']] = $servergroup['sgidname']; + if(file_exists('icons/'.$servergroup['sgid'].'.png')) { + $sqlhisgroup_file[$servergroup['sgid']] = true; + } else { + $sqlhisgroup_file[$servergroup['sgid']] = false; + } } if($adminlogin == 1) { switch ($keyorder) { @@ -125,8 +130,10 @@ ksort($grouptime); $countgrp = count($grouptime); if ($countentries > 0) { $countrank=0; - $except=0; + $exceptgrp=0; + $exceptcld=0; $highest=0; + $countallsum=0; foreach ($uidarr as $uid) { $cldgroup = $sqlhis[$uid]['cldgroup']; $lastseen = $sqlhis[$uid]['lastseen']; @@ -142,19 +149,19 @@ if ($countentries > 0) { $activetime = $count; } $grpcount=0; - $highest++; + $countallsum++; foreach ($grouptime as $time => $groupid) { $grpcount++; if (array_intersect($sgroups, $exceptgroup) && $showexgrp != 1 && $adminlogin != 1) { - $except++; + $exceptgrp++; break; } if (in_array($uid, $exceptuuid) && $showexcld != 1 && $adminlogin != 1) { - $except++; + $exceptcld++; break; } - if ($activetime < $time || ($grpcount == $countgrp && $adminlogin == 1 && $nextup == 0)) { - if($nextup == 0 && $grpcount == $countgrp) { + if ($activetime < $time || $grpcount == $countgrp && $nextup == 0 && $showhighest == 1 || $grpcount == $countgrp && $nextup == 0 && $adminlogin == 1) { + if($nextup == 0 && $grpcount == $countgrp) { $neededtime = 0; } elseif ($status == 1) { $neededtime = $time - $activetime - $livetime; @@ -220,17 +227,22 @@ if ($countentries > 0) { } elseif (array_intersect($sgroups, $exceptgroup)) { echo $lang['listexgrp'] , ''; } else { - echo $lang['errukwn']; + echo $lang['errukwn'], ''; } } - if ($grpcount == $countgrp && $neededtime == 0) { - echo ''; - } elseif ($showcolsg == 1 || $adminlogin == 1) { - echo ''; + if ($grpcount == $countgrp && $nextup == 0 && $showhighest == 1 || $grpcount == $countgrp && $nextup == 0 && $adminlogin == 1) { + echo ''; + $highest++; + } elseif ($sqlhisgroup_file[$groupid]==true) { + echo ''; + } else { + echo ''; } - echo ''; + echo ''; break; - } + } elseif ($grpcount == $countgrp && $nextup == 0) { + $highest++; + } } } } else { @@ -238,10 +250,15 @@ if ($countentries > 0) { } echo '
highest rank reached' , $sqlhisgroup[$groupid] , '',$lang['highest'],'  ' , $sqlhisgroup[$groupid] , '' , $sqlhisgroup[$groupid] , '
'; if ($showgen == 1 || $adminlogin == 1) { - $reached = $highest - $countrank; + $except = $exceptgrp + $exceptcld; + $notvisible = 0; + if ($showexgrp != 1) { $notvisible = $exceptgrp; } + if ($showexcld != 1) { $notvisible = $notvisible + $exceptcld; } + if ($showhighest != 1) { $notvisible = $notvisible + $highest; } + $displayed = $countallsum - $notvisible; $buildtime = microtime(true) - $starttime; - echo '' , sprintf($lang['sitegen'], $buildtime, $sumentries) , ' (',$countrank,' showing; ',$except,' exceptions; ',$reached,' highest rank)'; + echo '' , sprintf($lang['sitegenl'], $buildtime, $sumentries, $displayed, $except, $highest) , ''; } ?> - \ No newline at end of file + diff --git a/other/style.css.php b/other/style.css.php index ba181c7..fb0c7f2 100644 --- a/other/style.css.php +++ b/other/style.css.php @@ -36,8 +36,10 @@ a:hover{text-decoration:none;color:;} .size1{font-size:24px;font-weight:bold;} .size2{font-size:16px;font-weight:bold;} .width{width:95%;box-sizing:border-box;} +.elevated{vertical-align:super;} th{font-weight:bold;text-align:center;color:;} +img{margin-bottom:-3;} select{width:140px;} input.switch:empty {margin-left:-9999px;} diff --git a/other/webinterface_list.php b/other/webinterface_list.php index 1cd3177..d78f0cb 100644 --- a/other/webinterface_list.php +++ b/other/webinterface_list.php @@ -118,6 +118,7 @@ echo '', $lang['wiexgrp'], '', $lang['wie ', $lang['wiexuid'], '', $lang['wiexuiddesc'], ' +   ', $lang['wichdbid'], '', $lang['wichdbiddesc'], ''; if ($configs['resetbydbchange'] == 1) { echo '
@@ -126,21 +127,31 @@ if ($configs['resetbydbchange'] == 1) { echo '
'; } -echo '  - ', $lang['wiupcheck'], '', $lang['wiupcheckdesc'], ''; -if ($configs['upcheck'] == 1) { - echo '
+ echo '', $lang['cleanc'], '', $lang['cleancdesc'], ' new'; +if ($configs['cleanclients'] == 1) { + echo '
'; } else { - echo '
+ echo '
'; } -echo '', $lang['wiupuid'], '', $lang['wiupuiddesc'], ' - - ', $lang['wiuptime'], '', $lang['wiuptimedesc'], ' - +echo '', $lang['cleanp'], '', $lang['cleanpdesc'], ' new +   -   + ', $lang['wiupcheck'], '', $lang['wiupcheckdesc'], ''; +if ($configs['upcheck'] == 1) { + echo '
+
'; +} else { + echo '
+
'; +} +echo '', $lang['wiupuid'], '', $lang['wiupuiddesc'], ' + + ', $lang['wiuptime'], '', $lang['wiuptimedesc'], ' + +   +  
  @@ -177,113 +188,121 @@ if ($configs['showexcld'] == 1) { echo '
'; } +echo '', $lang['wishhicld'], '', $lang['wishhiclddesc'], ' new'; +if ($configs['showhighest'] == 1) { + echo '
+
'; +} else { + echo '
+
'; +} echo '  ', $lang['wishcolrg'], '', $lang['wishcolrgdesc'], ''; if ($configs['showcolrg'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolcld'], '', $lang['wishcolclddesc'], ''; if ($configs['showcolcld'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcoluuid'], '', $lang['wishcoluuiddesc'], ''; if ($configs['showcoluuid'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcoldbid'], '', $lang['wishcoldbiddesc'], ''; if ($configs['showcoldbid'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolls'], '', $lang['wishcollsdesc'], ''; if ($configs['showcolls'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolot'], '', $lang['wishcolotdesc'], ''; if ($configs['showcolot'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolit'], '', $lang['wishcolitdesc'], ''; if ($configs['showcolit'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolat'], '', $lang['wishcolatdesc'], ''; if ($configs['showcolat'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolnx'], '', $lang['wishcolnxdesc'], ''; if ($configs['showcolnx'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '', $lang['wishcolsg'], '', $lang['wishcolsgdesc'], ''; if ($configs['showcolsg'] == 1) { - echo '
-
'; + echo '
+
'; } else { - echo '
-
'; + echo '
+
'; } echo '  ', $lang['wibgco'], '', $lang['wibgcodesc'], ' - + ', $lang['wihdco'], '', $lang['wihdcodesc'], ' - + ', $lang['witxco'], '', $lang['witxcodesc'], ' - + ', $lang['wihvco'], '', $lang['wihvcodesc'], ' - + ', $lang['wiifco'], '', $lang['wiifcodesc'], ' - + ', $lang['wiwnco'], '', $lang['wiwncodesc'], ' - + ', $lang['wiscco'], '', $lang['wisccodesc'], ' - +   ', $lang['wishgen'], '', $lang['wishgendesc'], ''; if ($configs['showgen'] == 1) { - echo '
+ echo '
'; } else { - echo '
+ echo '
'; } echo '  -   +  
diff --git a/other/webinterface_login.php b/other/webinterface_login.php index dd462e0..e8ceab1 100644 --- a/other/webinterface_login.php +++ b/other/webinterface_login.php @@ -1,7 +1,7 @@ '; -if (showerrlogin == 1) { +if (isset($showerrlogin)) { echo ''; } echo ' diff --git a/update_0-12.php b/update_0-12.php new file mode 100644 index 0000000..a437b35 --- /dev/null +++ b/update_0-12.php @@ -0,0 +1,72 @@ + + + + TS-N.NET ranksystem - Update 0.12 + + + + +'.$lang['alrup'].'
'; + if(is_file('install.php') or is_file('update_0-02.php') or is_file('update_0-10.php') or is_file('update_0-11.php')) { + unlink('install.php'); + unlink('update_0-02.php'); + unlink('update_0-10.php'); + unlink('update_0-11.php'); + echo ''.sprintf($lang['updel'],'install.php
update_0-02.php
update_0-10.php
update_0-11.php
update_0-12.php').'
'; + } +} elseif (!is_writable('./other/dbconfig.php') || substr(sprintf('%o', fileperms('./icons/')), -4)!='0777') { + echo '',$lang['isntwichm'],''; +} else { + echo sprintf($lang['updb'],'0.12','0-12'); + echo ''; +} + +if(isset($_POST['updateranksystem'])) { + $errcount = 1; + if($mysqlcon->exec("CREATE TABLE $dbname.cleanclients (timestamp bigint(11) NOT NULL default '0')") === false) { + echo $lang['insttberr'].''.print_r($mysqlcon->errorInfo()).'.'; + $errcount++; + } + if($mysqlcon->exec("ALTER TABLE $dbname.config ADD (cleanclients int(1) NOT NULL default '0',cleanperiod bigint(11) NOT NULL default '0')") === false) { + echo $lang['insttberr'].''.print_r($mysqlcon->errorInfo()).'.'; + $errcount++; + } + if($mysqlcon->exec("UPDATE $dbname.config SET cleanclients='1', cleanperiod='86400'") === false) { + echo $lang['insttberr'].''.print_r($mysqlcon->errorInfo()).'.'; + $errcount++; + } + if ($errcount == 1) { + if($mysqlcon->exec("UPDATE $dbname.config set currvers='0.12-beta'") === false) { + echo $lang['insttberr'].''.print_r($mysqlcon->errorInfo()).'.'; + $errcount++; + } + if ($errcount == 1) { + echo''.$lang['upsucc'].'

'; + if(is_file('install.php') or is_file('update_0-02.php') or is_file('update_0-10.php')) { + unlink('install.php'); + unlink('update_0-02.php'); + unlink('update_0-10.php'); + unlink('update_0-11.php'); + echo ''.sprintf($lang['updel'],'install.php
update_0-02.php
update_0-10.php
update_0-11.php
update_0-12.php').'
'; + } + } + } + if ($errcount > 1) { + echo "Error by Updating the Database for the Ranksystem. Please run the following SQL Statements yourself and be sure all works correctly:

+ CREATE TABLE $dbname.cleanclients (timestamp bigint(11) NOT NULL default '0')
+ ALTER TABLE $dbname.config ADD (cleanclients int(1) NOT NULL default '0',cleanperiod bigint(11) NOT NULL default '0')
+ UPDATE $dbname.config SET cleanclients='1', cleanperiod='86400'
+ UPDATE $dbname.config set currvers='0.12-beta';
+ "; + } +} +?> + + \ No newline at end of file diff --git a/webinterface.php b/webinterface.php index cd37202..5744e0b 100644 --- a/webinterface.php +++ b/webinterface.php @@ -128,6 +128,13 @@ if (isset($_POST['updatecore'])) { } else { $msgtouser = 0; } + $cleanclients = $_POST['cleanclients']; + if ($cleanclients == "on") { + $cleanclients = 1; + } else { + $cleanclients = 0; + } + $cleanperiod = $_POST['cleanperiod']; $upcheck = $_POST['upcheck']; if ($upcheck == "on") { $upcheck = 1; @@ -144,7 +151,7 @@ if (isset($_POST['updatecore'])) { } $exceptuuid = $_POST['exceptuuid']; $exceptgroup = $_POST['exceptgroup']; - if ($mysqlcon->exec("UPDATE config set grouptime='$grouptime',resetbydbchange='$resetbydbchange',msgtouser='$msgtouser',upcheck='$upcheck',uniqueid='$uniqueid',updateinfotime='$updateinfotime',substridle='$substridle',exceptuuid='$exceptuuid',exceptgroup='$exceptgroup'") === false) { + if ($mysqlcon->exec("UPDATE config set grouptime='$grouptime',resetbydbchange='$resetbydbchange',msgtouser='$msgtouser',cleanclients='$cleanclients',cleanperiod='$cleanperiod',upcheck='$upcheck',uniqueid='$uniqueid',updateinfotime='$updateinfotime',substridle='$substridle',exceptuuid='$exceptuuid',exceptgroup='$exceptgroup'") === false) { $alert = '' . $mysqlcon->errorCode() . '
'; } else { $alert = '' . $lang['wisvsuc'] . ''; @@ -165,6 +172,12 @@ if (isset($_POST['updatestyle'])) { $showexcld = 1; } else { $showexcld = 0; + } + $showhighest = $_POST['showhighest']; + if ($showhighest == "on") { + $showhighest = 1; + } else { + $showhighest = 0; } $showcolrg = $_POST['showcolrg']; if ($showcolrg == "on") { @@ -240,7 +253,7 @@ if (isset($_POST['updatestyle'])) { $showgen = 0; } include('lang.php'); - if ($mysqlcon->exec("UPDATE config set language='$language',dateformat='$dateformat',showexgrp='$showexgrp',showexcld='$showexcld',showcolrg='$showcolrg',showcolcld='$showcolcld',showcoluuid='$showcoluuid',showcoldbid='$showcoldbid',showcolls='$showcolls',showcolot='$showcolot',showcolit='$showcolit',showcolat='$showcolat',showcolnx='$showcolnx',showcolsg='$showcolsg',bgcolor='$bgcolor',hdcolor='$hdcolor',txcolor='$txcolor',hvcolor='$hvcolor',ifcolor='$ifcolor',wncolor='$wncolor',sccolor='$sccolor',showgen='$showgen'") === false) { + if ($mysqlcon->exec("UPDATE config set language='$language',dateformat='$dateformat',showexgrp='$showexgrp',showexcld='$showexcld',showhighest='$showhighest',showcolrg='$showcolrg',showcolcld='$showcolcld',showcoluuid='$showcoluuid',showcoldbid='$showcoldbid',showcolls='$showcolls',showcolot='$showcolot',showcolit='$showcolit',showcolat='$showcolat',showcolnx='$showcolnx',showcolsg='$showcolsg',bgcolor='$bgcolor',hdcolor='$hdcolor',txcolor='$txcolor',hvcolor='$hvcolor',ifcolor='$ifcolor',wncolor='$wncolor',sccolor='$sccolor',showgen='$showgen'") === false) { $alert = '' . $mysqlcon->errorCode() . '
'; } else { $alert = '' . $lang['wisvsuc'] . ''; diff --git a/worker.php b/worker.php index d613112..a39d849 100644 --- a/worker.php +++ b/worker.php @@ -1,6 +1,6 @@ - @@ -95,8 +95,8 @@ try { if ($mysqlcon->exec("UPDATE $dbname.lastscan SET timestamp='$nowtime'") === false) { echo '',$mysqlcon->errorCode(),'
'; } - $dbdata = $mysqlcon->query("SELECT * FROM $dbname.user"); - $uuids = $dbdata->fetchAll(); + $dbuserdata = $mysqlcon->query("SELECT * FROM $dbname.user"); + $uuids = $dbuserdata->fetchAll(); foreach($uuids as $uuid) { $sqlhis[$uuid['uuid']] = array( "cldbid" => $uuid['cldbid'], @@ -315,8 +315,8 @@ try { $dbdata = $mysqlcon->query("SELECT * FROM $dbname.user WHERE online<>1 AND lastseen>$upnextuptime"); if ($dbdata->rowCount() != 0) { - $uuids = $dbdata->fetchAll(PDO::FETCH_ASSOC); - foreach($uuids as $uuid) { + $uuidsoff = $dbdata->fetchAll(PDO::FETCH_ASSOC); + foreach($uuidsoff as $uuid) { $idle = $uuid['idle']; $count = $uuid['count']; $grpid = $uuid['grpid']; @@ -333,7 +333,7 @@ try { } foreach ($grouptime as $time => $groupid) { if ($activetime > $time) { - break; + $nextup = 0; } else { $nextup = $time - $activetime; } @@ -345,7 +345,7 @@ try { } } - if ($updatenextup != 0) { + if (isset($updatenextup)) { $allupdateuuid = ''; $allupdatenextup = ''; foreach ($updatenextup as $updatedata) { @@ -377,6 +377,10 @@ try { $gefunden = 2; $iconid = $servergroup['iconid']; $iconid = ($iconid < 0) ? (pow(2, 32)) - ($iconid * -1) : $iconid; + $iconfile = 0; + if($iconid > 300) { + $iconfile = $servergroup->iconDownload(); + } $sgname = str_replace('\\', '\\\\', htmlspecialchars($servergroup['name'], ENT_QUOTES)); if ($sqlhisgroup != "empty") { foreach ($sqlhisgroup as $sgid => $sname) { @@ -385,7 +389,8 @@ try { $updategroups[] = array( "sgid" => $servergroup['sgid'], "sgidname" => $sgname, - "iconid" => $iconid + "iconid" => $iconid, + "icon" => $iconfile ); break; } @@ -394,25 +399,32 @@ try { $insertgroups[] = array( "sgid" => $servergroup['sgid'], "sgidname" => $sgname, - "iconid" => $iconid + "iconid" => $iconid, + "icon" => $iconfile ); } } else { $insertgroups[] = array( "sgid" => $servergroup['sgid'], "sgidname" => $sgname, - "iconid" => $iconid + "iconid" => $iconid, + "icon" => $iconfile ); } } if ($debug == 'on') { - echo '
insertgroups:
', $insertgroups, '

'; + echo '
insertgroups:
', print_r($insertgroups), '

'; } if (isset($insertgroups)) { $allinsertdata = ''; + $path_part = pathinfo($_SERVER['PATH_TRANSLATED']); + $icon_path = $path_part['dirname']; foreach ($insertgroups as $insertarr) { $allinsertdata = $allinsertdata . "('" . $insertarr['sgid'] . "', '" . $insertarr['sgidname'] . "', '" . $insertarr['iconid'] . "'),"; + if($insertarr['iconid']!=0 && $updatedata['iconid']>300) { + file_put_contents($icon_path . "/icons/" . $insertarr['sgid'] . ".png", $insertarr['icon']); + } } $allinsertdata = substr($allinsertdata, 0, -1); if ($allinsertdata != '') { @@ -425,16 +437,26 @@ try { if ($debug == 'on') { echo '
allinsertdata:
', $allinsertdata, '
'; } + unset($insertgroups); unset($allinsertdata); + + if ($debug == 'on') { + echo '
updategroups:
', print_r($updategroups), '

'; + } + if (isset($updategroups)) { $allsgids = ''; $allupdatesgid = ''; $allupdateiconid = ''; + $path_part = pathinfo($_SERVER['PATH_TRANSLATED']); foreach ($updategroups as $updatedata) { $allsgids = $allsgids . "'" . $updatedata['sgid'] . "',"; $allupdatesgid = $allupdatesgid . "WHEN '" . $updatedata['sgid'] . "' THEN '" . $updatedata['sgidname'] . "' "; $allupdateiconid = $allupdateiconid . "WHEN '" . $updatedata['sgid'] . "' THEN '" . $updatedata['iconid'] . "' "; + if($updatedata['iconid']!=0 && $updatedata['iconid']>300) { + file_put_contents("./icons/" . $updatedata['sgid'] . ".png", $updatedata['icon']); + } } $allsgids = substr($allsgids, 0, -1); if ($mysqlcon->exec("UPDATE $dbname.groups set sgidname = CASE sgid $allupdatesgid END, iconid = CASE sgid $allupdateiconid END WHERE sgid IN ($allsgids)") === false) { @@ -442,8 +464,77 @@ try { } } + if ($debug == 'on') { + echo '
updategroups:
', print_r($updategroups), '

'; + } + unset($allsgids); unset($allupdatesgid); + + if ($cleanclients == 1 && $slowmode != 1) { + $cleantime = $nowtime - $cleanperiod; + $lastclean = $mysqlcon->query("SELECT * FROM $dbname.cleanclients"); + $lastclean = $lastclean->fetchAll(); + $countrs = $dbuserdata->rowCount(); + if ($lastclean[0]['timestamp'] < $cleantime) { + echo '

', $lang['clean'], '
'; + $start=0; + $break=200; + $clientdblist=array(); + $countdel=0; + $countts=0; + while($getclientdblist=$ts3_VirtualServer->clientListDb($start, $break)) { + $clientdblist=array_merge($clientdblist, $getclientdblist); + $start=$start+$break; + if ($start == 50000 || array_shift(array_values($getclientdblist))['count'] <= $start) { + break; + } + } + foreach($clientdblist as $uuidts) { + $uidarrts[] = $uuidts['client_unique_identifier']; + } + foreach($uidarr as $uuid) { + if ($countdel + $countts == 25000) { + break; + } + if (in_array($uuid, $uidarrts)) { + $countts++; + } else { + $deleteuuids[] = $uuid; + $countdel++; + } + } + echo sprintf($lang['cleants'], $countts, array_shift(array_values($getclientdblist))['count']),'
'; + echo sprintf($lang['cleanrs'], $countrs),'
'; + if ($debug == 'on') { + echo '
deleteclients:
', print_r($deleteuuids), '

'; + } + if (isset($deleteuuids)) { + $alldeldata = ''; + foreach ($deleteuuids as $dellarr) { + $alldeldata = $alldeldata . "'" . $dellarr . "',"; + } + $alldeldata = substr($alldeldata, 0, -1); + $alldeldata = "(".$alldeldata.")"; + if ($alldeldata != '') { + if ($mysqlcon->exec("DELETE FROM $dbname.user WHERE uuid IN $alldeldata") === false) { + echo '',$mysqlcon->errorCode(),'
'; + } else { + echo '',sprintf($lang['cleandel'], $countdel),'
'; + if ($mysqlcon->exec("UPDATE $dbname.cleanclients SET timestamp='$nowtime'") === false) { + echo '',$mysqlcon->errorCode(),'
'; + } + } + + } + } else { + echo '',$lang['cleanno'],'
'; + if ($mysqlcon->exec("UPDATE $dbname.cleanclients SET timestamp='$nowtime'") === false) { + echo '',$mysqlcon->errorCode(),'
'; + } + } + } + } } catch (Exception $e) { echo $lang['error'] . $e->getCode() . ': ' . $e->getMessage();
' , $lang['errlogin'] , '

' , $lang['user'] , '