added config file - first part

git-svn-id: http://yolanda.mister-muffin.de/svn@300 7eef14d0-6ed0-489d-bf55-20463b2d70db
main
josch 16 years ago
parent e1a42e7e94
commit e555b062cb

@ -6,17 +6,18 @@
<string id="database">mysql</string>
<string id="database_host">localhost</string>
<string id="database_name">yolanda</string>
<string id="database_username">yolanda</string>
<string id="database_password"><!-- put password here --></string>
<string id="database_username">root</string>
<!--<string id="database_password">password</string>--><!-- MUST NOT be empty -->
<string id="url_root">http://localhost/</string>
<string id="url_root">http://localhost</string><!-- MUST NOT end with trailing slash -->
<string id="path_root">/var/www/yolanda/</string>
<string id="path_root">/var/www/yolanda/</string><!-- MUST end with trailing slash -->
<!-- general page settings -->
<string id="page_locale">en-us</string>
<string id="page_xslt">xhtml.xsl</string>
<string id="page_results_pagesize">10</string>
<string id="page_results_pagesize_default">10</string>
<string id="page_results_pagesize_max">500</string>
<string id="page_tag_lenght_min">3</string>
<string id="page_tag_count">20</string>
<string id="page_openid">true</string>
@ -31,5 +32,12 @@
<string id="video_filesize_max">204800</string><!-- in bytes -->
<string id="video_filesize_min">512</string>
<string id="video_audio_bitrate">64</string>
<!-- settings for xml output -->
<!--<string id="xml_namespace">http://feature.yolanda.namespace.tld</string>-->
<string id="xml_namespace_xsl">http://www.w3.org/1999/XSL/Transform</string>
<string id="xml_namespace_dc">http://purl.org/dc/elements/1.1/</string>
<string id="xml_namespace_cc">http://web.resource.org/cc/</string>
<string id="xml_namespace_rdf">http://www.w3.org/1999/02/22-rdf-syntax-ns#</string>
</strings>
</xsl:stylesheet>

