function process_request($request)
 {
     $userid = qa_get_logged_in_userid();
     $categoryoptions = array();
     $qa_content = qa_content_prepare();
     // check if we have done a post of the page
     if (qa_post_text('okthen')) {
         // update the current category
         $newcategory = qa_post_text('category');
         if (isset($newcategory)) {
             mp_set_categoryid($newcategory);
             // redirect to main page
             qa_redirect('');
         } else {
             $qa_content['error'] = 'You must select a course to continue.';
         }
     }
     // retrieve list of categories user is associated with
     // populate category options
     $results = mp_get_categories_for_user($userid);
     foreach ($results as $row) {
         $categoryoptions[$row['categoryid']] = $row['title'];
     }
     $qa_content['title'] = 'Registered courses';
     $qa_content['custom'] = 'The following list displays all courses your account is associated with.  Select a course from the list below and click <B>Select</B> to change to the new course<br /><br />';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('courses' => array('type' => 'select-radio', 'label' => 'Courses', 'tags' => 'NAME="category"', 'options' => $categoryoptions, 'value' => mp_get_categoryid(), 'error' => qa_html(@$errors['course']))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'Select', 'value' => '1')));
     return $qa_content;
 }
 function process_request($request)
 {
     require_once QA_INCLUDE_DIR . 'mp-app-posts.php';
     require_once QA_INCLUDE_DIR . 'mp-db-users.php';
     $qa_content = qa_content_prepare();
     // if the user is not logged in, request user to login
     if (!qa_get_logged_in_userid()) {
         $qa_content['error'] = qa_insert_login_links('Please ^1log in^2 or ^3register^4 first.', $request);
         return $qa_content;
     }
     $qa_content['title'] = 'Course Announcements';
     // DISPLAY ANNOUCEMENTS
     $data = '<div class="qa-q-list">';
     // retrieve annoucements
     $announcements = mp_announcements_get_all(mp_get_categoryid());
     if (count($announcements) == 0) {
         $data .= "No announcements";
     } else {
         foreach ($announcements as $announcement) {
             $data .= '<div class="qa-q-list-item">';
             $data .= '<div class="qa-q-item-title">' . $announcement['title'] . '</div>';
             $data .= '<div class="qa-q-view-content">' . $announcement['content'] . '</div>';
             $data .= '<div class="qa-q-item-meta">Posted by <A HREF="' . qa_path_html('user/' . $announcement['handle']) . '">' . $announcement['handle'] . '</A> on ' . $announcement['created'] . '</div>';
             $data .= '</div>';
             $data .= '<div class="qa-q-list-item-clear" ></div>';
         }
     }
     $data .= '</div>';
     $qa_content['custom_2'] = $data;
     // create the sub menu for navigation
     $qa_content['navigation']['sub'] = mp_announcements_sub_navigation();
     $qa_content['navigation']['sub']['default']['selected'] = true;
     return $qa_content;
 }
 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) . '">&laquo; 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;
 }
Exemplo n.º 4
0
 public function process_request($request)
 {
     $qa_content = qa_content_prepare(true);
     $qa_content['title'] = qa_opt('site_title') . ' Chat Logs';
     $qa_content['custom'] = '<iframe src="' . $this->urltoroot . 'chat/?view=logs"  width="100%" height="600"></iframe>';
     $qa_content['custom_2'] = '<script type="text/javascript"> $( document ).ready(function() {  $("#settingsContainer").hide(); }); </script>';
     return $qa_content;
 }
Exemplo n.º 5
0
 public function process_request($request)
 {
     $qa_content = qa_content_prepare(true);
     $qa_content['title'] = qa_opt('site_title') . ' Chat';
     $qa_content['custom'] = '<iframe src="' . $this->urltoroot . 'chat"  width="100%" height="800"></iframe>';
     $qa_content['custom_2'] = '<script type="text/javascript"> $( document ).ready(function() {  $("#adchat").hide();   createCookieAdChat("none");}); </script>';
     return $qa_content;
 }
Exemplo n.º 6
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['site_title'] = "Email Notifications";
     $qa_content['error'] = "";
     $qa_content['suggest_next'] = "";
     $qa_content['custom'] = $this->opt_form();
     return $qa_content;
 }
Exemplo n.º 7
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html('example_page/page_title');
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <b>custom html</b>';
     $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'name="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'name="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<p><br>More <i>custom html</i></p>';
     return $qa_content;
 }
