-
Notifications
You must be signed in to change notification settings - Fork 1
/
submit.php
82 lines (62 loc) · 2 KB
/
submit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
try {
require_once('Sprinkles.php');
$sprink = new Sprinkles();
$subject = request_param('subject');
$details = request_param('details');
$tags = request_param('tags');
$emoticon = request_param('emoticon');
$emotion = request_param('emotion');
$style = request_param('style');
$selected_products = request_param('product');
if (!$selected_products)
$selected_products = array();
$validation_errors = request_param('errs');
$suggested = $sprink->topics(array('query' => $subject, "limit" => $submit_suggestions));
$suggested = $suggested['topics'];
$top_tags = take(8, $sprink->tags($api_root . 'companies/' .
$sprink->company_sfnid .
'/tags?on=topics&sort=usage&limit=8'));
switch ($style) {
case 'question':
$friendly_style = 'question';
break;
case 'idea':
$friendly_style = 'idea';
break;
case 'problem':
$friendly_style = 'problem';
break;
case 'talk':
$friendly_style = 'discussion';
break;
default:
$friendly_style = 'topic';
}
$sprink->resolve_authors($suggested);
$smarty->assign('subject', $subject);
$smarty->assign('details', $details);
$smarty->assign('tags', $tags);
$smarty->assign('emoticon', $emoticon);
$smarty->assign('emotion', $emotion);
$smarty->assign('style', $style);
$smarty->assign('friendly_style', $friendly_style);
$smarty->assign('product', $selected_products);
$smarty->assign('top_tags', $top_tags);
$smarty->assign('top_tags_count', count($top_tags));
$smarty->assign('suggested', $suggested);
$products = $sprink->product_list();
foreach ($products as &$product) {
$product['selected'] = in_array($product['name'], $selected_products);
}
$smarty->assign('products', $products);
$smarty->assign('err_subject', in_array('subject', $validation_errors));
$smarty->assign('current_url', 'submit.php');
$sprink->add_std_hash_elems($smarty);
$smarty->display('submit.t');
finish_request('submit');
} catch (Exception $e) {
error_log("Exception thrown while preparing page: " . $e->getMessage());
$smarty->display('error.t');
}
?>