Commit fedbc59d by Scott Vivian

Trim trailing space in plugins/javascript

parent ec46ded0
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-content/qa-admin.js
Version: See define()s at top of qa-include/qa-base.php
Description: Javascript for admin pages to handle Ajax-triggered operations
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -38,20 +38,20 @@ function qa_recalc_click(state, elem, value, noteid)
{
if (elem.qa_recalc_running) {
elem.qa_recalc_stopped=true;
} else {
elem.qa_recalc_running=true;
elem.qa_recalc_stopped=false;
qa_recalc_running++;
document.getElementById(noteid).innerHTML='';
elem.qa_original_value=elem.value;
if (value)
elem.value=value;
qa_recalc_update(elem, state, noteid);
}
return false;
}
......@@ -63,16 +63,16 @@ function qa_recalc_update(elem, state, noteid)
if (lines[0]=='1') {
if (lines[2])
document.getElementById(noteid).innerHTML=lines[2];
if (elem.qa_recalc_stopped)
qa_recalc_cleanup(elem);
else
qa_recalc_update(elem, lines[1], noteid);
} else if (lines[0]=='0') {
document.getElementById(noteid).innerHTML=lines[2];
qa_recalc_cleanup(elem);
} else {
qa_ajax_error();
qa_recalc_cleanup(elem);
......@@ -98,11 +98,11 @@ function qa_mailing_start(noteid, pauseid)
if (lines[0]=='1') {
document.getElementById(noteid).innerHTML=lines[1];
window.setTimeout(function() { qa_mailing_start(noteid, pauseid); }, 1); // don't recurse
} else if (lines[0]=='0') {
document.getElementById(noteid).innerHTML=lines[1];
document.getElementById(pauseid).style.display='none';
} else {
qa_ajax_error();
}
......@@ -113,7 +113,7 @@ function qa_mailing_start(noteid, pauseid)
function qa_admin_click(target)
{
var p=target.name.split('_');
var params={entityid:p[1], action:p[2]};
params.code=target.form.elements.code.value;
......@@ -128,16 +128,16 @@ function qa_admin_click(target)
qa_ajax_error();
}
);
qa_show_waiting_after(target, false);
return false;
}
function qa_version_check(uri, versionkey, version, urikey, elem)
{
var params={uri:uri, versionkey:versionkey, version:version, urikey:urikey};
qa_ajax_post('version', params,
function (lines) {
if (lines[0]=='1')
......
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-content/qa-ask.js
Version: See define()s at top of qa-include/qa-base.php
Description: Javascript for ask page and question editing, including tag auto-completion
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -30,19 +30,19 @@ function qa_title_change(value)
qa_tags_examples=lines[1];
qa_tag_hints(true);
}
if (lines.length>2) {
var simelem=document.getElementById('similar');
if (simelem)
simelem.innerHTML=lines.slice(2).join('\n');
}
} else if (lines[0]=='0')
alert(lines[1]);
else
qa_ajax_error();
});
qa_show_waiting_after(document.getElementById('similar'), true);
}
......@@ -60,16 +60,16 @@ function qa_tag_click(link)
{
var elem=document.getElementById('tags');
var parts=qa_tag_typed_parts(elem);
// removes any HTML tags and ampersand
var tag=qa_html_unescape(link.innerHTML.replace(/<[^>]*>/g, ''));
var separator=qa_tag_onlycomma ? ', ' : ' ';
// replace if matches typed, otherwise append
var newvalue=(parts.typed && (tag.toLowerCase().indexOf(parts.typed.toLowerCase())>=0))
? (parts.before+separator+tag+separator+parts.after+separator) : (elem.value+separator+tag+separator);
// sanitize and set value
if (qa_tag_onlycomma)
elem.value=newvalue.replace(/[\s,]*,[\s,]*/g, ', ').replace(/^[\s,]+/g, '');
......@@ -78,7 +78,7 @@ function qa_tag_click(link)
elem.focus();
qa_tag_hints();
return false;
}
......@@ -87,21 +87,21 @@ function qa_tag_hints(skipcomplete)
var elem=document.getElementById('tags');
var html='';
var completed=false;
// first try to auto-complete
if (qa_tags_complete && !skipcomplete) {
var parts=qa_tag_typed_parts(elem);
if (parts.typed) {
html=qa_tags_to_html((qa_html_unescape(qa_tags_examples+','+qa_tags_complete)).split(','), parts.typed.toLowerCase());
completed=html ? true : false;
}
}
// otherwise show examples
if (qa_tags_examples && !completed)
html=qa_tags_to_html((qa_html_unescape(qa_tags_examples)).split(','), null);
// set title visiblity and hint list
document.getElementById('tag_examples_title').style.display=(html && !completed) ? '' : 'none';
document.getElementById('tag_complete_title').style.display=(html && completed) ? '' : 'none';
......@@ -113,14 +113,14 @@ function qa_tags_to_html(tags, matchlc)
var html='';
var added=0;
var tagseen={};
for (var i=0; i<tags.length; i++) {
var tag=tags[i];
var taglc=tag.toLowerCase();
if (!tagseen[taglc]) {
tagseen[taglc]=true;
if ( (!matchlc) || (taglc.indexOf(matchlc)>=0) ) { // match if necessary
if (matchlc) { // if matching, show appropriate part in bold
var matchstart=taglc.indexOf(matchlc);
......@@ -129,15 +129,15 @@ function qa_tags_to_html(tags, matchlc)
qa_html_escape(tag.substring(matchstart, matchend))+'</b>'+qa_html_escape(tag.substring(matchend))+'</span>';
} else // otherwise show as-is
inner=qa_html_escape(tag);
html+=qa_tag_template.replace(/\^/g, inner.replace('$', '$$$$'))+' '; // replace ^ in template, escape $s
if (++added>=qa_tags_max)
break;
}
}
}
return html;
}
......@@ -147,7 +147,7 @@ function qa_caret_from_end(elem)
elem.focus();
var sel=document.selection.createRange();
sel.moveStart('character', -elem.value.length);
return elem.value.length-sel.text.length;
} else if (typeof(elem.selectionEnd)!='undefined') // other browsers
......@@ -162,7 +162,7 @@ function qa_tag_typed_parts(elem)
var caret=elem.value.length-qa_caret_from_end(elem);
var active=elem.value.substring(0, caret);
var passive=elem.value.substring(active.length);
// if the caret is in the middle of a word, move the end of word from passive to active
if (
active.match(qa_tag_onlycomma ? /[^\s,][^,]*$/ : /[^\s,]$/) &&
......@@ -171,10 +171,10 @@ function qa_tag_typed_parts(elem)
active+=adjoinmatch[0];
passive=elem.value.substring(active.length);
}
// find what has been typed so far
var typedmatch=active.match(qa_tag_onlycomma ? /[^\s,]+[^,]*$/ : /[^\s,]+$/) || [''];
return {before:active.substring(0, active.length-typedmatch[0].length), after:passive, typed:typedmatch[0]};
}
......@@ -182,15 +182,15 @@ function qa_category_select(idprefix, startpath)
{
var startval=startpath ? startpath.split("/") : [];
var setdescnow=true;
for (var l=0; l<=qa_cat_maxdepth; l++) {
var elem=document.getElementById(idprefix+'_'+l);
if (elem) {
if (l) {
if (l<startval.length && startval[l].length) {
var val=startval[l];
for (var j=0; j<elem.options.length; j++)
if (elem.options[j].value==val)
elem.selectedIndex=j;
......@@ -198,67 +198,67 @@ function qa_category_select(idprefix, startpath)
var val=elem.options[elem.selectedIndex].value;
} else
val='';
if (elem.qa_last_sel!==val) {
elem.qa_last_sel=val;
var subelem=document.getElementById(idprefix+'_'+l+'_sub');
if (subelem)
subelem.parentNode.removeChild(subelem);
if (val.length || (l==0)) {
subelem=elem.parentNode.insertBefore(document.createElement('span'), elem.nextSibling);
subelem.id=idprefix+'_'+l+'_sub';
qa_show_waiting_after(subelem, true);
qa_ajax_post('category', {categoryid:val},
(function(elem, l) {
return function(lines) {
var subelem=document.getElementById(idprefix+'_'+l+'_sub');
if (subelem)
subelem.parentNode.removeChild(subelem);
if (lines[0]=='1') {
elem.qa_cat_desc=lines[1];
var addedoption=false;
if (lines.length>2) {
var subelem=elem.parentNode.insertBefore(document.createElement('span'), elem.nextSibling);
subelem.id=idprefix+'_'+l+'_sub';
subelem.innerHTML=' ';
var newelem=elem.cloneNode(false);
newelem.name=newelem.id=idprefix+'_'+(l+1);
newelem.options.length=0;
if (l ? qa_cat_allownosub : qa_cat_allownone)
newelem.options[0]=new Option(l ? '' : elem.options[0].text, '', true, true);
for (var i=2; i<lines.length; i++) {
var parts=lines[i].split('/');
if (String(qa_cat_exclude).length && (String(qa_cat_exclude)==parts[0]))
continue;
newelem.options[newelem.options.length]=new Option(parts.slice(1).join('/'), parts[0]);
addedoption=true;
}
if (addedoption) {
subelem.appendChild(newelem);
qa_category_select(idprefix, startpath);
}
if (l==0)
elem.style.display='none';
}
if (!addedoption)
set_category_description(idprefix);
} else if (lines[0]=='0')
alert(lines[1]);
else
......@@ -266,15 +266,15 @@ function qa_category_select(idprefix, startpath)
}
})(elem, l)
);
setdescnow=false;
}
break;
}
}
}
if (setdescnow)
set_category_description(idprefix);
}
......@@ -282,17 +282,17 @@ function qa_category_select(idprefix, startpath)
function set_category_description(idprefix)
{
var n=document.getElementById(idprefix+'_note');
if (n) {
desc='';
for (var l=1; l<=qa_cat_maxdepth; l++) {
var elem=document.getElementById(idprefix+'_'+l);
if (elem && elem.options[elem.selectedIndex].value.length)
desc=elem.qa_cat_desc;
}
n.innerHTML=desc;
}
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-content/qa-page.js
Version: See define()s at top of qa-include/qa-base.php
Description: Common Javascript including voting, notices and favorites
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -53,11 +53,11 @@ function qa_show_waiting_after(elem, inside)
{
if (elem && !elem.qa_waiting_shown) {
var w=document.getElementById('qa-waiting-template');
if (w) {
var c=w.cloneNode(true);
c.id=null;
if (inside)
elem.insertBefore(c, null);
else
......@@ -85,7 +85,7 @@ function qa_vote_click(elem)
var vote=parseInt(ens[2]);
var code=elem.form.elements.code.value;
var anchor=ens[3];
qa_ajax_post('vote', {postid:postid, vote:vote, code:code},
function(lines) {
if (lines[0]=='1') {
......@@ -93,7 +93,7 @@ function qa_vote_click(elem)
} else if (lines[0]=='0') {
var mess=document.getElementById('errorbox');
if (!mess) {
var mess=document.createElement('div');
mess.id='errorbox';
......@@ -101,16 +101,16 @@ function qa_vote_click(elem)
mess.innerHTML=lines[1];
mess.style.display='none';
}
var postelem=document.getElementById(anchor);
var e=postelem.parentNode.insertBefore(mess, postelem);
qa_reveal(e);
} else
qa_ajax_error();
}
);
return false;
}
......@@ -118,7 +118,7 @@ function qa_notice_click(elem)
{
var ens=elem.name.split('_');
var code=elem.form.elements.code.value;
qa_ajax_post('notice', {noticeid:ens[1], code:code},
function(lines) {
if (lines[0]=='1')
......@@ -129,7 +129,7 @@ function qa_notice_click(elem)
qa_ajax_error();
}
);
return false;
}
......@@ -137,7 +137,7 @@ function qa_favorite_click(elem)
{
var ens=elem.name.split('_');
var code=elem.form.elements.code.value;
qa_ajax_post('favorite', {entitytype:ens[1], entityid:ens[2], favorite:parseInt(ens[3]), code:code},
function (lines) {
if (lines[0]=='1')
......@@ -149,20 +149,20 @@ function qa_favorite_click(elem)
qa_ajax_error();
}
);
qa_show_waiting_after(elem, false);
return false;
}
function qa_ajax_post(operation, params, callback)
{
jQuery.extend(params, {qa:'ajax', qa_operation:operation, qa_root:qa_root, qa_request:qa_request});
jQuery.post(qa_root, params, function(response) {
var header='QA_AJAX_RESPONSE';
var headerpos=response.indexOf(header);
if (headerpos>=0)
callback(response.substr(headerpos+header.length).replace(/^\s+/, '').split("\n"));
else
......
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-content/qa-question.js
Version: See define()s at top of qa-include/qa-base.php
Description: Javascript to handle question page actions
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -27,10 +27,10 @@ var qa_element_revealed=null;
function qa_toggle_element(elem)
{
var e=elem ? document.getElementById(elem) : null;
if (e && e.qa_disabled)
e=null;
if (e && (qa_element_revealed==e)) {
qa_conceal(qa_element_revealed, 'form');
qa_element_revealed=null;
......@@ -38,22 +38,22 @@ function qa_toggle_element(elem)
} else {
if (qa_element_revealed)
qa_conceal(qa_element_revealed, 'form');
if (e) {
if (e.qa_load && !e.qa_loaded) {
e.qa_load();
e.qa_loaded=true;
}
if (e.qa_show)
e.qa_show();
qa_reveal(e, 'form', function() {
var t=$(e).offset().top;
var h=$(e).height()+16;
var wt=$(window).scrollTop();
var wh=$(window).height();
if ( (t<wt) || (t>(wt+wh)) )
qa_scroll_page_to(t);
else if ((t+h)>(wt+wh))
......@@ -63,60 +63,60 @@ function qa_toggle_element(elem)
e.qa_focus();
});
}
qa_element_revealed=e;
}
return !(e||!elem); // failed to find item
}
function qa_submit_answer(questionid, elem)
{
var params=qa_form_params('a_form');
params.a_questionid=questionid;
qa_ajax_post('answer', params,
function(lines) {
if (lines[0]=='1') {
if (lines[1]<1) {
var b=document.getElementById('q_doanswer');
if (b)
b.style.display='none';
}
var t=document.getElementById('a_list_title');
qa_set_inner_html(t, 'a_list_title', lines[2]);
qa_reveal(t, 'a_list_title');
var e=document.createElement('div');
e.innerHTML=lines.slice(3).join("\n");
var c=e.firstChild;
c.style.display='none';
var l=document.getElementById('a_list');
l.insertBefore(c, l.firstChild);
var a=document.getElementById('anew');
a.qa_disabled=true;
qa_reveal(c, 'answer');
qa_conceal(a, 'form');
} else if (lines[0]=='0') {
document.forms['a_form'].submit();
} else {
qa_ajax_error();
}
}
);
qa_show_waiting_after(elem, false);
return false;
}
......@@ -126,7 +126,7 @@ function qa_submit_comment(questionid, parentid, elem)
params.c_questionid=questionid;
params.c_parentid=parentid;
qa_ajax_post('comment', params,
function (lines) {
......@@ -134,42 +134,42 @@ function qa_submit_comment(questionid, parentid, elem)
var l=document.getElementById('c'+parentid+'_list');
l.innerHTML=lines.slice(2).join("\n");
l.style.display='';
var a=document.getElementById('c'+parentid);
a.qa_disabled=true;
var c=document.getElementById(lines[1]); // id of comment
if (c) {
c.style.display='none';
qa_reveal(c, 'comment');
}
qa_conceal(a, 'form');
} else if (lines[0]=='0') {
document.forms['c_form_'+parentid].submit();
} else {
qa_ajax_error();
}
}
);
qa_show_waiting_after(elem, false);
return false;
}
function qa_answer_click(answerid, questionid, target)
{
var params={};
params.answerid=answerid;
params.questionid=questionid;
params.code=target.form.elements.code.value;
params[target.name]=target.value;
qa_ajax_post('click_a', params,
function (lines) {
if (lines[0]=='1') {
......@@ -177,64 +177,64 @@ function qa_answer_click(answerid, questionid, target)
var l=document.getElementById('a'+answerid);
var h=lines.slice(2).join("\n");
if (h.length)
qa_set_outer_html(l, 'answer', h);
else
qa_conceal(l, 'answer');
} else {
target.form.elements.qa_click.value=target.name;
target.form.submit();
}
}
);
qa_show_waiting_after(target, false);
return false;
}
function qa_comment_click(commentid, questionid, parentid, target)
{
var params={};
params.commentid=commentid;
params.questionid=questionid;
params.parentid=parentid;
params.code=target.form.elements.code.value;
params[target.name]=target.value;
qa_ajax_post('click_c', params,
function (lines) {
if (lines[0]=='1') {
var l=document.getElementById('c'+commentid);
var h=lines.slice(1).join("\n");
if (h.length)
qa_set_outer_html(l, 'comment', h)
else
qa_conceal(l, 'comment');
} else {
target.form.elements.qa_click.value=target.name;
target.form.submit();
}
}
);
qa_show_waiting_after(target, false);
return false;
}
function qa_show_comments(questionid, parentid, elem)
{
var params={};
params.c_questionid=questionid;
params.c_parentid=parentid;
qa_ajax_post('show_cs', params,
function (lines) {
if (lines[0]=='1') {
......@@ -242,15 +242,15 @@ function qa_show_comments(questionid, parentid, elem)
l.innerHTML=lines.slice(1).join("\n");
l.style.display='none';
qa_reveal(l, 'comments');
} else {
qa_ajax_error();
}
}
);
qa_show_waiting_after(elem, true);
return false;
}
......@@ -258,15 +258,15 @@ function qa_form_params(formname)
{
var es=document.forms[formname].elements;
var params={};
for (var i=0; i<es.length; i++) {
var e=es[i];
var t=(e.type || '').toLowerCase();
if ( ((t!='checkbox') && (t!='radio')) || e.checked)
params[e.name]=e.value;
}
return params;
}
......
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-content/qa-user.js
Version: See define()s at top of qa-include/qa-base.php
Description: Javascript to handle user page actions
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,20 +25,20 @@
function qa_submit_wall_post(elem, morelink)
{
var params={};
params.message=document.forms.wallpost.message.value;
params.handle=document.forms.wallpost.handle.value;
params.start=document.forms.wallpost.start.value;
params.code=document.forms.wallpost.code.value;
params.morelink=morelink ? 1 : 0;
qa_ajax_post('wallpost', params,
function(lines) {
if (lines[0]=='1') {
var l=document.getElementById('wallmessages');
l.innerHTML=lines.slice(2).join("\n");
var c=document.getElementById(lines[1]); // id of new message
if (c) {
c.style.display='none';
......@@ -47,19 +47,19 @@ function qa_submit_wall_post(elem, morelink)
document.forms.wallpost.message.value='';
qa_hide_waiting(elem);
} else if (lines[0]=='0') {
document.forms.wallpost.qa_click.value=elem.name;
document.forms.wallpost.submit();
} else {
qa_ajax_error();
}
}
);
qa_show_waiting_after(elem, false);
return false;
}
......@@ -67,7 +67,7 @@ function qa_submit_wall_post(elem, morelink)
function qa_wall_post_click(messageid, target)
{
var params={};
params.messageid=messageid;
params.handle=document.forms.wallpost.handle.value;
params.code=document.forms.wallpost.code.value;
......@@ -79,20 +79,20 @@ function qa_wall_post_click(messageid, target)
if (lines[0]=='1') {
var l=document.getElementById('m'+messageid);
var h=lines.slice(1).join("\n");
if (h.length)
qa_set_outer_html(l, 'wallpost', h)
else
qa_conceal(l, 'wallpost');
} else {
document.forms.wallpost.qa_click.value=target.name;
document.forms.wallpost.submit();
}
}
);
qa_show_waiting_after(target, false);
return false;
}
\ No newline at end of file
<?php
/*
Question2Answer (c) Gideon Greenspan
http://www.question2answer.org/
File: qa-lang/en-GB/qa-lang-admin.php
Version: See define()s at top of qa-include/qa-base.php
Description: UK English translations - not much to do here
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -28,7 +28,7 @@
'admin_title' => 'Administration Centre',
'url_format_note' => 'Options with the ^ label are working for your site\'s configuration. For best search engine optimisation (SEO), use the first ^ option available.',
);
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/basic-adsense/qa-basic-adsense.php
Version: See define()s at top of qa-include/qa-base.php
Description: Widget module class for AdSense widget plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,17 +25,17 @@
*/
class qa_basic_adsense {
function allow_template($template)
{
return ($template!='admin');
}
function allow_region($region)
{
$allow=false;
switch ($region)
{
case 'main':
......@@ -44,24 +44,24 @@
$allow=true;
break;
}
return $allow;
}
function admin_form(&$qa_content)
{
$saved=false;
if (qa_clicked('adsense_save_button')) {
if (qa_clicked('adsense_save_button')) {
$trimchars="=;\"\' \t\r\n"; // prevent common errors by copying and pasting from Javascript
qa_opt('adsense_publisher_id', trim(qa_post_text('adsense_publisher_id_field'), $trimchars));
$saved=true;
}
return array(
'ok' => $saved ? 'AdSense settings saved' : null,
'fields' => array(
array(
'label' => 'AdSense Publisher ID:',
......@@ -70,7 +70,7 @@
'note' => 'Example: <i>pub-1234567890123456</i>',
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -84,24 +84,24 @@
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
$divstyle='';
switch ($region) {
case 'full': // Leaderboard
$divstyle='width:728px; margin:0 auto;';
case 'main': // Leaderboard
$width=728;
$height=90;
$format='728x90_as';
break;
case 'side': // Wide skyscraper
$width=160;
$height=600;
$format='160x600_as';
break;
}
?>
<div style="<?php echo $divstyle?>">
<script type="text/javascript">
......@@ -118,9 +118,9 @@ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</div>
<?php
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/basic-adsense/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates Adsense widget plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: Basic AdSense
Plugin URI:
Plugin URI:
Plugin Description: Provides a basic widget for displaying Google AdSense ads
Plugin Version: 1.0
Plugin Date: 2011-03-27
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.4
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -45,7 +45,7 @@
qa_register_plugin_module('widget', 'qa-basic-adsense.php', 'qa_basic_adsense', 'Basic AdSense');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/event-logger/qa-event-logger.php
Version: See define()s at top of qa-include/qa-base.php
Description: Event module class for event logger plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,12 +25,12 @@
*/
class qa_event_logger {
function init_queries($tableslc)
{
if (qa_opt('event_logger_to_database')) {
$tablename=qa_db_add_table_prefix('eventlog');
if (!in_array($tablename, $tableslc)) {
require_once QA_INCLUDE_DIR.'qa-app-users.php';
require_once QA_INCLUDE_DIR.'qa-db-maxima.php';
......@@ -52,14 +52,14 @@
}
}
function admin_form(&$qa_content)
{
// Process form input
$saved=false;
if (qa_clicked('event_logger_save_button')) {
qa_opt('event_logger_to_database', (int)qa_post_text('event_logger_to_database_field'));
qa_opt('event_logger_to_files', qa_post_text('event_logger_to_files_field'));
......@@ -68,14 +68,14 @@
$saved=true;
}
// Check the validity of the currently entered directory (if any)
$directory=qa_opt('event_logger_directory');
$note=null;
$error=null;
if (!strlen($directory))
$note='Please specify a directory that is writable by the web server.';
elseif (!file_exists($directory))
......@@ -84,17 +84,17 @@
$error='This is a file. Please enter the full path of a directory.';
elseif (!is_writable($directory))
$error='This directory is not writable by the web server. Please choose a different directory, use chown/chmod to change permissions, or contact your web hosting company for assistance.';
// Create the form for display
qa_set_display_rules($qa_content, array(
'event_logger_directory_display' => 'event_logger_to_files_field',
'event_logger_hide_header_display' => 'event_logger_to_files_field',
));
return array(
'ok' => ($saved && !isset($error)) ? 'Event log settings saved' : null,
'fields' => array(
array(
'label' => 'Log events to <code>'.QA_MYSQL_TABLE_PREFIX.'eventlog</code> database table',
......@@ -109,7 +109,7 @@
'value' => qa_opt('event_logger_to_files'),
'type' => 'checkbox',
),
array(
'id' => 'event_logger_directory_display',
'label' => 'Directory for log files - enter full path:',
......@@ -118,7 +118,7 @@
'note' => $note,
'error' => qa_html($error),
),
array(
'id' => 'event_logger_hide_header_display',
'label' => 'Include header lines at top of each log file',
......@@ -127,7 +127,7 @@
'value' => !qa_opt('event_logger_hide_header'),
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -137,7 +137,7 @@
);
}
function value_to_text($value)
{
if (is_array($value))
......@@ -146,45 +146,45 @@
$text=substr($value, 0, 38).'...';
else
$text=$value;
return strtr($text, "\t\n\r", ' ');
}
function process_event($event, $userid, $handle, $cookieid, $params)
{
if (qa_opt('event_logger_to_database')) {
$paramstring='';
foreach ($params as $key => $value)
$paramstring.=(strlen($paramstring) ? "\t" : '').$key.'='.$this->value_to_text($value);
qa_db_query_sub(
'INSERT INTO ^eventlog (datetime, ipaddress, userid, handle, cookieid, event, params) '.
'VALUES (NOW(), $, $, $, #, $, $)',
qa_remote_ip_address(), $userid, $handle, $cookieid, $event, $paramstring
);
);
}
if (qa_opt('event_logger_to_files')) {
// Substitute some placeholders if certain information is missing
if (!strlen($userid))
$userid='no_userid';
if (!strlen($handle))
$handle='no_handle';
if (!strlen($cookieid))
$cookieid='no_cookieid';
$ip=qa_remote_ip_address();
if (!strlen($ip))
$ip='no_ipaddress';
// Build the log file line to be written
$fixedfields=array(
'Date' => date('Y\-m\-d'),
'Time' => date('H\:i\:s'),
......@@ -194,36 +194,36 @@
'CookieID' => $cookieid,
'Event' => $event,
);
$fields=$fixedfields;
foreach ($params as $key => $value)
$fields['param_'.$key]=$key.'='.$this->value_to_text($value);
$string=implode("\t", $fields);
// Build the full path and file name
$directory=qa_opt('event_logger_directory');
if (substr($directory, -1)!='/')
$directory.='/';
$filename=$directory.'q2a-log-'.date('Y\-m\-d').'.txt';
// Open, lock, write, unlock, close (to prevent interference between multiple writes)
$exists=file_exists($filename);
$file=@fopen($filename, 'a');
if (is_resource($file)) {
if (flock($file, LOCK_EX)) {
if ( (!$exists) && (filesize($filename)===0) && !qa_opt('event_logger_hide_header') )
$string="Question2Answer ".QA_VERSION." log file generated by Event Logger plugin.\n".
"This file is formatted as tab-delimited text with UTF-8 encoding.\n\n".
implode("\t", array_keys($fixedfields))."\textras...\n\n".$string;
fwrite($file, $string."\n");
flock($file, LOCK_UN);
}
......@@ -232,9 +232,9 @@
}
}
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/event-logger/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates event logger plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: Event Logger
Plugin URI:
Plugin URI:
Plugin Description: Stores a record of user activity in the database and/or log files
Plugin Version: 1.1
Plugin Date: 2011-12-06
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.5
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -45,7 +45,7 @@
qa_register_plugin_module('event', 'qa-event-logger.php', 'qa_event_logger', 'Event Logger');
/*
Omit PHP closing tag to help avoid accidental output
......
<?php
/*
Question2Answer (c) Gideon Greenspan
http://www.question2answer.org/
File: qa-plugin/example-page/qa-example-lang-default.php
Version: See define()s at top of qa-include/qa-base.php
Description: US English language phrases for example plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -27,7 +27,7 @@
return array(
'page_title' => 'Example plugin page (US English)',
);
/*
Omit PHP closing tag to help avoid accidental output
......
<?php
/*
Question2Answer (c) Gideon Greenspan
http://www.question2answer.org/
File: qa-plugin/example-page/qa-example-lang-en-GB.php
Version: See define()s at top of qa-include/qa-base.php
Description: UK English language phrases for example plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -27,7 +27,7 @@
return array(
'page_title' => 'Example plugin page (UK English)',
);
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/example-page/qa-example-page.php
Version: See define()s at top of qa-include/qa-base.php
Description: Page module class for example page plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,10 +25,10 @@
*/
class qa_example_page {
var $directory;
var $urltoroot;
function load_module($directory, $urltoroot)
{
......@@ -36,9 +36,9 @@
$this->urltoroot=$urltoroot;
}
function suggest_requests() // for display in admin interface
{
{
return array(
array(
'title' => 'Example',
......@@ -48,7 +48,7 @@
);
}
function match_request($request)
{
if ($request=='example-plugin-page')
......@@ -57,7 +57,7 @@
return false;
}
function process_request($request)
{
$qa_content=qa_content_prepare();
......@@ -68,13 +68,13 @@
$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',
......@@ -82,9 +82,9 @@
'value' => qa_html($request),
'error' => qa_html('Another error'),
),
),
'buttons' => array(
'ok' => array(
'tags' => 'name="okthen"',
......@@ -92,19 +92,19 @@
'value' => '1',
),
),
'hidden' => array(
'hiddenfield' => '1',
),
);
$qa_content['custom_2']='<p><br>More <i>custom html</i></p>';
return $qa_content;
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/example-page/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates example page plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: Example Page
Plugin URI:
Plugin URI:
Plugin Description: Example of page plugin
Plugin Version: 1.1
Plugin Date: 2011-12-06
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.5
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -46,7 +46,7 @@
qa_register_plugin_module('page', 'qa-example-page.php', 'qa_example_page', 'Example Page');
qa_register_plugin_phrases('qa-example-lang-*.php', 'example_page');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -134,8 +134,8 @@ class Services_JSON
* bubble up with an error, so all return values
* from encode() should be checked with isError()
* - SERVICES_JSON_USE_TO_JSON: call toJSON when serializing objects
* It serializes the return value from the toJSON call rather
* than the object it'self, toJSON can return associative arrays,
* It serializes the return value from the toJSON call rather
* than the object it'self, toJSON can return associative arrays,
* strings or numbers, if you return an object, make sure it does
* not have a toJSON method, otherwise an error will occur.
*/
......@@ -150,7 +150,7 @@ class Services_JSON
var $_mb_strlen = false;
var $_mb_substr = false;
var $_mb_convert_encoding = false;
/**
* convert a string from one UTF-16 char to one UTF-8 char
*
......@@ -274,10 +274,10 @@ class Services_JSON
$ret = $this->_encode($var);
setlocale(LC_NUMERIC, $lc);
return $ret;
}
/**
* PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format
* PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format
*
* @param mixed $var any number, boolean, string, array, or object to be encoded.
* see argument 1 to Services_JSON() above for array-parsing behavior.
......@@ -287,9 +287,9 @@ class Services_JSON
* @return mixed JSON string representation of input var or an error if a problem occurs
* @access public
*/
function _encode($var)
function _encode($var)
{
switch (gettype($var)) {
case 'boolean':
return $var ? 'true' : 'false';
......@@ -354,7 +354,7 @@ class Services_JSON
$ascii .= '?';
break;
}
$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
$c += 1;
$utf16 = $this->utf82utf16($char);
......@@ -480,27 +480,27 @@ class Services_JSON
return '[' . join(',', $elements) . ']';
case 'object':
// support toJSON methods.
if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
// this may end up allowing unlimited recursion
// so we check the return value to make sure it's not got the same method.
$recode = $var->toJSON();
if (method_exists($recode, 'toJSON')) {
return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
? 'null'
: new Services_JSON_Error(class_name($var).
" toJSON returned an object with a toJSON method.");
}
return $this->_encode( $recode );
}
}
$vars = get_object_vars($var);
$properties = array_map(array($this, 'name_value'),
array_keys($vars),
array_values($vars));
......@@ -764,7 +764,7 @@ class Services_JSON
// element in an associative array,
// for now
$parts = array();
if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
// "name":value pair
$key = $this->decode($parts[1]);
......@@ -871,28 +871,28 @@ class Services_JSON
return false;
}
/**
* Calculates length of string in bytes
* @param string
* @param string
* @return integer length
*/
function strlen8( $str )
function strlen8( $str )
{
if ( $this->_mb_strlen ) {
return mb_strlen( $str, "8bit" );
}
return strlen( $str );
}
/**
* Returns part of a string, interpreting $start and $length as number of bytes.
* @param string
* @param integer start
* @param integer length
* @param string
* @param integer start
* @param integer length
* @return integer length
*/
function substr8( $string, $start, $length=false )
function substr8( $string, $start, $length=false )
{
if ( $length === false ) {
$length = $this->strlen8( $string ) - $start;
......@@ -929,5 +929,5 @@ if (class_exists('PEAR_Error')) {
}
}
}
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/facebook-login/qa-facebook-layer.php
Version: See define()s at top of qa-include/qa-base.php
Description: Theme layer class for mouseover layer plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,11 +25,11 @@
*/
class qa_html_theme_layer extends qa_html_theme_base {
function head_css()
{
qa_html_theme_base::head_css();
if (strlen(qa_opt('facebook_app_id')) && strlen(qa_opt('facebook_app_secret')))
$this->output(
'<style><!--',
......@@ -39,7 +39,7 @@
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/facebook-login/qa-facebook-login-page.php
Version: See define()s at top of qa-include/qa-base.php
Description: Page which performs Facebook login action
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,7 +25,7 @@
*/
class qa_facebook_login_page {
var $directory;
var $urltoroot;
......@@ -39,7 +39,7 @@
{
return ($request=='facebook-login');
}
function process_request($request)
{
if ($request=='facebook-login') {
......@@ -52,28 +52,28 @@
if (strlen($app_id) && strlen($app_secret)) {
if (!function_exists('json_decode')) { // work around fact that PHP might not have JSON extension installed
require_once $this->directory.'JSON.php';
function json_decode($json)
{
$decoder=new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
return $decoder->decode($json);
}
}
require_once $this->directory.'facebook.php';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true,
));
$fb_userid=$facebook->getUser();
if ($fb_userid) {
try {
$user=$facebook->api('/me?fields=email,name,verified,location,website,about,picture');
if (is_array($user))
qa_log_in_external_user('facebook', $fb_userid, array(
'email' => @$user['email'],
......@@ -93,13 +93,13 @@
qa_redirect_raw($facebook->getLoginUrl(array('redirect_uri' => $tourl)));
}
}
qa_redirect_raw($tourl);
}
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/facebook-login/qa-facebook-login.php
Version: See define()s at top of qa-include/qa-base.php
Description: Login module class for Facebook login plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,34 +25,34 @@
*/
class qa_facebook_login {
function match_source($source)
{
return $source=='facebook';
}
function login_html($tourl, $context)
{
$app_id=qa_opt('facebook_app_id');
if (!strlen($app_id))
return;
$this->facebook_html(qa_path_absolute('facebook-login', array('to' => $tourl)), false, $context);
}
function logout_html($tourl)
{
$app_id=qa_opt('facebook_app_id');
if (!strlen($app_id))
return;
$this->facebook_html($tourl, true, 'menu');
}
function facebook_html($tourl, $logout, $context)
{
......@@ -67,7 +67,7 @@
window.fbAsyncInit = function() {
FB.init({
appId : <?php echo qa_js(qa_opt('facebook_app_id'), true)?>,
status : true,
status : true,
cookie : true,
xfbml : true,
oauth : true
......@@ -88,25 +88,25 @@
</div>
<?php
}
function admin_form()
{
$saved=false;
if (qa_clicked('facebook_save_button')) {
qa_opt('facebook_app_id', qa_post_text('facebook_app_id_field'));
qa_opt('facebook_app_secret', qa_post_text('facebook_app_secret_field'));
$saved=true;
}
$ready=strlen(qa_opt('facebook_app_id')) && strlen(qa_opt('facebook_app_secret'));
return array(
'ok' => $saved ? 'Facebook application details saved' : null,
'fields' => array(
array(
'label' => 'Facebook App ID:',
......@@ -121,7 +121,7 @@
'error' => $ready ? null : 'To use Facebook Login, please <a href="http://developers.facebook.com/setup/" target="_blank">set up a Facebook application</a>.',
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -130,9 +130,9 @@
),
);
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/facebook-login/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates Facebook login plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: Facebook Login
Plugin URI:
Plugin URI:
Plugin Description: Allows users to log in via Facebook
Plugin Version: 1.1.5
Plugin Date: 2012-09-13
......@@ -50,7 +50,7 @@
qa_register_plugin_module('page', 'qa-facebook-login-page.php', 'qa_facebook_login_page', 'Facebook Login Page');
qa_register_plugin_layer('qa-facebook-layer.php', 'Facebook Login Layer');
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/mouseover-layer/qa-mouseover-admin-form.php
Version: See define()s at top of qa-include/qa-base.php
Description: Generic module class for mouseover layer plugin to provide admin form and default option
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,31 +25,31 @@
*/
class qa_mouseover_admin_form {
function option_default($option)
{
if ($option=='mouseover_content_max_len')
return 480;
}
function admin_form(&$qa_content)
{
$saved=false;
if (qa_clicked('mouseover_save_button')) {
qa_opt('mouseover_content_on', (int)qa_post_text('mouseover_content_on_field'));
qa_opt('mouseover_content_max_len', (int)qa_post_text('mouseover_content_max_len_field'));
$saved=true;
}
qa_set_display_rules($qa_content, array(
'mouseover_content_max_len_display' => 'mouseover_content_on_field',
));
return array(
'ok' => $saved ? 'Mouseover settings saved' : null,
'fields' => array(
array(
'label' => 'Show content preview on mouseover in question lists',
......@@ -57,7 +57,7 @@
'value' => qa_opt('mouseover_content_on'),
'tags' => 'name="mouseover_content_on_field" id="mouseover_content_on_field"',
),
array(
'id' => 'mouseover_content_max_len_display',
'label' => 'Maximum length of preview:',
......@@ -67,7 +67,7 @@
'tags' => 'name="mouseover_content_max_len_field"',
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -76,9 +76,9 @@
),
);
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/mouseover-layer/qa-mouseover-layer.php
Version: See define()s at top of qa-include/qa-base.php
Description: Theme layer class for mouseover layer plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,35 +25,35 @@
*/
class qa_html_theme_layer extends qa_html_theme_base {
function q_list($q_list)
{
if (count(@$q_list['qs']) && qa_opt('mouseover_content_on')) { // first check it is not an empty list and the feature is turned on
// Collect the question ids of all items in the question list (so we can do this in one DB query)
$postids=array();
foreach ($q_list['qs'] as $question)
if (isset($question['raw']['postid']))
$postids[]=$question['raw']['postid'];
if (count($postids)) {
// Retrieve the content for these questions from the database and put into an array
$result=qa_db_query_sub('SELECT postid, content, format FROM ^posts WHERE postid IN (#)', $postids);
$postinfo=qa_db_read_all_assoc($result, 'postid');
// Get the regular expression fragment to use for blocked words and the maximum length of content to show
$blockwordspreg=qa_get_block_words_preg();
$maxlength=qa_opt('mouseover_content_max_len');
// Now add the popup to the title for each question
foreach ($q_list['qs'] as $index => $question) {
$thispost=@$postinfo[$question['raw']['postid']];
if (isset($thispost)) {
$text=qa_viewer_text($thispost['content'], $thispost['format'], array('blockwordspreg' => $blockwordspreg));
$text=qa_shorten_string_line($text, $maxlength);
......@@ -62,12 +62,12 @@
}
}
}
qa_html_theme_base::q_list($q_list); // call back through to the default function
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/mouseover-layer/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates mouseover layer plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: Mouseover Layer
Plugin URI:
Plugin URI:
Plugin Description: Shows question content on mouse over in question lists
Plugin Version: 1.0.1
Plugin Date: 2011-12-06
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.5
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -46,7 +46,7 @@
qa_register_plugin_layer('qa-mouseover-layer.php', 'Mouseover Layer');
qa_register_plugin_module('module', 'qa-mouseover-admin-form.php', 'qa_mouseover_admin_form', 'Mouseover Layer');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/opensearch-support/qa-opensearch-layer.php
Version: See define()s at top of qa-include/qa-base.php
Description: Theme layer class for OpenSearch plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,16 +25,16 @@
*/
class qa_html_theme_layer extends qa_html_theme_base {
function head_links()
{
qa_html_theme_base::head_links();
$this->output('<link rel="search" type="application/opensearchdescription+xml" title="'.qa_html(qa_opt('site_title')).'" href="'.qa_path_html('opensearch.xml').'"/>');
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/opensearch-support/qa-opensearch-page.php
Version: See define()s at top of qa-include/qa-base.php
Description: Page module class for XML sitemap plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,7 +25,7 @@
*/
class qa_opensearch_xml {
function match_request($request)
{
return ($request=='opensearch.xml');
......@@ -39,22 +39,22 @@
$template=str_replace('_searchTerms_placeholder_', '{searchTerms}', qa_path_absolute('search', array('q' => '_searchTerms_placeholder_')));
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
echo '<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">'."\n";
echo "\t<ShortName>".$titlexml."</ShortName>\n";
echo "\t<Description>".qa_xml(qa_lang('main/search_button')).' '.$titlexml."</Description>\n";
echo "\t".'<Url type="text/html" method="get" template="'.qa_xml($template).'"/>'."\n";
echo "\t<InputEncoding>UTF-8</InputEncoding>\n";
echo '</OpenSearchDescription>'."\n";
return null;
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/opensearch-support/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates OpenSearch plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: OpenSearch Support
Plugin URI:
Plugin URI:
Plugin Description: Allows OpenSearch clients to search Q2A site directly
Plugin Version: 1.0
Plugin Date: 2012-08-21
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.5
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -43,10 +43,10 @@
exit;
}
qa_register_plugin_layer('qa-opensearch-layer.php', 'OpenSearch Layer');
qa_register_plugin_module('page', 'qa-opensearch-page.php', 'qa_opensearch_xml', 'OpenSearch XML');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/recaptcha-captcha/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates reCAPTCHA plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: reCAPTCHA
Plugin URI:
Plugin URI:
Plugin Description: Provides support for reCAPTCHA captchas
Plugin Version: 1.0
Plugin Date: 2011-11-17
......@@ -45,7 +45,7 @@
qa_register_plugin_module('captcha', 'qa-recaptcha-captcha.php', 'qa_recaptcha_captcha', 'reCAPTCHA');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/recaptcha-captcha/qa-recaptcha-captcha.php
Version: See define()s at top of qa-include/qa-base.php
Description: Captcha module for reCAPTCHA
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -31,9 +31,9 @@
class qa_recaptcha_captcha {
var $directory;
function load_module($directory, $urltoroot)
{
$this->directory=$directory;
......@@ -43,17 +43,17 @@
function admin_form()
{
$saved=false;
if (qa_clicked('recaptcha_save_button')) {
qa_opt('recaptcha_public_key', qa_post_text('recaptcha_public_key_field'));
qa_opt('recaptcha_private_key', qa_post_text('recaptcha_private_key_field'));
$saved=true;
}
$form=array(
'ok' => $saved ? 'reCAPTCHA settings saved' : null,
'fields' => array(
'public' => array(
'label' => 'reCAPTCHA public key:',
......@@ -76,49 +76,49 @@
),
),
);
return $form;
}
function recaptcha_error_html()
{
if (!function_exists('fsockopen'))
return 'To use reCAPTCHA, the fsockopen() PHP function must be enabled on your server. Please check with your system administrator.';
elseif ( (!strlen(trim(qa_opt('recaptcha_public_key')))) || (!strlen(trim(qa_opt('recaptcha_private_key')))) ) {
require_once $this->directory.'recaptchalib.php';
$url=recaptcha_get_signup_url(@$_SERVER['HTTP_HOST'], qa_opt('site_title'));
return 'To use reCAPTCHA, you must <a href="'.qa_html($url).'">sign up</a> to get these keys.';
}
return null;
return null;
}
function allow_captcha()
{
return function_exists('fsockopen') && strlen(trim(qa_opt('recaptcha_public_key'))) && strlen(trim(qa_opt('recaptcha_private_key')));
}
function form_html(&$qa_content, $error)
{
require_once $this->directory.'recaptchalib.php';
$language=qa_opt('site_language');
if (strpos('|en|nl|fr|de|pt|ru|es|tr|', '|'.$language.'|')===false) // supported as of 3/2010
$language='en';
$qa_content['script_lines'][]=array(
"var RecaptchaOptions={",
"\ttheme:'white',",
"\tlang:".qa_js($language),
"};",
);
return recaptcha_get_html(qa_opt('recaptcha_public_key'), $error, qa_is_https_probably());
}
......@@ -127,25 +127,25 @@
{
if ( (!empty($_POST['recaptcha_challenge_field'])) && (!empty($_POST['recaptcha_response_field'])) ) {
require_once $this->directory.'recaptchalib.php';
$answer=recaptcha_check_answer(
qa_opt('recaptcha_private_key'),
qa_remote_ip_address(),
$_POST['recaptcha_challenge_field'],
$_POST['recaptcha_response_field']
);
if ($answer->is_valid)
return true;
$error=@$answer->error;
}
return false;
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -108,7 +108,7 @@ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
if ($pubkey == null || $pubkey == '') {
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
}
if ($use_ssl) {
$server = RECAPTCHA_API_SECURE_SERVER;
} else {
......@@ -159,8 +159,8 @@ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $ex
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
}
//discard spam submissions
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
$recaptcha_response = new ReCaptchaResponse();
......@@ -215,7 +215,7 @@ function _recaptcha_aes_encrypt($val,$ky) {
if (! function_exists ("mcrypt_encrypt")) {
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
}
$mode=MCRYPT_MODE_CBC;
$mode=MCRYPT_MODE_CBC;
$enc=MCRYPT_RIJNDAEL_128;
$val=_recaptcha_aes_pad($val);
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
......@@ -232,11 +232,11 @@ function recaptcha_mailhide_url($pubkey, $privkey, $email) {
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
}
$ky = pack('H*', $privkey);
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
}
......@@ -267,7 +267,7 @@ function _recaptcha_mailhide_email_parts ($email) {
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
$emailparts = _recaptcha_mailhide_email_parts ($email);
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/tag-cloud-widget/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates tag cloud widget plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: Tag Cloud Widget
Plugin URI:
Plugin URI:
Plugin Description: Provides a list of tags with size indicating popularity
Plugin Version: 1.0.1
Plugin Date: 2011-12-06
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.4
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -45,7 +45,7 @@
qa_register_plugin_module('widget', 'qa-tag-cloud.php', 'qa_tag_cloud', 'Tag Cloud');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/tag-cloud-widget/qa-tag-cloud.php
Version: See define()s at top of qa-include/qa-base.php
Description: Widget module class for tag cloud plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,7 +25,7 @@
*/
class qa_tag_cloud {
function option_default($option)
{
if ($option=='tag_cloud_count_tags')
......@@ -36,21 +36,21 @@
return true;
}
function admin_form()
{
$saved=false;
if (qa_clicked('tag_cloud_save_button')) {
qa_opt('tag_cloud_count_tags', (int)qa_post_text('tag_cloud_count_tags_field'));
qa_opt('tag_cloud_font_size', (int)qa_post_text('tag_cloud_font_size_field'));
qa_opt('tag_cloud_size_popular', (int)qa_post_text('tag_cloud_size_popular_field'));
$saved=true;
}
return array(
'ok' => $saved ? 'Tag cloud settings saved' : null,
'fields' => array(
array(
'label' => 'Maximum tags to show:',
......@@ -67,7 +67,7 @@
'value' => (int)qa_opt('tag_cloud_font_size'),
'tags' => 'name="tag_cloud_font_size_field"',
),
array(
'label' => 'Font size represents tag popularity',
'type' => 'checkbox',
......@@ -75,7 +75,7 @@
'tags' => 'name="tag_cloud_size_popular_field"',
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -85,11 +85,11 @@
);
}
function allow_template($template)
{
$allow=false;
switch ($template)
{
case 'activity':
......@@ -110,53 +110,53 @@
$allow=true;
break;
}
return $allow;
}
function allow_region($region)
{
return ($region=='side');
}
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR.'qa-db-selects.php';
$populartags=qa_db_single_select(qa_db_popular_tags_selectspec(0, (int)qa_opt('tag_cloud_count_tags')));
reset($populartags);
$maxcount=current($populartags);
$themeobject->output(
'<h2 style="margin-top:0; padding-top:0;">',
qa_lang_html('main/popular_tags'),
'</h2>'
);
$themeobject->output('<div style="font-size:10px;">');
$maxsize=qa_opt('tag_cloud_font_size');
$scale=qa_opt('tag_cloud_size_popular');
$blockwordspreg=qa_get_block_words_preg();
foreach ($populartags as $tag => $count) {
if (count(qa_block_words_match_all($tag, $blockwordspreg)))
continue; // skip censored tags
$size=number_format(($scale ? ($maxsize*$count/$maxcount) : $maxsize), 1);
if (($size>=5) || !$scale)
$themeobject->output('<a href="'.qa_path_html('tag/'.$tag).'" style="font-size:'.$size.'px; vertical-align:baseline;">'.qa_html($tag).'</a>');
}
$themeobject->output('</div>');
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/wysiwyg-editor/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates WYSIWYG editor plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: WYSIWYG Editor
Plugin URI:
Plugin URI:
Plugin Description: Wrapper for CKEditor WYSIWYG rich text editor
Plugin Version: 1.1.1
Plugin Date: 2011-12-06
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.3
Plugin Update Check URI:
Plugin Update Check URI:
*/
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/wysiwyg-editor/qa-wysiwyg-editor.php
Version: See define()s at top of qa-include/qa-base.php
Description: Editor module class for WYSIWYG editor plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,44 +26,44 @@
class qa_wysiwyg_editor {
var $urltoroot;
function load_module($directory, $urltoroot)
{
$this->urltoroot=$urltoroot;
}
function option_default($option)
{
if ($option=='wysiwyg_editor_upload_max_size') {
require_once QA_INCLUDE_DIR.'qa-app-upload.php';
return min(qa_get_max_upload_size(), 1048576);
}
}
function bytes_to_mega_html($bytes)
{
return qa_html(number_format($bytes/1048576, 1));
}
function admin_form(&$qa_content)
{
require_once QA_INCLUDE_DIR.'qa-app-upload.php';
$saved=false;
if (qa_clicked('wysiwyg_editor_save_button')) {
qa_opt('wysiwyg_editor_upload_images', (int)qa_post_text('wysiwyg_editor_upload_images_field'));
qa_opt('wysiwyg_editor_upload_all', (int)qa_post_text('wysiwyg_editor_upload_all_field'));
qa_opt('wysiwyg_editor_upload_max_size', min(qa_get_max_upload_size(), 1048576*(float)qa_post_text('wysiwyg_editor_upload_max_size_field')));
$saved=true;
}
qa_set_display_rules($qa_content, array(
'wysiwyg_editor_upload_all_display' => 'wysiwyg_editor_upload_images_field',
'wysiwyg_editor_upload_max_size_display' => 'wysiwyg_editor_upload_images_field',
......@@ -71,7 +71,7 @@
return array(
'ok' => $saved ? 'WYSIWYG editor settings saved' : null,
'fields' => array(
array(
'label' => 'Allow images to be uploaded',
......@@ -87,7 +87,7 @@
'value' => (int)qa_opt('wysiwyg_editor_upload_all'),
'tags' => 'name="wysiwyg_editor_upload_all_field"',
),
array(
'id' => 'wysiwyg_editor_upload_max_size_display',
'label' => 'Maximum size of uploads:',
......@@ -97,7 +97,7 @@
'tags' => 'name="wysiwyg_editor_upload_max_size_field"',
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -106,8 +106,8 @@
),
);
}
function calc_quality($content, $format)
{
if ($format=='html')
......@@ -118,21 +118,21 @@
return 0;
}
function get_field(&$qa_content, $content, $format, $fieldname, $rows /* $autofocus parameter deprecated */)
{
$scriptsrc=$this->urltoroot.'ckeditor.js?'.QA_VERSION;
$scriptsrc=$this->urltoroot.'ckeditor.js?'.QA_VERSION;
$alreadyadded=false;
if (isset($qa_content['script_src']))
foreach ($qa_content['script_src'] as $testscriptsrc)
if ($testscriptsrc==$scriptsrc)
$alreadyadded=true;
if (!$alreadyadded) {
$uploadimages=qa_opt('wysiwyg_editor_upload_images');
$uploadall=$uploadimages && qa_opt('wysiwyg_editor_upload_all');
$qa_content['script_src'][]=$scriptsrc;
$qa_content['script_lines'][]=array(
"qa_wysiwyg_editor_config={toolbar:[".
......@@ -157,8 +157,8 @@
($uploadall ? (", filebrowserUploadUrl:".qa_js(qa_path('wysiwyg-editor-upload'))) : "").
"};"
);
}
}
if ($format=='html') {
$html=$content;
$text=$this->html_to_text($content);
......@@ -166,7 +166,7 @@
$text=$content;
$html=qa_html($content, true);
}
return array(
'tags' => 'name="'.$fieldname.'"',
'value' => qa_html($text),
......@@ -174,39 +174,39 @@
'html_prefix' => '<input name="'.$fieldname.'_ckeditor_ok" id="'.$fieldname.'_ckeditor_ok" type="hidden" value="0"><input name="'.$fieldname.'_ckeditor_data" id="'.$fieldname.'_ckeditor_data" type="hidden" value="'.qa_html($html).'">',
);
}
function load_script($fieldname)
{
return "if (qa_ckeditor_".$fieldname."=CKEDITOR.replace(".qa_js($fieldname).", window.qa_wysiwyg_editor_config)) { qa_ckeditor_".$fieldname.".setData(document.getElementById(".qa_js($fieldname.'_ckeditor_data').").value); document.getElementById(".qa_js($fieldname.'_ckeditor_ok').").value=1; }";
}
function focus_script($fieldname)
{
return "if (qa_ckeditor_".$fieldname.") qa_ckeditor_".$fieldname.".focus();";
}
function update_script($fieldname)
{
return "if (qa_ckeditor_".$fieldname.") qa_ckeditor_".$fieldname.".updateElement();";
}
function read_post($fieldname)
{
if (qa_post_text($fieldname.'_ckeditor_ok')) { // CKEditor was loaded successfully
$html=qa_post_text($fieldname);
$htmlformatting=preg_replace('/<\s*\/?\s*(br|p)\s*\/?\s*>/i', '', $html); // remove <p>, <br>, etc... since those are OK in text
if (preg_match('/<.+>/', $htmlformatting)) // if still some other tags, it's worth keeping in HTML
return array(
'format' => 'html',
'content' => qa_sanitize_html($html, false, true), // qa_sanitize_html() is ESSENTIAL for security
);
else { // convert to text
$viewer=qa_load_module('viewer', '');
......@@ -222,16 +222,16 @@
'content' => qa_post_text($fieldname),
);
}
function html_to_text($html)
{
$viewer=qa_load_module('viewer', '');
return $viewer->get_text($html, 'html', array());
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/wysiwyg-editor/qa-wysiwyg-upload.php
Version: See define()s at top of qa-include/qa-base.php
Description: Page module class for WYSIWYG editor (CKEditor) file upload receiver
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,41 +26,41 @@
class qa_wysiwyg_upload {
function match_request($request)
{
return ($request=='wysiwyg-editor-upload');
}
function process_request($request)
{
$message='';
$url='';
if (is_array($_FILES) && count($_FILES)) {
if (!qa_opt('wysiwyg_editor_upload_images'))
$message=qa_lang('users/no_permission');
require_once QA_INCLUDE_DIR.'qa-app-upload.php';
$upload=qa_upload_file_one(
qa_opt('wysiwyg_editor_upload_max_size'),
qa_get('qa_only_image') || !qa_opt('wysiwyg_editor_upload_all'),
qa_get('qa_only_image') ? 600 : null, // max width if it's an image upload
null // no max height
);
$message=@$upload['error'];
$url=@$upload['bloburl'];
}
echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(".qa_js(qa_get('CKEditorFuncNum')).
", ".qa_js($url).", ".qa_js($message).");</script>";
return null;
}
}
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/xml-sitemap/qa-plugin.php
Version: See define()s at top of qa-include/qa-base.php
Description: Initiates XML sitemap plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -26,7 +26,7 @@
/*
Plugin Name: XML Sitemap
Plugin URI:
Plugin URI:
Plugin Description: Generates sitemap.xml file for submission to search engines
Plugin Version: 1.1.1
Plugin Date: 2011-12-06
......@@ -34,7 +34,7 @@
Plugin Author URI: http://www.question2answer.org/
Plugin License: GPLv2
Plugin Minimum Question2Answer Version: 1.5
Plugin Update Check URI:
Plugin Update Check URI:
*/
......@@ -45,7 +45,7 @@
qa_register_plugin_module('page', 'qa-xml-sitemap.php', 'qa_xml_sitemap', 'XML Sitemap');
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-plugin/xml-sitemap/qa-xml-sitemap.php
Version: See define()s at top of qa-include/qa-base.php
Description: Page module class for XML sitemap plugin
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -25,17 +25,17 @@
*/
class qa_xml_sitemap {
var $directory;
var $urltoroot;
function load_module($directory, $urltoroot)
{
$this->directory=$directory;
$this->urltoroot=$urltoroot;
}
function option_default($option)
{
switch ($option) {
......@@ -48,31 +48,31 @@
break;
}
}
function admin_form()
{
require_once QA_INCLUDE_DIR.'qa-util-sort.php';
$saved=false;
if (qa_clicked('xml_sitemap_save_button')) {
qa_opt('xml_sitemap_show_questions', (int)qa_post_text('xml_sitemap_show_questions_field'));
if (!QA_FINAL_EXTERNAL_USERS)
qa_opt('xml_sitemap_show_users', (int)qa_post_text('xml_sitemap_show_users_field'));
if (qa_using_tags())
qa_opt('xml_sitemap_show_tag_qs', (int)qa_post_text('xml_sitemap_show_tag_qs_field'));
if (qa_using_categories()) {
qa_opt('xml_sitemap_show_category_qs', (int)qa_post_text('xml_sitemap_show_category_qs_field'));
qa_opt('xml_sitemap_show_categories', (int)qa_post_text('xml_sitemap_show_categories_field'));
}
$saved=true;
}
$form=array(
'ok' => $saved ? 'XML sitemap settings saved' : null,
......@@ -84,7 +84,7 @@
'tags' => 'name="xml_sitemap_show_questions_field"',
),
),
'buttons' => array(
array(
'label' => 'Save Changes',
......@@ -92,7 +92,7 @@
),
),
);
if (!QA_FINAL_EXTERNAL_USERS)
$form['fields']['users']=array(
'label' => 'Include user pages',
......@@ -100,7 +100,7 @@
'value' => (int)qa_opt('xml_sitemap_show_users'),
'tags' => 'name="xml_sitemap_show_users_field"',
);
if (qa_using_tags())
$form['fields']['tagqs']=array(
'label' => 'Include question list for each tag',
......@@ -128,9 +128,9 @@
return $form;
}
function suggest_requests()
{
{
return array(
array(
'title' => 'XML Sitemap',
......@@ -140,43 +140,43 @@
);
}
function match_request($request)
{
return ($request=='sitemap.xml');
}
function process_request($request)
{
@ini_set('display_errors', 0); // we don't want to show PHP errors inside XML
$siteurl=qa_opt('site_url');
header('Content-type: text/xml; charset=utf-8');
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n";
// Question pages
if (qa_opt('xml_sitemap_show_questions')) {
$hotstats=qa_db_read_one_assoc(qa_db_query_sub(
"SELECT MIN(hotness) AS base, MAX(hotness)-MIN(hotness) AS spread FROM ^posts WHERE type='Q'"
));
$nextpostid=0;
while (1) {
$questions=qa_db_read_all_assoc(qa_db_query_sub(
"SELECT postid, title, hotness FROM ^posts WHERE postid>=# AND type='Q' ORDER BY postid LIMIT 100",
$nextpostid
));
if (!count($questions))
break;
foreach ($questions as $question) {
$this->sitemap_output(qa_q_request($question['postid'], $question['title']),
0.1+0.9*($question['hotness']-$hotstats['base'])/(1+$hotstats['spread']));
......@@ -184,106 +184,106 @@
}
}
}
// User pages
if ((!QA_FINAL_EXTERNAL_USERS) && qa_opt('xml_sitemap_show_users')) {
$nextuserid=0;
while (1) {
$users=qa_db_read_all_assoc(qa_db_query_sub(
"SELECT userid, handle FROM ^users WHERE userid>=# ORDER BY userid LIMIT 100",
$nextuserid
));
if (!count($users))
break;
foreach ($users as $user) {
$this->sitemap_output('user/'.$user['handle'], 0.25);
$nextuserid=max($nextuserid, $user['userid']+1);
}
}
}
// Tag pages
if (qa_using_tags() && qa_opt('xml_sitemap_show_tag_qs')) {
$nextwordid=0;
while (1) {
$tagwords=qa_db_read_all_assoc(qa_db_query_sub(
"SELECT wordid, word, tagcount FROM ^words WHERE wordid>=# AND tagcount>0 ORDER BY wordid LIMIT 100",
$nextwordid
));
if (!count($tagwords))
break;
foreach ($tagwords as $tagword) {
$this->sitemap_output('tag/'.$tagword['word'], 0.5/(1+(1/$tagword['tagcount']))); // priority between 0.25 and 0.5 depending on tag frequency
$nextwordid=max($nextwordid, $tagword['wordid']+1);
}
}
}
}
// Question list for each category
if (qa_using_categories() && qa_opt('xml_sitemap_show_category_qs')) {
$nextcategoryid=0;
while (1) {
$categories=qa_db_read_all_assoc(qa_db_query_sub(
"SELECT categoryid, backpath FROM ^categories WHERE categoryid>=# AND qcount>0 ORDER BY categoryid LIMIT 2",
$nextcategoryid
));
if (!count($categories))
break;
foreach ($categories as $category) {
$this->sitemap_output('questions/'.implode('/', array_reverse(explode('/', $category['backpath']))), 0.5);
$nextcategoryid=max($nextcategoryid, $category['categoryid']+1);
}
}
}
// Pages in category browser
if (qa_using_categories() && qa_opt('xml_sitemap_show_categories')) {
$this->sitemap_output('categories', 0.5);
$nextcategoryid=0;
while (1) { // only find categories with a child
$categories=qa_db_read_all_assoc(qa_db_query_sub(
"SELECT parent.categoryid, parent.backpath FROM ^categories AS parent ".
"JOIN ^categories AS child ON child.parentid=parent.categoryid WHERE parent.categoryid>=# GROUP BY parent.categoryid LIMIT 100",
$nextcategoryid
));
if (!count($categories))
break;
foreach ($categories as $category) {
$this->sitemap_output('categories/'.implode('/', array_reverse(explode('/', $category['backpath']))), 0.5);
$nextcategoryid=max($nextcategoryid, $category['categoryid']+1);
}
}
}
// Finish up...
echo "</urlset>\n";
return null;
}
function sitemap_output($request, $priority)
{
......@@ -292,9 +292,9 @@
"\t\t<priority>".max(0, min(1.0, $priority))."</priority>\n".
"\t</url>\n";
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-theme/Candy/qa-styles.css
Version: See define()s at top of qa-include/qa-base.php
Description: CSS file for included Candy theme
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -23,13 +23,13 @@
*/
/*
Theme URI:
Theme URI:
Theme Version: 1.5
Theme Date: 2012-09-11
Theme Author: Question2Answer
Theme Author URI: http://www.question2answer.org/
Theme License: GPLv2
Theme Update Check URI:
Theme Update Check URI:
*/
......@@ -267,7 +267,7 @@ h2 {font-size:22px; color:#c659ab; padding-top:12px; clear:both;}
.qa-vote-down-button {background-position:-27px 0; color:#f1c96b;}
.qa-vote-down-disabled {background-position:-27px -116px; color:#CCC;}
.qa-vote-down-button:hover {background-position:-27px -29px; color:#f1c96b;}
.qa-voted-up-button {background:url(vote-buttons.png); border:0; color:#f1c96b; font-size:1px; height:29px; width:27px;}
.qa-voted-up-button {background-position:0 -87px; color:#f1c96b;}
.qa-voted-up-button:hover {background-position:0 -29px; color:#f1c96b;}
......
......@@ -5,7 +5,7 @@
http://www.question2answer.org/
File: qa-theme/Candy/qa-theme.php
Version: See define()s at top of qa-include/qa-base.php
Description: Override something in base theme class for Candy theme
......@@ -15,7 +15,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -32,7 +32,7 @@
$this->nav('user');
}
}
/*
Omit PHP closing tag to help avoid accidental output
......
......@@ -3,7 +3,7 @@
http://www.question2answer.org/
File: qa-theme/Classic/qa-styles.css
Version: See define()s at top of qa-include/qa-base.php
Description: CSS file for included Classic theme
......@@ -13,7 +13,7 @@
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
......@@ -23,13 +23,13 @@
*/
/*
Theme URI:
Theme URI:
Theme Version: 1.5
Theme Date: 2012-09-11
Theme Author: Question2Answer
Theme Author URI: http://www.question2answer.org/
Theme License: GPLv2
Theme Update Check URI:
Theme Update Check URI:
*/
......@@ -248,7 +248,7 @@ h2 {font-size:16px; padding-top:12px; clear:both;}
.qa-vote-down-button {background-position:-17px 0; color:#38544e;}
.qa-vote-down-disabled {background-position:-17px -60px; color:#38544e;}
.qa-vote-down-button:hover {background-position:-17px -15px; color:#65968e;}
.qa-voted-up-button {background:url(vote-buttons.gif) no-repeat; border:0; font-size:1px; height:15px; width:17px;}
.qa-voted-up-button {background-position:0 -30px; color:#f3cb7f;}
.qa-voted-up-button:hover {background-position:0 -45px; color:#f3cb7f;}
......
/*
Theme Name: Snow
Theme URI:
Theme URI:
Theme Version: 1.3
Theme Date: 2013-11-13
Theme Author: Q2A Market
......@@ -8,7 +8,7 @@
Theme License: GPLv2
*/
/*---[ Start: global css ]---*/
.clearfix:after,
#qa-login-group:after,
......@@ -48,7 +48,7 @@
.qa-nav-main-list,
.qa-nav-sub-list,
.qa-nav-cat-item { display: block; }
/* End hide from IE-mac */
/* End hide from IE-mac */
:-moz-placeholder{
color:#aaa !important;
......@@ -99,7 +99,7 @@ input[type="text"],input[type="password"],textarea,select,checkbox,radio{
transition:box-shadow ease-in-out 0.5s, border ease-in-out 0.5s;
}
input[type="text"]:focus,input[type="password"]:focus,textarea:focus{
box-shadow:0 2px 2px 0 rgba(0,0,0,0.3) inset;
box-shadow:0 2px 2px 0 rgba(0,0,0,0.3) inset;
border:1px solid #00AAFF !important;
color:#333;
line-height: normal;
......@@ -137,7 +137,7 @@ h1 {
line-height:1.1em;
border-bottom:1px solid #ddd;
position:relative;
padding:14px 25px 5px 0;
padding:14px 25px 5px 0;
}
h2 {
font-size:16px;
......@@ -150,7 +150,7 @@ h2 {
border-radius: 3px;
box-shadow: 0 -25px 25px -25px rgba(255,255,255,1) inset;
border:1px solid #ddd;
text-shadow:1px 1px 0 rgba(255,255,255,1);
text-shadow:1px 1px 0 rgba(255,255,255,1);
}
h3{
margin:0 0 10px 0;
......@@ -214,7 +214,7 @@ p {
background: -o-linear-gradient(top, #1ca0cc 0%,#0099cc 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #1ca0cc 0%,#0099cc 100%); /* IE10+ */
background: linear-gradient(to bottom, #1ca0cc 0%,#0099cc 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1ca0cc', endColorstr='#0099cc',GradientType=0 ); /* IE6-8 */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1ca0cc', endColorstr='#0099cc',GradientType=0 ); /* IE6-8 */
}
/*---[ Begin: login bar css ]---*/
#qa-login-bar{
......@@ -495,7 +495,7 @@ div.header-banner{
-webkit-transition:all ease-in-out 0.5s;
-o-transition:all ease-in-out 0.5s;
-ms-transition:all ease-in-out 0.5s;
transition:all ease-in-out 0.5s;
transition:all ease-in-out 0.5s;
}
.qa-nav-main-link:hover,.qa-nav-main-selected {
text-decoration:none;
......@@ -504,7 +504,7 @@ div.header-banner{
-webkit-transition:all ease-in-out 0.2s;
-o-transition:all ease-in-out 0.2s;
-ms-transition:all ease-in-out 0.2s;
transition:all ease-in-out 0.2s;
transition:all ease-in-out 0.2s;
}
.qa-nav-main-custom-1 .qa-nav-main-link{
border-left:none;
......@@ -549,7 +549,7 @@ div.header-banner{
-webkit-transition:all ease-in-out 0.5s;
-o-transition:all ease-in-out 0.5s;
-ms-transition:all ease-in-out 0.5s;
transition:all ease-in-out 0.5s;
transition:all ease-in-out 0.5s;
}
.qa-nav-sub-link:hover,.qa-nav-sub-selected {
color:#000 !important;
......@@ -561,7 +561,7 @@ div.header-banner{
-webkit-transition:all ease-in-out 0.2s;
-o-transition:all ease-in-out 0.2s;
-ms-transition:all ease-in-out 0.2s;
transition:all ease-in-out 0.2s;
transition:all ease-in-out 0.2s;
}
.qa-nav-sub-hot .qa-nav-sub-link{
color:#af0000 !important;
......@@ -789,7 +789,7 @@ div.header-banner{
height:60px;
text-align:center;
margin-right:5px;
padding:0;
padding:0;
border-radius: 3px;
}
.qa-a-count-zero{
......@@ -897,7 +897,7 @@ div.header-banner{
}
.qa-error a{
color:#fff;
font-weight:bold;
font-weight:bold;
}
.qa-error a:hover{
text-decoration:underline;
......@@ -928,7 +928,7 @@ div.header-banner{
padding-left:20px;
}
.qa-footer-bottom-group{
background:#ddd;
background:#ddd;
border-top:1px solid #aaa;
}
.qa-footer {
......@@ -942,7 +942,7 @@ div.header-banner{
.qa-footer a, .qa-footer a:visited{
text-decoration:underline;
}
/* IE6
/* IE6
Widget wrappers */
.qa-widget-full {
clear:both;
......@@ -1887,7 +1887,7 @@ margin:2px 0;
.qa-c-item-content {
display:block;
margin-bottom:6px;
font-size:12px;
font-size:12px;
}
.qa-c-item-footer {
position:relative;
......@@ -2092,14 +2092,14 @@ padding:10px;
font-size:0;
margin:0px 8px 0px 4px;
vertical-align:middle;
}
}
.qa-favoriting .qa-waiting{
position:absolute;
position:absolute;
padding:0;
left:50%;
top:50%;
margin:-7px 0 0 -7px;
}
}
.qa-a-selection .qa-waiting {
position:absolute;
padding:0;
......
......@@ -2,12 +2,12 @@
class qa_html_theme extends qa_html_theme_base
{
{
function head_script() // change style of WYSIWYG editor to match theme better
{
qa_html_theme_base::head_script();
$this->output(
'<script type="text/javascript">',
"if (typeof qa_wysiwyg_editor_config == 'object')",
......@@ -15,15 +15,15 @@
'</script>'
);
}
function nav_user_search() // outputs login form if user not logged in
{
if (!qa_is_logged_in()) {
$login=@$this->content['navigation']['user']['login'];
if (isset($login) && !QA_FINAL_EXTERNAL_USERS) {
$this->output(
'<!--[Begin: login form]-->',
'<!--[Begin: login form]-->',
'<form id="qa-loginform" action="'.$login['url'].'" method="post">',
'<input type="text" id="qa-userid" name="emailhandle" placeholder="'.trim(qa_lang_html(qa_opt('allow_login_email_only') ? 'users/email_label' : 'users/email_handle_label'), ':').'" />',
'<input type="password" id="qa-password" name="password" placeholder="'.trim(qa_lang_html('users/password_label'), ':').'" />',
......@@ -31,18 +31,18 @@
'<label for="qa-rememberme" id="qa-remember">'.qa_lang_html('users/remember').'</label></div>',
'<input type="hidden" name="code" value="'.qa_html(qa_get_form_security_code('login')).'"/>',
'<input type="submit" value="'.$login['label'].'" id="qa-login" name="dologin" />',
'</form>',
'</form>',
'<!--[End: login form]-->'
);
unset($this->content['navigation']['user']['login']); // removes regular navigation link to log in page
}
}
qa_html_theme_base::nav_user_search();
}
function logged_in()
function logged_in()
{
if (qa_is_logged_in()) // output user avatar to login bar
$this->output(
......@@ -53,17 +53,17 @@
qa_get_logged_in_user_field('avatarblobid'), qa_get_logged_in_user_field('avatarwidth'), qa_get_logged_in_user_field('avatarheight'),
24, true),
'</div>'
);
);
qa_html_theme_base::logged_in();
if (qa_is_logged_in()) { // adds points count after logged in username
$userpoints=qa_get_logged_in_points();
$pointshtml=($userpoints==1)
? qa_lang_html_sub('main/1_point', '1', '1')
: qa_lang_html_sub('main/x_points', qa_html(number_format($userpoints)));
$this->output(
'<span class="qa-logged-in-points">',
'('.$pointshtml.')',
......@@ -71,14 +71,14 @@
);
}
}
function body_header() // adds login bar, user navigation and search at top of page in place of custom header content
{
$this->output('<div id="qa-login-bar"><div id="qa-login-group">');
$this->nav_user_search();
$this->output('</div></div>');
}
function header_custom() // allows modification of custom element shown inside header after logo
{
if (isset($this->content['body_header'])) {
......@@ -87,12 +87,12 @@
$this->output('</div>');
}
}
function header() // removes user navigation and search from header and replaces with custom header content. Also opens new <div>s
{
{
$this->output('<div class="qa-header">');
$this->logo();
$this->logo();
$this->header_clear();
$this->header_custom();
......@@ -103,53 +103,53 @@
$this->nav_main_sub();
}
function sidepanel() // removes sidebar for user profile pages
{
if ($this->template!='user')
qa_html_theme_base::sidepanel();
}
function footer() // prevent display of regular footer content (see body_suffix()) and replace with closing new <div>s
{
$this->output('</div> <!-- END main-wrapper -->');
$this->output('</div> <!-- END main-shadow -->');
}
$this->output('</div> <!-- END main-shadow -->');
}
function title() // add RSS feed icon after the page title
{
qa_html_theme_base::title();
$feed=@$this->content['feed'];
if (!empty($feed))
$this->output('<a href="'.$feed['url'].'" title="'.@$feed['label'].'"><img src="'.$this->rooturl.'images/rss.jpg" alt="" width="16" height="16" border="0" class="qa-rss-icon"/></a>');
}
function q_item_stats($q_item) // add view count to question list
{
$this->output('<div class="qa-q-item-stats">');
$this->voting($q_item);
$this->a_count($q_item);
qa_html_theme_base::view_count($q_item);
$this->output('</div>');
}
function view_count($q_item) // prevent display of view count in the usual place
{
{
if ($this->template=='question')
qa_html_theme_base::view_count($q_item);
}
function body_suffix() // to replace standard Q2A footer
{
$this->output('<div class="qa-footer-bottom-group">');
qa_html_theme_base::footer();
$this->output('</div> <!-- END footer-bottom-group -->', '');
}
function attribution()
{
$this->output(
......@@ -160,7 +160,7 @@
qa_html_theme_base::attribution();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment