Example #1
0
 function c_item_content($c_item)
 {
     if (qa_opt('embed_smileys') && isset($c_item['content'])) {
         $c_item['content'] = $this->smiley_replace($c_item['content']);
     }
     qa_html_theme_base::c_item_content($c_item);
 }
 function head_css()
 {
     qa_html_theme_base::head_css();
     if (strlen(qa_opt('facebook_app_id')) && strlen(qa_opt('facebook_app_secret'))) {
         $this->output('<style><!--', '.fb-login-button.fb_iframe_widget.fb_hide_iframes span {display:none;}', '--></style>');
     }
 }
    function head_custom()
    {
        qa_html_theme_base::head_custom();
        if (in_array($this->template, array('question', 'ask', 'not-found')) && qa_opt('confirm_close_plugin')) {
            $this->output('<script type="text/javascript">
jQuery("document").ready(function() {

	jQuery("form").submit(function(event) {
		window.onbeforeunload = null;
	});

	window.onbeforeunload = function(event) {
		var content = false
		jQuery("textarea:visible").each( function() {
			if(this.value) {
				content = true;
				return false;
			}
		});
		if (content)
			return "You have entered text; are you sure you wish to leave this page?";

	}
});
</script>');
        }
    }
Example #4
0
 function body_prefix()
 {
     qa_html_theme_base::body_prefix();
     if ($this->notify) {
         $this->output($this->notify);
     }
 }
Example #5
0
 function head_custom()
 {
     if ($this->template == 'admin') {
         $this->output("\n\t<script>\t\t\t\n\tfunction mergePluginGetPosts() {\n\t\tvar from=jQuery('#merge_from').val();\n\t\tvar to=jQuery('#merge_to').val();\n\n\t\tvar dataString = 'ajax_merge_get_from='+from+'&ajax_merge_get_to='+to;  \n\t\tjQuery.ajax({  \n\t\t  type: 'POST',  \n\t\t  url: '" . qa_self_html() . "',  \n\t\t  data: dataString,  \n\t\t  dataType: 'json',  \n\t\t  success: function(json) {\n\t\t\t\tjQuery('#merge_from_out').html('Merging from: <a href=\"'+json.from_url+'\">'+json.from+'</a>');\n\t\t\t\tjQuery('#merge_to_out').html('To: <a href=\"'+json.to_url+'\">'+json.to+'</a>');\n\t\t\t} \n\t\t});\n\t\treturn false;\n\t}\n\t</script>");
     }
     qa_html_theme_base::head_custom();
 }
Example #6
0
 public function q_list($q_list)
 {
     if (!empty($q_list['qs']) && qa_opt('mouseover_content_on')) {
         // first check it is not an empty list and the feature is turned on
         // Collect the question ids of all items in the question list (so we can do this in one DB query)
         $postids = array();
         foreach ($q_list['qs'] as $question) {
             if (isset($question['raw']['postid'])) {
                 $postids[] = $question['raw']['postid'];
             }
         }
         if (!empty($postids)) {
             // Retrieve the content for these questions from the database and put into an array fetching
             // the minimal amount of characters needed to determine the string should be shortened or not
             $maxlength = qa_opt('mouseover_content_max_len');
             $result = qa_db_query_sub('SELECT postid, LEFT(content, #) content, format FROM ^posts WHERE postid IN (#)', $maxlength + 1, $postids);
             $postinfo = qa_db_read_all_assoc($result, 'postid');
             // Get the regular expression fragment to use for blocked words and the maximum length of content to show
             $blockwordspreg = qa_get_block_words_preg();
             // Now add the popup to the title for each question
             foreach ($q_list['qs'] as $index => $question) {
                 if (isset($postinfo[$question['raw']['postid']])) {
                     $thispost = $postinfo[$question['raw']['postid']];
                     $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                     $text = qa_shorten_string_line($text, $maxlength);
                     $title = isset($question['title']) ? $question['title'] : '';
                     $q_list['qs'][$index]['title'] = sprintf('<span title="%s">%s</span>', qa_html($text), $title);
                 }
             }
         }
     }
     qa_html_theme_base::q_list($q_list);
     // call back through to the default function
 }
Example #7
0
 function c_item_content($c_item)
 {
     if (isset($c_item['content'])) {
         $c_item['content'] = $this->embed_replace($c_item['content']);
     }
     qa_html_theme_base::c_item_content($c_item);
 }
 function q_list($q_list)
 {
     if (count(@$q_list['qs']) && qa_opt('mouseover_content_on')) {
         // first check it is not an empty list and the feature is turned on
         //	Collect the question ids of all items in the question list (so we can do this in one DB query)
         $postids = array();
         foreach ($q_list['qs'] as $question) {
             if (isset($question['raw']['postid'])) {
                 $postids[] = $question['raw']['postid'];
             }
         }
         if (count($postids)) {
             //	Retrieve the content for these questions from the database and put into an array
             $result = qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids);
             $postinfo = qa_db_read_all_assoc($result, 'postid');
             //	Get the regular expression fragment to use for blocked words and the maximum length of content to show
             $blockwordspreg = qa_get_block_words_preg();
             $maxlength = qa_opt('mouseover_content_max_len');
             //	Now add the popup to the title for each question
             foreach ($q_list['qs'] as $index => $question) {
                 $thispost = @$postinfo[$question['raw']['postid']];
                 if (isset($thispost)) {
                     $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                     $text = qa_shorten_string_line($text, $maxlength);
                     $q_list['qs'][$index]['title'] = '<SPAN TITLE="' . qa_html($text) . '">' . @$question['title'] . '</SPAN>';
                 }
             }
         }
     }
     qa_html_theme_base::q_list($q_list);
     // call back through to the default function
 }
 public function q_list($q_list)
 {
     if (!empty($q_list['qs']) && qa_opt('mouseover_content_on')) {
         // first check it is not an empty list and the feature is turned on
         // Collect the question ids of all items in the question list (so we can do this in one DB query)
         $postids = array();
         foreach ($q_list['qs'] as $question) {
             if (isset($question['raw']['postid'])) {
                 $postids[] = $question['raw']['postid'];
             }
         }
         if (!empty($postids)) {
             // Retrieve the content for these questions from the database
             $maxlength = qa_opt('mouseover_content_max_len');
             $result = qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids);
             $postinfo = qa_db_read_all_assoc($result, 'postid');
             // Get the regular expression fragment to use for blocked words and the maximum length of content to show
             $blockwordspreg = qa_get_block_words_preg();
             // Now add the popup to the title for each question
             foreach ($q_list['qs'] as $index => $question) {
                 if (isset($postinfo[$question['raw']['postid']])) {
                     $thispost = $postinfo[$question['raw']['postid']];
                     $text = qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
                     $text = preg_replace('/\\s+/', ' ', $text);
                     // Remove duplicated blanks, new line characters, tabs, etc
                     $text = qa_shorten_string_line($text, $maxlength);
                     $title = isset($question['title']) ? $question['title'] : '';
                     $q_list['qs'][$index]['title'] = $this->getHtmlTitle(qa_html($text), $title);
                 }
             }
         }
     }
     parent::q_list($q_list);
     // call back through to the default function
 }
 function head_custom()
 {
     parent::head_custom();
     $tmpl = array('ask', 'question');
     if (!in_array($this->template, $tmpl)) {
         return;
     }
     $hidecss = qa_opt($this->cssopt) === '1';
     $usehljs = qa_opt($this->hljsopt) === '1';
     $wmd_buttons = QA_HTML_THEME_LAYER_URLTOROOT . 'pagedown/wmd-buttons.png';
     $this->output_raw("<style>\n" . ".wmd-button > span { background-image: url('{$wmd_buttons}') }\n");
     // display CSS for Markdown Editor
     if (!$hidecss) {
         $cssWMD = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/wmd.css');
         $this->output_raw($cssWMD);
         // display CSS for HighlightJS
         if ($usehljs) {
             $cssHJS = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/highlightjs.css');
             $this->output_raw($cssHJS);
         }
     }
     $this->output_raw("</style>\n\n");
     // set up HighlightJS
     if ($usehljs) {
         $this->output_raw("<script src=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/highlight.min.js\"></script>\n" . "<script type=\"text/javascript\">\n" . "\$(function(){\n" . "\t\$('.wmd-input').keypress(function(){\n" . "\t\twindow.clearTimeout(hljs.Timeout);\n" . "\t\thljs.Timeout = window.setTimeout(function() {\n" . "\t\t\thljs.initHighlighting.called = false;\n" . "\t\t\thljs.initHighlighting();\n" . "\t\t}, 500);\n" . "\t});\n" . "\twindow.setTimeout(function() {\n" . "\t\thljs.initHighlighting.called = false;\n" . "\t\thljs.initHighlighting();\n" . "\t}, 500);\n" . "});\n" . "</script>\n\n");
     }
     //by hoangweb
     //$cssHJS = file_get_contents( QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/hoangweb/dropzone.css' ); //print css
     /*$this->output_raw("<style>\n");
       $this->output_raw($cssHJS);
       $this->output_raw("</style>\n\n");*/
     $this->output_raw("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/hoangweb/dropzone.css\"/>");
     $this->output_raw("<link rel=\"stylesheet\" type=\"text/css\" href=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/hoangweb/style.css\"/>");
     $this->output_raw("<script src=\"" . QA_HTML_THEME_LAYER_URLTOROOT . "pagedown/hoangweb/dropzone.js\"></script>");
 }
 public function head_custom()
 {
     parent::head_custom();
     $allowed_tmpl = qa_opt($this->allowed_templates_opt);
     if (strlen($allowed_tmpl)) {
         $tmpl = explode(',', $allowed_tmpl);
     } else {
         //fall back for the defaults if the option is not set from the admin panel
         $tmpl = array('ask', 'question');
     }
     if (!in_array($this->template, $tmpl)) {
         return;
     }
     $hidecss = qa_opt($this->cssopt) === '1';
     $usehljs = qa_opt($this->hljsopt) === '1';
     $wmd_buttons = QA_HTML_THEME_LAYER_URLTOROOT . 'pagedown/wmd-buttons.png';
     $this->output_raw("<style>\n" . ".wmd-button > span { background-image: url('{$wmd_buttons}') }\n");
     // display CSS for Markdown Editor
     if (!$hidecss) {
         $cssWMD = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/wmd.css');
         $this->output_raw($cssWMD);
         // display CSS for HighlightJS
         if ($usehljs) {
             $cssHJS = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/highlightjs.css');
             $this->output_raw($cssHJS);
         }
     }
     $this->output_raw("</style>\n\n");
     // set up HighlightJS
     if ($usehljs) {
         $js = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'pagedown/highlightjs-run.js');
         $this->output_raw('<script src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'pagedown/highlight.min.js"></script>' . '<script>' . $js . '</script>');
     }
 }
