summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2011-07-06 15:29:31 +0200
committerHugues Hiegel <hugues@hiegel.fr>2011-07-06 15:29:31 +0200
commitbd6ff6cf31048bc794e22a8d84bed08bcf93c188 (patch)
treee48a3ec90ea51ee0187c36eaea0c448fdb8b1a9e
parentd8db7489e628e8bd4a232f185e3599f40626cced (diff)
Rewrites URL to get canonical names, with leading .png for pictures -w/ backward compability-
-rw-r--r--.htaccess6
-rw-r--r--BigLine.php4
-rw-r--r--index.php22
3 files changed, 17 insertions, 15 deletions
diff --git a/.htaccess b/.htaccess
index fd859c7..b764fbf 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,11 +1,13 @@
Options -Indexes
RewriteEngine On
-RewriteCond %{REQUEST_URI} !^/BigLine/
+RewriteBase /
+
+RewriteRule ^(.*)/(.*)/(.*)/(.*).png$ /BigLine/$4/$1/$2/$3 [L]
+
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index/$1 [L]
-
# Permanently removed
Redirect Gone /Badges
Redirect Gone /Badges_v2
diff --git a/BigLine.php b/BigLine.php
index 2f689d5..9f5832d 100644
--- a/BigLine.php
+++ b/BigLine.php
@@ -322,8 +322,8 @@ function touch_badge($username, $type, $style, $color)
$res = mysql_query("SELECT hits FROM badges WHERE username='" . gpc_addslashes(strtolower($username)) . "' AND type='$type' AND style='$style' AND color='$color';");
$data = mysql_fetch_assoc($res);
- if(mysql_num_rows($res))
- $hits = $data["hits"];
+ //if(mysql_num_rows($res))
+ $hits = @$data["hits"];
$hits++;
$QUERY=sprintf("UPDATE badges SET hits=%s, lasthit='%s' WHERE username='%s' AND type='$type' AND style='$style' AND color='$color';",
diff --git a/index.php b/index.php
index f92ee88..3ebacec 100644
--- a/index.php
+++ b/index.php
@@ -161,21 +161,21 @@ function change()
<?
}
-$user = $_POST['user'];
-$type = $_POST['type'];
-$style = $_POST['style'];
-$color = $_POST['color'];
+$user = @$_POST['user'];
+$type = @$_POST['type'];
+$style = @$_POST['style'];
+$color = @$_POST['color'];
$pathinfo = explode("/", $_SERVER['PATH_INFO']);
-if ($user == "") $user = $pathinfo[1];
-if ($type == "") $type = $pathinfo[2]; if ($type == "") $type = "TracksPerDay";
-if ($style == "") $style = $pathinfo[3];
-if ($color == "") $color = $pathinfo[4];
+if ($type == "") $type = @$pathinfo[1]; if ($type == "") $type = "TracksPerDay";
+if ($style == "") $style = @$pathinfo[2];
+if ($color == "") $color = @$pathinfo[3];
+if ($user == "") $user = @$pathinfo[4];
include("Config.BigLine.php");
-$PATH="<span name=\"_user\">".$user."</span>/<span name=\"_type\">".$type."</span>/<span name=\"_style\">$style</span>/<span name=\"_color\">".$color."</span>/";
+$PATH="<span name=\"_type\">".$type."</span>/<span name=\"_style\">$style</span>/<span name=\"_color\">".$color."</span>/<span name=\"_user\">".$user."</span>";
$URL=preg_replace('/<[^>]*>/', '', $PATH);
?>
@@ -216,7 +216,7 @@ foreach ($Colors as $Color => $ColorCode)
<td><input type="submit" value="Go!" /></td></tr>
<tr>
<td colspan=2 class="center">
-<img id="preview" src="/BigLine/<? echo $URL ;?>" alt="<? echo str_replace("_", $user, $Comment); ?>" />
+<img id="preview" src="/<? echo $URL ;?>.png" alt="<? echo str_replace("_", $user, $Comment); ?>" />
</td>
</table>
</form>
@@ -224,7 +224,7 @@ foreach ($Colors as $Color => $ColorCode)
<? if ($type != "UNAVAILABLE") { ?>
<div class="code">
[url=http://lastfm.hiegel.fr/<? echo $PATH; ?>]<br />
- [img]http://lastfm.hiegel.fr/BigLine/<? echo $PATH; ?>[/img]<br />
+ [img]http://lastfm.hiegel.fr/<? echo $PATH; ?>.png[/img]<br />
[/url]
</div>
<? } ?>