function head_script()
 {
     qa_html_theme_base::head_script();
     if (qa_opt('voting_on_cs') && isset($this->content['q_view'])) {
         $this->output("\n<script type='text/javascript'>\n\tfunction ajaxCommentVote(elem, oldvote)\n\t{\n\t\tvar ens=elem.getAttribute('name').split('_');\n\t\tvar postid=ens[1];\n\t\tvar vote=parseInt(ens[2]);\n\t\tvar anchor=ens[3];\n\t\tvar which=parseInt(ens[4]);\n\n\t\tvar dataString = 'ajax_comment_vote_id='+postid+'&ajax_comment_vote='+vote;  \n\n\t\tjQuery.ajax({  \n\t\t  type: 'POST',  \n\t\t  url: '" . qa_self_html() . "',  \n\t\t  data: dataString,  \n\t\t  dataType: 'json',  \n\t\t  success: function(json) {\n\t\t\t\tif (json.status=='1') {\n\t\t\t\t\tswitch(vote) {\n\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\tvar up = 0;\n\t\t\t\t\t\t\tvar up_type = '-selected';\n\t\t\t\t\t\t\tvar down_type = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase -1:\n\t\t\t\t\t\t\tvar down = 0;\n\t\t\t\t\t\t\tvar up_type = false;\n\t\t\t\t\t\t\tvar down_type = '-selected';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\tvar up = 1;\n\t\t\t\t\t\t\tvar down = -1;\n\t\t\t\t\t\t\tvar up_type = '';\n\t\t\t\t\t\t\tvar down_type = '';\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}" . (!qa_opt('voting_down_cs') ? "\n\t\t\t\t\t\n\t\t\t\t\tdown_type = false;\n" : "") . "\n\t\t\t\t\telem.parentNode.innerHTML = (up_type!==false?'<div class=\"comment-vote-item'+up_type+'\" name=\"vote_'+ens[1]+'_'+up+'_c'+ens[1]+'_1\" onclick=\"ajaxCommentVote(this);\" title=\"'+json.up+'\">▲</div>':'')+(parseInt(json.data)!=0?'<div id=\"voting_'+ens[1]+'\" title=\"json.up\">'+(json.data!='0'?json.data:'')+'</div>':'')+(down_type!==false?'<div class=\"comment-vote-item'+down_type+'\" name=\"vote_'+ens[1]+'_'+down+'_c'+ens[1]+'_-1\" onclick=\"ajaxCommentVote(this);\" title=\"'+json.down+'\">▼</div>':'');\n\n\t\t\t\t} else if (json.status=='0') {\n\t\t\t\t\tvar mess=document.getElementById('errorbox');\n\t\t\t\t\tif (!mess) {\n\t\t\t\t\t\tvar mess=document.createElement('div');\n\t\t\t\t\t\tmess.id='errorbox';\n\t\t\t\t\t\tmess.className='qa-error';\n\t\t\t\t\t\tmess.innerHTML=json.data;\n\t\t\t\t\t}\n\t\t\t\t\tvar postelem=document.getElementById(anchor);\n\t\t\t\t\tpostelem.parentNode.insertBefore(mess, postelem);\n\t\t\t\t} else {\n\t\t\t\t\talert('Unexpected response from server - please try again.');\n\t\t\t\t}\n\t\t\t} \n\t\t});\n\t\treturn false;\n\t} \t\n</script>");
     }
 }