Example #12
0
    function head_custom()
    {
        parent::head_custom();
        if ($this->template != 'plugin' || $this->request != 'chat') {
            return;
        }
        $hidecss = qa_opt($this->optcss) === '1';
        if (!$hidecss) {
            $chat_css = '
				<style>
				#qa-chat-form { text-align: center; }
				.qa-chat-post { width: 600px; }
				#qa-chat-list, .qa-chat-item, #qa-chat-user-list, .qa-chat-user-item { display: block; list-style: none; margin: 0; padding: 0; font-size: 13px;  line-height: 1.4; }
				#qa-chat-list { width: 728px; margin: 1em auto; }
				.qa-chat-item { overflow: hidden; padding: 4px 0; border-top: 1px solid #eee; }
				.qa-chat-item:last-child { border-bottom: 1px solid #eee; }
				.qa-chat-item-meta { float: left; width: 110px; padding-right: 20px; font-size: 11px; color: #999; text-align: right; }
				.qa-chat-item-data { float: left; width: 598px; }
				.qa-chat-user-item { padding: 2px 4px; }
				.qa-chat-user-item:hover { background: rgba(255,255,255,0.4); }
				.qa-chat-idle, .qa-chat-idle > a { color: #aaa; }

				.qa-chat-kick { float: right; cursor: pointer; width: 10px; height: 10px; border-radius: 10px; background: #999; margin-top: 5px; }
				.qa-chat-kick:hover { background: #f00; }
				.qa-chat-service { background: #fffae4; }
				</style>';
            $this->output_raw($chat_css);
        }
    }
 function attribution()
 {
     // Please see the license at the top of this file before changing this link. Thank you.
     qa_html_theme_base::attribution();
     // modxclub [start] Please erase. Use this theme according to license of Question2Answer.
     $this->output('<DIV CLASS="qa-designedby">', 'Designed by <A HREF="http://www.axiologic.ro">Axiologic SaaS</A>', '</DIV>');
     // modxclub [end]
 }
Example #14
0
 function attribution()
 {
     // Please see the license at the top of this file before changing this link. Thank you.
     qa_html_theme_base::attribution();
     // modxclub [start] Please erase. Use this theme according to license of Question2Answer.
     $this->output('<div class="qa-attribution">, R2L Edition by <a href="http://www.Tohid.ir.tc" title="Freelance Web Designer, Programmer, Security Consultant">', 'Towhid Nategheian</a>', '</div>');
     // modxclub [end]
 }
 function main_parts($content)
 {
     if ($this->template == 'user' && qa_get('tab') == 'history' && qa_opt('event_logger_to_database') && qa_opt('user_act_list_active')) {
         $content = array();
         $content['form-activity-list'] = $this->user_activity_form();
     }
     qa_html_theme_base::main_parts($content);
 }
 function doctype()
 {
     qa_html_theme_base::doctype();
     $qw_notification_id = qa_get('ra_notification');
     if (isset($qw_notification_id)) {
         qw_set_notification_as_read($qw_notification_id);
     }
 }
 function nav_list($navigation, $navtype, $level = null)
 {
     // remove the registration link unless normal login AND allow registration booleans are set in options
     if (!(qa_opt('ldap_login_allow_normal') && qa_opt('ldap_login_allow_registration'))) {
         unset($navigation['register']);
     }
     qa_html_theme_base::nav_list($navigation, $navtype);
 }
 function body_script()
 {
     qa_html_theme_base::body_script();
     if ($this->jsTOS) {
         $error = qa_opt('tos_error');
         $this->output('<script type="text/javascript">', "\n\t\t\t\t\$(document).ready(function(e) {  \n\t\t\t\t\t\$('#register').click(function() {\n\t\t\t\t\t\tif (jQuery('#TOS').is(':checked')){\n\t\t\t\t\t\t\t\$('.qa-waiting').show();\n\t\t\t\t\t\t\t\$('#TOSvalidation').remove();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\$('#TOSvalidation').parent().parent().remove();\n\t\t\t\t\t\t\t\$('#TOS').parent().parent().append( '<tr><td class=\"qa-form-tall-data\"><div id=\"TOSvalidation\" class=\"qa-form-tall-error\">" . $error . "</div></td></tr>' );\n\t\t\t\t\t\t\t\$('.qa-waiting').hide();\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\t", '</script>');
     }
 }
 function body_prefix()
 {
     if (!qa_get_logged_in_userid() && !@$_COOKIE['qa_faq_noshow'] && qa_opt('faq_notify_show')) {
         setcookie('qa_faq_noshow', 'true', 0, '/', QA_COOKIE_DOMAIN);
         $this->faq_notify();
     }
     qa_html_theme_base::body_prefix();
 }
 function q_view($q_view)
 {
     // position before question [replaced by `title-after`]
     // $this->_output_widget('q-item-before');
     parent::q_view($q_view);
     // position after question
     $this->_output_widget('q-item-after');
 }
 function main_parts($content)
 {
     $userid = qa_get_logged_in_userid();
     if (qa_opt('news_plugin_active') && $this->template == 'user' && qa_opt('news_plugin_send') && !qa_get('tab') && $content['raw']['userid'] == $userid) {
         $content['form-newsletter'] = $this->newsletterForm();
     }
     qa_html_theme_base::main_parts($content);
 }
 function head_custom()
 {
     parent::head_custom();
     if (qa_opt('qa_btt_enabled')) {
         $script = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'js/qa-btt.js');
         $script = str_replace('QA_PLUGINDIR', QA_HTML_THEME_LAYER_URLTOROOT, $script);
         $this->output_raw('<script>' . $script . '</script>');
     }
 }
Example #23
0
 public function doctype()
 {
     $main = new qa_caching_main();
     if ($main->now_caching()) {
         if (isset($this->content['notices'])) {
             unset($this->content['notices']);
         }
     }
     qa_html_theme_base::doctype();
 }
 function form_button_data($button, $key, $style)
 {
     if ($this->forbid_new_tag() && $key === 'ask') {
         $baseclass = 'qa-form-' . $style . '-button qa-form-' . $style . '-button-' . $key;
         $hoverclass = 'qa-form-' . $style . '-hover qa-form-' . $style . '-hover-' . $key;
         $this->output('<INPUT' . rtrim(' ' . @$button['tags']) . ' onclick="qa_tag_verify();" VALUE="' . @$button['label'] . '" TITLE="' . @$button['popup'] . '" TYPE="button" CLASS="' . $baseclass . '" onmouseover="this.className=\'' . $hoverclass . '\';" onmouseout="this.className=\'' . $baseclass . '\';"/>');
     } else {
         qa_html_theme_base::form_button_data($button, $key, $style);
     }
 }
 function ranking_label($item, $class)
 {
     if (qa_opt('marker_plugin_w_users') && $class == 'qa-top-users') {
         $handle = strip_tags($item['label']);
         $uid = $this->getuserfromhandle($handle);
         $image = $this->get_role_marker($uid, 2);
         $item['label'] = $image . $item['label'];
     }
     qa_html_theme_base::ranking_label($item, $class);
 }
Example #26
0
 function form_field($field, $style)
 {
     if (@$field['type'] == 'ra_qaads_multi_text') {
         $this->form_prefix($field, $style);
         $this->ra_qaads_form_multi_text($field, $style);
         $this->form_suffix($field, $style);
     } else {
         qa_html_theme_base::form_field($field, $style);
         // call back through to the default function
     }
 }
    function q_view_clear()
    {
        // call default method output
        qa_html_theme_base::q_view_clear();
        // return if not admin!
        if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
            return;
        }
        // check if question is duplicate
        $closed = @$this->content['q_view']['raw']['closedbyid'] !== null;
        if ($closed) {
            // check if duplicate
            $duplicate = qa_db_read_one_value(qa_db_query_sub('SELECT postid FROM `^posts` 
																		WHERE `postid` = #
																		AND `type` = "Q"
																		;', $this->content['q_view']['raw']['closedbyid']), true);
            if ($duplicate) {
                $this->output('<div id="mergeDup" style="margin:10px 0 0 120px;padding:5px 10px;background:#FCC;border:1px solid #AAA;"><h3>Merge Duplicate:</h3>');
                // form output
                $this->output('
<FORM METHOD="POST">
<TABLE>
	<TR>
		<TD CLASS="qa-form-tall-label">
			From: &nbsp;
			<INPUT NAME="merge_from" id="merge_from" TYPE="text" VALUE="' . $this->content['q_view']['raw']['postid'] . '" CLASS="qa-form-tall-number">
			&nbsp; To: &nbsp;
			<INPUT NAME="merge_to" id="merge_to" TYPE="text" VALUE="' . $this->content['q_view']['raw']['closedbyid'] . '" CLASS="qa-form-tall-number">
		</TD>
	</TR>
	<TR>
		<TD CLASS="qa-form-tall-label">
		Text to show when redirecting from merged question:
		</TD>
	</TR>
	<TR>
		<TD CLASS="qa-form-tall-label">
		<INPUT NAME="merge_question_merged" id="merge_question_merged" TYPE="text" VALUE="' . qa_opt('merge_question_merged') . '" CLASS="qa-form-tall-text">
		</TD>
	</TR>
	<TR>
		<TD style="text-align:right;">
			<INPUT NAME="merge_question_process" VALUE="Merge" TITLE="" TYPE="submit" CLASS="qa-form-tall-button qa-form-tall-button-0">
		</TD>

	</TR>
	
</TABLE>
</FORM>				');
                $this->output('</div>');
            }
        }
    }
 function a_count($post)
 {
     if (qa_opt('ccount') && isset($post['answers'])) {
         $this->output('<div class="qa-ac-count">');
         qa_html_theme_base::a_count($post);
         $comments = qa_db_read_one_value(qa_db_query_sub("SELECT COUNT(postid) FROM ^posts WHERE (parentid=# OR parentid IN (SELECT postid FROM ^posts WHERE parentid=#)) AND type='C'", $post['raw']['postid'], $post['raw']['postid']));
         $this->output_split(array('prefix' => '', 'data' => $comments, 'suffix' => ' comments'), 'qa-c-count', 'SPAN', 'SPAN');
         $this->output('</div>');
     } else {
         qa_html_theme_base::a_count($post);
     }
 }
Example #29
0
 function footer()
 {
     qa_html_theme_base::footer();
     if (@$this->content['q_view']) {
         if (qa_opt('share_plugin_twitter')) {
             $this->output('<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>');
         }
         if (qa_opt('share_plugin_google')) {
             $this->output('<script type="text/javascript">(function() {var po = document.createElement("script"); po.type = "text/javascript"; po.async = true;po.src = "https://apis.google.com/js/plusone.js";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(po, s);})();</script>');
         }
     }
 }
 function head_custom()
 {
     parent::head_custom();
     if (qa_opt('qa_eql_enabled')) {
         $ias_call = file_get_contents(QA_HTML_THEME_LAYER_DIRECTORY . 'js/qa-eql.js');
         $ias_call = str_replace('QA_PLUGINDIR', QA_HTML_THEME_LAYER_URLTOROOT, $ias_call);
         $this->output_raw('<script>' . $ias_call . '</script>');
         if (qa_opt('qa_eql_include')) {
             $this->output_raw('<script type="text/javascript" src="' . QA_HTML_THEME_LAYER_URLTOROOT . 'js/jquery-ias-min.js"></script>');
         }
     }
 }