public function process_request($request) { if ($request == 'facebook-login') { $app_id = qa_opt('facebook_app_id'); $app_secret = qa_opt('facebook_app_secret'); $tourl = qa_get('to'); if (!strlen($tourl)) { $tourl = qa_path_absolute(''); } if (strlen($app_id) && strlen($app_secret)) { require_once $this->directory . 'facebook.php'; $facebook = new Facebook(array('appId' => $app_id, 'secret' => $app_secret, 'cookie' => true)); $fb_userid = $facebook->getUser(); if ($fb_userid) { try { $user = $facebook->api('/me?fields=email,name,verified,location,website,about,picture.width(250)'); if (is_array($user)) { qa_log_in_external_user('facebook', $fb_userid, array('email' => @$user['email'], 'handle' => @$user['name'], 'confirmed' => @$user['verified'], 'name' => @$user['name'], 'location' => @$user['location']['name'], 'website' => @$user['website'], 'about' => @$user['bio'], 'avatar' => strlen(@$user['picture']['data']['url']) ? qa_retrieve_url($user['picture']['data']['url']) : null)); } } catch (FacebookApiException $e) { } } else { qa_redirect_raw($facebook->getLoginUrl(array('redirect_uri' => $tourl))); } } qa_redirect_raw($tourl); } }
function main_parts($content) { if (qa_opt('buddypress_integration_enable') && $this->template == 'user' && !qa_get('tab')) { $content = $this->user_buddypress_form($content); } qa_html_theme_base::main_parts($content); }
function donut_get_sub_navigation($page_type, $template = '') { require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-admin.php'; $sub_nav = array(); switch ($page_type) { case 'questions': $sort = qa_get('sort'); $sub_nav = donut_qs_sub_navigation($sort, array()); break; case 'unanswered': $categoryslugs = qa_request_parts(1); $by = qa_get('by'); $sub_nav = donut_unanswered_sub_navigation($by, $categoryslugs); break; case 'users': $sub_nav = donut_users_sub_navigation(); break; case 'admin': $sub_nav = qa_admin_sub_navigation(); break; default: break; } return $sub_nav; }
function process_request($request) { // double check we are admin if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) { return; } if (qa_clicked('docancel')) { qa_redirect('admin/plugins'); } $qa_content = qa_content_prepare(); $qa_content['title'] = 'Widget Anywhere'; $qa_content['custom'] = '<p><a href="' . qa_path('admin/plugins') . '#' . qa_html($this->anchor) . '">« back to plugin options</a></p>'; $saved_msg = null; $editid = qa_get('editid'); if (qa_post_text('dodelete')) { $this->delete_widget(); qa_redirect('admin/plugins'); } else { if (qa_clicked('save_button')) { // save widget $widget = $this->save_widget(); $saved_msg = 'Widget saved.'; } else { if (empty($editid)) { // display blank form $widget = array('id' => 0, 'title' => '', 'pages' => '', 'position' => '', 'ordering' => 1, 'content' => ''); } else { // load specified widget $sql = 'SELECT * FROM ^' . $this->pluginkey . ' WHERE id=#'; $result = qa_db_query_sub($sql, $editid); $widget = qa_db_read_one_assoc($result); } } } $sel_position = empty($widget['position']) ? null : @$this->positionlangs[$widget['position']]; // set up page (template) list $widget_pages = explode(',', $widget['pages']); $sel_pages = array(); $custom_pages = array(); foreach ($widget_pages as $page) { if (strpos($page, 'custom:') === 0) { $custom_pages[] = substr($page, 7); } else { $sel_pages[] = $page; } } // $chkd = in_array('all', $sel_pages) ? 'checked' : ''; // $pages_html = '<label><input type="checkbox" name="wpages_all" ' . $chkd . '> ' . qa_lang_html('admin/widget_all_pages') . '</label><br><br>'; $pages_html = ''; foreach ($this->templatelangkeys as $tmpl => $langkey) { $chkd = in_array($tmpl, $sel_pages) ? 'checked' : ''; $pages_html .= '<label><input type="checkbox" name="wpages_' . $tmpl . '" ' . $chkd . '> ' . qa_lang_html($langkey) . '</label><br>'; } $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'ok' => $saved_msg, 'fields' => array('title' => array('label' => 'Title', 'tags' => 'NAME="wtitle"', 'value' => qa_html($widget['title'])), 'position' => array('type' => 'select', 'label' => 'Position', 'tags' => 'NAME="wposition"', 'options' => $this->positionlangs, 'value' => $sel_position), 'all_pages' => array('type' => 'checkbox', 'id' => 'tb_pages_all', 'label' => qa_lang_html('admin/widget_all_pages'), 'tags' => 'NAME="wpages_all" ID="wpages_all"', 'value' => in_array('all', $sel_pages)), 'pages' => array('type' => 'custom', 'id' => 'tb_pages_list', 'label' => qa_lang_html('admin/widget_pages_explanation'), 'html' => $pages_html), 'show_custom_pages' => array('type' => 'checkbox', 'id' => 'tb_show_custom_pages', 'label' => 'Show on custom page(s)', 'tags' => 'NAME="cb_custom_pages" ID="cb_custom_pages"', 'value' => count($custom_pages) > 0), 'custom_pages' => array('id' => 'tb_custom_pages', 'label' => 'Page slugs', 'tags' => 'NAME="wpages_custom"', 'value' => qa_html(implode(',', $custom_pages)), 'note' => 'Separate multiple page slugs (URL fragments) with commas, e.g. <code>custom-page,other-page</code>'), 'ordering' => array('type' => 'number', 'label' => 'Order', 'tags' => 'NAME="wordering"', 'value' => qa_html($widget['ordering'])), 'content' => array('type' => 'textarea', 'label' => 'Content (HTML)', 'tags' => 'NAME="wcontent"', 'value' => qa_html($widget['content']), 'rows' => 12)), 'hidden' => array('wid' => $widget['id']), 'buttons' => array('save' => array('tags' => 'NAME="save_button"', 'label' => 'Save widget', 'value' => '1'), 'cancel' => array('tags' => 'NAME="docancel"', 'label' => qa_lang_html('main/cancel_button')))); if ($widget['id'] > 0) { $qa_content['form']['fields']['delete'] = array('tags' => 'NAME="dodelete"', 'label' => 'Delete widget', 'value' => 0, 'type' => 'checkbox'); } qa_set_display_rules($qa_content, array('tb_pages_list' => '!wpages_all', 'tb_show_custom_pages' => '!wpages_all', 'tb_custom_pages' => 'cb_custom_pages && !wpages_all')); return $qa_content; }
function qa_get_request_content() { if (qa_opt('news_plugin_active')) { $requestlower = strtolower(qa_request()); if ($requestlower && $requestlower === 'my-profile') { $userid = qa_get_logged_in_userid(); if (!$userid) { qa_redirect(); } $handles = qa_userids_to_handles(array($userid)); $handle = $handles[$userid]; qa_redirect(qa_path('user/' . $handle)); } else { if ($requestlower && $requestlower === qa_opt('news_plugin_request')) { // send on cron if (qa_opt('news_plugin_send') && qa_get('cron') == qa_opt('news_plugin_cron_rand') && time() >= qa_opt('news_plugin_send_last') + 23 * 60 * 60) { // minumum cron interval is 23 hours qa_news_plugin_createNewsletter(true); return false; } else { if (qa_get('cron') == qa_opt('news_plugin_cron_rand')) { if (!qa_opt('news_plugin_send')) { error_log('Q2A Newsletter Recreate Error: sending newsletter not allowed via admin/plugins'); } else { error_log('Q2A Newsletter Recreate Error: cron request before minimum time elapsed'); } echo "false\n"; return false; } } include qa_opt('news_plugin_loc'); return false; } else { if (qa_opt('news_plugin_pdf') && $requestlower && $requestlower === qa_opt('news_plugin_request_pdf')) { $pdf = file_get_contents(qa_opt('news_plugin_loc_pdf')); header('Content-Description: File Transfer'); header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 header('Pragma: public'); header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // force download dialog header('Content-Type: application/force-download'); header('Content-Type: application/octet-stream', false); header('Content-Type: application/download', false); header('Content-Type: application/pdf', false); // use the Content-Disposition header to supply a recommended filename header('Content-Disposition: attachment; filename="' . basename(qa_opt('news_plugin_loc_pdf')) . '";'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . strlen($pdf)); echo $pdf; return false; } } } } return qa_get_request_content_base(); }
function doctype() { qa_html_theme_base::doctype(); $qw_notification_id = qa_get('ra_notification'); if (isset($qw_notification_id)) { qw_set_notification_as_read($qw_notification_id); } }
function main_parts($content) { $userid = qa_get_logged_in_userid(); if (qa_opt('news_plugin_active') && $this->template == 'user' && qa_opt('news_plugin_send') && !qa_get('tab') && $content['raw']['userid'] == $userid) { $content['form-newsletter'] = $this->newsletterForm(); } qa_html_theme_base::main_parts($content); }
function main_parts($content) { if ($this->template == 'user' && qa_get('tab') == 'history' && qa_opt('event_logger_to_database') && qa_opt('user_act_list_active')) { $content = array(); $content['form-activity-list'] = $this->user_activity_form(); } qa_html_theme_base::main_parts($content); }
function main_parts($content) { if (qa_opt('priv_active') && $this->template == 'user' && qa_get('tab') == 'privileges') { $content = array(); $content['form-privileges-list'] = $this->user_priv_form(); // this shouldn't happen } qa_html_theme_base::main_parts($content); }
function doctype() { parent::doctype(); if (QA_FINAL_EXTERNAL_USERS) { return; } // check if logged in $handle = qa_get_logged_in_handle(); if (isset($handle)) { if (qa_request() == '' && count($_GET) > 0) { // Check if we need to associate another provider $this->process_login(); } // see if the account pages are accessed $tmpl = array('account', 'favorites'); $user_pages = array('user', 'user-wall', 'user-activity', 'user-questions', 'user-answers'); $logins_page = qa_request() == 'logins' && !qa_get('confirm'); $urlhandle = qa_request_part(1); if (in_array($this->template, $tmpl) || $logins_page || in_array($this->template, $user_pages) && $handle == $urlhandle) { // add a navigation item $this->content['navigation']['sub']['logins'] = array('label' => qa_lang_html('plugin_open/my_logins_nav'), 'url' => qa_path_html('logins'), 'selected' => $logins_page); return; } } else { $title = qa_lang_html('plugin_open/login_title'); $descr = qa_lang_html('plugin_open/login_description'); // hide login/register links from navigation on any page if (qa_opt('open_login_hideform') == '1') { unset($this->content['navigation']['user']['login']); unset($this->content['navigation']['user']['register']); } // then check if login/register pages are accessed $tmpl = array('register', 'login'); if (!in_array($this->template, $tmpl)) { return; } // hide regular login/register form on those pages only if (qa_opt('open_login_hideform') == '1') { $this->content['title'] = $title; $this->content['form'] = null; } // add some custom text if (!empty($this->content['custom'])) { $content = str_ireplace('<BR>', '', $this->content['custom']); $this->content['custom'] = "<div><p>{$descr}</p>{$content}</div>"; if ($this->content['form'] != null) { $this->content['custom'] = "<br /><br /><h1>{$title}</h1>{$this->content['custom']}"; } } } }
function process_request($request) { $message = ''; $url = ''; if (is_array($_FILES) && count($_FILES)) { if (!qa_opt('wysiwyg_editor_upload_images')) { $message = qa_lang('users/no_permission'); } require_once QA_INCLUDE_DIR . 'qa-app-upload.php'; $upload = qa_upload_file_one(qa_opt('wysiwyg_editor_upload_max_size'), qa_get('qa_only_image') || !qa_opt('wysiwyg_editor_upload_all'), qa_get('qa_only_image') ? 600 : null, null); $message = @$upload['error']; $url = @$upload['bloburl']; } echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(" . qa_js(qa_get('CKEditorFuncNum')) . ", " . qa_js($url) . ", " . qa_js($message) . ");</script>"; return null; }
function doctype() { if (@$this->content['error'] == qa_lang_html('main/page_not_found') && preg_match('/^[0-9]+\\//', $this->request) !== false) { $pid = preg_replace('/\\/.*/', '', $this->request); $merged = qa_db_read_one_assoc(qa_db_query_sub("SELECT ^posts.postid as postid,^posts.title as title FROM ^postmeta, ^posts WHERE ^postmeta.meta_key='merged_with' AND ^postmeta.post_id=# AND ^posts.postid=^postmeta.meta_value", $pid), true); if ($merged) { qa_redirect(qa_q_request($merged['postid'], $merged['title']), array('merged' => $pid)); } } else { if (qa_get('merged')) { $this->content['error'] = str_replace('^post', qa_get('merged'), qa_opt('merge_question_merged')); } } if (qa_post_text('ajax_merge_get_from')) { return; } qa_html_theme_base::doctype(); }
function doctype() { if ($this->request == 'admin/permissions' && qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) { $permits[] = 'signature_allow'; $permits[] = 'signature_edit_allow'; foreach ($permits as $optionname) { $value = qa_opt($optionname); $optionfield = array('id' => $optionname, 'label' => qa_lang_html('signature_plugin/' . $optionname) . ':', 'tags' => 'NAME="option_' . $optionname . '" ID="option_' . $optionname . '"', 'value' => $value, 'error' => qa_html(@$errors[$optionname])); $widest = QA_PERMIT_USERS; $narrowest = QA_PERMIT_ADMINS; $permitoptions = qa_admin_permit_options($widest, $narrowest, !QA_FINAL_EXTERNAL_USERS && qa_opt('confirm_user_emails')); if (count($permitoptions) > 1) { qa_optionfield_make_select($optionfield, $permitoptions, $value, $value == QA_PERMIT_CONFIRMED ? QA_PERMIT_USERS : min(array_keys($permitoptions))); } $this->content['form']['fields'][$optionname] = $optionfield; $this->content['form']['fields'][$optionname . '_points'] = array('id' => $optionname . '_points', 'tags' => 'NAME="option_' . $optionname . '_points" ID="option_' . $optionname . '_points"', 'type' => 'number', 'value' => qa_opt($optionname . '_points'), 'prefix' => qa_lang_html('admin/users_must_have') . ' ', 'note' => qa_lang_html('admin/points')); $checkboxtodisplay[$optionname . '_points'] = '(option_' . $optionname . '==' . qa_js(QA_PERMIT_POINTS) . ') ||(option_' . $optionname . '==' . qa_js(QA_PERMIT_POINTS_CONFIRMED) . ')'; } qa_set_display_rules($this->content, $checkboxtodisplay); } if (qa_opt('signatures_enable')) { // add user signature if ($this->template == 'user' && isset($this->content['form_activity']) && !qa_get('tab')) { $sig_form = $this->content['user_signature_form']; // from overrides // insert our form if (isset($this->content['q_list'])) { // array splicing kungfu thanks to Stack Exchange // This adds form-signature before q_list $keys = array_keys($this->content); $vals = array_values($this->content); $insertBefore = array_search('q_list', $keys); $keys2 = array_splice($keys, $insertBefore); $vals2 = array_splice($vals, $insertBefore); $keys[] = 'form-signature'; $vals[] = $sig_form; $this->content = array_merge(array_combine($keys, $vals), array_combine($keys2, $vals2)); } else { $this->content['form-signature'] = $sig_form; } } } qa_html_theme_base::doctype(); }
function process_request($request) { if ($request == 'facebook-login') { $app_id = qa_opt('facebook_app_id'); $app_secret = qa_opt('facebook_app_secret'); $tourl = qa_get('to'); if (!strlen($tourl)) { $tourl = qa_path_absolute(''); } if (strlen($app_id) && strlen($app_secret)) { if (!function_exists('json_decode')) { // work around fact that PHP might not have JSON extension installed require_once $this->directory . 'JSON.php'; function json_decode($json) { $decoder = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); return $decoder->decode($json); } } require_once $this->directory . 'facebook.php'; $facebook = new Facebook(array('appId' => $app_id, 'secret' => $app_secret, 'cookie' => true)); $fb_userid = $facebook->getUser(); if ($fb_userid) { try { $user = $facebook->api('/me?fields=email,name,verified,location,website,about,picture'); if (is_array($user)) { qa_log_in_external_user('facebook', $fb_userid, array('email' => @$user['email'], 'handle' => @$user['name'], 'confirmed' => @$user['verified'], 'name' => @$user['name'], 'location' => @$user['location']['name'], 'website' => @$user['website'], 'about' => @$user['bio'], 'avatar' => strlen(@$user['picture']['data']['url']) ? qa_retrieve_url($user['picture']['data']['url']) : null)); } } catch (FacebookApiException $e) { } } else { qa_redirect_raw($facebook->getLoginUrl(array('redirect_uri' => $tourl))); } } qa_redirect_raw($tourl); } }
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; }
function main_parts($content) { if (qa_opt('badge_active') && $this->template == 'user' && qa_opt('badge_admin_user_field') && (qa_get('tab') == 'badges' || qa_opt('badge_admin_user_field_no_tab')) && isset($content['raw']['userid'])) { $userid = $content['raw']['userid']; if (!qa_opt('badge_admin_user_field_no_tab')) { foreach ($content as $i => $v) { if (strpos($i, 'form') === 0) { unset($content[$i]); } } } $content['form-badges-list'] = qa_badge_plugin_user_form($userid); } qa_html_theme_base::main_parts($content); }
More about this license: http://www.question2answer.org/license.php */ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'app/format.php'; require_once QA_INCLUDE_DIR . 'app/limits.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'util/sort.php'; // Check whether this is a follow-on question and get some info we need from the database $in = array(); $followpostid = qa_get('follow'); $in['categoryid'] = qa_clicked('doask') ? qa_get_category_field_value('category') : qa_get('cat'); $userid = qa_get_logged_in_userid(); list($categories, $followanswer, $completetags) = qa_db_select_with_pending(qa_db_category_nav_selectspec($in['categoryid'], true), isset($followpostid) ? qa_db_full_post_selectspec($userid, $followpostid) : null, qa_db_popular_tags_selectspec(0, QA_DB_RETRIEVE_COMPLETE_TAGS)); if (!isset($categories[$in['categoryid']])) { $in['categoryid'] = null; } if (@$followanswer['basetype'] != 'A') { $followanswer = null; } // Check for permission error $permiterror = qa_user_maximum_permit_error('permit_post_q', QA_LIMIT_QUESTIONS); if ($permiterror) { $qa_content = qa_content_prepare(); // The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here // The other option ('level') prevents the menu option being shown, in qa_content_prepare(...) switch ($permiterror) {
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; // Get list of unanswered questions, allow per-category if QA_ALLOW_UNINDEXED_QUERIES set in qa-config.php if (QA_ALLOW_UNINDEXED_QUERIES) { $categoryslugs = qa_request_parts(1); } else { $categoryslugs = null; } $countslugs = @count($categoryslugs); $by = qa_get('by'); $start = qa_get_start(); $userid = qa_get_logged_in_userid(); switch ($by) { case 'selected': $selectby = 'selchildid'; break; case 'upvotes': $selectby = 'amaxvote'; break; default: $selectby = 'acount'; break; } list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_unanswered_qs_selectspec($userid, $selectby, $start, $categoryslugs, false, false, qa_opt_if_loaded('page_size_una_qs')), QA_ALLOW_UNINDEXED_QUERIES ? qa_db_category_nav_selectspec($categoryslugs, false, false, true) : null, $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null); if ($countslugs) {
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; // Check that we're logged in $userid = qa_get_logged_in_userid(); if (!isset($userid)) { qa_redirect('login'); } // Find out which updates to show $forfavorites = qa_get('show') != 'content'; $forcontent = qa_get('show') != 'favorites'; // Get lists of recent updates for this user $questions = qa_db_select_with_pending(qa_db_user_updates_selectspec($userid, $forfavorites, $forcontent)); if ($forfavorites) { if ($forcontent) { $sometitle = qa_lang_html('misc/recent_updates_title'); $nonetitle = qa_lang_html('misc/no_recent_updates'); } else { $sometitle = qa_lang_html('misc/recent_updates_favorites'); $nonetitle = qa_lang_html('misc/no_updates_favorites'); } } else { $sometitle = qa_lang_html('misc/recent_updates_content'); $nonetitle = qa_lang_html('misc/no_updates_content'); } // Prepare and return content for theme
*/ // Ensure no PHP errors are shown in the image data @ini_set('display_errors', 0); function qa_image_db_fail_handler() { header('HTTP/1.1 500 Internal Server Error'); qa_exit('error'); } // Load the Q2A base file which sets up a bunch of crucial stuff require 'qa-base.php'; qa_report_process_stage('init_image'); // Retrieve the scaled image from the cache if available require_once QA_INCLUDE_DIR . 'qa-db-cache.php'; qa_db_connect('qa_image_db_fail_handler'); $blobid = qa_get('qa_blobid'); $size = (int) qa_get('qa_size'); $cachetype = 'i_' . $size; $content = qa_db_cache_get($cachetype, $blobid); // see if we've cached the scaled down version header('Cache-Control: max-age=2592000, public'); // allows browsers and proxies to cache images too if (isset($content)) { header('Content-Type: image/jpeg'); echo $content; } else { require_once QA_INCLUDE_DIR . 'qa-app-options.php'; require_once QA_INCLUDE_DIR . 'qa-app-blobs.php'; require_once QA_INCLUDE_DIR . 'qa-util-image.php'; // Otherwise retrieve the raw image and scale as appropriate $blob = qa_read_blob($blobid); if (isset($blob)) {
function head_title() { // Title Customization Options $title = ''; switch ($this->template) { case 'qa': $title_template = qa_opt('useo_title_qa'); if (!empty($title_template)) { $search = array('%site-title%'); $replace = array(qa_opt('site_title')); $title = str_replace($search, $replace, $title_template); } break; case 'question': $category_name = ''; if (isset($this->content["categoryids"]) && !empty($this->content["categoryids"])) { $category_name = $this->content["q_view"]["raw"]["categoryname"]; } if (empty($this->meta_title)) { // title customization $title_template = qa_opt('useo_title_qa_item'); if (!empty($title_template)) { $search = array('%site-title%', '%question-title%', '%category-name%'); $replace = array(qa_opt('site_title'), @$this->content['q_view']['raw']['title'], $category_name); $title = str_replace($search, $replace, $title_template); } } else { // meta editor $title = $this->meta_title; } break; case 'questions': $category_name = ''; if (count(explode('/', $this->request)) > 1) { $category_name = $this->content["q_list"]["qs"][0]["raw"]["categoryname"]; } $sort = qa_get('sort'); if (empty($sort)) { $title_template = qa_opt('useo_title_recent'); if (!empty($title_template)) { $search = array('%site-title%', '%recent-qs-title%', '%category-name%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/recent_qs_title'), $category_name); $title = str_replace($search, $replace, $title_template); } } elseif ($sort == 'hot') { $title_template = qa_opt('useo_title_hot'); if (!empty($title_template)) { $search = array('%site-title%', '%hot-qs-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/hot_qs_title')); $title = str_replace($search, $replace, $title_template); } } elseif ($sort == 'votes') { $title_template = qa_opt('useo_title_voted'); if (!empty($title_template)) { $search = array('%site-title%', '%voted-qs-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/voted_qs_title')); $title = str_replace($search, $replace, $title_template); } } elseif ($sort == 'answers') { $title_template = qa_opt('useo_title_answered'); if (!empty($title_template)) { $search = array('%site-title%', '%answered-qs-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/answered_qs_title')); $title = str_replace($search, $replace, $title_template); } } elseif ($sort == 'views') { $title_template = qa_opt('useo_title_viewed'); if (!empty($title_template)) { $search = array('%site-title%', '%viewed-qs-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/viewed_qs_title')); $title = str_replace($search, $replace, $title_template); } } case 'unanswered': $sort = qa_get('by'); $category_name = ''; if (count(explode('/', $this->request)) > 1) { $category_name = $this->content["q_list"]["qs"][0]["raw"]["categoryname"]; } if (empty($sort)) { $title_template = qa_opt('useo_title_unanswered'); if (!empty($title_template)) { $search = array('%site-title%', '%unanswered-qs-title%', '%category-name%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/unanswered_qs_title'), $category_name); $title = str_replace($search, $replace, $title_template); } } elseif ($sort == 'selected') { $title_template = qa_opt('useo_title_unselected'); if (!empty($title_template)) { $search = array('%site-title%', '%unselected-qs-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/unselected_qs_title')); $title = str_replace($search, $replace, $title_template); } } elseif ($sort == 'upvotes') { $title_template = qa_opt('useo_title_unupvoted'); if (!empty($title_template)) { $search = array('%site-title%', '%unupvoteda-qs-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/unupvoteda_qs_title')); $title = str_replace($search, $replace, $title_template); } } break; case 'activity': $title_template = qa_opt('useo_title_activity'); if (!empty($title_template)) { $category_name = ''; if (count(explode('/', $this->request)) > 1) { $category_name = $this->content["q_list"]["qs"][0]["raw"]["categoryname"]; } $search = array('%site-title%', '%recent-activity-title%', '%category-name%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/recent_activity_title'), $category_name); $title = str_replace($search, $replace, $title_template); } break; case 'ask': $title_template = qa_opt('useo_title_ask'); if (!empty($title_template)) { $search = array('%site-title%', '%ask-title%'); $replace = array(qa_opt('site_title'), qa_lang_html('question/ask_title')); $title = str_replace($search, $replace, $title_template); } break; case 'categories': $title_template = qa_opt('useo_title_categories'); if (!empty($title_template)) { $search = array('%site-title%', '%browse-categories%'); $replace = array(qa_opt('site_title'), qa_lang_html('misc/browse_categories')); $title = str_replace($search, $replace, $title_template); } break; case 'tags': $title_template = qa_opt('useo_title_tags'); if (!empty($title_template)) { $search = array('%site-title%', '%popular-tags%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/popular_tags')); $title = str_replace($search, $replace, $title_template); } break; case 'tag': $title_template = qa_opt('useo_title_tag'); if (!empty($title_template)) { $req = explode('/', $this->request); $tag = $req[1]; $search = array('%site-title%', '%questions-tagged-x%', '%current-tag%'); $replace = array(qa_opt('site_title'), qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)), $tag); $title = str_replace($search, $replace, $title_template); } break; case 'search': $title_template = qa_opt('useo_title_search'); if (!empty($title_template)) { $term = qa_get('q'); $search = array('%site-title%', '%results-for-x%', '%current-term%'); $replace = array(qa_opt('site_title'), qa_lang_html_sub('main/results_for_x', qa_html($term)), $term); $title = str_replace($search, $replace, $title_template); } break; case 'users': $title_template = qa_opt('useo_title_users'); if (!empty($title_template)) { $search = array('%site-title%', '%highest-users%'); $replace = array(qa_opt('site_title'), qa_lang_html('main/highest_users')); $title = str_replace($search, $replace, $title_template); } break; case 'user': $title_template = qa_opt('useo_title_user'); if (!empty($title_template)) { $req = explode('/', $this->request); $user = $req[1]; $search = array('%site-title%', '%user-x%', '%current-user%'); $replace = array(qa_opt('site_title'), qa_lang_html_sub('main/results_for_x', qa_html($user)), $user); $title = str_replace($search, $replace, $title_template); } break; } if (empty($title)) { qa_html_theme_base::head_title(); } else { $this->output('<title>' . $title . '</title>'); } // Page Meta Tags $noindex = qa_opt('useo_access_noindex'); $nofollow = qa_opt('useo_access_nofollow'); if ($noindex and $nofollow) { $this->output('<meta name="robots" content="noindex, nofollow" />'); } elseif ($noindex) { $this->output('<meta name="robots" content="noindex" />'); } else { // if page is not already noindex, check if it needs to be noindex. also add nofollow if necessary $status = 1; // content is long enough if ($this->template == 'question' and qa_opt('useo_access_length_enable') and (int) qa_opt('useo_access_length') > 0) { $status = 0; $minimum_words = (int) qa_opt('useo_access_length'); $word_count = str_word_count($this->content['q_view']['raw']['title']) + str_word_count($this->content['q_view']['raw']['content']); if ($word_count >= $minimum_words) { $status = 1; } else { foreach ($this->content['q_view']['c_list']['cs'] as $comment) { $word_count += str_word_count($comment['raw']['content']); } if ($word_count >= $minimum_words) { $status = 1; } else { foreach ($this->content['a_list']['as'] as $answer) { $word_count += str_word_count($answer['raw']['content']); } if ($word_count >= $minimum_words) { $status = 1; } else { foreach ($this->content['a_list']['as'] as $answer) { foreach ($answer['c_list']['cs'] as $comment) { $word_count += str_word_count($comment['raw']['content']); } } if ($word_count >= $minimum_words) { $status = 1; } } } } } if ($nofollow && $status == 1) { $this->output('<meta name="robots" content="nofollow" />'); } elseif ($nofollow && $status == 0) { $this->output('<meta name="robots" content="noindex, nofollow" />'); } elseif ($status == 0) { $this->output('<meta name="robots" content="noindex" />'); } } // Question Meta tags if ($this->template == 'question') { // setup custom meta keyword if (!empty($this->meta_keywords)) { $this->content['keywords'] = $this->meta_keywords; } // setup custom meta description if (!empty($this->meta_description)) { $this->content['description'] = $this->meta_description; } elseif (qa_opt('useo_meta_desc_ans_enable')) { $lenght = (int) qa_opt('useo_meta_desc_length'); if ($lenght <= 0) { $lenght = 160; } $text = ''; if ($this->content['q_view']['raw']['acount'] > 0 and qa_opt('useo_meta_desc_ans_enable')) { // get Selected Answer's content if (isset($this->content["q_view"]["raw"]["selchildid"]) and qa_opt('useo_meta_desc_sel_ans_enable')) { foreach ($this->content['a_list']['as'] as $answer) { if ($answer['raw']['isselected']) { $text = $answer['raw']['content']; } } } else { // get most voted Answer's content $max_vote = 0; // don't use answers with negative votes. foreach ($this->content['a_list']['as'] as $answer) { if ($answer['raw']['netvotes'] > $max_vote) { $text = $answer['raw']['content']; $max_vote = $answer['raw']['netvotes']; } } } } if (!empty($text)) { $excerpt = useo_get_excerpt($text, 0, $lenght); $this->content['description'] = $excerpt; } } // Meta Tags and social meta tags if ($this->template == 'question') { if (qa_opt('useo_social_enable_editor')) { foreach ($this->metas as $key => $value) { if (isset($this->social_metas[$key])) { $this->output('<meta ' . $value['type'] . ' content="' . $this->social_metas[$key] . '" />'); } else { $this->output('<meta ' . $value['type'] . ($value['content'] ? ' content="' . $value['content'] . '"' : '') . ' /> '); } } } elseif (qa_opt('useo_social_og_enable_auto')) { foreach ($this->metas as $key => $value) { $this->output('<meta ' . $value['type'] . ($value['content'] ? ' content="' . $value['content'] . '"' : '') . ' /> '); } } } } }
$qa_content['error'] = strtr(qa_lang_html('admin/module_x_database_init'), array('^1' => qa_html($name), '^2' => qa_html($type), '^3' => '<a href="' . qa_path_html('install') . '">', '^4' => '</a>')); } } } } if (qa_is_http_post() && !qa_check_form_security_code('admin/plugins', qa_post_text('qa_form_security_code'))) { $qa_content['error'] = qa_lang_html('misc/form_security_reload'); $showpluginforms = false; } else { $showpluginforms = true; } if (count($pluginfiles)) { foreach ($pluginfiles as $pluginindex => $pluginfile) { $plugindirectory = dirname($pluginfile) . '/'; $hash = qa_admin_plugin_directory_hash($plugindirectory); $showthisform = $showpluginforms && qa_get('show') == $hash; $contents = file_get_contents($pluginfile); $metadata = qa_admin_addon_metadata($contents, array('name' => 'Plugin Name', 'uri' => 'Plugin URI', 'description' => 'Plugin Description', 'version' => 'Plugin Version', 'date' => 'Plugin Date', 'author' => 'Plugin Author', 'author_uri' => 'Plugin Author URI', 'license' => 'Plugin License', 'min_q2a' => 'Plugin Minimum Question2Answer Version', 'min_php' => 'Plugin Minimum PHP Version', 'update' => 'Plugin Update Check URI')); if (strlen(@$metadata['name'])) { $namehtml = qa_html($metadata['name']); } else { $namehtml = qa_lang_html('admin/unnamed_plugin'); } if (strlen(@$metadata['uri'])) { $namehtml = '<a href="' . qa_html($metadata['uri']) . '">' . $namehtml . '</a>'; } $namehtml = '<b>' . $namehtml . '</b>'; if (strlen(@$metadata['version'])) { $namehtml .= ' v' . qa_html($metadata['version']); } if (strlen(@$metadata['author'])) {
function display_duplicates(&$qa_content, $useraccount, $otherlogins) { $userid = $useraccount['userid']; $disp_conf = qa_get('confirm'); if (!empty($otherlogins)) { // display other logins which could be linked to this user account if ($disp_conf) { $title = ''; $p = '<br />' . ($disp_conf == 1 ? qa_lang_html('plugin_open/other_logins_conf_text') : qa_lang_html_sub('plugin_open/link_exists', '<strong>' . ucfirst(qa_get('link')) . '</strong>')); } else { $title = '<h2>' . qa_lang_html('plugin_open/other_logins') . '</h2>'; $p = qa_lang_html('plugin_open/other_logins_conf_text'); } $qa_content['custom_merge'] = "{$title} <p>{$p}</p>"; $qa_content['form_merge'] = array('tags' => 'ENCTYPE="multipart/form-data" METHOD="POST" ACTION="' . qa_self_html() . '" CLASS="open-login-others"', 'style' => 'wide', 'buttons' => array('save' => array('tags' => 'onClick="qa_show_waiting_after(this, false);" style="display: none"', 'note' => qa_lang_html('plugin_open/action_info_1'), 'label' => qa_lang_html('plugin_open/continue'))), 'hidden' => array('domerge' => '1', 'confirm' => $disp_conf, 'to' => qa_get('to'))); $data = array(); $select = '<option value="0">' . qa_lang_html('plugin_open/select_base') . '</option>' . '<option value="' . $userid . '" title="' . qa_html($useraccount['handle']) . '">' . qa_html($useraccount['handle']) . ' (' . $useraccount['points'] . ' ' . qa_lang_html('admin/points') . ' - ' . qa_lang_html('plugin_open/current_account') . ')</option>'; foreach ($otherlogins as $i => $login) { $type = 'login'; $name = qa_html($login['details']['handle']); $points = $login['details']['points']; if (count($login['logins']) == 0) { // this is a regular site login, not an openid login $type = 'user'; } $login_providers = $type == 'user' ? strtolower(qa_lang_html('plugin_open/password')) : '<strong>' . implode(', ', $login['logins']) . '</strong>'; $data["f{$i}"] = array('label' => '<strong>' . $name . '</strong> (' . $points . ' ' . qa_lang_html('admin/points') . ', ' . strtolower(qa_lang_html_sub('plugin_open/login_using', '')) . $login_providers . ')', 'tags' => 'name="user_' . $login['details']['userid'] . '" value="' . $login['details']['userid'] . '" style="visibility: hidden" checked="checked" rel="' . $i . '" onchange="OP_checkClicked(this)"', 'type' => 'checkbox', 'style' => 'tall'); $select .= '<option value="' . $login['details']['userid'] . '" title="' . $name . '">' . $name . ' (' . $points . ' ' . qa_lang_html('admin/points') . ')</option>'; } $data['space'] = array('label' => '<br>' . qa_lang_html('plugin_open/choose_action'), 'type' => 'static', 'style' => 'tall'); $ac1html = '<div class="opacxhtml qa-form-tall-buttons" id="ac1html" style="display: none;">' . qa_lang_html('plugin_open/merge_all_first') . ' ' . qa_lang_html('plugin_open/merge_note') . '<br /><br />' . qa_lang_html('plugin_open/select_base_note') . '<br /><select name="base1" onchange="OP_baseSelected(this)">' . $select . '</select></div>'; $ac2html = '<div class="opacxhtml qa-form-tall-buttons" id="ac2html" style="display: none;">' . qa_lang_html('plugin_open/select_merge_first') . ' ' . qa_lang_html('plugin_open/merge_note') . '<br /><br />' . qa_lang_html('plugin_open/select_base_note') . '<br /><select name="base2" onchange="OP_baseSelected(this)">' . $select . '</select></div>'; $ac3html = '<div class="opacxhtml qa-form-tall-buttons" id="ac3html" style="display: none;">' . qa_lang_html('plugin_open/cancel_merge_note') . '</div>'; if ($disp_conf == null || $disp_conf == 1) { $data['actions1'] = array('label' => ' <strong><a href="javascript:;" onclick="OP_actionSelected(1, \'#ac1html\')">» ' . qa_lang_html('plugin_open/merge_all') . '</a></strong>' . $ac1html, 'type' => 'static', 'style' => 'tall'); $data['actions2'] = array('label' => ' <strong><a href="javascript:;" onclick="OP_actionSelected(2, \'#ac2html\')">» ' . qa_lang_html('plugin_open/select_merge') . '</a></strong>' . $ac2html, 'type' => 'static', 'style' => 'tall'); if ($disp_conf == 1) { $data['actions3'] = array('label' => ' <strong><a href="javascript:;" onclick="OP_actionSelected(0, \'#ac3html\')">» ' . qa_lang_html('plugin_open/cancel_merge') . '</a></strong>' . $ac3html, 'type' => 'static', 'style' => 'tall'); } } else { if ($disp_conf == 2) { $data['actions1'] = array('label' => ' <strong><a href="javascript:;" onclick="OP_actionSelected(1, \'#ac1html\')">» ' . qa_lang_html('plugin_open/link_all') . '</a></strong>' . $ac1html, 'type' => 'static', 'style' => 'tall'); $data['actions3'] = array('label' => ' <strong><a href="javascript:;" onclick="OP_actionSelected(0, \'#ac3html\')">» ' . qa_lang_html('plugin_open/cancel_link') . '</a></strong>' . $ac3html, 'type' => 'static', 'style' => 'tall'); } } $qa_content['form_merge']['fields'] = $data; $qa_content['customscript'] = '<script type="text/javascript"> function OP_actionSelected(i, divid) { $(".opacxhtml").slideUp(); if(i != 2 || op_last_action == 2) { $(".qa-main form.open-login-others input[type=checkbox]").css("visibility", "hidden"); } if(op_last_action == i) { OP_baseSelected(); op_last_action = -1; return; } op_last_action = i; $(divid).slideDown(); $(".qa-main form.open-login-others>input[name=domerge]").attr("value", i); if(i > 0) { $(".qa-main form.open-login-others input[type=checkbox]").attr("checked", "checked"); if(i == 2) { $(".qa-main form.open-login-others input[type=checkbox]").css("visibility", "visible"); $(".qa-main form.open-login-others select[name=base2]").html( $(".qa-main form.open-login-others select[name=base1]").html() ); } sel = $(".qa-main form.open-login-others select[name=base" + i +"]").get(0); sel.selectedIndex = 0; OP_baseSelected(sel); } else { $(".qa-main form.open-login-others span.qa-form-wide-note").html("' . qa_lang_html('plugin_open/action_info_2') . '"); $(".qa-main form.open-login-others input[type=submit]").show(); $(".qa-main form.open-login-others input[type=submit]").attr("disabled", false); } } function OP_baseSelected(sel) { if(!sel || sel.selectedIndex == 0) { if(sel) { $(".qa-main form.open-login-others span.qa-form-wide-note").html("' . qa_lang_html('plugin_open/action_info_3') . '") } else { $(".qa-main form.open-login-others span.qa-form-wide-note").html("' . qa_lang_html('plugin_open/action_info_1') . '") } $(".qa-main form.open-login-others input[type=submit]").hide() $(".qa-main form.open-login-others input[type=submit]").attr("disabled", "disabled") } else { if(OP_accValid()) { nam = $("option:selected", sel).attr("title") $(".qa-main form.open-login-others span.qa-form-wide-note").html("<strong>" + nam + "</strong> ' . qa_lang_html('plugin_open/action_info_4') . '") $(".qa-main form.open-login-others input[type=submit]").show() $(".qa-main form.open-login-others input[type=submit]").attr("disabled", false) } } } function OP_checkClicked(check) { ' . ($disp_conf == 2 ? '/* empty */' : ' var rel = $(check).attr("rel") var id = $(check).attr("value") var chk = $(check).attr("checked") $(".qa-main form.open-login-others select[name=base2]").get(0).selectedIndex = 0 if(chk) { $(".qa-main form.open-login-others select[name=base2] option[value=" + id + "]").show() } else { $(".qa-main form.open-login-others select[name=base2] option[value=" + id + "]").hide() } OP_accValid() ') . ' } function OP_accValid() { if(op_last_action != 2) { $(".qa-main form.open-login-others input[type=checkbox]").attr("checked", "checked") return true } someSel = false $(".qa-main form.open-login-others input[type=checkbox]").each(function(i, o) { someSel = someSel || $(o).attr("checked") == "checked" }); $(".qa-main form.open-login-others input[type=submit]").hide(); $(".qa-main form.open-login-others input[type=submit]").attr("disabled", "disabled"); if(!someSel) { // nothing selected $(".qa-main form.open-login-others span.qa-form-wide-note").html("' . qa_lang_html('plugin_open/action_info_5') . '"); return false; } else { $(".qa-main form.open-login-others span.qa-form-wide-note").html("' . qa_lang_html('plugin_open/action_info_3') . '"); return true; } } </script>'; $qa_content['script_onloads'][] = '$(function(){ OP_baseSelected() });'; $qa_content['script_var']['op_last_action'] = -1; return true; } return false; }
} 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') : 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')); $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 */
$navcategoryhtml = ''; foreach ($categories as $category) { if (!isset($category['parentid'])) { $navcategoryhtml .= '<a href="' . qa_path_html('admin/categories', array('edit' => $category['categoryid'])) . '">' . qa_html($category['title']) . '</a> - ' . qa_lang_html_sub('main/x_questions', $category['qcount']) . '<br/>'; } } $qa_content['form']['fields']['nav'] = array('label' => qa_lang_html('admin/top_level_categories'), 'type' => 'static', 'value' => $navcategoryhtml); $qa_content['form']['fields']['allow_no_category'] = array('label' => qa_lang_html('options/allow_no_category'), 'tags' => 'name="option_allow_no_category"', 'type' => 'checkbox', 'value' => qa_opt('allow_no_category')); if (!qa_opt('allow_no_category')) { $nocatcount = qa_db_count_categoryid_qs(null); if ($nocatcount) { $qa_content['form']['fields']['allow_no_category']['error'] = strtr(qa_lang_html('admin/category_none_error'), array('^q' => number_format($nocatcount), '^1' => '<a href="' . qa_path_html(qa_request(), array('missing' => 1)) . '">', '^2' => '</a>')); } } $qa_content['form']['fields']['allow_no_sub_category'] = array('label' => qa_lang_html('options/allow_no_sub_category'), 'tags' => 'name="option_allow_no_sub_category"', 'type' => 'checkbox', 'value' => qa_opt('allow_no_sub_category')); } else { unset($qa_content['form']['buttons']['save']); } } if (qa_get('recalc')) { $qa_content['form']['ok'] = '<span id="recalc_ok">' . qa_lang_html('admin/recalc_categories') . '</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('dorecalccategories', document.getElementById('dosaveoptions'), null, 'recalc_ok');"); } $qa_content['navigation']['sub'] = qa_admin_sub_navigation(); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
$gotcount = count($results); $results = array_slice($results, 0, $pagesize); // Retrieve extra information on users $fullquestions = array(); foreach ($results as $result) { if (isset($result['question'])) { $fullquestions[] = $result['question']; } } $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;
public function messagelist() { $offset = (int) qa_get('offset'); $offset = isset($offset) ? $offset * 15 : 0; require_once QA_INCLUDE_DIR . 'qa-db-users.php'; // Get Events $message_events = array('u_message', 'u_wall_post'); $events = "'" . implode("','", $message_events) . "'"; $userid = qa_get_logged_in_userid(); $eventslist = qa_db_read_all_assoc(qa_db_query_sub('SELECT id, UNIX_TIMESTAMP(datetime) AS datetime, userid, postid, effecteduserid, event, params, `read` FROM ^ra_userevent WHERE effecteduserid=# AND `read` = 0 AND event IN (' . $events . ') ORDER BY id DESC LIMIT 15 OFFSET #', $userid, $offset)); if (count($eventslist) > 0) { $event = array(); $userids = array(); foreach ($eventslist as $event) { $userids[$event['userid']] = $event['userid']; $userids[$event['effecteduserid']] = $event['effecteduserid']; } if (QA_FINAL_EXTERNAL_USERS) { $handles = qa_get_public_from_userids($userids); } else { $handles = qa_db_user_get_userid_handles($userids); } // get event's: time, type, parameters // get post id of questions foreach ($eventslist as $event) { $title = ''; $link = ''; $handle = $handles[$event['userid']]; $reciever_handle = $handles[$event['effecteduserid']]; $reciever_link = qa_path('user/' . $reciever_handle); $datetime = $event['datetime']; $event['date'] = qa_html(qa_time_to_string(qa_opt('db_time') - $datetime)); $event['params'] = json_decode($event['params'], true); $message = substr($event['params']['message'], 0, 30) . '..'; $id = ' data-id="' . $event['id'] . '"'; $read = $event['read'] ? ' read' : ' unread'; $url_param = array('ra_notification' => $event['id']); $user_link = qa_path_html('user/' . $handle, $url_param); switch ($event['event']) { case 'u_message': // related question to an answer echo '<div class="event-content clearfix' . $read . '"' . $id . '> <div class="avatar"><a href="' . $user_link . '">' . ra_get_avatar($handle, 32, true) . '</a></div> <div class="event-right"> <a href="' . qa_path_html('message/' . $handle, $url_param, QW_BASE_URL) . '"> <div class="head"> <strong class="user">' . $handle . '</strong> <span class="what">' . qa_lang_html('dude/sent_you_a_private_message') . '</span> <span class="message">' . $message . '</span> </div> <div class="footer"> <span class="event-icon icon-email"></span> <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span> </div> </a> </div> </div>'; break; case 'u_wall_post': // user's question had been answered $url = qa_path_html('user/' . $reciever_handle . '/wall', $url_param, QW_BASE_URL); echo '<div class="event-content clearfix' . $read . '"' . $id . '> <div class="avatar"><a href="' . $user_link . '">' . ra_get_avatar($handle, 32, true) . '</a></div> <div class="event-right"> <a href="' . $url . '"> <div class="head"> <strong class="user">' . $handle . '</strong> <span class="what">' . qa_lang_html('dude/posted_on_your_wall') . '</span> <span class="message">' . $message . '</span> </div> <div class="footer"> <span class="event-icon icon-pin"></span> <span class="date">' . qa_lang_sub('dude/x_ago', $event['date']) . '</span> </div> </a> </div> </div>'; break; } } } else { echo '<div class="no-more-activity">' . qa_lang_html('dude/no_more_messages') . '</div>'; } die; }
} array_push($showlevels, QA_USER_LEVEL_EXPERT, QA_USER_LEVEL_EDITOR, QA_USER_LEVEL_MODERATOR, QA_USER_LEVEL_ADMIN, QA_USER_LEVEL_SUPER); $leveloptions = array(); $catleveloptions = array('' => qa_lang_html('users/category_level_none')); foreach ($showlevels as $showlevel) { if ($showlevel <= $maxlevelassign) { $leveloptions[$showlevel] = qa_html(qa_user_level_string($showlevel)); if ($showlevel > QA_USER_LEVEL_BASIC) { $catleveloptions[$showlevel] = $leveloptions[$showlevel]; } } } $qa_content['form_profile']['fields']['level']['options'] = $leveloptions; // Category-specific levels if (qa_using_categories()) { $catleveladd = qa_get('catleveladd') ? true : false; if (!$catleveladd && !count($userlevels)) { $qa_content['form_profile']['fields']['level']['suffix'] = strtr(qa_lang_html('users/category_level_add'), array('^1' => '<a href="' . qa_path_html(qa_request(), array('state' => 'edit', 'catleveladd' => 1)) . '">', '^2' => '</a>')); } else { $qa_content['form_profile']['fields']['level']['suffix'] = qa_lang_html('users/level_in_general'); } if ($catleveladd || count($userlevels)) { $userlevels[] = array('entitytype' => QA_ENTITY_CATEGORY); } $index = 0; foreach ($userlevels as $userlevel) { if ($userlevel['entitytype'] == QA_ENTITY_CATEGORY) { $index++; $id = 'ls_' . +$index; $qa_content['form_profile']['fields']['uc_' . $index . '_level'] = array('label' => qa_lang_html('users/category_level_label'), 'type' => 'select', 'tags' => 'name="uc_' . $index . '_level" id="' . qa_html($id) . '" onchange="this.qa_prev=this.options[this.selectedIndex].value;"', 'options' => $catleveloptions, 'value' => isset($userlevel['level']) ? qa_html(qa_user_level_string($userlevel['level'])) : '', 'suffix' => qa_lang_html('users/category_level_in')); $qa_content['form_profile']['fields']['uc_' . $index . '_cat'] = array();
*/ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-limits.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-util-sort.php'; // Check whether this is a follow-on question and get some info we need from the database $in = array(); $followpostid = qa_get('follow'); $in['categoryid'] = qa_get_category_field_value('category'); if (!isset($in['categoryid'])) { $in['categoryid'] = qa_get('cat'); } $userid = qa_get_logged_in_userid(); list($categories, $followanswer, $completetags) = qa_db_select_with_pending(qa_db_category_nav_selectspec($in['categoryid'], true), isset($followpostid) ? qa_db_full_post_selectspec($userid, $followpostid) : null, qa_db_popular_tags_selectspec(0, QA_DB_RETRIEVE_COMPLETE_TAGS)); if (!isset($categories[$in['categoryid']])) { $in['categoryid'] = null; } if (@$followanswer['basetype'] != 'A') { $followanswer = null; } // Check for permission error $permiterror = qa_user_maximum_permit_error('permit_post_q', QA_LIMIT_QUESTIONS); if ($permiterror) { $qa_content = qa_content_prepare(); // The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here // The other option ('level') prevents the menu option being shown, in qa_content_prepare(...)
More about this license: http://www.question2answer.org/license.php */ // Ensure no PHP errors are shown in the blob response @ini_set('display_errors', 0); function qa_blob_db_fail_handler() { header('HTTP/1.1 500 Internal Server Error'); qa_exit('error'); } // Load the Q2A base file which sets up a bunch of crucial stuff require 'qa-base.php'; qa_report_process_stage('init_blob'); // Output the blob in question require_once QA_INCLUDE_DIR . 'app/blobs.php'; qa_db_connect('qa_blob_db_fail_handler'); $blob = qa_read_blob(qa_get('qa_blobid')); if (isset($blob)) { header('Cache-Control: max-age=2592000, public'); // allows browsers and proxies to cache the blob switch ($blob['format']) { case 'jpeg': case 'jpg': header('Content-Type: image/jpeg'); break; case 'gif': header('Content-Type: image/gif'); break; case 'png': header('Content-Type: image/png'); break; case 'swf':