function q_view_main($q_view)
 {
     if (qa_opt('ajax_comment_enable') && !$this->qa_state && $this->can_comment) {
         $this->output('<img style="display:none" src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'ajax-loader.gif" />');
         // this preloads the ajax loader gif
         $q_view['c_form'] = $this->qa_ajax_comment_form(null);
         if (isset($q_view['a_form'])) {
             $v = $q_view['a_form'];
             $q_view['a_form'] = $q_view['c_form'];
             $q_view['c_form'] = $v;
         }
     }
     qa_html_theme_base::q_view_main($q_view);
 }
 function q_view_main($q_main)
 {
     qa_html_theme_base::q_view_main($q_main);
     if (qa_opt('short_url_content_on')) {
         $login = qa_opt('short_url_bitly_username');
         $api_key = qa_opt('short_url_bitly_api_key');
         $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         $api_url = "http://api.bit.ly/v3/shorten?login="******"&apiKey=" . $api_key . "&uri=" . urlencode($url) . "&format=txt";
         if (qa_opt($url)) {
             $short_url = qa_opt($url);
         } else {
             $short_url = file_get_contents($api_url);
             qa_opt($url, $short_url);
         }
         $this->output('<input value="' . $short_url . '">');
     }
 }
示例#3
0
 function q_view_main($q_view)
 {
     qa_html_theme_base::q_view_main($q_view);
     // badge check on view update
     if (qa_opt('badge_active') && isset($this->content['inc_views_postid'])) {
         $uid = $q_view['raw']['userid'];
         if (!$uid) {
             return;
         }
         // anonymous
         $oid = $this->content['inc_views_postid'];
         // total views check
         $views = $q_view['raw']['views'];
         $views++;
         // because we haven't incremented the views yet
         $badges = array('notable_question', 'popular_question', 'famous_question');
         qa_badge_award_check($badges, $views, $uid, $oid, 2);
         // personal view count increase and badge check
         $uid = qa_get_logged_in_userid();
         qa_db_query_sub('UPDATE ^achievements SET questions_read=questions_read+1 WHERE user_id=# ', $uid);
         $views = qa_db_read_one_value(qa_db_query_sub('SELECT questions_read FROM ^achievements WHERE user_id=# ', $uid), true);
         $badges = array('reader', 'avid_reader', 'devoted_reader');
         qa_badge_award_check($badges, $views, $uid, null, 2);
     }
 }
示例#4
0
 function q_view_main($q_view)
 {
     if ($this->is_print_view) {
         $this->output('<DIV CLASS="qa-q-view-main">');
         $this->q_view_content($q_view);
         $this->q_view_follows($q_view);
         $this->post_tags($q_view, 'qa-q-view');
         $this->post_meta($q_view, 'qa-q-view');
         $this->c_list(@$q_view['c_list'], 'qa-q-view');
         $this->form(@$q_view['a_form']);
         $this->c_list(@$q_view['a_form']['c_list'], 'qa-a-item');
         $this->form(@$q_view['c_form']);
         $this->output('</DIV> <!-- END qa-q-view-main -->');
     } else {
         qa_html_theme_base::q_view_main($q_view);
     }
 }