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:
parent
08766cbc93
commit
e1137a95de
5 changed files with 57 additions and 26 deletions
25
trunk/apache.conf
Normal file
25
trunk/apache.conf
Normal 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>
|
|
@ -127,7 +127,7 @@ sub fill_results
|
||||||
{
|
{
|
||||||
'cc:Work' =>
|
'cc:Work' =>
|
||||||
{
|
{
|
||||||
'rdf:about' => "$domain/download/$id",
|
'rdf:about' => "$domain/download/$id/",
|
||||||
'dc:title' => [$title],
|
'dc:title' => [$title],
|
||||||
'dc:creator' => [$creator],
|
'dc:creator' => [$creator],
|
||||||
'dc:subject' => [$subject],
|
'dc:subject' => [$subject],
|
||||||
|
@ -135,7 +135,7 @@ sub fill_results
|
||||||
'dc:publisher' => [$publisher],
|
'dc:publisher' => [$publisher],
|
||||||
'dc:contributor' => [$contributor],
|
'dc:contributor' => [$contributor],
|
||||||
'dc:date' => [$timestamp],
|
'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:source' => [$source],
|
||||||
'dc:language' => [$language],
|
'dc:language' => [$language],
|
||||||
'dc:coverage' => [$coverage],
|
'dc:coverage' => [$coverage],
|
||||||
|
@ -155,3 +155,11 @@ sub fill_results
|
||||||
#close db
|
#close db
|
||||||
$dbh->disconnect() or die $dbh->errstr;
|
$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;
|
||||||
|
}
|
||||||
|
|
|
@ -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 .= " 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)";
|
$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);
|
$sth = $dbh->prepare($dbquery);
|
||||||
$rowcount = $sth->execute(@args) or die $dbh->errstr;
|
$rowcount = $sth->execute(@args) or die $dbh->errstr;
|
||||||
|
@ -140,7 +140,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
{
|
{
|
||||||
'cc:Work' =>
|
'cc:Work' =>
|
||||||
{
|
{
|
||||||
'rdf:about' => "$domain/download/$id",
|
'rdf:about' => "$domain/download/$id/",
|
||||||
'dc:title' => [$title],
|
'dc:title' => [$title],
|
||||||
'dc:creator' => [$creator],
|
'dc:creator' => [$creator],
|
||||||
'dc:subject' => [$subject],
|
'dc:subject' => [$subject],
|
||||||
|
@ -148,7 +148,7 @@ elsif($query->url_param('title') or $query->url_param('id'))
|
||||||
'dc:publisher' => [$publisher],
|
'dc:publisher' => [$publisher],
|
||||||
'dc:contributor' => [$contributor],
|
'dc:contributor' => [$contributor],
|
||||||
'dc:date' => [$timestamp],
|
'dc:date' => [$timestamp],
|
||||||
'dc:identifier' => ["$domain/video/$title/$id"],
|
'dc:identifier' => ["$domain/video/".urlencode($title)."/$id/"],
|
||||||
'dc:source' => [$source],
|
'dc:source' => [$source],
|
||||||
'dc:language' => [$language],
|
'dc:language' => [$language],
|
||||||
'dc:coverage' => [$coverage],
|
'dc:coverage' => [$coverage],
|
||||||
|
|
|
@ -62,10 +62,10 @@
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//@embed='true'">
|
<xsl:when test="//@embed='true'">
|
||||||
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, '/cortado=false&embed=true')" />
|
<xsl:value-of select="concat(//video/rdf:RDF/cc:Work/dc:identifier, 'cortado=false&embed=true')" />
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<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:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//@embed='true'">
|
<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:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:identifier" />
|
<xsl:value-of select="//video/rdf:RDF/cc:Work/dc:identifier" />
|
||||||
|
@ -137,35 +137,33 @@
|
||||||
<xsl:if test="//@edit='true'">
|
<xsl:if test="//@edit='true'">
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<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:attribute>
|
||||||
<img src="/images/tango/accessories-text-editor.png" />
|
<img src="/images/tango/accessories-text-editor.png" />
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<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:attribute>
|
||||||
<xsl:value-of select="$locale_strings[@id='edit_video']" />
|
<xsl:value-of select="$locale_strings[@id='edit_video']" />
|
||||||
</a>
|
</a>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-bookmark">
|
<div class="button-bookmark">
|
||||||
<xsl:if test="//@edit='true'">
|
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, '/action=bookmark')" />
|
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, 'action=bookmark')" />
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<img src="/images/tango/bookmark-new.png" />
|
<img src="/images/tango/bookmark-new.png" />
|
||||||
</a>
|
</a>
|
||||||
<br />
|
<br />
|
||||||
<a>
|
<a>
|
||||||
<xsl:attribute name="href">
|
<xsl:attribute name="href">
|
||||||
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, '/action=bookmark')" />
|
<xsl:value-of select="concat(//rdf:RDF/cc:Work/dc:identifier, 'action=bookmark')" />
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:value-of select="$locale_strings[@id='bookmark_video']" />
|
<xsl:value-of select="$locale_strings[@id='bookmark_video']" />
|
||||||
</a>
|
</a>
|
||||||
</xsl:if>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="videoccdata">
|
<div class="videoccdata">
|
||||||
<a>
|
<a>
|
||||||
|
|
Loading…
Reference in a new issue