From: Hans-Emil Skogh Date: Sat, 11 Feb 2012 21:14:28 +0000 (+0100) Subject: Changed latest apps from being rendered by update.py to wp-fdroid.php. X-Git-Tag: 0.1~937 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2f4d1985899d6c9cc7cc9ed5b71110716af6a090;p=fdroidserver.git Changed latest apps from being rendered by update.py to wp-fdroid.php. This also adds icons to the latest app widget listing. --- diff --git a/update.py b/update.py index a77faa2c..539485bd 100755 --- a/update.py +++ b/update.py @@ -494,18 +494,18 @@ for apk in apks: knownapks.recordapk(apk['apkname'], apk['id']) knownapks.writeifchanged() -# Generate latest apps HTML for widget -html = '

' +# Generate latest apps data for widget +data = '' for line in file(os.path.join('stats', 'latestapps.txt')): appid = line.rstrip() - html += '' + data += appid + "\t" for app in apps: if app['id'] == appid: - html += app['Name'] + '
' + data += app['Name'] + "\t" + data += app['icon'] + "\n" break -html += '

' -f = open('repo/latestapps.html', 'w') -f.write(html) +f = open('repo/latestapps.dat', 'w') +f.write(data) f.close() diff --git a/wp-fdroid/wp-fdroid.php b/wp-fdroid/wp-fdroid.php index a4f63b1e..6b7e829d 100644 --- a/wp-fdroid/wp-fdroid.php +++ b/wp-fdroid/wp-fdroid.php @@ -722,7 +722,21 @@ function widget_fdroidlatest($args) { extract($args); echo $before_widget; echo $before_title . 'Latest Apps' . $after_title; - readfile(getenv('DOCUMENT_ROOT').'/repo/latestapps.html'); + + $handle = fopen(getenv('DOCUMENT_ROOT').'/repo/latestapps.dat', 'r'); + if ($handle) { + while (($buffer = fgets($handle, 4096)) !== false) { + $app = explode("\t", $buffer); + echo ''; + if(trim($app[2])) { + echo ''; + } + echo $app[1].'
'; + echo '

'; + } + fclose($handle); + } + echo $after_widget; }