From 7229f4292fb98d9f831f57c4ceb30c3716b687f7 Mon Sep 17 00:00:00 2001 From: User Ggo Date: Tue, 7 Jul 2015 11:48:11 +0000 Subject: [PATCH 1/5] GeoLiteCity has a new URL. Updated the script to reflect this change As the new URL no longer contains the date of release, I have been able to remove much of the date calculation code. --- scripts/GeoLiteCity/GeoLite_Import.sh | 46 +++++++++------------------ 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/scripts/GeoLiteCity/GeoLite_Import.sh b/scripts/GeoLiteCity/GeoLite_Import.sh index 2ce1f2e..ce4ad53 100644 --- a/scripts/GeoLiteCity/GeoLite_Import.sh +++ b/scripts/GeoLiteCity/GeoLite_Import.sh @@ -41,46 +41,30 @@ LINUX_OTHER="0" # Login information for your MySQL server DBHOST="localhost" -DBNAME="" -DBUSER="" -DBPASS="" +DBNAME="hlstatsx" +DBUSER="hlxuser" +DBPASS="SQL_PASSWORD_HERE" # # Nothing to change below here. # -# database is updated every first tuesday of any month, so download it with that specific date and import it -TODAY_MONTH=$( date +%m ) -TODAY_YEAR=$( date +%Y ) -if [ $LINUX_OTHER == "1" ] - then CAL_COMMAND="cal -s" - else CAL_COMMAND="cal" -fi -FIRST_TUESDAY_MONTH=$( $CAL_COMMAND $TODAY_MONTH $TODAY_YEAR | - awk ' - NR == 1 { next } - NR == 2 { next } - NF <= 4 { next } - NF == 5 { print $1 ; exit } - NF == 6 { print $2 ; exit } - NF == 7 { print $3 ; exit } - ' ) - -DATE=""$TODAY_YEAR""$TODAY_MONTH"0"$FIRST_TUESDAY_MONTH"" -DIR="GeoLiteCity_$DATE" -FILE="GeoLiteCity_$DATE.zip" -ls *.csv &>/dev/null && rm *.csv +FILE="GeoLiteCity-latest.zip" +rm -f geoLiteCity_Blocks.csv +rm -f geoLiteCity_Location.csv +rm -f geoLiteCity_Location.csv.temp +rm -f $FILE [ -f $FILE ] || wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/$FILE || exit 1 -unzip -o $FILE || exit 1 -mv $DIR/GeoLiteCity-Blocks.csv geoLiteCity_Blocks.csv -mv $DIR/GeoLiteCity-Location.csv geoLiteCity_Location.csv.temp +unzip -jo $FILE || exit 1 +mv GeoLiteCity-Blocks.csv geoLiteCity_Blocks.csv +mv GeoLiteCity-Location.csv geoLiteCity_Location.csv.temp iconv -f ISO-8859-1 -t UTF-8 geoLiteCity_Location.csv.temp > geoLiteCity_Location.csv mysqlimport -C -d --fields-terminated-by=, --fields-enclosed-by=\" --ignore-lines=2 --default-character-set=utf8 -L -i -h $DBHOST -u $DBUSER --password=$DBPASS $DBNAME geoLiteCity_Blocks.csv mysqlimport -C -d --fields-terminated-by=, --fields-enclosed-by=\" --ignore-lines=2 --default-character-set=utf8 -L -i -h $DBHOST -u $DBUSER --password=$DBPASS $DBNAME geoLiteCity_Location.csv # Cleanup -ls *.csv &>/dev/null && rm *.csv -ls *.csv.temp &>/dev/null && rm *.csv.temp -rm $FILE -rmdir $DIR +rm -f geoLiteCity_Blocks.csv +rm -f geoLiteCity_Location.csv +rm -f geoLiteCity_Location.csv.temp +rm -f $FILE From 5b08f615f520ba79863b14577af9cafc9e567e7d Mon Sep 17 00:00:00 2001 From: pricetx Date: Tue, 7 Jul 2015 12:06:12 +0000 Subject: [PATCH 2/5] Cleared user-configured fields as per the original version. --- scripts/GeoLiteCity/GeoLite_Import.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/GeoLiteCity/GeoLite_Import.sh b/scripts/GeoLiteCity/GeoLite_Import.sh index ce4ad53..38099f1 100644 --- a/scripts/GeoLiteCity/GeoLite_Import.sh +++ b/scripts/GeoLiteCity/GeoLite_Import.sh @@ -40,10 +40,10 @@ LINUX_OTHER="0" # Login information for your MySQL server -DBHOST="localhost" -DBNAME="hlstatsx" -DBUSER="hlxuser" -DBPASS="SQL_PASSWORD_HERE" +DBHOST="" +DBNAME="" +DBUSER="" +DBPASS="" # # Nothing to change below here. From 95644a0f2453b30fdef4df0e12e612cce33c328d Mon Sep 17 00:00:00 2001 From: pricetx Date: Tue, 7 Jul 2015 12:08:44 +0000 Subject: [PATCH 3/5] Re-populated DBHOST with default of localhost, as this is true for the majority of installations. --- scripts/GeoLiteCity/GeoLite_Import.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/GeoLiteCity/GeoLite_Import.sh b/scripts/GeoLiteCity/GeoLite_Import.sh index 38099f1..0f4f7ad 100644 --- a/scripts/GeoLiteCity/GeoLite_Import.sh +++ b/scripts/GeoLiteCity/GeoLite_Import.sh @@ -40,7 +40,7 @@ LINUX_OTHER="0" # Login information for your MySQL server -DBHOST="" +DBHOST="localhost" DBNAME="" DBUSER="" DBPASS="" From 652d58fc76860168f216b596eab93059d2aa0627 Mon Sep 17 00:00:00 2001 From: pricetx Date: Tue, 7 Jul 2015 12:29:09 +0000 Subject: [PATCH 4/5] Fixed character conversion issues. --- web/includes/google_maps.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/includes/google_maps.php b/web/includes/google_maps.php index 41475d0..385190c 100644 --- a/web/includes/google_maps.php +++ b/web/includes/google_maps.php @@ -150,7 +150,7 @@ function printMap($type = 'main') $servers_js = array(); foreach ($map_location['servers'] as $server) { - $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`´':;ß²³#+~_\-|<>\/@{}äöüÄÖÜ ]/"); + $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`´':;߲ł#+~_\-|<>\/@{}äöüÄÖÜ ]/"); $replace_pattern = array(""); $server['name'] = preg_replace($search_pattern, $replace_pattern, $server['name']); $temp = "[" . $server['serverId'] . ','; @@ -183,7 +183,7 @@ function printMap($type = 'main') { $players[$row['cli_lat'] . ',' . $row['cli_lng']] = array('cli_lat' => $row['cli_lat'], 'cli_lng' => $row['cli_lng'], 'cli_city' => $row['cli_city'], 'cli_country' => $row['cli_country']); } - $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`´':;ß²³#+~_\-|<>\/@{}äöüÄÖÜ ]/"); + $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`´':;߲ł#+~_\-|<>\/@{}äöüÄÖÜ ]/"); $replace_pattern = array(""); $row['name'] = preg_replace($search_pattern, $replace_pattern, $row['name']); @@ -246,7 +246,7 @@ function printMap($type = 'main') 'country' => $row['country'] ); } - $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`´':;ß²³#+~_\-|<>\/@{}äöüÄÖÜ ]/"); + $search_pattern = array("/[^A-Za-z0-9\[\]*.,=()!\"$%&^`´':;߲ł#+~_\-|<>\/@{}äöüÄÖÜ ]/"); $replace_pattern = array(""); $row['name'] = preg_replace($search_pattern, $replace_pattern, $row['name']); From 4b38adc52a9d9caa7aef354ca3bb03d5b5fa0eaf Mon Sep 17 00:00:00 2001 From: pricetx Date: Tue, 7 Jul 2015 12:33:29 +0000 Subject: [PATCH 5/5] Corrected element not loading using SSL/TLS --- web/includes/google_maps.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/includes/google_maps.php b/web/includes/google_maps.php index 385190c..e19a257 100644 --- a/web/includes/google_maps.php +++ b/web/includes/google_maps.php @@ -42,7 +42,7 @@ function printMap($type = 'main') if ($type == 'main') { - echo (''); + echo (''); } ?>