示例#2
0
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
    require_once QA_INCLUDE_DIR . 'qa-app-format.php';
    require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
    $userid = qa_get_logged_in_userid();
    //	Chop down to size, get user information for display
    if (isset($pagesize)) {
        $questions = array_slice($questions, 0, $pagesize);
    }
    $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    if (count($questions)) {
        $qa_content['title'] = $sometitle;
        $defaults = qa_post_html_defaults('Q');
        foreach ($questions as $question) {
            $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
        }
    } else {
        $qa_content['title'] = $nonetitle;
    }
    if (isset($count) && isset($pagesize)) {
        $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
    }
    return $qa_content;
}
示例#3
0
 function head_custom()
 {
     if ($this->template == 'admin') {
         $this->output("\n\t<script>\t\t\t\n\tfunction mergePluginGetPosts() {\n\t\tvar from=jQuery('#merge_from').val();\n\t\tvar to=jQuery('#merge_to').val();\n\n\t\tvar dataString = 'ajax_merge_get_from='+from+'&ajax_merge_get_to='+to;  \n\t\tjQuery.ajax({  \n\t\t  type: 'POST',  \n\t\t  url: '" . qa_self_html() . "',  \n\t\t  data: dataString,  \n\t\t  dataType: 'json',  \n\t\t  success: function(json) {\n\t\t\t\tjQuery('#merge_from_out').html('Merging from: <a href=\"'+json.from_url+'\">'+json.from+'</a>');\n\t\t\t\tjQuery('#merge_to_out').html('To: <a href=\"'+json.to_url+'\">'+json.to+'</a>');\n\t\t\t} \n\t\t});\n\t\treturn false;\n\t}\n\t</script>");
     }
     qa_html_theme_base::head_custom();
 }
 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 head_script()
 {
     qa_html_theme_base::head_script();
     if (qa_opt('ajax_comment_enable') && !$this->qa_state && $this->template == 'question' && $this->can_comment) {
         $this->output_raw("\n\t<style>\n\t\t.ajax-comment-hidden {\n\t\t\tdisplay:none;\n\t\t}\n\t\t.ajax-comment-reminder {\n\t\t\tfont-size:10px;\n\t\t\tfont-style:italic;\n\t\t}\n\t\t.ajax-comment-vote-popup {\n\t\t\tposition: absolute; \n\t\t\tbackground-color:yellow; \n\t\t\tpadding:10px;\n\t\t\tborder:1px solid; \n\t\t\tmargin-left:20px; \n\t\t\tmargin-top:45px; \n\t\t\ttext-align:justify; \n\t\t\twidth:250px; \n\t\t\tfont-weight:bold;\n\t\t\tcursor:pointer;\n\t\t\tdisplay:none;\n\t\t}\n\t</style>");
         $this->output_raw("\n\t<script>\n\t\n\t\tfunction flashStar(idx) {\n\t\t\n\t\t\tvar star = jQuery('.qa-a-select-button').eq(idx-1);\n\t\t\tstar.attr('class','qa-a-select-hover');\n\t\t\tstar.fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow').fadeIn('slow').fadeOut('slow',function(){\n\t\t\t\tstar.attr('class','qa-a-select-button').fadeIn('slow');\n\t\t\t});\n\t\t}\n\n\t\tfunction voteReminderNotice(elem,idx) {\n\t\t\tflashStar(idx);\n\t\t\tjQuery('<div class=\"ajax-comment-vote-popup\" onclick=\"this.style.display=\\'none\\';\">" . qa_html(qa_opt('ajax_comment_popup_notice_text')) . "</div>').insertAfter(elem.parentNode.parentNode).fadeIn('fast').delay(8000).fadeOut('slow');\n\t\t}\n\t\n\t\tvar ajax_comment_position = 0;\n\t\tvar ajax_comment_id = 0;\n\t\tvar ajax_comment_height = 0;\n\t\tfunction toggleComment(idx,username,flash) {\n\t\t\tjQuery('.ajax-comment').hide('slow');\n\t\t\t\n\t\t\tif(idx === false) {\n\t\t\t\tjQuery('textarea#comment').val('');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar cDiv = jQuery('#ajax-comment-'+idx);\n\t\t\t\n\t\t\tif(cDiv.length) {\n\t\t\t\tif(ajax_comment_position != idx) {\n\t\t\t\t\tcDiv.append(jQuery('#ajax-comment-'+ajax_comment_position).html());\n\t\t\t\t\tjQuery('#ajax-comment-'+ajax_comment_position).html('');\n\t\t\t\t\tajax_comment_position = idx;\n\t\t\t\t}\n\n\t\t\t\tif(!cDiv.is(':visible')) {\n\t\t\t\t\t\n\t\t\t\t\t// flash star\n\t\t\t\t\t\t\n\t\t\t\t\tif(flash && !jQuery('.qa-a-item-selected').length) flashStar(flash);\n\t\t\t\t\t\n\t\t\t\t\t// check if onscreen\n\t\t\t\t\t\n\t\t\t\t\tvar top = (-1)*jQuery('html').offset().top;\n\t\t\t\t\tvar cTop = cDiv.prev().offset().top + cDiv.prev().height();\n\t\t\t\t\tvar bot = top + jQuery(window).height();\n\t\t\t\t\t\n\t\t\t\t\tif (cTop > top && cTop < bot) {\n\t\t\t\t\t\tcDiv.show('slow',function(){\n\t\t\t\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv.height()+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').focus();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcDiv.show();\n\t\t\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv.height()+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').focus();\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').val((username?'@'+username+' ':''));\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(username) {\n\t\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').val(jQuery('#ajax-comment-'+idx+' textarea#comment').val()+'@'+username+' ');\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t\t\tjQuery('#ajax-comment-'+idx+' textarea#comment').focus();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfunction ajaxPostComment() {\n\t\t\tvar cText = jQuery('#ajax-comment-'+ajax_comment_position+' textarea#comment');\n\t\t\tvar content = cText.val();\n\t\t\t\n\t\t\tvar notify = jQuery('#ajax-comment-'+(ajax_comment_position)+' input[name=\"notify\"]').attr('checked');\n\t\t\tvar email = jQuery('#ajax-comment-'+(ajax_comment_position)+' input[name=\"email\"]').val();\n\t\t\tvar editor = jQuery('#ajax-comment-'+(ajax_comment_position)+' input[name=\"editor\"]').val();\n\t\t\tvar oldcss = cText.css('background');\n\t\t\tcText.css('background','url(" . QA_HTML_THEME_LAYER_URLTOROOT . "ajax-loader.gif) no-repeat scroll center center silver');\n\t\t\t//cText.val('');\n\t\t\t\n\t\t\tvar dataString = 'ajax_id='+ajax_comment_position+'&ajax_comment_content='+content+(ajax_comment_position!=0?'&ajax_comment_id='+document.getElementById('ajax-comment-'+ajax_comment_position).getAttribute('value'):'')+(notify?'&notify='+notify:'')+(email?'&email='+email:'')+(editor?'&editor='+editor:'');  \n\t\t\tjQuery.ajax({  \n\t\t\t  type: 'POST',  \n\t\t\t  url: '" . qa_self_html() . "',  \n\t\t\t  data: dataString,  \n\t\t\t  success: function(data) {\n\t\t\t\tif(/^[\\t\\n ]*###/.exec(data)) {\n\t\t\t\t\tvar error = data.replace(/^[\\t\\n ]*### */,'');\n\t\t\t\t\twindow.alert(error);\n\t\t\t\t\t//cText.val(content);\n\t\t\t\t}\n\t\t\t\telse if(ajax_comment_position == 0) {\n\t\t\t\t\tif(jQuery('.qa-q-view-c-list').length == 0) jQuery('<div class=\"qa-q-view-c-list\">'+data+'</div>').insertBefore('#ajax-comment-'+ajax_comment_position).find('div.qa-c-list-item:last').show('slow',function () {slideToDiv('.qa-q-view-c-list')});\n\t\t\t\t\telse jQuery('.qa-q-view-c-list').append(data).find('div.qa-c-list-item:last').show('slow',function () {slideToDiv('.qa-q-view-c-list')});\n\t\t\t\t\ttoggleComment(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif(!document.getElementById('ajax-comment-'+ajax_comment_position).getAttribute('comments')) {\n\t\t\t\t\t\tdocument.getElementById('ajax-comment-'+ajax_comment_position).setAttribute('comments','true');\n\t\t\t\t\t\tjQuery('<div class=\"qa-a-item-c-list\">'+data+'</div>').insertBefore('#ajax-comment-'+ajax_comment_position).find('div.qa-c-list-item:last').show('slow');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tjQuery('.ajax-comment-idx-'+ajax_comment_position).append(data).find('div.qa-c-list-item:last').show('slow');\n\t\t\t\t\t}\n\t\t\t\t\ttoggleComment(false);\n\t\t\t\t}\n\t\t\t\tcText.css('background',oldcss);\n\t\t\t  }  \n\t\t\t});\n\t\t}\n\t\t\n\t\tfunction slideToDiv(div) {\n\t\t\tvar cDiv = jQuery(div);\n\t\t\tif(cDiv.length) {\n\t\t\t\tjQuery('html').animate({scrollTop:(cDiv.offset().top-jQuery(window).height()+cDiv.height()+20)+'px'},{queue:false, duration:600, easing: 'swing'});\n\t\t\t}\t\t\t\n\t\t}\n\t\t\n\t</script>");
     }
 }
