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); }
<?php require_once 'Sprinkles.php'; $query = request_param('query'); $mode = request_param('mode'); if (!$mode) { $mode = 'simple'; } $sprink = new Sprinkles(); $suggested = $sprink->topics(array('query' => $query, "limit" => 3)); $topics = $suggested['topics']; if ($mode == 'fancy') { $sprink->resolve_authors($topics); } $smarty->assign('suggested_topics', $topics); $smarty->assign('mode', $mode); $smarty->display('topic-suggestions.t'); finish_request('topic-suggestions');
} if (!$topic_id) { $sfn_id = request_param('sfn_id'); $topic_id = $sprink->api_url("topics/" . $sfn_id); } if (!$topic_id) { die("Internal error: expected id parameter."); } $topic = $sprink->topic($topic_id); $topic_head = array_shift($topic['replies']); $reply_count = count($topic['replies']); $topic['replies'] = thread_items($topic['replies'], $topic_head['id']); $toplevel_reply_count = count($topic['replies']); $topic['replies'] = flatten_threads($topic['replies']); $sprink->resolve_author($topic_head); $sprink->resolve_authors($topic['replies']); $related_topics = $sprink->topics(array('related' => $topic_id)); list($company_related_topics, $noncompany_related_topics) = $sprink->company_partition($related_topics['topics']); $noncompany_related_topics = take($related_topics_count, $noncompany_related_topics); resolve_companies($noncompany_related_topics); list($company_promoted, $star_promoted) = filter_promoted($topic['replies']); $smarty->assign('topic_head', $topic_head); $smarty->assign('replies', $topic['replies']); $smarty->assign('related_topics', $noncompany_related_topics); $smarty->assign('particip', $topic['particip']); $smarty->assign('tags', $topic['tags']); $smarty->assign(array('reply_count' => $reply_count, 'toplevel_reply_count' => $toplevel_reply_count)); $smarty->assign('num_pages', ceil($toplevel_reply_count / $topic_page_size)); $smarty->assign('page_num', $page_num); $smarty->assign('topic_id', $topic_id); $smarty->assign('reply_url', $reply_url);