Ejemplo n.º 1
0
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    return $qa_content;
}
Ejemplo n.º 2
0
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/format.php';
    require_once QA_INCLUDE_DIR . 'app/updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    //	Prepare content for theme
    $qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $defaults['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
            if (!empty($fields['raw']['closedbyid'])) {
                $fields['closed'] = array('state' => qa_lang_html('main/closed'));
            }
            $qa_content['q_list']['qs'][] = $fields;
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($userid) && isset($categoryid)) {
        $favoritemap = qa_get_favorite_non_qs_map();
        $categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
        $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    if (empty($qa_content['page_links'])) {
        $qa_content['suggest_next'] = $suggest;
    }
    if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
        $qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
    }
    if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
        $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
    }
    return $qa_content;
}
Ejemplo n.º 3
0
 function nav_user_search()
 {
     if (!qa_is_logged_in()) {
         $login = @$this->content['navigation']['user']['login'];
         if (isset($login) && !QA_FINAL_EXTERNAL_USERS) {
             $this->output('<!--[Begin: login form]-->', '<form id="qa-loginform" action="' . $login['url'] . '" method="post">', '<input type="text" id="qa-userid" name="emailhandle" placeholder="' . trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':') . '" />', '<input type="password" id="qa-password" name="password" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '" />', '<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1"/>', '<label for="qa-rememberme" id="qa-remember">' . qa_lang_html('users/remember') . '</label></div>', '<input type="hidden" name="code" value="' . qa_html(qa_get_form_security_code('login')) . '"/>', '<input type="submit" value="' . $login['label'] . '" id="qa-login" name="dologin" />', '</form>', '<!--[End: login form]-->');
             unset($this->content['navigation']['user']['login']);
             // removes regular navigation link to log in page
         }
     }
     qa_html_theme_base::nav_user_search();
 }
Ejemplo n.º 4
0
 public function nav_user_search()
 {
     if (!qa_is_logged_in()) {
         if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) {
             $login = $this->content['navigation']['user']['login'];
             $this->output('<form class="qam-login-form" action="' . $login['url'] . '" method="post">', '<input type="text" class="qam-login-text" name="emailhandle" dir="auto" placeholder="' . trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':') . '"/>', '<input type="password" class="qam-login-text" name="password" dir="auto" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '"/>', '<div class="qam-rememberbox"><input type="checkbox" name="remember" id="qam-rememberme" value="1"/>', '<label for="qam-rememberme" class="qam-remember">' . qa_lang_html('users/remember') . '</label></div>', '<input type="hidden" name="code" value="' . qa_html(qa_get_form_security_code('login')) . '"/>', '<input type="submit" value="' . qa_lang_html('users/login_button') . '" class="qa-form-tall-button qa-form-tall-button-login" name="dologin"/>', '</form>');
             // remove regular navigation link to log in page
             unset($this->content['navigation']['user']['login']);
         }
     }
     qa_html_theme_base::nav_user_search();
 }
Ejemplo n.º 5
0
function qa_favorite_q_list_view($questions, $usershtml)
{
    $q_list = array('qs' => array());
    if (count($questions) === 0) {
        return $q_list;
    }
    $q_list['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $defaults = qa_post_html_defaults('Q');
    foreach ($questions as $question) {
        $q_list['qs'][] = qa_post_html_fields($question, qa_get_logged_in_userid(), qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
    }
    return $q_list;
}
Ejemplo n.º 6
0
 public function admin_form(&$qa_content)
 {
     $saved = false;
     $error = false;
     if (qa_clicked(self::RESET_BTN)) {
         if (qa_check_form_security_code('donut/admin_options', qa_post_text('code'))) {
             if (donut_reset_all_options()) {
                 $saved = true;
                 qa_opt('donut_defaults_set_ok', 1);
             }
         } else {
             $error = qa_lang_html('admin/form_security_expired');
         }
     }
     $form = array('ok' => $saved ? donut_lang('options_reset') : null, 'fields' => array('simple_note' => array('type' => 'static', 'label' => donut_lang('admin_notes'), 'error' => $error)), 'buttons' => array(array('label' => qa_lang_html('admin/reset_options_button'), 'tags' => 'NAME="' . self::RESET_BTN . '"')), 'hidden' => array('code' => qa_get_form_security_code('donut/admin_options')));
     return $form;
 }
Ejemplo n.º 7
0
 public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'db/selects.php';
     if (!isset($qa_content['q_view']['raw']['type']) || $qa_content['q_view']['raw']['type'] != 'Q') {
         // question might not be visible, etc...
         return;
     }
     $questionid = $qa_content['q_view']['raw']['postid'];
     $userid = qa_get_logged_in_userid();
     $cookieid = qa_cookie_get();
     $questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
     $minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
     foreach ($questions as $key => $question) {
         if ($question['score'] < $minscore) {
             unset($questions[$key]);
         }
     }
     $titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
     if ($region == 'side') {
         $themeobject->output('<div class="qa-related-qs">', '<h2 style="margin-top:0; padding-top:0;">', $titlehtml, '</h2>');
         $themeobject->output('<ul class="qa-related-q-list">');
         foreach ($questions as $question) {
             $themeobject->output('<li class="qa-related-q-item">' . '<a href="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</a>' . '</li>');
         }
         $themeobject->output('</ul>', '</div>');
     } else {
         $themeobject->output('<h2>', $titlehtml, '</h2>');
         $q_list = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))), 'qs' => array());
         $defaults = qa_post_html_defaults('Q');
         $usershtml = qa_userids_handles_html($questions);
         foreach ($questions as $question) {
             $q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults));
         }
         $themeobject->q_list_and_form($q_list);
     }
 }