Exemplo n.º 8
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html('example_page/page_title');
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <B>custom html</B>';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request', 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
     return $qa_content;
 }
Exemplo n.º 9
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;
}
Exemplo n.º 10
0
 function process_request($request)
 {
     $rqsts = explode('_', strtolower($request));
     $qa_content = qa_content_prepare();
     //$qa_content['title']=qa_lang_html('example_page/page_title');
     //$qa_content['error']='An example error'."\n";
     $qa_content['title'] = ' 资料下载';
     $qa_content['custom'] = '<link href="' . $this->urltoroot . 'downpage.css" rel="stylesheet" type="text/css" />' . "\n";
     //$qa_content['custom'].='Some <B>custom html</B>'."\n";
     //
     /*
     			$qa_content['form']=array(
     				'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"',
     				
     				'style' => 'wide',
     				
     				'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null,
     				
     				'title' => 'Form title',
     				
     				'fields' => array(
     					'request' => array(
     						'label' => 'The request',
     						'tags' => 'NAME="request"',
     						'value' => qa_html($request),
     						'error' => qa_html('Another error'),
     					),
     					
     				),
     				
     				'buttons' => array(
     					'ok' => array(
     						'tags' => 'NAME="okthen"',
     						'label' => 'OK then',
     						'value' => '1',
     					),
     				),
     				
     				'hidden' => array(
     					'hiddenfield' => '1',
     				),
     			);
     */
     //$qa_content['custom_2']='<P><BR>More <I>custom html</I></P>';
     require_once $this->urltoroot . 'downloadhtml.php';
     $qa_content['custom_2'] = setDownloadHtml($rqsts, $this->urltoroot);
     //$qa_content['custom_2']=$this->urltoroot;
     return $qa_content;
 }
Exemplo n.º 11
0
 function process_request($request)
 {
     if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
         $qa_content = qa_content_prepare();
         $qa_content['error'] = "You don't have permission to access this page.";
         return $qa_content;
     }
     $qa_content = qa_content_prepare();
     $qa_content['site_title'] = "Infinity Theme";
     $qa_content['title'] = "Theme Option";
     $qa_content['error'] = "";
     $qa_content['suggest_next'] = "";
     $qa_content['custom'] = $this->page_form();
     $qa_content['sidepanel'] = '';
     return $qa_content;
 }
Exemplo n.º 12
0
function qa_admin_check_privileges(&$qa_content)
{
    if (!qa_is_logged_in()) {
        require_once QA_INCLUDE_DIR . 'qa-app-format.php';
        $qa_content = qa_content_prepare();
        $qa_content['title'] = qa_lang_html('admin/admin_title');
        $qa_content['error'] = qa_insert_login_links(qa_lang_html('admin/not_logged_in'), qa_request());
        return false;
    } elseif (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
        $qa_content = qa_content_prepare();
        $qa_content['title'] = qa_lang_html('admin/admin_title');
        $qa_content['error'] = qa_lang_html('admin/no_privileges');
        return false;
    }
    return true;
}
Exemplo n.º 13
0
 function process_request($request)
 {
     $parts = explode('/', $request);
     $tag = $parts[1];
     $qa_content = qa_content_prepare();
     $qa_content['title'] = 'Edit the description for Fture test ' . qa_html($tag);
     require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => 'Save Description')));
     if (qa_clicked('dosave')) {
         require_once QA_INCLUDE_DIR . 'qa-util-string.php';
         $taglc = qa_strtolower($tag);
         qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
         qa_redirect('tag/' . $tag);
     }
     $qa_content['focusid'] = 'tagdesc';
     return $qa_content;
 }
Exemplo n.º 14
0
 function process_request($request)
 {
     // perform userinfuser registration
     $ui = new UserInfuser("*****@*****.**", "0658a511-d890-4e51-ba9e-126d6c0a12f2");
     $ui->update_user(qa_get_logged_in_email(), qa_get_logged_in_userid(), "", "");
     $ui->award_points(qa_get_logged_in_email(), 1000);
     $pw = $ui->get_widget(qa_get_logged_in_email(), "points", 100, 100);
     $lw = $ui->get_widget(qa_get_logged_in_email(), "leaderboard", 600, 300);
     $qa_content = qa_content_prepare();
     $qa_content['title'] = 'Example plugin page';
     $qa_content['error'] = 'An example error';
     $qa_content['custom'] = 'Some <B>custom html</B>';
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null, 'title' => 'Form title', 'fields' => array('request' => array('label' => 'The request' . qa_get_logged_in_userid(), 'tags' => 'NAME="request"', 'value' => qa_html($request), 'error' => qa_html('Another error'))), 'buttons' => array('ok' => array('tags' => 'NAME="okthen"', 'label' => 'OK then', 'value' => '1')), 'hidden' => array('hiddenfield' => '1'));
     $qa_content['custom_2'] = '<P><BR>More <I>custom html</I></P>';
     $qa_content['custom_3'] = $pw . $lw;
     return $qa_content;
 }
