cleaned url generation (slashes at the end, proper encoding), added apache.conf

git-svn-id: http://yolanda.mister-muffin.de/svn@192 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2007-12-01 18:04:28 +00:00
parent 08766cbc93
commit e1137a95de
5 changed files with 57 additions and 26 deletions

25
trunk/apache.conf Normal file
View file

@ -0,0 +1,25 @@
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/yolanda/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
AllowEncodedSlashes On
RewriteEngine On
RewriteRule ^/video/(.*)/([0-9]*)/(.*)$ /video.pl?title=$1&id=$2&$3
RewriteRule ^/embedded/(.*)/([0-9]*)/(.*)$ /video.pl?title=$1&id=$2&embed=true&$3
RewriteRule ^/download/([0-9]+)/(.*)$ /download.pl?id=$1&$2
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>

View file

@ -127,7 +127,7 @@ sub fill_results
{
'cc:Work' =>
{
'rdf:about' => "$domain/download/$id",
'rdf:about' => "$domain/download/$id/",
'dc:title' => [$title],
'dc:creator' => [$creator],
'dc:subject' => [$subject],
@ -135,7 +135,7 @@ sub fill_results
'dc:publisher' => [$publisher],
'dc:contributor' => [$contributor],
'dc:date' => [$timestamp],
'dc:identifier' => ["$domain/video/$title/$id" . ($duration == 0 ? "/action=edit" : "")],
'dc:identifier' => ["$domain/video/".urlencode($title)."/$id/" . ($duration == 0 ? "/action=edit" : "")],
'dc:source' => [$source],
'dc:language' => [$language],
'dc:coverage' => [$coverage],
@ -155,3 +155,11 @@ sub fill_results
#close db
$dbh->disconnect() or die $dbh->errstr;
}
#replace chars in url as said in this rfc: http://www.rfc-editor.org/rfc/rfc1738.txt
sub urlencode
{
my ($url) = @_[0];
$url =~ s/([^A-Za-z0-9_\$\-.+!*'()])/sprintf("%%%02X", ord($1))/eg;
return $url;
}

View file

@ -59,7 +59,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
$dbquery .= " from videos as v, users as u where u.id = v.userid";
$dbquery .= " and match(v.title, v.description, v.subject) against( ? in boolean mode)";
@args = ($query->url_param('title'));
@args = ($query->url_param('title'), $query->url_param('title'));
$sth = $dbh->prepare($dbquery);
$rowcount = $sth->execute(@args) or die $dbh->errstr;
@ -140,7 +140,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
{
'cc:Work' =>
{
'rdf:about' => "$domain/download/$id",
'rdf:about' => "$domain/download/$id/",
'dc:title' => [$title],
'dc:creator' => [$creator],
'dc:subject' => [$subject],
@ -148,7 +148,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
'dc:publisher' => [$publisher],
'dc:contributor' => [$contributor],
'dc:date' => [$timestamp],
'dc:identifier' => ["$domain/video/$title/$id"],
'dc:identifier' => ["$domain/video/".urlencode($title)."/$id/"],
'dc:source' => [$source],
'dc:language' => [$language],
'dc:coverage' => [$coverage],

View file

@ -62,10 +62,10 @@
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="//@embed='true'">
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, '/cortado=false&amp;embed=true')" />
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'cortado=false&amp;embed=true')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, '/cortado=false')" />
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'cortado=false')" />
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
@ -90,7 +90,7 @@
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="//@embed='true'">
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, '/embed=true')" />
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'embed=true')" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:identifier" />
@ -137,35 +137,33 @@
<xsl:if test="//@edit='true'">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, '/action=edit')" />
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, 'action=edit')" />
</xsl:attribute>
<img src="/images/tango/accessories-text-editor.png" />
</a>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, '/action=edit')" />
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, 'action=edit')" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='edit_video']" />
</a>
</xsl:if>
</div>
<div class="button-bookmark">
<xsl:if test="//@edit='true'">
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, '/action=bookmark')" />
</xsl:attribute>
<img src="/images/tango/bookmark-new.png" />
</a>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, '/action=bookmark')" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='bookmark_video']" />
</a>
</xsl:if>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, 'action=bookmark')" />
</xsl:attribute>
<img src="/images/tango/bookmark-new.png" />
</a>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, 'action=bookmark')" />
</xsl:attribute>
<xsl:value-of select="$locale_strings[@id='bookmark_video']" />
</a>
</div>
<div class="videoccdata">
<a>