as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ require_once QA_INCLUDE_DIR . 'qa-app-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-cookies.php'; require_once QA_INCLUDE_DIR . 'qa-app-favorites.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; $entitytype = qa_post_text('entitytype'); $entityid = qa_post_text('entityid'); $setfavorite = qa_post_text('favorite'); $userid = qa_get_logged_in_userid(); if (!qa_check_form_security_code('favorite-' . $entitytype . '-' . $entityid, qa_post_text('code'))) { echo "QA_AJAX_RESPONSE\n0\n" . qa_lang('misc/form_security_reload'); } elseif (isset($userid)) { $cookieid = qa_cookie_get(); qa_user_favorite_set($userid, qa_get_logged_in_handle(), $cookieid, $entitytype, $entityid, $setfavorite); $favoriteform = qa_favorite_form($entitytype, $entityid, $setfavorite, qa_lang($setfavorite ? 'main/remove_favorites' : 'main/add_favorites')); $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-favorite', null, null); echo "QA_AJAX_RESPONSE\n1\n"; $themeclass->favorite_inner_html($favoriteform); } /* Omit PHP closing tag to help avoid accidental output */
$parentid = qa_post_text('parentid'); $userid = qa_get_logged_in_userid(); list($comment, $question, $parent, $children) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $commentid), qa_db_full_post_selectspec($userid, $questionid), qa_db_full_post_selectspec($userid, $parentid), qa_db_full_child_posts_selectspec($userid, $parentid)); // Check if there was an operation that succeeded if (@$comment['basetype'] == 'C' && @$question['basetype'] == 'Q' && (@$parent['basetype'] == 'Q' || @$parent['basetype'] == 'A')) { $comment = $comment + qa_page_q_post_rules($comment, $parent, $children, null); // array union if (qa_page_q_single_click_c($comment, $question, $parent, $error)) { $comment = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $commentid)); // If so, page content to be updated via Ajax echo "QA_AJAX_RESPONSE\n1"; // If the comment was not deleted... if (isset($comment)) { $parent = $parent + qa_page_q_post_rules($parent, $questionid == $parentid ? null : $question, null, $children); // in theory we should retrieve the parent's siblings for the above, but they're not going to be relevant $comment = $comment + qa_page_q_post_rules($comment, $parent, $children, null); $usershtml = qa_userids_handles_html(array($comment), true); $c_view = qa_page_q_comment_view($question, $parent, $comment, $usershtml, false); $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-comment', null, null); // ... send back the HTML for it echo "\n"; $themeclass->c_list_item($c_view); } return; } } echo "QA_AJAX_RESPONSE\n0\n"; // fall back to non-Ajax submission if something failed /* Omit PHP closing tag to help avoid accidental output */
require_once QA_INCLUDE_DIR . 'app/users.php'; require_once QA_INCLUDE_DIR . 'app/cookies.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; $message = qa_post_text('message'); $tohandle = qa_post_text('handle'); $morelink = qa_post_text('morelink'); $touseraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($tohandle, false)); $loginuserid = qa_get_logged_in_userid(); $errorhtml = qa_wall_error_html($loginuserid, $touseraccount['userid'], $touseraccount['flags']); if ($errorhtml || !strlen($message) || !qa_check_form_security_code('wall-' . $tohandle, qa_post_text('code'))) { echo "QA_AJAX_RESPONSE\n0"; } else { $messageid = qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $touseraccount['userid'], $touseraccount['handle'], $message, ''); $touseraccount['wallposts']++; // won't have been updated $usermessages = qa_db_select_with_pending(qa_db_recent_messages_selectspec(null, null, $touseraccount['userid'], true, qa_opt('page_size_wall'))); $usermessages = qa_wall_posts_add_rules($usermessages, 0); $themeclass = qa_load_theme_class(qa_get_site_theme(), 'wall', null, null); echo "QA_AJAX_RESPONSE\n1\n"; echo 'm' . $messageid . "\n"; // element in list to be revealed foreach ($usermessages as $message) { $themeclass->message_item(qa_wall_post_view($message)); } if ($morelink && $touseraccount['wallposts'] > count($usermessages)) { $themeclass->message_item(qa_wall_view_more_link($tohandle, count($usermessages))); } } /* Omit PHP closing tag to help avoid accidental output */
*/ require_once QA_INCLUDE_DIR . 'qa-app-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-cookies.php'; require_once QA_INCLUDE_DIR . 'qa-app-votes.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-options.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; $postid = qa_post_text('postid'); $vote = qa_post_text('vote'); $code = qa_post_text('code'); $userid = qa_get_logged_in_userid(); $cookieid = qa_cookie_get(); if (!qa_check_form_security_code('vote', $code)) { $voteerror = qa_lang_html('misc/form_security_reload'); } else { $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid)); $voteerror = qa_vote_error_html($post, $vote, $userid, qa_request()); } if ($voteerror === false) { qa_vote_set($post, $userid, qa_get_logged_in_handle(), $cookieid, $vote); $post = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $postid)); $fields = qa_post_html_fields($post, $userid, $cookieid, array(), null, array('voteview' => qa_get_vote_view($post, true))); $themeclass = qa_load_theme_class(qa_get_site_theme(), 'voting', null, null); echo "QA_AJAX_RESPONSE\n1\n"; $themeclass->voting_inner_html($fields); } else { echo "QA_AJAX_RESPONSE\n0\n" . $voteerror; } /* Omit PHP closing tag to help avoid accidental output */
$userid = qa_get_logged_in_userid(); list($question, $childposts) = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $questionid), qa_db_full_child_posts_selectspec($userid, $questionid)); if (@$question['basetype'] == 'Q' && !isset($question['closedbyid'])) { $answers = qa_page_q_load_as($question, $childposts); // Try to create the new answer $answerid = qa_page_q_add_a_submit($question, $answers, $usecaptcha, $in, $errors); $countanswers = $question['acount'] + 1; if (isset($answerid)) { // If successful, page content will be updated via Ajax $answer = qa_db_select_with_pending(qa_db_full_post_selectspec($userid, $answerid)); $question = $question + qa_page_q_post_rules($question, null, null, $childposts); // array union $answer = $answer + qa_page_q_post_rules($answer, $question, $answers, null); $usershtml = qa_userids_handles_html(array($answer), true); $a_view = qa_page_q_answer_view($question, $answer, false, $usershtml, false); $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-answer', null, null); echo "QA_AJAX_RESPONSE\n1\n"; // Send back whether the 'answer' button should still be visible echo (int) qa_opt('allow_multi_answers') . "\n"; // Send back the count of answers if ($countanswers == 1) { echo qa_lang_html('question/1_answer_title') . "\n"; } else { echo qa_lang_html_sub('question/x_answers_title', $countanswers) . "\n"; } // Send back the HTML $themeclass->a_list_item($a_view); return; } } }
<?php /* don't allow this page to be requested directly from browser */ if (!defined('QA_VERSION')) { header('Location: /'); exit; } /* Definitions */ define('MYTHEME_DIR', dirname(__FILE__)); define('MYTHEME_URL', qa_opt('site_url') . 'qa-theme/' . qa_get_site_theme() . '/'); // set layout cookies $layout = qa_opt('it_layout_lists'); if ($layout) { setcookie('layoutdefault', $layout, time() + 86400 * 3650, '/', QA_COOKIE_DOMAIN); } else { setcookie('layoutdefault', 'masonry', time() + 86400 * 3650, '/', QA_COOKIE_DOMAIN); } require MYTHEME_DIR . '/functions.php'; require MYTHEME_DIR . '/qa-layer-base.php'; if (isset($_REQUEST['qat_ajax_req'])) { qa_register_layer('/qa-layer-ajax.php', 'QAT Ajax Theme Layer', MYTHEME_DIR, MYTHEME_URL); die; } /* Omit PHP closing tag to help avoid accidental output */
<?php $theme_dir = dirname(__FILE__) . '/'; $theme_url = qa_opt('site_url') . 'qa-theme/' . qa_get_site_theme() . '/'; qa_register_layer('/qa-admin-options.php', 'Theme Options', $theme_dir, $theme_url); class qa_html_theme extends qa_html_theme_base { function head_metas() { qa_html_theme_base::head_metas(); $this->output('<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">'); } function head_css() { if (qa_opt('qat_compression') == 2) { //Gzip $this->output('<LINK REL="stylesheet" TYPE="text/css" HREF="' . $this->rooturl . 'qa-styles-gzip.php' . '"/>'); } elseif (qa_opt('qat_compression') == 1) { //CSS Compression $this->output('<LINK REL="stylesheet" TYPE="text/css" HREF="' . $this->rooturl . 'qa-styles-commpressed.css' . '"/>'); } else { // Normal CSS load $this->output('<LINK REL="stylesheet" TYPE="text/css" HREF="' . $this->rooturl . $this->css_name() . '"/>'); } if (isset($this->content['css_src'])) { foreach ($this->content['css_src'] as $css_src) { $this->output('<LINK REL="stylesheet" TYPE="text/css" HREF="' . $css_src . '"/>'); } } if (!empty($this->content['notices'])) { $this->output('<STYLE><!--', '.qa-body-js-on .qa-notice {display:none;}', '//--></STYLE>');
/** * Output the $qa_content via the theme class after doing some pre-processing, mainly relating to Javascript */ function qa_output_content($qa_content) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } global $qa_template; $requestlower = strtolower(qa_request()); // Set appropriate selected flags for navigation (not done in qa_content_prepare() since it also applies to sub-navigation) foreach ($qa_content['navigation'] as $navtype => $navigation) { if (!is_array($navigation) || $navtype == 'cat') { continue; } foreach ($navigation as $navprefix => $navlink) { $selected =& $qa_content['navigation'][$navtype][$navprefix]['selected']; if (isset($navlink['selected_on'])) { // match specified paths foreach ($navlink['selected_on'] as $path) { if (strpos($requestlower . '$', $path) === 0) { $selected = true; } } } elseif ($requestlower === $navprefix || $requestlower . '$' === $navprefix) { // exact match for array key $selected = true; } } } // Slide down notifications if (!empty($qa_content['notices'])) { foreach ($qa_content['notices'] as $notice) { $qa_content['script_onloads'][] = array("qa_reveal(document.getElementById(" . qa_js($notice['id']) . "), 'notice');"); } } // Handle maintenance mode if (qa_opt('site_maintenance') && $requestlower != 'login') { if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) { if (!isset($qa_content['error'])) { $qa_content['error'] = strtr(qa_lang_html('admin/maintenance_admin_only'), array('^1' => '<a href="' . qa_path_html('admin/general') . '">', '^2' => '</a>')); } } else { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('misc/site_in_maintenance'); } } // Handle new users who must confirm their email now, or must be approved before continuing $userid = qa_get_logged_in_userid(); if (isset($userid) && $requestlower != 'confirm' && $requestlower != 'account') { $flags = qa_get_logged_in_flags(); if ($flags & QA_USER_FLAGS_MUST_CONFIRM && !($flags & QA_USER_FLAGS_EMAIL_CONFIRMED) && qa_opt('confirm_user_emails')) { $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('users/confirm_title'); $qa_content['error'] = strtr(qa_lang_html('users/confirm_required'), array('^1' => '<a href="' . qa_path_html('confirm') . '">', '^2' => '</a>')); } elseif ($flags & QA_USER_FLAGS_MUST_APPROVE && qa_get_logged_in_level() < QA_USER_LEVEL_APPROVED && qa_opt('moderate_users')) { $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('users/approve_title'); $qa_content['error'] = strtr(qa_lang_html('users/approve_required'), array('^1' => '<a href="' . qa_path_html('account') . '">', '^2' => '</a>')); } } // Combine various Javascript elements in $qa_content into single array for theme layer $script = array('<script>'); if (isset($qa_content['script_var'])) { foreach ($qa_content['script_var'] as $var => $value) { $script[] = 'var ' . $var . ' = ' . qa_js($value) . ';'; } } if (isset($qa_content['script_lines'])) { foreach ($qa_content['script_lines'] as $scriptlines) { $script[] = ''; $script = array_merge($script, $scriptlines); } } if (isset($qa_content['focusid'])) { $qa_content['script_onloads'][] = array("var elem = document.getElementById(" . qa_js($qa_content['focusid']) . ");", "if (elem) {", "\telem.select();", "\telem.focus();", "}"); } if (isset($qa_content['script_onloads'])) { array_push($script, '', 'var qa_oldonload = window.onload;', 'window.onload = function() {', "\tif (typeof qa_oldonload == 'function')", "\t\tqa_oldonload();"); foreach ($qa_content['script_onloads'] as $scriptonload) { $script[] = "\t"; foreach ((array) $scriptonload as $scriptline) { $script[] = "\t" . $scriptline; } } $script[] = '};'; } $script[] = '</script>'; if (isset($qa_content['script_rel'])) { $uniquerel = array_unique($qa_content['script_rel']); // remove any duplicates foreach ($uniquerel as $script_rel) { $script[] = '<script src="' . qa_html(qa_path_to_root() . $script_rel) . '"></script>'; } } if (isset($qa_content['script_src'])) { $uniquesrc = array_unique($qa_content['script_src']); // remove any duplicates foreach ($uniquesrc as $script_src) { $script[] = '<script src="' . qa_html($script_src) . '"></script>'; } } $qa_content['script'] = $script; // Load the appropriate theme class and output the page $tmpl = substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $qa_template; $themeclass = qa_load_theme_class(qa_get_site_theme(), $tmpl, $qa_content, qa_request()); $themeclass->initialize(); header('Content-type: ' . $qa_content['content_type']); $themeclass->doctype(); $themeclass->html(); $themeclass->finish(); }
function admin_form(&$qa_content) { $saved = false; if (qa_clicked('ra_save_button')) { if ($_FILES['ra_logo_field']['size'] > 0) { if (getimagesize($_FILES['ra_logo_field']['tmp_name']) > 0) { $url = qa_opt('site_url') . 'qa-theme/' . qa_get_site_theme() . '/images/'; $uploaddir = QA_THEME_DIR . qa_get_site_theme() . '/images/'; $uploadfile = $uploaddir . basename($_FILES['ra_logo_field']['name']); move_uploaded_file($_FILES['ra_logo_field']['tmp_name'], $uploadfile); qa_opt('ra_logo', $url . $_FILES['ra_logo_field']['name']); } } //general qa_opt('ra_home_layout', qa_post_text('option_ra_home_layout')); qa_opt('google_analytics', qa_post_text('option_google_analytics')); qa_opt('custom_head_meta', qa_post_text('option_custom_head_meta')); qa_opt('ra_colla_comm', (bool) qa_post_text('option_ra_colla_comm')); qa_opt('show_real_name', (bool) qa_post_text('option_show_real_name')); qa_opt('users_table_layout', (bool) qa_post_text('option_users_table_layout')); //color qa_opt('ra_primary_color', qa_post_text('option_ra_primary_color')); qa_opt('ra_nav_bg', qa_post_text('option_ra_nav_bg')); qa_opt('ask-btn-bg', qa_post_text('option_ask-btn-bg')); qa_opt('selected-ans-bg', qa_post_text('option_selected-ans-bg')); qa_opt('hero-bg', qa_post_text('option_hero-bg')); qa_opt('tags-bg', qa_post_text('option_tags-bg')); qa_opt('vote-positive-bg', qa_post_text('option_vote-positive-bg')); qa_opt('vote-negative-bg', qa_post_text('option_vote-negative-bg')); qa_opt('vote-default-bg', qa_post_text('option_vote-default-bg')); qa_opt('post-status-open', qa_post_text('option_post-status-open')); qa_opt('post-status-selected', qa_post_text('option_post-status-selected')); qa_opt('post-status-closed', qa_post_text('option_post-status-closed')); qa_opt('post-status-duplicate', qa_post_text('option_post-status-duplicate')); qa_opt('favourite-btn-bg', qa_post_text('option_favourite-btn-bg')); qa_opt('bottom-bg', qa_post_text('option_bottom-bg')); // Typography qa_opt('ra_fonts', qa_post_text('option_ra_fonts')); qa_opt('ra_body_font', qa_post_text('option_ra_body_font')); qa_opt('ra_h_font', qa_post_text('option_ra_h_font')); qa_opt('q-list-ff', qa_post_text('option-q-list-ff')); //list qa_opt('ra_list_layout', qa_post_text('option_ra_list_layout')); qa_opt('ra_show_ans_view', (bool) qa_post_text('option_ra_show_ans_view')); // Navigation qa_opt('ra_nav_fixed', (bool) qa_post_text('option_ra_nav_fixed')); qa_opt('ra_show_icon', (bool) qa_post_text('option_ra_show_icon')); qa_opt('ra_nav_parent_font_size', qa_post_text('option_ra_nav_parent_font_size')); qa_opt('ra_nav_child_font_size', qa_post_text('option_ra_nav_child_font_size')); // bootstrap qa_opt('ra_body_bg', qa_post_text('option_ra_body_bg')); qa_opt('ra_text_color', qa_post_text('option_ra_text_color')); qa_opt('font-size-base', qa_post_text('option-font-size-base')); qa_opt('ra_base_fontfamily', qa_post_text('option_ra_base_fontfamily')); qa_opt('ra_base_lineheight', qa_post_text('option_ra_base_lineheight')); qa_opt('ads_below_question_title', base64_encode(@$_REQUEST['option_ads_below_question_title'])); qa_opt('ads_after_question_content', base64_encode(@$_REQUEST['option_ads_after_question_content'])); $ra_ads = $_REQUEST['ra_qaads']; $ra_list_ads = $_REQUEST['ra_list_ads']; foreach ($ra_ads as $k => $ads) { $ra_ads[$k]['code'] = base64_encode($ra_ads[$k]['code']); } foreach ($ra_list_ads as $k => $ads) { $ra_list_ads[$k]['code'] = base64_encode($ra_list_ads[$k]['code']); } qa_opt('ra_qaads', serialize($ra_ads)); qa_opt('ra_list_ads', serialize($ra_list_ads)); $saved = true; } $ra_forms = array('ok' => $saved ? 'Settings saved' : null, 'tags' => 'method="post" enctype="multipart/form-data" class="form-horizontal"', 'is_ra_option' => 1, 'fields' => array(array('label' => 'General', 'type' => 'block_start', 'tags' => 'general', 'icon' => 'icon-equalizer'), array('label' => 'Logo', 'type' => 'static', 'value' => '<img class="image-preview" src ="' . qa_opt('ra_logo') . '" /><input type="file" name="ra_logo_field" id="ra_logo_field" class="btn btn-success">', 'tags' => 'name="option_ra_logo" id="option_ra_logo"', 'description' => 'Upload a image to use as logo'), array('id' => 'ra_home_layout', 'label' => 'Home layout', 'type' => 'ra_select', 'value' => qa_opt('ra_home_layout'), 'options' => $this->ra_readdir('/home'), 'tags' => 'name="option_ra_home_layout"', 'description' => 'Set the layout of home'), array('id' => 'google_analytics', 'label' => 'Analytics tracking', 'value' => qa_opt('google_analytics'), 'tags' => 'name="option_google_analytics"', 'description' => 'Google analytics tracking ID'), array('id' => 'custom_head_meta', 'label' => 'Custom Meta', 'type' => 'textarea', 'rows' => '3', 'value' => qa_opt('custom_head_meta'), 'tags' => 'name="option_custom_head_meta"', 'description' => 'Like google and bing verification meta'), array('label' => 'Collapsible comments', 'type' => 'checkbox', 'value' => qa_opt('ra_colla_comm'), 'tags' => 'name="option_ra_colla_comm" id="option_ra_colla_comm"', 'description' => 'Show collapsible comments'), array('id' => 'show_real_name', 'label' => 'Show Real name', 'type' => 'checkbox', 'value' => qa_opt('show_real_name'), 'tags' => 'name="option_show_real_name" id="option_show_real_name"', 'description' => 'Show real name instead of username'), array('id' => 'users_table_layout', 'label' => 'User list in table', 'type' => 'checkbox', 'value' => qa_opt('users_table_layout'), 'tags' => 'name="option_users_table_layout" id="option_users_table_layout"', 'description' => 'Show table based user list in user page'), 'generalend' => array('type' => 'block_end'), array('label' => 'Typo', 'type' => 'block_start', 'tags' => 'typo', 'icon' => 'icon-pen'), array('label' => 'Google fonts', 'type' => 'textarea', 'rows' => '5', 'value' => qa_opt('ra_fonts'), 'tags' => 'name="option_ra_fonts"', 'description' => 'Google font url separated by a |'), array('label' => 'Body font family', 'type' => 'ra_select', 'value' => qa_opt('ra_body_font'), 'options' => $this->ra_font_family(), 'tags' => 'name="option_ra_body_font"', 'description' => 'Set the fontfamily for the main body'), array('id' => 'ra_h_font', 'label' => 'Heading font family', 'type' => 'ra_select', 'value' => qa_opt('ra_h_font'), 'options' => $this->ra_font_family(), 'tags' => 'name="option_ra_h_font"', 'description' => 'Set the font family for the heading'), array('id' => 'q-list-ff', 'label' => 'List font family', 'type' => 'ra_select', 'value' => qa_opt('q-list-ff'), 'options' => $this->ra_font_family(), 'tags' => 'name="option-q-list-ff"', 'description' => 'Set the font family for the list'), array('type' => 'block_end'), array('label' => 'Colors', 'type' => 'block_start', 'tags' => 'colors', 'icon' => 'icon-eyedropper'), array('id' => 'ra_nav_bg', 'label' => 'Nav Background', 'type' => 'color', 'value' => qa_opt('ra_nav_bg'), 'tags' => 'name="option_ra_nav_bg"', 'description' => 'Background color of navigation'), array('id' => 'ra_primary_color', 'label' => 'Parimary color', 'type' => 'color', 'value' => qa_opt('ra_primary_color'), 'tags' => 'name="option_ra_primary_color"', 'description' => 'Set a primary color'), array('id' => 'ask-btn-bg', 'label' => 'Ask button background', 'type' => 'color', 'value' => qa_opt('ask-btn-bg'), 'tags' => 'name="option_ask-btn-bg"', 'description' => 'Ask button background color'), array('id' => 'hero-bg', 'label' => 'Hero background', 'type' => 'color', 'value' => qa_opt('hero-bg'), 'tags' => 'name="option_hero-bg"', 'description' => 'BAckground color for hero unit'), array('id' => 'vote-positive-bg', 'label' => 'Positive vote bg', 'type' => 'color', 'value' => qa_opt('vote-positive-bg'), 'tags' => 'name="option_vote-positive-bg"', 'description' => 'Background for positive vote'), array('id' => 'vote-negative-bg', 'label' => 'Negative vote bg', 'type' => 'color', 'value' => qa_opt('vote-negative-bg'), 'tags' => 'name="option_vote-negative-bg"', 'description' => 'Background for negative vote'), array('id' => 'vote-default-bg', 'label' => 'Default vote bg', 'type' => 'color', 'value' => qa_opt('vote-default-bg'), 'tags' => 'name="option_vote-default-bg"', 'description' => 'Background for default vote'), array('id' => 'bottom-bg', 'label' => 'Bottom Bg', 'type' => 'color', 'value' => qa_opt('bottom-bg'), 'tags' => 'name="option_bottom-bg"', 'description' => 'Background for bottom'), array('type' => 'block_end'), 'liststart' => array('label' => 'List', 'type' => 'block_start', 'tags' => 'list', 'icon' => 'icon-layout-10'), array('id' => 'ra_list_layout', 'label' => 'List layout', 'type' => 'ra_select', 'value' => qa_opt('ra_list_layout'), 'options' => $this->ra_readdir('/q_list'), 'tags' => 'name="option_ra_list_layout"', 'description' => 'Set the layout of list'), array('id' => 'ra_show_ans_view', 'label' => 'Show Answer & view count', 'type' => 'checkbox', 'value' => qa_opt('ra_show_ans_view'), 'tags' => 'name="option_ra_show_ans_view" id="option_ra_show_ans_view"', 'description' => 'Show answer and view count in list'), 'listend' => array('type' => 'block_end'), array('label' => 'Navigation', 'type' => 'block_start', 'tags' => 'navigation', 'icon' => 'icon-reorder'), array('label' => 'Fixed Nav', 'type' => 'checkbox', 'value' => qa_opt('ra_nav_fixed'), 'tags' => 'name="option_ra_nav_fixed" id="option_ra_nav_fixed"', 'description' => 'Stick navigation to the top'), array('label' => 'Show menu Icon', 'type' => 'checkbox', 'value' => qa_opt('ra_show_icon'), 'tags' => 'name="option_ra_show_icon" id="option_ra_show_icon"', 'description' => 'Check this for hiding menu icon'), array('label' => 'Nav parent font size', 'type' => 'number', 'value' => qa_opt('ra_nav_parent_font_size'), 'tags' => 'name="option_ra_nav_parent_font_size" id="option_ra_nav_parent_font_size"', 'description' => 'Font size of parent menu'), array('label' => 'Nav child font size', 'type' => 'number', 'value' => qa_opt('ra_nav_child_font_size'), 'tags' => 'name="option_ra_nav_child_font_size" id="option_ra_nav_child_font_size"', 'description' => 'Font size of child menu'), array('type' => 'block_end'), array('label' => 'Bootstrap', 'type' => 'block_start', 'tags' => 'bootstrap', 'icon' => 'icon-twitter'), array('id' => 'ra_body_bg', 'label' => 'Body Background', 'type' => 'color', 'value' => qa_opt('ra_body_bg'), 'tags' => 'name="option_ra_body_bg"', 'description' => 'Background color of body'), array('id' => 'ra_text_color', 'label' => 'Body text color', 'type' => 'color', 'value' => qa_opt('ra_text_color'), 'tags' => 'name="option_ra_text_color"', 'description' => 'Color of the main body texts'), array('id' => 'font-size-base', 'label' => 'Base font size', 'value' => qa_opt('font-size-base'), 'tags' => 'name="option-font-size-base"', 'description' => 'Font size of main body'), array('id' => 'ra_base_fontfamily', 'label' => 'Base font family', 'value' => qa_opt('ra_base_fontfamily'), 'tags' => 'name="option_ra_base_fontfamily"', 'description' => 'Font family of main body'), array('id' => 'ra_base_lineheight', 'label' => 'Base line height', 'value' => qa_opt('ra_base_lineheight'), 'tags' => 'name="option_ra_base_lineheight"', 'description' => 'Font size of main body'), array('type' => 'block_end'), array('label' => 'Ads', 'type' => 'block_start', 'tags' => 'ads', 'icon' => 'icon-money'), array('id' => 'ra_qaads', 'label' => 'Ads code', 'description' => 'Add ads using builder, use ad name to add the code', 'input_label' => 'Ad name', 'type' => 'ra_qaads_multi_text', 'value' => qa_opt('ra_qaads'), 'tags' => 'ra_qaads[]'), array('id' => 'ra_list_ads', 'label' => 'List Ads', 'description' => 'Add ads between questions list', 'input_label' => 'Order', 'type' => 'ra_qaads_multi_text', 'value' => qa_opt('ra_list_ads'), 'tags' => 'ra_list_ads[]'), array('label' => 'Ads below question title', 'type' => 'textarea', 'rows' => '5', 'value' => str_replace('\\', '', base64_decode(qa_opt('ads_below_question_title'))), 'tags' => 'name="option_ads_below_question_title"', 'description' => 'Ads below question title and avatar'), array('label' => 'Ads after question content', 'type' => 'textarea', 'rows' => '5', 'value' => str_replace('\\', '', base64_decode(qa_opt('ads_after_question_content'))), 'tags' => 'name="option_ads_after_question_content"', 'description' => 'Add ads after question content'), array('type' => 'block_end')), 'buttons' => array(array('label' => 'Save Changes', 'tags' => 'name="ra_save_button"'))); return $ra_forms; }
break; } $exampletags[] = $tag; if (count($exampletags) >= $maxcount) { break; } } } else { $exampletags = array(); } // Output the response header and example tags echo "QA_AJAX_RESPONSE\n1\n"; echo strtr(qa_html(implode(',', $exampletags)), "\r\n", ' ') . "\n"; // Collect and output the list of related questions if ($doaskcheck) { $minscore = qa_match_to_min_score(qa_opt('match_ask_check_qs')); $maxcount = qa_opt('page_size_ask_check_qs'); $relatedquestions = array_slice($relatedquestions, 0, $maxcount); $limitedquestions = array(); foreach ($relatedquestions as $question) { if ($question['score'] < $minscore) { break; } $limitedquestions[] = $question; } $themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-asktitle', null, null); $themeclass->q_ask_similar($limitedquestions, qa_lang_html('question/ask_same_q')); } /* Omit PHP closing tag to help avoid accidental output */
$font_style = 'italic'; } $weight = str_replace('italic', '', $style); if (!empty($font_style)) { $insider .= 'font-style:' . $font_style . ';'; } if (!empty($weight)) { $insider .= 'font-weight:' . $weight . ';'; } if (!empty($size)) { $insider .= 'font-size:' . $size . 'px;'; } if (!empty($height)) { $insider .= 'line-height:' . $height . 'px;'; } if (!empty($insider)) { $css .= $elem . '{' . $insider . '}'; } } $css .= qa_post_text('it_custom_css'); $theme = qa_get_site_theme(); $result = file_put_contents(QA_THEME_DIR . $theme . '/css/dynamic.css', $css); if ($result) { qa_opt('it_custom_style_created', true); } else { qa_opt('it_custom_style_created', false); qa_opt('it_custom_css', $css); } /* Omit PHP closing tag to help avoid accidental output */
<?php /* don't allow this page to be requested directly from browser */ if (!defined('QA_VERSION')) { header('Location: /'); exit; } $ra_error = ''; define('DUDE_THEME_DIR', dirname(__FILE__)); define('DUDE_THEME_URL', get_base_url() . '/qa-theme/' . qa_get_site_theme()); require DUDE_THEME_DIR . '/language/default.php'; require DUDE_THEME_DIR . '/inc/core_functions.php'; require DUDE_THEME_DIR . '/inc/lessc.inc.php'; require DUDE_THEME_DIR . '/inc/less.php'; require DUDE_THEME_DIR . '/inc/widgets.php'; require DUDE_THEME_DIR . '/inc/builder.php'; require DUDE_THEME_DIR . '/functions.php'; if (isset($_FILES['cover']) && qa_check_form_security_code('upload_cover', qa_post_text('code'))) { ra_upload_cover('cover'); } if (isset($_REQUEST['ra_ajax'])) { require DUDE_THEME_DIR . '/inc/ajax.php'; } else { require DUDE_THEME_DIR . '/inc/blocks.php'; }
exit; } $cs_error = ''; if ($debug) { error_reporting(E_ALL); ini_set('display_errors', '1'); } else { error_reporting(0); @ini_set('display_errors', 0); } function get_base_url() { return qa_opt('site_url'); } define('Q_THEME_DIR', dirname(__FILE__)); define('Q_THEME_URL', qa_opt('site_url') . 'qa-theme/' . qa_get_site_theme()); include_once Q_THEME_DIR . '/functions.php'; include_once Q_THEME_DIR . '/inc/blocks.php'; qa_register_phrases(Q_THEME_DIR . '/language/cs-lang-*.php', 'cleanstrap'); if (isset($_REQUEST['cs_ajax'])) { if (isset($_REQUEST['cs_ajax'])) { $action = 'cs_ajax_' . $_REQUEST['action']; if (function_exists($action)) { $action(); } } } else { global $qa_request; $version = qa_opt('cs_version'); if (empty($version)) { $version = 0;