Example #1
0
 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>');
 }
Example #2
0
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
     reset($populartags);
     $maxcount = current($populartags);
     $themeobject->output('<H2 STYLE="margin-top:0; padding-top:0;">', qa_lang_html('main/popular_tags'), '</H2>');
     $themeobject->output('<DIV STYLE="font-size:10px;">');
     $maxsize = qa_opt('tag_cloud_font_size');
     $scale = qa_opt('tag_cloud_size_popular');
     foreach ($populartags as $tag => $count) {
         $size = number_format($scale ? $maxsize * $count / $maxcount : $maxsize, 1);
         if ($size >= 5 || !$scale) {
             $themeobject->output('<A HREF="' . qa_path_html('tag/' . $tag) . '" STYLE="font-size:' . $size . 'px; vertical-align:baseline;">' . qa_html($tag) . '</A>');
         }
     }
     $themeobject->output('</DIV>');
 }
Example #3
0
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     $widget_opt = @$themeobject->current_widget['param']['options'];
     if (@$themeobject->current_widget['param']['locations']['show_title']) {
         $themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/tags') . '<a href="' . qa_path_html('tags') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>');
     }
     $to_show = (int) $widget_opt['cs_tags_count'];
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, !empty($to_show) ? $to_show : 20));
     reset($populartags);
     $themeobject->output('<div class="ra-tags-widget clearfix">');
     $blockwordspreg = qa_get_block_words_preg();
     foreach ($populartags as $tag => $count) {
         if (count(qa_block_words_match_all($tag, $blockwordspreg))) {
             continue;
         }
         // skip censored tags
         $themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" class="widget-tag">' . qa_html($tag) . '<span>' . $count . '</span></a>');
     }
     $themeobject->output('</div>');
 }
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, (int) qa_opt('tag_cloud_count_tags')));
     reset($populartags);
     $maxcount = current($populartags);
     $themeobject->output('<h2 style="margin-top:0; padding-top:0;">', qa_lang_html('main/popular_tags'), '</h2>');
     $themeobject->output('<div style="font-size:10px;">');
     $maxsize = qa_opt('tag_cloud_font_size');
     $scale = qa_opt('tag_cloud_size_popular');
     $blockwordspreg = qa_get_block_words_preg();
     foreach ($populartags as $tag => $count) {
         if (count(qa_block_words_match_all($tag, $blockwordspreg))) {
             continue;
         }
         // skip censored tags
         $size = number_format($scale ? $maxsize * $count / $maxcount : $maxsize, 1);
         if ($size >= 5 || !$scale) {
             $themeobject->output('<a href="' . qa_path_html('tag/' . $tag) . '" style="font-size:' . $size . 'px; vertical-align:baseline;">' . qa_html($tag) . '</a>');
         }
     }
     $themeobject->output('</div>');
 }
Example #5
0
    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-util-sort.php';
