diff options
Diffstat (limited to 'cgi-bin/sketchbook_resolver.pl')
-rwxr-xr-x | cgi-bin/sketchbook_resolver.pl | 49 |
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 | |||
5 | use strict; | ||
6 | use Apache::Request; | ||
7 | use Apache::Constants qw(REDIRECT); | ||
8 | use Compose::local_lib; | ||
9 | use Compose::db_connection; | ||
10 | |||
11 | my $r = Apache::Request->new(Apache->request); | ||
12 | my $local_lib = new Compose::local_lib(); | ||
13 | my $dbh = new Compose::db_connection('localhost','aes','apache','webconnect'); | ||
14 | my $item = $local_lib->fix_spaces($r->param('card')); | ||
15 | |||
16 | $r->send_http_header('text/javascript'); | ||
17 | |||
18 | if ($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 | ||