Exemplo n.º 15
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['head_lines'][] = '<style>' . qa_opt('faq_css') . '</style>';
     $qa_content['title'] = qa_opt('faq_page_title');
     $qa_content['custom_0'] = $this->filter_subs(qa_opt('faq_pre_html')) . '<' . (qa_opt('faq_list_type') ? 'o' : 'u') . 'l class="qa-faq-list">';
     $idx = 0;
     while (qa_opt('faq_section_' . $idx)) {
         $title = $this->filter_subs(qa_opt('faq_section_' . $idx . '_title'));
         $text = $this->filter_subs(qa_opt('faq_section_' . $idx));
         $qa_content['custom_' . ($idx + 1) . '_title'] = '<li class="qa-faq-list-item"><div id="custom_' . $idx . '_title" onclick="jQuery(\'#custom_' . $idx . '_text\').toggle(\'fast\')" class="qa-faq-section-title">' . $title . '</div>';
         $qa_content['custom_' . ($idx + 1) . '_text'] = '<div id="custom_' . $idx . '_text" class="qa-faq-section-text">' . $text . '</div></li>';
         $idx++;
     }
     $qa_content['custom_' . ++$idx] = '</' . (qa_opt('faq_list_type') ? 'o' : 'u') . 'l>';
     $qa_content['custom_' . ++$idx] = $this->filter_subs(qa_opt('faq_post_html'));
     return $qa_content;
 }
Exemplo n.º 16
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['title'] = '联系我们';
     //$qa_content['error']='An example error';
     //$qa_content['custom']='Some <B>custom html</B>';
     /*
     			$qa_content['form']=array(
     				'tags' => 'METHOD="POST" ACTION="'.qa_self_html().'"',
     				
     				'style' => 'wide',
     				
     				'ok' => qa_post_text('okthen') ? 'You clicked OK then!' : null,
     				
     				'title' => 'Form title',
     				
     				'fields' => array(
     					'request' => array(
     						'label' => 'The request',
     						'tags' => 'NAME="request"',
     						'value' => qa_html($request),
     						'error' => qa_html('Another error'),
     					),
     					
     				),
     				
     				'buttons' => array(
     					'ok' => array(
     						'tags' => 'NAME="okthen"',
     						'label' => 'OK then',
     						'value' => '1',
     					),
     				),
     				
     				'hidden' => array(
     					'hiddenfield' => '1',
     				),
     			);
     */
     $qa_content['custom_2'] = file_get_contents($this->directory . 'contacthtml.ini');
     $qa_content['custom_2'] = str_replace('[-contact-img-path-]', $this->urltoroot, $qa_content['custom_2']);
     return $qa_content;
 }
 function process_request($request)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-format.php';
     require_once QA_INCLUDE_DIR . 'qa-app-posts.php';
     require_once QA_INCLUDE_DIR . 'qa-db-post-create.php';
     require_once QA_INCLUDE_DIR . 'mp-db-users.php';
     // report that we entered this page
     qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING']));
     // create the editor and update its content
     qa_get_post_content('editor', 'content', $ineditor, $incontent, $informat, $intext);
     $editorname = isset($ineditor) ? $ineditor : qa_opt('editor_for_qs');
     $editor = qa_load_editor(@$incontent, @$informat, $editorname);
     // retrieve variable data
     $innotify = qa_post_text('notify') ? true : false;
     // handle creation of annoucement
     if (qa_post_text('docreate')) {
         //retrieve data
         $title = qa_post_text('title');
         $content = $incontent;
         $format = $informat;
         // validate data
         // handle create work
         // actual create process is in file mp-app-posts.php
         $postid = qa_post_create('AN', null, $title, $content, $format, mp_get_categoryid(), null, qa_get_logged_in_userid(), $innotify);
         // redirect page
         qa_redirect('mp-announcements-page');
         // our work is done here
     }
     $qa_content = qa_content_prepare();
     // if the user is not logged in, request user to login
     if (!qa_get_logged_in_userid()) {
         $qa_content['error'] = qa_insert_login_links('Please ^1log in^2 or ^3register^4 first.', $request);
         return $qa_content;
     }
     $qa_content['title'] = 'Create Announcement';
     $qa_content['form_newannouncement'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('title' => array('label' => qa_lang_html('announcements/a_title_label'), 'tags' => 'NAME="title"', 'value' => qa_html(qa_post_text('title')), 'error' => qa_html(@$errors['title'])), 'content' => array_merge($editor->get_field($qa_content, @$incontent, @$informat, 'content', 12, false), array('label' => qa_lang_html('announcements/a_content_label'), 'error' => qa_html(@$errors['content']))), 'notify' => array('label' => 'Send email notification to all registered students', 'tags' => 'NAME="notify"', 'type' => 'checkbox', 'value' => qa_html($innotify))), 'buttons' => array('ok' => array('tags' => 'NAME="docreate"', 'label' => 'Create Announcement', 'value' => '1')), 'hidden' => array('hiddenfield' => '1', 'editor' => qa_html($editorname)));
     // create the sub menu for navigation
     $qa_content['navigation']['sub'] = mp_announcements_sub_navigation();
     $qa_content['navigation']['sub']['create']['selected'] = true;
     return $qa_content;
 }