示例#6
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;
 }
 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;
 }
示例#8
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;
}
function qa_favorite_q_list_view($questions, $usershtml)
{
    $q_list = array('qs' => array());
    if (count($questions) === 0) {
        return $q_list;
    }
    $q_list['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $defaults = qa_post_html_defaults('Q');
    foreach ($questions as $question) {
        $q_list['qs'][] = qa_post_html_fields($question, qa_get_logged_in_userid(), qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
    }
    return $q_list;
}
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-app-users.php';
     $allowEdit = !qa_user_permit_error('fb_share_permit_edit');
     $parts = explode('/', qa_self_html());
     if ($allowEdit && $parts[2] == qa_get_logged_in_handle()) {
         $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']);
         $helper = $fb->getRedirectLoginHelper();
         $permissions = ['email', 'publish_actions'];
         $callback = 'http://nathorr.com/qeta/fb-share/' . qa_get_logged_in_handle() . '/';
         $loginUrl = $helper->getLoginUrl($callback, $permissions);
         echo '<a href="' . $loginUrl . '"><img src="http://oi57.tinypic.com/f1xlbt.jpg"></a>';
     }
 }
 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;
 }
示例#12
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;
 }
 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;
 }
示例#14
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 newsletterForm()
 {
     $fields = array();
     $ok = null;
     $tags = null;
     $buttons = array();
     $userid = qa_get_logged_in_userid();
     require_once QA_INCLUDE_DIR . 'qa-db-metas.php';
     if (qa_clicked('newsletter_send_save')) {
         qa_db_usermeta_set($userid, 'newsletter', (bool) qa_post_text('newsletter_send_me'));
         $ok = qa_lang('badges/badge_notified_email_me');
     }
     $selected = (bool) qa_db_usermeta_get($userid, 'newsletter');
     $tags = 'id="badge-form" action="' . qa_self_html() . '#signature_text" method="POST"';
     $fields[] = array('type' => 'blank');
     $text = str_replace('^email', $this->getEmail($userid), qa_lang('newsletter/newsletter_send_me'));
     $text = str_replace('^newsletter', qa_opt('site_url') . qa_opt('news_plugin_request'), $text);
     $text = str_replace('^days', qa_opt('news_plugin_send_days'), $text);
     $fields[] = array('label' => $text, 'type' => 'checkbox', 'tags' => 'NAME="newsletter_send_me"', 'value' => $selected);
     $buttons[] = array('label' => qa_lang_html('main/save_button'), 'tags' => 'NAME="newsletter_send_save"');
     return array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'tall', 'tags' => $tags, 'title' => qa_lang('newsletter/newsletter'), 'fields' => $fields, 'buttons' => $buttons);
 }
 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;
 }
 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 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;
 }
 function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
     if (@$qa_content['q_view']['raw']['type'] != 'Q') {
         // question might not be visible, etc...
         return;
     }
     $questionid = $qa_content['q_view']['raw']['postid'];
     $userid = qa_get_logged_in_userid();
     $cookieid = qa_cookie_get();
     $questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
     $minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
     foreach ($questions as $key => $question) {
         if ($question['score'] < $minscore) {
             unset($questions[$key]);
         }
     }
     $titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
     if ($region == 'side') {
         $themeobject->output('<DIV CLASS="qa-related-qs">', '<H2 STYLE="margin-top:0; padding-top:0;">', $titlehtml, '</H2>');
         $themeobject->output('<UL CLASS="qa-related-q-list">');
         foreach ($questions as $question) {
             $themeobject->output('<LI CLASS="qa-related-q-item"><A HREF="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</A></LI>');
         }
         $themeobject->output('</UL>', '</DIV>');
     } else {
         $themeobject->output('<H2>', $titlehtml, '</H2>');
         $q_list = array('form' => array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"'), 'qs' => array());
         $options = qa_post_html_defaults('Q');
         $usershtml = qa_userids_handles_html($questions);
         foreach ($questions as $question) {
             $q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options);
         }
         $themeobject->q_list_and_form($q_list);
     }
 }
