#!/bin/bash

t="/tmp/dlhttrack$$"
mkdir -p "$t"
cd "$t"

for lang in de en fr
do
	#Set the language
	wget "http://god:m23@192.168.1.23/m23admin/index.php?LB_language=$lang&page=clientsoverview&m23_language=$lang&BUT_lang=OK" -O /dev/null

	mkdir $lang
	cd $lang

	# Get the files
	httrack -N1 --update http://god:m23@192.168.1.23/m23admin/index.php +"*.gif" +"*.jpg" +"*.png" +"*.js" \
	+"*shCoreDefault.css*" \
	-"*phpldapadmin*" \
	-"*recoverclient*" \
	-"*phpMyAdmin/*" \
	-"*searchLine*"

	# Clean the directory
	rm *
	rm -r hts-cache/
	mv web/* .
	rmdir web/

	cd ..

	# Upload the dump
	dt_sf_rsyncWrapper -rzaPy --delete-after $lang hhabermann@web.sf.net:/home/groups/m/m2/m23/htdocs/offline-copy/html/

	# Remove the dump
	rm -r $lang
done

cd /
rm -r "$t"