Exemplo n.º 18
0
 function process_request($request)
 {
     $userid = qa_get_logged_in_userid();
     $categoryid = mp_get_categoryid();
     $users = mp_get_category_userids($categoryid);
     $qa_content = qa_content_prepare();
     $qa_content['title'] = 'Classroom';
     $data = "<div class='mp-classroom'>";
     $data .= "<center><div class='mp-classroom-teacher'>&nbsp;</div></center>";
     $data .= "<div class='mp-classroom-users'>";
     foreach ($users as $user) {
         $userinfo = qa_db_select_with_pending(qa_db_user_account_selectspec($user['userid'], true));
         $data .= "<div class='mp-classroom-user'>";
         $data .= "<div class='mp-classroom-avatar'></div>";
         $data .= "<div class='mp-classroom-useremail'>" . qa_get_one_user_html($userinfo['handle'], false) . "</div>";
         $data .= "</div>";
     }
     $data .= "</div></div>";
     $qa_content['custom'] = $data;
     return $qa_content;
 }
Exemplo n.º 19
0
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['site_title'] = "Notifications";
     $qa_content['error'] = "";
     $qa_content['suggest_next'] = "";
     $qa_content['template'] = "notifications";
     // Get the no of notifications
     $start = qa_get_start();
     $pagesize = qa_opt('qw_all_notification_page_size');
     if (!$pagesize) {
         $pagesize = 15;
     }
     $notifications_count = qw_get_notification_count(qa_get_logged_in_userid());
     $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $notifications_count, qa_opt('pages_prev_next'));
     if (empty($qa_content['page_links'])) {
         $qa_content['suggest_next'] = qa_html_suggest_ask();
     }
     $qa_content['custom'] = $this->opt_form();
     return $qa_content;
 }
