summaryrefslogtreecommitdiff
path: root/cgi-bin/sketchbook_resolver.pl
diff options
context:
space:
mode:
Diffstat (limited to 'cgi-bin/sketchbook_resolver.pl')
-rwxr-xr-xcgi-bin/sketchbook_resolver.pl49
1 files changed, 49 insertions, 0 deletions
diff --git a/cgi-bin/sketchbook_resolver.pl b/cgi-bin/sketchbook_resolver.pl
new file mode 100755
index 0000000..cbf64be
--- /dev/null
+++ b/cgi-bin/sketchbook_resolver.pl
@@ -0,0 +1,49 @@
1#!/usr/bin/perl
2
3$|=1;
4
5use strict;
6use Apache::Request;
7use Apache::Constants qw(REDIRECT);
8use Compose::local_lib;
9use Compose::db_connection;
10
11my $r = Apache::Request->new(Apache->request);
12my $local_lib = new Compose::local_lib();
13my $dbh = new Compose::db_connection('localhost','aes','apache','webconnect');
14my $item = $local_lib->fix_spaces($r->param('card'));
15
16$r->send_http_header('text/javascript');
17
18if ($r->method() eq "GET") {
19 my %res = $dbh->queryRawDB(qq(
20 SELECT
21 enc_content_id,
22 textfield_0 AS title,
23 select_0 AS category,
24 CONCAT(clients.website.site_url,clients.website.publish_docroot,"/",human_dir,"/index.html") AS page_loc,
25 CONCAT(clients.website.site_url,clients.website.publish_docroot,"/",human_dir,"/orig/",image_1) AS rotated_image
26 FROM
27 content_data,
28 clients.website
29 WHERE
30 clients.website.site_id = content_data.site_id AND
31 content_data.site_id = 1 AND
32 form_id = 48 AND
33 moderation_status >= 3 AND
34 date_0 <= NOW() AND
35 enc_content_id = "$item" AND
36 !(textfield_5 is NULL or textfield_5 = "") AND
37 checkbox_2 != "Yes"
38 ));
39
40 print qq(
41\({
42 "cid" : "$res{0}{'enc_content_id'}",
43 "title" : "$res{0}{'title'}",
44 "category" : "$res{0}{'category'}",
45 "url" : "$res{0}{'page_loc'}",
46 "chip" : "$res{0}{'rotated_image'}"
47}\)
48 );
49} \ No newline at end of file