Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes from our YAPC::Brasil Act instance #39

Open
wants to merge 5 commits into
base: yapc-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
/Makefile
/inc
static
conf
/var
69 changes: 69 additions & 0 deletions conf/act.ini.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
[general]
conferences = FIX_ME FIX_ME_TOO AND_ME
cookie_name = act
searchlimit = 20
dir_photos = photos
dir_ttc = var/
max_imgsize = 320x200
root = $(home)/wwwdocs/
default_language = en
languages = pt es en
timezone = America/Chicago
default_country = US

[bcrypt]
cost = 5
salt = FIX_ME_FIX_ME_FI

[database]
name = act
dsn = dbi:Pg:dbname=FIX_ME;host=FIX_ME
user = FIX_ME
passwd = FIX_ME
dump_file = /FIX_ME/path/to/act_dump.sql
pg_dump = /usr/bin/pg_dump
test_dsn = dbi:Pg:dbname=FIX_ME;host=FIX_ME
test_user = FIX_ME
test_passwd = FIX_ME


[email]
sendmail = /usr/sbin/sendmail
test = 0
sender_address = [email protected]

[wiki]
dbname = FIX_ME
dbuser = FIX_ME
dbpass = FIX_ME
dbhost = FIX_ME
dbport = FIX_ME

[payment]
open = 0
invoices = 0
type = Fake

[payment_type_Fake]
plugin = Fake
notify_bcc = [email protected]

[flickr]
# see http://www.flickr.com/services/api/
apikey = FIX_ME_FIX_ME_FIX_ME_FIX_ME_FIX_


[talks]
durations = 20 40 60
start_date = 2011-07-01 00:00:00
end_date = 2012-07-01 00:00:00
submissions_open = 1

[rooms]
rooms = room1 room2
room1 = Room 1
room2 = Room 2

[registration]
open = 1
max_attendees = 5000
17 changes: 17 additions & 0 deletions debug.psgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env perl

use strict;
use warnings;
use lib 'lib';

use Act::Dispatcher;
use Plack::Builder;
use Plack::App::Directory;

builder {
enable 'Session::Cookie';
enable "SimpleLogger", level => "warn";
enable 'ReverseProxy';
enable 'Debug';
Act::Dispatcher->to_app;
};
1 change: 1 addition & 0 deletions lib/Act/Dispatcher.pm
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ sub to_app {
sub conference_app {
my $static_app = Act::Handler::Static->new;
builder {
enable '+Act::Middleware::Auth';
enable '+Act::Middleware::Language';
enable sub {
my $app = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Act/Handler/User/Register.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ sub handler
"INSERT INTO participations (user_id, conf_id, datetime, ip) VALUES (?,?, NOW(), ?);"
);
$sth->execute( $Request{user}->user_id, $Request{conference},
$Request{r}->connection->remote_ip );
$Request{r}->address );
$sth->finish();
$Request{dbh}->commit;
return Act::Util::redirect(make_uri('main'))
Expand Down
7 changes: 7 additions & 0 deletions lib/Act/Middleware/Language.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ sub call {

my $language;

# failsafe
$env->{'psgix.session'}->{'act'} = {} unless exists $env->{'psgix.session'}->{'act'};

# check session
my $s = $env->{'psgix.session'}{'act'};
if ($s && $s->{language} && $langs->{$s->{language}}) {
Expand All @@ -27,6 +30,7 @@ sub call {
my $force_language = $req->param('language');
if ($force_language && $langs->{$force_language} ) {
$language = $s->{language} = $force_language;

my $uri = $req->uri;
my @query = $uri->query_form;
for (my $i; $i < @query; $i+=2 ) {
Expand Down Expand Up @@ -66,6 +70,9 @@ sub call {
# remember it for this request
$env->{'act.language'} = $language;

# make sure whatever was picked last, it stays in the session
$s->{'language'} = $language;

# fetch localization handle
$env->{'act.loc'} = Act::I18N->get_handle($language);

Expand Down
2 changes: 1 addition & 1 deletion lib/Act/Wiki.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sub new
return Wiki::Toolkit->new(
store => Act::Wiki::Store->new(charset => 'UTF-8',
map { $_ => $Config->get("wiki_$_") }
qw(dbname dbuser dbpass)),
qw(dbname dbuser dbpass dbhost dbport)),
formatter => Act::Wiki::Formatter->new(),
);
}
Expand Down