@ -42,9 +42,10 @@ sub get_page_array
}
$page->{'username'} = $userinfo->{'username'};
$page->{'xmlns:dc'} = $xmlns_dc;
$page->{'xmlns:cc'} = $xmlns_cc;
$page->{'xmlns:rdf'} = $xmlns_rdf;
$page->{'xmlns:dc'} = $config->{"xml_namespace_dc"};
$page->{'xmlns:cc'} = $config->{"xml_namespace_cc"};
$page->{'xmlns:rdf'} = $config->{"xml_namespace_rdf"};
}
# called by video.pl (display ambiguous videos),
@ -59,10 +60,10 @@ sub fill_results
$resultcount = $sth->execute(@_) or die $dbh->errstr;
#set pagesize by query or usersettings or default
$pagesize = $query->param('pagesize') or $pagesize = $userinfo->{'pagesize'} or $pagesize = $defaultpagesize;
$pagesize = $query->param('pagesize') or $pagesize = $userinfo->{'pagesize'} or $pagesize = $config->{"page_results_pagesize_default"};
#if pagesize is more than maxpagesize reduce to maxpagesize
$pagesize = $pagesize > $maxpagesize ? $maxpagesize : $pagesize;
$pagesize = $pagesize > $config->{"page_results_pagesize_max"} ? $config->{"page_results_pagesize_max"} : $pagesize;
#rediculous but funny round up, will fail with 100000000000000 results per page
#on 0.0000000000001% of all queries - this is a risk we can handle
@ -92,22 +93,22 @@ sub fill_results
#before code cleanup, this was a really obfuscated array/hash creation
push @{ $page->{'results'}->{'result'} },
{
'thumbnail' => "$domain/video-stills/thumbnails/$id",
'preview' => "$domain/video-stills/previews/$id",
'thumbnail' => $config->{"url_root"}."/video-stills/thumbnails/$id",
'preview' => $config->{"url_root"}."/video-stills/previews/$id",
'duration' => $duration,
'viewcount' => $viewcount,
'rdf:RDF' =>
{
'cc:Work' =>
{
'rdf:about' => "$domain/download/$id/",
'rdf:about' => $config->{"url_root"}."/download/$id/",
'dc:title' => [$title],
'dc:creator' => [$creator],
'dc:subject' => [$subject],
'dc:description' => [$description],
'dc:publisher' => [$publisher],
'dc:date' => [$timestamp],
'dc:identifier' => ["$domain/video/".urlencode($title)."/$id/" . ($duration == 0 ? "/action=edit" : "")],
'dc:identifier' => [$config->{"url_root"}."/video/".urlencode($title)."/$id/" . ($duration == 0 ? "/action=edit" : "")],
'dc:source' => [$source],
'dc:language' => [$language],
'dc:coverage' => [$coverage],

@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/perl -w
use CGI qw(:standard);
use CGI::Session;
@ -17,19 +17,13 @@ $root = '/var/www/yolanda';
use lib qw(/var/www/yolanda);
#set global config variable
$config = XMLin("$root/config/backend.xml", KeyAttr => {string => 'id'}, ForceArray => [ 'string' ], ContentKey => '-content');
$config = $config->{"strings"}->{"string"};
#set global variables
$database = 'yolanda';
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$domain = 'http://localhost';
$session_name = 'sid';
$locale = "en-US";
$xmlns_dc = "http://purl.org/dc/elements/1.1/";
$xmlns_cc = "http://web.resource.org/cc/";
$xmlns_rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
$defaultpagesize = 20;
$maxpagesize = 500;
$dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass);
$dbh = DBI->connect("DBI:mysql:".$config->{"database_name"}.":".$config->{"database_host"}, $config->{"database_username"}, $config->{"database_password"}) or die $DBI::errstr;
1;

@ -34,7 +34,7 @@ elsif($query->param('pass') eq '' and $query->param('user')=~m/^http:\/\//)
cache => undef, # or File::Cache->new,
args => $query,
consumer_secret => $session->id, #is this save? don't know...
required_root => $domain );
required_root => $config->{"url_root"} );
#is an openid passed?
if($query->param('user'))
@ -49,8 +49,8 @@ elsif($query->param('pass') eq '' and $query->param('user')=~m/^http:\/\//)
{
#try to set the check_url
$check_url = $claimed->check_url(
return_to => "$domain/login.pl?action=openid", #on success return to this address
trust_root => $domain); #this is the string the user will be asked to trust
return_to => $config->{"url_root"}."login.pl?action=openid", #on success return to this address
trust_root => $config->{"url_root"}); #this is the string the user will be asked to trust
#redirect to openid server to check claim
print $query->redirect($check_url);
@ -73,7 +73,7 @@ elsif($query->param('action') eq 'openid')
cache => undef, # or File::Cache->new,
args => $query,
consumer_secret => $session->id, #is this save? don't know...
required_root => $domain );
required_root => $config->{"url_root"} );
if($setup_url = $con->user_setup_url)
{

@ -163,7 +163,7 @@ if($userinfo->{'id'} && $query->param("DC.Title") &&
}
#print success to the user
print $query->redirect("index.pl?information=information_uploaded&value=$domain/video/".urlencode($query->param("DC.Title"))."/$id/");
print $query->redirect("index.pl?information=information_uploaded&value=".$config->{"url_root"}."/video/".urlencode($query->param("DC.Title"))."/$id/");
}
else
{

@ -86,8 +86,8 @@ if($query->url_param('id'))
#before code cleanup, this was a really obfuscated array/hash creation
push @{ $page->{'video'} },
{
'thumbnail' => "$domain/video-stills/thumbnails/$id",
'preview' => "$domain/video-stills/previews/$id",
'thumbnail' => $config->{"url_root"}."/video-stills/thumbnails/$id",
'preview' => $config->{"url_root"}."/video-stills/previews/$id",
'filesize' => $filesize,
'duration' => $duration,
'width' => $width,
@ -99,14 +99,14 @@ if($query->url_param('id'))
{
'cc:Work' =>
{
'rdf:about' => "$domain/download/$id/",
'rdf:about' => $config->{"url_root"}."/download/$id/",
'dc:title' => [$title],
'dc:creator' => [$creator],
'dc:subject' => [$subject],
'dc:description' => [$description],
'dc:publisher' => [$publisher],
'dc:date' => [$timestamp],
'dc:identifier' => ["$domain/video/".urlencode($title)."/$id/"],
'dc:identifier' => [$config->{"url_root"}."/video/".urlencode($title)."/$id/"],
'dc:source' => [$source],
'dc:language' => [$language],
'dc:coverage' => [$coverage],

Loading…
Cancel
Save