Exemplo n.º 20
0
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    global $qa_login_userid, $qa_cookieid, $qa_request;
    // get globals from qa-page.php
    //	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() . '"');
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $options = qa_post_html_defaults('Q');
        if (isset($categorypathprefix)) {
            $options['categorypathprefix'] = $categorypathprefix;
        }
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
        }
    } 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);
    }
    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);
    }
    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;
}
 function process_request($request)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-users.php';
     $appid = qa_opt('fb_app_id');
     $secret = qa_opt('fb_app_secret');
     $fb = new Facebook\Facebook(['app_id' => $appid, 'app_secret' => $secret, 'default_graph_version' => 'v2.4']);
     $qa_content = qa_content_prepare();
     $qa_content['title'] = 'Facebook Sharing Page';
     $helper = $fb->getRedirectLoginHelper();
     try {
         $accessToken = $helper->getAccessToken();
     } catch (Facebook\Exceptions\FacebookSDKException $e) {
         echo $e->getMessage();
         exit;
     }
     if (isset($accessToken)) {
         $_SESSION['fb_access_token'] = (string) $accessToken;
         $res = $fb->post('/me/feed', array('link' => 'http://nathorr.com/qeta/user/' . qa_get_logged_in_handle() . '/', 'name' => qa_opt('fb_shared_message_title'), 'picture' => qa_opt('fb_shared_message_picture'), 'description' => qa_opt('fb_shared_message_description'), 'message' => 'I have scored ' . qa_get_logged_in_points() . ' points and achieved some nice badges in Nathorr Q&A, check it out!'), $accessToken);
         $post = $res->getGraphObject();
         $qa_content['custom'] = '<a href="http://nathorr.com/qeta/user/' . qa_get_logged_in_handle() . '">Successfully shared, return by clicking here.</a>';
         return $qa_content;
     } else {
         if ($helper->getError()) {
             var_dump($helper->getError());
             echo '<br><br>';
             var_dump($helper->getErrorCode());
             echo '<br><br>';
             var_dump($helper->getErrorReason());
             echo '<br><br>';
             var_dump($helper->getErrorDescription());
             echo '<br><br>';
             echo '<a href="http://nathorr.com/qeta/user/' . qa_get_logged_in_handle() . '/">Something went wrong, return by clicking here.</a>';
             exit;
         }
     }
     http_response_code(400);
     exit;
 }
 function process_request($request)
 {
     $parts = explode('/', $request);
     $tag = $parts[1];
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($tag));
     if (qa_user_permit_error('useo_tag_desc_permit_edit')) {
         $qa_content['error'] = qa_lang_html('users/no_permission');
         return $qa_content;
     }
     require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
     if (qa_clicked('dosave')) {
         require_once QA_INCLUDE_DIR . 'qa-util-string.php';
         $taglc = qa_strtolower($tag);
         qa_db_tagmeta_set($taglc, 'title', qa_post_text('tagtitle'));
         qa_db_tagmeta_set($taglc, 'description', qa_post_text('tagdesc'));
         qa_db_tagmeta_set($taglc, 'icon', qa_post_text('tagicon'));
         qa_redirect('tag/' . $tag);
     }
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('label' => 'Title:', 'type' => 'text', 'rows' => 2, 'tags' => 'NAME="tagtitle" ID="tagtitle"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'title'))), array('label' => 'Description:', 'type' => 'text', 'rows' => 4, 'tags' => 'NAME="tagdesc" ID="tagdesc"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'description'))), array('label' => 'Icon image:', 'type' => 'text', 'rows' => 1, 'tags' => 'NAME="tagicon" ID="tagicon"', 'value' => qa_html(qa_db_tagmeta_get($tag, 'icon')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => qa_lang_html('useo/save_desc_button'))));
     $qa_content['focusid'] = 'tagdesc';
     return $qa_content;
 }
Exemplo n.º 23
0
 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;
 }
Exemplo n.º 24
0
 function process_request($request)
 {
     if (qa_get_logged_in_level() < QA_USER_LEVEL_ADMIN) {
         $qa_content = qa_content_prepare();
         $qa_content['error'] = "You don't have permission to access this page.";
         return $qa_content;
     }
     global $qa_modules;
     $qa_content = qa_content_prepare();
     $qa_content['site_title'] = "Q2A Ultimate SEO by QA-Themes.com ";
     $qa_content['title'] = "Ultimate SEO";
     $qa_content['error'] = "";
     $qa_content['suggest_next'] = "";
     $qa_content['script_rel'][] = $qa_modules['page']['Ultimate SEO Options']['urltoroot'] . 'include/easyResponsiveTabs.js';
     $qa_content['script_rel'][] = $qa_modules['page']['Ultimate SEO Options']['urltoroot'] . 'include/main.js';
     $qa_content['css_src'][] = $this->urltoroot . 'include/style.css';
     $qa_content['custom'] = $this->page_form();
     //empty sidebar's content
     $qa_content['sidepanel'] = '';
     $qa_content['sidebar'] = '';
     unset($qa_content['widgets']);
     $qa_content['widgets'] = array();
     return $qa_content;
 }
 function process_request($request)
 {
     $parts = explode('/', $request);
     $categoryid = $parts[1];
     $fullcategory = qa_db_select_with_pending(qa_db_full_category_selectspec($categoryid, true));
     $slugs = explode('/', $fullcategory['backpath']);
     $new_request = implode('/', array_reverse($slugs));
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang_html_sub('useo/edit_desc_for_x', qa_html($fullcategory['title']));
     if (qa_user_permit_error('useo_cat_desc_permit_edit')) {
         $qa_content['error'] = qa_lang_html('users/no_permission');
         return $qa_content;
     }
     require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
     if (qa_clicked('dosave')) {
         require_once QA_INCLUDE_DIR . 'qa-util-string.php';
         qa_db_categorymeta_set($categoryid, 'useo_cat_title', qa_post_text('useo_cat_title'));
         qa_db_categorymeta_set($categoryid, 'useo_cat_description', qa_post_text('useo_cat_description'));
         qa_redirect($new_request);
     }
     $qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array(array('label' => 'Link Title:', 'type' => 'text', 'rows' => 2, 'tags' => 'NAME="useo_cat_title" ID="useo_cat_title"', 'value' => qa_html(qa_db_categorymeta_get($categoryid, 'useo_cat_title'))), array('label' => 'Description:', 'type' => 'text', 'rows' => 4, 'tags' => 'NAME="useo_cat_description" ID="useo_cat_description"', 'value' => qa_html(qa_db_categorymeta_get($categoryid, 'useo_cat_description')))), 'buttons' => array(array('tags' => 'NAME="dosave"', 'label' => qa_lang_html('useo/save_desc_button'))));
     $qa_content['focusid'] = 'tagtitle';
     return $qa_content;
 }
