function process_request($request)
 {
     $start = qa_get_start();
     $userid = qa_get_logged_in_userid();
     //	Prepare content for theme
     require_once QA_INCLUDE_DIR . 'qa-db-users.php';
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     require_once QA_INCLUDE_DIR . 'qa-app-users.php';
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     require_once QW_CONTROL_DIR . '/addons/social-login/cs-social-login-utils.php';
     if (QA_FINAL_EXTERNAL_USERS) {
         qa_fatal_error('User accounts are handled by external code');
     }
     if (!isset($userid)) {
         qa_redirect('login');
     }
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html('notification/my_notification_settings');
     $qa_content['site_title'] = qa_opt('site_title');
     if (qa_clicked('save_notf_user_settings')) {
         $data_to_save = array('qw_mail_when_a_post' => !!qa_post_text('qw_mail_when_a_post'), 'qw_mail_when_related' => !!qa_post_text('qw_mail_when_related'), 'qw_mail_when_c_post' => !!qa_post_text('qw_mail_when_c_post'), 'qw_mail_when_q_reshow' => !!qa_post_text('qw_mail_when_q_reshow'), 'qw_mail_when_c_reshow' => !!qa_post_text('qw_mail_when_c_reshow'), 'qw_mail_when_a_select' => !!qa_post_text('qw_mail_when_a_select'), 'qw_mail_when_q_vote_up' => !!qa_post_text('qw_mail_when_q_vote_up'), 'qw_mail_when_q_vote_down' => !!qa_post_text('qw_mail_when_q_vote_down'), 'qw_mail_when_a_vote_up' => !!qa_post_text('qw_mail_when_a_vote_up'), 'qw_mail_when_a_vote_down' => !!qa_post_text('qw_mail_when_a_vote_down'), 'qw_mail_when_q_favorite' => !!qa_post_text('qw_mail_when_q_favorite'), 'qw_mail_when_u_favorite' => !!qa_post_text('qw_mail_when_u_favorite'), 'qw_mail_when_u_message' => !!qa_post_text('qw_mail_when_u_message'), 'qw_mail_when_u_wall_post' => !!qa_post_text('qw_mail_when_u_wall_post'), 'qw_mail_when_u_level' => !!qa_post_text('qw_mail_when_u_level'), 'qw_mail_when_q_post_user_fl' => !!qa_post_text('qw_mail_when_q_post_user_fl'), 'qw_mail_when_q_post_tag_fl' => !!qa_post_text('qw_mail_when_q_post_tag_fl'), 'qw_mail_when_q_post_cat_fl' => !!qa_post_text('qw_mail_when_q_post_cat_fl'), 'qw_mail_when_q_approve' => !!qa_post_text('qw_mail_when_q_approve'), 'qw_mail_when_q_reject' => !!qa_post_text('qw_mail_when_q_reject'), 'qw_mail_when_a_approve' => !!qa_post_text('qw_mail_when_a_approve'), 'qw_mail_when_a_reject' => !!qa_post_text('qw_mail_when_a_reject'), 'qw_mail_when_c_approve' => !!qa_post_text('qw_mail_when_c_approve'), 'qw_mail_when_c_reject' => !!qa_post_text('qw_mail_when_c_reject'));
         qw_save_notification_settings(json_encode($data_to_save), $userid);
         qa_redirect('notification-settings', array('state' => 'settings-saved'));
     }
     $disp_conf = qa_get('confirm');
     $preferences = qw_get_notification_settings($userid);
     // qw_log(print_r(qw_check_pref_for_event($userid , 'a_post') , true )) ;
     if (!$disp_conf) {
         // display some summary about the user
         $qa_content['form_profile'] = array('title' => qa_lang_html('notification/my_notification_settings'), 'tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '" CLASS="social-login-settings"', 'style' => 'wide', 'buttons' => array('check_all' => array('type' => 'button', 'tags' => 'name="check_all_notf_fields" id="check_all_notf_fields" ', 'label' => qa_lang_html('notification/check_all')), 'uncheck_all' => array('type' => 'button', 'tags' => 'name="un_check_all_notf_fields" id="un_check_all_notf_fields" ', 'label' => qa_lang_html('notification/uncheck_all')), 'save' => array('tags' => 'onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('notification/save_settings'))), 'fields' => array('qw_mail_when_a_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_post_lable'), 'tags' => 'NAME="qw_mail_when_a_post"', 'value' => @$preferences['qw_mail_when_a_post'] ? true : false), 'qw_mail_when_related' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_related_lable'), 'tags' => 'NAME="qw_mail_when_related"', 'value' => @$preferences['qw_mail_when_related'] ? true : false), 'qw_mail_when_c_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_post_lable'), 'tags' => 'NAME="qw_mail_when_c_post"', 'value' => @$preferences['qw_mail_when_c_post'] ? true : false), 'qw_mail_when_q_reshow' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_reshow_lable'), 'tags' => 'NAME="qw_mail_when_q_reshow"', 'value' => @$preferences['qw_mail_when_q_reshow'] ? true : false), 'qw_mail_when_c_reshow' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_reshow_lable'), 'tags' => 'NAME="qw_mail_when_c_reshow"', 'value' => @$preferences['qw_mail_when_c_reshow'] ? true : false), 'qw_mail_when_a_select' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_select_lable'), 'tags' => 'NAME="qw_mail_when_a_select"', 'value' => @$preferences['qw_mail_when_a_select'] ? true : false), 'qw_mail_when_q_vote_up' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_vote_up_lable'), 'tags' => 'NAME="qw_mail_when_q_vote_up"', 'value' => @$preferences['qw_mail_when_q_vote_up'] ? true : false), 'qw_mail_when_q_vote_down' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_vote_down_lable'), 'tags' => 'NAME="qw_mail_when_q_vote_down"', 'value' => @$preferences['qw_mail_when_q_vote_down'] ? true : false), 'qw_mail_when_a_vote_up' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_vote_up_lable'), 'tags' => 'NAME="qw_mail_when_a_vote_up"', 'value' => @$preferences['qw_mail_when_a_vote_up'] ? true : false), 'qw_mail_when_a_vote_down' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_vote_down_lable'), 'tags' => 'NAME="qw_mail_when_a_vote_down"', 'value' => @$preferences['qw_mail_when_a_vote_down'] ? true : false), 'qw_mail_when_q_favorite' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_favorite_lable'), 'tags' => 'NAME="qw_mail_when_q_favorite"', 'value' => @$preferences['qw_mail_when_q_favorite'] ? true : false), 'qw_mail_when_u_favorite' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_favorite_lable'), 'tags' => 'NAME="qw_mail_when_u_favorite"', 'value' => @$preferences['qw_mail_when_u_favorite'] ? true : false), 'qw_mail_when_u_message' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_message_lable'), 'tags' => 'NAME="qw_mail_when_u_message"', 'value' => @$preferences['qw_mail_when_u_message'] ? true : false), 'qw_mail_when_u_wall_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_wall_post_lable'), 'tags' => 'NAME="qw_mail_when_u_wall_post"', 'value' => @$preferences['qw_mail_when_u_wall_post'] ? true : false), 'qw_mail_when_u_level' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_level_lable'), 'tags' => 'NAME="qw_mail_when_u_level"', 'value' => @$preferences['qw_mail_when_u_level'] ? true : false), 'qw_mail_when_q_post_user_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_user_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_user_fl"', 'value' => @$preferences['qw_mail_when_q_post_user_fl'] ? true : false), 'qw_mail_when_q_post_tag_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_tag_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_tag_fl"', 'value' => @$preferences['qw_mail_when_q_post_tag_fl'] ? true : false), 'qw_mail_when_q_post_cat_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_cat_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_cat_fl"', 'value' => @$preferences['qw_mail_when_q_post_cat_fl'] ? true : false), 'qw_mail_when_q_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_approve_lable'), 'tags' => 'NAME="qw_mail_when_q_approve"', 'value' => @$preferences['qw_mail_when_q_approve'] ? true : false), 'qw_mail_when_q_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_reject_lable'), 'tags' => 'NAME="qw_mail_when_q_reject"', 'value' => @$preferences['qw_mail_when_q_reject'] ? true : false), 'qw_mail_when_a_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_approve_lable'), 'tags' => 'NAME="qw_mail_when_a_approve"', 'value' => @$preferences['qw_mail_when_a_approve'] ? true : false), 'qw_mail_when_a_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_reject_lable'), 'tags' => 'NAME="qw_mail_when_a_reject"', 'value' => @$preferences['qw_mail_when_a_reject'] ? true : false), 'qw_mail_when_c_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_approve_lable'), 'tags' => 'NAME="qw_mail_when_c_approve"', 'value' => @$preferences['qw_mail_when_c_approve'] ? true : false), 'qw_mail_when_c_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_reject_lable'), 'tags' => 'NAME="qw_mail_when_c_reject"', 'value' => @$preferences['qw_mail_when_c_reject'] ? true : false)), 'hidden' => array('save_notf_user_settings' => '1'));
         if (qa_get_state() == 'settings-saved') {
             $qa_content['form_profile']['ok'] = qa_lang_html('notification/settings_saved');
         }
     }
     $qa_content['navigation']['sub'] = qa_account_sub_navigation();
     return $qa_content;
 }
}
//	Other profile fields
foreach ($userfields as $userfield) {
    $value = @$inprofile[$userfield['fieldid']];
    if (!isset($value)) {
        $value = @$userprofile[$userfield['title']];
    }
    $label = trim(qa_user_userfield_label($userfield), ':');
    if (strlen($label)) {
        $label .= ':';
    }
    $qa_content['form_profile']['fields'][$userfield['title']] = array('label' => qa_html($label), 'tags' => 'name="field_' . $userfield['fieldid'] . '"', 'value' => qa_html($value), 'error' => qa_html(@$errors[$userfield['fieldid']]), 'rows' => $userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE ? 8 : null, 'type' => $isblocked ? 'static' : 'text');
}
//	Raw information for plugin layers to access
$qa_content['raw']['account'] = $useraccount;
$qa_content['raw']['profile'] = $userprofile;
$qa_content['raw']['points'] = $userpoints;
//	Change password form
$qa_content['form_password'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'title' => qa_lang_html('users/change_password'), 'fields' => array('old' => array('label' => qa_lang_html('users/old_password'), 'tags' => 'name="oldpassword"', 'value' => qa_html(@$inoldpassword), 'type' => 'password', 'error' => qa_html(@$errors['oldpassword'])), 'new_1' => array('label' => qa_lang_html('users/new_password_1'), 'tags' => 'name="newpassword1"', 'type' => 'password', 'error' => qa_html(@$errors['password'])), 'new_2' => array('label' => qa_lang_html('users/new_password_2'), 'tags' => 'name="newpassword2"', 'type' => 'password', 'error' => qa_html(@$errors['newpassword2']))), 'buttons' => array('change' => array('label' => qa_lang_html('users/change_password'))), 'hidden' => array('dochangepassword' => '1', 'code' => qa_get_form_security_code('password')));
if (!$haspassword) {
    $qa_content['form_password']['fields']['old']['type'] = 'static';
    $qa_content['form_password']['fields']['old']['value'] = qa_lang_html('users/password_none');
}
if (qa_get_state() == 'password-changed') {
    $qa_content['form_profile']['ok'] = qa_lang_html('users/password_changed');
}
$qa_content['navigation']['sub'] = qa_user_sub_navigation($useraccount['handle'], 'account', true);
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
    case 'limit':
        $errorhtml = qa_lang_html('misc/message_limit');
        break;
    case false:
        break;
    default:
        $errorhtml = qa_lang_html('users/no_permission');
        break;
}
if (isset($errorhtml)) {
    $qa_content = qa_content_prepare();
    $qa_content['error'] = $errorhtml;
    return $qa_content;
}
//	Process sending a message to user
$messagesent = qa_get_state() == 'message-sent';
if (qa_post_text('domessage')) {
    $inmessage = qa_post_text('message');
    if (!qa_check_form_security_code('message-' . $handle, qa_post_text('code'))) {
        $pageerror = qa_lang_html('misc/form_security_again');
    } else {
        if (empty($inmessage)) {
            $errors['message'] = qa_lang('misc/message_empty');
        }
        if (empty($errors)) {
            require_once QA_INCLUDE_DIR . 'qa-db-messages.php';
            require_once QA_INCLUDE_DIR . 'qa-app-emails.php';
            if (qa_opt('show_message_history')) {
                $messageid = qa_db_message_create($loginuserid, $toaccount['userid'], $inmessage, '', false);
            } else {
                $messageid = null;
            $maxlevelassign = QA_USER_LEVEL_SUPER;
        } elseif ($loginlevel >= QA_USER_LEVEL_ADMIN) {
            $maxlevelassign = QA_USER_LEVEL_MODERATOR;
        } elseif ($loginlevel >= QA_USER_LEVEL_MODERATOR) {
            $maxlevelassign = QA_USER_LEVEL_EXPERT;
        }
        if ($loginlevel >= QA_USER_LEVEL_ADMIN) {
            $fieldseditable = true;
        }
        if (isset($maxlevelassign) && $useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED) {
            $maxlevelassign = min($maxlevelassign, QA_USER_LEVEL_EDITOR);
        }
        // if blocked, can't promote too high
    }
    $usereditbutton = $fieldseditable || isset($maxlevelassign);
    $userediting = $usereditbutton && qa_get_state() == 'edit';
}
//	Process edit or save button for user
if (!QA_FINAL_EXTERNAL_USERS) {
    $reloaduser = false;
    if ($usereditbutton) {
        if (qa_clicked('docancel')) {
            qa_redirect(qa_request());
        } elseif (qa_clicked('doedit')) {
            qa_redirect(qa_request(), array('state' => 'edit'));
        } elseif (qa_clicked('dosave')) {
            require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
            require_once QA_INCLUDE_DIR . 'qa-db-users.php';
            $errors = array();
            if (qa_post_text('removeavatar')) {
                qa_db_user_set_flag($userid, QA_USER_FLAGS_SHOW_AVATAR, false);
 function display_summary(&$qa_content, $useraccount)
 {
     // display some summary about the user
     $qa_content['form_profile'] = array('title' => qa_lang_html('plugin_open/my_current_user'), 'tags' => 'ENCTYPE="multipart/form-data" METHOD="POST" ACTION="' . qa_self_html() . '" CLASS="open-login-profile"', 'style' => 'wide', 'fields' => array('handle' => array('label' => qa_lang_html('users/handle_label'), 'value' => qa_html($useraccount['handle']), 'type' => 'static'), 'email' => array('label' => qa_lang_html('users/email_label'), 'value' => qa_html($useraccount['email']), 'type' => 'static')), 'hidden' => array('dosaveprofile' => '0'));
     if (qa_get_state() == 'profile-saved') {
         $qa_content['form_profile']['ok'] = qa_lang_html('users/profile_saved');
     }
 }
        case 'approve':
            $qa_content['error'] = qa_lang_html('main/view_q_must_be_approved');
            break;
        default:
            $qa_content['error'] = qa_lang_html('users/no_permission');
            break;
    }
    return $qa_content;
}
//	Determine if captchas will be required
$captchareason = qa_user_captcha_reason(qa_user_level_for_post($question));
$usecaptcha = $captchareason != false;
//	If we're responding to an HTTP POST, include file that handles all posting/editing/etc... logic
//	This is in a separate file because it's a *lot* of logic, and will slow down ordinary page views
$pagestart = qa_get_start();
$pagestate = qa_get_state();
$showid = qa_get('show');
$pageerror = null;
$formtype = null;
$formpostid = null;
$jumptoanchor = null;
$commentsall = null;
if (substr($pagestate, 0, 13) == 'showcomments-') {
    $commentsall = substr($pagestate, 13);
    $pagestate = null;
} elseif (isset($showid)) {
    foreach ($commentsfollows as $comment) {
        if ($comment['postid'] == $showid) {
            $commentsall = $comment['parentid'];
            break;
        }
Exemple #7
0
    function doctype()
    {
        qa_html_theme_base::doctype();
        if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
            // theme installation & update
            $version = qa_opt('IT_VERSION');
            if (IT_VERSION > $version) {
                qa_redirect('it_installation');
            }
            // admin/category form fields
            if ($this->request == 'admin/categories' && qa_get('edit') >= 1) {
                require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
                $categoryid = qa_get('edit');
                $et_category = json_decode(qa_db_categorymeta_get($categoryid, 'et_category'), true);
                $et_category_link_title = $et_category['et_cat_title'];
                $et_category_description = $et_category['et_cat_desc'];
                $et_category_icon_48 = $et_category['et_cat_icon48'];
                $et_category_icon_64 = $et_category['et_cat_icon64'];
                $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_link_title" ID="et_category_link_title"', 'label' => 'Category Link Title', 'value' => $et_category_link_title);
                $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_description" ID="et_category_description"', 'label' => 'Category Sidebar Description', 'value' => $et_category_description);
                $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_icon_48" ID="et_category_icon_48"', 'label' => 'Category Icon(48 pixel)', 'value' => $et_category_icon_48);
                $this->content['form']['fields'][] = array('tags' => 'NAME="et_category_icon_64" ID="et_category_icon_64"', 'label' => 'Category Icon(64 pixel)', 'value' => $et_category_icon_64);
            }
        }
        // ask form
        if ($this->template == 'ask' or $this->template == 'question' && substr(qa_get_state(), 0, 4) == 'edit') {
            // Form template
            if ($this->template == 'ask') {
                $form_name = 'form';
            } else {
                $form_name = 'form_q_edit';
            }
            // Featured Image
            if (qa_opt('it_feature_img_enable')) {
                $featured_image = '';
                $featured_image_url = '';
                $featured_image_style = '';
                $featured_file_container_style = '';
                if ($this->template != 'ask') {
                    $postid = $this->content["q_view"]["raw"]["postid"];
                    require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
                    $featured_image = qa_db_postmeta_get($postid, 'et_featured_image');
                    if (isset($featured_image)) {
                        $featured_image_url = qa_opt('it_featured_url_abs') . 'featured/' . $featured_image;
                        $featured_image_style = 'display: inline-block;';
                        $featured_file_container_style = 'display:none;';
                    }
                }
                $custom_field[0]['category_featured_upload']['label'] = '';
                $custom_field[0]['category_featured_upload']['html'] = '
					<div style="' . $featured_image_style . '" class="image-preview-container" id="image-preview-container">
						<img class="image-preview img-thumbnail" id="image-preview" src="' . $featured_image_url . '">
						<button class="btn btn-danger remove-featured-image" id="remove-featured-image" type="button">X</button>
					</div>
					<div id="featured_file_container" style="' . $featured_file_container_style . '"><div id="featured_file_upload"></div></div>
					<input type="hidden" value="' . $featured_image . '" name="featured_image" id="featured_image">
				';
                $custom_field[0]['category_featured_upload']['type'] = 'custom';
                $count = count($this->content[$form_name]["fields"]);
                $featured_pos = 0;
                $this->content[$form_name]["fields"] = array_merge(array_slice($this->content[$form_name]["fields"], 0, $featured_pos), $custom_field[0], array_slice($this->content[$form_name]["fields"], $featured_pos, $count));
                //v($custom_field);
            } else {
                $custom_field = array();
            }
            // Excerpt Field
            if (qa_opt('it_excerpt_field_enable')) {
                if ($this->template == 'ask') {
                    $excerpt_pos = (int) qa_opt('it_excerpt_pos_ask');
                    $excerit_text = '';
                } else {
                    $postid = $this->content["q_view"]["raw"]["postid"];
                    require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
                    $excerpt_pos = (int) qa_opt('it_excerpt_pos_edit');
                    $excerit_text = qa_db_postmeta_get($postid, 'et_excerpt_text');
                }
            }
            // Category Field
            if (qa_opt('it_cat_advanced_enable')) {
                if ($this->template == 'ask') {
                    $category_pos = (int) qa_opt('it_cat_pos_ask');
                    //$field_value = qa_post_text('q_category');
                } else {
                    $category_pos = (int) qa_opt('it_cat_pos_edit');
                }
                if (empty($this->content["q_view"]["raw"]["categoryid"])) {
                    $this->content[$form_name]['fields']['category']['value'] = '';
                }
                $this->content[$form_name]['fields']['category']['type'] = 'text';
                $this->content[$form_name]['fields']['category']['label'] = '';
                $this->content[$form_name]['fields']['category']['tags'] = 'name="q_category" id="category_tag" autocomplete="off" onkeyup="qa_cat_tag_hints();" onmouseup="qa_cat_tag_hints();"';
                $this->content[$form_name]['fields']['category']['note_force'] = true;
                $custom_field[1]['category_tag_holder']['label'] = 'This tip is about:';
                $custom_field[1]['category_tag_holder']['html'] = '<div id="category_tag_holder"></div>';
                $custom_field[1]['category_tag_holder']['type'] = 'custom';
            } else {
                $custom_field[1] = array();
                $category_pos = 0;
            }
            // order of form elements
            $count = count($this->content[$form_name]["fields"]);
            $this->content[$form_name]["fields"] = array_merge(array_slice($this->content[$form_name]["fields"], 0, $category_pos), $custom_field[1], array_slice($this->content[$form_name]["fields"], $category_pos, $count));
            // Excerpt Custom Fields
            if (qa_opt('it_excerpt_field_enable')) {
                $custom_field = array();
                $custom_field[0]['excerpt']['label'] = 'Add Excerpt';
                $custom_field[0]['excerpt']['html'] = '
					<textarea name="q-excerpt" id="excerpt-input-placeholder" class="qa-form-tall-text" cols="40" rows="3" name="excerpt-input-placeholder" placeholder="If you add an excerpt it will be used in lists">' . $excerit_text . '</textarea>
				';
                $custom_field[0]['excerpt']['type'] = 'custom';
                $count = count($this->content[$form_name]["fields"]);
                $this->content[$form_name]["fields"] = array_merge(array_slice($this->content[$form_name]["fields"], 0, $excerpt_pos), $custom_field[0], array_slice($this->content[$form_name]["fields"], $excerpt_pos, $count));
            }
        }
    }
Exemple #8
0
 function body_content()
 {
     $this->body_prefix();
     $this->notices();
     $this->widgets('full', 'top');
     // Q2A header
     $this->widgets('full', 'high');
     $this->header();
     $this->output('<div class="container-fluid' . (qa_opt('it_nav_fixed') ? ' fixed-nav-container' : '') . '">');
     // list of pages with no sidebar
     $pages = array("qa", "questions", "user", "user-wall", "user-activity", "Linux", "user-questions", "user-answers");
     // pages without sidebar
     if (in_array($this->template, $pages)) {
         // Q2A default body
         $this->output('<section class="qa-main-content col-md-12">');
         $this->main();
         $this->output('</section>');
     } else {
         $postid = @$this->content['q_view']['raw']['postid'];
         if (isset($postid)) {
             require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
             $image = qa_db_postmeta_get($postid, 'et_featured_image');
             if (!empty($image) && substr(qa_get_state(), 0, 4) != 'edit') {
                 $this->output('<img class="featured-image img-thumbnail" src="' . qa_opt('it_featured_url_abs') . 'featured/' . $image . '"/>');
             }
         }
         // Q2A sidebar
         if ($this->request == 'admin/it_options' && qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
             // Q2A default body
             $this->output('<section class="qa-main-content col-md-12">');
             $this->main();
             $this->output('</section>');
         } else {
             $this->output('<aside class="qa-main-sidebar col-md-3">');
             $this->sidepanel();
             $this->output('</aside>');
             // Q2A default body
             $this->output('<section class="qa-main-content col-md-9">');
             $this->main();
             $this->output('</section>');
         }
     }
     $this->output('</div>');
     // Q2A Footer
     $this->widgets('full', 'low');
     $this->footer();
     $this->widgets('full', 'bottom');
     $this->body_suffix();
 }
Exemple #9
0
 function c_form($c_form)
 {
     if (@$_POST['qa'] == 'ajax' or empty($c_form)) {
         return;
     }
     $pagestate = qa_get_state();
     if (!isset($c_form['collapse']) && empty($pagestate)) {
         $c_form['collapse'] = true;
     }
     $this->output('<div class="qa-c-form"' . (isset($c_form['id']) ? ' id="' . $c_form['id'] . '"' : '') . (@$c_form['collapse'] ? ' style="display:none;"' : '') . '>');
     $this->output('<div class="asker-avatar no-radius">');
     $this->output(cs_get_avatar(qa_get_logged_in_handle(), 30));
     $this->output('</div>');
     if (!empty($c_form['title'])) {
         $this->output('<div class="comment-f-wrap">');
         $this->output('<h3>', $c_form['title'], '</h3>');
         $c_form['title'] = '';
         $this->form($c_form);
         $this->output('</div>', '');
     } else {
         $this->form($c_form);
     }
     $this->output('</div>', '');
 }
Exemple #10
0
    return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
//	Check that we have permission and haven't reached the limit, but don't quit just yet
switch (qa_user_permit_error(null, QA_LIMIT_MESSAGES)) {
    case 'limit':
        $pageerror = qa_lang_html('misc/message_limit');
        break;
    case false:
        break;
    default:
        $pageerror = qa_lang_html('users/no_permission');
        break;
}
//	Process sending a message to user
// check for messages or errors
$state = qa_get_state();
$messagesent = $state == 'message-sent';
if ($state == 'email-error') {
    $pageerror = qa_lang_html('main/email_error');
}
if (qa_post_text('domessage')) {
    $inmessage = qa_post_text('message');
    if (isset($pageerror)) {
        // not permitted to post, so quit here
        $qa_content['error'] = $pageerror;
        return $qa_content;
    }
    if (!qa_check_form_security_code('message-' . $handle, qa_post_text('code'))) {
        $pageerror = qa_lang_html('misc/form_security_again');
    } else {
        if (empty($inmessage)) {