/** * adds blog admin pages to the request handlers * * @return mixed */ function qa_get_request_content() { $requestlower = strtolower(qa_request()); $requestparts = qa_request_parts(); $firstlower = strtolower(@$requestparts[0]); $secondlower = strtolower(@$requestparts[1]); $routing = qa_page_routing(); $route_part = ''; if (!empty($firstlower) && !empty($secondlower)) { $route_part = $firstlower . '/' . $secondlower . '/'; } if (!isset($routing[$requestlower]) && $route_part === 'admin/donut-theme/') { //for loading the default setting file qa_set_template($firstlower); $qa_content = (require QA_INCLUDE_DIR . $routing[$route_part]); if ($firstlower == 'admin') { $_COOKIE['qa_admin_last'] = $requestlower; // for navigation tab now... setcookie('qa_admin_last', $_COOKIE['qa_admin_last'], 0, '/', QA_COOKIE_DOMAIN); // ...and in future } } else { //otherwise load the original qa_get_request_content function $qa_content = qa_get_request_content_base(); } 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 qa_get_request_content() { $qa_content = qa_get_request_content_base(); // permissions if (isset($qa_content['form_profile']['fields']['permits'])) { $ov = $qa_content['form_profile']['fields']['permits']['value']; $ov = str_replace('[profile/permit_vote_c]', qa_lang('comment_voting/permit_vote_c'), $ov); $qa_content['form_profile']['fields']['permits']['value'] = $ov; } return $qa_content; }
function qa_get_request_content() { $qa_content = qa_get_request_content_base(); if (isset($qa_content['form_profile']['fields']['permits'])) { $ov = $qa_content['form_profile']['fields']['permits']['value']; $ov = str_replace('[profile/permit_create_cp]', qa_lang('cp/permit_create_community_posts'), $ov); $ov = str_replace('[profile/permit_edit_cp]', qa_lang('cp/permit_edit_community_posts'), $ov); $qa_content['form_profile']['fields']['permits']['value'] = $ov; } return $qa_content; }
function qa_get_request_content() { if (qa_opt('xml_rpc_bool_active')) { $requestlower = strtolower(qa_request()); if ($requestlower && $requestlower === "xml-rpc") { qa_xml_rpc_start_server(); return false; } } return qa_get_request_content_base(); }
function qa_get_request_content() { $qa_content = qa_get_request_content_base(); // permissions if (isset($qa_content['form_profile']['fields']['permits'])) { $ov = $qa_content['form_profile']['fields']['permits']['value']; $ov = str_replace('[profile/expert_question_roles]', qa_lang('expert_question/expert_question_roles'), $ov); $ov = str_replace('[profile/expert_question_ask]', qa_lang('expert_question/expert_question_ask'), $ov); $qa_content['form_profile']['fields']['permits']['value'] = $ov; } return $qa_content; }
function qa_get_request_content() { $qa_content = qa_get_request_content_base(); // displays signature form in user profile $qa_request = strtolower(qa_request()); $reqs = explode('/', $qa_request); if ($reqs[0] == 'user') { // permissions if (isset($qa_content['form_profile']['fields']['permits'])) { $ov = $qa_content['form_profile']['fields']['permits']['value']; $ov = str_replace('[profile/signature_allow]', qa_lang('signature_plugin/signature_allow'), $ov); $ov = str_replace('[profile/signature_edit_allow]', qa_lang('signature_plugin/signature_edit_allow'), $ov); $qa_content['form_profile']['fields']['permits']['value'] = $ov; } $qa_content['user_signature_form'] = array(); $userid = @$qa_content['raw']['userid']; if (!$userid) { return $qa_content; } $handles = qa_userids_to_handles(array($userid)); $handle = $handles[$userid]; if (qa_get_logged_in_handle() == $handle && !qa_user_permit_error('signature_allow') || !qa_user_permit_error('signature_edit_allow')) { $ok = null; $formats = qa_list_modules('editor'); $format = qa_opt('signatures_format'); $editorname = $formats[$format]; if (!strlen($editorname)) { $editorname = qa_lang_html('admin/basic_editor'); } $editor = qa_load_editor('', '', $editorname); qa_db_query_sub('CREATE TABLE IF NOT EXISTS ^usersignatures (' . 'userid INT(11) NOT NULL,' . 'signature VARCHAR (1000) DEFAULT \'\',' . 'format VARCHAR (20) DEFAULT \'\',' . 'id INT(11) NOT NULL AUTO_INCREMENT,' . 'UNIQUE (userid),' . 'PRIMARY KEY (id)' . ') ENGINE=MyISAM DEFAULT CHARSET=utf8'); if (qa_clicked('signature_save')) { if (strlen(qa_post_text('signature_text')) > qa_opt('signatures_length')) { $error = 'Max possible signature length is 1000 characters'; } else { $readdata = $editor->read_post('signature_text'); $informat = $readdata['format']; $incontent = qa_post_text('signature_text'); qa_db_query_sub('INSERT INTO ^usersignatures (userid,signature,format) VALUES (#,$,$) ON DUPLICATE KEY UPDATE signature=$,format=$', $userid, $incontent, $informat, $incontent, $informat); $ok = 'Signature Saved.'; } } $content = qa_db_read_one_assoc(qa_db_query_sub('SELECT BINARY signature AS signature,format FROM ^usersignatures WHERE userid=#', $userid), true); $field = qa_editor_load_field($editor, $qa_content, $content['signature'], $content['format'], 'signature_text', 12, false); $field['label'] = qa_lang_html('signature_plugin/signature'); $fields['content'] = $field; if (!$editorname || $editorname == 'Markdown Editor') { $fields['elCount'] = array('label' => '<div id="elCount">' . qa_opt('signatures_length') . '</div>', 'type' => 'static'); } $form = array('ok' => $ok && !isset($error) ? $ok : null, 'error' => @$error, 'style' => 'tall', 'title' => '<a name="signature_text"></a>' . qa_lang_html('signature_plugin/signature'), 'tags' => 'action="' . qa_self_html() . '#signature_text" method="POST"', 'fields' => $fields, 'buttons' => array(array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="signature_save"')), 'hidden' => array('editor' => qa_html($editorname), 'dosavesig' => '1')); $qa_content['user_signature_form'] = $form; } else { if (qa_opt('signatures_profile_enable')) { $content = qa_db_read_one_assoc(qa_db_query_sub('SELECT BINARY signature as signature, format FROM ^usersignatures WHERE userid=#', $userid), true); if (!$content) { return $qa_content; } $informat = $content['format']; $viewer = qa_load_viewer($content['signature'], $informat); global $options; $signature = qa_viewer_html($content['signature'], $informat, array('blockwordspreg' => @$options['blockwordspreg'], 'showurllinks' => @$options['showurllinks'], 'linksnewwindow' => @$options['linksnewwindow'])); $fields[] = array('label' => qa_opt('signatures_header') . $signature . qa_opt('signatures_footer'), 'type' => 'static'); $qa_content['user_signature_form'] = array('title' => 'Signature', 'fields' => $fields, 'style' => 'tall'); } } } return $qa_content; }
function qa_get_request_content() { if (qa_opt('book_plugin_active')) { $requestlower = strtolower(qa_request()); if ($requestlower && $requestlower === qa_opt('book_plugin_request')) { if (qa_opt('book_plugin_static')) { // refresh if (qa_opt('book_plugin_refresh') && (qa_opt('book_plugin_refresh_time') && (int) qa_opt('book_plugin_refresh_hours') || qa_get('cron') == 'true' && qa_opt('book_plugin_refresh_cron')) && time() > qa_opt('book_plugin_refresh_last') + qa_opt('book_plugin_refresh_hours') * 60 * 60) { qa_book_plugin_createBook(); if (qa_get('cron') == 'true') { echo "true\n"; return false; } } else { if (qa_get('cron') == 'true') { if (!qa_opt('book_plugin_refresh_cron')) { error_log('Q2A Book Recreate Error: cron request not allowed via admin/plugins'); } else { error_log('Q2A Book Recreate Error: cron request before minimum time elapsed'); } echo "false\n"; return false; } } include qa_opt('book_plugin_loc'); } else { echo qa_book_plugin_createBook(true); } return false; } else { if (qa_opt('book_plugin_pdf') && $requestlower && $requestlower === qa_opt('book_plugin_request_pdf')) { if (qa_opt('book_plugin_static')) { // refresh if (qa_opt('book_plugin_refresh') && (qa_opt('book_plugin_refresh_time') && (int) qa_opt('book_plugin_refresh_hours')) && time() > qa_opt('book_plugin_refresh_last') + qa_opt('book_plugin_refresh_hours') * 60 * 60) { qa_book_plugin_createBook(); } $pdf = file_get_contents(qa_opt('book_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('book_plugin_loc_pdf')) . '";'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . strlen($pdf)); echo $pdf; } else { qa_book_plugin_create_pdf(true); } return false; } } } return qa_get_request_content_base(); }