Exemplo n.º 26
0
        }
        if ($captchareason) {
            require_once 'qa-app-captcha.php';
            qa_captcha_validate_post($errors);
        }
        if (empty($errors)) {
            $cookieid = isset($userid) ? qa_cookie_get() : qa_cookie_get_create();
            // create a new cookie if necessary
            $questionid = qa_question_create($followanswer, $userid, qa_get_logged_in_handle(), $cookieid, $in['title'], $in['content'], $in['format'], $in['text'], qa_tags_to_tagstring($in['tags']), $in['notify'], $in['email'], $in['categoryid'], $in['extra'], $in['queued'], $in['name']);
            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);"';
            $securityexpired = true;
        } else {
            foreach ($optionnames as $optionname) {
                qa_set_option($optionname, (int) qa_post_text('option_' . $optionname));
            }
            if (!qa_post_text('has_js')) {
                qa_redirect('admin/recalc', array('dorecalcpoints' => 1));
            } else {
                $recalculate = true;
            }
        }
    }
    $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'));
    $pagesize = qa_opt('page_size_search');
    $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;
Exemplo n.º 29
0
 function process_request($request)
 {
     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 $this->directory . 'qa-open-utils.php';
     //	Check we're not using single-sign on integration, that we're logged in
     if (QA_FINAL_EXTERNAL_USERS) {
         qa_fatal_error('User accounts are handled by external code');
     }
     $userid = qa_get_logged_in_userid();
     if (!isset($userid)) {
         qa_redirect('login');
     }
     //	Get current information on user
     $useraccount = qa_db_user_find_by_id__open($userid);
     //  Check if settings were updated
     $this->check_settings();
     //  Check if we're unlinking an account
     $mylogins = $this->check_unlink($useraccount);
     //  Check if we need to associate another provider
     $tolink = $this->check_associate($useraccount);
     //  Check if we're merging multiple accounts
     $otherlogins = $this->check_merge($useraccount, $mylogins, $tolink);
     //	Prepare content for theme
     $disp_conf = qa_get('confirm') || !empty($tolink);
     $qa_content = qa_content_prepare();
     //  Build page
     if (!$disp_conf) {
         // just visiting the regular page
         $qa_content['title'] = qa_lang_html('plugin_open/my_logins_title');
         $qa_content['navigation']['sub'] = qa_user_sub_navigation($useraccount['handle'], '', true);
         $qa_content['script_onloads'][] = '$(function(){ window.setTimeout(function() { qa_conceal(".form-notification-ok"); }, 1500); });';
         $this->display_summary($qa_content, $useraccount);
         $this->display_logins($qa_content, $useraccount, $mylogins);
         $this->display_duplicates($qa_content, $useraccount, $otherlogins);
         $this->display_services($qa_content, !empty($mylogins) || !empty($otherlogins));
     } else {
         // logged in and there are duplicates
         $qa_content['title'] = qa_lang_html('plugin_open/other_logins_conf_title');
         if (!$this->display_duplicates($qa_content, $useraccount, $otherlogins)) {
             $tourl = qa_get('to');
             if (!empty($tourl)) {
                 qa_redirect($tourl);
             } else {
                 if ($tolink) {
                     // unable to link the login
                     $provider = ucfirst($tolink['source']);
                     qa_redirect('logins', array('provider' => $provider, 'code' => 99));
                 } else {
                     // no merge to confirm
                     qa_redirect('', array('provider' => '', 'code' => 98));
                 }
             }
         }
     }
     return $qa_content;
 }
 function process_request($request)
 {
     $qa_content = qa_content_prepare();
     $qa_content['title'] = qa_lang('badges/badge_list_title');
     $badges = qa_get_badge_list();
     $totalawarded = 0;
     $qa_content['custom'] = '<em>' . qa_lang('badges/badge_list_pre') . '</em><br />';
     $qa_content['custom2'] = '<table cellspacing="20">';
     $c = 2;
     $result = qa_db_read_all_assoc(qa_db_query_sub('SELECT user_id,badge_slug  FROM ^userbadges'));
     $count = array();
     foreach ($result as $r) {
         if (qa_opt('badge_' . $r['badge_slug'] . '_enabled') == '0') {
             continue;
         }
         if (isset($count[$r['badge_slug']][$r['user_id']])) {
             $count[$r['badge_slug']][$r['user_id']]++;
         } else {
             $count[$r['badge_slug']][$r['user_id']] = 1;
         }
         $totalawarded++;
         if (isset($count[$r['badge_slug']]['count'])) {
             $count[$r['badge_slug']]['count']++;
         } else {
             $count[$r['badge_slug']]['count'] = 1;
         }
     }
     foreach ($badges as $slug => $info) {
         if (qa_opt('badge_' . $slug . '_enabled') == '0') {
             continue;
         }
         $badge_name = qa_badge_name($slug);
         if (!qa_opt('badge_' . $slug . '_name')) {
             qa_opt('badge_' . $slug . '_name', $badge_name);
         }
         $name = qa_opt('badge_' . $slug . '_name');
         $var = qa_opt('badge_' . $slug . '_var');
         $desc = qa_badge_desc_replace($slug, $var, false);
         $type = qa_get_badge_type($info['type']);
         $types = $type['slug'];
         $typen = $type['name'];
         $qa_content['custom' . ++$c] = '<tr><td class="badge-entry"><div class="badge-entry-badge"><span class="badge-' . $types . '" title="' . $typen . '">' . $name . '</span>&nbsp;<span class="badge-entry-desc">' . $desc . '</span>' . (isset($count[$slug]) ? '&nbsp;<span title="' . $count[$slug]['count'] . ' ' . qa_lang('badges/awarded') . '" class="badge-count-link" onclick="jQuery(\'#badge-users-' . $slug . '\').slideToggle()">x' . $count[$slug]['count'] . '</span>' : '') . '</div>';
         // source users
         if (qa_opt('badge_show_source_users') && isset($count[$slug])) {
             $users = array();
             require_once QA_INCLUDE_DIR . 'qa-app-users.php';
             $qa_content['custom' . $c] .= '<div style="display:none" id="badge-users-' . $slug . '" class="badge-users">';
             foreach ($count[$slug] as $uid => $ucount) {
                 if ($uid == 'count') {
                     continue;
                 }
                 if (QA_FINAL_EXTERNAL_USERS) {
                     $handles = qa_get_public_from_userids(array($uid));
                     $handle = @$handles[$uid];
                 } else {
                     $useraccount = qa_db_select_with_pending(qa_db_user_account_selectspec($uid, true));
                     $handle = @$useraccount['handle'];
                 }
                 if (!$handle) {
                     continue;
                 }
                 $users[] = '<a href="' . qa_path_html('user/' . $handle) . '">' . $handle . ($ucount > 1 ? ' x' . $ucount : '') . '</a>';
             }
             $qa_content['custom' . $c] .= implode('<br/>', $users) . '</div>';
         }
         $qa_content['custom' . $c] .= '</td></tr>';
     }
     $qa_content['custom' . ++$c] = '<tr><td class="badge-entry"><span class="total-badges">' . count($badges) . ' ' . qa_lang('badges/badges_total') . '</span>' . ($totalawarded > 0 ? ', <span class="total-badge-count">' . $totalawarded . ' ' . qa_lang('badges/awarded_total') . '</span>' : '') . '</td></tr></table>';
     if (isset($qa_content['navigation']['main']['custom-2'])) {
         $qa_content['navigation']['main']['custom-2']['selected'] = true;
     }
     return $qa_content;
 }