<?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');
<?php try { require_once "Sprinkles.php"; $sprink = new Sprinkles(); $top_topic_tags = take(20, $sprink->tags($api_root . 'companies/' . $sprink->company_sfnid . '/tags?on=topics&sort=usage&limit=20')); $chunk = intval(ceil(sizeof($top_topic_tags) / 4)); $top_topic_tags = array_chunk($top_topic_tags, $chunk); $entries = $sprink->topics(array("limit" => $helpstart_topic_count, "sort" => 'recently_active')); // $sprink->resolve_authors($entries['topics']); $smarty->assign('top_topic_tags', $top_topic_tags); $smarty->assign('entries', $entries['topics']); # Standard stash items $smarty->assign('products', $sprink->product_list()); $smarty->assign('current_url', 'helpstart.php'); $smarty->assign('totals', $entries['totals']); $smarty->assign('filter_style', 'question'); $sprink->add_std_hash_elems($smarty); $smarty->display('helpstart.t'); finish_request('helpstart'); } catch (Exception $e) { error_log("Exception thrown while preparing page: " . $e->getMessage()); $smarty->assign('error_msg', $e->getMessage()); $smarty->display('error.t'); }
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;
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); $smarty->assign(array('company_promoted_replies' => $company_promoted, 'star_promoted_replies' => $star_promoted));
<?php require_once "Sprinkles.php"; $sprink = new Sprinkles(); $page_num = request_param('page'); if (!$page_num) { $page_num = 0; } $topic_filters = array("limit" => $discuss_page_size, "page" => $page_num); $filter_style = request_param('style'); if ($filter_style) { $topic_filters['style'] = $filter_style; $smarty->assign('style', $filter_style); } $filter_query = request_param('query'); if ($filter_query) { $topic_filters['query'] = $filter_query; $smarty->assign('query', $filter_query); } $topics = $sprink->topics($topic_filters); $topic_count = $topics['totals']['this']; // $sprink->resolve_authors($topics['topics']); $smarty->assign('page_num', $page_num); $smarty->assign('num_pages', ceil($topic_count / $discuss_page_size)); $smarty->assign('topics', $topics['topics']); $smarty->assign('topic_count', $topic_count); $smarty->assign('totals', $topics['totals']); $sprink->add_std_hash_elems($smarty); $smarty->display('results.t'); finish_request('results');
<?php try { require_once "Sprinkles.php"; $sprink = new Sprinkles(); $faqs = $sprink->topics(array('frequently_asked' => 1, 'style' => 'question')); $smarty->assign('entries', $entries); $smarty->assign('faqs', $faqs['topics']); $smarty->assign('current_url', 'faq.php'); $sprink->add_std_hash_elems($smarty); $smarty->display('faq.t'); finish_request('faq'); } catch (Exception $e) { error_log("Exception thrown while preparing page: " . $e->getMessage()); $smarty->display('error.t'); }
if (!$result) { die("Failed to fetch site settings from database (" . mysql_error() . ")."); } $settings = mysql_fetch_assoc($result); $smarty->assign('admin_users', $admin_users); foreach ($fields as $i => $field) { if (request_param($field)) { $settings[$field] = request_param($field); } } if (request_param('admin_users')) { $settings['admin_users_str'] = request_param('admin_users'); } $company_hcard = $sprink->company_hcard(); $smarty->assign('company_url', is_array($company_hcard['url']) ? $company_hcard['url'][0] : $company_hcard['url']); $sprinkles_tagged_topics = $sprink->topics(array('tag' => 'sprinkles', 'limit' => '3')); $sprinkles_tagged_topics = $sprinkles_tagged_topics['topics']; $site_links = $sprink->site_links(); $smarty->assign('site_links', $site_links); $smarty->assign('invalid', request_param('invalid')); $smarty->assign('errors', request_param('errors')); $smarty->assign('settings_saved', request_param('settings_saved')); $smarty->assign('hooked_msg', request_param('hooked')); $new_admins = request_param('new_admins'); if ($new_admins) { $smarty->assign('new_admins', split(',', $new_admins)); } $smarty->assign('settings', $settings); $smarty->assign('sprinkles_root_url', $sprink->sprinkles_root_url()); $smarty->assign('sprinkles_tagged_topics', $sprinkles_tagged_topics); $smarty->assign('current_url', 'admin.php');