From 4acc8da49e3d4083fd9906388dd8fe0212bb9f42 Mon Sep 17 00:00:00 2001 From: arno Date: Sat, 25 Jul 2009 19:22:53 +0200 Subject: [PATCH] small code cleanup (indentation, missing copyrights, etc) --- api.php | 3 +++ inc/i10n/en/syp.php | 3 +++ inc/i10n/updatelang.php | 21 ++++++++++++--------- inc/langutils.php | 4 ++-- items.php | 2 +- js/syp.js | 6 +++--- logout.php | 2 ++ media/admin.css | 4 ---- news.php | 14 +++++++------- 9 files changed, 33 insertions(+), 26 deletions(-) diff --git a/api.php b/api.php index 6ed26c9..50e8bfe 100644 --- a/api.php +++ b/api.php @@ -116,6 +116,9 @@ function img_check_upload ($file) { } function delete_image_if_unused ($imgpath, $con) { + if (!isset ($imgpath) || (strlen ($imgpath) == 0)) { + return; + } if ($con->imgpath_exists ($imgpath)) { return false; } diff --git a/inc/i10n/en/syp.php b/inc/i10n/en/syp.php index 55e66bb..4d965ea 100644 --- a/inc/i10n/en/syp.php +++ b/inc/i10n/en/syp.php @@ -1,4 +1,7 @@ "arno renevier", diff --git a/inc/i10n/updatelang.php b/inc/i10n/updatelang.php index 04b12ec..0d1498f 100755 --- a/inc/i10n/updatelang.php +++ b/inc/i10n/updatelang.php @@ -1,13 +1,16 @@ #!/usr/bin/php 1.0) { @@ -55,7 +55,7 @@ function other_languages ($current_lang) { if ($dotpos !== false) { $script = substr ($script, 0, $dotpos); } - + global $translations; $links = Array (); foreach ($translations as $lang => $obj) { diff --git a/items.php b/items.php index af0192f..2ce7c41 100644 --- a/items.php +++ b/items.php @@ -8,7 +8,7 @@ require_once ("./inc/db/mysql.php"); function main ($features) { - header("Cache-control: no-cache"); + header ("Cache-control: no-cache"); echo ' diff --git a/js/syp.js b/js/syp.js index 032a6ac..8e32d85 100644 --- a/js/syp.js +++ b/js/syp.js @@ -32,10 +32,10 @@ var SYP = { init: function() { this.map = new OpenLayers.Map("map", { controls:[ + new OpenLayers.Control.SypAttribution(), new OpenLayers.Control.Navigation(), new OpenLayers.Control.PanZoom(), - new OpenLayers.Control.Permalink(), - new OpenLayers.Control.SypAttribution() + new OpenLayers.Control.Permalink() ], projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326") @@ -140,7 +140,7 @@ var SYP = { this.map.events.unregister("movestart", this, this._unselect); return; } - popup = feature.popup; + var popup = feature.popup; if (popup.visible()) { popup.hide(); } diff --git a/logout.php b/logout.php index c2cd62c..9285e6a 100644 --- a/logout.php +++ b/logout.php @@ -1,4 +1,6 @@ /**/body #img { /* hide from ie7 */ #login_error { display: none; } - -/* - * add feature - */ diff --git a/news.php b/news.php index 615989f..9bdefd1 100644 --- a/news.php +++ b/news.php @@ -22,8 +22,8 @@ function date3339 ($feature) { return $date; } +// method from http://diveintomark.org/archives/2004/05/28/howto-atom-id#other function unique_id_from_feature ($feature) { - // method from http://diveintomark.org/archives/2004/05/28/howto-atom-id#other $date = date('Y-m-d', $feature->date); $res = sprintf("tag:%s,%s:%d", gethost(), $date, $feature->id); return $res; @@ -36,9 +36,9 @@ function unique_id_from_site () { } function main ($features) { - print " + printf (" \n"; + xmlns:georss=\"http://www.georss.org/georss\">\n"); printf(" \n", full_url_from_path ("")); @@ -60,10 +60,10 @@ function main ($features) { printf(" \n"); } - print "\n"; + printf ("\n"); foreach ($features as $feature) { - print (" \n"); + printf (" \n"); if ($feature->title) { $title = htmlspecialchars ($feature->title, ENT_QUOTES); @@ -88,7 +88,7 @@ function main ($features) { } if (strlen ($contentHTML) != 0) { - printf(" + printf (" %s \n", htmlspecialchars ($contentHTML)); } @@ -98,7 +98,7 @@ function main ($features) { printf(" \n\n"); } - print ''; + printf (""); } try { -- 2.39.2