//	Check whether this is a follow-on question and get some info we need from the database
$in = array();
$followpostid = qa_get('follow');
$in['categoryid'] = qa_get_category_field_value('category');
if (!isset($in['categoryid'])) {
    $in['categoryid'] = qa_get('cat');
}
$userid = qa_get_logged_in_userid();
list($categories, $followanswer, $completetags) = qa_db_select_with_pending(qa_db_category_nav_selectspec($in['categoryid'], true), isset($followpostid) ? qa_db_full_post_selectspec($userid, $followpostid) : null, qa_db_popular_tags_selectspec(0, QA_DB_RETRIEVE_COMPLETE_TAGS));
if (!isset($categories[$in['categoryid']])) {
    $in['categoryid'] = null;
}
if (@$followanswer['basetype'] != 'A') {
    $followanswer = null;
}
//	Check for permission error
$permiterror = qa_user_maximum_permit_error('permit_post_q', QA_LIMIT_QUESTIONS);
if ($permiterror) {
    $qa_content = qa_content_prepare();
    // The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here
    // The other option ('level') prevents the menu option being shown, in qa_content_prepare(...)
    switch ($permiterror) {
        case 'login':
            $qa_content['error'] = qa_insert_login_links(qa_lang_html('question/ask_must_login'), qa_request(), isset($followpostid) ? array('follow' => $followpostid) : null);
            qa_redirect(qa_q_request($questionid, $qin['title']));
        } else {
            $formtype = 'q_edit';
            // keep editing if an error
            $pageerror = @$qerrors['page'];
            // for security code failure
        }
    } else {
        if ($pagestate == 'edit-' . $questionid && qa_page_q_permit_edit($question, 'permit_edit_q', $pageerror, 'permit_retag_cat')) {
            $formtype = 'q_edit';
        }
    }
    if ($formtype == 'q_edit') {
        // get tags for auto-completion
        if (qa_opt('do_complete_tags')) {
            $completetags = array_keys(qa_db_select_with_pending(qa_db_popular_tags_selectspec(0, QA_DB_RETRIEVE_COMPLETE_TAGS)));
        } else {
            $completetags = array();
        }
    }
}
//	Process adding a comment to question (shows form or processes it)
if ($question['commentbutton']) {
    if (qa_clicked('q_docomment')) {
        qa_page_q_refresh($pagestart, 'comment-' . $questionid);
    }
    if (qa_clicked('c' . $questionid . '_doadd') || $pagestate == 'comment-' . $questionid) {
        qa_page_q_do_comment($question, $question, $commentsfollows, $pagestart, $usecaptcha, $cnewin, $cnewerrors, $formtype, $formpostid, $pageerror);
    }
}
//	Process clicked buttons for answers
Example #7
0
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
//	Get popular tags
$populartags = qa_db_select_with_pending(qa_db_popular_tags_selectspec($qa_start));
$tagcount = qa_opt('cache_tagcount');
$pagesize = qa_opt('page_size_tags');
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/popular_tags');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_tags')), 'type' => 'tags');
if (count($populartags)) {
    $output = 0;
    foreach ($populartags as $word => $count) {
        $qa_content['ranking']['items'][] = array('label' => qa_tag_html($word), 'count' => number_format($count));
        if (++$output >= $pagesize) {
            break;
        }
    }
} else {
Example #8
0
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
//	Get popular tags
$start = qa_get_start();
$userid = qa_get_logged_in_userid();
$populartags = qa_db_select_with_pending(qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags')));
$tagcount = qa_opt('cache_tagcount');
$pagesize = qa_opt('page_size_tags');
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('main/popular_tags');
$qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_tags')), 'type' => 'tags');
if (count($populartags)) {
    $favoritemap = qa_get_favorite_non_qs_map();
    $output = 0;
    foreach ($populartags as $word => $count) {
        $qa_content['ranking']['items'][] = array('label' => qa_tag_html($word, false, @$favoritemap['tag'][qa_strtolower($word)]), 'count' => number_format($count));
        if (++$output >= $pagesize) {
            break;
        }
    }
Example #9
0
function cs_tag_list($limit = 20)
{
    $populartags = qa_db_single_select(qa_db_popular_tags_selectspec(0, $limit));
    $i = 1;
    foreach ($populartags as $tag => $count) {
        echo '<li><a class="icon-tag" href="' . qa_path_html('tag/' . $tag) . '">' . qa_html($tag) . '<span>' . filter_var($count, FILTER_SANITIZE_NUMBER_INT) . '</span></a></li>';
    }
}
         $categoryslug = $category['tags'];
     } else {
         $categoryslug = 'example-category';
     }
     if (qa_opt('feed_for_qa')) {
         $feedrequest = 'qa';
     } elseif (qa_opt('feed_for_questions')) {
         $feedrequest = 'questions';
     } else {
         $feedrequest = 'activity';
     }
     $feedrequest .= '/' . $categoryslug;
     $feedisexample = true;
     break;
 case 'feed_for_tag_qs':
     $populartags = qa_db_select_with_pending(qa_db_popular_tags_selectspec(0, 1));
     if (count($populartags)) {
         reset($populartags);
         $feedrequest = 'tag/' . key($populartags);
     } else {
         $feedrequest = 'tag/singing';
     }
     $feedisexample = true;
     break;
 case 'feed_for_search':
     $feedrequest = 'search/why do birds sing';
     $feedisexample = true;
     break;
 case 'moderate_users':
     $optionfield['note'] = '<a href="' . qa_path_html('admin/users', null, null, null, 'profile_fields') . '">' . qa_lang_html('admin/registration_fields') . '</a>';
     break;