Ejemplo n.º 8
0
    $inmessage = qa_post_text('message');
    if (!strlen($inmessage)) {
        $errors['message'] = qa_lang('profile/post_wall_empty');
    } elseif (!qa_check_form_security_code('wall-' . $useraccount['handle'], qa_post_text('code'))) {
        $errors['message'] = qa_lang_html('misc/form_security_again');
    } elseif (!$wallposterrorhtml) {
        qa_wall_add_post($loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), $useraccount['userid'], $useraccount['handle'], $inmessage, '');
        qa_redirect(qa_request());
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('profile/wall_for_x', $userhtml);
$qa_content['error'] = @$errors['page'];
$qa_content['script_rel'][] = 'qa-content/qa-user.js?' . QA_VERSION;
$qa_content['message_list'] = array('tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'hidden' => array('qa_click' => '', 'handle' => qa_html($useraccount['handle']), 'start' => qa_html($start), 'code' => qa_get_form_security_code('wall-' . $useraccount['handle']))), 'messages' => array());
if ($start == 0) {
    // only allow posting on first page
    if ($wallposterrorhtml) {
        $qa_content['message_list']['error'] = $wallposterrorhtml;
    } else {
        $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message'])));
        $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, false);"', 'label' => qa_lang_html('profile/post_wall_button')));
    }
}
foreach ($usermessages as $message) {
    $qa_content['message_list']['messages'][] = qa_wall_post_view($message);
}
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
//	Sub menu for navigation in user pages
$ismyuser = isset($loginuserid) && $loginuserid == (QA_FINAL_EXTERNAL_USERS ? $userid : $useraccount['userid']);
Ejemplo n.º 9
0
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/stats_title');
$qa_content['error'] = qa_admin_page_error();
$qa_content['form'] = array('style' => 'wide', 'fields' => array('q2a_version' => array('label' => qa_lang_html('admin/q2a_version'), 'value' => qa_html(QA_VERSION)), 'q2a_date' => array('label' => qa_lang_html('admin/q2a_build_date'), 'value' => qa_html(QA_BUILD_DATE)), 'q2a_latest' => array('label' => qa_lang_html('admin/q2a_latest_version'), 'type' => 'custom', 'html' => '<iframe src="http://www.question2answer.org/question2answer-latest.php?version=' . urlencode(QA_VERSION) . '&language=' . urlencode(qa_opt('site_language')) . '" width="100" height="16" style="vertical-align:middle; border:0; background:transparent;" allowTransparency="true" scrolling="no" frameborder="0"></iframe>'), 'break0' => array('type' => 'blank'), 'db_version' => array('label' => qa_lang_html('admin/q2a_db_version'), 'value' => qa_html(qa_opt('db_version'))), 'db_size' => array('label' => qa_lang_html('admin/q2a_db_size'), 'value' => qa_html(number_format(qa_db_table_size() / 1048576, 1) . ' MB')), 'break1' => array('type' => 'blank'), 'php_version' => array('label' => qa_lang_html('admin/php_version'), 'value' => qa_html(phpversion())), 'mysql_version' => array('label' => qa_lang_html('admin/mysql_version'), 'value' => qa_html(qa_db_mysql_version())), 'break2' => array('type' => 'blank'), 'qcount' => array('label' => qa_lang_html('admin/total_qs'), 'value' => qa_html(number_format($qcount))), 'qcount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($qcount - $qcount_anon))), 'qcount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($qcount_anon))), 'break3' => array('type' => 'blank'), 'acount' => array('label' => qa_lang_html('admin/total_as'), 'value' => qa_html(number_format($acount))), 'acount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($acount - $acount_anon))), 'acount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($acount_anon))), 'break4' => array('type' => 'blank'), 'ccount' => array('label' => qa_lang_html('admin/total_cs'), 'value' => qa_html(number_format($ccount))), 'ccount_users' => array('label' => qa_lang_html('admin/from_users'), 'value' => qa_html(number_format($ccount - $ccount_anon))), 'ccount_anon' => array('label' => qa_lang_html('admin/from_anon'), 'value' => qa_html(number_format($ccount_anon))), 'break5' => array('type' => 'blank'), 'users' => array('label' => qa_lang_html('admin/users_registered'), 'value' => QA_FINAL_EXTERNAL_USERS ? '' : qa_html(number_format(qa_db_count_users()))), 'users_active' => array('label' => qa_lang_html('admin/users_active'), 'value' => qa_html(number_format((int) qa_opt('cache_userpointscount')))), 'users_posted' => array('label' => qa_lang_html('admin/users_posted'), 'value' => qa_html(number_format(qa_db_count_active_users('posts')))), 'users_voted' => array('label' => qa_lang_html('admin/users_voted'), 'value' => qa_html(number_format(qa_db_count_active_users('uservotes'))))));
if (QA_FINAL_EXTERNAL_USERS) {
    unset($qa_content['form']['fields']['users']);
} else {
    unset($qa_content['form']['fields']['users_active']);
}
foreach ($qa_content['form']['fields'] as $index => $field) {
    if (empty($field['type'])) {
        $qa_content['form']['fields'][$index]['type'] = 'static';
    }
}
$qa_content['form_2'] = array('tags' => 'method="post" action="' . qa_path_html('admin/recalc') . '"', 'title' => qa_lang_html('admin/database_cleanup'), 'style' => 'basic', 'buttons' => array('recount_posts' => array('label' => qa_lang_html('admin/recount_posts'), 'tags' => 'name="dorecountposts" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recount_posts_stop')) . ', \'recount_posts_note\');"', 'note' => '<span id="recount_posts_note">' . qa_lang_html('admin/recount_posts_note') . '</span>'), 'reindex_content' => array('label' => qa_lang_html('admin/reindex_content'), 'tags' => 'name="doreindexcontent" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/reindex_content_stop')) . ', \'reindex_content_note\');"', 'note' => '<span id="reindex_content_note">' . qa_lang_html('admin/reindex_content_note') . '</span>'), 'recalc_points' => array('label' => qa_lang_html('admin/recalc_points'), 'tags' => 'name="dorecalcpoints" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recalc_stop')) . ', \'recalc_points_note\');"', 'note' => '<span id="recalc_points_note">' . qa_lang_html('admin/recalc_points_note') . '</span>'), 'refill_events' => array('label' => qa_lang_html('admin/refill_events'), 'tags' => 'name="dorefillevents" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recalc_stop')) . ', \'refill_events_note\');"', 'note' => '<span id="refill_events_note">' . qa_lang_html('admin/refill_events_note') . '</span>'), 'recalc_categories' => array('label' => qa_lang_html('admin/recalc_categories'), 'tags' => 'name="dorecalccategories" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/recalc_stop')) . ', \'recalc_categories_note\');"', 'note' => '<span id="recalc_categories_note">' . qa_lang_html('admin/recalc_categories_note') . '</span>'), 'delete_hidden' => array('label' => qa_lang_html('admin/delete_hidden'), 'tags' => 'name="dodeletehidden" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/delete_stop')) . ', \'delete_hidden_note\');"', 'note' => '<span id="delete_hidden_note">' . qa_lang_html('admin/delete_hidden_note') . '</span>')), 'hidden' => array('code' => qa_get_form_security_code('admin/recalc')));
if (!qa_using_categories()) {
    unset($qa_content['form_2']['buttons']['recalc_categories']);
}
if (defined('QA_BLOBS_DIRECTORY')) {
    if (qa_db_has_blobs_in_db()) {
        $qa_content['form_2']['buttons']['blobs_to_disk'] = array('label' => qa_lang_html('admin/blobs_to_disk'), 'tags' => 'name="doblobstodisk" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/blobs_stop')) . ', \'blobs_to_disk_note\');"', 'note' => '<span id="blobs_to_disk_note">' . qa_lang_html('admin/blobs_to_disk_note') . '</span>');
    }
    if (qa_db_has_blobs_on_disk()) {
        $qa_content['form_2']['buttons']['blobs_to_db'] = array('label' => qa_lang_html('admin/blobs_to_db'), 'tags' => 'name="doblobstodb" onclick="return qa_recalc_click(this.name, this, ' . qa_js(qa_lang_html('admin/blobs_stop')) . ', \'blobs_to_db_note\');"', 'note' => '<span id="blobs_to_db_note">' . qa_lang_html('admin/blobs_to_db_note') . '</span>');
    }
}
$qa_content['script_rel'][] = 'qa-content/qa-admin.js?' . QA_VERSION;
$qa_content['script_var']['qa_warning_recalc'] = qa_lang('admin/stop_recalc_warning');
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
Ejemplo n.º 10
0
            foreach ($postids as $postid) {
                qa_post_set_hidden($postid, true, $userid);
            }
            qa_redirect(qa_request());
        }
    }
}
//	Combine sets of questions and get information for users
$questions = qa_any_sort_by_date(array_merge($qs, $qs_queued, $qs_hidden, $a_qs, $a_queued_qs, $a_hidden_qs, $c_qs, $c_queued_qs, $c_hidden_qs, $edit_qs));
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$hostname = gethostbyaddr($ip);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html_sub('main/ip_address_x', qa_html($ip));
$qa_content['error'] = @$pageerror;
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('host' => array('type' => 'static', 'label' => qa_lang_html('misc/host_name'), 'value' => qa_html($hostname))), 'hidden' => array('code' => qa_get_form_security_code('ip-' . $ip)));
if ($blockable) {
    require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
    $blockipclauses = qa_block_ips_explode(qa_opt('block_ips_write'));
    $matchclauses = array();
    foreach ($blockipclauses as $blockipclause) {
        if (qa_block_ip_match($ip, $blockipclause)) {
            $matchclauses[] = $blockipclause;
        }
    }
    if (count($matchclauses)) {
        $qa_content['form']['fields']['status'] = array('type' => 'static', 'label' => qa_lang_html('misc/matches_blocked_ips'), 'value' => qa_html(implode("\n", $matchclauses), true));
        $qa_content['form']['buttons']['unblock'] = array('tags' => 'name="dounblock"', 'label' => qa_lang_html('misc/unblock_ip_button'));
        if (count($questions) && !qa_user_maximum_permit_error('permit_hide_show')) {
            $qa_content['form']['buttons']['hideall'] = array('tags' => 'name="dohideall" onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('misc/hide_all_ip_button'));
        }
Ejemplo n.º 11
0
    ?>
		</tt>

		<a href="<?php 
    echo qa_path_html('admin/stats');
    ?>
"><?php 
    echo qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/stats_title');
    ?>
</a>
	</body>
</html>

<?php 
    qa_exit();
} elseif (isset($state)) {
    $qa_content = qa_content_prepare();
    $qa_content['title'] = qa_lang_html('admin/admin_title');
    $qa_content['error'] = qa_lang_html('misc/form_security_again');
    $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'buttons' => array('recalc' => array('tags' => 'name="' . qa_html($state) . '"', 'label' => qa_lang_html('misc/form_security_again'))), 'hidden' => array('code' => qa_get_form_security_code('admin/recalc')));
    return $qa_content;
} else {
    require_once QA_INCLUDE_DIR . 'app/format.php';
    $qa_content = qa_content_prepare();
    $qa_content['title'] = qa_lang_html('admin/admin_title');
    $qa_content['error'] = qa_lang_html('main/page_not_found');
    return $qa_content;
}
/*
	Omit PHP closing tag to help avoid accidental output
*/
Ejemplo n.º 12
0
<?php

session_start();
require_once '../bmf/bk_base.php';
require_once '../bmf/qa_base.php';
require_once QA_INCLUDE_DIR . 'app/users.php';
$securitycode = qa_get_form_security_code('ask');
?>
<!DOCTYPE html>
<!-- saved from url=(0029)http://beimeifang.net/?qa=ask -->
<html g_init="6793"><!-- Powered by Question2Answer - http://www.question2answer.org/ -->
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		
		<meta charset="utf-8">
        <meta HTTP-EQUIV="pragma" CONTENT="no-cache">
        <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
        <meta HTTP-EQUIV="expires" CONTENT="0">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta name="description" content="">
		<meta name="author" content="">
		<title>提一个问题</title>
		<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
		<link rel="stylesheet" type="text/css" href="css/donut.css">
		<link rel="stylesheet" type="text/css" href="css/donut-responsive.css">
        <link media="all" rel="stylesheet" href="css/common.css" type="text/css">
		<script>
		
		var qa_wysiwyg_editor_config = {
			toolbar: [
				{ name: 'basic', items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript' ] },
Ejemplo n.º 13
0
    } else {
        $pageerror = qa_lang('users/login_limit');
    }
} else {
    $inemailhandle = qa_get('e');
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/login_title');
$qa_content['error'] = @$pageerror;
if (empty($inemailhandle) || isset($errors['emailhandle'])) {
    $forgotpath = qa_path('forgot');
} else {
    $forgotpath = qa_path('forgot', array('e' => $inemailhandle));
}
$forgothtml = '<a href="' . qa_html($forgotpath) . '">' . qa_lang_html('users/forgot_link') . '</a>';
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'ok' => $passwordsent ? qa_lang_html('users/password_sent') : ($emailexists ? qa_lang_html('users/email_exists') : null), 'fields' => array('email_handle' => array('label' => qa_opt('allow_login_email_only') ? qa_lang_html('users/email_label') : qa_lang_html('users/email_handle_label'), 'tags' => 'name="emailhandle" id="emailhandle"', 'value' => qa_html(@$inemailhandle), 'error' => qa_html(@$errors['emailhandle'])), 'password' => array('type' => 'password', 'label' => qa_lang_html('users/password_label'), 'tags' => 'name="password" id="password"', 'value' => qa_html(@$inpassword), 'error' => empty($errors['password']) ? '' : qa_html(@$errors['password']) . ' - ' . $forgothtml, 'note' => $passwordsent ? qa_lang_html('users/password_sent') : $forgothtml), 'remember' => array('type' => 'checkbox', 'label' => qa_lang_html('users/remember_label'), 'tags' => 'name="remember"', 'value' => @$inremember ? true : false)), 'buttons' => array('login' => array('label' => qa_lang_html('users/login_button'))), 'hidden' => array('dologin' => '1', 'code' => qa_get_form_security_code('login')));
$loginmodules = qa_load_modules_with('login', 'login_html');
foreach ($loginmodules as $module) {
    ob_start();
    $module->login_html(qa_opt('site_url') . qa_get('to'), 'login');
    $html = ob_get_clean();
    if (strlen($html)) {
        @($qa_content['custom'] .= '<br>' . $html . '<br>');
    }
}
$qa_content['focusid'] = isset($inemailhandle) && !isset($errors['emailhandle']) ? 'password' : 'emailhandle';
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Ejemplo n.º 14
0
        }
    }
}
//	Get information for users
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
//	Create list of actual hidden postids and see which ones have dependents
$qhiddenpostid = array();
foreach ($questions as $key => $question) {
    $qhiddenpostid[$key] = isset($question['opostid']) ? $question['opostid'] : $question['postid'];
}
$dependcounts = qa_db_postids_count_dependents($qhiddenpostid);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/recent_hidden_title');
$qa_content['error'] = isset($pageerror) ? $pageerror : qa_admin_page_error();
$qa_content['q_list'] = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('admin/click'))), 'qs' => array());
if (count($questions)) {
    foreach ($questions as $key => $question) {
        $elementid = 'p' . $qhiddenpostid[$key];
        $htmloptions = qa_post_html_options($question);
        $htmloptions['voteview'] = false;
        $htmloptions['tagsview'] = !isset($question['opostid']);
        $htmloptions['answersview'] = false;
        $htmloptions['viewsview'] = false;
        $htmloptions['updateview'] = false;
        $htmloptions['contentview'] = true;
        $htmloptions['flagsview'] = true;
        $htmloptions['elementid'] = $elementid;
        $htmlfields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, $htmloptions);
        if (isset($htmlfields['what_url'])) {
            // link directly to relevant content
Ejemplo n.º 15
0
}
//	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
*/
Ejemplo n.º 16
0
 /**
  * login form
  *
  * @since Snow 1.4
  * @global array $qam_snow
  */
 public function nav_user_search()
 {
     // outputs login form if user not logged in
     global $qam_snow;
     $this->output('<div class="qam-account-items-wrapper">');
     $this->qam_user_account();
     $this->output('<div class="qam-account-items clearfix">');
     if (!qa_is_logged_in()) {
         if (isset($this->content['navigation']['user']['login']) && !QA_FINAL_EXTERNAL_USERS) {
             $login = $this->content['navigation']['user']['login'];
             $this->output('<!--[Begin: login form]-->', '<form id="qa-loginform" action="' . $login['url'] . '" method="post">', '<input type="text" id="qa-userid" name="emailhandle" placeholder="' . trim(qa_lang_html('users/email_handle_label'), ':') . '" />', '<input type="password" id="qa-password" name="password" placeholder="' . trim(qa_lang_html('users/password_label'), ':') . '" />', '<div id="qa-rememberbox"><input type="checkbox" name="remember" id="qa-rememberme" value="1" />', '<label for="qa-rememberme" id="qa-remember">' . qa_lang_html('users/remember') . '</label></div>', '<input type="hidden" name="code" value="' . qa_html(qa_get_form_security_code('login')) . '" />', '<input type="submit" value="' . $login['label'] . '" id="qa-login" name="dologin" />', '</form>', '<!--[End: login form]-->');
             unset($this->content['navigation']['user']['login']);
             // removes regular navigation link to log in page
         }
     }
     $this->nav('user');
     $this->output('</div> <!-- END qam-account-items -->');
     $this->output('</div> <!-- END qam-account-items-wrapper -->');
 }
Ejemplo n.º 17
0
                $pointstitle[$inpoints] = $intitle;
            }
        }
        //	Save the new option value
        krsort($pointstitle, SORT_NUMERIC);
        $option = '';
        foreach ($pointstitle as $points => $title) {
            $option .= (strlen($option) ? ',' : '') . $points . ' ' . $title;
        }
        qa_set_option('points_to_titles', $option);
        if (empty($errors)) {
            qa_redirect('admin/users');
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/users_title');
$qa_content['error'] = $securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error();
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_path_html(qa_request()) . '"', 'style' => 'tall', 'fields' => array('title' => array('tags' => 'name="title" id="title"', 'label' => qa_lang_html('admin/user_title'), 'value' => qa_html(isset($intitle) ? $intitle : @$pointstitle[$oldpoints]), 'error' => qa_html(@$errors['title'])), 'delete' => array('tags' => 'name="dodelete" id="dodelete"', 'label' => qa_lang_html('admin/delete_title'), 'value' => 0, 'type' => 'checkbox'), 'points' => array('id' => 'points_display', 'tags' => 'name="points"', 'label' => qa_lang_html('admin/points_required'), 'type' => 'number', 'value' => qa_html(isset($inpoints) ? $inpoints : @$oldpoints), 'error' => qa_html(@$errors['points']))), 'buttons' => array('save' => array('label' => qa_lang_html(isset($pointstitle[$oldpoints]) ? 'main/save_button' : 'admin/add_title_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array('dosavetitle' => '1', 'edit' => @$oldpoints, 'code' => qa_get_form_security_code('admin/usertitles')));
if (isset($pointstitle[$oldpoints])) {
    qa_set_display_rules($qa_content, array('points_display' => '!dodelete'));
} else {
    unset($qa_content['form']['fields']['delete']);
}
$qa_content['focusid'] = 'title';
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Ejemplo n.º 18
0
function ra_ajax_upload_cover()
{
    ?>
	<div id="cover-uploader" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
	<form method="post" enctype="multipart/form-data">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title"><?php 
    ra_lang('Upload cover');
    ?>
</h4>
      </div>
      <div class="modal-body">
        
			<label for="cover"><?php 
    ra_lang('File name');
    ?>
</label>
			<input type="file" name="cover" id="cover">
			<input type="hidden" name="code" value="<?php 
    echo qa_get_form_security_code('upload_cover');
    ?>
">
		
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal"><?php 
    ra_lang('Close');
    ?>
</button>
        <button type="submit" class="btn btn-primary"><?php 
    ra_lang('Save changes');
    ?>
</button>
      </div>
	  </form>
    </div>
  </div>
</div>

		
	<?php 
    die;
}
        unset($qa_content['form']['fields']['url']);
        unset($qa_content['form']['fields']['newwindow']);
    }
    if (isset($editpage['pageid'])) {
        qa_set_display_rules($qa_content, array('position_display' => '!dodelete', 'permit_display' => '!dodelete', $isexternal ? 'url_display' : 'slug_display' => '!dodelete', $isexternal ? 'newwindow_display' : 'heading_display' => '!dodelete', 'content_display' => '!dodelete'));
    } else {
        unset($qa_content['form']['fields']['slug']);
        unset($qa_content['form']['fields']['delete']);
    }
    if ($isexternal || !isset($editpage['pageid'])) {
        unset($qa_content['form']['buttons']['saveview']);
    }
    $qa_content['focusid'] = 'name';
} else {
    //	List of standard navigation links
    $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(), 'buttons' => array('save' => array('tags' => 'name="dosaveoptions"', 'label' => qa_lang_html('main/save_button')), 'addpage' => array('tags' => 'name="doaddpage"', 'label' => qa_lang_html('admin/add_page_button')), 'addlink' => array('tags' => 'name="doaddlink"', 'label' => qa_lang_html('admin/add_link_button'))), 'hidden' => array('code' => qa_get_form_security_code('admin/pages')));
    $qa_content['form']['fields']['navlinks'] = array('label' => qa_lang_html('admin/nav_links_explanation'), 'type' => 'static', 'tight' => true);
    foreach ($navoptions as $optionname => $langkey) {
        $qa_content['form']['fields'][$optionname] = array('label' => '<a href="' . qa_path_html($navpaths[$optionname]) . '">' . qa_lang_html($langkey) . '</a>', 'tags' => 'name="option_' . $optionname . '"', 'type' => 'checkbox', 'value' => qa_opt($optionname));
    }
    $qa_content['form']['fields'][] = array('type' => 'blank');
    //	List of suggested plugin pages
    $listhtml = '';
    $pagemodules = qa_load_modules_with('page', 'suggest_requests');
    foreach ($pagemodules as $tryname => $trypage) {
        $suggestrequests = $trypage->suggest_requests();
        foreach ($suggestrequests as $suggestrequest) {
            $listhtml .= '<li><b><a href="' . qa_path_html($suggestrequest['request']) . '">' . qa_html($suggestrequest['title']) . '</a></b>';
            $listhtml .= qa_lang_html_sub('admin/plugin_module', qa_html($tryname));
            $listhtml .= strtr(qa_lang_html('admin/add_link_link'), array('^1' => '<a href="' . qa_path_html(qa_request(), array('doaddlink' => 1, 'text' => $suggestrequest['title'], 'url' => $suggestrequest['request'], 'nav' => @$suggestrequest['nav'])) . '">', '^2' => '</a>'));
            if (method_exists($trypage, 'admin_form')) {
            } else {
                $pageerror = qa_lang_html('main/general_error');
            }
            qa_report_event('u_message', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $toaccount['userid'], 'handle' => $toaccount['handle'], 'messageid' => $messageid, 'message' => $inmessage));
            if ($messagesent && qa_opt('show_message_history')) {
                // show message as part of general history
                qa_redirect(qa_request(), array('state' => 'message-sent'));
            }
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/private_message_title');
$qa_content['error'] = @$pageerror;
$qa_content['form_message'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $messagesent ? 'static' : '', 'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)), 'tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, $messagesent), 'rows' => 8, 'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))), 'error' => qa_html(@$errors['message']))), 'buttons' => array('send' => array('tags' => 'onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('main/send_button'))), 'hidden' => array('domessage' => '1', 'code' => qa_get_form_security_code('message-' . $handle)));
$qa_content['focusid'] = 'message';
if ($messagesent) {
    $qa_content['form_message']['ok'] = qa_lang_html('misc/message_sent');
    unset($qa_content['form_message']['buttons']);
    if (qa_opt('show_message_history')) {
        unset($qa_content['form_message']['fields']['message']);
    } else {
        unset($qa_content['form_message']['fields']['message']['note']);
        unset($qa_content['form_message']['fields']['message']['label']);
    }
}
//	If relevant, show recent message history
if (qa_opt('show_message_history')) {
    $recent = array_merge($torecent, $fromrecent);
    qa_sort_by($recent, 'created');
                $maxposition = max($maxposition, $widget['position']);
                $positionoptions[$place . $widget['position']] = $positionhtml;
                $previous = $widget;
            }
        }
        if (!isset($editwidget['widgetid']) || $place != @$editwidget['place']) {
            $positionhtml = $optionhtml;
            if (isset($previous)) {
                $positionhtml .= ' - ' . qa_lang_html_sub('admin/after_x', $previous['title']);
            }
            $positionoptions[$place . (isset($previous) ? 1 + $maxposition : 1)] = $positionhtml;
        }
    }
}
$positionvalue = @$positionoptions[$editwidget['place'] . $editwidget['position']];
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_path_html(qa_request()) . '"', 'style' => 'tall', 'fields' => array('title' => array('label' => qa_lang_html('admin/widget_name') . ' &nbsp; ' . qa_html($editwidget['title']), 'type' => 'static', 'tight' => true), 'position' => array('id' => 'position_display', 'tags' => 'name="position"', 'label' => qa_lang_html('admin/position'), 'type' => 'select', 'options' => $positionoptions, 'value' => $positionvalue), 'delete' => array('tags' => 'name="dodelete" id="dodelete"', 'label' => qa_lang_html('admin/delete_widget_position'), 'value' => 0, 'type' => 'checkbox'), 'all' => array('id' => 'all_display', 'label' => qa_lang_html('admin/widget_all_pages'), 'type' => 'checkbox', 'tags' => 'name="template_all" id="template_all"', 'value' => is_numeric(strpos(',' . @$editwidget['tags'] . ',', ',all,'))), 'templates' => array('id' => 'templates_display', 'label' => qa_lang_html('admin/widget_pages_explanation'), 'type' => 'custom', 'html' => '')), 'buttons' => array('save' => array('label' => qa_lang_html(isset($editwidget['widgetid']) ? 'main/save_button' : 'admin/add_widget_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array('dosavewidget' => '1', 'edit' => @$editwidget['widgetid'], 'title' => @$editwidget['title'], 'code' => qa_get_form_security_code('admin/widgets')));
foreach ($templateoptions as $template => $optionhtml) {
    $qa_content['form']['fields']['templates']['html'] .= '<input type="checkbox" name="template_' . qa_html($template) . '"' . (is_numeric(strpos(',' . @$editwidget['tags'] . ',', ',' . $template . ',')) ? ' checked' : '') . '/> ' . $optionhtml . '<br/>';
}
if (isset($editwidget['widgetid'])) {
    qa_set_display_rules($qa_content, array('templates_display' => '!(dodelete||template_all)', 'all_display' => '!dodelete'));
} else {
    unset($qa_content['form']['fields']['delete']);
    qa_set_display_rules($qa_content, array('templates_display' => '!template_all'));
}
if (!$widgetfound) {
    unset($qa_content['form']['fields']['title']['tight']);
    $qa_content['form']['fields']['title']['error'] = qa_lang_html('admin/widget_not_available');
    unset($qa_content['form']['fields']['position']);
    unset($qa_content['form']['fields']['all']);
    unset($qa_content['form']['fields']['templates']);
Ejemplo n.º 22
0
if (@$userpoints['aselecteds']) {
    $qa_content['form_activity']['fields']['answers']['value'] .= $userpoints['aselecteds'] == 1 ? qa_lang_html_sub('profile/1_chosen_as_best', '<span class="qa-uf-user-a-selecteds">1</span>', '1') : qa_lang_html_sub('profile/x_chosen_as_best', '<span class="qa-uf-user-a-selecteds">' . number_format($userpoints['aselecteds']) . '</span>');
}
//	For plugin layers to access
$qa_content['raw']['userid'] = $userid;
$qa_content['raw']['points'] = $userpoints;
$qa_content['raw']['rank'] = $userrank;
//	Wall posts
if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) {
    $qa_content['message_list'] = array('title' => '<a name="wall">' . qa_lang_html_sub('profile/wall_for_x', $userhtml) . '</a>', 'tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '#wall"', 'style' => 'tall', 'hidden' => array('qa_click' => '')), 'messages' => array());
    if ($wallposterrorhtml) {
        $qa_content['message_list']['error'] = $wallposterrorhtml;
    } else {
        $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message'])));
        $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, true);"', 'label' => qa_lang_html('profile/post_wall_button')));
        $qa_content['message_list']['form']['hidden']['handle'] = qa_html($useraccount['handle']);
        $qa_content['message_list']['form']['hidden']['code'] = qa_get_form_security_code('wall-' . $useraccount['handle']);
    }
    foreach ($usermessages as $message) {
        $qa_content['message_list']['messages'][] = qa_wall_post_view($message);
    }
    if ($useraccount['wallposts'] > count($usermessages)) {
        $qa_content['message_list']['messages'][] = qa_wall_view_more_link($handle, count($usermessages));
    }
}
//	Sub menu for navigation in user pages
$qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'profile');
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
        }
    }
    $usershtml = qa_userids_handles_html($fullquestions);
    //	Report the search event
    qa_report_event('search', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('query' => $inquery, 'start' => $start));
}
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
if (strlen(qa_get('q'))) {
    $qa_content['search']['value'] = qa_html($inquery);
    if (count($results)) {
        $qa_content['title'] = qa_lang_html_sub('main/results_for_x', qa_html($inquery));
    } else {
        $qa_content['title'] = qa_lang_html_sub('main/no_results_for_x', qa_html($inquery));
    }
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    $qdefaults = qa_post_html_defaults('Q');
    foreach ($results as $result) {
        if (!isset($result['question'])) {
            // if we have any non-question results, display with less statistics
            $qdefaults['voteview'] = false;
            $qdefaults['answersview'] = false;
            $qdefaults['viewsview'] = false;
            break;
        }
    }
    foreach ($results as $result) {
        if (isset($result['question'])) {
            $fields = qa_post_html_fields($result['question'], $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($result['question'], $qdefaults));
        } elseif (isset($result['url'])) {
        }
        if (count($matchusers) != 1) {
            // if we get more than one match (should be impossible) also give an error
            $errors['emailhandle'] = qa_lang('users/user_not_found');
        }
        if (qa_opt('captcha_on_reset_password')) {
            qa_captcha_validate_post($errors);
        }
        if (empty($errors)) {
            $inuserid = $matchusers[0];
            qa_start_reset_user($inuserid);
            qa_redirect('reset', $passemailhandle ? array('e' => $inemailhandle) : null);
            // redirect to page where code is entered
        }
    }
} else {
    $inemailhandle = qa_get('e');
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/reset_title');
$qa_content['error'] = @$errors['page'];
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('email_handle' => array('label' => qa_lang_html('users/email_handle_label'), 'tags' => 'name="emailhandle" id="emailhandle"', 'value' => qa_html(@$inemailhandle), 'error' => qa_html(@$errors['emailhandle']), 'note' => qa_lang_html('users/send_reset_note'))), 'buttons' => array('send' => array('label' => qa_lang_html('users/send_reset_button'))), 'hidden' => array('doforgot' => '1', 'code' => qa_get_form_security_code('forgot')));
if (qa_opt('captcha_on_reset_password')) {
    qa_set_up_captcha_field($qa_content, $qa_content['form']['fields'], @$errors);
}
$qa_content['focusid'] = 'emailhandle';
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors)
{
    $commentid = $comment['postid'];
    $prefix = 'c' . $commentid . '_';
    $content = isset($in['content']) ? $in['content'] : $comment['content'];
    $format = isset($in['format']) ? $in['format'] : $comment['format'];
    $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_cs');
    $editor = qa_load_editor($content, $format, $editorname);
    $form = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'id' => $id, 'title' => qa_lang_html('question/edit_c_title'), 'style' => 'tall', 'fields' => array('content' => array_merge(qa_editor_load_field($editor, $qa_content, $content, $format, $prefix . 'content', 4, true), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('save' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script($prefix . 'content') : '') . '"', 'label' => qa_lang_html('main/save_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array($prefix . 'editor' => qa_html($editorname), $prefix . 'dosave' => '1', $prefix . 'code' => qa_get_form_security_code('edit-' . $commentid)));
    if ($comment['isbyuser']) {
        if (!qa_is_logged_in()) {
            qa_set_up_name_field($qa_content, $form['fields'], isset($in['name']) ? $in['name'] : @$comment['name'], $prefix);
        }
        qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : !empty($comment['notify']), isset($in['email']) ? $in['email'] : @$comment['notify'], @$errors['email'], $prefix);
    }
    if (!qa_user_post_permit_error('permit_edit_silent', $comment)) {
        $form['fields']['silent'] = array('type' => 'checkbox', 'label' => qa_lang_html('question/save_silent_label'), 'tags' => 'name="' . $prefix . 'silent"', 'value' => qa_html(@$in['silent']));
    }
    return $form;
}
Ejemplo n.º 26
0
function qa_favorite_form($entitytype, $entityid, $favorite, $title)
{
    return array('form_tags' => 'method="post" action="' . qa_self_html() . '"', 'form_hidden' => array('code' => qa_get_form_security_code('favorite-' . $entitytype . '-' . $entityid)), 'favorite_tags' => 'id="favoriting"', $favorite ? 'favorite_remove_tags' : 'favorite_add_tags' => 'title="' . qa_html($title) . '" name="' . qa_html('favorite_' . $entitytype . '_' . $entityid . '_' . (int) (!$favorite)) . '" onclick="return qa_favorite_click(this);"');
}
        }
    }
    $options = qa_get_options($optionnames);
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/admin_title') . ' - ' . qa_lang_html('admin/points_title');
$qa_content['error'] = $securityexpired ? qa_lang_html('admin/form_security_expired') : qa_admin_page_error();
$qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '" name="points_form" onsubmit="document.forms.points_form.has_js.value=1; return true;"', 'style' => 'wide', 'buttons' => array('saverecalc' => array('tags' => 'id="dosaverecalc"', 'label' => qa_lang_html('admin/save_recalc_button'))), 'hidden' => array('dosaverecalc' => '1', 'has_js' => '0', 'code' => qa_get_form_security_code('admin/points')));
if (qa_clicked('doshowdefaults')) {
    $qa_content['form']['ok'] = qa_lang_html('admin/points_defaults_shown');
    $qa_content['form']['buttons']['cancel'] = array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'));
} else {
    if ($recalculate) {
        $qa_content['form']['ok'] = '<span id="recalc_ok"></span>';
        $qa_content['form']['hidden']['code_recalc'] = qa_get_form_security_code('admin/recalc');
        $qa_content['script_rel'][] = 'qa-content/qa-admin.js?' . QA_VERSION;
        $qa_content['script_var']['qa_warning_recalc'] = qa_lang('admin/stop_recalc_warning');
        $qa_content['script_onloads'][] = array("qa_recalc_click('dorecalcpoints', document.getElementById('dosaverecalc'), null, 'recalc_ok');");
    }
    $qa_content['form']['buttons']['showdefaults'] = array('tags' => 'name="doshowdefaults"', 'label' => qa_lang_html('admin/show_defaults_button'));
}
foreach ($optionnames as $optionname) {
    $optionfield = array('label' => qa_lang_html('options/' . $optionname), 'tags' => 'name="option_' . $optionname . '"', 'value' => qa_html($options[$optionname]), 'type' => 'number', 'note' => qa_lang_html('admin/points'));
    switch ($optionname) {
        case 'points_multiple':
            $prefix = '&#215;';
            unset($optionfield['note']);
            break;
        case 'points_per_q_voted_up':
        case 'points_per_a_voted_up':
        $pluginhtml = $namehtml . ' ' . $authorhtml . ' ' . $updatehtml . '<br>' . $deschtml . (strlen($deschtml) ? '<br>' : '') . '<small style="color:#666">' . qa_html($plugindirectory) . '</small>';
        if (qa_qa_version_below(@$metadata['min_q2a'])) {
            $pluginhtml = '<strike style="color:#999">' . $pluginhtml . '</strike><br><span style="color:#f00">' . qa_lang_html_sub('admin/requires_q2a_version', qa_html($metadata['min_q2a'])) . '</span>';
        } elseif (qa_php_version_below(@$metadata['min_php'])) {
            $pluginhtml = '<strike style="color:#999">' . $pluginhtml . '</strike><br><span style="color:#f00">' . qa_lang_html_sub('admin/requires_php_version', qa_html($metadata['min_php'])) . '</span>';
        }
        $qa_content['form_plugin_' . $pluginindex] = array('tags' => 'id="' . qa_html($hash) . '"', 'style' => 'tall', 'fields' => array(array('type' => 'custom', 'html' => $pluginhtml)));
        if ($showthisform && isset($pluginoptionmodules[$plugindirectory])) {
            foreach ($pluginoptionmodules[$plugindirectory] as $pluginoptionmodule) {
                $type = $pluginoptionmodule['type'];
                $name = $pluginoptionmodule['name'];
                $module = qa_load_module($type, $name);
                $form = $module->admin_form($qa_content);
                if (!isset($form['tags'])) {
                    $form['tags'] = 'method="post" action="' . qa_admin_plugin_options_path($plugindirectory) . '"';
                }
                if (!isset($form['style'])) {
                    $form['style'] = 'tall';
                }
                $form['boxed'] = true;
                $form['hidden']['qa_form_security_code'] = qa_get_form_security_code('admin/plugins');
                $qa_content['form_plugin_options'] = $form;
            }
        }
    }
}
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
Ejemplo n.º 29
0
            qa_redirect(qa_q_request($questionid, $in['title']));
            // our work is done here
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare(false, array_keys(qa_category_path($categories, @$in['categoryid'])));
$qa_content['title'] = qa_lang_html(isset($followanswer) ? 'question/ask_follow_title' : 'question/ask_title');
$qa_content['error'] = @$errors['page'];
$editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs');
$editor = qa_load_editor(@$in['content'], @$in['format'], $editorname);
$field = qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false);
$field['label'] = qa_lang_html('question/q_content_label');
$field['error'] = qa_html(@$errors['content']);
$custom = qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : '';
$qa_content['form'] = array('tags' => 'name="ask" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('custom' => array('type' => 'custom', 'note' => $custom), 'title' => array('label' => qa_lang_html('question/q_title_label'), 'tags' => 'name="title" id="title" autocomplete="off"', 'value' => qa_html(@$in['title']), 'error' => qa_html(@$errors['title'])), 'similar' => array('type' => 'custom', 'html' => '<span id="similar"></span>'), 'content' => $field), 'buttons' => array('ask' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script('content') : '') . '"', 'label' => qa_lang_html('question/ask_button'))), 'hidden' => array('editor' => qa_html($editorname), 'code' => qa_get_form_security_code('ask'), 'doask' => '1'));
if (!strlen($custom)) {
    unset($qa_content['form']['fields']['custom']);
}
if (qa_opt('do_ask_check_qs') || qa_opt('do_example_tags')) {
    $qa_content['script_rel'][] = 'qa-content/qa-ask.js?' . QA_VERSION;
    $qa_content['form']['fields']['title']['tags'] .= ' onchange="qa_title_change(this.value);"';
    if (strlen(@$in['title'])) {
        $qa_content['script_onloads'][] = 'qa_title_change(' . qa_js($in['title']) . ');';
    }
}
if (isset($followanswer)) {
    $viewer = qa_load_viewer($followanswer['content'], $followanswer['format']);
    $field = array('type' => 'static', 'label' => qa_lang_html('question/ask_follow_from_a'), 'value' => $viewer->get_html($followanswer['content'], $followanswer['format'], array('blockwordspreg' => qa_get_block_words_preg())));
    qa_array_insert($qa_content['form']['fields'], 'title', array('follows' => $field));
}
if (@$userpoints['points']) {
    $qa_content['form_activity']['fields']['points']['value'] .= qa_lang_html_sub('profile/ranked_x', '<span class="qa-uf-user-rank">' . number_format($userrank) . '</span>');
}
if (@$userpoints['aselects']) {
    $qa_content['form_activity']['fields']['questions']['value'] .= $userpoints['aselects'] == 1 ? qa_lang_html_sub('profile/1_with_best_chosen', '<span class="qa-uf-user-q-selects">1</span>', '1') : qa_lang_html_sub('profile/x_with_best_chosen', '<span class="qa-uf-user-q-selects">' . number_format($userpoints['aselects']) . '</span>');
}
if (@$userpoints['aselecteds']) {
    $qa_content['form_activity']['fields']['answers']['value'] .= $userpoints['aselecteds'] == 1 ? qa_lang_html_sub('profile/1_chosen_as_best', '<span class="qa-uf-user-a-selecteds">1</span>', '1') : qa_lang_html_sub('profile/x_chosen_as_best', '<span class="qa-uf-user-a-selecteds">' . number_format($userpoints['aselecteds']) . '</span>');
}
//	For plugin layers to access
$qa_content['raw']['userid'] = $userid;
$qa_content['raw']['points'] = $userpoints;
$qa_content['raw']['rank'] = $userrank;
//	Wall posts
if (!QA_FINAL_EXTERNAL_USERS && qa_opt('allow_user_walls')) {
    $qa_content['message_list'] = array('title' => '<a name="wall">' . qa_lang_html_sub('profile/wall_for_x', $userhtml) . '</a>', 'tags' => 'id="wallmessages"', 'form' => array('tags' => 'name="wallpost" method="post" action="' . qa_self_html() . '#wall"', 'style' => 'tall', 'hidden' => array('qa_click' => '', 'handle' => qa_html($useraccount['handle']), 'start' => 0, 'code' => qa_get_form_security_code('wall-' . $useraccount['handle']))), 'messages' => array());
    if ($wallposterrorhtml) {
        $qa_content['message_list']['error'] = $wallposterrorhtml;
    } else {
        $qa_content['message_list']['form']['fields'] = array('message' => array('tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, false), 'rows' => 2, 'error' => qa_html(@$errors['message'])));
        $qa_content['message_list']['form']['buttons'] = array('post' => array('tags' => 'name="dowallpost" onclick="return qa_submit_wall_post(this, true);"', 'label' => qa_lang_html('profile/post_wall_button')));
    }
    foreach ($usermessages as $message) {
        $qa_content['message_list']['messages'][] = qa_wall_post_view($message);
    }
    if ($useraccount['wallposts'] > count($usermessages)) {
        $qa_content['message_list']['messages'][] = qa_wall_view_more_link($handle, count($usermessages));
    }
}
//	Sub menu for navigation in user pages
$qa_content['navigation']['sub'] = qa_user_sub_navigation($handle, 'profile', isset($loginuserid) && $loginuserid == (QA_FINAL_EXTERNAL_USERS ? $userid : $useraccount['userid']));