aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/CrossSell.pm5
-rw-r--r--perllib/Page.pm19
-rw-r--r--perllib/Problems.pm10
3 files changed, 17 insertions, 17 deletions
diff --git a/perllib/CrossSell.pm b/perllib/CrossSell.pm
index a533ecfc7..e40f2166f 100644
--- a/perllib/CrossSell.pm
+++ b/perllib/CrossSell.pm
@@ -218,9 +218,8 @@ sub display_advert ($$;$%) {
# }
#}
- # ALWAYS return democracy club advert for the mo
- $q->{scratch} = 'advert=demclub0';
- return display_democracyclub();
+ #$q->{scratch} = 'advert=demclub0';
+ #return display_democracyclub();
#unless (defined $data{done_tms} && $data{done_tms}==1) {
$q->{scratch} = 'advert=news';
diff --git a/perllib/Page.pm b/perllib/Page.pm
index fcf11f7f7..cafd9ba91 100644
--- a/perllib/Page.pm
+++ b/perllib/Page.pm
@@ -339,17 +339,14 @@ sub footer {
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://piwik.mysociety.org/" : "http://piwik.mysociety.org/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
-<!--
-piwik_action_name = '';
-piwik_idsite = 8;
-piwik_url = pkBaseURL + "piwik.php";
-piwik_log(piwik_action_name, piwik_idsite, piwik_url);
-//-->
-</script>
-<noscript><img width=1 height=1 src="http://piwik.mysociety.org/piwik.php?idsite=8" style="border:0" alt=""></noscript>
-<!-- /Piwik -->
+</script><script type="text/javascript">
+try {
+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 8);
+piwikTracker.trackPageView();
+piwikTracker.enableLinkTracking();
+} catch( err ) {}
+</script><noscript><p><img src="http://piwik.mysociety.org/piwik.php?idsite=8" style="border:0" alt=""/></p></noscript>
+<!-- End Piwik Tag -->
EOF
}
diff --git a/perllib/Problems.pm b/perllib/Problems.pm
index 69293e162..aad6c0716 100644
--- a/perllib/Problems.pm
+++ b/perllib/Problems.pm
@@ -209,7 +209,7 @@ sub fixed_nearby {
sub fetch_problem {
my $id = shift;
- dbh()->selectrow_hashref(
+ my $p = dbh()->selectrow_hashref(
"select id, easting, northing, council, category, title, detail, photo,
used_map, name, anonymous, extract(epoch from confirmed) as time,
state, extract(epoch from whensent-confirmed) as whensent,
@@ -218,7 +218,10 @@ sub fetch_problem {
from problem where id=? and state in ('confirmed','fixed', 'hidden')
$site_restriction", {}, $id
);
+ $p->{service} =~ s/_/ /g;
+ return $p;
}
+
# API functions
sub problems_matching_criteria {
@@ -301,10 +304,11 @@ sub council_problems {
push @params, $one_council;
$where_extra = "and areas like '%,'||?||',%'";
}
+ my $current_time = dbh()->selectrow_array('select ms_current_timestamp()');
my $problems = select_all(
"select id, title, detail, council, state, areas,
- extract(epoch from ms_current_timestamp()-lastupdate) as duration,
- extract(epoch from ms_current_timestamp()-confirmed) as age
+ extract(epoch from '$current_time'-lastupdate) as duration,
+ extract(epoch from '$current_time'-confirmed) as age
from problem
where state in ('confirmed', 'fixed')
$where_extra