function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; global $qa_login_userid, $questionid, $relatedcount, $question, $relatedquestions, $qa_cookieid, $usershtml; list($question, $relatedquestions) = qa_db_select_with_pending(qa_db_full_post_selectspec($qa_login_userid, $questionid), qa_db_related_qs_selectspec($qa_login_userid, $questionid)); if ($relatedcount > 1 && !$question['hidden']) { $minscore = qa_match_to_min_score(qa_opt('match_related_qs')); foreach ($relatedquestions as $key => $related) { if ($related['postid'] == $questionid || $related['score'] < $minscore) { unset($relatedquestions[$key]); } } if (count($relatedquestions)) { $themeobject->output('<h2>' . qa_lang('main/related_qs_title') . '</h2>'); } else { $themeobject->output('<h2>' . qa_lang('main/no_related_qs_title') . '</h2>'); } $upper = qa_opt('related_qs_num') < count($relatedquestions) ? qa_opt('related_qs_num') : count($relatedquestions); foreach ($relatedquestions as $related) { if ($upper <= 0) { break; } $themeobject->output('<p style="margin:0 0 10px 0; font-weight:bold;"><a href="' . qa_path_html(qa_q_request($related['postid'], $related['title'])) . '">' . $related['title'] . '</a></p>'); $upper--; } } }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { $widget_opt = @$themeobject->current_widget['param']['options']; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; $categoryslugs = ''; $userid = qa_get_logged_in_userid(); // Get lists of recent activity in all its forms, plus category information list($questions1, $questions2, $questions3, $questions4) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $categoryslugs, null, false, false, $qcount), qa_db_recent_a_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($userid, 0, $categoryslugs)); // Prepare and return content for theme $content = qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), $qcount, 0, null, null, null, null, null, true, 'activity/', null, null, null, null); $content = $content['q_list']['qs']; if (@$themeobject->current_widget['param']['locations']['show_title']) { $themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/recent_activities') . ' <a href="' . qa_path_html('activity') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>'); } $themeobject->output('<div class="ra-question-activity-widget">'); $q_list = $content; $themeobject->output('<ul class="activity-list">'); foreach ($q_list as $list) { $themeobject->output('<li class="clearfix ' . (is_featured($list['raw']['postid']) ? ' featured' : '') . '"><span class="fav-star icon-heart' . (@$list['raw']['userfavoriteq'] ? ' active' : '') . '"></span><span class="post-status-c">' . cs_post_status($list) . '</span><a href="' . $list['url'] . '">' . $list['title'] . '<span class="time">' . implode(' ', $list['when']) . '</span><span class="ans-count total-' . $list['raw']['acount'] . '">' . $list['raw']['acount'] . '</span></a></li>'); } $themeobject->output('</ul>'); $themeobject->output('</div>'); }
function qa_get_user_avatar_html($flags, $email, $handle, $blobid, $width, $height, $size, $padding = false) { if (qa_opt('avatar_allow_gravatar') && $flags & QA_USER_FLAGS_SHOW_GRAVATAR) { $html = qa_get_gravatar_html($email, $size); } elseif (qa_opt('avatar_allow_upload') && $flags & QA_USER_FLAGS_SHOW_AVATAR) { if (isset($blobid)) { $html = qa_get_avatar_blob_html($blobid, $width, $height, $size, $padding); } elseif (strlen($handle)) { $userprofile = qa_db_select_with_pending(qa_db_user_profile_selectspec($handle, false)); if (!empty($userprofile['social_avatar'])) { $html = '<img src="' . $userprofile['social_avatar'] . '" width="' . $size . '" height="' . $size . '" class="qa-avatar-image" />'; } else { $html = null; } } } if (!isset($html)) { if ((qa_opt('avatar_allow_gravatar') || qa_opt('avatar_allow_upload')) && qa_opt('avatar_default_show') && strlen(qa_opt('avatar_default_blobid'))) { $html = qa_get_avatar_blob_html(qa_opt('avatar_default_blobid'), qa_opt('avatar_default_width'), qa_opt('avatar_default_height'), $size, $padding); } else { $html = null; } } return isset($html) && strlen($handle) ? '<A HREF="' . qa_path_html('user/' . $handle) . '" CLASS="qa-avatar-link">' . $html . '</A>' : $html; }
function qa_priv_notification($uid, $oid, $badge_slug) { require_once QA_INCLUDE_DIR . 'qa-app-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-emails.php'; if (QA_FINAL_EXTERNAL_USERS) { $publictohandle = qa_get_public_from_userids(array($uid)); $handle = @$publictohandle[$uid]; } else { $user = qa_db_single_select(qa_db_user_account_selectspec($uid, true)); $handle = @$user['handle']; } $subject = qa_opt('badge_email_subject'); $body = qa_opt('badge_email_body'); $body = preg_replace('/\\^if_post_text="([^"]*)"/', $oid ? '$1' : '', $body); // if post text $site_url = qa_opt('site_url'); $profile_url = qa_path_html('user/' . $handle, null, $site_url); if ($oid) { $post = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $oid), true); if ($post['parentid']) { $parent = qa_db_read_one_assoc(qa_db_query_sub('SELECT * FROM ^posts WHERE postid=#', $post['parentid']), true); } if (isset($parent)) { $anchor = urlencode(qa_anchor($post['basetype'], $oid)); $post_title = $parent['title']; $post_url = qa_path_html(qa_q_request($parent['postid'], $parent['title']), null, qa_opt('site_url'), null, $anchor); } else { $post_title = $post['title']; $post_url = qa_path_html(qa_q_request($post['postid'], $post['title']), null, qa_opt('site_url')); } } $subs = array('^badge_name' => qa_opt('badge_' . $badge_slug . '_name'), '^post_title' => @$post_title, '^post_url' => @$post_url, '^profile_url' => $profile_url, '^site_url' => $site_url); qa_send_notification($uid, '@', $handle, $subject, $body, $subs); }
function process_request($request) { require_once QA_INCLUDE_DIR . 'mp-app-posts.php'; require_once QA_INCLUDE_DIR . 'mp-db-users.php'; $qa_content = qa_content_prepare(); // if the user is not logged in, request user to login if (!qa_get_logged_in_userid()) { $qa_content['error'] = qa_insert_login_links('Please ^1log in^2 or ^3register^4 first.', $request); return $qa_content; } $qa_content['title'] = 'Course Announcements'; // DISPLAY ANNOUCEMENTS $data = '<div class="qa-q-list">'; // retrieve annoucements $announcements = mp_announcements_get_all(mp_get_categoryid()); if (count($announcements) == 0) { $data .= "No announcements"; } else { foreach ($announcements as $announcement) { $data .= '<div class="qa-q-list-item">'; $data .= '<div class="qa-q-item-title">' . $announcement['title'] . '</div>'; $data .= '<div class="qa-q-view-content">' . $announcement['content'] . '</div>'; $data .= '<div class="qa-q-item-meta">Posted by <A HREF="' . qa_path_html('user/' . $announcement['handle']) . '">' . $announcement['handle'] . '</A> on ' . $announcement['created'] . '</div>'; $data .= '</div>'; $data .= '<div class="qa-q-list-item-clear" ></div>'; } } $data .= '</div>'; $qa_content['custom_2'] = $data; // create the sub menu for navigation $qa_content['navigation']['sub'] = mp_announcements_sub_navigation(); $qa_content['navigation']['sub']['default']['selected'] = true; return $qa_content; }
function q2apro_save_most_viewed_questions() { // save checktime of cache qa_opt('q2apro_popularqu_checktime', time()); $maxquestions = qa_opt('q2apro_popularqu_maxqu'); $lastdays = qa_opt('q2apro_popularqu_lastdays'); $ourTopQuestions = qa_db_read_all_assoc(qa_db_query_sub('SELECT postid, title, acount FROM `^posts` WHERE `created` > NOW() - INTERVAL # DAY AND `type` = "Q" AND `closedbyid` IS NULL ORDER BY views DESC LIMIT #;', $lastdays, $maxquestions)); $saveoutput = ''; foreach ($ourTopQuestions as $qu) { $activity_url = qa_path_html(qa_q_request($qu['postid'], $qu['title']), null, qa_opt('site_url'), null, null); $questionlink = '<a href="' . $activity_url . '">' . htmlspecialchars($qu['title']) . '</a>'; $answercnt = ''; if (qa_opt('q2apro_popularqu_answercount')) { $acnttitle = $qu['acount'] == 1 ? qa_lang('q2apro_popularqu_lang/answer_one') : $qu['acount'] . ' ' . qa_lang('q2apro_popularqu_lang/answers'); $answercnt = ' <span title="' . $acnttitle . '">(' . $qu['acount'] . ')</span>'; } $saveoutput .= '<li> ' . $questionlink . $answercnt . ' </li> '; } // save into cache qa_opt('q2apro_popularqu_cached', $saveoutput); }
function head_custom() { qa_html_theme_base::head_custom(); if (qa_opt('priv_active') && qa_opt('priv_check') && qa_get_logged_in_handle()) { $userid = qa_get_logged_in_userid(); $notices = qa_db_read_one_value(qa_db_query_sub('SELECT meta_value FROM ^usermeta WHERE user_id=# AND meta_key=$ ', $userid, 'priv_notify'), true); if ($notices) { $all = explode('^', $notices); if (!$all[1]) { // no new return; } $n = explode(',', $all[1]); $this->notify = '<div class="notify-container">'; $text = count($n) > 1 ? str_replace('#', count($n), qa_opt('priv_notify_text_multi')) : str_replace('^privilege', qa_lang('profile/' . $n[0]), qa_opt('priv_notify_text')); $text = str_replace('^profile', qa_path_html('user/' . qa_get_logged_in_handle(), array('tab' => 'privileges'), qa_opt('site_url')), $text); $this->notify .= '<div class="priv-notify notify">' . $text . '<div class="notify-close" onclick="jQuery(this).parent().sildeUp(\'fast\')">x</div></div>'; $this->notify .= '</div>'; // remove notification flag qa_db_query_sub('UPDATE ^usermeta SET meta_value=$ WHERE meta_key=$ AND user_id=#', ($all[0] ? $all[0] . ',' : '') . $all[1] . '^', 'priv_notify', $userid); /* $this->output(" <script> jQuery('document').ready(function() { jQuery('.notify-container').delay(10000).fadeOut(); }); </script>"); */ $this->output(' <style>', qa_opt('priv_css'), '</style>'); } } }
function qa_share_buttons($q_view) { if (qa_opt('expert_question_enable')) { $qid = $q_view['raw']['postid']; $expert = qa_db_read_one_value(qa_db_query_sub("SELECT meta_value FROM ^postmeta WHERE meta_key='is_expert_question' AND post_id=#", $qid), true); if ($expert) { return; } } $url = qa_path_html(qa_q_request($q_view['raw']['postid'], $q_view['raw']['title']), null, qa_opt('site_url')); $code = array('facebook' => '<iframe src="//www.facebook.com/plugins/like.php?href=' . qa_path_html(qa_q_request($this->content['q_view']['raw']['postid'], $this->content['q_view']['raw']['title']), null, qa_opt('site_url')) . '&send=false&layout=standard&width=53&layout=button_count&show_faces=false&action=like&colorscheme=light&font&height=20&appId=170382616390886" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:53px; height:20px;" allowTransparency="true"></iframe>', 'twitter' => '<a href="http://twitter.com/share" class="twitter-share-button" data-count="none">Tweet</a>', 'google' => '<g:plusone size="medium" count="false"></g:plusone>', 'linkedin' => '<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share"></script>', 'email' => '<a title="Share this question via email" id="share-button-email" href="mailto:?subject=' . rawurlencode('[' . qa_opt('site_title') . '] ' . $q_view['raw']['title']) . '&body=' . rawurlencode($url) . '"><img height="24" src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'qa-share-mail.png' . '"/></a>'); // sort by weight $weight = array('facebook' => qa_opt('share_plugin_facebook_weight'), 'twitter' => qa_opt('share_plugin_twitter_weight'), 'google' => qa_opt('share_plugin_google_weight'), 'linkedin' => qa_opt('share_plugin_linkedin_weight'), 'email' => qa_opt('share_plugin_email_weight')); asort($weight); // output foreach ($weight as $key => $val) { if (qa_opt('share_plugin_' . $key)) { $shares[] = $code[$key]; } } if (empty($shares)) { return null; } $output = implode(' ', $shares); return $output; }
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { require_once QA_INCLUDE_DIR . 'db/selects.php'; $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags'))); $maxcount = reset($populartags); // $themeobject->output(sprintf('<h2 style="margin-top: 0; padding-top: 0;">%s</h2>', qa_lang_html('main/popular_tags'))); // $themeobject->output('<div style="font-size: 10px;">'); $themeobject->output(sprintf('<div class="panel panel-primary" style="padding: 0;"><div class="panel-heading"><h3 class="panel-title">%s</h3></div>', qa_lang_html('main/popular_tags'))); $themeobject->output('<div class="panel-body">'); $maxsize = qa_opt('tag_cloud_font_size'); $minsize = qa_opt('tag_cloud_minimal_font_size'); $scale = qa_opt('tag_cloud_size_popular'); $blockwordspreg = qa_get_block_words_preg(); foreach ($populartags as $tag => $count) { $matches = qa_block_words_match_all($tag, $blockwordspreg); if (empty($matches)) { if ($scale) { $size = number_format($maxsize * $count / $maxcount, 1); if ($size < $minsize) { $size = $minsize; } } else { $size = $maxsize; } $themeobject->output(sprintf('<a href="%s" style="font-size: %dpx; vertical-align: baseline;">%s</a>', qa_path_html('tag/' . $tag), $size, qa_html($tag))); } } // $themeobject->output('</div>'); $themeobject->output('</div></div>'); }
function qa_category_nav_to_browse(&$navigation, $categories, $categoryid, $favoritemap) { foreach ($navigation as $key => $navlink) { $category = $categories[$navlink['categoryid']]; if (!$category['childcount']) { unset($navigation[$key]['url']); } elseif ($navlink['selected']) { $navigation[$key]['state'] = 'open'; $navigation[$key]['url'] = qa_path_html('categories/' . qa_category_path_request($categories, $category['parentid'])); } else { $navigation[$key]['state'] = 'closed'; } if (@$favoritemap[$navlink['categoryid']]) { $navigation[$key]['favorited'] = true; } $navigation[$key]['note'] = ''; $navigation[$key]['note'] .= ' - <a href="' . qa_path_html('questions/' . implode('/', array_reverse(explode('/', $category['backpath'])))) . '">' . ($category['qcount'] == 1 ? qa_lang_html_sub('main/1_question', '1', '1') : qa_lang_html_sub('main/x_questions', qa_format_number($category['qcount'], 0, true))) . '</a>'; if (strlen($category['content'])) { $navigation[$key]['note'] .= qa_html(' - ' . $category['content']); } if (isset($navlink['subnav'])) { qa_category_nav_to_browse($navigation[$key]['subnav'], $categories, $categoryid, $favoritemap); } } }
function cs_events($limit = 10, $events_type = false) { if (!$events_type) { $events_type = array('q_post', 'a_post', 'c_post', 'a_select', 'badge_awarded'); } // query last 3 events $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT datetime,ipaddress,handle,event,params FROM ^eventlog WHERE event IN ("q_post", "a_post", "c_post") ORDER BY datetime DESC LIMIT #', $limit)); if (empty($posts)) { return; } $postids = ''; $i = 1; foreach ($posts as $post) { $params = preg_replace('/\\s+/', '&', $post['params']); parse_str($params, $data); $postids .= ($i != 1 ? ', ' : '') . $data['postid']; $i++; } $posts = qa_db_read_all_assoc(qa_db_query_sub('SELECT ^posts.* , ^users.handle FROM ^posts, ^users WHERE (^posts.userid=^users.userid AND ^posts.postid IN (' . $postids . ')) AND ^posts.type IN ("Q", "A", "C") ORDER BY ^posts.created DESC')); $o = '<ul class="ra-activity">'; foreach ($posts as $p) { $event_name = ''; $event_icon = ''; if ($p['type'] == 'Q') { $event_name = qa_lang('cleanstrap/asked'); $event_icon = 'icon-question'; } else { if ($p['type'] == 'A') { $event_name = qa_lang('cleanstrap/answered'); $event_icon = 'icon-answer'; } else { $event_name = qa_lang('cleanstrap/commented'); $event_icon = 'icon-chat'; } } $username = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : htmlspecialchars($p['handle']); $usernameLink = is_null($p['handle']) ? qa_lang('cleanstrap/anonymous') : '<a href="' . qa_path_html('user/' . $p['handle']) . '">' . $p['handle'] . '</a>'; $timeCode = qa_when_to_html(strtotime($p['created']), 7); $time = @$timeCode['prefix'] . @$timeCode['data'] . @$timeCode['suffix']; $o .= '<li class="event-item">'; $o .= '<div class="event-inner">'; $o .= '<div class="event-icon pull-left ' . $event_icon . '"></div>'; $o .= '<div class="event-content">'; $o .= '<p class="title"><strong class="avatar" data-handle="' . $p['handle'] . '" data-id="' . $p['userid'] . '">' . @$usernameLink . '</strong> <span class="what">' . $event_name . '</span></p>'; if ($p['type'] == 'Q') { $o .= '<a class="event-title" href="' . qa_q_path_html($p['postid'], $p['title']) . '" title="' . $p['title'] . '">' . cs_truncate($p['title'], 100) . '</a>'; } elseif ($p['type'] == 'A') { $o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#a' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>'; } else { $o .= '<a class="event-title" href="' . cs_post_link($p['parentid']) . '#c' . $p['postid'] . '">' . cs_truncate(strip_tags($p['content']), 100) . '</a>'; } $o .= '<span class="time">' . $time . '</span>'; $o .= '</div>'; $o .= '</div>'; $o .= '</li>'; } $o .= '</ul>'; return $o; }
function faq_notify() { $notice = '<div class="notify-container">'; $text = str_replace('^faq', '<a href="' . qa_path_html(qa_opt('faq_page_url')) . '">' . qa_opt('faq_page_slug') . '</a>', qa_opt('faq_notify_text')); $notice .= '<div class="notify">' . $text . '<div class="notify-close" onclick="jQuery(this).parent().hide(\'slow\')">x</div></div>'; $notice .= '</div>'; $this->output($notice); }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { /* $requestparts=qa_request_parts(); $requestlower=strtolower(qa_request()); $firstlower=strtolower($requestparts[0]); $routing=qa_page_routing(); // unanswered & questions pages may contain categories. unset($routing['activity/']); unset($routing['unanswered/']); unset($routing['questions/']); if ( (isset($routing[$requestlower])) or (isset($routing[$firstlower.'/'])) or (is_numeric($requestparts[0])) ) return; $explicitqa=(strtolower($requestparts[0])=='qa' or strtolower($requestparts[0])=='unanswered' or strtolower($requestparts[0])=='questions' or strtolower($requestparts[0])=='activity'); if ($explicitqa) $slugs=array_slice($requestparts, 1); elseif (strlen($requestparts[0])) $slugs=$requestparts; else $slugs=array(); */ $slugs = useo_get_current_category_slug(); $countslugs = count($slugs); list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null); if ($countslugs && isset($categoryid)) { /* $categoryid is current categories ID $backpath = implode('/', array_reverse($slugs)); echo "countslugs: <pre>"; var_dump($countslugs); echo "</pre>"; $fullcategory=qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true)); echo "fullcategory: <pre>"; var_dump($fullcategory); echo "</pre>"; echo "categoryid: <pre>"; var_dump($categoryid); echo "</pre>"; echo "slugs: <pre>"; var_dump($slugs); echo "</pre>"; echo "template: <pre>"; var_dump($template); echo "</pre>"; echo "request: <pre>"; var_dump($request); echo "</pre>"; */ require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $description = qa_db_categorymeta_get($categoryid, 'useo_cat_description'); if (!qa_opt('useo_cat_desc_format')) { $description = qa_html($description); } $editurlhtml = qa_path_html('category-edit/' . $categoryid); $allowediting = !qa_user_permit_error('useo_cat_desc_permit_edit'); if (strlen($description)) { echo '<SPAN CLASS="entry-content qa-category-description">'; echo $description; echo '</SPAN>'; if ($allowediting) { echo ' - <A HREF="' . $editurlhtml . '">edit</A>'; } } elseif ($allowediting) { echo '<A HREF="' . $editurlhtml . '">' . qa_lang_html('useo/create_desc_link') . '</A>'; } } }
function bs_navbar() { $nav_html = '<nav class="navbar navbar-default" role="navigation">' . '<div class="container">' . '<div class="navbar-header">' . '<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#q2a-bs-collapse">' . '<span class="sr-only">Toggle</span>' . '<span class="icon-bar"></span>' . '<span class="icon-bar"></span>' . '<span class="icon-bar"></span>' . '</button>' . '<a class="navbar-brand" href="' . qa_path_html() . '">' . qa_opt('site_title') . '</a>' . '</div>' . '<div class="collapse navbar-collapse" id="q2a-bs-collapse">' . '<ul class="nav navbar-nav navbar-right">'; foreach ($this->content['navigation']['user'] as $unav) { $nav_html .= '<li><a href="' . $unav['url'] . '">' . $unav['label'] . '</a></li>'; } $nav_html .= '</ul>' . '</div>' . '</div>' . '</nav>'; $this->output($nav_html); }
function doctype() { $this->widgets = get_all_widgets(); // Setup Navigation global $qa_request; //var_dump($qa_request); $this->content['navigation']['user']['widgets'] = array('label' => 'Theme Widgets', 'url' => qa_path_html('widgets'), 'icon' => 'icon-puzzle'); if ($qa_request == 'widgets') { $this->content['navigation']['user']['widgets']['selected'] = true; $this->content['navigation']['user']['selected'] = true; $this->template = "widgets"; $this->content['site_title'] = "Theme Widgets"; $this->content['error'] = ""; $this->content['suggest_next'] = ""; $this->content['title'] = "Theme Widgets"; //$this->content['custom']=''; $saved = false; if (qa_clicked('cs_remove_all_button')) { qa_db_query_sub('TRUNCATE TABLE ^cs_widgets'); $saved = true; } if (qa_clicked('cs_reset_widgets_button')) { $handle = fopen(Q_THEME_DIR . '/demo_content/widget_builder.sql', 'r'); $sql = ''; if ($handle) { while (($line = fgets($handle, 4096)) !== false) { $sql .= trim(' ' . trim($line)); if (substr($sql, -strlen(';')) == ';') { qa_db_query_sub($sql); $sql = ''; } } fclose($handle); } $saved = true; } $cs_page = ' <div id="ra-widgets"> <div class="widget-list col-sm-5"> ' . $this->cs_get_widgets() . ' </div> <div class="widget-postions col-sm-7"> ' . $this->cs_get_widgets_positions() . ' </div> </div> <div class="form-widget-button-holder"> <form class="form-horizontal" method="post"> <input class="qa-form-tall-button btn-primary" type="submit" name="cs_remove_all_button" value="Remove All Widgets" title=""> <input class="qa-form-tall-button btn-primary" type="submit" name="cs_reset_widgets_button" value="Reset All Widgets To Theme Default" title=""> </form> </div> '; $this->content['custom'] = $cs_page; } qa_html_theme_base::doctype(); }
/** * Adds few more links in the admin subnavigation * * @return array */ function donut_admin_sub_navigation() { $navigation = array(); $level = qa_get_logged_in_level(); if ($level >= QA_USER_LEVEL_ADMIN) { $url = 'admin/donut-theme/general-settings'; $navigation[$url] = array('label' => donut_lang('donut_theme_settings'), 'url' => qa_path_html($url)); } return $navigation; }
function mp_announcements_sub_navigation() { $level = qa_get_logged_in_level(); $navigation = array(); if ($level >= QA_USER_LEVEL_EDITOR) { $navigation = array('default' => array('url' => qa_path_html('mp-announcements-page'), 'label' => qa_lang_html('announcements/link_all')), 'create' => array('url' => qa_path_html('mp-announcements-create-page'), 'label' => qa_lang_html('announcements/link_create'))); } else { $navigation = array('default' => array('url' => qa_path_html('mp-announcements-page'), 'label' => qa_lang_html('announcements/link_all'))); } return $navigation; }
function logged_in() { qa_html_theme_base::logged_in(); $qa_login_userid = qa_get_logged_in_userid(); if (isset($qa_login_userid)) { $currentcourse = mp_get_categoryinfo(mp_get_categoryid()); //$this->output('Course: '.$currentcourse['title'] ); //$this->output('<A HREF="'.qa_path_html('mp-change-course-page').'" class="qa-user-link">Change Course</a>'); $this->output('course: <A HREF="' . qa_path_html('mp-change-course-page') . '" class="qa-user-link">' . $currentcourse['title'] . '</a>'); } }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { if (!qa_opt('book_plugin_active')) { return; } $themeobject->output('<h2>' . qa_lang('book/widget_title') . '</h2>'); $out = '<li><a href="' . qa_path_html(qa_opt('book_plugin_request')) . '"></> ' . qa_lang('book/widget_html') . '</a></li>'; if (qa_opt('book_plugin_pdf')) { $out .= '<li><a href="' . qa_path_html(qa_opt('book_plugin_request_pdf')) . '"><img src="http://www.adobe.com/images/pdficon_small.png"> ' . qa_lang('book/widget_pdf') . '</a>'; } $themeobject->output('<ul class="book-widget" style="padding-top:8px;">', $out, '</ul>'); }
function qw_notification_btn() { //if (true){ // check options $userid = qa_get_logged_in_userid(); if (isset($userid)) { $handle = qa_get_logged_in_handle(); $this->output(' <div class="user-actions pull-right"> <div class="activity-bar"> <div class="button dropdown"> <a href="' . qa_path_html('user/' . $handle . '/activity') . '" class=" icon-bullhorn dropdown-toggle activitylist" data-toggle="dropdown" id="activitylist"></a> <div class="dropdown-menu activity-dropdown-list pull-right" id="activity-dropdown-list"> <div class="bar"> <span>' . qa_lang_html('dude/notifications') . '</span> <a class="mark-activity" href="#" data-id="' . qa_get_logged_in_userid() . '">' . qa_lang('dude/mark_all_as_read') . '</a> </div> <div class="append"> <div class="ajax-list"></div> <span class="loading"></span> <div class="no-activity icon-chart-bar">' . qa_lang('dude/no-activity') . '</div> </div> <a class="event-footer" href="' . qa_path_html('notifications', null, QW_BASE_URL) . '">' . qa_lang('dude/see_all') . '</a> </div> </div> </div> <div class="message-bar"> <div class="button dropdown"> <a href="' . qa_path_html('user/' . $handle . '/message') . '" class=" icon-envelope-alt dropdown-toggle messagelist" data-toggle="dropdown" id="messagelist"></a> <div class="dropdown-menu message-dropdown-list pull-right" id="message-dropdown-list"> <div class="bar"> <span>' . qa_lang_html('dude/messages') . '</span> <a class="mark-messages" href="#">' . qa_lang('dude/mark_all_as_read') . '</a> </div> <div class="append"> <div class="ajax-list"></div> <span class="loading"></span> <div class="no-activity icon-chart-bar">' . qa_lang('dude/no-activity') . '</div> </div> <a class="event-footer" href="' . qa_path_html('user/' . $handle . '/wall', null, QW_BASE_URL) . '">' . qa_lang('dude/see_all') . '</a> </div> </div> </div> </div> '); } //} }
function html() { if (qa_post_text('ajax_merge_get_from')) { $posts = qa_db_read_all_assoc(qa_db_query_sub("SELECT postid,title FROM ^posts WHERE postid IN (#,#)", qa_post_text('ajax_merge_get_from'), qa_post_text('ajax_merge_get_to'))); if ($posts[0]['postid'] == (int) qa_post_text('ajax_merge_get_from')) { echo '{"from":"' . $posts[0]['title'] . '","to":"' . $posts[1]['title'] . '","from_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_from'), $posts[0]['title']), null, qa_opt('site_url')) . '","to_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_to'), $posts[1]['title']), null, qa_opt('site_url')) . '"}'; } else { echo '{"from":"' . $posts[1]['title'] . '","to":"' . $posts[0]['title'] . '","from_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_from'), $posts[1]['title']), null, qa_opt('site_url')) . '","to_url":"' . qa_path_html(qa_q_request((int) qa_post_text('ajax_merge_get_to'), $posts[0]['title']), null, qa_opt('site_url')) . '"}'; } return; } qa_html_theme_base::html(); }
function qa_qs_sub_navigation($sort) { $navigation = array('recent' => array('label' => qa_lang('main/nav_most_recent'), 'url' => qa_path_html('questions')), 'hot' => array('label' => qa_lang('main/nav_hot'), 'url' => qa_path_html('questions', array('sort' => 'hot'))), 'votes' => array('label' => qa_lang('main/nav_most_votes'), 'url' => qa_path_html('questions', array('sort' => 'votes'))), 'answers' => array('label' => qa_lang('main/nav_most_answers'), 'url' => qa_path_html('questions', array('sort' => 'answers'))), 'views' => array('label' => qa_lang('main/nav_most_views'), 'url' => qa_path_html('questions', array('sort' => 'views')))); if (isset($navigation[$sort])) { $navigation[$sort]['selected'] = true; } else { $navigation['recent']['selected'] = true; } if (!qa_opt('do_count_q_views')) { unset($navigation['views']); } return $navigation; }
function doctype() { parent::doctype(); if (QA_FINAL_EXTERNAL_USERS) { return; } // check if logged in $handle = qa_get_logged_in_handle(); if (isset($handle)) { if (qa_request() == '' && count($_GET) > 0) { // Check if we need to associate another provider $this->process_login(); } // see if the account pages are accessed $tmpl = array('account', 'favorites'); $user_pages = array('user', 'user-wall', 'user-activity', 'user-questions', 'user-answers'); $logins_page = qa_request() == 'logins' && !qa_get('confirm'); $urlhandle = qa_request_part(1); if (in_array($this->template, $tmpl) || $logins_page || in_array($this->template, $user_pages) && $handle == $urlhandle) { // add a navigation item $this->content['navigation']['sub']['logins'] = array('label' => qa_lang_html('plugin_open/my_logins_nav'), 'url' => qa_path_html('logins'), 'selected' => $logins_page); return; } } else { $title = qa_lang_html('plugin_open/login_title'); $descr = qa_lang_html('plugin_open/login_description'); // hide login/register links from navigation on any page if (qa_opt('open_login_hideform') == '1') { unset($this->content['navigation']['user']['login']); unset($this->content['navigation']['user']['register']); } // then check if login/register pages are accessed $tmpl = array('register', 'login'); if (!in_array($this->template, $tmpl)) { return; } // hide regular login/register form on those pages only if (qa_opt('open_login_hideform') == '1') { $this->content['title'] = $title; $this->content['form'] = null; } // add some custom text if (!empty($this->content['custom'])) { $content = str_ireplace('<BR>', '', $this->content['custom']); $this->content['custom'] = "<div><p>{$descr}</p>{$content}</div>"; if ($this->content['form'] != null) { $this->content['custom'] = "<br /><br /><h1>{$title}</h1>{$this->content['custom']}"; } } } }
function qa_get_users_html($userids, $should_include_link, $relative_url_prefix) { $users = QACASHandler::getUsers($userids); $result = array(); foreach ($users as $userid => $data) { $publicusername = $data['publicusername']; $displayname = isset($data['display']) ? $data['display'] : $publicusername; $result[$userid] = htmlspecialchars($displayname); if ($should_include_link) { $result[$userid] = '<a href="' . qa_path_html('user/' . $publicusername) . '" class="qa-user-link">' . $result[$userid] . '</a>'; } } return $result; }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { require_once QA_INCLUDE_DIR . 'qa-db-metas.php'; $parts = explode('/', $request); $tag = $parts[1]; $description = qa_db_tagmeta_get($tag, 'description'); $editurlhtml = qa_path_html('tag-edit/' . $tag); if (strlen($description)) { echo qa_html($description); echo ' - <A HREF="' . $editurlhtml . '">edit</A>'; } else { echo '<A HREF="' . $editurlhtml . '">Create tag description</A>'; } }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { $temp = qa_db_query_sub('SELECT BINARY title as title, postid, netvotes, acount FROM ^posts WHERE type=$', 'Q'); $max = mysqli_num_rows($temp); if (!$max) { return; } $themeobject->output('<h2>' . qa_opt('random_question_title') . '</h2>'); for ($i = 0; $i < qa_opt('random_question_number'); $i++) { $rand = rand() / getrandmax() * $max; $check = mysqli_data_seek($temp, $rand); if (!$check) { $i--; } else { $random_question = qa_db_read_one_assoc($temp, true); } if (is_array($random_question)) { $votes = (int) $random_question['netvotes']; if ($votes > 0) { if ($votes > 1) { $votes = str_replace('^', '+' . $votes, qa_lang('main/x_votes')); } else { $votes = str_replace('1', '+1', qa_lang('main/1_vote')); } } else { if ($votes < 0) { if ($votes < -1) { $votes = str_replace('^', $votes, qa_lang('main/x_votes')); } else { $votes = str_replace('1', '-1', qa_lang('main/1_vote')); } } else { $votes = ''; } } $answers = (int) $random_question['acount']; if ($answers > 0) { if ($answers > 1) { $answers = str_replace('^', '+' . $answers, qa_lang('main/x_answers')); } else { $answers = qa_lang('main/1_answer'); } } else { $answers = ''; } $themeobject->output('<div class="random-question" style="padding-bottom:4px;"><a href="' . qa_path_html(qa_q_request($random_question['postid'], $random_question['title'])) . '">' . $random_question['title'] . '</a></div><div class="random-question-meta" style="padding-bottom:4px; border-bottom:1px solid; margin-bottom:2px;">' . $votes . ($votes && $answers ? ', ' : '') . $answers . '</div>'); } } }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; $favoritetags = qa_db_single_select(qa_db_user_favorite_tags_selectspec(qa_get_logged_in_userid())); $themeobject->output('<span class="qa-nav-cat-list qa-nav-cat-link">Favorite Tags</span><br>'); foreach ($favoritetags as $k => $v) { if ($k == qa_opt('obvious_max_tags')) { break; } $tag = $v['word']; $count = $v['tagcount']; $question = $count > 1 ? 'questions' : 'question'; $themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" class="qa-tag-link" title="Tagged in ' . $count . ' ' . $question . '">' . qa_html($tag) . '</a>'); } }
function option_default($option) { switch ($option) { case 'admin_plus_notify_text': return 'Plugin updates are available! Visit <a href="' . qa_path_html('admin/plugins', null, qa_opt('site_url')) . '">the plugins page</a> to see available updates.'; case 'admin_plus_notify_hours': return 1; case 'admin_plus_dropdown': return true; case 'admin_plus_notify_checked': return time(); default: return null; } }
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { if (isset($qa_content['categoryids'])) { $params = array('cat' => end($qa_content['categoryids'])); } else { $params = null; } $themeobject->output('<div class="ra-ask-widget">'); $themeobject->output('<form action="' . qa_path_html('ask', $params) . '" method="post">', '<div class="input-group"> <input type="text" name="title" class="form-control" id="ra-ask-search" placeholder="' . qa_lang_html('cleanstrap/askbox_placeholder') . '"> <span class="input-group-btn"> <button class="icon-question btn" type="submit">' . qa_lang_html('cleanstrap/askbox_ask') . '</button> </span> </div>', '<input type="hidden" value="1" name="doask1">', '</form>'); $themeobject->output('</div>'); }
function nav($navtype, $level = null) { if (qa_opt(self::ENABLE) && qa_opt(self::REQUEST) != '') { if ($navtype == 'sub') { $request = strtolower(qa_request_part(0)); if ($request == 'account' || $request == 'favorites' || $request == qa_opt(self::REQUEST)) { //$this->content['suggest_next']=qa_lang_html_sub('misc/suggest_favorites_add', '<SPAN CLASS="qa-favorite-image"> </SPAN>'); if (!QA_FINAL_EXTERNAL_USERS) { $this->content['navigation']['sub'] = qa_account_sub_navigation(); $this->content['navigation']['sub'][qa_opt(self::REQUEST)] = array('label' => qa_lang_html(self::PLUGIN . '/' . self::PAGE_NAVI), 'url' => qa_path_html(qa_opt(self::REQUEST))); } } } } qa_html_theme_base::nav($navtype, $level = null); }