示例#20
0
 public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
 {
     require_once QA_INCLUDE_DIR . 'db/selects.php';
     if (!isset($qa_content['q_view']['raw']['type']) || $qa_content['q_view']['raw']['type'] != 'Q') {
         // question might not be visible, etc...
         return;
     }
     $questionid = $qa_content['q_view']['raw']['postid'];
     $userid = qa_get_logged_in_userid();
     $cookieid = qa_cookie_get();
     $questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
     $minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
     foreach ($questions as $key => $question) {
         if ($question['score'] < $minscore) {
             unset($questions[$key]);
         }
     }
     $titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
     if ($region == 'side') {
         $themeobject->output('<div class="qa-related-qs">', '<h2 style="margin-top:0; padding-top:0;">', $titlehtml, '</h2>');
         $themeobject->output('<ul class="qa-related-q-list">');
         foreach ($questions as $question) {
             $themeobject->output('<li class="qa-related-q-item">' . '<a href="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</a>' . '</li>');
         }
         $themeobject->output('</ul>', '</div>');
     } else {
         $themeobject->output('<h2>', $titlehtml, '</h2>');
         $q_list = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))), 'qs' => array());
         $defaults = qa_post_html_defaults('Q');
         $usershtml = qa_userids_handles_html($questions);
         foreach ($questions as $question) {
             $q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults));
         }
         $themeobject->q_list_and_form($q_list);
     }
 }
示例#21
0
            qa_redirect(qa_q_request($questionid, $in['title']));
            // our work is done here
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare(false, array_keys(qa_category_path($categories, @$in['categoryid'])));
$qa_content['title'] = qa_lang_html(isset($followanswer) ? 'question/ask_follow_title' : 'question/ask_title');
$qa_content['error'] = @$errors['page'];
$editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_qs');
$editor = qa_load_editor(@$in['content'], @$in['format'], $editorname);
$field = qa_editor_load_field($editor, $qa_content, @$in['content'], @$in['format'], 'content', 12, false);
$field['label'] = qa_lang_html('question/q_content_label');
$field['error'] = qa_html(@$errors['content']);
$custom = qa_opt('show_custom_ask') ? trim(qa_opt('custom_ask')) : '';
$qa_content['form'] = array('tags' => 'name="ask" method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('custom' => array('type' => 'custom', 'note' => $custom), 'title' => array('label' => qa_lang_html('question/q_title_label'), 'tags' => 'name="title" id="title" autocomplete="off"', 'value' => qa_html(@$in['title']), 'error' => qa_html(@$errors['title'])), 'similar' => array('type' => 'custom', 'html' => '<span id="similar"></span>'), 'content' => $field), 'buttons' => array('ask' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script('content') : '') . '"', 'label' => qa_lang_html('question/ask_button'))), 'hidden' => array('editor' => qa_html($editorname), 'code' => qa_get_form_security_code('ask'), 'doask' => '1'));
if (!strlen($custom)) {
    unset($qa_content['form']['fields']['custom']);
}
if (qa_opt('do_ask_check_qs') || qa_opt('do_example_tags')) {
    $qa_content['script_rel'][] = 'qa-content/qa-ask.js?' . QA_VERSION;
    $qa_content['form']['fields']['title']['tags'] .= ' onchange="qa_title_change(this.value);"';
    if (strlen(@$in['title'])) {
        $qa_content['script_onloads'][] = 'qa_title_change(' . qa_js($in['title']) . ');';
    }
}
if (isset($followanswer)) {
    $viewer = qa_load_viewer($followanswer['content'], $followanswer['format']);
    $field = array('type' => 'static', 'label' => qa_lang_html('question/ask_follow_from_a'), 'value' => $viewer->get_html($followanswer['content'], $followanswer['format'], array('blockwordspreg' => qa_get_block_words_preg())));
    qa_array_insert($qa_content['form']['fields'], 'title', array('follows' => $field));
}
                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'));
}
foreach ($optionnames as $optionname) {
    $optionfield = array('label' => qa_lang_html('options/' . $optionname), 'tags' => 'name="option_' . $optionname . '"', 'value' => qa_html($options[$optionname]), 'type' => 'number', 'note' => qa_lang_html('admin/points'));
function qa_page_q_edit_c_form(&$qa_content, $id, $comment, $in, $errors)
{
    $commentid = $comment['postid'];
    $prefix = 'c' . $commentid . '_';
    $content = isset($in['content']) ? $in['content'] : $comment['content'];
    $format = isset($in['format']) ? $in['format'] : $comment['format'];
    $editorname = isset($in['editor']) ? $in['editor'] : qa_opt('editor_for_cs');
    $editor = qa_load_editor($content, $format, $editorname);
    $form = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'id' => $id, 'title' => qa_lang_html('question/edit_c_title'), 'style' => 'tall', 'fields' => array('content' => array_merge(qa_editor_load_field($editor, $qa_content, $content, $format, $prefix . 'content', 4, true), array('error' => qa_html(@$errors['content'])))), 'buttons' => array('save' => array('tags' => 'onclick="qa_show_waiting_after(this, false); ' . (method_exists($editor, 'update_script') ? $editor->update_script($prefix . 'content') : '') . '"', 'label' => qa_lang_html('main/save_button')), 'cancel' => array('tags' => 'name="docancel"', 'label' => qa_lang_html('main/cancel_button'))), 'hidden' => array($prefix . 'editor' => qa_html($editorname), $prefix . 'dosave' => '1', $prefix . 'code' => qa_get_form_security_code('edit-' . $commentid)));
    if ($comment['isbyuser']) {
        if (!qa_is_logged_in()) {
            qa_set_up_name_field($qa_content, $form['fields'], isset($in['name']) ? $in['name'] : @$comment['name'], $prefix);
        }
        qa_set_up_notify_fields($qa_content, $form['fields'], 'C', qa_get_logged_in_email(), isset($in['notify']) ? $in['notify'] : !empty($comment['notify']), isset($in['email']) ? $in['email'] : @$comment['notify'], @$errors['email'], $prefix);
    }
    if (!qa_user_post_permit_error('permit_edit_silent', $comment)) {
        $form['fields']['silent'] = array('type' => 'checkbox', 'label' => qa_lang_html('question/save_silent_label'), 'tags' => 'name="' . $prefix . 'silent"', 'value' => qa_html(@$in['silent']));
    }
    return $form;
}
示例#24
0
        }
    }
}
//	Get information for users
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
//	Create list of actual hidden postids and see which ones have dependents
$qhiddenpostid = array();
foreach ($questions as $key => $question) {
    $qhiddenpostid[$key] = isset($question['opostid']) ? $question['opostid'] : $question['postid'];
}
$dependcounts = qa_db_postids_count_dependents($qhiddenpostid);
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/recent_hidden_title');
$qa_content['error'] = isset($pageerror) ? $pageerror : qa_admin_page_error();
$qa_content['q_list'] = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('admin/click'))), 'qs' => array());
if (count($questions)) {
    foreach ($questions as $key => $question) {
        $elementid = 'p' . $qhiddenpostid[$key];
        $htmloptions = qa_post_html_options($question);
        $htmloptions['voteview'] = false;
        $htmloptions['tagsview'] = !isset($question['opostid']);
        $htmloptions['answersview'] = false;
        $htmloptions['viewsview'] = false;
        $htmloptions['updateview'] = false;
        $htmloptions['contentview'] = true;
        $htmloptions['flagsview'] = true;
        $htmloptions['elementid'] = $elementid;
        $htmlfields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, $htmloptions);
        if (isset($htmlfields['what_url'])) {
            // link directly to relevant content
示例#25
0
    } else {
        $pageerror = qa_lang('users/login_limit');
    }
} else {
    $inemailhandle = qa_get('e');
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('users/login_title');
$qa_content['error'] = @$pageerror;
if (empty($inemailhandle) || isset($errors['emailhandle'])) {
    $forgotpath = qa_path('forgot');
} else {
    $forgotpath = qa_path('forgot', array('e' => $inemailhandle));
}
$forgothtml = '<A HREF="' . qa_html($forgotpath) . '">' . qa_lang_html('users/forgot_link') . '</A>';
$qa_content['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'tall', 'ok' => $passwordsent ? qa_lang_html('users/password_sent') : 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
*/
        }
    }
    $usershtml = qa_userids_handles_html($fullquestions);
    //	Report the search event
    qa_report_event('search', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('query' => $inquery, 'start' => $start));
}
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
if (strlen(qa_get('q'))) {
    $qa_content['search']['value'] = qa_html($inquery);
    if (count($results)) {
        $qa_content['title'] = qa_lang_html_sub('main/results_for_x', qa_html($inquery));
    } else {
        $qa_content['title'] = qa_lang_html_sub('main/no_results_for_x', qa_html($inquery));
    }
    $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
    $qa_content['q_list']['qs'] = array();
    $qdefaults = qa_post_html_defaults('Q');
    foreach ($results as $result) {
        if (!isset($result['question'])) {
            // if we have any non-question results, display with less statistics
            $qdefaults['voteview'] = false;
            $qdefaults['answersview'] = false;
            $qdefaults['viewsview'] = false;
            break;
        }
    }
    foreach ($results as $result) {
        if (isset($result['question'])) {
            $fields = qa_post_html_fields($result['question'], $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($result['question'], $qdefaults));
        } elseif (isset($result['url'])) {
}
//	Other profile fields
foreach ($userfields as $userfield) {
    $value = @$inprofile[$userfield['fieldid']];
    if (!isset($value)) {
        $value = @$userprofile[$userfield['title']];
    }
    $label = trim(qa_user_userfield_label($userfield), ':');
    if (strlen($label)) {
        $label .= ':';
    }
    $qa_content['form_profile']['fields'][$userfield['title']] = array('label' => qa_html($label), 'tags' => 'name="field_' . $userfield['fieldid'] . '"', 'value' => qa_html($value), 'error' => qa_html(@$errors[$userfield['fieldid']]), 'rows' => $userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE ? 8 : null, 'type' => $isblocked ? 'static' : 'text');
}
//	Raw information for plugin layers to access
$qa_content['raw']['account'] = $useraccount;
$qa_content['raw']['profile'] = $userprofile;
$qa_content['raw']['points'] = $userpoints;
//	Change password form
$qa_content['form_password'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'title' => qa_lang_html('users/change_password'), 'fields' => array('old' => array('label' => qa_lang_html('users/old_password'), 'tags' => 'name="oldpassword"', 'value' => qa_html(@$inoldpassword), 'type' => 'password', 'error' => qa_html(@$errors['oldpassword'])), 'new_1' => array('label' => qa_lang_html('users/new_password_1'), 'tags' => 'name="newpassword1"', 'type' => 'password', 'error' => qa_html(@$errors['password'])), 'new_2' => array('label' => qa_lang_html('users/new_password_2'), 'tags' => 'name="newpassword2"', 'type' => 'password', 'error' => qa_html(@$errors['newpassword2']))), 'buttons' => array('change' => array('label' => qa_lang_html('users/change_password'))), 'hidden' => array('dochangepassword' => '1', 'code' => qa_get_form_security_code('password')));
if (!$haspassword) {
    $qa_content['form_password']['fields']['old']['type'] = 'static';
    $qa_content['form_password']['fields']['old']['value'] = qa_lang_html('users/password_none');
}
if (qa_get_state() == 'password-changed') {
    $qa_content['form_profile']['ok'] = qa_lang_html('users/password_changed');
}
$qa_content['navigation']['sub'] = qa_user_sub_navigation($useraccount['handle'], 'account', true);
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
示例#28
0
if (@$userpoints['aselects']) {
    $qa_content['form_activity']['fields']['questions']['value'] .= $userpoints['aselects'] == 1 ? qa_lang_html_sub('profile/1_with_best_chosen', '<SPAN CLASS="qa-uf-user-q-selects">1</SPAN>', '1') : qa_lang_html_sub('profile/x_with_best_chosen', '<SPAN CLASS="qa-uf-user-q-selects">' . number_format($userpoints['aselects']) . '</SPAN>');
}
if (@$userpoints['aselecteds']) {
    $qa_content['form_activity']['fields']['answers']['value'] .= $userpoints['aselecteds'] == 1 ? qa_lang_html_sub('profile/1_chosen_as_best', '<SPAN CLASS="qa-uf-user-a-selecteds">1</SPAN>', '1') : qa_lang_html_sub('profile/x_chosen_as_best', '<SPAN CLASS="qa-uf-user-a-selecteds">' . number_format($userpoints['aselecteds']) . '</SPAN>');
}
//	For plugin layers to access
$qa_content['raw']['userid'] = $userid;
$qa_content['raw']['points'] = $userpoints;
$qa_content['raw']['rank'] = $userrank;
//	Recent posts by this user
if ($pagesize > 0) {
    if (count($questions)) {
        $qa_content['q_list']['title'] = qa_lang_html_sub('profile/recent_activity_by_x', $userhtml);
    } else {
        $qa_content['q_list']['title'] = qa_lang_html_sub('profile/no_posts_by_x', $userhtml);
    }
    $qa_content['q_list']['form_profile'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
    $qa_content['q_list']['qs'] = array();
    $htmloptions = qa_post_html_defaults('Q');
    $htmloptions['whoview'] = true;
    //false;
    $htmloptions['avatarsize'] = 0;
    foreach ($questions as $question) {
        $qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, $htmloptions);
    }
}
return $qa_content;
/*
	Omit PHP closing tag to help avoid accidental output
*/
}
$formadded = false;
$moduletypes = qa_list_module_types();
foreach ($moduletypes as $type) {
    $modulenames = qa_list_modules($type);
    foreach ($modulenames as $name) {
        $module = qa_load_module($type, $name);
        if (method_exists($module, 'admin_form')) {
            $form = $module->admin_form($qa_content);
            if (!isset($form['title'])) {
                $form['title'] = qa_html($name);
            }
            $identifierhtml = qa_html(md5($type . '/' . $name));
            $form['title'] = '<A NAME="' . $identifierhtml . '">' . $form['title'] . '</A>';
            if (!isset($form['tags'])) {
                $form['tags'] = 'METHOD="POST" ACTION="' . qa_self_html() . '#' . $identifierhtml . '"';
            }
            if (!isset($form['style'])) {
                $form['style'] = 'tall';
            }
            $qa_content['form_' . $type . '_' . $name] = $form;
            $formadded = true;
        }
    }
}
if (!$formadded) {
    $qa_content['suggest_next'] = qa_lang_html('admin/no_plugin_options');
}
$qa_content['navigation']['sub'] = qa_admin_sub_navigation();
return $qa_content;
/*
            } else {
                $pageerror = qa_lang_html('main/general_error');
            }
            qa_report_event('u_message', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $toaccount['userid'], 'handle' => $toaccount['handle'], 'messageid' => $messageid, 'message' => $inmessage));
            if ($messagesent && qa_opt('show_message_history')) {
                // show message as part of general history
                qa_redirect(qa_request(), array('state' => 'message-sent'));
            }
        }
    }
}
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('misc/private_message_title');
$qa_content['error'] = @$pageerror;
$qa_content['form_message'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'tall', 'fields' => array('message' => array('type' => $messagesent ? 'static' : '', 'label' => qa_lang_html_sub('misc/message_for_x', qa_get_one_user_html($handle, false)), 'tags' => 'name="message" id="message"', 'value' => qa_html(@$inmessage, $messagesent), 'rows' => 8, 'note' => qa_lang_html_sub('misc/message_explanation', qa_html(qa_opt('site_title'))), 'error' => qa_html(@$errors['message']))), 'buttons' => array('send' => array('tags' => 'onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('main/send_button'))), 'hidden' => array('domessage' => '1', 'code' => qa_get_form_security_code('message-' . $handle)));
$qa_content['focusid'] = 'message';
if ($messagesent) {
    $qa_content['form_message']['ok'] = qa_lang_html('misc/message_sent');
    unset($qa_content['form_message']['buttons']);
    if (qa_opt('show_message_history')) {
        unset($qa_content['form_message']['fields']['message']);
    } else {
        unset($qa_content['form_message']['fields']['message']['note']);
        unset($qa_content['form_message']['fields']['message']['label']);
    }
}
//	If relevant, show recent message history
if (qa_opt('show_message_history')) {
    $recent = array_merge($torecent, $fromrecent);
    qa_sort_by($recent, 'created');